diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 435e9a6..1149167 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -188,6 +188,30 @@ const infoApi = { //禁用设备 stopDevice(params) { return postPBRequest("/data", params, 56102); - } + }, + //重置健康信息 + resetHealth(params) { + return postPBRequest("/data", params, 56007); + }, + // 设定 + setHis(params) { + return postPBRequest("/data", params, 56004); + }, + // 启用 + startHis(params) { + return postPBRequest("/data", params, 56002); + }, + // 导出 + exportHis(params) { + return postPBRequest("/data", params, 56006); + }, + // 清空 + clearHis(params) { + return postPBRequest("/data", params, 56005); + }, + // 写值 + writeValue(params) { + return postPBRequest("/data", params, 56001); + }, }; export default infoApi; \ No newline at end of file diff --git a/src/components/De.vue b/src/components/De.vue index 8901a90..38b52d6 100644 --- a/src/components/De.vue +++ b/src/components/De.vue @@ -1,54 +1,56 @@ @@ -74,27 +76,17 @@ export default { }); onMounted(() => { - getD(); }); - const getD = async () => { - // const parm = { - // driver_name: props.formData.driver_name - // } - // const res = await infoApi.getD(parm); - // if (res.code == 0) { - // state.name = res.data.name - // state.healthObj = res.data.health; - // state.countObj = res.data.count; - // } - }; - const resetCount = async () => { - // const parm = { - // name: props.formData.name - // } - // const res = await infoApi.resetCount(parm); - // if (res.code == 0) { - // getD(); - // } + const resetHealth = async () => { + const parm = { + driver_name: props.formData.driver_name, + device_name: props.formData.device_name, + point_name: props.formData.point_name + } + const res = await infoApi.resetHealth(parm); + if (res.code == 0) { + ElMessage.success(res.message || "请求成功"); + } } const closeDialog = () => { ctx.emit("dialogClose"); @@ -104,14 +96,14 @@ export default { return { ...toRefs(state), visible, - closeDialog, - getD, - resetCount + closeDialog, + resetHealth }; }, }; diff --git a/src/components/His.vue b/src/components/His.vue index dab9989..01ca14b 100644 --- a/src/components/His.vue +++ b/src/components/His.vue @@ -1,13 +1,25 @@ + diff --git a/src/css/index.scss b/src/css/index.scss index 2d519a4..8f9fdd4 100644 --- a/src/css/index.scss +++ b/src/css/index.scss @@ -318,4 +318,7 @@ s { } .height100 { height:100%; +} +.el-drawer__header { + margin-bottom: 0 !important; } \ No newline at end of file diff --git a/src/views/Data.vue b/src/views/Data.vue index 9a10f4b..d4acbb7 100644 --- a/src/views/Data.vue +++ b/src/views/Data.vue @@ -15,7 +15,7 @@ 通讯名称: {{ curDriver.driver_name }} 通讯总计数: {{ curDriver.health && curDriver.health.total_count }} 通讯描述: {{ curDriver.driver_description }} - 通讯状态: {{ curDriver.driver_status }} + 通讯状态: {{ txStatus[curDriver.driver_status] }} 通讯成功计数: {{ curDriver.health && curDriver.health.success_count }} 通讯失败计数: {{ curDriver.health && curDriver.health.failure_count }} 通讯最后一次成功时间: {{ curDriver.health && curDriver.health.last_success_time }} @@ -45,16 +45,16 @@
设备名称: {{ curDevice.device_name }} 设备描述: {{ curDevice.device_description }} - {{!curDevice.device_disable? '启用' : '禁用'}} + {{!curDevice.device_disable? '禁用' : '启用'}}
- - + @@ -63,10 +63,10 @@ 历史 - + 详情 - + 写值 @@ -93,6 +93,14 @@ @dialogSuccess="dialogSuccess" > + + @@ -102,10 +110,13 @@ import infoApi from "@/api/infoApi.js"; import { ElMessage, ElMessageBox } from "element-plus"; import De from "@/components/De.vue"; import His from "@/components/His.vue"; +import Write from "@/components/Write.vue"; export default { name: "data", components: { - De + De, + His, + Write }, setup() { @@ -128,10 +139,13 @@ export default { formData: {}, dialogVisible: false, dialogVisible1: false, + dialogVisible2: false, + txStatus: [] //通讯状态 }); onMounted(() => { getDriverData(); + getTxStatus(); }); const getDriverData = async () => { @@ -147,6 +161,16 @@ export default { } + // 获取通讯状态 + const getTxStatus = async () => { + + const res = await infoApi.getTxStatus(); + if (res.code == 0) { + state.txStatus = res.data; + } + + + }; const changeQd = (i, item) => { state.indexi = i; state.curDriver = item; @@ -191,26 +215,30 @@ export default { } } + // 启用禁用设备 const doDevice = async () => { const param = { driver_name: state.curDevice.driver_name, device_name: state.curDevice.device_name } - const res = !state.curDevice.device_disable? await infoApi.startDevice(param): await infoApi.stopDevice(param); + const res = !state.curDevice.device_disable? await infoApi.stopDevice(param): await infoApi.startDevice(param); if (res.code == 0) { ElMessage.success(res.message || '请求成功'); - getDeviceData(state.curDevice.driver_name); - getPointData(state.curDevice); + getDeviceData(state.curDriver.driver_name); } } const dialogClose = () => { state.dialogVisible = false; state.dialogVisible1 = false; + state.dialogVisible2= false; + // 更新点位表 + getPointData(state.curDevice); }; const dialogSuccess = () => { state.dialogVisible = false; state.dialogVisible1 = false; + state.dialogVisible2= false; }; const openDe = (item) => { state.formData = JSON.parse(JSON.stringify(item)); @@ -221,6 +249,11 @@ export default { state.formData = JSON.parse(JSON.stringify(item)); state.dialogVisible1 = true; + } + const openWrite = (item) => { + state.formData = JSON.parse(JSON.stringify(item)); + state.dialogVisible2 = true; + } return { ...toRefs(state), @@ -231,7 +264,9 @@ export default { dialogClose, dialogSuccess, openDe, - openHis + openHis, + openWrite, + getTxStatus }; }, }; @@ -321,6 +356,7 @@ export default { flex-wrap: wrap; justify-content: space-between; align-items: center; + padding: 0 10px; .el-tag { margin: 10px; }