pickDetail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <ele-modal
  3. width="80vw"
  4. :visible.sync="visible"
  5. custom-class="ele-dialog-form"
  6. :before-close="cancel"
  7. :title="title"
  8. :maxable="true"
  9. append-to-body
  10. >
  11. <div class="switch" style="margin-bottom: 10px">
  12. <div class="switch_left">
  13. <ul>
  14. <li
  15. v-for="item in tabOptions"
  16. :key="item.key"
  17. :class="{ active: activeComp == item.key }"
  18. @click="activeComp = item.key"
  19. >
  20. {{ item.name }}
  21. </li>
  22. </ul>
  23. </div>
  24. </div>
  25. <el-form
  26. ref="form"
  27. :model="form"
  28. :rules="rules"
  29. label-position="right"
  30. label-width="140px"
  31. v-if="activeComp == 'main'"
  32. >
  33. <el-row :gutter="10" class="basic">
  34. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  35. <el-form-item label="计划编号:">
  36. <el-input v-model="form.planCode" disabled></el-input>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  40. <el-form-item label="批次号:">
  41. <el-input v-model="form.batchNo" disabled></el-input>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  45. <el-form-item label="编码:">
  46. <el-input v-model="form.categoryCode" disabled></el-input>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  50. <el-form-item label="名称:">
  51. <el-input v-model="form.categoryName" disabled></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  55. <el-form-item label="零部件图号:">
  56. <el-input v-model="form.imgCode" disabled></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  60. <el-form-item :label="orderCodeLabel">
  61. <el-input v-model="form.code" disabled></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  65. <el-form-item label="需求订单号:">
  66. <el-input v-model="form.materialRequirements" disabled></el-input>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  70. <el-form-item label="顶级产品编号:">
  71. <el-input v-model="form.topCategoryName" disabled></el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
  75. <el-form-item label="顶级产品名称:">
  76. <el-input v-model="form.topCategoryName" disabled></el-input>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
  80. <el-form-item label="备注:">
  81. <el-input
  82. v-model="form.remark"
  83. type="textarea"
  84. :rows="2"
  85. disabled
  86. ></el-input>
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. </el-form>
  91. <ele-pro-table
  92. ref="table"
  93. :columns="columns"
  94. :datasource="form.detailList"
  95. :selection.sync="selection"
  96. row-key="id"
  97. cache-key="entrust_list_data"
  98. :height="tableHeight"
  99. :pageSize="20"
  100. @fullscreen-change="fullscreenChange"
  101. @refresh="refreshList"
  102. v-if="activeComp == 'main'"
  103. >
  104. <template v-slot:toolbar>
  105. <el-button
  106. type="primary"
  107. class="ele-btn-icon"
  108. size="small"
  109. @click="batchReturn"
  110. >批量退还</el-button
  111. >
  112. </template>
  113. <template #quantity="{ row }">
  114. <span>{{ row.quantity }}{{ row.measuringUnit }}</span>
  115. </template>
  116. <template #weight="{ row }">
  117. <span>{{ row.weight }}{{ row.weightUnit }}</span>
  118. </template>
  119. <template #componentAttribute="{ row }">
  120. <el-tag size="small" v-if="row.componentAttribute">{{
  121. componentAttributeMap[row.componentAttribute] || ''
  122. }}</el-tag>
  123. <span v-else></span>
  124. </template>
  125. <template #attributeType="{ row }">
  126. <el-tag type="success" size="small" v-if="row.attributeType">{{
  127. attributeTypeMap[row.attributeType] || ''
  128. }}</el-tag>
  129. <span v-else></span>
  130. </template>
  131. <template #borrowReturnStatus="{ row }">
  132. <el-tag size="small" v-if="row.borrowReturnStatus">{{
  133. returnStatusMap[row.borrowReturnStatus] || ''
  134. }}</el-tag>
  135. <span v-else></span>
  136. </template>
  137. <template #produceType="{ row }">
  138. <el-tag type="warning" size="small" v-if="row.produceType">{{
  139. produceTypeMap[row.produceType] || ''
  140. }}</el-tag>
  141. <span v-else></span>
  142. </template>
  143. <template #action="{ row }">
  144. <el-link
  145. :underline="false"
  146. type="primary"
  147. @click="singleOutDetailData(row)"
  148. >出库详情
  149. </el-link>
  150. </template>
  151. </ele-pro-table>
  152. <ele-pro-table
  153. ref="table"
  154. :columns="outColumns"
  155. :datasource="outList"
  156. :selection.sync="selection"
  157. row-key="id"
  158. cache-key="entrust_list_data"
  159. :height="tableHeight"
  160. :pageSize="20"
  161. @fullscreen-change="fullscreenChange"
  162. @refresh="refreshOutList"
  163. v-if="activeComp == 'out'"
  164. >
  165. <template #quantity="{ row }">
  166. <span>{{ row.quantity }}{{ row.measuringUnit }}</span>
  167. </template>
  168. <template #sourceType="{ row }">
  169. <el-tag size="small" v-if="row.sourceType">{{
  170. typeMap[row.sourceType]
  171. }}</el-tag>
  172. <span v-else></span>
  173. </template>
  174. <template #weight="{ row }">
  175. <span>{{ row.weight }}{{ row.weightUnit }}</span>
  176. </template>
  177. </ele-pro-table>
  178. <out-detail ref="outDetailRef" />
  179. </ele-modal>
  180. </template>
  181. <script>
  182. import {
  183. pickingOrderInfo,
  184. borrowOrderInfo,
  185. blankingOrderInfo,
  186. getOutOrderList,
  187. saveReturnOrder
  188. } from '@/api/requirementListOrder';
  189. import outDetail from './outDetail.vue';
  190. const COMPONENT_ATTRIBUTE_MAP = {
  191. 1: '自制件',
  192. 2: '采购件',
  193. 3: '外协件',
  194. 4: '受托件'
  195. };
  196. const ATTRIBUTE_TYPE_MAP = {
  197. 1: '总装',
  198. 2: '部装',
  199. 3: '零件',
  200. 4: '原材料'
  201. };
  202. const PRODUCE_TYPE_MAP = {
  203. 1: '加工',
  204. 2: '装配',
  205. 3: '下料'
  206. };
  207. const TYPE_MAP = {
  208. 1: '领料单',
  209. 2: '领用单',
  210. 3: '下料单'
  211. };
  212. const RETURN_STATUS_MAP = {
  213. 1: '领用中',
  214. 2: '已领用',
  215. 3: '退还中',
  216. 4: '已退还'
  217. };
  218. export default {
  219. components: { outDetail },
  220. data() {
  221. return {
  222. form: {},
  223. outList: [],
  224. rules: {},
  225. id: '',
  226. submitting: false,
  227. tableHeight: 'calc(100vh - 595px)',
  228. detailList: [],
  229. selection: [],
  230. visible: false,
  231. title: '',
  232. activeComp: 'main',
  233. tabOptions: [
  234. { key: 'main', name: '详情' },
  235. { key: 'out', name: '出库详情' }
  236. ],
  237. componentAttributeMap: COMPONENT_ATTRIBUTE_MAP,
  238. attributeTypeMap: ATTRIBUTE_TYPE_MAP,
  239. produceTypeMap: PRODUCE_TYPE_MAP,
  240. typeMap: TYPE_MAP,
  241. returnStatusMap: RETURN_STATUS_MAP,
  242. type: '',
  243. sourceCode: ''
  244. };
  245. },
  246. computed: {
  247. columns() {
  248. return [
  249. {
  250. columnKey: 'selection',
  251. type: 'selection',
  252. width: 45,
  253. align: 'center',
  254. fixed: 'left'
  255. },
  256. {
  257. columnKey: 'index',
  258. label: '序号',
  259. type: 'index',
  260. width: 55,
  261. align: 'center',
  262. showOverflowTooltip: true,
  263. fixed: 'left'
  264. },
  265. {
  266. prop: 'batchNo',
  267. label: '批次号',
  268. width: 100,
  269. align: 'center',
  270. showOverflowTooltip: true,
  271. show: this.type == 1 || this.type == 2 ? false : true
  272. },
  273. {
  274. prop: 'categoryLevelName',
  275. label: '物料分类',
  276. width: 100,
  277. align: 'center',
  278. showOverflowTooltip: true,
  279. show: this.type == 2 ? false : true
  280. },
  281. {
  282. prop: 'componentAttribute',
  283. label: '属性类型',
  284. width: 100,
  285. align: 'center',
  286. showOverflowTooltip: true,
  287. slot: 'componentAttribute',
  288. show: this.type == 2 ? false : true
  289. },
  290. {
  291. prop: 'attributeType',
  292. label: '存货类型',
  293. width: 100,
  294. align: 'center',
  295. showOverflowTooltip: true,
  296. slot: 'attributeType',
  297. show: this.type == 2 ? false : true
  298. },
  299. {
  300. prop: 'produceType',
  301. label: '生产类型',
  302. width: 100,
  303. align: 'center',
  304. showOverflowTooltip: true,
  305. slot: 'produceType',
  306. show: this.type == 2 ? false : true
  307. },
  308. {
  309. prop: 'categoryCode',
  310. label: '物料编码',
  311. width: 100,
  312. align: 'center',
  313. showOverflowTooltip: true
  314. },
  315. {
  316. prop: 'categoryName',
  317. label: '物料名称',
  318. width: 100,
  319. align: 'center',
  320. showOverflowTooltip: true
  321. },
  322. {
  323. prop: 'modelType',
  324. label: '型号',
  325. width: 100,
  326. align: 'center',
  327. showOverflowTooltip: true
  328. },
  329. {
  330. prop: 'specification',
  331. label: '规格',
  332. width: 100,
  333. align: 'center',
  334. showOverflowTooltip: true
  335. },
  336. {
  337. prop: 'categorySize',
  338. label: '尺寸',
  339. width: 100,
  340. align: 'center',
  341. showOverflowTooltip: true
  342. },
  343. {
  344. prop: 'brandNum',
  345. label: '牌号',
  346. width: 100,
  347. align: 'center',
  348. showOverflowTooltip: true
  349. },
  350. {
  351. prop: 'borrowReturnStatus',
  352. slot: 'borrowReturnStatus',
  353. label: '状态',
  354. width: 100,
  355. align: 'center',
  356. showOverflowTooltip: true
  357. },
  358. {
  359. prop: 'weight',
  360. slot: 'weight',
  361. label: '重量',
  362. width: 100,
  363. align: 'center',
  364. showOverflowTooltip: true
  365. },
  366. {
  367. prop: 'quantity',
  368. slot: 'quantity',
  369. label: '领料数量',
  370. width: 100,
  371. align: 'center',
  372. showOverflowTooltip: true
  373. },
  374. {
  375. prop: 'warehouseName',
  376. label: '仓库名称',
  377. width: 100,
  378. align: 'center',
  379. showOverflowTooltip: true,
  380. show: this.type == 1 || this.type == 2 ? false : true
  381. },
  382. {
  383. prop: 'createTime',
  384. label: '创建时间',
  385. width: 100,
  386. align: 'center',
  387. showOverflowTooltip: true
  388. },
  389. {
  390. columnKey: 'action',
  391. label: '操作',
  392. width: 200,
  393. align: 'center',
  394. resizable: false,
  395. fixed: 'right',
  396. slot: 'action'
  397. }
  398. ];
  399. },
  400. seekList() {
  401. return [
  402. {
  403. label: '编码:',
  404. value: 'categoryCode',
  405. type: 'input',
  406. labelWidth: 50
  407. }
  408. ];
  409. },
  410. orderCodeLabel() {
  411. return this.type == 1
  412. ? '领料单号'
  413. : this.type == 3
  414. ? '领用单号'
  415. : this.type == 2
  416. ? '下料单号'
  417. : '退料单号';
  418. },
  419. outColumns() {
  420. return [
  421. {
  422. columnKey: 'index',
  423. label: '序号',
  424. type: 'index',
  425. width: 55,
  426. align: 'center',
  427. showOverflowTooltip: true,
  428. fixed: 'left'
  429. },
  430. {
  431. prop: 'batchNo',
  432. label: '批次号',
  433. width: 100,
  434. align: 'center',
  435. showOverflowTooltip: true
  436. },
  437. {
  438. prop: 'brandNum',
  439. label: '牌号',
  440. width: 100,
  441. align: 'center',
  442. showOverflowTooltip: true
  443. },
  444. {
  445. prop: 'categoryCode',
  446. label: '物品编码',
  447. width: 100,
  448. align: 'center',
  449. showOverflowTooltip: true
  450. },
  451. {
  452. prop: 'categoryName',
  453. label: '物品名称',
  454. width: 100,
  455. align: 'center',
  456. showOverflowTooltip: true
  457. },
  458. {
  459. prop: 'categoryLevelName',
  460. label: '物品分类名称',
  461. width: 100,
  462. align: 'center',
  463. showOverflowTooltip: true
  464. },
  465. {
  466. prop: 'materialRequirements',
  467. label: '物料需求单号',
  468. width: 100,
  469. align: 'center',
  470. showOverflowTooltip: true
  471. },
  472. {
  473. prop: 'specification',
  474. label: '规格',
  475. width: 100,
  476. align: 'center',
  477. showOverflowTooltip: true
  478. },
  479. {
  480. prop: 'modelType',
  481. label: '型号',
  482. width: 100,
  483. align: 'center',
  484. showOverflowTooltip: true
  485. },
  486. {
  487. prop: 'planCode',
  488. label: '生产计划单号',
  489. width: 100,
  490. align: 'center',
  491. showOverflowTooltip: true
  492. },
  493. {
  494. prop: 'quantity',
  495. slot: 'quantity',
  496. label: '数量',
  497. width: 100,
  498. align: 'center',
  499. showOverflowTooltip: true
  500. },
  501. {
  502. prop: 'weight',
  503. slot: 'weight',
  504. label: '重量',
  505. width: 100,
  506. align: 'center',
  507. showOverflowTooltip: true
  508. },
  509. {
  510. prop: 'sourceCode',
  511. label: '来源编码',
  512. width: 100,
  513. align: 'center',
  514. showOverflowTooltip: true
  515. },
  516. {
  517. prop: 'sourceType',
  518. slot: 'sourceType',
  519. label: '来源类型',
  520. width: 100,
  521. align: 'center',
  522. showOverflowTooltip: true
  523. },
  524. {
  525. prop: 'substanceCode',
  526. label: '物品资产编码',
  527. width: 100,
  528. align: 'center',
  529. showOverflowTooltip: true
  530. },
  531. {
  532. prop: 'supplierCode',
  533. label: '供应商编码',
  534. width: 100,
  535. align: 'center',
  536. showOverflowTooltip: true
  537. },
  538. {
  539. prop: 'supplierName',
  540. label: '供应商名称',
  541. width: 100,
  542. align: 'center',
  543. showOverflowTooltip: true
  544. },
  545. {
  546. prop: 'warehouseName',
  547. label: '来源仓库名称',
  548. width: 100,
  549. align: 'center',
  550. showOverflowTooltip: true
  551. },
  552. {
  553. prop: 'createUserName',
  554. label: '创建人',
  555. width: 100,
  556. align: 'center',
  557. showOverflowTooltip: true
  558. },
  559. {
  560. prop: 'createTime',
  561. label: '创建时间',
  562. width: 100,
  563. align: 'center',
  564. showOverflowTooltip: true
  565. }
  566. ];
  567. }
  568. },
  569. methods: {
  570. open(item, type) {
  571. this.visible = true;
  572. this.id = item.id;
  573. this.type = type;
  574. this.sourceCode = item.code;
  575. this.title =
  576. this.type == 1
  577. ? '领料单详情'
  578. : this.type == 3
  579. ? '领用单详情'
  580. : this.type == 2
  581. ? '下料单详情'
  582. : '退料单详情';
  583. this.loadDetailData(item.id);
  584. // this.outDataDetailData(item.code);
  585. // pickOrderId: this.dataObj.id;
  586. this.outDataDetailData(this.id);
  587. },
  588. async loadDetailData(id) {
  589. const URL =
  590. this.type == 1
  591. ? pickingOrderInfo
  592. : this.type == 3
  593. ? borrowOrderInfo
  594. : blankingOrderInfo;
  595. this.form = (await URL(id)) || {};
  596. },
  597. async batchReturn() {
  598. if (!this.selection?.length) {
  599. return this.$message.warning('请先选择要退还的物料!');
  600. }
  601. if (this.type == 3) {
  602. const invalidItem = this.selection.find(
  603. (item) => item.borrowReturnStatus != 2
  604. );
  605. if (invalidItem) {
  606. return this.$message.warning('请选择已领用的物料进行退还!');
  607. }
  608. }
  609. try {
  610. await this.$confirm('是否确认批量退还所选物料?', '提示', {
  611. confirmButtonText: '确认',
  612. cancelButtonText: '取消',
  613. type: 'warning'
  614. });
  615. const loading = this.$loading({
  616. lock: true,
  617. fullscreen: true,
  618. text: '退料中...'
  619. });
  620. try {
  621. const { detailList, executorTime, ...formData } = this.form;
  622. const detailListData = this.selection.map(
  623. ({ id, ...rest }) => rest
  624. );
  625. const params = {
  626. ...formData,
  627. detailList: detailListData,
  628. returnOrderType: this.type,
  629. sourceId: this.form.id,
  630. sourceCode: this.form.code
  631. };
  632. await saveReturnOrder(params);
  633. this.$message.success('退还成功');
  634. this.selection = [];
  635. this.loadDetailData(this.id);
  636. } finally {
  637. loading.close();
  638. }
  639. } catch (e) {}
  640. },
  641. async outDataDetailData(pickOrderId) {
  642. const res = await getOutOrderList({
  643. // sourceCode
  644. pickOrderId
  645. });
  646. this.outList = res.list || [];
  647. },
  648. singleOutDetailData(item) {
  649. this.$refs.outDetailRef.open(item, this.sourceCode);
  650. },
  651. refreshList() {
  652. this.loadDetailData(this.id);
  653. },
  654. refreshOutList() {
  655. this.outDataDetailData(this.id);
  656. },
  657. cancel() {
  658. this.visible = false;
  659. },
  660. fullscreenChange(fullscreen) {
  661. this.tableHeight = fullscreen
  662. ? 'calc(100vh - 120px)'
  663. : 'calc(100vh - 595px)';
  664. }
  665. }
  666. };
  667. </script>
  668. <style scoped>
  669. ::v-deep .el-form-item {
  670. margin-bottom: 15px !important;
  671. }
  672. .btn_box {
  673. margin-bottom: 6px;
  674. }
  675. </style>