workList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <el-dialog
  3. :visible.sync="visible"
  4. :close-on-click-modal="true"
  5. :close-on-press-escape="false"
  6. append-to-body
  7. width="80vw"
  8. :fullscreen="fullscreen"
  9. class="fullscreen"
  10. >
  11. <template slot="title">
  12. <modalTitle
  13. title=""
  14. @setFullscreen="fullscreen = !fullscreen"
  15. ></modalTitle>
  16. </template>
  17. <div class="patrol">
  18. <div class="ele-body">
  19. <el-card shadow="never">
  20. <div class="switch">
  21. <div class="switch_left">
  22. <ul>
  23. <li
  24. v-for="item in tabOptions"
  25. :key="item.key"
  26. :class="{ active: activeComp == item.key }"
  27. @click="activeChange(item.key)"
  28. >
  29. {{ item.name }}
  30. </li>
  31. </ul>
  32. </div>
  33. </div>
  34. <ele-pro-table
  35. ref="table"
  36. :columns="columns()"
  37. :datasource="datasource"
  38. :current.sync="current"
  39. highlight-current-row
  40. row-key="id"
  41. >
  42. </ele-pro-table>
  43. </el-card>
  44. </div>
  45. </div>
  46. <template v-slot:footer>
  47. <el-button @click="visible = false">取消</el-button>
  48. <el-button type="primary" @click="add"> 确认 </el-button>
  49. </template>
  50. </el-dialog>
  51. </template>
  52. <script>
  53. import modalTitle from '@/components/modalTitle.vue';
  54. import {
  55. getWorkOrderPage,
  56. getWordOrderDetail
  57. } from '@/api/maintenance/patrol_maintenance';
  58. import { getWorkOrderList } from '@/api/maintenance/repair';
  59. export default {
  60. components: { modalTitle },
  61. data() {
  62. return {
  63. fullscreen: false,
  64. visible: false,
  65. activeComp: '1',
  66. tabOptions: [
  67. { key: '1', name: '巡点检工单' },
  68. { key: '2', name: '保养工单' },
  69. { key: '3', name: '维修工单' }
  70. ],
  71. current: {},
  72. patrolColumns: [
  73. {
  74. columnKey: 'index',
  75. label: '序号',
  76. type: 'index',
  77. width: 55,
  78. align: 'center',
  79. showOverflowTooltip: true,
  80. fixed: 'left'
  81. },
  82. {
  83. columnKey: 'code',
  84. slot: 'code',
  85. prop: 'code',
  86. label: '工单单号',
  87. align: 'center',
  88. showOverflowTooltip: true,
  89. minWidth: 140
  90. },
  91. {
  92. prop: 'planCode',
  93. label: '计划单号',
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. minWidth: 140
  97. },
  98. {
  99. prop: 'planName',
  100. label: '巡点检名称',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. minWidth: 120
  104. },
  105. {
  106. prop: 'executeGroupName',
  107. label: '巡点检部门',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 120
  111. },
  112. {
  113. prop: 'executeUserName',
  114. label: '巡点检人员',
  115. align: 'center',
  116. showOverflowTooltip: true
  117. },
  118. {
  119. prop: 'ruleName',
  120. label: '规则名称',
  121. align: 'center',
  122. showOverflowTooltip: true
  123. },
  124. {
  125. prop: 'createTime',
  126. label: '工单生成时间',
  127. align: 'center',
  128. // sortable: true,
  129. showOverflowTooltip: true,
  130. width: 170
  131. },
  132. {
  133. prop: 'acceptTime',
  134. label: '开工时间',
  135. align: 'center',
  136. showOverflowTooltip: true
  137. },
  138. {
  139. prop: 'finishTime',
  140. label: '报工时间',
  141. align: 'center',
  142. showOverflowTooltip: true
  143. },
  144. {
  145. columnKey: 'orderHour',
  146. label: '实际工时(分钟)',
  147. align: 'center',
  148. resizable: false,
  149. showOverflowTooltip: true,
  150. minWidth: 120,
  151. formatter: (row) => {
  152. if (row.finishTime && row.acceptTime) {
  153. return parseInt(
  154. (new Date(row.finishTime).getTime() -
  155. new Date(row.acceptTime).getTime()) /
  156. 60000
  157. );
  158. }
  159. }
  160. },
  161. {
  162. prop: 'orderStatus',
  163. label: '状态',
  164. align: 'center',
  165. showOverflowTooltip: true,
  166. formatter: (row) => {
  167. return {
  168. 0: '待接收',
  169. 1: '已接收',
  170. 2: '执行中',
  171. 3: '已完成'
  172. }[row.orderStatus];
  173. }
  174. },
  175. {
  176. prop: 'acceptanceStatus',
  177. label: '执行结果',
  178. align: 'center',
  179. showOverflowTooltip: true,
  180. formatter(row) {
  181. return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
  182. }
  183. }
  184. ],
  185. equipmentColumns: [
  186. {
  187. columnKey: 'index',
  188. label: '序号',
  189. type: 'index',
  190. width: 55,
  191. align: 'center',
  192. showOverflowTooltip: true,
  193. fixed: 'left'
  194. },
  195. {
  196. columnKey: 'code',
  197. slot: 'code',
  198. prop: 'code',
  199. label: '工单单号',
  200. align: 'center',
  201. showOverflowTooltip: true,
  202. minWidth: 140
  203. },
  204. {
  205. prop: 'planCode',
  206. label: '计划单号',
  207. align: 'center',
  208. showOverflowTooltip: true,
  209. slot: 'planCode',
  210. minWidth: 140
  211. },
  212. {
  213. prop: 'planName',
  214. label: '保养名称',
  215. align: 'center',
  216. showOverflowTooltip: true,
  217. minWidth: 120
  218. },
  219. {
  220. prop: 'executeGroupName',
  221. label: '保养部门',
  222. align: 'center',
  223. showOverflowTooltip: true,
  224. minWidth: 120
  225. },
  226. {
  227. prop: 'executeUserName',
  228. label: '保养人员',
  229. align: 'center',
  230. showOverflowTooltip: true
  231. },
  232. {
  233. prop: 'ruleName',
  234. label: '规则名称',
  235. align: 'center',
  236. showOverflowTooltip: true
  237. },
  238. {
  239. prop: 'createTime',
  240. label: '工单生成时间',
  241. // sortable: true,
  242. align: 'center',
  243. showOverflowTooltip: true,
  244. minWidth: 170
  245. },
  246. {
  247. prop: 'acceptTime',
  248. label: '开工时间',
  249. align: 'center',
  250. showOverflowTooltip: true
  251. },
  252. {
  253. prop: 'finishTime',
  254. label: '报工时间',
  255. align: 'center',
  256. showOverflowTooltip: true
  257. },
  258. {
  259. columnKey: 'orderHour',
  260. label: '实际工时(分钟)',
  261. align: 'center',
  262. resizable: false,
  263. showOverflowTooltip: true,
  264. minWidth: 120,
  265. formatter: (row) => {
  266. if (row.finishTime && row.acceptTime) {
  267. return parseInt(
  268. (new Date(row.finishTime).getTime() -
  269. new Date(row.acceptTime).getTime()) /
  270. 60000
  271. );
  272. }
  273. }
  274. },
  275. {
  276. prop: 'orderStatus',
  277. label: '状态',
  278. align: 'center',
  279. showOverflowTooltip: true,
  280. formatter: (row) => {
  281. return {
  282. 0: '待接收',
  283. 1: '已接收',
  284. 2: '执行中',
  285. 3: '已完成'
  286. }[row.orderStatus];
  287. }
  288. },
  289. {
  290. prop: 'executeResult',
  291. label: '执行结果',
  292. align: 'center',
  293. showOverflowTooltip: true,
  294. formatter(row) {
  295. return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
  296. }
  297. }
  298. ],
  299. repairColumns: [
  300. {
  301. columnKey: 'index',
  302. label: '序号',
  303. type: 'index',
  304. width: 55,
  305. align: 'center',
  306. showOverflowTooltip: true,
  307. fixed: 'left'
  308. },
  309. {
  310. prop: 'code',
  311. slot: 'code',
  312. label: '工单编号',
  313. align: 'center',
  314. showOverflowTooltip: true,
  315. minWidth: 150
  316. },
  317. {
  318. prop: 'planCode',
  319. // label: '关联单号',
  320. label: '计划单号',
  321. align: 'center',
  322. showOverflowTooltip: true,
  323. minWidth: 110
  324. },
  325. {
  326. prop: 'planName',
  327. label: '维修名称',
  328. align: 'center',
  329. showOverflowTooltip: true,
  330. minWidth: 110
  331. },
  332. {
  333. prop: 'substanceDetailVO.name',
  334. label: '设备名称',
  335. align: 'center',
  336. showOverflowTooltip: true,
  337. minWidth: 110
  338. },
  339. {
  340. prop: 'substanceDetailVO.fixCode',
  341. label: '固资编码',
  342. align: 'center',
  343. showOverflowTooltip: true,
  344. minWidth: 110
  345. },
  346. {
  347. prop: 'substanceDetailVO.codeNumber',
  348. label: '设备编号',
  349. align: 'center',
  350. showOverflowTooltip: true,
  351. minWidth: 110
  352. },
  353. {
  354. prop: 'executeUserName',
  355. label: '执行人',
  356. align: 'center',
  357. showOverflowTooltip: true,
  358. minWidth: 110
  359. },
  360. {
  361. prop: 'acceptTime',
  362. label: '开始时间',
  363. align: 'center',
  364. showOverflowTooltip: true,
  365. minWidth: 110
  366. },
  367. {
  368. prop: 'finishTime',
  369. label: '结束时间',
  370. align: 'center',
  371. showOverflowTooltip: true,
  372. minWidth: 110
  373. },
  374. {
  375. prop: 'planFinishTime',
  376. label: '计划完成时间',
  377. align: 'center',
  378. showOverflowTooltip: true,
  379. minWidth: 110
  380. },
  381. {
  382. columnKey: 'orderHour',
  383. label: '实际工时(分钟)',
  384. align: 'center',
  385. resizable: false,
  386. showOverflowTooltip: true,
  387. minWidth: 120,
  388. formatter: (row) => {
  389. if (row.finishTime && row.acceptTime) {
  390. return parseInt(
  391. (new Date(row.finishTime).getTime() -
  392. new Date(row.acceptTime).getTime()) /
  393. 60000
  394. );
  395. }
  396. }
  397. }
  398. ]
  399. };
  400. },
  401. methods: {
  402. async open() {
  403. this.visible = true;
  404. },
  405. /* 表格数据源 */
  406. datasource({ page, limit, where }) {
  407. where.type = this.activeComp;
  408. let api = this.activeComp == 3 ? getWorkOrderList : getWorkOrderPage;
  409. return api({
  410. pageNum: page,
  411. size: limit,
  412. ...where
  413. });
  414. },
  415. columns() {
  416. return this.activeComp == 1
  417. ? this.patrolColumns
  418. : this.activeComp == 2
  419. ? this.equipmentColumns
  420. : this.repairColumns;
  421. },
  422. activeChange(key) {
  423. this.activeComp = key;
  424. this.$refs.table.reload();
  425. },
  426. async add() {
  427. let data = null;
  428. let deviceList = [];
  429. if (!this.current.id) {
  430. this.$message.error('请至少选择一条数据');
  431. return;
  432. }
  433. if (this.activeComp == 3) {
  434. data = this.current;
  435. deviceList[0] = data.substanceDetailVO;
  436. } else {
  437. data = await getWordOrderDetail(this.current.id);
  438. deviceList = data.deviceList.map((item) => {
  439. return item.substance;
  440. });
  441. }
  442. data['deviceList'] = deviceList;
  443. this.$emit('open', data);
  444. this.visible = false;
  445. }
  446. }
  447. };
  448. </script>
  449. <style lang="scss" scoped>
  450. ::v-deep .el-card__body {
  451. padding-top: 0;
  452. padding-left: 0;
  453. }
  454. .main {
  455. padding-left: 17px;
  456. .plan {
  457. padding-top: 15px;
  458. }
  459. }
  460. </style>