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

<!--
<review-result
  :resultShow="resultShow"
  @showResultDetail="showResultDetail"
  @hideResultDialog="hideResultDialog">
</review-result>

import reviewResult from '@/components/review/review-result.vue'
 -->
<template>
  <div v-show="customDialog">
    <el-dialog class="edit-dialog" title="提示" :visible.sync="customDialog" width="420px" :before-close="handleClose">
      <div class="edit-dialog-body">
        <div class="result-content">
          <span>{{ resultText }}</span
          ><span class="color-f5222d">{{ failCount }} 条失败。</span> <el-button type="text" @click="showDetail">查看详情</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
// import { getRequest } from '@/api/api';
// import errMsg from '@/common/js/error';
export default {
  name: 'record-list',
  props: {
    resultText: {
      type: String,
      default: ''
    },
    failCount: {
      type: [String, Boolean],
      default: '0'
    },
    resultShow: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      customDialog: this.resultShow // 弹框显示
    };
  },
  methods: {
    /**
     *   关闭
     */
    handleClose(done) {
      const that = this;
      done();
      that.hideDialog();
    },
    /**
     *  取消
     */
    customCancel() {
      const that = this;
      that.hideDialog();
    },
    hideDialog() {
      const that = this;
      that.customDialog = false;
      that.$emit('hideResultDialog');
    },
    /**
     *  显示详情
     */
    showDetail() {
      const that = this;
      that.$emit('showResultDetail');
    }
  },
  watch: {
    resultShow: function(newData, oldData) {
      const that = this;
      that.customDialog = newData;
    }
  },

  /* 接收数据 */
  mounted() {
    const that = this;
    that.customDialog = that.resultShow;
  }
};
</script>

<style lang="scss" scoped>
.bg-82C5FF {
  background: #82c5ff;
}
.color-f5222d {
  color: #f5222d;
}
.edit-dialog {
  >>> .el-dialog__body {
    padding: 25px 20px 17px 20px;
    min-height: 54px;
  }

  >>> .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>
