userlog.vue 4.86 KB
Newer Older
xulili's avatar
xulili committed
1
<template>
xulili's avatar
xulili committed
2
  <!-- 用户操作日志 -->
xulili's avatar
xulili committed
3
  <div class="platform-log-wrapper height100">
xulili's avatar
xulili committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    <div class="search-container">
      <el-form :inline="true" :model="form">
        <el-form-item>
          <el-input
            v-model="form.nameOrCode"
            placeholder="请输入操作者"
            suffix-icon="el-icon-search"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-date-picker
            v-model="form.date"
            type="daterange"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            clearable
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-select
            clearable
            v-model="form.operationType"
            placeholder="请选择操作类型"
          >
            <el-option
              v-for="(item, index) in operationTypeList"
              :key="index"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <div class="btn-group">
            <el-button type="primary" @click="handleSubmit">查询</el-button>
            <el-button @click="handleReset">重置</el-button>
          </div>
        </el-form-item>
      </el-form>
      <div class="page-tip">
        <span class="page-tip-title">页面说明:</span>
        <span class="page-tips"
          >可查看所有账号在系统上的操作信息,可根据操作类型、操作时间段查询等方式对日志信息进行筛选</span
        >
xulili's avatar
xulili committed
53
      </div>
xulili's avatar
xulili committed
54 55 56 57 58 59 60 61 62 63 64
    </div>
    <div class="table-content hasTabs">
      <party-table
        class="noAdd"
        :currentPage="page._index"
        :feildList="feildList"
        :list="list"
      >
      </party-table>
      <party-pagination :page="page" @changePage="handleChangeCurrent" />
    </div>
xulili's avatar
xulili committed
65 66 67
  </div>
</template>
<script>
xulili's avatar
xulili committed
68 69
import { partyPagination, partyTable } from "@/components/index";
import { getLogType } from "@/config/logOperationType.js";
xulili's avatar
xulili committed
70
export default {
xulili's avatar
xulili committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
  data() {
    return {
      form: {
        nameOrCode: "",
        date: "",
        operationType: "",
        startDate: "",
        endDate: "",
      },
      logType: 2, //1.平台操作日志 2.用户操作日志
      operationTypeList: [],
      feildList: [
        { prop: "operationTime", label: "操作时间" },
        { prop: "operator", label: "操作者" },
        { prop: "operationType", label: "操作类型" },
        { prop: "operationObject", label: "操作对象" },
        { prop: "operationIp", label: "操作Ip" },
      ],
      list: [],
      page: {
        _index: 1,
        _size: 10,
        total: 0,
      },
    };
  },
  components: { partyTable, partyPagination },
  mounted() {
    // 获取日志操作类型
    this.getOperationType();
    // 获取机顶盒运维类表
    this.getFirstPageList();
  },
  methods: {
    getFirstPageList() {
      this.page._index = 1;
      this.getPageList();
xulili's avatar
xulili committed
108
    },
xulili's avatar
xulili committed
109 110 111 112
    getOperationType() {
      getLogType().then((res) => {
        this.operationTypeList = res;
      });
xulili's avatar
xulili committed
113
    },
xulili's avatar
xulili committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    handleSubmit() {
      this.getPageList();
    },
    handleReset() {
      for (let key in this.form) {
        this.form[key] = "";
      }
      this.getFirstPageList();
    },
    getPageList() {
      let requestParams = {};
      requestParams._index = this.page._index;
      requestParams._size = this.page._size;
      requestParams.type = this.logType;
      if (this.form.nameOrCode) {
        requestParams.nameOrCode = this.form.nameOrCode;
      }
      if (this.form.operationType) {
        requestParams.operationType = this.form.operationType;
      }
      if (this.form.date) {
        requestParams.startDate = this.form.date[0];
        requestParams.endDate = this.form.date[1];
      }
      this.$https(
        {
          method: "get",
          url: "sysLog/querySysLogList",
          authType: this.backToken,
xulili's avatar
xulili committed
143
        },
xulili's avatar
xulili committed
144 145 146 147 148 149 150 151 152 153 154 155
        requestParams
      )
        .then((res) => {
          if (res.status != 200) {
            this.getResWithOutData();
          } else {
            if (res.data.resultCode == 200) {
              this.list = res.data.data.records;
              this.page._size = res.data.data.size;
              this.page.total = res.data.data.total;
            } else {
              this.getResWithOutData();
xulili's avatar
xulili committed
156
            }
xulili's avatar
xulili committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 页面返回值为空
    getResWithOutData() {
      this.list = [];
      this.page = {
        _index: 1,
        _size: 10,
        total: 0,
      };
    },
    // 翻页
    handleChangeCurrent(val) {
      this.page._index = val;
     this.getPageList();
xulili's avatar
xulili committed
176
    },
xulili's avatar
xulili committed
177 178 179
  },
  watch: {},
};
xulili's avatar
xulili committed
180 181 182
</script>
<style lang="less" scoped>
</style>