index.vue 26 KB

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