zhangzengfei
2022-01-28 870f8569cf90e24cb8a80ec247f458ff87401f42
修复系统日志模糊查询功能
4个文件已修改
306 ■■■■ 已修改文件
src/pages/syslog/views/eventPushLog.vue 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/syslog/views/operationLog.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/syslog/views/pollingLog.vue 206 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/syslog/views/systemLog.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/syslog/views/eventPushLog.vue
@@ -28,7 +28,7 @@
            <span class="icon iconfont icon_clear" @click="clearSearch" slot="append" v-if="fuzzySearch">
              &#xe785;
            </span>
            <span class="icon iconfont icon_search" @click="getPushLog(1)" slot="append" v-else>
            <span class="icon iconfont icon_search" @click="getPushLog(1)" slot="append">
              &#xe714;
            </span>
@@ -124,8 +124,8 @@
</template>
<script>
import { pad0 } from "@/api/utils";
import { queryDataPushLog } from "@/api/log";
import { pad0 } from "@/api/utils"
import { queryDataPushLog } from "@/api/log"
export default {
  data() {
@@ -165,25 +165,25 @@
      timeEnd: "",
      fuzzySearch: "",
      total: 0
    };
    }
  },
  mounted() {
    this.getTimeRange(24 * 60 * 60 * 1000);
    this.getPushLog();
    this.getTimeRange(24 * 60 * 60 * 1000)
    this.getPushLog()
  },
  methods: {
    styleFunc({ row, column, rowIndex, columnIndex }) {
      if (columnIndex == 6) {
        return { cursor: "pointer" };
        return { cursor: "pointer" }
      }
      return {};
      return {}
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.pageSize = val
      // this.getPushLog();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.page = val
      // this.getPushLog();
    },
    levelChange(val) {
@@ -196,34 +196,34 @@
      // });
    },
    clickFaults(row, column, cell, event) {
      this.showSubTable = true;
      this.showSubTable = true
    },
    choseRange(item, i) {
      switch (item) {
        case "今日":
          this.getTimeRange(24 * 60 * 60 * 1000);
          break;
          this.getTimeRange(24 * 60 * 60 * 1000)
          break
        case "近三天":
          this.getTimeRange(24 * 60 * 60 * 1000 * 3);
          break;
          this.getTimeRange(24 * 60 * 60 * 1000 * 3)
          break
        case "近七天":
          this.getTimeRange(24 * 60 * 60 * 1000 * 7);
          break;
          this.getTimeRange(24 * 60 * 60 * 1000 * 7)
          break
        case "近一个月":
          this.getTimeRange(24 * 60 * 60 * 1000 * 30);
          break;
          this.getTimeRange(24 * 60 * 60 * 1000 * 30)
          break
        case "近六个月":
          this.getTimeRange(24 * 60 * 60 * 1000 * 30 * 6);
          break;
          this.getTimeRange(24 * 60 * 60 * 1000 * 30 * 6)
          break
        default:
          break;
          break
      }
      // this.getPushLog(1);
      this.activeDateChoise = i;
      this.activeDateChoise = i
    },
    getPushLog(typ) {
      if (typ == 1) {
        this.page = 1;
        this.page = 1
      }
      queryDataPushLog({
        timeStart: this.timeStart,
@@ -235,30 +235,30 @@
        result: this.result,
        fuzzySearch: this.fuzzySearch
      }).then((res) => {
        this.tableData = res.data.logs;
        this.total = res.data.total;
      });
        this.tableData = res.data.logs
        this.total = res.data.total
      })
    },
    getTimeStr(date) {
      var month = pad0(date.getMonth() + 1); //月
      var day = pad0(date.getDate()); //日
      var hour = pad0(date.getHours()); //时
      var minute = pad0(date.getMinutes()); //分
      var second = pad0(date.getSeconds()); //秒
      return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`;
      var month = pad0(date.getMonth() + 1) //月
      var day = pad0(date.getDate()) //日
      var hour = pad0(date.getHours()) //时
      var minute = pad0(date.getMinutes()) //分
      var second = pad0(date.getSeconds()) //秒
      return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`
    },
    getTimeRange(gap) {
      var date = new Date(); //当前时间
      var preDay = new Date(new Date().getTime() - gap);
      this.timeStart = this.getTimeStr(preDay);
      this.timeEnd = this.getTimeStr(date);
      var date = new Date() //当前时间
      var preDay = new Date(new Date().getTime() - gap)
      this.timeStart = this.getTimeStr(preDay)
      this.timeEnd = this.getTimeStr(date)
    },
    clearSearch() {
      this.fuzzySearch = "";
      this.getPushLog(1);
      this.fuzzySearch = ""
      this.getPushLog(1)
    }
  }
};
}
</script>
<style lang="scss">
.push-log {
src/pages/syslog/views/operationLog.vue
@@ -28,7 +28,7 @@
            <span class="icon iconfont icon_clear" @click="clearSearch" slot="append" v-if="fuzzySearch">
              &#xe785;
            </span>
            <span class="icon iconfont icon_search" @click="getOperationLog(1)" slot="append" v-else>
            <span class="icon iconfont icon_search" @click="getOperationLog(1)" slot="append">
              &#xe714;
            </span>
@@ -44,10 +44,9 @@
        <div class="bar">
          <div class="name">操作模块:</div>
          <el-select v-model="curModule" placeholder="请选择" size="small" @change="moduleChange">
          <el-select v-model="curModule" placeholder="请选择" size="small" @change="moduleChange" value-key="proc_name">
            <el-option label="全部" :value="''"> </el-option>
            <el-option v-for="(item, i) in moduleOptions" :key="i" :label="item.proc_name" :value="item.proc_name">
            </el-option>
            <el-option v-for="(item, i) in moduleOptions" :key="i" :label="item.name_zh" :value="item"> </el-option>
          </el-select>
        </div>
        <div class="bar">
@@ -123,7 +122,7 @@
  name: "operationLog",
  data() {
    return {
      png: "",
      png: require("../../../../public/images/syslog/没数据.png"),
      loading: false,
      loadingText: "",
      input3: "",
@@ -176,7 +175,7 @@
      this.getOperationLog(1)
      this.gongneng = ""
      getOperations({
        module: this.curModule
        module: val.proc_name
      }).then((res) => {
        this.gongnengOptions = res.data
      })
@@ -229,14 +228,13 @@
        timeEnd: this.timeEnd,
        page: this.page,
        pageSize: this.pageSize,
        module: this.curModule,
        module: this.curModule.name_zh,
        function: this.gongneng,
        result: this.result,
        fuzzySearch: this.fuzzySearch
      }).then((res) => {
        this.tableData = res.data.logs
        this.total = res.data.total
        this.png = require("../../../../public/images/syslog/没数据.png")
      })
    },
    getTimeStr(date) {
src/pages/syslog/views/pollingLog.vue
@@ -1,9 +1,5 @@
<template>
  <div
    class="polling-log"
    v-loading="loading"
    :element-loading-text="loadingText"
  >
  <div class="polling-log" v-loading="loading" :element-loading-text="loadingText">
    <div class="top">
      <div class="first">
        <div class="time-option">
@@ -19,22 +15,12 @@
            v-model="fuzzySearch"
            size="small"
            class="input-with-select"
            @keyup.enter.native="getOperationLog(1)"
            @keyup.enter.native="getScheduleLog(1)"
          >
            <span
              class="icon iconfont icon_clear"
              @click="clearSearch"
              slot="append"
              v-if="fuzzySearch"
            >
            <span class="icon iconfont icon_clear" @click="clearSearch" slot="append" v-if="fuzzySearch">
              &#xe785;
            </span>
            <span
              class="icon iconfont icon_search"
              @click="getOperationLog(1)"
              slot="append"
              v-else
            >
            <span class="icon iconfont icon_search" @click="getScheduleLog(1)" slot="append">
              &#xe714;
            </span>
@@ -77,8 +63,7 @@
        <template slot="empty">
          <img :src="png" class="empty_img" alt="" />
        </template>
        <el-table-column :align="'center'" label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column :align="'center'" label="序号" type="index" width="50"> </el-table-column>
        <el-table-column
          :align="'center'"
          sortable
@@ -93,17 +78,8 @@
          prop="schedule_end_time"
          label="轮询结束时间"
        ></el-table-column>
        <el-table-column
          :align="'center'"
          sortable
          prop="procName"
          label="摄像机"
        ></el-table-column>
        <el-table-column
          :align="'center'"
          prop="minute"
          label="轮询时长(分)"
        ></el-table-column>
        <el-table-column :align="'center'" sortable prop="info" label="摄像机"></el-table-column>
        <el-table-column :align="'center'" prop="minute" label="轮询时长(分)"></el-table-column>
      </el-table>
    </div>
@@ -118,12 +94,7 @@
    >
    </el-pagination>
    <el-dialog
      title="选择摄像机"
      :visible.sync="dialogVisible"
      width="50%"
      :before-close="handleClose"
    >
    <el-dialog title="选择摄像机" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
      <el-tree
        ref="cameraTree"
        :data="cameraTree"
@@ -138,23 +109,21 @@
        <el-button size="small" @click="pickAllNot">取消全选</el-button>
        <el-button @click="pickAllCam" size="small">全选</el-button>
        <el-button size="small" @click="cancelShow">取消</el-button>
        <el-button size="small" type="primary" @click="confirmCamera"
          >确定</el-button
        >
        <el-button size="small" type="primary" @click="confirmCamera">确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { pad0 } from "@/api/utils";
import { getLocalCameraTree } from "@/api/area";
import { getOperations, getModules, queryScheduleLog } from "@/api/log";
import { pad0 } from "@/api/utils"
import { getLocalCameraTree } from "@/api/area"
import { getOperations, getModules, queryScheduleLog } from "@/api/log"
export default {
  data() {
    return {
      png: "",
      png: require("../../../../public/images/syslog/没数据.png"),
      loading: false,
      loadingText: "",
      tableData: [],
@@ -163,7 +132,7 @@
      dateRange: [],
      cameraTree: [],
      props: {
        label: "name",
        label: "name"
      },
      value: "",
      page: 1,
@@ -184,131 +153,134 @@
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit("pick", [start, end])
            }
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit("pick", [start, end])
            }
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
    };
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit("pick", [start, end])
            }
          }
        ]
      }
    }
  },
  mounted() {
    this.getTimeRange(24 * 60 * 60 * 1000 * 30);
    this.getScheduleLog();
    this.getOptions();
    this.getTimeRange(24 * 60 * 60 * 1000 * 30)
    this.getScheduleLog()
    this.getOptions()
  },
  methods: {
    handleSizeChange(val) {
      this.pageSize = val;
      this.getOperationLog();
      this.pageSize = val
      this.getScheduleLog()
    },
    handleCurrentChange(val) {
      this.page = val;
      this.getOperationLog();
      this.page = val
      this.getScheduleLog()
    },
    cancelShow() {
      this.dialogVisible = false;
      this.pickAllNot();
      this.dialogVisible = false
      this.pickAllNot()
    },
    pickAllCam() {
      this.$refs.cameraTree.setCheckedNodes(this.cameraTree);
      this.$refs.cameraTree.setCheckedNodes(this.cameraTree)
    },
    pickAllNot() {
      this.$refs.cameraTree.setCheckedKeys([]);
      this.$refs.cameraTree.setCheckedKeys([])
    },
    confirmCamera() {
      const selectedIDs = this.$refs.cameraTree.getCheckedKeys();
      this.pickNum = selectedIDs.length;
      this.procID = selectedIDs.join(",");
      this.getScheduleLog();
      this.dialogVisible = false;
      const selectedIDs = this.$refs.cameraTree.getCheckedKeys()
      this.pickNum = selectedIDs.length
      this.procID = selectedIDs.join(",")
      this.getScheduleLog()
      this.dialogVisible = false
    },
    openDialog() {
      this.dialogVisible = true;
      this.dialogVisible = true
      getLocalCameraTree({
        cameraName: "",
        searchType: 0,
        searchType: 0
      }).then((res) => {
        this.cameraTree = res.data;
      });
        this.cameraTree = res.data
      })
    },
    moduleChange(val) {
      this.getScheduleLog();
      this.gongneng = "";
      this.getScheduleLog()
      this.gongneng = ""
      getOperations({
        module: this.curModule,
        module: this.curModule
      }).then((res) => {
        this.gongnengOptions = res.data;
      });
        this.gongnengOptions = res.data
      })
    },
    getOptions() {
      getModules().then((res) => {
        this.moduleOptions = res.data;
      });
        this.moduleOptions = res.data
      })
    },
    getScheduleLog() {
    getScheduleLog(typ) {
      if (typ == 1) {
        this.page = 1
      }
      const data = {
        timeStart: this.timeStart,
        timeEnd: this.timeEnd,
        page: this.page,
        pageSize: this.pageSize,
        fuzzySearch: this.fuzzySearch,
        procID: this.procID,
        procName: this.procName,
      };
        procName: this.procName
      }
      queryScheduleLog(data).then((res) => {
        this.tableData = res.data.logs;
        this.total = res.data.total;
        this.png = require("../../../../public/images/syslog/没数据.png");
      });
        this.tableData = res.data.logs
        this.total = res.data.total
      })
    },
    dateChange(val) {
      [this.timeStart, this.timeEnd] = val;
      this.getScheduleLog();
      ;[this.timeStart, this.timeEnd] = val
      this.getScheduleLog()
    },
    getTimeStr(date) {
      var month = pad0(date.getMonth() + 1); //月
      var day = pad0(date.getDate()); //日
      var hour = pad0(date.getHours()); //时
      var minute = pad0(date.getMinutes()); //分
      var second = pad0(date.getSeconds()); //秒
      return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`;
      var month = pad0(date.getMonth() + 1) //月
      var day = pad0(date.getDate()) //日
      var hour = pad0(date.getHours()) //时
      var minute = pad0(date.getMinutes()) //分
      var second = pad0(date.getSeconds()) //秒
      return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`
    },
    getTimeRange(gap) {
      var date = new Date(); //当前时间
      var preDay = new Date(new Date().getTime() - gap);
      this.timeStart = this.getTimeStr(preDay);
      this.timeEnd = this.getTimeStr(date);
      this.dateRange = [this.timeStart, this.timeEnd];
      var date = new Date() //当前时间
      var preDay = new Date(new Date().getTime() - gap)
      this.timeStart = this.getTimeStr(preDay)
      this.timeEnd = this.getTimeStr(date)
      this.dateRange = [this.timeStart, this.timeEnd]
    },
    handleSelectionChange() {},
    handleClose() {},
    getOperationLog() {},
    clearSearch() {
      this.fuzzySearch = "";
      this.getOperationLog(1);
    },
  },
};
      this.fuzzySearch = ""
      this.getScheduleLog(1)
    }
  }
}
</script>
<style lang="scss">
.polling-log {
src/pages/syslog/views/systemLog.vue
@@ -28,7 +28,7 @@
            <span class="icon iconfont icon_clear" @click="clearSearch" slot="append" v-if="fuzzySearch">
              &#xe785;
            </span>
            <span class="icon iconfont icon_search" @click="getVaSystemLog(1)" slot="append" v-else>
            <span class="icon iconfont icon_search" @click="getVaSystemLog(1)" slot="append">
              &#xe714;
            </span>
          </el-input>
@@ -145,7 +145,7 @@
export default {
  data() {
    return {
      png: "",
      png: require("../../../../public/images/syslog/没数据.png"),
      loading: false,
      loadingText: "",
      tableData: [],
@@ -199,7 +199,6 @@
    getOptions() {
      queryProcName().then((res) => {
        this.procOptions = res.data
        // this.png = require("../../../../public/images/syslog/没数据.png")
      })
    },
    choseRange(item, i) {
@@ -234,6 +233,7 @@
        timeEnd: this.timeEnd,
        level: this.level,
        procName: this.procName,
        fuzzySearch: this.fuzzySearch,
        page: this.page,
        pageSize: this.pageSize
      }).then((res) => {