From 1dabd9f512bdfd256111bb87facee242110184ca Mon Sep 17 00:00:00 2001 From: smjiao Date: Thu, 18 Apr 2024 09:43:36 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E9=92=88=E5=AF=B9ragdoll=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E5=92=8C=E8=BF=94=E5=9B=9E=E5=80=BC=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configuration.js | 12 +++--------- .../TranscationDomainConfigurations.vue | 4 ++-- .../configuration/TranscationDomainDetail.vue | 15 +++++++++------ .../configuration/TranscationDomainManagement.vue | 8 +++----- .../components/AddConfigurationDrawer.vue | 10 +++++----- .../configuration/components/AddHostDrawer.vue | 6 +++--- .../components/AddTranscationDomainModal.vue | 6 ++---- .../components/DomainSelectionModal.vue | 2 +- .../components/GetDomainStatusDrawer.vue | 4 ++-- .../components/QueryRealConfsDrawer.vue | 2 +- 10 files changed, 31 insertions(+), 38 deletions(-) diff --git a/src/api/configuration.js b/src/api/configuration.js index 0f9c5ef..37f7b0d 100644 --- a/src/api/configuration.js +++ b/src/api/configuration.js @@ -69,18 +69,12 @@ export function createDomain(domainInfo, ...parameter) { }); } // 删除业务域 -export function deleteDomain(parameter) { - const domainName = parameter.domainNameArray; +export function deleteDomain({domainName, ...parameter}) { return request({ url: api.deleteDomain, method: 'delete', - params: { - domainName - }, - paramsSerializer: { - serialize: (params) => { - return qs.stringify(params, {indices: false}); - } + data: { + domainName: domainName } }); } diff --git a/src/views/configuration/TranscationDomainConfigurations.vue b/src/views/configuration/TranscationDomainConfigurations.vue index b5a8469..b20e233 100644 --- a/src/views/configuration/TranscationDomainConfigurations.vue +++ b/src/views/configuration/TranscationDomainConfigurations.vue @@ -307,7 +307,7 @@ export default { domainName: _this.domainName }) .then(function (res) { - _this.tableData = res.confFiles; + _this.tableData = res.data.confFiles; }) .catch(function (err) { _this.$message.error(err.response.message); @@ -426,7 +426,7 @@ export default { confFiles: [{filePath: record.filePath.replace('openEuler:', '')}] }) .then(function (res) { - _this.manageConfChange = res.confBaseInfos; + _this.manageConfChange = res.data.confBaseInfos; }) .catch(function (err) { _this.$message.error(err.response.message); diff --git a/src/views/configuration/TranscationDomainDetail.vue b/src/views/configuration/TranscationDomainDetail.vue index e460ad2..6756817 100644 --- a/src/views/configuration/TranscationDomainDetail.vue +++ b/src/views/configuration/TranscationDomainDetail.vue @@ -220,16 +220,19 @@ export default { handleDelete(hostInfos) { const _this = this; return new Promise((resolve, reject) => { + const hostInfosList = [] hostInfos.map((hostInfo) => { - hostInfo.hostId = hostInfo.host_id; - return hostInfo; + const newHostInfo = {} + newHostInfo.hostId = hostInfo.host_id; + hostInfosList.push(newHostInfo); + return hostInfosList; }); deleteHost({ domainName: _this.domainName, - hostInfos: hostInfos + hostInfos: hostInfosList }) .then((res) => { - _this.$message.success(res.msg); + _this.$message.success(res.message); _this.getHostAndStatus(); _this.selectedRowKeys = []; _this.selectedRows = []; @@ -269,7 +272,7 @@ export default { batchSyncConf(_this.domainName, hostIds) .then((res) => { let msg = ''; - for (const item of res) { + for (const item of res.data) { const hostId = item.host_id; let success = ''; let fail = ''; @@ -328,7 +331,7 @@ export default { domainName }) .then(function (res) { - _this.confsOfDomain = res.confFiles || []; + _this.confsOfDomain = res.data.confFiles || []; }) .catch(function (err) { _this.$message.error(err.response.message); diff --git a/src/views/configuration/TranscationDomainManagement.vue b/src/views/configuration/TranscationDomainManagement.vue index db51c0c..d94469d 100644 --- a/src/views/configuration/TranscationDomainManagement.vue +++ b/src/views/configuration/TranscationDomainManagement.vue @@ -125,7 +125,7 @@ export default { domainList() .then(function (res) { // 特殊处理 - _this.domainData = res || []; + _this.domainData = res.data || []; }) .catch(function (err) { if (err.response.code === '400') return; @@ -164,15 +164,13 @@ export default { }); }, handleDelDomain(domainName) { - const domainNameArray = []; - domainNameArray.push(domainName); const _this = this; return new Promise((resolve, reject) => { deleteDomain({ - domainNameArray + domainName: domainName }) .then((res) => { - _this.$message.success(res.msg); + _this.$message.success(res.message); _this.getDomainList(); resolve(); }) diff --git a/src/views/configuration/components/AddConfigurationDrawer.vue b/src/views/configuration/components/AddConfigurationDrawer.vue index 0679955..670c51c 100644 --- a/src/views/configuration/components/AddConfigurationDrawer.vue +++ b/src/views/configuration/components/AddConfigurationDrawer.vue @@ -265,10 +265,10 @@ export default { const _this = this; addManagementConf(params) .then(function (res) { - if (res.code === 200) { - _this.$message.success(res.msg); - } else if (res.code === 206) { - _this.$message.warning(res.msg); + if (res.code === '200') { + _this.$message.success(res.message); + } else if (res.code === '206') { + _this.$message.warning(res.message); } _this.visible = false; _this.$emit('ok'); @@ -308,7 +308,7 @@ export default { this.hostListLoading = true; domainHostList(this.domainName) .then(function (res) { - _this.hostList = res; + _this.hostList = res.data; }) .catch(function (err) { _this.$message.error(err.response.data.msg || err.response.data.detail); diff --git a/src/views/configuration/components/AddHostDrawer.vue b/src/views/configuration/components/AddHostDrawer.vue index 9981acc..b4ad91b 100644 --- a/src/views/configuration/components/AddHostDrawer.vue +++ b/src/views/configuration/components/AddHostDrawer.vue @@ -120,8 +120,8 @@ export default { const _this = this; domainHostList(domainName) .then(function (res) { - _this.targetKeys = res.map((host) => host.hostId); - _this.oldTargetKeys = res.map((host) => host.hostId); + _this.targetKeys = res.data.map((host) => host.hostId); + _this.oldTargetKeys = res.data.map((host) => host.hostId); }) .catch(function (err) { // code == 400时,为域内未添加主机,不报错 @@ -159,7 +159,7 @@ export default { }); addHost(values.domainName, hostInfos) .then(function (res) { - _this.$message.success(res.msg); + _this.$message.success(res.message); _this.form.resetFields(); _this.close(); _this.$emit('addHostSuccess'); diff --git a/src/views/configuration/components/AddTranscationDomainModal.vue b/src/views/configuration/components/AddTranscationDomainModal.vue index 2f29133..cad671d 100644 --- a/src/views/configuration/components/AddTranscationDomainModal.vue +++ b/src/views/configuration/components/AddTranscationDomainModal.vue @@ -62,11 +62,9 @@ export default { const _this = this; this.isLoading = true; values.priority = 0; - const domainInfo = []; - domainInfo.push(values); - createDomain(domainInfo) + createDomain(values) .then(function (res) { - _this.$message.success(res.msg); + _this.$message.success(res.message); _this.onSuccess && _this.onSuccess(); _this.visible = false; _this.form.resetFields(); diff --git a/src/views/configuration/components/DomainSelectionModal.vue b/src/views/configuration/components/DomainSelectionModal.vue index 9b4e961..b4598a2 100644 --- a/src/views/configuration/components/DomainSelectionModal.vue +++ b/src/views/configuration/components/DomainSelectionModal.vue @@ -55,7 +55,7 @@ export default { const _this = this; domainList() .then(function (res) { - _this.domainNameList = res; + _this.domainNameList = res.data; }) .catch(function (err) { _this.$message.error(err.response.message); diff --git a/src/views/configuration/components/GetDomainStatusDrawer.vue b/src/views/configuration/components/GetDomainStatusDrawer.vue index 88a5aa3..d4238f1 100644 --- a/src/views/configuration/components/GetDomainStatusDrawer.vue +++ b/src/views/configuration/components/GetDomainStatusDrawer.vue @@ -149,7 +149,7 @@ export default { }) .then((res) => { let message = ''; - for (const item of res) { + for (const item of res.data) { const hostId = item.host_id; let success = ''; let fail = ''; @@ -193,7 +193,7 @@ export default { this.domainStatusIsLoading = true; domainStatus(_this.domainName, hostIp) .then(function (res) { - _this.statusData = res.hostStatus[0].syncStatus || []; + _this.statusData = res.data.hostStatus[0].syncStatus || []; }) .catch(function (err) { if (err.response.code !== '404' && err.code !== 'ERR_BAD_REQUEST') { diff --git a/src/views/configuration/components/QueryRealConfsDrawer.vue b/src/views/configuration/components/QueryRealConfsDrawer.vue index 9f9bea2..68cdcad 100644 --- a/src/views/configuration/components/QueryRealConfsDrawer.vue +++ b/src/views/configuration/components/QueryRealConfsDrawer.vue @@ -136,7 +136,7 @@ export default { hostIds: [{hostId}] }) .then((res) => { - _this.confsOfHost = (res && res[0] && res[0].confBaseInfos) || []; + _this.confsOfHost = (res.data && res.data[0] && res.data[0].confBaseInfos) || []; }) .catch((err) => { if (err.response.code !== '400' && err.code !== 'ERR_BAD_REQUEST') { -- 2.38.1.windows.1