<template>
  <app-dialog v-model="visible" :loading="loading" :title="title" append-to-body class="detail-dialog" width="700px" @cancel="onCancel" @confirm="onCancel">
    <el-form ref="form" :model="form" disabled label-width="150px">
      <el-row :gutter="15">
        <app-filter-item :span="24" label="数据资源项名称:" prop="name">
          <!--          <el-input v-model="form.name" />-->
          <span>{{ form.name }}</span>
        </app-filter-item>

        <app-filter-item :span="24" label="数据资源项编码:" prop="code">
          <span>{{ form.code }}</span>
        </app-filter-item>
        <app-filter-item :span="24" label="数据库实体表表名:" prop="entityTableName">
          <span>{{ form.entityTableName }}</span>
        </app-filter-item>
        <app-filter-item :span="24" label="数据表名:" prop="tableName">
          <span>{{ form.tableName }}</span>
        </app-filter-item>
        <app-filter-item :span="24" label="数据推送状态:" prop="status">
          <el-radio-group v-model="form.status">
            <el-radio-button v-for="(radio, index) in tableNameList" :key="index.value" :label="radio.value">
              {{ radio.label }}
            </el-radio-button>
          </el-radio-group>
        </app-filter-item>
        <app-filter-item :span="24" label="表当前数据总量:" prop="totalNum">
          <span>{{ form.totalNum }}</span>
        </app-filter-item>
      </el-row>
    </el-form>
  </app-dialog>
</template>

<script>
import dialogMixin from '@/mixins/dialog.js';

export default {
  companyName: 'CompanyDialog',
  mixins: [dialogMixin],
  props: {
    selectedRows: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      form: {
        sourceType: '1',
      },
      tableNameList: [
        { label: '成功', value: 1 },
        { label: '失败', value: 0 },
      ],
      loading: false,
    };
  },
  mounted() {},
  methods: {
    /**
     * @description: dialog每次显示时触发的init方法
     * @param {*} data 传入data
     * @return {*}
     */
    initData(data) {
      const orgForm = this.$options.data().form;
      this.form = { ...orgForm, ...data };
      this.$nextTick(() => {
        this.$refs.form.clearValidate();
      });
    },
    onCancel() {
      this.visible = false;
    },
  },
};
</script>

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