From ea35f905fa2848219be78b4898e0b65cf20d6126 Mon Sep 17 00:00:00 2001 From: xuyiming Date: Tue, 28 Jul 2020 15:07:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E8=B5=84=E6=BA=90=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/allot-info-confirm.vue | 2 +- src/components/shop-cloud/shop-cloud.vue | 117 +++++++++++++++-------- 2 files changed, 76 insertions(+), 43 deletions(-) diff --git a/src/components/allot-info-confirm.vue b/src/components/allot-info-confirm.vue index d40c6ed..c0e0e13 100644 --- a/src/components/allot-info-confirm.vue +++ b/src/components/allot-info-confirm.vue @@ -184,7 +184,7 @@ export default { this.hideDialog(); } else { this.$message({ - message: "分配失败", + message: data.errMsg || "分配失败", type: "warning", }); } diff --git a/src/components/shop-cloud/shop-cloud.vue b/src/components/shop-cloud/shop-cloud.vue index 3775e2d..e762f77 100644 --- a/src/components/shop-cloud/shop-cloud.vue +++ b/src/components/shop-cloud/shop-cloud.vue @@ -222,7 +222,7 @@ :max="10" placeholder="请选择内存最高使用量" > -
+
GB
@@ -238,7 +238,7 @@ :max="10" placeholder="请选择内存默认使用量" > -
+
GB
@@ -1197,51 +1197,84 @@ export default { }); } }, + checkNamespace(namespace, cb) { + this.$http + .get("/apaas/service/v3/resource/apply/checkNs", { + params: { namespace }, + }) + .then(({ data }) => { + if (data.success === 1) { + if (data.data === 1) { + typeof cb === "function" && cb(); + } else if (data.data === -1) { + this.$message({ + message: `命名空间名称已存在`, + type: "error", + }); + } else if (data.data === -1) { + this.$message({ + message: `命名空间名称验证失败`, + type: "error", + }); + } + } + }) + .catch((error) => { + console.log(error); + + this.$message({ + message: `命名空间名称验证失败`, + type: "error", + }); + }); + }, determineSubmit() { if (this.activeName == 0) { - let query = { - resource_info: { - namespace: this.formNew.namespace, - workplace: this.formNew.workplace, - workplacedesc: this.formNew.workplacedesc, - }, - resource_apply: { - apply_file: this.formNew.apply_file, - cpu: Number(this.formNew.cpu), - duration: this.formNew.appDuration, - duration_unit: Number(this.formNew.durType), - apply_connect_username: this.form.link_man, - apply_connect_mobile: this.form.phone, - memory: Number(this.formNew.memory), - containers: this.formNew.containerGroup, - disk_num: this.formNew.dataDisk, - disk_cap: this.formNew.perDataDisk, - one_cpu_min: this.formNew.perCPU, - one_cpu_max: this.formNew.perCPUs, - one_memory_min: this.formNew.perRAM, - one_memory_max: this.formNew.perRAMs, - }, - disks: [ - { + this.checkNamespace(this.formNew.namespace, () => { + let query = { + resource_info: { + namespace: this.formNew.namespace, + workplace: this.formNew.workplace, + workplacedesc: this.formNew.workplacedesc, + }, + resource_apply: { + apply_file: this.formNew.apply_file, + cpu: Number(this.formNew.cpu), + duration: this.formNew.appDuration, + duration_unit: Number(this.formNew.durType), + apply_connect_username: this.form.link_man, + apply_connect_mobile: this.form.phone, + memory: Number(this.formNew.memory), + containers: this.formNew.containerGroup, disk_num: this.formNew.dataDisk, disk_cap: this.formNew.perDataDisk, - store_type: this.formNew.store_type, + one_cpu_min: this.formNew.perCPU, + one_cpu_max: this.formNew.perCPUs, + one_memory_min: this.formNew.perRAM, + one_memory_max: this.formNew.perRAMs, }, - ], - }; - this.$api.serviceShop.applicationCloud(query).then((response) => { - if (response.data.success == 1) { - this.$message({ - message: "申请成功", - type: "success", - }); - this.$router.push("/services_shop"); - } else { - this.$message({ - message: `申请失败,${response.data.errMsg}`, - type: "error", - }); - } + disks: [ + { + disk_num: this.formNew.dataDisk, + disk_cap: this.formNew.perDataDisk, + store_type: this.formNew.store_type, + }, + ], + }; + this.$api.serviceShop.applicationCloud(query).then((response) => { + if (response.data.success == 1) { + this.$message({ + message: "申请成功", + type: "success", + }); + this.$router.push("/services_shop"); + } else { + this.$message({ + message: `申请失败,${response.data.errMsg}`, + type: "error", + }); + } + }); }); } else { let query = { -- 2.26.0