<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-10-21 14:27:29
 * @LastEditors: 无尘
 * @LastEditTime: 2020-06-01 17:52:41
 -->

<!--
<review-result-detail
  :detailShow="detailShow"
  @hideDetailDialog="hideDetailDialog">
</review-result-detail>

import reviewResultDetail from '@/components/review/review-result-detail.vue'
 -->
<template>
  <div v-show="customDialog">
    <el-dialog class="edit-dialog" title="审核详情" :visible.sync="customDialog" width="600px" :before-close="handleClose">
      <div class="edit-dialog-body">
        <el-table :data="tableData" style="width: 100%" height="332">
          <el-table-column prop="publishRecordId" label="审核事项" show-overflow-tooltip>
            <template slot-scope="scope">
              <span v-if="scope.row.auditType == 1">门店信息变更</span>
              <span v-if="scope.row.auditType == 2">导购绑定</span>
              <span v-if="scope.row.auditType == 3">导购新增</span>
              <span v-if="scope.row.auditType == 4">导购删除</span>
              <span v-if="scope.row.auditType == 5">导购解绑</span>
            </template>
          </el-table-column>
          <el-table-column label="品牌" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.enterpriseName || '--' }}
            </template>
          </el-table-column>
          <el-table-column label="提交人" width="150" show-overflow-tooltip>
            <template slot-scope="scope">
              <!-- <div class="flex">
                <div class="flex flex-align-center flex-pack-center bg-82C5FF table-head-pic">
                  <i v-if="!scope.row.headPic" class="iconfont icon-yewuduanmorentouxian"></i>
                  <img v-else :src="scope.row.headPic" alt="img" />
                </div>
                <div class="flex flex-column apply-info">
                  <span class="text-ellipsis">{{ scope.row.applyName }}</span>
                  <span class="font-13 text-ellipsis">{{ scope.row.storeName }}</span>
                </div>
              </div> -->
              {{ scope.row.commitName || '--' }}
            </template>
          </el-table-column>
          <el-table-column label="提交时间" show-overflow-tooltip>
            <template slot-scope="scope">
              <div class="color-606266 line-18">{{ scope.row.commitTime | timeStampToYmd }}</div>
              <div class="color-606266 line-18">{{ scope.row.commitTime | timeStampToHms }}</div>
            </template>
          </el-table-column>
          <el-table-column label="审核结果" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.auditResult == 1 ? '成功' : '失败' }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-dialog>
  </div>
</template>
<script>
// import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
// import { _debounce } from '@/common/js/public';
import { getRequest } from '@/api/api';
export default {
  name: 'record-list',
  props: {
    detailShow: {
      type: Boolean,
      default: false
    },
    batchId: {
      type: String,
      default() {
        return '';
      }
    },
    tableListData: {
      type: Object,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      customDialog: false, // 弹框显示
      tableData: [
        /* {
          interfaceVersionId: '1',
          version: '测试',
          remark: '描述内容',
          createTime: 1564455643252
        } */
      ]
    };
  },
  methods: {
    /**
     *   关闭
     */
    handleClose(done) {
      const that = this;
      done();
      that.hideDialog();
    },

    /**
     *  取消
     */
    customCancel() {
      const that = this;
      that.hideDialog();
    },

    hideDialog() {
      const that = this;
      that.customDialog = false;
      that.$emit('hideDetailDialog');
    },
    getTableData() {
      const that = this;
      let para = {
        batchId: that.batchId
      };
      getRequest('/haoban-manage3-web/audit/audit-detail-list', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            that.tableData = resData.result || [];
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  watch: {
    detailShow: function(newData, oldData) {
      const that = this;
      that.customDialog = newData;
    },
    batchId: function(newData, oldData) {
      const that = this;
      if (!!newData) {
        that.getTableData();
      }
    }
  },

  /* 接收数据 */
  mounted() {
    const that = this;
    that.customDialog = that.detailShow;
    if (!!that.batchId) {
      that.getTableData();
    }
  }
};
</script>

<style lang="less" scoped>
.bg-82C5FF {
  background: #82c5ff;
}

.table-head-pic {
  width: 35px;
  height: 35px;
  padding: 10px;
  border-radius: 4px;
  i {
    font-size: 20px;
    color: #e5f3ff;
  }
  img {
    max-width: 35px;
    max-height: 35px;
  }
}

.apply-info {
  margin-left: 15px;
  line-height: 18px;
  .text-ellipsis {
    display: block;
    width: 96px;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.edit-dialog {
  /deep/ .el-dialog__body {
    padding: 25px 20px 17px 20px;
    min-height: 352px;
  }

  /deep/ .el-dialog__footer {
    border: none;
    padding-top: 3px;
  }

  &__title {
    width: 100%;
    height: 38px;
    padding: 12px 15px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    background: rgba(235, 238, 245, 1);
  }

  .el-alert--info {
    width: 400px;
    font-size: 14px;
    color: #606266;
    background: #e6f7ff;
    border: 1px solid rgba(145, 213, 255, 1);
  }
  .el-icon-info {
    width: 12px;
    font-size: 12px;
    color: #1890ff;
  }
  .el-form {
    margin-top: 40px;
  }
}
</style>
