main
parent
ac0559f5bb
commit
b05fb583ed
|
@ -84,6 +84,11 @@ const infoApi = {
|
||||||
detP(params) {
|
detP(params) {
|
||||||
return postPBRequest('/template', params, 53310, params.template_name)
|
return postPBRequest('/template', params, 53310, params.template_name)
|
||||||
},
|
},
|
||||||
|
// 点位导入
|
||||||
|
|
||||||
|
importP(params) {
|
||||||
|
return postPBRequest('/template', params, 53310, params.template_name)
|
||||||
|
},
|
||||||
// 驱动列表查询
|
// 驱动列表查询
|
||||||
getTx(params) {
|
getTx(params) {
|
||||||
return postPBRequest('/driver', params, 54000)
|
return postPBRequest('/driver', params, 54000)
|
||||||
|
|
|
@ -208,15 +208,7 @@ export default {
|
||||||
{ required: true, validator: validName, trigger: "blur" },
|
{ required: true, validator: validName, trigger: "blur" },
|
||||||
],
|
],
|
||||||
description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
|
description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
|
||||||
type: [{ required: true, message: "请选择通讯驱动", trigger: "blur" }],
|
type: [{ required: true, message: "请选择通讯驱动", trigger: "blur" }]
|
||||||
// com: [{ required: true, message: "请选择COM口", trigger: "blur" }],
|
|
||||||
// baudRate: [{ required: true, message: "请选择波特率", trigger: "blur" }],
|
|
||||||
// parity: [{ required: true, message: "请选择校验位", trigger: "blur" }],
|
|
||||||
// dataBits: [{ required: true, message: "请选择数据位", trigger: "blur" }],
|
|
||||||
// stopBits: [{ required: true, message: "请选择停止位", trigger: "blur" }],
|
|
||||||
// timeout: [{ required: true, message: "请选择超时时间", trigger: "blur" }],
|
|
||||||
// port: [{ required: true, message: "请填写主机地址", trigger: "blur" }],
|
|
||||||
// host: [{ required: true, message: "请填写主机端口", trigger: "blur" }]
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const visible = computed(() => {
|
const visible = computed(() => {
|
||||||
|
@ -269,7 +261,7 @@ export default {
|
||||||
ElMessage.success(res.message || "请求成功");
|
ElMessage.success(res.message || "请求成功");
|
||||||
ctx.emit("dialogSuccess");
|
ctx.emit("dialogSuccess");
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.message || "请求失败");
|
ElMessage.error(res.data || res.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("error submit!");
|
console.log("error submit!");
|
||||||
|
|
|
@ -171,10 +171,6 @@ export default {
|
||||||
ctx.emit("dialogClose");
|
ctx.emit("dialogClose");
|
||||||
};
|
};
|
||||||
|
|
||||||
const importData = () => { };
|
|
||||||
|
|
||||||
const exportData = () => { };
|
|
||||||
|
|
||||||
const saveP = async () => {
|
const saveP = async () => {
|
||||||
console.log(ruleFormRef.value);
|
console.log(ruleFormRef.value);
|
||||||
await ruleFormRef.value.validate(async (valid) => {
|
await ruleFormRef.value.validate(async (valid) => {
|
||||||
|
@ -203,8 +199,6 @@ export default {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
visible,
|
visible,
|
||||||
closeDialog,
|
closeDialog,
|
||||||
importData,
|
|
||||||
exportData,
|
|
||||||
saveP,
|
saveP,
|
||||||
ruleFormRef
|
ruleFormRef
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<el-dialog v-model="visible" title="设备管理" width="40%" :before-close="closeDialog">
|
<el-dialog v-model="visible" title="设备管理" width="40%" :before-close="closeDialog">
|
||||||
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef">
|
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef">
|
||||||
<el-form-item label="设备名称:" prop="name">
|
<el-form-item label="设备名称:" prop="name">
|
||||||
<el-input v-model="addForm.name" placeholder="请输入点位名称" clearable :disabled="type!=='I'"/>
|
<el-input v-model="addForm.name" placeholder="请输入设备名称" clearable :disabled="type!=='I'"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备id:" prop="id">
|
<el-form-item label="设备id:" prop="id">
|
||||||
<el-input v-model="addForm.id" placeholder="请输入设备id:1-255" clearable type="number" />
|
<el-input v-model="addForm.id" placeholder="请输入设备id:1-255" clearable type="number" />
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
<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 style="width: 18px; height: 18px; margin-left: 8px;" @click="delFile" v-if="fileName"/>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="closeDialog">取消</el-button>
|
||||||
|
<el-button 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: '',
|
||||||
|
formData: new FormData()
|
||||||
|
});
|
||||||
|
const visible = computed(() => {
|
||||||
|
return props.dialogVisible;
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
state.addForm = props.pointData
|
||||||
|
});
|
||||||
|
const closeDialog = () => {
|
||||||
|
ctx.emit("dialogClose");
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveP = async () => {
|
||||||
|
const res = await infoApi.importP(state.formData);
|
||||||
|
ctx.emit("dialogSuccess");
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const uploadFile = (e) => {
|
||||||
|
let file = e.target.files[0];
|
||||||
|
state.fileName = file.name;
|
||||||
|
state.formData.append("file", file);
|
||||||
|
state.formData.append("folderName", file.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="nickname">
|
<div class="nickname">
|
||||||
<p>登录名:{{ (userInfo && userInfo.loginUserName) || "" }}</p>
|
<p>登录名:{{ (userInfo && userInfo.nickName) || "" }}</p>
|
||||||
<p>昵称:{{ (userInfo && userInfo.nickName) || "" }}</p>
|
<p>昵称:{{ (userInfo && userInfo.nickName) || "" }}</p>
|
||||||
<el-tag effect="dark" class="reStart" @click="reStart"
|
<el-tag effect="dark" class="reStart" @click="reStart"
|
||||||
>重启设备</el-tag
|
>重启设备</el-tag
|
||||||
|
@ -62,15 +62,12 @@ export default {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
name: "dashboard",
|
name: "dashboard",
|
||||||
userInfo: null,
|
userInfo: store.state.userInfo,
|
||||||
hasBack: false,
|
hasBack: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const pathname = window.location.hash.split("/")[1] || "";
|
const pathname = window.location.hash.split("/")[1] || "";
|
||||||
if (!["login"].includes(pathname)) {
|
|
||||||
getUserInfo();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const dialogClose = () => {
|
const dialogClose = () => {
|
||||||
state.dialogVisible = false;
|
state.dialogVisible = false;
|
||||||
|
@ -79,19 +76,6 @@ export default {
|
||||||
const dialogSuccess = () => {
|
const dialogSuccess = () => {
|
||||||
state.dialogVisible = false;
|
state.dialogVisible = false;
|
||||||
};
|
};
|
||||||
const getUserInfo = async () => {
|
|
||||||
// const userInfo = await myApi.getUserInfo();
|
|
||||||
// state.userInfo = userInfo
|
|
||||||
state.userInfo = {
|
|
||||||
adminUserId: 1,
|
|
||||||
locked: 0,
|
|
||||||
loginPassword: "******",
|
|
||||||
loginUserName: "admin",
|
|
||||||
nickName: "admin",
|
|
||||||
};
|
|
||||||
store.commit("setUserInfo", state.userInfo);
|
|
||||||
};
|
|
||||||
|
|
||||||
const reStart = async () => {
|
const reStart = async () => {
|
||||||
const res = await infoApi.reboot();
|
const res = await infoApi.reboot();
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
|
|
@ -56,9 +56,11 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<AddPoint :type="type" :formData="formData1" :pointData="pointData" :dialogVisible="dialogVisible1" v-if="dialogVisible1"
|
<AddPoint :type="type" :formData="formData1" :pointData="pointData" :dialogVisible="dialogVisible1"
|
||||||
@dialogClose="dialogVisible1 = false" @dialogSuccess="dialogSuccess1">
|
v-if="dialogVisible1" @dialogClose="dialogVisible1 = false" @dialogSuccess="dialogSuccess1">
|
||||||
</AddPoint>
|
</AddPoint>
|
||||||
|
<ExportPoint :formData="formData1" :dialogVisible="dialogVisible2" v-if="dialogVisible2" @dialogClose="dialogVisible2 = false"
|
||||||
|
@dialogSuccess="dialogSuccess2"></ExportPoint>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -66,9 +68,11 @@ 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";
|
||||||
import AddPoint from "@/components/AddPoint.vue";
|
import AddPoint from "@/components/AddPoint.vue";
|
||||||
|
import ExportPoint from "@/components/ExportPoint.vue";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AddPoint
|
AddPoint,
|
||||||
|
ExportPoint
|
||||||
},
|
},
|
||||||
props: ["formData", "dialogVisible", "templateData"],
|
props: ["formData", "dialogVisible", "templateData"],
|
||||||
emits: ["dialogClose", "dialogSuccess"],
|
emits: ["dialogClose", "dialogSuccess"],
|
||||||
|
@ -77,6 +81,7 @@ export default {
|
||||||
pointData: {},
|
pointData: {},
|
||||||
formData1: {},
|
formData1: {},
|
||||||
dialogVisible1: false,
|
dialogVisible1: false,
|
||||||
|
dialogVisible2: false,
|
||||||
propertiesData: [],
|
propertiesData: [],
|
||||||
typeData: {
|
typeData: {
|
||||||
1: 'bool',
|
1: 'bool',
|
||||||
|
@ -184,8 +189,14 @@ export default {
|
||||||
getPointList();
|
getPointList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const importData = () => {
|
const dialogSuccess2 = () => {
|
||||||
|
state.dialogVisible2 = false;
|
||||||
|
getPointList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const importData = () => {
|
||||||
|
state.formData1 = props.formData;
|
||||||
|
state.dialogVisible2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportData = () => {
|
const exportData = () => {
|
||||||
|
@ -199,6 +210,7 @@ export default {
|
||||||
delData,
|
delData,
|
||||||
manageData,
|
manageData,
|
||||||
dialogSuccess1,
|
dialogSuccess1,
|
||||||
|
dialogSuccess2,
|
||||||
importData,
|
importData,
|
||||||
exportData,
|
exportData,
|
||||||
editData
|
editData
|
||||||
|
|
|
@ -26,11 +26,14 @@ axios.interceptors.request.use(
|
||||||
|
|
||||||
axios.interceptors.response.use(
|
axios.interceptors.response.use(
|
||||||
(res) => {
|
(res) => {
|
||||||
const token = res.headers["token"]
|
for (const key in res.headers) {
|
||||||
// 如果token不为空,就缓存到本地
|
if (Object.hasOwnProperty.call(res.headers, "token")) {
|
||||||
|
const token = res.headers["token"];
|
||||||
if (typeof (token) != "undefined") {
|
if (typeof (token) != "undefined") {
|
||||||
localSet("token", token);
|
localSet("token", token);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const ret = res.data;
|
const ret = res.data;
|
||||||
// token过期
|
// token过期
|
||||||
if (ret.code === 3004) {
|
if (ret.code === 3004) {
|
||||||
|
|
|
@ -45,10 +45,12 @@ import { user, token, response } from '../proto/data/pd'
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import md5 from 'js-md5'
|
import md5 from 'js-md5'
|
||||||
import { localRemove, pathMap } from "@/utils";
|
import { localRemove, pathMap } from "@/utils";
|
||||||
|
import { useStore } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: "Login",
|
||||||
setup() {
|
setup() {
|
||||||
|
const store = useStore();
|
||||||
const loginForm = ref(null);
|
const loginForm = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
|
@ -78,10 +80,12 @@ export default {
|
||||||
password: md5(state.ruleForm.password).toUpperCase(),
|
password: md5(state.ruleForm.password).toUpperCase(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 截取有效长度
|
|
||||||
// const send_userInfo = userInfo.slice(0, userInfo.length);
|
|
||||||
myApi.login(userInfo).then(async (res) => {
|
myApi.login(userInfo).then(async (res) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
let userInfo = {
|
||||||
|
nickName: state.ruleForm.username,
|
||||||
|
};
|
||||||
|
store.commit("setUserInfo", userInfo);
|
||||||
getLoginStatus();
|
getLoginStatus();
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.message);
|
ElMessage.error(res.message);
|
||||||
|
|
Loading…
Reference in New Issue