workOrder.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- <patrolSearch @search="search"></patrolSearch> -->
  5. <seek-page
  6. :seekList="seekList"
  7. @search="search"
  8. :maxLength="4"
  9. style="margin-bottom: 15px"
  10. ></seek-page>
  11. <ele-pro-table
  12. ref="table"
  13. row-key="id"
  14. :columns="columns"
  15. :datasource="datasource"
  16. :cache-key="cacheKeyUrl"
  17. autoAmendPage
  18. >
  19. <template v-slot:toolbar> </template>
  20. <template v-slot:code="{ row }">
  21. <el-link
  22. type="primary"
  23. :underline="false"
  24. @click="openWorkOrderReport('detail', row)"
  25. >
  26. {{ row.code }}
  27. </el-link>
  28. </template>
  29. <template v-slot:action="{ row }">
  30. <el-link
  31. v-if="row.executeStatus == 1"
  32. type="primary"
  33. :underline="false"
  34. @click="openWorkOrderReport('add', row)"
  35. >
  36. 报工
  37. </el-link>
  38. <el-link
  39. v-if="row.executeStatus == 1"
  40. type="primary"
  41. :underline="false"
  42. @click="openRedeployOther(row)"
  43. >
  44. 转派
  45. </el-link>
  46. </template>
  47. </ele-pro-table>
  48. </el-card>
  49. <redeployOther ref="redeployOtherRef" @refresh="reload"></redeployOther>
  50. <workOrderReport
  51. ref="programRulesDialogRef"
  52. @refresh="reload"
  53. ></workOrderReport>
  54. </div>
  55. </template>
  56. <script>
  57. import dictMixins from '@/mixins/dictMixins';
  58. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  59. import { producetaskrulerecordQueryRecordWorkOrderPage } from '@/api/recordRules/index';
  60. import programRulesDialog from './programRulesDialog.vue';
  61. import patrolSearch from './patrol-search.vue';
  62. import redeployOther from './redeployOther.vue';
  63. import workOrderReport from './workOrderReport.vue';
  64. export default {
  65. mixins: [dictMixins, tableColumnsMixin],
  66. components: {
  67. programRulesDialog,
  68. patrolSearch,
  69. redeployOther,
  70. workOrderReport
  71. },
  72. data() {
  73. return {
  74. columns: [
  75. {
  76. columnKey: 'index',
  77. label: '序号',
  78. type: 'index',
  79. width: 55,
  80. align: 'center',
  81. showOverflowTooltip: true,
  82. fixed: 'left'
  83. },
  84. {
  85. prop: 'code',
  86. label: '工单单号',
  87. align: 'center',
  88. minWidth: 150,
  89. slot: 'code'
  90. },
  91. {
  92. prop: 'planCode',
  93. label: '计划单号',
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. minWidth: 150
  97. },
  98. {
  99. prop: 'ruleName',
  100. label: '记录规则名称',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. minWidth: 110
  104. },
  105. {
  106. prop: '',
  107. label: '记录部门',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 110,
  111. formatter: (row) => {
  112. if (row.planExecuteType == 0) {
  113. return Array.from(new Set((row.executeUsers || []).map(i => i.groupName).filter(v => v))).join(',');
  114. }
  115. return '';
  116. }
  117. },
  118. {
  119. prop: '',
  120. label: '负责人',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 110,
  124. formatter: (row) => {
  125. if (row.planExecuteType == 0) {
  126. return row.executeUsers.map((i) => i.userName).join(',');
  127. }
  128. return '';
  129. }
  130. },
  131. {
  132. prop: 'executeUser',
  133. label: '班组',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. minWidth: 110,
  137. formatter: (row) => {
  138. if (row.planExecuteType == 1) {
  139. return row.executeUsers.map((i) => i.teamName).join(',');
  140. }
  141. return '';
  142. }
  143. },
  144. {
  145. prop: 'workshopAreaName',
  146. label: '车间名称',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110,
  150. formatter: (row) => {
  151. return row.itemTypeName;
  152. }
  153. },
  154. {
  155. prop: 'createTime',
  156. label: '工单生成时间',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 110
  160. },
  161. {
  162. prop: 'checkStartTime',
  163. label: '检查开始时间',
  164. align: 'center',
  165. showOverflowTooltip: true,
  166. minWidth: 110
  167. },
  168. {
  169. prop: 'checkFinishTime',
  170. label: '检查结束时间',
  171. align: 'center',
  172. showOverflowTooltip: true,
  173. minWidth: 110
  174. },
  175. {
  176. prop: 'duration',
  177. label: '工时',
  178. align: 'center',
  179. showOverflowTooltip: true,
  180. minWidth: 110,
  181. formatter: (row) => {
  182. // 工时,单位:毫秒,转换为小时显示
  183. if (row.duration) {
  184. return (row.duration / 3600000).toFixed(2);
  185. }
  186. return '';
  187. }
  188. },
  189. {
  190. prop: 'executeStatus',
  191. label: '状态',
  192. align: 'center',
  193. showOverflowTooltip: true,
  194. minWidth: 110,
  195. formatter: (row) => {
  196. const statusMap = {
  197. 0: '未报工',
  198. 1: '执行中',
  199. 2: '已执行'
  200. };
  201. return statusMap[row.executeStatus] || '';
  202. }
  203. },
  204. {
  205. columnKey: 'action',
  206. label: '操作',
  207. width: 220,
  208. align: 'center',
  209. resizable: false,
  210. fixed: 'right',
  211. slot: 'action',
  212. showOverflowTooltip: true
  213. }
  214. ],
  215. cacheKeyUrl: 'mes-2511241029-batchrecord-workorder-workorder'
  216. };
  217. },
  218. computed: {
  219. seekList() {
  220. return [
  221. {
  222. label: '工单单号',
  223. value: 'code',
  224. type: 'input',
  225. placeholder: '请输入'
  226. },
  227. {
  228. label: '计划单号',
  229. value: 'planCode',
  230. type: 'input',
  231. placeholder: '请输入'
  232. },
  233. {
  234. label: '记录规则名称',
  235. value: 'ruleName',
  236. type: 'input',
  237. placeholder: '请输入',
  238. labelWidth: 110
  239. },
  240. {
  241. label: '状态',
  242. value: 'executeStatus',
  243. type: 'select',
  244. placeholder: '请输入',
  245. planList: [
  246. { value: 0, label: '未报工' },
  247. { value: 1, label: '执行中' },
  248. { value: 2, label: '已执行' }
  249. ]
  250. }
  251. // {
  252. // label: '生成时间',
  253. // value: 'time',
  254. // type: 'date',
  255. // dateType: 'daterange'
  256. // }
  257. ];
  258. }
  259. },
  260. created() {},
  261. methods: {
  262. // 刷新表格
  263. reload(where = {}) {
  264. this.$refs.table.reload({
  265. where
  266. });
  267. },
  268. /* 表格数据源 */
  269. datasource({ page, limit, where, order }) {
  270. // 参数
  271. const body = {
  272. ...where,
  273. ...order,
  274. pageNum: page,
  275. size: limit
  276. };
  277. return producetaskrulerecordQueryRecordWorkOrderPage(body);
  278. },
  279. search(where) {
  280. console.log('where', where);
  281. if (where.time) {
  282. where.createTimeStart = where.time[0];
  283. where.createTimeEnd = where.time[1];
  284. where.time = null;
  285. }
  286. this.reload(where);
  287. },
  288. openRedeployOther(row) {
  289. this.$refs.redeployOtherRef.open(row, 'transfer');
  290. },
  291. // 报工
  292. openWorkOrderReport(type, row) {
  293. this.$refs.programRulesDialogRef.open(type, row);
  294. }
  295. }
  296. };
  297. </script>
  298. <style></style>