inquiryTable.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. <template>
  2. <el-form :model="form" ref="form">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. :toolkit="[]"
  8. max-height="500px"
  9. :span-method="objectSpanMethod"
  10. :datasource="form.resultList"
  11. cache-key="systemRoleTable17"
  12. class="time-form"
  13. >
  14. <!-- 表头工具栏 -->
  15. <template v-slot:toolbar>
  16. <el-row type="flex" justify="end" align="middle">
  17. <el-popconfirm
  18. class="ele-action"
  19. title="确定要删除吗?"
  20. @confirm="removeSupplier"
  21. v-if="status !== 'Detail'"
  22. >
  23. <template v-slot:reference>
  24. <el-link
  25. type="danger"
  26. title="删除供应商"
  27. :underline="false"
  28. icon="el-icon-delete"
  29. >
  30. 删除
  31. </el-link>
  32. </template>
  33. </el-popconfirm>
  34. </el-row>
  35. </template>
  36. <template v-slot:supplierName="{ row, $index }">
  37. {{ form.supplierName }}
  38. </template>
  39. <template v-slot:supplierTotalPrice="{ row, $index }">
  40. {{ form.totalPrice }}
  41. </template>
  42. <template v-slot:preferentialPrice="{ row, $index }">
  43. <el-form-item
  44. prop="preferentialPrice"
  45. :rules="{
  46. required: true,
  47. message: '请输入优惠价',
  48. trigger: 'blur'
  49. }"
  50. >
  51. <el-input
  52. v-model="form.preferentialPrice"
  53. :disabled="status == 'Detail'"
  54. ></el-input>
  55. </el-form-item>
  56. </template>
  57. <template v-slot:settlementMode="{ row, $index }">
  58. <el-form-item
  59. prop="settlementMode"
  60. :rules="{
  61. required: true,
  62. message: '请输入优惠价',
  63. trigger: 'change'
  64. }"
  65. >
  66. <DictSelection
  67. dictName="结算方式"
  68. clearable
  69. v-model="form.settlementMode"
  70. @itemChange="chaengMode"
  71. :disabled="status == 'Detail'"
  72. >
  73. </DictSelection>
  74. </el-form-item>
  75. </template>
  76. <template v-slot:deliveryDate="{ row, $index }">
  77. <el-form-item
  78. prop="deliveryDate"
  79. :rules="{
  80. required: true,
  81. message: '请选择交货日期',
  82. trigger: 'change'
  83. }"
  84. >
  85. <el-date-picker
  86. style="width: 100%"
  87. clearable
  88. type="date"
  89. :disabled="status == 'Detail'"
  90. v-model="form.deliveryDate"
  91. value-format="yyyy-MM-dd"
  92. placeholder="请选择日期"
  93. >
  94. </el-date-picker>
  95. </el-form-item>
  96. </template>
  97. <template v-slot:taxRate="{ row, $index }">
  98. <el-form-item prop="taxRate">
  99. <el-input
  100. v-model="form.taxRate"
  101. style="width: 100%"
  102. :disabled="status == 'Detail'"
  103. >
  104. <template slot="suffix">%</template>
  105. </el-input>
  106. </el-form-item>
  107. </template>
  108. <template v-slot:files="{ row, $index }">
  109. <el-form-item prop="files">
  110. <fileMain
  111. v-model="form.files"
  112. :type="status == 'Detail' ? 'view' : ''"
  113. ></fileMain>
  114. <!-- <fileUpload-->
  115. <!-- v-if="status != 'Detail'"-->
  116. <!-- v-model="form.files"-->
  117. <!-- module="main"-->
  118. <!-- :showLib="false"-->
  119. <!-- :limit="5"-->
  120. <!-- />-->
  121. <!-- <div-->
  122. <!-- v-if=" form.files && form.files?.length && status == 'Detail' ">-->
  123. <!-- <el-link-->
  124. <!-- v-for="link in form.files"-->
  125. <!-- :key="link.id"-->
  126. <!-- type="primary"-->
  127. <!-- :underline="false"-->
  128. <!-- @click="downloadFile(link)"-->
  129. <!-- >-->
  130. <!-- {{ link.name }}-->
  131. <!-- </el-link-->
  132. <!-- >-->
  133. <!-- </div>-->
  134. </el-form-item>
  135. </template>
  136. <template v-slot:isWinner="{ row, $index }">
  137. <el-form-item
  138. style="margin-bottom: 20px"
  139. :prop="'resultList.' + $index + '.isWinner'"
  140. :rules="{
  141. required: true,
  142. message: '请输入',
  143. trigger: 'change'
  144. }"
  145. >
  146. <el-select v-model="row.isWinner" :disabled="status == 'Detail'">
  147. <el-option label="是" :value="1"></el-option>
  148. <el-option label="否" :value="0"></el-option>
  149. </el-select>
  150. </el-form-item>
  151. </template>
  152. <template v-slot:supplierProductName="{ row, $index }">
  153. <el-form-item
  154. style="margin-bottom: 20px"
  155. :prop="'resultList.' + $index + '.supplierProductName'"
  156. :rules="{
  157. required: true,
  158. message: '请输入',
  159. trigger: 'change'
  160. }"
  161. >
  162. <el-input
  163. v-model="row.supplierProductName"
  164. placeholder="请输入"
  165. :disabled="status == 'Detail'"
  166. ></el-input>
  167. </el-form-item>
  168. </template>
  169. <template v-slot:supplierProductCode="scope">
  170. <el-form-item
  171. style="margin-bottom: 20px"
  172. :prop="'resultList.' + scope.$index + '.supplierProductCode'"
  173. :rules="{
  174. required: false,
  175. message: '请输入',
  176. trigger: 'blur'
  177. }"
  178. >
  179. <el-input
  180. v-model="scope.row.supplierProductCode"
  181. :disabled="status == 'Detail'"
  182. ></el-input>
  183. </el-form-item>
  184. </template>
  185. <template v-slot:deliveryDays="scope">
  186. <el-form-item
  187. style="margin-bottom: 20px"
  188. :prop="'resultList.' + scope.$index + '.deliveryDays'"
  189. >
  190. <el-input
  191. v-model="scope.row.deliveryDays"
  192. :disabled="status == 'Detail'"
  193. ></el-input>
  194. </el-form-item>
  195. </template>
  196. <template v-slot:guaranteePeriod="scope">
  197. <el-form-item
  198. style="margin-bottom: 20px"
  199. :prop="'resultList.' + scope.$index + '.guaranteePeriod'"
  200. >
  201. <el-input
  202. v-model="scope.row.guaranteePeriod"
  203. :disabled="status == 'Detail'"
  204. ></el-input>
  205. </el-form-item>
  206. </template>
  207. <template v-slot:guaranteePeriodUnitCode="scope">
  208. <el-form-item
  209. style="margin-bottom: 20px"
  210. :prop="'resultList.' + scope.$index + '.guaranteePeriodUnitCode'"
  211. >
  212. <DictSelection
  213. dictName="质保期单位"
  214. clearable
  215. v-model="scope.row.guaranteePeriodUnitCode"
  216. :disabled="status == 'Detail'"
  217. @itemChange="chaengUnitCode"
  218. >
  219. </DictSelection>
  220. </el-form-item>
  221. </template>
  222. <template v-slot:singlePrice="scope">
  223. <el-form-item
  224. style="margin-bottom: 20px"
  225. :prop="'resultList.' + scope.$index + '.singlePrice'"
  226. :rules="{
  227. required: true,
  228. message: '请输入',
  229. trigger: 'change'
  230. }"
  231. >
  232. <el-input
  233. @blur="changeGetPrice(scope.row)"
  234. v-model="scope.row.singlePrice"
  235. :disabled="status == 'Detail'"
  236. type="number"
  237. >
  238. <template slot="suffix">元</template>
  239. </el-input>
  240. </el-form-item>
  241. </template>
  242. <template v-slot:totalCount="scope">
  243. <el-form-item
  244. :prop="'resultList.' + scope.$index + '.totalCount'"
  245. :rules="{
  246. required: true,
  247. pattern: numberReg,
  248. message: '请输入数字',
  249. trigger: 'blur'
  250. }"
  251. >
  252. <el-input
  253. @blur="changeGetPrice(scope.row)"
  254. v-model="scope.row.totalCount"
  255. :disabled="status == 'Detail'"
  256. placeholder="请输入"
  257. ></el-input>
  258. </el-form-item>
  259. </template>
  260. <template v-slot:totalPrice="scope">
  261. <span>{{
  262. totalPrice(scope.row.totalCount, scope.row.singlePrice, scope.row)
  263. }}</span>
  264. </template>
  265. <template v-slot:modelType="scope">
  266. <el-form-item
  267. style="margin-bottom: 20px"
  268. :prop="'resultList.' + scope.$index + '.modelType'"
  269. >
  270. <el-input
  271. v-model="scope.row.modelType"
  272. :disabled="status == 'Detail'"
  273. ></el-input>
  274. </el-form-item>
  275. </template>
  276. <template v-slot:specification="scope">
  277. <el-form-item
  278. style="margin-bottom: 20px"
  279. :prop="'resultList.' + scope.$index + '.specification'"
  280. >
  281. <el-input
  282. v-model="scope.row.specification"
  283. :disabled="status == 'Detail'"
  284. ></el-input>
  285. </el-form-item>
  286. </template>
  287. <!-- <template v-slot:measuringUnit="scope">-->
  288. <!-- <el-form-item-->
  289. <!-- style="margin-bottom: 20px"-->
  290. <!-- :prop="'resultList.' + scope.$index + '.measuringUnit'"-->
  291. <!-- :rules="{-->
  292. <!-- required: false,-->
  293. <!-- message: '请输入',-->
  294. <!-- trigger: 'blur'-->
  295. <!-- }"-->
  296. <!-- >-->
  297. <!-- <el-input-->
  298. <!-- v-model="scope.row.measuringUnit"-->
  299. <!-- placeholder="请输入"-->
  300. <!-- :disabled="true"-->
  301. <!-- ></el-input>-->
  302. <!-- </el-form-item>-->
  303. <!-- </template>-->
  304. <template v-slot:remark="scope">
  305. <el-form-item
  306. style="margin-bottom: 20px"
  307. :prop="'resultList.' + scope.$index + '.remark'"
  308. >
  309. <el-input
  310. v-model="scope.row.remark"
  311. type="textarea"
  312. placeholder="请输入"
  313. :disabled="status == 'Detail'"
  314. ></el-input>
  315. </el-form-item>
  316. </template>
  317. <template v-slot:isRequired="{ column }">
  318. <span class="is-required">{{ column.label }}</span>
  319. </template>
  320. <!-- <template v-slot:files="scope">
  321. <el-form-item prop="files">
  322. <fileUpload
  323. v-model="scope.row.files"
  324. module="main"
  325. :showLib="false"
  326. :limit="5"
  327. />
  328. </el-form-item>
  329. </template> -->
  330. </ele-pro-table>
  331. </el-form>
  332. </template>
  333. <script>
  334. import { numberReg } from 'ele-admin';
  335. import dictMixins from '@/mixins/dictMixins';
  336. import fileUpload from '@/components/upload/fileUpload';
  337. import { copyObj } from '@/utils/util';
  338. import { getFile } from '@/api/system/file';
  339. import fileMain from '@/components/addDoc/index.vue';
  340. import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
  341. // import headList from '@/views/saleManage/businessOpportunity/components/headList.vue';
  342. const defaultColumns = [
  343. {
  344. width: 50,
  345. label: '序号',
  346. type: 'index',
  347. columnKey: 'index',
  348. align: 'center',
  349. fixed: 'left'
  350. },
  351. {
  352. minWidth: 120,
  353. prop: 'supplierName',
  354. label: '供应商',
  355. slot: 'supplierName',
  356. align: 'center',
  357. showOverflowTooltip: true,
  358. isMerge: true,
  359. fixed: 'left'
  360. },
  361. {
  362. minWidth: 80,
  363. prop: 'supplierTotalPrice',
  364. label: '总价',
  365. slot: 'supplierTotalPrice',
  366. align: 'center',
  367. showOverflowTooltip: true,
  368. isMerge: true,
  369. fixed: 'left'
  370. },
  371. {
  372. minWidth: 120,
  373. prop: 'preferentialPrice',
  374. label: '优惠后总价',
  375. slot: 'preferentialPrice',
  376. headerSlot: 'isRequired',
  377. align: 'center',
  378. showOverflowTooltip: true,
  379. isMerge: true,
  380. fixed: 'left'
  381. },
  382. {
  383. minWidth: 120,
  384. prop: 'settlementMode',
  385. label: '结算方式',
  386. slot: 'settlementMode',
  387. headerSlot: 'isRequired',
  388. align: 'center',
  389. showOverflowTooltip: true,
  390. isMerge: true,
  391. fixed: 'left'
  392. },
  393. {
  394. minWidth: 160,
  395. prop: 'deliveryDate',
  396. label: '交货日期',
  397. slot: 'deliveryDate',
  398. headerSlot: 'isRequired',
  399. align: 'center',
  400. showOverflowTooltip: true,
  401. isMerge: true,
  402. fixed: 'left'
  403. },
  404. {
  405. minWidth: 100,
  406. prop: 'productCode',
  407. label: '编码',
  408. slot: 'productCode',
  409. align: 'center',
  410. showOverflowTooltip: true
  411. },
  412. {
  413. minWidth: 100,
  414. prop: 'productName',
  415. label: '产品名称',
  416. slot: 'productName',
  417. align: 'center',
  418. showOverflowTooltip: true
  419. },
  420. {
  421. minWidth: 100,
  422. prop: 'isWinner',
  423. label: '是否中标',
  424. slot: 'isWinner',
  425. align: 'center',
  426. headerSlot: 'isRequired',
  427. showOverflowTooltip: true
  428. },
  429. {
  430. minWidth: 140,
  431. prop: 'supplierProductCode',
  432. label: '供应商产品编码',
  433. slot: 'supplierProductCode',
  434. align: 'center'
  435. },
  436. {
  437. minWidth: 160,
  438. prop: 'supplierProductName',
  439. label: '供应商产品名称',
  440. slot: 'supplierProductName',
  441. headerSlot: 'isRequired',
  442. align: 'center'
  443. },
  444. {
  445. minWidth: 90,
  446. prop: 'totalCount',
  447. label: '购买数量',
  448. slot: 'totalCount',
  449. headerSlot: 'isRequired',
  450. align: 'center'
  451. },
  452. {
  453. minWidth: 80,
  454. prop: 'availableCountBase',
  455. label: '库存数量',
  456. slot: 'availableCountBase',
  457. align: 'center'
  458. },
  459. {
  460. minWidth: 80,
  461. prop: 'doneTotalCount',
  462. label: '已采数量',
  463. align: 'center'
  464. },
  465. {
  466. minWidth: 80,
  467. prop: 'waitTotalCount',
  468. label: '待采数量',
  469. align: 'center'
  470. },
  471. {
  472. minWidth: 80,
  473. prop: 'measuringUnit',
  474. label: '计量单位',
  475. slot: 'measuringUnit',
  476. align: 'center'
  477. },
  478. {
  479. minWidth: 120,
  480. prop: 'singlePrice',
  481. label: '采购单价',
  482. slot: 'singlePrice',
  483. headerSlot: 'isRequired',
  484. align: 'center'
  485. },
  486. {
  487. minWidth: 80,
  488. prop: 'totalPrice',
  489. label: '采购金额',
  490. slot: 'totalPrice',
  491. align: 'center'
  492. },
  493. {
  494. minWidth: 120,
  495. prop: 'modelType',
  496. label: '型号',
  497. slot: 'modelType',
  498. align: 'center'
  499. },
  500. {
  501. minWidth: 120,
  502. prop: 'specification',
  503. label: '规格',
  504. slot: 'specification',
  505. align: 'center'
  506. },
  507. // {
  508. // width: 130,
  509. // prop: 'brand',
  510. // label: '品牌',
  511. // slot: 'brand'
  512. // },
  513. {
  514. minWidth: 80,
  515. prop: 'deliveryDays',
  516. label: '交期(天)',
  517. slot: 'deliveryDays',
  518. align: 'center'
  519. },
  520. {
  521. minWidth: 100,
  522. prop: 'guaranteePeriod',
  523. label: '质保期',
  524. slot: 'guaranteePeriod',
  525. align: 'center'
  526. },
  527. {
  528. minWidth: 120,
  529. prop: 'guaranteePeriodUnitCode',
  530. label: '质保期单位',
  531. slot: 'guaranteePeriodUnitCode',
  532. align: 'center'
  533. },
  534. {
  535. minWidth: 220,
  536. prop: 'remark',
  537. label: '备注',
  538. slot: 'remark',
  539. align: 'center'
  540. },
  541. {
  542. minWidth: 90,
  543. prop: 'taxRate',
  544. label: '税率',
  545. slot: 'taxRate',
  546. align: 'center',
  547. isMerge: true,
  548. showOverflowTooltip: true
  549. },
  550. {
  551. minWidth: 220,
  552. prop: 'files',
  553. label: '附件',
  554. slot: 'files',
  555. align: 'center',
  556. isMerge: true,
  557. showOverflowTooltip: true
  558. }
  559. ];
  560. export default {
  561. mixins: [dictMixins],
  562. components: {
  563. fileMain,
  564. fileUpload
  565. // headList
  566. },
  567. props: {
  568. obj: {},
  569. status: {
  570. default: 'edit'
  571. },
  572. radio: {
  573. default: ''
  574. },
  575. isUpdate: {
  576. default: false
  577. }
  578. },
  579. data() {
  580. const defaultForm = {
  581. key: null,
  582. endTime: '',
  583. isFirst: 0,
  584. name: ''
  585. };
  586. return {
  587. numberReg,
  588. defaultForm,
  589. radio1: '',
  590. form: {
  591. resultList: [
  592. {
  593. supplierProductCode: '',
  594. deliveryDays: '',
  595. guaranteePeriod: '',
  596. guaranteePeriodUnitCode: '',
  597. guaranteePeriodUnitName: '',
  598. measuringUnit: '',
  599. modelType: '',
  600. productCode: '',
  601. isWinner: '',
  602. remark: '',
  603. singlePrice: '',
  604. specification: '',
  605. supplierProductName: '',
  606. technicalAnswerName: '',
  607. technicalParams: '',
  608. totalCount: '',
  609. totalPrice: ''
  610. }
  611. ]
  612. },
  613. dataList: [],
  614. spanArr: [],
  615. columns: [...defaultColumns]
  616. };
  617. },
  618. computed: {},
  619. watch: {
  620. radio(n, v) {
  621. this.radio1 = n;
  622. }
  623. },
  624. created() {
  625. this.obj.resultList.forEach((item) => {
  626. this.obj['deliveryDate'] =
  627. this.obj.deliveryDate || item.expectReceiveDate;
  628. });
  629. this.form = copyObj(this.obj);
  630. console.log(this.obj);
  631. this.radio1 = this.radio;
  632. this.getSpanArr();
  633. this.setDeliveryDays();
  634. this.setIsInquiry();
  635. this.getInventoryTotalAPI();
  636. },
  637. methods: {
  638. //计算交期
  639. setDeliveryDays() {
  640. this.form.resultList.forEach((item,index) => {
  641. let day =
  642. this.form.deliveryDate &&
  643. (new Date(this.form.deliveryDate).getTime() -
  644. new Date().getTime()) /
  645. 1000 /
  646. 60 /
  647. 60 /
  648. 24;
  649. this.$set(this.form.resultList[index],'deliveryDays', Math.ceil(day) || 1)
  650. });
  651. this.$forceUpdate();
  652. },
  653. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  654. if (this.columns[columnIndex]?.isMerge) {
  655. const _row = this.spanArr[rowIndex]?.supplierName || 0;
  656. const _col = _row > 0 ? 1 : 0;
  657. return {
  658. rowspan: _row,
  659. colspan: _col
  660. };
  661. }
  662. return {
  663. rowspan: 1,
  664. colspan: 1
  665. };
  666. },
  667. async getInventoryTotalAPI() {
  668. let codeList = this.form.resultList.map((item) => item.productCode);
  669. //获取仓库库存
  670. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  671. this.form.resultList.forEach((item, index) => {
  672. let find =
  673. inventoryTotalList.find((key) => key.code == item.productCode) ||
  674. {};
  675. // item.availableCountBase = find.availableCountBase;
  676. this.$set(
  677. this.form.resultList[index],
  678. 'availableCountBase',
  679. find.availableCountBase
  680. );
  681. });
  682. },
  683. getSpanArr() {
  684. let pos = 0;
  685. this.spanArr = [];
  686. this.form.resultList.forEach((item, index) => {
  687. // item.guaranteePeriodUnitCode = Number(item.guaranteePeriodUnitCode);
  688. // console.log(item.guaranteePeriodUnitCode,'item.guaranteePeriodUnitCode')
  689. if (index === 0) {
  690. let obj = {};
  691. this.columns.forEach((col) => {
  692. if (col.isMerge) {
  693. obj[col.prop] = 1;
  694. }
  695. });
  696. this.spanArr.push(obj);
  697. } else {
  698. let nameSame =
  699. item.supplierName ===
  700. this.form.resultList[index - 1].supplierName;
  701. if (nameSame) {
  702. this.spanArr[pos].supplierName += 1;
  703. this.spanArr.push({
  704. supplierName: 0,
  705. supplierTotalPrice: 0,
  706. preferentialPrice: 0,
  707. settlementMode: 0,
  708. taxRate: 0,
  709. files: 0,
  710. deliveryDate: 0
  711. });
  712. } else {
  713. pos = index;
  714. let obj = {};
  715. this.columns.forEach((col) => {
  716. if (col.isMerge) {
  717. obj[col.prop] = 1;
  718. }
  719. });
  720. this.spanArr.push(obj);
  721. }
  722. // let totalPriceSame = item.totalPrice === this.form.resultList[index - 1].totalPrice;
  723. // if (totalPriceSame) {
  724. // this.spanArr[pos].totalPrice += 1;
  725. // this.spanArr.push({ totalPrice: 0 });
  726. // } else {
  727. // pos = index;
  728. // this.spanArr.push({ totalPrice: 1 });
  729. // }
  730. }
  731. });
  732. },
  733. setIsInquiry() {
  734. return
  735. this.$emit('setIsInquiry');
  736. },
  737. deliveryDateChange(row) {
  738. this.$emit('deliveryDateChange', (data) => {
  739. let is = false;
  740. if (data.length > 0) {
  741. data.forEach((item) => {
  742. if (
  743. new Date(this.form.deliveryDate).getTime() >
  744. new Date(item.expectReceiveDate).getTime()
  745. ) {
  746. is = true;
  747. }
  748. });
  749. }
  750. if (is) {
  751. this.$message.error('交货日期大于到货日期');
  752. }
  753. });
  754. this.setDeliveryDays();
  755. },
  756. downloadFile(file) {
  757. getFile({ objectName: file.storePath }, file.name);
  758. },
  759. //
  760. changeGetPrice(row) {
  761. if (row.singlePrice && row.totalCount) {
  762. let num = 0;
  763. this.form.resultList.forEach((item) => {
  764. num += item.totalPrice || 0;
  765. });
  766. this.form.preferentialPrice = parseFloat(num.toFixed(2));
  767. }
  768. },
  769. //计算销售金额
  770. totalPrice(a, b, row) {
  771. if (!a || !b) {
  772. return;
  773. }
  774. row.totalPrice = parseFloat((a * b).toFixed(2));
  775. this.totalPriceAll();
  776. return row.totalPrice;
  777. },
  778. //计算销售总价
  779. totalPriceAll() {
  780. let num = 0;
  781. this.form.resultList.forEach((item) => {
  782. num += item.totalPrice || 0;
  783. });
  784. this.form.totalPrice = parseFloat(num.toFixed(2));
  785. // this.form.preferentialPrice = parseFloat(num.toFixed(2));
  786. // console.log(this.form.resultList,'dasdasd')
  787. },
  788. // 返回列表数据
  789. getTableValue() {
  790. return this.form;
  791. },
  792. chaengMode(data) {
  793. this.form.settlementModeName = data.dictValue;
  794. },
  795. chaengUnitCode(data) {
  796. this.form.settlementModeName = data.dictValue;
  797. },
  798. //修改回显
  799. putTableValue(data) {
  800. this.form.resultList = copyObj(data);
  801. this.setDeliveryDays();
  802. this.setIsInquiry();
  803. },
  804. remove(productCode) {
  805. let index = this.form.resultList.findIndex(
  806. (item) => item.productCode == productCode
  807. );
  808. this.form.resultList.splice(index, 1);
  809. this.setIsInquiry();
  810. this.setSort();
  811. },
  812. removeSupplier() {
  813. this.$emit('removeSupplier', this.form.supplierId);
  814. },
  815. // 清空表格
  816. restTable() {
  817. this.form.resultList = [];
  818. },
  819. // 重新排序
  820. setSort() {
  821. this.form.resultList.forEach((n, index) => {
  822. n.key = index + 1;
  823. });
  824. },
  825. validateForm(callback) {
  826. //开始表单校验
  827. this.$refs.form.validate((valid) => {
  828. callback(valid);
  829. });
  830. }
  831. }
  832. };
  833. </script>
  834. <style lang="scss" scoped>
  835. .headbox {
  836. display: flex;
  837. justify-content: space-between;
  838. align-items: center;
  839. .amount {
  840. font-size: 14px;
  841. font-weight: bold;
  842. }
  843. }
  844. .time-form .el-form-item {
  845. margin-bottom: 0 !important;
  846. }
  847. ::v-deep .period {
  848. display: flex;
  849. .borderleftnone {
  850. .el-input--medium .el-input__inner {
  851. border-top-right-radius: 0;
  852. border-bottom-right-radius: 0;
  853. }
  854. }
  855. .borderrightnone {
  856. .el-input--medium .el-input__inner {
  857. border-top-left-radius: 0;
  858. border-bottom-left-radius: 0;
  859. }
  860. }
  861. }
  862. ::v-deep .time-form tbody > tr:hover > td {
  863. background-color: transparent !important;
  864. }
  865. ::v-deep .time-form .el-table tr {
  866. background-color: #ffffff;
  867. }
  868. ::v-deep .el-upload-list--text {
  869. width: 75%;
  870. }
  871. </style>