<!--
 * @Descripttion: 重复手机号，查看详情
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2020-11-16 14:56:07
 * @LastEditors: 无尘
 * @LastEditTime: 2020-11-19 11:10:14
-->

<!--
<account-detail :edit-obj="editObj"></account-detail>
import accountDetail from '@/components/account/account-detail.vue';
-->
<template>
  <el-dialog title="试用账号详情" :visible.sync="dialogVisible" width="680px" :before-close="handleClose" append-to-body>
    <div class="">
      <el-table class="select-table" ref="" v-loading="loading" :data="tableData" tooltip-effect="dark" :style="{ width: '100%'}">
        <el-table-column label="试用人" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.trialAccountName || '--' }}</template>
        </el-table-column>
        <el-table-column label="企业" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.wxEnterpriseName || '--' }}</template>
        </el-table-column>
        <el-table-column label="用户手机号" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.selfPhoneNumber || '--' }}</template>
        </el-table-column>
        <el-table-column label="试用账号" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.trialAccount || '--' }}</template>
        </el-table-column>
        <el-table-column prop="" label="试用开始时间" show-overflow-tooltip>
          <template slot-scope="scope">
            <div>{{ scope.row.createTime | timeStampToYmd }} {{ !scope.row.createTime ? '--': '' }}</div>
            <div>{{ scope.row.createTime | timeStampToHms }} {{ !scope.row.createTime ? '--': '' }}</div>
          </template>
        </el-table-column>
        <el-table-column label="有效期" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.effectDate | timeStampToYmd }} {{ !scope.row.effectDate ? '不限' : ''}}</template>
        </el-table-column>
      </el-table>
    </div>
  </el-dialog>
</template>

<script>

export default {
  name: 'SqlDetail',
  components: {},
  props: {
    editObj: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  data() {
    return {
      dialogVisible: true,
      loading: false,
      tableData: []
    };
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    const that = this;
    if (Object.keys(that.editObj).length) {
      that.tableData = [ JSON.parse(JSON.stringify(that.editObj)) ];
    }
  },
  // methods
  methods: {
    /**
     * @description: 关闭弹窗
     * @author: 无尘
     */
    handleClose() {
      const that = this;
      that.$emit('closeDetail');
    },
    cancelEdit() {
      const that = this;
      that.$emit('closeDetail');
    }
  },
  watch: {
    editObj(newData) {
      const that = this;
      if (Object.keys(newData).length) {
        that.tableData = [ JSON.parse(JSON.stringify(newData)) ];
      }
    }
  }
};
</script>
<style lang='less' scoped>
  .w-363 {
    width: 363px;
  }
  .selected {
    div {
      color: #2f54eb;
    }
  }
</style>
