|
@@ -3,15 +3,15 @@
|
|
|
<div class="charge-tools">
|
|
|
<el-form :inline="true" :model="queryParams">
|
|
|
<el-form-item label="换电编号:" style="margin-left: 35px">
|
|
|
- <el-input v-model="queryParams.swapId" placeholder="请输入换电编号" clearable />
|
|
|
+ <el-input v-model.trim="queryParams.swapId" placeholder="请输入换电编号" clearable />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="车牌号:" style="margin-left: 50px">
|
|
|
- <el-input v-model="queryParams.vehiclePlate" placeholder="请输入车牌号" clearable />
|
|
|
+ <el-input v-model.trim="queryParams.vehiclePlate" placeholder="请输入车牌号" clearable />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="车辆识别码:" style="margin-left: 50px">
|
|
|
- <el-input v-model="queryParams.PlateCode" placeholder="请输入车牌号" clearable />
|
|
|
+ <el-input v-model.trim="queryParams.PlateCode" placeholder="请输入车牌号" clearable />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="时间范围:" style="margin-left: 50px">
|
|
@@ -45,9 +45,9 @@
|
|
|
<el-table-column prop="swapDuration" label="换电时长" />
|
|
|
<el-table-column label="操作" align="center" width="200">
|
|
|
<template v-if="scope.row.userAccount !== 'admin'" slot-scope="scope">
|
|
|
- <el-button type="primary" class="handle" size="small" @click="handleEdit(scope.row)">日志查询</el-button>
|
|
|
+ <el-button type="primary" class="handle" size="small" @click="handleSerch(scope.row)">日志查询</el-button>
|
|
|
<el-button type="primary" class="handle" size="small"
|
|
|
- @click="handleDelete(scope.$index, scope.row.id)">导出日志</el-button>
|
|
|
+ @click="handleExport(scope.row)">导出日志</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -61,16 +61,19 @@
|
|
|
|
|
|
<!--导出弹窗-->
|
|
|
<div class="rolemanage">
|
|
|
- <el-dialog :title="dialogType === 'find' ? '查看数据范围' : '导出数据范围'" :visible.sync="dialogexportVisible"
|
|
|
+ <el-dialog :title="dialogType === 'find' ? '查看日志' : '导出日志'" :visible.sync="dialogexportVisible"
|
|
|
:destroy-on-close="true" @close="dialogClose">
|
|
|
- <el-form ref="ruleForm" v-loading="loading">
|
|
|
+ <el-form :model="ruleForm" :rules="rules" ref="ExportForm" v-loading="loading">
|
|
|
+ <el-form-item label="任务名称:" prop="exportName" v-if="dialogType==='export'">
|
|
|
+ <el-input v-model="ruleForm.exportName" placeholder="请输入任务名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<div class="checkFirst">
|
|
|
<div>日志范围:</div>
|
|
|
<template>
|
|
|
- <el-form-item style="margin-left: 5px; margin-top: 20px">
|
|
|
- <el-select multiple v-model="robotValue" filterable clearable placeholder="请选择" @change="changeSelect"
|
|
|
+ <el-form-item style="margin-left:8px; margin-top: 20px">
|
|
|
+ <el-select multiple v-model="robotValue" filterable clearable placeholder="全部" @change="changeSelect"
|
|
|
collapse-tags @remove-tag="removeTag">
|
|
|
- <el-option label="全选" value="全选" @click.native="selectAll"></el-option>
|
|
|
+ <el-option label="全部" value="全部" @click.native="selectAll"></el-option>
|
|
|
<el-option v-for="item in logOptions" :key="item.alarmCode" :label="item.alarmName"
|
|
|
:value="item.alarmCode" />
|
|
|
</el-select>
|
|
@@ -79,8 +82,8 @@
|
|
|
</div>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button class="exit" @click="dialogUserVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" class="save" @click="AddUserinfo">确 定</el-button>
|
|
|
+ <el-button type="primary" class="save" @click="handleExportLog">{{ dialogType==='find' ? '查看': '生成' }}</el-button>
|
|
|
+ <el-button class="exit" @click="dialogexportVisible = false">取消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -91,7 +94,7 @@
|
|
|
<script>
|
|
|
import "./log.scss";
|
|
|
import { swapList } from "@/api/records";
|
|
|
-import { logModel } from "@/api/log";
|
|
|
+import { logModel,exportFile } from "@/api/log";
|
|
|
export default {
|
|
|
name: "ChangeRecord",
|
|
|
components: {},
|
|
@@ -109,12 +112,20 @@ export default {
|
|
|
page: 1, // 当前页
|
|
|
pageSize: 10, // 每页条数
|
|
|
vehiclePlate: undefined, // 车牌号
|
|
|
+ vehicleVin:undefined,//车辆识别码
|
|
|
swapId: undefined, // 换电编号
|
|
|
swapBeginTime: undefined,
|
|
|
swapEndTime: undefined,
|
|
|
orderByField: undefined, // 排序字段
|
|
|
orderByWays: 'desc'// 排序方式
|
|
|
},
|
|
|
+ //日志查询参数
|
|
|
+ serchParams:{
|
|
|
+ exchangeNo:undefined,//换电编号
|
|
|
+ startTime:undefined,//开始时间
|
|
|
+ endTime:undefined,//结束时间
|
|
|
+ signals:[],//日志范围
|
|
|
+ },
|
|
|
total: 0, // 总条数,
|
|
|
tableheight: 0, // 表格高度设置
|
|
|
dialogexportVisible: false, // 弹窗显示
|
|
@@ -124,7 +135,16 @@ export default {
|
|
|
logOptions: [],
|
|
|
logheader: [],
|
|
|
loading: false,
|
|
|
- heightTimer: false
|
|
|
+ heightTimer: false,
|
|
|
+ ruleForm:{
|
|
|
+ exportName:undefined,
|
|
|
+ },
|
|
|
+ rules:{
|
|
|
+ exportName: [
|
|
|
+ { required: true, message: '请输入任务名称', trigger: 'blur' },
|
|
|
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -165,82 +185,31 @@ export default {
|
|
|
if (this.robotValue.length < this.logOptions.length) {
|
|
|
this.robotValue = [];
|
|
|
this.logOptions.map((item) => {
|
|
|
- this.robotValue.push(item.value);
|
|
|
+ this.robotValue.push(item.alarmCode);
|
|
|
});
|
|
|
- this.robotValue.unshift("全选");
|
|
|
} else {
|
|
|
this.robotValue = [];
|
|
|
}
|
|
|
- this.$emit("SelectedData", this.robotValue);
|
|
|
},
|
|
|
changeSelect(val) {
|
|
|
- if (!val.includes("全选") && val.length === this.logOptions.length) {
|
|
|
- this.robotValue.unshift("全选");
|
|
|
- } else if (
|
|
|
- val.includes("全选") &&
|
|
|
- val.length - 1 < this.logOptions.length
|
|
|
- ) {
|
|
|
+ if (!val.includes("全部") && val.length === this.logOptions.length) {
|
|
|
+ this.robotValue.unshift("全部");
|
|
|
+ } else if (val.includes("全部") && val.length - 1 < this.logOptions.length) {
|
|
|
this.robotValue = this.robotValue.filter((item) => {
|
|
|
- return item !== "全选";
|
|
|
+ return item !== "全部";
|
|
|
});
|
|
|
}
|
|
|
- this.$emit("SelectedData", this.robotValue);
|
|
|
},
|
|
|
removeTag(val) {
|
|
|
- if (val === "全选") {
|
|
|
+ if (val === "全部") {
|
|
|
this.robotValue = [];
|
|
|
}
|
|
|
- this.$emit("SelectedData", this.robotValue);
|
|
|
- },
|
|
|
- AddUserinfo() {
|
|
|
- this.$refs.ruleForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- // 添加用户
|
|
|
- if (this.dialogType === "new") {
|
|
|
- addUserinfo(this.formData).then((res) => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.dialogUserVisible = false;
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- this.getUserlist();
|
|
|
- } else {
|
|
|
- this.loading = false;
|
|
|
- return this.$message.error(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // 修改用户
|
|
|
- else {
|
|
|
- const updateFrom = this.formData;
|
|
|
- delete updateFrom.pwd;
|
|
|
- console.log(updateFrom);
|
|
|
- updateUser(updateFrom).then((res) => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.dialogUserVisible = false;
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- this.getUserlist();
|
|
|
- } else {
|
|
|
- this.loading = false;
|
|
|
- return this.$message.error(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
},
|
|
|
// 清空表单数据
|
|
|
dialogClose() { },
|
|
|
//获取换电记录列表
|
|
|
getswapList() {
|
|
|
swapList(this.queryParams).then((res) => {
|
|
|
- console.log(res);
|
|
|
this.datalist = res.data.records;
|
|
|
this.total = res.data.total;
|
|
|
});
|
|
@@ -250,14 +219,8 @@ export default {
|
|
|
logModel().then((res) => {
|
|
|
this.logOptions = res.data;
|
|
|
this.logheader = res.data;
|
|
|
- console.log(this.logOptions);
|
|
|
});
|
|
|
},
|
|
|
- // 充电明细弹窗显示
|
|
|
- chargeShow(list) {
|
|
|
- this.dialogChargeVisible = true;
|
|
|
- this.chargeShowList = list;
|
|
|
- },
|
|
|
/** 分页下一页 */
|
|
|
handleSizeChange(val) {
|
|
|
this.queryParams.pageSize = val;
|
|
@@ -271,10 +234,10 @@ export default {
|
|
|
// 搜索
|
|
|
handleQuery() {
|
|
|
if (this.dateTime) {
|
|
|
- this.queryParams.startTime = this.$moment(this.dateTime[0]).format(
|
|
|
+ this.queryParams.swapBeginTime = this.$moment(this.dateTime[0]).format(
|
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
|
);
|
|
|
- this.queryParams.endTime = this.$moment(this.dateTime[1]).format(
|
|
|
+ this.queryParams.swapEndTime = this.$moment(this.dateTime[1]).format(
|
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
|
);
|
|
|
}
|
|
@@ -282,10 +245,70 @@ export default {
|
|
|
},
|
|
|
// 搜索重置
|
|
|
resetForm() {
|
|
|
- this.queryParams.startTime = undefined;
|
|
|
- this.queryParams.endTime = undefined;
|
|
|
+ this.queryParams.swapBeginTime = undefined;
|
|
|
+ this.queryParams.swapEndTime = undefined;
|
|
|
this.getswapList();
|
|
|
},
|
|
|
+ //日志查询
|
|
|
+ handleSerch(val){
|
|
|
+ this.dialogexportVisible=true
|
|
|
+ this.dialogType='find'
|
|
|
+ this.serchParams.exchangeNo=val.swapId
|
|
|
+ this.serchParams.startTime=val.swapBeginTime
|
|
|
+ this.serchParams.endTime=val.swapEndTime
|
|
|
+ },
|
|
|
+ //导出日志
|
|
|
+ handleExport(val){
|
|
|
+ this.dialogexportVisible=true
|
|
|
+ this.dialogType='export'
|
|
|
+ this.serchParams.startTime=val.swapBeginTime
|
|
|
+ this.serchParams.endTime=val.swapEndTime
|
|
|
+ this.serchParams.exchangeNo=val.swapId
|
|
|
+ },
|
|
|
+ //查询和生成日志文件
|
|
|
+ handleExportLog(){
|
|
|
+ if(this.dialogType ==='find'){
|
|
|
+ this.serchParams.signals=this.robotValue
|
|
|
+ this.$router.push({name:"Robot",params:this.serchParams})
|
|
|
+ }else{
|
|
|
+ this.$refs.ExportForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let addParams={
|
|
|
+ exportName:this.ruleForm.exportName,
|
|
|
+ signals:this.robotValue,
|
|
|
+ exchangeNo:this.serchParams.exchangeNo,
|
|
|
+ startTime:this.serchParams.startTime,
|
|
|
+ endTime:this.serchParams.endTime,
|
|
|
+ exportLogType:1
|
|
|
+ }
|
|
|
+ exportFile(addParams).then( res =>{
|
|
|
+ if(res.code === 0){
|
|
|
+ this.$router.push({path:"/manage-log/data-export"})
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "warning",
|
|
|
+ duration: 1000,
|
|
|
+ offset: 20,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .el-form{
|
|
|
+ .is-required{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ padding-right: 25px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|