diff --git a/package-lock.json b/package-lock.json
index 2223b3b..ba9d684 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,7 +14,7 @@
"axios": "^0.21.1",
"echarts": "^5.4.2",
"element-plus": "^2.3.4",
- "js-base64": "^3.7.5",
+ "js-base64": "^3.7.7",
"js-md5": "^0.7.3",
"moment": "^2.29.4",
"protobufjs": "^7.2.4",
@@ -3928,9 +3928,9 @@
}
},
"node_modules/js-base64": {
- "version": "3.7.5",
- "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
- "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
+ "version": "3.7.7",
+ "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz",
+ "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
},
"node_modules/js-md5": {
"version": "0.7.3",
@@ -9882,9 +9882,9 @@
}
},
"js-base64": {
- "version": "3.7.5",
- "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
- "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
+ "version": "3.7.7",
+ "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz",
+ "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
},
"js-md5": {
"version": "0.7.3",
diff --git a/package.json b/package.json
index 63738af..0e72368 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"axios": "^0.21.1",
"echarts": "^5.4.2",
"element-plus": "^2.3.4",
- "js-base64": "^3.7.5",
+ "js-base64": "^3.7.7",
"js-md5": "^0.7.3",
"moment": "^2.29.4",
"protobufjs": "^7.2.4",
diff --git a/src/components/AddMb.vue b/src/components/AddMb.vue
index 1c548ef..b15f57d 100644
--- a/src/components/AddMb.vue
+++ b/src/components/AddMb.vue
@@ -36,7 +36,7 @@ export default {
addForm: {},
rules: {
name: [
- { required: true, message: "请输入模板名称", trigger: "blur" }
+ { required: true, message: "请输入模板名称", trigger: "blur" },
],
description: [
{ required: true, message: "请输入模板描述", trigger: "blur" }
diff --git a/src/components/AddPoint.vue b/src/components/AddPoint.vue
index bf68c88..47200f1 100644
--- a/src/components/AddPoint.vue
+++ b/src/components/AddPoint.vue
@@ -5,7 +5,7 @@
-
+
@@ -48,6 +48,14 @@ export default {
props: ["formData", "dialogVisible", "pointData", "type"],
emits: ["dialogClose", "dialogSuccess"],
setup(props, ctx) {
+ const checkAddress = (rule, value, callback) => {
+ let num = Number(value);
+ if (value && (num >= 0 && num <= 19999) || (num >= 30000 && num <= 49999)) {
+ callback();
+ } else {
+ callback(new Error("点位地址:0-19999,30000-49999"));
+ }
+ };
const ruleFormRef = ref(null);
const state = reactive({
addForm: {
@@ -141,7 +149,10 @@ export default {
],
rules: {
name: [{ required: true, message: "请输入点位名称", trigger: "blur" }],
- address: [{ required: true, message: "请输入点位地址", trigger: "blur" }],
+ address: [
+ { required: true, message: "请输入点位地址", trigger: "blur" },
+ { required: true, validator: checkAddress, trigger: "blur" }
+ ],
type: [{ required: true, message: "请选择点位类型", trigger: "blur" }],
byte_order: [{ required: true, message: "请选择字节顺序", trigger: "blur" }],
multiplier: [{ required: true, message: "请输入缩放系数", trigger: "blur" }],
@@ -174,7 +185,7 @@ export default {
address: Number(state.addForm.address),
multiplier: Number(state.addForm.multiplier)
}
- 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) {
ElMessage.success(res.message || "请求成功");
ctx.emit("dialogSuccess");
diff --git a/src/components/AddSet copy.vue b/src/components/AddSet copy.vue
deleted file mode 100644
index 4f4f5af..0000000
--- a/src/components/AddSet copy.vue
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
- 通讯名称:{{ addForm.name }}
- 通讯描述:{{ addForm.description }}
- 通讯主机:{{ addForm.host }}
-
-
-
- 保存
- 取消
-
-
- 扫描
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
- +新增一行
-
-
-
-
-
-
diff --git a/src/components/AddSet.vue b/src/components/AddSet.vue
index f2a5daf..765d84b 100644
--- a/src/components/AddSet.vue
+++ b/src/components/AddSet.vue
@@ -1,11 +1,11 @@
-
+
-
+
@@ -34,6 +34,14 @@ export default {
props: ["formData", "dialogVisible", "setData", "type"],
emits: ["dialogClose", "dialogSuccess"],
setup(props, ctx) {
+ const checkSetId = (rule, value, callback) => {
+ let num = Number(value);
+ if (value && (num >= 1 && num <= 255)) {
+ callback();
+ } else {
+ callback(new Error("设备ID:1-255"));
+ }
+ };
const ruleFormRef = ref(null);
const state = reactive({
addForm: {
@@ -42,7 +50,10 @@ export default {
rules: {
name: [{ required: true, message: "请输入设备名称", trigger: "blur" }],
template_name: [{ required: true, message: "请选择模板名称", trigger: "blur" }],
- id: [{ required: true, message: "请输入设备ID", trigger: "blur" }],
+ id: [
+ { required: true, message: "请输入设备ID", trigger: "blur" },
+ { required: true, validator: checkSetId, trigger: "blur" }
+ ],
},
});
const visible = computed(() => {
@@ -73,10 +84,9 @@ export default {
state.modelArr.push(obj);
console.log(33,state.modelArr);
}
- console.log(state.modelArr);
state.addForm.template_name = state.modelArr[0].name;
} else {
- ElMessage.error(res.message || "请求失败");
+ ElMessage.error(res.data || res.messgae);
}
};
const closeDialog = () => {
@@ -99,7 +109,7 @@ export default {
ElMessage.success(res.message || "请求成功");
ctx.emit("dialogSuccess");
} else {
- ElMessage.error(res.message);
+ ElMessage.error(res.data || res.message);
}
} else {
console.log("error submit!");
diff --git a/src/components/ViewPoint.vue b/src/components/ViewPoint.vue
index b8b793c..1d15b7c 100644
--- a/src/components/ViewPoint.vue
+++ b/src/components/ViewPoint.vue
@@ -16,7 +16,7 @@
导出
-
@@ -126,7 +126,7 @@ export default {
state.propertiesData.push(pointData[i]);
}
} else {
- console.log(res);
+ ElMessage.error(res.data || res.message);
}
};
const closeDialog = () => {
diff --git a/src/components/ViewSet.vue b/src/components/ViewSet.vue
index 848828e..643f866 100644
--- a/src/components/ViewSet.vue
+++ b/src/components/ViewSet.vue
@@ -16,7 +16,7 @@
导出
-
diff --git a/src/utils/axios.js b/src/utils/axios.js
index c671ae9..948269f 100644
--- a/src/utils/axios.js
+++ b/src/utils/axios.js
@@ -6,12 +6,10 @@ import router from "@/router/index";
import {
localSet,
localGet,
- localRemove
+ localRemove,
} from "./index";
import config from "~/config";
-import {
- response
-} from '../proto/data/pd';
+import {Base64} from 'js-base64';
axios.defaults.baseURL = config[
import.meta.env.MODE].baseUrl;
@@ -57,7 +55,7 @@ axios.interceptors.response.use(
);
// post请求
export function postPBRequest(url, params, actionNum,name) {
- const title = url === '/driver' ? {'driver_name': name }: {'template_name': name}
+ const title = url === '/driver' ? {'driver_name': Base64.encode(name) }: {'template_name': Base64.encode(name)}
return axios({
method: "post",
url: url,
diff --git a/src/utils/index.js b/src/utils/index.js
index bd387fc..9511b7d 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -37,4 +37,4 @@ export const pathMap = {
report: '上报管理',
transparent: '透传管理',
rules: '规则引擎'
-}
\ No newline at end of file
+}