inquiryTable.vue 24 KB

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