<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__aqe7kQxJLYTosNuCkT0">
  <name>保存</name>
  <parentId>__FdIQLsyVhvbJjxJJYHL</parentId>
  <type>13</type>
  <onActionForm></onActionForm>
  <onActionView></onActionView>
  <onActionFlow></onActionFlow>
  <onActionPrint></onActionPrint>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[(function(){
 var doc=getCurrentDocument();
var applyRuleName = doc.getItemValueAsString("applyRuleName"); 
if(applyRuleName==null || applyRuleName.trim().length()<=0) {
    return "报名名称不得为空！";
}
var applyType = doc.getItemValueAsString("applyType"); 
if(applyType==null || applyType.trim().length()<=0) {
    return "报名分类不得为空！";
}
var applyStartDate = doc.getItemValueAsDate("applyStartDate");           
var applyEndDate = doc.getItemValueAsDate("applyEndDate");   
if(applyStartDate!=null&&applyEndDate!=null){       
  applyStartDate = format(applyStartDate,"yyyy-MM-dd");       
  applyEndDate= format(applyEndDate,"yyyy-MM-dd");       
  diff = diffDays(applyStartDate,applyEndDate);       
  if(diff < 0){
    return "时间区间填写有误！";
  }       
}else{
  return "时间区间不得为空！";
}
var applyColumn = doc.getItemValueAsString("applyColumn"); 
if(applyColumn==null || applyColumn.trim().length()<=0) {
    return "报名字段不得为空！";
}
})()]]></beforeActionScript>
  <afterActionScript><![CDATA[]]></afterActionScript>
  <retractBeforeActionScript><![CDATA[]]></retractBeforeActionScript>
  <retractAfterActionScript><![CDATA[]]></retractAfterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[]]></readonlyScript>
  <startFlowScript><![CDATA[							]]></startFlowScript>
  <editMode>0</editMode>
  <flowShowType>表单中显示流程操作</flowShowType>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <orderno>1</orderno>
  <stateToShow></stateToShow>
  <parentView></parentView>
  <parentForm>__FdIQLsyVhvbJjxJJYHL</parentForm>
  <impmappingconfigid>__7tkXQ8UWGSqrTJkHtCB</impmappingconfigid>
  <jumpType>0</jumpType>
  <expSub>false</expSub>
  <icon></icon>
  <disableFlowNode>true</disableFlowNode>
  <changeFlowOperator>true</changeFlowOperator>
  <changeFlowCc>true</changeFlowCc>
  <multiLanguageLabel></multiLanguageLabel>
  <dispatcherMode>0</dispatcherMode>
  <dispatcherUrl><![CDATA[]]></dispatcherUrl>
  <dispatcherParams><![CDATA[]]></dispatcherParams>
  <jumpMode>0</jumpMode>
  <jumpActOpenType>0</jumpActOpenType>
  <withOld>false</withOld>
  <actionType>1</actionType>
  <actionDispatcherUrlScript><![CDATA[]]></actionDispatcherUrlScript>
  <actionSelection>0</actionSelection>
  <relatedFormId>选择</relatedFormId>
  <actionScript><![CDATA[#include "getDsName"
(function(){
 var ruleId = getItemValueAsString("applyRuleId"); 
 var columnId = getItemValueAsString("columnId"); 
 var conditionId = getItemValueAsString("conditionId"); 
 var applyRuleName = getItemValueAsString("applyRuleName"); 
var applyType = getItemValueAsString("applyType"); 
var applyStartDate = getItemValueAsDate("applyStartDate");           
var applyEndDate = getItemValueAsDate("applyEndDate");       

var applyColumnStr = getItemValueAsString("applyColumn"); 
var applyColumnArr = splitText(applyColumnStr,";");

var applyAgeType = getItemValueAsString("applyAgeType"); 
var applyStartAge = getItemValueAsInt("applyStartAge"); 
var applyEndAge = getItemValueAsInt("applyEndAge"); 
var applyEducationType = getItemValueAsString("applyEducationType"); 
var applyStartEdu = getItemValueAsString("applyStartEdu"); 
var applyEndEdu = getItemValueAsString("applyEndEdu"); 

var dsName = getDsName();
try {
  var process = getDocProcess(getApplication());//Document 操作类
  //var ruleDoc = process.doView(ruleId);
  var ruleDoc = findDocument(ruleId);
  //println("ruleDoc修改前==>"+ruleDoc);
  ruleDoc.findItem("applyRuleName").setValue(applyRuleName);
  ruleDoc.findItem("APPLYTYPE").setValue(applyType);
  ruleDoc.findItem("applyStartDate").setValue(applyStartDate);
  ruleDoc.findItem("applyEndDate").setValue(applyEndDate);
  //println("ruleDoc修改后==>"+ruleDoc);
  
  var columnDoc = findDocument(columnId);
  //println("columnDoc修改前==>"+columnDoc);
  //var applySelectColumnStr = data.get("ITEM_APPLYCOLUMN");//已选字段
  var applySelectColumnStr = columnDoc.findItem("applyColumn").getValue();
  var applySelectColumnArr = splitText(applySelectColumnStr,";");
  
  columnDoc.findItem("applyColumn").setValue(applyColumnStr);
  
  for(var i=0;i<applySelectColumnArr.length;i++){   
    var applySelectColumn =  applySelectColumnArr[i]; 
    if(applyColumnStr.indexOf(applySelectColumn) == -1){
      //println(applySelectColumn+"字段已被取消");
      columnDoc.findItem(applySelectColumn+"ISSHOW").setValue("0");
    }
  } 
  for(var i=0;i<applyColumnArr.length;i++){       
    var applyColumn =  applyColumnArr[i]; 
    columnDoc.findItem(applyColumn+"ISSHOW").setValue("1");
  } 
  //println("columnDoc修改后==>"+columnDoc);
  
  var conditionDoc = findDocument(conditionId);
  //println("conditionDoc修改前==>"+conditionDoc);
  conditionDoc.findItem("APPLYAGETYPE").setValue(applyAgeType);
  conditionDoc.findItem("APPLYSTARTAGE").setValue(applyStartAge);
  conditionDoc.findItem("APPLYENDAGE").setValue(applyEndAge);
  conditionDoc.findItem("APPLYEDUCATIONTYPE").setValue(applyEducationType);
  conditionDoc.findItem("APPLYSTARTEDU").setValue(applyStartEdu);
  conditionDoc.findItem("APPLYENDEDU").setValue(applyEndEdu);
  //println("conditionDoc修改后==>"+conditionDoc);
  
  beginTransaction(dsName);  
  process.doUpdate(ruleDoc); 
  process.doUpdate(columnDoc); 
  process.doUpdate(conditionDoc); 
  commitTransaction(dsName);   

} catch(e) {
  println("异常信息==>" + e);
  rollbackTransaction(dsName);     
  return createAlert("保存失败，请稍后重试！");    
}   
})()]]></actionScript>
  <workFlowType>0</workFlowType>
  <isneedcomment>0</isneedcomment>
  <contextMenu>true</contextMenu>
  <showInToolbar>true</showInToolbar>
  <transpond>选择</transpond>
  <targetList>__pv8pd9ykExqgVfGcWYM|</targetList>
  <label><![CDATA[]]></label>
</activity>