|
@@ -9,18 +9,18 @@
|
|
|
</div>
|
|
|
<div class="permissionList_tree_body">
|
|
|
<el-scrollbar style="height: 100%" :horizontal="false">
|
|
|
- <el-tree ref="tree" :data="data" show-checkbox node-key="pageconfigurationid" default-expand-all :expand-on-click-node="false" @check="checkChange">
|
|
|
+ <el-tree ref="tree" :data="data" show-checkbox node-key="apiid" default-expand-all :expand-on-click-node="false" @check="checkChange">
|
|
|
<template slot-scope="{node,data}">
|
|
|
<div class="custom-tree-node flex">
|
|
|
- <div class="custom-tree-node-list">{{data.pagename}}</div>
|
|
|
- <div class="custom-tree-node-list">{{data.pagetype}}</div>
|
|
|
+ <div class="custom-tree-node-list">{{data.apiname}}</div>
|
|
|
+ <div class="custom-tree-node-list">{{data.apitype}}</div>
|
|
|
<div class="custom-tree-node-list">
|
|
|
<el-tooltip class="item" effect="dark" :content="data.filterset" placement="top">
|
|
|
<div class="tmsg">{{ data.filterset }}</div>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
<div class="custom-tree-node-list">
|
|
|
- <template v-if="data.pagetype == 'table'">
|
|
|
+ <template v-if="data.apitype != '参数'">
|
|
|
<el-button size="mini" type="text" @click="details(node, data)">行权限</el-button>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -71,7 +71,7 @@ export default {
|
|
|
label: 'pagename'
|
|
|
},
|
|
|
defaultKeys: [],
|
|
|
- nodeKey: 'pageconfigurationid',
|
|
|
+ nodeKey: 'apiid',
|
|
|
adDep: 1,
|
|
|
dataKey: 'pagename',
|
|
|
checkDatas: [],
|
|
@@ -79,7 +79,7 @@ export default {
|
|
|
tableKey: '',
|
|
|
rowData: {},
|
|
|
selectOptions: [],
|
|
|
- queryId: 6,
|
|
|
+ queryId: 9,
|
|
|
allAuthData: [],
|
|
|
}
|
|
|
},
|
|
@@ -112,7 +112,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async queryAllAuthData (serviceid, pagename) {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
const datacontent = { filter: { 1: 1 } }
|
|
|
try {
|
|
|
const { code, returnData } = await Query({
|
|
@@ -123,6 +123,10 @@ export default {
|
|
|
size: 9999,
|
|
|
});
|
|
|
if (code == 0 && returnData?.length) {
|
|
|
+ returnData.forEach(item => {
|
|
|
+ item.pagename = item.apiname
|
|
|
+ item.pagecode = item.apiid
|
|
|
+ })
|
|
|
this.allAuthData = _.cloneDeep(returnData)
|
|
|
this.setAuthData([], returnData)
|
|
|
} else {
|
|
@@ -141,7 +145,7 @@ export default {
|
|
|
if (nodata?.length) {
|
|
|
alldata.map(item => {
|
|
|
nodata.map(ci => {
|
|
|
- if (item.pageconfigurationid == ci.pageconfigurationid) {
|
|
|
+ if (item.apiid == ci.apiid) {
|
|
|
item.disabled = true
|
|
|
}
|
|
|
})
|
|
@@ -161,25 +165,16 @@ export default {
|
|
|
},
|
|
|
getAdvancedQueryData (dataRules) {
|
|
|
const ndata = this.checkDatas?.at(-1)
|
|
|
- const nitem = ndata.filter(item => item.pageconfigurationid == this.rowData.pageconfigurationid)
|
|
|
- const { id, supergroupid, type } = this.queryItem
|
|
|
- const { pageconfigurationid, serviceid, selectcolumnlist = '', insetcolumnlist = '', updatecolumnlist = '', filterset = '' } = nitem[0]
|
|
|
+ const nitem = ndata.filter(item => item.apiid == this.rowData.apiid)
|
|
|
+ const { appid } = this.queryItem
|
|
|
+ const { apiid, columnlist = '', filterset = '' } = nitem[0]
|
|
|
const rowData = {
|
|
|
- pageconfigurationid,
|
|
|
- serviceid,
|
|
|
- selectcolumnlist,
|
|
|
- insetcolumnlist,
|
|
|
- updatecolumnlist,
|
|
|
+ appid,
|
|
|
+ apiid,
|
|
|
+ columnlist,
|
|
|
filterset
|
|
|
}
|
|
|
rowData.filterset = JSON.stringify(dataRules)
|
|
|
- if (type == 1) {
|
|
|
- rowData.userid = id
|
|
|
- this.queryId = 7
|
|
|
- } else {
|
|
|
- rowData.usergroupid = id
|
|
|
- this.queryId = 6
|
|
|
- }
|
|
|
this.sendCheckData('edit', [rowData])
|
|
|
this.advancedDrawer = false
|
|
|
},
|
|
@@ -215,30 +210,35 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const ndata = _.cloneDeep(data)
|
|
|
- const { pageconfigurationid } = ndata
|
|
|
- const nitem = this.checkDatas?.at(-1).filter(item => item.pageconfigurationid == pageconfigurationid)
|
|
|
+ const { apiid } = ndata
|
|
|
+ const nitem = this.checkDatas?.at(-1).filter(item => item.apiid == apiid)
|
|
|
if (!nitem.length) {
|
|
|
this.$message.error('请先勾选权限后再操作')
|
|
|
return
|
|
|
}
|
|
|
this.adDep = Math.random()
|
|
|
this.rowData = ndata
|
|
|
- sessionStorage.setItem('tableColumns', JSON.stringify({ tableKey: pageconfigurationid, tableValues: ndata.children }))
|
|
|
- this.$store.dispatch('auth/changeAuthMsg', ndata.children)
|
|
|
+ const rowDataChild = _.cloneDeep(ndata.children)
|
|
|
+ rowDataChild.forEach(item => {
|
|
|
+ item.isfiltercolumn = true
|
|
|
+ item.pagename = item.apiname
|
|
|
+ item.pagecode = item.apiid
|
|
|
+ })
|
|
|
+ this.$store.dispatch('auth/changeAuthMsg', rowDataChild)
|
|
|
if (data.selectcolumnmsg) {
|
|
|
this.selectOptions = JSON.parse(data.selectcolumnmsg)
|
|
|
}
|
|
|
this.advancedDrawer = true
|
|
|
},
|
|
|
//初始化数据
|
|
|
- setAuthData (arrs = [], returnData = []) {
|
|
|
+ setAuthData (arrs = [], returnData = [], flag = false) {
|
|
|
const narrs = _.cloneDeep(arrs)
|
|
|
const ndata = _.cloneDeep(returnData)
|
|
|
if (narrs.length) {
|
|
|
ndata.map(item => {
|
|
|
narrs.map(ci => {
|
|
|
- if (item.pageconfigurationid == ci.pageconfigurationid && ci.filterset) {
|
|
|
- const tableColumnArrs = ndata.filter(item => item['superiorid'] == ci.pageconfigurationid && item['pagetype'] == 'column')
|
|
|
+ if (item.apiid == ci.apiid && ci.filterset) {
|
|
|
+ const tableColumnArrs = ndata.filter(item => item['superiorid'] == ci.apiid)
|
|
|
const htmls = this.formatRowAuth(ci.filterset, tableColumnArrs)
|
|
|
item.selectcolumnmsg = ci.filterset
|
|
|
item.filterset = htmls.join('')
|
|
@@ -247,7 +247,7 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
const alldata = this.disableTreeData(ndata)
|
|
|
- const treeMenu = listToTree([...alldata], 'superiorid', 'pageconfigurationid')
|
|
|
+ const treeMenu = flag ? listToTree([...ndata], 'superiorid', 'apiid') : listToTree([...alldata], 'superiorid', 'apiid')
|
|
|
this.data = treeMenu
|
|
|
},
|
|
|
//勾选已有权限
|
|
@@ -255,16 +255,16 @@ export default {
|
|
|
const returnData = _.cloneDeep(ndata)
|
|
|
if (ndata?.length) {
|
|
|
const ids = []
|
|
|
- ndata.map(({ pageconfigurationid }) => {
|
|
|
- ids.push(pageconfigurationid)
|
|
|
+ ndata.map(({ apiid }) => {
|
|
|
+ ids.push(apiid)
|
|
|
})
|
|
|
this.$refs.tree.setCheckedKeys(ids)
|
|
|
const treeDatas = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
|
|
|
const res = this.findRepetData(treeDatas, returnData)
|
|
|
if (res?.length) {
|
|
|
res.map((item) => {
|
|
|
- if (item.pageconfigurationid) {
|
|
|
- this.$refs.tree.setChecked(item.pageconfigurationid, false, false);
|
|
|
+ if (item.apiid) {
|
|
|
+ this.$refs.tree.setChecked(item.apiid, false, false);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -273,12 +273,21 @@ export default {
|
|
|
},
|
|
|
//获取当前用户组/用户已有权限
|
|
|
async queryTreeData (dataContent, pagename) {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
try {
|
|
|
- const { code, returnData } = await getAuthorization({ datacontent: dataContent });
|
|
|
+ const { appid } = dataContent
|
|
|
+ const { code, returnData } = await Query({
|
|
|
+ serviceid: 9,
|
|
|
+ datacontent: {
|
|
|
+ appid
|
|
|
+ },
|
|
|
+ event: '0',
|
|
|
+ page: 1,
|
|
|
+ size: 9999,
|
|
|
+ });
|
|
|
if (code == 0) {
|
|
|
const ndata = _.cloneDeep(returnData)
|
|
|
- this.setAuthData(ndata, this.allAuthData)
|
|
|
+ this.setAuthData(ndata, this.allAuthData, true)
|
|
|
this.$nextTick(() => {
|
|
|
this.checkAuthData(ndata)
|
|
|
})
|
|
@@ -286,6 +295,7 @@ export default {
|
|
|
this.$message.error(`获取${pagename}数据失败`);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
+ console.log(error)
|
|
|
this.$message.error(`获取${pagename}数据失败`);
|
|
|
}
|
|
|
this.loading = false;
|
|
@@ -318,7 +328,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
findRepetData (nitems1, nitems2) {
|
|
|
- const key = 'pageconfigurationid'
|
|
|
+ const key = 'apiid'
|
|
|
const res = [...nitems1, ...nitems2].filter(
|
|
|
(item) =>
|
|
|
!(
|
|
@@ -333,7 +343,7 @@ export default {
|
|
|
const event = types == 'add' ? 1 : types == 'edit' ? 2 : 3
|
|
|
const querys = []
|
|
|
const items = _.cloneDeep(data)
|
|
|
- const { id, type } = this.queryItem
|
|
|
+ const { appid, type } = this.queryItem
|
|
|
if (types == 'edit') {
|
|
|
items.map(item => {
|
|
|
if (item.children) delete item.children
|
|
@@ -343,7 +353,7 @@ export default {
|
|
|
datacontent: [
|
|
|
{
|
|
|
filter: {
|
|
|
- pageconfigurationid: items[0].pageconfigurationid
|
|
|
+ apiid: items[0].apiid
|
|
|
},
|
|
|
value: items[0]
|
|
|
}
|
|
@@ -353,18 +363,22 @@ export default {
|
|
|
type == 1 ? params.datacontent[0].filter.userid = items[0].userid : params.datacontent[0].filter.usergroupid = items[0].usergroupid
|
|
|
querys.push(modifyData(params))
|
|
|
} else {
|
|
|
- const ids = []
|
|
|
items.map(item => {
|
|
|
if (item.children) delete item.children
|
|
|
- ids.push(item.pageconfigurationid)
|
|
|
+ const { apiid, applicationpermissionsid = null } = item
|
|
|
+ const params = {
|
|
|
+ serviceid: this.queryId,
|
|
|
+ datacontent: {
|
|
|
+ appid,
|
|
|
+ apiid,
|
|
|
+ applicationpermissionsid,
|
|
|
+ columnlist: null,
|
|
|
+ filterset: null
|
|
|
+ },
|
|
|
+ event
|
|
|
+ }
|
|
|
+ event == 1 ? querys.push(newData(params)) : querys.push(moveData(params))
|
|
|
})
|
|
|
- const params = {
|
|
|
- id,
|
|
|
- type,
|
|
|
- datacontent: ids,
|
|
|
- event
|
|
|
- }
|
|
|
- querys.push(authorization(params))
|
|
|
}
|
|
|
this.getAnscyData(querys, types)
|
|
|
},
|