From 5b5c1cd57e68a9a1020718991019e1070508c0be Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 20 Oct 2022 10:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setting.js | 4 +- src/utils/api.js | 2 + src/views/course/AddCurriculum.vue | 14 ++- src/views/data/Product.vue | 14 ++- src/views/serve/Configure.vue | 1 + src/views/system/manageLog.vue | 2 +- src/views/system/role.vue | 133 ++++++++++++++++++++++------- 7 files changed, 132 insertions(+), 38 deletions(-) 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] }} + {{ systemBelongKeys[scope.row.belong] }} diff --git a/src/views/system/manageLog.vue b/src/views/system/manageLog.vue index 74144c1..d7c6e01 100644 --- a/src/views/system/manageLog.vue +++ b/src/views/system/manageLog.vue @@ -32,7 +32,7 @@ - {{ item.draft ? '未发布' : item.createTime }} + {{ item.draft ? '未发布' : item.draftTime }} {{ item.versionName + (item.draft ? '(草稿)' : '') }} diff --git a/src/views/system/role.vue b/src/views/system/role.vue index 85c979a..e3cee05 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -45,14 +45,18 @@ + ref="per" + :data="permissions" + show-checkbox + default-expand-all + node-key="id" + :default-expanded-keys="checkedIds" + :default-checked-keys="checkedIds" + :props="defaultProps"> + + {{ node.label }} + 数据权限 + @@ -62,6 +66,18 @@ 确 定 + + + 请选择要关联的供应商系统 + + 全部 + {{ item.supplierName }} + + + 取 消 + 确 定 + + @@ -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
{{ item.draft ? '未发布' : item.createTime }}
{{ item.draft ? '未发布' : item.draftTime }}
请选择要关联的供应商系统