ÎļþÃû´Ó Source/UBCS-WEB/src/views/omd/dict.vue ÐÞ¸Ä |
| | |
| | | <el-tag>{{ row.isSealed === 0 ? 'å¦' : 'æ¯' }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog :title="`[${dictValue}]æä¸¾é¡¹é
ç½®`" |
| | | <el-dialog :title="`[${name}]æä¸¾é¡¹é
ç½®`" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="1000px"> |
| | |
| | | icon="el-icon-delete" |
| | | v-if="permission.dict_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | @click="handleDeleteChild" |
| | | >å é¤ |
| | | </el-button> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getParentList, |
| | | getChildList, |
| | | remove, |
| | | update, |
| | | add, |
| | | getDict, |
| | | getDictTree |
| | | } from "@/api/omd/dict"; |
| | | import {optionParent, optionChild} from "@/const/omd/dict"; |
| | | import { |
| | | getParentList, |
| | | getChildList, |
| | | remove, |
| | | update, |
| | | add, |
| | | getDict, |
| | | getDictTree, addChild, updateChild, getDictChild, removeChild |
| | | } from "@/api/omd/enum"; |
| | | import {optionParent, optionChild} from "@/const/omd/enum"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dictValue: 'ææ ', |
| | | parentId: -1, |
| | | parentoid: -1, |
| | | formParent: {}, |
| | | formChild: {}, |
| | | selectionList: [], |
| | |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | ids.push(ele.oid); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | getDictTree().then(res => { |
| | | const column = this.findObject(this.optionChild.column, "parentId"); |
| | | getDictTree(this.pageParent.currentPage, |
| | | this.pageParent.pageSize, |
| | | this.query).then(res => { |
| | | const column = this.findObject(this.optionChild.column, "parentoid"); |
| | | column.dicData = res.data.data; |
| | | }); |
| | | }, |
| | | handleAdd(row) { |
| | | this.formChild.dictValue = ""; |
| | | this.formChild.dictKey = ""; |
| | | this.formChild.value = ""; |
| | | this.formChild.name = ""; |
| | | this.formChild.sort = 0; |
| | | this.formChild.isSealed = 0; |
| | | this.formChild.remark = ""; |
| | | this.formChild.parentId = row.id; |
| | | this.formChild.parentoid = row.oid; |
| | | this.$refs.crudChild.rowAdd(); |
| | | }, |
| | | rowSave(row, done, loading) { |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return remove(row.oid); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | |
| | | }, |
| | | handleRowClick(row) { |
| | | this.query = {}; |
| | | this.parentId = row.id; |
| | | this.dictValue = row.dictValue; |
| | | this.parentId = row.oid; |
| | | this.name = row.name; |
| | | |
| | | const code = this.findObject(this.optionChild.column, "code"); |
| | | const code = this.findObject(this.optionChild.column, "value"); |
| | | code.value = row.code; |
| | | const parentId = this.findObject(this.optionChild.column, "parentId"); |
| | | parentId.value = row.id; |
| | | // const parentoid = this.findObject(this.optionChild.column, "parentoid"); |
| | | this.parentoid = row.oid; |
| | | |
| | | this.box = true; |
| | | this.onLoadChild(this.pageChild); |
| | |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDict(this.formParent.id).then(res => { |
| | | getDict(this.formParent.oid).then(res => { |
| | | this.formParent = res.data.data; |
| | | }); |
| | | } |
| | |
| | | this.onLoadParent(this.pageParent, this.query); |
| | | }, |
| | | rowSaveChild(row, done, loading) { |
| | | add(row).then(() => { |
| | | row.parentoid = this.parentoid; |
| | | addChild(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | |
| | | }); |
| | | }, |
| | | rowUpdateChild(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | updateChild(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return removeChild(row.oid); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | return removeChild(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | |
| | | this.initData(); |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | getDict(this.formChild.id).then(res => { |
| | | getDictChild(this.formChild.oid).then(res => { |
| | | this.formChild = res.data.data; |
| | | }); |
| | | } |
| | |
| | | getChildList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | this.parentId, |
| | | this.parentoid, |
| | | Object.assign(params, this.query) |
| | | ).then(res => { |
| | | this.dataChild = res.data.data; |