var tmpl=`
    <el-card ref="cardSelf" class="box-card">
        <slot name="header">
          <div style="float:left;width:100px;"><h3>{{title}}</h3></div>
          <gsb-search style="float:left;margin-left:20px;margin-top:10px" @search="searchEnter" refModel="product" placeHolder="请输入文字选择并使用工具" labelField="name" valueField="code"></gsb-search>
          <div v-if="isShowCardButton" style="float:right;width:500px;text-align:right">
            <el-button type="warning"   @click="homePage"><i class="fa fa-cube" style="margin-right:3px"/>商标工作台</el-button>
            <el-button type="default"   @click="toolbox"><i class="fa fa-th" style="margin-right:3px"/>智能工具箱</el-button>
            <gsb-backbtn type="default"></gsb-backbtn>
          </div>
          <div style="float:right;margin-top:26px"><slot   name="extra"></slot></div>
          <div style="float:left;width:100%;height:1px;border-top:1px solid #eee"></div>
          <div style="clear:both;"></div><br/>
        </slot>
        <div>
          <div>
            <slot></slot>
          </div>
        </div>
    </el-card>
`
module.exports=
`{
   template:'${tmpl}',
   props:["title"],
   data:function(){
     return {
       currentDate:new Date(),
       isShowCardButton:true
     };
   },
   mounted:function(){
     var $card=$(this.$refs.cardSelf.$el);
     var ch=$(window).height()-this.$root.$data.header_h;
     $card.height(ch+2000);
     $(window).resize(()=>{
       var ch=$(window).height()-this.$root.$data.header_h;
       $card.height(ch+2000);
     });
   },
   created:function(){

   },
   methods:{
      homePage(){
        this.$router.push("/workbench");
      },
      toolbox(){
        this.$router.push("/toolbox");
      },
      changeButtonState(){
        this.isShowCardButton=!this.isShowCardButton;
      },
      searchEnter(v){
      var pt=this.$store.state.products.forEach(p=>{
         if(p.code==v){
           this.$router.push("/products/"+v+"/"+p.id);
           return false;
         }
       });
      }
   },
   vname:"gsb-card2"
}`
