角色数据权限联调

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/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
host = 'http://192.168.31.51:9000/'// 榕
// host = 'http://192.168.31.137:9000/'// 赓
// host = 'http://192.168.31.51:9000/'// 榕
host = 'http://192.168.31.116:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
}

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

@ -96,7 +96,9 @@
</el-select>
</el-form-item>
<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-col>
@ -451,7 +453,8 @@ export default {
checkedKeyword: '',
checkeds: [],
checkedAll: [],
checkAll: false
checkAll: false,
suppliers: []
};
},
watch: {
@ -487,6 +490,7 @@ export default {
mounted() {
this.getSubject()
this.getConfig()
this.getSupplier()
this.form.cid && this.getInfoData()
},
methods: {
@ -512,6 +516,12 @@ export default {
}).catch(err => {
});
},
//
getSupplier() {
this.$get(this.api.getSupplierListByRole).then(res => {
this.suppliers = res.supplierList
}).catch(res => {})
},
getSubject() { //
this.$get(this.api.courseDiscipline).then(res => {
this.subjectList = res.list;

@ -62,7 +62,9 @@
</el-input>
</el-form-item>
<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 label="结算方式" prop="settlementMethod" style="width: 800px">
<div class="settlement" style="align-items: center">
@ -226,6 +228,7 @@ export default {
previewHead: [],
previewData: [],
submited: false,
suppliers: []
};
},
watch: {
@ -254,6 +257,7 @@ export default {
},
mounted() {
this.getData()
this.getSupplier()
},
methods: {
//
@ -275,6 +279,12 @@ export default {
this.page = 1
this.getData()
},
//
getSupplier() {
this.$get(this.api.getSupplierListByRole).then(res => {
this.suppliers = res.supplierList
}).catch(res => {})
},
//
getTable(n,isConcat){
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] }}
</template>
</el-table-column>
<el-table-column prop="systemName" label="供应商" align="center"></el-table-column>
<el-table-column prop="belong" label="系统归属" align="center">
<template slot-scope="scope">
{{ systemBelongKeys[scope.row.belong] }}

@ -32,7 +32,7 @@
</div>
<el-timeline class="timeline">
<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>
{{ item.versionName + (item.draft ? '(草稿)' : '') }}

@ -53,6 +53,10 @@
:default-expanded-keys="checkedIds"
:default-checked-keys="checkedIds"
: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>
</div>
</el-form-item>
@ -62,6 +66,18 @@
<el-button type="primary" @click="saveData"> </el-button>
</span>
</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>
</template>
@ -91,7 +107,12 @@ export default {
roleVisible: false,
permissions: [],
checkedIds: [],
roleNameReapeat: false //
roleNameReapeat: false, //
datas: ['客户管理', '订单管理', '课程管理', '服务配置'], //
dataVisible: false,
suppliers: [],
dataCheckAll: false,
curData: {}
};
},
watch: {
@ -205,6 +226,32 @@ export default {
this.permissions.length && this.$refs.per.setCheckedNodes([]);
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) {
let result = data;
@ -238,33 +285,57 @@ export default {
this.roleVisible = true;
},
async saveData() {
if (!this.form.roleName) return this.$message.warning("请填写角色名称");
if (!this.form.remark) return this.$message.warning("请填写角色描述");
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限");
const { form } = this
if (!form.roleName) 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 = {
...this.form,
permissionId,
dataPermissionList: ids,
platformId: Setting.platformId,
};
if (this.form.id) {
debugger
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("修改成功");
this.$message.success(form.id ? "修改成功" : "新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
} else {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
}
}
}
};
</script>
<style lang="scss" scoped>
.data {
margin-left: 50px;
&:hover {
color: #9076FF;
}
}
.data-dia {
.title {
margin-bottom: 10px;
}
}
</style>
Loading…
Cancel
Save