| | |
| | | <template> |
| | | <basic-container |
| | | :class="[$store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '']" |
| | | :class="[ |
| | | $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize', |
| | | $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : '' |
| | | ]" |
| | | > |
| | | <avue-crud |
| | | class="tablesss" |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | |
| | | remove, |
| | | update, |
| | | getLazyMenuList, |
| | | getMenu, |
| | | getMenu |
| | | } from "@/api/system/menu"; |
| | | import { |
| | | addDataScope, |
| | | removeDataScope, |
| | | updateDataScope, |
| | | getListDataScope, |
| | | getMenuDataScope, |
| | | getMenuDataScope |
| | | } from "@/api/system/scope"; |
| | | import { mapGetters } from "vuex"; |
| | | import iconList from "@/config/iconList"; |
| | |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | ...this.$store.state.control.changePageSize, |
| | | ...this.$store.state.control.changePageSize |
| | | }, |
| | | drawerVisible: false, |
| | | direction: "rtl", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入菜单名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "路由地址", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入路由地址", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "上级菜单", |
| | |
| | | dicUrl: "/api/blade-system/menu/tree", |
| | | hide: true, |
| | | props: { |
| | | label: "title", |
| | | label: "title" |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请选择上级菜单", |
| | | trigger: "click", |
| | | }, |
| | | ], |
| | | trigger: "click" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "菜单图标", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入菜单图标", |
| | | trigger: "click", |
| | | }, |
| | | ], |
| | | trigger: "click" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "菜单编号", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入菜单编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "菜单类型", |
| | |
| | | dicData: [ |
| | | { |
| | | label: "菜单", |
| | | value: 1, |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "按钮", |
| | | value: 2, |
| | | }, |
| | | value: 2 |
| | | } |
| | | ], |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择菜单类型", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "菜单别名", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入菜单别名", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "按钮功能", |
| | |
| | | dicData: [ |
| | | { |
| | | label: "工具栏", |
| | | value: 0, |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "操作栏", |
| | | value: 1, |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "工具操作栏", |
| | | value: 2, |
| | | }, |
| | | value: 2 |
| | | } |
| | | ], |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择按钮功能", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "菜单排序", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入菜单排序", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "新窗口", |
| | |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: 0, |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1, |
| | | }, |
| | | value: 1 |
| | | } |
| | | ], |
| | | hide: true, |
| | | hide: true |
| | | }, |
| | | { |
| | | label: "菜单备注", |
| | |
| | | type: "textarea", |
| | | span: 24, |
| | | minRows: 6, |
| | | hide: true, |
| | | }, |
| | | ], |
| | | hide: true |
| | | } |
| | | ] |
| | | }, |
| | | data: [], |
| | | formScope: {}, |
| | |
| | | pageScope: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | total: 0 |
| | | }, |
| | | optionScope: { |
| | | tip: false, |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入数据权限名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "权限编号", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入数据权限编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "权限字段", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入数据权限编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "规则类型", |
| | |
| | | dicUrl: "/api/blade-system/dict/dictionary?code=data_scope_type", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | value: "dictKey" |
| | | }, |
| | | dataType: "number", |
| | | slot: true, |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入通知类型", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "可见字段", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入数据权限可见的字段", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "权限类名", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入MybatisMapper对应方法的完整类名路径", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "规则值", |
| | |
| | | minRows: 5, |
| | | type: "textarea", |
| | | display: true, |
| | | hide: true, |
| | | hide: true |
| | | }, |
| | | { |
| | | label: "备注", |
| | | prop: "remark", |
| | | span: 24, |
| | | hide: true, |
| | | }, |
| | | ], |
| | | hide: true |
| | | } |
| | | ] |
| | | }, |
| | | dataScope: [], |
| | | dataScope: [] |
| | | }; |
| | | }, |
| | | watch: { |
| | | "formScope.scopeType"() { |
| | | this.initScope(); |
| | | }, |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | |
| | | addBtn: this.vaildData(this.permission.menu_add, false), |
| | | viewBtn: this.vaildData(this.permission.menu_view, false), |
| | | delBtn: this.vaildData(this.permission.menu_delete, false), |
| | | editBtn: this.vaildData(this.permission.menu_edit, false), |
| | | editBtn: this.vaildData(this.permission.menu_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | scopeIds() { |
| | | let ids = []; |
| | | this.selectionListScope.forEach((ele) => { |
| | | this.selectionListScope.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | }, |
| | | methods: { |
| | | initScope() { |
| | |
| | | column = ""; |
| | | name = "自定义"; |
| | | } |
| | | this.$refs.crudScope.option.column.filter((item) => { |
| | | this.$refs.crudScope.option.column.filter(item => { |
| | | if (watchMode) { |
| | | if (item.prop === "scopeName") { |
| | | this.formScope.scopeName = `${this.scopeMenuName} [${name}]`; |
| | |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getMenu(this.form.id).then((res) => { |
| | | getMenu(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | getLazyMenuList(this.parentId, Object.assign(params, this.query)).then( |
| | | (res) => { |
| | | res => { |
| | | this.data = res.data.data; |
| | | this.loading = false; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | } |
| | | ); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | const parentId = tree.id; |
| | | getLazyMenuList(parentId).then((res) => { |
| | | getLazyMenuList(parentId).then(res => { |
| | | resolve(res.data.data); |
| | | }); |
| | | }, |
| | |
| | | rowSaveScope(row, done, loading) { |
| | | row = { |
| | | ...row, |
| | | menuId: this.scopeMenuId, |
| | | menuId: this.scopeMenuId |
| | | }; |
| | | addDataScope(row).then( |
| | | () => { |
| | | this.onLoadScope(this.pageScope); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | rowUpdateScope(row, index, done, loading) { |
| | | row = { |
| | | ...row, |
| | | menuId: this.scopeMenuId, |
| | | menuId: this.scopeMenuId |
| | | }; |
| | | updateDataScope(row).then( |
| | | () => { |
| | | this.onLoadScope(this.pageScope); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removeDataScope(row.id); |
| | |
| | | this.onLoadScope(this.pageScope); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removeDataScope(this.scopeIds); |
| | |
| | | this.onLoadScope(this.pageScope); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crudScope.toggleSelection(); |
| | | }); |
| | |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | this.watchMode = false; |
| | | getMenuDataScope(this.formScope.id).then((res) => { |
| | | getMenuDataScope(this.formScope.id).then(res => { |
| | | this.formScope = res.data.data; |
| | | }); |
| | | } |
| | |
| | | this.scopeLoading = true; |
| | | const values = { |
| | | ...params, |
| | | menuId: this.scopeMenuId, |
| | | menuId: this.scopeMenuId |
| | | }; |
| | | getListDataScope( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(values, this.query) |
| | | ).then((res) => { |
| | | ).then(res => { |
| | | const data = res.data.data; |
| | | this.pageScope.total = data.total; |
| | | this.dataScope = data.records; |
| | | this.selectionListScope = []; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.scopeLoading = false; |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |