inventoryTable.vue 23 KB

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