inventoryTable.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. <template>
  2. <el-form ref="form" :model="form" :rules="rules">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. @columns-change="handleColumnChange"
  8. :cache-key="cacheKeyUrl"
  9. :datasource="form.datasource"
  10. :selection.sync="selection"
  11. class="time-form"
  12. :maxHeight="350"
  13. >
  14. <!-- 表头工具栏 -->
  15. <template v-slot:toolbar>
  16. <div class="headbox" v-if="!contractId && isShowAdd">
  17. <div>
  18. <el-button
  19. size="small"
  20. type="primary"
  21. icon="el-icon-plus"
  22. class="ele-btn-icon"
  23. @click="handlAdd('', -1)"
  24. >
  25. 新增
  26. </el-button>
  27. <warehouseAll
  28. @success="warehouseAllChange"
  29. :disabled="!selection.length"
  30. ></warehouseAll>
  31. </div>
  32. </div>
  33. </template>
  34. <template v-slot:technicalDrawings="{ row, $index }">
  35. <el-form-item
  36. style="margin-bottom: 20px"
  37. :prop="'datasource.' + $index + '.technicalDrawings'"
  38. >
  39. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  40. </el-form-item>
  41. </template>
  42. <template v-slot:industryArtFiles="{ row, $index }">
  43. <el-form-item
  44. style="margin-bottom: 20px"
  45. :prop="'datasource.' + $index + '.industryArtFiles'"
  46. >
  47. <fileMain v-model="row.industryArtFiles" type="view"></fileMain>
  48. </el-form-item>
  49. </template>
  50. <template v-slot:otherFiles="{ row, $index }">
  51. <el-form-item
  52. style="margin-bottom: 20px"
  53. :prop="'datasource.' + $index + '.otherFiles'"
  54. >
  55. <fileMain v-model="row.otherFiles" type="view"></fileMain>
  56. </el-form-item>
  57. </template>
  58. <template v-slot:customerReqFiles="{ row, $index }">
  59. <el-form-item
  60. style="margin-bottom: 20px"
  61. :prop="'datasource.' + $index + '.customerReqFiles'"
  62. >
  63. <fileMain v-model="row.customerReqFiles" type="view"></fileMain>
  64. </el-form-item>
  65. </template>
  66. <template v-slot:remark="{ row, $index }">
  67. <el-form-item
  68. style="margin-bottom: 20px"
  69. :prop="'datasource.' + $index + '.remark'"
  70. >
  71. <el-input
  72. clearable
  73. v-model="row.remark"
  74. type="textarea"
  75. placeholder="请输入"
  76. />
  77. </el-form-item>
  78. </template>
  79. <template v-slot:totalCount="scope">
  80. <el-form-item
  81. style="margin-bottom: 20px"
  82. :prop="'datasource.' + scope.$index + '.totalCount'"
  83. :rules="[
  84. { required: true, message: '请输入本次收货数量', trigger: 'blur' }
  85. ]"
  86. >
  87. <el-input
  88. v-model="scope.row.totalCount"
  89. type="number"
  90. @input="(val) => changeNum(val, scope.row, scope.$index)"
  91. ></el-input>
  92. </el-form-item>
  93. </template>
  94. <template v-slot:batchNo="scope">
  95. <el-form-item
  96. style="margin-bottom: 20px"
  97. :prop="'datasource.' + scope.$index + '.batchNo'"
  98. :rules="[
  99. { required: true, message: '请输入批次号', trigger: 'blur' }
  100. ]"
  101. >
  102. <el-input v-model="scope.row.batchNo" type="number"></el-input>
  103. </el-form-item>
  104. </template>
  105. <template v-slot:singlePrice="scope">
  106. <el-form-item
  107. style="margin-bottom: 20px"
  108. :prop="'datasource.' + scope.$index + '.singlePrice'"
  109. :rules="[{ required: true, message: '请输入单价', trigger: 'blur' }]"
  110. >
  111. <el-input
  112. v-model="scope.row.singlePrice"
  113. type="number"
  114. @input="(val) => changeNum(val, scope.row, scope.$index)"
  115. ></el-input>
  116. </el-form-item>
  117. </template>
  118. <template v-slot:warehouseId="scope">
  119. <el-form-item
  120. style="margin-bottom: 20px"
  121. :prop="'datasource.' + scope.$index + '.warehouseId'"
  122. :rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
  123. >
  124. <el-select v-model="scope.row.warehouseId" placeholder="请选择">
  125. <el-option
  126. v-for="item in warehouseList"
  127. :key="item.id"
  128. :label="item.name"
  129. :value="item.id"
  130. @click.native="warehouseChange(scope.$index, scope.row, item)"
  131. >
  132. </el-option>
  133. </el-select>
  134. </el-form-item>
  135. </template>
  136. <template v-slot:produceDeliveryDeadline="scope">
  137. <el-form-item
  138. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  139. >
  140. <el-date-picker
  141. style="width: 140px"
  142. v-model="scope.row.produceDeliveryDeadline"
  143. type="date"
  144. placeholder="选择日期"
  145. >
  146. </el-date-picker>
  147. </el-form-item>
  148. </template>
  149. <template v-slot:customerExpectDeliveryDeadline="scope">
  150. <el-form-item
  151. :prop="
  152. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  153. "
  154. >
  155. <el-date-picker
  156. style="width: 140px"
  157. v-model="scope.row.customerExpectDeliveryDeadline"
  158. type="date"
  159. placeholder="选择日期"
  160. >
  161. </el-date-picker>
  162. </el-form-item>
  163. </template>
  164. <template v-slot:warehouseNum="scope">
  165. <el-form-item style="margin-bottom: 20px">
  166. {{ scope.row.warehouseNum }}
  167. </el-form-item>
  168. </template>
  169. <template v-slot:headerTotalCount="{ column }">
  170. <span class="is-required">{{ column.label }}</span>
  171. </template>
  172. <template v-slot:headerWarehouseId="{ column }">
  173. <span class="is-required">{{ column.label }}</span>
  174. </template>
  175. <template v-slot:isRequired="{ column }">
  176. <span class="is-required">{{ column.label }}</span>
  177. </template>
  178. <!-- 操作列 -->
  179. <template v-slot:action="scope">
  180. <el-popconfirm
  181. class="ele-action"
  182. title="确定要删除吗?"
  183. @confirm="remove(scope.$index)"
  184. >
  185. <template v-slot:reference>
  186. <el-link type="danger" :underline="false" icon="el-icon-delete">
  187. 删除
  188. </el-link>
  189. </template>
  190. </el-popconfirm>
  191. </template>
  192. </ele-pro-table>
  193. <product-list
  194. ref="productListRef"
  195. classType="1"
  196. @changeParent="changeParent"
  197. ></product-list>
  198. </el-form>
  199. </template>
  200. <script>
  201. import { numberReg } from 'ele-admin';
  202. import dictMixins from '@/mixins/dictMixins';
  203. import productList from '@/BIZComponents/product-list.vue';
  204. import {
  205. getWarehouseList,
  206. getWarehouseOutStock
  207. } from '@/api/saleManage/saleorder';
  208. import warehouseAll from '@/BIZComponents/warehouseAll.vue';
  209. import tabMixins from '@/mixins/tableColumnsMixin';
  210. import { getCode } from '@/api/login/index';
  211. export default {
  212. mixins: [dictMixins, tabMixins],
  213. props: {
  214. orderId: String,
  215. isShowAdd: {
  216. type: Boolean,
  217. default: true
  218. },
  219. pricingWay: [Number, String]
  220. },
  221. components: {
  222. warehouseAll,
  223. productList
  224. },
  225. data() {
  226. const defaultForm = {
  227. key: null,
  228. endTime: '',
  229. isFirst: 0,
  230. name: '',
  231. startTime: '',
  232. workHour: '',
  233. technicalDrawings: []
  234. // warehouseCode:"",
  235. // warehouseId:'',
  236. // warehouseName:'',
  237. };
  238. return {
  239. discountTotalPrice: 0.0,
  240. allPrice: 0.0,
  241. numberReg,
  242. defaultForm,
  243. cacheKeyUrl: 'eos-saleManage-entrustedReceive-inventoryTable',
  244. warehouseList: [],
  245. selection: [],
  246. form: {
  247. datasource: []
  248. },
  249. rules: {},
  250. columns: [
  251. {
  252. width: 45,
  253. type: 'index',
  254. columnKey: 'index',
  255. align: 'center',
  256. fixed: 'left'
  257. },
  258. {
  259. label: '选择',
  260. width: 45,
  261. type: 'selection',
  262. columnKey: 'selection',
  263. align: 'center',
  264. fixed: 'left'
  265. },
  266. {
  267. minWidth: 200,
  268. prop: 'productName',
  269. label: '名称',
  270. slot: 'productName',
  271. align: 'center'
  272. },
  273. {
  274. minWidth: 120,
  275. prop: 'productCode',
  276. label: '编码',
  277. slot: 'productCode',
  278. align: 'center'
  279. },
  280. {
  281. minWidth: 150,
  282. prop: 'productCategoryName',
  283. label: '类型',
  284. slot: 'productCategoryName',
  285. align: 'center'
  286. },
  287. {
  288. prop: 'batchNo',
  289. label: '批次号',
  290. slot: 'batchNo',
  291. align: 'center',
  292. headerSlot: 'isRequired',
  293. showOverflowTooltip: true,
  294. minWidth: 150
  295. },
  296. {
  297. minWidth: 100,
  298. prop: 'productBrand',
  299. label: '牌号',
  300. slot: 'productBrand',
  301. align: 'center'
  302. },
  303. {
  304. minWidth: 120,
  305. prop: 'modelType',
  306. label: '型号',
  307. slot: 'modelType',
  308. align: 'center'
  309. },
  310. {
  311. minWidth: 120,
  312. prop: 'specification',
  313. label: '规格',
  314. slot: 'specification',
  315. align: 'center'
  316. },
  317. {
  318. minWidth: 150,
  319. prop: 'customerMark',
  320. label: '客户代号',
  321. slot: 'customerMark',
  322. align: 'center'
  323. },
  324. {
  325. minWidth: 200,
  326. prop: 'warehouseId',
  327. label: '仓库名称',
  328. slot: 'warehouseId',
  329. headerSlot: 'headerWarehouseId',
  330. align: 'center'
  331. },
  332. // {
  333. // minWidth: 80,
  334. // prop: 'warehouseNum',
  335. // label: '库存',
  336. // slot: 'warehouseNum',
  337. // align: 'center'
  338. // },
  339. {
  340. width: 110,
  341. prop: 'orderTotalCount',
  342. label: '订单总数量',
  343. slot: 'orderTotalCount',
  344. align: 'center'
  345. },
  346. {
  347. width: 150,
  348. prop: 'totalCount',
  349. label: '本次收货数量',
  350. slot: 'totalCount',
  351. headerSlot: 'headerTotalCount',
  352. align: 'center'
  353. },
  354. {
  355. width: 100,
  356. prop: 'receiveTotalCount',
  357. label: '已收货总数',
  358. slot: 'receiveTotalCount',
  359. align: 'center'
  360. },
  361. {
  362. minWidth: 100,
  363. prop: 'measuringUnit',
  364. label: '计量单位',
  365. slot: 'measuringUnit',
  366. align: 'center'
  367. },
  368. {
  369. width: 120,
  370. prop: 'singleWeight',
  371. label: '单重',
  372. slot: 'singleWeight',
  373. align: 'center'
  374. },
  375. {
  376. width: 100,
  377. prop: 'receiveTotalWeight',
  378. label: '收货总重',
  379. slot: 'receiveTotalWeight',
  380. align: 'center'
  381. },
  382. {
  383. width: 100,
  384. prop: 'weightUnit',
  385. label: '重量单位',
  386. slot: 'weightUnit',
  387. align: 'center'
  388. },
  389. {
  390. width: 150,
  391. prop: 'singlePrice',
  392. label: '单价',
  393. slot: 'singlePrice',
  394. align: 'center'
  395. },
  396. {
  397. width: 100,
  398. prop: 'taxRate',
  399. label: '税率',
  400. formatter: (_row, _column, cellValue) => {
  401. return _row.taxRate ? _row.taxRate + '%' : '';
  402. },
  403. align: 'center'
  404. },
  405. {
  406. width: 100,
  407. prop: 'discountSinglePrice',
  408. label: '折让单价',
  409. slot: 'discountSinglePrice',
  410. align: 'center',
  411. formatter: (_row, _column, cellValue) => {
  412. return _row.discountSinglePrice
  413. ? Number(_row.discountSinglePrice).toFixed(2)
  414. : '';
  415. }
  416. },
  417. {
  418. width: 80,
  419. prop: 'totalPrice',
  420. label: '合计',
  421. slot: 'totalPrice',
  422. align: 'center'
  423. },
  424. {
  425. width: 100,
  426. prop: 'discountTotalPrice',
  427. label: '折让合计',
  428. slot: 'discountTotalPrice',
  429. align: 'center',
  430. formatter: (_row, _column, cellValue) => {
  431. return _row.discountTotalPrice
  432. ? Number(_row.discountTotalPrice).toFixed(2)
  433. : '';
  434. }
  435. },
  436. // {
  437. // width: 80,
  438. // prop: 'deliveryDays',
  439. // label: '交期(天)',
  440. // slot: 'deliveryDays'
  441. // },
  442. // {
  443. // width: 160,
  444. // prop: 'deliveryDeadline',
  445. // label: '交期截止日期',
  446. // slot: 'deliveryDeadline',
  447. // show: this.isDeliveryDeadline
  448. // },
  449. {
  450. minWidth: 170,
  451. prop: 'customerExpectDeliveryDeadline',
  452. label: '客户期望交期',
  453. slot: 'customerExpectDeliveryDeadline',
  454. headerSlot: 'headerCustomerExpectDeliveryDeadline',
  455. align: 'center'
  456. },
  457. {
  458. minWidth: 170,
  459. prop: 'produceDeliveryDeadline',
  460. label: '生产交付交期',
  461. slot: 'produceDeliveryDeadline',
  462. align: 'center'
  463. },
  464. {
  465. width: 100,
  466. prop: 'guaranteePeriod',
  467. label: '有效期',
  468. slot: 'guaranteePeriod',
  469. formatter: (_row, _column, cellValue) => {
  470. return (
  471. _row.guaranteePeriod &&
  472. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  473. );
  474. },
  475. align: 'center'
  476. },
  477. {
  478. minWidth: 120,
  479. prop: 'guaranteePeriodDeadline',
  480. label: '有效期截止日期',
  481. align: 'center'
  482. },
  483. {
  484. minWidth: 200,
  485. prop: 'customerReqFiles',
  486. label: '客户需求',
  487. slot: 'customerReqFiles',
  488. align: 'center'
  489. },
  490. {
  491. width: 130,
  492. prop: 'technicalAnswerName',
  493. label: '技术答疑人',
  494. slot: 'technicalAnswerName',
  495. align: 'center'
  496. },
  497. {
  498. width: 220,
  499. prop: 'technicalParams',
  500. label: '技术参数',
  501. slot: 'technicalParams',
  502. align: 'center'
  503. },
  504. {
  505. width: 240,
  506. prop: 'technicalDrawings',
  507. label: '技术图纸',
  508. slot: 'technicalDrawings',
  509. align: 'center'
  510. },
  511. {
  512. width: 240,
  513. prop: 'industryArtFiles',
  514. label: '工艺附件',
  515. slot: 'industryArtFiles',
  516. align: 'center'
  517. },
  518. {
  519. width: 240,
  520. prop: 'otherFiles',
  521. label: '其他附件',
  522. slot: 'otherFiles',
  523. align: 'center'
  524. },
  525. {
  526. width: 220,
  527. prop: 'remark',
  528. label: '备注',
  529. slot: 'remark',
  530. align: 'center'
  531. },
  532. {
  533. columnKey: 'action',
  534. label: '操作',
  535. width: 120,
  536. align: 'center',
  537. resizable: false,
  538. slot: 'action',
  539. fixed: 'right',
  540. showOverflowTooltip: true
  541. }
  542. ]
  543. };
  544. },
  545. created() {
  546. getWarehouseList().then((res) => {
  547. this.warehouseList = res;
  548. });
  549. },
  550. computed: {
  551. canHandl() {
  552. return this.form.datasource.length;
  553. },
  554. contractId() {
  555. return this.$store.state.order.contractId;
  556. }
  557. },
  558. methods: {
  559. async warehouseChange(index, row) {
  560. let data = null;
  561. if (row.warehouseId) {
  562. data = this.warehouseList.find((item) => item.id == row.warehouseId);
  563. } else {
  564. data = this.warehouseList.find(
  565. (item) => item.inventoryType == row.categoryRootLevelId
  566. );
  567. }
  568. if (data) {
  569. this.$set(this.form.datasource[index], 'warehouseName', data.name);
  570. this.$set(this.form.datasource[index], 'warehouseCode', data.code);
  571. this.$set(this.form.datasource[index], 'warehouseId', data.id);
  572. // const warehouseOutStock = await getWarehouseOutStock({
  573. // warehouseId: data.id,
  574. // code: row.productCode
  575. // });
  576. // this.$set(
  577. // this.form.datasource[index],
  578. // 'warehouseNum',
  579. // warehouseOutStock
  580. // );
  581. }
  582. },
  583. warehouseAllChange(data) {
  584. let keyS = this.selection.map((item) => item.key - 1);
  585. keyS.forEach((key) => {
  586. this.$set(this.form.datasource[key], 'warehouseName', data.name);
  587. this.$set(this.form.datasource[key], 'warehouseCode', data.code);
  588. this.$set(this.form.datasource[key], 'warehouseId', data.id);
  589. });
  590. },
  591. //修改数量更新合计
  592. changeNum(val, row, index) {
  593. this.$set(
  594. this.form.datasource[index],
  595. 'receiveTotalWeight',
  596. val ? val * row.singleWeight : ''
  597. );
  598. this.$set(
  599. this.form.datasource[index],
  600. 'totalPrice',
  601. this.getTotalPrice(row).toFixed(2)
  602. );
  603. this.$set(
  604. this.form.datasource[index],
  605. 'discountTotalPrice',
  606. this.getDiscountTotalPrice(row).toFixed(2)
  607. );
  608. this.$refs.table.reload();
  609. },
  610. getTotalPrice(row) {
  611. let num = 0;
  612. if (row.singlePrice && row.totalCount) {
  613. num = Number(row.singlePrice) * Number(row.totalCount);
  614. }
  615. return num;
  616. },
  617. getDiscountTotalPrice(row) {
  618. let num = 0;
  619. if (row.discountSinglePrice && row.totalCount) {
  620. num = Number(row.discountSinglePrice) * Number(row.totalCount);
  621. }
  622. return num;
  623. },
  624. validateTotalCount(row) {
  625. return (rule, value, callback) => {
  626. callback();
  627. if (isNaN(value) || Number(value) <= 0) {
  628. callback(new Error('请输入大于0的数字'));
  629. } else if (
  630. Number(value) + Number(row.receiveTotalCount) >
  631. row.orderTotalCount
  632. ) {
  633. callback(new Error('输入的数字不能大于最大发货值'));
  634. } else {
  635. callback();
  636. }
  637. };
  638. },
  639. // 返回列表数据
  640. getTableValue() {
  641. let comitDatasource = this.form.datasource;
  642. if (comitDatasource.length === 0) return [];
  643. comitDatasource.forEach(async (v) => {
  644. v.totalCount = Number(v.totalCount);
  645. // item['pricingWay'] = item.pricingWay || this.pricingWay;
  646. v.technicalDrawings = Array.isArray(v.technicalDrawings)
  647. ? v.technicalDrawings
  648. : [];
  649. v.customerReqFiles = Array.isArray(v.customerReqFiles)
  650. ? v.customerReqFiles
  651. : [];
  652. v.industryArtFiles = v.industryArtFiles || [];
  653. v.otherFiles = v.otherFiles || [];
  654. // v.ownerId = this.warehouseList.find(item => v.warehouseId == item.id)?.ownerId 获取仓库人员id
  655. });
  656. return comitDatasource;
  657. },
  658. getPrice() {
  659. return [this.allPrice];
  660. },
  661. //修改回显
  662. putTableValue(data) {
  663. if (data) {
  664. this.form.datasource = data;
  665. data.forEach(async (item, index) => {
  666. item['key'] = index + 1;
  667. if (!item.warehouseId) {
  668. this.warehouseChange(index, item);
  669. }
  670. //发货数量因已发货数量被修改需要重新计算金额,总重
  671. this.changeNum(item.totalCount, item, index);
  672. });
  673. }
  674. },
  675. remove(i) {
  676. this.form.datasource.splice(i, 1);
  677. this.setSort();
  678. },
  679. // 重新排序
  680. setSort() {
  681. this.form.datasource.forEach((n, index) => {
  682. n.key = index + 1;
  683. });
  684. },
  685. // 添加
  686. handlAdd() {
  687. if (!this.orderId) return this.$message.error('请先选择订单');
  688. this.$refs.productListRef.open('', -1);
  689. },
  690. //选择产品回调
  691. changeParent(obj, idx) {
  692. obj.forEach(async (item, index) => {
  693. let i = idx == -1 ? index : idx;
  694. let row = JSON.parse(JSON.stringify(this.defaultForm));
  695. row.key = this.form.datasource.length + 1;
  696. let parasm = idx == -1 ? row : this.form.datasource[i];
  697. this.$set(parasm, 'productId', item.id);
  698. this.$set(parasm, 'categoryName', item.name);
  699. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  700. this.$set(parasm, 'productBrand', item.brandNum);
  701. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  702. this.$set(parasm, 'productCode', item.code);
  703. this.$set(parasm, 'productName', item.name);
  704. this.$set(parasm, 'modelType', item.modelType);
  705. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  706. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  707. this.$set(parasm, 'specification', item.specification);
  708. this.$set(parasm, 'weightUnit', item.weightUnit);
  709. this.$set(parasm, 'singleWeight', item.netWeight);
  710. this.$set(parasm, 'pricingWay', 1);
  711. this.$set(parasm, 'goodsLevel', item.goodsLevel);
  712. this.$set(parasm, 'batchNo', await getCode('lot_number_code'));
  713. this.$set(parasm, 'discountSinglePrice', 0);
  714. this.$set(parasm, 'singlePrice', 0);
  715. this.$set(parasm, 'imgCode', item.imgCode);
  716. this.$set(parasm, 'produceType', item.componentAttribute);
  717. this.$set(
  718. parasm,
  719. 'categoryRootLevelId',
  720. item.categoryLevelPathIdParent
  721. );
  722. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  723. this.$set(
  724. parasm,
  725. 'packingSpecification',
  726. item.extField.packingSpecification
  727. );
  728. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  729. if (idx == -1) {
  730. this.form.datasource.push(row);
  731. }
  732. });
  733. this.form.datasource.forEach((item, index) => {
  734. if (!item.warehouseId) {
  735. this.warehouseChange(index, item);
  736. }
  737. });
  738. },
  739. validateForm(callback) {
  740. //开始表单校验
  741. this.$refs.form.validate((valid, obj) => {
  742. if (obj) {
  743. let messages = Object.keys(obj).map((key) => obj[key][0]);
  744. if (messages.length > 0) {
  745. this.$message.warning(messages[0].message);
  746. }
  747. }
  748. callback(valid);
  749. });
  750. }
  751. }
  752. };
  753. </script>
  754. <style lang="scss" scoped>
  755. .headbox {
  756. display: flex;
  757. justify-content: space-between;
  758. align-items: center;
  759. .amount {
  760. font-size: 14px;
  761. font-weight: bold;
  762. padding-right: 30px;
  763. }
  764. }
  765. .time-form .el-form-item {
  766. margin-bottom: 0 !important;
  767. }
  768. ::v-deep .period {
  769. display: flex;
  770. .borderleftnone {
  771. .el-input--medium .el-input__inner {
  772. border-top-right-radius: 0;
  773. border-bottom-right-radius: 0;
  774. }
  775. }
  776. .borderrightnone {
  777. .el-input--medium .el-input__inner {
  778. border-top-left-radius: 0;
  779. border-bottom-left-radius: 0;
  780. }
  781. }
  782. }
  783. ::v-deep .time-form tbody > tr:hover > td {
  784. background-color: transparent !important;
  785. }
  786. ::v-deep .time-form .el-table tr {
  787. background-color: #ffffff;
  788. }
  789. .pricebox {
  790. display: flex;
  791. justify-content: flex-start;
  792. align-items: center;
  793. font-weight: bold;
  794. }
  795. </style>