index.vue 27 KB

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