{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          isSingleSelect:false,
          cc:"",
          showReject : false,
          rejectRow : {},
          rejectReason : "",
          rejectLoading : false,
        }
    },
    mounted:function(){
    },
    created:function(){
    },
    methods:{
        onColFormater(row,column,cellvalue,index){
          if(column.property=="created_at"){
            if(row["created_at"]){
              return new Date(row["created_at"]).toLocaleString();
            }else{
              return "";
            }
          }
          if(column.property=="audit_at"){
            if(row["audit_at"]){
              return new Date(row["audit_at"]).toLocaleString();
            }else{
              return "";
            }
          }
          if(column.property=="valid_at"){
            if(row["valid_at"]){
              return new Date(row["valid_at"]).toLocaleString();
            }else{
              return "";
            }
          }

          return cellvalue;
        },
       handleSelectionChange:function(val){
         this.multipleSelection = val;
         console.log(this.cc);
       },
       headerCellStyle:function(){
         return {"background-color":"red"};
       },
       onDlgFormClick(k, model){
       },
       toolbarclick(key,b,selectedRows){
       },
       doReject() {
         var that = this;
         var reason = this.rejectReason || "";
         if(!reason.trim()) {
           that.$message.warning(`请填写驳回原因`);
           return;
         }
         this.rejectLoading = true;
         this.$root.postReq("/web/tmcompanyCtl/reject",{id : that.rejectRow.id, auditReason: reason}).then(function(d){
           if(d.status== 0){
             that.rejectReason = "";
             that.rejectRow = {};
             that.$message.success(`驳回成功`);
             that.$refs.tmcompanyAuditGrid.fetchData();
             that.showReject=false;
           }else{
             that.$message.warning(d.msg || `驳回失败，请刷新页面后重新操作`);
           }
           that.rejectLoading = false;
         });
       },
       rowClick(row,key,t,e){
         console.log(row,key,t,e);
         var that=this;
         that.dialogTableVisible =false;
         that.approvalDialogFormVisible = false;
         if(key=="auditPass") {
           console.log(row);
           if(row.auditStatus != '0') {
             that.$message.warning(`该申请已审核完成`);
             return false;
           }
           this.$confirm('确定审核通过?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(()=>{
              this.$root.postReq("/web/tmcompanyCtl/pass",{id : row.id}).then(function(d){
                if(d.status== 0){
                  that.$message.success(`审核成功`);
                  that.$refs.tmcompanyAuditGrid.fetchData();
                }else{
                  that.$message.warning(d.msg || `审核失败，请刷新页面后重新操作`);
                }
              });
            });
         }
         if(key=="auditReject"){
           if(row.auditStatus != '0') {
             that.$message.warning(`该申请已审核完成`);
             return false;
           }
           that.rejectRow=row;
           that.showReject=true;
         }
       },
    },
    computed:{
      headStyle:function(){
        return {"background-color":"white"};
      }
    },
    vname:"gsb-tmcompanyaudit"
}
