<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'"
	  />
	  <bom
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'bom'"
	  />
	  <warehousingInspection
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'warehousingInspection'"
	  />
	  <workshopLine
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'workshopLine'"
	  />
	  <produceLine
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'produceLine'"
	  />
	  <warehousingReportloss
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'warehousingReportloss'"
	  />
	  <cwCost
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'costCode'"
	  />
	  <cwpaymentreceipt
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'cwPaymentReceipt'"
	  />
	  <cwsettlement
	    ref="form"
	    @eventReceiver="eventReceiver"
	    v-if="config.formEnCode === 'cwSettlement'"
	  />
    </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";
import bom from "@/pages/scm/form/bom/index.vue";
import warehousingInspection from "@/pages/scm/form/warehousingInspection/index.vue";
import workshopLine from "@/pages/scm/form/businessLine1/workshopLineIndex.vue";
import produceLine from "@/pages/scm/form/businessLine1/produceLineIndex.vue";
import warehousingReportloss from "@/pages/scm/form/warehousingReportloss/index.vue";
import cwCost from "@/pages/scm/form/cwCost/index.vue";
import cwpaymentreceipt from "@/pages/scm/form/cwpaymentreceipt/index.vue";
import cwsettlement from "@/pages/scm/form/cwsettlement/index.vue";

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