addInvoiceDialog.vue 21 KB

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