Commit 5df40d6e authored by 李苏's avatar 李苏 💬

假数据展示,选择时填充真数据

parent a4ca973e
...@@ -32,10 +32,39 @@ ...@@ -32,10 +32,39 @@
async mounted() { async mounted() {
/* 初始化数据 */ /* 初始化数据 */
that = this that = this
console.log(that, 'that') /* 创建假数据*/
let filterList=[]
let showDatas=[]
let orDatas=_.cloneDeep(this.app.$datas)
orDatas.forEach(item=>{
/* 判断条件*/
let iscf=false
filterList.forEach(fitem=>{
if(item.ckid==fitem.ckid&&item.wlid==fitem.wlid){
iscf=true
}else{
iscf=false
}
})
if(iscf){
showDatas.forEach(sitem=>{
if(item.ckid==sitem.ckid&&item.wlid==sitem.wlid){
sitem.jhsl=sitem.jhsl+item.jhsl
}
})
}else{
filterList.push({
ckid:item.ckid,
wlid:item.wlid
})
showDatas.push(item)
}
})
this.editTableConfig.editTableData=showDatas
}, },
data() { data() {
return { return {
datas:_.cloneDeep(this.app.$datas),
editTableConfig: { editTableConfig: {
editTableTitle: [{ editTableTitle: [{
label: '仓库', label: '仓库',
...@@ -71,18 +100,18 @@ ...@@ -71,18 +100,18 @@
label: 'username' label: 'username'
}, },
give() { give() {
/* v2在批量渲染复杂组件,虽然通过forEach来对数组进行了特殊处理,延迟后进行渲染,明显是响应式 /*
但是由于diff进行一些奇怪的性能增强,导致这些dom刷新排到了下个队列 v2中对象属性没定义直接去动态添加(不是修改)会监听不到,在下一个周期刷新
所以为了符合预期直接改变list的地址让vue2认为这是重新的渲染而不用错误的优化导致展示延迟 要么初始化赋值,要么直接更新对象来解决这个问题
*/ */
let list =_.cloneDeep(that.editTableConfig.editTableData) let list =that.datas
list.forEach(item => { list.forEach(item => {
if (item.wlid == this.form.wlid && item.ckid == this.form.ckid) { if (item.wlid == this.form.wlid && item.ckid == this.form.ckid) {
item.fzrName = this.form.fzrName item.fzrName = this.form.fzrName
item.fzrid = this.form.fzrid item.fzrid = this.form.fzrid
} }
}) })
that.editTableConfig.editTableData=list // that.editTableConfig.editTableData=list
} }
...@@ -90,7 +119,7 @@ ...@@ -90,7 +119,7 @@
}, },
], ],
editTableData:_.cloneDeep(this.app.$datas) editTableData:[]
}, },
...@@ -99,7 +128,7 @@ ...@@ -99,7 +128,7 @@
methods: { methods: {
save() { save() {
this.app.showDialog = false this.app.showDialog = false
this.$emit('save', that.editTableConfig.editTableData) this.$emit('save', this.datas)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment