fast(扫码录入): 添加扫码枪串口录入
This commit is contained in:
parent
6c6a3ba4e7
commit
d36ad16535
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gateway-app",
|
"name": "gateway-app",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"description": "An Electron application with Vue",
|
"description": "An Electron application with Vue",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "example.com",
|
||||||
|
@ -21,10 +21,11 @@
|
||||||
"@electron-toolkit/preload": "^3.0.1",
|
"@electron-toolkit/preload": "^3.0.1",
|
||||||
"@electron-toolkit/utils": "^3.0.0",
|
"@electron-toolkit/utils": "^3.0.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"dayjs": "^1.11.11",
|
"dayjs": "^1.11.13",
|
||||||
"electron-updater": "^6.1.7",
|
"electron-updater": "^6.1.7",
|
||||||
"element-plus": "^2.7.6",
|
"element-plus": "^2.7.6",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
"gateway-app": "file:",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"vue-router": "^4.4.0",
|
"vue-router": "^4.4.0",
|
||||||
"xlsx": "^0.18.5"
|
"xlsx": "^0.18.5"
|
||||||
|
|
|
@ -12,7 +12,7 @@ const settings = defineProps({
|
||||||
<el-menu-item index="/system/switch"> <span class="iconfont icon-icon_duanluqi"></span> 断路器调试</el-menu-item>
|
<el-menu-item index="/system/switch"> <span class="iconfont icon-icon_duanluqi"></span> 断路器调试</el-menu-item>
|
||||||
<!-- <el-menu-item index="/system/videoplayer"><span class="iconfont icon-icon_jiankong"></span> 视频监控</el-menu-item>-->
|
<!-- <el-menu-item index="/system/videoplayer"><span class="iconfont icon-icon_jiankong"></span> 视频监控</el-menu-item>-->
|
||||||
<el-menu-item index="/system/serialport"><span class="iconfont icon-chuankou2"></span> 设备参数读写</el-menu-item>
|
<el-menu-item index="/system/serialport"><span class="iconfont icon-chuankou2"></span> 设备参数读写</el-menu-item>
|
||||||
<el-menu-item index="/system/devicestandard"><span class="iconfont icon-icon_chajian"></span> 空开标定</el-menu-item>
|
<el-menu-item index="/system/devicestandard"><span class="iconfont icon-icon_chajian"></span> 断路器标定</el-menu-item>
|
||||||
<el-menu-item index="/system/scancodewrite"><span class="iconfont icon-chuankou2"></span> 扫码录入</el-menu-item>
|
<el-menu-item index="/system/scancodewrite"><span class="iconfont icon-chuankou2"></span> 扫码录入</el-menu-item>
|
||||||
<!-- <el-menu-item index="/gateway/southdirection"><span class="iconfont icon-icon_chajian"></span> 南向采集配置</el-menu-item>-->
|
<!-- <el-menu-item index="/gateway/southdirection"><span class="iconfont icon-icon_chajian"></span> 南向采集配置</el-menu-item>-->
|
||||||
<!-- <el-menu-item index="/gateway/northboundtask"><span class="iconfont icon-icon_chajian"></span> 北向任务配置</el-menu-item>-->
|
<!-- <el-menu-item index="/gateway/northboundtask"><span class="iconfont icon-icon_chajian"></span> 北向任务配置</el-menu-item>-->
|
||||||
|
|
|
@ -2,6 +2,7 @@ import '@renderer/assets/main.css'
|
||||||
|
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from 'element-plus'
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
|
@ -10,6 +11,7 @@ import App from '@renderer/App.vue'
|
||||||
import router from '@renderer/router'
|
import router from '@renderer/router'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
app.config.globalProperties.$dayjs = dayjs
|
||||||
|
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
app.component(key, component)
|
app.component(key, component)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -440,6 +440,7 @@ const analysisData = (hexData, data) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const sendDeviceAttr = (data, type, index) => {
|
const sendDeviceAttr = (data, type, index) => {
|
||||||
if (!serialportForm.port) {
|
if (!serialportForm.port) {
|
||||||
ElMessage.error('请先打开串口');
|
ElMessage.error('请先打开串口');
|
||||||
|
@ -486,10 +487,10 @@ const sendDeviceAttr = (data, type, index) => {
|
||||||
// 成功响应后的处理
|
// 成功响应后的处理
|
||||||
console.log('串口请求', response); // 打印响应数据
|
console.log('串口请求', response); // 打印响应数据
|
||||||
if (response.data.code === 0) {
|
if (response.data.code === 0) {
|
||||||
ElMessage.success('操作成功');
|
ElMessage.success('操作成功');
|
||||||
if (type === 'output') {
|
if (type === 'output') {
|
||||||
deviceAttrList.value[index].outputValue = analysisData(response.data.data.hex || '', data);
|
deviceAttrList.value[index].outputValue = analysisData(response.data.data.hex || '', data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(response.data.message);
|
ElMessage.error(response.data.message);
|
||||||
}
|
}
|
||||||
|
@ -553,27 +554,32 @@ const allReadDeviceAttr = () => {
|
||||||
// 成功响应后的处理
|
// 成功响应后的处理
|
||||||
console.log('串口请求', response); // 打印响应数据
|
console.log('串口请求', response); // 打印响应数据
|
||||||
if (response.data.code === 0) {
|
if (response.data.code === 0) {
|
||||||
ElMessage.success('操作成功');
|
if (response.data.data.hex !== '') {
|
||||||
let hexValue = response.data.data.hex.substring(24, 392);
|
ElMessage.success('操作成功');
|
||||||
let startValue = 0;
|
let hexValue = response.data.data.hex.substring(24, 392);
|
||||||
deviceAttrList.value.forEach((item, index) => {
|
let startValue = 0;
|
||||||
if (startValue === 0) {
|
deviceAttrList.value.forEach((item, index) => {
|
||||||
startValue = item.startValue;
|
if (startValue === 0) {
|
||||||
}
|
startValue = item.startValue;
|
||||||
let value = hexValue.substring(startValue, item.lengthValue * 4 * 2 + startValue);
|
}
|
||||||
startValue = startValue + item.lengthValue * 4 * 2;
|
let value = hexValue.substring(startValue, item.lengthValue * 4 * 2 + startValue);
|
||||||
console.log('value', value);
|
startValue = startValue + item.lengthValue * 4 * 2;
|
||||||
if (item.dataType === 'str') {
|
console.log('value', value);
|
||||||
deviceAttrList.value[index].outputValue = hexToString(value).trim();
|
if (item.dataType === 'str') {
|
||||||
deviceAttrList.value[index].inputValue = hexToString(value).trim();
|
deviceAttrList.value[index].outputValue = hexToString(value).trim();
|
||||||
} else if (item.dataType === 'hex') {
|
deviceAttrList.value[index].inputValue = hexToString(value).trim();
|
||||||
deviceAttrList.value[index].outputValue = rearrangeHexStr(value);
|
} else if (item.dataType === 'hex') {
|
||||||
deviceAttrList.value[index].inputValue = rearrangeHexStr(value);
|
deviceAttrList.value[index].outputValue = rearrangeHexStr(value);
|
||||||
} else {
|
deviceAttrList.value[index].inputValue = rearrangeHexStr(value);
|
||||||
deviceAttrList.value[index].outputValue = value;
|
} else {
|
||||||
deviceAttrList.value[index].inputValue = value;
|
deviceAttrList.value[index].outputValue = value;
|
||||||
}
|
deviceAttrList.value[index].inputValue = value;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage.error('获取数据为空');
|
||||||
|
}
|
||||||
|
|
||||||
// deviceAttrList.value[index].outputValue = analysisData(response.data.data.hex || '', data);
|
// deviceAttrList.value[index].outputValue = analysisData(response.data.data.hex || '', data);
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(response.data.message);
|
ElMessage.error(response.data.message);
|
||||||
|
|
Loading…
Reference in New Issue