| | |
| | | <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="menu"> |
| | | <el-button type="text" icon="el-icon-setting" size="small" plain class="none-border" |
| | | <template slot-scope="{row, size}" slot="menu"> |
| | | <el-button type="text" icon="el-icon-setting" :size="size" plain class="none-border" |
| | | @click.stop="handleModel(row)">模型配置 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="modelTable"> |
| | | <el-tag>{{ row.modelTable }}</el-tag> |
| | | <template slot-scope="{row, size}" slot="modelTable"> |
| | | <el-tag :size="size">{{ row.modelTable }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="数据库模型配置" :visible.sync="modelBox" :fullscreen="true" append-to-body> |
| | |
| | | option: { |
| | | ...option, |
| | | |
| | | labelWidth: 120, |
| | | labelWidth: 96, |
| | | searchLabelWidth: 96, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | |
| | | <el-col :span="24"> |
| | | <basicContainer> |
| | | <avue-crud ref="crud" :option="option" :before-open="beforeOpen" :before-close="beforeClose" :data="data" |
| | | @tree-load="treeLoad" @row-save="rowSave" @row-del="rowDel" @refresh-change="refreshChange" @row-update="rowUpdate" |
| | | @on-load="onLoad"> |
| | | <template #menu="{row,size}"> |
| | | <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd(row)">新增子级 |
| | | @tree-load="treeLoad" @row-save="rowSave" @row-del="rowDel" @refresh-change="refreshChange" |
| | | @row-update="rowUpdate" @on-load="onLoad"> |
| | | |
| | | <template slot-scope="{row, size}" slot="menu"> |
| | | <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" @click="handleAdd(row)">新增子级 |
| | | </el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | </basicContainer> |
| | | </el-col> |
| | |
| | | }, |
| | | parentId: undefined, |
| | | option: { |
| | | labelWidth: 96, |
| | | searchLabelWidth: 96, |
| | | menuWidth: 240, |
| | | |
| | | lazy: true, |
| | | rowKey: 'id', |
| | | defaultExpandAll:true, |
| | |
| | | methods: { |
| | | |
| | | refreshChange() { |
| | | this.onLoad(); |
| | | this.onLoad() |
| | | }, |
| | | |
| | | beforeOpen(done, type) { |
| | | if (["add", "edit"].includes(type)) { |
| | | this.initData(); |
| | | this.initData() |
| | | } |
| | | done(); |
| | | done() |
| | | }, |
| | | |
| | | beforeClose(done) { |
| | | this.parentId = ""; |
| | | const column = this.findObject(this.option.column, "parentId"); |
| | | column.value = ""; |
| | | column.addDisabled = false; |
| | | done(); |
| | | this.parentId = "" |
| | | const column = this.findObject(this.option.column, "parentId") |
| | | column.value = "" |
| | | column.addDisabled = false |
| | | done() |
| | | }, |
| | | |
| | | initData() { |
| | | const column = this.findObject(this.option.column, "parentId"); |
| | | column.dicData = this.data; |
| | | const column = this.findObject(this.option.column, "parentId") |
| | | column.dicData = this.data |
| | | }, |
| | | |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.selectionList = [] |
| | | }, |
| | | |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | this.loading = true |
| | | getTreeList().then(res => { |
| | | const data = res.data.data; |
| | | this.data = data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | const data = res.data.data |
| | | this.data = data |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | }, |
| | | |
| | | rowDel(row, index, done) { |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(row); |
| | | }); |
| | | }) |
| | | done(row) |
| | | }) |
| | | }, |
| | | |
| | | rowSave(row, done) { |
| | | row.parentId = this.parentId; |
| | | row.parentId = this.parentId |
| | | row.labelName = row.name |
| | | add(row).then(() => { |
| | | this.initFlag = false; |
| | | this.onLoad(this.page); |
| | | this.initFlag = false |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }) |
| | | done() |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | window.console.log(error) |
| | | loading() |
| | | }) |
| | | }, |
| | | |
| | | rowUpdate(row, index, done) { |
| | | const column = this.findObject(this.option.column, "parentId"); |
| | | column.value = row.id; |
| | | const column = this.findObject(this.option.column, "parentId") |
| | | column.value = row.id |
| | | done(row) |
| | | }, |
| | | |
| | | handleAdd(row) { |
| | | const column = this.findObject(this.option.column, "parentId"); |
| | | column.value = row.id; |
| | | column.addDisabled = true; |
| | | const column = this.findObject(this.option.column, "parentId") |
| | | column.value = row.id |
| | | column.addDisabled = true |
| | | this.parentId = row.id |
| | | this.$refs.crud.rowAdd() |
| | | }, |
| | |
| | | |
| | | |
| | | |
| | | <style> |
| | | </style> |
| | | <style></style> |