123
parent
72a880cf70
commit
b026d8f8cf
|
@ -109,6 +109,10 @@ const infoApi = {
|
|||
delTx(params) {
|
||||
return postPBRequest(`/driver`, params, 54300);
|
||||
},
|
||||
// 获取通讯状态
|
||||
getTxStatus(params) {
|
||||
return postPBRequest(`/driver`, params, 54004);
|
||||
},
|
||||
|
||||
// 获取支持的通讯驱动
|
||||
getTxSupport() {
|
||||
|
@ -139,11 +143,11 @@ const infoApi = {
|
|||
|
||||
// 通讯服务启用,停用
|
||||
startStatus(params) {
|
||||
return postPBRequest("/driver", params, 53201);
|
||||
return postPBRequest("/driver", params, 54202,params.name);
|
||||
},
|
||||
// 通讯服务停止
|
||||
stopStatus(params) {
|
||||
return postPBRequest("/driver", params, 53202);
|
||||
return postPBRequest("/driver", params, 54203,params.name);
|
||||
},
|
||||
//保存配置
|
||||
addPz(params, header) {
|
||||
|
|
|
@ -270,18 +270,18 @@ export default {
|
|||
};
|
||||
const driveChange = () => {
|
||||
// 如果是串口协议
|
||||
if (props.formData.drive.serial) {
|
||||
state.serialConfig = true;
|
||||
state.modbusTCPConfig = false;
|
||||
// 获取com
|
||||
getCom();
|
||||
// if (props.formData.drive.serial) {
|
||||
// state.serialConfig = true;
|
||||
// state.modbusTCPConfig = false;
|
||||
// // 获取com
|
||||
// getCom();
|
||||
|
||||
} else {
|
||||
state.serialConfig = false;
|
||||
if (props.formData.drive.name == "modbusTCP") {
|
||||
state.modbusTCPConfig = true;
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// state.serialConfig = false;
|
||||
// if (props.formData.drive.name == "modbusTCP") {
|
||||
// state.modbusTCPConfig = true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// 获取com
|
||||
const getCom = async () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" :title= "pztype + '类型 配置管理'" direction="rtl" :before-close="closeDialog">
|
||||
<!-- 1 -->
|
||||
<!-- 1 modbus_tcp -->
|
||||
<el-form :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 1">
|
||||
<el-form-item label="轮询时间" prop="polling_time">
|
||||
<el-input-number v-model="form.polling_time" :min="1" placeholder="(单位:秒)" clearable/><span>秒</span>
|
||||
|
@ -130,7 +130,7 @@ export default {
|
|||
id: 1,
|
||||
},
|
||||
form2: {
|
||||
polling_time: "",
|
||||
polling_time: "",
|
||||
faile_retry_time: "",
|
||||
driver_name: '',
|
||||
dataBits: 5,
|
||||
|
@ -212,13 +212,13 @@ export default {
|
|||
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
||||
faile_retry_time: [{ required: true, message: "请输入失败重试时间", trigger: "blur" }],
|
||||
host: [{ required: true, validator: (rule, value, callback) => {
|
||||
// 只能输入英文字母
|
||||
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
|
||||
if (value && reg.test(value) ) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入正确的ip地址"));
|
||||
}}, trigger: 'blur' }],
|
||||
// 只能输入英文字母
|
||||
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
|
||||
if (value && reg.test(value) ) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入正确的ip地址"));
|
||||
}}, trigger: 'blur' }],
|
||||
port: [{ required: true, message: "请输入端口号", trigger: "blur" }]
|
||||
},
|
||||
rules2: {
|
||||
|
|
|
@ -61,7 +61,7 @@ axios.interceptors.response.use(
|
|||
}
|
||||
);
|
||||
// post请求
|
||||
export function postPBRequest(url, params, actionNum,name) {
|
||||
export function postPBRequest(url, params, actionNum, name) {
|
||||
const title = url === '/driver' ? {'driver_name': Base64.encode(name) }: {'template_name': Base64.encode(name)}
|
||||
return axios({
|
||||
method: "post",
|
||||
|
|
|
@ -23,15 +23,20 @@
|
|||
/> -->
|
||||
<el-table-column prop="status" label="通讯状态" width="200" align="center">
|
||||
<template #default="scope">
|
||||
<span class="txStatusDiv" :style="{
|
||||
background: scope.row.status == 1 ? '#13ce66' : '#f8cecc',
|
||||
}">{{ scope.row.status == 1 ? "正常" : "未连接" }}</span>
|
||||
<span> {{ txStatus[scope.row.status] }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="enable" label="启用状态" width="350" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.enable" inline-prompt active-text="启用" inactive-text="停用" :active-value="false"
|
||||
:inactive-value="true" active-color="#13ce66" inactive-color="red" @change="changeStatus(scope.row)" />
|
||||
现在是 <el-tag :class="!scope.row.enable? 'stop':'start'">{{!scope.row.enable? '停用状态' : '启用状态'}} </el-tag> 您可以点击
|
||||
<el-button type="primary" size="mini" @click="changeStatus(scope.row)" v-if="!scope.row.enable">
|
||||
启用
|
||||
</el-button>
|
||||
<el-button size="mini" @click="changeStatus(scope.row)" v-else>
|
||||
停用
|
||||
</el-button>
|
||||
<!-- <el-switch v-model="scope.row.enable" inline-prompt active-text="启用" inactive-text="停用" :active-value="true"
|
||||
:inactive-value="false" active-color="#13ce66" inactive-color="#ddd" @change="changeStatus(scope.row)" /> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" show-overflow-tooltip>
|
||||
|
@ -105,12 +110,14 @@ export default {
|
|||
dialogVisible3: false,
|
||||
type: '0', // 0新增 1 编辑
|
||||
pztype: '',
|
||||
pztypecode: ''
|
||||
pztypecode: '',
|
||||
txStatus: [] //通讯状态
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getTxSupport();
|
||||
getTableData();
|
||||
getTxStatus();
|
||||
});
|
||||
// 获取通讯驱动
|
||||
const getTxSupport = async () => {
|
||||
|
@ -122,6 +129,17 @@ export default {
|
|||
}
|
||||
|
||||
|
||||
};
|
||||
// 获取通讯状态
|
||||
const getTxStatus = async () => {
|
||||
|
||||
const res = await infoApi.getTxStatus();
|
||||
if (res.code == 0) {
|
||||
state.txStatus = res.data;
|
||||
console.log(456, state.txStatus)
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
const getTableData = async () => {
|
||||
const param = {
|
||||
|
@ -269,4 +287,10 @@ export default {
|
|||
border-radius: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.stop {
|
||||
color: red;
|
||||
}
|
||||
.start {
|
||||
color: #009fa4;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue