This commit is contained in:
unknown 2023-11-10 19:17:45 +08:00
commit 587849810d
12 changed files with 253 additions and 49 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

@ -858,11 +858,17 @@ export default {
cmdlist_dz: "", cmdlist_dz: "",
}, },
rules2: { rules2: {
cmdlist_ml: [{ required: true, trigger: "change" }], cmdlist_ml: [{ required: true, trigger: "change", message: "必填项" }],
cmdlist_sbid: [{ required: true, trigger: "change" }], cmdlist_sbid: [
cmdlist_qsdz: [{ required: true, trigger: "change" }], { required: true, trigger: "change", message: "必填项" },
cmdlist_dzcd: [{ required: true, trigger: "change" }], ],
cmdlist_dz: [{ required: true, trigger: "change" }], cmdlist_qsdz: [
{ required: true, trigger: "change", message: "必填项" },
],
cmdlist_dzcd: [
{ required: true, trigger: "change", message: "必填项" },
],
cmdlist_dz: [{ required: true, trigger: "change", message: "必填项" }],
}, },
value: "", value: "",
flag: false, flag: false,
@ -1032,6 +1038,8 @@ export default {
message: "新增成功", message: "新增成功",
type: "success", type: "success",
}); });
} else {
this.$message.error("新增失败");
} }
}, },
// //

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,12 +273,15 @@ 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",
}); });
this.flag = true;
} else { } else {
this.$message.error("操作失败"); this.$message.error("操作失败");
return;
} }
}, },
}, },
@ -301,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">
@ -222,7 +223,7 @@ export default {
ruleForm: { ruleForm: {
sswg: "", sswg: "",
csname: "", csname: "",
sfyxbz: "", // sfyxbz: "",
sdz: "", sdz: "",
cskey: "", cskey: "",
xsws: "", xsws: "",
@ -236,9 +237,9 @@ export default {
csname: [ csname: [
{ required: true, trigger: "change", message: "请选择一个选项" }, { required: true, trigger: "change", message: "请选择一个选项" },
], ],
sfyxbz: [ // sfyxbz: [
{ required: true, trigger: "change", message: "请选择一个选项" }, // { required: true, trigger: "change", message: "" },
], // ],
sdz: [{ required: true, trigger: "blur", message: "设定值是必填参数" }], sdz: [{ required: true, trigger: "blur", message: "设定值是必填参数" }],
cskey: [ cskey: [
{ required: true, trigger: "change", message: "请选择一个选项" }, { required: true, trigger: "change", message: "请选择一个选项" },
@ -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

@ -158,7 +158,7 @@
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveAll">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -171,6 +171,7 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
//
user_id: "", user_id: "",
ippz_ip1: "192", ippz_ip1: "192",
ippz_ip2: "168", ippz_ip2: "168",
@ -204,8 +205,12 @@ export default {
ippz_dns_by: "", ippz_dns_by: "",
}, },
rules: { rules: {
ippz_ip_hqfs: [{ required: true, message: "", trigger: "blur" }], ippz_ip_hqfs: [
ippz_dns_hqfs: [{ required: true, message: "", trigger: "blur" }], { required: true, message: "请选择一项", trigger: "blur" },
],
ippz_dns_hqfs: [
{ required: true, message: "请选择一项", trigger: "blur" },
],
ippz_ip: [ ippz_ip: [
{ {
required: true, required: true,
@ -241,7 +246,7 @@ export default {
ippz_dns_by: [ ippz_dns_by: [
{ {
required: true, required: true,
validator: this.validatePrimaryDNS, validator: this.validatePrimaryDNS1,
trigger: "blur", trigger: "blur",
message: "", message: "",
}, },
@ -253,6 +258,7 @@ export default {
let that = this; let that = this;
window.getParameter = that.getParameter; window.getParameter = that.getParameter;
}, },
methods: { methods: {
getParameter(data) { getParameter(data) {
this.user_id = data; this.user_id = data;
@ -361,6 +367,7 @@ export default {
submitForm() { submitForm() {
this.$refs["ruleForm"].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
this.saveAll();
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
return false; return false;
@ -372,11 +379,26 @@ export default {
}, },
//ip //ip
validateIpAddress(rule, value, callback) { validateIpAddress(rule, value, callback) {
if (value === "") { if (
this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_ip4 ===
""
) {
callback(new Error("请输入IP地址")); callback(new Error("请输入IP地址"));
} else if ( } else if (
!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( !/^(\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])$/.test(
value this.ippz_ip1 +
"." +
this.ippz_ip2 +
"." +
this.ippz_ip3 +
"." +
this.ippz_ip4
) )
) { ) {
callback(new Error("请输入有效的IP地址")); callback(new Error("请输入有效的IP地址"));
@ -386,11 +408,26 @@ export default {
}, },
// //
validateSubnetMask(rule, value, callback) { validateSubnetMask(rule, value, callback) {
if (value === "") { if (
this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4 ===
""
) {
callback(new Error("请输入子网掩码")); callback(new Error("请输入子网掩码"));
} else if ( } else if (
!/^(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$/.test( !/^(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$/.test(
value this.ippz_zwym1 +
"." +
this.ippz_zwym2 +
"." +
this.ippz_zwym3 +
"." +
this.ippz_zwym4
) )
) { ) {
callback(new Error("请输入有效的子网掩码")); callback(new Error("请输入有效的子网掩码"));
@ -400,24 +437,91 @@ export default {
}, },
// //
validateGateway(rule, value, callback) { validateGateway(rule, value, callback) {
if (value === "") { if (
this.ippz_mrwg1 +
"." +
this.ippz_mrwg2 +
"." +
this.ippz_mrwg3 +
"." +
this.ippz_mrwg4 ===
""
) {
callback(new Error("请输入网关地址")); callback(new Error("请输入网关地址"));
} else if (!/^(\d{1,3}\.){3}\d{1,3}$/.test(value)) { } else if (
!/^(\d{1,3}\.){3}\d{1,3}$/.test(
this.ippz_mrwg1 +
"." +
this.ippz_mrwg2 +
"." +
this.ippz_mrwg3 +
"." +
this.ippz_mrwg4
)
) {
callback(new Error("请输入有效的网关地址")); callback(new Error("请输入有效的网关地址"));
} else { } else {
callback(); callback();
} }
}, },
//dns //dns
validatePrimaryDNS(rule, value, callback) { validatePrimaryDNS(rule, value, callback) {
if (value === "") { if (
this.ippz_dns_zy1 +
"." +
this.ippz_dns_zy2 +
"." +
this.ippz_dns_zy3 +
"." +
this.ippz_dns_zy4 ===
""
) {
callback(new Error("请输入主DNS服务器地址")); callback(new Error("请输入主DNS服务器地址"));
} else if (!isValidPrimaryDNS(value)) { } else if (
!isValidPrimaryDNS(
this.ippz_dns_zy1 +
"." +
this.ippz_dns_zy2 +
"." +
this.ippz_dns_zy3 +
"." +
this.ippz_dns_zy4
)
) {
callback(new Error("请输入有效的主DNS服务器地址")); callback(new Error("请输入有效的主DNS服务器地址"));
} else { } else {
callback(); callback();
} }
}, },
//dns
validatePrimaryDNS1(rule, value, callback) {
if (
this.ippz_dns_by1 +
"." +
this.ippz_dns_by2 +
"." +
this.ippz_dns_by3 +
"." +
this.ippz_dns_by4 ===
""
) {
callback(new Error("请输入备用DNS服务器地址"));
} else if (
!isValidPrimaryDNS(
this.ippz_dns_by1 +
"." +
this.ippz_dns_by2 +
"." +
this.ippz_dns_by3 +
"." +
this.ippz_dns_by4
)
) {
callback(new Error("请输入有效的备用DNS服务器地址"));
} else {
callback();
}
},
}, },
created() { created() {
this.Loading = true; this.Loading = true;

View File

@ -47,8 +47,9 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</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({
@ -106,7 +118,7 @@ export default {
this.$message.error("保存失败"); this.$message.error("保存失败");
} }
}, },
// //
async GetUserAnswer() { async GetUserAnswer() {
let res = await GetUserAnswer({ let res = await GetUserAnswer({
mark: "CKFWQ_wx", mark: "CKFWQ_wx",
@ -120,6 +132,16 @@ export default {
this.ruleForm.wkms = obj.wkms; this.ruleForm.wkms = obj.wkms;
} }
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
}; };
</script> </script>

View File

@ -1,6 +1,5 @@
<template> <template>
<div> <div>
<!-- <el-button @click="dialogVisible = true">对象管理</el-button> -->
<el-dialog title="对象管理" :visible.sync="dialogVisible" width="50%"> <el-dialog title="对象管理" :visible.sync="dialogVisible" width="50%">
<div class="title"> <div class="title">
<el-button style="margin-bottom: 10px" @click="addObj" <el-button style="margin-bottom: 10px" @click="addObj"
@ -90,7 +89,7 @@
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="SaveUserAnswer">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible1 = false"> </el-button> <el-button @click="dialogVisible1 = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -122,7 +121,12 @@ export default {
dxmc: [ dxmc: [
{ required: true, trigger: "blur", message: "选择一个对象名称" }, { required: true, trigger: "blur", message: "选择一个对象名称" },
], ],
ip: [{ required: true, message: "ip地址是必填项" }], ip: [
{
required: true,
validator: this.validateIpAddress,
},
],
}, },
json: {}, json: {},
}; };
@ -136,9 +140,33 @@ export default {
getParameter(data) { getParameter(data) {
this.user_id = data; this.user_id = data;
}, },
//ip
validateIpAddress(rule, value, callback) {
if (this.ip1 + "." + this.ip2 + "." + this.ip3 + "." + this.ip4 === "") {
callback(new Error("请输入IP地址"));
} else if (
!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(
this.ip1 + "." + this.ip2 + "." + this.ip3 + "." + this.ip4
)
) {
callback(new Error("请输入有效的IP地址"));
} else {
callback();
}
},
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.SaveUserAnswer();
} else {
console.log("error submit!!");
return false;
}
});
},
async SaveUserAnswer() { async SaveUserAnswer() {
// //
console.log(this.dxgl); // console.log(this.dxgl);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx")); var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
this.dxgl.push({ this.dxgl.push({
dx_name: this.ruleForm.dxmc, dx_name: this.ruleForm.dxmc,
@ -150,13 +178,12 @@ export default {
user_id: `${this.user_id}`, user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }), mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
}); });
console.log(data.data); console.log(data.state);
if (data.state) { if (data.state) {
this.$message({ this.$message({
message: "保存成功", message: "保存成功",
type: "success", type: "success",
}); });
this.dialogVisible1 = false; this.dialogVisible1 = false;
} else { } else {
this.$message.error("保存失败"); this.$message.error("保存失败");
@ -178,11 +205,11 @@ export default {
async deleteRow(index, rows) { async deleteRow(index, rows) {
this.dxgl.splice(index, 1); this.dxgl.splice(index, 1);
var json = JSON.parse(sessionStorage.getItem("GYWZ_yx")); var json = JSON.parse(sessionStorage.getItem("GYWZ_yx"));
let { data } = await SaveUserAnswer({ let { data } = await {
mark: `${this.$store.state.type}`, mark: `${this.$store.state.type}`,
user_id: `${this.user_id}`, user_id: `${this.user_id}`,
mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }), mark_value: JSON.stringify({ ...json, ...{ dxgl: this.dxgl } }),
}); };
console.log(data.data); console.log(data.data);
if (data.state) { if (data.state) {
this.$message({ this.$message({

View File

@ -106,7 +106,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="submitForm('ruleForm'), (dialogVisible = false)">保存</el-button> --> <!-- <el-button type="primary" @click="submitForm('ruleForm'), (dialogVisible = false)">保存</el-button> -->
<el-button type="primary" @click="savePort"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -179,14 +179,12 @@ export default {
dkpz_dbcd: [ dkpz_dbcd: [
{ required: true, message: "请输入打包长度", trigger: "blur" }, { required: true, message: "请输入打包长度", trigger: "blur" },
// 1000 // 1000
{ validator: this.validatePackagingLength, trigger: "blur" }, // { type: "number", message: "", trigger: "blur" },
{ type: "number", message: "打包长度必须为数字值", trigger: "blur" },
], ],
dkpz_tbbtl: [ dkpz_tbbtl: [
{ required: true, message: "请输入打包时间", trigger: "blur" }, { required: true, message: "请输入打包时间", trigger: "blur" },
{ type: "number", message: "打包时间必须为数字值", trigger: "blur" }, // { type: "number", message: "", trigger: "blur" },
// 1000 // 1000
{ validator: this.validatTime, trigger: "blur" },
], ],
dkpz_tbbtl: [ dkpz_tbbtl: [
{ required: true, message: "请选择同步波特率", trigger: "change" }, { required: true, message: "请选择同步波特率", trigger: "change" },
@ -235,9 +233,9 @@ export default {
localStorage.setItem("CKFWQ_yx", JSON.stringify(datas)); localStorage.setItem("CKFWQ_yx", JSON.stringify(datas));
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
// alert("submit!"); this.savePort();
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
return false; return false;

View File

@ -57,7 +57,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -136,6 +136,16 @@ export default {
console.log(this.ruleForm, "取"); console.log(this.ruleForm, "取");
} }
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
}; };
</script> </script>

View File

@ -132,7 +132,7 @@
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDatas">保存</el-button> <el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -236,6 +236,16 @@ export default {
getParameter(data) { getParameter(data) {
alert(data); alert(data);
}, },
submitForm(formName) {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
this.saveDatas();
} else {
console.log("error submit!!");
return false;
}
});
},
}, },
created() { created() {
this.GetUserAnswer(); this.GetUserAnswer();

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,