zhangzengfei
2022-03-23 6c84a71cc8f3397e7f3c4f49208c38774a82531f
src/pages/syslog/views/eventPushLog.vue
@@ -44,10 +44,8 @@
        <div class="bar">
          <div class="name">状态:</div>
          <el-select v-model="level" placeholder="请选择" size="small" @change="levelChange">
            <el-option label="全部" :value="''"> </el-option>
            <el-option v-for="(item, i) in levelOptions" :key="i" :label="item.proc_name" :value="item.proc_name">
            </el-option>
          <el-select v-model="state" placeholder="请选择" size="small" @change="stateChange">
            <el-option v-for="(item, i) in stateOptions" :key="i" :label="item.label" :value="item.value"> </el-option>
          </el-select>
        </div>
      </div>
@@ -138,20 +136,19 @@
      tableData: [],
      subTableData: [],
      dateArr: ["今日", "近三天", "近七天", "近一个月", "近六个月"],
      levelOptions: [],
      hostNameOptions: [],
      resultOptions: [
      stateOptions: [
        {
          value: "",
          label: "全部"
        },
        {
          value: "成功",
          label: "成功"
          value: "完成",
          label: "完成"
        },
        {
          value: "失败",
          label: "失败"
          value: "进行中",
          label: "进行中"
        }
      ],
      value: "",
@@ -160,7 +157,7 @@
      activeDateChoise: 0,
      hostName: "",
      result: "",
      level: "",
      state: "",
      timeStart: "",
      timeEnd: "",
      fuzzySearch: "",
@@ -186,17 +183,8 @@
      this.page = val
      // this.getPushLog();
    },
    levelChange(val) {
      // this.getPushLog(1);
      // this.hostName = "";
      // getOperations({
      //   module: this.level,
      // }).then((res) => {
      //   this.hostNameOptions = res.data;
      // });
    },
    clickFaults(row, column, cell, event) {
      this.showSubTable = true
    stateChange(val) {
      this.getPushLog(1)
    },
    choseRange(item, i) {
      switch (item) {
@@ -218,7 +206,7 @@
        default:
          break
      }
      // this.getPushLog(1);
      this.getPushLog(1)
      this.activeDateChoise = i
    },
    getPushLog(typ) {
@@ -230,7 +218,7 @@
        timeEnd: this.timeEnd,
        page: this.page,
        pageSize: this.pageSize,
        state: this.level,
        state: this.state,
        function: this.hostName,
        result: this.result,
        fuzzySearch: this.fuzzySearch
@@ -242,16 +230,15 @@
    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 date = new Date() //当前时间
      var preDay = new Date(new Date().getTime() - gap)
      this.timeStart = this.getTimeStr(preDay)
      this.timeEnd = this.getTimeStr(date)
      // 计算出来的时间会多一天, 为了不修改上边的代码, 计算时增加一天
      // 修正时间从起始日期的, 0点开始到24点结束
      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 = ""