<template>
	<div style="height:100%" v-if="visible">
		<el-dialog v-dialogDrag :visible="visible" :title="title[mode]" width="95%" top="5vh" v-if="visible" @close="$emit('update:visible',false)" append-to-body destory-on-close>
      <div v-loading = 'loading'>
        <imgDeatailDialog scanType='old' v-bind="$attrs" v-on="$listeners"	:mode="mode"  v-if="mode == 'view'"/>
        <addBindDialog scanType='old' v-bind="$attrs" v-on="$listeners"	:mode="mode" v-if="mode == 'bind'"/>
        <webScan scanType='old' v-bind="$attrs" v-on="$listeners"	:mode="mode" v-if="mode=='scan'"/>
      </div>
		</el-dialog>
	</div>
</template>

<script>
import imgDeatailDialog from "./imgDeatailDialog.vue";
import addBindDialog from "./addBindDialog.vue";
import webScan from "./scan.vue";
import OCR from "@/page/Business/OcrComp/views";
import Api from "~/service/Api";

	export default {
		props:{
			mode:{
				type: String,//scan:批扫 view:查看 bind:绑定
			},
			visible:{
				type: Boolean,
				default: false
			}
    },
    watch :{
      // OcrParams:{
      //   handler (newVal,oldVal) {
      //     console.log(!_.isEqual(newVal,oldVal))
      //     if(newVal.type != oldVal.type) {
      //       this.loading = true
      //       console.log(this.loading,newVal,new Date().getTime())
      //       // if(newVal && newVal.type =='1') this.getOcrResult()
      //       // if(newVal && newVal.type =='2') this.getOcrIdentify()
      //     }
      //   }
      // },
      OcrResult:{
          handler (newVal,oldVal) {
          console.log(newVal)
          this.tabName = 'YXBD'
        },
      }
    },
    computed: {
      // OcrParams () {
      //   return this.$store.state.Status.OcrParams
      // },
      OcrResult () {
        return this.$store.state.Status.OcrResult
      },
    },
		components:{
			imgDeatailDialog,
			addBindDialog,
      webScan,
      OCR
		},
		data(){
			return {
        SUCCESS:"AAAAAA",
        loading:false,
        disabled:true,
        isOpen: true,
        tabName: 'YXSM',
				title:{
					scan:"影像批扫",
					view:"影像查看",
					bind:"影像绑定"
				}
			}
			
    },
    methods: {
      heandleChangeTab (tab, event) {
        console.log(tab, event)
        // this.$store.commit("setOcr", false);
      },
    },
	}
</script>
<style scoped lang="less">
  ::v-deep .el-loading-mask{
    z-index: 99999999 !important;
  }
::v-deep .el-dialog {
  height: 90vh;
  margin: 5vh auto;
  .el-dialog__body {
    position: relative;
    height: calc(100% - 54px);
  }
}
</style>