inventoryTableDetails.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  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. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  15. >
  16. <fileMain
  17. v-model="scope.row.technicalDrawings"
  18. type="view"
  19. ></fileMain>
  20. </el-form-item>
  21. </template>
  22. <template v-slot:customerReqFiles="scope">
  23. <el-form-item
  24. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  25. >
  26. <fileMain v-model="scope.row.customerReqFiles" type="view"></fileMain>
  27. </el-form-item>
  28. </template>
  29. <template v-slot:industryArtFiles="scope">
  30. <el-form-item
  31. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  32. >
  33. <fileMain v-model="scope.row.industryArtFiles" type="view"></fileMain>
  34. </el-form-item>
  35. </template>
  36. <template v-slot:otherFiles="scope">
  37. <el-form-item :prop="'datasource.' + scope.$index + '. otherFiles'">
  38. <fileMain v-model="scope.row.otherFiles" type="view"></fileMain>
  39. </el-form-item>
  40. </template>
  41. <template v-slot:customerExpectDeliveryDeadline="scope">
  42. <div v-if="scope.row.arrivalWay == 1 || !scope.row.arrivalWay">
  43. {{ scope.row.customerExpectDeliveryDeadline }}
  44. </div>
  45. <div v-if="scope.row.arrivalWay == 2">
  46. <el-link
  47. type="primary"
  48. :underline="false"
  49. @click.native="handleMethod(scope.row)"
  50. >
  51. 查看分批时间
  52. </el-link>
  53. </div>
  54. </template>
  55. <template v-slot:saleCount="scope">
  56. <el-form-item
  57. :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
  58. >
  59. {{ scope.row[countObj.countKey] }}
  60. {{ scope.row[countObj.unitKey] }}
  61. </el-form-item>
  62. </template>
  63. <!-- <template v-slot:saleUnit="scope">
  64. <el-form-item
  65. :prop="'datasource.' + scope.$index + '.' + countObj.unitKey"
  66. >
  67. {{ scope.row[countObj.unitKey] }}
  68. </el-form-item>
  69. </template> -->
  70. <!-- 表头工具栏 -->
  71. <template v-slot:toolbar>
  72. <div class="headbox">
  73. <div class="pricebox">
  74. <span class="amount" v-if="isAllPrice">总计:{{ allPrice }}元</span>
  75. <span class="amount" v-if="isDiscountTotalPrice"
  76. >优惠后总金额:{{ form.discountTotalPrice }}元</span
  77. >
  78. </div>
  79. </div>
  80. </template>
  81. </ele-pro-table>
  82. <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
  83. </el-form>
  84. </template>
  85. <script>
  86. import dictMixins from '@/mixins/dictMixins';
  87. // import fileMain from '@/components/addDoc/index.vue';
  88. import { contactQueryByCategoryIdsAPI } from '@/api/bpm/components/supplierManage/contact';
  89. const dayjs = require('dayjs');
  90. import { lbjtList, levelList } from '@/enum/dict.js';
  91. import timeDialog from '@/components/timeDialog/index.vue';
  92. export default {
  93. mixins: [dictMixins],
  94. components: {
  95. // fileMain,
  96. timeDialog
  97. },
  98. props: {
  99. isDiscountTotalPrice: {
  100. default: false,
  101. type: Boolean
  102. },
  103. isDiscount: {
  104. //折让
  105. type: Boolean,
  106. default: true
  107. },
  108. isCustomerMark: {
  109. //客户代号必填
  110. type: Boolean,
  111. default: false
  112. },
  113. pageName: {
  114. default: ''
  115. },
  116. isChangeCount: {
  117. //默认计算
  118. type: Boolean,
  119. default: true
  120. },
  121. contractBookType: {
  122. //合同类型 1销售 2采购
  123. type: [String, Number],
  124. default: 1
  125. },
  126. isAllPrice: {
  127. //是否显示合计
  128. type: Boolean,
  129. default: true
  130. },
  131. //是否显示订单编码
  132. isOrderNo: {
  133. type: Boolean,
  134. default: false
  135. },
  136. isArrivalWay: {
  137. type: Boolean,
  138. default: false
  139. },
  140. countObj: {
  141. type: Object,
  142. default: () => {
  143. return {
  144. countKey: 'saleCount',
  145. unitKey: 'saleUnit',
  146. unitIdKey: 'saleUnitId'
  147. };
  148. }
  149. },
  150. //是否显示生产要求
  151. isProductionRequirements: {
  152. type: Boolean,
  153. default: false
  154. },
  155. quoteType: {
  156. type: Number,
  157. default: 1
  158. }
  159. },
  160. data() {
  161. return {
  162. allPrice: 0,
  163. form: {
  164. discountTotalPrice: 0,
  165. datasource: []
  166. }
  167. };
  168. },
  169. computed: {
  170. columns() {
  171. // 基础列(新增字段之前的列)
  172. const baseColumns = [
  173. {
  174. width: 45,
  175. type: 'index',
  176. columnKey: 'index',
  177. align: 'center'
  178. },
  179. {
  180. minWidth: 200,
  181. prop: 'orderNo',
  182. label: '订单编码',
  183. showOverflowTooltip: true,
  184. align: 'center',
  185. isNone: !this.isOrderNo
  186. },
  187. {
  188. width: 280,
  189. prop: 'productName',
  190. label: '名称',
  191. slot: 'productName',
  192. headerSlot: 'headerProductName',
  193. align: 'center'
  194. },
  195. {
  196. width: 120,
  197. prop: 'productCode',
  198. label: '编码',
  199. slot: 'productCode',
  200. align: 'center'
  201. },
  202. {
  203. width: 200,
  204. prop: 'productCategoryName',
  205. label: '类型',
  206. slot: 'productCategoryName',
  207. align: 'center'
  208. },
  209. {
  210. width: 120,
  211. prop: 'specification',
  212. label: '规格',
  213. slot: 'specification',
  214. align: 'center'
  215. }
  216. ];
  217. // 条件显示的新增字段列(仅当quoteType为2时显示)
  218. const additionalColumns =
  219. this.quoteType === 2
  220. ? [
  221. // 新增字段:厚度
  222. {
  223. width: 150,
  224. prop: 'thickNess',
  225. label: '厚度',
  226. slot: 'thickNess',
  227. formatter: (row, column) => {
  228. if (row.thickNess) {
  229. return row.thickNess + ' mm';
  230. }
  231. },
  232. align: 'center'
  233. },
  234. // 新增字段:平方数
  235. {
  236. width: 150,
  237. prop: 'squareNumber',
  238. label: '平方数',
  239. formatter: (row, column) => {
  240. if (row.squareNumber) {
  241. return row.squareNumber + ' cm²';
  242. }
  243. },
  244. align: 'center'
  245. },
  246. // 新增字段:加工费(未税)
  247. {
  248. width: 150,
  249. prop: 'processingFeeBeforeTax',
  250. label: '加工费(未税)',
  251. formatter: (row, column) => {
  252. if (row.processingFeeBeforeTax) {
  253. return row.processingFeeBeforeTax + ' 元';
  254. }
  255. },
  256. align: 'center'
  257. },
  258. // 新增字段:包装费(未税)
  259. {
  260. width: 150,
  261. prop: 'packagingFeeNotTaxed',
  262. label: '包装费(未税)',
  263. formatter: (row, column) => {
  264. if (row.packagingFeeNotTaxed) {
  265. return row.packagingFeeNotTaxed + ' 元';
  266. }
  267. },
  268. align: 'center'
  269. },
  270. // 新增字段:运输费(未税)
  271. {
  272. width: 150,
  273. prop: 'transportationFeeWithoutTax',
  274. label: '运输费(未税)',
  275. formatter: (row, column) => {
  276. if (row.transportationFeeWithoutTax) {
  277. return row.transportationFeeWithoutTax + ' 元';
  278. }
  279. },
  280. align: 'center'
  281. },
  282. // 新增字段:未税小计
  283. {
  284. width: 150,
  285. prop: 'quotationSubtotalBeforeTax',
  286. label: '未税小计',
  287. align: 'center',
  288. formatter: (row, column) => {
  289. if (row.quotationSubtotalBeforeTax) {
  290. return row.quotationSubtotalBeforeTax + ' 元';
  291. }
  292. }
  293. },
  294. // 新增字段:税率(%)
  295. {
  296. width: 150,
  297. prop: 'extraTax',
  298. label: '税率(%)',
  299. align: 'center',
  300. formatter: (row, column) => {
  301. return row.extraTax;
  302. }
  303. },
  304. // 新增字段:含税小计
  305. {
  306. width: 150,
  307. prop: 'quotationSubtotalTax',
  308. label: '含税小计',
  309. align: 'center',
  310. formatter: (row, column) => {
  311. if (row.quotationSubtotalTax) {
  312. return row.quotationSubtotalTax + ' 元';
  313. }
  314. }
  315. }
  316. ]
  317. : [];
  318. const remainingColumns = [
  319. {
  320. width: 200,
  321. prop: 'customerMark',
  322. label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
  323. slot: 'customerMark',
  324. headerSlot: 'headerCustomerMark',
  325. isNone: this.quoteType === 2,
  326. align: 'center'
  327. },
  328. {
  329. minWidth: 240,
  330. prop: 'taskName',
  331. label: '工序',
  332. slot: 'taskName',
  333. align: 'center'
  334. },
  335. {
  336. minWidth: 160,
  337. prop: 'productionCodes',
  338. label: '生产编号',
  339. isNone: this.quoteType === 2,
  340. align: 'center'
  341. },
  342. {
  343. minWidth: 280,
  344. prop: 'productionRequirements',
  345. label: '生产要求',
  346. align: 'center',
  347. isNone: !this.isProductionRequirements
  348. },
  349. {
  350. minWidth: 120,
  351. prop: 'entrustedEnterpriseId',
  352. label: '受托企业',
  353. slot: 'entrustedEnterpriseId',
  354. isNone: !this.isCustomerMark,
  355. align: 'center',
  356. showOverflowTooltip: true,
  357. formatter: (row, column) => {
  358. return (
  359. this.supplierObj[row.productId]?.find(
  360. (item) => item.id === row.entrustedEnterpriseId
  361. )?.name || ''
  362. );
  363. }
  364. },
  365. {
  366. width: 180,
  367. prop: 'saleCount',
  368. label: '数量',
  369. slot: 'saleCount',
  370. headerSlot: 'headerTotalCount',
  371. align: 'center'
  372. },
  373. {
  374. width: 120,
  375. prop: 'packingSpecification',
  376. align: 'center',
  377. label: '包装规格',
  378. isNone: this.quoteType === 2,
  379. showOverflowTooltip: true
  380. },
  381. {
  382. width: 150,
  383. prop: 'totalCount',
  384. label: '计量数量',
  385. slot: 'totalCount',
  386. isNone: this.quoteType === 2,
  387. headerSlot: 'headerTotalCount',
  388. formatter: (row, column) => {
  389. if (row.totalCount) {
  390. return row.totalCount + ' ' + row.measuringUnit;
  391. }
  392. },
  393. align: 'center'
  394. },
  395. {
  396. width: 140,
  397. prop: 'singleWeight',
  398. label: '单重',
  399. slot: 'singleWeight',
  400. isNone: this.quoteType === 2,
  401. headerSlot: 'headerSingleWeight',
  402. formatter: (row, column) => {
  403. if (row.singleWeight) {
  404. return row.singleWeight + ' ' + row.weightUnit;
  405. }
  406. },
  407. align: 'center'
  408. },
  409. {
  410. width: 140,
  411. prop: 'totalWeight',
  412. label: '总重',
  413. slot: 'totalWeight',
  414. formatter: (row, column) => {
  415. if (row.totalWeight) {
  416. return row.totalWeight + ' ' + row.weightUnit;
  417. }
  418. },
  419. align: 'center'
  420. },
  421. {
  422. width: 160,
  423. prop: 'goodsPriceType',
  424. label: '价格类型',
  425. isNone: this.quoteType === 2,
  426. formatter: (row, column) => {
  427. return this.getDictValue('商品价格类型', row.goodsPriceType);
  428. },
  429. align: 'center'
  430. },
  431. {
  432. width: 200,
  433. prop: 'singlePrice',
  434. label: '单价',
  435. slot: 'singlePrice',
  436. isNone: this.quoteType === 2,
  437. headerSlot: 'headerSinglePrice',
  438. align: 'center'
  439. },
  440. {
  441. width: 160,
  442. prop: 'taxRate',
  443. label: '税率',
  444. isNone: this.quoteType === 2,
  445. formatter: (_row, _column, cellValue) => {
  446. return _row.taxRate ? _row.taxRate + '%' : '';
  447. },
  448. align: 'center'
  449. },
  450. {
  451. width: 150,
  452. prop: 'notaxSinglePrice',
  453. label: '不含税单价',
  454. isNone: this.quoteType === 2,
  455. slot: 'notaxSinglePrice',
  456. align: 'center'
  457. },
  458. {
  459. width: 160,
  460. prop: 'discountSinglePrice',
  461. label: '折让单价',
  462. align: 'center',
  463. isNone: !this.isDiscount,
  464. formatter: (_row, _column, cellValue) => {
  465. return _row.discountSinglePrice
  466. ? Number(_row.discountSinglePrice).toFixed(2)
  467. : '';
  468. }
  469. },
  470. {
  471. width: 120,
  472. prop: 'totalPrice',
  473. label: '合计',
  474. slot: 'totalPrice',
  475. align: 'center'
  476. },
  477. {
  478. width: 160,
  479. prop: 'discountTotalPrice',
  480. label: '折让合计',
  481. align: 'center',
  482. isNone: !this.isDiscount,
  483. formatter: (_row, _column, cellValue) => {
  484. return _row.discountTotalPrice
  485. ? Number(_row.discountTotalPrice).toFixed(2)
  486. : '';
  487. }
  488. },
  489. {
  490. minWidth: 120,
  491. prop: 'goodsLevel',
  492. label: '物品级别',
  493. isNone: this.quoteType === 2,
  494. formatter: (_row, _column, cellValue) => {
  495. return levelList.find((item) => item.value == _row.goodsLevel)
  496. ?.label;
  497. },
  498. align: 'center'
  499. },
  500. {
  501. width: 110,
  502. prop: 'batchNo',
  503. label: '批次号',
  504. slot: 'batchNo',
  505. isNone: this.quoteType === 2,
  506. align: 'center'
  507. },
  508. {
  509. width: 160,
  510. prop: 'productBrand',
  511. label: '牌号',
  512. slot: 'productBrand',
  513. isNone: this.quoteType === 2,
  514. align: 'center'
  515. },
  516. {
  517. width: 120,
  518. prop: 'modelType',
  519. label: '型号',
  520. slot: 'modelType',
  521. isNone: this.quoteType === 2,
  522. align: 'center'
  523. },
  524. {
  525. minWidth: 120,
  526. prop: 'modelKey',
  527. label: '机型',
  528. slot: 'modelKey',
  529. isNone: this.quoteType === 2,
  530. showOverflowTooltip: true,
  531. align: 'center'
  532. },
  533. {
  534. minWidth: 120,
  535. prop: 'colorKey',
  536. slot: 'colorKey',
  537. showOverflowTooltip: true,
  538. label: '颜色',
  539. isNone: this.quoteType === 2,
  540. align: 'center'
  541. },
  542. {
  543. width: 120,
  544. prop: 'imgCode',
  545. align: 'center',
  546. label: '图号/件号',
  547. isNone: this.quoteType === 2,
  548. showOverflowTooltip: true
  549. },
  550. {
  551. prop: 'provenance',
  552. label: '产地',
  553. slot: 'provenance',
  554. align: 'center',
  555. isNone: this.quoteType === 2,
  556. minWidth: 200,
  557. showOverflowTooltip: true,
  558. formatter: (row, column) => {
  559. return row.provenance && row.provenance.length
  560. ? row.provenance
  561. .map((item) => this.getDictValue('产地', item))
  562. .join(',')
  563. : '';
  564. }
  565. },
  566. {
  567. width: 120,
  568. prop: 'produceType',
  569. align: 'center',
  570. label: '属性类型',
  571. isNone: this.quoteType === 2,
  572. showOverflowTooltip: true,
  573. formatter: (row, column) => {
  574. if (row.produceType) {
  575. return row.produceType
  576. .map((item) => {
  577. return lbjtList[item];
  578. })
  579. .toString();
  580. }
  581. }
  582. },
  583. {
  584. width: 160,
  585. prop: 'arrivalWay',
  586. label: '到货方式',
  587. align: 'center',
  588. isNone: !this.isArrivalWay || this.quoteType === 2,
  589. formatter: (_row, _column, cellValue) => {
  590. return _row.arrivalWay == 1
  591. ? '一次性到货'
  592. : _row.arrivalWay == 2
  593. ? '分批到货'
  594. : '';
  595. }
  596. },
  597. {
  598. width: 160,
  599. prop: 'customerExpectDeliveryDeadline',
  600. label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
  601. slot: 'customerExpectDeliveryDeadline',
  602. align: 'center'
  603. },
  604. {
  605. width: 160,
  606. prop: 'produceDeliveryDeadline',
  607. label: '生产交付交期',
  608. slot: 'produceDeliveryDeadline',
  609. isNone: this.contractBookType != 1,
  610. headerSlot: 'headerProduceDeliveryDeadline',
  611. align: 'center'
  612. },
  613. {
  614. width: 200,
  615. prop: 'guaranteePeriod',
  616. label: '有效期',
  617. isNone: this.quoteType === 2,
  618. slot: 'guaranteePeriod',
  619. align: 'center',
  620. formatter: (_row, _column, cellValue) => {
  621. return (
  622. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  623. );
  624. }
  625. },
  626. {
  627. width: 200,
  628. prop: 'guaranteePeriodDeadline',
  629. label: '有效期截止日期',
  630. isNone: this.quoteType === 2,
  631. slot: 'guaranteePeriodDeadline',
  632. align: 'center'
  633. },
  634. {
  635. width: 220,
  636. prop: 'customerReqFiles',
  637. label: '客户需求',
  638. slot: 'customerReqFiles',
  639. isNone: this.quoteType === 2,
  640. align: 'center'
  641. },
  642. // {
  643. // width: 100,
  644. // prop: 'density',
  645. // label: '密度',
  646. // align: 'center'
  647. // },
  648. {
  649. width: 150,
  650. prop: 'productType',
  651. label: '生产加工方式',
  652. align: 'center',
  653. formatter: (_row, _column, cellValue) => {
  654. return _row.productType == 2
  655. ? '加工'
  656. : _row.productType == 3
  657. ? '装配'
  658. : '';
  659. }
  660. },
  661. {
  662. width: 130,
  663. prop: 'technicalAnswerName',
  664. label: '技术答疑人',
  665. isNone: this.quoteType === 2,
  666. slot: 'technicalAnswerName',
  667. align: 'center'
  668. },
  669. {
  670. width: 220,
  671. prop: 'technicalParams',
  672. label: '技术参数',
  673. isNone: this.quoteType === 2,
  674. slot: 'technicalParams',
  675. align: 'center'
  676. },
  677. {
  678. width: 240,
  679. prop: 'technicalDrawings',
  680. label: '技术图纸',
  681. slot: 'technicalDrawings',
  682. align: 'center'
  683. },
  684. {
  685. width: 120,
  686. prop: 'drawingVersion',
  687. isNone: this.quoteType === 2,
  688. label: '图纸版本',
  689. align: 'center'
  690. },
  691. {
  692. width: 240,
  693. prop: 'technologyRouteName',
  694. label: '工艺路线',
  695. isNone: this.quoteType === 2,
  696. slot: 'technologyRouteName',
  697. align: 'center'
  698. },
  699. {
  700. width: 240,
  701. prop: 'industryArtFiles',
  702. label: '工艺附件',
  703. isNone: this.quoteType === 2,
  704. slot: 'industryArtFiles',
  705. align: 'center'
  706. },
  707. {
  708. width: 240,
  709. prop: 'otherFiles',
  710. label: '其他附件',
  711. slot: 'otherFiles',
  712. isNone: this.quoteType === 2,
  713. align: 'center'
  714. },
  715. {
  716. width: 220,
  717. prop: 'remark',
  718. label: '备注',
  719. slot: 'remark',
  720. align: 'center'
  721. }
  722. ];
  723. // 合并所有列
  724. return [
  725. ...baseColumns,
  726. ...additionalColumns,
  727. ...remainingColumns
  728. ].filter((item) => !item.isNone);
  729. }
  730. },
  731. created() {
  732. this.requestDict('生产类型');
  733. this.requestDict('产地');
  734. this.requestDict('保质期单位');
  735. this.requestDict('商品价格类型');
  736. },
  737. methods: {
  738. async getSupplierObj(productList, queryName) {
  739. try {
  740. let categoryIds = productList
  741. .filter((item) => item[queryName])
  742. .map((item) => item[queryName]);
  743. return await contactQueryByCategoryIdsAPI({
  744. categoryIds,
  745. isQueryEE: 1
  746. });
  747. } catch (e) {
  748. return Promise.resolve({});
  749. }
  750. },
  751. handleMethod(row) {
  752. this.$refs.timeDialogRef.open(row);
  753. },
  754. // 返回列表数据
  755. getTableValue() {
  756. let comitDatasource = this.form.datasource;
  757. if (comitDatasource.length === 0) return [];
  758. comitDatasource.forEach((v) => {
  759. if (v.guaranteePeriodUnitCode) {
  760. v.guaranteePeriodUnitName = this.getDictValue(
  761. '保质期单位',
  762. v.guaranteePeriodUnitCode
  763. );
  764. }
  765. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  766. v.customerReqFiles = v.customerReqFiles || [];
  767. v.industryArtFiles = v.industryArtFiles || [];
  768. v.otherFiles = v.otherFiles || [];
  769. });
  770. return comitDatasource;
  771. },
  772. setDeliveryDays() {
  773. console.log(this.form.datasource, 'this.form.datasource');
  774. this.form.datasource.forEach((item, i) => {
  775. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  776. item.guaranteePeriodUnitCode
  777. );
  778. this.$set(
  779. this.form.datasource[i],
  780. 'guaranteePeriodDeadline',
  781. guaranteePeriodUnitName != 'second'
  782. ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
  783. : ''
  784. );
  785. // }
  786. });
  787. },
  788. guaranteePeriodUnit(code) {
  789. return code == 3
  790. ? 'day'
  791. : code == 4
  792. ? 'month'
  793. : code == 5
  794. ? 'year'
  795. : 'second';
  796. },
  797. setDay(addDay, dateType = 'day') {
  798. console.log(addDay);
  799. return dayjs(this.contractStartDate || new Date())
  800. .add(addDay, dateType)
  801. .format('YYYY-MM-DD');
  802. },
  803. //修改回显
  804. async putTableValue(data) {
  805. let productList =
  806. (data &&
  807. (data.quoteProductList || data.productList || data.detailList)) ||
  808. [];
  809. if (productList) {
  810. this.form.datasource = productList;
  811. this.allPrice =
  812. data.totalAmount || data.totalPrice || data?.contractVO?.totalPrice;
  813. if (this.isDiscountTotalPrice) {
  814. this.form.discountTotalPrice =
  815. data.payAmount ||
  816. data.discountTotalPrice ||
  817. data?.contractVO?.discountTotalPrice;
  818. }
  819. // this.setDeliveryDays();
  820. this.supplierObj = await this.getSupplierObj(
  821. productList,
  822. 'productId'
  823. );
  824. this.$refs.table.reload();
  825. }
  826. }
  827. }
  828. };
  829. </script>
  830. <style lang="scss" scoped>
  831. .headbox {
  832. display: flex;
  833. justify-content: space-between;
  834. align-items: center;
  835. .amount {
  836. font-size: 14px;
  837. font-weight: bold;
  838. padding-right: 30px;
  839. }
  840. }
  841. .time-form .el-form-item {
  842. margin-bottom: 0 !important;
  843. }
  844. ::v-deep .period {
  845. display: flex;
  846. .borderleftnone {
  847. .el-input--medium .el-input__inner {
  848. border-top-right-radius: 0;
  849. border-bottom-right-radius: 0;
  850. }
  851. }
  852. .borderrightnone {
  853. .el-input--medium .el-input__inner {
  854. border-top-left-radius: 0;
  855. border-bottom-left-radius: 0;
  856. }
  857. }
  858. }
  859. ::v-deep .time-form tbody > tr:hover > td {
  860. background-color: transparent !important;
  861. }
  862. ::v-deep .time-form .el-table tr {
  863. background-color: #ffffff;
  864. }
  865. .pricebox {
  866. display: flex;
  867. justify-content: flex-start;
  868. align-items: center;
  869. font-weight: bold;
  870. }
  871. </style>