addInvoiceDialog.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. v-if="visible"
  6. :visible.sync="visible"
  7. :title="title"
  8. :close-on-click-modal="false"
  9. :append-to-body="true"
  10. width="70%"
  11. @close="cancel"
  12. :maxable="true"
  13. :resizable="true"
  14. >
  15. <div class="switch" v-if="title == '详情'">
  16. <div class="switch_left">
  17. <ul>
  18. <li
  19. v-for="item in tabOptions"
  20. :key="item.key"
  21. :class="{ active: activeComp == item.key }"
  22. @click="activeComp = item.key"
  23. >
  24. {{ item.name }}
  25. </li>
  26. </ul>
  27. </div>
  28. </div>
  29. <el-form
  30. v-show="activeComp == 'main'"
  31. ref="form"
  32. :model="form"
  33. :rules="rules"
  34. class="el-form-box"
  35. label-width="140px"
  36. >
  37. <headerTitle title="收货确认单信息"></headerTitle>
  38. <el-row :gutter="12">
  39. <el-col :span="12" v-if="title != '新增收货确认单'">
  40. <el-form-item label="收货确认单编码" prop="receiveConfirmNo">
  41. <el-input
  42. v-model="form.receiveConfirmNo"
  43. :disabled="true"
  44. placeholder=" "
  45. />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="12">
  49. <el-form-item label="收货单" prop="receiveCode">
  50. <el-input
  51. clearable
  52. v-model="form.receiveCode"
  53. @click.native="handleOrderBtn"
  54. :disabled="title == '详情'"
  55. placeholder="请输入"
  56. />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item prop="repliedFiles" label="回执附件">
  61. <fileMain
  62. v-model="form.repliedFiles"
  63. :type="title == '详情' ? 'view' : 'add'"
  64. ></fileMain>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <headerTitle title="收货信息"></headerTitle>
  69. <el-row :gutter="12">
  70. <el-col :span="12">
  71. <el-form-item label="收货单编码:" prop="receiveCode">
  72. <el-input v-model="form.receiveCode" disabled></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="12">
  76. <el-form-item prop="orderNo" label="订单编码:">
  77. <el-input v-model="form.orderNo" disabled></el-input>
  78. </el-form-item>
  79. </el-col>
  80. <!-- <el-col :span="12">
  81. <el-form-item prop="outsourceSendCode" label="委外发货单编码:">
  82. <el-input v-model="form.outsourceSendCode" disabled></el-input>
  83. </el-form-item>
  84. </el-col> -->
  85. <el-col :span="12">
  86. <el-form-item label="供应商名称:" prop="supplierName">
  87. <el-input v-model="form.supplierName" disabled></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="供应商联系人:" prop="linkName">
  92. <el-input v-model="form.linkName" disabled></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="12">
  96. <el-form-item label="供应商电话:" prop="linkPhone">
  97. <el-input v-model="form.linkPhone" disabled></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="12">
  101. <el-form-item label="车牌号:" prop="carNo">
  102. <el-input v-model="form.carNo" disabled></el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="12">
  106. <el-form-item prop="receiveDate" label="收货日期:">
  107. <el-input v-model="form.receiveDate" disabled></el-input>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="12">
  111. <el-form-item label="附件:" prop="receiveFiles">
  112. <fileMain v-model="form.receiveFiles" type="view"></fileMain>
  113. </el-form-item>
  114. </el-col>
  115. </el-row>
  116. </el-form>
  117. <headerTitle title="物品清单" v-show="activeComp == 'main'"></headerTitle>
  118. <ele-pro-table
  119. v-show="activeComp == 'main'"
  120. ref="table"
  121. :needPage="false"
  122. :columns="columns"
  123. :cache-key="cacheKeyUrl"
  124. @columns-change="handleColumnChange"
  125. :datasource="form.productList"
  126. row-key="id"
  127. max-height="500px"
  128. >
  129. <template v-slot:technicalDrawings="{ row }">
  130. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  131. </template>
  132. <template v-slot:isException="scope">
  133. <el-select
  134. v-model="scope.row.isException"
  135. :disabled="title == '详情'"
  136. placeholder="请选择"
  137. >
  138. <el-option
  139. v-for="item in options"
  140. :key="item.value"
  141. :label="item.label"
  142. :value="item.value"
  143. >
  144. </el-option>
  145. </el-select>
  146. </template>
  147. <template v-slot:totalCount="scope">
  148. <el-input
  149. :disabled="title == '详情'"
  150. v-model="scope.row.confirmCount"
  151. @input="totalCountChange(scope.row, scope.$index)"
  152. type="number"
  153. placeholder="请输入"
  154. >
  155. <template slot="append">
  156. {{ scope.row.measuringUnit }}
  157. </template>
  158. </el-input>
  159. </template>
  160. <template v-slot:remark="scope">
  161. <el-input
  162. :disabled="title == '详情'"
  163. v-model="scope.row.remark"
  164. placeholder="请输入"
  165. ></el-input>
  166. </template>
  167. </ele-pro-table>
  168. <div slot="footer" class="footer">
  169. <el-button
  170. type="primary"
  171. @click="save"
  172. v-click-once
  173. v-if="title != '详情'"
  174. >保存</el-button
  175. >
  176. <el-button
  177. type="primary"
  178. @click="save('sub')"
  179. v-click-once
  180. v-if="title != '详情'"
  181. >提交</el-button
  182. >
  183. <el-button @click="cancel">返回</el-button>
  184. </div>
  185. <process-submit-dialog
  186. :isNotNeedProcess="false"
  187. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  188. v-if="processSubmitDialogFlag"
  189. ref="processSubmitDialogRef"
  190. @reload="reload"
  191. ></process-submit-dialog>
  192. <sendListDialog
  193. ref="sendListDialogRef"
  194. @changeParent="getSaleOrderDetail"
  195. ></sendListDialog>
  196. <bpmDetail
  197. v-if="activeComp === 'bpm' && form.processInstanceId"
  198. :id="form.processInstanceId"
  199. ></bpmDetail>
  200. </ele-modal>
  201. </template>
  202. <script>
  203. import dictMixins from '@/mixins/dictMixins';
  204. import { getReceiveSaleOrderrecordDetail } from '@/api/purchasingManage/purchaseorderreceive';
  205. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  206. import tabMixins from '@/mixins/tableColumnsMixin';
  207. import sendListDialog from '@/views/purchasingManage/purchaseOrder/returnGoods/components/sendListDialog.vue';
  208. import { levelList,pricingWayList } from '@/enum/dict.js';
  209. import {
  210. addReceiveConfirmInformation,
  211. getReceiveConfirmDetail,
  212. UpdateReceiveConfirmInformation
  213. } from '@/api/purchasingManage/invoiceConfirm';
  214. import { copyObj } from '@/utils/util';
  215. import bpmDetail from '@/views/bpm/processInstance/detail.vue';
  216. let formDef = {
  217. receiveCode: '',
  218. repliedFiles: '',
  219. supplierName: '',
  220. linkName: '',
  221. linkPhone: '',
  222. carNo: '',
  223. receiveDate: '',
  224. receiveFiles: '',
  225. receiveNo: '',
  226. productList: []
  227. };
  228. export default {
  229. mixins: [dictMixins, tabMixins],
  230. components: {
  231. processSubmitDialog,
  232. sendListDialog,
  233. bpmDetail
  234. },
  235. data() {
  236. return {
  237. activeComp: 'main',
  238. billDetailDialogFlag: false,
  239. fullscreen: false,
  240. tabOptions: [
  241. { key: 'main', name: '确认单详情' },
  242. { key: 'bpm', name: '流程详情' }
  243. ],
  244. cacheKeyUrl: 'eos-purchasingManage-invoiceConfirm-inventoryTable',
  245. visible: false,
  246. processSubmitDialogFlag: false,
  247. title: '',
  248. form: {
  249. ...formDef
  250. },
  251. options: [
  252. { value: 0, label: '无异常' },
  253. { value: 1, label: '有异常' }
  254. ],
  255. rules: {
  256. sendNo: [
  257. { required: true, message: '请选择发货单', trigger: 'change' }
  258. ],
  259. repliedFiles: [
  260. { required: true, message: '请上传回执附件', trigger: 'change' }
  261. ]
  262. },
  263. // 提交状态
  264. loading: false,
  265. // 是否是修改
  266. isUpdate: false,
  267. columnsVersion: 1
  268. };
  269. },
  270. created() {
  271. this.requestDict('产地');
  272. this.requestDict('生产类型');
  273. },
  274. computed: {
  275. columns() {
  276. let columnsVersion = this.columnsVersion;
  277. return [
  278. {
  279. width: 45,
  280. type: 'index',
  281. columnKey: 'index',
  282. align: 'center',
  283. fixed: 'left'
  284. },
  285. {
  286. width: 200,
  287. prop: 'productName',
  288. label: '名称',
  289. slot: 'productName',
  290. align: 'center'
  291. },
  292. {
  293. width: 120,
  294. prop: 'productCode',
  295. label: '编码',
  296. slot: 'productCode',
  297. align: 'center'
  298. },
  299. {
  300. width: 200,
  301. prop: 'productCategoryName',
  302. label: '类型',
  303. slot: 'productCategoryName',
  304. align: 'center'
  305. },
  306. {
  307. minWidth: 150,
  308. prop: 'taskName',
  309. label: '工序',
  310. slot: 'taskName',
  311. align: 'center'
  312. },
  313. {
  314. width: 110,
  315. prop: 'batchNo',
  316. label: '批次号',
  317. slot: 'batchNo',
  318. align: 'center'
  319. },
  320. {
  321. width: 160,
  322. prop: 'productBrand',
  323. label: '牌号',
  324. slot: 'productBrand',
  325. align: 'center'
  326. },
  327. {
  328. width: 120,
  329. prop: 'modelType',
  330. label: '型号',
  331. slot: 'modelType',
  332. align: 'center'
  333. },
  334. {
  335. width: 120,
  336. prop: 'supplierMark',
  337. label: '供应商代号',
  338. slot: 'supplierMark',
  339. align: 'center'
  340. },
  341. {
  342. width: 120,
  343. prop: 'specification',
  344. label: '规格',
  345. slot: 'specification',
  346. align: 'center'
  347. },
  348. {
  349. width: 200,
  350. prop: 'warehouseName',
  351. label: '仓库名称',
  352. slot: 'warehouseName',
  353. align: 'center'
  354. },
  355. {
  356. width: 140,
  357. prop: 'pricingWay',
  358. label: '计价方式',
  359. align: 'center',
  360. fixed: 'left',
  361. formatter: (row, column) => {
  362. return pricingWayList.find((item) => item.id == row.pricingWay)
  363. ?.name;
  364. }
  365. },
  366. {
  367. width: 80,
  368. prop: 'totalCount',
  369. label: '收货数量',
  370. align: 'center',
  371. formatter: (row, column) => {
  372. if (row.totalCount) {
  373. return row.totalCount + ' ' + row.measuringUnit;
  374. }
  375. }
  376. },
  377. {
  378. width: 180,
  379. prop: 'confirmCount',
  380. label: '确认数量',
  381. slot: 'totalCount',
  382. align: 'center'
  383. },
  384. {
  385. width: 120,
  386. prop: 'singleWeight',
  387. label: '单重',
  388. slot: 'singleWeight',
  389. align: 'center'
  390. },
  391. {
  392. width: 200,
  393. prop: 'sendTotalWeight',
  394. label: '发货总重',
  395. slot: 'sendTotalWeight',
  396. align: 'center',
  397. headerSlot: 'headerTotalCount'
  398. },
  399. {
  400. width: 100,
  401. prop: 'receiveTotalWeight',
  402. label: '收货总重',
  403. slot: 'receiveTotalWeight',
  404. align: 'center'
  405. },
  406. {
  407. width: 100,
  408. prop: 'increaseTotalWeight',
  409. label: '增重重量',
  410. slot: 'increaseTotalWeight',
  411. align: 'center'
  412. },
  413. {
  414. width: 100,
  415. prop: 'weightUnit',
  416. label: '重量单位',
  417. slot: 'weightUnit',
  418. align: 'center'
  419. },
  420. {
  421. width: 120,
  422. prop: 'packingSpecification',
  423. align: 'center',
  424. label: '包装规格',
  425. showOverflowTooltip: true
  426. },
  427. {
  428. minWidth: 120,
  429. prop: 'goodsLevel',
  430. label: '物品级别',
  431. formatter: (_row, _column, cellValue) => {
  432. return levelList.find((item) => item.value == _row.goodsLevel)
  433. ?.label;
  434. },
  435. align: 'center'
  436. },
  437. {
  438. width: 160,
  439. prop: 'singlePrice',
  440. label: '单价',
  441. slot: 'singlePrice',
  442. align: 'center'
  443. },
  444. {
  445. width: 150,
  446. prop: 'notaxSinglePrice',
  447. label: '不含税单价',
  448. align: 'center'
  449. },
  450. {
  451. width: 160,
  452. prop: 'discountSinglePrice',
  453. label: '折后单价',
  454. slot: 'discountSinglePrice',
  455. align: 'center'
  456. },
  457. {
  458. width: 120,
  459. prop: 'totalPrice',
  460. label: '合计',
  461. slot: 'totalPrice',
  462. align: 'center'
  463. },
  464. {
  465. width: 160,
  466. prop: 'discountTotalPrice',
  467. label: '折后合计',
  468. slot: 'discountTotalPrice',
  469. align: 'center'
  470. },
  471. {
  472. prop: 'provenance',
  473. label: '产地',
  474. slot: 'provenance',
  475. align: 'center',
  476. minWidth: 200,
  477. showOverflowTooltip: true,
  478. formatter: (row, column) => {
  479. return row.provenance && row.provenance.length
  480. ? row.provenance
  481. .map((item) => this.getDictValue('产地', item))
  482. .join(',')
  483. : '';
  484. }
  485. },
  486. {
  487. minWidth: 120,
  488. prop: 'modelKey',
  489. label: '机型',
  490. showOverflowTooltip: true,
  491. align: 'center'
  492. },
  493. {
  494. minWidth: 120,
  495. prop: 'colorKey',
  496. showOverflowTooltip: true,
  497. label: '颜色',
  498. align: 'center'
  499. },
  500. {
  501. prop: 'productionDate',
  502. label: '生产日期',
  503. slot: 'productionDate',
  504. align: 'center',
  505. showOverflowTooltip: true,
  506. minWidth: 200
  507. },
  508. {
  509. width: 160,
  510. prop: 'deliveryDeadline',
  511. label: '交期截止日期',
  512. slot: 'deliveryDeadline',
  513. align: 'center'
  514. },
  515. {
  516. width: 200,
  517. prop: 'guaranteePeriod',
  518. label: '有效期',
  519. slot: 'guaranteePeriod',
  520. align: 'center',
  521. formatter: (_row, _column, cellValue) => {
  522. return (
  523. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  524. );
  525. }
  526. },
  527. {
  528. width: 160,
  529. prop: 'guaranteePeriodDeadline',
  530. label: '有效期截止日期',
  531. slot: 'guaranteePeriodDeadline',
  532. align: 'center'
  533. },
  534. {
  535. width: 130,
  536. prop: 'technicalAnswerName',
  537. label: '技术答疑人',
  538. slot: 'technicalAnswerName',
  539. align: 'center'
  540. },
  541. {
  542. width: 220,
  543. prop: 'technicalParams',
  544. label: '技术参数',
  545. slot: 'technicalParams',
  546. align: 'center'
  547. },
  548. {
  549. width: 240,
  550. prop: 'technicalDrawings',
  551. label: '技术图纸',
  552. slot: 'technicalDrawings',
  553. align: 'center'
  554. },
  555. {
  556. width: 220,
  557. prop: 'remark',
  558. label: '备注',
  559. slot: 'remark',
  560. align: 'center'
  561. },
  562. {
  563. width: 120,
  564. slot: 'isException',
  565. prop: 'isException',
  566. label: '收货状态',
  567. align: 'center',
  568. fixed: 'right'
  569. }
  570. ];
  571. }
  572. },
  573. methods: {
  574. //选择发货单回调
  575. handleOrderBtn() {
  576. this.$refs.sendListDialogRef.open();
  577. },
  578. //发货单详情
  579. async getSaleOrderDetail(res) {
  580. this.loading = true;
  581. let row = await getReceiveSaleOrderrecordDetail(res.id);
  582. this.loading = false;
  583. row.productList = row.productList.map((item) => {
  584. delete item.id;
  585. item['isException'] = 0;
  586. item['confirmCount'] = item.totalCount;
  587. return item;
  588. });
  589. if (row) {
  590. row.receiveId = row.id;
  591. row.receiveCode = row.receiveNo;
  592. row.reviewStatus = 0;
  593. row.processInstanceId = '';
  594. let data = copyObj(row);
  595. delete data.id;
  596. if (this.isUpdate) {
  597. data.receiveConfirmNo = this.form.receiveConfirmNo;
  598. data.id = this.form.id;
  599. data.reviewStatus = this.form.reviewStatus;
  600. data.processInstanceId = this.form.processInstanceId;
  601. }
  602. this.form = data;
  603. }
  604. },
  605. // //发货单确认详情
  606. async getSendSaleOrderDetail(id) {
  607. this.businessId = id;
  608. this.loading = true;
  609. const data = await getReceiveConfirmDetail(id);
  610. this.loading = false;
  611. if (data) {
  612. this.form = data;
  613. }
  614. },
  615. //打开新增编辑弹框
  616. async open(type, row, invoiceData) {
  617. this.activeComp = 'main';
  618. this.title =
  619. type === 'add' ? '新增收货确认单' : type === 'view' ? '详情' : '修改';
  620. this.visible = true;
  621. if (row && row?.id) {
  622. await this.getSendSaleOrderDetail(row?.id);
  623. }
  624. if (invoiceData) {
  625. this.changeOrder(invoiceData);
  626. }
  627. this.isUpdate = type != 'add';
  628. },
  629. totalCountChange(row, index) {
  630. if (row.confirmCount < 0) {
  631. this.$set(this.form.productList[index], 'confirmCount', 0);
  632. }
  633. if (row.confirmCount && row.singlePrice) {
  634. this.$set(
  635. this.form.productList[index],
  636. 'totalPrice',
  637. row.confirmCount * row.singlePrice
  638. );
  639. }
  640. },
  641. getValidate() {
  642. return Promise.all([
  643. new Promise((resolve, reject) => {
  644. this.$refs.form.validate((valid) => {
  645. if (!valid) {
  646. reject(false);
  647. } else {
  648. resolve(true);
  649. }
  650. });
  651. })
  652. ]).catch((e) => {
  653. this.$message.warning('有必填项未填写,请检查');
  654. return Promise.reject(e);
  655. });
  656. },
  657. // 添加
  658. handlAdd() {
  659. if (!this.form.sendNo) return this.$message.error('请先选择来源单据');
  660. this.handleSelectGoods();
  661. },
  662. async save(type) {
  663. try {
  664. await this.getValidate();
  665. // 表单验证通过,执行保存操作
  666. this.loading = true;
  667. if (!this.isUpdate) {
  668. delete this.form.id;
  669. }
  670. this.form.repliedFiles = this.form.repliedFiles || [];
  671. this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
  672. let commitData = Object.assign({}, this.form);
  673. const API = this.isUpdate
  674. ? UpdateReceiveConfirmInformation
  675. : addReceiveConfirmInformation;
  676. API(commitData)
  677. .then((res) => {
  678. this.loading = false;
  679. // this.$message.success('修改成功');
  680. if (type === 'sub') {
  681. this.sendSubmit(res);
  682. return;
  683. }
  684. this.cancel();
  685. this.$emit('done');
  686. })
  687. .catch((e) => {
  688. //this.loading = false;
  689. });
  690. } catch (error) {
  691. console.log(error);
  692. // 表单验证未通过,不执行保存操作
  693. }
  694. },
  695. async sendSubmit(res) {
  696. const data = await getReceiveConfirmDetail(this.businessId || res);
  697. this.processSubmitDialogFlag = true;
  698. this.$nextTick(() => {
  699. let params = {
  700. businessId: this.businessId || res,
  701. businessKey: 'purchase_receive_confirm_approve',
  702. formCreateUserId: data.createUserId,
  703. variables: {
  704. businessCode: data.receiveConfirmNo,
  705. businessName: data.supplierName,
  706. businessType: '收货确认单'
  707. }
  708. };
  709. this.$refs.processSubmitDialogRef.init(params);
  710. });
  711. },
  712. remove(index) {
  713. this.form.productList.splice(index, 1);
  714. },
  715. reload() {
  716. this.cancel();
  717. this.$emit('done');
  718. },
  719. cancel() {
  720. this.$nextTick(() => {
  721. // 关闭后,销毁所有的表单数据
  722. this.form = formDef;
  723. this.visible = false;
  724. });
  725. }
  726. }
  727. };
  728. </script>
  729. <style scoped lang="scss">
  730. .TotalAmount {
  731. font-size: 16px;
  732. padding-right: 30px;
  733. }
  734. .headbox {
  735. display: flex;
  736. justify-content: flex-start;
  737. align-items: center;
  738. .amount {
  739. font-size: 14px;
  740. font-weight: bold;
  741. margin-right: 20px;
  742. }
  743. }
  744. </style>