diff --git a/src/setting.js b/src/setting.js index 2518636..8ecc39f 100644 --- a/src/setting.js +++ b/src/setting.js @@ -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/' } diff --git a/src/utils/api.js b/src/utils/api.js index 231096a..d4240dc 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -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`, diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index 0645255..a5f3913 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -96,7 +96,9 @@ - + + + @@ -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; diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index 7c94ae3..e9d44fe 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -62,7 +62,9 @@ - + + +
@@ -226,6 +228,7 @@ export default { previewHead: [], previewData: [], submited: false, + suppliers: [] }; }, watch: { @@ -253,7 +256,8 @@ export default { } }, mounted() { - this.getData() + 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 => { diff --git a/src/views/serve/Configure.vue b/src/views/serve/Configure.vue index 0f43830..d93318e 100644 --- a/src/views/serve/Configure.vue +++ b/src/views/serve/Configure.vue @@ -54,6 +54,7 @@ {{ systemTypeKeys[scope.row.type] }} + @@ -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("请选择角色权限"); - // 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 - let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; - let data = { - ...this.form, - permissionId, - platformId: Setting.platformId, - }; - if (this.form.id) { - this.$post(this.api.saveOrUpdate, data).then(res => { - this.$message.success("修改成功"); - this.getData(); - this.roleVisible = false; - }).catch(res => {}); + 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("请选择角色权限"); + // 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 + 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 { - this.$post(this.api.saveOrUpdate, data).then(res => { - this.$message.success("新增成功"); - this.getData(); - this.roleVisible = false; - }).catch(res => {}); + ids.push({ + permissionId: e.id, + roleId + }) } + }) + console.log("🚀 ~ file: role.vue ~ line 296 ~ saveData ~ checks", checks, ids) + let data = { + ...this.form, + dataPermissionList: ids, + platformId: Setting.platformId, + }; + debugger + this.$post(this.api.saveOrUpdate, data).then(res => { + this.$message.success(form.id ? "修改成功" : "新增成功"); + this.getData(); + this.roleVisible = false; + }).catch(res => {}); } } }; \ No newline at end of file