<template>
  <div class="more-data">
    <div class="ls-row">
      <div class="row-header title">
        <span class="icon iconfont icon-iconfontgengduo"></span>
        <span>更多</span>
      </div>
    </div>

    <div class="contain">
      <div @click="handleJump('log')"
           class="data-item"
           style="border:none;padding:0px">
        <div>
          <span class="iconfont icon-shenpi"></span>
        </div>
        <span>操作日志</span>
      </div>
      <div @click="handleJump('file')"
           class="data-item"
           style="border:none;padding:0px">
        <div class="bg57B9">
          <span class="iconfont icon-fujian"></span>
        </div>
        <span>相关附件</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'more-data',
  props: { modelId: Number, busId: String, uid: String, isDelete: Boolean, fileId: String, fileName: String },
  data () {
    return {
      param: {
        fileId: '', // 附件ID
        fileName: '', // 附件名称
        modelId: '', // 模块ID
        busId: '', // 业务ID
        uid: '', // 用户ID
        isDelete: false // 是否可以删除,boolean
      }
    }
  },
  created () {
    for (let key in this.param) {
      if (this[key]) {
        this.param[key] = this[key]
      }
    }
  },
  methods: {
    // 手动初始化参数
    initParam (param) {
      for (let key in this.param) {
        if (param[key]) {
          this.param[key] = param[key]
        }
      }
    },
    handleJump (flag) {
      if (flag === 'log') {
        if (this.param['busId'] === '') {
          console.log('业务ID不能为空！')
          return false
        }
        this.$router.push({ name: 'operationlLog', params: { busId: this.param.busId } })
      } else if (flag === 'file') {
        if (this.param['modelId'] === null || this.param['modelId'] === '' || this.param['busId'] === '') {
          console.log('查询附件的模块ID和业务ID不能为空！')
          return false
        }
        this.$router.push({ name: 'attachment', query: this.param })
      }
    }
  }
}
</script>

<style type="text/css" scoped lang="scss">
.more-data {
  background-color: #fff;
  margin-bottom: 40px;

  .contain {
    display: flex;

    .data-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      font-size: 26px;

      div:first-child {
        width: 108px;
        height: 108px;
        background: #4f94f3;
        border-radius: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 20px;

        .iconfont {
          font-size: 50px;
          color: #fff;
        }
      }
      div.bg57B9 {
        background-color: #57b986;
      }
    }
  }
}
</style>
