From 1988d77f4df3c01a9137303e0c959b3442c14377 Mon Sep 17 00:00:00 2001 From: lzhe <lzhe@example.com> Date: 星期一, 30 九月 2024 22:10:30 +0800 Subject: [PATCH] 1 --- src/views/tpm/MachineGroup.vue | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/views/tpm/MachineGroup.vue b/src/views/tpm/MachineGroup.vue index e77729e..9f54d09 100644 --- a/src/views/tpm/MachineGroup.vue +++ b/src/views/tpm/MachineGroup.vue @@ -1,8 +1,8 @@ <!-- * @Date: 2024-04-27 20:02:44 - * @LastEditors: Sneed - * @LastEditTime: 2024-04-27 21:40:33 - * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/tpm/MachineGroup.vue + * @LastEditors: gaoshp + * @LastEditTime: 2024-09-29 19:33:58 + * @FilePath: /cps-web/src/views/tpm/MachineGroup.vue --> <template> <el-container> @@ -19,7 +19,7 @@ <el-header> <div class="left-panel"> <el-button @click="addChild" type="primary" plain>鏂板涓嬬骇</el-button> - <el-button @click="del" type="danger" plain>鍒犻櫎</el-button> + <el-button :disabled="!form.id" @click="del" type="danger" plain>鍒犻櫎</el-button> </div> </el-header> <el-main class=""> @@ -83,6 +83,9 @@ } }, addChild() { + if (!this.form.id) { + return + } let { name, id, groupType, groupCategory } = this.form this.form.id = '' this.form.name = '' @@ -115,11 +118,20 @@ }, save() { this.group = [] - this.$HTTP.post('/api/blade-cps/group', this.form).then(res => { - if (res.code === 200) { - this.getTreeData() - } - }) + if (this.form.id) { + this.$HTTP.put('/api/blade-cps/group', this.form).then(res => { + if (res.code === 200) { + this.getTreeData() + } + }) + } else { + this.$HTTP.post('/api/blade-cps/group', this.form).then(res => { + if (res.code === 200) { + this.getTreeData() + } + }) + } + } } } -- Gitblit v1.9.3