inventoryTableDetails.vue 14 KB

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