index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. <script>
  2. import useColumns from "./columns";
  3. import {EXIST} from "@/api/business/purchase/catalogue";
  4. import {ITEM, SAVE} from "@/api/business/purchase/apply";
  5. import {tax, unit, currency} from "@/components/popover-select-v2/fetch";
  6. // 用于回显参照框数据
  7. import {getRefer} from '@/api/purchase/basic.js'
  8. const fetchExist = async (prop) => {
  9. try {
  10. // try
  11. const {code, data} = await EXIST(prop);
  12. if (code === 200) return data;
  13. } catch (err) {
  14. // catch
  15. console.error(err);
  16. } finally {
  17. // finally
  18. }
  19. };
  20. export default {
  21. name: "EditDrawer",
  22. props: {
  23. dict: {
  24. type: Object,
  25. },
  26. selectData: {
  27. type: [Array],
  28. require: true,
  29. },
  30. },
  31. components: {
  32. ElSuperForm: () => import("@/components/super-form/index.vue"),
  33. ElSuperTable: () => import("@/components/super-table/index.vue"),
  34. ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
  35. ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
  36. },
  37. data() {
  38. const {
  39. TabColumns,
  40. TableColumns,
  41. TabColumns: [
  42. {
  43. item: {key: tabName},
  44. },
  45. ],
  46. } = useColumns();
  47. const rules = this.$init.rules([...TabColumns, ...TableColumns]);
  48. const params = this.$init.params([...TabColumns, ...TableColumns]);
  49. return {
  50. title: "编 辑",
  51. width: "100%",
  52. visible: false,
  53. loading: false,
  54. rules: rules,
  55. params: params,
  56. tabName: tabName,
  57. TabColumns: TabColumns,
  58. TableColumns: TableColumns,
  59. delDemandItemList: [],
  60. };
  61. },
  62. computed: {
  63. disabled: {
  64. get() {
  65. const {
  66. selectData,
  67. selectData: [{status} = {}],
  68. } = this.$props;
  69. if (selectData.length !== 1) {
  70. return true;
  71. }
  72. if (selectData.length === 1 && status === "1") {
  73. return true;
  74. }
  75. if (selectData.length === 1 && status === "2") {
  76. return true;
  77. }
  78. },
  79. set() {
  80. },
  81. },
  82. priceApply: {
  83. get() {
  84. this.params.priceApplyItems = this.params.priceApplyItems.map(
  85. (item, index) => ({
  86. ...item,
  87. $index: index,
  88. })
  89. );
  90. return {
  91. priceApplyItems: this.params.priceApplyItems.filter(
  92. ({delFlag}) => delFlag !== "2"
  93. ),
  94. };
  95. },
  96. set() {
  97. },
  98. },
  99. },
  100. watch: {},
  101. methods: {
  102. //
  103. async changeMaterialName(prop) {
  104. console.log('prop', prop);
  105. const {selectData} = prop;
  106. const {
  107. puOrg,
  108. customer,
  109. customerName,
  110. supplier,
  111. currency,
  112. currencyCode,
  113. currencyName,
  114. } = this.params;
  115. console.log('selectData', selectData)
  116. const {nickName: createByName} = this.$store.state.user;
  117. if (selectData.length) {
  118. this.params[this.tabName].splice(-1);
  119. }
  120. for (const item of selectData) {
  121. console.log('item', item)
  122. this.loading = true;
  123. const {tax: taxName, unitName, code: materialCode} = item;
  124. // task 1
  125. const {ntaxrate} = await tax(taxName);
  126. // task 2
  127. const {
  128. id: puUnit,
  129. code: puUnitCode,
  130. name: puUnitName,
  131. } = await unit(unitName);
  132. // task 3
  133. const {
  134. recentlyPrice = "0",
  135. isApprovalFirst = "N",
  136. purchasequantity,
  137. recentlyPriceDate
  138. } = await fetchExist({puOrg, customer, supplier, materialCode, customerName: "",priceType: prop.row.priceType});
  139. this.loading = false;
  140. await this.onRowAdd(this.tabName, {
  141. ...item,
  142. currency: currency,
  143. currencyCode: currencyCode,
  144. currencyName: currencyName,
  145. unit: puUnit,
  146. unitCode: puUnitCode,
  147. unitName: puUnitName,
  148. puUnit: puUnit,
  149. puUnitCode: puUnitCode,
  150. puUnitName: puUnitName,
  151. recentlyPrice,
  152. isApprovalFirst,
  153. recentlyPriceDate: recentlyPriceDate,
  154. yPurchaseQuantity: purchasequantity,
  155. tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
  156. createByName: createByName,
  157. updateByName: createByName,
  158. id: null,
  159. });
  160. }
  161. },
  162. //
  163. async changeCustomerName(prop) {
  164. console.log("prop", prop)
  165. const {
  166. puOrg,
  167. supplier,
  168. currency,
  169. currencyCode,
  170. currencyName,
  171. } = this.params;
  172. const {
  173. recentlyPrice,
  174. isApprovalFirst,
  175. purchasequantity,
  176. recentlyPriceDate
  177. } = await fetchExist({
  178. puOrg,
  179. supplier,
  180. materialCode: prop.row.materialCode,
  181. customer: prop.row.customerName ? prop.row.customer : '',
  182. customerName: prop.row.customerName,
  183. priceType: prop.row.priceType
  184. });
  185. prop.row.yPurchaseQuantity = purchasequantity
  186. prop.row.recentlyPrice = recentlyPrice
  187. prop.row.isApprovalFirst = isApprovalFirst
  188. prop.row.recentlyPriceDate = recentlyPriceDate
  189. },
  190. //
  191. async fetchItem(prop) {
  192. try {
  193. // try
  194. this.loading = true;
  195. const {tabName, TabColumns} = this;
  196. const {TableColumns} = TabColumns.find(
  197. ({item: {key}}) => key === tabName
  198. );
  199. const {code, data} = await ITEM(prop, false);
  200. if (code === 200) {
  201. this.params = data;
  202. this.params.priceApplyItems = data.priceApplyItems.map((item) => ({
  203. ...this.$init.params(TableColumns),
  204. ...item,
  205. }));
  206. return true;
  207. } else {
  208. return false;
  209. }
  210. } catch (err) {
  211. // catch
  212. console.error(err);
  213. } finally {
  214. // finally
  215. this.loading = false;
  216. }
  217. },
  218. //
  219. async onOpen() {
  220. const {
  221. selectData: [{id}],
  222. } = this.$props;
  223. this.visible = await this.fetchItem(id);
  224. },
  225. //
  226. async onHide() {
  227. const {TabColumns, TableColumns} = useColumns();
  228. this.visible = false;
  229. this.params = this.$init.params([...TabColumns, ...TableColumns]);
  230. this.$emit("success");
  231. },
  232. //
  233. async onRowAdd(prop, pushParams = {}) {
  234. this.$refs.superForm.validate(async (valid) => {
  235. if (valid) {
  236. const {TabColumns} = this;
  237. const {TableColumns} = TabColumns.find(
  238. ({item: {key}}) => key === prop
  239. );
  240. this.params[prop].push({
  241. delFlag: "0",
  242. ...this.$init.params(TableColumns),
  243. ...pushParams,
  244. });
  245. }
  246. });
  247. },
  248. //
  249. async onRowRemove(prop, scope) {
  250. console.log('prop', prop)
  251. console.log('scope', scope)
  252. // const {
  253. // row: {$index},
  254. // } = scope;
  255. // this.params[prop] = this.params[prop].map((item, index) => ({
  256. // ...item,
  257. // delFlag: index === $index ? "2" : item.delFlag,
  258. // }));
  259. scope.row.delFlag = '2'
  260. let delList = []
  261. delList = this.params[prop].filter(item => {
  262. return item.delFlag == '2'
  263. })
  264. this.params[prop] = this.params[prop].filter(item => {
  265. return item.delFlag == '0'
  266. })
  267. this.delDemandItemList.push(...delList)
  268. console.log('删除的数组',this.delDemandItemList)
  269. console.log('this.params[prop]', this.params[prop])
  270. },
  271. //
  272. async useSubmit(prop) {
  273. this.$refs[prop].validate(async (valid) => {
  274. console.log(this.params);
  275. if (valid) {
  276. try {
  277. this.loading = true;
  278. let list = []
  279. list.push(...this.params.priceApplyItems, ...this.delDemandItemList)
  280. this.params.priceApplyItems = this.params.priceApplyItems.filter(
  281. (item) => item.materialName
  282. );
  283. // 深拷贝一下参数对象
  284. let param = JSON.parse(JSON.stringify(this.params))
  285. console.log('深拷贝对象',param);
  286. param.priceApplyItems = list
  287. const {msg, code} = await SAVE(param);
  288. if (code === 200) {
  289. this.onHide();
  290. this.$emit("success");
  291. this.$notify.success(msg);
  292. this.delDemandItemList = []
  293. }
  294. } catch (err) {
  295. // catch
  296. console.error(err);
  297. } finally {
  298. // finally
  299. this.loading = false;
  300. }
  301. } else {
  302. return false;
  303. }
  304. });
  305. },
  306. // 粘贴
  307. async pasteMe(e, scope, index, prop) {
  308. this.$modal.loading("正在处理数据...");
  309. e.preventDefault() //阻止默认粘贴事件
  310. let source = e.clipboardData.getData("Text");
  311. console.log('scope', scope.column.property)
  312. console.log('index', index)
  313. // 首先对源头进行解析
  314. let rows = source.split("\r\n"); // 拆成一个数组
  315. // 数组去除空字符串
  316. rows = rows.filter(item => {
  317. return item && item.trim()
  318. })
  319. if (rows.length < 100) {
  320. if(scope.column.property == 'materialCode') {
  321. let rowList = []
  322. let newLine = []
  323. await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
  324. if (res.code === 200) {
  325. rowList = res.rows
  326. }
  327. })
  328. const {
  329. puOrg,
  330. customer,
  331. customerName,
  332. supplier,
  333. currency,
  334. currencyCode,
  335. currencyName,
  336. } = this.params;
  337. const {TabColumns} = this;
  338. const {TableColumns} = TabColumns.find(
  339. ({item: {key}}) => key === prop
  340. );
  341. // console.log('kk', TableColumns)
  342. // console.log('this.$init.params(TableColumns)', this.$init.params(TableColumns))
  343. for (let i = 0; i<rowList.length; i++) {
  344. let line = {...this.$init.params(TableColumns)}
  345. console.log('line',line)
  346. const {nickName: createByName} = this.$store.state.user;
  347. const {ntaxrate} = await tax(rowList[i].materialRateName);
  348. // task 2
  349. const {
  350. id: puUnit,
  351. code: puUnitCode,
  352. name: puUnitName,
  353. } = await unit(rowList[i].unitIdName);
  354. // task 3
  355. const {
  356. recentlyPrice = "0",
  357. isApprovalFirst = "N",
  358. purchasequantity,
  359. recentlyPriceDate
  360. } = await fetchExist({puOrg, customer, supplier, materialCode: rowList[i].code, customerName: "", priceType: line.priceType});
  361. line.delFlag = '0'
  362. line.materialCode = rowList[i].code
  363. line.material = rowList[i].id
  364. line.materialName = rowList[i].name
  365. line.specification = rowList[i].specification
  366. line.model = rowList[i].model
  367. line.manufacturerName = rowList[i].manufacturerIdName
  368. line.unit = puUnit,
  369. line.unitCode = puUnitCode,
  370. line.unitName = puUnitName,
  371. line.puUnit = puUnit,
  372. line.puUnitCode = puUnitCode,
  373. line.puUnitName = puUnitName,
  374. line.recentlyPrice = recentlyPrice
  375. line.isApprovalFirst = isApprovalFirst
  376. line.recentlyPriceDate = recentlyPriceDate,
  377. line.yPurchaseQuantity = purchasequantity,
  378. line.tax = Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
  379. line.createByName = createByName,
  380. line.updateByName = createByName,
  381. line.currency = currency
  382. line.currencyCode = currencyCode
  383. line.currencyName = currencyName
  384. newLine.push(line)
  385. console.log('临时数组', newLine)
  386. }
  387. // 删除指定下标
  388. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  389. this.$modal.closeLoading();
  390. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  391. } else if(scope.column.property == 'taxPrice') {
  392. console.log('复制内容:', rows)
  393. let newLine = []
  394. const {TabColumns} = this;
  395. const {TableColumns} = TabColumns.find(
  396. ({item: {key}}) => key === prop
  397. );
  398. if(this.params[prop].length <= 1) {
  399. for (let i = 0; i<rows.length; i++) {
  400. let line = {...this.$init.params(TableColumns)}
  401. line.taxPrice = rows[i]
  402. newLine.push(line)
  403. }
  404. // 删除指定下标
  405. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  406. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  407. // this.$refs.table.doLayout()
  408. this.$modal.closeLoading();
  409. } else {
  410. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  411. this.params[prop][i].taxPrice = rows[j]
  412. }
  413. // this.$refs.table.doLayout()
  414. console.log(this.params[prop])
  415. this.$modal.closeLoading();
  416. }
  417. } else if(scope.column.property == 'supplierName') {
  418. console.log('复制内容:', rows)
  419. let newLine = []
  420. const {TabColumns} = this;
  421. const {TableColumns} = TabColumns.find(
  422. ({item: {key}}) => key === prop
  423. );
  424. if(this.params[prop].length <= 1) {
  425. for (let i = 0; i<rows.length; i++) {
  426. let line = {...this.$init.params(TableColumns)}
  427. line.supplierName = rows[i]
  428. newLine.push(line)
  429. }
  430. // 删除指定下标
  431. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  432. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  433. // this.$refs.table.doLayout()
  434. this.$modal.closeLoading();
  435. } else {
  436. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  437. this.params[prop][i].supplierName = rows[j]
  438. }
  439. // this.$refs.table.doLayout()
  440. console.log(this.params[prop])
  441. this.$modal.closeLoading();
  442. }
  443. } else if(scope.column.property == 'bidPrice') {
  444. console.log('复制内容:', rows)
  445. let newLine = []
  446. const {TabColumns} = this;
  447. const {TableColumns} = TabColumns.find(
  448. ({item: {key}}) => key === prop
  449. );
  450. if(this.params[prop].length <= 1) {
  451. for (let i = 0; i<rows.length; i++) {
  452. let line = {...this.$init.params(TableColumns)}
  453. line.bidPrice = rows[i]
  454. newLine.push(line)
  455. }
  456. // 删除指定下标
  457. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  458. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  459. // this.$refs.table.doLayout()
  460. this.$modal.closeLoading();
  461. } else {
  462. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  463. this.params[prop][i].bidPrice = rows[j]
  464. }
  465. // this.$refs.table.doLayout()
  466. console.log(this.params[prop])
  467. this.$modal.closeLoading();
  468. }
  469. } else if(scope.column.property == 'unitPrice') {
  470. console.log('复制内容:', rows)
  471. let newLine = []
  472. const {TabColumns} = this;
  473. const {TableColumns} = TabColumns.find(
  474. ({item: {key}}) => key === prop
  475. );
  476. if(this.params[prop].length <= 1) {
  477. for (let i = 0; i<rows.length; i++) {
  478. let line = {...this.$init.params(TableColumns)}
  479. line.unitPrice = rows[i]
  480. newLine.push(line)
  481. }
  482. // 删除指定下标
  483. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  484. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  485. // this.$refs.table.doLayout()
  486. this.$modal.closeLoading();
  487. } else {
  488. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  489. this.params[prop][i].unitPrice = rows[j]
  490. }
  491. // this.$refs.table.doLayout()
  492. console.log(this.params[prop])
  493. this.$modal.closeLoading();
  494. }
  495. } else if(scope.column.property == 'supplierName1') {
  496. console.log('复制内容:', rows)
  497. let newLine = []
  498. const {TabColumns} = this;
  499. const {TableColumns} = TabColumns.find(
  500. ({item: {key}}) => key === prop
  501. );
  502. if(this.params[prop].length <= 1) {
  503. for (let i = 0; i<rows.length; i++) {
  504. let line = {...this.$init.params(TableColumns)}
  505. line.supplierName1 = rows[i]
  506. newLine.push(line)
  507. }
  508. // 删除指定下标
  509. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  510. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  511. // this.$refs.table.doLayout()
  512. this.$modal.closeLoading();
  513. } else {
  514. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  515. this.params[prop][i].supplierName1 = rows[j]
  516. }
  517. // this.$refs.table.doLayout()
  518. console.log(this.params[prop])
  519. this.$modal.closeLoading();
  520. }
  521. } else if(scope.column.property == 'bidPrice1') {
  522. console.log('复制内容:', rows)
  523. let newLine = []
  524. const {TabColumns} = this;
  525. const {TableColumns} = TabColumns.find(
  526. ({item: {key}}) => key === prop
  527. );
  528. if(this.params[prop].length <= 1) {
  529. for (let i = 0; i<rows.length; i++) {
  530. let line = {...this.$init.params(TableColumns)}
  531. line.bidPrice1 = rows[i]
  532. newLine.push(line)
  533. }
  534. // 删除指定下标
  535. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  536. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  537. // this.$refs.table.doLayout()
  538. this.$modal.closeLoading();
  539. } else {
  540. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  541. this.params[prop][i].bidPrice1 = rows[j]
  542. }
  543. // this.$refs.table.doLayout()
  544. console.log(this.params[prop])
  545. this.$modal.closeLoading();
  546. }
  547. } else if(scope.column.property == 'unitPrice1') {
  548. console.log('复制内容:', rows)
  549. let newLine = []
  550. const {TabColumns} = this;
  551. const {TableColumns} = TabColumns.find(
  552. ({item: {key}}) => key === prop
  553. );
  554. if(this.params[prop].length <= 1) {
  555. for (let i = 0; i<rows.length; i++) {
  556. let line = {...this.$init.params(TableColumns)}
  557. line.unitPrice1 = rows[i]
  558. newLine.push(line)
  559. }
  560. // 删除指定下标
  561. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  562. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  563. // this.$refs.table.doLayout()
  564. this.$modal.closeLoading();
  565. } else {
  566. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  567. this.params[prop][i].unitPrice1 = rows[j]
  568. }
  569. // this.$refs.table.doLayout()
  570. console.log(this.params[prop])
  571. this.$modal.closeLoading();
  572. }
  573. } else if(scope.column.property == 'supplierName2') {
  574. console.log('复制内容:', rows)
  575. let newLine = []
  576. const {TabColumns} = this;
  577. const {TableColumns} = TabColumns.find(
  578. ({item: {key}}) => key === prop
  579. );
  580. if(this.params[prop].length <= 1) {
  581. for (let i = 0; i<rows.length; i++) {
  582. let line = {...this.$init.params(TableColumns)}
  583. line.supplierName2 = rows[i]
  584. newLine.push(line)
  585. }
  586. // 删除指定下标
  587. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  588. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  589. // this.$refs.table.doLayout()
  590. this.$modal.closeLoading();
  591. } else {
  592. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  593. this.params[prop][i].supplierName2 = rows[j]
  594. }
  595. // this.$refs.table.doLayout()
  596. console.log(this.params[prop])
  597. this.$modal.closeLoading();
  598. }
  599. } else if(scope.column.property == 'bidPrice2') {
  600. console.log('复制内容:', rows)
  601. let newLine = []
  602. const {TabColumns} = this;
  603. const {TableColumns} = TabColumns.find(
  604. ({item: {key}}) => key === prop
  605. );
  606. if(this.params[prop].length <= 1) {
  607. for (let i = 0; i<rows.length; i++) {
  608. let line = {...this.$init.params(TableColumns)}
  609. line.bidPrice2 = rows[i]
  610. newLine.push(line)
  611. }
  612. // 删除指定下标
  613. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  614. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  615. // this.$refs.table.doLayout()
  616. this.$modal.closeLoading();
  617. } else {
  618. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  619. this.params[prop][i].bidPrice2 = rows[j]
  620. }
  621. // this.$refs.table.doLayout()
  622. console.log(this.params[prop])
  623. this.$modal.closeLoading();
  624. }
  625. } else if(scope.column.property == 'unitPrice2') {
  626. console.log('复制内容:', rows)
  627. let newLine = []
  628. const {TabColumns} = this;
  629. const {TableColumns} = TabColumns.find(
  630. ({item: {key}}) => key === prop
  631. );
  632. if(this.params[prop].length <= 1) {
  633. for (let i = 0; i<rows.length; i++) {
  634. let line = {...this.$init.params(TableColumns)}
  635. line.unitPrice2 = rows[i]
  636. newLine.push(line)
  637. }
  638. // 删除指定下标
  639. this.params[prop].splice(index,this.params[prop].length - index,...newLine)
  640. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  641. // this.$refs.table.doLayout()
  642. this.$modal.closeLoading();
  643. } else {
  644. for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
  645. this.params[prop][i].unitPrice2 = rows[j]
  646. }
  647. // this.$refs.table.doLayout()
  648. console.log(this.params[prop])
  649. this.$modal.closeLoading();
  650. }
  651. }
  652. } else {
  653. this.$modal.notifyWarning("复制长度不能超过100!");
  654. this.$modal.closeLoading();
  655. }
  656. },
  657. },
  658. created() {
  659. },
  660. mounted() {
  661. },
  662. destroyed() {
  663. },
  664. };
  665. </script>
  666. <template>
  667. <el-button
  668. v-bind="$attrs"
  669. v-on="$listeners"
  670. :disabled="disabled"
  671. @click="onOpen"
  672. >
  673. {{ title }}
  674. <el-drawer
  675. :show-close="false"
  676. :size="width"
  677. :title="title"
  678. :visible.sync="visible"
  679. append-to-body
  680. destroy-on-close
  681. @close="onHide"
  682. >
  683. <template slot="title">
  684. <span>{{ title }}</span>
  685. <el-button
  686. type="primary"
  687. :size="$attrs.size"
  688. :loading="loading"
  689. @click="useSubmit('superForm')"
  690. >
  691. 确 认
  692. </el-button>
  693. <el-button :size="$attrs.size" :loading="loading" @click="onHide">
  694. 取 消
  695. </el-button>
  696. </template>
  697. <el-super-form
  698. v-model="params"
  699. :dict="dict"
  700. :rules="rules"
  701. :size="$attrs.size"
  702. :columns="TableColumns"
  703. ref="superForm"
  704. label-width="auto"
  705. label-position="right"
  706. style="padding: 18px"
  707. >
  708. </el-super-form>
  709. <el-tabs v-model="tabName" style="padding: 0 18px 18px">
  710. <el-tab-pane
  711. v-for="({ item, TableColumns: columns }, index) in TabColumns"
  712. :key="index"
  713. :label="item.title"
  714. :name="item.key"
  715. lazy
  716. >
  717. <div v-loading="loading" style="height: 250px; display: flex">
  718. <el-super-ux-table
  719. v-model="priceApply[item.key]"
  720. :dict="dict"
  721. :ref="tabName"
  722. height="250"
  723. :columns="columns"
  724. :size="$attrs.size"
  725. >
  726. <template slot="materialName" slot-scope="scope">
  727. <component
  728. v-bind="scope.attr"
  729. v-model="scope.row[scope.item.key]"
  730. :size="$attrs.size"
  731. :source.sync="scope.row"
  732. @change="changeMaterialName({ ...scope, selectData: $event })"
  733. >
  734. </component>
  735. </template>
  736. <template slot="materialCode" slot-scope="scope">
  737. <component
  738. v-bind="scope.attr"
  739. v-model="scope.row[scope.item.key]"
  740. :size="$attrs.size"
  741. :source.sync="scope.row"
  742. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  743. >
  744. </component>
  745. </template>
  746. <template slot="taxPrice" slot-scope="scope">
  747. <component
  748. v-bind="scope.attr"
  749. v-model="scope.row[scope.item.key]"
  750. :size="$attrs.size"
  751. :source.sync="scope.row"
  752. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  753. >
  754. </component>
  755. </template>
  756. <template slot="supplierName" slot-scope="scope">
  757. <component
  758. v-bind="scope.attr"
  759. v-model="scope.row[scope.item.key]"
  760. :size="$attrs.size"
  761. :source.sync="scope.row"
  762. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  763. >
  764. </component>
  765. </template>
  766. <template slot="bidPrice" slot-scope="scope">
  767. <component
  768. v-bind="scope.attr"
  769. v-model="scope.row[scope.item.key]"
  770. :size="$attrs.size"
  771. :source.sync="scope.row"
  772. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  773. >
  774. </component>
  775. </template>
  776. <template slot="unitPrice" slot-scope="scope">
  777. <component
  778. v-bind="scope.attr"
  779. v-model="scope.row[scope.item.key]"
  780. :size="$attrs.size"
  781. :source.sync="scope.row"
  782. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  783. >
  784. </component>
  785. </template>
  786. <template slot="supplierName1" slot-scope="scope">
  787. <component
  788. v-bind="scope.attr"
  789. v-model="scope.row[scope.item.key]"
  790. :size="$attrs.size"
  791. :source.sync="scope.row"
  792. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  793. >
  794. </component>
  795. </template>
  796. <template slot="bidPrice1" slot-scope="scope">
  797. <component
  798. v-bind="scope.attr"
  799. v-model="scope.row[scope.item.key]"
  800. :size="$attrs.size"
  801. :source.sync="scope.row"
  802. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  803. >
  804. </component>
  805. </template>
  806. <template slot="unitPrice1" slot-scope="scope">
  807. <component
  808. v-bind="scope.attr"
  809. v-model="scope.row[scope.item.key]"
  810. :size="$attrs.size"
  811. :source.sync="scope.row"
  812. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  813. >
  814. </component>
  815. </template>
  816. <template slot="supplierName2" slot-scope="scope">
  817. <component
  818. v-bind="scope.attr"
  819. v-model="scope.row[scope.item.key]"
  820. :size="$attrs.size"
  821. :source.sync="scope.row"
  822. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  823. >
  824. </component>
  825. </template>
  826. <template slot="bidPrice2" slot-scope="scope">
  827. <component
  828. v-bind="scope.attr"
  829. v-model="scope.row[scope.item.key]"
  830. :size="$attrs.size"
  831. :source.sync="scope.row"
  832. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  833. >
  834. </component>
  835. </template>
  836. <template slot="unitPrice2" slot-scope="scope">
  837. <component
  838. v-bind="scope.attr"
  839. v-model="scope.row[scope.item.key]"
  840. :size="$attrs.size"
  841. :source.sync="scope.row"
  842. @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
  843. >
  844. </component>
  845. </template>
  846. <template slot="customerName" slot-scope="scope">
  847. <component
  848. v-bind="scope.attr"
  849. v-model="scope.row[scope.item.key]"
  850. :size="$attrs.size"
  851. :source.sync="scope.row"
  852. @input="changeCustomerName({ ...scope, selectData: $event })"
  853. >
  854. </component>
  855. </template>
  856. <ux-table-column fixed="right" title="操作" width="100">
  857. <template slot="header" slot-scope="scope">
  858. <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
  859. 新增
  860. </el-button>
  861. </template>
  862. <template slot-scope="scope">
  863. <el-button
  864. :size="$attrs.size"
  865. @click.native.prevent="onRowRemove(tabName, scope)"
  866. >
  867. 删除
  868. </el-button>
  869. </template>
  870. </ux-table-column>
  871. </el-super-ux-table>
  872. </div>
  873. </el-tab-pane>
  874. </el-tabs>
  875. </el-drawer>
  876. </el-button>
  877. </template>
  878. <style scoped>
  879. ::v-deep .el-table__row.is-hidden {
  880. display: none;
  881. }
  882. </style>