main
wangqiujuan0808 2024-10-15 15:18:03 +08:00
parent dad69ea7f7
commit 2730102450
7 changed files with 119 additions and 85 deletions

View File

@ -88,6 +88,10 @@ const infoApi = {
importP(params,template_name) {
return postPBRequest('/template', params, 53212,template_name)
},
//
getPointType(params) {
return postPBRequest('/template', params, 53011)
},
//
exportP(params) {

View File

@ -93,7 +93,7 @@ export default {
template_name: [
{ required: true, message: "请选择通讯模板", trigger: "blur" },
],
driver_description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
driver_description: [{ required: false, message: "请输入驱动描述", trigger: "blur" }],
driver_type: [{ required: true, message: "请选择通讯驱动", trigger: "change" }]
},
});

View File

@ -49,7 +49,7 @@ export default {
{ required: true, validator: validName, trigger: "blur" },
],
template_description: [
{ required: true, message: "请输入模板描述", trigger: "blur" }
{ required: false, message: "请输入模板描述", trigger: "blur" }
],
template_type: [
{ required: true, message: "请选择类型", trigger: "blur" }

View File

@ -7,14 +7,15 @@
<el-form-item label="点位地址:" prop="address">
<el-input v-model="addForm.address" placeholder="请输入点位地址0-65535" clearable type="number" />
</el-form-item>
<el-form-item label="点位类型:" prop="point_type">
<el-select v-model="addForm.point_type" size="mini" placeholder="请选择点位类型">
<el-option v-for="item in datatypeArr" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item label="寄存器:" prop="register">
<el-select v-model="addForm.register" size="mini" placeholder="请选择寄存器" @change="changeRegister">
<el-option v-for="item in registerArr" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="寄存器:" prop="register">
<el-select v-model="addForm.register" size="mini" placeholder="请选择寄存器">
<el-option v-for="item in registerArr" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item label="点位类型:" prop="point_type">
<el-select v-model="addForm.point_type" size="mini" placeholder="请选择点位类型">
<el-option v-for="item in datatypeArr" :disabled="item.disabled || item.disabled1" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="点位描述:" prop="point_description">
@ -22,7 +23,7 @@
</el-form-item>
<el-form-item label="读写权限:" prop="point_permissions">
<el-select v-model="addForm.point_permissions" size="mini" placeholder="请选择读写权限">
<el-option v-for="item in perOptions" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in perOptions" :disabled="item.disabled" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="缩放系数:" prop="multiplier">
@ -45,7 +46,7 @@ import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
import infoApi from "@/api/infoApi.js";
import { ElMessage, ElMessageBox } from "element-plus";
export default {
props: ["formData", "dialogVisible", "pointData", "type"],
props: ["formData", "dialogVisible", "pointData", "type", "pointTypeOptions"],
emits: ["dialogClose", "dialogSuccess"],
setup(props, ctx) {
const checkAddress = (rule, value, callback) => {
@ -68,36 +69,7 @@ export default {
const state = reactive({
addForm: {
},
datatypeArr: [{
label: 'bool',
value: 1
}, {
label: 'int16',
value: 2
}, {
label: 'int32',
value: 3
}, {
label: 'int64',
value: 4
},
{
label: 'unit16',
value: 5
}, {
label: 'unit32',
value: 6
},
{
label: 'unit64',
value: 7
}, {
label: 'float32',
value: 8
}, {
label: 'float64',
value: 9
}],
datatypeArr: [],
registerArr: [
{
label: 'coil_status',
@ -165,7 +137,7 @@ export default {
}],
perOptions: [
{
label: '读',
label: '读',
value: 1
},
{
@ -184,10 +156,10 @@ export default {
point_type: [{ required: true, message: "请选择点位类型", trigger: "blur" }],
register: [{ required: true, message: "请输入寄存器", trigger: "blur" }],
multiplier: [{ required: true, message: "请输入缩放系数", trigger: "blur" }],
point_unit: [{ required: true, message: "请输入点位单位", trigger: "blur" }],
point_unit: [{ required: false, message: "请输入点位单位", trigger: "blur" }],
point_permissions: [{ required: true, message: "请输入读写权限", trigger: "blur" }],
point_description: [
{ required: true, message: "请输入点位描述", trigger: "blur" }
{ required: false, message: "请输入点位描述", trigger: "blur" }
],
},
});
@ -196,8 +168,65 @@ export default {
});
onMounted(() => {
state.addForm = props.pointData
state.addForm = props.pointData;
getPointData();
changeRegister();
});
const getPointData = () => {
state.datatypeArr = [];
for (let i in props.pointTypeOptions) {
let obj = {
value: Number(i),
label: props.pointTypeOptions[i],
disabled: (Number(i) === 2 || Number(i) === 6 || Number(i) === 12) && (props.formData.template_type === 1)
}
state.datatypeArr.push(obj);
}
}
const changeRegister = () => {
if(state.addForm.register === 1) {
state.datatypeArr.forEach(ele => { // bool
ele.disabled1 = ele.value!== 1
})
state.perOptions.forEach(ele => {//
ele.disabled = false;
})
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
}
if(state.addForm.register === 2) {
state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value!== 1
})
state.perOptions.forEach(ele => {//
ele.disabled = ele.value === 2;
})
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
}
if(state.addForm.register === 3) {
state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value === 1
})
state.perOptions.forEach(ele => {//
ele.disabled = ele.value === 2;
})
state.addForm.point_type = 3;
state.addForm.point_permissions = 1;
}
if(state.addForm.register === 4) {
state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value === 1
})
state.perOptions.forEach(ele => {//
ele.disabled = false;
})
state.addForm.point_type = 3;
state.addForm.point_permissions = 1;
}
}
const closeDialog = () => {
ctx.emit("dialogClose");
};
@ -230,7 +259,8 @@ export default {
visible,
closeDialog,
saveP,
ruleFormRef
ruleFormRef,
changeRegister
};
},
};

View File

@ -3,8 +3,6 @@
v-model="visible" title="点位管理">
<el-card class="top-title">
<span>模板名称{{ formData.template_name }}</span>
<!-- <span>模板描述{{ formData.template_description }}</span>
<span>模板类型{{ templateData[formData.template_type] }}</span> -->
<span>点位数量{{ propertiesData.length }}</span>
</el-card>
<div class="top-btn">
@ -25,7 +23,7 @@
</el-table-column>
<el-table-column prop="point_type" label="点位类型" align="center" show-overflow-tooltip>
<template #default="scope">
<span>{{ typeData[scope.row.point_type] }}</span>
<span>{{ pointTypeOptions[scope.row.point_type] }}</span>
</template>
</el-table-column>
@ -42,7 +40,7 @@
</el-table-column>
<el-table-column prop="point_permissions" label="读写权限" align="center" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row.point_permissions == 1 ? '读' : '可写' }}</span>
<span>{{ scope.row.point_permissions == 1 ? '读' : '可写' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" show-overflow-tooltip>
@ -56,7 +54,7 @@
</template>
</el-table-column>
</el-table>
<AddPoint :type="type" :formData="formData1" :pointData="pointData" :dialogVisible="dialogVisible1"
<AddPoint :type="type" :pointTypeOptions="pointTypeOptions" :formData="formData1" :pointData="pointData" :dialogVisible="dialogVisible1"
v-if="dialogVisible1" @dialogClose="dialogVisible1 = false" @dialogSuccess="dialogSuccess1">
</AddPoint>
<ExportPoint :formData="formData1" :dialogVisible="dialogVisible2" v-if="dialogVisible2"
@ -84,17 +82,6 @@ export default {
dialogVisible1: false,
dialogVisible2: false,
propertiesData: [],
typeData: {
1: 'bool',
2: 'int16',
3: 'int32',
4: 'int64',
5: 'unit16',
6: 'unit32',
7: 'unit64',
8: 'float32',
9: 'float64'
},
byteData: {
1: 'null',
2: '12',
@ -116,16 +103,27 @@ export default {
3: 'input_register',
4: 'holding_register'
},
type: 'I'
type: 'I',
pointTypeOptions:{}
});
const visible = computed(() => {
return props.dialogVisible;
});
onMounted(() => {
getPointType();
getPointList();
});
const getPointType = async () => {
const parm = {};
const res = await infoApi.getPointType(parm);
if (res.code == 0) {
state.pointTypeOptions = res.data;
}
}
const getPointList = async () => {
const parm = {
template_name: props.formData.template_name
@ -178,12 +176,12 @@ export default {
state.type = 'I';
state.pointData = {
point_name: '',
address: 36,
address: null,
point_type: 1,
point_permissions: 1,
multiplier: 1,
point_unit: 'on',
register: 1
point_unit: '',
register: 3
}
}

View File

@ -47,7 +47,8 @@
<fieldset class="right-div1 box2">
<legend class="box-ht">网卡信息</legend>
<div v-for="(item, index) of deviceData.running_information && deviceData.running_information.netinfo" :key="index" class="all-con">
<p class="title">网卡{{ item.name }}的使用情况</p>
<p class="title" v-if="index===0">A</p>
<p class="title" v-else>B</p>
<div class="data">
<span>
<span class="name">字节</span>

View File

@ -10,7 +10,8 @@
size="large"
>
<div v-for="(item, index) of formData.ip" :key="index" :class="formData.ip.length ==1 ? 'ipDiv' : 'moreipDiv'">
<p>{{ item.name || "网卡" }}</p>
<p v-if="index===0">{{ "A" }}</p>
<p v-else>{{ "B" }}</p>
<div class="info-div">
<div>
<el-form-item