Commit 02ea3ef9 by 张杰

限制离线时间选择

1 parent fcab77aa
......@@ -43,7 +43,7 @@
<el-input v-model="searchForm.keywords" placeholder="设备|车架号|姓名|工单号"></el-input>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="getList()">搜索</el-button>
<el-button icon="el-icon-search" type="primary" @click="searchEvent()">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" type="default" @click="rest()">重置</el-button>
......@@ -140,9 +140,9 @@ export default {
// 动态设置禁用日期
let disabledDate = function (e) {
let n = moment(e).format("x");
let max = moment().subtract(1,'day').format("x");
let max = moment().subtract(1, "day").format("x");
if (query.endTime) {
max = moment(query.endTime).subtract(1,'day').format("x");
max = moment(query.endTime).subtract(1, "day").format("x");
}
if (n < max) {
return false;
......@@ -161,7 +161,11 @@ export default {
let start = moment()
.day(moment().day() - 3)
.format("YYYY-MM-DD HH:mm:ss");
this.searchForm = { deviceTypeAndSource: "", offlineStartTime: start, offlineEndTime:end };
this.searchForm = {
deviceTypeAndSource: "",
offlineStartTime: start,
offlineEndTime: end,
};
this.getList();
},
......@@ -186,6 +190,21 @@ export default {
return oParams;
},
// 搜索
searchEvent() {
let oParams = this.getParams();
let max = oParams.offlineEndTime;
let min = oParams.offlineStartTime;
let m = moment(max).diff(moment(min), "days");
if (m < 1) {
showToast({
message: "离线查询时间小于24小时,请更改条件后重试!",
});
return false;
}
this.getList();
},
// 获取数据列表
getList(current) {
let oParams = this.getParams();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!