Commit 76ca00fc by 张杰

修复bug

1 parent 763ba376
...@@ -97,4 +97,71 @@ export const shutDownShortcuts = [ ...@@ -97,4 +97,71 @@ export const shutDownShortcuts = [
picker.$emit("pick", [start, end]); picker.$emit("pick", [start, end]);
}, },
}, },
]
// 里程统计详情
export const mileageDetailShortcuts = [
{
text: "全部",
onClick(picker) {
const end = "";
const start = "";
picker.$emit("pick", [start, end]);
},
},
{
text: "昨日",
onClick(picker) {
const start = moment()
.day(moment().day() - 1)
.format("YYYY-MM-DD");
const end = moment()
.day(moment().day() - 1)
.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) {
let weekOfDay = parseInt(moment().format("E"));
const end = moment()
.subtract(weekOfDay, "days")
.format("YYYY-MM-DD");
const start = moment()
.subtract(weekOfDay + 7 - 1, "days")
.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]);
},
},
{
text: "上月",
onClick(picker) {
const end = moment()
.month(moment().month() - 1)
.endOf("month")
.format("YYYY-MM-DD");
const start = moment()
.month(moment().month() - 1)
.startOf("month")
.format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
] ]
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
v-show="hasOk" v-show="hasOk"
type="primary" type="primary"
:size="btn_size" :size="btn_size"
:loading="loading"
@click="handleConfirm" @click="handleConfirm"
>{{btnOkLabel}}</el-button> >{{btnOkLabel}}</el-button>
<slot name="btn-behind"></slot> <slot name="btn-behind"></slot>
...@@ -54,6 +55,10 @@ export default { ...@@ -54,6 +55,10 @@ export default {
hasOk: { hasOk: {
type: Boolean, type: Boolean,
default: true default: true
},
loading:{
type:Boolean,
default:false
} }
}, },
methods: { methods: {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</el-date-picker> </el-date-picker>
</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="getList(1)">搜索</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>
...@@ -114,12 +114,12 @@ export default { ...@@ -114,12 +114,12 @@ export default {
dloading: false, dloading: false,
tloading: false, tloading: false,
FENCE_MONITOR_LIST, FENCE_MONITOR_LIST,
fenceId:'' fenceId: "",
}; };
}, },
created() { created() {
console.log(history.state) console.log(history.state);
this.fenceId = history.state.fenceId this.fenceId = history.state.fenceId;
this.getList(); this.getList();
}, },
mounted() {}, mounted() {},
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
this.searchForm = {}; this.searchForm = {};
this.currentPage = 1; this.currentPage = 1;
this.pageSize = 10; this.pageSize = 10;
this.fenceId = '' this.fenceId = "";
this.getList(); this.getList();
}, },
...@@ -142,8 +142,8 @@ export default { ...@@ -142,8 +142,8 @@ export default {
oParams.alarmEndTime = m[1]; oParams.alarmEndTime = m[1];
} }
if(this.fenceId){ if (this.fenceId) {
oParams.fenceId = this.fenceId oParams.fenceId = this.fenceId;
} }
delete oParams.orgName; delete oParams.orgName;
...@@ -157,6 +157,9 @@ export default { ...@@ -157,6 +157,9 @@ export default {
oParams.pageSize = this.pageSize; oParams.pageSize = this.pageSize;
oParams.pageNumber = current || this.currentPage; oParams.pageNumber = current || this.currentPage;
this.tloading = true; this.tloading = true;
if (current) {
this.currentPage = current;
}
GET_FENCEALARM_LIST(oParams).then((res) => { GET_FENCEALARM_LIST(oParams).then((res) => {
this.tloading = false; this.tloading = false;
let obj = res.data || {}; let obj = res.data || {};
...@@ -205,17 +208,16 @@ export default { ...@@ -205,17 +208,16 @@ export default {
? moment(row.alarmTime).format("x") - 120000 ? moment(row.alarmTime).format("x") - 120000
: ""; : "";
let sTime = moment(startTime).format("yyyy-MM-DD HH:mm:ss"); let sTime = moment(startTime).format("yyyy-MM-DD HH:mm:ss");
let endTime = row.endTime||""; let endTime = row.endTime || "";
let eTime = moment(endTime).format("yyyy-MM-DD HH:mm:ss"); let eTime = moment(endTime).format("yyyy-MM-DD HH:mm:ss");
if (!row.endTime) { if (!row.endTime) {
eTime = moment(startTime + 3600000).format("yyyy-MM-DD HH:mm:ss"); eTime = moment(startTime + 3600000).format("yyyy-MM-DD HH:mm:ss");
} }
console.log(sTime +'---'+eTime); console.log(sTime + "---" + eTime);
let path = `/oEshield#/monitor/replay?sn=${row.sn}&name=${row.ownerName}&standno=${row.vin}&startTime=${sTime}&endTime=${eTime}&fenceId=${row.fenceId}&isInitFence=1`; let path = `/oEshield#/monitor/replay?sn=${row.sn}&name=${row.ownerName}&standno=${row.vin}&startTime=${sTime}&endTime=${eTime}&fenceId=${row.fenceId}&isInitFence=1`;
//this.$root.parentCommon.setBreadCrumbs(path); //this.$root.parentCommon.setBreadCrumbs(path);
window.open(path); window.open(path);
}, },
}, },
}; };
</script> </script>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="search_box"> <div class="search_box">
<el-form :model="searchForm" :inline="true" size="small"> <el-form :model="searchForm" :inline="true" size="small">
<el-form-item label="关键字:"> <el-form-item label="关键字:">
<el-input placeholder="设备号|车架号|姓名|工单号" class="a_input" v-model="searchForm.keywords"> <el-input placeholder="设备号|车架号|姓名|工单号" class="a_input" v-model.trim="searchForm.keywords">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="车辆归属:"> <el-form-item label="车辆归属:">
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getList()">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="searchEvent()">搜索</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="default" icon="el-icon-refresh" @click="rest()">重置</el-button> <el-button type="default" icon="el-icon-refresh" @click="rest()">重置</el-button>
...@@ -64,11 +64,11 @@ import { ...@@ -64,11 +64,11 @@ import {
GET_JOURNEYS_EXPORTDETAIL, GET_JOURNEYS_EXPORTDETAIL,
} from "services/report"; } from "services/report";
import { deepClone, showToast } from "@/utils/util"; import { deepClone, showToast } from "@/utils/util";
import moment from "moment"; import {mileageDetailShortcuts} from '@/common/index'
export default { export default {
data() { data() {
return { return {
searchForm: {sn:this.$route.query.sn}, searchForm: { sn: this.$route.query.sn },
snList: [], snList: [],
dateTime: [], dateTime: [],
tableData: [], tableData: [],
...@@ -95,71 +95,10 @@ export default { ...@@ -95,71 +95,10 @@ export default {
], ],
pageTotal: 0, pageTotal: 0,
pickerOptions: { pickerOptions: {
shortcuts: [ shortcuts: mileageDetailShortcuts,
{
text: "全部",
onClick(picker) {
const end = "";
const start = "";
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: "本周",
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) {
let weekOfDay = parseInt(moment().format("E"));
const end = moment()
.subtract(weekOfDay, "days")
.format("YYYY-MM-DD");
const start = moment()
.subtract(weekOfDay + 7 - 1, "days")
.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]);
},
},
{
text: "上月",
onClick(picker) {
const end = moment()
.month(moment().month() - 1)
.endOf("month")
.format("YYYY-MM-DD");
const start = moment()
.month(moment().month() - 1)
.startOf("month")
.format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
],
}, },
dloading: false, dloading: false,
aloding:false aloding: false,
}; };
}, },
components: { components: {
...@@ -169,7 +108,7 @@ export default { ...@@ -169,7 +108,7 @@ export default {
//this.getSn(); //this.getSn();
}, },
mounted() { mounted() {
this.getList() this.getList();
//this.getTableList(); //this.getTableList();
}, },
methods: { methods: {
...@@ -189,7 +128,7 @@ export default { ...@@ -189,7 +128,7 @@ export default {
// 获取列表 // 获取列表
getList(options) { getList(options) {
let oParams = this.getParams(); let oParams = this.getParams();
oParams.pageSize = this.$refs.glsxTable.pageSize; oParams.pageSize = this.$refs.glsxTable.pageSizeNum;
oParams.pageNumber = options ? options.pageNumber || 1 : 1; oParams.pageNumber = options ? options.pageNumber || 1 : 1;
this.aloding = true; this.aloding = true;
GET_JOURNEYS_SEARCHDETAIL(oParams).then((res) => { GET_JOURNEYS_SEARCHDETAIL(oParams).then((res) => {
...@@ -231,21 +170,27 @@ export default { ...@@ -231,21 +170,27 @@ export default {
let _this = this; let _this = this;
let oParams = this.getParams(); let oParams = this.getParams();
_this.dloading = true; _this.dloading = true;
GET_JOURNEYS_EXPORTDETAIL(oParams).then(res => { GET_JOURNEYS_EXPORTDETAIL(oParams).then((res) => {
_this.dloading = false; _this.dloading = false;
if (res.code != 200) { if (res.code != 200) {
return false; return false;
} }
window.open(res.data); window.open(res.data);
}) });
}, },
// 重置 // 重置
rest() { rest() {
//this.searchForm = {}; //this.searchForm = {};
this.dateTime = []; this.dateTime = [];
this.getList();
this.$refs.glsxTable.rest(); this.$refs.glsxTable.rest();
this.getList();
},
// 搜索事件
searchEvent() {
this.$refs.glsxTable.rest("currentPage", 1);
this.getList();
}, },
}, },
}; };
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
<!-- 列表数据 end --> <!-- 列表数据 end -->
<!-- 新增、编辑、查看弹框 开始 --> <!-- 新增、编辑、查看弹框 开始 -->
<basic-dialog width="800px" :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')"> <basic-dialog width="800px" :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" :loading="ajaxLoading" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')">
<slot> <slot>
<div class="dialog_content" v-loading="formLoading"> <div class="dialog_content" v-loading="formLoading">
<el-form class="el_form" ref="snForm" :model="snForm" :rules="vehicleRules" :inline="false" :disabled="isReadonly" size="mini" label-width="100px"> <el-form class="el_form" ref="snForm" :model="snForm" :rules="vehicleRules" :inline="false" :disabled="isReadonly" size="mini" label-width="100px">
...@@ -343,7 +343,7 @@ import { VEHICLE_API } from "@/config/config"; ...@@ -343,7 +343,7 @@ import { VEHICLE_API } from "@/config/config";
import store from "@/store"; import store from "@/store";
import freqModal from "./freqModal"; import freqModal from "./freqModal";
import { Validator } from "@/utils/validator"; import { Validator } from "@/utils/validator";
import { deepClone } from "@/utils/util"; import { deepClone, showToast } from "@/utils/util";
import { VEHICLE_ONLINE_STATUS } from "@/common/constants"; import { VEHICLE_ONLINE_STATUS } from "@/common/constants";
import { import {
getVehicleList, getVehicleList,
...@@ -809,6 +809,7 @@ export default { ...@@ -809,6 +809,7 @@ export default {
}, },
], ],
VEHICLE_ONLINE_STATUS, VEHICLE_ONLINE_STATUS,
ajaxLoading: false,
}; };
}, },
...@@ -1083,6 +1084,7 @@ export default { ...@@ -1083,6 +1084,7 @@ export default {
// 新增车辆、编辑车辆 // 新增车辆、编辑车辆
handleConfirm(type) { handleConfirm(type) {
let _this = this;
switch (type) { switch (type) {
case "create": case "create":
//console.log(this.vehicleForm, this.vehicleData); //console.log(this.vehicleForm, this.vehicleData);
...@@ -1094,28 +1096,33 @@ export default { ...@@ -1094,28 +1096,33 @@ export default {
if (params.id) { if (params.id) {
api = updateNewVehicle; api = updateNewVehicle;
} }
api(params).then((res) => { _this.ajaxLoading = true;
const { code, message } = res; api(params)
if (code != 200) { .then((res) => {
this.$message({ _this.ajaxLoading = false;
const { code, message } = res;
if (code != 200) {
showToast({
message: message,
});
return false;
}
showToast({
message: "操作成功", message: "操作成功",
type: "danger", type: "success",
}); });
return false; this.vehicleVisible = !this.vehicleVisible;
} this.snForm = {};
this.$message({ this.dialogType = "";
message: "操作成功", this.$refs.snForm.clearValidate();
type: "success", //this.$refs.serchButton.$el.click();
this.getList();
//this.$refs.vehicleForm.refreshTable();
//this.$refs.snForm.refreshTable();
})
.catch(() => {
_this.ajaxLoading = false;
}); });
this.vehicleVisible = !this.vehicleVisible;
this.snForm = {};
this.dialogType = "";
this.$refs.snForm.clearValidate();
//this.$refs.serchButton.$el.click();
this.getList();
//this.$refs.vehicleForm.refreshTable();
//this.$refs.snForm.refreshTable();
});
}); });
break; break;
case "import": case "import":
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!