<template>
  <div class="debug">
    <!--  设备  -->
    <section  v-if="nodeData && nodeData.type === 'device'">
      <!-- 相机 -->
      <camera
        v-if="nodeData.properties.deviceType ==='camera'"
        :nodeData="nodeData"
         :lf="lf"
        :socketResponse="socketResponse"
        @onClose="handleClose"
        />
      <!-- PLC -->
      <plc v-if="nodeData.properties.deviceType ==='plc'"
        :nodeData="nodeData"
        :socketResponse="socketResponse"
        :lf="lf"
        @onClose="handleClose">
      </plc>
      <code-scan
          v-if="nodeData.properties.deviceType ==='gun'"
          :nodeData="nodeData"
           :lf="lf"
          :socketResponse="socketResponse"
          @onClose="handleClose"
          />
      <robot
          v-if="nodeData.properties.deviceType ==='robot'"
          :nodeData="nodeData"
          :lf="lf"
          :socketResponse="socketResponse"
          @onClose="handleClose"
      />

    </section>
     <!-- 算法 -->
    <section  v-if="nodeData && nodeData.type === 'algorithm'" >
      <!-- <algorithm
        :nodeData="nodeData"
        @onClose="handleClose"
        /> -->
      <!-- 门缝 -->
      <ocr
        v-if="nodeData.properties.breif.includes('libAlgo_ocr_rec')"
        :nodeData="nodeData"
         :lf="lf"
        @onClose="handleClose"
        :socketResponse="socketResponse"
        />
      <crack
        v-if="nodeData.properties.breif.includes('detect_gap')"
        :nodeData="nodeData"
         :lf="lf"
        @onClose="handleClose"
        :socketResponse="socketResponse"
        />
      <!-- 条形码 -->
      <bar-code v-if="nodeData.properties.algName.includes('识别条形码')"
        :nodeData="nodeData"
         :lf="lf"
        :socketResponse="socketResponse"
        @onClose="handleClose">
      </bar-code>
      <qr-code v-if="nodeData.properties.breif.includes('libAlgo_detect_qbar')"
        :nodeData="nodeData"
         :lf="lf"
        :socketResponse="socketResponse"
        @onClose="handleClose">

      </qr-code>
      <!-- 螺丝 -->
      <screw-check
          v-if="nodeData.properties.breif.includes('libAlgo_detect_luosi')"
          :nodeData="nodeData"
          :lf="lf"
          :socketResponse="socketResponse"
          @onClose="handleClose"
      />
      <!-- 划伤划痕检测 -->
      <scratch-check
          v-if="nodeData.properties.algName.includes('划伤划痕检测')"
          :nodeData="nodeData"
          :lf="lf"
          :socketResponse="socketResponse"
          @onClose="handleClose"
      />
      <!-- 模板匹配 -->
      <template-match
          v-if="nodeData.properties.algName.includes('模板匹配')"
          :nodeData="nodeData"
          :lf="lf"
          :socketResponse="socketResponse"
          @onClose="handleClose"
      />
    </section>

  </div>
</template>
<script>
import camera from './camera'
import crack from "./crack";
import codeScan from './codeScan'
import screwCheck from './screwCheck'
import scratchCheck from './scratchCheck'
import templateMatch from './templateMatch'
import BarCode from './barCode.vue';
import QrCode from './qrCode.vue';
import plc from './PLC.vue';
import ocr from './ocr.vue';
import robot from './robot.vue';
// import { toTurboData } from '../../Util/AdpterForTurbo';
export default {
  name: 'debug',
  components: {
    camera,
    crack,
    codeScan,
    screwCheck,
    scratchCheck,
    BarCode,
    QrCode,
    templateMatch,
    plc,
    robot,
    ocr
  },
  props: {
    nodeData: Object,
    socketResponse: Object,
    graphData: Object,
    lf: Object
  },

  mounted () {
    console.log(this.nodeData.properties,"pro132321perties")
  },
  methods: {
    handleClose (record,callback) {
      // 数据转化为Turbo识别的数据结构
      this.$emit("setPropertiesFinish",{id:record.id, formData:record.formData}, callback)
    }
  }
}
</script>
<style>

</style>
