
import React from 'react';
import {initFilter} from "../../utils/common";
import { ConfirmButton } from '@woowalker/feui'
import {message} from "antd/lib/index";

//采购单列表
export default {

  btnShow:({record,close,loadData,login,dispatch})=> {
  },
  btnSendCheck:({record,close,loadData,login,btn,dispatch})=> {
    const confirm=()=>{
      //dispatch()
      const json=initFilter(login.OrgId, record.ID,'',0,1,login.userId);

      dispatch({
        type: 'WHInMaterialSendInspect/sendInspect',
        payload:json,
        onComplete: (ret) => {
          if(ret) {
            message.success('执行成功');
            loadData();
          }
        }
      })
    };
    let result={};
    // if(!isReturn) {
    //   if(record.ENABLE_FLOW){
    //     btn.LABEL="送审";
    //   }
    //   else{
    //     btn.LABEL="确认";
    //   };
    //
    //
    // };
    return {
      content:<ConfirmButton isConfirm={true} confirmTitle="是否确定送检?" onClick={confirm} key={record ? (record.ID + btn.ID) : btn.ID}
                             type={btn.CSS} icon={btn.ICON} size="small" title={btn.LABEL} />,
    };
  },
  checkPermitState:({record,close,loadData,login,btn,dispatch})=> {
    const isReturn=record.ORDER_STATUS!=0;
    return {
      isReturn:isReturn,
    };
  },
}
