main
wangqiujuan0808 2024-12-29 22:22:10 +08:00
parent 244832ff69
commit 013a5c9e78
29 changed files with 186 additions and 116 deletions

16
package-lock.json generated
View File

@ -13,7 +13,7 @@
"@sentry/tracing": "^6.3.1", "@sentry/tracing": "^6.3.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"echarts": "^5.4.2", "echarts": "^5.4.2",
"element-plus": "^2.3.4", "element-plus": "^2.8.6",
"js-base64": "^3.7.7", "js-base64": "^3.7.7",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"moment": "^2.29.4", "moment": "^2.29.4",
@ -628,9 +628,9 @@
} }
}, },
"node_modules/@element-plus/icons-vue": { "node_modules/@element-plus/icons-vue": {
"version": "2.1.0", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/@element-plus/icons-vue/-/icons-vue-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.3.1.tgz",
"integrity": "sha512-PSBn3elNoanENc1vnCfh+3WA9fimRC7n+fWkf3rE5jvv+aBohNHABC/KAR5KWPecxWxDTVT1ERpRbOMRcOV/vA==", "integrity": "sha512-XxVUZv48RZAd87ucGS48jPf6pKu0yV5UCg9f4FFwtrYxXOwWuVJo6wOvSLKEoMQKjv8GsX/mhP6UsC1lRwbUWg==",
"peerDependencies": { "peerDependencies": {
"vue": "^3.2.0" "vue": "^3.2.0"
} }
@ -2655,12 +2655,12 @@
"integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==" "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung=="
}, },
"node_modules/element-plus": { "node_modules/element-plus": {
"version": "2.3.4", "version": "2.8.6",
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.3.4.tgz", "resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.8.6.tgz",
"integrity": "sha512-SQr0J9z7N4z48WYk/l9NE2tizl8Q7j2OhqlpTc42k4pGncry3+rVX6dsmcsglFynn6vt3NzYxWJqmLFyDKQq+g==", "integrity": "sha512-fk5jB8V3efM02/4roZ5SWOLArgaYXbxEydZLlXSr+KPAwjNyHBlk2+HO5em8YKo5+RLBoHnn6BaThj6IE4nXoQ==",
"dependencies": { "dependencies": {
"@ctrl/tinycolor": "^3.4.1", "@ctrl/tinycolor": "^3.4.1",
"@element-plus/icons-vue": "^2.0.6", "@element-plus/icons-vue": "^2.3.1",
"@floating-ui/dom": "^1.0.1", "@floating-ui/dom": "^1.0.1",
"@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7", "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7",
"@types/lodash": "^4.14.182", "@types/lodash": "^4.14.182",

View File

@ -15,7 +15,7 @@
"@sentry/tracing": "^6.3.1", "@sentry/tracing": "^6.3.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"echarts": "^5.4.2", "echarts": "^5.4.2",
"element-plus": "^2.3.4", "element-plus": "^2.8.6",
"js-base64": "^3.7.7", "js-base64": "^3.7.7",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"moment": "^2.29.4", "moment": "^2.29.4",

View File

@ -67,6 +67,10 @@ const infoApi = {
exportP(params) { exportP(params) {
return postPBRequest('/template', params, 53211, params.template_name) return postPBRequest('/template', params, 53211, params.template_name)
}, },
// dlt645 point
getDlt645Data() {
return postPBRequest("/template", {}, 53012);
},
// //
getTx(params) { getTx(params) {
return postPBRequest('/driver', params, 54000) return postPBRequest('/driver', params, 54000)
@ -190,6 +194,6 @@ const infoApi = {
// //
writeValue(params) { writeValue(params) {
return postPBRequest("/data", params, 56001); return postPBRequest("/data", params, 56001);
}, }
}; };
export default infoApi; export default infoApi;

View File

@ -125,7 +125,7 @@ export default {
if (valid) { if (valid) {
const res = props.type === '0' ? await infoApi.saveTx(state.addForm) : await infoApi.editTx(state.addForm); const res = props.type === '0' ? await infoApi.saveTx(state.addForm) : await infoApi.editTx(state.addForm);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message);

View File

@ -94,11 +94,11 @@ export default {
if (valid) { if (valid) {
const res = props.type === 'I' ? await infoApi.addMb(state.addForm) : await infoApi.editMb(state.addForm); const res = props.type === 'I' ? await infoApi.addMb(state.addForm) : await infoApi.editMb(state.addForm);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
// //
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }

View File

@ -1,6 +1,8 @@
<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" label-position="top"> <!-- modbus -->
<el-form v-if="formData.template_type === 1" :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>
@ -34,6 +36,33 @@
<el-input v-model="addForm.point_unit" placeholder="请输入点位单位" clearable /> <el-input v-model="addForm.point_unit" placeholder="请输入点位单位" clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- dlt645 2007 -->
<el-form v-if="formData.template_type === 5" :model="addForm" label-width="100px" :rules="rules1" ref="ruleFormRef">
<el-form-item label="点位名称:" prop="point_name">
<el-select v-model="addForm.point_name" size="mini" placeholder="请选择点位名称" @change="changePointName">
<el-option v-for="(item, key) of dlt645PointData" :key="key" :label="key"
:value="key" />
</el-select>
</el-form-item>
<el-form-item label="点位地址:" prop="id">
<el-input v-model="addForm.id" disabled/>
</el-form-item>
<el-form-item label="点位描述:" prop="point_description">
<el-input v-model="addForm.point_description" disabled/>
</el-form-item>
<el-form-item label="读写权限:" prop="point_permissions">
<el-select v-model="addForm.point_permissions" size="mini" placeholder="请选择读写权限" disabled>
<el-option v-for="item in perOptions" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="缩放系数:" prop="multiplier">
<el-input v-model="addForm.multiplier" placeholder="请输入缩放系数" type="number" clearable />
</el-form-item>
<el-form-item label="点位单位:" prop="point_unit">
<el-input v-model="addForm.point_unit" disabled/>
</el-form-item>
</el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button size="large" @click="closeDialog"></el-button> <el-button size="large" @click="closeDialog"></el-button>
@ -166,6 +195,11 @@ export default {
{ required: false, message: "请输入点位描述", trigger: "blur" } { required: false, message: "请输入点位描述", trigger: "blur" }
], ],
}, },
rules1: {
point_name: { required: true, message: "请输入点位名称", trigger: "blur" },
multiplier: [{ required: true, message: "请输入缩放系数", trigger: "blur" }],
},
dlt645PointData: {},
}); });
const visible = computed(() => { const visible = computed(() => {
return props.dialogVisible; return props.dialogVisible;
@ -173,10 +207,36 @@ export default {
onMounted(() => { onMounted(() => {
state.addForm = props.pointData; state.addForm = props.pointData;
if (props.formData.template_type === 1) {// modbus
getPointData(); getPointData();
props.type === 'U' ? changeSelectData() : changeRegister(); props.type === 'U' ? changeSelectData() : changeRegister();
}
if (props.formData.template_type === 5) {// dlt645 2007
getDlt645Data();
}
}); });
const getDlt645Data = async () => {
const res = await infoApi.getDlt645Data();
if (res.code == 0) {
state.dlt645PointData = res.data;
} else {
ElMessage.error(res.data || res.message);
}
}
const changePointName = () => {
let somePointData = state.dlt645PointData[state.addForm.point_name];
console.log(somePointData);
state.addForm.id = somePointData.id;
state.addForm.point_description = somePointData.point_description;
state.addForm.point_permissions = somePointData.point_permissions;
state.addForm.multiplier = somePointData.multiplier;
state.addForm.point_unit = somePointData.point_unit;
}
const getPointData = () => { const getPointData = () => {
state.datatypeArr = []; state.datatypeArr = [];
for (let i in props.pointTypeOptions) { for (let i in props.pointTypeOptions) {
@ -265,10 +325,10 @@ export default {
} }
const res = props.type === 'I' ? await infoApi.addP(param) : await infoApi.editP(param); const res = props.type === 'I' ? await infoApi.addP(param) : await infoApi.editP(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }
@ -282,7 +342,8 @@ export default {
closeDialog, closeDialog,
saveP, saveP,
ruleFormRef, ruleFormRef,
changeRegister changeRegister,
changePointName
}; };
}, },
}; };

View File

@ -110,10 +110,10 @@ export default {
const res = props.type === 'I' ? await infoApi.saveTx(req_data) : await infoApi.updateTx(req_data); const res = props.type === 'I' ? await infoApi.saveTx(req_data) : await infoApi.updateTx(req_data);
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
if(ret.code == 0) { if(ret.code == 0) {
ElMessage.success(res.message || '请求成功'); ElMessage.success(res.data || res.message || '请求成功');
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }

View File

@ -86,10 +86,10 @@ export default {
} }
const res = props.type === 'I' ? await infoApi.addSet(param) : await infoApi.editSet(param); const res = props.type === 'I' ? await infoApi.addSet(param) : await infoApi.editSet(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }

View File

@ -393,10 +393,10 @@ export default {
if (valid) { if (valid) {
const res = await infoApi.saveTc(props.formData); const res = await infoApi.saveTc(props.formData);
if(res.code == 0) { if(res.code == 0) {
ElMessage.success(res.msg || '请求成功'); ElMessage.success(res.data || res.message || '请求成功');
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }

View File

@ -85,7 +85,7 @@ export default {
} }
const res = await infoApi.resetHealth(parm); const res = await infoApi.resetHealth(parm);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
} }
} }
const closeDialog = () => { const closeDialog = () => {

View File

@ -37,10 +37,10 @@ export default {
const saveP = async () => { const saveP = async () => {
const res = await infoApi.importDevice(state.importData, props.formData.driver_name); const res = await infoApi.importDevice(state.importData, props.formData.driver_name);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message); ElMessage.success(res.data || res.message || "请求成功");
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };

View File

@ -38,10 +38,10 @@ export default {
const saveP = async () => { const saveP = async () => {
const res = await infoApi.importP(state.importData, props.formData.template_name); const res = await infoApi.importP(state.importData, props.formData.template_name);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message); ElMessage.success(res.data || res.message || "请求成功");
ctx.emit("dialogSuccess"); ctx.emit("dialogSuccess");
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };

View File

@ -70,9 +70,9 @@ export default {
const reStart = async () => { const reStart = async () => {
const res = await infoApi.reboot(); const res = await infoApi.reboot();
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
} else { } else {
ElMessage.error(res.message || "请求失败"); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };
const logout = async () => { const logout = async () => {

View File

@ -1,12 +1,14 @@
<template> <template>
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog"> <el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
<div class="count-status"> <div class="count-status">
<el-tag>最大计数: {{ formData.history && formData.history.max }}</el-tag> <el-tag v-if="formData.history && formData.history.enable">: {{ formData.history && formData.history.max
}}</el-tag>
<el-tag>状态: {{ formData.history && formData.history.enable ? "启用" : "禁用" }}</el-tag> <el-tag>状态: {{ formData.history && formData.history.enable ? "启用" : "禁用" }}</el-tag>
</div> </div>
<div> <div>
<el-table :data="tableData" height="400" border :header-cell-style="{ background: '#F6F7FC' }" size="large"> <el-table :data="tableData" height="600" border :header-cell-style="{ background: '#F6F7FC' }" size="large"
:sort-method="sortDates">
<el-table-column type="index" label="序号" width="80" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column prop="timestamp" label="时间戳" align="center" /> <el-table-column prop="timestamp" label="时间戳" align="center" />
<el-table-column prop="value" label="点位值" align="center" /> <el-table-column prop="value" label="点位值" align="center" />
@ -74,16 +76,6 @@ export default {
} }
} }
const exportHis = async () => { const exportHis = 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.exportHis(parm);
// const url = window.URL.createObjectURL(new Blob([res]));
// window.open(url);
const params = { const params = {
driver_name: props.formData.driver_name, driver_name: props.formData.driver_name,
device_name: props.formData.device_name, device_name: props.formData.device_name,
@ -123,6 +115,12 @@ export default {
ctx.emit("dialogClose"); ctx.emit("dialogClose");
}; };
const sortDates = (a, b) => {
const dateA = new Date(a.timestamp);
const dateB = new Date(b.timestamp);
return dateA - dateB;
}
return { return {
...toRefs(state), ...toRefs(state),
@ -132,7 +130,8 @@ export default {
startHis, startHis,
exportHis, exportHis,
clearHis, clearHis,
dialogSuccess1 dialogSuccess1,
sortDates
}; };
}, },
}; };

View File

@ -4,7 +4,7 @@
<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>
{{ form.driver_name }} {{ formData.driver_name }}
</el-form-item> </el-form-item>
</el-form> </el-form>
</fieldset> </fieldset>
@ -40,7 +40,7 @@
</fieldset> </fieldset>
</el-form> </el-form>
<!-- 1: 'modbus_rtu' --> <!-- 1: 'modbus_rtu' -->
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 1"> <el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 1 || pztypecode === 6">
<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">
@ -307,7 +307,7 @@ export default {
} else { } else {
} }
}); });
} else if (props.pztypecode === 1) { // modbus_rtu } else if (props.pztypecode === 1 || props.pztypecode === 6) { // modbus_rtu
await ruleFormRef2.value.validate(async (valid) => { await ruleFormRef2.value.validate(async (valid) => {
if (valid) { if (valid) {
var param = { var param = {
@ -373,7 +373,7 @@ export default {
if (props.pztypecode === 2) { if (props.pztypecode === 2) {
state.form = res.data; state.form = res.data;
} }
if (props.pztypecode === 1) { if (props.pztypecode === 1 || props.pztypecode === 6) {
state.form2 = res.data; state.form2 = res.data;
state.form2.com_name = res.data.com.name; state.form2.com_name = res.data.com.name;
state.form2.dataBits = Number(res.data.com.dataBits); state.form2.dataBits = Number(res.data.com.dataBits);

View File

@ -36,7 +36,7 @@ export default {
rules: { rules: {
max: [ max: [
{ required: true, message: "请输入历史记录最大数量", trigger: "blur" }, { required: true, message: "请输入历史记录最大数量(最大值50-250)", trigger: "blur" },
{ required: true, validator: checkMax, trigger: "blur" } { required: true, validator: checkMax, trigger: "blur" }
], ],
}, },

View File

@ -19,7 +19,9 @@
<el-table-column type="index" label="序号" width="80" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column prop="point_name" label="点位名称" align="center" show-overflow-tooltip> <el-table-column prop="point_name" label="点位名称" align="center" show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="点位地址" align="center" show-overflow-tooltip> <el-table-column prop="address" label="点位地址" align="center" show-overflow-tooltip v-if="formData.template_type===1">
</el-table-column>
<el-table-column prop="id" label="点位地址" align="center" show-overflow-tooltip v-if="formData.template_type ===5">
</el-table-column> </el-table-column>
<el-table-column prop="point_type" label="点位类型" align="center" show-overflow-tooltip> <el-table-column prop="point_type" label="点位类型" align="center" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
@ -27,7 +29,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="register" label="寄存器" align="center" show-overflow-tooltip> <el-table-column prop="register" label="寄存器" align="center" show-overflow-tooltip v-if="formData.template_type!==5">
<template #default="scope"> <template #default="scope">
<span>{{ registerData[scope.row.register] }}</span> <span>{{ registerData[scope.row.register] }}</span>
</template> </template>

View File

@ -95,7 +95,7 @@ export default {
}); });
} }
} else { } else {
ElMessage.error(res.data || res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };
const closeDialog = () => { const closeDialog = () => {
@ -115,10 +115,10 @@ export default {
} }
const res = await infoApi.delSet(param); const res = await infoApi.delSet(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "删除成功"); ElMessage.success(res.data || res.message || "删除成功");
getSet(); getSet();
} else { } else {
ElMessage.error(res.data | res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}) })
.catch(() => { .catch(() => {

View File

@ -1,7 +1,7 @@
<template> <template>
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog"> <el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
<div class="count-status"> <div class="count-status">
<el-input-number v-model="writeV" style="width: 240px" placeholder="请输入点位值" /> <el-input-number v-model="writeV" style="width: 240px" placeholder="请输入点位值" size="large"/>
</div> </div>
<div class="btns"> <div class="btns">
<el-button type="primary" size="large" @click="writeValue"></el-button> <el-button type="primary" size="large" @click="writeValue"></el-button>

View File

@ -2,6 +2,7 @@ import { createApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import ElementPlus from "element-plus"; import ElementPlus from "element-plus";
import "element-plus/dist/index.css"; import "element-plus/dist/index.css";
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import router from "./router/index"; import router from "./router/index";
import store from "./store/index"; import store from "./store/index";
import "./css/index.scss"; import "./css/index.scss";
@ -12,7 +13,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component); app.component(key, component);
} }
app.use(ElementPlus); app.use(ElementPlus, {lacale: zhCn});
app.use(router); app.use(router);
app.use(store); app.use(store);

View File

@ -54,9 +54,9 @@ axios.interceptors.response.use(
(error) => { (error) => {
ElMessage.closeAll(); ElMessage.closeAll();
ElMessage.error("请求错误"); ElMessage.error("请求错误");
// router.push({ router.push({
// path: "/login" path: "/login"
// }); });
return Promise.reject(error); return Promise.reject(error);
} }
); );

View File

@ -16,34 +16,27 @@
<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 }}
</td>
<td style="width:180px;border-bottom: 1px solid #006b3b;">通讯失败计数: {{ curDriver.health &&
curDriver.health.failure_count }}</td>
<td style="width:340px;border-bottom: 1px solid #006b3b;">
通讯最后一次成功时间: {{ curDriver.health && curDriver.health.last_success_time }}
</td>
<td style="border-bottom: 1px solid #006b3b;">
通讯状态: {{ txStatus[curDriver.driver_status] }} 通讯状态: {{ txStatus[curDriver.driver_status] }}
</td> </td>
<td style="border-bottom: 1px solid #006b3b;">
通讯总计数: {{ curDriver.health && curDriver.health.total_count }} <td style="width:180px;border-bottom: 1px solid #006b3b;">成功计数: {{ curDriver.health &&
curDriver.health.success_count }}</td>
<td style="width:340px;border-bottom: 1px solid #006b3b;">
通讯最后一次成功时间: {{ curDriver.health && curDriver.health.last_success_time }}
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
驱动描述: {{ curDriver.driver_description }} 通讯计数: {{ curDriver.health && curDriver.health.total_count }}
</td> </td>
<td> <td>
通讯成功计数: {{ curDriver.health && curDriver.health.success_count }} 失败计数: {{ curDriver.health && curDriver.health.failure_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>
</table> </table>
</span> </span>
@ -63,12 +56,14 @@
<div class="box-info1"> <div class="box-info1">
<div> <div>
<el-tag size="medium" type="">设备名称: {{ curDevice.device_name }}</el-tag> <el-tag size="medium" type="">设备名称: {{ curDevice.device_name }}</el-tag>
<el-tag size="medium" type="">设备状态: {{ !curDevice.device_disable ? '启用' : '停用' }} </el-tag>
<el-tag size="medium" type="">设备描述: {{ 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="600" border :header-cell-style="{ background: '#F6F7FC' }" size="large"> <el-table :data="tableData" height="600" border :header-cell-style="{ background: '#F6F7FC' }" size="large"
:row-class-name="tableRowClassName">
<el-table-column type="index" label="序号" width="80" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column prop="point_name" label="名称" width="100" align="center" show-overflow-tooltip /> <el-table-column prop="point_name" label="名称" width="100" 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 />
@ -169,6 +164,13 @@ export default {
clearInterval(state.intervalId); clearInterval(state.intervalId);
}) })
const tableRowClassName = ({ row, rowIndex }) => {
if (state.curDevice.device_disable) {
return '#ccc'
}
}
const getPointType = async () => { const getPointType = async () => {
const parm = {}; const parm = {};
const res = await infoApi.getPointType(parm); const res = await infoApi.getPointType(parm);
@ -183,9 +185,9 @@ export default {
if (res.code == 0) { if (res.code == 0) {
state.driverData = res.data || []; state.driverData = res.data || [];
if (state.driverData.length > 0) { if (state.driverData.length > 0) {
changeQd(0, state.driverData[0]); let select = state.curDriver || state.driverData[0];
state.curDriver = state.driverData[0]; changeQd(0, select);
console.log(333, state.curDriver) console.log(333, select)
} }
} }
@ -216,8 +218,8 @@ export default {
state.deviceData = res.data || []; state.deviceData = res.data || [];
console.log(123, state.deviceData) console.log(123, state.deviceData)
if (state.deviceData.length > 0) { if (state.deviceData.length > 0) {
handleNodeClick(state.deviceData[0]); let node = state.curDevice || state.deviceData[0];
state.curDevice = state.deviceData[0] handleNodeClick(node);
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);
@ -253,7 +255,7 @@ export default {
} }
const res = !state.curDevice.device_disable ? await infoApi.stopDevice(param) : await infoApi.startDevice(param); const res = !state.curDevice.device_disable ? await infoApi.stopDevice(param) : await infoApi.startDevice(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || '请求成功'); ElMessage.success(res.data || res.message || '请求成功');
getDeviceData(state.curDriver.driver_name); getDeviceData(state.curDriver.driver_name);
} }
} }
@ -296,7 +298,8 @@ export default {
openDe, openDe,
openHis, openHis,
openWrite, openWrite,
getTxStatus getTxStatus,
tableRowClassName
}; };
}, },
}; };

View File

@ -191,7 +191,7 @@ export default {
ElMessage.success(res.data + ',保存网络后会重启' || "请求成功,保存网络后会重启"); ElMessage.success(res.data + ',保存网络后会重启' || "请求成功,保存网络后会重启");
getNet(); getNet();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} else { } else {
} }

View File

@ -107,7 +107,7 @@ export default {
if (res.code == 0) { if (res.code == 0) {
window.location.href = '/'; window.location.href = '/';
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
} }
const resetForm = () => { const resetForm = () => {

View File

@ -140,10 +140,10 @@ export default {
.then(async () => { .then(async () => {
const res = await infoApi.delMb(item); const res = await infoApi.delMb(item);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}) })
.catch(() => { .catch(() => {

View File

@ -101,13 +101,13 @@ export default {
onMounted(() => { onMounted(() => {
getTxSupport(); getTxSupport();
getTxStatus(); getTxStatus();
// getTableData(); getTableData();
state.intervalId = setInterval(() => // state.intervalId = setInterval(() =>
getTableData(), 1000); // getTableData(), 1000);
}); });
onUnmounted(() => { onUnmounted(() => {
clearInterval(state.intervalId); // clearInterval(state.intervalId);
}) })
// //
const getTxSupport = async () => { const getTxSupport = async () => {
@ -206,10 +206,10 @@ export default {
} }
const res = await infoApi.delTx(param); const res = await infoApi.delTx(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "删除成功"); ElMessage.success(res.data || res.message || "删除成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message || "删除失败"); ElMessage.error(res.data || res.message || "删除失败");
} }
}) })
.catch(() => { .catch(() => {
@ -233,10 +233,10 @@ export default {
} }
const res = !item.driver_enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param); const res = !item.driver_enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };

View File

@ -170,10 +170,10 @@ export default {
const res = await infoApi.delSc(req_data); const res = await infoApi.delSc(req_data);
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
if (ret.code == 0) { if (ret.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}) })
.catch(() => { .catch(() => {
@ -187,10 +187,10 @@ export default {
}; };
const res = await infoApi.stopSc(param); const res = await infoApi.stopSc(param);
if (res.code == 0) { if (res.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };

View File

@ -131,10 +131,10 @@ export default {
const res = await infoApi.postRules(req_data1); const res = await infoApi.postRules(req_data1);
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
if (ret.code == 0) { if (ret.code == 0) {
ElMessage.success(res.message || "请求成功"); ElMessage.success(res.data || res.message || "请求成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}) })
.catch(() => { .catch(() => {
@ -175,10 +175,10 @@ export default {
const res = item.enable==='启动' ? await infoApi.postRules(req_data2) : await infoApi.postRules(req_data1); const res = item.enable==='启动' ? await infoApi.postRules(req_data2) : await infoApi.postRules(req_data1);
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
if (ret.code == 0) { if (ret.code == 0) {
ElMessage.success(res.message || "更新成功"); ElMessage.success(res.data || res.message || "更新成功");
getTableData(); getTableData();
} else { } else {
ElMessage.error(res.message); ElMessage.error(res.data || res.message || "请求失败");
} }
}; };
const dialogClose = () => { const dialogClose = () => {

View File

@ -37,7 +37,7 @@ export default ({ mode }) => defineConfig({
'/api': { '/api': {
// target: 'http://cdcm_test_api.shikicc.com:58909', // target: 'http://cdcm_test_api.shikicc.com:58909',
// target: 'http://frp.shikicc.com:58951', // target: 'http://frp.shikicc.com:58951',
target: 'https://cdcm_api2.shikicc.com', target: 'http://cdcm_test_api.shikicc.com:8900',
// target: 'https://cdcm_api.shikicc.com', // target: 'https://cdcm_api.shikicc.com',
// target: 'http://localhost:8088', // target: 'http://localhost:8088',
changeOrigin: true, changeOrigin: true,