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

View File

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

View File

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

View File

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