| | |
| | | <template> |
| | | <basic-container> |
| | | <basic-container |
| | | :class="[ |
| | | 'hasButTwo', |
| | | $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize', |
| | | $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : '' |
| | | ]" |
| | | > |
| | | <avue-crud |
| | | class="tablesss" |
| | | :option="optionParent" |
| | | :table-loading="loading" |
| | | :data="dataParent" |
| | |
| | | v-if="permission.dict_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="scope" slot="menu"> |
| | |
| | | size="small" |
| | | @click.stop="handleRowClick(scope.row)" |
| | | v-if="userInfo.role_name.includes('admin')" |
| | | >字典配置 |
| | | >字典配置 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="code"> |
| | | <el-tag @click="handleRowClick(row)" style="cursor:pointer">{{ row.code }}</el-tag> |
| | | <template slot-scope="{ row }" slot="code"> |
| | | <el-tag @click="handleRowClick(row)" style="cursor: pointer">{{ |
| | | row.code |
| | | }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? '否' : '是' }}</el-tag> |
| | | <template slot-scope="{ row }" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? "否" : "是" }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog :title="`[${dictValue}]字典配置`" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="1000px"> |
| | | <el-dialog |
| | | :title="`[${dictValue}]字典配置`" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="1000px" |
| | | > |
| | | <avue-crud |
| | | :option="optionChild" |
| | | :table-loading="loadingChild" |
| | |
| | | v-if="permission.dict_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="scope" slot="menu"> |
| | |
| | | type="text" |
| | | icon="el-icon-circle-plus-outline" |
| | | size="small" |
| | | @click.stop="handleAdd(scope.row,scope.index)" |
| | | @click.stop="handleAdd(scope.row, scope.index)" |
| | | v-if="userInfo.role_name.includes('admin')" |
| | | >新增子项 |
| | | >新增子项 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? '否' : '是' }}</el-tag> |
| | | <template slot-scope="{ row }" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? "否" : "是" }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | </el-dialog> |
| | |
| | | getDict, |
| | | getDictTree |
| | | } from "@/api/system/dict"; |
| | | import {optionParent, optionChild} from "@/option/system/dict"; |
| | | import {mapGetters} from "vuex"; |
| | | import { optionParent, optionChild } from "@/option/system/dict"; |
| | | import { mapGetters } from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dictValue: '暂无', |
| | | dictValue: "暂无", |
| | | parentId: -1, |
| | | formParent: {}, |
| | | formChild: {}, |
| | |
| | | }, |
| | | dataParent: [], |
| | | dataChild: [], |
| | | optionParent: optionParent, |
| | | optionChild: optionChild, |
| | | optionParent: { |
| | | height: "auto", |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 10, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | menuWidth: 250, |
| | | dialogWidth: 880, |
| | | dialogClickModal: false, |
| | | ...this.$store.state.control.clearOtherBut, |
| | | column: [ |
| | | { |
| | | label: "字典编号", |
| | | prop: "code", |
| | | search: true, |
| | | slot: true, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典编号", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典名称", |
| | | prop: "dictValue", |
| | | search: true, |
| | | align: "center", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典名称", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典排序", |
| | | prop: "sort", |
| | | type: "number", |
| | | align: "right", |
| | | width: 100, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典排序", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "封存", |
| | | prop: "isSealed", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 100, |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择封存", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典备注", |
| | | prop: "remark", |
| | | hide: true |
| | | } |
| | | ] |
| | | }, |
| | | optionChild: { |
| | | height: "auto", |
| | | calcHeight: 95, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 10, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | menuWidth: 300, |
| | | dialogWidth: 880, |
| | | dialogClickModal: false, |
| | | ...this.$store.state.control.clearOtherBut, |
| | | column: [ |
| | | { |
| | | label: "字典编号", |
| | | prop: "code", |
| | | addDisabled: true, |
| | | editDisabled: true, |
| | | search: true, |
| | | span: 24, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典编号", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典名称", |
| | | prop: "dictValue", |
| | | search: true, |
| | | align: "center", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典名称", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "上级字典", |
| | | prop: "parentId", |
| | | type: "tree", |
| | | dicData: [], |
| | | hide: true, |
| | | props: { |
| | | label: "title" |
| | | }, |
| | | addDisabled: true, |
| | | editDisabled: true, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "请选择上级字典", |
| | | trigger: "click" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典键值", |
| | | prop: "dictKey", |
| | | width: 80, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典键值", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典排序", |
| | | prop: "sort", |
| | | type: "number", |
| | | align: "right", |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入字典排序", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "封存", |
| | | prop: "isSealed", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 80, |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择封存", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "字典备注", |
| | | prop: "remark", |
| | | 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() { |
| | |
| | | }, |
| | | mounted() { |
| | | this.initData(); |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | }, |
| | | methods: { |
| | | initData() { |
| | |
| | | rowSave(row, done, loading) { |
| | | const form = { |
| | | ...row, |
| | | dictKey: -1, |
| | | dictKey: -1 |
| | | }; |
| | | add(form).then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | add(form).then( |
| | | () => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | this.onLoadChild(this.pageChild); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | update(row).then( |
| | | () => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | this.onLoadChild(this.pageChild); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | this.onLoadParent(this.pageParent, this.query); |
| | | }, |
| | | rowSaveChild(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | add(row).then( |
| | | () => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdateChild(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | update(row).then( |
| | | () => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowDelChild(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | this.pageParent.total = data.total; |
| | | this.dataParent = data.records; |
| | | this.loading = false; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | |
| | | ).then(res => { |
| | | this.dataChild = res.data.data; |
| | | this.loadingChild = false; |
| | | this.$store.commit("setWindowSizeHeightAdd"); |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |