diff --git a/src/api/infoApi.js b/src/api/infoApi.js
index 634eef5..ecaed75 100644
--- a/src/api/infoApi.js
+++ b/src/api/infoApi.js
@@ -136,6 +136,14 @@ const infoApi = {
getSet(params) {
return postPBRequest('/driver', params, 54010, params.driver_name)
},
+ // 获取详情
+ getD(params) {
+ return postPBRequest('/driver', params, 54003, params.driver_name)
+ },
+ // 重置
+ resetCount(params) {
+ return postPBRequest('/driver', params, 54201, params.driver_name)
+ },
// 删除设备
delSet(params) {
return postPBRequest('/driver', params, 54310, params.driver_name)
@@ -143,19 +151,19 @@ const infoApi = {
// 通讯服务启用,停用
startStatus(params) {
- return postPBRequest("/driver", params, 54202,params.name);
+ return postPBRequest("/driver", params, 54400,params.name);
},
// 通讯服务停止
stopStatus(params) {
- return postPBRequest("/driver", params, 54203,params.name);
+ return postPBRequest("/driver", params, 54500,params.name);
},
//保存配置
addPz(params, header) {
- return postPBRequest("/driver", params, 54201, header.driver_name);
+ return postPBRequest("/driver", params, 54202, header.driver_name);
},
// 获取com
- getCom() {
- return postPBRequest("/info", null, 51001);
+ getCom(params) {
+ return postPBRequest("/info", null, 51001, params.name);
},
// // 获取上报列表
// getSc(params) {
diff --git a/src/components/Details.vue b/src/components/Details.vue
new file mode 100644
index 0000000..008e826
--- /dev/null
+++ b/src/components/Details.vue
@@ -0,0 +1,109 @@
+
+
+
+
+ {{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 重置计数
+ 取消
+
+
+
+
+
+
diff --git a/src/components/PzSet.vue b/src/components/PzSet.vue
index 50eb78f..1e81d98 100644
--- a/src/components/PzSet.vue
+++ b/src/components/PzSet.vue
@@ -27,8 +27,8 @@
秒
-
-
+
+
-
+
@@ -121,6 +121,8 @@ export default {
emits: ["dialogClose", "dialogSuccess"],
setup(props, ctx) {
const ruleFormRef = ref(null);
+ const ruleFormRef2= ref(null);
+ const ruleFormRef3 = ref(null);
const state = reactive({
form: {
polling_time: "",
@@ -132,12 +134,12 @@ export default {
form2: {
polling_time: "",
faile_retry_time: "",
- driver_name: '',
+ com_name: '',
dataBits: 5,
- baudRate: 2480,
+ baudRate: 2400,
stopBits: 1,
parity: 'N',
- id: 1
+ id: 1,
},
form3: {
polling_time: "",
@@ -149,11 +151,11 @@ export default {
},
comArr: [],// com
baudRateArr: [{
- name: 2480,
- value: 2480
+ name: 2400,
+ value: 2400
},{
- name: 4880,
- value: 4880
+ name: 4800,
+ value: 4800
},
{
name:9600,
@@ -224,7 +226,7 @@ export default {
rules2: {
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
faile_retry_time: [{ required: true, message: "请输入失败重试时间", trigger: "blur" }],
- driver_name: [{ required: true, message: "请选择COM口", trigger: "blur" }],
+ com_name: [{ required: true, message: "请选择COM口", trigger: "blur" }],
dataBits: [{ required: true, message: "请选择数据位", trigger: "blur" }],
baudRate: [{ required: true, message: "请选择波特率", trigger: "blur" }],
stopBits: [{ required: true, message: "请选择停止位", trigger: "blur" }],
@@ -274,16 +276,28 @@ export default {
} else if (props.pztypecode === 2) {
await ruleFormRef2.value.validate(async (valid) => {
if (valid) {
- var param = {
- polling_time:Number(state.form2.polling_time),
- faile_retry_time: Number(state.form2.faile_retry_time),
- dataBits: Number(state.form2.dataBits),
- baudRate: Number(state.form2.baudRate),
- stopBits: Number(state.form2.stopBits),
- driver_name: state.form2.driver_name,
- parity: state.form2.parity,
- id: Number(state.form2.id)
- }
+ // var param = {
+ // polling_time:Number(state.form2.polling_time),
+ // faile_retry_time: Number(state.form2.faile_retry_time),
+ // dataBits: Number(state.form2.dataBits),
+ // baudRate: Number(state.form2.baudRate),
+ // stopBits: Number(state.form2.stopBits),
+ // driver_name: state.form2.driver_name,
+ // parity: state.form2.parity,
+ // id: Number(state.form2.id)
+ // }
+ var param = {
+ name: props.formData.name,
+ polling_time: Number(state.form2.polling_time),
+ faile_retry_time: Number(state.form2.faile_retry_time),
+ com: {
+ name: state.form2.com_name,
+ dataBits: Number(state.form2.dataBits),
+ baudRate: Number(state.form2.baudRate),
+ stopBits: Number(state.form2.stopBits),
+ parity: state.form2.parity
+ }
+ }
const res = await infoApi.addPz(param, header);
if (res.code == 0) {
ElMessage.success(res.message || "请求成功");
@@ -328,11 +342,14 @@ export default {
getCom();
});
const getCom = async () => {
- const res = await infoApi.getCom();
+ const parm = {
+ name: props.formData.name
+ }
+ const res = await infoApi.getCom(parm);
if (res.code == 0) {
state.comArr = res.data;
console.log(44, state.comArr);
- state.form2.driver_name = state.comArr[0].name;
+ state.form2.com_name = state.comArr[0].name;
}
};
const closeDialog = () => {
@@ -350,6 +367,8 @@ export default {
exportData,
onSubmit,
ruleFormRef,
+ ruleFormRef2,
+ ruleFormRef3,
getCom
};
},
diff --git a/src/css/index.scss b/src/css/index.scss
index 7587bdc..f55f4f5 100644
--- a/src/css/index.scss
+++ b/src/css/index.scss
@@ -236,3 +236,7 @@ s {
}
}
+.btns {
+ width: 100%;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/src/views/Page.vue b/src/views/Page.vue
index db12904..c436383 100644
--- a/src/views/Page.vue
+++ b/src/views/Page.vue
@@ -41,6 +41,9 @@
+
+ 详情
+
配置
@@ -77,6 +80,14 @@
@dialogSuccess="dialogSuccess3"
>
+
+
{
state.dialogVisible3 = false;
};
+ const dialogClose4 = () => {
+ state.dialogVisible4 = false;
+ };
const dialogSuccess3 = () => {
state.dialogVisible3 = false;
getTableData();
};
+ const dialogSuccess4 = () => {
+ state.dialogVisible4 = false;
+ };
const dialogSuccess1 = () => {
state.dialogVisible1 = false;
@@ -235,7 +255,7 @@ export default {
const param = {
name: item.name,
}
- const res = item.enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param);
+ const res = !item.enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param);
if (res.code == 0) {
ElMessage.success(res.msg || "请求成功");
getTableData();
@@ -251,7 +271,11 @@ export default {
state.pztypecode = item.type;
state.formData = JSON.parse(JSON.stringify(item));
}
-
+ const openDetails = (item) => {
+ state.formData = JSON.parse(JSON.stringify(item));
+ state.dialogVisible4 = true;
+
+ }
return {
...toRefs(state),
addData,
@@ -264,8 +288,11 @@ export default {
dialogClose1,
dialogSuccess1,
dialogClose3,
+ dialogClose4,
dialogSuccess3,
+ dialogSuccess4,
openPz,
+ openDetails,
viewData
};
},