index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <work-search @search="reload"> </work-search>
  5. <!-- 数据表格 -->
  6. <!-- :default-sort="{ prop: 'createTime', order: 'ascending' }" -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. cache-key="systemRoleTable"
  12. >
  13. <!-- 表头工具栏 -->
  14. <template v-slot:toolbar>
  15. <!-- <el-button
  16. size="small"
  17. type="primary"
  18. class="ele-btn-icon"
  19. @click="goDetail()"
  20. >
  21. 详情
  22. </el-button> -->
  23. </template>
  24. <template v-slot:code="{ row }">
  25. <el-link type="primary" :underline="false" @click="goDetail(row)">
  26. {{ row.code }}
  27. </el-link>
  28. </template>
  29. <!-- 操作列 -->
  30. <template v-slot:action="{ row }">
  31. <el-link
  32. v-if="row.orderStatus === 3"
  33. type="primary"
  34. :underline="false"
  35. @click="handleExport(row)"
  36. >
  37. 预览打印
  38. </el-link>
  39. <el-link
  40. v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
  41. type="primary"
  42. :underline="false"
  43. icon="el-icon-truck"
  44. @click="addSpareItems(row)"
  45. >
  46. 申请备品备件
  47. </el-link>
  48. <el-link
  49. v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
  50. type="primary"
  51. :underline="false"
  52. icon="el-icon-edit"
  53. @click="toSigningUpWork(row)"
  54. >
  55. 报工
  56. </el-link>
  57. <el-link
  58. v-if="
  59. row.orderStatus !== 3 && row.orderStatus !== 4 && row.isGroup != 1
  60. "
  61. type="primary"
  62. :underline="false"
  63. icon="el-icon-edit"
  64. @click="toRedeploy(row)"
  65. >
  66. 转派
  67. </el-link>
  68. <!-- <el-link
  69. type="primary"
  70. :underline="false"
  71. @click="handlePrint(row, 1)"
  72. v-if="row.orderStatus == 3"
  73. >
  74. 一级表
  75. </el-link> -->
  76. </template>
  77. </ele-pro-table>
  78. </el-card>
  79. <!-- 转派弹窗 -->
  80. <redeployOther ref="redeployOtherRef" @refresh="reload" />
  81. <!-- 报工弹框 -->
  82. <signingUpWork ref="signingUpWorkRef" @refresh="reload" />
  83. <edit @refresh="reload" ref="edit" />
  84. <printWorkOrder ref="printRef11"></printWorkOrder>
  85. </div>
  86. </template>
  87. <script>
  88. import WorkSearch from './components/work-search.vue';
  89. // import { pageRoles } from '@/api/system/role';
  90. import edit from '@/views/sparePartsApply/components/edit';
  91. import { workPage } from '@/api/equipment/work';
  92. import redeployOther from '@/views/maintenance/components/redeployOther.vue';
  93. import signingUpWork from '@/views/maintenance/components/signingUpWork.vue';
  94. import { getWordOrderDetail } from '@/api/maintenance/patrol_maintenance';
  95. import printWorkOrder from './components/printWorkOrder.vue';
  96. import { getToken } from '@/utils/token-util';
  97. export default {
  98. components: {
  99. WorkSearch,
  100. redeployOther,
  101. signingUpWork,
  102. edit,
  103. printWorkOrder
  104. },
  105. data() {
  106. return {
  107. // 表格列配置
  108. columns: [
  109. {
  110. columnKey: 'index',
  111. label: '序号',
  112. type: 'index',
  113. width: 55,
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. fixed: 'left'
  117. },
  118. {
  119. columnKey: 'code',
  120. slot: 'code',
  121. prop: 'code',
  122. label: '工单单号',
  123. align: 'center',
  124. showOverflowTooltip: true,
  125. minWidth: 140
  126. },
  127. {
  128. prop: 'planCode',
  129. label: '计划单号',
  130. align: 'center',
  131. showOverflowTooltip: true,
  132. slot: 'planCode',
  133. minWidth: 140
  134. },
  135. {
  136. prop: 'planName',
  137. label: '保养名称',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. minWidth: 120
  141. },
  142. {
  143. prop: 'executeGroupName',
  144. label: '保养部门',
  145. align: 'center',
  146. showOverflowTooltip: true,
  147. minWidth: 120
  148. },
  149. {
  150. prop: 'executeUserName',
  151. label: '保养人员',
  152. align: 'center',
  153. showOverflowTooltip: true
  154. },
  155. {
  156. prop: 'ruleName',
  157. label: '规则名称',
  158. align: 'center',
  159. showOverflowTooltip: true
  160. },
  161. {
  162. prop: 'createTime',
  163. label: '工单生成时间',
  164. // sortable: true,
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. minWidth: 170
  168. },
  169. {
  170. prop: 'acceptTime',
  171. label: '开工时间',
  172. align: 'center',
  173. showOverflowTooltip: true
  174. },
  175. {
  176. prop: 'finishTime',
  177. label: '报工时间',
  178. align: 'center',
  179. showOverflowTooltip: true
  180. },
  181. {
  182. columnKey: 'orderHour',
  183. label: '实际工时(分钟)',
  184. align: 'center',
  185. resizable: false,
  186. showOverflowTooltip: true,
  187. minWidth: 120,
  188. formatter: (row) => {
  189. if (row.finishTime && row.acceptTime) {
  190. return parseInt(
  191. (new Date(row.finishTime).getTime() -
  192. new Date(row.acceptTime).getTime()) /
  193. 60000
  194. );
  195. }
  196. }
  197. },
  198. {
  199. prop: 'orderStatus',
  200. label: '状态',
  201. align: 'center',
  202. showOverflowTooltip: true,
  203. formatter: (row) => {
  204. return {
  205. 0: '待接收',
  206. 1: '已接收',
  207. 2: '执行中',
  208. 3: '已完成'
  209. }[row.orderStatus];
  210. }
  211. },
  212. {
  213. prop: 'executeResult',
  214. label: '执行结果',
  215. align: 'center',
  216. showOverflowTooltip: true,
  217. formatter(row) {
  218. return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
  219. }
  220. },
  221. {
  222. columnKey: 'action',
  223. label: '操作',
  224. width: 300,
  225. align: 'center',
  226. resizable: false,
  227. slot: 'action',
  228. showOverflowTooltip: true
  229. }
  230. ],
  231. // 加载状态
  232. loading: false,
  233. pageType: 'add',
  234. dialogTitle: '',
  235. isBindPlan: false
  236. };
  237. },
  238. computed: {},
  239. methods: {
  240. /* 表格数据源 */
  241. datasource({ page, limit, where, order }) {
  242. where.type = 2;
  243. return workPage({ pageNum: page, size: limit, ...where });
  244. },
  245. async changeEnable(row) {
  246. const res = await putRoles(row);
  247. if (res.code == 0) {
  248. this.$message({
  249. type: 'success',
  250. message: '修改成功',
  251. customClass: 'ele-message-border'
  252. });
  253. this.reload();
  254. }
  255. },
  256. /* 刷新表格 */
  257. reload(where) {
  258. this.$refs.table.reload({ page: 1, where });
  259. },
  260. // 添加备品备件
  261. async addSpareItems(row) {
  262. let data = await getWordOrderDetail(row.id);
  263. data.deviceList = data.deviceList.map((item) => {
  264. return item.substance;
  265. });
  266. this.$refs.edit.open(data, 'add');
  267. },
  268. goDetail({ id }) {
  269. this.$router.push({
  270. path: '/maintenance/equipment/workOrder/details',
  271. query: {
  272. id
  273. }
  274. });
  275. },
  276. // 转派
  277. toRedeploy(row) {
  278. this.$refs.redeployOtherRef.open(row);
  279. },
  280. // 报工
  281. toSigningUpWork(row) {
  282. this.$refs.signingUpWorkRef.open(row);
  283. },
  284. handlePrint(row, val) {
  285. this.$refs.printRef11.open(row.id, val);
  286. },
  287. handleExport(row) {
  288. const url = `http://192.168.1.251:8085/jmreport/view/1057242475693346816?token=${getToken()}&id=${
  289. row.id
  290. }`;
  291. window.open(url, '_blank');
  292. }
  293. }
  294. };
  295. </script>
  296. <style lang="scss" scoped></style>