From f2af26998af74304a750da560002983fcad4658b Mon Sep 17 00:00:00 2001 From: kerwincui <164770707@qq.com> Date: Wed, 8 Jun 2022 14:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=89=A9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=9A=E4=B8=BE=E5=92=8C=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=B8=8D=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/product/product-things-model.vue | 58 +++++++++++-------- vue/src/views/iot/template/index.vue | 52 ++++++++++------- 2 files changed, 65 insertions(+), 45 deletions(-) diff --git a/vue/src/views/iot/product/product-things-model.vue b/vue/src/views/iot/product/product-things-model.vue index a42597ec..8fa75c1b 100644 --- a/vue/src/views/iot/product/product-things-model.vue +++ b/vue/src/views/iot/product/product-things-model.vue @@ -127,7 +127,7 @@
- + @@ -314,15 +314,15 @@ export default { // 表单重置 reset() { this.form = { - modelId: null, - modelName: null, - productId: null, - productName: null, + templateId: null, + templateName: null, + userId: null, + userName: null, tenantId: null, tenantName: null, identifier: null, - type: null, - datatype: null, + type: 1, + datatype: "integer", isSys: null, isTop: null, isMonitor: null, @@ -332,7 +332,13 @@ export default { updateBy: null, updateTime: null, remark: null, - specs: null, + specs: { + enumList: [{ + value: "", + text: "" + }], + arrayType: "int" + }, }; this.resetForm("form"); }, @@ -351,23 +357,27 @@ export default { this.reset(); this.open = true; this.title = "添加物模型"; - this.form.type = 1; - this.form.datatype = "integer" - this.form.specs = { - enumList: [], - arrayType: "int" - }; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - const modelId = row.modelId; + const modelId = row.modelId;; getModel(modelId).then((response) => { - this.form = response.data; + let tempForm = response.data; this.open = true; this.title = "修改物模型"; // Json转对象 - this.form.specs = JSON.parse(this.form.specs); + tempForm.specs = JSON.parse(tempForm.specs); + if (!tempForm.specs.enumList) { + tempForm.specs.enumList = [{ + value: "", + text: "" + }]; + } + if (!tempForm.specs.arrayType) { + tempForm.specs.arrayType = "int"; + } + this.form=tempForm; }); }, /**查看物模型 */ @@ -539,19 +549,19 @@ export default { }, /** 切换为枚举项 */ dataTypeChange(val) { - if (val == "enum") { - this.form.specs.enumList = [{ - value: "", - text: "" - }]; - } + // if (val == "enum") { + // this.form.specs.enumList = [{ + // value: "", + // text: "" + // }]; + // } }, /** 添加枚举项 */ addEnumItem() { this.form.specs.enumList.push({ value: "", text: "" - }) + }); }, /** 删除枚举项 */ removeEnumItem(index) { diff --git a/vue/src/views/iot/template/index.vue b/vue/src/views/iot/template/index.vue index 95dbdfda..86521e73 100644 --- a/vue/src/views/iot/template/index.vue +++ b/vue/src/views/iot/template/index.vue @@ -1,6 +1,6 @@