diff --git a/src/views/dataReport/index.vue b/src/views/dataReport/index.vue index becbf883..efd33cb0 100644 --- a/src/views/dataReport/index.vue +++ b/src/views/dataReport/index.vue @@ -263,20 +263,20 @@ export default { }, }, created() { - // const thirtyDaysAgo = new Date(); - // this.$set( - // this.formdata, - // "starttime", - // new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30)) - // ); - // console.log(this.formdata.starttime); - // const currentDate = new Date(); // 获取当前时间 - // currentDate.setHours(23); // 设置小时为23 - // currentDate.setMinutes(59); // 设置分钟为59 - // currentDate.setSeconds(59); // 设置秒数为59 - // this.$set(this.formdata, "endtime", currentDate); - // console.log("我是开始时间", this.formdata.starttime); - // console.log("我是结束时间", currentDate); + const thirtyDaysAgo = new Date(); + this.$set( + this.formdata, + "starttime", + new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30)) + ); + console.log(this.formdata.starttime); + const currentDate = new Date(); // 获取当前时间 + currentDate.setHours(23); // 设置小时为23 + currentDate.setMinutes(59); // 设置分钟为59 + currentDate.setSeconds(59); // 设置秒数为59 + this.$set(this.formdata, "endtime", currentDate); + console.log("我是开始时间", this.formdata.starttime); + console.log("我是结束时间", currentDate); this.treeData = []; this.getSubNodes(); }, @@ -387,7 +387,11 @@ export default { this.formdata.endtime = endDate; console.log(this.formdata.endtime); } else { + val.setHours(23); // 设置小时为23 + val.setMinutes(59); // 设置分钟为59 + val.setSeconds(59); // 设置秒数为59 this.formdata.endtime = val; + console.log(val); } }, getAllTimeTable() { diff --git a/src/views/equipment/modevtype/components/attributeList.vue b/src/views/equipment/modevtype/components/attributeList.vue index 4cb2c8ab..886454d0 100644 --- a/src/views/equipment/modevtype/components/attributeList.vue +++ b/src/views/equipment/modevtype/components/attributeList.vue @@ -124,7 +124,11 @@ export default { comment: "", //typeVal: 2, }, - rules: {}, + rules: { + comment: [ + { required: true, message: "请输入属性描述", trigger: "blur" }, + ], + }, }; }, created() {}, @@ -183,31 +187,38 @@ export default { }, //新增接口 submitAddForm() { - console.log(this.formInfo); - modevtypepointAddApi({ - modevtypeId: this.rowData.id, - field: this.formInfo.name, - fieldDesc: this.formInfo.comment, - //type: this.formInfo.typeVal, - }) - .then((res) => { - console.log(res); + this.$refs.formInfo.validate((valid) => { + if (valid) { + console.log(this.formInfo); + modevtypepointAddApi({ + modevtypeId: this.rowData.id, + field: this.formInfo.name, + fieldDesc: this.formInfo.comment, + //type: this.formInfo.typeVal, + }) + .then((res) => { + console.log(res); - if (res.success) { - this.innerVisible = false; - this.getListAll(); - } else { - this.$message({ - duration: 1500, - showClose: true, - type: "error", - message: res.errorMsg, + if (res.success) { + this.innerVisible = false; + this.getListAll(); + } else { + this.$message({ + duration: 1500, + showClose: true, + type: "error", + message: res.errorMsg, + }); + } + }) + .catch((err) => { + console.log(err); //代码错误、请求失败捕获 }); - } - }) - .catch((err) => { - console.log(err); //代码错误、请求失败捕获 - }); + } else { + console.log("error submit!!"); + return false; + } + }); }, //删除 handleDeleteClick(val) {