<template>
  <view>
    <template v-if="config.formType == 1">
      <crmOrder
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'crmOrder'"
      />
      <leaveApply
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'leaveApply'"
      />
      <salesOrder
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'salesOrder'"
      />
      <kehuguanli
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'kehuguanli'"
      />
      <gysgl
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'gysgl'"
      />
      <fwsgl
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'fwsgl'"
      />
      <contract
        ref="form"
        @eventReceiver="eventReceiver"
        v-if="config.formEnCode === 'contract'"
      />
	  <productWarehouse
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'productWarehouse'"
	  />
	  <purchaseOrder
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'purchaseOrder'"
	  />
	  <saleOrder
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'saleOrder'"
	  />
	  <energyConsumption
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'energyConsumption'"
	  />
    </template>
    <template v-if="config.formType == 2">
      <dynamicForm
        ref="form"
        @eventReceiver="eventReceiver"
        @setBtnLoad="setBtnLoad"
      />
    </template>
  </view>
</template>

<script>
import dynamicForm from "@/pages/workFlow/workFlowForm/dynamicForm";
import salesOrder from "@/pages/workFlow/workFlowForm/salesOrder";
import leaveApply from "@/pages/workFlow/workFlowForm/leaveApply";
import crmOrder from "@/pages/workFlow/workFlowForm/crmOrder";
import kehuguanli from "@/pages/scm/form/subjectbasic/customerIndex.vue";
import gysgl from "@/pages/scm/form/subjectbasic/supplierIndex.vue";
import fwsgl from "@/pages/scm/form/subjectbasic/serviceIndex.vue";
import contract from "@/pages/scm/form/contractL/index.vue";
import productWarehouse from "@/pages/scm/form/productWarehouse/index.vue";
import purchaseOrder from "@/pages/scm/form/businessOrder/purchaseIndex.vue";
import saleOrder from "@/pages/scm/form/businessOrder/saleIndex.vue";
import energyConsumption from "@/pages/scm/form/energyConsumption/index.vue";

export default {
  components: {
    crmOrder,
    dynamicForm,
    leaveApply,
    salesOrder,
    kehuguanli,
    gysgl,
    contract,
	productWarehouse,
	purchaseOrder,
	saleOrder,
	energyConsumption
  },
  props: {
    config: {
      type: Object,
      default: () => {},
    },
  },
  methods: {
    eventReceiver(formData, eventType) {
      this.$emit("eventReceiver", formData, eventType);
    },
    setBtnLoad(val) {
      this.$emit("setBtnLoad", val);
    },
  },
};
</script>
