inventoryTableDetails.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  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. supplierObj: [],
  164. form: {
  165. discountTotalPrice: 0,
  166. datasource: []
  167. }
  168. };
  169. },
  170. computed: {
  171. columns() {
  172. // 基础列(新增字段之前的列)
  173. const baseColumns = [
  174. {
  175. width: 45,
  176. type: 'index',
  177. columnKey: 'index',
  178. align: 'center'
  179. },
  180. {
  181. minWidth: 200,
  182. prop: 'orderNo',
  183. label: '订单编码',
  184. showOverflowTooltip: true,
  185. align: 'center',
  186. isNone: !this.isOrderNo
  187. },
  188. {
  189. width: 280,
  190. prop: 'productName',
  191. label: '名称',
  192. slot: 'productName',
  193. headerSlot: 'headerProductName',
  194. align: 'center'
  195. },
  196. {
  197. width: 120,
  198. prop: 'productCode',
  199. label: '编码',
  200. slot: 'productCode',
  201. align: 'center'
  202. },
  203. {
  204. width: 200,
  205. prop: 'productCategoryName',
  206. label: '类型',
  207. slot: 'productCategoryName',
  208. align: 'center'
  209. },
  210. {
  211. width: 120,
  212. prop: 'specification',
  213. label: '规格',
  214. slot: 'specification',
  215. align: 'center'
  216. }
  217. ];
  218. // 条件显示的新增字段列(仅当quoteType为2时显示)
  219. const additionalColumns =
  220. this.quoteType === 2
  221. ? [
  222. // 新增字段:厚度
  223. {
  224. width: 150,
  225. prop: 'thickNess',
  226. label: '厚度',
  227. slot: 'thickNess',
  228. formatter: (row, column) => {
  229. if (row.thickNess) {
  230. return row.thickNess + ' mm';
  231. }
  232. },
  233. align: 'center'
  234. },
  235. // 新增字段:平方数
  236. {
  237. width: 150,
  238. prop: 'squareNumber',
  239. label: '平方数',
  240. formatter: (row, column) => {
  241. if (row.squareNumber) {
  242. return row.squareNumber + ' m²';
  243. }
  244. },
  245. align: 'center'
  246. },
  247. // 新增字段:加工费(未税)
  248. {
  249. width: 150,
  250. prop: 'processingFeeBeforeTax',
  251. label: '加工费(未税)',
  252. formatter: (row, column) => {
  253. if (row.processingFeeBeforeTax) {
  254. return row.processingFeeBeforeTax + ' 元';
  255. }
  256. },
  257. align: 'center'
  258. },
  259. // 新增字段:包装费(未税)
  260. {
  261. width: 150,
  262. prop: 'packagingFeeNotTaxed',
  263. label: '包装费(未税)',
  264. formatter: (row, column) => {
  265. if (row.packagingFeeNotTaxed) {
  266. return row.packagingFeeNotTaxed + ' 元';
  267. }
  268. },
  269. align: 'center'
  270. },
  271. // 新增字段:运输费(未税)
  272. {
  273. width: 150,
  274. prop: 'transportationFeeWithoutTax',
  275. label: '运输费(未税)',
  276. formatter: (row, column) => {
  277. if (row.transportationFeeWithoutTax) {
  278. return row.transportationFeeWithoutTax + ' 元';
  279. }
  280. },
  281. align: 'center'
  282. },
  283. // 新增字段:未税小计
  284. {
  285. width: 150,
  286. prop: 'quotationSubtotalBeforeTax',
  287. label: '未税小计',
  288. align: 'center',
  289. formatter: (row, column) => {
  290. if (row.quotationSubtotalBeforeTax) {
  291. return row.quotationSubtotalBeforeTax + ' 元';
  292. }
  293. }
  294. },
  295. // 新增字段:税率(%)
  296. {
  297. width: 150,
  298. prop: 'extraTax',
  299. label: '税率(%)',
  300. align: 'center',
  301. formatter: (row, column) => {
  302. return row.extraTax;
  303. }
  304. },
  305. // 新增字段:含税小计
  306. {
  307. width: 150,
  308. prop: 'quotationSubtotalTax',
  309. label: '含税小计',
  310. align: 'center',
  311. formatter: (row, column) => {
  312. if (row.quotationSubtotalTax) {
  313. return row.quotationSubtotalTax + ' 元';
  314. }
  315. }
  316. }
  317. ]
  318. : [];
  319. const remainingColumns = [
  320. {
  321. width: 200,
  322. prop: 'customerMark',
  323. label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
  324. slot: 'customerMark',
  325. headerSlot: 'headerCustomerMark',
  326. isNone: this.quoteType === 2,
  327. align: 'center'
  328. },
  329. {
  330. minWidth: 240,
  331. prop: 'taskName',
  332. label: '工序',
  333. slot: 'taskName',
  334. align: 'center'
  335. },
  336. {
  337. minWidth: 160,
  338. prop: 'productionCodes',
  339. label: '生产编号',
  340. isNone: this.quoteType === 2,
  341. align: 'center'
  342. },
  343. {
  344. minWidth: 280,
  345. prop: 'productionRequirements',
  346. label: '生产要求',
  347. align: 'center',
  348. isNone: !this.isProductionRequirements
  349. },
  350. {
  351. minWidth: 120,
  352. prop: 'entrustedEnterpriseId',
  353. label: '受托企业',
  354. slot: 'entrustedEnterpriseId',
  355. isNone: !this.isCustomerMark,
  356. align: 'center',
  357. showOverflowTooltip: true,
  358. formatter: (row, column) => {
  359. return (
  360. this.supplierObj[row.productId]?.find(
  361. (item) => item.id === row.entrustedEnterpriseId
  362. )?.name || ''
  363. );
  364. }
  365. },
  366. {
  367. width: 180,
  368. prop: 'saleCount',
  369. label: '数量',
  370. slot: 'saleCount',
  371. headerSlot: 'headerTotalCount',
  372. align: 'center'
  373. },
  374. {
  375. width: 120,
  376. prop: 'packingSpecification',
  377. align: 'center',
  378. label: '包装规格',
  379. isNone: this.quoteType === 2,
  380. showOverflowTooltip: true
  381. },
  382. {
  383. width: 150,
  384. prop: 'totalCount',
  385. label: '计量数量',
  386. slot: 'totalCount',
  387. isNone: this.quoteType === 2,
  388. headerSlot: 'headerTotalCount',
  389. formatter: (row, column) => {
  390. if (row.totalCount) {
  391. return row.totalCount + ' ' + (row.measuringUnit || '');
  392. }
  393. },
  394. align: 'center'
  395. },
  396. {
  397. width: 140,
  398. prop: 'singleWeight',
  399. label: '单重',
  400. slot: 'singleWeight',
  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. slot: 'guaranteePeriodDeadline',
  631. align: 'center'
  632. },
  633. {
  634. width: 220,
  635. prop: 'customerReqFiles',
  636. label: '客户需求',
  637. slot: 'customerReqFiles',
  638. isNone: this.quoteType === 2,
  639. align: 'center'
  640. },
  641. // {
  642. // width: 100,
  643. // prop: 'density',
  644. // label: '密度',
  645. // align: 'center'
  646. // },
  647. {
  648. width: 150,
  649. prop: 'productType',
  650. label: '生产加工方式',
  651. align: 'center',
  652. formatter: (_row, _column, cellValue) => {
  653. return _row.productType == 2
  654. ? '加工'
  655. : _row.productType == 3
  656. ? '装配'
  657. : '';
  658. }
  659. },
  660. {
  661. width: 130,
  662. prop: 'technicalAnswerName',
  663. label: '技术答疑人',
  664. isNone: this.quoteType === 2,
  665. slot: 'technicalAnswerName',
  666. align: 'center'
  667. },
  668. {
  669. width: 220,
  670. prop: 'technicalParams',
  671. label: '技术参数',
  672. isNone: this.quoteType === 2,
  673. slot: 'technicalParams',
  674. align: 'center'
  675. },
  676. {
  677. width: 240,
  678. prop: 'technicalDrawings',
  679. label: '技术图纸',
  680. slot: 'technicalDrawings',
  681. align: 'center'
  682. },
  683. {
  684. width: 120,
  685. prop: 'drawingVersion',
  686. isNone: this.quoteType === 2,
  687. label: '图纸版本',
  688. align: 'center'
  689. },
  690. {
  691. width: 240,
  692. prop: 'technologyRouteName',
  693. label: '工艺路线',
  694. isNone: this.quoteType === 2,
  695. slot: 'technologyRouteName',
  696. align: 'center'
  697. },
  698. {
  699. width: 240,
  700. prop: 'industryArtFiles',
  701. label: '工艺附件',
  702. isNone: this.quoteType === 2,
  703. slot: 'industryArtFiles',
  704. align: 'center'
  705. },
  706. {
  707. width: 240,
  708. prop: 'otherFiles',
  709. label: '其他附件',
  710. slot: 'otherFiles',
  711. isNone: this.quoteType === 2,
  712. align: 'center'
  713. },
  714. {
  715. width: 220,
  716. prop: 'remark',
  717. label: '备注',
  718. slot: 'remark',
  719. align: 'center'
  720. }
  721. ];
  722. // 合并所有列
  723. return [
  724. ...baseColumns,
  725. ...additionalColumns,
  726. ...remainingColumns
  727. ].filter((item) => !item.isNone);
  728. }
  729. },
  730. created() {
  731. this.requestDict('生产类型');
  732. this.requestDict('产地');
  733. this.requestDict('保质期单位');
  734. this.requestDict('商品价格类型');
  735. },
  736. methods: {
  737. async getSupplierObj(productList, queryName) {
  738. try {
  739. let categoryIds = productList
  740. .filter((item) => item[queryName])
  741. .map((item) => item[queryName]);
  742. return await contactQueryByCategoryIdsAPI({
  743. categoryIds,
  744. isQueryEE: 1
  745. });
  746. } catch (e) {
  747. return Promise.resolve({});
  748. }
  749. },
  750. handleMethod(row) {
  751. this.$refs.timeDialogRef.open(row);
  752. },
  753. // 返回列表数据
  754. getTableValue() {
  755. let comitDatasource = this.form.datasource;
  756. if (comitDatasource.length === 0) return [];
  757. comitDatasource.forEach((v) => {
  758. if (v.guaranteePeriodUnitCode) {
  759. v.guaranteePeriodUnitName = this.getDictValue(
  760. '保质期单位',
  761. v.guaranteePeriodUnitCode
  762. );
  763. }
  764. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  765. v.customerReqFiles = v.customerReqFiles || [];
  766. v.industryArtFiles = v.industryArtFiles || [];
  767. v.otherFiles = v.otherFiles || [];
  768. });
  769. return comitDatasource;
  770. },
  771. setDeliveryDays() {
  772. console.log(this.form.datasource, 'this.form.datasource');
  773. this.form.datasource.forEach((item, i) => {
  774. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  775. item.guaranteePeriodUnitCode
  776. );
  777. this.$set(
  778. this.form.datasource[i],
  779. 'guaranteePeriodDeadline',
  780. guaranteePeriodUnitName != 'second'
  781. ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
  782. : ''
  783. );
  784. // }
  785. });
  786. },
  787. guaranteePeriodUnit(code) {
  788. return code == 3
  789. ? 'day'
  790. : code == 4
  791. ? 'month'
  792. : code == 5
  793. ? 'year'
  794. : 'second';
  795. },
  796. setDay(addDay, dateType = 'day') {
  797. console.log(addDay);
  798. return dayjs(this.contractStartDate || new Date())
  799. .add(addDay, dateType)
  800. .format('YYYY-MM-DD');
  801. },
  802. //修改回显
  803. async putTableValue(data) {
  804. let productList =
  805. (data &&
  806. (data.quoteProductList || data.productList || data.detailList)) ||
  807. [];
  808. if (productList) {
  809. this.form.datasource = productList;
  810. this.allPrice =
  811. data.totalAmount || data.totalPrice || data?.contractVO?.totalPrice;
  812. if (this.isDiscountTotalPrice) {
  813. this.form.discountTotalPrice =
  814. data.payAmount ||
  815. data.discountTotalPrice ||
  816. data?.contractVO?.discountTotalPrice;
  817. }
  818. // this.setDeliveryDays();
  819. this.supplierObj = await this.getSupplierObj(
  820. productList,
  821. 'productId'
  822. );
  823. this.$refs.table.reload();
  824. }
  825. }
  826. }
  827. };
  828. </script>
  829. <style lang="scss" scoped>
  830. .headbox {
  831. display: flex;
  832. justify-content: space-between;
  833. align-items: center;
  834. .amount {
  835. font-size: 14px;
  836. font-weight: bold;
  837. padding-right: 30px;
  838. }
  839. }
  840. .time-form .el-form-item {
  841. margin-bottom: 0 !important;
  842. }
  843. ::v-deep .period {
  844. display: flex;
  845. .borderleftnone {
  846. .el-input--medium .el-input__inner {
  847. border-top-right-radius: 0;
  848. border-bottom-right-radius: 0;
  849. }
  850. }
  851. .borderrightnone {
  852. .el-input--medium .el-input__inner {
  853. border-top-left-radius: 0;
  854. border-bottom-left-radius: 0;
  855. }
  856. }
  857. }
  858. ::v-deep .time-form tbody > tr:hover > td {
  859. background-color: transparent !important;
  860. }
  861. ::v-deep .time-form .el-table tr {
  862. background-color: #ffffff;
  863. }
  864. .pricebox {
  865. display: flex;
  866. justify-content: flex-start;
  867. align-items: center;
  868. font-weight: bold;
  869. }
  870. </style>