{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          isSingleSelect:false,
          remarksType:"add",
          remarks:{},
          showRemarks:false,
          remarksList:[
           /* {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},
            {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},
            {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},
            {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},
            {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},
            {customer_intention:"意向一般",desc:"该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。该客户还在考虑，后续继续跟进。",time:"2019-05-16"},*/
          ],
        }
    },
    mounted:function(){

    },
    created:function(){
    },
    methods:{
      onsel(c){
        this.remarks.customer_intention=c;
      },
      submitRemarks(){
        if(!this.remarks.customer_intention){
          this.$message.warning("请选择客户意向");
          return;
        }
        if(this.remarks.desc && this.remarks.desc.length>50){
          this.$message.warning("备注内容字数不能超过50");
          return;
        }
        this.$root.postReq("/web/needCtl/submitRemarks",this.remarks).then(d=>{
          if(d && d.code==1){
            this.showRemarks=false;
            this.$refs.containerGrid.fetchData();
            this.$message.success("提交备注成功");
          }else{
            this.$message.warning(d.msg);
          }
        }).catch(function(e){
          that.$message.warning(`操作失败，请刷新页面后重新操作`);
        });
      },
       onColFormater(row,column,cellvalue,index){
      if(column.property=="created_at"){
        var date = new Date(row["created_at"]);
        var time= date.toLocaleString();
        return time;
       }
       if(column.property=="updated_at"){
        var date = new Date(row["updated_at"]);
        var time= date.toLocaleString();
        return time;
       }
       return cellvalue;
      },
       handleSelectionChange:function(val){
         this.multipleSelection = val;
         console.log(val);
       },
       onRowClick(row,key,e){
         if(key=="myremark"){
           this.remarksList=[];
           if(row.opNotes){
             var obj = JSON.parse(row.opNotes);
             if(obj.opNotes && obj.opNotes.length>0){
              this.remarksList = obj.opNotes;
             }
             this.remarks={};
           }
           this.remarks.id = row.id;
           this.showRemarks=true;
         }
         if(key=="dealing"){
           if(row["statusName"]=="已完成"){
             this.$message.warning(`当前客户需求已处理完成`);
           }
           if(row["statusName"]=="待服务"){
             var that=this;
             this.modelName="need";
             var url=this.getUrl("update");
             row["statusName"]="跟进中";
             row["status"]="2";
             row["version"]+=1;
             this.$root.postReq(url,row).then(rd=>{
               if(rd.status==0){
                 that.$refs.containerGrid.fetchData();
               }
             }).catch(function(e){
               that.$message.warning(`操作失败，请刷新页面后重新操作`);
             });
             return;
           }
           if(row["statusName"]=="跟进中"){
             var that=this;
             this.modelName="need";
             var url=this.getUrl("update");
             row["statusName"]="已完成";
             row["status"]="4";
             row["version"]+=1;
             this.$root.postReq(url,row).then(rd=>{
               if(rd.status==0){
                 that.$refs.containerGrid.fetchData();
               }
             }).catch(function(e){
               console.log(e);
               that.$message.warning(`操作失败，请刷新页面后重新操作`);
             });
             return;
           }
         }


         },

    },
    computed: Vuex.mapState({
      count:state=>state.count,
      headStyle:function(){
        return {"background-color":"white"};
      }
    }),
    vname:"gsb_clientneed"
}
