<template>
    <div>
       <Input  v-if="!value"  :disabled="true" style="width: 100%" />
       <div  v-else  class="link">
          <a type="text" @click="jumpToDetail" class="aClass">{{value}}</a>
       </div>
    </div>
</template>

<script>
import input from './util/bc_input.js'
export default {
  name: "超链接",
  mixins: [input],
  data() {
    return {
      id:null,
      queryData:[]
    }
  },
  watch: {
    value: function (nv, ov) {
       
    },
  },
  methods: {
    jumpToDetail(){
      let configId = 'SHLLID';
      let configDefineName = 'SHLLDEFINE';
      if(this.define.config.defineId && this.define.config.defineId.split('.').length>1){
        configId =  this.define.config.defineId.split('.')[1];
      }
      if(this.define.config.defineName && this.define.config.defineName.split('.').length>1){
        configDefineName =  this.define.config.defineName.split('.')[1];
      }
      let defineName = this.context.dataObject.getValue(configDefineName);
      let id = this.context.dataObject.getValue(configId);
      let a = "/showBillForm/" + defineName + '_R/' + id;
      let routeData = GMS.routerManager.getRouter().resolve({
        path: a
      }); 
      window.open(routeData.href, "_blank"); 
    }
  },
  mounted() {
    GMS.vbus.$on('onSelectionChange', (selection) => {
      this.queryData = [...selection]
    })
    GMS.vbus.$on('onCurrentChange', (currentRow) => {
      this.queryData = [currentRow]
    })
  }
}
</script>

<style scoped>
.link{
  border-radius:4px;
  border: 1px solid #ddd;
  width: 100%;
  display: inline-block;
  height: 32px;
  line-height: 32px;
}
.aClass{
  color:#3379A7;
  margin-left:8px;
}
.aClass:hover{
  text-decoration:underline;
  color: #3379A7;
}
</style>