<template>
  <el-dialog v-if="show" :title="`报销详情【${info.statusName}】`" :visible.sync="show" width="800px">
    <el-descriptions :column="2" border>
      <el-descriptions-item v-for="(item, index) in showColumns" :key="index" :label="item.label">
        {{ info[item.prop] }}
      </el-descriptions-item>
    </el-descriptions>
    <span slot="footer">
      <el-button @click="show = false">取消</el-button>
    </span>
  </el-dialog>

</template>

<script>
export default {
  data() {
    return {
      show: false,
      showColumns: [],
      info: {}
    };
  },
  methods: {
    init(data) {
      this.show = true;
      this.info = { ...data, statusName: '待审核', type: '1' };
      const commonColumns = [
        { prop: 'applyUser', label: `申请人` },
        { prop: 'applyDate', label: `申请时间` },
        { prop: 'applyRemark', label: `申请备注` },
        { prop: 'expenseType', label: `报销款项` },
        { prop: 'expenseTotal', label: `报销金额` },
        { prop: 'auditStatus', label: `审批状态` },
        { prop: 'auditUser', label: `审批人` },
        { prop: 'auditDate', label: `审批时间` },
        { prop: 'auditRemark', label: `审批备注` }
      ];
      const otherColumns = {
        1: [{ prop: 'spotName', label: `报名点` }],
        2: [{ prop: 'stuName', label: `成交学员` }]
      };
      this.showColumns = otherColumns[this.info.type].concat(commonColumns);
    }
  }
};
</script>

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