{
  template: '${tmpl}',
    data: function() {
      return {
        multipleSelection: [],
        isSingleSelect: false,
        bizCode: 'mytradetransferdiliver',
        showUploadform: false,
        f1: "",
        trackVisable:false,
        trackContent:"",
        trackRecords:[
    
        ],
        currentRow:null,
        isbtnRunning:false,
      }
    },
  mounted: function() {
    this.currentRow=null;


  },
  created: function() {
    /* if(this.codePath.indexOf("appuser")>=0){
       this.bizCode="appuser";
     }else{
       this.bizCode="allusers";
     }*/
  },
  methods: {
    validateformmethod(rule, value, cbk){
      return cbk();
    },
    inputMobile(row){
      alert("input mobile..")
    },
    onDlgFormClick(k, model){
      var that=this;
      if (k = "alisubmit") {
        debugger;
        if(model.transfer_status=="PAY_OVER" || model.transfer_status=="MATERIAL_PROVIDE"){
          that.$message.warning("状态不可修改");
          return;
        }
        this.$root.postReq("/web/transfer/tradetransferCtl/submit", model).then(function (d) {
          if (d.status > -1) {
            $("[name='grdid']").show();
            $("[name='frmid']").hide();
            that.$message({
              type: 'success',
              message: '提交成功!'
            });
          }else{
            $("[name='grdid']").show();
            $("[name='frmid']").hide();
            that.$message.warning("提交失败");
          }
        })
      }
    },
    onColFormater(row, column, cellvalue, index){
      /*这里解析跟进字段，解析为数组，取最后一条*/
      if(column.property=="tracklast"){
        if(row.tracklog && row.tracklog!=""){
          tlogobj= JSON.parse(row.tracklog.split("|")[0]);
          console.log(tlogobj["content"],"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv");
          return tlogobj["content"];
        }
       
     }
      return cellvalue;
    },
    handleSelectionChange: function(val) {
      this.multipleSelection = val;
      console.log(val);
    },
    fetchData: function() {

    },
    onRowClick(row, key, e){
      if (key == "upfiles") {
        console.log(this.$router);
        this.$router.push({ path: "/tansfersupplymaterail", query: { ali_bizid: row.ali_bizid } });

      }
      if (key == "notar") {
        console.log(this.$router);
        this.$router.push({ path: "/mynotarizationflow", query: { ali_bizid: row.ali_bizid } });
      }
      if(key=="tracks"){
        this.trackContent="";
        this.currentRow=row;
        this.trackVisable=true;
        this.handlerTrackLog(this.currentRow);
        if(this.trackRecords.length==0){
          this.trackRecords.push({"trackDate":"暂无跟进","trackContent":"请联系客户，进行跟进"});
        }
      }
      if(key=="bicall"){
        alert("开始双虎 ");
      }
    },
    handlerTrackLog(row){
      this.trackRecords=[];
      if(row.tracklog && row.tracklog!=""){
        let arrstrs=row.tracklog.split("|");
        arrstrs.forEach((item)=>{
          if(item && item!=""){
            let it=JSON.parse(item);
            if(it){
              let trackItem={"trackDate":`${it.dateStr} ${it.yw}`,"trackContent":`${it.timeStr} ${it.content}`};
              this.trackRecords.push(trackItem);
            }
       
          }
       
        })
      }
    },
    upsuccess(result){
      console.log(result);
    },
    showdetail(){
      alert("track.......details");
    },
    cancelClick(){
      this.trackVisable=false;
    },
    saveClick(){
      this.isbtnRunning=true;
      if(this.trackContent==""){
        return;
      }
      let tid=this.currentRow.id;
      let pushData={"tid":tid,"log":{"content":this.trackContent}};
      var self=this;
      this.$root.postReq("/web/transfer/tradetransferCtl/track", {logdata:pushData}).then(function (d) {
        /*返回整个跟进字段，解析为数组*/
         console.log(d.data,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
         self.currentRow.version=d.data.version;
         self.currentRow.tracklog=d.data.tracklog;
         self.handlerTrackLog(self.currentRow);
         self.trackContent="";
         self.isbtnRunning=false;
        
      })
      
    }
  },
  computed: Vuex.mapState({
    headStyle: function () {
      return { "background-color": "white" };
    }
  }),
    vname: "gsb-tradetransferdiliver"
}
