<template>
  <div class="core-enterprise">
    <enterprise-inspection ref="enterpriseInspection" :inspection-data="inspectionData" />
    <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      :rules="rules"
      label-position="top"
      label-width="150px"
      class="rule-form-orange"
    >
      <el-form-item
        label="实际经营地址"
        prop="address"
        class="industry"
        style="width: 100%"
      >
        <el-input v-model="ruleForm.address" placeholder="请输入实际经营地址" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  components: {
    EnterpriseInspection: () => import('../../components/EnterpriseInspection')
  },
  data() {
    return {
      inspectionData: {
        company: {
          key: 'company',
          name: '核心企业名称'
        }
      },
      ruleForm: {
        address: ''
      },
      rules: {

      }
    }
  },
  methods: {
    async validate() {
      const enterprise = await this.$refs.enterpriseInspection.validate()
      return new Promise((resolve, reject) => {
        this.$refs.ruleFormRef.validate(valid => {
          if (valid) {
            const projectCoreEnterprise = {
              enterprise: {
                ...this.ruleForm,
                ...enterprise
              }
            }
            return resolve(projectCoreEnterprise)
          } else {
            reject()
            return false
          }
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.core-enterprise {
  padding: 10px 20px;
}
</style>
