var tmpl=`
<div>
   <el-transfer
      style="text-align: left;height:500px"
      v-model="sels"
      :value="value"
      filterable
      :titles="ts"
      @change="handleChange"
      :data="dataSouce">
    </el-transfer>
    </div>
`
module.exports=
`{
   template:'${tmpl}',
   model:{
    prop: 'value',
    event: 'change'
   },
   props:["titles","refwhere","refMethod","dicKey","refModel","isFilter","labelField","valueField","value"],
   data:function(){
     return {
       dataSouce:[],
       sels:this.value?this.value:[],
       ts:this.titles?this.titles:["待选择","已选择"],
     };
   },
   mounted:function(){
 
   },
   watch:{
     value:function(v){
        this.sels=v;
     },
     refModel:function(){
        this.fetchData();
     },
   },
   created:function(){
    
   },
   computed:{

   },
   methods:{
     fetchData:function(slike){
       this.dataSouce.length=0;
       if(this.dicKey){
         this.$root.getReq("/web/common/metaCtl/getDicConfig",{"dicKey":this.dicKey}).then(cfg=>{
            Object.keys(cfg.data).forEach(key=>{
               this.dataSouce.push({"label":cfg.data[key],"key":key});
            });
         });
         return;
       }else{
         if(this.refModel==""){
           return;
         }
         console.log(this.refModel);
         var query={};
         query.fields=[this.labelField,this.valueField];
         query.likestr=slike;
         query.refwhere=this.refwhere?this.refwhere:{};
         var method="refQuery";
         if(this.refMethod){
           method=this.refMethod;
         }
          var url="/web/"+this.refModel.split(".").join("/")+"Ctl/"+method;
        
         var self=this;
         this.$root.postReq(url,query).then(d=>{
             d.data.map(x=>{
               self.dataSouce.push({key:x[self.valueField],label:x[self.labelField]});
             });
             console.log(JSON.stringify(self.dataSouce));
         });
       }
     },
     handleChange:function(value, direction, movedKeys){
        this.$emit("change",this.sels);
     },
   },
   vname:"gsb-transfer"
}`
