mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
解决物模型修改枚举和数组界面不更新问题
This commit is contained in:
@@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
<div v-if="form.datatype == 'enum'">
|
<div v-if="form.datatype == 'enum'">
|
||||||
<el-form-item label="枚举项" prop="">
|
<el-form-item label="枚举项" prop="">
|
||||||
<el-row v-for="(item,index) in form.specs.enumList" :key="index" style="margin-bottom:10px;">
|
<el-row v-for="(item,index) in form.specs.enumList" :key="'enum'+index" style="margin-bottom:10px;">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-input v-model="item.value" placeholder="参数值,例如:0" type="number" />
|
<el-input v-model="item.value" placeholder="参数值,例如:0" type="number" />
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -314,15 +314,15 @@ export default {
|
|||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
modelId: null,
|
templateId: null,
|
||||||
modelName: null,
|
templateName: null,
|
||||||
productId: null,
|
userId: null,
|
||||||
productName: null,
|
userName: null,
|
||||||
tenantId: null,
|
tenantId: null,
|
||||||
tenantName: null,
|
tenantName: null,
|
||||||
identifier: null,
|
identifier: null,
|
||||||
type: null,
|
type: 1,
|
||||||
datatype: null,
|
datatype: "integer",
|
||||||
isSys: null,
|
isSys: null,
|
||||||
isTop: null,
|
isTop: null,
|
||||||
isMonitor: null,
|
isMonitor: null,
|
||||||
@@ -332,7 +332,13 @@ export default {
|
|||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
specs: null,
|
specs: {
|
||||||
|
enumList: [{
|
||||||
|
value: "",
|
||||||
|
text: ""
|
||||||
|
}],
|
||||||
|
arrayType: "int"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@@ -351,23 +357,27 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加物模型";
|
this.title = "添加物模型";
|
||||||
this.form.type = 1;
|
|
||||||
this.form.datatype = "integer"
|
|
||||||
this.form.specs = {
|
|
||||||
enumList: [],
|
|
||||||
arrayType: "int"
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const modelId = row.modelId;
|
const modelId = row.modelId;;
|
||||||
getModel(modelId).then((response) => {
|
getModel(modelId).then((response) => {
|
||||||
this.form = response.data;
|
let tempForm = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改物模型";
|
this.title = "修改物模型";
|
||||||
// Json转对象
|
// 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) {
|
dataTypeChange(val) {
|
||||||
if (val == "enum") {
|
// if (val == "enum") {
|
||||||
this.form.specs.enumList = [{
|
// this.form.specs.enumList = [{
|
||||||
value: "",
|
// value: "",
|
||||||
text: ""
|
// text: ""
|
||||||
}];
|
// }];
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
/** 添加枚举项 */
|
/** 添加枚举项 */
|
||||||
addEnumItem() {
|
addEnumItem() {
|
||||||
this.form.specs.enumList.push({
|
this.form.specs.enumList.push({
|
||||||
value: "",
|
value: "",
|
||||||
text: ""
|
text: ""
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
/** 删除枚举项 */
|
/** 删除枚举项 */
|
||||||
removeEnumItem(index) {
|
removeEnumItem(index) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="padding:6px;">
|
<div style="padding:6px;">
|
||||||
<el-card v-show="showSearch" style="margin-bottom:6px;">
|
<el-card v-show="showSearch" style="margin-bottom:5px;">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" style="margin-bottom:-20px;">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" style="margin-bottom:-20px;">
|
||||||
<el-form-item label="名称" prop="templateName">
|
<el-form-item label="名称" prop="templateName">
|
||||||
<el-input v-model="queryParams.templateName" placeholder="请输入物模型名称" clearable size="small" @keyup.enter.native="handleQuery" />
|
<el-input v-model="queryParams.templateName" placeholder="请输入物模型名称" clearable size="small" @keyup.enter.native="handleQuery" />
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']" v-if="scope.row.isSys == '0'? true:!isTenant" >修改</el-button>
|
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']" v-if="scope.row.isSys == '0'? true:!isTenant">修改</el-button>
|
||||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" v-if="scope.row.isSys == '0'? true:!isTenant">删除</el-button>
|
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" v-if="scope.row.isSys == '0'? true:!isTenant">删除</el-button>
|
||||||
<span style="font-size:10px;color:#999;" v-if="scope.row.isSys == '1' && isTenant">系统定义,不能修改</span>
|
<span style="font-size:10px;color:#999;" v-if="scope.row.isSys == '1' && isTenant">系统定义,不能修改</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="form.datatype == 'enum'">
|
<div v-if="form.datatype == 'enum'">
|
||||||
<el-form-item label="枚举项" prop="">
|
<el-form-item label="枚举项" prop="">
|
||||||
<el-row v-for="(item,index) in form.specs.enumList" :key="index" style="margin-bottom:10px;">
|
<el-row v-for="(item,index) in form.specs.enumList" :key="'enum'+index" style="margin-bottom:10px;">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-input v-model="item.value" placeholder="参数值,例如:0" type="number" />
|
<el-input v-model="item.value" placeholder="参数值,例如:0" type="number" />
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -292,8 +292,8 @@ export default {
|
|||||||
tenantId: null,
|
tenantId: null,
|
||||||
tenantName: null,
|
tenantName: null,
|
||||||
identifier: null,
|
identifier: null,
|
||||||
type: null,
|
type: 1,
|
||||||
datatype: null,
|
datatype: "integer",
|
||||||
isSys: null,
|
isSys: null,
|
||||||
isTop: null,
|
isTop: null,
|
||||||
isMonitor: null,
|
isMonitor: null,
|
||||||
@@ -303,7 +303,13 @@ export default {
|
|||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
specs: null,
|
specs: {
|
||||||
|
enumList: [{
|
||||||
|
value: "",
|
||||||
|
text: ""
|
||||||
|
}],
|
||||||
|
arrayType: "int"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@@ -328,23 +334,27 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加通用物模型";
|
this.title = "添加通用物模型";
|
||||||
this.form.type = 1;
|
|
||||||
this.form.datatype = "integer"
|
|
||||||
this.form.specs = {
|
|
||||||
enumList: [],
|
|
||||||
arrayType: "int"
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const templateId = row.templateId || this.ids;
|
const templateId = row.templateId || this.ids;
|
||||||
getTemplate(templateId).then((response) => {
|
getTemplate(templateId).then((response) => {
|
||||||
this.form = response.data;
|
let tempForm = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改通用物模型";
|
this.title = "修改通用物模型";
|
||||||
// Json转对象
|
// 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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
@@ -445,19 +455,19 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 切换为枚举项 */
|
/** 切换为枚举项 */
|
||||||
dataTypeChange(val) {
|
dataTypeChange(val) {
|
||||||
if (val == "enum") {
|
// if (val == "enum") {
|
||||||
this.form.specs.enumList = [{
|
// this.form.specs.enumList = [{
|
||||||
value: "",
|
// value: "",
|
||||||
text: ""
|
// text: ""
|
||||||
}];
|
// }];
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
/** 添加枚举项 */
|
/** 添加枚举项 */
|
||||||
addEnumItem() {
|
addEnumItem() {
|
||||||
this.form.specs.enumList.push({
|
this.form.specs.enumList.push({
|
||||||
value: "",
|
value: "",
|
||||||
text: ""
|
text: ""
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
/** 删除枚举项 */
|
/** 删除枚举项 */
|
||||||
removeEnumItem(index) {
|
removeEnumItem(index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user