添加过滤

lijinlong
李劲龙 5 months ago
parent 1633d1519e
commit 21193b3b25

@ -8,6 +8,7 @@ const getters = {
token: state => state.user.token, token: state => state.user.token,
avatar: state => state.user.avatar, avatar: state => state.user.avatar,
name: state => state.user.name, name: state => state.user.name,
useer: state => state.user.useer,
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,

@ -8,7 +8,8 @@ const user = {
name: '', name: '',
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [] permissions: [],
useer: ""
}, },
mutations: { mutations: {
@ -21,6 +22,9 @@ const user = {
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name
}, },
SET_NAMEUSE: (state, name) => {
state.useer = name
},
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
}, },
@ -64,6 +68,7 @@ const user = {
} }
commit('SET_ID', user.userId) commit('SET_ID', user.userId)
commit('SET_NAME', user.userName) commit('SET_NAME', user.userName)
commit('SET_NAMEUSE', user)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {

@ -189,12 +189,8 @@ export default {
}, },
mounted() { mounted() {
console.log(this.$store.state.user); console.log(this.$store.state.user);
if(this.$store.state.user.roles[0] == "admin"){ console.log(this.$store.state.user.roles[0]);
// this.pagination: {
// current: 1,
// size: 10,
// },
}
this.getInfo(); this.getInfo();
this.cancalDebounce(); this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce); window.addEventListener('resize', this.cancalDebounce);
@ -246,6 +242,9 @@ export default {
// //
getInfo() { getInfo() {
this.loading = true; this.loading = true;
if(this.$store.state.user.roles.includes("unit")){
this.pagination.dwmc=this.$store.state.user.useer.nickName
}
getassetTask(this.pagination).then(res => { getassetTask(this.pagination).then(res => {
this.loading = false; this.loading = false;
this.total = res.data.total; this.total = res.data.total;

Loading…
Cancel
Save