<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__BRN9zTbWanBzwpHeekS">
  <name>保存</name>
  <parentId>__HbFhSdDXsvPIG3aS2S1</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[(function(){
 var applyRuleId = getId();

})()]]></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>2</orderno>
  <stateToShow></stateToShow>
  <parentView></parentView>
  <parentForm>__HbFhSdDXsvPIG3aS2S1</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>__HbFhSdDXsvPIG3aS2S1</relatedFormId>
  <actionScript><![CDATA[//在表单控件值脚本中获取当前文档对象
#include "getDsName"
(function(){
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 userName= getWebUser().getName(); 
var dsName = getDsName();
try {
  var process = getDocumentProcess();            
  var formProcess = getFormProcess();            
  var applyRuleInfo = formProcess.doView("__9R1Aei29Y0ZwTAnkcQf");            
  var applyRuleInfoDoc = process.doNew(applyRuleInfo,getWebUser(),createParamsTable());            
  applyRuleInfoDoc.addStringItem("APPLYRULENAME",applyRuleName);            
  applyRuleInfoDoc.addStringItem("APPLYTYPE",applyType);           
  applyRuleInfoDoc.addDateItem("APPLYSTARTDATE",applyStartDate);   
  applyRuleInfoDoc.addDateItem("APPLYENDDATE",applyEndDate);
  applyRuleInfoDoc.addStringItem("CREATEDUSER",userName);
  var applyRuleId = applyRuleInfoDoc.getId();
  
  var applyColumnInfo = formProcess.doView("__v4CHp8kohCxPM9GnX6Y");            
  var applyColumnInfoDoc = process.doNew(applyColumnInfo,getWebUser(),createParamsTable());            
  applyColumnInfoDoc.addStringItem("APPLYRULEID",applyRuleId);
  applyColumnInfoDoc.addStringItem("APPLYCOLUMN",applyColumnStr);
  for(var i=0;i<applyColumnArr.length;i++){       
    var applyColumn =  applyColumnArr[i]; 
    applyColumnInfoDoc.addStringItem(applyColumn+"ISSHOW","1");
  } 
  
  var applyConditionInfo = formProcess.doView("__340tz9B7lq7UwdxVI9e");            
  var applyConditionInfoDoc = process.doNew(applyConditionInfo,getWebUser(),createParamsTable());            
  applyConditionInfoDoc.addStringItem("APPLYRULEID",applyRuleId);
  applyConditionInfoDoc.addStringItem("APPLYAGETYPE",applyAgeType);
  applyConditionInfoDoc.addStringItem("APPLYSTARTAGE",applyStartAge);
  applyConditionInfoDoc.addStringItem("APPLYENDAGE",applyEndAge);
  applyConditionInfoDoc.addStringItem("APPLYEDUCATIONTYPE",applyEducationType);
  applyConditionInfoDoc.addStringItem("APPLYSTARTEDU",applyStartEdu);
  applyConditionInfoDoc.addStringItem("APPLYENDEDU",applyEndEdu);
  
  var ruleObjectInfo = formProcess.doView("__YnNdVeJNx5aI7TOvQBR");            
  var ruleObjectInfoDoc = process.doNew(ruleObjectInfo,getWebUser(),createParamsTable());            
  ruleObjectInfoDoc.addStringItem("RULEID",applyRuleId);
  ruleObjectInfoDoc.addStringItem("RULETYPE","0");
  
  beginTransaction(dsName);  
  process.doCreate(applyRuleInfoDoc); 
  process.doCreate(applyColumnInfoDoc); 
  process.doCreate(applyConditionInfoDoc); 
  process.doCreate(ruleObjectInfoDoc);
  commitTransaction(dsName);                       
} catch(e) {
  println("异常信息==>" + e);
  rollbackTransaction(dsName);     
  return createAlert("保存失败，请稍后重试！");    
}   
})()]]></actionScript>
  <workFlowType>0</workFlowType>
  <contextMenu>true</contextMenu>
  <showInToolbar>true</showInToolbar>
  <transpond>选择</transpond>
  <targetList>__pv8pd9ykExqgVfGcWYM|</targetList>
  <label><![CDATA[]]></label>
</activity>