| | |
| | | <basic-container |
| | | :class="[ |
| | | 'hasButTwo', |
| | | $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '', |
| | | $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize', |
| | | $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : '' |
| | | ]" |
| | | > |
| | | <avue-crud |
| | | class="tablesss" |
| | | :option="optionParent" |
| | | :table-loading="loading" |
| | | :data="dataParent" |
| | |
| | | update, |
| | | add, |
| | | getDict, |
| | | getDictTree, |
| | | getDictTree |
| | | } from "@/api/system/dict"; |
| | | import { optionParent, optionChild } from "@/option/system/dict"; |
| | | import { mapGetters } from "vuex"; |
| | |
| | | pageSize: 10, |
| | | pageSizes: [10, 30, 50, 100, 200], |
| | | currentPage: 1, |
| | | total: 0, |
| | | total: 0 |
| | | }, |
| | | pageChild: { |
| | | pageSize: 10, |
| | | pageSizes: [10, 30, 50, 100, 200], |
| | | currentPage: 1, |
| | | total: 0, |
| | | total: 0 |
| | | }, |
| | | dataParent: [], |
| | | dataChild: [], |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入字典编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典名称", |
| | |
| | | { |
| | | 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 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | |
| | | { |
| | | required: true, |
| | | message: "请选择封存", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典备注", |
| | | prop: "remark", |
| | | hide: true, |
| | | }, |
| | | ], |
| | | hide: true |
| | | } |
| | | ] |
| | | }, |
| | | optionChild: { |
| | | height: "auto", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入字典编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典名称", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入字典名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "上级字典", |
| | |
| | | dicData: [], |
| | | hide: true, |
| | | props: { |
| | | label: "title", |
| | | label: "title" |
| | | }, |
| | | addDisabled: true, |
| | | editDisabled: true, |
| | |
| | | { |
| | | required: false, |
| | | message: "请选择上级字典", |
| | | trigger: "click", |
| | | }, |
| | | ], |
| | | trigger: "click" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典键值", |
| | |
| | | { |
| | | 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 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | |
| | | { |
| | | required: true, |
| | | message: "请选择封存", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典备注", |
| | | prop: "remark", |
| | | hide: true, |
| | | }, |
| | | ], |
| | | }, |
| | | hide: true |
| | | } |
| | | ] |
| | | } |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | addBtn: this.vaildData(this.permission.dict_add, false), |
| | | delBtn: this.vaildData(this.permission.dict_delete, false), |
| | | editBtn: this.vaildData(this.permission.dict_edit, false), |
| | | viewBtn: false, |
| | | viewBtn: false |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.initData(); |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | getDictTree().then((res) => { |
| | | getDictTree().then(res => { |
| | | const column = this.findObject(this.optionChild.column, "parentId"); |
| | | column.dicData = res.data.data; |
| | | }); |
| | |
| | | rowSave(row, done, loading) { |
| | | const form = { |
| | | ...row, |
| | | dictKey: -1, |
| | | dictKey: -1 |
| | | }; |
| | | add(form).then( |
| | | () => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | this.onLoadChild(this.pageChild); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDict(this.formParent.id).then((res) => { |
| | | getDict(this.formParent.id).then(res => { |
| | | this.formParent = res.data.data; |
| | | }); |
| | | } |
| | |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.onLoadChild(this.pageChild); |
| | | 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.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crudChild.toggleSelection(); |
| | | }); |
| | |
| | | this.initData(); |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | getDict(this.formChild.id).then((res) => { |
| | | getDict(this.formChild.id).then(res => { |
| | | this.formChild = res.data.data; |
| | | }); |
| | | } |
| | |
| | | }, |
| | | beforeCloseChild(done) { |
| | | this.$refs.crudChild.value.parentId = this.parentId; |
| | | this.$refs.crudChild.option.column.filter((item) => { |
| | | this.$refs.crudChild.option.column.filter(item => { |
| | | if (item.prop === "parentId") { |
| | | item.value = this.parentId; |
| | | } |
| | |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | ).then(res => { |
| | | const data = res.data.data; |
| | | this.pageParent.total = data.total; |
| | | this.dataParent = data.records; |
| | | this.loading = false; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | |
| | | page.pageSize, |
| | | this.parentId, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | ).then(res => { |
| | | this.dataChild = res.data.data; |
| | | this.loadingChild = false; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |