123
parent
b026d8f8cf
commit
f7af27b6ed
|
@ -136,6 +136,14 @@ const infoApi = {
|
||||||
getSet(params) {
|
getSet(params) {
|
||||||
return postPBRequest('/driver', params, 54010, params.driver_name)
|
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) {
|
delSet(params) {
|
||||||
return postPBRequest('/driver', params, 54310, params.driver_name)
|
return postPBRequest('/driver', params, 54310, params.driver_name)
|
||||||
|
@ -143,19 +151,19 @@ const infoApi = {
|
||||||
|
|
||||||
// 通讯服务启用,停用
|
// 通讯服务启用,停用
|
||||||
startStatus(params) {
|
startStatus(params) {
|
||||||
return postPBRequest("/driver", params, 54202,params.name);
|
return postPBRequest("/driver", params, 54400,params.name);
|
||||||
},
|
},
|
||||||
// 通讯服务停止
|
// 通讯服务停止
|
||||||
stopStatus(params) {
|
stopStatus(params) {
|
||||||
return postPBRequest("/driver", params, 54203,params.name);
|
return postPBRequest("/driver", params, 54500,params.name);
|
||||||
},
|
},
|
||||||
//保存配置
|
//保存配置
|
||||||
addPz(params, header) {
|
addPz(params, header) {
|
||||||
return postPBRequest("/driver", params, 54201, header.driver_name);
|
return postPBRequest("/driver", params, 54202, header.driver_name);
|
||||||
},
|
},
|
||||||
// 获取com
|
// 获取com
|
||||||
getCom() {
|
getCom(params) {
|
||||||
return postPBRequest("/info", null, 51001);
|
return postPBRequest("/info", null, 51001, params.name);
|
||||||
},
|
},
|
||||||
// // 获取上报列表
|
// // 获取上报列表
|
||||||
// getSc(params) {
|
// getSc(params) {
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
<template>
|
||||||
|
<el-drawer v-model="visible" title= "详情" direction="rtl" :before-close="closeDialog">
|
||||||
|
<el-form label-width="130px">
|
||||||
|
<el-form-item label="驱动名称:">
|
||||||
|
{{ name }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="健康状态">
|
||||||
|
<el-input disabled v-model="health[healthObj.status]"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最后一次成功时间">
|
||||||
|
<el-input disabled v-model="healthObj.last_success_time"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最后一次失败时间">
|
||||||
|
<el-input disabled v-model="healthObj.last_failure_ctime"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最后一次失败原因">
|
||||||
|
<el-input disabled v-model="healthObj.last_failure_cause"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-form label-width="130px">
|
||||||
|
<el-form-item label="总计数">
|
||||||
|
<el-input disabled v-model="countObj.total_count"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="失败计数">
|
||||||
|
<el-input disabled v-model="countObj.failure_count"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="成功计数">
|
||||||
|
<el-input disabled v-model="countObj.success_count"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div class="btns">
|
||||||
|
<el-button type="primary" @click="resetCount">重置计数</el-button>
|
||||||
|
<el-button @click="closeDialog">取消</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||||
|
import infoApi from "@/api/infoApi.js";
|
||||||
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
export default {
|
||||||
|
props: ["dialogVisible", "formData"],
|
||||||
|
emits: ["dialogClose", "dialogSuccess"],
|
||||||
|
setup(props, ctx) {
|
||||||
|
const ruleFormRef = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
health: {
|
||||||
|
0: 'null',
|
||||||
|
1: 'ok',
|
||||||
|
2: 'error',
|
||||||
|
},
|
||||||
|
name: '',
|
||||||
|
healthObj: {},
|
||||||
|
countObj: {}
|
||||||
|
})
|
||||||
|
|
||||||
|
const visible = computed(() => {
|
||||||
|
return props.dialogVisible;
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getD();
|
||||||
|
});
|
||||||
|
const getD = async () => {
|
||||||
|
const parm = {
|
||||||
|
name: props.formData.name
|
||||||
|
}
|
||||||
|
const res = await infoApi.getD(parm);
|
||||||
|
if (res.code == 0) {
|
||||||
|
state.name = res.data.name
|
||||||
|
state.healthObj = res.data.health;
|
||||||
|
state.countObj = res.data.count;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const resetCount = async () => {
|
||||||
|
const parm = {
|
||||||
|
name: props.formData.name
|
||||||
|
}
|
||||||
|
const res = await infoApi.resetCount(parm);
|
||||||
|
if (res.code == 0) {
|
||||||
|
getD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const closeDialog = () => {
|
||||||
|
ctx.emit("dialogClose");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
...toRefs(state),
|
||||||
|
visible,
|
||||||
|
closeDialog,
|
||||||
|
getD,
|
||||||
|
resetCount
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .el-form-item__content {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
>span {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -27,8 +27,8 @@
|
||||||
<el-form-item label="失败重试时间" prop="faile_retry_time">
|
<el-form-item label="失败重试时间" prop="faile_retry_time">
|
||||||
<el-input-number v-model="form2.faile_retry_time" :min="1" placeholder="(单位:秒)" clearable/><span>秒</span>
|
<el-input-number v-model="form2.faile_retry_time" :min="1" placeholder="(单位:秒)" clearable/><span>秒</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="COM" prop="driver_name">
|
<el-form-item label="COM" prop="com_name">
|
||||||
<el-select v-model="form2.driver_name" clearable>
|
<el-select v-model="form2.com_name" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in comArr"
|
v-for="item in comArr"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 3: 'plc_s7' -->
|
<!-- 3: 'plc_s7' -->
|
||||||
<el-form :model="form3" label-width="120px" :rules="rules3" ref="ruleFormRef3" v-if="pztypecode === 3">
|
<!-- <el-form :model="form3" label-width="120px" :rules="rules3" ref="ruleFormRef3" v-if="pztypecode === 3">
|
||||||
<el-form-item label="轮询时间" prop="polling_time">
|
<el-form-item label="轮询时间" prop="polling_time">
|
||||||
<el-input-number v-model="form3.polling_time" :min="1" placeholder="(单位:秒)" clearable/><span>秒</span>
|
<el-input-number v-model="form3.polling_time" :min="1" placeholder="(单位:秒)" clearable/><span>秒</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||||
<el-button @click="closeDialog">取消</el-button>
|
<el-button @click="closeDialog">取消</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form> -->
|
||||||
|
|
||||||
|
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
@ -121,6 +121,8 @@ export default {
|
||||||
emits: ["dialogClose", "dialogSuccess"],
|
emits: ["dialogClose", "dialogSuccess"],
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const ruleFormRef = ref(null);
|
const ruleFormRef = ref(null);
|
||||||
|
const ruleFormRef2= ref(null);
|
||||||
|
const ruleFormRef3 = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
form: {
|
form: {
|
||||||
polling_time: "",
|
polling_time: "",
|
||||||
|
@ -132,12 +134,12 @@ export default {
|
||||||
form2: {
|
form2: {
|
||||||
polling_time: "",
|
polling_time: "",
|
||||||
faile_retry_time: "",
|
faile_retry_time: "",
|
||||||
driver_name: '',
|
com_name: '',
|
||||||
dataBits: 5,
|
dataBits: 5,
|
||||||
baudRate: 2480,
|
baudRate: 2400,
|
||||||
stopBits: 1,
|
stopBits: 1,
|
||||||
parity: 'N',
|
parity: 'N',
|
||||||
id: 1
|
id: 1,
|
||||||
},
|
},
|
||||||
form3: {
|
form3: {
|
||||||
polling_time: "",
|
polling_time: "",
|
||||||
|
@ -149,11 +151,11 @@ export default {
|
||||||
},
|
},
|
||||||
comArr: [],// com
|
comArr: [],// com
|
||||||
baudRateArr: [{
|
baudRateArr: [{
|
||||||
name: 2480,
|
name: 2400,
|
||||||
value: 2480
|
value: 2400
|
||||||
},{
|
},{
|
||||||
name: 4880,
|
name: 4800,
|
||||||
value: 4880
|
value: 4800
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:9600,
|
name:9600,
|
||||||
|
@ -224,7 +226,7 @@ export default {
|
||||||
rules2: {
|
rules2: {
|
||||||
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
||||||
faile_retry_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" }],
|
dataBits: [{ required: true, message: "请选择数据位", trigger: "blur" }],
|
||||||
baudRate: [{ required: true, message: "请选择波特率", trigger: "blur" }],
|
baudRate: [{ required: true, message: "请选择波特率", trigger: "blur" }],
|
||||||
stopBits: [{ required: true, message: "请选择停止位", trigger: "blur" }],
|
stopBits: [{ required: true, message: "请选择停止位", trigger: "blur" }],
|
||||||
|
@ -274,16 +276,28 @@ export default {
|
||||||
} else if (props.pztypecode === 2) {
|
} else if (props.pztypecode === 2) {
|
||||||
await ruleFormRef2.value.validate(async (valid) => {
|
await ruleFormRef2.value.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
var param = {
|
// var param = {
|
||||||
polling_time:Number(state.form2.polling_time),
|
// polling_time:Number(state.form2.polling_time),
|
||||||
faile_retry_time: Number(state.form2.faile_retry_time),
|
// faile_retry_time: Number(state.form2.faile_retry_time),
|
||||||
dataBits: Number(state.form2.dataBits),
|
// dataBits: Number(state.form2.dataBits),
|
||||||
baudRate: Number(state.form2.baudRate),
|
// baudRate: Number(state.form2.baudRate),
|
||||||
stopBits: Number(state.form2.stopBits),
|
// stopBits: Number(state.form2.stopBits),
|
||||||
driver_name: state.form2.driver_name,
|
// driver_name: state.form2.driver_name,
|
||||||
parity: state.form2.parity,
|
// parity: state.form2.parity,
|
||||||
id: Number(state.form2.id)
|
// 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);
|
const res = await infoApi.addPz(param, header);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
ElMessage.success(res.message || "请求成功");
|
ElMessage.success(res.message || "请求成功");
|
||||||
|
@ -328,11 +342,14 @@ export default {
|
||||||
getCom();
|
getCom();
|
||||||
});
|
});
|
||||||
const getCom = async () => {
|
const getCom = async () => {
|
||||||
const res = await infoApi.getCom();
|
const parm = {
|
||||||
|
name: props.formData.name
|
||||||
|
}
|
||||||
|
const res = await infoApi.getCom(parm);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
state.comArr = res.data;
|
state.comArr = res.data;
|
||||||
console.log(44, state.comArr);
|
console.log(44, state.comArr);
|
||||||
state.form2.driver_name = state.comArr[0].name;
|
state.form2.com_name = state.comArr[0].name;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
|
@ -350,6 +367,8 @@ export default {
|
||||||
exportData,
|
exportData,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
ruleFormRef,
|
ruleFormRef,
|
||||||
|
ruleFormRef2,
|
||||||
|
ruleFormRef3,
|
||||||
getCom
|
getCom
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -236,3 +236,7 @@ s {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.btns {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -41,6 +41,9 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" show-overflow-tooltip>
|
<el-table-column label="操作" align="center" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<el-button type="primary" @click="openDetails(scope.row)">
|
||||||
|
详情
|
||||||
|
</el-button>
|
||||||
<el-button type="primary" @click="openPz(scope.row)">
|
<el-button type="primary" @click="openPz(scope.row)">
|
||||||
配置
|
配置
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -77,6 +80,14 @@
|
||||||
@dialogSuccess="dialogSuccess3"
|
@dialogSuccess="dialogSuccess3"
|
||||||
>
|
>
|
||||||
</PzSet>
|
</PzSet>
|
||||||
|
<Details
|
||||||
|
:formData="formData"
|
||||||
|
:dialogVisible="dialogVisible4"
|
||||||
|
v-if="dialogVisible4"
|
||||||
|
@dialogClose="dialogClose4"
|
||||||
|
@dialogSuccess="dialogSuccess4"
|
||||||
|
>
|
||||||
|
</Details>
|
||||||
<AddData :formData="formData" :type="type" :qudongOptions="qudongOptions" :dialogVisible="dialogVisible"
|
<AddData :formData="formData" :type="type" :qudongOptions="qudongOptions" :dialogVisible="dialogVisible"
|
||||||
v-if="dialogVisible" @dialogClose="dialogClose" @dialogSuccess="dialogSuccess"></AddData>
|
v-if="dialogVisible" @dialogClose="dialogClose" @dialogSuccess="dialogSuccess"></AddData>
|
||||||
<ViewSet :formData="formData" :qudongOptions="qudongOptions" :dialogVisible="dialogVisible2" v-if="dialogVisible2" @dialogClose="dialogClose"
|
<ViewSet :formData="formData" :qudongOptions="qudongOptions" :dialogVisible="dialogVisible2" v-if="dialogVisible2" @dialogClose="dialogClose"
|
||||||
|
@ -91,12 +102,14 @@ import infoApi from "@/api/infoApi.js";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import AddData from "@/components/AddData.vue";
|
import AddData from "@/components/AddData.vue";
|
||||||
import PzSet from "@/components/PzSet.vue";
|
import PzSet from "@/components/PzSet.vue";
|
||||||
|
import Details from "@/components/Details.vue";
|
||||||
import ViewSet from "@/components/ViewSet.vue";
|
import ViewSet from "@/components/ViewSet.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "page",
|
name: "page",
|
||||||
components: {
|
components: {
|
||||||
AddData,
|
AddData,
|
||||||
PzSet,
|
PzSet,
|
||||||
|
Details,
|
||||||
ViewSet
|
ViewSet
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -108,6 +121,7 @@ export default {
|
||||||
dialogVisible1: false,
|
dialogVisible1: false,
|
||||||
dialogVisible2: false,
|
dialogVisible2: false,
|
||||||
dialogVisible3: false,
|
dialogVisible3: false,
|
||||||
|
dialogVisible4: false,
|
||||||
type: '0', // 0新增 1 编辑
|
type: '0', // 0新增 1 编辑
|
||||||
pztype: '',
|
pztype: '',
|
||||||
pztypecode: '',
|
pztypecode: '',
|
||||||
|
@ -168,10 +182,16 @@ export default {
|
||||||
const dialogClose3 = () => {
|
const dialogClose3 = () => {
|
||||||
state.dialogVisible3 = false;
|
state.dialogVisible3 = false;
|
||||||
};
|
};
|
||||||
|
const dialogClose4 = () => {
|
||||||
|
state.dialogVisible4 = false;
|
||||||
|
};
|
||||||
const dialogSuccess3 = () => {
|
const dialogSuccess3 = () => {
|
||||||
state.dialogVisible3 = false;
|
state.dialogVisible3 = false;
|
||||||
getTableData();
|
getTableData();
|
||||||
};
|
};
|
||||||
|
const dialogSuccess4 = () => {
|
||||||
|
state.dialogVisible4 = false;
|
||||||
|
};
|
||||||
|
|
||||||
const dialogSuccess1 = () => {
|
const dialogSuccess1 = () => {
|
||||||
state.dialogVisible1 = false;
|
state.dialogVisible1 = false;
|
||||||
|
@ -235,7 +255,7 @@ export default {
|
||||||
const param = {
|
const param = {
|
||||||
name: item.name,
|
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) {
|
if (res.code == 0) {
|
||||||
ElMessage.success(res.msg || "请求成功");
|
ElMessage.success(res.msg || "请求成功");
|
||||||
getTableData();
|
getTableData();
|
||||||
|
@ -251,7 +271,11 @@ export default {
|
||||||
state.pztypecode = item.type;
|
state.pztypecode = item.type;
|
||||||
state.formData = JSON.parse(JSON.stringify(item));
|
state.formData = JSON.parse(JSON.stringify(item));
|
||||||
}
|
}
|
||||||
|
const openDetails = (item) => {
|
||||||
|
state.formData = JSON.parse(JSON.stringify(item));
|
||||||
|
state.dialogVisible4 = true;
|
||||||
|
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
addData,
|
addData,
|
||||||
|
@ -264,8 +288,11 @@ export default {
|
||||||
dialogClose1,
|
dialogClose1,
|
||||||
dialogSuccess1,
|
dialogSuccess1,
|
||||||
dialogClose3,
|
dialogClose3,
|
||||||
|
dialogClose4,
|
||||||
dialogSuccess3,
|
dialogSuccess3,
|
||||||
|
dialogSuccess4,
|
||||||
openPz,
|
openPz,
|
||||||
|
openDetails,
|
||||||
viewData
|
viewData
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue