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