index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <work-search @search="reload"> </work-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. :default-sort="{ prop: 'createTime', order: 'ascending' }"
  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 && row.orderStatus !== 4"
  33. type="primary"
  34. :underline="false"
  35. icon="el-icon-edit"
  36. @click="toSigningUpWork(row)"
  37. >
  38. 报工
  39. </el-link>
  40. <el-link
  41. v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
  42. type="primary"
  43. :underline="false"
  44. icon="el-icon-edit"
  45. @click="toRedeploy(row)"
  46. >
  47. 转派
  48. </el-link>
  49. </template>
  50. </ele-pro-table>
  51. </el-card>
  52. <!-- 转派弹窗 -->
  53. <redeployOther ref="redeployOtherRef" @refresh="reload" />
  54. <!-- 报工弹框 -->
  55. <signingUpWork ref="signingUpWorkRef" @refresh="reload" />
  56. </div>
  57. </template>
  58. <script>
  59. import WorkSearch from './components/work-search.vue';
  60. // import { pageRoles } from '@/api/system/role';
  61. import { workPage } from '@/api/equipment/work';
  62. import redeployOther from '@/views/maintenance/components/redeployOther.vue';
  63. import signingUpWork from '@/views/maintenance/components/signingUpWork.vue';
  64. export default {
  65. components: {
  66. WorkSearch,
  67. redeployOther,
  68. signingUpWork
  69. },
  70. data() {
  71. return {
  72. // 表格列配置
  73. columns: [
  74. {
  75. columnKey: 'index',
  76. label: '序号',
  77. type: 'index',
  78. width: 55,
  79. align: 'center',
  80. showOverflowTooltip: true,
  81. fixed: 'left'
  82. },
  83. {
  84. columnKey: 'code',
  85. slot: 'code',
  86. prop: 'code',
  87. label: '工单单号',
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. minWidth: 140
  91. },
  92. {
  93. prop: 'planCode',
  94. label: '计划单号',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. slot: 'planCode',
  98. minWidth: 140
  99. },
  100. {
  101. prop: 'planName',
  102. label: '保养名称',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 120
  106. },
  107. {
  108. prop: 'executeGroupName',
  109. label: '保养部门',
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. minWidth: 120
  113. },
  114. {
  115. prop: 'executeUserName',
  116. label: '保养人员',
  117. align: 'center',
  118. showOverflowTooltip: true
  119. },
  120. {
  121. prop: 'ruleName',
  122. label: '规则名称',
  123. align: 'center',
  124. showOverflowTooltip: true
  125. },
  126. {
  127. prop: 'createTime',
  128. label: '工单生成时间',
  129. sortable: true,
  130. align: 'center',
  131. showOverflowTooltip: true,
  132. minWidth: 170
  133. },
  134. {
  135. prop: 'acceptTime',
  136. label: '开工时间',
  137. align: 'center',
  138. showOverflowTooltip: true
  139. },
  140. {
  141. prop: 'finishTime',
  142. label: '报工时间',
  143. align: 'center',
  144. showOverflowTooltip: true
  145. },
  146. {
  147. columnKey: 'orderHour',
  148. label: '实际工时(分钟)',
  149. align: 'center',
  150. resizable: false,
  151. showOverflowTooltip: true,
  152. minWidth: 120,
  153. formatter: (row) => {
  154. if (row.finishTime && row.acceptTime) {
  155. return parseInt(
  156. (new Date(row.finishTime).getTime() -
  157. new Date(row.acceptTime).getTime()) /
  158. 60000
  159. );
  160. }
  161. }
  162. },
  163. {
  164. prop: 'orderStatus',
  165. label: '状态',
  166. align: 'center',
  167. showOverflowTooltip: true,
  168. formatter: (row) => {
  169. return {
  170. 0: '待接收',
  171. 1: '已接收',
  172. 2: '执行中',
  173. 3: '已完成'
  174. }[row.orderStatus];
  175. }
  176. },
  177. {
  178. prop: 'executeResult',
  179. label: '执行结果',
  180. align: 'center',
  181. showOverflowTooltip: true,
  182. formatter(row) {
  183. return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
  184. }
  185. },
  186. {
  187. columnKey: 'action',
  188. label: '操作',
  189. width: 150,
  190. align: 'center',
  191. resizable: false,
  192. slot: 'action',
  193. showOverflowTooltip: true
  194. }
  195. ],
  196. // 加载状态
  197. loading: false,
  198. pageType: 'add',
  199. dialogTitle: '',
  200. isBindPlan: false
  201. };
  202. },
  203. computed: {},
  204. methods: {
  205. /* 表格数据源 */
  206. datasource({ page, limit, where, order }) {
  207. where.type = 2;
  208. return workPage({ pageNum: page, size: limit, ...where });
  209. },
  210. async changeEnable(row) {
  211. const res = await putRoles(row);
  212. if (res.code == 0) {
  213. this.$message({
  214. type: 'success',
  215. message: '修改成功',
  216. customClass: 'ele-message-border'
  217. });
  218. this.reload();
  219. }
  220. },
  221. /* 刷新表格 */
  222. reload(where) {
  223. this.$refs.table.reload({ page: 1, where });
  224. },
  225. goDetail({ id }) {
  226. this.$router.push({
  227. path: '/maintenance/equipment/workOrder/details',
  228. query: {
  229. id
  230. }
  231. });
  232. },
  233. // 转派
  234. toRedeploy(row) {
  235. this.$refs.redeployOtherRef.open(row);
  236. },
  237. // 报工
  238. toSigningUpWork(row) {
  239. this.$refs.signingUpWorkRef.open(row);
  240. }
  241. }
  242. };
  243. </script>
  244. <style lang="scss" scoped></style>