{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          isSingleSelect:false,
          c:"hello",
          form:{
            scope:"",
            companyName:"",
            tmName:"",
            tmAnalyze:"",
            caseInfoMemo:"",
            cost:"",
            accountName:"",
            accountTel:"",
            companyName:"",
            accountWx:"",
            accountEmail:"",
            nclOnes:[]
          },
          d:{},
          action:""
        }
    },
    mounted:function(){
      var that=this;
      this.$root.postReq("/web/uploadCtl/getOssConfig","").then(function(d){
          that.d["key"]="key";
          that.d["Bucket"]=d.Bucket;
          that.d["OSSAccessKeyId"]=d.OSSAccessKeyId;
          that.d["Signature"]=d.Signature;
          that.d["policy"]=d.policy;
          that.d["success_action_status"]=d.success_action_status;
          that.action=d.url;
      });
      this.$root.getReq("/web/pconfigCtl/getConfigValue",{configType:"platformUseProfit"}).then(function(d){
          console.log(d);
          if(d!=null && d.configValue!=null && d.configValue!=""){
            that.platformUseFee=Number(d.configValue);
          }
      });
      this.$root.getReq("/web/pconfigCtl/getConfigValue",{configType:"invoiceTaxRate"}).then(function(d){
          console.log(d);
          if(d!=null && d.configValue!=null && d.configValue!=""){
            that.invoiceTaxRate=Number(d.configValue);
          }
      });
    },
    created:function(){

    },
    methods:{
      error(err){
        this.$message.warning(`上传失败，请重新上传`);
        console.log(err);
      },
      delRow(index, rows){
        rows.splice(index, 1);
    },
      updateRow(index, rows){
        this.$prompt('', '通过率', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(({ value }) => {
          this.form.nclOnes[index].passrate=value;
      }).catch(()=>{
      });
    },
      uploadsuccess(obj){
        var that=this;
        if(obj.flag=="tmPic"){
          that.$root.showMask();
          this.$root.getReq("/web/calculatepriceCtl/toblack",{"key":obj.key}).then(function(d){
            if(d.status==0){
              that.form.tmPic=d.data.url;
              that.$root.hideMask();
            }else{
              that.form.tmPic="";
              that.$root.hideMask();
              that.$message.warning(`上传失败请重新上传`);
              return false;
            }

          }).catch(function(){
            that.form.picUrl="";
            that.$root.hideMask();
            that.$message.warning(`上传失败请重新上传`);
            return false;
          });
        }
      },
       handleSelectionChange:function(val){
         this.multipleSelection = val;
       },
       headerCellStyle:function(){
         return {"background-color":"red"};
       },
       onsave(m){
         var obj=this.form;
         this.$root.getReq("/web/advicelettercaseCtl/save",{alc:obj}).then(d=>{
         });
       },
       applierChange(){
         console.log(this.form.companyName);
         this.$root.getReq("/web/calculatepriceCtl/getEntregistryByCompanyName",{companyName:this.form.companyName}).then(d=>{
           console.log(d);
           if(d.businessAddress && d.businessAddress!=""){
             this.form.scope=d.scope;
           }
           this.$root.getReq("/web/advicelettercaseCtl/nclonebyscope",{tmName:this.form.tmName,companyName:this.form.companyName}).then(d=>{
             console.log(d);
             this.form.nclOnes=d.data.data;
           });
         });
       },
       selrate(){
         var obj={tmName:this.form.tmName,companyName:this.form.companyName};
         this.$root.getReq("/web/advicelettercaseCtl/nclonebyscope",obj).then(d=>{
           console.log(d);
           this.form.nclOnes=d.data.data;
         });
       },
       showUrl(url){
         window.open(url);
       },
       rowClick(row,key,t,e){
         if(key=="createpdf"){
           var id= row.id;
           var url=window.location.href.split("#")[0]+"mobile2#/products/createalc/"+id;
           this.$root.getReq("/web/advicelettercaseCtl/createalc",{"url":url,"id":id}).then(function(d){
             if(d.data.url!="" && d.data.url!=null){
               that.$refs.grid.fetchData();
               that.showUrl(d.data.url);
             }else{
               that.$message.warning(`操作失败，请刷新页面后重新操作`);
             }
             that.$root.hideMask();
           }).catch(function(e){
             that.$root.hideMask();
             that.$message.warning(`操作失败，请刷新页面后重新操作`);
           });
         }
         if(key=="rpreview"){
           var that=this;
           var id= row.id;
           window.open(window.location.href.split("#")[0]+"mobile2#/products/createalc/"+id);
         }
         if( key=="myedit"){
           this.form=row;
           this.form.nclOnes=JSON.parse(row.nclOnes);
           this.$refs.card.changeButtonState();
           this.$refs.grid.showDlgForm();
         }
       },
       toolbarclick(key,b,selectedRows){
         if(key=="createpdf"){
             var id= selectedRows.id;
             window.open(window.location.href.split("#")[0]+"mobile2#/products/createalc/"+id);
         }
         if(key=="tpreview"){
           var that=this;
           var id= selectedRows.id;
           var url=window.location.href.split("#")[0]+"mobile2#/products/createalc/"+id;
           this.$root.getReq("/web/advicelettercaseCtl/createalc",{"url":url,"id":id}).then(function(d){
             if(d.data.url!="" && d.data.url!=null){
               that.$refs.grid.fetchData();
               that.showUrl(d.data.url);
             }else{
               that.$message.warning(`操作失败，请刷新页面后重新操作`);
             }
             that.$root.hideMask();
           }).catch(function(e){
             that.$root.hideMask();
             that.$message.warning(`操作失败，请刷新页面后重新操作`);
           });
         }
       },

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