main
wangqiujuan0808 2024-10-22 11:56:06 +08:00
parent 33e4edea02
commit 47e6f6ac94
9 changed files with 244 additions and 202 deletions

View File

@ -34,12 +34,12 @@
<el-option v-for="(item, index) of typeOptions" :key="index" :label="item.name" :value="item.key" /> <el-option v-for="(item, index) of typeOptions" :key="index" :label="item.name" :value="item.key" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="通讯模板:" prop="template_name" > <el-form-item label="驱动模板:" prop="template_name" >
<el-select <el-select
v-model="addForm.template_name" v-model="addForm.template_name"
value-key="name" value-key="name"
clearable clearable
placeholder="请选择通讯模板" placeholder="请选择驱动模板"
:disabled="type == '1'" :disabled="type == '1'"
> >
<el-option v-for="(item, index) of templateOptions" :key="index" :label="item.name" :value="item.name" /> <el-option v-for="(item, index) of templateOptions" :key="index" :label="item.name" :value="item.name" />
@ -48,7 +48,7 @@
<el-form-item label="驱动描述:" prop="driver_description"> <el-form-item label="驱动描述:" prop="driver_description">
<el-input <el-input
v-model="addForm.driver_description" v-model="addForm.driver_description"
placeholder="请输入模板描述(不超过50个字符)" placeholder="请输入驱动描述(不超过50个字符)"
clearable clearable
maxlength="50" maxlength="50"
></el-input> ></el-input>
@ -94,7 +94,7 @@ export default {
{ required: true, message: "请选择通讯模板", trigger: "blur" }, { required: true, message: "请选择通讯模板", trigger: "blur" },
], ],
driver_description: [{ required: false, message: "请输入驱动描述", trigger: "blur" }], driver_description: [{ required: false, message: "请输入驱动描述", trigger: "blur" }],
driver_type: [{ required: true, message: "请选择通讯驱动", trigger: "change" }] driver_type: [{ required: true, message: "请选择驱动类型", trigger: "change" }]
}, },
}); });
const visible = computed(() => { const visible = computed(() => {

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-model="visible" :title="type === 'I' ? '新增模板' : '编辑模板'" width="45%" :before-close="closeDialog"> <el-dialog v-model="visible" :title="type === 'I' ? '新增模板' : '编辑模板'" width="45%" :before-close="closeDialog">
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large"> <el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large" label-position="top">
<el-form-item label="模板名称:" prop="template_name"> <el-form-item label="模板名称:" prop="template_name">
<el-input v-model="addForm.template_name" placeholder="请输入模板名称(不超过20个字符)" maxlength="20" clearable <el-input v-model="addForm.template_name" placeholder="请输入模板名称(不超过20个字符)" maxlength="20" clearable
:disabled="type !== 'I'" /> :disabled="type !== 'I'" />

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-model="visible" title="点位管理" width="40%" :before-close="closeDialog"> <el-dialog v-model="visible" title="点位管理" width="40%" :before-close="closeDialog">
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large"> <el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large" label-position="top">
<el-form-item label="点位名称:" prop="point_name"> <el-form-item label="点位名称:" prop="point_name">
<el-input v-model="addForm.point_name" placeholder="请输入点位名称" clearable :disabled="type !== 'I'" /> <el-input v-model="addForm.point_name" placeholder="请输入点位名称" clearable :disabled="type !== 'I'" />
</el-form-item> </el-form-item>
@ -14,8 +14,8 @@
</el-form-item> </el-form-item>
<el-form-item label="点位类型:" prop="point_type"> <el-form-item label="点位类型:" prop="point_type">
<el-select v-model="addForm.point_type" size="mini" placeholder="请选择点位类型"> <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" <el-option v-for="item in datatypeArr" :disabled="item.disabled || item.disabled1" :key="item.value"
:value="item.value" /> :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="点位描述:" prop="point_description"> <el-form-item label="点位描述:" prop="point_description">
@ -23,7 +23,8 @@
</el-form-item> </el-form-item>
<el-form-item label="读写权限:" prop="point_permissions"> <el-form-item label="读写权限:" prop="point_permissions">
<el-select v-model="addForm.point_permissions" size="mini" placeholder="请选择读写权限"> <el-select v-model="addForm.point_permissions" size="mini" placeholder="请选择读写权限">
<el-option v-for="item in perOptions" :disabled="item.disabled" :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-select>
</el-form-item> </el-form-item>
<el-form-item label="缩放系数:" prop="multiplier"> <el-form-item label="缩放系数:" prop="multiplier">
@ -51,7 +52,10 @@ export default {
setup(props, ctx) { setup(props, ctx) {
const checkAddress = (rule, value, callback) => { const checkAddress = (rule, value, callback) => {
let num = Number(value); let num = Number(value);
if (value && (num >= 0 && num <= 65535)) { if (num === 0) {
callback();
}
else if (value && (num > 0 && num <= 65535)) {
callback(); callback();
} else { } else {
callback(new Error("点位地址0-65535")); callback(new Error("点位地址0-65535"));
@ -170,7 +174,7 @@ export default {
onMounted(() => { onMounted(() => {
state.addForm = props.pointData; state.addForm = props.pointData;
getPointData(); getPointData();
changeRegister(); props.type === 'U'? changeSelectData() : changeRegister();
}); });
const getPointData = () => { const getPointData = () => {
@ -186,47 +190,65 @@ export default {
} }
const changeRegister = () => { const changeRegister = () => {
if(state.addForm.register === 1) { changeSelectData();
changeValue();
}
const changeSelectData = () => {
if (state.addForm.register === 1) {
state.datatypeArr.forEach(ele => { // bool state.datatypeArr.forEach(ele => { // bool
ele.disabled1 = ele.value!== 1 ele.disabled1 = ele.value !== 1
}) })
state.perOptions.forEach(ele => {// state.perOptions.forEach(ele => {//
ele.disabled = false; ele.disabled = false;
}) })
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
} }
if(state.addForm.register === 2) { if (state.addForm.register === 2) {
state.datatypeArr.forEach(ele => {// bool state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value!== 1 ele.disabled1 = ele.value !== 1
}) })
state.perOptions.forEach(ele => {// state.perOptions.forEach(ele => {//
ele.disabled = ele.value === 2; ele.disabled = ele.value === 2;
}) })
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
} }
if(state.addForm.register === 3) { if (state.addForm.register === 3) {
state.datatypeArr.forEach(ele => {// bool state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value === 1 ele.disabled1 = ele.value === 1
}) })
state.perOptions.forEach(ele => {// state.perOptions.forEach(ele => {//
ele.disabled = ele.value === 2; ele.disabled = ele.value === 2;
}) })
}
if (state.addForm.register === 4) {
state.datatypeArr.forEach(ele => {// bool
ele.disabled1 = ele.value === 1
})
state.perOptions.forEach(ele => {//
ele.disabled = false;
})
}
}
const changeValue = () => {
if (state.addForm.register === 1) {
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
}
if (state.addForm.register === 2) {
state.addForm.point_type = 1;
state.addForm.point_permissions = 1;
}
if (state.addForm.register === 3) {
state.addForm.point_type = 3; state.addForm.point_type = 3;
state.addForm.point_permissions = 1; state.addForm.point_permissions = 1;
} }
if(state.addForm.register === 4) { 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_type = 3;
state.addForm.point_permissions = 1; state.addForm.point_permissions = 1;
} }
} }
const closeDialog = () => { const closeDialog = () => {
ctx.emit("dialogClose"); ctx.emit("dialogClose");
}; };

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-model="visible" title="设备管理" width="40%" :before-close="closeDialog"> <el-dialog v-model="visible" title="设备管理" width="40%" :before-close="closeDialog">
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large"> <el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large" label-position="top">
<el-form-item label="设备名称:" prop="device_name"> <el-form-item label="设备名称:" prop="device_name">
<el-input v-model="addForm.device_name" placeholder="请输入设备名称(不超过20个字符)" maxlength="10" clearable <el-input v-model="addForm.device_name" placeholder="请输入设备名称(不超过20个字符)" maxlength="10" clearable
:disabled="type !== 'I'" /> :disabled="type !== 'I'" />
@ -55,7 +55,7 @@ export default {
{ min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" }, { min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" },
{ required: true, validator: validName, trigger: "blur" },], { required: true, validator: validName, trigger: "blur" },],
device_description: [ device_description: [
{ required: true, message: "请输入设备描述", trigger: "blur" } { required: false, message: "请输入设备描述", trigger: "blur" }
], ],
slave_id: [ slave_id: [
{ required: true, message: "请输入设备ID", trigger: "blur" }, { required: true, message: "请输入设备ID", trigger: "blur" },

View File

@ -6,47 +6,38 @@
<span class="name">{{ name }}</span> <span class="name">{{ name }}</span>
</div> </div>
<div class="right"> <div class="right">
<el-popover <el-popover placement="bottom" :width="350" trigger="click" popper-class="popper-user-box">
placement="bottom"
:width="350"
trigger="click"
popper-class="popper-user-box"
>
<template #reference> <template #reference>
<div class="author"> <div class="author">
<el-icon><User /></el-icon> <el-icon>
<User />
</el-icon>
{{ (userInfo && userInfo.nickName) || "" }} {{ (userInfo && userInfo.nickName) || "" }}
<el-icon><CaretBottom /></el-icon> <el-icon>
<CaretBottom />
</el-icon>
</div> </div>
</template> </template>
<div class="nickname"> <div class="nickname">
<p>登录名{{ (userInfo && userInfo.nickName) || "" }}</p> <p>登录名{{ (userInfo && userInfo.nickName) || "" }}</p>
<p>昵称{{ (userInfo && userInfo.nickName) || "" }}</p> <p>昵称{{ (userInfo && userInfo.nickName) || "" }}</p>
<el-tag effect="dark" class="reStart" @click="reStart" <div class="btn-class">
>重启设备</el-tag <el-button type="primary" size="large" @click="reStart"></el-button>
> <el-button type="primary" size="large" @click="editPass"></el-button>
<el-tag effect="dark" class="editPass" @click="editPass" <el-button type="primary" size="large" @click="logout">退</el-button>
>修改密码</el-tag </div>
>
<el-tag effect="dark" class="logout" @click="logout"
>退出登录</el-tag
>
</div> </div>
</el-popover> </el-popover>
</div> </div>
</div> </div>
<EditPass <EditPass :dialogVisible="dialogVisible" @dialogClose="dialogClose" @dialogSuccess="dialogSuccess"></EditPass>
:dialogVisible="dialogVisible"
@dialogClose="dialogClose"
@dialogSuccess="dialogSuccess"
></EditPass>
</div> </div>
</template> </template>
<script> <script>
import { onMounted, reactive, toRefs } from "vue"; import { onMounted, reactive, toRefs } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { pathMap,localRemove } from "@/utils"; import { pathMap, localRemove } from "@/utils";
import EditPass from "@/components/EditPass.vue"; import EditPass from "@/components/EditPass.vue";
import { useStore } from "vuex"; import { useStore } from "vuex";
import myApi from "@/api/myApi.js"; import myApi from "@/api/myApi.js";
@ -84,11 +75,11 @@ export default {
ElMessage.error(res.message || "请求失败"); ElMessage.error(res.message || "请求失败");
} }
}; };
const logout = async () => { const logout = async () => {
const res = await myApi.logout(); const res = await myApi.logout();
if (res.code == 0) { if (res.code == 0) {
localRemove("token"); localRemove("token");
window.location.reload(); window.location.reload();
} else { } else {
} }
}; };
@ -125,28 +116,34 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 20px; padding: 0 20px;
.left { .left {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.name { .name {
font-size: 20px; font-size: 20px;
} }
} }
.right { .right {
font-size: 20px; font-size: 20px;
} }
} }
.el-icon-back { .el-icon-back {
border: 1px solid #e9e9e9; border: 1px solid #e9e9e9;
padding: 4px; padding: 4px;
border-radius: 50px; border-radius: 50px;
margin-right: 10px; margin-right: 10px;
} }
.right > div > .icon {
.right>div>.icon {
font-size: 18px; font-size: 18px;
margin-right: 6px; margin-right: 6px;
} }
.author { .author {
margin-left: 10px; margin-left: 10px;
cursor: pointer; cursor: pointer;
@ -154,31 +151,37 @@ export default {
</style> </style>
<style> <style>
.popper-user-box { .popper-user-box {
background: url("https://s.yezgea02.com/lingling-h5/static/account-banner-bg.png") background: url("https://s.yezgea02.com/lingling-h5/static/account-banner-bg.png") 50% 50% no-repeat !important;
50% 50% no-repeat !important;
background-size: cover !important; background-size: cover !important;
border-radius: 0 !important; border-radius: 0 !important;
} }
.popper-user-box .nickname { .popper-user-box .nickname {
position: relative; position: relative;
color: #ffffff; color: #ffffff;
} }
.popper-user-box .nickname .logout { .popper-user-box .nickname .logout {
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
cursor: pointer; cursor: pointer;
} }
.editPass { .editPass {
position: absolute; position: absolute;
right: 75px; right: 75px;
top: 0px; top: 0px;
cursor: pointer; cursor: pointer;
} }
.reStart { .reStart {
position: absolute; position: absolute;
right: 150px; right: 150px;
top: 0px; top: 0px;
cursor: pointer; cursor: pointer;
} }
.btn-class {
margin-top: 10px;
}
</style> </style>

View File

@ -181,7 +181,7 @@ export default {
point_permissions: 1, point_permissions: 1,
multiplier: 1, multiplier: 1,
point_unit: '', point_unit: '',
register: 3 register: 4
} }
} }

View File

@ -3,23 +3,25 @@
<div class="all-content"> <div class="all-content">
<fieldset class="left box2"> <fieldset class="left box2">
<legend class="box-ht">通讯列表</legend> <legend class="box-ht">通讯列表</legend>
<div v-for="(item, i) in driverData" :class="i === indexi ? 'active' : ''" class="qd-one" :key="i" @click="changeQd(i, item)"> <div v-for="(item, i) in driverData" :class="i === indexi ? 'active' : ''" class="qd-one" :key="i"
@click="changeQd(i, item)">
<img src="../assets/qd.png" alt=""> <img src="../assets/qd.png" alt="">
{{ item.driver_name }} {{ item.driver_name }}
</div> </div>
</fieldset> </fieldset>
<div class="right"> <div class="right">
<div class="des"> <div class="des">
<span class="box-title">通讯信息</span> <span class="box-title">驱动信息</span>
<span class="box-info"> <span class="box-info">
<table> <table>
<tr> <tr>
<td style="width:180px;border-bottom: 1px solid #006b3b;"> <td style="width:180px;border-bottom: 1px solid #006b3b;">
通讯名称: {{ curDriver.driver_name }} 驱动名称: {{ curDriver.driver_name }}
</td> </td>
<td style="width:120px;border-bottom: 1px solid #006b3b;">通讯失败计数: {{ curDriver.health && curDriver.health.failure_count }}</td> <td style="width:180px;border-bottom: 1px solid #006b3b;">通讯失败计数: {{ curDriver.health &&
<td style="width:220px;border-bottom: 1px solid #006b3b;"> curDriver.health.failure_count }}</td>
<td style="width:340px;border-bottom: 1px solid #006b3b;">
通讯最后一次成功时间: {{ curDriver.health && curDriver.health.last_success_time }} 通讯最后一次成功时间: {{ curDriver.health && curDriver.health.last_success_time }}
</td> </td>
<td style="border-bottom: 1px solid #006b3b;"> <td style="border-bottom: 1px solid #006b3b;">
@ -29,17 +31,17 @@
通讯总计数: {{ curDriver.health && curDriver.health.total_count }} 通讯总计数: {{ curDriver.health && curDriver.health.total_count }}
</td> </td>
</tr> </tr>
<tr > <tr>
<td > <td >
通讯描述: {{ curDriver.driver_description }} 驱动描述: {{ curDriver.driver_description }}
</td> </td>
<td > <td>
通讯成功计数: {{ curDriver.health && curDriver.health.success_count }} 通讯成功计数: {{ curDriver.health && curDriver.health.success_count }}
</td> </td>
<td> <td>
通讯最后一次失败时间: {{ curDriver.health && curDriver.health.last_failure_ctime }} 通讯最后一次失败时间: {{ curDriver.health && curDriver.health.last_failure_ctime || '-'}}
</td> </td>
<td colspan="2">通讯最后一次失败原因: {{ curDriver.health && curDriver.health.last_failure_cause }}</td> <td colspan="2">通讯最后一次失败原因: {{ curDriver.health && curDriver.health.last_failure_cause }}</td>
</tr> </tr>
@ -49,82 +51,67 @@
<div class="right-con"> <div class="right-con">
<div class="right-set"> <div class="right-set">
<fieldset class="height100 box2"> <fieldset class="height100 box2">
<legend class="box-ht">设备列表</legend> <legend class="box-ht">设备列表</legend>
<el-tree <el-tree :data="deviceData" :props="defaultProps" :highlight-current="true" accordion node-key="device_name"
:data="deviceData" ref="taskTree" :current-node-key="device_name" @node-click="handleNodeClick">
:props="defaultProps" </el-tree>
:highlight-current="true"
accordion
node-key="device_name"
ref="taskTree"
:current-node-key="device_name"
@node-click="handleNodeClick">
</el-tree>
</fieldset> </fieldset>
</div> </div>
<div class="right-table"> <div class="right-table">
<div class="des1"> <div class="des1">
<span class="box-title">设备信息</span> <span class="box-title">设备信息</span>
<div class="box-info1"> <div class="box-info1">
<div> <div>
<el-tag>设备名称: {{ curDevice.device_name }}</el-tag> <el-tag size="medium" type="">设备名称: {{ curDevice.device_name }}</el-tag>
<el-tag>设备描述: {{ curDevice.device_description }} </el-tag> <el-tag size="medium" type="">设备描述: {{ curDevice.device_description }} </el-tag>
</div> </div>
<el-button type="danger" @click="doDevice">{{!curDevice.device_disable? '' : ''}}</el-button> <el-button type="danger" @click="doDevice">{{ !curDevice.device_disable ? '' : '' }}</el-button>
</div> </div>
</div> </div>
<el-table :data="tableData" height="400" border <el-table :data="tableData" height="400" border :header-cell-style="{ background: '#F6F7FC' }" size="large">
:header-cell-style="{ background: '#F6F7FC' }" size="large"> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column prop="point_name" label="名称" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_name" label="名称" width="150" align="center" show-overflow-tooltip />
<el-table-column prop="point_description" label="描述" align="center" show-overflow-tooltip /> <el-table-column prop="point_description" label="描述" align="center" show-overflow-tooltip />
<el-table-column prop="point_quality" label="质量" width="100" align="center" show-overflow-tooltip /> <el-table-column prop="point_quality" label="质量" width="80" align="center" show-overflow-tooltip>
<el-table-column prop="point_value" label="点位值" width="130" align="center" show-overflow-tooltip /> <template #default="scope">
<span>{{ scope.row.point_quality ==1 ? 'good' : 'bad' }}</span>
</template>
</el-table-column>
<el-table-column prop="point_value" label="点位值" width="80" align="center" show-overflow-tooltip />
<el-table-column prop="point_unit" label="单位" width="100" align="center" show-overflow-tooltip /> <el-table-column prop="point_unit" label="单位" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_type" label="类型" width="100" align="center" show-overflow-tooltip /> <el-table-column prop="point_type" label="类型" width="80" align="center" show-overflow-tooltip>
<template #default="scope">
<span>{{ pointTypeOptions[scope.row.point_type] }}</span>
</template>
</el-table-column>
<el-table-column prop="point_timestamp" label="时间戳" width="200" align="center" show-overflow-tooltip /> <el-table-column prop="point_timestamp" label="时间戳" width="200" align="center" show-overflow-tooltip />
<el-table-column label="操作" fixed="right" align="center" width="200" show-overflow-tooltip> <el-table-column label="操作" fixed="right" align="center" width="300" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-button type="success" size="large" @click="openHis(scope.row)"> <el-button type="success" size="large" @click="openHis(scope.row)">
历史 历史
</el-button> </el-button>
<el-button type="warning" size="large" @click="openDe(scope.row)" > <el-button type="warning" size="large" @click="openDe(scope.row)">
详情 详情
</el-button> </el-button>
<el-button type="primary" size="large" @click="openWrite(scope.row)" > <el-button type="primary" size="large" @click="openWrite(scope.row)">
写值 写值
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<De <De :formData="formData" :dialogVisible="dialogVisible" v-if="dialogVisible" @dialogClose="dialogClose"
:formData="formData" @dialogSuccess="dialogSuccess">
:dialogVisible="dialogVisible"
v-if="dialogVisible"
@dialogClose="dialogClose"
@dialogSuccess="dialogSuccess"
>
</De> </De>
<His <His :formData="formData" :dialogVisible="dialogVisible1" v-if="dialogVisible1" @dialogClose="dialogClose"
:formData="formData" @dialogSuccess="dialogSuccess">
:dialogVisible="dialogVisible1"
v-if="dialogVisible1"
@dialogClose="dialogClose"
@dialogSuccess="dialogSuccess"
>
</His> </His>
<Write <Write :formData="formData" :dialogVisible="dialogVisible2" v-if="dialogVisible2" @dialogClose="dialogClose"
:formData="formData" @dialogSuccess="dialogSuccess">
:dialogVisible="dialogVisible2"
v-if="dialogVisible2"
@dialogClose="dialogClose"
@dialogSuccess="dialogSuccess"
>
</Write> </Write>
</el-card> </el-card>
</template> </template>
@ -137,20 +124,20 @@ import De from "@/components/De.vue";
import His from "@/components/His.vue"; import His from "@/components/His.vue";
import Write from "@/components/Write.vue"; import Write from "@/components/Write.vue";
export default { export default {
name: "data", name: "data",
components: { components: {
De, De,
His, His,
Write Write
}, },
setup() { setup() {
const taskTree = ref(null); const taskTree = ref(null);
const state = reactive({ const state = reactive({
indexi: 0, indexi: 0,
driverData: [], driverData: [],
deviceData: [ ], deviceData: [],
currentNodekey: 11, currentNodekey: 11,
tableData: [], tableData: [],
defaultProps: { defaultProps: {
@ -158,21 +145,32 @@ export default {
label: "device_name" label: "device_name"
}, },
curDriver: {}, curDriver: {},
curDevice: {}, curDevice: {},
start: 0, // start: 0, //
// //
formData: {}, formData: {},
dialogVisible: false, dialogVisible: false,
dialogVisible1: false, dialogVisible1: false,
dialogVisible2: false, dialogVisible2: false,
txStatus: [] // txStatus: [], //
pointTypeOptions: {}
}); });
onMounted(() => { onMounted(() => {
getDriverData(); getDriverData();
getTxStatus(); getTxStatus();
getPointType();
}); });
const getPointType = async () => {
const parm = {};
const res = await infoApi.getPointType(parm);
if (res.code == 0) {
state.pointTypeOptions = res.data;
}
}
const getDriverData = async () => { const getDriverData = async () => {
const res = await infoApi.getDriverData(); const res = await infoApi.getDriverData();
if (res.code == 0) { if (res.code == 0) {
@ -186,8 +184,8 @@ export default {
} }
// //
const getTxStatus = async () => { const getTxStatus = async () => {
const res = await infoApi.getTxStatus(); const res = await infoApi.getTxStatus();
if (res.code == 0) { if (res.code == 0) {
@ -195,7 +193,7 @@ export default {
} }
}; };
const changeQd = (i, item) => { const changeQd = (i, item) => {
state.indexi = i; state.indexi = i;
state.curDriver = item; state.curDriver = item;
@ -214,7 +212,7 @@ export default {
handleNodeClick(state.deviceData[0]); handleNodeClick(state.deviceData[0]);
state.curDevice = state.deviceData[0] state.curDevice = state.deviceData[0]
nextTick(() => { nextTick(() => {
console.log(123 , state.deviceData[0].device_name) console.log(123, state.deviceData[0].device_name)
taskTree.value.setCurrentKey(state.deviceData[0].device_name); taskTree.value.setCurrentKey(state.deviceData[0].device_name);
}) })
} }
@ -235,27 +233,27 @@ export default {
} }
const res = await infoApi.getPointData(param); const res = await infoApi.getPointData(param);
if(res.code == 0) { if (res.code == 0) {
state.tableData = res.data; state.tableData = res.data;
} }
} }
// //
const doDevice = async () => { const doDevice = async () => {
const param = { const param = {
driver_name: state.curDevice.driver_name, driver_name: state.curDevice.driver_name,
device_name: state.curDevice.device_name device_name: state.curDevice.device_name
}
const res = !state.curDevice.device_disable ? await infoApi.stopDevice(param) : await infoApi.startDevice(param);
if (res.code == 0) {
ElMessage.success(res.message || '请求成功');
getDeviceData(state.curDriver.driver_name);
}
} }
const res = !state.curDevice.device_disable? await infoApi.stopDevice(param): await infoApi.startDevice(param); const dialogClose = () => {
if (res.code == 0) {
ElMessage.success(res.message || '请求成功');
getDeviceData(state.curDriver.driver_name);
}
}
const dialogClose = () => {
state.dialogVisible = false; state.dialogVisible = false;
state.dialogVisible1 = false; state.dialogVisible1 = false;
state.dialogVisible2= false; state.dialogVisible2 = false;
// //
getPointData(state.curDevice); getPointData(state.curDevice);
}; };
@ -263,28 +261,28 @@ export default {
const dialogSuccess = () => { const dialogSuccess = () => {
state.dialogVisible = false; state.dialogVisible = false;
state.dialogVisible1 = false; state.dialogVisible1 = false;
state.dialogVisible2= false; state.dialogVisible2 = false;
}; };
const openDe = (item) => { const openDe = (item) => {
state.formData = JSON.parse(JSON.stringify(item)); state.formData = JSON.parse(JSON.stringify(item));
state.dialogVisible = true; state.dialogVisible = true;
} }
const openHis = (item) => { const openHis = (item) => {
state.formData = JSON.parse(JSON.stringify(item)); state.formData = JSON.parse(JSON.stringify(item));
state.dialogVisible1 = true; state.dialogVisible1 = true;
} }
const openWrite = (item) => { const openWrite = (item) => {
state.formData = JSON.parse(JSON.stringify(item)); state.formData = JSON.parse(JSON.stringify(item));
state.dialogVisible2 = true; state.dialogVisible2 = true;
} }
return { return {
...toRefs(state), ...toRefs(state),
taskTree, taskTree,
changeQd, changeQd,
handleNodeClick, handleNodeClick,
doDevice, doDevice,
dialogClose, dialogClose,
dialogSuccess, dialogSuccess,
@ -305,14 +303,16 @@ export default {
.left { .left {
width: 15%; width: 15%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
font-size: 16px; font-size: 16px;
height:100%; height: 100%;
.qd-one { .qd-one {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 45px; height: 45px;
img { img {
width: 24px; width: 24px;
} }
@ -323,21 +323,26 @@ export default {
width: 84%; width: 84%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
justify-content: space-around; justify-content: space-around;
.box-title {
height:100% !important; .box-title {
width: 70px; width: 80px;
background: #00AAA3; padding: 10px 5px;
color:#fff; background: #00AAA3;
color: #fff;
// border-right: 1px solid #006b3b; margin:0 5px;
display: flex;
justify-content: center; // border-right: 1px solid #006b3b;
align-items: center; display: flex;
} justify-content: center;
align-items: center;
}
.right-con { .right-con {
margin-top: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.right-set { .right-set {
width: 20%; width: 20%;
padding: 5px; padding: 5px;
@ -351,6 +356,7 @@ export default {
// } // }
} }
} }
.active { .active {
background: #00AAA3; background: #00AAA3;
color: #fff; color: #fff;
@ -359,14 +365,15 @@ export default {
.right { .right {
width: 84%; width: 84%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
.right-set { .right-set {
width: 10%; width: 10%;
padding: 20px; padding: 20px;
overflow: auto; overflow: auto;
} }
.right-table { .right-table {
width: 88%; width: 88%;
// .el-tree-node { // .el-tree-node {
@ -375,43 +382,53 @@ export default {
// } // }
} }
} }
.box-info { .box-info {
width:100%; width: 100%;
display: inline-block; display: inline-block;
height: 100%; height: 100%;
table {
width:100%; table {
height: 100%; width: 100%;
border-collapse: collapse; height: 100%;
} border-collapse: collapse;
td {
padding:5px;
border-right: 1px solid #006b3b;
border-collapse: collapse;
}
}
.des, .des1 {
border-bottom: 1px solid #006b3b;
display: flex;
align-items: center;
width:100%;
height: 80px;
} }
.des1 {
height: 50px; td {
} padding: 5px;
.box-info1 { border-right: 1px solid #006b3b;
width:100%; border-collapse: collapse;
height: 80px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 5px 10px;
}
.el-tag {
margin-right: 10px;
width:200px;
justify-content: left;
} }
}
.des,
.des1 {
border-bottom: 1px solid #006b3b;
display: flex;
align-items: center;
width: 100%;
// height: 80px;
}
.des1 {
height: 50px;
}
.box-info1 {
width: 100%;
height: 80px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 5px 10px;
}
.el-tag {
margin-right: 10px;
width: 200px;
justify-content: left;
padding: 20px 10px;
// background:#00AAA3;
// color: #fff;
}
</style> </style>

View File

@ -2,7 +2,7 @@
<el-card class="content-div"> <el-card class="content-div">
<div class="all-content"> <div class="all-content">
<div class="top-div"> <div class="top-div">
<el-button type="primary" size="large" @click="addData"></el-button> <el-button type="primary" size="large" v-show="tableData && tableData.length>0" @click="addData"></el-button>
</div> </div>
<el-table :data="tableData" style="width: 100%" border stripe <el-table :data="tableData" style="width: 100%" border stripe
:header-cell-style="{ background: '#F6F7FC' }" size="large"> :header-cell-style="{ background: '#F6F7FC' }" size="large">

View File

@ -14,7 +14,7 @@
<span>{{ qudongOptions[scope.row.driver_type] }}</span> <span>{{ qudongOptions[scope.row.driver_type] }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="template_name" label="通讯模板" width="200" align="center"> <el-table-column prop="template_name" label="驱动模板" width="200" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="driver_status" label="驱动状态" width="200" align="center"> <el-table-column prop="driver_status" label="驱动状态" width="200" align="center">
<template #default="scope"> <template #default="scope">
@ -215,7 +215,7 @@ export default {
}) })
.then(async () => { .then(async () => {
let param = { let param = {
name: item.name driver_name: item.driver_name
} }
const res = await infoApi.delTx(param); const res = await infoApi.delTx(param);
if (res.code == 0) { if (res.code == 0) {