<template>
  <app-dialog v-model="visible" :loading="loading" :title="title" append-to-body class="detail-dialog" width="60%" :hideFooter="true">
    <el-descriptions :column="1" size="small" border>
      <el-descriptions-item label-class-name="detail-dialog-label" v-for="(col, index) in columns" :key="index" :label="col.label">
        {{ formData[col.prop] }}</el-descriptions-item
      >
    </el-descriptions>
  </app-dialog>
</template>

<script>
import dialogMixin from '@/mixins/dialog.js';
import { dictionaryEscape, getDictionaryByCode } from '@/utils/dictionary.js';
export default {
  name: 'viewDetailDialog',
  mixins: [dialogMixin],
  data() {
    return {
      loading: false,
      formData: {},
      columns: [],
    };
  },
  methods: {
    /**
     * @description: dialog每次显示时触发的init方法
     * @param {*} data 传入data
     * @return {*}
     */
    initData(data) {
      this.formData = data.formData || {};
      this.columns = data.columns || [];
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .detail-dialog-label {
  width: 20%;
}
</style>
