fix(系统): bug修复

This commit is contained in:
Jamin
2026-04-16 14:33:05 +08:00
parent 09d62b413f
commit dd7fe18ec8
4 changed files with 990 additions and 949 deletions

5
vue/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"i18n-ally.localesPaths": [
"src/lang"
]
}

View File

@@ -34,7 +34,7 @@
</el-form-item>
<el-form-item :label="$t('product.product-edit.473153-16')" prop="networkMethod">
<el-select v-model="form.networkMethod" :placeholder="$t('product.product-edit.473153-17')" style="width: 100%" :disabled="form.status == 2">
<el-option v-for="dict in dict.type.iot_network_method" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-option v-for="dict in dict.type.iot_network_method" :key="dict.value" :label="dict.label" :value="Number(dict.value)"></el-option>
</el-select>
</el-form-item>
@@ -48,7 +48,7 @@
</el-form-item>
<el-form-item :label="$t('product.product-edit.473153-21')" prop="vertificateMethod">
<el-select v-model="form.vertificateMethod" :placeholder="$t('product.product-edit.473153-22')" style="width: 100%" :disabled="form.status == 2 || form.deviceType == 3">
<el-option v-for="dict in dict.type.iot_vertificate_method" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
<el-option v-for="dict in dict.type.iot_vertificate_method" :key="dict.value" :label="dict.label" :value="Number(dict.value)"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('product.product-edit.473153-25')" prop="productId">

View File

@@ -2,12 +2,10 @@
<div style="padding-left: 20px">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-if="productInfo.status == 1">{{ $t('product.product-things-model.142341-0') }}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-if="productInfo.status == 1">{{ $t('product.product-things-model.142341-0') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-upload2" size="mini" @click="handleSelect"
v-if="productInfo.status == 1">{{ $t('product.product-things-model.142341-1') }}</el-button>
<el-button type="success" plain icon="el-icon-upload2" size="mini" @click="handleSelect" v-if="productInfo.status == 1">{{ $t('product.product-things-model.142341-1') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="getList">{{ $t('refresh') }}</el-button>
@@ -53,8 +51,7 @@
<dict-tag :options="dict.type.iot_data_type" :value="scope.row.datatype" />
</template>
</el-table-column>
<el-table-column :label="$t('product.product-things-model.142341-18')" align="left" header-align="center" prop="specs" min-width="150"
class-name="specsColor">
<el-table-column :label="$t('product.product-things-model.142341-18')" align="left" header-align="center" prop="specs" min-width="150" class-name="specsColor">
<template slot-scope="scope">
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
</template>
@@ -63,10 +60,8 @@
<el-table-column :label="$t('product.product-things-model.142341-20')" align="center" prop="modelOrder" width="80" />
<el-table-column :label="$t('opation')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-if="productInfo.status != 2">{{ $t('product.product-things-model.142341-84') }}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-if="productInfo.status != 2">{{ $t('del') }}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="productInfo.status != 2">{{ $t('product.product-things-model.142341-84') }}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-if="productInfo.status != 2">{{ $t('del') }}</el-button>
</template>
</el-table-column>
</el-table>
@@ -81,8 +76,7 @@
<el-input v-model="form.identifier" :placeholder="$t('product.product-things-model.142341-27')" style="width: 385px" />
</el-form-item>
<el-form-item :label="$t('product.product-things-model.142341-28')" prop="modelOrder">
<el-input-number v-model="form.modelOrder" :placeholder="$t('product.product-things-model.142341-29')" type="number" style="width: 386px"
controls-position="right" />
<el-input-number v-model="form.modelOrder" :placeholder="$t('product.product-things-model.142341-29')" type="number" style="width: 386px" controls-position="right" />
</el-form-item>
<el-form-item :label="$t('product.product-things-model.142341-30')" prop="type">
<el-radio-group v-model="form.type" @change="typeChange(form.type)">
@@ -92,16 +86,27 @@
</el-radio-group>
</el-form-item>
<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="isMonitor" :label="$t('product.product-things-model.142341-13')" @change="isMonitorChange" v-show="form.type == 1"
v-model="form.isMonitor" :true-label="1" :false-label="0"></el-checkbox>
<el-checkbox name="isReadonly" :label="$t('product.product-things-model.142341-35')" @change="isReadonlyChange" :disabled="form.type == 3"
v-model="form.isReadonly" :true-label="1" :false-label="0"></el-checkbox>
<el-checkbox name="isHistory" :label="$t('product.product-things-model.142341-15')" v-model="form.isHistory" :true-label="1"
:false-label="0"></el-checkbox>
<el-checkbox name="isSharePerm" :label="$t('product.product-things-model.142341-36')" v-model="form.isSharePerm" :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
name="isMonitor"
:label="$t('product.product-things-model.142341-13')"
@change="isMonitorChange"
v-show="form.type == 1"
v-model="form.isMonitor"
:true-label="1"
:false-label="0"
></el-checkbox>
<el-checkbox
name="isReadonly"
:label="$t('product.product-things-model.142341-35')"
@change="isReadonlyChange"
:disabled="form.type == 3"
v-model="form.isReadonly"
:true-label="1"
:false-label="0"
></el-checkbox>
<el-checkbox name="isHistory" :label="$t('product.product-things-model.142341-15')" v-model="form.isHistory" :true-label="1" :false-label="0"></el-checkbox>
<el-checkbox name="isSharePerm" :label="$t('product.product-things-model.142341-36')" v-model="form.isSharePerm" :true-label="1" :false-label="0"></el-checkbox>
</el-form-item>
<el-divider></el-divider>
<el-form-item :label="$t('product.product-things-model.142341-17')" prop="datatype">
@@ -118,26 +123,22 @@
<el-form-item :label="$t('product.product-things-model.142341-45')" v-if="form.datatype == 'integer'">
<el-row>
<el-col :span="9">
<el-input v-model="form.specs.min" :placeholder="$t('product.product-things-model.142341-46')" controls-position="right" type="number"
style="width: 174px;" @input="handleEdit" />
<el-input v-model="form.specs.min" :placeholder="$t('product.product-things-model.142341-46')" controls-position="right" type="number" style="width: 174px" @input="handleEdit" />
</el-col>
<el-col :span="2" align="center">{{ $t('product.product-things-model.142341-47') }}</el-col>
<el-col :span="9">
<el-input v-model="form.specs.max" :placeholder="$t('product.product-things-model.142341-48')" type="number" controls-position="right"
style="width: 174px;" @input="handleEditmax" />
<el-input v-model="form.specs.max" :placeholder="$t('product.product-things-model.142341-48')" type="number" controls-position="right" style="width: 174px" @input="handleEditmax" />
</el-col>
</el-row>
</el-form-item>
<el-form-item :label="$t('product.product-things-model.142341-45')" v-if="form.datatype == 'decimal'">
<el-row>
<el-col :span="9">
<el-input v-model="form.specs.min" :placeholder="$t('product.product-things-model.142341-46')" controls-position="right" type="number"
style="width: 174px;" />
<el-input v-model="form.specs.min" :placeholder="$t('product.product-things-model.142341-46')" controls-position="right" type="number" style="width: 174px" />
</el-col>
<el-col :span="2" align="center">{{ $t('product.product-things-model.142341-47') }}</el-col>
<el-col :span="9">
<el-input v-model="form.specs.max" :placeholder="$t('product.product-things-model.142341-48')" type="number" controls-position="right"
style="width: 174px;" />
<el-input v-model="form.specs.max" :placeholder="$t('product.product-things-model.142341-48')" type="number" controls-position="right" style="width: 174px" />
</el-col>
</el-row>
</el-form-item>
@@ -146,8 +147,7 @@
<el-input v-model="form.specs.unit" :placeholder="$t('product.product-things-model.142341-50')" style="width: 385px" />
</el-form-item>
<el-form-item :label="$t('product.product-things-model.142341-51')">
<el-input-number v-model="form.specs.step" :placeholder="$t('product.product-things-model.142341-52')" type="number" style="width: 386px"
controls-position="right" />
<el-input-number v-model="form.specs.step" :placeholder="$t('product.product-things-model.142341-52')" type="number" style="width: 386px" controls-position="right" />
</el-form-item>
<el-form-item :label="$t('product.product-things-model.142341-19')" prop="formula">
<template slot="label">
@@ -210,8 +210,9 @@
<el-col :span="11" :offset="1">
<el-input v-model="item.text" :placeholder="$t('product.product-things-model.142341-74')" />
</el-col>
<el-col :span="2" :offset="1" v-if="index != 0"><a style="color: #f56c6c"
@click="removeEnumItem(index)">{{ $t('del') }}</a></el-col>
<el-col :span="2" :offset="1" v-if="index != 0">
<a style="color: #f56c6c" @click="removeEnumItem(index)">{{ $t('del') }}</a>
</el-col>
</el-row>
<div>
+
@@ -254,16 +255,14 @@
<el-col :span="18">
<el-input readonly v-model="item.name" size="mini" :placeholder="$t('product.product-things-model.142341-83')" style="margin-top: 3px">
<template slot="prepend">
<el-tag size="mini" effect="dark" style="margin-left: -21px; height: 26px; line-height: 26px">{{
item.order }}</el-tag>
<el-tag size="mini" effect="dark" style="margin-left: -21px; height: 26px; line-height: 26px">{{ item.order }}</el-tag>
{{ form.identifier + '_' + item.id }}
</template>
<el-button slot="append" @click="editParameter(item, index)" size="small">{{ $t('product.product-things-model.142341-84') }}</el-button>
</el-input>
</el-col>
<el-col :span="2" :offset="2">
<el-button size="small" plain type="danger" style="padding: 5px" icon="el-icon-delete"
@click="removeParameter(index)">{{ $t('del') }}</el-button>
<el-button size="small" plain type="danger" style="padding: 5px" icon="el-icon-delete" @click="removeParameter(index)">{{ $t('del') }}</el-button>
</el-col>
</el-row>
</div>
@@ -281,16 +280,14 @@
<el-col :span="18">
<el-input readonly v-model="item.name" size="mini" :placeholder="$t('product.product-things-model.142341-88')" style="margin-top: 3px">
<template slot="prepend">
<el-tag size="mini" effect="dark" style="margin-left: -21px; height: 26px; line-height: 26px">{{
item.order }}</el-tag>
<el-tag size="mini" effect="dark" style="margin-left: -21px; height: 26px; line-height: 26px">{{ item.order }}</el-tag>
{{ form.identifier + '_' + item.id }}
</template>
<el-button slot="append" @click="editParameter(item, index)" size="small">{{ $t('product.product-things-model.142341-84') }}</el-button>
</el-input>
</el-col>
<el-col :span="2" :offset="2">
<el-button size="small" plain type="danger" style="padding: 5px" icon="el-icon-delete"
@click="removeParameter(index)">{{ $t('del') }}</el-button>
<el-button size="small" plain type="danger" style="padding: 5px" icon="el-icon-delete" @click="removeParameter(index)">{{ $t('del') }}</el-button>
</el-col>
</el-row>
</div>
@@ -332,7 +329,6 @@
</div>
</el-dialog>
</div>
</template>
<style>
@@ -454,7 +450,8 @@ export default {
required: true,
message: this.$t('product.product-things-model.142341-96'),
trigger: 'blur',
}, {
},
{
type: 'number',
min: -2147483648,
max: 2147483647,
@@ -468,7 +465,6 @@ export default {
message: this.$t('product.product-things-model.142341-97'),
trigger: 'change',
},
],
datatype: [
{
@@ -706,10 +702,9 @@ export default {
}
}
//验证模型特性为图表展示时,数据类型是否为整数或者小数
if ((this.form.isChart == 1 && this.form.datatype != 'integer') && (this.form.isChart == 1 && this.form.datatype != 'decimal')) {
if (this.form.isChart == 1 && this.form.datatype != 'integer' && this.form.isChart == 1 && this.form.datatype != 'decimal') {
this.$modal.msgError(this.$t('product.product-things-model.142341-106'));
}
else if (this.form.modelId != null) {
} else if (this.form.modelId != null) {
// 格式化specs
let tempForm = JSON.parse(JSON.stringify(this.form));
tempForm.specs = this.formatThingsSpecs();
@@ -870,7 +865,20 @@ export default {
return JSON.stringify(data);
},
/** 数据类型改变 */
dataTypeChange(val) { },
dataTypeChange(val) {
this.form.specs = {
enumList: [
{
value: '',
text: '',
},
],
arrayType: 'integer',
arrayCount: 5,
showWay: 'select',
params: [],
};
},
/** 添加枚举项 */
addEnumItem() {
this.form.specs.enumList.push({
@@ -887,19 +895,36 @@ export default {
let specs = JSON.parse(json);
if (specs.type === 'integer' || specs.type === 'decimal' || specs.type === 'INT16' || specs.type === 'INT') {
return (
'<span style=\'width:50%;display:inline-block;\'>' + this.$t('product.product-things-model.142341-117') + '<span style="color:#F56C6C">' +
"<span style='width:50%;display:inline-block;'>" +
this.$t('product.product-things-model.142341-117') +
'<span style="color:#F56C6C">' +
specs.max +
'</span></span>' + this.$t('product.product-things-model.142341-118') + '<span style="color:#F56C6C">' +
'</span></span>' +
this.$t('product.product-things-model.142341-118') +
'<span style="color:#F56C6C">' +
specs.min +
'</span><br /><span style=\'width:50%;display:inline-block;\'>' + this.$t('product.product-things-model.142341-119') + '<span style="color:#F56C6C">' +
"</span><br /><span style='width:50%;display:inline-block;'>" +
this.$t('product.product-things-model.142341-119') +
'<span style="color:#F56C6C">' +
specs.step +
'</span></span>' + this.$t('product.product-things-model.142341-120') + '<span style="color:#F56C6C">' +
'</span></span>' +
this.$t('product.product-things-model.142341-120') +
'<span style="color:#F56C6C">' +
specs.unit
);
} else if (specs.type === 'string') {
return this.$t('product.product-things-model.142341-121') + '<span style="color:#F56C6C">' + specs.maxLength + '</span>';
} else if (specs.type === 'array') {
return '<span style=\'width:50%;display:inline-block;\'>' + this.$t('product.product-things-model.142341-122') + '<span style="color:#F56C6C">' + specs.arrayType + '</span></span>' + this.$t('product.product-things-model.142341-123') + '<span style="color:#F56C6C">' + specs.arrayCount;
return (
"<span style='width:50%;display:inline-block;'>" +
this.$t('product.product-things-model.142341-122') +
'<span style="color:#F56C6C">' +
specs.arrayType +
'</span></span>' +
this.$t('product.product-things-model.142341-123') +
'<span style="color:#F56C6C">' +
specs.arrayCount
);
} else if (specs.type === 'enum') {
let items = '';
for (let i = 0; i < specs.enumList.length; i++) {
@@ -953,20 +978,20 @@ export default {
},
// 在输入最小值改变时触发
handleEdit(e) {
let value = e.replace(/[^\-\d]/g, ""); // 只能输入-和数字
value = value.replace(/\-{2,}/g, "-"); // -只能保留一个
value = value.replace(/(\d)\-/g, "$1"); // 数字后面不能接-,不能出现类似-11-2,12-11-23
value = value.replace(/(-)0+/g, "$1"); // 不能出现-0,-001,-0001类似
value = value.replace(/(-\d{10})\d*/, '$1') // 最多保留10位整数
let value = e.replace(/[^\-\d]/g, ''); // 只能输入-和数字
value = value.replace(/\-{2,}/g, '-'); // -只能保留一个
value = value.replace(/(\d)\-/g, '$1'); // 数字后面不能接-,不能出现类似-11-2,12-11-23
value = value.replace(/(-)0+/g, '$1'); // 不能出现-0,-001,-0001类似
value = value.replace(/(-\d{10})\d*/, '$1'); // 最多保留10位整数
this.form.specs.min = value;
},
// 在输入最大值改变时触发
handleEditmax(e) {
let value = e.replace(/[^\-\d]/g, ""); // 只能输入-和数字
value = value.replace(/\-{2,}/g, "-"); // -只能保留一个
value = value.replace(/(\d)\-/g, "$1"); // 数字后面不能接-,不能出现类似-11-2,12-11-23
value = value.replace(/(-)0+/g, "$1"); // 不能出现-0,-001,-0001类似
value = value.replace(/(-\d{10})\d*/, '$1') // 最多保留10位整数
let value = e.replace(/[^\-\d]/g, ''); // 只能输入-和数字
value = value.replace(/\-{2,}/g, '-'); // -只能保留一个
value = value.replace(/(\d)\-/g, '$1'); // 数字后面不能接-,不能出现类似-11-2,12-11-23
value = value.replace(/(-)0+/g, '$1'); // 不能出现-0,-001,-0001类似
value = value.replace(/(-\d{10})\d*/, '$1'); // 最多保留10位整数
this.form.specs.max = value;
},
//数据类型为小数的校验

View File

@@ -766,7 +766,18 @@ export default {
},
/** 数据类型改变 */
dataTypeChange(val) {
this.form.specs = {};
this.form.specs = {
enumList: [
{
value: '',
text: '',
},
],
arrayType: 'integer',
arrayCount: 5,
showWay: 'select',
params: [],
};
},
/** 添加枚举项 */
addEnumItem() {