代码暂存
parent
7b67cd7221
commit
a511bf3e7b
|
@ -27,7 +27,6 @@
|
||||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||||
import infoApi from "@/api/infoApi.js";
|
import infoApi from "@/api/infoApi.js";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
// import { mb_list, mb_info, response} from '../proto/data/pd'
|
|
||||||
export default {
|
export default {
|
||||||
props: ["formData", "dialogVisible", "type", "templateData"],
|
props: ["formData", "dialogVisible", "type", "templateData"],
|
||||||
emits: ["dialogClose", "dialogSuccess"],
|
emits: ["dialogClose", "dialogSuccess"],
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
|
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
|
||||||
|
|
||||||
<fieldset class="box2">
|
|
||||||
<legend class="box-ht">驱动名称</legend>
|
|
||||||
<el-form label-width="130px">
|
|
||||||
<el-form-item>
|
|
||||||
{{ name }}
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="box2">
|
<fieldset class="box2">
|
||||||
<legend class="box-ht">通讯状态</legend>
|
<legend class="box-ht">驱动名称</legend>
|
||||||
<el-form label-width="130px">
|
<el-form label-width="130px">
|
||||||
<el-form-item label="健康状态">
|
<el-form-item>
|
||||||
<el-input disabled v-model="health[healthObj.status]"></el-input>
|
{{ name }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="最后一次成功时间">
|
</el-form>
|
||||||
<el-input disabled v-model="healthObj.last_success_time"></el-input>
|
</fieldset>
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="最后一次失败时间">
|
<fieldset class="box2">
|
||||||
<el-input disabled v-model="healthObj.last_failure_ctime"></el-input>
|
<legend class="box-ht">通讯状态</legend>
|
||||||
</el-form-item>
|
<el-form label-width="130px">
|
||||||
<el-form-item label="最后一次失败原因">
|
<el-form-item label="健康状态">
|
||||||
<el-input disabled v-model="healthObj.last_failure_cause"></el-input>
|
<el-input disabled v-model="health[healthObj.status]"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
<el-form-item label="最后一次成功时间">
|
||||||
</fieldset>
|
<el-input disabled v-model="healthObj.last_success_time"></el-input>
|
||||||
<fieldset class="box2">
|
</el-form-item>
|
||||||
<legend class="box-ht">通讯计数</legend>
|
<el-form-item label="最后一次失败时间">
|
||||||
<el-form label-width="130px">
|
<el-input disabled v-model="healthObj.last_failure_ctime"></el-input>
|
||||||
<el-form-item label="总计数">
|
</el-form-item>
|
||||||
<el-input disabled v-model="countObj.total_count"></el-input>
|
<el-form-item label="最后一次失败原因">
|
||||||
</el-form-item>
|
<el-input disabled v-model="healthObj.last_failure_cause"></el-input>
|
||||||
<el-form-item label="失败计数">
|
</el-form-item>
|
||||||
<el-input disabled v-model="countObj.failure_count"></el-input>
|
</el-form>
|
||||||
</el-form-item>
|
</fieldset>
|
||||||
<el-form-item label="成功计数">
|
<fieldset class="box2">
|
||||||
<el-input disabled v-model="countObj.success_count"></el-input>
|
<legend class="box-ht">通讯计数</legend>
|
||||||
</el-form-item>
|
<el-form label-width="130px">
|
||||||
</el-form>
|
<el-form-item label="总计数">
|
||||||
<div class="btns">
|
<el-input disabled v-model="countObj.total_count"></el-input>
|
||||||
<el-button type="primary" size="large" @click="resetCount">重置计数</el-button>
|
</el-form-item>
|
||||||
<!-- <el-button @click="closeDialog">取消</el-button> -->
|
<el-form-item label="失败计数">
|
||||||
</div>
|
<el-input disabled v-model="countObj.failure_count"></el-input>
|
||||||
</fieldset>
|
</el-form-item>
|
||||||
|
<el-form-item label="成功计数">
|
||||||
|
<el-input disabled v-model="countObj.success_count"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div class="btns">
|
||||||
|
<el-button type="primary" size="large" @click="resetCount">重置计数</el-button>
|
||||||
|
<!-- <el-button @click="closeDialog">取消</el-button> -->
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -75,19 +75,19 @@ export default {
|
||||||
getD();
|
getD();
|
||||||
});
|
});
|
||||||
const getD = async () => {
|
const getD = async () => {
|
||||||
const parm = {
|
const parm = {
|
||||||
name: props.formData.driver_name
|
driver_name: props.formData.driver_name
|
||||||
}
|
}
|
||||||
const res = await infoApi.getD(parm);
|
const res = await infoApi.getD(parm);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
state.name = res.data.name
|
state.name = res.data.name
|
||||||
state.healthObj = res.data.health;
|
state.healthObj = res.data.health;
|
||||||
state.countObj = res.data.count;
|
state.countObj = res.data.count;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const resetCount = async () => {
|
const resetCount = async () => {
|
||||||
const parm = {
|
const parm = {
|
||||||
name: props.formData.name
|
name: props.formData.name
|
||||||
}
|
}
|
||||||
const res = await infoApi.resetCount(parm);
|
const res = await infoApi.resetCount(parm);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
@ -97,7 +97,7 @@ export default {
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
ctx.emit("dialogClose");
|
ctx.emit("dialogClose");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
@ -113,6 +113,7 @@ export default {
|
||||||
::v-deep .el-form-item__content {
|
::v-deep .el-form-item__content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
>span {
|
>span {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
<template>
|
<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">
|
<fieldset class="box2">
|
||||||
<legend class="box-ht">驱动名称</legend>
|
<legend class="box-ht">驱动名称</legend>
|
||||||
<el-form label-width="130px">
|
<el-form label-width="130px">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
{{ formData.name }}
|
{{ form.driver_name }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- 1 modbus_tcp -->
|
<!-- 2 modbus_tcp -->
|
||||||
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 1">
|
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 2">
|
||||||
<fieldset class="box2">
|
<fieldset class="box2">
|
||||||
<legend class="box-ht">通用配置</legend>
|
<legend class="box-ht">通用配置</legend>
|
||||||
<el-form-item label="轮询时间" prop="polling_time">
|
<el-form-item label="轮询时间" prop="polling_time">
|
||||||
|
@ -27,10 +27,20 @@
|
||||||
<el-form-item label="端口号" prop="port">
|
<el-form-item label="端口号" prop="port">
|
||||||
<el-input-number v-model="form.port" :min="1" clearable />
|
<el-input-number v-model="form.port" :min="1" clearable />
|
||||||
</el-form-item>
|
</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>
|
</fieldset>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 2: 'modbus_rtu' -->
|
<!-- 1: 'modbus_rtu' -->
|
||||||
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 2">
|
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 1">
|
||||||
<fieldset class="box2">
|
<fieldset class="box2">
|
||||||
<legend class="box-ht">通用配置</legend>
|
<legend class="box-ht">通用配置</legend>
|
||||||
<el-form-item label="轮询时间" prop="polling_time">
|
<el-form-item label="轮询时间" prop="polling_time">
|
||||||
|
@ -116,11 +126,14 @@ export default {
|
||||||
const ruleFormRef3 = ref(null);
|
const ruleFormRef3 = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
form: {
|
form: {
|
||||||
|
driver_name: '',
|
||||||
polling_time: "",
|
polling_time: "",
|
||||||
faile_retry_time: "",
|
faile_retry_time: "",
|
||||||
host: '',
|
host: '',
|
||||||
port: '',
|
port: '',
|
||||||
id: 1,
|
id: 1,
|
||||||
|
little_endian: false,
|
||||||
|
wordswap: false
|
||||||
},
|
},
|
||||||
form2: {
|
form2: {
|
||||||
polling_time: "",
|
polling_time: "",
|
||||||
|
@ -140,6 +153,26 @@ export default {
|
||||||
rack: 1,
|
rack: 1,
|
||||||
id: 1
|
id: 1
|
||||||
},
|
},
|
||||||
|
endianArr: [
|
||||||
|
{
|
||||||
|
name: '大端模式',
|
||||||
|
value: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '小端模式',
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
wordswapArr: [
|
||||||
|
{
|
||||||
|
name: '正常',
|
||||||
|
value: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '交换',
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
],
|
||||||
comArr: [],// com
|
comArr: [],// com
|
||||||
baudRateArr: [{
|
baudRateArr: [{
|
||||||
name: 2400,
|
name: 2400,
|
||||||
|
@ -215,7 +248,9 @@ export default {
|
||||||
}
|
}
|
||||||
}, trigger: 'blur'
|
}, 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: {
|
rules2: {
|
||||||
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
||||||
|
@ -246,15 +281,15 @@ export default {
|
||||||
});
|
});
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
var header = {
|
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) => {
|
await ruleFormRef.value.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
var param = {
|
var param = {
|
||||||
|
...state.form,
|
||||||
polling_time: Number(state.form.polling_time),
|
polling_time: Number(state.form.polling_time),
|
||||||
faile_retry_time: Number(state.form.faile_retry_time),
|
faile_retry_time: Number(state.form.faile_retry_time),
|
||||||
host: state.form.host,
|
|
||||||
port: Number(state.form.port),
|
port: Number(state.form.port),
|
||||||
id: Number(state.form.id)
|
id: Number(state.form.id)
|
||||||
}
|
}
|
||||||
|
@ -268,7 +303,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (props.pztypecode === 2) {
|
} else if (props.pztypecode === 1) {
|
||||||
await ruleFormRef2.value.validate(async (valid) => {
|
await ruleFormRef2.value.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// var param = {
|
// var param = {
|
||||||
|
@ -332,8 +367,19 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
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 getCom = async () => {
|
||||||
const parm = {
|
const parm = {
|
||||||
name: props.formData.name
|
name: props.formData.name
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
<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">
|
<el-card class="top-title">
|
||||||
<span>模板名称:{{ formData.template_name }}</span>
|
<span>模板名称:{{ formData.template_name }}</span>
|
||||||
<!-- <span>模板描述:{{ formData.template_description }}</span>
|
<!-- <span>模板描述:{{ formData.template_description }}</span>
|
||||||
|
@ -64,7 +64,6 @@
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { Base64 } from 'js-base64';
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||||
import infoApi from "@/api/infoApi.js";
|
import infoApi from "@/api/infoApi.js";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
<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">
|
<el-card class="top-title">
|
||||||
<span>通讯名称:{{ formData.driver_name }}</span>
|
<span>通讯名称:{{ formData.driver_name }}</span>
|
||||||
<span>设备数量:{{ propertiesData.length }}</span>
|
<span>设备数量:{{ propertiesData.length }}</span>
|
||||||
|
|
|
@ -288,7 +288,10 @@ s {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
}
|
}
|
||||||
.el-form-item__label {
|
.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 {
|
.el-tree--highlight-current .is-current.el-tree-node > .el-tree-node__content {
|
||||||
|
|
|
@ -256,7 +256,7 @@ export default {
|
||||||
const openPz = (item) => {
|
const openPz = (item) => {
|
||||||
state.dialogVisible3 = true;
|
state.dialogVisible3 = true;
|
||||||
state.pztype = state.qudongOptions[item.type];
|
state.pztype = state.qudongOptions[item.type];
|
||||||
state.pztypecode = item.type;
|
state.pztypecode = item.driver_type;
|
||||||
state.formData = JSON.parse(JSON.stringify(item));
|
state.formData = JSON.parse(JSON.stringify(item));
|
||||||
}
|
}
|
||||||
const openDetails = (item) => {
|
const openDetails = (item) => {
|
||||||
|
|
Loading…
Reference in New Issue