解决部署管理和数据库管理,选择记录不能启用自定义按钮的问题

This commit is contained in:
zhanghouying
2020-05-08 16:28:21 +08:00
parent 4ef60b1616
commit 8393f74046
2 changed files with 26 additions and 12 deletions

View File

@@ -56,7 +56,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row stripe style="width: 100%" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row stripe style="width: 100%" @selection-change="handleCurrentChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="name" width="130px" label="数据库名称" /> <el-table-column prop="name" width="130px" label="数据库名称" />
<el-table-column prop="jdbcUrl" label="连接地址" /> <el-table-column prop="jdbcUrl" label="连接地址" />
@@ -142,9 +142,16 @@ export default {
execute() { execute() {
this.$refs.execute.dialog = true this.$refs.execute.dialog = true
}, },
handleCurrentChange(row) { handleCurrentChange(selection) {
this.crud.selections = selection
if (selection.length === 1) {
const row = selection[0]
this.selectIndex = row.id
this.currentRow = row this.currentRow = row
this.selectIndex = !row ? null : row.id } else {
this.currentRow = {}
this.selectIndex = ''
}
} }
} }
} }

View File

@@ -96,7 +96,7 @@
<fForm ref="sysRestore" :key="times" :app-name="appName" /> <fForm ref="sysRestore" :key="times" :app-name="appName" />
<dForm ref="deploy" /> <dForm ref="deploy" />
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row stripe style="width: 100%" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row stripe style="width: 100%" @selection-change="handleCurrentChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="app.name" label="应用名称" /> <el-table-column prop="app.name" label="应用名称" />
<el-table-column prop="servers" label="服务器列表" /> <el-table-column prop="servers" label="服务器列表" />
@@ -187,13 +187,20 @@ export default {
sysRestore() { sysRestore() {
this.$refs.sysRestore.dialog = true this.$refs.sysRestore.dialog = true
}, },
handleCurrentChange(row) { handleCurrentChange(selection) {
this.crud.selections = selection
if (selection.length === 1) {
const row = selection[0]
this.selectIndex = row.id
this.currentRow = row this.currentRow = row
this.selectIndex = !row ? null : row.id this.appName = row.app.name
this.appName = !row ? null : row.app.name this.times = this.times + 1
this.times = this.times + !row ? 0 : 1 this.appId = row.appId
this.appId = !row ? null : row.appId this.deployId = row.id
this.deployId = !row ? null : row.id } else {
this.currentRow = {}
this.selectIndex = ''
}
}, },
startServer() { startServer() {
crudDeploy.startServer(JSON.stringify(this.currentRow)) crudDeploy.startServer(JSON.stringify(this.currentRow))