62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { message } from "antd";
 | 
						|
 | 
						|
function setVisibleByInputType(inputType,setFieldVisibleByBatch) {
 | 
						|
    const arrayList=[];
 | 
						|
    if(inputType == undefined)
 | 
						|
    {
 | 
						|
        arrayList.push({field: 'Nav_Line.CODE',visible:false});
 | 
						|
        arrayList.push({field: 'Nav_WorkStage.CODE',visible:false});
 | 
						|
    }
 | 
						|
    if(inputType==1)
 | 
						|
    {
 | 
						|
        arrayList.push({field: 'Nav_Line.CODE',visible:false});
 | 
						|
        arrayList.push({field: 'Nav_WorkStage.CODE',visible:true});
 | 
						|
    }
 | 
						|
    if(inputType==0)
 | 
						|
    {
 | 
						|
        arrayList.push({field: 'Nav_WorkStage.CODE',visible:false});
 | 
						|
        arrayList.push({field: 'Nav_Line.CODE',visible:true});
 | 
						|
    }
 | 
						|
    setFieldVisibleByBatch(arrayList);
 | 
						|
  }
 | 
						|
  
 | 
						|
  
 | 
						|
  //	产品样本配置编辑
 | 
						|
  export default {
 | 
						|
    onChange: ({value,colInfo,setFieldVisibleByBatch}) => {
 | 
						|
      if(colInfo.FIELD_NAME=='PRODUCT_TYPE'){
 | 
						|
        setVisibleByInputType(value,setFieldVisibleByBatch);
 | 
						|
      }
 | 
						|
    },
 | 
						|
    onBeforeEdit:({stateData,setFieldVisibleByBatch})=>{
 | 
						|
      setVisibleByInputType(stateData.PRODUCT_TYPE,setFieldVisibleByBatch);
 | 
						|
    },
 | 
						|
    onBeforeSave:({data,getFieldValue,setFieldValue,stateData})=>{
 | 
						|
        let checkResult=false;
 | 
						|
        if(stateData.PRODUCT_TYPE == undefined)
 | 
						|
        {
 | 
						|
            message.warn("类型不得为空");
 | 
						|
            checkResult=true;
 | 
						|
        }
 | 
						|
        if(stateData.PRODUCT_TYPE ==1)
 | 
						|
        {
 | 
						|
            stateData.LINE_ID=null;
 | 
						|
            if(!(stateData.WORKSTAGE_ID))
 | 
						|
            {
 | 
						|
              message.warn("生产中心不得为空");
 | 
						|
              checkResult=true;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        if(stateData.PRODUCT_TYPE ==0)
 | 
						|
        {
 | 
						|
            stateData.WORKSTAGE_ID=null;
 | 
						|
            if(!(stateData.LINE_ID))
 | 
						|
            {
 | 
						|
              message.warn("生产线不得为空");
 | 
						|
              checkResult=true;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        return checkResult;
 | 
						|
    },
 | 
						|
  }
 | 
						|
  
 |