Commit 38be4bbe by 蒋勇

d

parent a4b89b0b
...@@ -23,6 +23,18 @@ export const btnAuthFilter=(metainfo,user)=>{ ...@@ -23,6 +23,18 @@ export const btnAuthFilter=(metainfo,user)=>{
// }) // })
// } // }
// metainfo.auths=authbtns // metainfo.auths=authbtns
let authbtns=[]
let keyswithauth=Object.keys(metainfo.auths).filter(authname=>{
return true
})
if(keyswithauth){
keyswithauth.forEach(k=>{
metainfo.auths[k].forEach(bt=>{
authbtns.push(bt)
})
})
}
metainfo.auths=authbtns
return metainfo return metainfo
} }
......
...@@ -9,9 +9,6 @@ export default { ...@@ -9,9 +9,6 @@ export default {
title: 'Handle', title: 'Handle',
key: 'handle', key: 'handle',
button: [//这个数组中内容,需要按照权限字符串,在服务端构造 button: [//这个数组中内容,需要按照权限字符串,在服务端构造
{title: "删除",type: "text",icon: "md-trash",key:"delete" },
{title: "编辑",type: "text",icon: "",key:"edit" },
{title: "启用",type: "text",icon: "",key:"enable"},
] ]
} }
], ],
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
searchable searchable
search-place="top" search-place="top"
v-model="tableData" v-model="tableData"
:columns="columns" :columns="colswithauth"
@on-rapid-query="doquery" @on-rapid-query="doquery"
@on-exec="doexec" @on-exec="doexec"
/> />
...@@ -34,11 +34,7 @@ export default { ...@@ -34,11 +34,7 @@ export default {
data() { data() {
this.metaName = "user_info"; this.metaName = "user_info";
return { return {
forminfo: this.metaName ? this.$store.getters[this.metaName]["form"] : {}, metainfo:this.$store.getters[this.metaName],
columns: this.metaName ? this.$store.getters[this.metaName]["list"] : [],
authbtns: this.metaName
? this.$store.getters[this.metaName]["auths"]
: [],
tableData: [] tableData: []
}; };
}, },
...@@ -61,20 +57,29 @@ export default { ...@@ -61,20 +57,29 @@ export default {
}); });
}, },
computed: { computed: {
forminfo(){
return this.metainfo["form"]
},
formbtns() { formbtns() {
return this.authbtns.filter(bt => { return this.metainfo["auths"].filter(bt => {
return bt.isOnForm; return bt.isOnForm;
}); });
}, },
onlistbtns() { onlistbtns() {
return this.authbtns.filter(bt => { return this.metainfo["auths"].filter(bt => {
return bt.isOnGrid; return bt.isOnGrid;
}); });
}, },
inrowbtns() { colswithauth(){
return this.authbtns.filter(bt => { let listbtns=this.metainfo["auths"].filter(bt => {
return bt.isInRow; return bt.isInRow;
}); });
this.metainfo["list"].forEach(c=>{
if(c.key=="handle"){
c.button.push(...listbtns)
}
})
return this.metainfo["list"]
} }
} }
}; };
......
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