produceOrder.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <template>
  2. <!-- 工单列表 -->
  3. <el-dialog
  4. :visible.sync="equipmentdialog"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="70%"
  10. title="生产工单"
  11. >
  12. <div>
  13. <seek-page :seekList="seekList" @search="search"></seek-page>
  14. <el-row>
  15. <el-col :span="24" class="table_col" v-if="equipmentdialog">
  16. <ele-pro-table
  17. ref="equiTable"
  18. :columns="columns"
  19. :datasource="datasource"
  20. :selection.sync="selection"
  21. :current.sync="current"
  22. highlight-current-row
  23. row-key="id"
  24. height="50vh"
  25. :pageSize="20"
  26. @update:selection="handleSelectionChange"
  27. >
  28. </ele-pro-table>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. <div class="btns">
  33. <el-button type="primary" size="small" @click="selected">选择</el-button>
  34. <el-button size="small" @click="handleClose">关闭</el-button>
  35. </div>
  36. </el-dialog>
  37. </template>
  38. <script>
  39. import { produceOrder } from '@/api/aps/index.js';
  40. import produceOrderSearch from './produceOrderSearch.vue';
  41. export default {
  42. components: { produceOrderSearch },
  43. props: {
  44. selectList: Array,
  45. type: {
  46. default: 2 //1多选 2单选
  47. }
  48. },
  49. data() {
  50. return {
  51. planType: [
  52. { label: '所有计划类型', value: null },
  53. { label: '内销计划', value: '1' },
  54. { label: '外销计划', value: '2' },
  55. { label: '预制计划', value: '3' }
  56. ],
  57. statusOpt: {
  58. first: [
  59. { label: '所有状态', value: '5,4' },
  60. { label: '待生产', value: '4' },
  61. { label: '生产中', value: '5' }
  62. // { label: '已延期', value: '7' }
  63. ],
  64. second: [{ label: '已完成', value: '6' }]
  65. },
  66. equipmentdialog: false,
  67. current: null,
  68. columns: [
  69. {
  70. width: 45,
  71. type: 'selection',
  72. columnKey: 'selection',
  73. align: 'center',
  74. reserveSelection: true
  75. },
  76. {
  77. label: '生产工单号',
  78. align: 'center',
  79. prop: 'code',
  80. minWidth: 110,
  81. showOverflowTooltip: true
  82. },
  83. {
  84. prop: 'productionPlanCode',
  85. label: '计划编号',
  86. align: 'center',
  87. minWidth: 110,
  88. showOverflowTooltip: true
  89. },
  90. {
  91. prop: 'planType',
  92. label: '计划类型',
  93. align: 'center',
  94. formatter: (row) => {
  95. const obj = this.planType.find((i) => i.value == row.planType);
  96. return obj && obj.label;
  97. },
  98. showOverflowTooltip: true
  99. },
  100. {
  101. prop: 'produceRoutingName',
  102. label: '工艺路线',
  103. align: 'center',
  104. showOverflowTooltip: true
  105. },
  106. {
  107. prop: 'productCode',
  108. label: '产品编码',
  109. align: 'center',
  110. showOverflowTooltip: true
  111. },
  112. {
  113. prop: 'productName',
  114. label: '产品名称',
  115. align: 'center',
  116. showOverflowTooltip: true
  117. },
  118. {
  119. prop: 'brandNo',
  120. label: '牌号',
  121. align: 'center',
  122. showOverflowTooltip: true
  123. },
  124. {
  125. prop: 'specification',
  126. label: '规格',
  127. align: 'center',
  128. showOverflowTooltip: true
  129. },
  130. {
  131. prop: 'model',
  132. label: '型号',
  133. align: 'center',
  134. showOverflowTooltip: true
  135. },
  136. {
  137. prop: 'batchNo',
  138. label: '批次号',
  139. align: 'center',
  140. minWidth: 100,
  141. showOverflowTooltip: true
  142. },
  143. {
  144. prop: 'priority',
  145. label: '优先级',
  146. align: 'center',
  147. minWidth: 120,
  148. sortable: 'custom',
  149. showOverflowTooltip: true
  150. },
  151. {
  152. prop: 'formingNum',
  153. label: '要求生产数量',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'formingWeight',
  160. label: '要求生产重量',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110
  164. },
  165. {
  166. prop: 'formedNum',
  167. label: '已生产数量',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 110
  171. },
  172. {
  173. prop: 'formedWeight',
  174. label: '已生产重量',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. minWidth: 110
  178. },
  179. {
  180. prop: 'planStartTime',
  181. label: '计划开始时间',
  182. align: 'center',
  183. showOverflowTooltip: true,
  184. minWidth: 110
  185. },
  186. {
  187. prop: 'planCompleteTime',
  188. label: '计划结束时间',
  189. align: 'center',
  190. showOverflowTooltip: true,
  191. minWidth: 110
  192. },
  193. {
  194. prop: 'startTime',
  195. label: '实际开始时间',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. minWidth: 110
  199. },
  200. {
  201. prop: 'createTime',
  202. label: '创建时间',
  203. align: 'center',
  204. showOverflowTooltip: true,
  205. minWidth: 110
  206. },
  207. {
  208. prop: 'teamName',
  209. label: '班组',
  210. align: 'center',
  211. showOverflowTooltip: true
  212. }
  213. ],
  214. categoryLevelId: null,
  215. code: null,
  216. selection: [],
  217. ids: [],
  218. allSelection: [],
  219. activeName: 'first'
  220. };
  221. },
  222. computed: {
  223. // 表格列配置
  224. seekList() {
  225. return [
  226. {
  227. label: '关键字:',
  228. value: 'keyWord',
  229. type: 'input',
  230. placeholder: ''
  231. },
  232. {
  233. label: '生产工单号:',
  234. value: 'code',
  235. type: 'input',
  236. placeholder: '',
  237. labelWidth: 100
  238. },
  239. {
  240. label: '生产订单号:',
  241. value: 'apsWorkOrderCode',
  242. type: 'input',
  243. labelWidth: 100
  244. },
  245. {
  246. label: '计划编号:',
  247. value: 'productionPlanCode',
  248. type: 'input',
  249. width: 240
  250. },
  251. {
  252. label: '计划类型:',
  253. value: 'planType',
  254. type: 'select',
  255. placeholder: '',
  256. width: 240,
  257. // 加载状态
  258. planList: this.planType
  259. },
  260. {
  261. label: '工艺路线',
  262. value: 'produceRoutingName',
  263. type: 'input',
  264. placeholder: '',
  265. width: 240
  266. },
  267. {
  268. label: '产品编码',
  269. value: 'productCode',
  270. type: 'input',
  271. placeholder: '',
  272. width: 240
  273. },
  274. {
  275. label: '产品名称:',
  276. value: 'productName',
  277. type: 'input',
  278. placeholder: '',
  279. width: 240
  280. },
  281. {
  282. label: '牌号',
  283. value: 'brandNo',
  284. type: 'input',
  285. placeholder: '',
  286. width: 240
  287. },
  288. {
  289. label: '型号',
  290. value: 'model',
  291. type: 'input',
  292. placeholder: '',
  293. width: 240
  294. },
  295. {
  296. label: '创建时间:',
  297. value: 'createTime',
  298. type: 'date',
  299. dateType: 'daterange',
  300. placeholder: '',
  301. width: 240
  302. }
  303. ];
  304. },
  305. basicColumns() {
  306. const num = this.columnsVersion;
  307. const opt = {
  308. first: [
  309. // {
  310. // prop: 'deliveryTime',
  311. // label: '预测交货日期',
  312. // align: 'center',
  313. // showOverflowTooltip: true,
  314. // minWidth: 110
  315. // }
  316. ],
  317. second: [
  318. {
  319. prop: 'completeTime',
  320. label: '完成时间',
  321. align: 'center'
  322. },
  323. {
  324. prop: 'cycle',
  325. label: '生产周期',
  326. align: 'center'
  327. }
  328. ]
  329. };
  330. return [
  331. {
  332. width: 45,
  333. type: 'selection',
  334. columnKey: 'selection',
  335. align: 'center',
  336. fixed: 'left'
  337. },
  338. {
  339. prop: 'batchNo',
  340. label: '批次号',
  341. align: 'center',
  342. minWidth: 130,
  343. showOverflowTooltip: true
  344. },
  345. {
  346. prop: 'lineNumber',
  347. label: '行号',
  348. align: 'center',
  349. minWidth: 130,
  350. showOverflowTooltip: true
  351. },
  352. {
  353. prop: 'code',
  354. slot: 'code',
  355. label: '生产工单号',
  356. align: 'center',
  357. minWidth: 110,
  358. showOverflowTooltip: true
  359. },
  360. // {
  361. // prop: 'originalCode',
  362. // label: '原始工单号',
  363. // align: 'center',
  364. // minWidth: 110
  365. // },
  366. {
  367. prop: 'QRcode',
  368. slot: 'QRcode',
  369. label: '二维码',
  370. align: 'center',
  371. minWidth: 110,
  372. showOverflowTooltip: true
  373. },
  374. {
  375. prop: 'apsWorkOrderCode',
  376. label: '生产订单号',
  377. slot: 'apsWorkOrderCode',
  378. align: 'center',
  379. minWidth: 110,
  380. showOverflowTooltip: true
  381. },
  382. {
  383. prop: 'productionPlanCode',
  384. label: '计划编号',
  385. align: 'center',
  386. minWidth: 110,
  387. showOverflowTooltip: true
  388. },
  389. {
  390. prop: 'planType',
  391. label: '计划类型',
  392. align: 'center',
  393. showOverflowTooltip: true,
  394. formatter: (row) => {
  395. const obj = this.planType.find((i) => i.value == row.planType);
  396. return obj && obj.label;
  397. }
  398. },
  399. {
  400. prop: 'bomType',
  401. label: '生产类型',
  402. align: 'center',
  403. showOverflowTooltip: true,
  404. width: 120,
  405. formatter: (row) => {
  406. if (row.bomType == 1) {
  407. return '产品(PBOM)';
  408. }
  409. if (row.bomType == 2) {
  410. return '加工(MBOM)';
  411. }
  412. if (row.bomType == 3) {
  413. return '装配(ABOM)';
  414. }
  415. // if (row.bomType == 4) {
  416. // return '装配(EBOM)';
  417. // }
  418. return '';
  419. }
  420. },
  421. {
  422. prop: 'bomCategoryName',
  423. label: 'BOM版本',
  424. align: 'center',
  425. width: 130,
  426. showOverflowTooltip: true,
  427. formatter: (row) => {
  428. if (row.bomCategoryName) {
  429. return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
  430. }
  431. return '';
  432. }
  433. },
  434. {
  435. prop: 'produceRoutingName',
  436. label: '工艺路线',
  437. align: 'center',
  438. showOverflowTooltip: true
  439. },
  440. {
  441. prop: 'productCode',
  442. label: '编码',
  443. align: 'center',
  444. showOverflowTooltip: true
  445. },
  446. {
  447. prop: 'colorKey',
  448. label: '颜色',
  449. align: 'center',
  450. showOverflowTooltip: true,
  451. minWidth: 110
  452. },
  453. {
  454. prop: 'modelKey',
  455. label: '机型',
  456. align: 'center',
  457. showOverflowTooltip: true,
  458. minWidth: 110
  459. },
  460. {
  461. prop: 'productName',
  462. label: '名称',
  463. align: 'center',
  464. showOverflowTooltip: true
  465. },
  466. {
  467. prop: 'model',
  468. label: '型号',
  469. align: 'center',
  470. showOverflowTooltip: true
  471. },
  472. {
  473. prop: 'specification',
  474. label: '规格',
  475. align: 'center',
  476. showOverflowTooltip: true
  477. },
  478. {
  479. prop: 'productionCodes',
  480. label: '生产编号',
  481. align: 'center',
  482. minWidth: 150,
  483. showOverflowTooltip: true
  484. },
  485. {
  486. prop: 'brandNo',
  487. label: '牌号',
  488. align: 'center',
  489. showOverflowTooltip: true
  490. },
  491. {
  492. prop: 'taskName',
  493. label: '工序进度',
  494. align: 'center',
  495. showOverflowTooltip: true
  496. },
  497. {
  498. prop: 'singleReport',
  499. slot: 'singleReport',
  500. label: '报工类型',
  501. align: 'center',
  502. showOverflowTooltip: true
  503. },
  504. {
  505. prop: 'outsourceStatus',
  506. label: '委外状态',
  507. align: 'center',
  508. slot: 'outsourceStatus',
  509. showOverflowTooltip: true
  510. },
  511. {
  512. prop: 'entrustStatus',
  513. label: '请托状态',
  514. align: 'center',
  515. slot: 'entrustStatus',
  516. showOverflowTooltip: true
  517. },
  518. {
  519. prop: 'priority',
  520. label: '优先级',
  521. align: 'center',
  522. minWidth: 120,
  523. slot: 'priority',
  524. sortable: 'custom'
  525. },
  526. {
  527. prop: 'formingNum',
  528. label: '要求生产数量',
  529. align: 'center',
  530. slot: 'formingNum',
  531. showOverflowTooltip: true,
  532. minWidth: 110
  533. },
  534. {
  535. prop: 'unit',
  536. label: '单位',
  537. align: 'center',
  538. showOverflowTooltip: true,
  539. minWidth: 110
  540. },
  541. {
  542. prop: 'factoriesName',
  543. label: '所属工厂',
  544. align: 'center',
  545. showOverflowTooltip: true,
  546. minWidth: 110
  547. },
  548. {
  549. prop: 'formingWeight',
  550. label: '要求生产重量',
  551. slot: 'formingWeight',
  552. align: 'center',
  553. showOverflowTooltip: true,
  554. minWidth: 110
  555. },
  556. {
  557. prop: 'formedNum',
  558. label: '已生产数量',
  559. align: 'center',
  560. showOverflowTooltip: true,
  561. minWidth: 110
  562. },
  563. {
  564. prop: 'formedWeight',
  565. label: '已生产重量',
  566. align: 'center',
  567. showOverflowTooltip: true,
  568. minWidth: 110
  569. },
  570. {
  571. prop: 'planStartTime',
  572. label: '计划开始时间',
  573. align: 'center',
  574. showOverflowTooltip: true,
  575. minWidth: 150,
  576. sortable: 'custom'
  577. },
  578. {
  579. prop: 'planCompleteTime',
  580. label: '计划结束时间',
  581. align: 'center',
  582. showOverflowTooltip: true,
  583. minWidth: 150,
  584. sortable: 'custom'
  585. },
  586. {
  587. prop: 'startTime',
  588. label: '实际开始时间',
  589. align: 'center',
  590. showOverflowTooltip: true,
  591. minWidth: 150,
  592. sortable: 'custom'
  593. },
  594. {
  595. prop: 'completeTime',
  596. label: '实际完成时间',
  597. align: 'center',
  598. showOverflowTooltip: true,
  599. minWidth: 150,
  600. sortable: 'custom'
  601. },
  602. ...opt[this.activeName],
  603. {
  604. prop: 'createTime',
  605. label: '创建时间',
  606. align: 'center',
  607. showOverflowTooltip: true,
  608. minWidth: 150,
  609. sortable: 'custom'
  610. },
  611. // {
  612. // prop: 'status',
  613. // slot: 'status',
  614. // label: '状态',
  615. // align: 'center',
  616. // formatter: (row) => {
  617. // const obj = this.statusOpt[this.activeName].find(
  618. // (i) => i.value == row.status
  619. // );
  620. // return obj && obj.label;
  621. // }
  622. // },
  623. {
  624. prop: 'deviceName',
  625. slot: 'deviceName',
  626. label: '设备名称',
  627. align: 'center',
  628. showOverflowTooltip: true
  629. },
  630. {
  631. prop: 'crewNames',
  632. slot: 'crewNames',
  633. label: '报工人员',
  634. align: 'center',
  635. showOverflowTooltip: true
  636. },
  637. {
  638. prop: 'teamName',
  639. label: '班组',
  640. align: 'center',
  641. showOverflowTooltip: true
  642. }
  643. ];
  644. },
  645. clientEnvironmentId() {
  646. return this.$store.state.user.info.clientEnvironmentId;
  647. }
  648. },
  649. methods: {
  650. datasource({ page, where, limit }) {
  651. return produceOrder({
  652. ...where,
  653. pageNum: page,
  654. size: limit
  655. });
  656. },
  657. open(list) {
  658. this.equipmentdialog = true;
  659. this.allSelection = list;
  660. this.$nextTick(() => {
  661. this.allSelection.forEach((item) => {
  662. this.$refs.equiTable.toggleRowSelection(item, true);
  663. });
  664. });
  665. },
  666. search(e) {
  667. if (Array.isArray(e.createTime) && e.createTime.length) {
  668. e.createTimeStart = e.createTime[0];
  669. e.createTimeEnd = e.createTime[1];
  670. }
  671. this.reload(e);
  672. },
  673. /* 刷新表格 */
  674. reload(where = {}) {
  675. this.$nextTick(() => {
  676. where.statusList = (
  677. where.status || this.statusOpt[this.activeName][0].value
  678. ).split(',');
  679. this.$refs.equiTable.reload({ page: 1, where });
  680. });
  681. },
  682. handleClose() {
  683. this.equipmentdialog = false;
  684. this.$refs.equiTable.clearSelection();
  685. },
  686. handleSelectionChange(data) {
  687. this.allSelection = data;
  688. },
  689. // 选择
  690. selected() {
  691. this.$emit('choose', this.selection);
  692. this.handleClose();
  693. }
  694. }
  695. };
  696. </script>
  697. <style lang="scss" scoped>
  698. .tree_col {
  699. border: 1px solid #eee;
  700. padding: 10px 0;
  701. box-sizing: border-box;
  702. max-height: 530px;
  703. overflow: auto;
  704. }
  705. .table_col {
  706. padding-left: 10px;
  707. ::v-deep .el-table th.el-table__cell {
  708. background: #f2f2f2;
  709. }
  710. }
  711. .pagination {
  712. text-align: right;
  713. padding: 10px 0;
  714. }
  715. .btns {
  716. text-align: center;
  717. padding: 10px 0;
  718. }
  719. .topsearch {
  720. margin-bottom: 15px;
  721. }
  722. </style>