角色数据权限联调

fixAuth
yujialong 2 years ago
parent e3473f4cb9
commit 5b5c1cd57e
  1. 4
      src/setting.js
  2. 2
      src/utils/api.js
  3. 14
      src/views/course/AddCurriculum.vue
  4. 12
      src/views/data/Product.vue
  5. 1
      src/views/serve/Configure.vue
  6. 2
      src/views/system/manageLog.vue
  7. 103
      src/views/system/role.vue

@ -11,8 +11,8 @@ if (isDev) {
jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统 jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // host = 'https://huorantech.cn/'
host = 'http://192.168.31.51:9000/'// 榕 // host = 'http://192.168.31.51:9000/'// 榕
// host = 'http://192.168.31.137:9000/'// 赓 host = 'http://192.168.31.116:9000/'// 赓
} else if (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
} }

@ -260,6 +260,8 @@ export default {
obtainDetails: `users/users/role/obtainDetails`, //获取角色详情 obtainDetails: `users/users/role/obtainDetails`, //获取角色详情
saveOrUpdate: `users/users/role/saveOrUpdate`, //新增或更新角色 saveOrUpdate: `users/users/role/saveOrUpdate`, //新增或更新角色
queryAllMenus: `users/users/permission/queryAllMenus`, //查询所有菜单 queryAllMenus: `users/users/permission/queryAllMenus`, //查询所有菜单
getSupplierList: `users/users/supplier/getSupplierList`,
getSupplierListByRole: `users/users/supplier/getSupplierListByRole`,
// 日志管理 // 日志管理
logAdd: `nakadai/nakadai/log/add`, logAdd: `nakadai/nakadai/log/add`,

@ -96,7 +96,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="供应厂商" prop="supplier"> <el-form-item label="供应厂商" prop="supplier">
<el-input placeholder="请输入供应厂商" v-model.trim="form.supplier"></el-input> <el-select v-model="form.supplier" clearable placeholder="请选择供应厂商">
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -451,7 +453,8 @@ export default {
checkedKeyword: '', checkedKeyword: '',
checkeds: [], checkeds: [],
checkedAll: [], checkedAll: [],
checkAll: false checkAll: false,
suppliers: []
}; };
}, },
watch: { watch: {
@ -487,6 +490,7 @@ export default {
mounted() { mounted() {
this.getSubject() this.getSubject()
this.getConfig() this.getConfig()
this.getSupplier()
this.form.cid && this.getInfoData() this.form.cid && this.getInfoData()
}, },
methods: { methods: {
@ -512,6 +516,12 @@ export default {
}).catch(err => { }).catch(err => {
}); });
}, },
//
getSupplier() {
this.$get(this.api.getSupplierListByRole).then(res => {
this.suppliers = res.supplierList
}).catch(res => {})
},
getSubject() { // getSubject() { //
this.$get(this.api.courseDiscipline).then(res => { this.$get(this.api.courseDiscipline).then(res => {
this.subjectList = res.list; this.subjectList = res.list;

@ -62,7 +62,9 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="供应厂商" prop="supplier"> <el-form-item label="供应厂商" prop="supplier">
<el-input placeholder="请输入供应厂商" v-model.trim="supplier"></el-input> <el-select v-model="supplier" clearable placeholder="请选择供应厂商">
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="结算方式" prop="settlementMethod" style="width: 800px"> <el-form-item label="结算方式" prop="settlementMethod" style="width: 800px">
<div class="settlement" style="align-items: center"> <div class="settlement" style="align-items: center">
@ -226,6 +228,7 @@ export default {
previewHead: [], previewHead: [],
previewData: [], previewData: [],
submited: false, submited: false,
suppliers: []
}; };
}, },
watch: { watch: {
@ -254,6 +257,7 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
this.getSupplier()
}, },
methods: { methods: {
// //
@ -275,6 +279,12 @@ export default {
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
//
getSupplier() {
this.$get(this.api.getSupplierListByRole).then(res => {
this.suppliers = res.supplierList
}).catch(res => {})
},
// //
getTable(n,isConcat){ getTable(n,isConcat){
this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=${n.typePage}&pageSize=${this.typeUnit}&updateTime=`).then(res => { this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=${n.typePage}&pageSize=${this.typeUnit}&updateTime=`).then(res => {

@ -54,6 +54,7 @@
{{ systemTypeKeys[scope.row.type] }} {{ systemTypeKeys[scope.row.type] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="systemName" label="供应商" align="center"></el-table-column>
<el-table-column prop="belong" label="系统归属" align="center"> <el-table-column prop="belong" label="系统归属" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ systemBelongKeys[scope.row.belong] }} {{ systemBelongKeys[scope.row.belong] }}

@ -32,7 +32,7 @@
</div> </div>
<el-timeline class="timeline"> <el-timeline class="timeline">
<el-timeline-item placement="top" v-for="(item, i) in listData" :key="i" :class="['item' + i, {draft: item.draft}]"> <el-timeline-item placement="top" v-for="(item, i) in listData" :key="i" :class="['item' + i, {draft: item.draft}]">
<p class="sign">{{ item.draft ? '未发布' : item.createTime }}</p> <p class="sign">{{ item.draft ? '未发布' : item.draftTime }}</p>
<div class="ver"> <div class="ver">
<div> <div>
{{ item.versionName + (item.draft ? '(草稿)' : '') }} {{ item.versionName + (item.draft ? '(草稿)' : '') }}

@ -53,6 +53,10 @@
:default-expanded-keys="checkedIds" :default-expanded-keys="checkedIds"
:default-checked-keys="checkedIds" :default-checked-keys="checkedIds"
:props="defaultProps"> :props="defaultProps">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span v-if="datas.includes(node.label)" class="data" @click.stop="showData(data)">数据权限</span>
</span>
</el-tree> </el-tree>
</div> </div>
</el-form-item> </el-form-item>
@ -62,6 +66,18 @@
<el-button type="primary" @click="saveData"> </el-button> <el-button type="primary" @click="saveData"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="数据权限设置" :visible.sync="dataVisible" width="500px" class="data-dia" :close-on-click-modal="false">
<p class="title">请选择要关联的供应商系统</p>
<div class="checks">
<el-checkbox v-model="dataCheckAll" @change="checkAll">全部</el-checkbox>
<el-checkbox v-for="(item, i) in suppliers" :key="i" v-model="item.check">{{ item.supplierName }}</el-checkbox>
</div>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="dataVisible = false"> </el-button>
<el-button type="primary" @click="dataSubmit"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
@ -91,7 +107,12 @@ export default {
roleVisible: false, roleVisible: false,
permissions: [], permissions: [],
checkedIds: [], checkedIds: [],
roleNameReapeat: false // roleNameReapeat: false, //
datas: ['客户管理', '订单管理', '课程管理', '服务配置'], //
dataVisible: false,
suppliers: [],
dataCheckAll: false,
curData: {}
}; };
}, },
watch: { watch: {
@ -205,6 +226,32 @@ export default {
this.permissions.length && this.$refs.per.setCheckedNodes([]); this.permissions.length && this.$refs.per.setCheckedNodes([]);
this.roleVisible = true; this.roleVisible = true;
}, },
//
checkAll(val) {
this.suppliers.map(e => e.check = val)
},
//
showData(data) {
this.curData = data
this.dataVisible = true
this.$get(this.api.getSupplierList).then(res => {
const list = res.supplierList
const ids = data.supplierIds
list.map(e => e.check = ids ? ids.includes(e.supplierId) : false)
this.suppliers = list
this.dataCheckAll = !list.find(e => !e.check)
console.log("🚀 ~ file: role.vue ~ line 235 ~ showData ~ data", data)
}).catch(res => {})
},
//
dataSubmit() {
const { id } = this.curData
this.permissions[0].children.map(e => {
// id
if (e.id == id) e.supplierIds = this.suppliers.filter(e => e.check).map(e => e.supplierId)
})
this.dataVisible = false
},
// //
handleRolePer(data, permissions) { handleRolePer(data, permissions) {
let result = data; let result = data;
@ -238,33 +285,57 @@ export default {
this.roleVisible = true; this.roleVisible = true;
}, },
async saveData() { async saveData() {
if (!this.form.roleName) return this.$message.warning("请填写角色名称"); const { form } = this
if (!this.form.remark) return this.$message.warning("请填写角色描述"); if (!form.roleName) return this.$message.warning("请填写角色名称");
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限"); if (!form.remark) return this.$message.warning("请填写角色描述");
const tree = this.$refs.per
if (!tree.getCheckedKeys().length) return this.$message.warning("请选择角色权限");
// ,(), // ,(),
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; const checks = [...this.$refs.per.getHalfCheckedNodes(), ...this.$refs.per.getCheckedNodes()];
const ids = []
const roleId = form.id
checks.map(e => {
if (e.supplierIds) {
e.supplierIds.map(n => {
ids.push({
permissionId: e.id,
roleId,
supplierId: n
})
})
} else {
ids.push({
permissionId: e.id,
roleId
})
}
})
console.log("🚀 ~ file: role.vue ~ line 296 ~ saveData ~ checks", checks, ids)
let data = { let data = {
...this.form, ...this.form,
permissionId, dataPermissionList: ids,
platformId: Setting.platformId, platformId: Setting.platformId,
}; };
if (this.form.id) { debugger
this.$post(this.api.saveOrUpdate, data).then(res => { this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("修改成功"); this.$message.success(form.id ? "修改成功" : "新增成功");
this.getData(); this.getData();
this.roleVisible = false; this.roleVisible = false;
}).catch(res => {}); }).catch(res => {});
} else {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
}
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.data {
margin-left: 50px;
&:hover {
color: #9076FF;
}
}
.data-dia {
.title {
margin-bottom: 10px;
}
}
</style> </style>
Loading…
Cancel
Save