{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          isSingleSelect:false,
          c:"hello",
          dialogFormVisible: false,
          copyDialogFormVisible: false,
          channeldata:[],
          channel:"",
          copyToChannel:"",
          bizCode:"",
          title:"服务项管理",
          copyData:[],
        }
    },
    mounted:function(){
      var $card=$(this.$refs.card.$el);
      var ch=$(window).height()-this.$root.$data.header_h;
      $card.height(ch+2500);
      $(window).resize(()=>{
        var ch=$(window).height()-this.$root.$data.header_h;
        $card.height(ch+2500);
      });
    },
    created:function(){
      var that=this;
      if(this.codePath.indexOf("tmstock")>=0){
        this.bizCode="tmstock";
        this.title="商标库管理";
      }else{
        this.bizCode="servicesitem";
      }
      that.$root.postReq("/web/channelCtl/findAllChannel","").then(function(d){
        if(d.code==1){
          that.channeldata=d.data;
        }
      })
    },
    methods:{
      onColFormater(row,column,cellvalue,index){
        if(column.property=="isPubed"){
          if(row["isPubed"]){
            return "是";
          }else{
            return "否";
          }
        }
        return cellvalue;
      },
       toolbarclick(key,b,selectedRows){
         var that=this;
         that.dialogFormVisible=false;
         that.copyDialogFormVisible=false;
         that.channel="";
         that.copyToChannel="";
         if(key=="extraup"){
           that.dialogFormVisible=true;
         }
         if(key=="copyOp"){
             if(selectedRows==null || selectedRows.length==0){
               this.$message.warning(`请至少选择一行记录进行复制`);
               return false;
             }
             console.log(selectedRows.length,"selectedRows.lengthselectedRows.length");
             console.log(selectedRows);
             that.copyData=selectedRows;
             that.copyDialogFormVisible=true;
        }
       },
       submit:function(){
         console.log(this.channel);
         if(this.channel==""){
           this.$message.warning( '请选择渠道' );
         }else{
           var that=this;
           that.dialogFormVisible=false;
           that.copyDialogFormVisible=false;
           that.$root.showMask();
           var obj={channel:this.channel};
           that.$root.postReq("/web/servicesitemCtl/replenishServiceItem",obj).then(function(d){
                that.$root.hideMask();
                if(d.code == 1 )
                {
                  that.$message.success( d.message );
                }
                else {
                  that.$message.warning(d.message);
                }
              });
         }
       },
       copySubmit:function(){
         if(this.copyToChannel==""){
           this.$message.warning( '请选择渠道' );
         }else if(this.copyData.length==0){
           this.$message.warning( '没有选择的数据，请选择数据进行操作' );
         }
         else {
           var that=this;
           that.dialogFormVisible=false;
           that.copyDialogFormVisible=false;
           console.log("that.copyData............................");
           console.log(that.copyData);
           var opids=[];
           for (var i = 0; i < that.copyData.length; i++) {
             var tItem=that.copyData[i];
             console.log("tItem=====================================");
             console.log(tItem);
             if(tItem!=null){
               opids.push(tItem.id);
             }
           }
           console.log("opids.....................................");
           console.log(opids);
           var obj={channel:that.copyToChannel,ids:opids};
           that.$root.postReq("/web/servicesitemCtl/opCopyData",obj).then(function(d){
             console.log("dddddd*****************************************");
             console.log(d);
                that.$root.hideMask();
                console.log("dddddd*****************************************00001");
                if(d.code == 1 )
                {
                  that.$message.success( d.message );
                }
                else {
                  that.$message.warning(d.message);
                }
              });
         }
       },
       vfmethod:function(rule, value, callback){
         if(rule.field=="hotline"){
           if(/^1[23456789]\d{9}$/.test(value) == false){
              return  callback(new Error("请输入正确的手机号"));
           }else{
              return  callback();
           }
         }
         if(this.codePath.indexOf("tmstock")>=0){
           return  callback();
         }
         var that=this;
         /*发票税率*/
         var fpsl=7;
         that.$root.getReq("/web/pconfigCtl/getConfigValue",{configType:"invoiceTaxRate"}).then(function(d){
             if(d!=null && d.configValue!=null && d.configValue!=""){
               that.fpsl=Number(d.configValue);
             }
         });
         var model=this.$refs.grd2.getFormModel();
         var serviceCharge=model.serviceCharge?model.serviceCharge:0;
         var publicExpense=model.publicExpense?model.publicExpense:0;
         var platformCost=model.platformCost?model.platformCost:0;
         /*服务费+官费+平台使用费==自服务底价*/
         console.log("serviceCharge:"+serviceCharge);
         console.log("publicExpense:"+publicExpense);
         console.log("platformCost:"+platformCost);
         var tmpTotalSum=serviceCharge+publicExpense+platformCost;
         var s=tmpTotalSum+tmpTotalSum*that.fpsl/100;
         /*var sw=(publicExpense+platformCost)/0.93;*/
         this.$set(model,"platformWorkFloorPrice",s);
         if(rule.field=="guidePrice"){
           if(Number(value)<s){
             return callback(new Error("指导报价不能小于委托平台服务底价"));
           }else{
             this.$set(model,"guidePrice",value);
           }
         }
         /*this.$set(model,"selfWorkFloorPrice",Math.round(sw));*/
         return callback();
       },
       handleSelectionChange:function(val){
         this.multipleSelection = val;
         console.log(this.cc);
       },
       headerCellStyle:function(){
         return {"background-color":"red"};
       },

    },
    computed:{
      headStyle:function(){
        return {"background-color":"white"};
      }
    },
    vname:"gsb-servicesitem"
}
