zhangzengfei
2023-11-29 0d3db253cad1fb49c4fae9b9a537c8c318c7172f
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
      })
@@ -200,7 +199,7 @@
    choseRange(item, i) {
      switch (item) {
        case "今日":
          this.getTimeRange()
          this.getTimeRange(24 * 60 * 60 * 1000)
          break
        case "近三天":
          this.getTimeRange(24 * 60 * 60 * 1000 * 3)
@@ -229,28 +228,25 @@
        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) {
      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}`
      return `${date.getFullYear()}-${month}-${day}`
    },
    getTimeRange(gap) {
      var preDay
      preDay = gap ? new Date(new Date().getTime() - gap) : new Date(new Date().setHours(0, 0, 0, 0))
      this.timeStart = this.getTimeStr(preDay)
      var date = new Date()
      var preDay = new Date(new Date().getTime() - gap + 24 * 60 * 60 * 1000)
      this.timeStart = this.getTimeStr(preDay) + " 00:00:00"
      this.timeEnd = this.getTimeStr(date) + " 23:59:59"
    },
    clearSearch() {
      this.fuzzySearch = ""