inventoryTableDetails.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <el-form ref="form">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. :toolkit="[]"
  8. :datasource="form.datasource"
  9. cache-key="systemRoleTable17"
  10. class="time-form"
  11. >
  12. <template v-slot:technicalDrawings="scope">
  13. <el-form-item
  14. style="margin-bottom: 20px"
  15. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  16. >
  17. <fileMain
  18. v-model="scope.row.technicalDrawings"
  19. type="view"
  20. ></fileMain>
  21. </el-form-item>
  22. </template>
  23. <template v-slot:customerReqFiles="scope">
  24. <el-form-item
  25. style="margin-bottom: 20px"
  26. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  27. >
  28. <fileMain v-model="scope.row.customerReqFiles" type="view"></fileMain>
  29. </el-form-item>
  30. </template>
  31. <template v-slot:industryArtFiles="scope">
  32. <el-form-item
  33. style="margin-bottom: 20px"
  34. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  35. >
  36. <fileMain v-model="scope.row.industryArtFiles" type="view"></fileMain>
  37. </el-form-item>
  38. </template>
  39. <template v-slot:otherFiles="scope">
  40. <el-form-item
  41. style="margin-bottom: 20px"
  42. :prop="'datasource.' + scope.$index + '. otherFiles'"
  43. >
  44. <fileMain v-model="scope.row.otherFiles" type="view"></fileMain>
  45. </el-form-item>
  46. </template>
  47. <!-- 表头工具栏 -->
  48. <template v-slot:toolbar>
  49. <div class="headbox">
  50. <div class="pricebox">
  51. <span class="amount" v-if="isAllPrice">总计:{{ allPrice }}元</span>
  52. <span class="amount" v-if="isDiscountTotalPrice"
  53. >优惠后总金额:{{ form.discountTotalPrice }}元</span
  54. >
  55. </div>
  56. </div>
  57. </template>
  58. </ele-pro-table>
  59. </el-form>
  60. </template>
  61. <script>
  62. import dictMixins from '@/mixins/dictMixins';
  63. import fileMain from '@/components/addDoc/index.vue';
  64. import { contactQueryByCategoryIdsAPI } from '@/api/bpm/components/supplierManage/contact';
  65. const dayjs = require('dayjs');
  66. export default {
  67. mixins: [dictMixins],
  68. components: {
  69. fileMain
  70. },
  71. props: {
  72. isDiscountTotalPrice: {
  73. default: false,
  74. type: Boolean
  75. },
  76. isDiscount: {
  77. //折让
  78. type: Boolean,
  79. default: true
  80. },
  81. isCustomerMark: {
  82. //客户代号必填
  83. type: Boolean,
  84. default: false
  85. },
  86. pageName: {
  87. default: ''
  88. },
  89. isChangeCount: {
  90. //默认计算
  91. type: Boolean,
  92. default: true
  93. },
  94. contractBookType: {
  95. //合同类型 1销售 2采购
  96. type: [String, Number],
  97. default: 1
  98. },
  99. isAllPrice: {
  100. //是否显示合计
  101. type: Boolean,
  102. default: true
  103. }
  104. },
  105. data() {
  106. return {
  107. allPrice: 0,
  108. form: {
  109. discountTotalPrice: 0,
  110. datasource: []
  111. },
  112. columns: [
  113. {
  114. width: 45,
  115. type: 'index',
  116. columnKey: 'index',
  117. align: 'center'
  118. },
  119. {
  120. width: 280,
  121. prop: 'productName',
  122. label: '名称',
  123. slot: 'productName',
  124. headerSlot: 'headerProductName',
  125. align: 'center'
  126. },
  127. {
  128. width: 120,
  129. prop: 'productCode',
  130. label: '编码',
  131. slot: 'productCode',
  132. align: 'center'
  133. },
  134. {
  135. width: 200,
  136. prop: 'productCategoryName',
  137. label: '类型',
  138. slot: 'productCategoryName',
  139. align: 'center'
  140. },
  141. {
  142. width: 120,
  143. prop: 'specification',
  144. label: '规格',
  145. slot: 'specification',
  146. align: 'center'
  147. },
  148. {
  149. width: 200,
  150. prop: 'customerMark',
  151. label: '客户代号',
  152. slot: 'customerMark',
  153. headerSlot: 'headerCustomerMark',
  154. align: 'center',
  155. show: this.contractBookType == 1
  156. },
  157. {
  158. width: 200,
  159. prop: 'supplierMark',
  160. label: '供应商代号',
  161. slot: 'supplierMark',
  162. headerSlot: 'headerSupplierMark',
  163. align: 'center',
  164. show: this.contractBookType == 2
  165. },
  166. {
  167. minWidth: 120,
  168. prop: 'entrustedEnterpriseId',
  169. label: '受托企业',
  170. slot: 'entrustedEnterpriseId',
  171. show: this.isCustomerMark,
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. formatter: (row, column) => {
  175. return (
  176. (this.supplierObj &&
  177. this.supplierObj[row.productId]?.find(
  178. (item) => item.id === row.entrustedEnterpriseId
  179. )?.name) ||
  180. ''
  181. );
  182. }
  183. },
  184. {
  185. width: 150,
  186. prop: 'totalCount',
  187. label: '数量',
  188. slot: 'totalCount',
  189. headerSlot: 'headerTotalCount',
  190. align: 'center'
  191. },
  192. {
  193. width: 120,
  194. prop: 'measuringUnit',
  195. label: '计量单位',
  196. slot: 'measuringUnit',
  197. align: 'center'
  198. },
  199. {
  200. minWidth: 110,
  201. prop: 'sendTotalCount',
  202. label: '已发货数量',
  203. slot: 'sendTotalCount',
  204. show: this.pageName == 'send',
  205. align: 'center'
  206. },
  207. {
  208. minWidth: 110,
  209. prop: 'notSendTotalCount',
  210. label: '未发货数量',
  211. slot: 'notSendTotalCount',
  212. show: this.pageName == 'send',
  213. align: 'center'
  214. },
  215. {
  216. width: 120,
  217. prop: 'singleWeight',
  218. label: '单重',
  219. slot: 'singleWeight',
  220. headerSlot: 'headerSingleWeight',
  221. align: 'center'
  222. },
  223. {
  224. width: 120,
  225. prop: 'totalWeight',
  226. label: '总重',
  227. slot: 'totalWeight',
  228. align: 'center'
  229. },
  230. {
  231. width: 120,
  232. prop: 'weightUnit',
  233. label: '重量单位',
  234. slot: 'weightUnit',
  235. align: 'center'
  236. },
  237. {
  238. width: 160,
  239. prop: 'pricingWay',
  240. label: '计价方式',
  241. slot: 'pricingWay',
  242. align: 'center',
  243. formatter: (row, column) => {
  244. return row.pricingWay == 1
  245. ? '按数量计费'
  246. : row.pricingWay == 2
  247. ? '按重量计费'
  248. : '';
  249. }
  250. },
  251. {
  252. width: 200,
  253. prop: 'singlePrice',
  254. label: '单价',
  255. slot: 'singlePrice',
  256. headerSlot: 'headerSinglePrice',
  257. align: 'center'
  258. },
  259. {
  260. width: 160,
  261. prop: 'taxRate',
  262. label: '税率',
  263. slot: 'taxRate',
  264. align: 'center'
  265. },
  266. {
  267. width: 160,
  268. prop: 'discountSinglePrice',
  269. label: '折让单价',
  270. align: 'center',
  271. show: this.isDiscount,
  272. formatter: (_row, _column, cellValue) => {
  273. return _row.discountSinglePrice
  274. ? Number(_row.discountSinglePrice).toFixed(2)
  275. : '';
  276. }
  277. },
  278. {
  279. width: 120,
  280. prop: 'totalPrice',
  281. label: '合计',
  282. slot: 'totalPrice',
  283. align: 'center'
  284. },
  285. {
  286. width: 160,
  287. prop: 'discountTotalPrice',
  288. label: '折让合计',
  289. align: 'center',
  290. show: this.isDiscount,
  291. formatter: (_row, _column, cellValue) => {
  292. return _row.discountTotalPrice
  293. ? Number(_row.discountTotalPrice).toFixed(2)
  294. : '';
  295. }
  296. },
  297. {
  298. width: 160,
  299. prop: 'productBrand',
  300. label: '牌号',
  301. slot: 'productBrand',
  302. align: 'center'
  303. },
  304. {
  305. width: 120,
  306. prop: 'modelType',
  307. label: '型号',
  308. slot: 'modelType',
  309. align: 'center'
  310. },
  311. {
  312. width: 120,
  313. prop: 'imgCode',
  314. align: 'center',
  315. label: '图号/件号',
  316. showOverflowTooltip: true
  317. },
  318. {
  319. prop: 'provenance',
  320. label: '产地',
  321. slot: 'provenance',
  322. align: 'center',
  323. show:this.contractBookType==2,
  324. minWidth: 200,
  325. showOverflowTooltip: true,
  326. formatter: (row, column) => {
  327. return row.provenance && row.provenance.length
  328. ? row.provenance
  329. .map((item) => this.getDictValue('产地', item ))
  330. .join(',')
  331. : '';
  332. }
  333. },
  334. {
  335. width: 120,
  336. prop: 'produceType',
  337. align: 'center',
  338. label: '生产类型',
  339. showOverflowTooltip: true,
  340. formatter: (row, column) => {
  341. return row?.produceType
  342. ?.map((item) => {
  343. return this.getDictValue('生产类型', item);
  344. })
  345. ?.toString();
  346. }
  347. },
  348. {
  349. width: 120,
  350. prop: 'approvalNumber',
  351. align: 'center',
  352. label: '批准文号',
  353. showOverflowTooltip: true
  354. },
  355. {
  356. width: 120,
  357. prop: 'packingSpecification',
  358. align: 'center',
  359. label: '包装规格',
  360. showOverflowTooltip: true
  361. },
  362. {
  363. width: 160,
  364. prop: 'customerExpectDeliveryDeadline',
  365. label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
  366. slot: 'customerExpectDeliveryDeadline',
  367. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  368. align: 'center'
  369. },
  370. {
  371. width: 160,
  372. prop: 'produceDeliveryDeadline',
  373. label: '生产交付交期',
  374. slot: 'produceDeliveryDeadline',
  375. headerSlot: 'headerProduceDeliveryDeadline',
  376. show: this.contractBookType == 1,
  377. align: 'center'
  378. },
  379. {
  380. width: 200,
  381. prop: 'guaranteePeriod',
  382. label: '质保期',
  383. slot: 'guaranteePeriod',
  384. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  385. align: 'center',
  386. formatter: (_row, _column, cellValue) => {
  387. return (
  388. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  389. );
  390. }
  391. },
  392. {
  393. width: 200,
  394. prop: 'guaranteePeriodDeadline',
  395. label: '质保期截止日期',
  396. slot: 'guaranteePeriodDeadline',
  397. align: 'center'
  398. },
  399. {
  400. width: 220,
  401. prop: 'customerReqFiles',
  402. label: '客户需求',
  403. slot: 'customerReqFiles',
  404. align: 'center'
  405. },
  406. {
  407. width: 130,
  408. prop: 'technicalAnswerName',
  409. label: '技术答疑人',
  410. slot: 'technicalAnswerName',
  411. align: 'center'
  412. },
  413. {
  414. width: 220,
  415. prop: 'technicalParams',
  416. label: '技术参数',
  417. slot: 'technicalParams',
  418. align: 'center'
  419. },
  420. {
  421. width: 240,
  422. prop: 'technicalDrawings',
  423. label: '技术图纸',
  424. slot: 'technicalDrawings',
  425. align: 'center'
  426. },
  427. {
  428. width: 240,
  429. prop: 'technologyRouteName',
  430. label: '工艺路线',
  431. slot: 'technologyRouteName',
  432. align: 'center'
  433. },
  434. {
  435. width: 240,
  436. prop: 'industryArtFiles',
  437. label: '工艺附件',
  438. slot: 'industryArtFiles',
  439. align: 'center'
  440. },
  441. {
  442. width: 240,
  443. prop: 'otherFiles',
  444. label: '其他附件',
  445. slot: 'otherFiles',
  446. align: 'center'
  447. },
  448. {
  449. width: 220,
  450. prop: 'remark',
  451. label: '备注',
  452. slot: 'remark',
  453. align: 'center'
  454. }
  455. ]
  456. };
  457. },
  458. computed: {},
  459. created() {
  460. this.requestDict('生产类型');
  461. this.requestDict('产地');
  462. this.requestDict('保质期单位');
  463. },
  464. methods: {
  465. // async getSupplierObj(productList, queryName) {
  466. // try {
  467. // let categoryIds = productList.map((item) => item[queryName]);
  468. // return await contactQueryByCategoryIdsAPI({
  469. // categoryIds,
  470. // isQueryEE: 1
  471. // });
  472. // } catch (e) {
  473. // return Promise.resolve({});
  474. // }
  475. // },
  476. // 返回列表数据
  477. getTableValue() {
  478. let comitDatasource = this.form.datasource;
  479. if (comitDatasource.length === 0) return [];
  480. comitDatasource.forEach((v) => {
  481. if (v.guaranteePeriodUnitCode) {
  482. v.guaranteePeriodUnitName = this.getDictValue(
  483. '保质期单位',
  484. v.guaranteePeriodUnitCode
  485. );
  486. }
  487. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  488. v.customerReqFiles = v.customerReqFiles || [];
  489. v.industryArtFiles = v.industryArtFiles || [];
  490. v.otherFiles = v.otherFiles || [];
  491. });
  492. return comitDatasource;
  493. },
  494. setDeliveryDays() {
  495. console.log(this.form.datasource,'this.form.datasource')
  496. this.form.datasource.forEach((item, i) => {
  497. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  498. item.guaranteePeriodUnitCode
  499. );
  500. this.$set(
  501. this.form.datasource[i],
  502. 'guaranteePeriodDeadline',
  503. guaranteePeriodUnitName != 'second'
  504. ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
  505. : ''
  506. );
  507. // }
  508. });
  509. },
  510. guaranteePeriodUnit(code) {
  511. return code == 3
  512. ? 'day'
  513. : code == 4
  514. ? 'month'
  515. : code == 5
  516. ? 'year'
  517. : 'second';
  518. },
  519. setDay(addDay, dateType = 'day') {
  520. console.log(addDay)
  521. return dayjs(this.contractStartDate || new Date())
  522. .add(addDay, dateType)
  523. .format('YYYY-MM-DD');
  524. },
  525. //修改回显
  526. async putTableValue(data) {
  527. console.log(data, 'dasdas');
  528. let productList =
  529. (data &&
  530. (data.quoteProductList || data.productList || data.detailList)) ||
  531. [];
  532. if (productList) {
  533. this.form.datasource = productList;
  534. this.allPrice =
  535. data.totalAmount || data.totalPrice || data?.contractVO?.totalPrice;
  536. if (this.isDiscountTotalPrice) {
  537. this.form.discountTotalPrice =
  538. data.payAmount ||
  539. data.discountTotalPrice ||
  540. data?.contractVO?.discountTotalPrice;
  541. }
  542. this.setDeliveryDays();
  543. // this.supplierObj = await this.getSupplierObj(
  544. // productList,
  545. // 'productId'
  546. // );
  547. this.$refs.table.reload();
  548. }
  549. }
  550. }
  551. };
  552. </script>
  553. <style lang="scss" scoped>
  554. .headbox {
  555. display: flex;
  556. justify-content: space-between;
  557. align-items: center;
  558. .amount {
  559. font-size: 14px;
  560. font-weight: bold;
  561. padding-right: 30px;
  562. }
  563. }
  564. .time-form .el-form-item {
  565. margin-bottom: 0 !important;
  566. }
  567. ::v-deep .period {
  568. display: flex;
  569. .borderleftnone {
  570. .el-input--medium .el-input__inner {
  571. border-top-right-radius: 0;
  572. border-bottom-right-radius: 0;
  573. }
  574. }
  575. .borderrightnone {
  576. .el-input--medium .el-input__inner {
  577. border-top-left-radius: 0;
  578. border-bottom-left-radius: 0;
  579. }
  580. }
  581. }
  582. ::v-deep .time-form tbody > tr:hover > td {
  583. background-color: transparent !important;
  584. }
  585. ::v-deep .time-form .el-table tr {
  586. background-color: #ffffff;
  587. }
  588. .pricebox {
  589. display: flex;
  590. justify-content: flex-start;
  591. align-items: center;
  592. font-weight: bold;
  593. }
  594. </style>