index.vue 26 KB

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