123
parent
9959342a91
commit
48dc219afc
File diff suppressed because it is too large
Load Diff
|
@ -127,8 +127,11 @@ const infoApi = {
|
||||||
// 通讯服务停止
|
// 通讯服务停止
|
||||||
stopStatus(params) {
|
stopStatus(params) {
|
||||||
return postPBRequest("/driver", params, 53202);
|
return postPBRequest("/driver", params, 53202);
|
||||||
}
|
},
|
||||||
|
//保存配置
|
||||||
|
addPz(params) {
|
||||||
|
return postPBRequest("/driver", params, 54201, params.driver_name);
|
||||||
|
},
|
||||||
// // 获取上报列表
|
// // 获取上报列表
|
||||||
// getSc(params) {
|
// getSc(params) {
|
||||||
// return getRequest('/sb/list', params)
|
// return getRequest('/sb/list', params)
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer v-model="visible" title="配置管理" direction="rtl" :before-close="closeDialog">
|
<el-drawer v-model="visible" :title= "pztype + '类型 配置管理'" direction="rtl" :before-close="closeDialog">
|
||||||
<el-form :model="form" label-width="120px">
|
<el-form :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 1">
|
||||||
<el-form-item label="Activity name">
|
<el-form-item label="轮询时间" prop="polling_time">
|
||||||
<el-input v-model="form.name" />
|
<el-input v-model="form.polling_time" clearable/><span>秒</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="Activity zone">
|
<el-form-item label="失败重试时间" prop="faile_retry_time">
|
||||||
|
<el-input v-model="form.faile_retry_time" clearable/><span>秒</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="主机地址" prop="host">
|
||||||
|
<el-input v-model="form.host" clearable/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="端口号" prop="port">
|
||||||
|
<el-input v-model="form.port" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="faile_retry_time">
|
||||||
<el-select v-model="form.region" placeholder="please select your zone">
|
<el-select v-model="form.region" placeholder="please select your zone">
|
||||||
<el-option label="Zone one" value="shanghai" />
|
<el-option label="Zone one" value="shanghai" />
|
||||||
<el-option label="Zone two" value="beijing" />
|
<el-option label="Zone two" value="beijing" />
|
||||||
|
@ -40,10 +49,10 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="Activity form">
|
<el-form-item label="Activity form">
|
||||||
<el-input v-model="form.desc" type="textarea" />
|
<el-input v-model="form.desc" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||||
<el-button>取消</el-button>
|
<el-button @click="closeDialog">取消</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
@ -52,26 +61,57 @@
|
||||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||||
import infoApi from "@/api/infoApi.js";
|
import infoApi from "@/api/infoApi.js";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
export default {
|
export default {//2: 'modbus_rtu', 3: 'plc_s7'
|
||||||
props: ["formData", "dialogVisible"],
|
props: ["formData", "dialogVisible", "pztype", "pztypecode"],
|
||||||
emits: ["dialogClose", "dialogSuccess"],
|
emits: ["dialogClose", "dialogSuccess"],
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const ruleFormRef = ref(null);
|
const ruleFormRef = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
polling_time: "",
|
||||||
region: '',
|
faile_retry_time: "",
|
||||||
date1: '',
|
host: '',
|
||||||
date2: '',
|
port: '',
|
||||||
delivery: false,
|
id: 1,
|
||||||
type: [],
|
},
|
||||||
resource: '',
|
rules: {
|
||||||
desc: '',
|
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' }],
|
||||||
|
port: [{ required: true, message: "请输入端口号", trigger: "blur" }]
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const onSubmit = async () => {
|
||||||
|
console.log(555, props.formData.name);
|
||||||
|
await ruleFormRef.value.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const param = {
|
||||||
|
driver_name: props.formData.name,
|
||||||
|
polling_time:Number(state.form.polling_time),
|
||||||
|
faile_retry_time: Number(state.form.faile_retry_time),
|
||||||
|
host: state.form.host,
|
||||||
|
port: Number(state.form.port),
|
||||||
|
id: Number(state.form.id)
|
||||||
|
}
|
||||||
|
console.log(777, param);
|
||||||
|
const res = await infoApi.addPz(param);
|
||||||
|
if (res.code == 0) {
|
||||||
|
ElMessage.success(res.message || "请求成功");
|
||||||
|
ctx.emit("dialogClose");
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("error submit!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = () => {
|
|
||||||
console.log('submit!')
|
|
||||||
}
|
}
|
||||||
const visible = computed(() => {
|
const visible = computed(() => {
|
||||||
return props.dialogVisible;
|
return props.dialogVisible;
|
||||||
|
@ -83,7 +123,6 @@ export default {
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
ctx.emit("dialogClose");
|
ctx.emit("dialogClose");
|
||||||
};
|
};
|
||||||
|
|
||||||
const importData = () => { };
|
const importData = () => { };
|
||||||
|
|
||||||
const exportData = () => { };
|
const exportData = () => { };
|
||||||
|
@ -93,10 +132,20 @@ export default {
|
||||||
visible,
|
visible,
|
||||||
closeDialog,
|
closeDialog,
|
||||||
importData,
|
importData,
|
||||||
exportData
|
exportData,
|
||||||
|
onSubmit,
|
||||||
|
ruleFormRef
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .el-form-item__content {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
span {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -107,6 +107,7 @@
|
||||||
:type="type"
|
:type="type"
|
||||||
:qudongOptions="qudongOptions"
|
:qudongOptions="qudongOptions"
|
||||||
:dialogVisible="dialogVisible"
|
:dialogVisible="dialogVisible"
|
||||||
|
|
||||||
v-if="dialogVisible"
|
v-if="dialogVisible"
|
||||||
@dialogClose="dialogClose"
|
@dialogClose="dialogClose"
|
||||||
@dialogSuccess="dialogSuccess"
|
@dialogSuccess="dialogSuccess"
|
||||||
|
@ -121,6 +122,9 @@
|
||||||
</AddSet>
|
</AddSet>
|
||||||
<PzSet
|
<PzSet
|
||||||
:dialogVisible="dialogVisible3"
|
:dialogVisible="dialogVisible3"
|
||||||
|
:formData="formData"
|
||||||
|
:pztype="pztype"
|
||||||
|
:pztypecode="pztypecode"
|
||||||
v-if="dialogVisible3"
|
v-if="dialogVisible3"
|
||||||
@dialogClose="dialogClose3"
|
@dialogClose="dialogClose3"
|
||||||
@dialogSuccess="dialogSuccess3"
|
@dialogSuccess="dialogSuccess3"
|
||||||
|
@ -157,7 +161,9 @@ export default {
|
||||||
dialogVisible1: false,
|
dialogVisible1: false,
|
||||||
dialogVisible2: false,
|
dialogVisible2: false,
|
||||||
dialogVisible3: false,
|
dialogVisible3: false,
|
||||||
type: '0' // 0新增 1 编辑
|
type: '0', // 0新增 1 编辑
|
||||||
|
pztype: '',
|
||||||
|
pztypecode: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -170,6 +176,7 @@ export default {
|
||||||
const res = await infoApi.getTxSupport();
|
const res = await infoApi.getTxSupport();
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
state.qudongOptions = res.data;
|
state.qudongOptions = res.data;
|
||||||
|
console.log(123, state.qudongOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,6 +286,10 @@ export default {
|
||||||
|
|
||||||
const openPz = (item) => {
|
const openPz = (item) => {
|
||||||
state.dialogVisible3 = true;
|
state.dialogVisible3 = true;
|
||||||
|
state.pztype = state.qudongOptions[item.type];
|
||||||
|
console.log(456, item.type);
|
||||||
|
state.pztypecode = item.type;
|
||||||
|
state.formData = JSON.parse(JSON.stringify(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue