Browse Source

Merge branch 'develop' of https://gitee.com/lmlz_0/dc-ui into develop

pull/1/head
lxg 1 year ago
parent
commit
57c24838e3
  1. 3
      src/views/model/device/index.vue
  2. 288
      src/views/model/params/index.vue

3
src/views/model/device/index.vue

@ -609,7 +609,8 @@ function handleParams(row){
router.push({
path: path,
query: {
deviceUuid: row.uuid
deviceUuid: row.uuid,
deviceCode: row.centerDeviceCode
}
});
}

288
src/views/model/params/index.vue

@ -178,7 +178,11 @@
<el-table-column label="偏移量" align="center" prop="setAdjustvalue" />
<el-table-column label="验证范围" align="center" prop="validateScope" />
<el-table-column label="全局统一编码" align="center" prop="globalCode" />
<el-table-column label="参数模版ID" align="center" prop="paramModelId" />
<el-table-column label="参数模版" align="center" prop="paramModelId" >
<template #default="scope">
<span>{{ getParamModelName(scope.row.paramModelId) }}</span>
</template>
</el-table-column>
<el-table-column label="分区(字典)" align="center" prop="partion" />
<el-table-column label="plc地址" align="center" prop="plcAdr" />
<el-table-column label="是/否可控制" align="center" prop="controllab" />
@ -210,111 +214,129 @@
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="paramsRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备UUID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数名称" prop="paramName">
<el-input v-model="form.paramName" placeholder="请输入参数名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数编码" prop="paramCode">
<el-input v-model="form.paramCode" placeholder="请输入参数编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据类型" prop="paramType">
<el-select v-model="form.paramType" placeholder="请选择数据类型">
<el-option
v-for="dict in dc_param_value_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="form.contrlFlag" placeholder="请选择是否可控">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数单位" prop="contrlType">
<el-select v-model="form.contrlType" placeholder="请选择参数单位">
<el-option
v-for="dict in dc_param_uint_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否有效" prop="enabled">
<el-select v-model="form.enabled" placeholder="请选择是否有效">
<el-option
v-for="dict in enabled"
:label="dict.label"
:value=dict.value>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设置值" prop="setDefautvalue">
<el-input v-model="form.setDefautvalue" placeholder="请输入设置值" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="偏移量" prop="setAdjustvalue">
<el-input v-model="form.setAdjustvalue" placeholder="请输入偏移量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="验证范围" prop="validateScope">
<el-input v-model="form.validateScope" placeholder="请输入验证范围" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="全局统一编码" prop="globalCode">
<el-input v-model="form.globalCode" placeholder="请输入全局统一编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数模版ID" prop="paramModelId">
<el-select v-model="form.paramModelId" placeholder="请选择参数模版ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分区(字典)" prop="partion">
<el-select v-model="form.partion" placeholder="请选择分区(字典)">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="plc地址" prop="plcAdr">
<el-input v-model="form.plcAdr" placeholder="请输入plc地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="form.controllab" placeholder="请选择是/否可控制">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-row>
<el-col :span="12">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备UUID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数名称" prop="paramName">
<el-input v-model="form.paramName" placeholder="请输入参数名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数模版" prop="paramModelId">
<el-select v-model="form.paramModelId" placeholder="请选择参数模版ID" @change="checkedParamModel">
<el-option
v-for="dict in paramClassList"
:label="dict.paramClassName"
:value=dict.id>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数编码" prop="paramCode">
<el-input v-model="form.paramCode" placeholder="请输入参数编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据类型" prop="paramType">
<el-select v-model="form.paramType" placeholder="请选择数据类型">
<el-option
v-for="dict in dc_param_value_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="form.contrlFlag" placeholder="请选择是否可控">
<el-option
v-for="dict in contrlFlag"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数单位" prop="contrlType">
<el-select v-model="form.contrlType" placeholder="请选择参数单位">
<el-option
v-for="dict in dc_param_uint_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否有效" prop="enabled">
<el-select v-model="form.enabled" placeholder="请选择是否有效">
<el-option
v-for="dict in enabled"
:label="dict.label"
:value=dict.value>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设置值" prop="setDefautvalue">
<el-input v-model="form.setDefautvalue" placeholder="请输入设置值" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="偏移量" prop="setAdjustvalue">
<el-input v-model="form.setAdjustvalue" placeholder="请输入偏移量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="验证范围" prop="validateScope">
<el-input v-model="form.validateScope" placeholder="请输入验证范围" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="全局统一编码" prop="globalCode">
<el-input v-model="form.globalCode" placeholder="请输入全局统一编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分区(字典)" prop="partion">
<el-select v-model="form.partion" placeholder="请选择分区(字典)">
<el-option
v-for="dict in dc_device_partion"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="plc地址" prop="plcAdr">
<el-input v-model="form.plcAdr" placeholder="请输入plc地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="form.controllab" placeholder="请选择是/否可控制">
<el-option
v-for="dict in controllab"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
@ -329,10 +351,10 @@
<script setup name="Params">
import { listParams, getParams, delParams, addParams, updateParams } from "@/api/model/params";
import { listParamclass } from "@/api/model/paramclass";
const { proxy } = getCurrentInstance();
const router = useRouter();
const { dc_param_uint_type, dc_param_value_type } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type');
const { dc_param_uint_type, dc_param_value_type, dc_device_partion } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type', 'dc_device_partion');
const paramsList = ref([]);
const open = ref(false);
@ -343,17 +365,22 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const paramClassList = ref([]);
const deviceUuid = router.currentRoute._value.query.deviceUuid;
const deviceCode = router.currentRoute._value.query.deviceCode;
const contrlFlag = ref([
{label: '可控', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不可控', value: 'false', elTagType: 'default', elTagClass: null}
{label: '可控', value: true, elTagType: 'default', elTagClass: null},
{label: '不可控', value: false, elTagType: 'default', elTagClass: null}
]);
const enabled = ref([
{label: '有效', value: 'true', elTagType: 'default', elTagClass: null},
{label: '无效', value: 'false', elTagType: 'default', elTagClass: null}
{label: '有效', value: true, elTagType: 'default', elTagClass: null},
{label: '无效', value: false, elTagType: 'default', elTagClass: null}
]);
const data = reactive({
form: {},
form: {
contrlFlag:contrlFlag,
enabled:enabled,
},
queryParams: {
pageNum: 1,
pageSize: 10,
@ -382,7 +409,6 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询设备参数明细列表 */
function getList() {
loading.value = true;
debugger
if(deviceUuid != null && deviceUuid != undefined && deviceUuid != ""){
queryParams.value.deviceUuid = deviceUuid;
listParams(queryParams.value).then(response => {
@ -514,5 +540,39 @@ function handleExport() {
}, `params_${new Date().getTime()}.xlsx`)
}
function getParamModel() {
listParamclass({}).then(response => {
console.log("response");
console.log(response);
console.log(response.rows);
paramClassList.value = response.rows;
});
}
function getParamModelName(id){
paramClassList.value.forEach(item=>{
if(item.id == id){
return item.getParamModelName;
}
})
}
function checkedParamModel(val){
console.log("val");
console.log(val);
let paramClassCodeSeleted = "";
paramClassList.value.forEach(item=>{
console.log("item");
console.log(item);
console.log(item.id == val);
if(item.id == val){
paramClassCodeSeleted = item.paramClassCode;
}
})
form.value.paramCode = deviceCode+paramClassCodeSeleted;
}
getList();
getParamModel();
</script>

Loading…
Cancel
Save