This commit is contained in:
lll 2023-11-10 14:39:32 +08:00
parent 5afc5afdcb
commit 6a802226b5
6 changed files with 43 additions and 8 deletions

View File

@ -26,6 +26,7 @@ export default {
}, },
created() { created() {
// this.queryallanswer(); // this.queryallanswer();
console.log(this.$annswerObj, "变化没用");
}, },
methods: { methods: {
// //

5
src/answerObj.js Normal file
View File

@ -0,0 +1,5 @@
export let answer = {
kqwk: "",
wkgzfs: "",
wkms: "",
};

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-dialog title="网关配置" :visible.sync="dialogVisible"> <el-dialog title="网关配置" :visible.sync="dialogVisible" width="70%">
<el-dialog title="详情" :visible.sync="xqFlag" width="30%"> <el-dialog title="详情" :visible.sync="xqFlag" width="30%">
<div class="xqbox"> <div class="xqbox">
<p> <p>
@ -41,7 +41,7 @@
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template></el-table-column </template></el-table-column
> >
<el-table-column type="selection" width="55"> </el-table-column> <el-table-column type="selection" width="40"> </el-table-column>
<el-table-column prop="wgid" label="网关ID"> </el-table-column> <el-table-column prop="wgid" label="网关ID"> </el-table-column>
<el-table-column prop="wgbh" label="网关编号"> </el-table-column> <el-table-column prop="wgbh" label="网关编号"> </el-table-column>
<el-table-column prop="wgmc" label="网关名称"> </el-table-column> <el-table-column prop="wgmc" label="网关名称"> </el-table-column>
@ -81,7 +81,7 @@
</el-table> </el-table>
</el-dialog> </el-dialog>
<el-dialog title="新建网关" :visible.sync="flag" width="30%"> <el-dialog title="新建网关" :visible.sync="flag">
<el-form <el-form
:model="ruleForm" :model="ruleForm"
:rules="rules" :rules="rules"
@ -167,6 +167,7 @@ export default {
user_id: "", user_id: "",
wgpz: [], wgpz: [],
FormData: [], FormData: [],
multipleSelection: [],
search: "", search: "",
rowDate: {}, rowDate: {},
ruleForm: { ruleForm: {
@ -207,7 +208,6 @@ export default {
this.$refs["ruleForm"].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
if (this.wgpz.length < 4) { if (this.wgpz.length < 4) {
this.wgpz.push(this.ruleForm);
localStorage.setItem("wgpz", JSON.stringify(this.wgpz)); localStorage.setItem("wgpz", JSON.stringify(this.wgpz));
this.SaveUserAnswer(); this.SaveUserAnswer();
this.flag = false; this.flag = false;
@ -219,7 +219,6 @@ export default {
return false; return false;
} }
} else { } else {
console.log("error submit!!");
return false; return false;
} }
}); });
@ -236,6 +235,13 @@ export default {
}, },
// //
deleteSelectedRows() { deleteSelectedRows() {
if (this.multipleSelection.length == 0) {
this.$message({
message: "请先选择数据",
type: "warning",
});
return false;
}
this.wgpz = this.wgpz.filter( this.wgpz = this.wgpz.filter(
(row) => !this.multipleSelection.includes(row) (row) => !this.multipleSelection.includes(row)
); );
@ -267,6 +273,7 @@ export default {
mark_value: JSON.stringify(this.wgpz), mark_value: JSON.stringify(this.wgpz),
}); });
if (data.state) { if (data.state) {
this.wgpz.push(this.ruleForm);
this.$message({ this.$message({
message: "操作成功", message: "操作成功",
type: "success", type: "success",
@ -303,4 +310,7 @@ export default {
} }
} }
} }
.el-table {
height: 400px;
}
</style> </style>

View File

@ -39,6 +39,7 @@
title="网关维护" title="网关维护"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:append-to-body="true" :append-to-body="true"
width="90%"
> >
<div class="title"> <div class="title">
<div class="left"> <div class="left">
@ -277,9 +278,8 @@ export default {
this.$refs["ruleForm"].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
if (this.tableData.length < 4) { if (this.tableData.length < 4) {
this.tableData.push(this.ruleForm);
localStorage.setItem("wgwh", JSON.stringify(this.tableData));
this.SaveUserAnswer(); this.SaveUserAnswer();
localStorage.setItem("wgwh", JSON.stringify(this.tableData));
this.flag = false; this.flag = false;
} else { } else {
this.$message({ this.$message({
@ -333,6 +333,7 @@ export default {
mark_value: JSON.stringify(this.tableData), mark_value: JSON.stringify(this.tableData),
}); });
if (data.state) { if (data.state) {
this.tableData.push(this.ruleForm);
this.$message({ this.$message({
message: "操作成功", message: "操作成功",
type: "success", type: "success",
@ -373,4 +374,7 @@ export default {
} }
} }
} }
.el-table {
height: 400px;
}
</style> </style>

View File

@ -49,6 +49,7 @@
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<!-- <el-button @click="change">改变</el-button> -->
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -67,6 +68,11 @@ export default {
wkgzfs: "LAN口", wkgzfs: "LAN口",
wkms: "n", wkms: "n",
}, },
// $answerObj: {
// kqwk: "",
// wkgzfs: "",
// wkms: "",
// },
rules: { rules: {
kqwk: [{ required: true, trigger: "change", message: "必填项" }], kqwk: [{ required: true, trigger: "change", message: "必填项" }],
wkgzfs: [{ required: true, trigger: "change", message: "必填项" }], wkgzfs: [{ required: true, trigger: "change", message: "必填项" }],
@ -75,6 +81,9 @@ export default {
}; };
}, },
created() { created() {
// this.$answerObj.kqwk = "";
// console.log(this.$answerObj);
let that = this; let that = this;
window.getParameter = that; window.getParameter = that;
this.GetUserAnswer(); this.GetUserAnswer();
@ -83,6 +92,9 @@ export default {
getParameter(data) { getParameter(data) {
this.user_id = data; this.user_id = data;
}, },
change() {
console.log(this.$answerObj);
},
async saveDatas() { async saveDatas() {
let datas = JSON.parse(sessionStorage.getItem("CKFWQ_wx")); let datas = JSON.parse(sessionStorage.getItem("CKFWQ_wx"));
let res = await SaveUserAnswer({ let res = await SaveUserAnswer({

View File

@ -6,6 +6,8 @@ import "element-ui/lib/theme-chalk/index.css";
import store from "./store"; import store from "./store";
Vue.config.productionTip = false; Vue.config.productionTip = false;
import moment from "moment"; import moment from "moment";
import { answer } from "./answerObj";
let answerObj = Vue.observable(answer);
//定义一个全局过滤器实现日期格式化 //定义一个全局过滤器实现日期格式化
Vue.filter("datefmt", function (input, fmtstring) { Vue.filter("datefmt", function (input, fmtstring) {
//当input为时间戳时需转为Number类型 //当input为时间戳时需转为Number类型
@ -14,6 +16,7 @@ Vue.filter("datefmt", function (input, fmtstring) {
}); });
Vue.prototype.$moment = moment; Vue.prototype.$moment = moment;
Vue.prototype.$store = store; Vue.prototype.$store = store;
Vue.prototype.$answerObj = answerObj;
Vue.use(ElementUI); Vue.use(ElementUI);
new Vue({ new Vue({
router, router,