selectWorkOrder.vue 14 KB

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