Merge branch 'main' of https://git.shikicc.com/wangqiujuan0808/dataControl
commit
32833eb6b8
|
@ -130,6 +130,10 @@ const infoApi = {
|
|||
editSet(params) {
|
||||
return postPBRequest('/driver', params, 54210, params.driver_name)
|
||||
},
|
||||
// 设备导入
|
||||
importDevice(params,driver_name) {
|
||||
return postPBRequest('/driver', params, 54212,driver_name)
|
||||
},
|
||||
|
||||
// 获取设备列表
|
||||
getSet(params) {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
// import { mb_list, mb_info, response} from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type", "templateData"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
|
||||
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">驱动名称</legend>
|
||||
<el-form label-width="130px">
|
||||
<el-form-item>
|
||||
{{ name }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">驱动名称</legend>
|
||||
<el-form label-width="130px">
|
||||
<el-form-item>
|
||||
{{ name }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通讯状态</legend>
|
||||
<el-form label-width="130px">
|
||||
<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>
|
||||
</fieldset>
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通讯计数</legend>
|
||||
<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" size="large" @click="resetCount">重置计数</el-button>
|
||||
<!-- <el-button @click="closeDialog">取消</el-button> -->
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通讯状态</legend>
|
||||
<el-form label-width="130px">
|
||||
<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>
|
||||
</fieldset>
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通讯计数</legend>
|
||||
<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" size="large" @click="resetCount">重置计数</el-button>
|
||||
<!-- <el-button @click="closeDialog">取消</el-button> -->
|
||||
</div>
|
||||
</fieldset>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -75,8 +75,8 @@ export default {
|
|||
getD();
|
||||
});
|
||||
const getD = async () => {
|
||||
const parm = {
|
||||
name: props.formData.driver_name
|
||||
const parm = {
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getD(parm);
|
||||
if (res.code == 0) {
|
||||
|
@ -87,7 +87,7 @@ export default {
|
|||
};
|
||||
const resetCount = async () => {
|
||||
const parm = {
|
||||
name: props.formData.name
|
||||
name: props.formData.name
|
||||
}
|
||||
const res = await infoApi.resetCount(parm);
|
||||
if (res.code == 0) {
|
||||
|
@ -113,6 +113,7 @@ export default {
|
|||
::v-deep .el-form-item__content {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
>span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,10 @@ export default {
|
|||
// 请求数据
|
||||
const param = {
|
||||
name: store.state.userInfo.nickName,
|
||||
password: md5(state.formData.oldPass).toUpperCase(),
|
||||
new_password: md5(state.formData.newPass).toUpperCase()
|
||||
password: state.formData.oldPass,
|
||||
new_password: state.formData.newPass,
|
||||
// password: md5(state.formData.oldPass).toUpperCase(),
|
||||
// new_password: md5(state.formData.newPass).toUpperCase()
|
||||
}
|
||||
const res = await myApi.editPass(param);
|
||||
if (res.code == 0) {
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="点位导入" width="40%" :before-close="closeDialog">
|
||||
<input style="display:none" type="file" @change="uploadFile" id="fileinput1" class="fileinput" />
|
||||
<label class="filelabel" for="fileinput1">上传</label>
|
||||
<div class="fileName">
|
||||
<span>{{ fileName }}</span>
|
||||
<delete class="delete" @click="delFile" v-if="fileName" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button size="large" @click="closeDialog">取消</el-button>
|
||||
<el-button size="large" type="primary" @click="saveP"> 保存 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</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: ["formData", "dialogVisible"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
|
||||
const state = reactive({
|
||||
fileName: '',
|
||||
importData: new FormData()
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
});
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
||||
const saveP = async () => {
|
||||
const res = await infoApi.importDevice(state.importData, props.formData.driver_name);
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.message);
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
ElMessage.error(res.data || res.message);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const uploadFile = (e) => {
|
||||
let file = e.target.files[0];
|
||||
state.fileName = file.name;
|
||||
state.importData.append("file", file);
|
||||
}
|
||||
|
||||
const delFile = () => {
|
||||
state.fileName = '';
|
||||
state.formData = new FormData();
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
visible,
|
||||
closeDialog,
|
||||
saveP,
|
||||
uploadFile,
|
||||
delFile
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.filelabel {
|
||||
background: #1890ff;
|
||||
border: 1px solid #1890ff;
|
||||
font-weight: 500;
|
||||
padding: 5px 15px 5px;
|
||||
margin: 0 2px 0 6px;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.fileName {
|
||||
margin: 15px 0;
|
||||
font-size: 16px;
|
||||
.delete {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -31,9 +31,6 @@ export default {
|
|||
return props.dialogVisible;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
state.addForm = props.pointData
|
||||
});
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" title="驱动配置" direction="rtl" :before-close="closeDialog">
|
||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog" title="驱动配置">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">驱动名称</legend>
|
||||
<el-form label-width="130px">
|
||||
<el-form-item>
|
||||
{{ formData.name }}
|
||||
{{ form.driver_name }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<!-- 1 modbus_tcp -->
|
||||
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 1">
|
||||
<!-- 2 modbus_tcp -->
|
||||
<el-form size="large" :model="form" label-width="120px" :rules="rules" ref="ruleFormRef" v-if="pztypecode === 2">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通用配置</legend>
|
||||
<el-form-item label="轮询时间" prop="polling_time">
|
||||
|
@ -27,10 +27,20 @@
|
|||
<el-form-item label="端口号" prop="port">
|
||||
<el-input-number v-model="form.port" :min="1" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="大小端模式" prop="little_endian">
|
||||
<el-select v-model="form.little_endian">
|
||||
<el-option v-for="item in endianArr" :label="item.name" :value="item.value" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字节顺序" prop="wordswap">
|
||||
<el-select v-model="form.wordswap">
|
||||
<el-option v-for="item in wordswapArr" :label="item.name" :value="item.value" :key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</fieldset>
|
||||
</el-form>
|
||||
<!-- 2: 'modbus_rtu' -->
|
||||
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 2">
|
||||
<!-- 1: 'modbus_rtu' -->
|
||||
<el-form size="large" :model="form2" label-width="120px" :rules="rules2" ref="ruleFormRef2" v-if="pztypecode === 1">
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">通用配置</legend>
|
||||
<el-form-item label="轮询时间" prop="polling_time">
|
||||
|
@ -116,11 +126,14 @@ export default {
|
|||
const ruleFormRef3 = ref(null);
|
||||
const state = reactive({
|
||||
form: {
|
||||
driver_name: '',
|
||||
polling_time: "",
|
||||
faile_retry_time: "",
|
||||
host: '',
|
||||
port: '',
|
||||
id: 1,
|
||||
little_endian: false,
|
||||
wordswap: false
|
||||
},
|
||||
form2: {
|
||||
polling_time: "",
|
||||
|
@ -140,6 +153,26 @@ export default {
|
|||
rack: 1,
|
||||
id: 1
|
||||
},
|
||||
endianArr: [
|
||||
{
|
||||
name: '大端模式',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: '小端模式',
|
||||
value: true
|
||||
}
|
||||
],
|
||||
wordswapArr: [
|
||||
{
|
||||
name: '正常',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: '交换',
|
||||
value: true
|
||||
}
|
||||
],
|
||||
comArr: [],// com
|
||||
baudRateArr: [{
|
||||
name: 2400,
|
||||
|
@ -215,7 +248,9 @@ export default {
|
|||
}
|
||||
}, trigger: 'blur'
|
||||
}],
|
||||
port: [{ required: true, message: "请输入端口号", trigger: "blur" }]
|
||||
port: [{ required: true, message: "请输入端口号", trigger: "blur" }],
|
||||
little_endian: [{ required: true, message: "请选择大小端模式", trigger: "blur" }],
|
||||
wordswap: [{ required: true, message: "请选择字节顺序", trigger: "blur" }]
|
||||
},
|
||||
rules2: {
|
||||
polling_time: [{ required: true, message: "请输入轮询时间", trigger: "blur" }],
|
||||
|
@ -246,15 +281,15 @@ export default {
|
|||
});
|
||||
const onSubmit = async () => {
|
||||
var header = {
|
||||
driver_name: props.formData.name
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
if (props.pztypecode === 1) {
|
||||
if (props.pztypecode === 2) {
|
||||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
var param = {
|
||||
...state.form,
|
||||
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)
|
||||
}
|
||||
|
@ -268,7 +303,7 @@ export default {
|
|||
} else {
|
||||
}
|
||||
});
|
||||
} else if (props.pztypecode === 2) {
|
||||
} else if (props.pztypecode === 1) {
|
||||
await ruleFormRef2.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// var param = {
|
||||
|
@ -332,8 +367,19 @@ export default {
|
|||
});
|
||||
|
||||
onMounted(() => {
|
||||
getCom();
|
||||
getD();
|
||||
// getCom();
|
||||
});
|
||||
const getD = async () => {
|
||||
const parm = {
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getD(parm);
|
||||
if (res.code == 0) {
|
||||
state.form = res.data;
|
||||
console.log(state.form);
|
||||
}
|
||||
};
|
||||
const getCom = async () => {
|
||||
const parm = {
|
||||
name: props.formData.name
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible">
|
||||
v-model="visible" title="点位管理">
|
||||
<el-card class="top-title">
|
||||
<span>模板名称:{{ formData.template_name }}</span>
|
||||
<!-- <span>模板描述:{{ formData.template_description }}</span>
|
||||
|
@ -64,7 +64,6 @@
|
|||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { Base64 } from 'js-base64';
|
||||
import axios from "axios";
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible">
|
||||
v-model="visible" title="设备管理">
|
||||
<el-card class="top-title">
|
||||
<span>通讯名称:{{ formData.driver_name }}</span>
|
||||
<span>设备数量:{{ propertiesData.length }}</span>
|
||||
|
@ -38,16 +38,21 @@
|
|||
<AddSet :type="type" :formData="formData1" :setData="setData" :dialogVisible="dialogVisible1" v-if="dialogVisible1"
|
||||
@dialogClose="dialogVisible1 = false" @dialogSuccess="dialogSuccess1">
|
||||
</AddSet>
|
||||
<ExportDevice :formData="formData1" :dialogVisible="dialogVisible2" v-if="dialogVisible2"
|
||||
@dialogClose="dialogVisible2 = false" @dialogSuccess="dialogSuccess2"></ExportDevice>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import AddSet from "@/components/AddSet.vue";
|
||||
import ExportDevice from "@/components/ExportDevice.vue";
|
||||
export default {
|
||||
components: {
|
||||
AddSet
|
||||
AddSet,
|
||||
ExportDevice
|
||||
},
|
||||
props: ["formData", "dialogVisible", "qudongOptions"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
|
@ -58,7 +63,8 @@ export default {
|
|||
setData: {},
|
||||
dialogVisible1: false,
|
||||
type: 'I',
|
||||
driverInfo: {}
|
||||
driverInfo: {},
|
||||
dialogVisible2:false
|
||||
});
|
||||
const visible = computed(() => {
|
||||
return props.dialogVisible;
|
||||
|
@ -142,12 +148,34 @@ export default {
|
|||
getSet();
|
||||
};
|
||||
|
||||
const importData = () => {
|
||||
const dialogSuccess2 = () => {
|
||||
state.dialogVisible2 = false;
|
||||
getSet();
|
||||
}
|
||||
|
||||
const importData = () => {
|
||||
state.formData1 = props.formData;
|
||||
state.dialogVisible2 = true;
|
||||
}
|
||||
|
||||
const exportData = () => {
|
||||
|
||||
axios({
|
||||
method: "post",
|
||||
url: '/driver',
|
||||
headers: {
|
||||
"action": 54211,
|
||||
'driver_name': props.formData.driver_name
|
||||
},
|
||||
responseType: 'blob',
|
||||
}).then((response) => {
|
||||
let fileName = response.headers['content-disposition'].split('filename=')[1];
|
||||
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', `${decodeURI(fileName.split('"')[1])}`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}).catch();
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +188,8 @@ export default {
|
|||
dialogSuccess1,
|
||||
importData,
|
||||
exportData,
|
||||
editData
|
||||
editData,
|
||||
dialogSuccess2
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
|
@ -288,7 +288,10 @@ s {
|
|||
color: transparent;
|
||||
}
|
||||
.el-form-item__label {
|
||||
width: 100px !important;
|
||||
// width: 100px !important;
|
||||
}
|
||||
.el-drawer__title {
|
||||
font-size: 20px;
|
||||
}
|
||||
/* 点击树结构项的选中颜色 */
|
||||
.el-tree--highlight-current .is-current.el-tree-node > .el-tree-node__content {
|
||||
|
|
|
@ -77,24 +77,25 @@ export default {
|
|||
// 1. 编码数据
|
||||
const userInfo = {
|
||||
username: state.ruleForm.username,
|
||||
password: md5(state.ruleForm.password).toUpperCase(),
|
||||
password: state.ruleForm.password
|
||||
// password: md5(state.ruleForm.password).toUpperCase(),
|
||||
}
|
||||
// 模拟登录
|
||||
localSet("token", '99999999999999999');
|
||||
store.commit("setUserInfo", userInfo);
|
||||
window.location.href = '/';
|
||||
// localSet("token", '99999999999999999');
|
||||
// store.commit("setUserInfo", userInfo);
|
||||
// window.location.href = '/';
|
||||
|
||||
// myApi.login(userInfo).then(async (res) => {
|
||||
// if (res.code == 0) {
|
||||
// let userInfo = {
|
||||
// nickName: state.ruleForm.username,
|
||||
// };
|
||||
// store.commit("setUserInfo", userInfo);
|
||||
// getLoginStatus();
|
||||
// } else {
|
||||
// ElMessage.error(res.message);
|
||||
// }
|
||||
// })
|
||||
myApi.login(userInfo).then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
let userInfo = {
|
||||
nickName: state.ruleForm.username,
|
||||
};
|
||||
store.commit("setUserInfo", userInfo);
|
||||
getLoginStatus();
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ export default {
|
|||
const openPz = (item) => {
|
||||
state.dialogVisible3 = true;
|
||||
state.pztype = state.qudongOptions[item.type];
|
||||
state.pztypecode = item.type;
|
||||
state.pztypecode = item.driver_type;
|
||||
state.formData = JSON.parse(JSON.stringify(item));
|
||||
}
|
||||
const openDetails = (item) => {
|
||||
|
|
Loading…
Reference in New Issue