| | |
| | | |
| | | <script> |
| | | // import codeMixin from "@/components/makepager/mixin/codeMixin" |
| | | import { addRole, updateRole, getDataRole } from "@/api/unifiedManage/userLevel" |
| | | export default { |
| | | name: "AddUserLevel", |
| | | // mixins: [codeMixin], |
| | |
| | | title: "新建", |
| | | infomation: {} |
| | | } |
| | | } |
| | | }, |
| | | editRow: { |
| | | type: Object, |
| | | default: () => { |
| | | return {} |
| | | } |
| | | } |
| | | }, |
| | |
| | | watch: { |
| | | "editCommonConfig.visible"(val) { |
| | | if (val) { |
| | | console.log(val, "sssssss") |
| | | this.isOpen = val |
| | | this.$refs.form.resetFields() |
| | | this.getDataInfo() |
| | | } |
| | | }, |
| | | "editCommonConfig.infomation"(val) { |
| | | if (this.isopen) { |
| | | this.$refs.form.resetFields() |
| | | if (val.id) { |
| | | this.getDataInfo(val) |
| | | } |
| | | } |
| | | console.log(val, "aaaa") |
| | | // if (this.isopen) { |
| | | // this.$refs.form.resetFields() |
| | | // if (val.id) { |
| | | // this.getDataInfo(val) |
| | | // } |
| | | // } |
| | | } |
| | | }, |
| | | created() { |
| | | this.getDataInfo() |
| | | console.log(this.editConfig.infomation, "sdddd") |
| | | this.getDataInfo(this.editConfig.infomation) |
| | | }, |
| | | methods: { |
| | | handleClose() { |
| | |
| | | }, |
| | | // 获取参考角色 页面权限 菜单 的数据 |
| | | async getDataInfo(val) { |
| | | console.log(val) |
| | | // const rsp = await getDataRole({ useType: 1 }) |
| | | // if (rsp.code == 200) { |
| | | // // 参考角色 |
| | | // this.prepareRoleList = rsp.data.roles ? rsp.data.roles : [] |
| | | // this.menusList = rsp.data.menus ? rsp.data.menus : [] |
| | | // // 页面权限 |
| | | // this.completeList = rsp.data.subsystems ? rsp.data.subsystems : [] |
| | | // this.form.completeType = this.completeList.length > 0 ? this.completeList[0].systemType : 1 |
| | | // } |
| | | // if (this.isopen) { |
| | | // this.resetForm(val) |
| | | // } |
| | | const rsp = await getDataRole({ useType: 2 }) |
| | | if (rsp.code == 200) { |
| | | // 参考角色 |
| | | this.prepareRoleList = rsp.data.roles ? rsp.data.roles : [] |
| | | this.menusList = rsp.data.menus ? rsp.data.menus : [] |
| | | // 页面权限 |
| | | this.completeList = rsp.data.subsystems ? rsp.data.subsystems : [] |
| | | this.form.completeType = this.completeList.length > 0 ? this.completeList[0].systemType : 1 |
| | | } |
| | | if (this.editConfig.visible) { |
| | | this.resetForm(val) |
| | | } |
| | | }, |
| | | getMenuCheck(val) { |
| | | if (val && val.length > 0) { |
| | |
| | | this.completeList.length > 0 && this.completeList[0].systemType ? this.completeList[0].systemType : 1 |
| | | if (this.form.menuIDs && this.form.menuIDs.length > 0) { |
| | | for (let i in this.menusList) { |
| | | this.$refs["menuTree&" + this.menusList[i].systemType][0].setCheckedKeys(this.form.allMenu.split(",")) |
| | | console.log(this.$refs["menuTree&" + this.menusList[i].systemType]) |
| | | // this.$refs["menuTree&" + this.menusList[i].systemType][0].setCheckedKeys(this.form.allMenu.split(",")) |
| | | } |
| | | } |
| | | } else { |
| | | console.log(this.menusList) |
| | | for (let i in this.menusList) { |
| | | this.$refs["menuTree&" + this.menusList[i].systemType][0].setCheckedKeys([]) |
| | | console.log(this.$refs["menuTree&" + this.menusList[i]?.systemType]) |
| | | // this.$refs["menuTree&" + this.menusList[i]?.systemType][0].setCheckedKeys([]) |
| | | } |
| | | } |
| | | }, |
| | | imgClick(item) { |
| | | imgClick(item, index) { |
| | | console.log(index) |
| | | this.form.completeType = item.systemType |
| | | this.$forceUpdate() |
| | | }, |
| | |
| | | this.$refs[formName].validate((valid) => { |
| | | console.log(valid) |
| | | if (valid) { |
| | | // let submitFn = this.editRow.id ? updateRole : addRole |
| | | // let param = this.saveParams() |
| | | // submitFn(param).then((reply) => { |
| | | // if (reply && reply.code === 200) { |
| | | // this.$message.success("保存成功") |
| | | // this.$emit("shutdown", false) |
| | | // } |
| | | // }) |
| | | let submitFn = this.editRow.id ? updateRole : addRole |
| | | let param = this.saveParams() |
| | | submitFn(param).then((reply) => { |
| | | if (reply && reply.code === 200) { |
| | | this.$message.success("保存成功") |
| | | this.$emit("shutdown", false) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | id: this.editRow.id, |
| | | comment: data.comment || "", |
| | | name: data.name || "", |
| | | useType: 1 |
| | | useType: 2 |
| | | }, |
| | | menuIDs: menuIds |
| | | } |
| | | return params |
| | | }, |
| | | shutdown() { |
| | | this.$emit("shutdown", false) |
| | | } |
| | | } |
| | | } |