From b76274b464aca1d2ededd5f6b543bb335569dcd8 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Thu, 29 Aug 2024 15:30:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ip=E9=80=89=E6=8B=A9=E5=99=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E7=94=A8=E8=87=AA=E6=B5=8B=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20#7543=20#=20Reviewed,=20transaction=20id:?= =?UTF-8?q?=2016831?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/RenderForm/tags/TagIpSelector.vue | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/frontend/desktop/src/components/common/RenderForm/tags/TagIpSelector.vue b/frontend/desktop/src/components/common/RenderForm/tags/TagIpSelector.vue index 2187e51bd..e94676148 100644 --- a/frontend/desktop/src/components/common/RenderForm/tags/TagIpSelector.vue +++ b/frontend/desktop/src/components/common/RenderForm/tags/TagIpSelector.vue @@ -194,33 +194,37 @@ Promise.all(requestList).then(values => { let hasDiff = false const { ip, group } = this.value - values.forEach((v) => { - switch (selectorInfo.id) { - case 'ip': - this.staticIpList = v.data - if (!this.hook) { // 表单没有被勾选 - ip.forEach(value => { - // 拿到新的静态ip列表后替换对应的已保存ip属性,如果已保存ip在新列表中不存在,则提示用户手动更新 - hasDiff = this.staticIpList.every(item => item.bk_host_id !== value.bk_host_id) + values.forEach((v, index) => { + if (index === 0) { + switch (selectorInfo.id) { + case 'ip': + this.staticIpList = v.data + if (!this.hook) { // 表单没有被勾选 + ip.forEach(value => { + // 拿到新的静态ip列表后替换对应的已保存ip属性,如果已保存ip在新列表中不存在,则提示用户手动更新 + hasDiff = this.staticIpList.every(item => item.bk_host_id !== value.bk_host_id) + this.$set(value, 'diff', hasDiff) + }) + } + break + case 'topo': + this.dynamicIpList = v.data + break + case 'group': + this.dynamicGroupList = v.data.info + // 判断动态分组数据与最新的CMDB动态分组配置是否存在差异 + const dynamicGroups = group || [] + dynamicGroups.some(value => { + hasDiff = this.dynamicGroupList.every(item => item.id !== value.id) this.$set(value, 'diff', hasDiff) }) - } - break - case 'topo': - this.dynamicIpList = v.data - break - case 'group': - this.dynamicGroupList = v.data.info - // 判断动态分组数据与最新的CMDB动态分组配置是否存在差异 - const dynamicGroups = group || [] - dynamicGroups.some(value => { - hasDiff = this.dynamicGroupList.every(item => item.id !== value.id) - this.$set(value, 'diff', hasDiff) - }) - break - default: - this.topoModelList = v.data - break + break + default: + this.topoModelList = v.data + break + } + } else { + this.topoModelList = v.data } }) this.loading = false