index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. <script>
  2. import orderApi from "@/api/business/purchase/purchase-order";
  3. import { initColumns, initDicts, initRules, initParams } from "@/utils/init/index.js";
  4. import { Columns, TabColumns } from "./column";
  5. const NewColumns = initColumns(Columns);
  6. const NewTabColumns = TabColumns.map((element) => ({
  7. ...element,
  8. tableColumns: initColumns(element.tableColumns),
  9. }));
  10. const SelectColumns = NewColumns.filter(
  11. (column) => column.inputType === "Select"
  12. );
  13. NewTabColumns.forEach((column) => {
  14. SelectColumns.push(
  15. ...column.tableColumns.filter((cColumn) => cColumn.inputType === "Select")
  16. );
  17. });
  18. export default {
  19. name: "AddPurchaseOrderDrawer",
  20. dicts: initDicts(SelectColumns),
  21. components: {
  22. FileUploadCenter: () => import("../components/FileUploadCenter/index.vue"),
  23. popDialog: () => import("@/components/PopDialog/index.vue"),
  24. BatchImport: () => import("@/components/BatchImport/index.vue"),
  25. },
  26. data() {
  27. return {
  28. visible: false,
  29. loading:false,
  30. tabLoading:false,
  31. columns: NewColumns,
  32. rules: initRules(NewColumns),
  33. count:0,
  34. params: {
  35. ...initParams(NewColumns),
  36. puOrderItemList: [],
  37. puOrderExecuteList: [],
  38. },
  39. tabColumns: NewTabColumns,
  40. tabName: "puOrderItemList",
  41. isCopy:false,
  42. };
  43. },
  44. computed: {},
  45. watch: {
  46. "params.puOrderItemList": {
  47. handler(nVal, oVal) {
  48. this.visible &&
  49. this.handleSynchronousMaterial(
  50. "puOrderItemList",
  51. "puOrderExecuteList"
  52. );
  53. },
  54. deep: true,
  55. },
  56. "params.puOrderExecuteList": {
  57. handler(nVal, oVal) {
  58. this.visible &&
  59. this.handleSynchronousMaterial(
  60. "puOrderExecuteList",
  61. "puOrderItemList"
  62. );
  63. },
  64. deep: true,
  65. },
  66. "params.billType":{
  67. handler(nVal, oVal){
  68. let billList = ['21-Cxx-02','21-Cxx-04','21-Cxx-10','21-Cxx-14','21-Cxx-09','21-Cxx-17','21-Cxx-18'];
  69. if(billList.find(item => item === nVal)){
  70. this.rules.warehouseName = [
  71. { required: true, message: "WMS入库仓库不能为空", trigger: "change" },
  72. ];
  73. this.rules.goodsAllocationName = [
  74. { required: true, message: "货位不能为空", trigger: "change" },
  75. ];
  76. }else{
  77. this.rules.warehouseName = null;
  78. this.rules.goodsAllocationName = null;
  79. }
  80. this.count++;
  81. }
  82. }
  83. },
  84. methods: {
  85. beforeOpen() {
  86. if(!this.isCopy){
  87. const { deptName, deptId, name, nickName, orgName, orgId } = this.$store.state.user;
  88. this.params.puOrg = orgId;
  89. this.params.puOrgName = orgName;
  90. this.params.buyer = name;
  91. this.params.buyerName = nickName;
  92. this.params.puDept = deptId;
  93. this.params.puDeptName = deptName;
  94. this.params.billDate = new Date().Format('yyyy-MM-dd');
  95. console.log(this.params,'this.params');
  96. // this.addTableRow();
  97. }
  98. },
  99. setVisible(prop,iscopy) {
  100. this.visible = prop;
  101. this.isCopy = iscopy;
  102. if(!this.visible){
  103. this.$refs['orderAddForm'].clearValidate();
  104. }
  105. },
  106. // 复制赋值
  107. async setCopyParams(id) {
  108. try {
  109. this.loading = true;
  110. const { code, msg, data } = await orderApi.details(id);
  111. if (code === 200) {
  112. this.params = {
  113. ...data,
  114. id: "",
  115. code: "",
  116. isEnd:'N',
  117. status: "0",
  118. source: "3",
  119. isClose:'N',
  120. billDate: new Date().Format('yyyy-MM-dd'),
  121. closeTime:'',
  122. oaDemandNo:'',
  123. isInvoice:'N',
  124. isSendWms:'N',
  125. rebateMoney:'',
  126. invoiceMoney:'',
  127. paymentMoney:'',
  128. applyPaymentMoney:'',
  129. erpOrderCode:'',
  130. };
  131. for (const key in this.params) {
  132. // if (Array.isArray(this.params[key])) {
  133. if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
  134. this.params[key].forEach((v) => {
  135. v.id = "";
  136. v.demandCode = "";
  137. v['isInvoice'] && (v['isInvoice'] = 'N');
  138. v['isStorage'] && (v['isStorage'] = 'N');
  139. v['isArrival'] && (v['isArrival'] = 'N');
  140. v['isPayment'] && (v['isPayment'] = 'N');
  141. });
  142. }
  143. }
  144. // 清空 累计本币开票金额、
  145. // 累计付款金额、累计付款申请金额、累计开票主数量、最终关闭时间
  146. // 、最终关闭、已同步WMS 、订单抵扣余额金额、订单使用返利金额、 发票标识
  147. }
  148. } catch (err) {
  149. //
  150. } finally {
  151. this.loading = false;
  152. }
  153. },
  154. // 增行
  155. addTableRow(prop) {
  156. for (const key in this.params) {
  157. // if (Array.isArray(this.params[key])) {
  158. if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
  159. const arr = this.tabColumns.find(
  160. (element) => element.key === key
  161. ).tableColumns;
  162. let rowData = initParams(arr, "key", "value");
  163. "rowno" in rowData &&
  164. (rowData["rowno"] = this.params[key].length + 1);
  165. // 物料
  166. if("rowNo" in rowData){
  167. rowData["rowNo"] = this.params[key].length + 1;
  168. // 扣税类别
  169. rowData["taxDeductClassify"] = '1';
  170. // 价格类型
  171. rowData["priceType"] = 'order';
  172. // 币种
  173. rowData["currency"] = '1002Z0100000000001K1';
  174. rowData["currencyName"] = '人民币';
  175. }
  176. // 是否完成询价,新增明细行需默认明细为false
  177. rowData["whetherCompleteInquiry"] = false;
  178. this.params[key].push(rowData);
  179. }
  180. }
  181. // const arr = this.tabColumns.find(
  182. // (element) => element.key === this.tabName
  183. // ).tableColumns;
  184. // prop.push(initParams(arr, "key", "value"));
  185. },
  186. // 删行
  187. async delTableRow(prop, index) {
  188. for (const key in this.params) {
  189. // if (Array.isArray(this.params[key])) {
  190. if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
  191. this.params[key].splice(index, 1);
  192. }
  193. }
  194. await this.handleGetPrice();
  195. // prop.splice(index, 1);
  196. },
  197. // 同步子表物料
  198. handleSynchronousMaterial(tableOne, tableTwo) {
  199. let _this = this;
  200. // this.params[tableOne]-- -> this.params[tableTwo]
  201. this.params[tableOne] &&
  202. this.params[tableOne].forEach((item, index) => {
  203. for (const key in item) {
  204. if(!_this.params[tableTwo][index]){
  205. const arr = _this.tabColumns.find(
  206. (element) => element.key === tableTwo
  207. ).tableColumns;
  208. _this.params[tableTwo].push(initParams(arr, "key", "value"));
  209. }
  210. if (key in _this.params[tableTwo][index]) {
  211. _this.params[tableTwo][index].material = item.material;
  212. key !== 'id' && ( _this.params[tableTwo][index][key] = item[key]);
  213. }
  214. }
  215. });
  216. },
  217. // 取消
  218. handleCancel() {
  219. this.params = {
  220. ...initParams(this.columns),
  221. puOrderItemList: [],
  222. puOrderExecuteList: [],
  223. };
  224. this.setVisible(false);
  225. },
  226. // 判断保存条件
  227. judgeSaveCondition(cb){
  228. this.$refs['orderAddForm'].validate(async (valid) => {
  229. if (valid) {
  230. if(!this.params['puOrderItemList'].length || !this.params['puOrderExecuteList'].length){
  231. this.$notify.error({
  232. title: '错误',
  233. message: '请填写订单行!'
  234. });
  235. return false;
  236. }
  237. // puOrderItemList
  238. let isPrice = this.params.puOrderItemList.filter(item => !item.whetherCompleteInquiry);
  239. if(isPrice.length){
  240. this.$notify.error({
  241. title: '错误',
  242. message: '询价失败!'
  243. });
  244. return false
  245. }
  246. console.log(isPrice,'isPrice');
  247. cb();
  248. } else {
  249. this.$notify.error({
  250. title: '错误',
  251. message: '存在必填项未填写'
  252. });
  253. console.log('error submit!!');
  254. return false;
  255. }
  256. });
  257. },
  258. // 保存
  259. handleSava() {
  260. console.log(this.params,'this.params---------');
  261. this.judgeSaveCondition(async()=>{
  262. try {
  263. this.loading = true;
  264. const { code, msg } = await orderApi.create(this.params);
  265. if (code === 200) {
  266. this.handleCancel();
  267. }
  268. } catch (err) {
  269. //
  270. } finally {
  271. this.loading = false;
  272. }
  273. })
  274. },
  275. // 主表参照改变之后
  276. async handleReferChange(val, type, source){
  277. // 供应商选择
  278. if( type === 'SUPPLIER_PARAM' ){
  279. let page = { pageNum: 1 , pageSize: 10 };
  280. let relevanceRefer = [
  281. {
  282. // 供应商联系人
  283. key:'supplierContacts',
  284. params:{
  285. type:'SUPPLIERCONTACTS_PARAM',
  286. supplierId:val.id,
  287. }
  288. },
  289. {
  290. // 供应商业务员
  291. key:'supplierPersonal',
  292. params:{
  293. type:'PSNLICENSE_PARAM',
  294. supplierId:val.id,
  295. pkOrg: source.puOrg,
  296. }
  297. }
  298. ]
  299. await relevanceRefer.forEach(async (refer) =>{
  300. try {
  301. const { code, rows} = await orderApi.REFER(
  302. {
  303. ...refer.params,
  304. search: "",
  305. isPage: true,
  306. }, page );
  307. if (code === 200) {
  308. source[refer.key] = rows[0]? rows[0].id :'';
  309. source[`${refer.key}Name`] = rows[0] ? rows[0].name :'';
  310. }
  311. } catch (error) {}
  312. })
  313. // 明细不为空的情况下进行询价
  314. let detailList = this.params['puOrderItemList'].filter(item => (
  315. item.material && item.material != ''
  316. ))
  317. if(detailList.length){
  318. this.params['puOrderItemList'] = this.params['puOrderItemList'].map(item => {
  319. item['whetherCompleteInquiry'] = false
  320. return item;
  321. });
  322. await this.handleGetPrice();
  323. }
  324. }
  325. // // 组织
  326. // if(type === 'ORG_PARAM'){
  327. // for (const key in this.params) {
  328. // // if (Array.isArray(this.params[key])) {
  329. // if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
  330. // this.params[key] = [];
  331. // }
  332. // else if(key === 'sysFileRecordList'){
  333. // this.params[key] = [];
  334. // }
  335. // else if (
  336. // key != "puOrg" &&
  337. // key != "puOrgName" &&
  338. // key != "buyer" &&
  339. // key != "buyerName" &&
  340. // key != "puDept" &&
  341. // key != "puDeptName" &&
  342. // key != "status" &&
  343. // key != "billDate"
  344. // ) {
  345. // this.params[key] = "";
  346. // } else {
  347. // }
  348. // }
  349. // }
  350. },
  351. // 下拉框选择改变
  352. handleSelectChange(val,typeName){
  353. if(val === 'billType'){
  354. this.params['billTypeName'] = this.dict.type[typeName].find(item => item.value == this.params[val]).label;
  355. }
  356. },
  357. // 子表参照改变之后
  358. async handleTabReferChange(val, type, source) {
  359. // 触发物料参照询价
  360. if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
  361. source['qty'] = 0;
  362. source['whetherCompleteInquiry'] = false;
  363. source['taxPrice'] = 0;
  364. source['money'] = 0;
  365. source['taxDeductMoneya'] = 0;
  366. source['price'] = 0;
  367. source['notaxMoney'] = 0;
  368. source['tax'] = 0;
  369. this.params['qty'] = 0;
  370. this.params['originalQty'] = 0;
  371. this.params['money'] = 0;
  372. this.params['originalMoney'] = 0;
  373. this.params['notaxMoney'] = 0;
  374. source.isDrug = val.materialMedcine.isDrug == '0' ? 'Y' : 'N';
  375. // await this.handleGetPrice();
  376. }
  377. },
  378. // 子表下拉框改变
  379. async handleTabSelectChange(type,row){
  380. if(type == 'priceType' && row.material && row.qty && row.qty != ""){
  381. row['whetherCompleteInquiry'] = false;
  382. await this.handleGetPrice();
  383. }
  384. },
  385. // 子表inputNumber
  386. handleInputChange(row, type) {
  387. // 物料数量变化----询价
  388. if (type == "qty" && row.material) {
  389. row['whetherCompleteInquiry'] = false;
  390. row.qty && this.handleGetPrice();
  391. }
  392. },
  393. // 子表多选框改变
  394. handleTabCheckbox(type,source){
  395. // 勾选赠品,价税合计更新为0,含税单价、无税单价更新为0
  396. if(type === 'isGift' && source.material && source.qty && source.qty != ""){
  397. source['whetherCompleteInquiry'] = false;
  398. this.handleGetPrice()
  399. }
  400. },
  401. // 询价 getPrice
  402. async handleGetPrice() {
  403. try {
  404. // action:insert(新增)、revise(修订)、update(编辑)
  405. let { code, data } = await orderApi.getPrice({ ...this.params,action: 'insert' });
  406. if (code == 200) {
  407. this.params = data;
  408. }
  409. } catch (error) {}
  410. },
  411. async handelImport(fileList){
  412. try {
  413. let formData = new FormData();
  414. formData.append('file',fileList[0].raw);
  415. this.$modal.loading("正在上传文件,请稍候...");
  416. let {code,data} = await orderApi.orderImport(formData);
  417. if(code == 200) {
  418. this.tabLoading = true;
  419. // puOrderExecuteList puOrderItemList
  420. let size = 20;
  421. let num = 1;
  422. let total = Math.ceil(data['puOrderItemList'].length / size);
  423. let resultData = {...data};
  424. let intervalPush = setInterval(()=>{
  425. if(num > total){
  426. clearInterval(intervalPush);
  427. this.tabLoading = false;
  428. this.handleGetPrice();
  429. }
  430. for (const key in resultData) {
  431. resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
  432. this.params[key].push(item);
  433. })
  434. }
  435. num++;
  436. },200);
  437. // for (const key in data) {
  438. // this.params[key].push(...data[key]);
  439. // }
  440. let {setVisible} = this.$refs.batchImport;
  441. setVisible(false);
  442. }
  443. } catch (error) {
  444. }finally{
  445. this.$modal.closeLoading();
  446. }
  447. },
  448. async handleTemDownload(){
  449. this.download('/pu/order/downloadFailData',{}, `物料信息模板${new Date().getTime()}.xlsx`);
  450. },
  451. },
  452. created() {
  453. console.log("ADD CREATED", this.params);
  454. },
  455. mounted() {},
  456. destroyed() {},
  457. };
  458. </script>
  459. <template>
  460. <el-drawer
  461. direction="btt"
  462. size="100%"
  463. :with-header="false"
  464. :visible.sync="visible"
  465. @open="beforeOpen"
  466. @close="$emit('close')"
  467. v-loading="loading"
  468. >
  469. <el-form
  470. size="mini"
  471. label-position="right"
  472. ref="orderAddForm"
  473. label-width="140px"
  474. :model="params"
  475. :rules="rules"
  476. :key="count"
  477. >
  478. <el-card
  479. :body-style="{
  480. padding: '20px',
  481. display: 'flex',
  482. 'flex-wrap': 'wrap',
  483. }"
  484. style="margin: 10px"
  485. >
  486. <div
  487. slot="header"
  488. style="
  489. display: flex;
  490. justify-content: space-between;
  491. align-items: center;
  492. "
  493. >
  494. <h3>新增</h3>
  495. <div style="text-align: right">
  496. <el-button
  497. size="mini"
  498. type="primary"
  499. @click="handleSava"
  500. >保存</el-button>
  501. <el-button size="mini" @click="handleCancel">取消</el-button>
  502. </div>
  503. </div>
  504. <el-row style="display: flex; flex-wrap: wrap">
  505. <el-col
  506. v-for="(column, index) in columns"
  507. :key="index"
  508. :span="column.span || 6"
  509. >
  510. <el-form-item
  511. :prop="column.key"
  512. :label="column.title"
  513. v-if="column.isShow"
  514. >
  515. <el-input
  516. v-if="column.inputType === 'Input'"
  517. v-model="params[column.key]"
  518. :placeholder="column.placeholder"
  519. :clearable="column.clearable"
  520. :disabled="column.disabled"
  521. style="width: 100%;"
  522. >
  523. </el-input>
  524. <dr-popover-select
  525. v-if="column.inputType === 'PopoverSelect'"
  526. v-model="params[column.key]"
  527. :value-key="column.valueKey"
  528. :source.sync="params"
  529. :title="column.title"
  530. :type="column.referName"
  531. :disabled="column.disabled"
  532. :multiple="column.multiple"
  533. :placeholder="column.placeholder"
  534. :data-mapping="column.dataMapping"
  535. :query-params="column.queryParams"
  536. @change="handleReferChange"
  537. ></dr-popover-select>
  538. <el-input
  539. v-if="column.inputType === 'Textarea'"
  540. v-model="params[column.key]"
  541. type="textarea"
  542. :placeholder="column.placeholder"
  543. :clearable="column.clearable"
  544. :disabled="column.disabled"
  545. style="width: 100%"
  546. ></el-input>
  547. <el-input-number
  548. v-if="column.inputType === 'InputNumber'"
  549. v-model="params[column.key]"
  550. :precision="column.precision"
  551. :controls-position="column.controlsPosition"
  552. :placeholder="column.placeholder"
  553. :clearable="column.clearable"
  554. :disabled="column.disabled"
  555. style="width: 100%"
  556. >
  557. </el-input-number>
  558. <el-select
  559. v-if="column.inputType === 'Select'"
  560. v-model="params[column.key]"
  561. :disabled="column.disabled"
  562. :clearable="column.clearable"
  563. :placeholder="column.placeholder"
  564. style="width: 100%"
  565. filterable
  566. @change="handleSelectChange(column.key,column.referName)"
  567. >
  568. <el-option
  569. v-for="item in dict.type[column.referName]"
  570. :key="item.value"
  571. :label="item.label"
  572. :value="item.value"
  573. ></el-option>
  574. </el-select>
  575. <el-select
  576. v-if="column.inputType === 'TagSelect'"
  577. v-model="params[column.key]"
  578. multiple
  579. clearable
  580. collapse-tags
  581. :placeholder="column.placeholder"
  582. :clearable="column.clearable"
  583. :disabled="column.disabled"
  584. style="width: 100%"
  585. >
  586. <template #prefix>
  587. <el-icon
  588. class="el-icon-view"
  589. style="cursor: pointer"
  590. @click.stop="$message.info(234)"
  591. >
  592. </el-icon>
  593. </template>
  594. <el-option
  595. v-for="item in options"
  596. :key="item.value"
  597. :label="item.label"
  598. :value="item.value"
  599. ></el-option>
  600. </el-select>
  601. <el-date-picker
  602. v-if="column.inputType === 'DatePicker'"
  603. v-model="params[column.key]"
  604. :type="column.type"
  605. :placeholder="column.placeholder"
  606. :clearable="column.clearable"
  607. :disabled="column.disabled"
  608. :picker-options="column.pickerOptions"
  609. style="width: 100%"
  610. ></el-date-picker>
  611. <el-checkbox
  612. v-if="column.inputType === 'Checkbox'"
  613. v-model="params[column.key]"
  614. :disabled="column.disabled"
  615. true-label="Y"
  616. false-label="N"
  617. ></el-checkbox>
  618. <file-upload-center
  619. v-if="column.inputType === 'Upload'"
  620. v-model="params[column.key]"
  621. :file-type="column.fileType"
  622. ></file-upload-center>
  623. </el-form-item>
  624. </el-col>
  625. </el-row>
  626. </el-card>
  627. <el-card
  628. :body-style="{
  629. padding: '20px',
  630. display: 'flex',
  631. 'flex-wrap': 'wrap',
  632. position: 'relative',
  633. }"
  634. style="margin: 10px"
  635. >
  636. <el-tabs v-model="tabName" style="width: 100%" v-loading="tabLoading">
  637. <el-tab-pane
  638. v-for="(column, index) in tabColumns"
  639. :key="index"
  640. :label="column.title"
  641. :name="column.key"
  642. >
  643. <el-table
  644. :data="params[column.key]"
  645. style="width: 100%"
  646. :height="params[column.key].length ? 300 : 100"
  647. border
  648. >
  649. <el-table-column
  650. v-for="(cColumn, cIndex) in column.tableColumns"
  651. :key="cIndex"
  652. :label="cColumn.title"
  653. :width="cColumn.width || 80"
  654. >
  655. <template slot="header" slot-scope="scope">
  656. <span v-if="cColumn.require" style="color: #ff4949">*</span>
  657. <span>
  658. {{ cColumn.title }}
  659. </span>
  660. </template>
  661. <template slot-scope="scope">
  662. <el-form-item
  663. label-width="0"
  664. :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
  665. :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
  666. >
  667. <el-tag v-if="cColumn.key === 'index'" >
  668. {{ scope.$index + 1 }}
  669. </el-tag>
  670. <el-input
  671. v-if="cColumn.inputType === 'Input'"
  672. v-model="scope.row[cColumn.key]"
  673. :placeholder="cColumn.placeholder"
  674. :clearable="cColumn.clearable"
  675. :disabled="cColumn.disabled"
  676. size="mini"
  677. style="width: 100%"
  678. ></el-input>
  679. <!-- -->
  680. <dr-popover-select
  681. v-if="cColumn.inputType === 'PopoverSelect'"
  682. v-model="scope.row[cColumn.key]"
  683. :source.sync="scope.row"
  684. :title="cColumn.title"
  685. :value-key="cColumn.valueKey"
  686. :type="cColumn.referName"
  687. :disabled="cColumn.disabled"
  688. :multiple="cColumn.multiple"
  689. :placeholder="cColumn.placeholder"
  690. :data-mapping="cColumn.dataMapping"
  691. :query-params="cColumn.queryParams"
  692. @change="handleTabReferChange"
  693. size="mini"
  694. >
  695. </dr-popover-select>
  696. <el-input-number
  697. v-if="cColumn.inputType === 'InputNumber'"
  698. v-model="scope.row[cColumn.key]"
  699. :precision="cColumn.precision"
  700. :controls-position="cColumn.controlsPosition"
  701. :placeholder="cColumn.placeholder"
  702. @change="handleInputChange(scope.row, cColumn.key)"
  703. :clearable="cColumn.clearable"
  704. :disabled="cColumn.disabled"
  705. :min="cColumn.key === 'reservedQty' ? 0 : -Infinity"
  706. size="mini"
  707. style="width: 100%"
  708. ></el-input-number>
  709. <el-select
  710. v-if="cColumn.inputType === 'Select'"
  711. v-model="scope.row[cColumn.key]"
  712. filterable
  713. size="mini"
  714. :disabled="cColumn.disabled"
  715. :clearable="cColumn.clearable"
  716. :placeholder="cColumn.placeholder"
  717. style="width: 100%"
  718. @change="handleTabSelectChange(cColumn.key,scope.row)"
  719. >
  720. <el-option
  721. v-for="item in dict.type[cColumn.referName]"
  722. :key="item.value"
  723. :label="item.label"
  724. :value="item.value"
  725. ></el-option>
  726. </el-select>
  727. <el-checkbox
  728. v-if="cColumn.inputType === 'Checkbox'"
  729. v-model="scope.row[cColumn.key]"
  730. :disabled="cColumn.disabled"
  731. true-label="Y"
  732. false-label="N"
  733. @change="handleTabCheckbox(cColumn.key,scope.row)"
  734. ></el-checkbox>
  735. </el-form-item>
  736. </template>
  737. </el-table-column>
  738. <el-table-column fixed="right" label="操作" width="80">
  739. <template slot-scope="scope">
  740. <el-button
  741. @click.native.prevent="
  742. delTableRow(params[tabName], scope.$index)
  743. "
  744. type="text"
  745. size="small"
  746. >
  747. 删行
  748. </el-button>
  749. </template>
  750. </el-table-column>
  751. </el-table>
  752. </el-tab-pane>
  753. </el-tabs>
  754. <el-row style="position: absolute; top: 20px; right: 20px">
  755. <el-button size="mini" @click="addTableRow(params[tabName])"
  756. >增行</el-button
  757. >
  758. <BatchImport
  759. ref="batchImport"
  760. @import="handelImport"
  761. @temDownload="handleTemDownload"
  762. ></BatchImport>
  763. </el-row>
  764. </el-card>
  765. </el-form>
  766. </el-drawer>
  767. </template>