inventoryTableDetails.vue 13 KB

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