Commit 88e9ef9e by cwq0219

merge

2 parents e15c651c 8530a60c
{ {
"name": "home", "name": "account",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
"core-js": "^3.4.4", "core-js": "^3.4.4",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"vue": "^2.6.11", "vue": "^2.6.11",
"glsx-components": "^1.1.2",
"glsx-table": "^1.0.9",
"vue-amap": "^0.5.10" "vue-amap": "^0.5.10"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -57,6 +57,18 @@ const staticRoutes = Object.freeze([{ ...@@ -57,6 +57,18 @@ const staticRoutes = Object.freeze([{
path: '/employee/detailEmployee/:id', path: '/employee/detailEmployee/:id',
meta: {}, meta: {},
component: resolve => require([`@/views/employee/detailEmployee.vue`], resolve) component: resolve => require([`@/views/employee/detailEmployee.vue`], resolve)
},
{
name: 'baseInfo',
path: '/baseInfo/index',
meta: {},
component: resolve => require([`@/views/baseInfo/index.vue`], resolve)
},
{
name: 'relevance',
path: '/baseInfo/relevance',
meta: {},
component: resolve => require([`@/views/baseInfo/relevance.vue`], resolve)
} }
]) ])
export default staticRoutes export default staticRoutes
\ No newline at end of file \ No newline at end of file
...@@ -29,4 +29,25 @@ util.checkisCard = function(card) { ...@@ -29,4 +29,25 @@ util.checkisCard = function(card) {
let myreg = /^(^\d{15}$)|(^\d{17}([0-9]|X)$)/; let myreg = /^(^\d{15}$)|(^\d{17}([0-9]|X)$)/;
return myreg.test(card); return myreg.test(card);
} }
util.deepClone = function(obj) {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
if (obj instanceof Date) {
const copy = new Date()
copy.setTime(obj.getTime())
return copy
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = util.deepClone(obj[attr])
}
}
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
}
export default util export default util
\ No newline at end of file \ No newline at end of file
...@@ -184,6 +184,7 @@ ...@@ -184,6 +184,7 @@
highlight-current highlight-current
:props="defaultProps" :props="defaultProps"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@check="clickDeal"
> >
</el-tree> </el-tree>
</div> </div>
...@@ -288,6 +289,9 @@ export default { ...@@ -288,6 +289,9 @@ export default {
}, },
}, },
methods: { methods: {
clickDeal() {
this.$parent.editStatus = true;
},
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
......
<template> <template>
<div class="account-body scrm-box-f" v-loading="loading"> <div class="account-body scrm-box-f" v-loading="loading">
<div class="account-title">{{title}}</div> <div class="account-title">{{ title }}</div>
<el-tabs v-model="tabName" type="card"> <el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik">
<el-tab-pane <el-tab-pane :label="item.accounttypeName" :name="item.accounttypeId" v-for="(item, index) in tabMenu" :key="index"></el-tab-pane>
:label="item.accounttypeName"
:name="item.accounttypeId"
v-for="(item, index) in tabMenu"
:key="index"
></el-tab-pane>
</el-tabs> </el-tabs>
<div <div class="account-select-pro" v-for="(item, index) in tabMenu" :key="index" v-show="tabName == item.accounttypeId">
class="account-select-pro"
v-for="(item, index) in tabMenu"
:key="index"
v-show="tabName == item.accounttypeId"
>
<label>选择产品</label> <label>选择产品</label>
<el-checkbox-group v-model="item.productsArr" @change="selectPro"> <el-checkbox-group v-model="item.productsArr" @change="selectPro">
<el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{ <el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{ itm.productName }}</el-checkbox>
itm.productName
}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div class="account-select-menu">请选择产品权限</div> <div class="account-select-menu">请选择产品权限</div>
...@@ -27,40 +15,19 @@ ...@@ -27,40 +15,19 @@
<div class="menu-box-panel"> <div class="menu-box-panel">
<div :key="index" v-for="(item, index) in tabMenu"> <div :key="index" v-for="(item, index) in tabMenu">
<div class="menu-box-tab" v-show="tabName == item.accounttypeId"> <div class="menu-box-tab" v-show="tabName == item.accounttypeId">
<div <div v-show="item.productsArr.indexOf(itm) != -1" class="tab-item text-hide" :class="{ 'select-checked': productTab == itm.productId }" @click="productClick(itm.productId)" v-for="(itm, idx) in item.products" :key="idx">
v-show="item.productsArr.indexOf(itm) != -1"
class="tab-item text-hide"
:class="{ 'select-checked': productTab == itm.productId }"
@click="productClick(itm.productId)"
v-for="(itm, idx) in item.products"
:key="idx"
>
{{ itm.productName }} {{ itm.productName }}
</div> </div>
</div> </div>
<div <div v-show="tabName == item.accounttypeId" class="menu-box-tree" v-if="item.products" :style="{ 'min-height': treeHeight + 'px' }">
v-show="tabName == item.accounttypeId"
class="menu-box-tree"
v-if="item.products"
:style="{ 'min-height': treeHeight + 'px' }"
>
<div v-for="(itm, idx) in item.products" :key="idx"> <div v-for="(itm, idx) in item.products" :key="idx">
<el-tree <div class="nodata" v-if="item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0">
v-show="productTab == itm.productId" <img src="../../../assets/img/empty.png" alt="" />
:data="itm.merchantProTreeResponses" <div>{{ item.productsArr.length == 0 ? '请先选择产品' : '暂无菜单权限' }}</div>
show-checkbox </div>
check-strictly <div v-else>
check-on-click-node <el-tree v-show="productTab == itm.productId" :data="itm.merchantProTreeResponses" show-checkbox check-strictly check-on-click-node :expand-on-click-node="false" default-expand-all node-key="id" :class="'tree_' + item.accounttypeId + '_' + itm.productId" :ref="`tree_${item.accounttypeId}_${itm.productId}`" highlight-current :render-content="renderContent" :props="defaultProps" @check="clickDeal"></el-tree>
:expand-on-click-node="false" </div>
default-expand-all
node-key="id"
:class="'tree_' + item.accounttypeId + '_' + itm.productId"
:ref="`tree_${item.accounttypeId}_${itm.productId}`"
highlight-current
:render-content="renderContent"
:props="defaultProps"
@check="clickDeal"
></el-tree>
</div> </div>
</div> </div>
</div> </div>
...@@ -68,192 +35,214 @@ ...@@ -68,192 +35,214 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import util from "@/utils/util";
export default { export default {
name: "product", name: 'product',
props: { props: {
title: { title: {
type: String, type: String
}, },
roleType: { roleType: {
type: Boolean, type: Boolean
} }
}, },
data() { data() {
return { return {
loading: false, loading: false,
treeHeight: 300, treeHeight: 450,
tabMenu: [], tabMenu: [],
tabMenu_x: [],
tabMenu_s: [],
accountList: [],
selectIndex: 0, selectIndex: 0,
productId: 0, productId: 0,
products: [], products: [],
productsArr: [], productsArr: [],
tabName: "", tabName: '',
productTab: "", productTab: '',
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label'
}, },
accountTypes: [], accountTypes: []
}; }
}, },
methods: { methods: {
handleClik(tab, event) {
console.log(tab, event)
const tabId = tab.name
this.productTab = this.tabMenu.find(i => i.accounttypeId == tabId).productsArr[0].productId
},
selectPro(data) { selectPro(data) {
this.$parent.editStatus = true; this.$parent.editStatus = true
this.productTab = data.length != 0 ? data[data.length - 1].productId : ""; this.productTab = data.length != 0 ? data[data.length - 1].productId : ''
const { tabName, tabMenu, productTab } = this; const { tabName, tabMenu, productTab } = this
console.log(tabName, data); console.log(tabName, data)
// 设置全选 // 设置全选
var arr = tabMenu var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses
.find((i) => i.accounttypeId == tabName) this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr))
.products.find((j) => j.productId == productTab).merchantProTreeResponses; console.log(tabMenu)
this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr));
console.log(tabMenu);
}, },
productClick(productId) { productClick(productId) {
this.productTab = productId; this.productTab = productId
}, },
// 获取当前的所有权限 // 获取当前的所有权限
async findMenuFunTreeByMerId(params) { async findMenuFunTreeByMerId(params, arr) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params); let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
this.tabMenu = tabMenu.map((item) => { this.tabMenu = tabMenu
.map(item => {
return { return {
productsArr: [], productsArr: [],
products: item.products, products: item.products,
accounttypeName: item.accounttypeName, accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses, }
// productId: '' })
}; .filter(i => arr.includes(i.accounttypeId))
});
this.$nextTick(() => { this.$nextTick(() => {
this.addStyle(); this.addStyle()
}); })
console.log(this.tabMenu); console.log(this.tabMenu)
this.accountTypes = tabMenu.map((item) => { this.accountTypes = tabMenu.map(item => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
}; }
}); })
this.tabName = this.tabMenu[0].accounttypeId; this.tabName = this.tabMenu[0].accounttypeId
return this.tabMenu return this.tabMenu
}, },
// 获取当前的所有权限 // 获取当前的所有权限
async accountTypeSearchRequest(params,status) { async accountTypeSearchRequest(params, status) {
this.loading = true; this.loading = true
let account = '' let account = ''
if(status) { if (status) {
account = 'findMenuFunTreeByMerId' account = 'findMenuFunTreeByMerId'
}else { } else {
account = 'accountTypeSearchRequest' account = 'accountTypeSearchRequest'
} }
let tabMenu = await this.$apis.store[account](params); let tabMenu = await this.$apis.store[account](params)
this.tabMenu = tabMenu.map((item) => { this.accountList = tabMenu.map(item => {
return { return {
productsArr: [], productsArr: [],
products: item.products, products: item.products,
accounttypeName: item.accounttypeName, accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses, // merchantProTreeResponses: item.merchantProTreeResponses,
// productId: '' // productId: ''
}; }
}); })
this.$nextTick(() => { this.$nextTick(() => {
this.addStyle(); this.addStyle()
}); })
console.log(this.tabMenu); console.log(this.accountList)
this.accountTypes = tabMenu.map((item) => { this.accountTypes = tabMenu.map(item => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
}; }
}); })
this.tabName = this.tabMenu[0].accounttypeId; this.tabMenu_s = util.deepClone(this.accountList);
this.findPermissionsByMerId(params.merchantId?params.merchantId:params.id); // this.tabName = this.tabMenu[0].accounttypeId
return this.tabMenu this.findPermissionsByMerId(params.merchantId ? params.merchantId : params.id)
return this.accountList
}, },
// 获取已选择的权限 // 获取已选择的权限
findPermissionsByMerId(id) { findPermissionsByMerId(id) {
const params = { const params = {
id, id
}; }
this.$apis.store.findPermissionsByMerId(params).then((res) => { this.$apis.store.findPermissionsByMerId(params).then(res => {
// this.accountTypes = res.map(item=>{ this.loading = false
// let products = item.products.map(i=>{ this.tabMenu_x = util.deepClone(res);
// return { res.forEach(item => {
// menuIds: i.menuIds, console.log(item)
// productId: i.productId, this.accountList.forEach(itm => {
// functionIds: i.functionIds console.log(itm)
// } if (item.accounttypeId == itm.accounttypeId) {
// }) this.tabMenu.push(itm)
// return { item.products.forEach(i => {
// accounttypeId: item.accounttypeId, itm.products.forEach(j => {
// products if (i.productId == j.productId) {
// } itm.productsArr.push(j)
// }) this.$nextTick(() => {
this.loading = false; this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
res.forEach((item) => { })
this.tabMenu.forEach((itm) => { }
})
})
}
})
})
this.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId
// const arr = res.map(i => i.accounttypeId)
// this.tabMenu.map(i => arr.includes(i.accounttypeId))
// console.log(this.tabMenu, arr)
})
},
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) { if (item.accounttypeId == itm.accounttypeId) {
item.products.forEach((i) => { this.tabMenu.push(itm)
itm.products.forEach((j) => { item.products.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) { if (i.productId == j.productId) {
itm.productsArr.push(j); itm.productsArr.push(j)
this.$refs[ this.$nextTick(() => {
`tree_${itm.accounttypeId}_${j.productId}` this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
][0].setCheckedKeys(i.menuIds); })
} }
}); })
}); })
} }
}); })
}); })
});
}, },
// 渲染树结构 // 渲染树结构
renderContent(h, v) { renderContent(h, v) {
if (v.data.logo == "functionValue") { if (v.data.logo == 'functionValue') {
return ( return (
<div class="custom-tree-node fun-tree-node"> <div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span> <span>{v.node.label}</span>
</div> </div>
); )
} else { } else {
return ( return (
<div class="custom-tree-node"> <div class="custom-tree-node">
<span>{v.node.label}</span> <span>{v.node.label}</span>
</div> </div>
); )
} }
}, },
addStyle() { addStyle() {
const nodes = document.getElementsByClassName("fun-tree-node"); const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode; const parentNode = nodes[i].parentNode
parentNode.style.float = "left"; parentNode.style.float = 'left'
} }
}, },
clickDeal(currentObj, treeStatus) { clickDeal(currentObj, treeStatus) {
this.$parent.editStatus = true; this.$parent.editStatus = true
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。 // 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let selected = treeStatus.checkedKeys.indexOf(currentObj.id); // -1未选中 let selected = treeStatus.checkedKeys.indexOf(currentObj.id) // -1未选中
// 选中 // 选中
if (selected !== -1) { if (selected !== -1) {
// 子节点只要被选中父节点就被选中 // 子节点只要被选中父节点就被选中
this.selectedParent(currentObj); this.selectedParent(currentObj)
// 统一处理子节点为相同的勾选状态 // 统一处理子节点为相同的勾选状态
this.uniteChildSame(currentObj, true); this.uniteChildSame(currentObj, true)
} else { } else {
// 未选中 处理子节点全部未选中 // 未选中 处理子节点全部未选中
console.log(currentObj); console.log(currentObj)
if (currentObj.children !== null) { if (currentObj.children !== null) {
if (currentObj.children.length !== 0) { if (currentObj.children.length !== 0) {
this.uniteChildSame(currentObj, false); this.uniteChildSame(currentObj, false)
} }
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定 //放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态 // this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
...@@ -265,142 +254,135 @@ export default { ...@@ -265,142 +254,135 @@ export default {
}, },
uniteParentSame(id, treeStatus) { uniteParentSame(id, treeStatus) {
//当子节点全为未选中时父节点也变为未选中状态 //当子节点全为未选中时父节点也变为未选中状态
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
let node = this.$refs[tree_ref][0].getNode(id); //获取当前节点的节点树 let node = this.$refs[tree_ref][0].getNode(id) //获取当前节点的节点树
if (node.parent !== null && node.parent !== undefined) { if (node.parent !== null && node.parent !== undefined) {
let parentNode = node.parent.data; //获取当前节点的父节点树 let parentNode = node.parent.data //获取当前节点的父节点树
if (parentNode != undefined) { if (parentNode != undefined) {
//判断父节点是否存在 //判断父节点是否存在
for (let i = 0; i < parentNode.children.length; i++) { for (let i = 0; i < parentNode.children.length; i++) {
let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys(); let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys()
let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys(); let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys()
let selectNodes = checkedKeys.concat(hafCheckedKeys); //获取已选择树节点 let selectNodes = checkedKeys.concat(hafCheckedKeys) //获取已选择树节点
let selected = selectNodes.indexOf(parentNode.children[i].id); // -1当前节点的同级节点是否全部未选中 let selected = selectNodes.indexOf(parentNode.children[i].id) // -1当前节点的同级节点是否全部未选中
if (selected !== -1) { if (selected !== -1) {
return; return
} }
} }
} else { } else {
return; return
} }
this.$refs[tree_ref][0].setChecked(parentNode.id, false); //修改节点为未选择 this.$refs[tree_ref][0].setChecked(parentNode.id, false) //修改节点为未选择
if (node.level > 2) { if (node.level > 2) {
//判断是否是最上级节点 //判断是否是最上级节点
this.uniteParentSame(parentNode.id, treeStatus); this.uniteParentSame(parentNode.id, treeStatus)
} }
} else { } else {
return; return
} }
}, },
// 统一处理子节点为相同的勾选状态 // 统一处理子节点为相同的勾选状态
uniteChildSame(treeList, isSelected) { uniteChildSame(treeList, isSelected) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
this.$refs[tree_ref][0].setChecked(treeList.id, isSelected); this.$refs[tree_ref][0].setChecked(treeList.id, isSelected)
console.log(treeList); console.log(treeList)
if (treeList.children !== null) { if (treeList.children !== null) {
for (let i = 0; i < treeList.children.length; i++) { for (let i = 0; i < treeList.children.length; i++) {
this.uniteChildSame(treeList.children[i], isSelected); this.uniteChildSame(treeList.children[i], isSelected)
} }
} }
}, },
// 统一处理父节点为选中 // 统一处理父节点为选中
selectedParent(currentObj) { selectedParent(currentObj) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
let currentNode = this.$refs[tree_ref][0].getNode(currentObj); let currentNode = this.$refs[tree_ref][0].getNode(currentObj)
if (currentNode.parent.key !== undefined) { if (currentNode.parent.key !== undefined) {
this.$refs[tree_ref][0].setChecked(currentNode.parent, true); this.$refs[tree_ref][0].setChecked(currentNode.parent, true)
this.selectedParent(currentNode.parent); this.selectedParent(currentNode.parent)
} }
}, },
// 获取所有节点的id // 获取所有节点的id
getAllId(data, arr = []) { getAllId(data, arr = []) {
if (data) { if (data) {
data.forEach((item) => { data.forEach(item => {
arr.push(item.id); arr.push(item.id)
if (item.children && item.children.length != 0) { if (item.children && item.children.length != 0) {
item.children.forEach((i) => { item.children.forEach(i => {
arr.push(i.id); arr.push(i.id)
this.getAllId(i.children, arr); this.getAllId(i.children, arr)
}); })
} }
}); })
} }
return arr; return arr
}, },
getSelectInfo() { getSelectInfo() {
this.accountTypes = this.tabMenu.map((item) => { this.accountTypes = this.tabMenu.map(item => {
let products = []; let products = []
let productList = []; let productList = []
item.productsArr.forEach((itm) => { item.productsArr.forEach(itm => {
const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] ? this.$refs[`tree_${item.accounttypeId}_${itm.productId}`][0].getCheckedNodes() : []
? this.$refs[ console.log(checkedNodes)
`tree_${item.accounttypeId}_${itm.productId}`
][0].getCheckedNodes()
: [];
console.log(checkedNodes);
const menuIdList = checkedNodes const menuIdList = checkedNodes
// .filter((item) => item.logo === "menu") // .filter((item) => item.logo === "menu")
.filter((item) => item.logo !== "function" && item.logo !== "functionValue" && item.logo !== 'neglect') .filter(item => item.logo !== 'function' && item.logo !== 'functionValue' && item.logo !== 'neglect')
.map((i) => i.id); // 全选菜单idlist .map(i => i.id) // 全选菜单idlist
// const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist // const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const functionIdList = checkedNodes.filter((item) => item.logo === "function"); const functionIdList = checkedNodes.filter(item => item.logo === 'function')
const functionValueIdLists = checkedNodes.filter( const functionValueIdLists = checkedNodes.filter(item => item.logo === 'functionValue')
(item) => item.logo === "functionValue" var list = []
);
var list = [];
/** { menuId, id, functionValue} */ /** { menuId, id, functionValue} */
if (functionValueIdLists.length !== 0) { if (functionValueIdLists.length !== 0) {
functionValueIdLists.forEach((j, index) => { functionValueIdLists.forEach((j, index) => {
if (list.map((item) => item.id).includes(j.parentId)) { if (list.map(item => item.id).includes(j.parentId)) {
const obj = list.find((k) => k.id === j.parentId); const obj = list.find(k => k.id === j.parentId)
obj.functionValue += ";" + j.id + ":" + j.label; obj.functionValue += ';' + j.id + ':' + j.label
} else { } else {
list.push({ list.push({
id: j.parentId, id: j.parentId,
menuId: j.superParentId, menuId: j.superParentId,
functionValue: j.id + ":" + j.label, functionValue: j.id + ':' + j.label
}); })
} }
}); })
} }
console.log(menuIdList, functionIdList, functionValueIdLists, list); console.log(menuIdList, functionIdList, functionValueIdLists, list)
if (this.roleType) { if (this.roleType) {
productList.push({ productList.push({
productId: itm.productId, productId: itm.productId,
functionIdList: functionIdList, functionIdList: functionIdList,
// functionValue: list, // functionValue: list,
menuIdList: menuIdList, menuIdList: menuIdList
}); })
} else { } else {
products.push({ products.push({
productId: itm.productId, productId: itm.productId,
functionIds: functionIdList, functionIds: functionIdList,
functionValue: list, functionValue: list,
menuIds: menuIdList, menuIds: menuIdList
}); })
} }
}); })
if (this.roleType) { if (this.roleType) {
return { return {
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId,
productList, productList
}; }
} else { } else {
return { return {
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId,
products, products
}; }
}
})
return this.accountTypes
} }
});
return this.accountTypes;
},
}, },
mounted() { mounted() {
// this.accountTypeSearchRequest(); // this.accountTypeSearchRequest();
// this.findPermissionsByMerId() // this.findPermissionsByMerId()
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -458,7 +440,7 @@ export default { ...@@ -458,7 +440,7 @@ export default {
cursor: pointer; cursor: pointer;
&.select-checked { &.select-checked {
color: #322ad9; color: #322ad9;
font-weight: 700; // font-weight: 700;
border-bottom: none; border-bottom: none;
} }
} }
...@@ -470,4 +452,16 @@ export default { ...@@ -470,4 +452,16 @@ export default {
} }
} }
} }
.nodata {
position: absolute;
top: 50%;
left: 50%;
text-align: center;
transform: translate(-50%, -50%);
img {
width: 64px;
height: 41px;
margin-bottom: 12px;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -13,29 +13,29 @@ ...@@ -13,29 +13,29 @@
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">登录账户名:</span> <span class="itemName">登录账户名:</span>
<span class="itemValue">{{ firstPageObj.merchantLoginAccount }}</span> <span class="itemValue">{{ firstPageObj.merchantLoginAccount || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">账户等级:</span> <span class="itemName itemNameCol2">账户等级:</span>
<span class="itemValue">{{ firstPageObj.accountLevelName }}</span> <span class="itemValue">{{ firstPageObj.accountLevelName || '-' }}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">开通模式:</span> <span class="itemName">开通模式:</span>
<span class="itemValue">{{ firstPageObj.merchantModelName }}</span> <span class="itemValue">{{ firstPageObj.merchantModelName || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">账户状态:</span> <span class="itemName itemNameCol2">账户状态:</span>
<span class="itemValue"> <span class="itemValue">
{{ firstPageObj.statusName }} {{ firstPageObj.statusName || '-' }}
</span> </span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">关联企业微信名:</span> <span class="itemName">关联企业微信名:</span>
<span class="itemValue">{{ firstPageObj.entmicroName }}</span> <span class="itemValue">{{ firstPageObj.entmicroName || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">账户有效期:</span> <span class="itemName itemNameCol2">账户有效期:</span>
...@@ -86,23 +86,23 @@ ...@@ -86,23 +86,23 @@
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">商户名称:</span> <span class="itemName">商户名称:</span>
<span class="itemValue">{{ firstPageObj.merchantName }}</span> <span class="itemValue">{{ firstPageObj.merchantName || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">简称:</span> <span class="itemName itemNameCol2">简称:</span>
<span class="itemValue"> <span class="itemValue">
{{ firstPageObj.merchantAbbreviation }} {{ firstPageObj.merchantAbbreviation || '-' }}
</span> </span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">商户类型:</span> <span class="itemName">商户类型:</span>
<span class="itemValue">{{ firstPageObj.merchantTypeName }}</span> <span class="itemValue">{{ firstPageObj.merchantTypeName || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">身份证:</span> <span class="itemName itemNameCol2">身份证:</span>
<span class="itemValue">{{ firstPageObj.merchantOrgcode }}</span> <span class="itemValue">{{ firstPageObj.merchantOrgcode || '-' }}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
...@@ -110,28 +110,28 @@ ...@@ -110,28 +110,28 @@
<span class="itemName">地址:</span> <span class="itemName">地址:</span>
<span class="itemValue"> <span class="itemValue">
{{ firstPageObj.merchantAddress }} {{ firstPageObj.merchantAddress || '-' }}
</span> </span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">联系人:</span> <span class="itemName itemNameCol2">联系人:</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPerson }}</span> <span class="itemValue">{{ firstPageObj.merchantLegalPerson || '-' }}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="14"> <el-col :span="14">
<span class="itemName">联系电话:</span> <span class="itemName">联系电话:</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPersonPhone }}</span> <span class="itemValue">{{ firstPageObj.merchantLegalPersonPhone || '-' }}</span>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<span class="itemName itemNameCol2">营业范围:</span> <span class="itemName itemNameCol2">营业范围:</span>
<span class="itemValue">{{ firstPageObj.businessScopName }}</span> <span class="itemValue">{{ firstPageObj.businessScopName || '-' }}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<span class="itemName">主营品牌:</span> <span class="itemName">主营品牌:</span>
<span class="itemValue">{{ firstPageObj.merchantBrandName }}</span> <span class="itemValue">{{ firstPageObj.merchantBrandName || '-' }}</span>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
......
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
</template> </template>
<script> <script>
import util from "@/utils/util";
import mapView from "@/components/mapView/index"; import mapView from "@/components/mapView/index";
import autoButton from "@/components/auto-button/index"; import autoButton from "@/components/auto-button/index";
import selectProduct from "./components/selectProduct"; import selectProduct from "./components/selectProduct";
...@@ -181,6 +182,7 @@ export default { ...@@ -181,6 +182,7 @@ export default {
data() { data() {
return { return {
editStatus: false, editStatus: false,
detailFirst: {},
tabWidth: 0, tabWidth: 0,
editInfo: {}, editInfo: {},
pwdStatus: true, pwdStatus: true,
...@@ -254,6 +256,12 @@ export default { ...@@ -254,6 +256,12 @@ export default {
}, },
deep: true, deep: true,
}, },
accountInfoForm: {
handler() {
this.editStatus = true;
},
deep: true,
},
}, },
methods: { methods: {
hanleTab(status) { hanleTab(status) {
...@@ -267,12 +275,21 @@ export default { ...@@ -267,12 +275,21 @@ export default {
this.handleNext(status); this.handleNext(status);
}) })
.catch(() => { .catch(() => {
this.handleTabs(status); this.tabCancel(status);
}); });
} else { } else {
this.handleTabs(status); this.handleTabs(status);
} }
}, },
tabCancel(status) {
if (status == 2) {
this.$refs.productForm.resetView();
} else {
this.renderView(this.detailFirst);
this.pwdStatus = true;
}
this.handleTabs(status);
},
handleTabs(status) { handleTabs(status) {
this.editStatus = false; this.editStatus = false;
if (status == 1 && this.step == "second") { if (status == 1 && this.step == "second") {
...@@ -284,18 +301,10 @@ export default { ...@@ -284,18 +301,10 @@ export default {
this.tabWidth = 124; this.tabWidth = 124;
} }
}, },
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getAddress() {
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
console.log(this.accountAddForm.merchantAddress);
},
handleCancel() { handleCancel() {
this.$router.push("/account/index"); this.$router.push("/account/index");
}, },
//保存
handleSave(status) { handleSave(status) {
if (this.$refs.productForm.getSelectInfo().length == 0) { if (this.$refs.productForm.getSelectInfo().length == 0) {
this.$message.error("请选择产品"); this.$message.error("请选择产品");
...@@ -359,12 +368,6 @@ export default { ...@@ -359,12 +368,6 @@ export default {
}); });
this.findMerchantDetail(); this.findMerchantDetail();
}, },
addBusinessScope() {
this.businessScopeCustomize.push({ name: "" });
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index, 1);
},
async findMerchantDetail() { async findMerchantDetail() {
this.$apis.store this.$apis.store
.findMerchantDetail({ .findMerchantDetail({
...@@ -386,6 +389,11 @@ export default { ...@@ -386,6 +389,11 @@ export default {
}; };
} }
this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant); this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant);
this.detailFirst = util.deepClone(res);
this.renderView(res);
});
},
renderView(res) {
let { let {
isloginName, isloginName,
bussinessBegintime, bussinessBegintime,
...@@ -415,9 +423,7 @@ export default { ...@@ -415,9 +423,7 @@ export default {
this.accountInfoForm.merchantLoginAccount = merchantLoginAccount; this.accountInfoForm.merchantLoginAccount = merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = merchantLoginPassword; this.accountInfoForm.merchantLoginPassword = merchantLoginPassword;
this.accountTypes = accountTypes; this.accountTypes = accountTypes;
this.accountAddForm.businessScope = businessScope this.accountAddForm.businessScope = businessScope ? businessScope.split(",") : [];
? businessScope.split(",")
: [];
if (this.accountAddForm.businessScope.length > 0) { if (this.accountAddForm.businessScope.length > 0) {
for (let i in this.accountAddForm.businessScope) { for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt( this.accountAddForm.businessScope[i] = parseInt(
...@@ -452,12 +458,10 @@ export default { ...@@ -452,12 +458,10 @@ export default {
}); });
} }
merchantBrand = merchantBrand ? merchantBrand.split(",") : []; merchantBrand = merchantBrand ? merchantBrand.split(",") : [];
if (merchantBrand && merchantBrand.length > 0) {
for (let i in merchantBrand) { for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]); merchantBrand[i] = parseInt(merchantBrand[i]);
} }
this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand); this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand);
}
this.accountAddForm = Object.assign(this.accountAddForm, { this.accountAddForm = Object.assign(this.accountAddForm, {
isloginName: isloginName ? true : false, isloginName: isloginName ? true : false,
lat, lat,
...@@ -477,7 +481,6 @@ export default { ...@@ -477,7 +481,6 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.editStatus = false; this.editStatus = false;
}); });
});
}, },
getCarbrandTree() { getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => { this.$apis.store.getCarbrandTree({}).then((res) => {
...@@ -485,7 +488,6 @@ export default { ...@@ -485,7 +488,6 @@ export default {
}); });
}, },
}, },
mounted() { mounted() {
this.footerLeft = document.querySelector(".base-container-right").offsetLeft; this.footerLeft = document.querySelector(".base-container-right").offsetLeft;
this.footerWidth = document.documentElement.clientWidth - this.footerLeft; this.footerWidth = document.documentElement.clientWidth - this.footerLeft;
......
...@@ -156,13 +156,13 @@ export default { ...@@ -156,13 +156,13 @@ export default {
} }
let flag = false let flag = false
this.dataList.forEach(item => { this.dataList.forEach(item => {
if (item.departmentId == this.curGLData.departmentId && item.merchantId == this.curGLData.merchantId) { if (item.departmentId == this.curGLData.departmentId || item.merchantId == this.curGLData.merchantId) {
flag = true flag = true
} }
}) })
if (flag) { if (flag) {
this.$message({ this.$message({
message: '该关联已在列表当中', message: '此商户已经绑定,请勿重复绑定',
type: 'warning' type: 'warning'
}) })
return return
...@@ -233,7 +233,6 @@ export default { ...@@ -233,7 +233,6 @@ export default {
tempindex = index tempindex = index
} }
}) })
console.log(tempindex)
this.$confirm('此操作将删除该项, 是否继续?', '提示', { this.$confirm('此操作将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -248,10 +247,10 @@ export default { ...@@ -248,10 +247,10 @@ export default {
}) })
}) })
.catch(() => { .catch(() => {
this.$message({ // this.$message({
type: 'info', // type: 'info',
message: '已取消删除' // message: '已取消删除'
}) // })
}) })
}, },
// 递归:处理层级数组 // 递归:处理层级数组
...@@ -323,6 +322,9 @@ export default { ...@@ -323,6 +322,9 @@ export default {
text-align: right; text-align: right;
} }
} }
.sel-wrap /deep/ .el-cascader-node {
max-width: 250px!important;
}
.btn-wrap { .btn-wrap {
padding-left: 20px; padding-left: 20px;
padding-top: 40px; padding-top: 40px;
......
<template>
<div class="account-body scrm-box-f" v-loading="loading">
<!-- <div class="account-title">{{ title }}</div> -->
<el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik">
<el-tab-pane :label="item.accounttypeName" :name="item.accounttypeId" v-for="(item, index) in tabMenu" :key="index"></el-tab-pane>
</el-tabs>
<div class="account-select-pro" v-for="(item, index) in tabMenu" :key="index" v-show="tabName == item.accounttypeId">
<label>选择产品</label>
<el-checkbox-group v-model="item.productsArr" @change="selectPro">
<el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{ itm.productName }}</el-checkbox>
</el-checkbox-group>
</div>
<div class="account-select-menu">请选择产品权限</div>
<div class="menu-box">
<div class="menu-box-panel">
<div :key="index" v-for="(item, index) in tabMenu">
<div class="menu-box-tab" v-show="tabName == item.accounttypeId">
<div v-show="item.productsArr.indexOf(itm) != -1" class="tab-item text-hide" :class="{ 'select-checked': productTab == itm.productId }" @click="productClick(itm.productId)" v-for="(itm, idx) in item.products" :key="idx">
{{ itm.productName }}
</div>
</div>
<div v-show="tabName == item.accounttypeId" class="menu-box-tree" v-if="item.products" :style="{ 'min-height': treeHeight + 'px' }">
<div v-for="(itm, idx) in item.products" :key="idx">
<div class="nodata" v-if="item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0">
<img src="../../../assets/img/empty.png" alt="" />
<div>{{ item.productsArr.length == 0 ? '请先选择产品' : '暂无菜单权限' }}</div>
</div>
<div v-else>
<el-tree v-show="productTab == itm.productId" :data="itm.merchantProTreeResponses" show-checkbox check-strictly check-on-click-node :expand-on-click-node="false" default-expand-all node-key="id" :class="'tree_' + item.accounttypeId + '_' + itm.productId" :ref="`tree_${item.accounttypeId}_${itm.productId}`" highlight-current :render-content="renderContent" :props="defaultProps" @check="clickDeal"></el-tree>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import util from "@/utils/util";
export default {
name: 'product',
props: {
title: {
type: String
},
roleType: {
type: Boolean
}
},
data() {
return {
loading: false,
treeHeight: 450,
tabMenu: [],
tabMenu_x: [],
tabMenu_s: [],
accountList: [],
selectIndex: 0,
productId: 0,
products: [],
productsArr: [],
tabName: '',
productTab: '',
defaultProps: {
children: 'children',
label: 'label'
},
accountTypes: []
}
},
methods: {
handleClik(tab, event) {
console.log(tab, event)
const tabId = tab.name
this.productTab = this.tabMenu.find(i => i.accounttypeId == tabId).productsArr[0].productId
},
selectPro(data) {
this.$parent.editStatus = true
this.productTab = data.length != 0 ? data[data.length - 1].productId : ''
const { tabName, tabMenu, productTab } = this
console.log(tabName, data)
// 设置全选
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))
console.log(tabMenu)
},
productClick(productId) {
this.productTab = productId
},
// 获取当前的所有权限
async findMenuFunTreeByMerId(params, arr) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
this.tabMenu = tabMenu
.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId
}
})
.filter(i => arr.includes(i.accounttypeId))
this.$nextTick(() => {
this.addStyle()
})
console.log(this.tabMenu)
this.accountTypes = tabMenu.map(item => {
return {
products: null,
accounttypeId: item.accounttypeId
}
})
this.tabName = this.tabMenu[0].accounttypeId
return this.tabMenu
},
// 获取当前的所有权限
async accountTypeSearchRequest(params, status) {
this.loading = true
let account = ''
if (status) {
account = 'findMenuFunTreeByMerId'
} else {
account = 'accountTypeSearchRequest'
}
let tabMenu = await this.$apis.store[account](params)
this.accountList = tabMenu.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
}
})
this.$nextTick(() => {
this.addStyle()
})
console.log(this.accountList)
this.accountTypes = tabMenu.map(item => {
return {
products: null,
accounttypeId: item.accounttypeId
}
})
this.tabMenu_s = util.deepClone(this.accountList);
// this.tabName = this.tabMenu[0].accounttypeId
this.findPermissionsByMerId(params.merchantId ? params.merchantId : params.id)
return this.accountList
},
// 获取已选择的权限
findPermissionsByMerId(id) {
const params = {
id
}
this.$apis.store.findPermissionsByMerId(params).then(res => {
this.loading = false
this.tabMenu_x = util.deepClone(res);
res.forEach(item => {
console.log(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.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId
// const arr = res.map(i => i.accounttypeId)
// this.tabMenu.map(i => arr.includes(i.accounttypeId))
// console.log(this.tabMenu, arr)
})
},
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)
})
}
})
})
}
})
})
},
// 渲染树结构
renderContent(h, v) {
if (v.data.logo == 'functionValue') {
return (
<div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span>
</div>
)
} else {
return (
<div class="custom-tree-node">
<span>{v.node.label}</span>
</div>
)
}
},
addStyle() {
const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode
parentNode.style.float = 'left'
}
},
clickDeal(currentObj, treeStatus) {
this.$parent.editStatus = true
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let selected = treeStatus.checkedKeys.indexOf(currentObj.id) // -1未选中
// 选中
if (selected !== -1) {
// 子节点只要被选中父节点就被选中
this.selectedParent(currentObj)
// 统一处理子节点为相同的勾选状态
this.uniteChildSame(currentObj, true)
} else {
// 未选中 处理子节点全部未选中
console.log(currentObj)
if (currentObj.children !== null) {
if (currentObj.children.length !== 0) {
this.uniteChildSame(currentObj, false)
}
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
}
// else {
// this.uniteParentSame(currentObj.id,treeStatus)
// }
}
},
uniteParentSame(id, treeStatus) {
//当子节点全为未选中时父节点也变为未选中状态
const tree_ref = `tree_${this.tabName}_${this.productTab}`
let node = this.$refs[tree_ref][0].getNode(id) //获取当前节点的节点树
if (node.parent !== null && node.parent !== undefined) {
let parentNode = node.parent.data //获取当前节点的父节点树
if (parentNode != undefined) {
//判断父节点是否存在
for (let i = 0; i < parentNode.children.length; i++) {
let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys()
let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys()
let selectNodes = checkedKeys.concat(hafCheckedKeys) //获取已选择树节点
let selected = selectNodes.indexOf(parentNode.children[i].id) // -1当前节点的同级节点是否全部未选中
if (selected !== -1) {
return
}
}
} else {
return
}
this.$refs[tree_ref][0].setChecked(parentNode.id, false) //修改节点为未选择
if (node.level > 2) {
//判断是否是最上级节点
this.uniteParentSame(parentNode.id, treeStatus)
}
} else {
return
}
},
// 统一处理子节点为相同的勾选状态
uniteChildSame(treeList, isSelected) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`
this.$refs[tree_ref][0].setChecked(treeList.id, isSelected)
console.log(treeList)
if (treeList.children !== null) {
for (let i = 0; i < treeList.children.length; i++) {
this.uniteChildSame(treeList.children[i], isSelected)
}
}
},
// 统一处理父节点为选中
selectedParent(currentObj) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`
let currentNode = this.$refs[tree_ref][0].getNode(currentObj)
if (currentNode.parent.key !== undefined) {
this.$refs[tree_ref][0].setChecked(currentNode.parent, true)
this.selectedParent(currentNode.parent)
}
},
// 获取所有节点的id
getAllId(data, arr = []) {
if (data) {
data.forEach(item => {
arr.push(item.id)
if (item.children && item.children.length != 0) {
item.children.forEach(i => {
arr.push(i.id)
this.getAllId(i.children, arr)
})
}
})
}
return arr
},
getSelectInfo() {
this.accountTypes = this.tabMenu.map(item => {
let products = []
let productList = []
item.productsArr.forEach(itm => {
const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] ? this.$refs[`tree_${item.accounttypeId}_${itm.productId}`][0].getCheckedNodes() : []
console.log(checkedNodes)
const menuIdList = checkedNodes
// .filter((item) => item.logo === "menu")
.filter(item => item.logo !== 'function' && item.logo !== 'functionValue' && item.logo !== 'neglect')
.map(i => i.id) // 全选菜单idlist
// const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const functionIdList = checkedNodes.filter(item => item.logo === 'function')
const functionValueIdLists = checkedNodes.filter(item => item.logo === 'functionValue')
var list = []
/** { menuId, id, functionValue} */
if (functionValueIdLists.length !== 0) {
functionValueIdLists.forEach((j, index) => {
if (list.map(item => item.id).includes(j.parentId)) {
const obj = list.find(k => k.id === j.parentId)
obj.functionValue += ';' + j.id + ':' + j.label
} else {
list.push({
id: j.parentId,
menuId: j.superParentId,
functionValue: j.id + ':' + j.label
})
}
})
}
console.log(menuIdList, functionIdList, functionValueIdLists, list)
if (this.roleType) {
productList.push({
productId: itm.productId,
functionIdList: functionIdList,
// functionValue: list,
menuIdList: menuIdList
})
} else {
products.push({
productId: itm.productId,
functionIds: functionIdList,
functionValue: list,
menuIds: menuIdList
})
}
})
if (this.roleType) {
return {
accounttypeId: item.accounttypeId,
productList
}
} else {
return {
accounttypeId: item.accounttypeId,
products
}
}
})
return this.accountTypes
}
},
mounted() {
// this.accountTypeSearchRequest();
// this.findPermissionsByMerId()
}
}
</script>
<style scoped lang="scss">
.account-body {
padding: 20px;
margin-bottom: 50px;
padding-top: 20px;
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
}
.account-title {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
margin-bottom: 30px;
}
.account-select-pro {
padding-left: 30px;
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
display: flex;
flex-wrap: wrap;
label {
margin-right: 20px;
}
}
.account-select-menu {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
margin-top: 20px;
}
.menu-box {
margin-top: 10px;
background: #f4f6fc;
border-radius: 4px;
padding: 10px;
.tab-item {
width: 180px;
background: #ffffff;
border-radius: 4px 0px 0px 0px;
border: 1px solid #f4f6fc;
font-size: 14px;
line-height: 14px;
font-weight: 400;
color: #37383a;
text-align: center;
padding: 12px 0px;
cursor: pointer;
&.select-checked {
color: #322ad9;
// font-weight: 700;
border-bottom: none;
}
}
.menu-box-tab {
display: flex;
}
.menu-box-tree {
background: #ffffff;
}
}
}
.nodata {
position: absolute;
top: 50%;
left: 50%;
text-align: center;
transform: translate(-50%, -50%);
img {
width: 64px;
height: 41px;
margin-bottom: 12px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'"> <el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'">
<el-input disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input> <el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色名称" prop="roleName"> <el-form-item label="角色名称" prop="roleName">
<el-input style="width: 40%" v-model="ruleForm.roleName"></el-input> <el-input size="small" style="width: 40%" v-model="ruleForm.roleName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色说明" prop="roleDesc"> <el-form-item label="角色说明" prop="roleDesc">
<el-input style="width: 40%" v-model="ruleForm.roleDesc"></el-input> <el-input size="small" style="width: 40%" v-model="ruleForm.roleDesc"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色权限" prop="roleRoot"> <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element"> <div class="custom_element">
...@@ -32,7 +32,10 @@ ...@@ -32,7 +32,10 @@
<SelectProduct ref="productFrom" :roleType="true" title=""></SelectProduct> <SelectProduct ref="productFrom" :roleType="true" title=""></SelectProduct>
</div> </div>
<div style="height: 84px"></div> <div style="height: 84px"></div>
<div class="fixed_bottom"> <div class="fixed_bottom" :style="{
left: footerLeft + 'px',
width: footerWidth + 'px',
}">
<el-button v-if="pageType == 'create'" type="primary" @click="toCreateRole(1)">草稿</el-button> <el-button v-if="pageType == 'create'" type="primary" @click="toCreateRole(1)">草稿</el-button>
<div class="wrap_driver"> <div class="wrap_driver">
<el-button type="primary" @click="toCreateRole(0)">确定</el-button> <el-button type="primary" @click="toCreateRole(0)">确定</el-button>
...@@ -91,6 +94,10 @@ export default { ...@@ -91,6 +94,10 @@ export default {
const { session } = this.$globalState const { session } = this.$globalState
this.accountLevel = session.accountLevel this.accountLevel = session.accountLevel
}, },
mounted(){
this.footerLeft = document.querySelector(".base-container-right").offsetLeft;
this.footerWidth = document.documentElement.clientWidth - this.footerLeft;
},
methods: { methods: {
// 获取角色信息 // 获取角色信息
getRoleData(id) { getRoleData(id) {
...@@ -235,17 +242,15 @@ export default { ...@@ -235,17 +242,15 @@ export default {
} }
.fixed_bottom { .fixed_bottom {
position: fixed; position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 60px);
width: 100%; width: 100%;
bottom: 0px;
height: 64px; height: 64px;
background: #ffffff;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 20; background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
.wrap_driver { .wrap_driver {
margin: 0 40px; margin: 0 40px;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!