Browse Source

选择商品回显,

master
朱耘稷 4 years ago
parent
commit
0e81cdea44
  1. 49
      src/views/components/goods/index.vue

49
src/views/components/goods/index.vue

@ -34,7 +34,7 @@
<!--表单组件-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;" @selection-change="handleSelectionChange" ref="multipleTable">
<el-table-column
type="selection"
width="55">
@ -96,8 +96,40 @@ export default {
}
}
},
watch: {
page: function (val) {
var map = this.selectGoods;
map.set(this.lastPage, this.multipleSelection);
this.selectGoods = map;
if (map.get(val)) {
this.multipleSelection = map.get(val);
}
this.lastPage = val;
},
data: function (val) {
const _this=this;
_this.$nextTick(()=> {
//map
var map = this.selectGoods;
//
var thePageData = map.get(this.page);
if (thePageData) {
thePageData.forEach(thePageData=>{
val.forEach(tableData=>{
if(tableData.id==thePageData.id){
this.$refs.multipleTable.toggleRowSelection(tableData,true);
}
})
})
}
})
}
},
data() {
return {
lastPage: 0,
selectGoods: new Map(),
newValue: this.value,
delLoading: false,
visible: false,
@ -126,11 +158,20 @@ export default {
})
},
doSelect() {
this.newValue = this.multipleSelection
this.newValue =[];
var dataList=this.selectGoods;
dataList.forEach(i=>{
i.forEach(j=>{
this.newValue.push(j)
})
})
this.$emit("selectGoods", this.newValue)
this.dialog = false
},
handleSelectionChange(val) {
var map = this.selectGoods;
map.set(this.lastPage, val);
this.selectGoods = map;
this.multipleSelection = val;
},
toSelete() {
@ -144,7 +185,9 @@ export default {
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
if (type && value) {
this.params[type] = value
}
return true
}
}

Loading…
Cancel
Save