代码暂存
parent
7b67cd7221
commit
a511bf3e7b
|
@ -27,7 +27,6 @@
|
|||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
// import { mb_list, mb_info, response} from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type", "templateData"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
|
|
|
@ -76,7 +76,7 @@ export default {
|
|||
});
|
||||
const getD = async () => {
|
||||
const parm = {
|
||||
name: props.formData.driver_name
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getD(parm);
|
||||
if (res.code == 0) {
|
||||
|
@ -113,6 +113,7 @@ export default {
|
|||
::v-deep .el-form-item__content {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
>span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
|
||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog" title="驱动配置">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">驱动名称</legend>
|
||||
<el-form label-width="130px">
|
||||
<el-form-item>
|
||||
{{ formData.name }}
|
||||
{{ form.driver_name }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<!-- 1 modbus_tcp -->
|
||||
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 1">
|
||||
<!-- 2 modbus_tcp -->
|
||||
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 2">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通用配置</legend>
|
||||
<el-form-item label="轮询时间" prop="polling_time">
|
||||
|
@ -27,10 +27,20 @@
|
|||
<el-form-item label="端口号" prop="port">
|
||||
<el-input-number v-model="form.port" :min="1" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="大小端模式" prop="little_endian">
|
||||
<el-select v-model="form.little_endian">
|
||||
<el-option v-for="item in endianArr" :label="item.name" :value="item.value" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字节顺序" prop="wordswap">
|
||||
<el-select v-model="form.wordswap">
|
||||
<el-option v-for="item in wordswapArr" :label="item.name" :value="item.value" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</fieldset>
|
||||
</el-form>
|
||||
<!-- 2: 'modbus_rtu' -->
|
||||
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 2">
|
||||
<!-- 1: 'modbus_rtu' -->
|
||||
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 1">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通用配置</legend>
|
||||
<el-form-item label="轮询时间" prop="polling_time">
|
||||
|
@ -116,11 +126,14 @@ export default {
|
|||
const ruleFormRef3 = ref(null);
|
||||
const state = reactive({
|
||||
form: {
|
||||
driver_name: '',
|
||||
polling_time: "",
|
||||
faile_retry_time: "",
|
||||
host: '',
|
||||
port: '',
|
||||
id: 1,
|
||||
little_endian: false,
|
||||
wordswap: false
|
||||
},
|
||||
form2: {
|
||||
polling_time: "",
|
||||
|
@ -140,6 +153,26 @@ export default {
|
|||
rack: 1,
|
||||
id: 1
|
||||
},
|
||||
endianArr: [
|
||||
{
|
||||
name: '大端模式',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: '小端模式',
|
||||
value: true
|
||||
}
|
||||
],
|
||||
wordswapArr: [
|
||||
{
|
||||
name: '正常',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: '交换',
|
||||
value: true
|
||||
}
|
||||
],
|
||||
comArr: [],// com
|
||||
baudRateArr: [{
|
||||
name: 2400,
|
||||
|
@ -215,7 +248,9 @@ export default {
|
|||
}
|
||||
}, trigger: 'blur'
|
||||
}],
|
||||
port: [{ required: true, message: "请输入端口号", trigger: "blur" }]
|
||||
port: [{ required: true, message: "请输入端口号", trigger: "blur" }],
|
||||
little_endian: [{ required: true, message: "请选择大小端模式", trigger: "blur" }],
|
||||
wordswap: [{ required: true, message: "请选择字节顺序", trigger: "blur" }]
|
||||
},
|
||||
rules2: {
|
||||
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
||||
|
@ -246,15 +281,15 @@ export default {
|
|||
});
|
||||
const onSubmit = async () => {
|
||||
var header = {
|
||||
driver_name: props.formData.name
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
if (props.pztypecode === 1) {
|
||||
if (props.pztypecode === 2) {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
var param = {
|
||||
...state.form,
|
||||
polling_time: Number(state.form.polling_time),
|
||||
faile_retry_time: Number(state.form.faile_retry_time),
|
||||
host: state.form.host,
|
||||
port: Number(state.form.port),
|
||||
id: Number(state.form.id)
|
||||
}
|
||||
|
@ -268,7 +303,7 @@ export default {
|
|||
} else {
|
||||
}
|
||||
});
|
||||
} else if (props.pztypecode === 2) {
|
||||
} else if (props.pztypecode === 1) {
|
||||
await ruleFormRef2.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// var param = {
|
||||
|
@ -332,8 +367,19 @@ export default {
|
|||
});
|
||||
|
||||
onMounted(() => {
|
||||
getCom();
|
||||
getD();
|
||||
// getCom();
|
||||
});
|
||||
const getD = async () => {
|
||||
const parm = {
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getD(parm);
|
||||
if (res.code == 0) {
|
||||
state.form = res.data;
|
||||
console.log(state.form);
|
||||
}
|
||||
};
|
||||
const getCom = async () => {
|
||||
const parm = {
|
||||
name: props.formData.name
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible">
|
||||
v-model="visible" title="点位管理">
|
||||
<el-card class="top-title">
|
||||
<span>模板名称:{{ formData.template_name }}</span>
|
||||
<!-- <span>模板描述:{{ formData.template_description }}</span>
|
||||
|
@ -64,7 +64,6 @@
|
|||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { Base64 } from 'js-base64';
|
||||
import axios from "axios";
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible">
|
||||
v-model="visible" title="设备管理">
|
||||
<el-card class="top-title">
|
||||
<span>通讯名称:{{ formData.driver_name }}</span>
|
||||
<span>设备数量:{{ propertiesData.length }}</span>
|
||||
|
|
|
@ -288,7 +288,10 @@ s {
|
|||
color: transparent;
|
||||
}
|
||||
.el-form-item__label {
|
||||
width: 100px !important;
|
||||
// width: 100px !important;
|
||||
}
|
||||
.el-drawer__title {
|
||||
font-size: 20px;
|
||||
}
|
||||
/* 点击树结构项的选中颜色 */
|
||||
.el-tree--highlight-current .is-current.el-tree-node > .el-tree-node__content {
|
||||
|
|
|
@ -256,7 +256,7 @@ export default {
|
|||
const openPz = (item) => {
|
||||
state.dialogVisible3 = true;
|
||||
state.pztype = state.qudongOptions[item.type];
|
||||
state.pztypecode = item.type;
|
||||
state.pztypecode = item.driver_type;
|
||||
state.formData = JSON.parse(JSON.stringify(item));
|
||||
}
|
||||
const openDetails = (item) => {
|
||||
|
|
Loading…
Reference in New Issue