detailedList.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. <template>
  2. <div class="ele-body">
  3. <BOMSearch @search="reload" :statusOpt="statusOpt" />
  4. <!-- :header-cell-style="headerCellStyle" -->
  5. <ele-pro-table
  6. ref="table"
  7. :key="tableKey"
  8. :columns="columns"
  9. :pagination="pagination"
  10. :datasource="datasource"
  11. class="dict-table"
  12. tool-class="ele-toolbar-actions"
  13. >
  14. <template v-slot:toolbar>
  15. <div class="toolbar_box">
  16. <div
  17. v-if="
  18. attributeData.status != 1 && attributeData.approvalStatus != 1
  19. "
  20. >
  21. <el-button
  22. type="primary"
  23. size="mini"
  24. @click="handleAdd"
  25. v-if="!isWt && attributeData.attributeType != 4"
  26. >新增</el-button
  27. >
  28. <el-button
  29. type="primary"
  30. size="mini"
  31. @click="handleSave"
  32. v-if="!isWt"
  33. >保存</el-button
  34. >
  35. </div>
  36. <div class="toolbar_box_right"
  37. ><span>基本数量</span>
  38. <el-input
  39. placeholder="请输入"
  40. v-model.number="attributeData.baseCount"
  41. >
  42. <template #append>
  43. {{
  44. attributeData.category && attributeData.category.measuringUnit
  45. }}</template
  46. >
  47. </el-input>
  48. </div>
  49. </div>
  50. </template>
  51. <!-- 用量 -->
  52. <template v-slot:dosageHead="{ column }">
  53. <div>
  54. <span class="is-required">{{ column.label }}</span>
  55. </div>
  56. </template>
  57. <template v-slot:dosage="{ row }">
  58. <el-input
  59. v-model="row.dosage"
  60. placeholder="请输入"
  61. size="mini"
  62. style="width: 68px"
  63. >
  64. </el-input>
  65. </template>
  66. <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
  67. <template v-slot:rootCategoryLevelId="{ row }"
  68. >{{ rootCategoryLevelIdText(row.rootCategoryLevelId) }}
  69. </template>
  70. <template v-slot:produceType="{ row }">
  71. <el-select
  72. v-model="row.produceType"
  73. filterable
  74. multiple
  75. disabled
  76. class="ele-block"
  77. size="mini"
  78. >
  79. <el-option
  80. v-for="item in produceTypeList"
  81. :key="item.value"
  82. :value="item.value"
  83. :label="item.label"
  84. ></el-option>
  85. </el-select>
  86. </template>
  87. <template v-slot:attributeType="{ row }">
  88. <el-select
  89. v-model="row.attributeType"
  90. filterable
  91. disabled
  92. class="ele-block"
  93. size="mini"
  94. >
  95. <el-option
  96. v-for="item in attributeList"
  97. :key="item.value"
  98. :value="item.value"
  99. :label="item.label"
  100. ></el-option>
  101. </el-select>
  102. </template>
  103. <template v-slot:componentAttribute="{ row }">
  104. <div>
  105. <el-select
  106. v-model="row.componentAttribute"
  107. filterable
  108. multiple
  109. disabled
  110. class="ele-block"
  111. size="mini"
  112. >
  113. <el-option
  114. v-for="item in sxtList"
  115. :key="item.value"
  116. :value="item.value"
  117. :label="item.label"
  118. ></el-option>
  119. </el-select>
  120. </div>
  121. </template>
  122. <template v-slot:resourceBomVersion="{ row }">
  123. <div v-if="!row.id">
  124. <el-select
  125. v-model="row.resourceBomVersion"
  126. disabled
  127. class="ele-block"
  128. size="mini"
  129. @change="resourceBomVersionFn($event, row)"
  130. >
  131. <el-option
  132. v-for="item in row.resourceBomVersionList"
  133. :key="item.versions"
  134. :value="item.versions"
  135. :label="'V' + item.versions + '.0'"
  136. ></el-option>
  137. </el-select>
  138. </div>
  139. <div v-else-if="row.resourceBomVersion">
  140. {{ 'V' + row.resourceBomVersion + '.0' }}
  141. </div>
  142. </template>
  143. <template v-slot:materielDesignation="{ row }">
  144. <el-input
  145. v-model="row.materielDesignation"
  146. placeholder="请输入物料代号"
  147. size="mini"
  148. style="width: 120px"
  149. >
  150. </el-input>
  151. </template>
  152. <template v-slot:supplierId="{ row }">
  153. <el-select
  154. v-model="row.supplierId"
  155. size="mini"
  156. clearable
  157. class="ele-block"
  158. filterable
  159. placeholder="请选择供应商"
  160. >
  161. <el-option
  162. v-for="(item, index) in gysList"
  163. :key="item.id + index"
  164. :value="item.id"
  165. :label="item.name"
  166. ></el-option>
  167. </el-select>
  168. </template>
  169. <template v-slot:factories="{ row }">
  170. <div style="display: flex">
  171. <el-input
  172. v-model="row.factories"
  173. disabled
  174. :value="row.factories"
  175. placeholder="请选择生产厂家"
  176. size="mini"
  177. style="width: 120px"
  178. >
  179. </el-input>
  180. <!-- -->
  181. <el-button type="primary" @click="factoriesFn(row.code)"
  182. >选择</el-button
  183. >
  184. <!-- <el-select v-model="row.factories" size="mini" clearable class="ele-block" filterable placeholder="请选择生产厂家">
  185. <el-option v-for="(item, index) in sccjList" :key="item.id + index" :value="item.id"
  186. :label="item.name"></el-option>
  187. </el-select> -->
  188. </div>
  189. <!-- <el-input v-model="row.factories" placeholder="请输入生产厂家" size="mini" style="width: 120px">
  190. </el-input> -->
  191. </template>
  192. <!-- 表头工具栏 -->
  193. <template v-slot:action="{ row, $index }">
  194. <el-link
  195. v-if="
  196. attributeData.approvalStatus != 1 &&
  197. attributeData.approvalStatus != 2 &&
  198. !isWt
  199. "
  200. type="danger"
  201. :underline="false"
  202. icon="el-icon-delete"
  203. @click="handleDel(row, $index)"
  204. >
  205. 删除
  206. </el-link>
  207. </template>
  208. </ele-pro-table>
  209. <bomTreeDialog ref="bomTreeDialogRef" @reload="bomClose" />
  210. <standardOutput
  211. ref="standardOutputRefs"
  212. @selection="chooseStandardList"
  213. ></standardOutput>
  214. <clientDialog
  215. ref="clientSelectionRef"
  216. @success="confirmSelection"
  217. ></clientDialog>
  218. </div>
  219. </template>
  220. <script>
  221. import BOMSearch from './BOM-search.vue';
  222. import {
  223. getBomPageCategoryId,
  224. contactList,
  225. deleteBomTreeList,
  226. updateBatchBOM,
  227. sourceBomVersion
  228. } from '@/api/material/BOM';
  229. import clientDialog from './clientDialog.vue';
  230. import { getByCode } from '@/api/system/dictionary-data';
  231. import bomTreeDialog from './bomTreeDialog.vue';
  232. import { produceTypeList } from '@/enum/dict.js';
  233. import standardOutput from './standardOutput.vue';
  234. export default {
  235. name: 'SystemDictionary',
  236. components: { BOMSearch, bomTreeDialog, standardOutput, clientDialog },
  237. data() {
  238. return {
  239. produceTypeList,
  240. pagination: {
  241. tableTotal: 0
  242. },
  243. // 表格列配置
  244. columns: [
  245. {
  246. label: '序号',
  247. columnKey: 'index',
  248. type: 'index',
  249. width: 55,
  250. align: 'center',
  251. showOverflowTooltip: true
  252. },
  253. {
  254. prop: 'code',
  255. label: 'BOM编码',
  256. showOverflowTooltip: true,
  257. width: 120
  258. },
  259. {
  260. prop: 'categoryCode',
  261. label: '物品编码',
  262. showOverflowTooltip: true,
  263. width: 120
  264. },
  265. {
  266. prop: 'name',
  267. label: '名称',
  268. width: 150
  269. },
  270. {
  271. prop: 'level',
  272. label: '层级'
  273. },
  274. {
  275. prop: 'brandNum',
  276. label: '牌号'
  277. },
  278. {
  279. prop: 'modelType',
  280. label: '型号',
  281. align: 'center',
  282. showOverflowTooltip: true
  283. },
  284. {
  285. prop: 'specification',
  286. label: '规格',
  287. align: 'center',
  288. showOverflowTooltip: true
  289. },
  290. {
  291. prop: 'rootCategoryLevelId',
  292. slot: 'rootCategoryLevelId',
  293. label: '物品分类',
  294. align: 'center',
  295. showOverflowTooltip: true
  296. },
  297. {
  298. prop: 'dosage',
  299. slot: 'dosage',
  300. label: '用量',
  301. width: 100,
  302. headerSlot: 'dosageHead'
  303. },
  304. {
  305. prop: 'measuringUnit',
  306. label: '计量单位',
  307. showOverflowTooltip: true
  308. },
  309. {
  310. prop: 'produceType',
  311. slot: 'produceType',
  312. label: '生产类型',
  313. width: 260
  314. },
  315. {
  316. prop: 'attributeType',
  317. slot: 'attributeType',
  318. label: '存货类型',
  319. width: 260
  320. },
  321. {
  322. prop: 'componentAttribute',
  323. slot: 'componentAttribute',
  324. label: '属性类型',
  325. width: 260
  326. },
  327. {
  328. prop: 'materielDesignation',
  329. slot: 'materielDesignation',
  330. label: '物料代号',
  331. width: 150
  332. },
  333. {
  334. prop: 'supplierId',
  335. slot: 'supplierId',
  336. label: '供应商',
  337. width: 150
  338. },
  339. {
  340. prop: 'factories',
  341. slot: 'factories',
  342. label: '生产厂家',
  343. width: 180
  344. },
  345. {
  346. prop: 'resourceBomVersion',
  347. slot: 'resourceBomVersion',
  348. label: '来源版本',
  349. width: 180
  350. },
  351. {
  352. prop: 'versions',
  353. slot: 'versions',
  354. label: '版本'
  355. },
  356. {
  357. prop: 'status ',
  358. label: '状态',
  359. formatter: (row) => {
  360. return this.statusOpt[+row.status];
  361. }
  362. },
  363. {
  364. prop: 'createName',
  365. label: '创建人',
  366. showOverflowTooltip: true
  367. },
  368. {
  369. prop: 'createTime',
  370. label: '创建日期',
  371. width: 160
  372. },
  373. {
  374. action: 'action',
  375. slot: 'action',
  376. fixed: 'right',
  377. label: '操作',
  378. width: 120
  379. }
  380. ],
  381. statusOpt: {
  382. '': '全部',
  383. 0: '草稿',
  384. 1: '已发布'
  385. },
  386. dictList: [
  387. {
  388. label: '加工',
  389. value: 1
  390. },
  391. {
  392. label: '装配',
  393. value: 3
  394. }
  395. ],
  396. attributeList: [
  397. {
  398. label: '总装',
  399. value: 1
  400. },
  401. {
  402. label: '部件',
  403. value: 2
  404. },
  405. {
  406. label: '零件',
  407. value: 3
  408. },
  409. {
  410. label: '原材料',
  411. value: 4
  412. }
  413. ],
  414. sxtList: [
  415. {
  416. label: '自制件',
  417. value: 1
  418. },
  419. {
  420. label: '采购件',
  421. value: 2
  422. },
  423. {
  424. label: '外协件',
  425. value: 3
  426. },
  427. {
  428. label: '受托件',
  429. value: 4
  430. }
  431. ],
  432. rootCategoryLevelIdList: [
  433. {
  434. label: '产品',
  435. value: 9
  436. },
  437. {
  438. label: '物料',
  439. value: 1
  440. },
  441. {
  442. label: '生产设备',
  443. value: 4
  444. },
  445. {
  446. label: '模具',
  447. value: 5
  448. },
  449. {
  450. label: '备品备件',
  451. value: 6
  452. },
  453. {
  454. label: '零部件',
  455. value: 3
  456. },
  457. {
  458. label: '舟皿',
  459. value: 8
  460. },
  461. {
  462. label: '消耗材料',
  463. value: 10
  464. },
  465. {
  466. label: '包装材料',
  467. value: 13
  468. },
  469. {
  470. label: '生产辅助设备',
  471. value: 14
  472. },
  473. {
  474. label: '仪表计量设备',
  475. value: 15
  476. },
  477. {
  478. label: '会计科目',
  479. value: 23
  480. },
  481. {
  482. label: '周转盘',
  483. value: 26
  484. },
  485. {
  486. label: '废品',
  487. value: 28
  488. }
  489. ],
  490. isList: false,
  491. isId: null,
  492. tableKey: '',
  493. list: [], //表格数据
  494. listTow: [],
  495. newList: [],
  496. gysList: [],
  497. sccjList: [],
  498. newTreeId: null,
  499. responsesList: []
  500. // dictList: []
  501. };
  502. },
  503. created() {
  504. // this.getDictList('productionType');
  505. // this.getZeroPartPros('zeroPartPros');
  506. this.getContactList();
  507. },
  508. mounted() {},
  509. props: {
  510. attributeData: {
  511. type: Object,
  512. default: {}
  513. },
  514. isWt: {
  515. type: Boolean,
  516. default: false
  517. },
  518. treeId: {
  519. type: String,
  520. default: ''
  521. },
  522. isTemp: {
  523. type: Number,
  524. default: 0
  525. }
  526. },
  527. watch: {
  528. treeId: {
  529. handler(val) {
  530. this.newTreeId = val;
  531. },
  532. deep: true,
  533. immediate: true
  534. },
  535. 'attributeData.id': {
  536. handler(val) {
  537. this.$nextTick(() => {
  538. console.log(val, '66666666');
  539. this.reload();
  540. });
  541. },
  542. deep: true,
  543. immediate: true
  544. },
  545. data: {
  546. handler(val) {
  547. console.log(val);
  548. // this.$nextTick(() => {
  549. // this.reload();
  550. // });
  551. },
  552. deep: true,
  553. immediate: true
  554. }
  555. },
  556. // computed: {
  557. // processedItems() {
  558. // return this.list.map(item => {
  559. // // 处理逻辑
  560. // console.log(item);
  561. // // return processedItem;
  562. // });
  563. // }
  564. // },
  565. mounted() {
  566. console.log(this.attributeData, 'attributeData');
  567. console.log(this.isWt, 'isWt');
  568. },
  569. methods: {
  570. rootCategoryLevelIdText(v) {
  571. console.log(v, '111111');
  572. if (v) {
  573. let a = this.rootCategoryLevelIdList.find((item) => item.value == v);
  574. return a.label;
  575. }
  576. },
  577. factoriesFn(code) {
  578. this.isId = code;
  579. this.$refs.clientSelectionRef.open();
  580. },
  581. // 选择工厂
  582. confirmSelection(obj) {
  583. let list = this.$refs.table.getData();
  584. list.map((v) => {
  585. if (v.code == this.isId) {
  586. v.factories = obj.name;
  587. }
  588. });
  589. console.log(list, 'list');
  590. // arr.factories = obj.name;
  591. this.$nextTick(() => {
  592. this.list = [...list];
  593. this.listTow = JSON.parse(JSON.stringify(this.list));
  594. this.$refs.table.setData(this.list);
  595. this.updateFn();
  596. this.tableKey = Date.now();
  597. });
  598. this.$forceUpdate();
  599. },
  600. updateFn(list) {
  601. this.isList = true;
  602. this.reload();
  603. setTimeout(() => {
  604. this.isList = false;
  605. }, 1000);
  606. },
  607. /* 表格数据源 */
  608. datasource({ where, page, limit }) {
  609. // let that = this;
  610. // console.log(getBomPageCategoryId({
  611. // ...where,
  612. // pageNum: page,
  613. // size: limit,
  614. // id: this.attributeData.id,
  615. // bomType: this.attributeData.bomType
  616. // }));
  617. // return new Promise((resolve, reject) => {
  618. // getBomPageCategoryId({
  619. // ...where,
  620. // pageNum: page,
  621. // size: limit,
  622. // id: that.attributeData.id,
  623. // bomType: that.attributeData.bomType
  624. // }).then((res) => {
  625. // console.log(res, '111111111111');
  626. // if(res.list && res.list.length ){
  627. // const arrays = []
  628. // res.list.map((item) => {
  629. // arrays.push(item.categoryId);
  630. // });
  631. // that.getResourceBomVersionListFn(arrays).then(v => {
  632. // v.map(element => {
  633. // res.list.map((item2, i) => {
  634. // if (element.categoryId == item2.id) {
  635. // item2.resourceBomVersionList.push(element);
  636. // }
  637. // item2.resourceBomVersion = item2.resourceBomVersionList[0].versions;
  638. // item2.resourceBomId = item2.resourceBomVersionList[0].resourceBomId;
  639. // // item2.id ="";
  640. // })
  641. // })
  642. // this.$nextTick(() => {
  643. // resolve(res);
  644. // })
  645. // })
  646. // }
  647. // })
  648. // .catch((err) => {
  649. // reject(err);
  650. // });
  651. // });
  652. let data = getBomPageCategoryId({
  653. ...where,
  654. pageNum: page,
  655. size: limit,
  656. id: this.attributeData.id,
  657. bomType: this.attributeData.bomType
  658. });
  659. if (this.isList) {
  660. data = this.listTow;
  661. }
  662. console.log(data, 'data');
  663. return data;
  664. },
  665. /* 刷新表格 */
  666. reload(where) {
  667. this.$refs.table.reload({ where });
  668. },
  669. async getDictList(code) {
  670. let { data: res } = await getByCode(code);
  671. this.dictList = res.map((item) => {
  672. let values = Object.keys(item);
  673. return {
  674. value: Number(values[0]),
  675. label: item[values[0]]
  676. };
  677. });
  678. },
  679. // async getZeroPartPros(code) {
  680. // let { data: res } = await getByCode(code);
  681. // let sxtList = res.map((item) => {
  682. // let values = Object.keys(item);
  683. // return {
  684. // value: Number(values[0]),
  685. // label: item[values[0]]
  686. // };
  687. // });
  688. // this.$nextTick(() => {
  689. // this.$set(this, 'sxtList', sxtList);
  690. // });
  691. // },
  692. getContactList() {
  693. let param = {
  694. pageNum: 1,
  695. type: 2,
  696. size: -1,
  697. status: 1
  698. };
  699. contactList(param).then((res) => {
  700. console.log(res, 'res11111111111');
  701. this.gysList = res.list;
  702. });
  703. },
  704. handleAdd() {
  705. // // 打开树形对话框
  706. // this.$refs.bomTreeDialogRef.open(
  707. // this.attributeData.bomType,
  708. // this.attributeData.versions,
  709. // this.attributeData.categoryId,
  710. // this.newTreeId,
  711. // this.isTemp
  712. // );
  713. let _list = this.$refs.table.getData() ?? [];
  714. this.$refs.standardOutputRefs.open(_list);
  715. },
  716. // 勾选
  717. async chooseStandardList(data) {
  718. const that = this;
  719. const arrays = [];
  720. data.map((m) => {
  721. m.parentId = this.newTreeId;
  722. m.createTime = '';
  723. m.bomType = this.attributeData.bomType;
  724. m.level = Number(this.attributeData.level) + 1;
  725. m.categoryCode = m.code;
  726. m.code = '';
  727. m.versions = this.attributeData.versions;
  728. m.categoryId = m.id;
  729. // m.dosage = 1;
  730. m.componentAttribute = m.componentAttribute;
  731. m.rootCategoryLevelId = m.categoryLevelPathIdParent;
  732. m.resourceBomVersionList = [];
  733. arrays.push(m.id);
  734. });
  735. this.getResourceBomVersionListFn(arrays).then((v) => {
  736. if (v.length) {
  737. v.map((element) => {
  738. data.map((item2, i) => {
  739. if (element.categoryId == item2.id) {
  740. item2.resourceBomVersionList.push(element);
  741. }
  742. if (item2.resourceBomVersionList.length) {
  743. item2.resourceBomVersion =
  744. item2.resourceBomVersionList[0].versions;
  745. item2.resourceBomId =
  746. item2.resourceBomVersionList[0].resourceBomId;
  747. }
  748. setTimeout(() => {
  749. item2.id = '';
  750. }, 100);
  751. });
  752. });
  753. }
  754. this.$nextTick(() => {
  755. data.map((v) => {
  756. v.id = '';
  757. });
  758. this.list = [...data, ...this.$refs.table.getData()];
  759. this.$refs.table._data.tableTotal = this.list.length;
  760. this.$refs.table.setData(this.list);
  761. });
  762. });
  763. // this.$nextTick(() => {
  764. // this.list = [...data, ...this.$refs.table.getData()];
  765. // console.log(this.list,'9999999999');
  766. // // this.$refs.table.setData(this.list);
  767. // console.log(this.$refs.table._data,'this.$refs.table');
  768. // // this.$refs.table._data.tableData = [];
  769. // //
  770. // // this.$set(this.$refs.table._data,"tableData",this.list);
  771. // // this.bomClose();
  772. // });
  773. },
  774. resourceBomVersionFn(e, row) {
  775. let arr = row.resourceBomVersionList.find((item) => item.versions == e);
  776. console.log(arr, 'eeeeeeeeee');
  777. this.$forceUpdate();
  778. row.resourceBomVersion = arr.versions;
  779. row.resourceBomId = arr.resourceBomId;
  780. console.log(row);
  781. },
  782. async getResourceBomVersionListFn(id) {
  783. return new Promise((resolve, reject) => {
  784. sourceBomVersion({
  785. bomType: this.attributeData.bomType,
  786. categoryIds: id
  787. }).then((res) => {
  788. resolve(res.data);
  789. });
  790. });
  791. },
  792. bomClose() {
  793. this.$nextTick(() => {
  794. this.$refs.table.reload({
  795. pageNum: 1
  796. });
  797. });
  798. },
  799. handleDel(row, i) {
  800. this.$confirm('是否确认删除?', '提示', {
  801. confirmButtonText: '确定',
  802. cancelButtonText: '取消',
  803. type: 'warning'
  804. })
  805. .then(() => {
  806. if (row.id) {
  807. deleteBomTreeList([row.id]).then((msg) => {
  808. this.$message.success('删除' + msg);
  809. this.$refs.table.reload({
  810. pageNum: 1
  811. });
  812. });
  813. } else {
  814. let _list = this.$refs.table.getData() ?? [];
  815. _list.splice(i, 1);
  816. // _list = _list.filter((item) => item.id !== row.id);
  817. this.$refs.table.setData(_list);
  818. }
  819. })
  820. .catch(() => {});
  821. },
  822. handleSave() {
  823. let _list = this.$refs.table.getData() ?? [];
  824. if (_list.length == 0) {
  825. return this.$message.info('明细表最少有一条数据');
  826. }
  827. let list = JSON.parse(JSON.stringify(_list));
  828. console.log(list, 'list');
  829. const arr = list.every((v) => {
  830. return v.dosage && v.quantity !== '';
  831. });
  832. if (!arr) {
  833. return this.$message.info('用量不能为空');
  834. }
  835. // console.log(list);
  836. // return
  837. updateBatchBOM(list).then((res) => {
  838. if (res) {
  839. this.$message.success('保存成功');
  840. this.reload();
  841. // this.$refs.table.reload({
  842. // pageNum: 1
  843. // });
  844. }
  845. });
  846. }
  847. }
  848. };
  849. </script>
  850. <style lang="scss" scoped>
  851. .ele-body {
  852. height: 100%;
  853. ::v-deep .el-card {
  854. height: 100%;
  855. .el-card__body {
  856. height: 100%;
  857. display: flex;
  858. flex-direction: column;
  859. .dict-table {
  860. flex: 1;
  861. overflow: hidden;
  862. display: flex;
  863. flex-direction: column;
  864. .el-table {
  865. flex: 1;
  866. overflow-y: auto;
  867. }
  868. }
  869. }
  870. }
  871. }
  872. .toolbar_box {
  873. display: flex;
  874. justify-content: space-between;
  875. align-items: center;
  876. .toolbar_box_right {
  877. display: flex;
  878. align-items: center;
  879. justify-content: center;
  880. margin-right: 10px;
  881. > span {
  882. width: 150px;
  883. }
  884. > div {
  885. margin-left: 10px;
  886. }
  887. }
  888. }
  889. </style>