index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="作业单位" prop="workUnit">
  5. <el-select v-model="queryParams.workUnit" placeholder="请选择作业单位" clearable size="small">
  6. <el-option
  7. v-for="dict in workUnitOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="parseInt(dict.dictValue)"
  11. ></el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="作业区域" prop="workArea">
  15. <el-select v-model="queryParams.workArea" placeholder="请选择作业区域" clearable size="small">
  16. <el-option
  17. v-for="dict in workAreaOptions"
  18. :key="dict.dictValue"
  19. :label="dict.dictLabel"
  20. :value="parseInt(dict.dictValue)"
  21. ></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="单元号" prop="unitNumber">
  25. <el-select v-model="queryParams.unitNumber" placeholder="请选择单元号" clearable size="small">
  26. <el-option
  27. v-for="dict in unitNumberOptions"
  28. :key="dict.dictValue"
  29. :label="dict.dictLabel"
  30. :value="parseInt(dict.dictValue)"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="楼层位置" prop="floorLocation">
  35. <el-select v-model="queryParams.floorLocation" placeholder="请选择楼层位置" clearable size="small">
  36. <el-option
  37. v-for="dict in floorLocationOptions"
  38. :key="dict.dictValue"
  39. :label="dict.dictLabel"
  40. :value="parseInt(dict.dictValue)"
  41. ></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label=" 作业开始时间" prop="workStartTime">
  45. <el-date-picker clearable size="small" style="width: 200px"
  46. v-model="queryParams.workStartTime"
  47. type="date"
  48. value-format="yyyy-MM-dd"
  49. placeholder="选择 作业开始时间">
  50. </el-date-picker>
  51. </el-form-item>
  52. <el-form-item label="作业结束时间" prop="workEndTime">
  53. <el-date-picker clearable size="small" style="width: 200px"
  54. v-model="queryParams.workEndTime"
  55. type="date"
  56. value-format="yyyy-MM-dd"
  57. placeholder="选择作业结束时间">
  58. </el-date-picker>
  59. </el-form-item>
  60. <el-form-item label="联系人" prop="contact">
  61. <el-input
  62. v-model="queryParams.contact"
  63. placeholder="请输入联系人"
  64. clearable
  65. size="small"
  66. @keyup.enter.native="handleQuery"
  67. />
  68. </el-form-item>
  69. <el-form-item label="联系方式" prop="phonenumber">
  70. <el-input
  71. v-model="queryParams.phonenumber"
  72. placeholder="请输入联系方式"
  73. clearable
  74. size="small"
  75. @keyup.enter.native="handleQuery"
  76. />
  77. </el-form-item>
  78. <el-form-item>
  79. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  80. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  81. </el-form-item>
  82. </el-form>
  83. <el-row :gutter="10" class="mb8">
  84. <el-col :span="1.5">
  85. <el-button
  86. type="primary"
  87. icon="el-icon-plus"
  88. size="mini"
  89. @click="handleAdd"
  90. v-hasPermi="['invoice:bookingworkticket:add']"
  91. >预约</el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="success"
  96. icon="el-icon-edit"
  97. size="mini"
  98. :disabled="single"
  99. @click="handleUpdate"
  100. v-hasPermi="['invoice:bookingworkticket:edit']"
  101. >修改</el-button>
  102. </el-col>
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="info"
  107. icon="el-icon-upload2"
  108. size="mini"
  109. @click="handleImport"
  110. v-hasPermi="['invoice:bookingworkticket:edit']"
  111. >导入</el-button>
  112. </el-col>
  113. <el-col :span="1.5">
  114. <el-button
  115. type="warning"
  116. icon="el-icon-download"
  117. size="mini"
  118. @click="handleExport"
  119. v-hasPermi="['invoice:bookingworkticket:export']"
  120. >导出</el-button>
  121. </el-col>
  122. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  123. </el-row>
  124. <el-table v-loading="loading" :data="bookingworkticketList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  125. <el-table-column type="selection" width="55" align="center" />
  126. <el-table-column label="作业单位" align="center" prop="workUnit" :formatter="workUnitFormat"/>
  127. <el-table-column label="作业区域" align="center" prop="workArea" :formatter="workAreaFormat"/>
  128. <el-table-column label="单元号" align="center" prop="unitNumber" :formatter="unitNumberFormat"/>
  129. <el-table-column label="楼层位置" align="center" prop="floorLocation" :formatter="floorLocationFormat"/>
  130. <el-table-column label=" 作业开始时间" align="center" prop="workStartTime" width="100">
  131. <template slot-scope="scope">
  132. <span>{{ parseTime(scope.row.workStartTime, '{y}-{m}-{d}') }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="作业结束时间" align="center" prop="workEndTime" width="100">
  136. <template slot-scope="scope">
  137. <span>{{ parseTime(scope.row.workEndTime, '{y}-{m}-{d}') }}</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="联系人" align="center" prop="contact" :show-overflow-tooltip="true"/>
  141. <el-table-column label="联系方式" align="center" prop="phonenumber" :show-overflow-tooltip="true"/>
  142. <el-table-column label="状态" align="center" prop="status" width="100" :formatter="statusFormat" />
  143. <el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
  144. <template slot-scope="scope">
  145. <el-button
  146. size="mini"
  147. type="text"
  148. icon="el-icon-edit"
  149. @click="handleUpdate(scope.row)"
  150. v-hasPermi="['invoice:bookingworkticket:edit']"
  151. >修改</el-button>
  152. <el-button
  153. v-if="scope.row.status== 0"
  154. size="mini"
  155. type="text"
  156. icon="el-icon-edit"
  157. @click="handleDelete(scope.row)"
  158. >删除</el-button>
  159. <el-button
  160. size="mini"
  161. type="text"
  162. icon="el-icon-s-claim"
  163. @click="signature(scope.row)"
  164. v-hasPermi="['invoice:bookingworkticket:signature']"
  165. >签字</el-button>
  166. <el-button
  167. size="mini"
  168. type="text"
  169. icon="el-icon-s-promotion"
  170. @click="association(scope.row)"
  171. v-hasRole="['dbbz','admin']"
  172. >关联票号</el-button>
  173. <el-button
  174. size="mini"
  175. type="text"
  176. icon="el-icon-share"
  177. @click="billSee(scope.row)"
  178. >票据预览</el-button>
  179. <el-button
  180. type="text"
  181. size="mini"
  182. @click="addAprrove(scope.row)"
  183. >{{ $t('预约开票申请') }}</el-button>
  184. </template>
  185. </el-table-column>
  186. </el-table>
  187. <pagination
  188. v-show="total>0"
  189. :total="total"
  190. :page.sync="queryParams.pageNum"
  191. :limit.sync="queryParams.pageSize"
  192. @pagination="getList"
  193. />
  194. <!-- 添加或修改预约作业票台账对话框 -->
  195. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  196. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  197. <el-row>
  198. <el-col :span="12">
  199. <el-form-item label="承包商" prop="workUnit">
  200. <el-select v-model="form.workUnit" placeholder="请选择作业单位">
  201. <el-option
  202. v-for="dict in workUnitOptions"
  203. :key="dict.dictValue"
  204. :label="dict.dictLabel"
  205. :value="parseInt(dict.dictValue)"
  206. ></el-option>
  207. </el-select>
  208. </el-form-item>
  209. </el-col>
  210. <el-col :span="12">
  211. <el-form-item label="作业区域" prop="workArea">
  212. <el-select v-model="form.workArea" placeholder="请选择作业区域">
  213. <el-option
  214. v-for="dict in workAreaOptions"
  215. :key="dict.dictValue"
  216. :label="dict.dictLabel"
  217. :value="parseInt(dict.dictValue)"
  218. ></el-option>
  219. </el-select>
  220. </el-form-item>
  221. </el-col>
  222. </el-row>
  223. <el-row>
  224. <el-col :span="12">
  225. <el-form-item label="单元号" prop="unitNumber">
  226. <el-select v-model="form.unitNumber" placeholder="请选择单元号">
  227. <el-option
  228. v-for="dict in unitNumberOptions"
  229. :key="dict.dictValue"
  230. :label="dict.dictLabel"
  231. :value="parseInt(dict.dictValue)"
  232. ></el-option>
  233. </el-select>
  234. </el-form-item>
  235. </el-col>
  236. <el-col :span="12">
  237. <el-form-item label="楼层位置" prop="floorLocation">
  238. <el-select v-model="form.floorLocation" placeholder="请选择楼层位置">
  239. <el-option
  240. v-for="dict in floorLocationOptions"
  241. :key="dict.dictValue"
  242. :label="dict.dictLabel"
  243. :value="parseInt(dict.dictValue)"
  244. ></el-option>
  245. </el-select>
  246. </el-form-item>
  247. </el-col>
  248. </el-row>
  249. <el-row>
  250. <el-col :span="12">
  251. <el-form-item label=" 作业开始" prop="workStartTime">
  252. <el-date-picker clearable size="small" style="width: 190px"
  253. v-model="form.workStartTime"
  254. type="date"
  255. value-format="yyyy-MM-dd"
  256. placeholder="选择 作业开始时间">
  257. </el-date-picker>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="12">
  261. <el-form-item label="作业结束" prop="workEndTime">
  262. <el-date-picker clearable size="small" style="width: 190px"
  263. v-model="form.workEndTime"
  264. type="date"
  265. value-format="yyyy-MM-dd"
  266. placeholder="选择作业结束时间">
  267. </el-date-picker>
  268. </el-form-item>
  269. </el-col>
  270. </el-row>
  271. <el-row>
  272. <el-col :span="12">
  273. <el-form-item label="用户单位" prop="userUnit">
  274. <el-select v-model="form.userUnit" placeholder="请选择用户单位">
  275. <el-option
  276. v-for="dict in userUnitOptions"
  277. :key="dict.dictValue"
  278. :label="dict.dictLabel"
  279. :value="parseInt(dict.dictValue)"
  280. ></el-option>
  281. </el-select>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="12">
  285. <el-form-item label="用户主管" prop="userMg">
  286. <el-select v-model="form.userMg" placeholder="请选择用户单位">
  287. <el-option
  288. v-for="dict in userMgOptions"
  289. :key="dict.dictValue"
  290. :label="dict.dictLabel"
  291. :value="parseInt(dict.dictValue)"
  292. ></el-option>
  293. </el-select>
  294. </el-form-item>
  295. </el-col>
  296. </el-row>
  297. </el-form>
  298. <el-form v-for="(ruleForm, index) in ruleForm" :key="index" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  299. <el-divider><i class="el-icon-more" style="color:green;font-size:100%"></i><i class="el-icon-more" style="color:green;font-size:100%"></i> <span ><font color="green">关联的作业内容</font></span>
  300. <i class="el-icon-more" style="color:green;font-size:100%"></i><i class="el-icon-more" style="color:green;font-size:100%"></i></el-divider>
  301. <el-form-item label="作业内容描述" prop="workDescription">
  302. <el-input v-model="ruleForm.workDescription"></el-input>
  303. </el-form-item>
  304. <el-row>
  305. <el-col :span="12">
  306. <el-form-item label="作业类型" prop="workType">
  307. <el-select v-model="ruleForm.workType" placeholder="请选择作业类型" clearable size="small">
  308. <el-option
  309. v-for="dict in workTypeOptions"
  310. :key="dict.dictValue"
  311. :label="dict.dictLabel"
  312. :value="parseInt(dict.dictValue)"
  313. />
  314. </el-select>
  315. </el-form-item>
  316. </el-col>
  317. <el-col :span="12">
  318. <el-form-item label="风险等级" prop="riskLevel">
  319. <el-select v-model="ruleForm.riskLevel" placeholder="请选择风险等级" clearable size="small">
  320. <el-option
  321. v-for="dict in riskLevelOptions"
  322. :key="dict.dictValue"
  323. :label="dict.dictLabel"
  324. :value="parseInt(dict.dictValue)"
  325. />
  326. </el-select>
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. <el-row>
  331. <el-col :span="12">
  332. <el-form-item label="作业人数" prop="workPeopleNumber">
  333. <el-input v-model="ruleForm.workPeopleNumber"></el-input>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="12">
  337. <el-form-item label="监护人单位" prop="guardianUnit">
  338. <el-select v-model="ruleForm.guardianUnit" placeholder="请选择监护人单位" clearable size="small">
  339. <el-option
  340. v-for="dict in guardianUnitOptions"
  341. :key="dict.dictValue"
  342. :label="dict.dictLabel"
  343. :value="parseInt(dict.dictValue)"
  344. />
  345. </el-select>
  346. </el-form-item>
  347. </el-col>
  348. </el-row>
  349. <el-form-item label="预计作业时间" prop="estimateWorktime">
  350. <el-input v-model="ruleForm.estimateWorktime" style="width: 190px"></el-input>
  351. </el-form-item>
  352. </el-form>
  353. <el-button @click="resetForm1()">重置</el-button>
  354. <el-button @click="add">+</el-button>
  355. <el-button @click="reduce" :disabled="flag">-</el-button>
  356. <div slot="footer" class="dialog-footer">
  357. <el-button type="primary" @click="submitForm">确 定</el-button>
  358. <el-button @click="cancel">取 消</el-button>
  359. </div>
  360. </el-dialog>
  361. <!-- 用户导入对话框 -->
  362. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  363. <el-upload
  364. ref="upload"
  365. :limit="1"
  366. accept=".xlsx, .xls"
  367. :headers="upload.headers"
  368. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  369. :disabled="upload.isUploading"
  370. :on-progress="handleFileUploadProgress"
  371. :on-success="handleFileSuccess"
  372. :auto-upload="false"
  373. drag
  374. >
  375. <i class="el-icon-upload"></i>
  376. <div class="el-upload__text">
  377. 将文件拖到此处,或
  378. <em>点击上传</em>
  379. </div>
  380. <div class="el-upload__tip" slot="tip">
  381. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  382. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  383. </div>
  384. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  385. </el-upload>
  386. <div slot="footer" class="dialog-footer">
  387. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  388. <el-button @click="upload.open = false">取 消</el-button>
  389. </div>
  390. </el-dialog>
  391. <add-approve v-if="addAprroveVisible" ref="addApprove" @refreshDataList="getList"></add-approve>
  392. </div>
  393. </template>
  394. <script>
  395. import { listBookingworkticket, getBookingworkticket, delBookingworkticket, addBookingworkticket, updateBookingworkticket, exportBookingworkticket, importTemplate} from "@/api/invoice/bookingworkticket";
  396. import { listWorkcontent, getWorkcontent, delWorkcontent, addWorkcontent, updateWorkcontent, exportWorkcontent,getWorkcontentBybookingticketId} from "@/api/invoice/workcontent";
  397. import { treeselect } from "@/api/system/dept";
  398. import { getToken } from "@/utils/auth";
  399. import Treeselect from "@riophae/vue-treeselect";
  400. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  401. import AddApprove from "../approveinvoice/index"
  402. export default {
  403. name: "Bookingworkticket",
  404. components: { Treeselect,AddApprove},
  405. data() {
  406. return {
  407. tInvoiceWorkcontentList:[],
  408. //作业内容表头
  409. tabletou:['作业类型','风险等级','作业内容描述','作业人员数','作业预计时间','监护人单位'],
  410. //用户名和承包商名
  411. username:"",
  412. addAprroveVisible: false,
  413. hisAprroveVisible: false,
  414. //bookticked关联ID
  415. btid:"",
  416. // 遮罩层
  417. loading: true,
  418. // 选中数组
  419. ids: [],
  420. // 非单个禁用
  421. single: true,
  422. // 非多个禁用
  423. multiple: true,
  424. // 显示搜索条件
  425. showSearch: false,
  426. // 总条数
  427. total: 0,
  428. // 预约作业票台账表格数据
  429. bookingworkticketList: [],
  430. // 弹出层标题
  431. title: "",
  432. // 部门树选项
  433. deptOptions: undefined,
  434. clientHeight:300,
  435. // 状态字典
  436. statusOptions: [],
  437. // 作业单位字典
  438. workUnitOptions: [],
  439. // 作业区域字典
  440. workAreaOptions: [],
  441. // 单元号字典
  442. unitNumberOptions: [],
  443. // 楼层字典
  444. floorLocationOptions: [],
  445. // 用户单位字典
  446. userUnitOptions: [],
  447. // 用户主管字典
  448. userMgOptions: [],
  449. // 作业类型字典
  450. workTypeOptions: [],
  451. // 风险等级字典
  452. riskLevelOptions: [],
  453. // 监护人单位字典
  454. guardianUnitOptions: [],
  455. // 是否显示弹出层
  456. open: false,
  457. // 用户导入参数
  458. upload: {
  459. // 是否显示弹出层(用户导入)
  460. open: false,
  461. // 弹出层标题(用户导入)
  462. title: "",
  463. // 是否禁用上传
  464. isUploading: false,
  465. // 是否更新已经存在的用户数据
  466. updateSupport: 0,
  467. // 设置上传的请求头部
  468. headers: { Authorization: "Bearer " + getToken() },
  469. // 上传的地址
  470. url: process.env.VUE_APP_BASE_API + "/invoice/bookingworkticket/importData"
  471. },
  472. // 查询参数
  473. queryParams: {
  474. pageNum: 1,
  475. pageSize: 20,
  476. workUnit: null,
  477. workArea: null,
  478. unitNumber: null,
  479. floorLocation: null,
  480. workStartTime: null,
  481. workEndTime: null,
  482. createrCode: null,
  483. createdate: null,
  484. updaterCode: null,
  485. updatedate: null,
  486. contact: null,
  487. phonenumber: null,
  488. status: null,
  489. deptId: null,
  490. userMg: null,
  491. userUnit: null
  492. },
  493. // 表单参数
  494. form: { },
  495. ruleForm: [{} ],
  496. flag: true,
  497. // 表单校验
  498. rules: {
  499. workUnit: [
  500. { required: true, message: "作业单位不能为空", trigger: "blur" }
  501. ],
  502. riskLevel: [
  503. { required: true, message: "风险等级不能为空", trigger: "blur" }
  504. ],
  505. }
  506. };
  507. },
  508. watch: {
  509. // 根据名称筛选部门树
  510. deptName(val) {
  511. this.$refs.tree.filter(val);
  512. }
  513. },
  514. created() {
  515. //设置表格高度对应屏幕高度
  516. this.$nextTick(() => {
  517. this.clientHeight = document.body.clientHeight -250
  518. })
  519. this.getList();
  520. this.getTreeselect();
  521. this.getDicts("booking_work_status").then(response => {
  522. this.statusOptions = response.data;
  523. });
  524. this.getDicts("book_work_area").then(response => {
  525. this.workAreaOptions = response.data;
  526. });
  527. this.getDicts("book_unit_number").then(response => {
  528. this.unitNumberOptions = response.data;
  529. });
  530. this.getDicts("book_floor_location").then(response => {
  531. this.floorLocationOptions = response.data;
  532. });
  533. this.getDicts("book_user_mg").then(response => {
  534. this.userMgOptions = response.data;
  535. });
  536. this.getDicts("book_user_unit").then(response => {
  537. this.userUnitOptions = response.data;
  538. });
  539. this.getDicts("book_work_unit").then(response => {
  540. this.workUnitOptions = response.data;
  541. });
  542. this.getDicts("book_work_type").then(response => {
  543. this.workTypeOptions = response.data;
  544. });
  545. this.getDicts("book_risk_level").then(response => {
  546. this.riskLevelOptions = response.data;
  547. });
  548. this.getDicts("book_guardian_unit").then(response => {
  549. this.guardianUnitOptions = response.data;
  550. });
  551. },
  552. methods: {
  553. addAprrove(row) {
  554. var rows = row ? [row] : this.bookingworkticketList.map(item => {
  555. return item
  556. })
  557. for (let i = 0; i < rows.length; i++) {
  558. if(rows[i].status != 0){
  559. this.$alert(this.$t('预约已确认,无法重复申请'), this.$t('提示'), {
  560. type: 'warning'
  561. })
  562. return
  563. } else if (rows[i].status != 0&&rows[i].status != 5) {
  564. this.$alert(this.$t('预约正在申请中,无法重复申请'), this.$t('提示'), {
  565. type: 'warning'
  566. })
  567. return
  568. }
  569. }
  570. this.$nextTick(() => {
  571. this.$refs.addApprove.init(rows)
  572. })
  573. this.addAprroveVisible = true
  574. },
  575. // 表单添加一行
  576. add() {
  577. var arr = { }
  578. this.ruleForm.push(arr)
  579. this.flags()
  580. },
  581. // 表单减少一行
  582. reduce() {
  583. this.ruleForm.length = this.ruleForm.length - 1
  584. this.flags()
  585. },
  586. // 判断数组长度
  587. flags() {
  588. if (this.ruleForm.length < 2) {
  589. this.flag = true
  590. } else {
  591. //先赋值为true再赋为false, 不然会没反应
  592. this.flag = true
  593. this.flag = false
  594. }
  595. },
  596. // 重置方法
  597. resetForm1() {
  598. this.ruleForm = [{}]
  599. },
  600. /** 查询预约作业票台账列表 */
  601. getList() {
  602. this.loading = true;
  603. listBookingworkticket(this.queryParams).then(response => {
  604. this.bookingworkticketList=response.rows;
  605. for (let i = 0; i < this.bookingworkticketList.length; i++) {
  606. if( this.bookingworkticketList[i].tInvoiceWorkcontentList) {
  607. this.tInvoiceWorkcontentList = this.bookingworkticketList[i].tInvoiceWorkcontentList
  608. }
  609. }
  610. this.tInvoiceWorkcontentList.tabletou=this.tabletou;
  611. this.total = response.total;
  612. this.loading = false;
  613. console.log(this.tInvoiceWorkcontentList)
  614. });
  615. },
  616. /** 查询部门下拉树结构 */
  617. getTreeselect() {
  618. treeselect().then(response => {
  619. this.deptOptions = response.data;
  620. });
  621. },
  622. // 状态字典翻译
  623. statusFormat(row, column) {
  624. return this.selectDictLabel(this.statusOptions, row.status);
  625. },
  626. // 字典翻译
  627. workUnitFormat(row, column) {
  628. return this.selectDictLabel(this.workUnitOptions, row.workUnit);
  629. },
  630. // 字典翻译
  631. workAreaFormat(row, column) {
  632. return this.selectDictLabel(this.workAreaOptions, row.workArea);
  633. },
  634. // 字典翻译
  635. unitNumberFormat(row, column) {
  636. return this.selectDictLabel(this.unitNumberOptions, row.unitNumber);
  637. },
  638. // 字典翻译
  639. floorLocationFormat(row, column) {
  640. return this.selectDictLabel(this.floorLocationOptions, row.floorLocation);
  641. },
  642. // 字典翻译
  643. userMgFormat(row, column) {
  644. return this.selectDictLabel(this.userMgOptions, row.userMg);
  645. },
  646. // 字典翻译
  647. userUnitFormat(row, column) {
  648. return this.selectDictLabel(this.userUnitOptions, row.userUnit);
  649. },
  650. // 字典翻译
  651. workTypeFormat(row, column) {
  652. return this.selectDictLabel(this.workTypeOptions, row.workType);
  653. },
  654. // 字典翻译
  655. riskLevelFormat(row, column) {
  656. return this.selectDictLabel(this.riskLevelOptions, row.riskLevel);
  657. },
  658. // 字典翻译
  659. guardianUnitFormat(row, column) {
  660. return this.selectDictLabel(this.guardianUnitOptions, row.guardianUnit);
  661. },
  662. // 取消按钮
  663. cancel() {
  664. this.open = false;
  665. this.reset();
  666. },
  667. // 表单重置
  668. reset() {
  669. this.form = {
  670. id: null,
  671. workUnit: null,
  672. workArea: null,
  673. unitNumber: null,
  674. floorLocation: null,
  675. workStartTime: null,
  676. workEndTime: null,
  677. delFlag: null,
  678. createrCode: null,
  679. createdate: null,
  680. updaterCode: null,
  681. updatedate: null,
  682. contact: null,
  683. phonenumber: null,
  684. status: 0,
  685. deptId: null,
  686. userMg: null,
  687. userUnit:null
  688. };
  689. this.resetForm("form");
  690. },
  691. /** 搜索按钮操作 */
  692. handleQuery() {
  693. this.queryParams.pageNum = 1;
  694. this.getList();
  695. },
  696. /** 重置按钮操作 */
  697. resetQuery() {
  698. this.resetForm("queryForm");
  699. this.handleQuery();
  700. },
  701. // 多选框选中数据
  702. handleSelectionChange(selection) {
  703. this.ids = selection.map(item => item.id)
  704. this.single = selection.length!==1
  705. this.multiple = !selection.length
  706. },
  707. /** 新增按钮操作 */
  708. handleAdd() {
  709. this.reset();
  710. this.resetForm1();
  711. var roles =this.$store.state.user.roles
  712. this.open = true;
  713. this.title = "添加预约作业票台账";
  714. },
  715. /** 修改按钮操作 */
  716. handleUpdate(row) {
  717. this.reset();
  718. const id = row.id || this.ids
  719. getBookingworkticket(id).then(response => {
  720. this.form = response.data;
  721. this.open = true;
  722. this.title = "修改预约作业票台账";
  723. this.ruleForm=response.data.tInvoiceWorkcontentList
  724. });
  725. },
  726. /** 提交按钮 */
  727. submitForm() {
  728. this.$refs["form"].validate(valid => {
  729. if (valid) {
  730. if (this.form.id != null) {
  731. this.form.tInvoiceWorkcontentList=this.ruleForm
  732. updateBookingworkticket(this.form).then(response => {
  733. this.msgSuccess("修改成功");
  734. this.open = false;
  735. this.getList();
  736. });
  737. } else {
  738. this.form.tInvoiceWorkcontentList=this.ruleForm
  739. addBookingworkticket(this.form).then(response => {
  740. this.msgSuccess("新增成功");
  741. this.open = false;
  742. this.getList();
  743. this.resetForm1();
  744. });
  745. }
  746. }
  747. });
  748. },
  749. /** 删除按钮操作 */
  750. handleDelete(row) {
  751. const ids = row.id || this.ids;
  752. this.$confirm('是否确认删除?', "警告", {
  753. confirmButtonText: "确定",
  754. cancelButtonText: "取消",
  755. type: "warning"
  756. }).then(function() {
  757. return delBookingworkticket(ids);
  758. }).then(() => {
  759. this.getList();
  760. this.msgSuccess("删除成功");
  761. })
  762. },
  763. /** 导出按钮操作 */
  764. handleExport() {
  765. const queryParams = this.queryParams;
  766. this.$confirm('是否确认导出所有预约作业票台账数据项?', "警告", {
  767. confirmButtonText: "确定",
  768. cancelButtonText: "取消",
  769. type: "warning"
  770. }).then(function() {
  771. return exportBookingworkticket(queryParams);
  772. }).then(response => {
  773. this.download(response.msg);
  774. })
  775. },
  776. /** 导入按钮操作 */
  777. handleImport() {
  778. this.upload.title = "用户导入";
  779. this.upload.open = true;
  780. },
  781. /** 下载模板操作 */
  782. importTemplate() {
  783. importTemplate().then(response => {
  784. this.download(response.msg);
  785. });
  786. },
  787. // 文件上传中处理
  788. handleFileUploadProgress(event, file, fileList) {
  789. this.upload.isUploading = true;
  790. },
  791. // 文件上传成功处理
  792. handleFileSuccess(response, file, fileList) {
  793. this.upload.open = false;
  794. this.upload.isUploading = false;
  795. this.$refs.upload.clearFiles();
  796. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  797. this.getList();
  798. },
  799. // 提交上传文件
  800. submitFileForm() {
  801. this.$refs.upload.submit();
  802. },
  803. //关联票号
  804. association(){
  805. console.log(this.$store.state.user)
  806. var userName = this.$store.state.user.roles;
  807. this.msgSuccess(userName);
  808. }
  809. }
  810. };
  811. </script>