Commit c25f06ae by 张晓玮

Merge branch '1.7.1' into 'v1.8.0'

1.7.1

See merge request !27
2 parents 6799457a f3d50005
...@@ -148,11 +148,10 @@ let nextDay = { ...@@ -148,11 +148,10 @@ let nextDay = {
let latelyOneDay = { let latelyOneDay = {
text: "近1天不在线", text: "近1天不在线",
onClick(picker) { onClick(picker) {
const end = moment().format("YYYY-MM-DD HH:mm:ss");
const start = moment() const start = moment()
.day(moment().day() - 1) .day(moment().day() - 1)
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", [start, end]); picker.$emit("pick", start);
}, },
} }
...@@ -160,11 +159,10 @@ let latelyOneDay = { ...@@ -160,11 +159,10 @@ let latelyOneDay = {
let latelyThreeDay = { let latelyThreeDay = {
text: "近3天不在线", text: "近3天不在线",
onClick(picker) { onClick(picker) {
const end = moment().format("YYYY-MM-DD HH:mm:ss");
const start = moment() const start = moment()
.day(moment().day() - 3) .day(moment().day() - 3)
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", [start, end]); picker.$emit("pick", start);
}, },
} }
...@@ -172,11 +170,10 @@ let latelyThreeDay = { ...@@ -172,11 +170,10 @@ let latelyThreeDay = {
let latelySevenDay = { let latelySevenDay = {
text: "近7天不在线", text: "近7天不在线",
onClick(picker) { onClick(picker) {
const end = moment().format("YYYY-MM-DD HH:mm:ss");
const start = moment() const start = moment()
.day(moment().day() - 7) .day(moment().day() - 7)
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", [start, end]); picker.$emit("pick", start);
}, },
} }
...@@ -265,3 +262,12 @@ export const offlineActiveShortcuts = [ ...@@ -265,3 +262,12 @@ export const offlineActiveShortcuts = [
nearly7Days, nearly7Days,
currentMonth currentMonth
] ]
//通用防拆报警-报警时间
export const tamperAlarmShortcuts = [
currentDay,
yesterday,
nearly7Days,
currentWeek,
currentMonth
]
\ No newline at end of file \ No newline at end of file
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
.datatime_picker{ .datatime_picker{
width: 360px; width: 360px;
} }
.sort_picker{
width:190px;
}
.mr5{ .mr5{
margin-right:5px; margin-right:5px;
} }
......
...@@ -3,6 +3,7 @@ import Vue from 'vue' ...@@ -3,6 +3,7 @@ import Vue from 'vue'
import { Message, MessageBox, Loading } from 'element-ui' import { Message, MessageBox, Loading } from 'element-ui'
import moment from 'moment' import moment from 'moment'
let loadingInstance = '' let loadingInstance = ''
const EventBus = new Vue()
export const Util = { export const Util = {
/** /**
* 简单alert * 简单alert
...@@ -244,17 +245,30 @@ export const Util = { ...@@ -244,17 +245,30 @@ export const Util = {
} }
// 通过url下载文件 // 通过url下载文件
export const downFileByPath = function(url){ export const downFileByPath = function (url) {
if (!url) { if (!url) {
return false; return false;
}; };
// let link = document.createElement('a') // let link = document.createElement('a')
// link.style.display = 'none' // link.style.display = 'none'
// link.src = url // link.src = url
// link.target = '_blank' // link.target = '_blank'
// document.body.appendChild(link); // document.body.appendChild(link);
// link.click(); // link.click();
window.location.href = url window.location.href = url
}
// 传递消息
export const broadcast = function (msg, data) {
EventBus.$emit(msg, data)
}
// 接收消息
export const received = function (msg, callBack) {
EventBus.$off(msg)
EventBus.$on(msg, function (row) {
callBack(row)
})
} }
export const showModal = Util.msg export const showModal = Util.msg
......
...@@ -10,7 +10,12 @@ ...@@ -10,7 +10,12 @@
<div class="search_box"> <div class="search_box">
<el-form :inline="true" size="small"> <el-form :inline="true" size="small">
<el-form-item label="离线时间:"> <el-form-item label="离线时间:">
<el-date-picker v-model="searchForm.offDate" type="datetimerange" class="datatime_picker" unlink-panels range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="offPickerOptions" @change="onChangeDate"> <!-- <el-date-picker v-model="searchForm.offDate" type="datetimerange" class="datatime_picker" unlink-panels range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="offPickerOptions" @change="onChangeDate">
</el-date-picker> -->
<el-date-picker v-model="searchForm.offlineStartTime" class="sort_picker" type="datetime" unlink-panels placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="offPickerOptions">
</el-date-picker>
<span> ~ </span>
<el-date-picker v-model="searchForm.offlineEndTime" class="sort_picker" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" disabled>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="激活区间:"> <el-form-item label="激活区间:">
...@@ -38,7 +43,7 @@ ...@@ -38,7 +43,7 @@
<el-input v-model="searchForm.keywords" placeholder="设备|车架号|姓名|工单号"></el-input> <el-input v-model="searchForm.keywords" placeholder="设备|车架号|姓名|工单号"></el-input>
</el-form-item> </el-form-item>
<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-form-item> <el-form-item>
<el-button icon="el-icon-refresh" type="default" @click="rest()">重置</el-button> <el-button icon="el-icon-refresh" type="default" @click="rest()">重置</el-button>
...@@ -86,7 +91,7 @@ ...@@ -86,7 +91,7 @@
import moment from "moment"; import moment from "moment";
import GlsxOrganization from "@/components/glsx-organization"; import GlsxOrganization from "@/components/glsx-organization";
import { GETOFFLINESEARCH, ALARM_OFFLINE_EXPORT } from "@/services/alarmCenter"; import { GETOFFLINESEARCH, ALARM_OFFLINE_EXPORT } from "@/services/alarmCenter";
import { deepClone, showToast } from "@/utils/util"; import { deepClone, showToast, broadcast, received } from "@/utils/util";
import { offlineShortcuts, offlineActiveShortcuts } from "@/common"; import { offlineShortcuts, offlineActiveShortcuts } from "@/common";
import qs from "qs"; import qs from "qs";
export default { export default {
...@@ -106,7 +111,38 @@ export default { ...@@ -106,7 +111,38 @@ export default {
showResult: false, showResult: false,
loading: false, loading: false,
offPickerOptions: { offPickerOptions: {
shortcuts: offlineShortcuts, shortcuts: [
{
text: "近1天不在线",
onClick(picker) {
const start = moment()
.day(moment().day() - 1)
.format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", start);
broadcast("change_off_time");
},
},
{
text: "近3天不在线",
onClick(picker) {
const start = moment()
.day(moment().day() - 3)
.format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", start);
broadcast("change_off_time");
},
},
{
text: "近7天不在线",
onClick(picker) {
const start = moment()
.day(moment().day() - 7)
.format("YYYY-MM-DD HH:mm:ss");
picker.$emit("pick", start);
broadcast("change_off_time");
},
},
],
}, },
pickerOptions: { pickerOptions: {
shortcuts: offlineActiveShortcuts, shortcuts: offlineActiveShortcuts,
...@@ -118,6 +154,8 @@ export default { ...@@ -118,6 +154,8 @@ export default {
}; };
}, },
created() { created() {
received("change_off_time", this.onChangeDate);
let query = this.$route.query; let query = this.$route.query;
let end = moment().format("YYYY-MM-DD HH:mm:ss"); let end = moment().format("YYYY-MM-DD HH:mm:ss");
let start = moment() let start = moment()
...@@ -125,17 +163,19 @@ export default { ...@@ -125,17 +163,19 @@ export default {
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
if (query.startTime) { if (query.startTime) {
this.$set(this.searchForm, "offDate", [query.startTime, query.endTime]); this.$set(this.searchForm, "offlineStartTime", query.startTime);
this.$set(this.searchForm, "offlineEndTime", query.endTime);
} else { } else {
this.$set(this.searchForm, "offDate", [start, end]); this.$set(this.searchForm, "offlineStartTime", start);
this.$set(this.searchForm, "offlineEndTime", end);
} }
// 动态设置禁用日期 // 动态设置禁用日期
let disabledDate = function (e) { let disabledDate = function (e) {
let n = moment(e).format("x"); let n = moment(e).format("x");
let max = moment().format("x"); let max = moment().subtract(1, "day").format("x");
if (query.endTime) { if (query.endTime) {
max = moment(query.endTime).format("x"); max = moment(query.endTime).subtract(1, "day").format("x");
} }
if (n < max) { if (n < max) {
return false; return false;
...@@ -154,7 +194,11 @@ export default { ...@@ -154,7 +194,11 @@ export default {
let start = moment() let start = moment()
.day(moment().day() - 3) .day(moment().day() - 3)
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
this.searchForm = { deviceTypeAndSource: "", offDate: [start, end] }; this.searchForm = {
deviceTypeAndSource: "",
offlineStartTime: start,
offlineEndTime: end,
};
this.getList(); this.getList();
}, },
...@@ -168,10 +212,10 @@ export default { ...@@ -168,10 +212,10 @@ export default {
oParams.activeEndTime = m[1]; oParams.activeEndTime = m[1];
} }
if (n && n.length > 0) { // if (n && n.length > 0) {
oParams.offlineStartTime = n[0]; // oParams.offlineStartTime = n[0];
oParams.offlineEndTime = n[1]; // oParams.offlineEndTime = n[1];
} // }
delete oParams.offDate; delete oParams.offDate;
delete oParams.orgName; delete oParams.orgName;
...@@ -179,6 +223,21 @@ export default { ...@@ -179,6 +223,21 @@ export default {
return oParams; 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) { getList(current) {
let oParams = this.getParams(); let oParams = this.getParams();
...@@ -241,17 +300,25 @@ export default { ...@@ -241,17 +300,25 @@ export default {
oParams.bsTime = row.lastBsTime; oParams.bsTime = row.lastBsTime;
//let a = window.location.origin; //let a = window.location.origin;
let path = `/oEshield#/monitor/activeLocation?${qs.stringify(oParams)}`; let path = `/oEshield#/monitor/activeLocation?${qs.stringify(oParams)}`;
this.$root.parentCommon.setBreadCrumbs(path); //this.$root.parentCommon.setBreadCrumbs(path);
window.open(path); window.open(path);
//history.pushState(oParams, "报警位置点", path); //history.pushState(oParams, "报警位置点", path);
}, },
onChangeDate(e) { onChangeDate() {
console.log(e); let max = moment().format("YYYY-MM-DD HH:mm:ss");
this.$set(this.searchForm, "offlineEndTime", max);
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/styles/hadoop.scss"; @import "@/styles/hadoop.scss";
</style>
\ No newline at end of file \ No newline at end of file
</style>
<style lang="scss">
.el-picker-panel {
.el-button--text.el-picker-panel__link-btn {
display: none;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -92,6 +92,8 @@ import { ...@@ -92,6 +92,8 @@ import {
ALARM_COMMONTEARDOWN_EXPORT, ALARM_COMMONTEARDOWN_EXPORT,
} from "@/services/alarmCenter"; } from "@/services/alarmCenter";
import { deepClone, showToast } from "@/utils/util"; import { deepClone, showToast } from "@/utils/util";
import {tamperAlarmShortcuts} from '@/common'
import qs from 'qs'
export default { export default {
components: { components: {
GlsxOrganization, GlsxOrganization,
...@@ -110,51 +112,7 @@ export default { ...@@ -110,51 +112,7 @@ export default {
showResult: false, showResult: false,
loading: false, loading: false,
pickerOptions: { pickerOptions: {
shortcuts: [ shortcuts: tamperAlarmShortcuts,
{
text: "今日",
onClick(picker) {
const end = new Date();
const start = new Date();
picker.$emit("pick", [start, end]);
},
},
{
text: "昨日",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 1);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近7天",
onClick(picker) {
const end = moment().format("YYYY-MM-DD");
const start = moment()
.day(moment().day() - 7)
.format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "本周",
onClick(picker) {
const end = moment().format("YYYY-MM-DD");
const start = moment().weekday(1).format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "本月",
onClick(picker) {
const start = moment().add("month", 0).format("YYYY-MM") + "-01";
const end = moment().format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
],
onPick: ({ maxDate, minDate }) => { onPick: ({ maxDate, minDate }) => {
this.pickerMinDate = minDate.getTime(); this.pickerMinDate = minDate.getTime();
if (maxDate) { if (maxDate) {
...@@ -271,8 +229,10 @@ export default { ...@@ -271,8 +229,10 @@ export default {
oParams.standNo = row.vin; oParams.standNo = row.vin;
oParams.time = row.alarmEffectTime; oParams.time = row.alarmEffectTime;
let path = `/oEshield#/monitor/activeLocation`; //let path = `/oEshield#/monitor/activeLocation`;
history.pushState(oParams, "报警位置点", path); let path = `/oEshield#/monitor/activeLocation?${qs.stringify(oParams)}`;
window.open(path);
//history.pushState(oParams, "报警位置点", path);
}, },
// //
......
...@@ -386,7 +386,12 @@ import { getOrgTree } from "services/common"; ...@@ -386,7 +386,12 @@ import { getOrgTree } from "services/common";
import AuthButton from "@/components/auth-button"; import AuthButton from "@/components/auth-button";
import moment from "moment"; import moment from "moment";
import GlsxOrganization from "@/components/glsx-organization"; import GlsxOrganization from "@/components/glsx-organization";
import { VEHICLE_USE_LIST, VEHICLE_TAG_LIST,SETTLEFLAGLIST,SETTLE_FLAG_LIST } from "@/common/constants"; import {
VEHICLE_USE_LIST,
VEHICLE_TAG_LIST,
SETTLEFLAGLIST,
SETTLE_FLAG_LIST,
} from "@/common/constants";
export default { export default {
components: { components: {
freqModal, freqModal,
...@@ -439,7 +444,7 @@ export default { ...@@ -439,7 +444,7 @@ export default {
return { return {
VEHICLE_USE_LIST, VEHICLE_USE_LIST,
VEHICLE_TAG_LIST, VEHICLE_TAG_LIST,
searchForm: {settleFlag:''}, searchForm: { settleFlag: "" },
getListApi: getVehicleList, getListApi: getVehicleList,
authList: [ authList: [
...@@ -826,8 +831,8 @@ export default { ...@@ -826,8 +831,8 @@ export default {
], ],
VEHICLE_ONLINE_STATUS, VEHICLE_ONLINE_STATUS,
ajaxLoading: false, ajaxLoading: false,
settleFlagList:SETTLEFLAGLIST, settleFlagList: SETTLEFLAGLIST,
SETTLE_FLAG_LIST SETTLE_FLAG_LIST,
}; };
}, },
...@@ -880,7 +885,7 @@ export default { ...@@ -880,7 +885,7 @@ export default {
refresh() { refresh() {
this.pageSize = 10; this.pageSize = 10;
this.pageNumber = 1; this.pageNumber = 1;
this.searchForm = {settleFlag:''}; this.searchForm = { settleFlag: "" };
this.getList(); this.getList();
}, },
...@@ -922,7 +927,7 @@ export default { ...@@ -922,7 +927,7 @@ export default {
//this.snForm.deviceArr = [{ sn: "", deviceType: "" }]; //this.snForm.deviceArr = [{ sn: "", deviceType: "" }];
//this.snForm.deviceInfoDtos = [{}]; //this.snForm.deviceInfoDtos = [{}];
this.snForm = {settleFlag:0}; this.snForm = { settleFlag: 0 };
this.$set(this.snForm, "deviceInfoDtos", [ this.$set(this.snForm, "deviceInfoDtos", [
{ sn: "", deviceClassifyName: "" }, { sn: "", deviceClassifyName: "" },
]); ]);
...@@ -1017,27 +1022,37 @@ export default { ...@@ -1017,27 +1022,37 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}).then(() => { beforeClose: (action, instance, done) => {
deleteNewVehicle({ if (action === "cancel") {
vdId: scope.vdId, done();
//sn: scope.sn return;
}).then((res) => {
const { code, message } = res;
if (code == 200) {
this.$message({
type: "success",
message: "删除成功!",
});
//this.$refs.vehicleForm.refreshTable();
this.getList();
} else {
this.$message({
message,
type: "error",
});
} }
}); instance.confirmButtonLoading = true;
}); instance.confirmButtonText = "提交中...";
deleteNewVehicle({
vdId: scope.vdId,
//sn: scope.sn
}).then((res) => {
const { code, message } = res;
instance.confirmButtonLoading = false;
if (code == 200) {
done();
this.$message({
type: "success",
message: "删除成功!",
});
this.getList();
} else {
this.$message({
message,
type: "error",
});
}
});
},
})
.then(() => {})
.catch(() => {});
break; break;
case "unbind": case "unbind":
this.$confirm("是否要解绑, 是否继续?", "提示", { this.$confirm("是否要解绑, 是否继续?", "提示", {
...@@ -1074,8 +1089,8 @@ export default { ...@@ -1074,8 +1089,8 @@ export default {
break; break;
case "export": case "export":
let oParams = this.getParams(); let oParams = this.getParams();
delete oParams.pageSize delete oParams.pageSize;
delete oParams.pageNumber delete oParams.pageNumber;
this.$Common.exportExcel({ this.$Common.exportExcel({
url: `${store.state.baseURL}/trialdrive/vehicle/vehicleinfo/export`, url: `${store.state.baseURL}/trialdrive/vehicle/vehicleinfo/export`,
method: "GET", method: "GET",
...@@ -1716,17 +1731,15 @@ export default { ...@@ -1716,17 +1731,15 @@ export default {
}, },
// 是否有权限 // 是否有权限
hasPermission(id){ hasPermission(id) {
return this.$hasPermission(id) return this.$hasPermission(id);
}, },
// 搜索 // 搜索
searchEvent(){ searchEvent() {
this.pageNumber = 1; this.pageNumber = 1;
this.getList() this.getList();
} },
}, },
}; };
</script> </script>
...@@ -1860,13 +1873,13 @@ export default { ...@@ -1860,13 +1873,13 @@ export default {
border-color: #c6e2ff; border-color: #c6e2ff;
background: #ecf5ff; background: #ecf5ff;
} }
.el_switch_box{ .el_switch_box {
display:flex; display: flex;
align-items: center; align-items: center;
.tips{ .tips {
font-size:12px; font-size: 12px;
color:#333; color: #333;
margin-left:10px; margin-left: 10px;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!