<template>
  <div>
    <BaseDialog
      width="580px"
      :isShow.sync="isShow"
      title="操作记录"
      @close="close"
      :confirmStatus="false"
    >
      <el-timeline style="max-height: 600px; overflow: auto">
        <el-timeline-item
          v-for="(item, index) in checkLogVos"
          :timestamp="$methodsTools.onlyForma(item.createTime)"
          placement="top"
        >
          <el-card>
            <h4>动作：{{ getlogAction(item.logAction) }}</h4>
            <p>操作人：{{ item.operName }}</p>
            <p>操作前：{{ item.oldContent }}</p>
            <p>操作后：{{ item.newContent }}</p>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </BaseDialog>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    userId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      checkLogVos: [],
    };
  },
  mounted() {},

  methods: {
    getlogAction(i) {
      var a = "";
      switch (i) {
        case 1:
          a = "新增";
          break;
        case 2:
          a = "修改";
          break;
        case 3:
          a = "删除";
          break;
        case 4:
          a = "开通";
          break;
        case 5:
          a = "恢复";
          break;
        case 6:
          a = "注销";
          break;
        case 7:
          a = "退款";
          break;
        case 8:
          a = "充值";
          break;

        default:
          break;
      }
      return a;
    },
    close() {},
    init() {
      this.$api
        .systemloglist({ logType: 2, majorId: this.userId })
        .then((res) => {
          this.checkLogVos = res.rows;
        });
    },
  },
  computed: {
    isShow: {
      get() {
        if (this.dialogVisible) {
          this.init();
        }
        return this.dialogVisible;
      },
      set(val) {
        this.$emit("update:dialogVisible", false);
      },
    },
  },
};
</script>

<style lang="scss" scoped></style>
