selectWorkOrder.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <ele-modal
  3. :title="title"
  4. :visible.sync="visible"
  5. :close-on-click-modal="false"
  6. @close="handleClose"
  7. resizable
  8. maxable
  9. append-to-body
  10. width="90%"
  11. >
  12. <div>
  13. <seek-page :seekList="seekList" @search="search"></seek-page>
  14. <ele-pro-table
  15. ref="table"
  16. key="id"
  17. :columns="basicColumns"
  18. :datasource="datasource"
  19. row-key="code"
  20. :selection.sync="selection"
  21. autoAmendPage
  22. :cache-key="cacheKeyUrl"
  23. >
  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. <template v-slot:QRcode="{ row }">
  30. <el-link type="primary" :underline="false" @click="handleQRcode(row)"
  31. >生成二维码
  32. </el-link>
  33. </template>
  34. <template v-slot:apsWorkOrderCode="{ row }">
  35. <label>{{ row.apsWorkOrderCode || '' }}</label>
  36. </template>
  37. <template v-slot:formingNum="{ row }">
  38. <span> {{ row.formingNum }} </span>
  39. </template>
  40. <template v-slot:formingWeight="{ row }">
  41. <span> {{ row.formingWeight }} {{ row.weightUnit }} </span>
  42. </template>
  43. <template v-slot:singleReport="{ row }">
  44. <span v-if="row.singleReport == 0">批量报工</span>
  45. <span v-if="row.singleReport == 1">单个报工</span>
  46. </template>
  47. <template v-slot:outsourceStatus="{ row }">
  48. <div v-if="row.outsourceStatus">
  49. <span v-if="row.outsourceStatus == 1">未委外</span>
  50. <span v-if="row.outsourceStatus == 2">委外中</span>
  51. <span v-if="row.outsourceStatus == 3">完成委外</span>
  52. </div>
  53. </template>
  54. <template v-slot:status="{ row }">
  55. <span :class="{ 'ele-text-danger': row.status == 3 }">
  56. {{ statusFormatter(row.status) }}
  57. </span>
  58. </template>
  59. </ele-pro-table>
  60. </div>
  61. <template v-slot:footer>
  62. <el-button type="primary" @click="submit">选 择</el-button>
  63. <el-button @click="handleClose">取 消</el-button>
  64. </template>
  65. </ele-modal>
  66. </template>
  67. <script>
  68. import dictMixins from '@/mixins/dictMixins';
  69. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  70. import { getPage } from '@/api/produceOrder/index.js';
  71. import { pageOrderByProduct } from '@/api/produce/workOrder.js';
  72. export default {
  73. mixins: [dictMixins, tableColumnsMixin],
  74. props: {
  75. // 额外的过滤条件
  76. where: {
  77. type: Object,
  78. default: () => ({})
  79. },
  80. // 选择后是否自动关闭弹窗
  81. autoClose: {
  82. type: Boolean,
  83. default: true
  84. }
  85. },
  86. data() {
  87. return {
  88. visible: false,
  89. title: '选择生产工单',
  90. statusOpt: {
  91. first: [
  92. { label: '所有状态', value: '5,4' },
  93. { label: '待生产', value: '4' },
  94. { label: '生产中', value: '5' }
  95. // { label: '已延期', value: '7' }
  96. ],
  97. second: [{ label: '已完成', value: '6' }]
  98. },
  99. planType: [
  100. { label: '所有计划类型', value: null },
  101. { label: '内销计划', value: '1' },
  102. { label: '外销计划', value: '2' },
  103. { label: '预制计划', value: '3' }
  104. ],
  105. cacheKeyUrl: 'public-2025926-select-work-order',
  106. selection: []
  107. };
  108. },
  109. computed: {
  110. // 表格列配置
  111. seekList() {
  112. return [
  113. {
  114. label: '关键字:',
  115. value: 'keyWord',
  116. type: 'input',
  117. placeholder: ''
  118. },
  119. {
  120. label: '生产工单号:',
  121. value: 'code',
  122. type: 'input',
  123. placeholder: '',
  124. labelWidth: 100
  125. },
  126. {
  127. label: '生产订单号:',
  128. value: 'apsWorkOrderCode',
  129. type: 'input',
  130. labelWidth: 100
  131. },
  132. {
  133. label: '计划编号:',
  134. value: 'productionPlanCode',
  135. type: 'input',
  136. width: 240
  137. },
  138. {
  139. label: '计划类型:',
  140. value: 'planType',
  141. type: 'select',
  142. placeholder: '',
  143. width: 240,
  144. // 加载状态
  145. planList: this.planType
  146. },
  147. {
  148. label: '工艺路线',
  149. value: 'produceRoutingName',
  150. type: 'input',
  151. placeholder: '',
  152. width: 240
  153. },
  154. {
  155. label: '产品编码',
  156. value: 'productCode',
  157. type: 'input',
  158. placeholder: '',
  159. width: 240
  160. },
  161. {
  162. label: '产品名称:',
  163. value: 'productName',
  164. type: 'input',
  165. placeholder: '',
  166. width: 240
  167. },
  168. {
  169. label: '牌号',
  170. value: 'brandNo',
  171. type: 'input',
  172. placeholder: '',
  173. width: 240
  174. },
  175. {
  176. label: '型号',
  177. value: 'model',
  178. type: 'input',
  179. placeholder: '',
  180. width: 240
  181. },
  182. // {
  183. // label: '班组:',
  184. // value: 'teamId',
  185. // type: 'select',
  186. // multiple: false, // 是否多选
  187. // filterable: true, // 是否可搜索
  188. // placeholder: '',
  189. // width: 240,
  190. // // 加载状态
  191. // planList: this.statusOpt.first
  192. // },
  193. {
  194. label: '创建时间:',
  195. value: 'createTime',
  196. type: 'date',
  197. dateType: 'daterange',
  198. placeholder: '',
  199. width: 240,
  200. // 加载状态
  201. planList: this.statusOpt.first
  202. }
  203. ];
  204. },
  205. basicColumns() {
  206. return [
  207. {
  208. width: 45,
  209. type: 'selection',
  210. columnKey: 'selection',
  211. align: 'center',
  212. fixed: 'left'
  213. },
  214. {
  215. slot: 'code',
  216. label: '生产工单号',
  217. align: 'center',
  218. minWidth: 150,
  219. showOverflowTooltip: true
  220. },
  221. // {
  222. // prop: 'originalCode',
  223. // label: '原始工单号',
  224. // align: 'center',
  225. // minWidth: 110
  226. // },
  227. {
  228. prop: 'productCode',
  229. label: '产品编码',
  230. align: 'center',
  231. minWidth: 150,
  232. showOverflowTooltip: true
  233. },
  234. {
  235. prop: 'productName',
  236. label: '产品名称',
  237. align: 'center',
  238. minWidth: 150,
  239. showOverflowTooltip: true
  240. },
  241. {
  242. prop: 'batchNo',
  243. label: '批次号',
  244. align: 'center',
  245. minWidth: 150,
  246. showOverflowTooltip: true
  247. },
  248. {
  249. prop: 'model',
  250. label: '型号',
  251. align: 'center',
  252. minWidth: 150,
  253. showOverflowTooltip: true
  254. },
  255. {
  256. prop: 'specification',
  257. label: '规格',
  258. align: 'center',
  259. showOverflowTooltip: true
  260. },
  261. {
  262. prop: 'productionCodes',
  263. label: '生产编号',
  264. align: 'center',
  265. minWidth: 150,
  266. showOverflowTooltip: true
  267. },
  268. {
  269. label: '生产订单号',
  270. slot: 'apsWorkOrderCode',
  271. align: 'center',
  272. minWidth: 110,
  273. showOverflowTooltip: true
  274. },
  275. {
  276. prop: 'productionPlanCode',
  277. label: '计划编号',
  278. align: 'center',
  279. minWidth: 110,
  280. showOverflowTooltip: true
  281. },
  282. {
  283. prop: 'planType',
  284. label: '计划类型',
  285. align: 'center',
  286. showOverflowTooltip: true,
  287. formatter: (row) => {
  288. const obj = this.planType.find((i) => i.value == row.planType);
  289. return obj && obj.label;
  290. }
  291. },
  292. {
  293. prop: 'bomType',
  294. label: '生产类型',
  295. align: 'center',
  296. width: 120,
  297. formatter: (row) => {
  298. if (row.bomType == 1) {
  299. return '产品(PBOM)';
  300. }
  301. if (row.bomType == 2) {
  302. return '加工(MBOM)';
  303. }
  304. if (row.bomType == 3) {
  305. return '装配(ABOM)';
  306. }
  307. // if (row.bomType == 4) {
  308. // return '装配(EBOM)';
  309. // }
  310. return '';
  311. }
  312. },
  313. {
  314. prop: 'bomCategoryName',
  315. label: 'BOM版本',
  316. align: 'center',
  317. width: 130,
  318. showOverflowTooltip: true,
  319. formatter: (row) => {
  320. if (row.bomCategoryName) {
  321. return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
  322. }
  323. return '';
  324. }
  325. },
  326. {
  327. prop: 'produceRoutingName',
  328. label: '工艺路线',
  329. align: 'center',
  330. showOverflowTooltip: true
  331. },
  332. {
  333. prop: 'lineNumber',
  334. label: '行号',
  335. align: 'center',
  336. minWidth: 130,
  337. showOverflowTooltip: true
  338. },
  339. {
  340. prop: 'brandNo',
  341. label: '牌号',
  342. align: 'center'
  343. },
  344. {
  345. prop: 'taskName',
  346. label: '工序进度',
  347. align: 'center'
  348. },
  349. {
  350. prop: 'singleReport',
  351. slot: 'singleReport',
  352. label: '报工类型',
  353. align: 'center'
  354. },
  355. {
  356. prop: 'outsourceStatus',
  357. label: '委外状态',
  358. align: 'center',
  359. slot: 'outsourceStatus',
  360. showOverflowTooltip: true
  361. },
  362. {
  363. prop: 'formingNum',
  364. label: '要求生产数量',
  365. align: 'center',
  366. slot: 'formingNum',
  367. showOverflowTooltip: true,
  368. minWidth: 110
  369. },
  370. {
  371. prop: 'formingWeight',
  372. label: '要求生产重量',
  373. slot: 'formingWeight',
  374. align: 'center',
  375. showOverflowTooltip: true,
  376. minWidth: 110
  377. },
  378. {
  379. prop: 'formedNum',
  380. label: '已生产数量',
  381. align: 'center',
  382. showOverflowTooltip: true,
  383. minWidth: 110
  384. },
  385. {
  386. prop: 'formedWeight',
  387. label: '已生产重量',
  388. align: 'center',
  389. showOverflowTooltip: true,
  390. minWidth: 110
  391. },
  392. {
  393. prop: 'planStartTime',
  394. label: '计划开始时间',
  395. align: 'center',
  396. showOverflowTooltip: true,
  397. minWidth: 150,
  398. sortable: 'custom'
  399. },
  400. {
  401. prop: 'planCompleteTime',
  402. label: '计划结束时间',
  403. align: 'center',
  404. showOverflowTooltip: true,
  405. minWidth: 150,
  406. sortable: 'custom'
  407. },
  408. {
  409. prop: 'startTime',
  410. label: '实际开始时间',
  411. align: 'center',
  412. showOverflowTooltip: true,
  413. minWidth: 150,
  414. sortable: 'custom'
  415. },
  416. {
  417. prop: 'completeTime',
  418. label: '实际完成时间',
  419. align: 'center',
  420. showOverflowTooltip: true,
  421. minWidth: 150,
  422. sortable: 'custom'
  423. },
  424. {
  425. prop: 'createTime',
  426. label: '创建时间',
  427. align: 'center',
  428. showOverflowTooltip: true,
  429. minWidth: 150,
  430. sortable: 'custom'
  431. },
  432. // {
  433. // prop: 'status',
  434. // slot: 'status',
  435. // label: '状态',
  436. // align: 'center',
  437. // formatter: (row) => {
  438. // const obj = this.statusOpt[this.activeName].find(
  439. // (i) => i.value == row.status
  440. // );
  441. // return obj && obj.label;
  442. // }
  443. // },
  444. {
  445. prop: 'deviceName',
  446. slot: 'deviceName',
  447. label: '设备名称',
  448. align: 'center',
  449. showOverflowTooltip: true
  450. },
  451. {
  452. prop: 'crewNames',
  453. slot: 'crewNames',
  454. label: '报工人员',
  455. align: 'center',
  456. showOverflowTooltip: true
  457. },
  458. {
  459. prop: 'teamName',
  460. label: '班组',
  461. align: 'center',
  462. showOverflowTooltip: true
  463. }
  464. ];
  465. }
  466. },
  467. methods: {
  468. // 外部调用,打开弹窗
  469. open(data) {
  470. this.visible = true;
  471. },
  472. // 关闭时清理表单
  473. handleClose() {
  474. this.visible = false;
  475. },
  476. // 提交 选择
  477. submit() {
  478. console.log('this.selection', this.selection);
  479. this.$emit('confirm', this.selection);
  480. if (this.autoClose) {
  481. this.handleClose();
  482. }
  483. },
  484. /* 表格数据源 */
  485. datasource({ page, limit, where, order }) {
  486. return pageOrderByProduct({
  487. ...where,
  488. ...order,
  489. pageNum: page,
  490. size: limit,
  491. queryTermination: 0,
  492. ...this.where
  493. });
  494. },
  495. /* 刷新表格 */
  496. reload(where = {}) {
  497. this.$refs.table.reload({ page: 1, where });
  498. },
  499. search(e) {
  500. if (Array.isArray(e.createTime) && e.createTime.length) {
  501. e.createTimeStart = e.createTime[0];
  502. e.createTimeEnd = e.createTime[1];
  503. }
  504. this.reload(e);
  505. }
  506. }
  507. };
  508. </script>
  509. <style scoped lang="scss"></style>