|
@@ -883,23 +883,39 @@ export default {
|
|
|
this.$modal.loading("正在粘贴数据...");
|
|
|
e.preventDefault() //阻止默认粘贴事件
|
|
|
let source = e.clipboardData.getData("Text");
|
|
|
- // 首先对源头进行解析
|
|
|
- let rows = source.split("\r\n"); // 拆成一个数组
|
|
|
- // 数组去除空字符串
|
|
|
- rows = rows.filter(item => {
|
|
|
- return item && item.trim()
|
|
|
- })
|
|
|
- await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
|
|
|
- this.$modal.closeLoading();
|
|
|
- if (res.code === 200) {
|
|
|
- let rowList = res.rows
|
|
|
- console.log('粘贴的', rowList)
|
|
|
- this.queryParams.materialCodeList = rowList.map(item => {return item.code})
|
|
|
- this.queryParams.names = (rowList.map(item => {return item.code})).join(',')
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
+ console.log('source', source)
|
|
|
+ // 这里区分普通复制和在表格内复制,判断是否包含','
|
|
|
+ // 没找到,就通过表格复制
|
|
|
+ if (source.indexOf(",") === -1) {
|
|
|
+ // 首先对源头进行解析
|
|
|
+ let rows = source.split("\r\n"); // 拆成一个数组
|
|
|
+ // 数组去除空字符串
|
|
|
+ rows = rows.filter(item => {
|
|
|
+ return item && item.trim()
|
|
|
+ })
|
|
|
+ await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ if (res.code === 200) {
|
|
|
+ let rowList = res.rows
|
|
|
+ console.log('粘贴的', rowList)
|
|
|
+ this.queryParams.materialCodeList = rowList.map(item => {return item.code})
|
|
|
+ this.queryParams.names = (rowList.map(item => {return item.code})).join(',')
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 找到了,按,分割
|
|
|
+ let codelist = source.split(',')
|
|
|
+ console.log('按照逗号分隔', codelist)
|
|
|
+ // 数组去除空字符串
|
|
|
+ codelist = codelist.filter(item => {
|
|
|
+ return item && item.trim()
|
|
|
+ })
|
|
|
+ this.queryParams.materialCodeList = codelist
|
|
|
+ this.queryParams.names = codelist.join(',')
|
|
|
this.$modal.closeLoading();
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
// 明细行选择业务部门参照带出业务部门数据
|
|
|
chooseSon(index, type, isPage, title) {
|