Commit 6cc526c9 by 李长胜

角色修改

1 parent 72c66bbb
......@@ -36,7 +36,7 @@
</div>
</template>
<script>
import util from "@/utils/util";
import util from '@/utils/util'
export default {
name: 'product',
props: {
......@@ -76,10 +76,11 @@ export default {
this.productTab = this.tabMenu.find(i => i.accounttypeId == tabId).productsArr[0].productId
},
selectPro(data) {
this.$parent.roleRootRules = false
this.$parent.editStatus = true
this.productTab = data.length != 0 ? data[data.length - 1].productId : ''
const { tabName, tabMenu, productTab } = this
console.log(tabName, data)
console.log(tabName, data, productTab, '选中')
// 设置全选
var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses
this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr))
......@@ -90,21 +91,20 @@ export default {
},
findMenuFunTree(arr) {
let tabMenu = util.deepClone(this.tabMenu_r)
this.tabMenu = tabMenu.filter(item=>arr.includes(item.accounttypeId))
this.tabMenu = tabMenu.filter(item => arr.includes(item.accounttypeId))
},
// 获取当前的所有权限
async findMenuFunTreeByMerId(params) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
tabMenu = tabMenu
.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId
}
})
this.tabMenu_r = util.deepClone(tabMenu)
tabMenu = tabMenu.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId
}
})
this.tabMenu_r = util.deepClone(tabMenu)
this.$nextTick(() => {
this.addStyle()
})
......@@ -141,7 +141,7 @@ export default {
accounttypeId: item.accounttypeId
}
})
this.tabMenu_s = util.deepClone(this.accountList);
this.tabMenu_s = util.deepClone(this.accountList)
// this.tabName = this.tabMenu[0].accounttypeId
this.findPermissionsByMerId(arr)
this.tabMenu_r = util.deepClone(this.accountList)
......@@ -149,47 +149,47 @@ export default {
},
// 获取已选择的权限
findPermissionsByMerId(arr) {
arr.forEach(item => {
this.accountList.forEach(itm => {
if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm)
item.productList.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.idList)
})
}
})
arr.forEach(item => {
this.accountList.forEach(itm => {
if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm)
item.productList.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.idList)
})
}
})
}
})
})
}
})
this.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId
})
this.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId
},
resetView() {
this.tabMenu = [];
this.accountList = util.deepClone(this.tabMenu_s);
this.tabMenu_x.forEach(item => {
this.accountList.forEach(itm => {
console.log(itm)
if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm)
item.products.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
})
}
})
this.tabMenu = []
this.accountList = util.deepClone(this.tabMenu_s)
this.tabMenu_x.forEach(item => {
this.accountList.forEach(itm => {
console.log(itm)
if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm)
item.products.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
})
}
})
}
})
})
}
})
})
},
// 渲染树结构
renderContent(h, v) {
......@@ -370,7 +370,7 @@ export default {
// this.findPermissionsByMerId()
}
}
</script>
</script>
<style scoped lang="scss">
.account-body {
......@@ -469,4 +469,4 @@ export default {
margin-bottom: 12px;
}
}
</style>
\ No newline at end of file
</style>
......@@ -184,7 +184,7 @@ export default {
this.rootList.forEach(item => {
accounttypeId.push(item.accounttypeId)
})
console.log(this.rootList, accounttypeId, '99999')
this.accounttypeIds = accounttypeId
this.$refs.productFrom.findMenuFunTree(accounttypeId)
},
......@@ -203,7 +203,7 @@ export default {
return
}
this.roleRootRules = false
if (this.accounttypeIds.length == 0) {
if (this.$refs.productFrom.getSelectInfo().length == 0 || this.$refs.productFrom.productTab === '') {
this.roleRootRules = true
return
}
......@@ -226,9 +226,8 @@ export default {
if (valid) {
let accountTypes = JSON.stringify(this.$refs.productFrom.getSelectInfo())
this.roleRootRules = false
if (this.$refs.productFrom.getSelectInfo().length == 0) {
if (this.$refs.productFrom.getSelectInfo().length == 0 || this.$refs.productFrom.productTab === '') {
this.roleRootRules = true
return
}
let para = {
......@@ -246,6 +245,12 @@ export default {
}
}
})
// console.log('外面', this.$refs.productFrom.getSelectInfo().length, this.$refs.productFrom.productTab)
this.roleRootRules = false
if (this.$refs.productFrom.getSelectInfo().length == 0 || this.$refs.productFrom.productTab === '') {
this.roleRootRules = true
return
}
}
},
insertRole(para) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!