feat(product): 添加设备类型筛选功能并优化物模型管理
- 在查询表单中新增设备类型筛选条件 - 在表格列中显示设备类型信息 - 在编辑表单中添加设备类型选择字段 - 更新数据字典配置以支持设备类型 - 修复标识符重复验证提示信息,明确指出同设备类型下不能重复 - 优化数据类型转换逻辑,确保前后端数据一致性 - 修复重置查询时devType字段的处理逻辑
This commit is contained in:
@@ -248,7 +248,7 @@
|
|||||||
"product.product-things-model.142341-1": "导入通用物模型",
|
"product.product-things-model.142341-1": "导入通用物模型",
|
||||||
"product.product-things-model.142341-2": "刷新",
|
"product.product-things-model.142341-2": "刷新",
|
||||||
"product.product-things-model.142341-3": "查看物模型",
|
"product.product-things-model.142341-3": "查看物模型",
|
||||||
"product.product-things-model.142341-4": "注意:标识符不能重复",
|
"product.product-things-model.142341-4": "注意:同设备类型下标识符不能重复",
|
||||||
"product.product-things-model.142341-5": "请选择设备从机:",
|
"product.product-things-model.142341-5": "请选择设备从机:",
|
||||||
"product.product-things-model.142341-6": "请选择设备从机",
|
"product.product-things-model.142341-6": "请选择设备从机",
|
||||||
"product.product-things-model.142341-7": "网关物模型",
|
"product.product-things-model.142341-7": "网关物模型",
|
||||||
@@ -377,6 +377,10 @@
|
|||||||
"product.product-things-model.142341-133": "搜索",
|
"product.product-things-model.142341-133": "搜索",
|
||||||
"product.product-things-model.142341-134": "重置",
|
"product.product-things-model.142341-134": "重置",
|
||||||
"product.product-things-model.142341-135": "分组",
|
"product.product-things-model.142341-135": "分组",
|
||||||
|
"product.product-things-model.142341-136": "设备类型",
|
||||||
|
"product.product-things-model.142341-137": "请选择设备类型",
|
||||||
|
"product.product-things-model.142341-138": "模型名称",
|
||||||
|
"product.product-things-model.142341-139": "请选择模型名称",
|
||||||
"product.product-modbus.562372-0": "网关子设备配置",
|
"product.product-modbus.562372-0": "网关子设备配置",
|
||||||
"product.product-modbus.562372-1": "网关子设备配置默认的子设备地址,轮询方式",
|
"product.product-modbus.562372-1": "网关子设备配置默认的子设备地址,轮询方式",
|
||||||
"product.product-modbus.562372-2": "编辑设备配置",
|
"product.product-modbus.562372-2": "编辑设备配置",
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="padding-left: 20px">
|
<div style="padding-left: 20px">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
||||||
<!-- <el-form-item :label="$t('product.product-things-model.142341-127')" prop="isAPP">
|
<!-- <el-form-item :label="$t('product.product-things-model.142341-138')" prop="modelName">-->
|
||||||
<el-select v-model="queryParams.isAPP" :placeholder="$t('product.product-things-model.142341-128')" clearable
|
<!-- <el-input v-model="queryParams.modelName" :placeholder="$t('product.product-things-model.142341-139')" clearable size="small" @keyup.enter.native="handleQuery" />-->
|
||||||
size="small">
|
<!-- </el-form-item>-->
|
||||||
<el-option v-for="dict in dict.type.iot_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item :label="$t('product.product-things-model.142341-129')" prop="type">
|
<el-form-item :label="$t('product.product-things-model.142341-129')" prop="type">
|
||||||
<el-select v-model="queryParams.type" :placeholder="$t('product.product-things-model.142341-130')" clearable size="small">
|
<el-select v-model="queryParams.type" :placeholder="$t('product.product-things-model.142341-130')" clearable size="small">
|
||||||
<el-option v-for="dict in dict.type.iot_things_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-option v-for="dict in dict.type.iot_things_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('product.product-things-model.142341-136')" prop="devType">
|
||||||
|
<el-select v-model="queryParams.devType" :placeholder="$t('product.product-things-model.142341-137')" clearable size="small">
|
||||||
|
<el-option v-for="dict in dict.type.model_dev_type" :key="dict.value" :label="dict.label" :value="Number(dict.value)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item :label="$t('product.product-things-model.142341-131')" prop="isHistory">
|
<el-form-item :label="$t('product.product-things-model.142341-131')" prop="isHistory">
|
||||||
<el-select v-model="queryParams.isHistory" :placeholder="$t('product.product-things-model.142341-132')" clearable size="small">
|
<el-select v-model="queryParams.isHistory" :placeholder="$t('product.product-things-model.142341-132')" clearable size="small">
|
||||||
<el-option v-for="dict in dict.type.iot_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-option v-for="dict in dict.type.iot_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
@@ -22,7 +25,6 @@
|
|||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('product.product-things-model.142341-134') }}</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('product.product-things-model.142341-134') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-if="productInfo.status == 1 && productInfo.isOwner != 0" v-hasPermi="['iot:model:add']">
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-if="productInfo.status == 1 && productInfo.isOwner != 0" v-hasPermi="['iot:model:add']">
|
||||||
@@ -98,6 +100,11 @@
|
|||||||
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
|
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column :label="$t('product.product-things-model.142341-136')" align="center" prop="devType" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.model_dev_type" :value="scope.row.devType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column :label="$t('product.product-things-model.142341-19')" align="center" prop="formula" />
|
<el-table-column :label="$t('product.product-things-model.142341-19')" align="center" prop="formula" />
|
||||||
<el-table-column :label="$t('product.product-things-model.142341-20')" align="center" prop="modelOrder" width="80" />
|
<el-table-column :label="$t('product.product-things-model.142341-20')" align="center" prop="modelOrder" width="80" />
|
||||||
<el-table-column :label="$t('product.product-things-model.142341-21')" align="center" class-name="small-padding fixed-width" fixed="right">
|
<el-table-column :label="$t('product.product-things-model.142341-21')" align="center" class-name="small-padding fixed-width" fixed="right">
|
||||||
@@ -133,6 +140,11 @@
|
|||||||
<el-radio-button label="3">{{ $t('product.product-things-model.142341-33') }}</el-radio-button>
|
<el-radio-button label="3">{{ $t('product.product-things-model.142341-33') }}</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('product.product-things-model.142341-136')" prop="devType">
|
||||||
|
<el-select v-model="form.devType" :placeholder="$t('product.product-things-model.142341-137')" clearable style="width: 385px">
|
||||||
|
<el-option v-for="dict in dict.type.model_dev_type" :key="dict.value" :label="dict.label" :value="String(dict.value)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item :label="$t('product.product-things-model.142341-34')" prop="property">
|
<el-form-item :label="$t('product.product-things-model.142341-34')" prop="property">
|
||||||
<el-checkbox name="isChart" :label="$t('product.product-things-model.142341-12')" @change="isChartChange" v-show="form.type == 1" v-model="form.isChart" :true-label="1" :false-label="0"></el-checkbox>
|
<el-checkbox name="isChart" :label="$t('product.product-things-model.142341-12')" @change="isChartChange" v-show="form.type == 1" v-model="form.isChart" :true-label="1" :false-label="0"></el-checkbox>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@@ -391,7 +403,7 @@ import importBatch from './components/batchImportThingsModel';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'product-things-model',
|
name: 'product-things-model',
|
||||||
dicts: ['iot_things_type', 'iot_data_type', 'iot_yes_no'],
|
dicts: ['iot_things_type', 'iot_data_type', 'iot_yes_no', 'model_dev_type'],
|
||||||
components: {
|
components: {
|
||||||
productSelectTemplate,
|
productSelectTemplate,
|
||||||
thingsParameter,
|
thingsParameter,
|
||||||
@@ -537,6 +549,7 @@ export default {
|
|||||||
modelOrder: 0,
|
modelOrder: 0,
|
||||||
type: 1,
|
type: 1,
|
||||||
datatype: 'integer',
|
datatype: 'integer',
|
||||||
|
devType: null,
|
||||||
isSys: null,
|
isSys: null,
|
||||||
isChart: 1,
|
isChart: 1,
|
||||||
isHistory: 1,
|
isHistory: 1,
|
||||||
@@ -569,9 +582,12 @@ export default {
|
|||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm('queryForm');
|
this.resetForm('queryForm');
|
||||||
|
// 重置后确保 devType 为 undefined 而不是空字符串
|
||||||
|
this.queryParams.devType = undefined;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
@@ -581,6 +597,7 @@ export default {
|
|||||||
this.title = this.$t('product.product-things-model.142341-99');
|
this.title = this.$t('product.product-things-model.142341-99');
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const modelId = row.modelId;
|
const modelId = row.modelId;
|
||||||
@@ -588,6 +605,12 @@ export default {
|
|||||||
let tempForm = response.data;
|
let tempForm = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = this.$t('product.product-things-model.142341-100');
|
this.title = this.$t('product.product-things-model.142341-100');
|
||||||
|
// devType类型转换,确保与下拉选项类型一致(String类型)
|
||||||
|
if (tempForm.devType != null && tempForm.devType !== '') {
|
||||||
|
tempForm.devType = String(tempForm.devType);
|
||||||
|
} else {
|
||||||
|
tempForm.devType = undefined;
|
||||||
|
}
|
||||||
// Json转对象
|
// Json转对象
|
||||||
tempForm.specs = JSON.parse(tempForm.specs);
|
tempForm.specs = JSON.parse(tempForm.specs);
|
||||||
if (!tempForm.specs.enumList) {
|
if (!tempForm.specs.enumList) {
|
||||||
@@ -615,8 +638,13 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.form = tempForm;
|
this.form = tempForm;
|
||||||
|
// 强制更新视图
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$set(this.form, 'devType', this.form.devType);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**查看物模型 */
|
/**查看物模型 */
|
||||||
handleOpenThingsModel() {
|
handleOpenThingsModel() {
|
||||||
this.title = this.$t('product.product-things-model.142341-101');
|
this.title = this.$t('product.product-things-model.142341-101');
|
||||||
@@ -734,6 +762,12 @@ export default {
|
|||||||
// 格式化specs
|
// 格式化specs
|
||||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||||
tempForm.specs = this.formatThingsSpecs();
|
tempForm.specs = this.formatThingsSpecs();
|
||||||
|
// devType类型转换:String转Number(如果devType有值)
|
||||||
|
if (tempForm.devType != null && tempForm.devType !== '' && tempForm.devType !== undefined) {
|
||||||
|
tempForm.devType = Number(tempForm.devType);
|
||||||
|
} else {
|
||||||
|
tempForm.devType = null;
|
||||||
|
}
|
||||||
if (this.form.type == 2) {
|
if (this.form.type == 2) {
|
||||||
tempForm.isMonitor = 0;
|
tempForm.isMonitor = 0;
|
||||||
tempForm.isChart = 0;
|
tempForm.isChart = 0;
|
||||||
@@ -751,6 +785,12 @@ export default {
|
|||||||
// 格式化specs
|
// 格式化specs
|
||||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||||
tempForm.specs = this.formatThingsSpecs();
|
tempForm.specs = this.formatThingsSpecs();
|
||||||
|
// devType类型转换:String转Number(如果devType有值)
|
||||||
|
if (tempForm.devType != null && tempForm.devType !== '' && tempForm.devType !== undefined) {
|
||||||
|
tempForm.devType = Number(tempForm.devType);
|
||||||
|
} else {
|
||||||
|
tempForm.devType = null;
|
||||||
|
}
|
||||||
tempForm.productId = this.productInfo.productId;
|
tempForm.productId = this.productInfo.productId;
|
||||||
tempForm.productName = this.productInfo.productName;
|
tempForm.productName = this.productInfo.productName;
|
||||||
if (this.form.type == 2) {
|
if (this.form.type == 2) {
|
||||||
@@ -769,6 +809,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const modelIds = row.modelId;
|
const modelIds = row.modelId;
|
||||||
|
|||||||
Reference in New Issue
Block a user