diff --git a/o2server/start_aix_debug.sh b/o2server/start_aix_debug.sh index 1c66a4510498d50e55e7bca6e8e4fbcd84ef3060..8887d9f3e2ba21e252fafe7437af116c316d0417 100755 --- a/o2server/start_aix_debug.sh +++ b/o2server/start_aix_debug.sh @@ -48,4 +48,4 @@ then exit 1 fi fi -setsid ${current_dir}/jvm/aix_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +setsid ${current_dir}/jvm/aix_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_arm_debug.sh b/o2server/start_arm_debug.sh index 5bd2a1dcd812b5d131a13319b7a996448610f2f2..5b8c539138cfc949a5002ed408caa7b502131746 100755 --- a/o2server/start_arm_debug.sh +++ b/o2server/start_arm_debug.sh @@ -41,4 +41,4 @@ if [ -d ${current_dir}/local/update ]; then exit 1 fi fi -setsid ${current_dir}/jvm/arm_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +setsid ${current_dir}/jvm/arm_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_linux_debug.sh b/o2server/start_linux_debug.sh index 5ac87a7420ea28b5326fc535a2e7aa330a518452..0c4f608f61b2789547a2643693cd868fe0069553 100755 --- a/o2server/start_linux_debug.sh +++ b/o2server/start_linux_debug.sh @@ -41,4 +41,4 @@ if [ -d ${current_dir}/local/update ]; then exit 1 fi fi -setsid ${current_dir}/jvm/linux_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +setsid ${current_dir}/jvm/linux_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_macos_debug.sh b/o2server/start_macos_debug.sh index 5559ff844e1c40a083bee1aad60782fb7ad9699c..36e470fd53bf8ec0cf9e2daadff765f8c362fef3 100755 --- a/o2server/start_macos_debug.sh +++ b/o2server/start_macos_debug.sh @@ -42,4 +42,4 @@ if [ -d ${current_dir}/local/update ]; then exit 1 fi fi -sudo ${current_dir}/jvm/macos_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +sudo ${current_dir}/jvm/macos_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_mips_debug.sh b/o2server/start_mips_debug.sh index 1e219f229ef74d23a05d9ed09a748a47f7f5ab1c..b5aab837dd8992fd22857f96cc5b648dffe78f21 100755 --- a/o2server/start_mips_debug.sh +++ b/o2server/start_mips_debug.sh @@ -41,4 +41,4 @@ if [ -d ${current_dir}/local/update ]; then exit 1 fi fi -setsid ${current_dir}/jvm/mips_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +setsid ${current_dir}/jvm/mips_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_raspi_debug.sh b/o2server/start_raspi_debug.sh index 45a125638593e06334b91a1c81af796852110da0..034815deb1a03d2bd1a8db990546f8bac85fdec4 100755 --- a/o2server/start_raspi_debug.sh +++ b/o2server/start_raspi_debug.sh @@ -41,4 +41,4 @@ if [ -d ${current_dir}/local/update ]; then exit 1 fi fi -setsid ${current_dir}/jvm/raspi_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar +setsid ${current_dir}/jvm/raspi_java11/bin/java -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar ${current_dir}/console.jar diff --git a/o2server/start_windows_debug.bat b/o2server/start_windows_debug.bat index 280bbcc57fef9dcb4989e716f2185d4e12193b75..e5c74a982e0958c5f795b916f20f112a127e86d1 100755 --- a/o2server/start_windows_debug.bat +++ b/o2server/start_windows_debug.bat @@ -37,4 +37,4 @@ if exist "%~dp0local\update" ( ) ) @echo on -"%~dp0jvm\windows_java11\bin\java" -javaagent:"%~dp0console.jar" -server -Xms2g -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20000 -Djava.rmi.server.hostname=127.0.0.1 -jar "%~dp0console.jar" +"%~dp0jvm\windows_java11\bin\java" -javaagent:"%~dp0console.jar" -server -Xms2g -Dnashorn.args=--no-deprecation-warning --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Duser.timezone=GMT+08 -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0.0.0.0:20000 -Djava.rmi.server.hostname=127.0.0.1 -jar "%~dp0console.jar" diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseDictionary.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseDictionary.java index 5b9591d5e7ef5c90087413f927292b18605315c7..369ae42fb997c70f91eea938f876cfd74d4b71f2 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseDictionary.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/openjpa/jdbc/sql/GBaseDictionary.java @@ -62,7 +62,7 @@ public class GBaseDictionary extends DBDictionary { floatTypeName = "FLOAT"; doubleTypeName = "DOUBLE PRECISION"; bitTypeName = "BOOLEAN"; - blobTypeName = "BYTE"; + blobTypeName = "BLOB"; dateTypeName = "DATE"; timeTypeName = "DATETIME HOUR TO SECOND"; timestampTypeName = "DATETIME YEAR TO FRACTION(5)"; diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java index fef0df4be2ab675da0ab421fc6311e2578ca6f4f..3cf7eb9ede6efab7f5812a46471417a815300049 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java @@ -134,6 +134,7 @@ public class Config { public static final String DIR_LOCAL_BACKUP = "local/backup"; public static final String DIR_LOCAL_DUMP = "local/dump"; public static final String DIR_LOCAL_REPOSITORY = "local/repository"; + public static final String DIR_LOCAL_REPOSITORY_INDEX = "local/repository/index"; public static final String DIR_LOCAL_UPDATE = "local/update"; public static final String DIR_LOCAL_TEMP = "local/temp"; public static final String DIR_LOCAL_TEMP_CLASSES = "local/temp/classes"; @@ -1465,4 +1466,12 @@ public class Config { return path; } + public static Path path_local_repository_index(boolean force) throws IOException, URISyntaxException { + Path path = Paths.get(base(), DIR_LOCAL_REPOSITORY_INDEX); + if ((!Files.exists(path)) && force) { + Files.createDirectories(path); + } + return path; + } + } diff --git a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/General.java b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/General.java index 409c7d5fc5b8ee35cdb48f2c74338a0da42985c2..8ba1f75699dca826be9e86fdeb4126ba0c41b442 100644 --- a/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/General.java +++ b/o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/General.java @@ -21,7 +21,7 @@ public class General extends ConfigObject { private static final Boolean DEFAULT_WEBSOCKETENABLE = true; private static final Boolean DEFAULT_CONFIGAPIENABLE = true; private static final List DEFAULT_SCRIPTINGBLOCKEDCLASSES = Arrays.asList(Runtime.class.getName(), - File.class.getName(), Path.class.getName()); + File.class.getName(), Path.class.getName(), ProcessBuilder.class.getName()); private static final Boolean DEFAULT_REQUESTLOGENABLE = false; private static final Integer DEFAULT_REQUESTLOGRETAINDAYS = 7; private static final Boolean DEFAULT_REQUESTLOGBODYENABLE = false; diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java index 71322e9c220a9020151b316c565532ac2913363d..39df2c02d05a44ae290422a4a929e5d525890762 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java @@ -1,7 +1,9 @@ package com.x.cms.assemble.control; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import com.x.cms.core.entity.CategoryInfo; import com.x.cms.core.entity.Document; @@ -418,6 +420,7 @@ public class Business { /** * 是否是文档的编辑者 + * 文档不存在判断是否是分类或应用的发布者 * @param person * @param appInfo * @return @@ -427,8 +430,8 @@ public class Business { if (isManager(person)) { return true; } - List unitNames = null; - List groupNames = null; + List unitNames = this.organization().unit().listWithPersonSupNested(person.getDistinguishedName()); + List groupNames = this.organization().group().listWithPerson(person.getDistinguishedName()); if(document!=null){ if( ListTools.isNotEmpty( document.getAuthorPersonList() )) { if( document.getAuthorPersonList().contains( getShortTargetFlag(person.getDistinguishedName()) ) ) { @@ -436,65 +439,52 @@ public class Business { } } if( ListTools.isNotEmpty( document.getAuthorUnitList() )) { - unitNames = this.organization().unit() - .listWithPersonSupNested(person.getDistinguishedName()); if( ListTools.containsAny( getShortTargetFlag(unitNames), document.getAuthorUnitList())) { return true; } } if( ListTools.isNotEmpty( document.getAuthorGroupList() )) { - groupNames = this.organization().group().listWithPerson(person.getDistinguishedName()); if( ListTools.containsAny( getShortTargetFlag(groupNames), document.getAuthorGroupList())) { return true; } } } if (categoryInfo != null) { - if (ListTools.isNotEmpty(categoryInfo.getManageablePersonList())) { - if (categoryInfo.getManageablePersonList().contains(person.getDistinguishedName())) { - return true; - } + Set catePersonList = new HashSet<>(categoryInfo.getManageablePersonList()); + Set cateUnitList = new HashSet<>(categoryInfo.getManageableUnitList()); + Set cateGroupList = new HashSet<>(categoryInfo.getManageableGroupList()); + if(document == null){ + catePersonList.addAll(categoryInfo.getPublishablePersonList()); + cateUnitList.addAll(categoryInfo.getPublishableUnitList()); + cateGroupList.addAll(categoryInfo.getPublishableGroupList()); } - if (ListTools.isNotEmpty(categoryInfo.getManageableUnitList())) { - if(unitNames == null) { - unitNames = this.organization().unit() - .listWithPersonSupNested(person.getDistinguishedName()); - } - if (ListTools.containsAny(unitNames, categoryInfo.getManageableUnitList())) { - return true; - } + if (catePersonList.size() > 0 && catePersonList.contains(person.getDistinguishedName())) { + return true; } - if (ListTools.isNotEmpty(categoryInfo.getManageableGroupList())) { - if(groupNames == null) { - groupNames = this.organization().group().listWithPerson(person.getDistinguishedName()); - } - if (ListTools.containsAny(groupNames, categoryInfo.getManageableGroupList())) { - return true; - } + if (cateUnitList.size() > 0 && ListTools.containsAny(unitNames, new ArrayList<>(cateUnitList))) { + return true; + } + if (cateGroupList.size() > 0 && ListTools.containsAny(groupNames, new ArrayList<>(cateGroupList))) { + return true; } } if (appInfo != null) { - if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) { - if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) { - return true; - } + Set appPersonList = new HashSet<>(appInfo.getManageablePersonList()); + Set appUnitList = new HashSet<>(appInfo.getManageableUnitList()); + Set appGroupList = new HashSet<>(appInfo.getManageableGroupList()); + if(document == null){ + appPersonList.addAll(appInfo.getPublishablePersonList()); + appUnitList.addAll(appInfo.getPublishableUnitList()); + appGroupList.addAll(appInfo.getPublishableGroupList()); } - if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) { - if(unitNames == null) { - unitNames = this.organization().unit() - .listWithPersonSupNested(person.getDistinguishedName()); - } - if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) { - return true; - } + if (appPersonList.size() > 0 && appPersonList.contains(person.getDistinguishedName())) { + return true; } - if (ListTools.isNotEmpty(appInfo.getManageableGroupList())) { - if(groupNames == null) { - groupNames = this.organization().group().listWithPerson(person.getDistinguishedName()); - } - if (ListTools.containsAny(groupNames, appInfo.getManageableGroupList())) { - return true; - } + if (appUnitList.size() > 0 && ListTools.containsAny(unitNames, new ArrayList<>(appUnitList))) { + return true; + } + if (appGroupList.size() > 0 && ListTools.containsAny(groupNames, new ArrayList<>(appGroupList))) { + return true; } } return false; diff --git a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java index aea89b95a1434e26b37556afab1a75b0a7b3e271..1bd797c5f475521233e47f9a3f3a3119cd4d35df 100644 --- a/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java +++ b/o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentQueryService.java @@ -35,7 +35,7 @@ public class DocumentQueryService { public Document get( String id ) throws Exception { if( StringUtils.isEmpty( id ) ){ - throw new Exception("id is null!"); + return null; } try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) { return documentInfoService.get( emc, id ); diff --git a/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/factory/MeetingFactory.java b/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/factory/MeetingFactory.java index f699afa9ce36a85e0fed71a2e86443e0b39403c2..1eb6900073c18d80d13eefac490145317d396abc 100644 --- a/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/factory/MeetingFactory.java +++ b/o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/factory/MeetingFactory.java @@ -114,7 +114,6 @@ public class MeetingFactory extends AbstractFactory { Root root = cq.from(Meeting.class); Predicate p = cb.isMember(person, root.get(Meeting_.invitePersonList)); p = cb.and(p, cb.isMember(person, root.get(Meeting_.rejectPersonList))); - p = cb.and(p, cb.lessThan(root.get(Meeting_.completedTime), new Date())); cq.select(root.get(Meeting_.id)).where(p); return em.createQuery(cq).getResultList(); } @@ -170,7 +169,7 @@ public class MeetingFactory extends AbstractFactory { cq.select(root.get(Meeting_.id)).where(p); return em.createQuery(cq).getResultList(); } - + public List listWithDateAndRoom(Date start, Date end,String roomId) throws Exception { EntityManager em = this.entityManagerContainer().get(Meeting.class); CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -181,7 +180,7 @@ public class MeetingFactory extends AbstractFactory { Predicate p = cb.greaterThanOrEqualTo(root.get(Meeting_.completedTime), start); p = cb.and(p, cb.lessThanOrEqualTo(root.get(Meeting_.completedTime), end)); p = cb.and(p, cb.equal(root.get(Meeting_.room), roomId)); - + cq.select(root.get(Meeting_.id)).where(p); return em.createQuery(cq).getResultList(); } @@ -264,4 +263,4 @@ public class MeetingFactory extends AbstractFactory { return em.createQuery(cq).setMaxResults(200).getResultList(); } -} \ No newline at end of file +} diff --git a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java index 64a5f2996e89f0271b899c6c7a1940a85214dcb2..c16b97a1340acfcc59c482828424e8bf8b8e3bbb 100644 --- a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java +++ b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.math.NumberUtils; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.entity.JpaObject; +import com.x.base.core.entity.JpaObject_; import com.x.base.core.project.bean.WrapCopier; import com.x.base.core.project.bean.WrapCopierFactory; import com.x.base.core.project.http.ActionResult; @@ -26,39 +27,38 @@ import com.x.message.core.entity.Instant_; class ActionListWithCurrentPersonWithoutIMDesc extends BaseAction { - private static final Logger LOGGER= LoggerFactory.getLogger(ActionListWithCurrentPersonWithoutIMDesc.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ActionListWithCurrentPersonWithoutIMDesc.class); - ActionResult> execute(EffectivePerson effectivePerson, Integer count) throws Exception { - - LOGGER.debug("execute:{}, count:{}.", effectivePerson::getDistinguishedName, () -> count); - - try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - Business business = new Business(emc); - ActionResult> result = new ActionResult<>(); - List wos = this.list(business, NumberUtils.min(200, NumberUtils.max(1, count)), effectivePerson); - result.setData(wos); - return result; - } - } + ActionResult> execute(EffectivePerson effectivePerson, Integer count) throws Exception { - private List list(Business business, Integer count, EffectivePerson effectivePerson) throws Exception { - EntityManager em = business.entityManagerContainer().get(Instant.class); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Instant.class); - Root root = cq.from(Instant.class); - Predicate p = cb.equal(root.get(Instant_.person), effectivePerson.getDistinguishedName()); - p = cb.and(p, cb.notEqual(root.get(Instant_.type), MessageConnector.TYPE_IM_CREATE)); - p = cb.and(p, cb.isNotEmpty(root.get(Instant_.consumerList))); - List os = em.createQuery(cq.select(root).where(p).orderBy(cb.desc(root.get(Instant_.createTime)))) - .setMaxResults(count).getResultList(); - return Wo.copier.copy(os); - } + LOGGER.debug("execute:{}, count:{}.", effectivePerson::getDistinguishedName, () -> count); - public static class Wo extends Instant { + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + Business business = new Business(emc); + ActionResult> result = new ActionResult<>(); + List wos = this.list(business, NumberUtils.min(200, NumberUtils.max(1, count)), effectivePerson); + result.setData(wos); + return result; + } + } - private static final long serialVersionUID = 681982898431236763L; - static WrapCopier copier = WrapCopierFactory.wo(Instant.class, Wo.class, null, - JpaObject.FieldsInvisible); - } + private List list(Business business, Integer count, EffectivePerson effectivePerson) throws Exception { + EntityManager em = business.entityManagerContainer().get(Instant.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Instant.class); + Root root = cq.from(Instant.class); + Predicate p = cb.equal(root.get(Instant_.person), effectivePerson.getDistinguishedName()); + p = cb.and(p, cb.notEqual(root.get(Instant_.type), MessageConnector.TYPE_IM_CREATE)); + List os = em.createQuery(cq.select(root).where(p).orderBy(cb.desc(root.get(JpaObject_.createTime)))) + .setMaxResults(count).getResultList(); + return Wo.copier.copy(os); + } + + public static class Wo extends Instant { + + private static final long serialVersionUID = 681982898431236763L; + static WrapCopier copier = WrapCopierFactory.wo(Instant.class, Wo.class, null, + JpaObject.FieldsInvisible); + } } \ No newline at end of file diff --git a/o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java b/o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java index 857d97a0a07da1c4f9cda4bce111d35ebd028c9b..e60ad65314ee3b16a8aa4f185f7f3049394dad8a 100644 --- a/o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java +++ b/o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java @@ -1,7 +1,5 @@ package com.x.message.core.entity; -import java.util.List; - import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,14 +8,9 @@ import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.Lob; -import javax.persistence.OrderColumn; import javax.persistence.Table; import javax.persistence.UniqueConstraint; -import org.apache.openjpa.persistence.PersistentCollection; -import org.apache.openjpa.persistence.jdbc.ContainerTable; -import org.apache.openjpa.persistence.jdbc.ElementColumn; -import org.apache.openjpa.persistence.jdbc.ElementIndex; import org.apache.openjpa.persistence.jdbc.Index; import com.x.base.core.entity.JpaObject; @@ -99,16 +92,6 @@ public class Instant extends SliceJpaObject { @CheckPersist(allowEmpty = false) private Boolean consumed; - public static final String consumerList_FIELDNAME = "consumerList"; - @FieldDescribe("消费对象.") - @PersistentCollection(fetch = FetchType.EAGER) - @OrderColumn(name = ORDERCOLUMNCOLUMN) - @ContainerTable(name = TABLE + ContainerTableNameMiddle - + consumerList_FIELDNAME, joinIndex = @Index(name = TABLE + consumerList_FIELDNAME + JoinIndexNameSuffix)) - @ElementColumn(length = JpaObject.length_64B, name = ColumnNamePrefix + consumerList_FIELDNAME) - @ElementIndex(name = TABLE + consumerList_FIELDNAME + ElementIndexNameSuffix) - private List consumerList; - public String getBody() { return body; } @@ -125,14 +108,6 @@ public class Instant extends SliceJpaObject { this.type = type; } - public List getConsumerList() { - return consumerList; - } - - public void setConsumerList(List consumerList) { - this.consumerList = consumerList; - } - public String getPerson() { return person; } diff --git a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java index 3f49ce8bbd9a09e4296ac48c2fd6c3488d7e026b..126d54f9d74629706e7d6ad8f9c5973ad2bea2bb 100644 --- a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java +++ b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ActionCreate.java @@ -1,8 +1,5 @@ package com.x.organization.assemble.personal.jaxrs.regist; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; - import com.google.gson.JsonElement; import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.factory.EntityManagerContainerFactory; @@ -13,21 +10,27 @@ import com.x.base.core.project.config.Config; import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.http.ActionResult; import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.WoId; import com.x.base.core.project.jaxrs.WrapBoolean; import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.tools.StringTools; +import com.x.base.core.project.x_organization_assemble_control; import com.x.organization.assemble.personal.Business; +import com.x.organization.assemble.personal.ThisApplication; import com.x.organization.core.entity.Person; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; class ActionCreate extends BaseAction { private static Logger logger = LoggerFactory.getLogger(ActionCreate.class); ActionResult execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception { + ActionResult result = new ActionResult<>(); + Wi wi = this.convertToWrapIn(jsonElement, Wi.class); + Person person; try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { - ActionResult result = new ActionResult<>(); - Wi wi = this.convertToWrapIn(jsonElement, Wi.class); Business business = new Business(emc); String name = wi.getName(); String passwd = wi.getPassword(); @@ -65,7 +68,7 @@ class ActionCreate extends BaseAction { throw new ExceptionInvalidPassword(Config.person().getPasswordRegexHint()); } if (null == genderType) { - throw new ExceptionInvalidGenderType(); + genderType = GenderType.d; } if (StringUtils.equals(com.x.base.core.project.config.Person.REGISTER_TYPE_CODE, Config.person().getRegister())) { @@ -79,15 +82,21 @@ class ActionCreate extends BaseAction { throw new ExceptionInvalidCaptcha(); } } - this.register(business, name, passwd, genderType, mobile, mail); - Wo wo = new Wo(); - wo.setValue(true); - result.setData(wo); - return result; + if(StringUtils.isNotBlank(wi.getUnit()) && business.unit().pick(wi.getUnit()) == null){ + throw new ExceptionInvalidUnit(wi.getUnit()); + } + person = this.register(business, name, passwd, genderType, mobile, mail); + } + if(StringUtils.isNotBlank(wi.getUnit())){ + this.createIdentity(person, wi.getUnit()); } + Wo wo = new Wo(); + wo.setValue(true); + result.setData(wo); + return result; } - private void register(Business business, String name, String password, GenderType genderType, String mobile, String mail) + private Person register(Business business, String name, String password, GenderType genderType, String mobile, String mail) throws Exception { Person o = new Person(); o.setName(name); @@ -98,6 +107,46 @@ class ActionCreate extends BaseAction { business.entityManagerContainer().beginTransaction(Person.class); business.entityManagerContainer().persist(o, CheckPersistType.all); business.entityManagerContainer().commit(); + return o; + } + + private void createIdentity(Person person, String unit) throws Exception { + WrapIdentity identity = new WrapIdentity(); + identity.setName(person.getName()); + identity.setPerson(person.getId()); + identity.setUnit(unit); + ThisApplication.context().applications().postQuery(x_organization_assemble_control.class, + "identity", identity); + } + + private static class WrapIdentity extends GsonPropertyObject { + private String person; + private String name; + private String unit; + + public String getPerson() { + return person; + } + + public void setPerson(String person) { + this.person = person; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } } public static class Wi extends GsonPropertyObject { @@ -126,6 +175,9 @@ class ActionCreate extends BaseAction { @FieldDescribe("邮件地址(非必填).") private String mail; + @FieldDescribe("归属组织(非必填).") + private String unit; + public String getName() { return name; } @@ -189,6 +241,14 @@ class ActionCreate extends BaseAction { public void setMail(String mail) { this.mail = mail; } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } } public static class Wo extends WrapBoolean { diff --git a/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ExceptionInvalidUnit.java b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ExceptionInvalidUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..854634263f83e528823d13c0850b3358b90b9ded --- /dev/null +++ b/o2server/x_organization_assemble_personal/src/main/java/com/x/organization/assemble/personal/jaxrs/regist/ExceptionInvalidUnit.java @@ -0,0 +1,12 @@ +package com.x.organization.assemble.personal.jaxrs.regist; + +import com.x.base.core.project.exception.PromptException; + +class ExceptionInvalidUnit extends PromptException { + + private static final long serialVersionUID = 6647381353782082070L; + + ExceptionInvalidUnit(String unit) { + super("指定的组织不存在:{}.", unit); + } +} diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/MessageFactory.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/MessageFactory.java index 9bcecc317eac8bb28edbf24f231db3fec616d71e..6cf8e88992a0b95700ce0faa5cfaabe7eaf21da8 100644 --- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/MessageFactory.java +++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/MessageFactory.java @@ -54,7 +54,7 @@ public class MessageFactory { public static void workCompleted_delete(WorkCompleted workCompleted) throws Exception { String title = "删除完成工作:" + adjustTitle(workCompleted); - MessageConnector.send(MessageConnector.TYPE_WORKCOMPLETED_CREATE, title, "", workCompleted); + MessageConnector.send(MessageConnector.TYPE_WORKCOMPLETED_DELETE, title, "", workCompleted); } public static void task_press(Task task, String from) throws Exception { @@ -242,4 +242,4 @@ public class MessageFactory { return title; } -} \ No newline at end of file +} diff --git a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/job/ActionDelete.java b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/job/ActionDelete.java index f71216a7e84de22d0a355404cfbb487b917465d6..5fb047ece6224862136f4623a7f47cfc67a47d29 100644 --- a/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/job/ActionDelete.java +++ b/o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/job/ActionDelete.java @@ -54,6 +54,7 @@ public class ActionDelete extends BaseAction { emc.beginTransaction(WorkCompleted.class); for (WorkCompleted o : emc.listEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job)) { emc.remove(o); + MessageFactory.workCompleted_delete(o); Wo wo = new Wo(); wo.setId(o.getId()); wos.add(wo); diff --git a/o2web/source/o2_core/o2/lp/en.js b/o2web/source/o2_core/o2/lp/en.js index 9266e9ca0de27e14004c9f7527c212cc1bb74640..325a139dbf7b34ce9ae79f08c99cb3ad7082c953 100644 --- a/o2web/source/o2_core/o2/lp/en.js +++ b/o2web/source/o2_core/o2/lp/en.js @@ -504,7 +504,8 @@ o2.LP.authentication = { "inputYourNewPassword" : "Enter a new password", "changePasswordSuccess" : "Successfully change password", "userAppCameraHtml" : "
open
APP
and scan
", - "loginToPage": "Login to the page" + "loginToPage": "Login to the page", + "accessError": "Failed to access background service" }; o2.LP.script = { diff --git a/o2web/source/o2_core/o2/lp/zh-cn.js b/o2web/source/o2_core/o2/lp/zh-cn.js index bbcb1fcb7072f6142bffbab43d72251c8656321a..5fdf166cc107882249ab16db7c2a026b3bdfd777 100644 --- a/o2web/source/o2_core/o2/lp/zh-cn.js +++ b/o2web/source/o2_core/o2/lp/zh-cn.js @@ -510,7 +510,8 @@ o2.LP.authentication = { "inputYourNewPassword" : "请输入新密码", "changePasswordSuccess" : "修改密码成功", "userAppCameraHtml" : "
打开
APP
扫一扫
", - "loginToPage": "登录网页版" + "loginToPage": "登录网页版", + "accessError": "访问后台服务失败" }; o2.LP.script = { diff --git a/o2web/source/o2_core/o2/xDesktop/Authentication.js b/o2web/source/o2_core/o2/xDesktop/Authentication.js index f0f091583a32d8655dcebeb3b973af4dd4823414..21bc974309a3700b1e8f6458c93d81e4d188e476 100644 --- a/o2web/source/o2_core/o2/xDesktop/Authentication.js +++ b/o2web/source/o2_core/o2/xDesktop/Authentication.js @@ -46,46 +46,62 @@ MWF.xDesktop.Authentication = new Class({ }, loadLogin: function (node) { - if(node)this.loginNode = node; - if( !node && this.loginNode )node = this.loginNode; - if (layout.config.loginPage && layout.config.loginPage.enable && layout.config.loginPage.portal) { - MWF.xDesktop.loadPortal(layout.config.loginPage.portal, this.options.loginParameter); - this.fireEvent("openLogin"); - } else { - this.popupOptions = { - "draggable": false, - "closeAction": false, - "hasMask": false, - "relativeToApp": false - }; - this.popupPara = { - container: node - }; - this.postLogin = function (json) { - layout.desktop.session.user = json.data; - layout.session.user = json.data; - layout.session.token = layout.session.user.token; - var user = layout.desktop.session.user; - if (!user.identityList) user.identityList = []; - if (user.roleList) { - var userRoleName = []; - user.roleList.each(function (role) { - userRoleName.push(role.substring(0, role.indexOf("@"))); - }); - user.roleList = user.roleList.concat(userRoleName); - } - var roleLCList = (user.roleList || []).map(function(role){ - return role.toLowerCase(); - }.bind(this)); - if( roleLCList.isIntersect(["systemmanager","securitymanager","auditmanager"]) ){ - window.location = "../x_desktop/app.html?app=ThreeMember"; - }else{ - window.location.reload(); + o2.Actions.load("x_organization_assemble_authentication").EchoAction.get(function () { + if (node) this.loginNode = node; + if (!node && this.loginNode) node = this.loginNode; + if (layout.config.loginPage && layout.config.loginPage.enable && layout.config.loginPage.portal) { + MWF.xDesktop.loadPortal(layout.config.loginPage.portal, this.options.loginParameter); + this.fireEvent("openLogin"); + } else { + this.popupOptions = { + "draggable": false, + "closeAction": false, + "hasMask": false, + "relativeToApp": false + }; + this.popupPara = { + container: node + }; + this.postLogin = function (json) { + layout.desktop.session.user = json.data; + layout.session.user = json.data; + layout.session.token = layout.session.user.token; + var user = layout.desktop.session.user; + if (!user.identityList) user.identityList = []; + if (user.roleList) { + var userRoleName = []; + user.roleList.each(function (role) { + userRoleName.push(role.substring(0, role.indexOf("@"))); + }); + user.roleList = user.roleList.concat(userRoleName); + } + var roleLCList = (user.roleList || []).map(function (role) { + return role.toLowerCase(); + }.bind(this)); + if (roleLCList.isIntersect(["systemmanager", "securitymanager", "auditmanager"])) { + window.location = "../x_desktop/app.html?app=ThreeMember"; + } else { + window.location.reload(); + } + }.bind(this); + this.openLoginForm(this.popupOptions); + this.fireEvent("openLogin"); + } + }.bind(this), function (xhr) { + var message; + if (xhr) { + try { + var responseJSON = JSON.parse(xhr.responseText); + message = responseJSON.message; //message为错误提示文本 + } catch (e) { } - }.bind(this); - this.openLoginForm(this.popupOptions); - this.fireEvent("openLogin"); - } + } + if (!message) message = MWF.LP.authentication.accessError; + new Element("div", { + "style": "font-size:16px;font-weight:bold;", + "text": message + }).inject(node); + }.bind(this)); }, safeLogout: function(){ o2.Actions.get("x_organization_assemble_authentication").safeLogout(function () { diff --git a/o2web/source/o2_core/o2/xScript/PageEnvironment.js b/o2web/source/o2_core/o2/xScript/PageEnvironment.js index 4537f4a7568e891d61f2d5fde5bc3957db9e56a7..f4d1bbfa0aaeb62a7196c95fa6cabec9777aada7 100644 --- a/o2web/source/o2_core/o2/xScript/PageEnvironment.js +++ b/o2web/source/o2_core/o2/xScript/PageEnvironment.js @@ -2061,7 +2061,14 @@ if (!MWF.xScript || !MWF.xScript.PageEnvironment) { if (category) { options["category"] = category } - if (window.o2android && window.o2android.createO2CmsDocument){ + if (window.o2android && window.o2android.postMessage) { + var body = { + type: "createO2CmsDocument", + data: options + }; + window.o2android.postMessage(JSON.stringify(body)); + return; + } else if (window.o2android && window.o2android.createO2CmsDocument){ window.o2android.createO2CmsDocument(JSON.stringify(options)); return; } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.createO2CmsDocument) { diff --git a/o2web/source/o2_core/o2/xScript/ViewEnvironment.js b/o2web/source/o2_core/o2/xScript/ViewEnvironment.js index fd5515043aebe73e0e1e98ec373ce3fa17e5972e..e215f1a76e82d4993bac5c6e800334346f84e9bf 100644 --- a/o2web/source/o2_core/o2/xScript/ViewEnvironment.js +++ b/o2web/source/o2_core/o2/xScript/ViewEnvironment.js @@ -4569,7 +4569,14 @@ MWF.xScript.ViewEnvironment = function (ev) { if (category) { options["category"] = category } - if (window.o2android && window.o2android.createO2CmsDocument){ + if (window.o2android && window.o2android.postMessage) { + var body = { + type: "createO2CmsDocument", + data: options + }; + window.o2android.postMessage(JSON.stringify(body)); + return; + } else if (window.o2android && window.o2android.createO2CmsDocument){ window.o2android.createO2CmsDocument(JSON.stringify(options)); return; } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.createO2CmsDocument) { diff --git a/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_mobile.json b/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_mobile.json index b10f8ae9cad5a8a4d1229693debfab2d38ad0648..e73cabf8db8add618a41ba9dd83fa3c8940e20c3 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_mobile.json +++ b/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_mobile.json @@ -120,7 +120,7 @@ "overflow": "hidden", "min-height": "40px", "background-color": "#ffffff", - "padding": "0xp 20px" + "padding": "0px 20px" }, "preprocessing": "y" }, @@ -138,7 +138,7 @@ "overflow": "hidden", "min-height": "40px", "background-color": "#ffffff", - "padding": "0xp 20px" + "padding": "0px 20px" }, "preprocessing": "y" }, @@ -511,10 +511,10 @@ "html": "" }, "events": { - "queryLoad": { - "code": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessorMobile\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nthis.define(\"popupProcessorMobile\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nwindow.O2ProcessorMobile = new Class({\r\n Implements: [Events],\r\n initialize: function (macro) {\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = $(document.body); //this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant: function () {\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n },\r\n load: function () {\r\n if ( this.status === \"show\" || this.status === \"loading\" ){\r\n\r\n }else if (this.status === \"closed\" ) {\r\n this.node.show();\r\n // this.positionSeted = false; //重新设置位置\r\n // this.setSize( this.getCurrentRouteOrgList().length );\r\n this.status = \"show\";\r\n } else {\r\n this.status = \"loading\";\r\n this.container = new Element(\"div\").inject(this.appContentNode);\r\n this.node.setStyles({\r\n \"width\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"z-index\" : \"101\"\r\n })\r\n this.loadContent();\r\n this.setEvents();\r\n this.node.inject(this.container);\r\n this.status = \"show\";\r\n }\r\n },\r\n loadContent: function () {\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if (orgLength === 0) { //流程选人数量为0\r\n if (this.orgsTile) {\r\n this.orgsTile.destroy();\r\n this.orgsTile = null;\r\n }\r\n if (this.orgsArea) {\r\n this.orgsArea.destroy();\r\n this.orgsArea = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if (this.hasDecisionOpinion) { //有决策组\r\n this.setRouteGroupList();\r\n } else { //没有决策组\r\n if (this.routeGroupTitle) {\r\n this.routeGroupTitle.destroy();\r\n this.routeGroupTitle = null;\r\n }\r\n if (this.routeGroupArea) {\r\n this.routeGroupArea.destroy();\r\n this.routeGroupArea = null;\r\n }\r\n // this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n // if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n // this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n // }\r\n this.setRouteList();\r\n }\r\n },\r\n\r\n getAllNode: function () {\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n\r\n this.routeGroupTitle = this.getNode(\"routeGroupTitle\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitle = this.getNode(\"routeSelectorTitle\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNode = this.getNode(\"inputOpinionNode\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n\r\n this.orgsTile = this.getNode(\"orgsTile\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.buttonsArea = this.getNode(\"submitButtonNode\");\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEvents: function () {\r\n if (this.cancelButton) {\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if (this.okButton) {\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n getNode: function (name) {\r\n if (this.macro.form.get(name)) {\r\n return this.macro.form.get(name).node;\r\n }\r\n if (this.form.allForName[name]) {\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData: function (name, value) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData: function (name) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList: function () { //获取当前待办的所有路由设置\r\n if (!this.routeConfigList) {\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute({\"valueList\": this.task.routeList}, function (json) {\r\n json.data.each(function (d) {\r\n d.selectConfigList = JSON.parse(d.selectConfig || \"[]\");\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false);\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig: function (routeId) { //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i];\r\n }\r\n }\r\n },\r\n getMaxOrgLength: function () { //获取当前待办下可能的最多选人组件个数\r\n var routeList = this.getRouteConfigList();\r\n var length = 0;\r\n routeList.each(function (route) {\r\n if (route.hiddenScriptText) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n length = Math.max(length, route.selectConfigList.length);\r\n }.bind(this));\r\n return length;\r\n },\r\n getOrgConfig: function (routeId) { //获取人员选择配置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i].selectConfigList;\r\n }\r\n }\r\n },\r\n getCurrentRouteSelectorList: function () { //获取当前路由的人员选择器对象\r\n var selectorList = [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n if (!orgList) return [];\r\n orgList.each(function (org) {\r\n if (org.selector && org.selector.selector) {\r\n selectorList.push(org.selector.selector);\r\n }\r\n }.bind(this))\r\n return selectorList;\r\n },\r\n getCurrentRouteOrgList: function () { //获取当前路由的org对象\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n return orgList || [];\r\n },\r\n getSelectorSelectedData: function (filedName) { //获取人员选择器选择的值\r\n var data = [];\r\n var orgList = this.getCurrentRouteOrgList();\r\n for (var i = 0; i < orgList.length; i++) {\r\n var org = orgList[i];\r\n if (org.json.name === filedName) {\r\n var selector = org.selector.selector;\r\n selector.selectedItems.each(function (item) {\r\n data.push(item.data)\r\n })\r\n }\r\n }\r\n return data;\r\n },\r\n getMarginY: function (node) {\r\n return (node.getStyle(\"margin-top\").toInt() || 0) +\r\n (node.getStyle(\"margin-bottom\").toInt() || 0);\r\n // (node.getStyle(\"padding-top\").toInt() || 0 ) +\r\n // (node.getStyle(\"padding-bottom\").toInt() || 0 )+\r\n // (node.getStyle(\"border-top-width\").toInt() || 0 ) +\r\n // (node.getStyle(\"border-bottom-width\").toInt() || 0 );\r\n },\r\n setSize: function (currentOrgLength) {\r\n var lines = ((currentOrgLength + 1) / 2).toInt();\r\n\r\n if (lines > 0) {\r\n this.showOrgsArea();\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n if (this.buttonsArea) {\r\n var bodySize = this.appContentNode.getSize();\r\n var nodeHeight = bodySize.y - this.getMarginY(this.node);\r\n this.node.setStyles({\r\n \"overflow-y\": \"hidden\",\r\n \"height\": nodeHeight\r\n });\r\n var buttonsAreaSize = this.buttonsArea.getSize();\r\n this.contentNode.setStyles({\r\n \"height\": nodeHeight - buttonsAreaSize.y - this.getMarginY(this.buttonsArea) - this.getMarginY(this.contentNode),\r\n \"overflow-y\": \"auto\"\r\n })\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n showOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.show();\r\n if (this.orgsArea) this.orgsArea.show();\r\n },\r\n hideOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.hide();\r\n if (this.orgsArea) this.orgsArea.hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList: function () { //获取决策组并格式化成对象\r\n if (this.routeGroupObject) return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function (route, i) {\r\n\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n } else {\r\n route.displayName = route.name;\r\n }\r\n\r\n if (route.decisionOpinion) { //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each(function (decisionOption) {\r\n this.routeGroupNameList.combine([decisionOption]);\r\n var d = this.splitByStartNumber(decisionOption);\r\n if (!this.routeGroupObject[d.name]) this.routeGroupObject[d.name] = [];\r\n this.routeGroupObject[d.name].push(route);\r\n }.bind(this))\r\n } else {\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine([defaultName]);\r\n if (!this.routeGroupObject[defaultName]) this.routeGroupObject[defaultName] = [];\r\n this.routeGroupObject[defaultName].push(route);\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber: function (str) {\r\n var obj = {\r\n name: \"\",\r\n order: \"\"\r\n };\r\n for (var i = 0; i < str.length; i++) {\r\n if (parseInt(str.substr(i, 1)).toString() !== \"NaN\") {\r\n obj.order = obj.order + str.substr(i, 1);\r\n } else {\r\n obj.name = str.substr(i, str.length);\r\n break;\r\n }\r\n }\r\n return obj;\r\n },\r\n setRouteGroupList: function () { //排序并创建决策组DOM对象\r\n var _self = this;\r\n\r\n //根据决策组的排序号进行排序\r\n var keys = this.routeGroupNameList;\r\n keys.sort(function (a, b) {\r\n var aIdx = parseInt(this.splitByStartNumber(a).order || \"9999999\");\r\n var bIdx = parseInt(this.splitByStartNumber(b).order || \"9999999\");\r\n return aIdx - bIdx;\r\n }.bind(this));\r\n\r\n var list = [];\r\n keys.each(function (k) {\r\n list.push(this.splitByStartNumber(k).name)\r\n }.bind(this));\r\n\r\n debugger;\r\n var flag = false;\r\n list.each(function (routeGroupName) {\r\n var routeList = this.routeGroupObject[routeGroupName];\r\n var routeGroupNode = new Element(\"div\", {\r\n \"styles\": this.css.routeGroupNode,\r\n \"text\": routeGroupName\r\n }).inject(this.routeGroupArea);\r\n routeGroupNode.store(\"routeList\", routeList);\r\n routeGroupNode.store(\"routeGroupName\", routeGroupName);\r\n\r\n routeGroupNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRouteGroup(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRouteGroup(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRouteGroup(this);\r\n }\r\n });\r\n\r\n if (keys.length === 1) { //如果决策组只有1个,则默认选中\r\n this.selectRouteGroup(routeGroupNode);\r\n flag = false;\r\n } else {\r\n flag = true;\r\n }\r\n }.bind(this))\r\n if(flag){\r\n this.setSize(0);\r\n }\r\n },\r\n overRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n },\r\n outRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n },\r\n selectRouteGroup: function (node) { //选中决策组执行...\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode);\r\n //this.selectedRouteGroup.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRouteGroup = node;\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode_selected);\r\n //this.selectedRouteGroup.addClass(\"mainColor_bg\");\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n\r\n } else {\r\n\r\n }\r\n } else {\r\n this.selectedRouteGroup = node;\r\n node.setStyles(this.css.routeGroupNode_selected);\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n }\r\n this.routeGroupArea.setStyle(\"background-color\", \"#FFF\");\r\n },\r\n setRouteList: function (routeList) { //创建决策对象\r\n var _self = this;\r\n this.routeSelectorArea.empty();\r\n this.selectedRoute = null;\r\n\r\n if (!routeList) routeList = this.getRouteConfigList();\r\n var isSelected = false;\r\n routeList.each(function (route, i) {\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n var routeName = route.name;\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n routeName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }\r\n var routeNode = new Element(\"div\", {\r\n \"styles\": this.css.routeNode,\r\n \"text\": routeName\r\n }).inject(this.routeSelectorArea);\r\n routeNode.store(\"route\", route.id);\r\n routeNode.store(\"routeName\", route.name);\r\n\r\n routeNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRoute(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRoute(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRoute(this);\r\n }\r\n });\r\n\r\n if (routeList.length == 1 || route.sole) { //sole表示优先路由\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n }\r\n\r\n }.bind(this));\r\n if (!isSelected) {\r\n this.setSize(0);\r\n }\r\n },\r\n overRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n },\r\n outRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n },\r\n getDefaultOpinion: function( node ){\r\n var routeId = node.retrieve(\"route\");\r\n var routeDate = this.getRouteConfig( routeId );\r\n return routeDate.opinion || \"\";\r\n },\r\n selectRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n if( this.getData(\"inputTextarea\") === this.getDefaultOpinion( this.selectedRoute ) ||\r\n this.getData(\"inputTextarea\") === \"\"\r\n ){\r\n this.setData( \"inputTextarea\", this.getDefaultOpinion(node) || \"\" );\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n\r\n } else {\r\n if ( this.getData(\"inputTextarea\") === this.getDefaultOpinion(this.selectedRoute)) {\r\n this.setData( \"inputTextarea\", \"\");\r\n }\r\n\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.addClass(\"lightColor_bg\");\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRoute = null;\r\n }\r\n } else {\r\n if (this.getData(\"inputTextarea\") === \"\") {\r\n var defaultOpinion1 = this.getDefaultOpinion(node);\r\n if (defaultOpinion1) this.setData( \"inputTextarea\", defaultOpinion1);\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#FFF\");\r\n\r\n this.loadOrgs(this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\");\r\n\r\n if (this.form.data.json.events && this.form.data.json.events.afterSelectRoute) {\r\n this.form.Macro.exec(this.form.data.json.events.afterSelectRoute.code, node);\r\n }\r\n\r\n },\r\n /*决策和决策组相关 结束*/\r\n\r\n setOpinion: function () {\r\n if (!this.inputTextarea) return;\r\n if (this.handwritingAction) this.handwritingAction.addEvent(\"click\", function () {\r\n window.setTimeout( function(){\r\n this.handwriting();\r\n }.bind(this), 100 )\r\n }.bind(this));\r\n\r\n if (this.selectIdeaAreaNode) {\r\n MWF.require(\"MWF.widget.UUID\", function () {\r\n MWF.UD.getDataJson(\"idea\", function (json) {\r\n if (json) {\r\n if (json.ideas) {\r\n this.setIdeaList(json.ideas);\r\n }\r\n } else {\r\n MWF.UD.getPublicData(\"idea\", function (pjson) {\r\n if (pjson) {\r\n if (pjson.ideas) {\r\n this.setIdeaList(pjson.ideas);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n }.bind(this));\r\n }.bind(this));\r\n }\r\n\r\n },\r\n\r\n audioRecord: function () {\r\n if (!this.audioRecordNode) this.createAudioRecord();\r\n this.audioRecordNode.show();\r\n this.audioRecordNode.position({\r\n \"relativeTo\": this.options.mediaNode || this.node,\r\n \"position\": \"center\",\r\n \"edge\": \"center\"\r\n });\r\n\r\n MWF.require(\"MWF.widget.AudioRecorder\", function () {\r\n this.audioRecorder = new MWF.widget.AudioRecorder(this.audioRecordNode, {\r\n \"onSave\": function (blobFile) {\r\n this.soundFile = blobFile;\r\n this.audioRecordNode.hide();\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.soundFile = null;\r\n this.audioRecordNode.hide();\r\n }.bind(this)\r\n }, null);\r\n }.bind(this));\r\n },\r\n createAudioRecord: function () {\r\n this.audioRecordNode = new Element(\"div\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n var size = (this.options.mediaNode || this.node).getSize();\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.audioRecordNode.setStyles({\r\n \"height\": \"\" + size.y + \"px\",\r\n \"width\": \"\" + size.x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n },\r\n\r\n handwriting: function () {\r\n if (!this.handwritingNode) this.createHandwriting();\r\n if(this.handwritingNodeMask)this.handwritingNodeMask.show();\r\n this.handwritingNode.show();\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n },\r\n createHandwriting: function () {\r\n this.handwritingNodeMask = new Element(\"div.handwritingMask\", {\"styles\": this.css.handwritingMask}).inject(this.node);\r\n\r\n this.handwritingNode = new Element(\"div.handwritingNode\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n //var size = (this.options.mediaNode || this.node).getSize();\r\n //var y = size.y;\r\n //var x = size.x;\r\n //兼容以前的默认高宽\r\n\r\n debugger;\r\n\r\n var bodySize = $(document.body).getSize();\r\n var x = bodySize.x;\r\n var y = bodySize.y;\r\n\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.handwritingNode.setStyles({\r\n \"height\": \"\" + y + \"px\",\r\n \"width\": \"\" + x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n this.handwritingNode.addEvent('touchmove' , function(e){\r\n e.preventDefault();\r\n });\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n this.handwritingAreaNode = new Element(\"div\", {\"styles\": this.css.handwritingAreaNode}).inject(this.handwritingNode);\r\n // this.handwritingActionNode = new Element(\"div\", {\r\n // \"styles\": this.css.handwritingActionNode,\r\n // \"text\": MWF.xApplication.process.Work.LP.saveWrite\r\n // }).inject(this.handwritingNode);\r\n // var h = this.handwritingActionNode.getSize().y + this.handwritingActionNode.getStyle(\"margin-top\").toInt() + this.handwritingActionNode.getStyle(\"margin-bottom\").toInt();\r\n // h = y - h;\r\n // this.handwritingAreaNode.setStyle(\"height\", \"\" + h + \"px\");\r\n this.handwritingAreaNode.setStyle(\"height\", \"\" + y + \"px\");\r\n\r\n MWF.require(\"MWF.widget.Tablet\", function () {\r\n var handWritingOptions = {\r\n \"style\": \"default\",\r\n \"contentWidth\": 0,\r\n \"contentHeight\": 0,\r\n \"onSave\": function (base64code, base64Image, imageFile) {\r\n this.handwritingFile = imageFile;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n // this.page.get(\"div_image\").node.set(\"src\",base64Image);\r\n\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.handwritingFile = null;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n }.bind(this)\r\n };\r\n handWritingOptions.tools = [\r\n \"undo\",\r\n \"redo\", \"|\",\r\n \"reset\", \"|\",\r\n \"size\",\r\n \"cancel\"\r\n ]\r\n this.tablet = new MWF.widget.Tablet(this.handwritingAreaNode, handWritingOptions, null);\r\n this.tablet.load();\r\n }.bind(this));\r\n\r\n // this.handwritingActionNode.addEvent(\"click\", function () {\r\n // //this.handwritingNode.hide();\r\n // if (this.tablet) this.tablet.save();\r\n // }.bind(this));\r\n },\r\n\r\n setIdeaList: function (ideas) {\r\n var _self = this;\r\n ideas.each(function (idea) {\r\n new Element(\"div\", {\r\n \"styles\": this.css.selectIdeaItemNode,\r\n \"text\": idea,\r\n \"events\": {\r\n \"click\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"dblclick\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"mouseover\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode_over);\r\n },\r\n \"mouseout\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode);\r\n }\r\n }\r\n }).inject(this.selectIdeaAreaNode);\r\n }.bind(this));\r\n },\r\n submit: function (ev) {\r\n if (this.hasDecisionOpinion && !this.selectedRouteGroup) {\r\n this.routeGroupArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"top\"},\r\n \"请先选择决策组\",\r\n this.routeGroupArea,\r\n null, //{\"x\": 0, \"y\": 30}\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n\r\n if (!this.selectedRoute) {\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.routeSelectorArea,\r\n delayClose: 6000,\r\n content: \"请先选择决策\"\r\n });\r\n return false;\r\n }\r\n var routeName = this.selectedRoute.retrieve(\"routeName\") || this.selectedRoute.get(\"text\");\r\n var opinion = this.getData(\"inputTextarea\");\r\n if (opinion === MWF.xApplication.process.Work.LP.inputText) opinion = \"\";\r\n var medias = [];\r\n if (this.handwritingFile) medias.push(this.handwritingFile);\r\n if (this.soundFile) medias.push(this.soundFile);\r\n if (this.videoFile) medias.push(this.videoFile);\r\n\r\n var currentRouteId = this.selectedRoute.retrieve(\"route\");\r\n var routeConfig = this.getRouteConfig(currentRouteId);\r\n if (!opinion && medias.length === 0) {\r\n if (routeConfig.opinionRequired == true) {\r\n this.inputTextarea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.inputTextarea,\r\n delayClose: 6000,\r\n content: \"请填写意见\"\r\n });\r\n return false;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: validation\r\n });\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: \"路由校验失败\"\r\n });\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n //var array = [routeName, opinion, medias];\r\n //this.node.mask({\r\n // \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n // \"destroyOnHide\": true,\r\n // \"style\": {\r\n // \"background-color\": \"#999\",\r\n // \"opacity\": 0.3,\r\n // \"z-index\":600\r\n // }\r\n //});\r\n //this.fireEvent(\"submit\", array );\r\n\r\n var appendTaskOrgItem;\r\n if (routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\") {\r\n if (!this.orgItems || this.orgItems.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"没有配置转交人,请联系管理员\" //\"没有配置转交人,请联系管理员\"\r\n });\r\n return false;\r\n } else {\r\n appendTaskOrgItem = this.orgItems[0]\r\n }\r\n }\r\n\r\n if (!this.saveOrgs()) return false;\r\n\r\n //this.saveOrgsWithCheckEmpower( function(){\r\n var appandTaskIdentityList;\r\n if (appendTaskOrgItem) {\r\n appandTaskIdentityList = appendTaskOrgItem.getData();\r\n if (!appandTaskIdentityList || appandTaskIdentityList.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"请选择转交人\"\r\n });\r\n return;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n validation,\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n \"路由校验失败\",\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n this.node.mask({\r\n \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n \"destroyOnHide\": true,\r\n \"style\": {\r\n \"background-color\": \"#999\",\r\n \"opacity\": 0.3,\r\n \"z-index\": 600\r\n }\r\n });\r\n\r\n // var array = [ routeName, opinion, medias, appandTaskIdentityList, this.orgItems, function(){\r\n // if(appendTaskOrgItem)appendTaskOrgItem.setData([]);\r\n // }];\r\n\r\n var op = this.form.getOpinion();\r\n var mds = op.medias;\r\n\r\n if (!medias || !medias.length) {\r\n medias = mds;\r\n } else {\r\n medias = medias.concat(mds)\r\n }\r\n\r\n this.form.submitWork(routeName, opinion, medias, function () {\r\n this.close();\r\n }.bind(this), this, null, appandTaskIdentityList, this.orgItems, function () {\r\n if (appendTaskOrgItem) appendTaskOrgItem.setData([]);\r\n this.setData(\"inputTextarea\", \"\");\r\n }.bind(this));\r\n\r\n // this.fireEvent(\"submit\", array );\r\n },\r\n\r\n close: function () {\r\n this.node.setStyle(\"display\", \"none\");\r\n this.status = \"closed\";\r\n },\r\n destroy: function () {\r\n // this.node.empty();\r\n // delete this.task;\r\n // delete this.node;\r\n // delete this.routeSelectorTile;\r\n // delete this.routeSelectorArea;\r\n // delete this.routeOpinionTile;\r\n // delete this.routeOpinionArea;\r\n // delete this.buttonsArea;\r\n // delete this.inputOpinionNode;\r\n // delete this.inputTextarea;\r\n // delete this.cancelButton;\r\n // delete this.okButton;\r\n },\r\n loadOrgs: function (route) {\r\n if (!this.form || !route) {\r\n this.hideOrgsArea();\r\n return;\r\n } else {\r\n this.showOrgsArea();\r\n }\r\n if (!this.orgTableObject) this.orgTableObject = {};\r\n if (!this.orgItemsObject) this.orgItemsObject = {};\r\n var isLoaded = false;\r\n for (var key in this.orgTableObject) {\r\n if (route === key) {\r\n this.orgTableObject[key].show();\r\n this.orgItems = this.orgItemsObject[key] || [];\r\n var data = this.getOrgConfig(route);\r\n isLoaded = true;\r\n } else {\r\n this.orgTableObject[key].hide();\r\n }\r\n }\r\n if (isLoaded) return;\r\n\r\n this.orgItems = [];\r\n this.orgItemsObject[route] = this.orgItems;\r\n\r\n var data = this.getOrgConfig(route);\r\n var routeConfig = this.getRouteConfig(route);\r\n var ignoreFirstOrgOldData = false; //(routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\");\r\n this.setSize(data.length);\r\n if (data.length) {\r\n this.showOrgsArea();\r\n\r\n var routeOrgTable = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTable\r\n }).inject(this.orgsArea);\r\n this.orgTableObject[route] = routeOrgTable;\r\n\r\n data.each(function (config, i) {\r\n var sNode = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTr\r\n }).inject(routeOrgTable);\r\n this.loadOrg(sNode, config, ignoreFirstOrgOldData && i == 0)\r\n }.bind(this))\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n },\r\n loadOrg: function (container, json, position, ignoreOldData) {\r\n var titleNode = new Element(\"div.selectorTitle\", {\r\n \"styles\": this.css.selectorTitle\r\n }).inject(container);\r\n var titleTextNode = new Element(\"div.selectorTitleText\", {\r\n \"text\": json.title,\r\n \"styles\": this.css.selectorTitleText\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.selectorContent\", {\r\n \"styles\": this.css.selectorContent\r\n }).inject(container);\r\n\r\n var errorNode = new Element(\"div.selectorErrorNode\", {\r\n \"styles\": this.css.selectorErrorNode\r\n }).inject(container);\r\n\r\n var org = new O2ProcessorMobile.Org(contentNode, this.form, json, this, {\r\n onSelect: function (items, data) {\r\n if (!data || !data.length) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n } else {\r\n contentNode.setStyles(this.css.selectorContent);\r\n }\r\n }.bind(this)\r\n });\r\n org.ignoreOldData = ignoreOldData;\r\n org.errContainer = errorNode;\r\n org.summitDlalog = this;\r\n this.orgItems.push(org);\r\n\r\n titleNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n contentNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n\r\n var defaultValue = org.getValue();\r\n org.loadOrgWidget(defaultValue, contentNode);\r\n if (!defaultValue || defaultValue.length == 0) {\r\n {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n }\r\n }\r\n\r\n },\r\n validationOrgs: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.validation()) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n isOrgsHasEmpower: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = false;\r\n this.needCheckEmpowerOrg = [];\r\n this.orgItems.each(function (item) {\r\n if (item.hasEmpowerIdentity()) {\r\n this.needCheckEmpowerOrg.push(item);\r\n flag = true;\r\n }\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgs: function (keepSilent) {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.save(!keepSilent)) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgsWithCheckEmpower: function (callback) {\r\n debugger;\r\n if (!this.orgItems || !this.orgItems.length) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n if (!this.validationOrgs()) return false;\r\n if (!this.isOrgsHasEmpower()) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n //this.checkEmpowerMode = true;\r\n this.showEmpowerDlg(callback);\r\n },\r\n showEmpowerDlg: function (callback) {\r\n\r\n //this.needCheckEmpowerOrg.each( function(org){\r\n // org.saveCheckedEmpowerData();\r\n //}.bind(this));\r\n\r\n var empowerNode = new Element(\"div.empowerNode\", {\"styles\": this.css.empowerNode});\r\n var empowerTitleNode = new Element(\"div\", {\r\n text: \"下列人员对工作进行了授权,选择后文件将发送给被授权人,取消选择后文件将发送给授权者本人\",\r\n styles: this.css.empowerTitleNode\r\n }).inject(empowerNode);\r\n\r\n var orgs = this.needCheckEmpowerOrg;\r\n var len = orgs.length;\r\n var lines = ((len + 1) / 2).toInt();\r\n\r\n var empowerTable = new Element(\"table\", {\r\n \"cellspacing\": 0, \"cellpadding\": 0, \"border\": 0, \"width\": \"100%\",\r\n \"styles\": this.css.empowerTable\r\n }).inject(empowerNode);\r\n\r\n for (var n = 0; n < lines; n++) {\r\n var tr = new Element(\"tr\").inject(empowerTable);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerOddTd}).inject(tr);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerEvenTd}).inject(tr);\r\n }\r\n\r\n var trs = empowerTable.getElements(\"tr\");\r\n orgs.each(function (org, i) {\r\n var sNode;\r\n var width;\r\n if (i + 1 == len && (len % 2 === 1)) {\r\n sNode = trs[trs.length - 1].getFirst(\"td\");\r\n sNode.set(\"colspan\", 2);\r\n trs[trs.length - 1].getLast(\"td\").destroy();\r\n width = \"50%\";\r\n } else {\r\n var row = ((i + 2) / 2).toInt();\r\n var tr = trs[row - 1];\r\n sNode = (i % 2 === 0) ? tr.getFirst(\"td\") : tr.getLast(\"td\");\r\n }\r\n\r\n var titleNode = new Element(\"div.empowerAreaTitle\", {\r\n \"styles\": this.css.empowerAreaTitle\r\n }).inject(sNode);\r\n\r\n var titleTextNode = new Element(\"div.empowerAreaTitleText\", {\r\n \"text\": org.json.title,\r\n \"styles\": this.css.empowerAreaTitleText\r\n }).inject(titleNode);\r\n\r\n var selectAllNode = new Element(\"div\", {\r\n styles: {\r\n float: \"right\"\r\n }\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.empowerAreaContent\", {\r\n \"styles\": this.css.empowerAreaContent\r\n }).inject(sNode);\r\n\r\n org.loadCheckEmpower(null, contentNode, selectAllNode);\r\n\r\n }.bind(this));\r\n\r\n empowerNode.setStyle(\"height\", lines * this.options.orgHeight + 20);\r\n //var dlgHeight = Math.min( Math.floor( this.form.app.content.getSize().y * 0.9) , lines*this.options.orgHeight + 151 );\r\n\r\n //var width = this.node.retrieve(\"width\");\r\n //empowerNode.setStyle( \"width\", width );\r\n var width = \"880\";\r\n //if( len > 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle(\"width\", width + \"px\");\r\n\r\n this.node.getParent().mask({\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\": false,\r\n \"buttonList\": [\r\n {\r\n \"type\": \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function (d, e) {\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each(function (org, i) {\r\n org.saveCheckedEmpowerData(function () {\r\n if (i === orgs.length - 1) {\r\n if (callback) callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\": \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function () {\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss: function () {\r\n this.css = {\r\n\r\n \"routeGroupNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\": \"28px\",\r\n \"color\": \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"border-radius\": \"5px\",\r\n \"height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-left\": \"26px\",\r\n \"padding-right\": \"8px\",\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\": {\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\": {\r\n \"color\": \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#3296FA\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"padding\": \"4px 4px 4px 4px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background\": \"#ffffff\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"height\": \"3em\",\r\n \"line-height\": \"3em\",\r\n \"margin\": \"5px auto\",\r\n \"border-radius\": \"5px\",\r\n \"border\": \"1px solid #3296FA\",\r\n \"background-color\": \"#3296FA\",\r\n \"text-align\": \"center\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\"\r\n },\r\n\r\n \"inputOpinionAudioRecordAction\": {\r\n \"display\": \"none\",\r\n \"float\": \"right\",\r\n \"border\": \"1px solid #6681a5\",\r\n \"border-radius\": \"3px\",\r\n \"cursor\": \"pointer\",\r\n \"padding-left\": \"24px\",\r\n \"padding-right\": \"5px\",\r\n \"margin-left\": \"5px\",\r\n \"background\": \"url(\" + \"/x_component_process_Work/$Processor/default/audioRecord.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeOrgTable\": {},\r\n \"routeOrgTr\": {\r\n \"margin-bottom\": \"10px\"\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n\r\n \"selectorTitle\": {\r\n \"padding\": \"0px 4px\",\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"font-size\": \"14px\",\r\n // \"font-weight\": \"bold\",\r\n \"color\": \"#000\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/mobile/arrow_right2.png) no-repeat right 10px center\",\r\n \"background-color\": \"#fff\"\r\n },\r\n \"selectorTitle_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"selectorTitleText\": {\r\n// \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\": {\r\n //\"float\" : \"right\",\r\n \"background-color\": \"#fff\",\r\n \"margin-right\": \"5px\",\r\n \"font-weight\": \"normal\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"background-color\": \"#fff\",\r\n \"padding\": \"0px 5px 5px 5px\"\r\n },\r\n \"selectorContent_noItem\": {\r\n \"padding\": \"0px\"\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\n\r\nO2ProcessorMobile.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n setTimeout( function(){ //如果有输入法界面,这个时候页面的计算不对,所以等100毫秒\r\n var options = this.getOptions();\r\n if(options){\r\n //this.selector = new MWF.O2Selector(this.container, options);\r\n this.selector = new MWF.O2Selector($(document.body), options);\r\n }\r\n }.bind(this), 100 )\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2ProcessorMobile.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2ProcessorMobile.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"default\",\r\n \"zIndex\" : 3000\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n var mobileEvents = {\r\n \"onComplete\": function(items){\r\n this.selectOnComplete(items);\r\n }.bind(this),\r\n \"onCancel\": this.selectOnCancel.bind(this),\r\n \"onClose\": this.selectOnClose.bind(this)\r\n };\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n mobileEvents,\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue();\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n resetData: function(){\r\n var v = this.getValue();\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n return this.getValue();\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2ProcessorMobile.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2ProcessorMobile.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});", - "html": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessorMobile\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nthis.define(\"popupProcessorMobile\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nwindow.O2ProcessorMobile = new Class({\r\n Implements: [Events],\r\n initialize: function (macro) {\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = $(document.body); //this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant: function () {\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n },\r\n load: function () {\r\n if ( this.status === \"show\" || this.status === \"loading\" ){\r\n\r\n }else if (this.status === \"closed\" ) {\r\n this.node.show();\r\n // this.positionSeted = false; //重新设置位置\r\n // this.setSize( this.getCurrentRouteOrgList().length );\r\n this.status = \"show\";\r\n } else {\r\n this.status = \"loading\";\r\n this.container = new Element(\"div\").inject(this.appContentNode);\r\n this.node.setStyles({\r\n \"width\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"z-index\" : \"101\"\r\n })\r\n this.loadContent();\r\n this.setEvents();\r\n this.node.inject(this.container);\r\n this.status = \"show\";\r\n }\r\n },\r\n loadContent: function () {\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if (orgLength === 0) { //流程选人数量为0\r\n if (this.orgsTile) {\r\n this.orgsTile.destroy();\r\n this.orgsTile = null;\r\n }\r\n if (this.orgsArea) {\r\n this.orgsArea.destroy();\r\n this.orgsArea = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if (this.hasDecisionOpinion) { //有决策组\r\n this.setRouteGroupList();\r\n } else { //没有决策组\r\n if (this.routeGroupTitle) {\r\n this.routeGroupTitle.destroy();\r\n this.routeGroupTitle = null;\r\n }\r\n if (this.routeGroupArea) {\r\n this.routeGroupArea.destroy();\r\n this.routeGroupArea = null;\r\n }\r\n // this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n // if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n // this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n // }\r\n this.setRouteList();\r\n }\r\n },\r\n\r\n getAllNode: function () {\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n\r\n this.routeGroupTitle = this.getNode(\"routeGroupTitle\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitle = this.getNode(\"routeSelectorTitle\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNode = this.getNode(\"inputOpinionNode\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n\r\n this.orgsTile = this.getNode(\"orgsTile\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.buttonsArea = this.getNode(\"submitButtonNode\");\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEvents: function () {\r\n if (this.cancelButton) {\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if (this.okButton) {\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n getNode: function (name) {\r\n if (this.macro.form.get(name)) {\r\n return this.macro.form.get(name).node;\r\n }\r\n if (this.form.allForName[name]) {\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData: function (name, value) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData: function (name) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList: function () { //获取当前待办的所有路由设置\r\n if (!this.routeConfigList) {\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute({\"valueList\": this.task.routeList}, function (json) {\r\n json.data.each(function (d) {\r\n d.selectConfigList = JSON.parse(d.selectConfig || \"[]\");\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false);\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig: function (routeId) { //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i];\r\n }\r\n }\r\n },\r\n getMaxOrgLength: function () { //获取当前待办下可能的最多选人组件个数\r\n var routeList = this.getRouteConfigList();\r\n var length = 0;\r\n routeList.each(function (route) {\r\n if (route.hiddenScriptText) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n length = Math.max(length, route.selectConfigList.length);\r\n }.bind(this));\r\n return length;\r\n },\r\n getOrgConfig: function (routeId) { //获取人员选择配置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i].selectConfigList;\r\n }\r\n }\r\n },\r\n getCurrentRouteSelectorList: function () { //获取当前路由的人员选择器对象\r\n var selectorList = [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n if (!orgList) return [];\r\n orgList.each(function (org) {\r\n if (org.selector && org.selector.selector) {\r\n selectorList.push(org.selector.selector);\r\n }\r\n }.bind(this))\r\n return selectorList;\r\n },\r\n getCurrentRouteOrgList: function () { //获取当前路由的org对象\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n return orgList || [];\r\n },\r\n getSelectorSelectedData: function (filedName) { //获取人员选择器选择的值\r\n var data = [];\r\n var orgList = this.getCurrentRouteOrgList();\r\n for (var i = 0; i < orgList.length; i++) {\r\n var org = orgList[i];\r\n if (org.json.name === filedName) {\r\n var selector = org.selector.selector;\r\n selector.selectedItems.each(function (item) {\r\n data.push(item.data)\r\n })\r\n }\r\n }\r\n return data;\r\n },\r\n getMarginY: function (node) {\r\n return (node.getStyle(\"margin-top\").toInt() || 0) +\r\n (node.getStyle(\"margin-bottom\").toInt() || 0);\r\n // (node.getStyle(\"padding-top\").toInt() || 0 ) +\r\n // (node.getStyle(\"padding-bottom\").toInt() || 0 )+\r\n // (node.getStyle(\"border-top-width\").toInt() || 0 ) +\r\n // (node.getStyle(\"border-bottom-width\").toInt() || 0 );\r\n },\r\n setSize: function (currentOrgLength) {\r\n var lines = ((currentOrgLength + 1) / 2).toInt();\r\n\r\n if (lines > 0) {\r\n this.showOrgsArea();\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n if (this.buttonsArea) {\r\n var bodySize = this.appContentNode.getSize();\r\n var nodeHeight = bodySize.y - this.getMarginY(this.node);\r\n this.node.setStyles({\r\n \"overflow-y\": \"hidden\",\r\n \"height\": nodeHeight\r\n });\r\n var buttonsAreaSize = this.buttonsArea.getSize();\r\n this.contentNode.setStyles({\r\n \"height\": nodeHeight - buttonsAreaSize.y - this.getMarginY(this.buttonsArea) - this.getMarginY(this.contentNode),\r\n \"overflow-y\": \"auto\"\r\n })\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n showOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.show();\r\n if (this.orgsArea) this.orgsArea.show();\r\n },\r\n hideOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.hide();\r\n if (this.orgsArea) this.orgsArea.hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList: function () { //获取决策组并格式化成对象\r\n if (this.routeGroupObject) return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function (route, i) {\r\n\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n } else {\r\n route.displayName = route.name;\r\n }\r\n\r\n if (route.decisionOpinion) { //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each(function (decisionOption) {\r\n this.routeGroupNameList.combine([decisionOption]);\r\n var d = this.splitByStartNumber(decisionOption);\r\n if (!this.routeGroupObject[d.name]) this.routeGroupObject[d.name] = [];\r\n this.routeGroupObject[d.name].push(route);\r\n }.bind(this))\r\n } else {\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine([defaultName]);\r\n if (!this.routeGroupObject[defaultName]) this.routeGroupObject[defaultName] = [];\r\n this.routeGroupObject[defaultName].push(route);\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber: function (str) {\r\n var obj = {\r\n name: \"\",\r\n order: \"\"\r\n };\r\n for (var i = 0; i < str.length; i++) {\r\n if (parseInt(str.substr(i, 1)).toString() !== \"NaN\") {\r\n obj.order = obj.order + str.substr(i, 1);\r\n } else {\r\n obj.name = str.substr(i, str.length);\r\n break;\r\n }\r\n }\r\n return obj;\r\n },\r\n setRouteGroupList: function () { //排序并创建决策组DOM对象\r\n var _self = this;\r\n\r\n //根据决策组的排序号进行排序\r\n var keys = this.routeGroupNameList;\r\n keys.sort(function (a, b) {\r\n var aIdx = parseInt(this.splitByStartNumber(a).order || \"9999999\");\r\n var bIdx = parseInt(this.splitByStartNumber(b).order || \"9999999\");\r\n return aIdx - bIdx;\r\n }.bind(this));\r\n\r\n var list = [];\r\n keys.each(function (k) {\r\n list.push(this.splitByStartNumber(k).name)\r\n }.bind(this));\r\n\r\n debugger;\r\n var flag = false;\r\n list.each(function (routeGroupName) {\r\n var routeList = this.routeGroupObject[routeGroupName];\r\n var routeGroupNode = new Element(\"div\", {\r\n \"styles\": this.css.routeGroupNode,\r\n \"text\": routeGroupName\r\n }).inject(this.routeGroupArea);\r\n routeGroupNode.store(\"routeList\", routeList);\r\n routeGroupNode.store(\"routeGroupName\", routeGroupName);\r\n\r\n routeGroupNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRouteGroup(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRouteGroup(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRouteGroup(this);\r\n }\r\n });\r\n\r\n if (keys.length === 1) { //如果决策组只有1个,则默认选中\r\n this.selectRouteGroup(routeGroupNode);\r\n flag = false;\r\n } else {\r\n flag = true;\r\n }\r\n }.bind(this))\r\n if(flag){\r\n this.setSize(0);\r\n }\r\n },\r\n overRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n },\r\n outRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n },\r\n selectRouteGroup: function (node) { //选中决策组执行...\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode);\r\n //this.selectedRouteGroup.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRouteGroup = node;\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode_selected);\r\n //this.selectedRouteGroup.addClass(\"mainColor_bg\");\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n\r\n } else {\r\n\r\n }\r\n } else {\r\n this.selectedRouteGroup = node;\r\n node.setStyles(this.css.routeGroupNode_selected);\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n }\r\n this.routeGroupArea.setStyle(\"background-color\", \"#FFF\");\r\n },\r\n setRouteList: function (routeList) { //创建决策对象\r\n var _self = this;\r\n this.routeSelectorArea.empty();\r\n this.selectedRoute = null;\r\n\r\n if (!routeList) routeList = this.getRouteConfigList();\r\n var isSelected = false;\r\n routeList.each(function (route, i) {\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n var routeName = route.name;\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n routeName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }\r\n var routeNode = new Element(\"div\", {\r\n \"styles\": this.css.routeNode,\r\n \"text\": routeName\r\n }).inject(this.routeSelectorArea);\r\n routeNode.store(\"route\", route.id);\r\n routeNode.store(\"routeName\", route.name);\r\n\r\n routeNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRoute(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRoute(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRoute(this);\r\n }\r\n });\r\n\r\n if (routeList.length == 1 || route.sole) { //sole表示优先路由\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n }\r\n\r\n }.bind(this));\r\n if (!isSelected) {\r\n this.setSize(0);\r\n }\r\n },\r\n overRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n },\r\n outRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n },\r\n getDefaultOpinion: function( node ){\r\n var routeId = node.retrieve(\"route\");\r\n var routeDate = this.getRouteConfig( routeId );\r\n return routeDate.opinion || \"\";\r\n },\r\n selectRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n if( this.getData(\"inputTextarea\") === this.getDefaultOpinion( this.selectedRoute ) ||\r\n this.getData(\"inputTextarea\") === \"\"\r\n ){\r\n this.setData( \"inputTextarea\", this.getDefaultOpinion(node) || \"\" );\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n\r\n } else {\r\n if ( this.getData(\"inputTextarea\") === this.getDefaultOpinion(this.selectedRoute)) {\r\n this.setData( \"inputTextarea\", \"\");\r\n }\r\n\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.addClass(\"lightColor_bg\");\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRoute = null;\r\n }\r\n } else {\r\n if (this.getData(\"inputTextarea\") === \"\") {\r\n var defaultOpinion1 = this.getDefaultOpinion(node);\r\n if (defaultOpinion1) this.setData( \"inputTextarea\", defaultOpinion1);\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#FFF\");\r\n\r\n this.loadOrgs(this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\");\r\n\r\n if (this.form.data.json.events && this.form.data.json.events.afterSelectRoute) {\r\n this.form.Macro.exec(this.form.data.json.events.afterSelectRoute.code, node);\r\n }\r\n\r\n },\r\n /*决策和决策组相关 结束*/\r\n\r\n setOpinion: function () {\r\n if (!this.inputTextarea) return;\r\n if (this.handwritingAction) this.handwritingAction.addEvent(\"click\", function () {\r\n window.setTimeout( function(){\r\n this.handwriting();\r\n }.bind(this), 100 )\r\n }.bind(this));\r\n\r\n if (this.selectIdeaAreaNode) {\r\n MWF.require(\"MWF.widget.UUID\", function () {\r\n MWF.UD.getDataJson(\"idea\", function (json) {\r\n if (json) {\r\n if (json.ideas) {\r\n this.setIdeaList(json.ideas);\r\n }\r\n } else {\r\n MWF.UD.getPublicData(\"idea\", function (pjson) {\r\n if (pjson) {\r\n if (pjson.ideas) {\r\n this.setIdeaList(pjson.ideas);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n }.bind(this));\r\n }.bind(this));\r\n }\r\n\r\n },\r\n\r\n audioRecord: function () {\r\n if (!this.audioRecordNode) this.createAudioRecord();\r\n this.audioRecordNode.show();\r\n this.audioRecordNode.position({\r\n \"relativeTo\": this.options.mediaNode || this.node,\r\n \"position\": \"center\",\r\n \"edge\": \"center\"\r\n });\r\n\r\n MWF.require(\"MWF.widget.AudioRecorder\", function () {\r\n this.audioRecorder = new MWF.widget.AudioRecorder(this.audioRecordNode, {\r\n \"onSave\": function (blobFile) {\r\n this.soundFile = blobFile;\r\n this.audioRecordNode.hide();\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.soundFile = null;\r\n this.audioRecordNode.hide();\r\n }.bind(this)\r\n }, null);\r\n }.bind(this));\r\n },\r\n createAudioRecord: function () {\r\n this.audioRecordNode = new Element(\"div\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n var size = (this.options.mediaNode || this.node).getSize();\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.audioRecordNode.setStyles({\r\n \"height\": \"\" + size.y + \"px\",\r\n \"width\": \"\" + size.x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n },\r\n\r\n handwriting: function () {\r\n if (!this.handwritingNode) this.createHandwriting();\r\n if(this.handwritingNodeMask)this.handwritingNodeMask.show();\r\n this.handwritingNode.show();\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n },\r\n createHandwriting: function () {\r\n this.handwritingNodeMask = new Element(\"div.handwritingMask\", {\"styles\": this.css.handwritingMask}).inject(this.node);\r\n\r\n this.handwritingNode = new Element(\"div.handwritingNode\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n //var size = (this.options.mediaNode || this.node).getSize();\r\n //var y = size.y;\r\n //var x = size.x;\r\n //兼容以前的默认高宽\r\n\r\n debugger;\r\n\r\n var bodySize = $(document.body).getSize();\r\n var x = bodySize.x;\r\n var y = bodySize.y;\r\n\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.handwritingNode.setStyles({\r\n \"height\": \"\" + y + \"px\",\r\n \"width\": \"\" + x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n this.handwritingNode.addEvent('touchmove' , function(e){\r\n e.preventDefault();\r\n });\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n this.handwritingAreaNode = new Element(\"div\", {\"styles\": this.css.handwritingAreaNode}).inject(this.handwritingNode);\r\n // this.handwritingActionNode = new Element(\"div\", {\r\n // \"styles\": this.css.handwritingActionNode,\r\n // \"text\": MWF.xApplication.process.Work.LP.saveWrite\r\n // }).inject(this.handwritingNode);\r\n // var h = this.handwritingActionNode.getSize().y + this.handwritingActionNode.getStyle(\"margin-top\").toInt() + this.handwritingActionNode.getStyle(\"margin-bottom\").toInt();\r\n // h = y - h;\r\n // this.handwritingAreaNode.setStyle(\"height\", \"\" + h + \"px\");\r\n this.handwritingAreaNode.setStyle(\"height\", \"\" + y + \"px\");\r\n\r\n MWF.require(\"MWF.widget.Tablet\", function () {\r\n var handWritingOptions = {\r\n \"style\": \"default\",\r\n \"contentWidth\": 0,\r\n \"contentHeight\": 0,\r\n \"onSave\": function (base64code, base64Image, imageFile) {\r\n this.handwritingFile = imageFile;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n // this.page.get(\"div_image\").node.set(\"src\",base64Image);\r\n\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.handwritingFile = null;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n }.bind(this)\r\n };\r\n handWritingOptions.tools = [\r\n \"undo\",\r\n \"redo\", \"|\",\r\n \"reset\", \"|\",\r\n \"size\",\r\n \"cancel\"\r\n ]\r\n this.tablet = new MWF.widget.Tablet(this.handwritingAreaNode, handWritingOptions, null);\r\n this.tablet.load();\r\n }.bind(this));\r\n\r\n // this.handwritingActionNode.addEvent(\"click\", function () {\r\n // //this.handwritingNode.hide();\r\n // if (this.tablet) this.tablet.save();\r\n // }.bind(this));\r\n },\r\n\r\n setIdeaList: function (ideas) {\r\n var _self = this;\r\n ideas.each(function (idea) {\r\n new Element(\"div\", {\r\n \"styles\": this.css.selectIdeaItemNode,\r\n \"text\": idea,\r\n \"events\": {\r\n \"click\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"dblclick\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"mouseover\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode_over);\r\n },\r\n \"mouseout\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode);\r\n }\r\n }\r\n }).inject(this.selectIdeaAreaNode);\r\n }.bind(this));\r\n },\r\n submit: function (ev) {\r\n if (this.hasDecisionOpinion && !this.selectedRouteGroup) {\r\n this.routeGroupArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"top\"},\r\n \"请先选择决策组\",\r\n this.routeGroupArea,\r\n null, //{\"x\": 0, \"y\": 30}\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n\r\n if (!this.selectedRoute) {\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.routeSelectorArea,\r\n delayClose: 6000,\r\n content: \"请先选择决策\"\r\n });\r\n return false;\r\n }\r\n var routeName = this.selectedRoute.retrieve(\"routeName\") || this.selectedRoute.get(\"text\");\r\n var opinion = this.getData(\"inputTextarea\");\r\n if (opinion === MWF.xApplication.process.Work.LP.inputText) opinion = \"\";\r\n var medias = [];\r\n if (this.handwritingFile) medias.push(this.handwritingFile);\r\n if (this.soundFile) medias.push(this.soundFile);\r\n if (this.videoFile) medias.push(this.videoFile);\r\n\r\n var currentRouteId = this.selectedRoute.retrieve(\"route\");\r\n var routeConfig = this.getRouteConfig(currentRouteId);\r\n if (!opinion && medias.length === 0) {\r\n if (routeConfig.opinionRequired == true) {\r\n this.inputTextarea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.inputTextarea,\r\n delayClose: 6000,\r\n content: \"请填写意见\"\r\n });\r\n return false;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: validation\r\n });\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: \"路由校验失败\"\r\n });\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n //var array = [routeName, opinion, medias];\r\n //this.node.mask({\r\n // \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n // \"destroyOnHide\": true,\r\n // \"style\": {\r\n // \"background-color\": \"#999\",\r\n // \"opacity\": 0.3,\r\n // \"z-index\":600\r\n // }\r\n //});\r\n //this.fireEvent(\"submit\", array );\r\n\r\n var appendTaskOrgItem;\r\n if (routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\") {\r\n if (!this.orgItems || this.orgItems.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"没有配置转交人,请联系管理员\" //\"没有配置转交人,请联系管理员\"\r\n });\r\n return false;\r\n } else {\r\n appendTaskOrgItem = this.orgItems[0]\r\n }\r\n }\r\n\r\n if (!this.saveOrgs()) return false;\r\n\r\n //this.saveOrgsWithCheckEmpower( function(){\r\n var appandTaskIdentityList;\r\n if (appendTaskOrgItem) {\r\n appandTaskIdentityList = appendTaskOrgItem.getData();\r\n if (!appandTaskIdentityList || appandTaskIdentityList.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"请选择转交人\"\r\n });\r\n return;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n validation,\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n \"路由校验失败\",\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n this.node.mask({\r\n \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n \"destroyOnHide\": true,\r\n \"style\": {\r\n \"background-color\": \"#999\",\r\n \"opacity\": 0.3,\r\n \"z-index\": 600\r\n }\r\n });\r\n\r\n // var array = [ routeName, opinion, medias, appandTaskIdentityList, this.orgItems, function(){\r\n // if(appendTaskOrgItem)appendTaskOrgItem.setData([]);\r\n // }];\r\n\r\n var op = this.form.getOpinion();\r\n var mds = op.medias;\r\n\r\n if (!medias || !medias.length) {\r\n medias = mds;\r\n } else {\r\n medias = medias.concat(mds)\r\n }\r\n\r\n this.form.submitWork(routeName, opinion, medias, function () {\r\n this.close();\r\n }.bind(this), this, null, appandTaskIdentityList, this.orgItems, function () {\r\n if (appendTaskOrgItem) appendTaskOrgItem.setData([]);\r\n this.setData(\"inputTextarea\", \"\");\r\n }.bind(this));\r\n\r\n // this.fireEvent(\"submit\", array );\r\n },\r\n\r\n close: function () {\r\n this.node.setStyle(\"display\", \"none\");\r\n this.status = \"closed\";\r\n },\r\n destroy: function () {\r\n // this.node.empty();\r\n // delete this.task;\r\n // delete this.node;\r\n // delete this.routeSelectorTile;\r\n // delete this.routeSelectorArea;\r\n // delete this.routeOpinionTile;\r\n // delete this.routeOpinionArea;\r\n // delete this.buttonsArea;\r\n // delete this.inputOpinionNode;\r\n // delete this.inputTextarea;\r\n // delete this.cancelButton;\r\n // delete this.okButton;\r\n },\r\n loadOrgs: function (route) {\r\n if (!this.form || !route) {\r\n this.hideOrgsArea();\r\n return;\r\n } else {\r\n this.showOrgsArea();\r\n }\r\n if (!this.orgTableObject) this.orgTableObject = {};\r\n if (!this.orgItemsObject) this.orgItemsObject = {};\r\n var isLoaded = false;\r\n for (var key in this.orgTableObject) {\r\n if (route === key) {\r\n this.orgTableObject[key].show();\r\n this.orgItems = this.orgItemsObject[key] || [];\r\n var data = this.getOrgConfig(route);\r\n isLoaded = true;\r\n } else {\r\n this.orgTableObject[key].hide();\r\n }\r\n }\r\n if (isLoaded) return;\r\n\r\n this.orgItems = [];\r\n this.orgItemsObject[route] = this.orgItems;\r\n\r\n var data = this.getOrgConfig(route);\r\n var routeConfig = this.getRouteConfig(route);\r\n var ignoreFirstOrgOldData = false; //(routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\");\r\n this.setSize(data.length);\r\n if (data.length) {\r\n this.showOrgsArea();\r\n\r\n var routeOrgTable = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTable\r\n }).inject(this.orgsArea);\r\n this.orgTableObject[route] = routeOrgTable;\r\n\r\n data.each(function (config, i) {\r\n var sNode = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTr\r\n }).inject(routeOrgTable);\r\n this.loadOrg(sNode, config, ignoreFirstOrgOldData && i == 0)\r\n }.bind(this))\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n },\r\n loadOrg: function (container, json, position, ignoreOldData) {\r\n var titleNode = new Element(\"div.selectorTitle\", {\r\n \"styles\": this.css.selectorTitle\r\n }).inject(container);\r\n var titleTextNode = new Element(\"div.selectorTitleText\", {\r\n \"text\": json.title,\r\n \"styles\": this.css.selectorTitleText\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.selectorContent\", {\r\n \"styles\": this.css.selectorContent\r\n }).inject(container);\r\n\r\n var errorNode = new Element(\"div.selectorErrorNode\", {\r\n \"styles\": this.css.selectorErrorNode\r\n }).inject(container);\r\n\r\n var org = new O2ProcessorMobile.Org(contentNode, this.form, json, this, {\r\n onSelect: function (items, data) {\r\n if (!data || !data.length) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n } else {\r\n contentNode.setStyles(this.css.selectorContent);\r\n }\r\n }.bind(this)\r\n });\r\n org.ignoreOldData = ignoreOldData;\r\n org.errContainer = errorNode;\r\n org.summitDlalog = this;\r\n this.orgItems.push(org);\r\n\r\n titleNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n contentNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n\r\n var defaultValue = org.getValue();\r\n org.loadOrgWidget(defaultValue, contentNode);\r\n if (!defaultValue || defaultValue.length == 0) {\r\n {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n }\r\n }\r\n\r\n },\r\n validationOrgs: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.validation()) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n isOrgsHasEmpower: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = false;\r\n this.needCheckEmpowerOrg = [];\r\n this.orgItems.each(function (item) {\r\n if (item.hasEmpowerIdentity()) {\r\n this.needCheckEmpowerOrg.push(item);\r\n flag = true;\r\n }\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgs: function (keepSilent) {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.save(!keepSilent)) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgsWithCheckEmpower: function (callback) {\r\n debugger;\r\n if (!this.orgItems || !this.orgItems.length) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n if (!this.validationOrgs()) return false;\r\n if (!this.isOrgsHasEmpower()) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n //this.checkEmpowerMode = true;\r\n this.showEmpowerDlg(callback);\r\n },\r\n showEmpowerDlg: function (callback) {\r\n\r\n //this.needCheckEmpowerOrg.each( function(org){\r\n // org.saveCheckedEmpowerData();\r\n //}.bind(this));\r\n\r\n var empowerNode = new Element(\"div.empowerNode\", {\"styles\": this.css.empowerNode});\r\n var empowerTitleNode = new Element(\"div\", {\r\n text: \"下列人员对工作进行了授权,选择后文件将发送给被授权人,取消选择后文件将发送给授权者本人\",\r\n styles: this.css.empowerTitleNode\r\n }).inject(empowerNode);\r\n\r\n var orgs = this.needCheckEmpowerOrg;\r\n var len = orgs.length;\r\n var lines = ((len + 1) / 2).toInt();\r\n\r\n var empowerTable = new Element(\"table\", {\r\n \"cellspacing\": 0, \"cellpadding\": 0, \"border\": 0, \"width\": \"100%\",\r\n \"styles\": this.css.empowerTable\r\n }).inject(empowerNode);\r\n\r\n for (var n = 0; n < lines; n++) {\r\n var tr = new Element(\"tr\").inject(empowerTable);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerOddTd}).inject(tr);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerEvenTd}).inject(tr);\r\n }\r\n\r\n var trs = empowerTable.getElements(\"tr\");\r\n orgs.each(function (org, i) {\r\n var sNode;\r\n var width;\r\n if (i + 1 == len && (len % 2 === 1)) {\r\n sNode = trs[trs.length - 1].getFirst(\"td\");\r\n sNode.set(\"colspan\", 2);\r\n trs[trs.length - 1].getLast(\"td\").destroy();\r\n width = \"50%\";\r\n } else {\r\n var row = ((i + 2) / 2).toInt();\r\n var tr = trs[row - 1];\r\n sNode = (i % 2 === 0) ? tr.getFirst(\"td\") : tr.getLast(\"td\");\r\n }\r\n\r\n var titleNode = new Element(\"div.empowerAreaTitle\", {\r\n \"styles\": this.css.empowerAreaTitle\r\n }).inject(sNode);\r\n\r\n var titleTextNode = new Element(\"div.empowerAreaTitleText\", {\r\n \"text\": org.json.title,\r\n \"styles\": this.css.empowerAreaTitleText\r\n }).inject(titleNode);\r\n\r\n var selectAllNode = new Element(\"div\", {\r\n styles: {\r\n float: \"right\"\r\n }\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.empowerAreaContent\", {\r\n \"styles\": this.css.empowerAreaContent\r\n }).inject(sNode);\r\n\r\n org.loadCheckEmpower(null, contentNode, selectAllNode);\r\n\r\n }.bind(this));\r\n\r\n empowerNode.setStyle(\"height\", lines * this.options.orgHeight + 20);\r\n //var dlgHeight = Math.min( Math.floor( this.form.app.content.getSize().y * 0.9) , lines*this.options.orgHeight + 151 );\r\n\r\n //var width = this.node.retrieve(\"width\");\r\n //empowerNode.setStyle( \"width\", width );\r\n var width = \"880\";\r\n //if( len > 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle(\"width\", width + \"px\");\r\n\r\n this.node.getParent().mask({\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\": false,\r\n \"buttonList\": [\r\n {\r\n \"type\": \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function (d, e) {\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each(function (org, i) {\r\n org.saveCheckedEmpowerData(function () {\r\n if (i === orgs.length - 1) {\r\n if (callback) callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\": \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function () {\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss: function () {\r\n this.css = {\r\n\r\n \"routeGroupNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\": \"28px\",\r\n \"color\": \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"border-radius\": \"5px\",\r\n \"height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-left\": \"26px\",\r\n \"padding-right\": \"8px\",\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\": {\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\": {\r\n \"color\": \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#3296FA\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"padding\": \"4px 4px 4px 4px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background\": \"#ffffff\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"height\": \"3em\",\r\n \"line-height\": \"3em\",\r\n \"margin\": \"5px auto\",\r\n \"border-radius\": \"5px\",\r\n \"border\": \"1px solid #3296FA\",\r\n \"background-color\": \"#3296FA\",\r\n \"text-align\": \"center\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\"\r\n },\r\n\r\n \"inputOpinionAudioRecordAction\": {\r\n \"display\": \"none\",\r\n \"float\": \"right\",\r\n \"border\": \"1px solid #6681a5\",\r\n \"border-radius\": \"3px\",\r\n \"cursor\": \"pointer\",\r\n \"padding-left\": \"24px\",\r\n \"padding-right\": \"5px\",\r\n \"margin-left\": \"5px\",\r\n \"background\": \"url(\" + \"/x_component_process_Work/$Processor/default/audioRecord.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeOrgTable\": {},\r\n \"routeOrgTr\": {\r\n \"margin-bottom\": \"10px\"\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n\r\n \"selectorTitle\": {\r\n \"padding\": \"0px 4px\",\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"font-size\": \"14px\",\r\n // \"font-weight\": \"bold\",\r\n \"color\": \"#000\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/mobile/arrow_right2.png) no-repeat right 10px center\",\r\n \"background-color\": \"#fff\"\r\n },\r\n \"selectorTitle_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"selectorTitleText\": {\r\n// \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\": {\r\n //\"float\" : \"right\",\r\n \"background-color\": \"#fff\",\r\n \"margin-right\": \"5px\",\r\n \"font-weight\": \"normal\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"background-color\": \"#fff\",\r\n \"padding\": \"0px 5px 5px 5px\"\r\n },\r\n \"selectorContent_noItem\": {\r\n \"padding\": \"0px\"\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\n\r\nO2ProcessorMobile.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n setTimeout( function(){ //如果有输入法界面,这个时候页面的计算不对,所以等100毫秒\r\n var options = this.getOptions();\r\n if(options){\r\n //this.selector = new MWF.O2Selector(this.container, options);\r\n this.selector = new MWF.O2Selector($(document.body), options);\r\n }\r\n }.bind(this), 100 )\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2ProcessorMobile.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2ProcessorMobile.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"default\",\r\n \"zIndex\" : 3000\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n var mobileEvents = {\r\n \"onComplete\": function(items){\r\n this.selectOnComplete(items);\r\n }.bind(this),\r\n \"onCancel\": this.selectOnCancel.bind(this),\r\n \"onClose\": this.selectOnClose.bind(this)\r\n };\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n mobileEvents,\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue();\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n resetData: function(){\r\n var v = this.getValue();\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n return this.getValue();\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2ProcessorMobile.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2ProcessorMobile.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});" - }, + "queryLoad": { + "code": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessorMobile\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load( defaultRoute );\r\n});\r\n\r\nthis.define(\"popupProcessorMobile\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load( defaultRoute );\r\n});\r\n\r\nwindow.O2ProcessorMobile = new Class({\r\n Implements: [Events],\r\n initialize: function (macro) {\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = $(document.body); //this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant: function () {\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n },\r\n load: function ( defaultRoute ) {\r\n this.defaultRoute = defaultRoute || \"\";\r\n if ( this.status === \"show\" || this.status === \"loading\" ){\r\n\r\n }else if (this.status === \"closed\" ) {\r\n this.node.show();\r\n // this.positionSeted = false; //重新设置位置\r\n // this.setSize( this.getCurrentRouteOrgList().length );\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n if( currentRoute )this.showOrgsByRoute(currentRoute);\r\n this.status = \"show\";\r\n } else {\r\n this.status = \"loading\";\r\n this.container = new Element(\"div\").inject(this.appContentNode);\r\n this.node.setStyles({\r\n \"width\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"z-index\" : \"101\"\r\n })\r\n this.loadContent();\r\n this.setEvents();\r\n this.node.inject(this.container);\r\n this.status = \"show\";\r\n }\r\n },\r\n loadContent: function () {\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if (orgLength === 0) { //流程选人数量为0\r\n if (this.orgsTile) {\r\n this.orgsTile.destroy();\r\n this.orgsTile = null;\r\n }\r\n if (this.orgsArea) {\r\n this.orgsArea.destroy();\r\n this.orgsArea = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if (this.hasDecisionOpinion) { //有决策组\r\n this.setRouteGroupList();\r\n } else { //没有决策组\r\n if (this.routeGroupTitle) {\r\n this.routeGroupTitle.destroy();\r\n this.routeGroupTitle = null;\r\n }\r\n if (this.routeGroupArea) {\r\n this.routeGroupArea.destroy();\r\n this.routeGroupArea = null;\r\n }\r\n // this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n // if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n // this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n // }\r\n this.setRouteList();\r\n }\r\n },\r\n\r\n getAllNode: function () {\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n\r\n this.routeGroupTitle = this.getNode(\"routeGroupTitle\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitle = this.getNode(\"routeSelectorTitle\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNode = this.getNode(\"inputOpinionNode\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n\r\n this.orgsTile = this.getNode(\"orgsTile\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.buttonsArea = this.getNode(\"submitButtonNode\");\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEvents: function () {\r\n if (this.cancelButton) {\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if (this.okButton) {\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n getNode: function (name) {\r\n if (this.macro.form.get(name)) {\r\n return this.macro.form.get(name).node;\r\n }\r\n if (this.form.allForName[name]) {\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData: function (name, value) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData: function (name) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList: function () { //获取当前待办的所有路由设置\r\n if (!this.routeConfigList) {\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute({\"valueList\": this.task.routeList}, function (json) {\r\n json.data.each(function (d) {\r\n d.selectConfigList = JSON.parse(d.selectConfig || \"[]\");\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false);\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig: function (routeId) { //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i];\r\n }\r\n }\r\n },\r\n getMaxOrgLength: function () { //获取当前待办下可能的最多选人组件个数\r\n var routeList = this.getRouteConfigList();\r\n var length = 0;\r\n routeList.each(function (route) {\r\n if (route.hiddenScriptText) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n length = Math.max(length, route.selectConfigList.length);\r\n }.bind(this));\r\n return length;\r\n },\r\n getOrgConfig: function (routeId) { //获取人员选择配置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i].selectConfigList;\r\n }\r\n }\r\n },\r\n getVisableOrgConfig: function (routeId) {\r\n var selectConfigList = this.getOrgConfig(routeId);\r\n var list = [];\r\n (selectConfigList || []).each(function (config) {\r\n if (!this.isOrgHidden(config)) {\r\n list.push(config);\r\n }\r\n }.bind(this));\r\n return list;\r\n },\r\n isOrgHidden: function (d) {\r\n if (d.hiddenScript && d.hiddenScript.code) { //如果隐藏路由,返回\r\n var hidden = this.form.Macro.exec(d.hiddenScript.code, this);\r\n if (hidden && hidden.toString() === \"true\") return true;\r\n }\r\n return false;\r\n },\r\n getCurrentRouteSelectorList: function () { //获取当前路由的人员选择器对象\r\n var selectorList = [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n if (!orgList) return [];\r\n orgList.each(function (org) {\r\n if (org.selector && org.selector.selector) {\r\n selectorList.push(org.selector.selector);\r\n }\r\n }.bind(this))\r\n return selectorList;\r\n },\r\n getCurrentRouteOrgList: function () { //获取当前路由的org对象\r\n if( !this.orgItemsObject )return [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n return orgList || [];\r\n },\r\n getSelectorSelectedData: function (filedName) { //获取人员选择器选择的值\r\n var data = [];\r\n var orgList = this.getCurrentRouteOrgList();\r\n for (var i = 0; i < orgList.length; i++) {\r\n var org = orgList[i];\r\n if (org.json.name === filedName) {\r\n var selector = org.selector.selector;\r\n selector.selectedItems.each(function (item) {\r\n data.push(item.data)\r\n })\r\n }\r\n }\r\n return data;\r\n },\r\n getMarginY: function (node) {\r\n return (node.getStyle(\"margin-top\").toInt() || 0) +\r\n (node.getStyle(\"margin-bottom\").toInt() || 0);\r\n // (node.getStyle(\"padding-top\").toInt() || 0 ) +\r\n // (node.getStyle(\"padding-bottom\").toInt() || 0 )+\r\n // (node.getStyle(\"border-top-width\").toInt() || 0 ) +\r\n // (node.getStyle(\"border-bottom-width\").toInt() || 0 );\r\n },\r\n setSize: function (currentOrgLength) {\r\n var lines = ((currentOrgLength + 1) / 2).toInt();\r\n\r\n if (lines > 0) {\r\n this.showOrgsArea();\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n if (this.buttonsArea) {\r\n var bodySize = this.appContentNode.getSize();\r\n var nodeHeight = bodySize.y - this.getMarginY(this.node);\r\n this.node.setStyles({\r\n \"overflow-y\": \"hidden\",\r\n \"height\": nodeHeight\r\n });\r\n var buttonsAreaSize = this.buttonsArea.getSize();\r\n this.contentNode.setStyles({\r\n \"height\": nodeHeight - buttonsAreaSize.y - this.getMarginY(this.buttonsArea) - this.getMarginY(this.contentNode),\r\n \"overflow-y\": \"auto\"\r\n })\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n showOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.show();\r\n if (this.orgsArea) this.orgsArea.show();\r\n },\r\n hideOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.hide();\r\n if (this.orgsArea) this.orgsArea.hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList: function () { //获取决策组并格式化成对象\r\n if (this.routeGroupObject) return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function (route, i) {\r\n\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n } else {\r\n route.displayName = route.name;\r\n }\r\n\r\n if (route.decisionOpinion) { //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each(function (decisionOption) {\r\n this.routeGroupNameList.combine([decisionOption]);\r\n var d = this.splitByStartNumber(decisionOption);\r\n if (!this.routeGroupObject[d.name]) this.routeGroupObject[d.name] = [];\r\n this.routeGroupObject[d.name].push(route);\r\n }.bind(this))\r\n } else {\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine([defaultName]);\r\n if (!this.routeGroupObject[defaultName]) this.routeGroupObject[defaultName] = [];\r\n this.routeGroupObject[defaultName].push(route);\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber: function (str) {\r\n var obj = {\r\n name: \"\",\r\n order: \"\"\r\n };\r\n for (var i = 0; i < str.length; i++) {\r\n if (parseInt(str.substr(i, 1)).toString() !== \"NaN\") {\r\n obj.order = obj.order + str.substr(i, 1);\r\n } else {\r\n obj.name = str.substr(i, str.length);\r\n break;\r\n }\r\n }\r\n return obj;\r\n },\r\n setRouteGroupList: function () { //排序并创建决策组DOM对象\r\n var _self = this;\r\n\r\n this.routeGroupNodeMap = {};\r\n\r\n //根据决策组的排序号进行排序\r\n var keys = this.routeGroupNameList;\r\n keys.sort(function (a, b) {\r\n var aIdx = parseInt(this.splitByStartNumber(a).order || \"9999999\");\r\n var bIdx = parseInt(this.splitByStartNumber(b).order || \"9999999\");\r\n return aIdx - bIdx;\r\n }.bind(this));\r\n\r\n var list = [];\r\n keys.each(function (k) {\r\n list.push(this.splitByStartNumber(k).name)\r\n }.bind(this));\r\n\r\n debugger;\r\n var flag = false;\r\n list.each(function (routeGroupName) {\r\n var routeList = this.routeGroupObject[routeGroupName];\r\n var routeGroupNode = new Element(\"div\", {\r\n \"styles\": this.css.routeGroupNode,\r\n \"text\": routeGroupName\r\n }).inject(this.routeGroupArea);\r\n routeGroupNode.store(\"routeList\", routeList);\r\n routeGroupNode.store(\"routeGroupName\", routeGroupName);\r\n\r\n this.routeGroupNodeMap[routeGroupName] = routeGroupNode;\r\n\r\n routeGroupNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRouteGroup(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRouteGroup(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRouteGroup(this);\r\n }\r\n });\r\n\r\n if (keys.length === 1) { //如果决策组只有1个,则默认选中\r\n this.selectRouteGroup(routeGroupNode);\r\n flag = false;\r\n } else {\r\n flag = true;\r\n }\r\n }.bind(this));\r\n if(flag){\r\n this.setSize(0);\r\n }\r\n },\r\n overRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n },\r\n outRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n },\r\n selectRouteGroup: function (node) { //选中决策组执行...\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode);\r\n //this.selectedRouteGroup.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRouteGroup = node;\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode_selected);\r\n //this.selectedRouteGroup.addClass(\"mainColor_bg\");\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n\r\n } else {\r\n\r\n }\r\n } else {\r\n this.selectedRouteGroup = node;\r\n node.setStyles(this.css.routeGroupNode_selected);\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n }\r\n this.routeGroupArea.setStyle(\"background-color\", \"#FFF\");\r\n },\r\n setRouteList: function (routeList) { //创建决策对象\r\n var _self = this;\r\n this.routeSelectorArea.empty();\r\n this.selectedRoute = null;\r\n\r\n this.routeNodeMap = {};\r\n\r\n if (!routeList) routeList = this.getRouteConfigList();\r\n var isSelected = false;\r\n var isSelectedDefault = false;\r\n routeList.each(function (route, i) {\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n var routeName = route.name;\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n routeName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }\r\n var routeNode = new Element(\"div\", {\r\n \"styles\": this.css.routeNode,\r\n \"text\": routeName\r\n }).inject(this.routeSelectorArea);\r\n routeNode.store(\"route\", route.id);\r\n routeNode.store(\"routeName\", route.name);\r\n\r\n this.routeNodeMap[route.id] = routeNode;\r\n this.routeNodeMap[route.name] = routeNode;\r\n\r\n routeNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRoute(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRoute(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRoute(this);\r\n }\r\n });\r\n\r\n if( route.id === this.defaultRoute || route.name === this.defaultRoute) {\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n isSelectedDefault = true;\r\n }else if ( !isSelectedDefault && (routeList.length == 1 || route.sole )) { //sole表示优先路由\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n }\r\n\r\n }.bind(this));\r\n if (!isSelected) {\r\n this.setSize(0);\r\n }\r\n },\r\n overRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n },\r\n outRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n },\r\n getDefaultOpinion: function( node ){\r\n var routeId = node.retrieve(\"route\");\r\n var routeDate = this.getRouteConfig( routeId );\r\n return routeDate.opinion || \"\";\r\n },\r\n selectRouteByName: function( route ){\r\n\r\n },\r\n selectRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n if( this.getData(\"inputTextarea\") === this.getDefaultOpinion( this.selectedRoute ) ||\r\n this.getData(\"inputTextarea\") === \"\"\r\n ){\r\n this.setData( \"inputTextarea\", this.getDefaultOpinion(node) || \"\" );\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n\r\n } else {\r\n if ( this.getData(\"inputTextarea\") === this.getDefaultOpinion(this.selectedRoute)) {\r\n this.setData( \"inputTextarea\", \"\");\r\n }\r\n\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.addClass(\"lightColor_bg\");\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRoute = null;\r\n }\r\n } else {\r\n if (this.getData(\"inputTextarea\") === \"\") {\r\n var defaultOpinion1 = this.getDefaultOpinion(node);\r\n if (defaultOpinion1) this.setData( \"inputTextarea\", defaultOpinion1);\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#FFF\");\r\n\r\n this.loadOrgs(this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\");\r\n\r\n if (this.form.data.json.events && this.form.data.json.events.afterSelectRoute) {\r\n this.form.Macro.exec(this.form.data.json.events.afterSelectRoute.code, node);\r\n }\r\n\r\n },\r\n /*决策和决策组相关 结束*/\r\n\r\n setOpinion: function () {\r\n if (!this.inputTextarea) return;\r\n if (this.handwritingAction) this.handwritingAction.addEvent(\"click\", function () {\r\n window.setTimeout( function(){\r\n this.handwriting();\r\n }.bind(this), 100 )\r\n }.bind(this));\r\n\r\n if (this.selectIdeaAreaNode) {\r\n MWF.require(\"MWF.widget.UUID\", function () {\r\n MWF.UD.getDataJson(\"idea\", function (json) {\r\n if (json) {\r\n if (json.ideas) {\r\n this.setIdeaList(json.ideas);\r\n }\r\n } else {\r\n MWF.UD.getPublicData(\"idea\", function (pjson) {\r\n if (pjson) {\r\n if (pjson.ideas) {\r\n this.setIdeaList(pjson.ideas);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n }.bind(this));\r\n }.bind(this));\r\n }\r\n\r\n },\r\n\r\n audioRecord: function () {\r\n if (!this.audioRecordNode) this.createAudioRecord();\r\n this.audioRecordNode.show();\r\n this.audioRecordNode.position({\r\n \"relativeTo\": this.options.mediaNode || this.node,\r\n \"position\": \"center\",\r\n \"edge\": \"center\"\r\n });\r\n\r\n MWF.require(\"MWF.widget.AudioRecorder\", function () {\r\n this.audioRecorder = new MWF.widget.AudioRecorder(this.audioRecordNode, {\r\n \"onSave\": function (blobFile) {\r\n this.soundFile = blobFile;\r\n this.audioRecordNode.hide();\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.soundFile = null;\r\n this.audioRecordNode.hide();\r\n }.bind(this)\r\n }, null);\r\n }.bind(this));\r\n },\r\n createAudioRecord: function () {\r\n this.audioRecordNode = new Element(\"div\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n var size = (this.options.mediaNode || this.node).getSize();\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.audioRecordNode.setStyles({\r\n \"height\": \"\" + size.y + \"px\",\r\n \"width\": \"\" + size.x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n },\r\n\r\n handwriting: function () {\r\n if (!this.handwritingNode) this.createHandwriting();\r\n if(this.handwritingNodeMask)this.handwritingNodeMask.show();\r\n this.handwritingNode.show();\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n },\r\n createHandwriting: function () {\r\n this.handwritingNodeMask = new Element(\"div.handwritingMask\", {\"styles\": this.css.handwritingMask}).inject(this.node);\r\n\r\n this.handwritingNode = new Element(\"div.handwritingNode\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n //var size = (this.options.mediaNode || this.node).getSize();\r\n //var y = size.y;\r\n //var x = size.x;\r\n //兼容以前的默认高宽\r\n\r\n debugger;\r\n\r\n var bodySize = $(document.body).getSize();\r\n var x = bodySize.x;\r\n var y = bodySize.y;\r\n\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.handwritingNode.setStyles({\r\n \"height\": \"\" + y + \"px\",\r\n \"width\": \"\" + x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n this.handwritingNode.addEvent('touchmove' , function(e){\r\n e.preventDefault();\r\n });\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n this.handwritingAreaNode = new Element(\"div\", {\"styles\": this.css.handwritingAreaNode}).inject(this.handwritingNode);\r\n // this.handwritingActionNode = new Element(\"div\", {\r\n // \"styles\": this.css.handwritingActionNode,\r\n // \"text\": MWF.xApplication.process.Work.LP.saveWrite\r\n // }).inject(this.handwritingNode);\r\n // var h = this.handwritingActionNode.getSize().y + this.handwritingActionNode.getStyle(\"margin-top\").toInt() + this.handwritingActionNode.getStyle(\"margin-bottom\").toInt();\r\n // h = y - h;\r\n // this.handwritingAreaNode.setStyle(\"height\", \"\" + h + \"px\");\r\n this.handwritingAreaNode.setStyle(\"height\", \"\" + y + \"px\");\r\n\r\n MWF.require(\"MWF.widget.Tablet\", function () {\r\n var handWritingOptions = {\r\n \"style\": \"default\",\r\n \"contentWidth\": 0,\r\n \"contentHeight\": 0,\r\n \"onSave\": function (base64code, base64Image, imageFile) {\r\n this.handwritingFile = imageFile;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n // this.page.get(\"div_image\").node.set(\"src\",base64Image);\r\n\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.handwritingFile = null;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n }.bind(this)\r\n };\r\n handWritingOptions.tools = [\r\n \"undo\",\r\n \"redo\", \"|\",\r\n \"reset\", \"|\",\r\n \"size\",\r\n \"cancel\"\r\n ]\r\n this.tablet = new MWF.widget.Tablet(this.handwritingAreaNode, handWritingOptions, null);\r\n this.tablet.load();\r\n }.bind(this));\r\n\r\n // this.handwritingActionNode.addEvent(\"click\", function () {\r\n // //this.handwritingNode.hide();\r\n // if (this.tablet) this.tablet.save();\r\n // }.bind(this));\r\n },\r\n\r\n setIdeaList: function (ideas) {\r\n var _self = this;\r\n ideas.each(function (idea) {\r\n if (!idea) return;\r\n new Element(\"div\", {\r\n \"styles\": this.css.selectIdeaItemNode,\r\n \"text\": idea,\r\n \"events\": {\r\n \"click\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"dblclick\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"mouseover\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode_over);\r\n },\r\n \"mouseout\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode);\r\n }\r\n }\r\n }).inject(this.selectIdeaAreaNode);\r\n }.bind(this));\r\n },\r\n submit: function (ev) {\r\n if (this.hasDecisionOpinion && !this.selectedRouteGroup) {\r\n this.routeGroupArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"top\"},\r\n \"请先选择决策组\",\r\n this.routeGroupArea,\r\n null, //{\"x\": 0, \"y\": 30}\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n\r\n if (!this.selectedRoute) {\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.routeSelectorArea,\r\n delayClose: 6000,\r\n content: \"请先选择决策\"\r\n });\r\n return false;\r\n }\r\n var routeName = this.selectedRoute.retrieve(\"routeName\") || this.selectedRoute.get(\"text\");\r\n var opinion = this.getData(\"inputTextarea\");\r\n if (opinion === MWF.xApplication.process.Work.LP.inputText) opinion = \"\";\r\n var medias = [];\r\n if (this.handwritingFile) medias.push(this.handwritingFile);\r\n if (this.soundFile) medias.push(this.soundFile);\r\n if (this.videoFile) medias.push(this.videoFile);\r\n\r\n var currentRouteId = this.selectedRoute.retrieve(\"route\");\r\n var routeConfig = this.getRouteConfig(currentRouteId);\r\n if (!opinion && medias.length === 0) {\r\n if (routeConfig.opinionRequired == true) {\r\n this.inputTextarea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.inputTextarea,\r\n delayClose: 6000,\r\n content: \"请填写意见\"\r\n });\r\n return false;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: validation\r\n });\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: \"路由校验失败\"\r\n });\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n //var array = [routeName, opinion, medias];\r\n //this.node.mask({\r\n // \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n // \"destroyOnHide\": true,\r\n // \"style\": {\r\n // \"background-color\": \"#999\",\r\n // \"opacity\": 0.3,\r\n // \"z-index\":600\r\n // }\r\n //});\r\n //this.fireEvent(\"submit\", array );\r\n\r\n var appendTaskOrgItem;\r\n if (routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\") {\r\n if (!this.orgItems || this.orgItems.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"没有配置转交人,请联系管理员\" //\"没有配置转交人,请联系管理员\"\r\n });\r\n return false;\r\n } else {\r\n appendTaskOrgItem = this.orgItems[0]\r\n }\r\n }\r\n\r\n if (!this.saveOrgs()) return false;\r\n\r\n //this.saveOrgsWithCheckEmpower( function(){\r\n var appandTaskIdentityList;\r\n if (appendTaskOrgItem) {\r\n appandTaskIdentityList = appendTaskOrgItem.getData();\r\n if (!appandTaskIdentityList || appandTaskIdentityList.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"请选择转交人\"\r\n });\r\n return;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n validation,\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n \"路由校验失败\",\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n this.node.mask({\r\n \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n \"destroyOnHide\": true,\r\n \"style\": {\r\n \"background-color\": \"#999\",\r\n \"opacity\": 0.3,\r\n \"z-index\": 600\r\n }\r\n });\r\n\r\n // var array = [ routeName, opinion, medias, appandTaskIdentityList, this.orgItems, function(){\r\n // if(appendTaskOrgItem)appendTaskOrgItem.setData([]);\r\n // }];\r\n\r\n var op = this.form.getOpinion();\r\n var mds = op.medias;\r\n\r\n if (!medias || !medias.length) {\r\n medias = mds;\r\n } else {\r\n medias = medias.concat(mds)\r\n }\r\n\r\n this.form.submitWork(routeName, opinion, medias, function () {\r\n this.close();\r\n }.bind(this), this, null, appandTaskIdentityList, this.orgItems, function () {\r\n if (appendTaskOrgItem) appendTaskOrgItem.setData([]);\r\n this.setData(\"inputTextarea\", \"\");\r\n }.bind(this));\r\n\r\n // this.fireEvent(\"submit\", array );\r\n },\r\n\r\n close: function () {\r\n this.node.setStyle(\"display\", \"none\");\r\n this.status = \"closed\";\r\n },\r\n destroy: function () {\r\n // this.node.empty();\r\n // delete this.task;\r\n // delete this.node;\r\n // delete this.routeSelectorTile;\r\n // delete this.routeSelectorArea;\r\n // delete this.routeOpinionTile;\r\n // delete this.routeOpinionArea;\r\n // delete this.buttonsArea;\r\n // delete this.inputOpinionNode;\r\n // delete this.inputTextarea;\r\n // delete this.cancelButton;\r\n // delete this.okButton;\r\n },\r\n loadOrgs: function (route) {\r\n if (!this.form || !route) {\r\n this.hideOrgsArea();\r\n return;\r\n } else {\r\n this.showOrgsArea();\r\n }\r\n if (!this.orgTableObject) this.orgTableObject = {};\r\n if (!this.orgItemsObject) this.orgItemsObject = {};\r\n if (!this.orgItemsMap) this.orgItemsMap = {};\r\n var isLoaded = false;\r\n for (var key in this.orgTableObject) {\r\n if (route === key) {\r\n isLoaded = true;\r\n } else {\r\n this.orgTableObject[key].hide();\r\n }\r\n }\r\n if (isLoaded) {\r\n this.showOrgs_mobile(route);\r\n } else {\r\n this.createOrgs_mobile(route)\r\n }\r\n },\r\n showOrgs_mobile: function (route) {\r\n this.orgItemMap = this.orgItemsMap[route] || {};\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n if (dataVisable.length) {\r\n if (this.isSameArray(Object.keys(this.orgItemMap), dataVisable.map(function (d) {\r\n return d.name\r\n }))) {\r\n this.orgTableObject[route].show();\r\n this.orgItems = this.orgItemsObject[route] || [];\r\n this.setSize(dataVisable.length);\r\n } else {\r\n this.loadOrgTable_mobile(route);\r\n }\r\n } else {\r\n this.orgsArea.hide();\r\n this.orgItemMap = {};\r\n this.orgItems = [];\r\n this.setSize(0);\r\n }\r\n },\r\n createOrgs_mobile: function (route) {\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n if (dataVisable.length) {\r\n this.loadOrgTable_mobile(route);\r\n } else {\r\n this.setSize(dataVisable.length);\r\n this.orgItemMap = {};\r\n this.orgItems = [];\r\n this.orgsArea.hide();\r\n }\r\n },\r\n loadOrgTable_mobile: function (route) {\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n this.setSize(dataVisable.length);\r\n\r\n this.orgsArea.show();\r\n\r\n var table_old = this.orgTableObject[route];\r\n var divsMap_old = {};\r\n if (table_old) {\r\n var divs = table_old.getChildren(\"div\");\r\n divs.each(function (div) {\r\n divsMap_old[div.retrieve(\"orgName\")] = div;\r\n });\r\n }\r\n\r\n var orgItems_old = this.orgItemsObject[route] || [];\r\n var orgItemMap_old = this.orgItemsMap[route] || {};\r\n\r\n this.orgItemsObject[route] = [];\r\n this.orgItemsMap[route] = {};\r\n\r\n this.orgItems = this.orgItemsObject[route];\r\n this.orgItemMap = this.orgItemsMap[route];\r\n\r\n var routeOrgTable = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTable\r\n }).inject(this.orgsArea);\r\n this.orgTableObject[route] = routeOrgTable;\r\n\r\n var ignoreFirstOrgOldData = false\r\n\r\n dataVisable.each(function (config, i) {\r\n var sNode = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTr\r\n }).inject(routeOrgTable);\r\n sNode.store(\"orgName\", config.name);\r\n if (orgItemMap_old[config.name]) {\r\n var org = orgItemMap_old[config.name];\r\n this.orgItems.push(org);\r\n this.orgItemMap[config.name] = org;\r\n\r\n var div = divsMap_old[config.name];\r\n div.getChildren().inject(sNode);\r\n } else {\r\n this.loadOrg(sNode, config, ignoreFirstOrgOldData && i == 0)\r\n }\r\n }.bind(this));\r\n if (table_old) table_old.destroy();\r\n\r\n },\r\n loadOrg: function (container, json, position, ignoreOldData) {\r\n var titleNode = new Element(\"div.selectorTitle\", {\r\n \"styles\": this.css.selectorTitle\r\n }).inject(container);\r\n var titleTextNode = new Element(\"div.selectorTitleText\", {\r\n \"text\": json.title,\r\n \"styles\": this.css.selectorTitleText\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.selectorContent\", {\r\n \"styles\": this.css.selectorContent\r\n }).inject(container);\r\n\r\n var errorNode = new Element(\"div.selectorErrorNode\", {\r\n \"styles\": this.css.selectorErrorNode\r\n }).inject(container);\r\n\r\n var org = new O2ProcessorMobile.Org(contentNode, this.form, json, this, {\r\n onSelect: function (items, data) {\r\n if (!data || !data.length) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n } else {\r\n contentNode.setStyles(this.css.selectorContent);\r\n }\r\n }.bind(this)\r\n });\r\n org.ignoreOldData = ignoreOldData;\r\n org.errContainer = errorNode;\r\n org.summitDlalog = this;\r\n this.orgItems.push(org);\r\n\r\n titleNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n contentNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n\r\n var defaultValue = org.getValue();\r\n org.loadOrgWidget(defaultValue, contentNode);\r\n if (!defaultValue || defaultValue.length == 0) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n }\r\n\r\n },\r\n showOrgsByRoute: function (route) {\r\n //debugger;\r\n this.loadOrgs(route);\r\n },\r\n isSameArray: function (arr1, arr2) {\r\n if (arr1.length !== arr2.length) return false;\r\n for (var i = 0; i < arr1.length; i++) {\r\n if (arr1[i] !== arr2[i]) return false;\r\n }\r\n return true;\r\n },\r\n validationOrgs: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.validation()) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n isOrgsHasEmpower: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = false;\r\n this.needCheckEmpowerOrg = [];\r\n this.orgItems.each(function (item) {\r\n if (item.hasEmpowerIdentity()) {\r\n this.needCheckEmpowerOrg.push(item);\r\n flag = true;\r\n }\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgs: function (keepSilent) {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.save(!keepSilent)) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgsWithCheckEmpower: function (callback) {\r\n debugger;\r\n if (!this.orgItems || !this.orgItems.length) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n if (!this.validationOrgs()) return false;\r\n if (!this.isOrgsHasEmpower()) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n //this.checkEmpowerMode = true;\r\n this.showEmpowerDlg(callback);\r\n },\r\n showEmpowerDlg: function (callback) {\r\n\r\n //this.needCheckEmpowerOrg.each( function(org){\r\n // org.saveCheckedEmpowerData();\r\n //}.bind(this));\r\n\r\n var empowerNode = new Element(\"div.empowerNode\", {\"styles\": this.css.empowerNode});\r\n var empowerTitleNode = new Element(\"div\", {\r\n text: \"下列人员对工作进行了授权,选择后文件将发送给被授权人,取消选择后文件将发送给授权者本人\",\r\n styles: this.css.empowerTitleNode\r\n }).inject(empowerNode);\r\n\r\n var orgs = this.needCheckEmpowerOrg;\r\n var len = orgs.length;\r\n var lines = ((len + 1) / 2).toInt();\r\n\r\n var empowerTable = new Element(\"table\", {\r\n \"cellspacing\": 0, \"cellpadding\": 0, \"border\": 0, \"width\": \"100%\",\r\n \"styles\": this.css.empowerTable\r\n }).inject(empowerNode);\r\n\r\n for (var n = 0; n < lines; n++) {\r\n var tr = new Element(\"tr\").inject(empowerTable);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerOddTd}).inject(tr);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerEvenTd}).inject(tr);\r\n }\r\n\r\n var trs = empowerTable.getElements(\"tr\");\r\n orgs.each(function (org, i) {\r\n var sNode;\r\n var width;\r\n if (i + 1 == len && (len % 2 === 1)) {\r\n sNode = trs[trs.length - 1].getFirst(\"td\");\r\n sNode.set(\"colspan\", 2);\r\n trs[trs.length - 1].getLast(\"td\").destroy();\r\n width = \"50%\";\r\n } else {\r\n var row = ((i + 2) / 2).toInt();\r\n var tr = trs[row - 1];\r\n sNode = (i % 2 === 0) ? tr.getFirst(\"td\") : tr.getLast(\"td\");\r\n }\r\n\r\n var titleNode = new Element(\"div.empowerAreaTitle\", {\r\n \"styles\": this.css.empowerAreaTitle\r\n }).inject(sNode);\r\n\r\n var titleTextNode = new Element(\"div.empowerAreaTitleText\", {\r\n \"text\": org.json.title,\r\n \"styles\": this.css.empowerAreaTitleText\r\n }).inject(titleNode);\r\n\r\n var selectAllNode = new Element(\"div\", {\r\n styles: {\r\n float: \"right\"\r\n }\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.empowerAreaContent\", {\r\n \"styles\": this.css.empowerAreaContent\r\n }).inject(sNode);\r\n\r\n org.loadCheckEmpower(null, contentNode, selectAllNode);\r\n\r\n }.bind(this));\r\n\r\n empowerNode.setStyle(\"height\", lines * this.options.orgHeight + 20);\r\n //var dlgHeight = Math.min( Math.floor( this.form.app.content.getSize().y * 0.9) , lines*this.options.orgHeight + 151 );\r\n\r\n //var width = this.node.retrieve(\"width\");\r\n //empowerNode.setStyle( \"width\", width );\r\n var width = \"880\";\r\n //if( len > 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle(\"width\", width + \"px\");\r\n\r\n this.node.getParent().mask({\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\": false,\r\n \"buttonList\": [\r\n {\r\n \"type\": \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function (d, e) {\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each(function (org, i) {\r\n org.saveCheckedEmpowerData(function () {\r\n if (i === orgs.length - 1) {\r\n if (callback) callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\": \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function () {\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss: function () {\r\n this.css = {\r\n\r\n \"routeGroupNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\": \"28px\",\r\n \"color\": \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"border-radius\": \"5px\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-left\": \"26px\",\r\n \"padding-right\": \"8px\",\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\": {\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\": {\r\n \"color\": \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#3296FA\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"padding\": \"4px 4px 4px 4px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background\": \"#ffffff\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"height\": \"3em\",\r\n \"line-height\": \"3em\",\r\n \"margin\": \"5px auto\",\r\n \"border-radius\": \"5px\",\r\n \"border\": \"1px solid #3296FA\",\r\n \"background-color\": \"#3296FA\",\r\n \"text-align\": \"center\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\"\r\n },\r\n\r\n \"inputOpinionAudioRecordAction\": {\r\n \"display\": \"none\",\r\n \"float\": \"right\",\r\n \"border\": \"1px solid #6681a5\",\r\n \"border-radius\": \"3px\",\r\n \"cursor\": \"pointer\",\r\n \"padding-left\": \"24px\",\r\n \"padding-right\": \"5px\",\r\n \"margin-left\": \"5px\",\r\n \"background\": \"url(\" + \"/x_component_process_Work/$Processor/default/audioRecord.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeOrgTable\": {},\r\n \"routeOrgTr\": {\r\n \"margin-bottom\": \"10px\"\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n\r\n \"selectorTitle\": {\r\n \"padding\": \"0px 4px\",\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"font-size\": \"14px\",\r\n // \"font-weight\": \"bold\",\r\n \"color\": \"#000\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/mobile/arrow_right2.png) no-repeat right 10px center\",\r\n \"background-color\": \"#fff\"\r\n },\r\n \"selectorTitle_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"selectorTitleText\": {\r\n// \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\": {\r\n //\"float\" : \"right\",\r\n \"background-color\": \"#fff\",\r\n \"margin-right\": \"5px\",\r\n \"font-weight\": \"normal\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"background-color\": \"#fff\",\r\n \"padding\": \"0px 5px 5px 5px\"\r\n },\r\n \"selectorContent_noItem\": {\r\n \"padding\": \"0px\"\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\n\r\nO2ProcessorMobile.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n setTimeout( function(){ //如果有输入法界面,这个时候页面的计算不对,所以等100毫秒\r\n var options = this.getOptions();\r\n if(options){\r\n //this.selector = new MWF.O2Selector(this.container, options);\r\n this.selector = new MWF.O2Selector($(document.body), options);\r\n }\r\n }.bind(this), 100 )\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2ProcessorMobile.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2ProcessorMobile.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"default\",\r\n \"zIndex\" : 3000\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n var mobileEvents = {\r\n \"onComplete\": function(items){\r\n this.selectOnComplete(items);\r\n }.bind(this),\r\n \"onCancel\": this.selectOnCancel.bind(this),\r\n \"onClose\": this.selectOnClose.bind(this)\r\n };\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n mobileEvents,\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n if( typeOf(data) === \"string\" ){\r\n data = { distinguishedName : data, name : o2.name.cn(data) };\r\n }\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue() || [];\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n setDataToOriginal: function () {\r\n var v = this._computeValue();\r\n this.setData(v || \"\");\r\n },\r\n resetData: function(){\r\n var v = this.getValue() || [];\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n return this.getValue();\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2ProcessorMobile.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2ProcessorMobile.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});", + "html": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessorMobile\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load( defaultRoute );\r\n});\r\n\r\nthis.define(\"popupProcessorMobile\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2ProcessorMobile(this);\r\n }\r\n this.processor.load( defaultRoute );\r\n});\r\n\r\nwindow.O2ProcessorMobile = new Class({\r\n Implements: [Events],\r\n initialize: function (macro) {\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = $(document.body); //this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant: function () {\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n },\r\n load: function ( defaultRoute ) {\r\n this.defaultRoute = defaultRoute || \"\";\r\n if ( this.status === \"show\" || this.status === \"loading\" ){\r\n\r\n }else if (this.status === \"closed\" ) {\r\n this.node.show();\r\n // this.positionSeted = false; //重新设置位置\r\n // this.setSize( this.getCurrentRouteOrgList().length );\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n if( currentRoute )this.showOrgsByRoute(currentRoute);\r\n this.status = \"show\";\r\n } else {\r\n this.status = \"loading\";\r\n this.container = new Element(\"div\").inject(this.appContentNode);\r\n this.node.setStyles({\r\n \"width\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"z-index\" : \"101\"\r\n })\r\n this.loadContent();\r\n this.setEvents();\r\n this.node.inject(this.container);\r\n this.status = \"show\";\r\n }\r\n },\r\n loadContent: function () {\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if (orgLength === 0) { //流程选人数量为0\r\n if (this.orgsTile) {\r\n this.orgsTile.destroy();\r\n this.orgsTile = null;\r\n }\r\n if (this.orgsArea) {\r\n this.orgsArea.destroy();\r\n this.orgsArea = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if (this.hasDecisionOpinion) { //有决策组\r\n this.setRouteGroupList();\r\n } else { //没有决策组\r\n if (this.routeGroupTitle) {\r\n this.routeGroupTitle.destroy();\r\n this.routeGroupTitle = null;\r\n }\r\n if (this.routeGroupArea) {\r\n this.routeGroupArea.destroy();\r\n this.routeGroupArea = null;\r\n }\r\n // this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n // if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n // this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n // }\r\n this.setRouteList();\r\n }\r\n },\r\n\r\n getAllNode: function () {\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n\r\n this.routeGroupTitle = this.getNode(\"routeGroupTitle\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitle = this.getNode(\"routeSelectorTitle\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNode = this.getNode(\"inputOpinionNode\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n\r\n this.orgsTile = this.getNode(\"orgsTile\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.buttonsArea = this.getNode(\"submitButtonNode\");\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEvents: function () {\r\n if (this.cancelButton) {\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if (this.okButton) {\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n getNode: function (name) {\r\n if (this.macro.form.get(name)) {\r\n return this.macro.form.get(name).node;\r\n }\r\n if (this.form.allForName[name]) {\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData: function (name, value) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData: function (name) {\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList: function () { //获取当前待办的所有路由设置\r\n if (!this.routeConfigList) {\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute({\"valueList\": this.task.routeList}, function (json) {\r\n json.data.each(function (d) {\r\n d.selectConfigList = JSON.parse(d.selectConfig || \"[]\");\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false);\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig: function (routeId) { //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i];\r\n }\r\n }\r\n },\r\n getMaxOrgLength: function () { //获取当前待办下可能的最多选人组件个数\r\n var routeList = this.getRouteConfigList();\r\n var length = 0;\r\n routeList.each(function (route) {\r\n if (route.hiddenScriptText) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n length = Math.max(length, route.selectConfigList.length);\r\n }.bind(this));\r\n return length;\r\n },\r\n getOrgConfig: function (routeId) { //获取人员选择配置\r\n var routeList = this.getRouteConfigList();\r\n for (var i = 0; i < routeList.length; i++) {\r\n if (routeList[i].id === routeId) {\r\n return routeList[i].selectConfigList;\r\n }\r\n }\r\n },\r\n getVisableOrgConfig: function (routeId) {\r\n var selectConfigList = this.getOrgConfig(routeId);\r\n var list = [];\r\n (selectConfigList || []).each(function (config) {\r\n if (!this.isOrgHidden(config)) {\r\n list.push(config);\r\n }\r\n }.bind(this));\r\n return list;\r\n },\r\n isOrgHidden: function (d) {\r\n if (d.hiddenScript && d.hiddenScript.code) { //如果隐藏路由,返回\r\n var hidden = this.form.Macro.exec(d.hiddenScript.code, this);\r\n if (hidden && hidden.toString() === \"true\") return true;\r\n }\r\n return false;\r\n },\r\n getCurrentRouteSelectorList: function () { //获取当前路由的人员选择器对象\r\n var selectorList = [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n if (!orgList) return [];\r\n orgList.each(function (org) {\r\n if (org.selector && org.selector.selector) {\r\n selectorList.push(org.selector.selector);\r\n }\r\n }.bind(this))\r\n return selectorList;\r\n },\r\n getCurrentRouteOrgList: function () { //获取当前路由的org对象\r\n if( !this.orgItemsObject )return [];\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n var orgList = this.orgItemsObject[currentRoute];\r\n return orgList || [];\r\n },\r\n getSelectorSelectedData: function (filedName) { //获取人员选择器选择的值\r\n var data = [];\r\n var orgList = this.getCurrentRouteOrgList();\r\n for (var i = 0; i < orgList.length; i++) {\r\n var org = orgList[i];\r\n if (org.json.name === filedName) {\r\n var selector = org.selector.selector;\r\n selector.selectedItems.each(function (item) {\r\n data.push(item.data)\r\n })\r\n }\r\n }\r\n return data;\r\n },\r\n getMarginY: function (node) {\r\n return (node.getStyle(\"margin-top\").toInt() || 0) +\r\n (node.getStyle(\"margin-bottom\").toInt() || 0);\r\n // (node.getStyle(\"padding-top\").toInt() || 0 ) +\r\n // (node.getStyle(\"padding-bottom\").toInt() || 0 )+\r\n // (node.getStyle(\"border-top-width\").toInt() || 0 ) +\r\n // (node.getStyle(\"border-bottom-width\").toInt() || 0 );\r\n },\r\n setSize: function (currentOrgLength) {\r\n var lines = ((currentOrgLength + 1) / 2).toInt();\r\n\r\n if (lines > 0) {\r\n this.showOrgsArea();\r\n } else {\r\n this.hideOrgsArea();\r\n }\r\n\r\n if (this.buttonsArea) {\r\n var bodySize = this.appContentNode.getSize();\r\n var nodeHeight = bodySize.y - this.getMarginY(this.node);\r\n this.node.setStyles({\r\n \"overflow-y\": \"hidden\",\r\n \"height\": nodeHeight\r\n });\r\n var buttonsAreaSize = this.buttonsArea.getSize();\r\n this.contentNode.setStyles({\r\n \"height\": nodeHeight - buttonsAreaSize.y - this.getMarginY(this.buttonsArea) - this.getMarginY(this.contentNode),\r\n \"overflow-y\": \"auto\"\r\n })\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n showOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.show();\r\n if (this.orgsArea) this.orgsArea.show();\r\n },\r\n hideOrgsArea: function () {\r\n if (this.orgsTile) this.orgsTile.hide();\r\n if (this.orgsArea) this.orgsArea.hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList: function () { //获取决策组并格式化成对象\r\n if (this.routeGroupObject) return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function (route, i) {\r\n\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n } else {\r\n route.displayName = route.name;\r\n }\r\n\r\n if (route.decisionOpinion) { //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each(function (decisionOption) {\r\n this.routeGroupNameList.combine([decisionOption]);\r\n var d = this.splitByStartNumber(decisionOption);\r\n if (!this.routeGroupObject[d.name]) this.routeGroupObject[d.name] = [];\r\n this.routeGroupObject[d.name].push(route);\r\n }.bind(this))\r\n } else {\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine([defaultName]);\r\n if (!this.routeGroupObject[defaultName]) this.routeGroupObject[defaultName] = [];\r\n this.routeGroupObject[defaultName].push(route);\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber: function (str) {\r\n var obj = {\r\n name: \"\",\r\n order: \"\"\r\n };\r\n for (var i = 0; i < str.length; i++) {\r\n if (parseInt(str.substr(i, 1)).toString() !== \"NaN\") {\r\n obj.order = obj.order + str.substr(i, 1);\r\n } else {\r\n obj.name = str.substr(i, str.length);\r\n break;\r\n }\r\n }\r\n return obj;\r\n },\r\n setRouteGroupList: function () { //排序并创建决策组DOM对象\r\n var _self = this;\r\n\r\n this.routeGroupNodeMap = {};\r\n\r\n //根据决策组的排序号进行排序\r\n var keys = this.routeGroupNameList;\r\n keys.sort(function (a, b) {\r\n var aIdx = parseInt(this.splitByStartNumber(a).order || \"9999999\");\r\n var bIdx = parseInt(this.splitByStartNumber(b).order || \"9999999\");\r\n return aIdx - bIdx;\r\n }.bind(this));\r\n\r\n var list = [];\r\n keys.each(function (k) {\r\n list.push(this.splitByStartNumber(k).name)\r\n }.bind(this));\r\n\r\n debugger;\r\n var flag = false;\r\n list.each(function (routeGroupName) {\r\n var routeList = this.routeGroupObject[routeGroupName];\r\n var routeGroupNode = new Element(\"div\", {\r\n \"styles\": this.css.routeGroupNode,\r\n \"text\": routeGroupName\r\n }).inject(this.routeGroupArea);\r\n routeGroupNode.store(\"routeList\", routeList);\r\n routeGroupNode.store(\"routeGroupName\", routeGroupName);\r\n\r\n this.routeGroupNodeMap[routeGroupName] = routeGroupNode;\r\n\r\n routeGroupNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRouteGroup(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRouteGroup(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRouteGroup(this);\r\n }\r\n });\r\n\r\n if (keys.length === 1) { //如果决策组只有1个,则默认选中\r\n this.selectRouteGroup(routeGroupNode);\r\n flag = false;\r\n } else {\r\n flag = true;\r\n }\r\n }.bind(this));\r\n if(flag){\r\n this.setSize(0);\r\n }\r\n },\r\n overRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode_over);\r\n }\r\n },\r\n outRouteGroup: function (node) {\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n } else {\r\n node.setStyles(this.css.routeGroupNode);\r\n }\r\n },\r\n selectRouteGroup: function (node) { //选中决策组执行...\r\n if (this.selectedRouteGroup) {\r\n if (this.selectedRouteGroup.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode);\r\n //this.selectedRouteGroup.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRouteGroup = node;\r\n this.selectedRouteGroup.setStyles(this.css.routeGroupNode_selected);\r\n //this.selectedRouteGroup.addClass(\"mainColor_bg\");\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n\r\n } else {\r\n\r\n }\r\n } else {\r\n this.selectedRouteGroup = node;\r\n node.setStyles(this.css.routeGroupNode_selected);\r\n\r\n var routeList = this.selectedRouteGroup.retrieve(\"routeList\");\r\n this.setRouteList(routeList);\r\n }\r\n this.routeGroupArea.setStyle(\"background-color\", \"#FFF\");\r\n },\r\n setRouteList: function (routeList) { //创建决策对象\r\n var _self = this;\r\n this.routeSelectorArea.empty();\r\n this.selectedRoute = null;\r\n\r\n this.routeNodeMap = {};\r\n\r\n if (!routeList) routeList = this.getRouteConfigList();\r\n var isSelected = false;\r\n var isSelectedDefault = false;\r\n routeList.each(function (route, i) {\r\n if (route.hiddenScriptText && this.form && this.form.Macro) { //如果隐藏路由,返回\r\n if (this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\") return;\r\n }\r\n var routeName = route.name;\r\n if (route.displayNameScriptText && this.form && this.form.Macro) { //如果有显示名称公式\r\n routeName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }\r\n var routeNode = new Element(\"div\", {\r\n \"styles\": this.css.routeNode,\r\n \"text\": routeName\r\n }).inject(this.routeSelectorArea);\r\n routeNode.store(\"route\", route.id);\r\n routeNode.store(\"routeName\", route.name);\r\n\r\n this.routeNodeMap[route.id] = routeNode;\r\n this.routeNodeMap[route.name] = routeNode;\r\n\r\n routeNode.addEvents({\r\n \"mouseover\": function (e) {\r\n _self.overRoute(this);\r\n },\r\n \"mouseout\": function (e) {\r\n _self.outRoute(this);\r\n },\r\n \"click\": function (e) {\r\n _self.selectRoute(this);\r\n }\r\n });\r\n\r\n if( route.id === this.defaultRoute || route.name === this.defaultRoute) {\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n isSelectedDefault = true;\r\n }else if ( !isSelectedDefault && (routeList.length == 1 || route.sole )) { //sole表示优先路由\r\n this.selectRoute(routeNode);\r\n isSelected = true;\r\n }\r\n\r\n }.bind(this));\r\n if (!isSelected) {\r\n this.setSize(0);\r\n }\r\n },\r\n overRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode_over);\r\n node.addClass(\"lightColor_bg\");\r\n }\r\n },\r\n outRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n } else {\r\n node.setStyles(this.css.routeNode);\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n },\r\n getDefaultOpinion: function( node ){\r\n var routeId = node.retrieve(\"route\");\r\n var routeDate = this.getRouteConfig( routeId );\r\n return routeDate.opinion || \"\";\r\n },\r\n selectRouteByName: function( route ){\r\n\r\n },\r\n selectRoute: function (node) {\r\n if (this.selectedRoute) {\r\n if (this.selectedRoute.get(\"text\") != node.get(\"text\")) {\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n if( this.getData(\"inputTextarea\") === this.getDefaultOpinion( this.selectedRoute ) ||\r\n this.getData(\"inputTextarea\") === \"\"\r\n ){\r\n this.setData( \"inputTextarea\", this.getDefaultOpinion(node) || \"\" );\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n\r\n } else {\r\n if ( this.getData(\"inputTextarea\") === this.getDefaultOpinion(this.selectedRoute)) {\r\n this.setData( \"inputTextarea\", \"\");\r\n }\r\n\r\n this.selectedRoute.setStyles(this.css.routeNode);\r\n this.selectedRoute.addClass(\"lightColor_bg\");\r\n this.selectedRoute.removeClass(\"mainColor_bg\");\r\n\r\n this.selectedRoute = null;\r\n }\r\n } else {\r\n if (this.getData(\"inputTextarea\") === \"\") {\r\n var defaultOpinion1 = this.getDefaultOpinion(node);\r\n if (defaultOpinion1) this.setData( \"inputTextarea\", defaultOpinion1);\r\n }\r\n\r\n this.selectedRoute = node;\r\n node.setStyles(this.css.routeNode_selected);\r\n node.addClass(\"mainColor_bg\");\r\n node.removeClass(\"lightColor_bg\");\r\n }\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#FFF\");\r\n\r\n this.loadOrgs(this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\");\r\n\r\n if (this.form.data.json.events && this.form.data.json.events.afterSelectRoute) {\r\n this.form.Macro.exec(this.form.data.json.events.afterSelectRoute.code, node);\r\n }\r\n\r\n },\r\n /*决策和决策组相关 结束*/\r\n\r\n setOpinion: function () {\r\n if (!this.inputTextarea) return;\r\n if (this.handwritingAction) this.handwritingAction.addEvent(\"click\", function () {\r\n window.setTimeout( function(){\r\n this.handwriting();\r\n }.bind(this), 100 )\r\n }.bind(this));\r\n\r\n if (this.selectIdeaAreaNode) {\r\n MWF.require(\"MWF.widget.UUID\", function () {\r\n MWF.UD.getDataJson(\"idea\", function (json) {\r\n if (json) {\r\n if (json.ideas) {\r\n this.setIdeaList(json.ideas);\r\n }\r\n } else {\r\n MWF.UD.getPublicData(\"idea\", function (pjson) {\r\n if (pjson) {\r\n if (pjson.ideas) {\r\n this.setIdeaList(pjson.ideas);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n }.bind(this));\r\n }.bind(this));\r\n }\r\n\r\n },\r\n\r\n audioRecord: function () {\r\n if (!this.audioRecordNode) this.createAudioRecord();\r\n this.audioRecordNode.show();\r\n this.audioRecordNode.position({\r\n \"relativeTo\": this.options.mediaNode || this.node,\r\n \"position\": \"center\",\r\n \"edge\": \"center\"\r\n });\r\n\r\n MWF.require(\"MWF.widget.AudioRecorder\", function () {\r\n this.audioRecorder = new MWF.widget.AudioRecorder(this.audioRecordNode, {\r\n \"onSave\": function (blobFile) {\r\n this.soundFile = blobFile;\r\n this.audioRecordNode.hide();\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.soundFile = null;\r\n this.audioRecordNode.hide();\r\n }.bind(this)\r\n }, null);\r\n }.bind(this));\r\n },\r\n createAudioRecord: function () {\r\n this.audioRecordNode = new Element(\"div\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n var size = (this.options.mediaNode || this.node).getSize();\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.audioRecordNode.setStyles({\r\n \"height\": \"\" + size.y + \"px\",\r\n \"width\": \"\" + size.x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n },\r\n\r\n handwriting: function () {\r\n if (!this.handwritingNode) this.createHandwriting();\r\n if(this.handwritingNodeMask)this.handwritingNodeMask.show();\r\n this.handwritingNode.show();\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n },\r\n createHandwriting: function () {\r\n this.handwritingNodeMask = new Element(\"div.handwritingMask\", {\"styles\": this.css.handwritingMask}).inject(this.node);\r\n\r\n this.handwritingNode = new Element(\"div.handwritingNode\", {\"styles\": this.css.handwritingNode}).inject(this.node, \"after\");\r\n //var size = (this.options.mediaNode || this.node).getSize();\r\n //var y = size.y;\r\n //var x = size.x;\r\n //兼容以前的默认高宽\r\n\r\n debugger;\r\n\r\n var bodySize = $(document.body).getSize();\r\n var x = bodySize.x;\r\n var y = bodySize.y;\r\n\r\n var zidx = this.node.getStyle(\"z-index\");\r\n this.handwritingNode.setStyles({\r\n \"height\": \"\" + y + \"px\",\r\n \"width\": \"\" + x + \"px\",\r\n \"z-index\": zidx + 1\r\n });\r\n this.handwritingNode.addEvent('touchmove' , function(e){\r\n e.preventDefault();\r\n });\r\n this.handwritingNode.setStyles({\r\n \"top\": \"0px\",\r\n \"left\": \"0px\"\r\n });\r\n this.handwritingAreaNode = new Element(\"div\", {\"styles\": this.css.handwritingAreaNode}).inject(this.handwritingNode);\r\n // this.handwritingActionNode = new Element(\"div\", {\r\n // \"styles\": this.css.handwritingActionNode,\r\n // \"text\": MWF.xApplication.process.Work.LP.saveWrite\r\n // }).inject(this.handwritingNode);\r\n // var h = this.handwritingActionNode.getSize().y + this.handwritingActionNode.getStyle(\"margin-top\").toInt() + this.handwritingActionNode.getStyle(\"margin-bottom\").toInt();\r\n // h = y - h;\r\n // this.handwritingAreaNode.setStyle(\"height\", \"\" + h + \"px\");\r\n this.handwritingAreaNode.setStyle(\"height\", \"\" + y + \"px\");\r\n\r\n MWF.require(\"MWF.widget.Tablet\", function () {\r\n var handWritingOptions = {\r\n \"style\": \"default\",\r\n \"contentWidth\": 0,\r\n \"contentHeight\": 0,\r\n \"onSave\": function (base64code, base64Image, imageFile) {\r\n this.handwritingFile = imageFile;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n // this.page.get(\"div_image\").node.set(\"src\",base64Image);\r\n\r\n }.bind(this),\r\n \"onCancel\": function () {\r\n this.handwritingFile = null;\r\n this.handwritingNode.hide();\r\n this.handwritingNodeMask.hide();\r\n }.bind(this)\r\n };\r\n handWritingOptions.tools = [\r\n \"undo\",\r\n \"redo\", \"|\",\r\n \"reset\", \"|\",\r\n \"size\",\r\n \"cancel\"\r\n ]\r\n this.tablet = new MWF.widget.Tablet(this.handwritingAreaNode, handWritingOptions, null);\r\n this.tablet.load();\r\n }.bind(this));\r\n\r\n // this.handwritingActionNode.addEvent(\"click\", function () {\r\n // //this.handwritingNode.hide();\r\n // if (this.tablet) this.tablet.save();\r\n // }.bind(this));\r\n },\r\n\r\n setIdeaList: function (ideas) {\r\n var _self = this;\r\n ideas.each(function (idea) {\r\n if (!idea) return;\r\n new Element(\"div\", {\r\n \"styles\": this.css.selectIdeaItemNode,\r\n \"text\": idea,\r\n \"events\": {\r\n \"click\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"dblclick\": function () {\r\n if (!_self.getData(\"inputTextarea\")) {\r\n _self.setData(\"inputTextarea\", this.get(\"text\"));\r\n } else {\r\n _self.setData(\"inputTextarea\", _self.getData(\"inputTextarea\") + \", \" + this.get(\"text\"));\r\n }\r\n },\r\n \"mouseover\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode_over);\r\n },\r\n \"mouseout\": function () {\r\n this.setStyles(_self.css.selectIdeaItemNode);\r\n }\r\n }\r\n }).inject(this.selectIdeaAreaNode);\r\n }.bind(this));\r\n },\r\n submit: function (ev) {\r\n if (this.hasDecisionOpinion && !this.selectedRouteGroup) {\r\n this.routeGroupArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"top\"},\r\n \"请先选择决策组\",\r\n this.routeGroupArea,\r\n null, //{\"x\": 0, \"y\": 30}\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n\r\n if (!this.selectedRoute) {\r\n this.routeSelectorArea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.routeSelectorArea,\r\n delayClose: 6000,\r\n content: \"请先选择决策\"\r\n });\r\n return false;\r\n }\r\n var routeName = this.selectedRoute.retrieve(\"routeName\") || this.selectedRoute.get(\"text\");\r\n var opinion = this.getData(\"inputTextarea\");\r\n if (opinion === MWF.xApplication.process.Work.LP.inputText) opinion = \"\";\r\n var medias = [];\r\n if (this.handwritingFile) medias.push(this.handwritingFile);\r\n if (this.soundFile) medias.push(this.soundFile);\r\n if (this.videoFile) medias.push(this.videoFile);\r\n\r\n var currentRouteId = this.selectedRoute.retrieve(\"route\");\r\n var routeConfig = this.getRouteConfig(currentRouteId);\r\n if (!opinion && medias.length === 0) {\r\n if (routeConfig.opinionRequired == true) {\r\n this.inputTextarea.setStyle(\"background-color\", \"#ffe9e9\");\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.inputTextarea,\r\n delayClose: 6000,\r\n content: \"请填写意见\"\r\n });\r\n return false;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: validation\r\n });\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.node,\r\n delayClose: 6000,\r\n content: \"路由校验失败\"\r\n });\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n //var array = [routeName, opinion, medias];\r\n //this.node.mask({\r\n // \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n // \"destroyOnHide\": true,\r\n // \"style\": {\r\n // \"background-color\": \"#999\",\r\n // \"opacity\": 0.3,\r\n // \"z-index\":600\r\n // }\r\n //});\r\n //this.fireEvent(\"submit\", array );\r\n\r\n var appendTaskOrgItem;\r\n if (routeConfig.type === \"appendTask\" && routeConfig.appendTaskIdentityType === \"select\") {\r\n if (!this.orgItems || this.orgItems.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"没有配置转交人,请联系管理员\" //\"没有配置转交人,请联系管理员\"\r\n });\r\n return false;\r\n } else {\r\n appendTaskOrgItem = this.orgItems[0]\r\n }\r\n }\r\n\r\n if (!this.saveOrgs()) return false;\r\n\r\n //this.saveOrgsWithCheckEmpower( function(){\r\n var appandTaskIdentityList;\r\n if (appendTaskOrgItem) {\r\n appandTaskIdentityList = appendTaskOrgItem.getData();\r\n if (!appandTaskIdentityList || appandTaskIdentityList.length === 0) {\r\n new mBox.Notice({\r\n type: \"error\",\r\n position: {\"x\": \"center\", \"y\": \"top\"},\r\n move: false,\r\n target: this.orgsArea,\r\n delayClose: 6000,\r\n content: \"请选择转交人\"\r\n });\r\n return;\r\n }\r\n }\r\n\r\n if (routeConfig.validationScriptText) {\r\n var validation = this.form.Macro.exec(routeConfig.validationScriptText, this);\r\n if (!validation || validation.toString() !== \"true\") {\r\n if (typeOf(validation) === \"string\") {\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n validation,\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n } else {\r\n //\"路由校验失败\"\r\n MWF.xDesktop.notice(\r\n \"error\",\r\n {\"x\": \"center\", \"y\": \"center\"},\r\n \"路由校验失败\",\r\n this.node,\r\n {\"x\": 0, \"y\": 30},\r\n {\"closeOnBoxClick\": true, \"closeOnBodyClick\": true, \"fixed\": true, \"delayClose\": 6000}\r\n );\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n this.node.mask({\r\n \"inject\": {\"where\": \"bottom\", \"target\": this.node},\r\n \"destroyOnHide\": true,\r\n \"style\": {\r\n \"background-color\": \"#999\",\r\n \"opacity\": 0.3,\r\n \"z-index\": 600\r\n }\r\n });\r\n\r\n // var array = [ routeName, opinion, medias, appandTaskIdentityList, this.orgItems, function(){\r\n // if(appendTaskOrgItem)appendTaskOrgItem.setData([]);\r\n // }];\r\n\r\n var op = this.form.getOpinion();\r\n var mds = op.medias;\r\n\r\n if (!medias || !medias.length) {\r\n medias = mds;\r\n } else {\r\n medias = medias.concat(mds)\r\n }\r\n\r\n this.form.submitWork(routeName, opinion, medias, function () {\r\n this.close();\r\n }.bind(this), this, null, appandTaskIdentityList, this.orgItems, function () {\r\n if (appendTaskOrgItem) appendTaskOrgItem.setData([]);\r\n this.setData(\"inputTextarea\", \"\");\r\n }.bind(this));\r\n\r\n // this.fireEvent(\"submit\", array );\r\n },\r\n\r\n close: function () {\r\n this.node.setStyle(\"display\", \"none\");\r\n this.status = \"closed\";\r\n },\r\n destroy: function () {\r\n // this.node.empty();\r\n // delete this.task;\r\n // delete this.node;\r\n // delete this.routeSelectorTile;\r\n // delete this.routeSelectorArea;\r\n // delete this.routeOpinionTile;\r\n // delete this.routeOpinionArea;\r\n // delete this.buttonsArea;\r\n // delete this.inputOpinionNode;\r\n // delete this.inputTextarea;\r\n // delete this.cancelButton;\r\n // delete this.okButton;\r\n },\r\n loadOrgs: function (route) {\r\n if (!this.form || !route) {\r\n this.hideOrgsArea();\r\n return;\r\n } else {\r\n this.showOrgsArea();\r\n }\r\n if (!this.orgTableObject) this.orgTableObject = {};\r\n if (!this.orgItemsObject) this.orgItemsObject = {};\r\n if (!this.orgItemsMap) this.orgItemsMap = {};\r\n var isLoaded = false;\r\n for (var key in this.orgTableObject) {\r\n if (route === key) {\r\n isLoaded = true;\r\n } else {\r\n this.orgTableObject[key].hide();\r\n }\r\n }\r\n if (isLoaded) {\r\n this.showOrgs_mobile(route);\r\n } else {\r\n this.createOrgs_mobile(route)\r\n }\r\n },\r\n showOrgs_mobile: function (route) {\r\n this.orgItemMap = this.orgItemsMap[route] || {};\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n if (dataVisable.length) {\r\n if (this.isSameArray(Object.keys(this.orgItemMap), dataVisable.map(function (d) {\r\n return d.name\r\n }))) {\r\n this.orgTableObject[route].show();\r\n this.orgItems = this.orgItemsObject[route] || [];\r\n this.setSize(dataVisable.length);\r\n } else {\r\n this.loadOrgTable_mobile(route);\r\n }\r\n } else {\r\n this.orgsArea.hide();\r\n this.orgItemMap = {};\r\n this.orgItems = [];\r\n this.setSize(0);\r\n }\r\n },\r\n createOrgs_mobile: function (route) {\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n if (dataVisable.length) {\r\n this.loadOrgTable_mobile(route);\r\n } else {\r\n this.setSize(dataVisable.length);\r\n this.orgItemMap = {};\r\n this.orgItems = [];\r\n this.orgsArea.hide();\r\n }\r\n },\r\n loadOrgTable_mobile: function (route) {\r\n var dataVisable = this.getVisableOrgConfig(route);\r\n this.setSize(dataVisable.length);\r\n\r\n this.orgsArea.show();\r\n\r\n var table_old = this.orgTableObject[route];\r\n var divsMap_old = {};\r\n if (table_old) {\r\n var divs = table_old.getChildren(\"div\");\r\n divs.each(function (div) {\r\n divsMap_old[div.retrieve(\"orgName\")] = div;\r\n });\r\n }\r\n\r\n var orgItems_old = this.orgItemsObject[route] || [];\r\n var orgItemMap_old = this.orgItemsMap[route] || {};\r\n\r\n this.orgItemsObject[route] = [];\r\n this.orgItemsMap[route] = {};\r\n\r\n this.orgItems = this.orgItemsObject[route];\r\n this.orgItemMap = this.orgItemsMap[route];\r\n\r\n var routeOrgTable = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTable\r\n }).inject(this.orgsArea);\r\n this.orgTableObject[route] = routeOrgTable;\r\n\r\n var ignoreFirstOrgOldData = false\r\n\r\n dataVisable.each(function (config, i) {\r\n var sNode = new Element(\"div\", {\r\n \"styles\": this.css.routeOrgTr\r\n }).inject(routeOrgTable);\r\n sNode.store(\"orgName\", config.name);\r\n if (orgItemMap_old[config.name]) {\r\n var org = orgItemMap_old[config.name];\r\n this.orgItems.push(org);\r\n this.orgItemMap[config.name] = org;\r\n\r\n var div = divsMap_old[config.name];\r\n div.getChildren().inject(sNode);\r\n } else {\r\n this.loadOrg(sNode, config, ignoreFirstOrgOldData && i == 0)\r\n }\r\n }.bind(this));\r\n if (table_old) table_old.destroy();\r\n\r\n },\r\n loadOrg: function (container, json, position, ignoreOldData) {\r\n var titleNode = new Element(\"div.selectorTitle\", {\r\n \"styles\": this.css.selectorTitle\r\n }).inject(container);\r\n var titleTextNode = new Element(\"div.selectorTitleText\", {\r\n \"text\": json.title,\r\n \"styles\": this.css.selectorTitleText\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.selectorContent\", {\r\n \"styles\": this.css.selectorContent\r\n }).inject(container);\r\n\r\n var errorNode = new Element(\"div.selectorErrorNode\", {\r\n \"styles\": this.css.selectorErrorNode\r\n }).inject(container);\r\n\r\n var org = new O2ProcessorMobile.Org(contentNode, this.form, json, this, {\r\n onSelect: function (items, data) {\r\n if (!data || !data.length) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n } else {\r\n contentNode.setStyles(this.css.selectorContent);\r\n }\r\n }.bind(this)\r\n });\r\n org.ignoreOldData = ignoreOldData;\r\n org.errContainer = errorNode;\r\n org.summitDlalog = this;\r\n this.orgItems.push(org);\r\n\r\n titleNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n contentNode.addEvent(\"click\", function () {\r\n this.load();\r\n }.bind(org));\r\n\r\n var defaultValue = org.getValue();\r\n org.loadOrgWidget(defaultValue, contentNode);\r\n if (!defaultValue || defaultValue.length == 0) {\r\n contentNode.setStyles(this.css.selectorContent_noItem);\r\n }\r\n\r\n },\r\n showOrgsByRoute: function (route) {\r\n //debugger;\r\n this.loadOrgs(route);\r\n },\r\n isSameArray: function (arr1, arr2) {\r\n if (arr1.length !== arr2.length) return false;\r\n for (var i = 0; i < arr1.length; i++) {\r\n if (arr1[i] !== arr2[i]) return false;\r\n }\r\n return true;\r\n },\r\n validationOrgs: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.validation()) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n isOrgsHasEmpower: function () {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = false;\r\n this.needCheckEmpowerOrg = [];\r\n this.orgItems.each(function (item) {\r\n if (item.hasEmpowerIdentity()) {\r\n this.needCheckEmpowerOrg.push(item);\r\n flag = true;\r\n }\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgs: function (keepSilent) {\r\n if (!this.orgItems || !this.orgItems.length) return true;\r\n var flag = true;\r\n this.orgItems.each(function (item) {\r\n if (!item.save(!keepSilent)) flag = false;\r\n }.bind(this));\r\n return flag;\r\n },\r\n saveOrgsWithCheckEmpower: function (callback) {\r\n debugger;\r\n if (!this.orgItems || !this.orgItems.length) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n if (!this.validationOrgs()) return false;\r\n if (!this.isOrgsHasEmpower()) {\r\n if (callback) callback();\r\n return true;\r\n }\r\n //this.checkEmpowerMode = true;\r\n this.showEmpowerDlg(callback);\r\n },\r\n showEmpowerDlg: function (callback) {\r\n\r\n //this.needCheckEmpowerOrg.each( function(org){\r\n // org.saveCheckedEmpowerData();\r\n //}.bind(this));\r\n\r\n var empowerNode = new Element(\"div.empowerNode\", {\"styles\": this.css.empowerNode});\r\n var empowerTitleNode = new Element(\"div\", {\r\n text: \"下列人员对工作进行了授权,选择后文件将发送给被授权人,取消选择后文件将发送给授权者本人\",\r\n styles: this.css.empowerTitleNode\r\n }).inject(empowerNode);\r\n\r\n var orgs = this.needCheckEmpowerOrg;\r\n var len = orgs.length;\r\n var lines = ((len + 1) / 2).toInt();\r\n\r\n var empowerTable = new Element(\"table\", {\r\n \"cellspacing\": 0, \"cellpadding\": 0, \"border\": 0, \"width\": \"100%\",\r\n \"styles\": this.css.empowerTable\r\n }).inject(empowerNode);\r\n\r\n for (var n = 0; n < lines; n++) {\r\n var tr = new Element(\"tr\").inject(empowerTable);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerOddTd}).inject(tr);\r\n new Element(\"td\", {\"width\": \"50%\", \"styles\": this.css.empowerEvenTd}).inject(tr);\r\n }\r\n\r\n var trs = empowerTable.getElements(\"tr\");\r\n orgs.each(function (org, i) {\r\n var sNode;\r\n var width;\r\n if (i + 1 == len && (len % 2 === 1)) {\r\n sNode = trs[trs.length - 1].getFirst(\"td\");\r\n sNode.set(\"colspan\", 2);\r\n trs[trs.length - 1].getLast(\"td\").destroy();\r\n width = \"50%\";\r\n } else {\r\n var row = ((i + 2) / 2).toInt();\r\n var tr = trs[row - 1];\r\n sNode = (i % 2 === 0) ? tr.getFirst(\"td\") : tr.getLast(\"td\");\r\n }\r\n\r\n var titleNode = new Element(\"div.empowerAreaTitle\", {\r\n \"styles\": this.css.empowerAreaTitle\r\n }).inject(sNode);\r\n\r\n var titleTextNode = new Element(\"div.empowerAreaTitleText\", {\r\n \"text\": org.json.title,\r\n \"styles\": this.css.empowerAreaTitleText\r\n }).inject(titleNode);\r\n\r\n var selectAllNode = new Element(\"div\", {\r\n styles: {\r\n float: \"right\"\r\n }\r\n }).inject(titleNode);\r\n\r\n var contentNode = new Element(\"div.empowerAreaContent\", {\r\n \"styles\": this.css.empowerAreaContent\r\n }).inject(sNode);\r\n\r\n org.loadCheckEmpower(null, contentNode, selectAllNode);\r\n\r\n }.bind(this));\r\n\r\n empowerNode.setStyle(\"height\", lines * this.options.orgHeight + 20);\r\n //var dlgHeight = Math.min( Math.floor( this.form.app.content.getSize().y * 0.9) , lines*this.options.orgHeight + 151 );\r\n\r\n //var width = this.node.retrieve(\"width\");\r\n //empowerNode.setStyle( \"width\", width );\r\n var width = \"880\";\r\n //if( len > 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle(\"width\", width + \"px\");\r\n\r\n this.node.getParent().mask({\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\": false,\r\n \"buttonList\": [\r\n {\r\n \"type\": \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function (d, e) {\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each(function (org, i) {\r\n org.saveCheckedEmpowerData(function () {\r\n if (i === orgs.length - 1) {\r\n if (callback) callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\": \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function () {\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss: function () {\r\n this.css = {\r\n\r\n \"routeGroupNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\": \"28px\",\r\n \"color\": \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\": {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"border-radius\": \"5px\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-left\": \"26px\",\r\n \"padding-right\": \"8px\",\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\": {\r\n \"color\": \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\": {\r\n \"color\": \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#3296FA\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"padding\": \"4px 4px 4px 4px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background\": \"#ffffff\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"height\": \"3em\",\r\n \"line-height\": \"3em\",\r\n \"margin\": \"5px auto\",\r\n \"border-radius\": \"5px\",\r\n \"border\": \"1px solid #3296FA\",\r\n \"background-color\": \"#3296FA\",\r\n \"text-align\": \"center\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\"\r\n },\r\n\r\n \"inputOpinionAudioRecordAction\": {\r\n \"display\": \"none\",\r\n \"float\": \"right\",\r\n \"border\": \"1px solid #6681a5\",\r\n \"border-radius\": \"3px\",\r\n \"cursor\": \"pointer\",\r\n \"padding-left\": \"24px\",\r\n \"padding-right\": \"5px\",\r\n \"margin-left\": \"5px\",\r\n \"background\": \"url(\" + \"/x_component_process_Work/$Processor/default/audioRecord.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeOrgTable\": {},\r\n \"routeOrgTr\": {\r\n \"margin-bottom\": \"10px\"\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n\r\n \"selectorTitle\": {\r\n \"padding\": \"0px 4px\",\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"font-size\": \"14px\",\r\n // \"font-weight\": \"bold\",\r\n \"color\": \"#000\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/mobile/arrow_right2.png) no-repeat right 10px center\",\r\n \"background-color\": \"#fff\"\r\n },\r\n \"selectorTitle_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"selectorTitleText\": {\r\n// \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\": {\r\n //\"float\" : \"right\",\r\n \"background-color\": \"#fff\",\r\n \"margin-right\": \"5px\",\r\n \"font-weight\": \"normal\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"background-color\": \"#fff\",\r\n \"padding\": \"0px 5px 5px 5px\"\r\n },\r\n \"selectorContent_noItem\": {\r\n \"padding\": \"0px\"\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\n\r\nO2ProcessorMobile.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n setTimeout( function(){ //如果有输入法界面,这个时候页面的计算不对,所以等100毫秒\r\n var options = this.getOptions();\r\n if(options){\r\n //this.selector = new MWF.O2Selector(this.container, options);\r\n this.selector = new MWF.O2Selector($(document.body), options);\r\n }\r\n }.bind(this), 100 )\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2ProcessorMobile.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2ProcessorMobile.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"default\",\r\n \"zIndex\" : 3000\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n var mobileEvents = {\r\n \"onComplete\": function(items){\r\n this.selectOnComplete(items);\r\n }.bind(this),\r\n \"onCancel\": this.selectOnCancel.bind(this),\r\n \"onClose\": this.selectOnClose.bind(this)\r\n };\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n mobileEvents,\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n mobileEvents,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n if( typeOf(data) === \"string\" ){\r\n data = { distinguishedName : data, name : o2.name.cn(data) };\r\n }\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2ProcessorMobile.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue() || [];\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n setDataToOriginal: function () {\r\n var v = this._computeValue();\r\n this.setData(v || \"\");\r\n },\r\n resetData: function(){\r\n var v = this.getValue() || [];\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n return this.getValue();\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2ProcessorMobile.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2ProcessorMobile.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});" + }, "load": { "code": "this.loadProcessorMobile()", "html": "this.loadProcessorMobile()" diff --git a/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_pc.json b/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_pc.json index 6fae053b7fd6302a0d90d75339ea708ed4d81454..db8a3745b2cbffb1363c2e9c7a23afe6aff6b09a 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_pc.json +++ b/o2web/source/x_component_process_FormDesigner/Module/Form/template/form_custom_submit_pc.json @@ -644,8 +644,8 @@ }, "events": { "queryLoad": { - "code": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessor\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nthis.define(\"popupProcessor\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n this.processor.load();\r\n }\r\n this.processor.popup();\r\n});\r\n\r\n\r\n//自定义提交有两种模式,嵌入到表单中显示和弹出窗口显示\r\nwindow.O2Processor = new Class({\r\n Implements: [Events],\r\n initialize : function( macro ){\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant : function(){\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n\r\n //*弹出框参数 开始\r\n this.Width_Narrow = 800; //无选人或者只有一个选人时提交框的宽度\r\n this.Width_Wild = 1100; //有两个以上选人时提交框的宽度\r\n this.Max_Height = 810; //提交框的最大高度\r\n this.Max_Height_Percent = \"98%\"; //提交框的最大高度( 相对于父容器 )\r\n this.Min_Top = 5; //提交框的最小边距\r\n this.Content_Padding_Right = 20; //内容区域的右边距\r\n //*弹出框参数 结束\r\n\r\n this.Tablet_Height = 320; //默认的手写板高度\r\n this.Tablet_Width = 600; //默认的手写板宽度\r\n\r\n this.Org_height = 240; //人员组件的高度,不包括标题\r\n\r\n },\r\n load : function(){ //加载内容\r\n this.loadContent();\r\n this.setEmbeddedEvents();\r\n },\r\n popup : function(){\r\n debugger;\r\n if( this.status === \"closed\" ) {\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n this.node.show();\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize(this.getCurrentRouteOrgList().length);\r\n }else if( this.status === \"embedded\" ){\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }else{\r\n debugger;\r\n this.status = \"popup\";\r\n if( !this.maskNode )this.createMaskNode();\r\n if( !this.container ){\r\n this.container = new Element(\"div\").inject( this.appContentNode );\r\n }\r\n this.positionSeted = false;\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.loadContent();\r\n this.setPopupEvents();\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }\r\n },\r\n close : function(){\r\n if( this.macro.target && this.macro.target.isEmbedded ){ //如果是嵌入在表单中\r\n this.status = \"embedded\";\r\n this.maskNode.setStyle(\"display\",\"none\");\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.show();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.show();\r\n if( this.buttonNode )this.buttonNode.hide();\r\n if( this.topNode )this.topNode.hide();\r\n\r\n this.node.setStyles( this.css.embeddedNode );\r\n this.node.setStyle(\"width\", \"auto\");\r\n this.node.setStyle(\"height\", \"auto\" );\r\n this.contentNode.setStyle(\"height\", \"auto\" );\r\n\r\n this.node.inject( this.embeddedContainer );\r\n }else{\r\n this.status = \"closed\";\r\n if(this.maskNode)this.maskNode.setStyle(\"display\",\"none\");\r\n this.node.setStyle(\"display\",\"none\");\r\n }\r\n },\r\n createMaskNode : function(){\r\n this.maskNode = new Element(\"div.formMaskNode\", {\r\n \"styles\": this.css.mask,\r\n \"events\": {\r\n \"mouseover\": function (e) { e.stopPropagation(); },\r\n \"mouseout\": function (e) { e.stopPropagation(); },\r\n \"click\": function (e) {\r\n // this.close();\r\n e.stopPropagation();\r\n }.bind(this)\r\n // \"mousewheel\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // },\r\n // \"DOMMouseScroll\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // }\r\n }\r\n }).inject( this.appContentNode );\r\n },\r\n loadContent : function(){\r\n if( this.contentLoaded )return;\r\n\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if( orgLength === 0 ) { //流程选人数量为0\r\n if (this.orgsTileTd) {\r\n this.orgsTileTd.getParent(\"tr\").destroy();\r\n this.orgsTileTd = null;\r\n }\r\n if (this.orgsAreaTd) {\r\n this.orgsAreaTd.getParent(\"tr\").destroy();\r\n this.orgsAreaTd = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if( this.hasDecisionOpinion ){ //有决策组\r\n if(this.routeGroupArea)this.routeGroupArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n if(this.routeGroupArea)this.routeSelectorArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n this.setRouteGroupList();\r\n }else{ //没有决策组\r\n if( this.routeGroupTitleTd ){\r\n this.routeGroupTitleTd.destroy();\r\n this.routeGroupTitleTd = null;\r\n this.routeSelectorTitleTd.set(\"colspan\",\"2\");\r\n }\r\n if( this.routeGroupAreaTd ){\r\n this.routeGroupAreaTd.destroy();\r\n this.routeGroupAreaTd = null;\r\n this.routeSelectorAreaTd.set(\"colspan\",\"2\");\r\n }\r\n this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n }\r\n this.setRouteList();\r\n }\r\n this.contentLoaded = true;\r\n },\r\n\r\n getAllNode : function(){\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.embeddedContainer = this.node.getParent();\r\n\r\n this.topNode_embedded = this.getNode(\"submitTopNode_embedded\");\r\n this.buttonNode_embedded = this.getNode(\"submitButtonNode_embedded\");\r\n this.okButton_embedded = this.getNode(\"okButton_embedded\");\r\n\r\n this.topNode = this.getNode(\"submitTopNode\");\r\n this.topCloseAction = this.getNode(\"submitTopCloseActionNode\");\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n this.contentTable = this.getNode(\"submitContentTable\").getElement(\"table\");\r\n\r\n this.routeGroupTitleTd = this.getNode(\"routeGroupTitleTd\");\r\n this.routeGroupAreaTd = this.getNode(\"routeGroupAreaTd\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitleTd = this.getNode(\"routeSelectorTitleTd\");\r\n this.routeSelectorAreaTd = this.getNode(\"routeSelectorAreaTd\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaNodeTd = this.getNode(\"selectIdeaNodeTd\");\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNodeTd = this.getNode(\"inputOpinionNodeTd\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n if( this.form.json.isHandwriting === \"no\" ){\r\n var mediaActionArea = this.getNode(\"mediaActionArea\");\r\n if(mediaActionArea){\r\n mediaActionArea.hide();\r\n }else if( this.handwritingAction ){\r\n this.handwritingAction.hide();\r\n }\r\n }\r\n\r\n this.orgsTileTd = this.getNode(\"orgsTileTd\");\r\n this.orgsAreaTd = this.getNode(\"orgsAreaTd\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEmbeddedEvents : function(){\r\n if(this.okButton_embedded){\r\n this.okButton_embedded.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n setPopupEvents: function(){\r\n if( this.popupEventsSeted )return;\r\n if(this.topCloseAction){\r\n this.topCloseAction.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this))\r\n }\r\n if(this.cancelButton){\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if(this.okButton){\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n if(this.topNode){\r\n this.containerDrag = new Drag.Move(this.node, {\r\n \"handle\": this.topNode,\r\n \"container\": this.markNode || this.appContentNode,\r\n \"snap\": 5\r\n });\r\n }\r\n this.popupEventsSeted = true;\r\n },\r\n getNode : function(name){\r\n if( this.macro.form.get(name) ){\r\n return this.macro.form.get(name).node;\r\n }\r\n if( this.form.allForName[name] ){\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData : function(name, value){\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData : function(name){\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList : function(){ //获取当前待办的所有路由设置\r\n if( !this.routeConfigList ){\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute( {\"valueList\":this.task.routeList} , function( json ){\r\n json.data.each( function(d){\r\n d.selectConfigList = JSON.parse( d.selectConfig || \"[]\" );\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false );\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig : function( routeId ){ //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for( var i=0; i 0 ){\r\n this.showOrgArea();\r\n }else{\r\n this.hideOrgArea();\r\n }\r\n\r\n if( this.orgsArea ){\r\n this.orgsArea.setStyle(\"height\", ( this.Org_height + 26 ) * lines );\r\n }\r\n\r\n if( this.status !== \"popup\" )return; //如果不是弹出模式,则返回\r\n\r\n var maxOrgLength = this.getMaxOrgLength();\r\n if( maxOrgLength === 0 ){ //流程选人数量为0\r\n this.node.setStyle(\"width\", this.Width_Narrow);\r\n }else if( maxOrgLength === 1 ){\r\n this.node.setStyle(\"width\", this.Width_Narrow);\r\n }else{\r\n this.node.setStyle(\"width\", this.Width_Wild );\r\n }\r\n\r\n var maxHeigh = this.getMaxHeight();\r\n\r\n var height = 0, topHeight = 0, buttonHeight = 0;\r\n var contentWrapOffestY = 0, contentOffsetY = 0;\r\n\r\n if( this.topNode )topHeight = this.getOffsetY(this.topNode) + this.topNode.getStyle(\"height\").toInt();\r\n height = height + topHeight;\r\n\r\n if( this.buttonNode )buttonHeight = this.getOffsetY(this.buttonNode) + this.buttonNode.getStyle(\"height\").toInt();\r\n height = height + buttonHeight;\r\n\r\n\r\n if( this.contentWrapNode )contentWrapOffestY = this.getOffsetY( this.contentWrapNode );\r\n height = height + contentWrapOffestY;\r\n\r\n if( this.contentNode )contentOffsetY = this.getOffsetY( this.contentNode );\r\n height = height + contentOffsetY;\r\n\r\n if( this.contentInnerNode )height = height + this.getOffsetY(this.contentInnerNode) + this.contentInnerNode.getSize().y;\r\n //getStyle(\"height\").toInt()\r\n\r\n if( height > maxHeigh ){\r\n this.node.setStyle(\"height\", maxHeigh );\r\n this.contentNode.setStyle(\"height\", maxHeigh - topHeight - buttonHeight - contentWrapOffestY - contentOffsetY);\r\n }else{\r\n this.node.setStyle(\"height\", \"auto\" );\r\n this.contentNode.setStyle(\"height\", \"auto\" );\r\n }\r\n\r\n //根据是否有滚动条设置内容区域右边距,尽量使内容本身的宽度不动\r\n if( this.contentNode.getScrollSize().y <= this.contentNode.getSize().y + 1 ){ //没有滚动条\r\n this.contentNode.setStyle(\"padding-right\", this.Content_Padding_Right + \"px\" );\r\n }else{ //有滚动条\r\n var paddingRight = 0;\r\n if( this.Content_Padding_Right > 20 ){\r\n paddingRight = this.Content_Padding_Right - 20;\r\n }\r\n this.contentNode.setStyle(\"padding-right\", paddingRight + \"px\" );\r\n }\r\n\r\n //设置弹出框的位置,top和left\r\n if( !this.positionSeted ){ //该次弹出,只设置一次\r\n var positionWidth = Math.min(\r\n maxOrgLength < 2 ? this.Width_Narrow : this.Width_Wild,\r\n this.app.node.getSize().x-20\r\n );\r\n var positionSize = {\r\n y : this.Max_Height,\r\n x : positionWidth\r\n };\r\n var p = o2.getCenter(positionSize, this.appContentNode, this.appContentNode );\r\n if (p.y< ( this.Min_Top || 0 ) ) p.y = this.Min_Top || 0;\r\n this.node.setStyles({\r\n \"top\" : p.y,\r\n \"left\" : p.x\r\n });\r\n this.positionSeted = true;\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n getMaxHeight : function(){\r\n var maxHeightPercent = this.Max_Height_Percent;\r\n var containerHeight = this.appContentNode.getSize().y;\r\n maxHeightPercent = parseFloat(containerHeight * parseInt(maxHeightPercent) / 100);\r\n if( maxHeightPercent + this.Min_Top > containerHeight ){\r\n maxHeightPercent = containerHeight - this.Min_Top\r\n }\r\n\r\n var maxHeight = parseFloat( this.Max_Height );\r\n if( typeOf(maxHeightPercent) === \"number\" ){\r\n maxHeight = Math.min( maxHeight, maxHeightPercent );\r\n }\r\n return maxHeight;\r\n },\r\n showOrgArea : function(){\r\n if( this.orgsTileTd )this.orgsTileTd.getParent(\"tr\").show();\r\n if( this.orgsAreaTd )this.orgsAreaTd.getParent(\"tr\").show();\r\n },\r\n hideOrgArea : function(){\r\n if( this.orgsTileTd )this.orgsTileTd.getParent(\"tr\").hide();\r\n if( this.orgsAreaTd )this.orgsAreaTd.getParent(\"tr\").hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList : function(){ //获取决策组并格式化成对象\r\n if( this.routeGroupObject )return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function(route, i){\r\n\r\n if( route.hiddenScriptText && this.form && this.form.Macro ){ //如果隐藏路由,返回\r\n if( this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\" )return;\r\n }\r\n\r\n if( route.displayNameScriptText && this.form && this.form.Macro ){ //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }else{\r\n route.displayName = route.name;\r\n }\r\n\r\n if( route.decisionOpinion ){ //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each( function( decisionOption ){\r\n this.routeGroupNameList.combine( [decisionOption] );\r\n var d = this.splitByStartNumber( decisionOption );\r\n if( !this.routeGroupObject[ d.name ] )this.routeGroupObject[ d.name ] = [];\r\n this.routeGroupObject[ d.name ].push( route );\r\n }.bind(this))\r\n }else{\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine( [defaultName] );\r\n if( !this.routeGroupObject[ defaultName ] )this.routeGroupObject[ defaultName ] = [];\r\n this.routeGroupObject[ defaultName].push( route );\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber : function( str ){\r\n var obj = {\r\n name : \"\",\r\n order : \"\"\r\n };\r\n for( var i=0; i 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle( \"width\", width+\"px\" );\r\n\r\n this.node.getParent().mask( {\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width + 40, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\" : false,\r\n \"onPostLoad\" : function () {\r\n if( this.nodeWidth ){\r\n this.node.setStyle(\"width\", this.nodeWidth+\"px\" );\r\n }\r\n if( this.nodeHeight ){\r\n this.node.setStyle(\"height\", this.nodeHeight+\"px\" );\r\n }\r\n },\r\n \"buttonList\": [\r\n {\r\n \"type\" : \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function(d, e){\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each( function( org, i ){\r\n org.saveCheckedEmpowerData( function(){\r\n if( i === orgs.length-1 ){\r\n if( callback )callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\" : \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function(){\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss : function () {\r\n this.css = {\r\n \"mask\": {\r\n \"opacity\": 0.7,\r\n \"background-color\": \"#eee\",\r\n \"height\": \"100%\",\r\n \"width\": \"100%\",\r\n \"position\": \"absolute\",\r\n \"top\": \"0px\",\r\n \"left\": \"0px\",\r\n // \"z-index\": \"98\",\r\n },\r\n \"popupNode\" : {\r\n \"opacity\":\"1\",\r\n // \"top\":\"0px\",\r\n // \"background-color\":\"#ffffff\",\r\n \"margin\":\"0px auto\",\r\n \"border-radius\":\"8px\",\r\n \"position\" : \"absolute\",\r\n // \"border\":\"1px solid #eeeeee\",\r\n \"box-shadow\":\"5px 5px 30px #999\"\r\n },\r\n \"embeddedNode\" : {\r\n \"margin\":\"0px\",\r\n \"border-radius\" : \"0px\",\r\n \"box-shadow\" : \"none\",\r\n \"position\" : \"static\"\r\n },\r\n \"routeSelectorArea\": {\r\n \"overflow\": \"hidden\",\r\n \"min-height\": \"40px\",\r\n \"padding\": \"0xp 20px\"\r\n },\r\n \"routeSelectorArea_hasGroup\" : {\r\n \"overflow\": \"auto\",\r\n \"height\": \"100px\",\r\n \"padding\": \"0xp 20px\"\r\n },\r\n \"routeSelectorArea_hasGroup_single\" : {\r\n \"overflow\" : \"hidden\",\r\n \"margin-left\":\"30px\"\r\n },\r\n\r\n \"routeGroupNode\" : {\r\n \"margin-left\": \"20px\",\r\n \"padding-left\" : \"28px\",\r\n \"color\" : \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"5px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\" : {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\" : {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\" : \"26px\",\r\n \"border-radius\": \"20px\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-right\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"color\" : \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\" : {\r\n \"color\" : \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\" : {\r\n \"color\" : \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#4a90e2\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"margin-top\": \"2px\",\r\n \"padding\": \"2px 2px 2px 12px\",\r\n \"background\": \"url(\"+\"/x_component_process_Work/$Processor/process/point.png) no-repeat 3px center\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingMask\" : {\r\n \"background-color\": \"#eee\",\r\n \"width\" : \"100%\",\r\n \"height\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"top\" : \"0px\",\r\n \"left\" : \"0px\",\r\n \"opacity\": 0.4\r\n },\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background-color\": \"#ffffff\",\r\n \"border\": \"3px solid #999999\",\r\n \"border-radius\": \"8px\",\r\n \"overflow\": \"hidden\",\r\n \"box-shadow\": \"0px 0px 10px #666\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"margin\": \"5px auto\",\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"border-radius\": \"5px\",\r\n \"text-align\": \"center\",\r\n \"background-color\": \"#6681a5\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\",\r\n \"cursor\": \"pointer\"\r\n },\r\n\r\n\r\n \"routeOrgTable\": {\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n \"selectorTitle\": {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"font-size\": \"14px\",\r\n \"color\": \"#333333\",\r\n \"padding-left\" : \"2px\",\r\n \"background-color\" : \"#f7f7f7\",\r\n \"overflow\" : \"hidden\"\r\n },\r\n \"selectorTitleText\": {\r\n \"margin-left\" : \"10px\",\r\n \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\" : {\r\n \"float\" : \"right\",\r\n \"margin-right\" : \"5px\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"margin-bottom\": \"10px\",\r\n \"position\": \"relative\"\r\n },\r\n \"empowerNode\" : {\r\n \"width\" : \"840px\",\r\n \"height\" : \"400px\",\r\n \"background-color\" : \"#fff\"\r\n },\r\n \"empowerTitleNode\":{\r\n \"margin-left\" : \"10px\",\r\n \"line-height\": \"40px\",\r\n \"color\": \"#333333\",\r\n \"overflow\": \"hidden\",\r\n \"font-size\": \"12px\"\r\n },\r\n \"empowerAreaNode\": {\r\n \"font-size\": \"12px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"empowerTable\": {\r\n },\r\n \"empowerOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"empowerEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n \"empowerAreaTitle\": {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"font-size\": \"14px\",\r\n \"color\": \"#333333\",\r\n \"padding-left\" : \"2px\",\r\n \"background-color\" : \"#f7f7f7\",\r\n \"overflow\" : \"hidden\"\r\n },\r\n \"empowerAreaTitleText\": {\r\n \"margin-left\" : \"10px\",\r\n \"float\": \"left\"\r\n },\r\n \"empowerAreaErrorNode\" : {\r\n \"float\" : \"right\",\r\n \"margin-right\" : \"5px\"\r\n },\r\n \"empowerAreaContent\": {\r\n \"overflow\": \"hidden\",\r\n \"margin-bottom\": \"10px\",\r\n \"position\": \"relative\",\r\n \"border\":\"1px solid #ccc\",\r\n \"height\" : \"240px\",\r\n \"overflow\" : \"auto\"\r\n },\r\n \"empowerSelectAllItemNode\" : {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"padding-left\" : \"20px\",\r\n \"font-size\" : \"14px\",\r\n \"width\": \"40px\",\r\n \"float\": \"right\",\r\n \"overflow\": \"hidden\",\r\n \"color\" : \"inherit\",\r\n \"cursor\" : \"pointer\",\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_unchecked.png) no-repeat left center\"\r\n },\r\n \"empowerSelectAllItemNode_over\" : {\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_unchecked.png) no-repeat left center\"\r\n },\r\n \"empowerSelectAllItemNode_selected\" : {\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_checked.png) no-repeat left center\"\r\n },\r\n \"empowerItemOddNode\": {\r\n \"float\" : \"left\",\r\n \"width\" : \"190px\",\r\n \"height\": \"20px\",\r\n \"margin-bottom\": \"10px\",\r\n \"padding\": \"8px 3px\",\r\n \"cursor\": \"pointer\",\r\n \"font-size\" : \"14px\",\r\n \"margin-left\" : \"10px\",\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemEvenNode\": {\r\n \"float\" : \"left\",\r\n \"width\" : \"190px\",\r\n \"height\": \"20px\",\r\n \"margin-bottom\": \"10px\",\r\n \"padding\": \"8px 3px\",\r\n \"cursor\": \"pointer\",\r\n \"font-size\" : \"14px\",\r\n \"margin-left\" : \"10px\",\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemOddNode_over\": {\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemEvenNode_over\": {\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemOddNode_selected\": {\r\n \"background-color\": \"#6681a5\"\r\n },\r\n \"empowerItemEvenNode_selected\": {\r\n \"background-color\": \"#6681a5\"\r\n },\r\n \"empowerItemIconNode\": {\r\n \"height\": \"20px\",\r\n \"width\": \"30px\",\r\n \"float\": \"right\",\r\n \"overflow\": \"hidden\",\r\n \"background\": \"url(/x_component_process_Xform/$Form/default/icon/rollback_uncheck.png) no-repeat center center\"\r\n },\r\n \"empowerItemIconNode_selected\": {\r\n \"background\": \"url(/x_component_process_Xform/$Form/default/icon/rollback_check.png) no-repeat center center\"\r\n },\r\n \"empowerItemContentNode\": {\r\n \"height\": \"20px\"\r\n },\r\n \"empowerItemTitleNode\": {\r\n \"float\": \"left\",\r\n \"height\": \"20px\",\r\n \"margin-left\": \"5px\",\r\n \"line-height\": \"20px\",\r\n \"color\": \"#666666\"\r\n },\r\n \"empowerItemTitleNode_selected\":{\r\n \"color\": \"#ffffff\"\r\n },\r\n \"empowerItemPersonNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"5px\",\r\n \"height\": \"20px\",\r\n \"width\" : \"48px\",\r\n \"line-height\": \"20px\",\r\n \"color\": \"#0000ff\"\r\n },\r\n \"empowerItemPersonNode_selected\": {\r\n \"color\": \"#ffffff\"\r\n }\r\n }\r\n }\r\n\r\n});\r\n\r\n\r\nO2Processor.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n var options = this.getOptions();\r\n if(options){\r\n this.selector = new MWF.O2Selector(this.container, options);\r\n }\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2Processor.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2Processor.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"process\",\r\n \"width\" : \"auto\",\r\n \"height\" : this.options.height,\r\n \"embedded\" : true,\r\n \"hasLetter\" : false, //字母\r\n \"hasTop\" : true //可选、已选的标题\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2Processor.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2Processor.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue();\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n resetData: function(){\r\n var v = this.getValue();\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n var data = [];\r\n if( this.selector && this.selector.selector){\r\n this.selector.selector.selectedItems.each( function( item ){\r\n data.push( MWF.org.parseOrgData(item.data, true) );\r\n })\r\n }\r\n return data;\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n debugger;\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n openSelectEmpowerDlg : function( data, orgData, callback, container ){\r\n var node = new Element(\"div\", {\"styles\": this.css.empowerAreaNode});\r\n //var html = \"
\"+MWF.xApplication.process.Xform.LP.empowerDlgText+\"
\";\r\n var html = \"
\";\r\n node.set(\"html\", html);\r\n var itemNode = node.getLast();\r\n this.getEmpowerItems(itemNode, data);\r\n node.inject( container || this.processor.appContentNode );\r\n\r\n if( this.selectAllNode ){\r\n var selectNode = this.createSelectAllEmpowerNode();\r\n selectNode.inject( this.selectAllNode );\r\n if( this.checkedAllItems ){\r\n selectNode.store(\"isSelected\", true);\r\n selectNode.setStyles( this.css.empowerSelectAllItemNode_selected );\r\n }\r\n }\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2Processor.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2Processor.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});", - "html": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessor\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n }\r\n this.processor.load();\r\n});\r\n\r\nthis.define(\"popupProcessor\", function(){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n this.processor.load();\r\n }\r\n this.processor.popup();\r\n});\r\n\r\n\r\n//自定义提交有两种模式,嵌入到表单中显示和弹出窗口显示\r\nwindow.O2Processor = new Class({\r\n Implements: [Events],\r\n initialize : function( macro ){\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant : function(){\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n\r\n //*弹出框参数 开始\r\n this.Width_Narrow = 800; //无选人或者只有一个选人时提交框的宽度\r\n this.Width_Wild = 1100; //有两个以上选人时提交框的宽度\r\n this.Max_Height = 810; //提交框的最大高度\r\n this.Max_Height_Percent = \"98%\"; //提交框的最大高度( 相对于父容器 )\r\n this.Min_Top = 5; //提交框的最小边距\r\n this.Content_Padding_Right = 20; //内容区域的右边距\r\n //*弹出框参数 结束\r\n\r\n this.Tablet_Height = 320; //默认的手写板高度\r\n this.Tablet_Width = 600; //默认的手写板宽度\r\n\r\n this.Org_height = 240; //人员组件的高度,不包括标题\r\n\r\n },\r\n load : function(){ //加载内容\r\n this.loadContent();\r\n this.setEmbeddedEvents();\r\n },\r\n popup : function(){\r\n debugger;\r\n if( this.status === \"closed\" ) {\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n this.node.show();\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize(this.getCurrentRouteOrgList().length);\r\n }else if( this.status === \"embedded\" ){\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }else{\r\n debugger;\r\n this.status = \"popup\";\r\n if( !this.maskNode )this.createMaskNode();\r\n if( !this.container ){\r\n this.container = new Element(\"div\").inject( this.appContentNode );\r\n }\r\n this.positionSeted = false;\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.loadContent();\r\n this.setPopupEvents();\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }\r\n },\r\n close : function(){\r\n if( this.macro.target && this.macro.target.isEmbedded ){ //如果是嵌入在表单中\r\n this.status = \"embedded\";\r\n this.maskNode.setStyle(\"display\",\"none\");\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.show();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.show();\r\n if( this.buttonNode )this.buttonNode.hide();\r\n if( this.topNode )this.topNode.hide();\r\n\r\n this.node.setStyles( this.css.embeddedNode );\r\n this.node.setStyle(\"width\", \"auto\");\r\n this.node.setStyle(\"height\", \"auto\" );\r\n this.contentNode.setStyle(\"height\", \"auto\" );\r\n\r\n this.node.inject( this.embeddedContainer );\r\n }else{\r\n this.status = \"closed\";\r\n if(this.maskNode)this.maskNode.setStyle(\"display\",\"none\");\r\n this.node.setStyle(\"display\",\"none\");\r\n }\r\n },\r\n createMaskNode : function(){\r\n this.maskNode = new Element(\"div.formMaskNode\", {\r\n \"styles\": this.css.mask,\r\n \"events\": {\r\n \"mouseover\": function (e) { e.stopPropagation(); },\r\n \"mouseout\": function (e) { e.stopPropagation(); },\r\n \"click\": function (e) {\r\n // this.close();\r\n e.stopPropagation();\r\n }.bind(this)\r\n // \"mousewheel\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // },\r\n // \"DOMMouseScroll\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // }\r\n }\r\n }).inject( this.appContentNode );\r\n },\r\n loadContent : function(){\r\n if( this.contentLoaded )return;\r\n\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if( orgLength === 0 ) { //流程选人数量为0\r\n if (this.orgsTileTd) {\r\n this.orgsTileTd.getParent(\"tr\").destroy();\r\n this.orgsTileTd = null;\r\n }\r\n if (this.orgsAreaTd) {\r\n this.orgsAreaTd.getParent(\"tr\").destroy();\r\n this.orgsAreaTd = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if( this.hasDecisionOpinion ){ //有决策组\r\n if(this.routeGroupArea)this.routeGroupArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n if(this.routeGroupArea)this.routeSelectorArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n this.setRouteGroupList();\r\n }else{ //没有决策组\r\n if( this.routeGroupTitleTd ){\r\n this.routeGroupTitleTd.destroy();\r\n this.routeGroupTitleTd = null;\r\n this.routeSelectorTitleTd.set(\"colspan\",\"2\");\r\n }\r\n if( this.routeGroupAreaTd ){\r\n this.routeGroupAreaTd.destroy();\r\n this.routeGroupAreaTd = null;\r\n this.routeSelectorAreaTd.set(\"colspan\",\"2\");\r\n }\r\n this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n }\r\n this.setRouteList();\r\n }\r\n this.contentLoaded = true;\r\n },\r\n\r\n getAllNode : function(){\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.embeddedContainer = this.node.getParent();\r\n\r\n this.topNode_embedded = this.getNode(\"submitTopNode_embedded\");\r\n this.buttonNode_embedded = this.getNode(\"submitButtonNode_embedded\");\r\n this.okButton_embedded = this.getNode(\"okButton_embedded\");\r\n\r\n this.topNode = this.getNode(\"submitTopNode\");\r\n this.topCloseAction = this.getNode(\"submitTopCloseActionNode\");\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n this.contentTable = this.getNode(\"submitContentTable\").getElement(\"table\");\r\n\r\n this.routeGroupTitleTd = this.getNode(\"routeGroupTitleTd\");\r\n this.routeGroupAreaTd = this.getNode(\"routeGroupAreaTd\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitleTd = this.getNode(\"routeSelectorTitleTd\");\r\n this.routeSelectorAreaTd = this.getNode(\"routeSelectorAreaTd\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaNodeTd = this.getNode(\"selectIdeaNodeTd\");\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNodeTd = this.getNode(\"inputOpinionNodeTd\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n if( this.form.json.isHandwriting === \"no\" ){\r\n var mediaActionArea = this.getNode(\"mediaActionArea\");\r\n if(mediaActionArea){\r\n mediaActionArea.hide();\r\n }else if( this.handwritingAction ){\r\n this.handwritingAction.hide();\r\n }\r\n }\r\n\r\n this.orgsTileTd = this.getNode(\"orgsTileTd\");\r\n this.orgsAreaTd = this.getNode(\"orgsAreaTd\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEmbeddedEvents : function(){\r\n if(this.okButton_embedded){\r\n this.okButton_embedded.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n setPopupEvents: function(){\r\n if( this.popupEventsSeted )return;\r\n if(this.topCloseAction){\r\n this.topCloseAction.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this))\r\n }\r\n if(this.cancelButton){\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if(this.okButton){\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n if(this.topNode){\r\n this.containerDrag = new Drag.Move(this.node, {\r\n \"handle\": this.topNode,\r\n \"container\": this.markNode || this.appContentNode,\r\n \"snap\": 5\r\n });\r\n }\r\n this.popupEventsSeted = true;\r\n },\r\n getNode : function(name){\r\n if( this.macro.form.get(name) ){\r\n return this.macro.form.get(name).node;\r\n }\r\n if( this.form.allForName[name] ){\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData : function(name, value){\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData : function(name){\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList : function(){ //获取当前待办的所有路由设置\r\n if( !this.routeConfigList ){\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute( {\"valueList\":this.task.routeList} , function( json ){\r\n json.data.each( function(d){\r\n d.selectConfigList = JSON.parse( d.selectConfig || \"[]\" );\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false );\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig : function( routeId ){ //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for( var i=0; i 0 ){\r\n this.showOrgArea();\r\n }else{\r\n this.hideOrgArea();\r\n }\r\n\r\n if( this.orgsArea ){\r\n this.orgsArea.setStyle(\"height\", ( this.Org_height + 26 ) * lines );\r\n }\r\n\r\n if( this.status !== \"popup\" )return; //如果不是弹出模式,则返回\r\n\r\n var maxOrgLength = this.getMaxOrgLength();\r\n if( maxOrgLength === 0 ){ //流程选人数量为0\r\n this.node.setStyle(\"width\", this.Width_Narrow);\r\n }else if( maxOrgLength === 1 ){\r\n this.node.setStyle(\"width\", this.Width_Narrow);\r\n }else{\r\n this.node.setStyle(\"width\", this.Width_Wild );\r\n }\r\n\r\n var maxHeigh = this.getMaxHeight();\r\n\r\n var height = 0, topHeight = 0, buttonHeight = 0;\r\n var contentWrapOffestY = 0, contentOffsetY = 0;\r\n\r\n if( this.topNode )topHeight = this.getOffsetY(this.topNode) + this.topNode.getStyle(\"height\").toInt();\r\n height = height + topHeight;\r\n\r\n if( this.buttonNode )buttonHeight = this.getOffsetY(this.buttonNode) + this.buttonNode.getStyle(\"height\").toInt();\r\n height = height + buttonHeight;\r\n\r\n\r\n if( this.contentWrapNode )contentWrapOffestY = this.getOffsetY( this.contentWrapNode );\r\n height = height + contentWrapOffestY;\r\n\r\n if( this.contentNode )contentOffsetY = this.getOffsetY( this.contentNode );\r\n height = height + contentOffsetY;\r\n\r\n if( this.contentInnerNode )height = height + this.getOffsetY(this.contentInnerNode) + this.contentInnerNode.getSize().y;\r\n //getStyle(\"height\").toInt()\r\n\r\n if( height > maxHeigh ){\r\n this.node.setStyle(\"height\", maxHeigh );\r\n this.contentNode.setStyle(\"height\", maxHeigh - topHeight - buttonHeight - contentWrapOffestY - contentOffsetY);\r\n }else{\r\n this.node.setStyle(\"height\", \"auto\" );\r\n this.contentNode.setStyle(\"height\", \"auto\" );\r\n }\r\n\r\n //根据是否有滚动条设置内容区域右边距,尽量使内容本身的宽度不动\r\n if( this.contentNode.getScrollSize().y <= this.contentNode.getSize().y + 1 ){ //没有滚动条\r\n this.contentNode.setStyle(\"padding-right\", this.Content_Padding_Right + \"px\" );\r\n }else{ //有滚动条\r\n var paddingRight = 0;\r\n if( this.Content_Padding_Right > 20 ){\r\n paddingRight = this.Content_Padding_Right - 20;\r\n }\r\n this.contentNode.setStyle(\"padding-right\", paddingRight + \"px\" );\r\n }\r\n\r\n //设置弹出框的位置,top和left\r\n if( !this.positionSeted ){ //该次弹出,只设置一次\r\n var positionWidth = Math.min(\r\n maxOrgLength < 2 ? this.Width_Narrow : this.Width_Wild,\r\n this.app.node.getSize().x-20\r\n );\r\n var positionSize = {\r\n y : this.Max_Height,\r\n x : positionWidth\r\n };\r\n var p = o2.getCenter(positionSize, this.appContentNode, this.appContentNode );\r\n if (p.y< ( this.Min_Top || 0 ) ) p.y = this.Min_Top || 0;\r\n this.node.setStyles({\r\n \"top\" : p.y,\r\n \"left\" : p.x\r\n });\r\n this.positionSeted = true;\r\n }\r\n\r\n this.fireEvent(\"resize\");\r\n },\r\n getMaxHeight : function(){\r\n var maxHeightPercent = this.Max_Height_Percent;\r\n var containerHeight = this.appContentNode.getSize().y;\r\n maxHeightPercent = parseFloat(containerHeight * parseInt(maxHeightPercent) / 100);\r\n if( maxHeightPercent + this.Min_Top > containerHeight ){\r\n maxHeightPercent = containerHeight - this.Min_Top\r\n }\r\n\r\n var maxHeight = parseFloat( this.Max_Height );\r\n if( typeOf(maxHeightPercent) === \"number\" ){\r\n maxHeight = Math.min( maxHeight, maxHeightPercent );\r\n }\r\n return maxHeight;\r\n },\r\n showOrgArea : function(){\r\n if( this.orgsTileTd )this.orgsTileTd.getParent(\"tr\").show();\r\n if( this.orgsAreaTd )this.orgsAreaTd.getParent(\"tr\").show();\r\n },\r\n hideOrgArea : function(){\r\n if( this.orgsTileTd )this.orgsTileTd.getParent(\"tr\").hide();\r\n if( this.orgsAreaTd )this.orgsAreaTd.getParent(\"tr\").hide();\r\n },\r\n\r\n /*决策和决策组相关 开始*/\r\n getRouteGroupList : function(){ //获取决策组并格式化成对象\r\n if( this.routeGroupObject )return this.routeGroupObject;\r\n this.routeGroupObject = {};\r\n this.routeGroupNameList = [];\r\n this.hasDecisionOpinion = false;\r\n var routeList = this.getRouteConfigList();\r\n routeList.each(function(route, i){\r\n\r\n if( route.hiddenScriptText && this.form && this.form.Macro ){ //如果隐藏路由,返回\r\n if( this.form.Macro.exec(route.hiddenScriptText, this).toString() === \"true\" )return;\r\n }\r\n\r\n if( route.displayNameScriptText && this.form && this.form.Macro ){ //如果有显示名称公式\r\n route.displayName = this.form.Macro.exec(route.displayNameScriptText, this);\r\n }else{\r\n route.displayName = route.name;\r\n }\r\n\r\n if( route.decisionOpinion ){ //决策组名称\r\n this.hasDecisionOpinion = true;\r\n var decisionOpinionList = route.decisionOpinion.split(\"#\");\r\n decisionOpinionList.each( function( decisionOption ){\r\n this.routeGroupNameList.combine( [decisionOption] );\r\n var d = this.splitByStartNumber( decisionOption );\r\n if( !this.routeGroupObject[ d.name ] )this.routeGroupObject[ d.name ] = [];\r\n this.routeGroupObject[ d.name ].push( route );\r\n }.bind(this))\r\n }else{\r\n var defaultName = this.DefaultDecisionOpinionName;\r\n this.routeGroupNameList.combine( [defaultName] );\r\n if( !this.routeGroupObject[ defaultName ] )this.routeGroupObject[ defaultName ] = [];\r\n this.routeGroupObject[ defaultName].push( route );\r\n }\r\n }.bind(this));\r\n return this.routeGroupObject;\r\n },\r\n splitByStartNumber : function( str ){\r\n var obj = {\r\n name : \"\",\r\n order : \"\"\r\n };\r\n for( var i=0; i 1 ){\r\n // width = \"840\"\r\n //}else{\r\n // width = \"420\"\r\n //}\r\n empowerNode.setStyle( \"width\", width+\"px\" );\r\n\r\n this.node.getParent().mask( {\r\n \"style\": this.css.mask\r\n });\r\n this.empowerDlg = o2.DL.open({\r\n \"title\": \"授权人员替换选择\",\r\n \"style\": this.form.json.dialogStyle || \"user\",\r\n \"isResize\": false,\r\n \"content\": empowerNode,\r\n //\"container\" : this.node,\r\n \"width\": width + 40, //600,\r\n \"height\": \"auto\", //dlgHeight,\r\n \"mark\" : false,\r\n \"onPostLoad\" : function () {\r\n if( this.nodeWidth ){\r\n this.node.setStyle(\"width\", this.nodeWidth+\"px\" );\r\n }\r\n if( this.nodeHeight ){\r\n this.node.setStyle(\"height\", this.nodeHeight+\"px\" );\r\n }\r\n },\r\n \"buttonList\": [\r\n {\r\n \"type\" : \"ok\",\r\n \"text\": \"确定\",\r\n \"action\": function(d, e){\r\n //if (this.empowerDlg) this.empowerDlg.okButton.click();\r\n\r\n orgs.each( function( org, i ){\r\n org.saveCheckedEmpowerData( function(){\r\n if( i === orgs.length-1 ){\r\n if( callback )callback();\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }\r\n }.bind(this))\r\n }.bind(this))\r\n }.bind(this)\r\n },\r\n {\r\n \"type\" : \"cancel\",\r\n \"text\": \"取消\",\r\n \"action\": function(){\r\n this.node.getParent().unmask();\r\n this.empowerDlg.close();\r\n }.bind(this)\r\n }\r\n ]\r\n });\r\n },\r\n getCss : function () {\r\n this.css = {\r\n \"mask\": {\r\n \"opacity\": 0.7,\r\n \"background-color\": \"#eee\",\r\n \"height\": \"100%\",\r\n \"width\": \"100%\",\r\n \"position\": \"absolute\",\r\n \"top\": \"0px\",\r\n \"left\": \"0px\",\r\n // \"z-index\": \"98\",\r\n },\r\n \"popupNode\" : {\r\n \"opacity\":\"1\",\r\n // \"top\":\"0px\",\r\n // \"background-color\":\"#ffffff\",\r\n \"margin\":\"0px auto\",\r\n \"border-radius\":\"8px\",\r\n \"position\" : \"absolute\",\r\n // \"border\":\"1px solid #eeeeee\",\r\n \"box-shadow\":\"5px 5px 30px #999\"\r\n },\r\n \"embeddedNode\" : {\r\n \"margin\":\"0px\",\r\n \"border-radius\" : \"0px\",\r\n \"box-shadow\" : \"none\",\r\n \"position\" : \"static\"\r\n },\r\n \"routeSelectorArea\": {\r\n \"overflow\": \"hidden\",\r\n \"min-height\": \"40px\",\r\n \"padding\": \"0xp 20px\"\r\n },\r\n \"routeSelectorArea_hasGroup\" : {\r\n \"overflow\": \"auto\",\r\n \"height\": \"100px\",\r\n \"padding\": \"0xp 20px\"\r\n },\r\n \"routeSelectorArea_hasGroup_single\" : {\r\n \"overflow\" : \"hidden\",\r\n \"margin-left\":\"30px\"\r\n },\r\n\r\n \"routeGroupNode\" : {\r\n \"margin-left\": \"20px\",\r\n \"padding-left\" : \"28px\",\r\n \"color\" : \"#000\",\r\n \"background-color\": \"#E3E3E3\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"5px\",\r\n \"cursor\": \"pointer\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_over\" : {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/route.png) no-repeat 5px center\"\r\n },\r\n \"routeGroupNode_selected\" : {\r\n \"background-color\": \"#E3E3E3\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/routegroup_selected.png) no-repeat 5px center\"\r\n },\r\n\r\n \"routeNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"20px\",\r\n \"padding-left\" : \"26px\",\r\n \"border-radius\": \"20px\",\r\n \"min-height\": \"24px\",\r\n \"line-height\": \"24px\",\r\n \"margin-top\": \"8px\",\r\n \"padding-right\": \"8px\",\r\n \"cursor\": \"pointer\",\r\n \"color\" : \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#f0f0f0\"\r\n },\r\n \"routeNode_over\" : {\r\n \"color\" : \"#000\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/nocheck.png) no-repeat 5px center\",\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n \"routeNode_selected\" : {\r\n \"color\" : \"#fff\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/checked.png) no-repeat 5px center\",\r\n \"background-color\": \"#4a90e2\"\r\n },\r\n\r\n \"selectIdeaItemNode\": {\r\n \"line-height\": \"18px\",\r\n \"font-size\": \"14px\",\r\n \"cursor\": \"pointer\",\r\n \"background-color\": \"#FFF\",\r\n \"margin-top\": \"2px\",\r\n \"padding\": \"2px 2px 2px 12px\",\r\n \"background\": \"url(\"+\"/x_component_process_Work/$Processor/process/point.png) no-repeat 3px center\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"selectIdeaItemNode_over\": {\r\n \"background-color\": \"#e6ecf8\"\r\n },\r\n\r\n \"handwritingMask\" : {\r\n \"background-color\": \"#eee\",\r\n \"width\" : \"100%\",\r\n \"height\" : \"100%\",\r\n \"position\" : \"absolute\",\r\n \"top\" : \"0px\",\r\n \"left\" : \"0px\",\r\n \"opacity\": 0.4\r\n },\r\n \"handwritingNode\": {\r\n \"position\": \"absolute\",\r\n \"background-color\": \"#ffffff\",\r\n \"border\": \"3px solid #999999\",\r\n \"border-radius\": \"8px\",\r\n \"overflow\": \"hidden\",\r\n \"box-shadow\": \"0px 0px 10px #666\"\r\n },\r\n \"handwritingActionNode\": {\r\n \"height\": \"30px\",\r\n \"line-height\": \"30px\",\r\n \"margin\": \"5px auto\",\r\n \"width\": \"70%\",\r\n \"min-width\": \"100px\",\r\n \"border-radius\": \"5px\",\r\n \"text-align\": \"center\",\r\n \"background-color\": \"#6681a5\",\r\n \"color\": \"#ffffff\",\r\n \"font-size\": \"16px\",\r\n \"cursor\": \"pointer\"\r\n },\r\n\r\n\r\n \"routeOrgTable\": {\r\n },\r\n \"routeOrgOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"routeOrgEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n \"selectorTitle\": {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"font-size\": \"14px\",\r\n \"color\": \"#333333\",\r\n \"padding-left\" : \"2px\",\r\n \"background-color\" : \"#f7f7f7\",\r\n \"overflow\" : \"hidden\"\r\n },\r\n \"selectorTitleText\": {\r\n \"margin-left\" : \"10px\",\r\n \"float\": \"left\"\r\n },\r\n \"selectorErrorNode\" : {\r\n \"float\" : \"right\",\r\n \"margin-right\" : \"5px\"\r\n },\r\n \"selectorContent\": {\r\n \"overflow\": \"hidden\",\r\n \"margin-bottom\": \"10px\",\r\n \"position\": \"relative\"\r\n },\r\n \"empowerNode\" : {\r\n \"width\" : \"840px\",\r\n \"height\" : \"400px\",\r\n \"background-color\" : \"#fff\"\r\n },\r\n \"empowerTitleNode\":{\r\n \"margin-left\" : \"10px\",\r\n \"line-height\": \"40px\",\r\n \"color\": \"#333333\",\r\n \"overflow\": \"hidden\",\r\n \"font-size\": \"12px\"\r\n },\r\n \"empowerAreaNode\": {\r\n \"font-size\": \"12px\",\r\n \"overflow\": \"hidden\"\r\n },\r\n \"empowerTable\": {\r\n },\r\n \"empowerOddTd\": {\r\n \"width\": \"50%\"\r\n },\r\n \"empowerEvenTd\": {\r\n \"width\": \"50%\",\r\n \"border-left\": \"5px solid #ffffff\"\r\n },\r\n \"empowerAreaTitle\": {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"font-size\": \"14px\",\r\n \"color\": \"#333333\",\r\n \"padding-left\" : \"2px\",\r\n \"background-color\" : \"#f7f7f7\",\r\n \"overflow\" : \"hidden\"\r\n },\r\n \"empowerAreaTitleText\": {\r\n \"margin-left\" : \"10px\",\r\n \"float\": \"left\"\r\n },\r\n \"empowerAreaErrorNode\" : {\r\n \"float\" : \"right\",\r\n \"margin-right\" : \"5px\"\r\n },\r\n \"empowerAreaContent\": {\r\n \"overflow\": \"hidden\",\r\n \"margin-bottom\": \"10px\",\r\n \"position\": \"relative\",\r\n \"border\":\"1px solid #ccc\",\r\n \"height\" : \"240px\",\r\n \"overflow\" : \"auto\"\r\n },\r\n \"empowerSelectAllItemNode\" : {\r\n \"height\": \"26px\",\r\n \"line-height\": \"26px\",\r\n \"padding-left\" : \"20px\",\r\n \"font-size\" : \"14px\",\r\n \"width\": \"40px\",\r\n \"float\": \"right\",\r\n \"overflow\": \"hidden\",\r\n \"color\" : \"inherit\",\r\n \"cursor\" : \"pointer\",\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_unchecked.png) no-repeat left center\"\r\n },\r\n \"empowerSelectAllItemNode_over\" : {\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_unchecked.png) no-repeat left center\"\r\n },\r\n \"empowerSelectAllItemNode_selected\" : {\r\n \"color\" : \"#3C76B7\",\r\n \"background\": \"url(/x_component_process_Work/$Processor/process/empower_checked.png) no-repeat left center\"\r\n },\r\n \"empowerItemOddNode\": {\r\n \"float\" : \"left\",\r\n \"width\" : \"190px\",\r\n \"height\": \"20px\",\r\n \"margin-bottom\": \"10px\",\r\n \"padding\": \"8px 3px\",\r\n \"cursor\": \"pointer\",\r\n \"font-size\" : \"14px\",\r\n \"margin-left\" : \"10px\",\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemEvenNode\": {\r\n \"float\" : \"left\",\r\n \"width\" : \"190px\",\r\n \"height\": \"20px\",\r\n \"margin-bottom\": \"10px\",\r\n \"padding\": \"8px 3px\",\r\n \"cursor\": \"pointer\",\r\n \"font-size\" : \"14px\",\r\n \"margin-left\" : \"10px\",\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemOddNode_over\": {\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemEvenNode_over\": {\r\n \"background-color\": \"#eaf1f9\"\r\n },\r\n \"empowerItemOddNode_selected\": {\r\n \"background-color\": \"#6681a5\"\r\n },\r\n \"empowerItemEvenNode_selected\": {\r\n \"background-color\": \"#6681a5\"\r\n },\r\n \"empowerItemIconNode\": {\r\n \"height\": \"20px\",\r\n \"width\": \"30px\",\r\n \"float\": \"right\",\r\n \"overflow\": \"hidden\",\r\n \"background\": \"url(/x_component_process_Xform/$Form/default/icon/rollback_uncheck.png) no-repeat center center\"\r\n },\r\n \"empowerItemIconNode_selected\": {\r\n \"background\": \"url(/x_component_process_Xform/$Form/default/icon/rollback_check.png) no-repeat center center\"\r\n },\r\n \"empowerItemContentNode\": {\r\n \"height\": \"20px\"\r\n },\r\n \"empowerItemTitleNode\": {\r\n \"float\": \"left\",\r\n \"height\": \"20px\",\r\n \"margin-left\": \"5px\",\r\n \"line-height\": \"20px\",\r\n \"color\": \"#666666\"\r\n },\r\n \"empowerItemTitleNode_selected\":{\r\n \"color\": \"#ffffff\"\r\n },\r\n \"empowerItemPersonNode\": {\r\n \"float\": \"left\",\r\n \"margin-left\": \"5px\",\r\n \"height\": \"20px\",\r\n \"width\" : \"48px\",\r\n \"line-height\": \"20px\",\r\n \"color\": \"#0000ff\"\r\n },\r\n \"empowerItemPersonNode_selected\": {\r\n \"color\": \"#ffffff\"\r\n }\r\n }\r\n }\r\n\r\n});\r\n\r\n\r\nO2Processor.Org = new Class({\r\n Implements: [Options, Events],\r\n options: {\r\n height : 240,\r\n moduleEvents : [\"queryLoadSelector\",\"postLoadSelector\",\"postLoadContent\",\"queryLoadCategory\",\"postLoadCategory\",\r\n \"selectCategory\", \"unselectCategory\",\"queryLoadItem\",\"postLoadItem\",\"selectItem\", \"unselectItem\",\"change\"]\r\n },\r\n initialize: function (container, form, json, processor, options) {\r\n this.form = form;\r\n this.json = json;\r\n this.processor = processor;\r\n this.container = $(container);\r\n this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n this.setOptions(options);\r\n },\r\n load : function(){\r\n var options = this.getOptions();\r\n if(options){\r\n this.selector = new MWF.O2Selector(this.container, options);\r\n }\r\n },\r\n _getOrgOptions: function(){\r\n this.selectTypeList = typeOf( this.json.selectType ) == \"array\" ? this.json.selectType : [this.json.selectType];\r\n if( this.selectTypeList.contains( \"identity\" ) ) {\r\n this.identityOptions = new O2Processor.IdentityOptions(this.form, this.json);\r\n }\r\n if( this.selectTypeList.contains( \"unit\" ) ) {\r\n this.unitOptions = new O2Processor.UnitOptions(this.form, this.json);\r\n }\r\n //if( this.selectTypeList.contains( \"group\" ) ){\r\n // this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );\r\n //}\r\n },\r\n getOptions: function(){\r\n var _self = this;\r\n this._getOrgOptions();\r\n if( this.selectTypeList.length === 0 )return false;\r\n var exclude = [];\r\n if( this.json.exclude ){\r\n var v = this.form.Macro.exec(this.json.exclude.code, this);\r\n exclude = typeOf(v)===\"array\" ? v : [v];\r\n }\r\n\r\n var identityOpt;\r\n if( this.identityOptions ){\r\n identityOpt = this.identityOptions.getOptions();\r\n if (this.json.identityRange!==\"all\"){\r\n if ( !identityOpt.noUnit && (!identityOpt.units || !identityOpt.units.length) ){\r\n this.form.notice(\"无法确定身份的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if ( !identityOpt.noUnit && this.json.dutyRange && this.json.dutyRange!==\"all\"){\r\n if (!identityOpt.dutys || !identityOpt.dutys.length){\r\n this.form.notice(\"无法确定职务的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n identityOpt.values = this._computeValue() || [];\r\n }else{\r\n identityOpt.values = this.getValue();\r\n }\r\n identityOpt.exclude = exclude;\r\n }\r\n\r\n var unitOpt;\r\n if( this.unitOptions ){\r\n unitOpt = this.unitOptions.getOptions();\r\n if (this.json.unitRange!==\"all\"){\r\n if ( !unitOpt.units || !unitOpt.units.length){\r\n this.form.notice(\"无法确定组织的选择范围\", \"error\", this.node);\r\n return false;\r\n }\r\n }\r\n if( this.ignoreOldData ){\r\n unitOpt.values = this._computeValue() || [];\r\n }else{\r\n unitOpt.values = this.getValue();\r\n }\r\n unitOpt.exclude = exclude;\r\n }\r\n\r\n //var groupOpt;\r\n //if( this.groupOptions ){\r\n // groupOpt = this.groupOptions.getOptions();\r\n // groupOpt.values = (this.json.isInput) ? [] : values;\r\n // groupOpt.exclude = exclude;\r\n //}\r\n\r\n var defaultOpt = {\r\n \"style\" : \"process\",\r\n \"width\" : \"auto\",\r\n \"height\" : this.options.height,\r\n \"embedded\" : true,\r\n \"hasLetter\" : false, //字母\r\n \"hasTop\" : true //可选、已选的标题\r\n };\r\n\r\n if( this.json.events && typeOf(this.json.events) === \"object\" ){\r\n Object.each(this.json.events, function(e, key){\r\n if (e.code){\r\n if (this.options.moduleEvents.indexOf(key)!==-1){\r\n //this.addEvent(key, function(event){\r\n // return this.form.Macro.fire(e.code, this, event);\r\n //}.bind(this));\r\n if( key === \"postLoadSelector\" ) {\r\n this.addEvent(\"loadSelector\", function (selector) {\r\n return this.form.Macro.fire(e.code, selector);\r\n }.bind(this))\r\n }else if( key === \"queryLoadSelector\"){\r\n defaultOpt[\"onQueryLoad\"] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }else{\r\n defaultOpt[\"on\"+key.capitalize()] = function(target){\r\n return this.form.Macro.fire(e.code, target);\r\n }.bind(this)\r\n }\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n\r\n if( this.form.json.selectorStyle ){\r\n defaultOpt = Object.merge( Object.clone(this.form.json.selectorStyle), defaultOpt );\r\n if( this.form.json.selectorStyle.style )defaultOpt.style = this.form.json.selectorStyle.style;\r\n }\r\n\r\n if( this.selectTypeList.length === 1 ){\r\n return Object.merge(\r\n defaultOpt,\r\n {\r\n \"type\": this.selectTypeList[0],\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this, this.selector )\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n },\r\n identityOpt || unitOpt\r\n )\r\n }else if( this.selectTypeList.length > 1 ){\r\n var options = {\r\n \"type\" : \"\",\r\n \"types\" : this.selectTypeList,\r\n \"onLoad\": function(){\r\n //this 为 selector\r\n _self.selectOnLoad(this)\r\n }\r\n //\"onComplete\": function(items){\r\n // this.selectOnComplete(items);\r\n //}.bind(this),\r\n //\"onCancel\": this.selectOnCancel.bind(this),\r\n //\"onClose\": this.selectOnClose.bind(this)\r\n };\r\n if( identityOpt ){\r\n options.identityOptions = Object.merge(\r\n defaultOpt,\r\n identityOpt\r\n );\r\n }\r\n if( unitOpt ){\r\n options.unitOptions = Object.merge(\r\n defaultOpt,\r\n unitOpt\r\n );\r\n }\r\n //if( groupOpt )options.groupOptions = groupOpt;\r\n return options;\r\n }\r\n },\r\n selectOnComplete: function(items){ //移动端才执行\r\n var array = [];\r\n items.each(function(item){\r\n array.push(item.data);\r\n }.bind(this));\r\n this.checkEmpower( array, function( data ){\r\n var values = [];\r\n data.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n\r\n this.setData(values);\r\n\r\n //this.validationMode();\r\n //this.validation();\r\n\r\n this.container.empty();\r\n this.loadOrgWidget(values, this.container);\r\n\r\n this.selector = null;\r\n\r\n this.fireEvent(\"select\", [items, values]);\r\n }.bind(this))\r\n },\r\n selectOnCancel: function(){ //移动端才执行\r\n //this.validation();\r\n },\r\n selectOnLoad: function( selector ){\r\n //if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"none\");\r\n this.fireEvent(\"loadSelector\", [selector])\r\n },\r\n selectOnClose: function(){\r\n var v = this._getBusinessData();\r\n //if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle(\"display\", \"block\");\r\n },\r\n loadOrgWidget: function(value, node){\r\n var height = node.getStyle(\"height\").toInt();\r\n if (node.getStyle(\"overflow\")===\"visible\" && !height) node.setStyle(\"overflow\", \"hidden\");\r\n if (value && value.length){\r\n value.each(function(data){\r\n var flag = data.distinguishedName.substr(data.distinguishedName.length-1, 1);\r\n var copyData = Object.clone(data);\r\n if( this.json.displayTextScript && this.json.displayTextScript.code ){\r\n this.currentData = copyData;\r\n var displayName = this.form.Macro.exec(this.json.displayTextScript.code, this);\r\n if( displayName ){\r\n copyData.displayName = displayName;\r\n }\r\n this.currentData = null;\r\n }\r\n\r\n var widget;\r\n switch (flag.toLowerCase()){\r\n case \"i\":\r\n widget = new MWF.widget.O2Identity(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"p\":\r\n widget = new MWF.widget.O2Person(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"u\":\r\n widget = new MWF.widget.O2Unit(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n case \"g\":\r\n widget = new MWF.widget.O2Group(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n break;\r\n default:\r\n widget = new MWF.widget.O2Other(copyData, node, {\"style\": \"xform\",\"lazy\":true});\r\n }\r\n widget.field = this;\r\n }.bind(this));\r\n }\r\n },\r\n\r\n hasEmpowerIdentity : function(){\r\n var data = this.getData();\r\n if(!this.empowerChecker )this.empowerChecker = new O2Processor.EmpowerChecker(this.form, this.json, this.processor);\r\n return this.empowerChecker.hasEmpowerIdentity( data );\r\n },\r\n checkEmpower : function( data, callback, container, selectAllNode ){\r\n if( typeOf(data)===\"array\" && this.identityOptions && this.json.isCheckEmpower && this.json.identityResultType === \"identity\" ) {\r\n if(!this.empowerChecker )this.empowerChecker = new O2Processor.EmpowerChecker(this.form, this.json, this.processor);\r\n this.empowerChecker.selectAllNode = selectAllNode;\r\n this.empowerChecker.load(data, callback, container);\r\n }else{\r\n if( callback )callback( data );\r\n }\r\n },\r\n\r\n loadCheckEmpower : function( callback, container, selectAllNode ){\r\n this.checkEmpower( this.getData(), callback, container, selectAllNode)\r\n },\r\n saveCheckedEmpowerData:function( callback ){\r\n var data = this.getData();\r\n //this.empowerChecker.replaceEmpowerIdentity(data, function( newData ){\r\n this.empowerChecker.setIgnoreEmpowerFlag(data, function( newData ){\r\n var values = [];\r\n newData.each(function(d){\r\n values.push(MWF.org.parseOrgData(d, true));\r\n }.bind(this));\r\n this.setData( values );\r\n if( callback )callback(values)\r\n }.bind(this))\r\n },\r\n\r\n save: function( isValid ){\r\n if( isValid ){\r\n if( this.validation() ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }else{\r\n this.setData( this.getData() );\r\n return true;\r\n }\r\n },\r\n\r\n resetSelectorData : function(){\r\n if( this.selector && this.selector.selector ){\r\n this.selector.selector.emptySelectedItems();\r\n this.selector.selector.options.values = this.getValue();\r\n this.selector.selector.setSelectedItem();\r\n }\r\n },\r\n resetData: function(){\r\n var v = this.getValue();\r\n //this.setData((v) ? v.join(\", \") : \"\");\r\n this.setData(v);\r\n },\r\n getData: function(){\r\n if( this.selector && !layout.mobile ){\r\n return this.getSelectedData();\r\n }else{\r\n return this.getValue();\r\n }\r\n },\r\n getSelectedData : function(){\r\n var data = [];\r\n if( this.selector && this.selector.selector){\r\n this.selector.selector.selectedItems.each( function( item ){\r\n data.push( MWF.org.parseOrgData(item.data, true) );\r\n })\r\n }\r\n return data;\r\n },\r\n getValue: function(){\r\n var value = this._getBusinessData();\r\n if (!value) value = this._computeValue();\r\n return value || \"\";\r\n },\r\n _computeValue: function(){\r\n var values = [];\r\n if (this.json.identityValue) {\r\n this.json.identityValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.unitValue) {\r\n this.json.unitValue.each(function(v){ if (v) values.push(v)});\r\n }\r\n if (this.json.dutyValue) {\r\n var dutys = JSON.decode(this.json.dutyValue);\r\n var par;\r\n if (dutys.length){\r\n dutys.each(function(duty){\r\n if (duty.code) par = this.form.Macro.exec(duty.code, this);\r\n var code = \"return this.org.getDuty(\\\"\"+duty.name+\"\\\", \\\"\"+par+\"\\\")\";\r\n\r\n var d = this.form.Macro.exec(code, this);\r\n if (typeOf(d)!==\"array\") d = (d) ? [d.toString()] : [];\r\n d.each(function(dd){if (dd) values.push(dd);});\r\n\r\n }.bind(this));\r\n }\r\n }\r\n if (this.json.defaultValue && this.json.defaultValue.code){\r\n var fd = this.form.Macro.exec(this.json.defaultValue.code, this);\r\n if (typeOf(fd)!==\"array\") fd = (fd) ? [fd] : [];\r\n fd.each(function(fdd){\r\n if (fdd){\r\n if (typeOf(fdd)===\"string\"){\r\n var data;\r\n this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false);\r\n values.push(data);\r\n }else{\r\n values.push(fdd);\r\n }\r\n }\r\n }.bind(this));\r\n }\r\n if (this.json.count>0){\r\n return values.slice(0, this.json.count);\r\n }\r\n return values;\r\n //return (this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || \"\");\r\n },\r\n getOrgAction: function(){\r\n if (!this.orgAction) this.orgAction = MWF.Actions.get(\"x_organization_assemble_control\");\r\n //if (!this.orgAction) this.orgAction = new MWF.xApplication.Selector.Actions.RestActions();\r\n return this.orgAction;\r\n },\r\n setData: function(value){\r\n\r\n debugger;\r\n\r\n if (!value) return false;\r\n var oldValues = this.getValue();\r\n var values = [];\r\n\r\n var type = typeOf(value);\r\n if (type===\"array\"){\r\n value.each(function(v){\r\n var vtype = typeOf(v);\r\n var data = null;\r\n if (vtype===\"string\"){\r\n this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false);\r\n }\r\n if (vtype===\"object\") {\r\n data = MWF.org.parseOrgData(v, true);\r\n if(data.woPerson)delete data.woPerson;\r\n }\r\n if (data)values.push(data);\r\n }.bind(this));\r\n }\r\n if (type===\"string\"){\r\n var vData;\r\n this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false);\r\n if (vData)values.push(vData);\r\n }\r\n if (type===\"object\"){\r\n var vData = MWF.org.parseOrgData(value, true);\r\n if(vData.woPerson)delete vData.woPerson;\r\n values.push( vData );\r\n }\r\n\r\n var change = false;\r\n if (oldValues.length && values.length){\r\n if (oldValues.length === values.length){\r\n for (var i=0; i 0) {\r\n o2.Actions.get(\"x_organization_assemble_express\").listEmpowerWithIdentity({\r\n \"application\": (this.form.businessData.work || this.form.businessData.workCompleted).application,\r\n \"process\": (this.form.businessData.work || this.form.businessData.workCompleted).process,\r\n \"work\" : (this.form.businessData.work || this.form.businessData.workCompleted).id,\r\n \"identityList\": array\r\n }, function (json) {\r\n var arr = [];\r\n json.data.each(function (d) {\r\n if (d.fromIdentity !== d.toIdentity)\r\n arr.push(d);\r\n });\r\n if (arr.length > 0) {\r\n flag = true;\r\n }\r\n }.bind(this), null, false)\r\n }\r\n }\r\n return flag;\r\n },\r\n openSelectEmpowerDlg : function( data, orgData, callback, container ){\r\n var node = new Element(\"div\", {\"styles\": this.css.empowerAreaNode});\r\n //var html = \"
\"+MWF.xApplication.process.Xform.LP.empowerDlgText+\"
\";\r\n var html = \"
\";\r\n node.set(\"html\", html);\r\n var itemNode = node.getLast();\r\n this.getEmpowerItems(itemNode, data);\r\n node.inject( container || this.processor.appContentNode );\r\n\r\n if( this.selectAllNode ){\r\n var selectNode = this.createSelectAllEmpowerNode();\r\n selectNode.inject( this.selectAllNode );\r\n if( this.checkedAllItems ){\r\n selectNode.store(\"isSelected\", true);\r\n selectNode.setStyles( this.css.empowerSelectAllItemNode_selected );\r\n }\r\n }\r\n },\r\n getSelectedData : function( callback ){\r\n var json = {};\r\n this.empowerSelectNodes.each(function(node){\r\n if( node.retrieve(\"isSelected\") ){\r\n var d = node.retrieve(\"data\");\r\n json[ d.fromIdentity ] = d;\r\n }\r\n }.bind(this));\r\n if( callback )callback( json );\r\n }\r\n});\r\n\r\nO2Processor.UnitOptions = new Class({\r\n Extends : MWF.APPOrg.UnitOptions\r\n});\r\n\r\nO2Processor.IdentityOptions = new Class({\r\n Extends : MWF.APPOrg.IdentityOptions\r\n});" + "code": "MWF.xDesktop.requireApp(\"process.Xform\", \"Org\", null, false);\r\n\r\nthis.define(\"loadProcessor\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n }\r\n this.processor.load( defaultRoute );\r\n});\r\n\r\nthis.define(\"popupProcessor\", function( defaultRoute ){\r\n if( !this.processor ){\r\n this.processor = new O2Processor(this);\r\n this.processor.load( defaultRoute );\r\n defaultRoute = \"\"\r\n }\r\n this.processor.popup( defaultRoute );\r\n});\r\n\r\n\r\n//自定义提交有两种模式,嵌入到表单中显示和弹出窗口显示\r\nwindow.O2Processor = new Class({\r\n Implements: [Events],\r\n initialize : function( macro ){\r\n\r\n debugger;\r\n\r\n this.macro = macro;\r\n this.app = macro.form.app;\r\n this.form = this.app.appForm;\r\n this.task = this.form.businessData.task;\r\n this.appContentNode = this.app.content;\r\n\r\n this.initConstant();\r\n this.getCss();\r\n this.getAllNode();\r\n\r\n // this.loadCss();\r\n\r\n },\r\n initConstant : function(){\r\n this.DefaultDecisionOpinionName = \"其它\"; //默认的决策组,如果当前节点有决策组,但是某些决策没有落在决策组中,那么使用默认决策组\r\n\r\n //*弹出框参数 开始\r\n this.Width_Narrow = 800; //无选人或者只有一个选人时提交框的宽度\r\n this.Width_Wild = 1100; //有两个以上选人时提交框的宽度\r\n this.Max_Height = 810; //提交框的最大高度\r\n this.Max_Height_Percent = \"98%\"; //提交框的最大高度( 相对于父容器 )\r\n this.Min_Top = 5; //提交框的最小边距\r\n this.Content_Padding_Right = 20; //内容区域的右边距\r\n //*弹出框参数 结束\r\n\r\n this.Tablet_Height = 320; //默认的手写板高度\r\n this.Tablet_Width = 600; //默认的手写板宽度\r\n\r\n this.Org_height = 240; //人员组件的高度,不包括标题\r\n\r\n },\r\n load : function(defaultRoute){ //加载内容\r\n this.defaultRoute = defaultRoute || \"\";\r\n this.loadContent();\r\n this.setEmbeddedEvents();\r\n },\r\n popup : function( defaultRoute ){\r\n debugger;\r\n this.defaultRoute = defaultRoute || \"\";\r\n if( this.status === \"closed\" ) {\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n this.node.show();\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize(this.getCurrentRouteOrgList().length);\r\n var currentRoute = this.selectedRoute ? this.selectedRoute.retrieve(\"route\") : \"\";\r\n if( currentRoute )this.showOrgsByRoute(currentRoute);\r\n }else if( this.status === \"embedded\" ){\r\n this.status = \"popup\";\r\n this.maskNode.show();\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.positionSeted = false; //重新设置位置\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }else{\r\n debugger;\r\n this.status = \"popup\";\r\n if( !this.maskNode )this.createMaskNode();\r\n if( !this.container ){\r\n this.container = new Element(\"div\").inject( this.appContentNode );\r\n }\r\n this.positionSeted = false;\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.hide();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.hide();\r\n if( this.topNode )this.topNode.show();\r\n if( this.buttonNode )this.buttonNode.show();\r\n\r\n this.loadContent();\r\n this.setPopupEvents();\r\n this.node.setStyles( this.css.popupNode );\r\n this.node.inject( this.container );\r\n this.setSize( this.getCurrentRouteOrgList().length );\r\n }\r\n },\r\n close : function(){\r\n if( this.macro.target && this.macro.target.isEmbedded ){ //如果是嵌入在表单中\r\n this.status = \"embedded\";\r\n this.maskNode.setStyle(\"display\",\"none\");\r\n\r\n if(this.topNode_embedded)this.topNode_embedded.show();\r\n if( this.buttonNode_embedded )this.buttonNode_embedded.show();\r\n if( this.buttonNode )this.buttonNode.hide();\r\n if( this.topNode )this.topNode.hide();\r\n\r\n this.node.setStyles( this.css.embeddedNode );\r\n this.node.setStyle(\"width\", \"auto\");\r\n this.node.setStyle(\"height\", \"auto\" );\r\n this.contentNode.setStyle(\"height\", \"auto\" );\r\n\r\n this.node.inject( this.embeddedContainer );\r\n }else{\r\n this.status = \"closed\";\r\n if(this.maskNode)this.maskNode.setStyle(\"display\",\"none\");\r\n this.node.setStyle(\"display\",\"none\");\r\n }\r\n },\r\n createMaskNode : function(){\r\n this.maskNode = new Element(\"div.formMaskNode\", {\r\n \"styles\": this.css.mask,\r\n \"events\": {\r\n \"mouseover\": function (e) { e.stopPropagation(); },\r\n \"mouseout\": function (e) { e.stopPropagation(); },\r\n \"click\": function (e) {\r\n // this.close();\r\n e.stopPropagation();\r\n }.bind(this)\r\n // \"mousewheel\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // },\r\n // \"DOMMouseScroll\": function (e) {\r\n // if (e.stopPropagation) e.stopPropagation();\r\n // else e.cancelBubble = true;\r\n //\r\n // if (e.preventDefault) e.preventDefault();\r\n // else e.returnValue = false;\r\n // }\r\n }\r\n }).inject( this.appContentNode );\r\n },\r\n loadContent : function(){\r\n if( this.contentLoaded )return;\r\n\r\n this.getRouteGroupList();\r\n\r\n var orgLength = this.getMaxOrgLength();\r\n if( orgLength === 0 ) { //流程选人数量为0\r\n if (this.orgsTileTd) {\r\n this.orgsTileTd.getParent(\"tr\").destroy();\r\n this.orgsTileTd = null;\r\n }\r\n if (this.orgsAreaTd) {\r\n this.orgsAreaTd.getParent(\"tr\").destroy();\r\n this.orgsAreaTd = null;\r\n }\r\n }\r\n\r\n this.setOpinion(); //意见\r\n\r\n if( this.hasDecisionOpinion ){ //有决策组\r\n if(this.routeGroupArea)this.routeGroupArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n if(this.routeGroupArea)this.routeSelectorArea.setStyles( this.css.routeSelectorArea_hasGroup );\r\n this.setRouteGroupList();\r\n }else{ //没有决策组\r\n if( this.routeGroupTitleTd ){\r\n this.routeGroupTitleTd.destroy();\r\n this.routeGroupTitleTd = null;\r\n this.routeSelectorTitleTd.set(\"colspan\",\"2\");\r\n }\r\n if( this.routeGroupAreaTd ){\r\n this.routeGroupAreaTd.destroy();\r\n this.routeGroupAreaTd = null;\r\n this.routeSelectorAreaTd.set(\"colspan\",\"2\");\r\n }\r\n this.routeSelectorArea.setStyles( this.css.routeSelectorArea );\r\n if( this.inputOpinionNodeTd && this.selectIdeaNodeTd ){\r\n this.inputOpinionNodeTd.set( \"width\", orgLength < 2 ? \"60%\" : \"50%\" );\r\n }\r\n this.setRouteList();\r\n }\r\n this.contentLoaded = true;\r\n },\r\n\r\n getAllNode : function(){\r\n this.node = this.getNode(\"submitNode\");\r\n\r\n this.embeddedContainer = this.node.getParent();\r\n\r\n this.topNode_embedded = this.getNode(\"submitTopNode_embedded\");\r\n this.buttonNode_embedded = this.getNode(\"submitButtonNode_embedded\");\r\n this.okButton_embedded = this.getNode(\"okButton_embedded\");\r\n\r\n this.topNode = this.getNode(\"submitTopNode\");\r\n this.topCloseAction = this.getNode(\"submitTopCloseActionNode\");\r\n this.buttonNode = this.getNode(\"submitButtonNode\");\r\n\r\n this.contentWrapNode = this.getNode(\"submitContentWrapNode\");\r\n this.contentNode = this.getNode(\"submitContentNode\");\r\n this.contentInnerNode = this.getNode(\"submitContentInnerNode\");\r\n this.contentTable = this.getNode(\"submitContentTable\").getElement(\"table\");\r\n\r\n this.routeGroupTitleTd = this.getNode(\"routeGroupTitleTd\");\r\n this.routeGroupAreaTd = this.getNode(\"routeGroupAreaTd\");\r\n this.routeGroupArea = this.getNode(\"routeGroupArea\");\r\n\r\n this.routeSelectorTitleTd = this.getNode(\"routeSelectorTitleTd\");\r\n this.routeSelectorAreaTd = this.getNode(\"routeSelectorAreaTd\");\r\n this.routeSelectorArea = this.getNode(\"routeSelectorArea\");\r\n\r\n this.selectIdeaNodeTd = this.getNode(\"selectIdeaNodeTd\");\r\n this.selectIdeaAreaNode = this.getNode(\"selectIdeaAreaNode\");\r\n\r\n this.inputOpinionNodeTd = this.getNode(\"inputOpinionNodeTd\");\r\n this.inputTextarea = this.getNode(\"inputTextarea\");\r\n\r\n this.handwritingAction = this.getNode(\"handwritingAction\");\r\n if( this.form.json.isHandwriting === \"no\" ){\r\n var mediaActionArea = this.getNode(\"mediaActionArea\");\r\n if(mediaActionArea){\r\n mediaActionArea.hide();\r\n }else if( this.handwritingAction ){\r\n this.handwritingAction.hide();\r\n }\r\n }\r\n\r\n this.orgsTileTd = this.getNode(\"orgsTileTd\");\r\n this.orgsAreaTd = this.getNode(\"orgsAreaTd\");\r\n this.orgsArea = this.getNode(\"orgsArea\");\r\n\r\n this.okButton = this.getNode(\"okButton\");\r\n this.cancelButton = this.getNode(\"cancelButton\");\r\n },\r\n setEmbeddedEvents : function(){\r\n if(this.okButton_embedded){\r\n this.okButton_embedded.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n },\r\n setPopupEvents: function(){\r\n if( this.popupEventsSeted )return;\r\n if(this.topCloseAction){\r\n this.topCloseAction.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this))\r\n }\r\n if(this.cancelButton){\r\n this.cancelButton.addEvent(\"click\", function () {\r\n this.close();\r\n this.fireEvent(\"cancel\");\r\n }.bind(this));\r\n }\r\n if(this.okButton){\r\n this.okButton.addEvent(\"click\", function (ev) {\r\n this.submit(ev)\r\n }.bind(this));\r\n }\r\n if(this.topNode){\r\n this.containerDrag = new Drag.Move(this.node, {\r\n \"handle\": this.topNode,\r\n \"container\": this.markNode || this.appContentNode,\r\n \"snap\": 5\r\n });\r\n }\r\n this.popupEventsSeted = true;\r\n },\r\n getNode : function(name){\r\n if( this.macro.form.get(name) ){\r\n return this.macro.form.get(name).node;\r\n }\r\n if( this.form.allForName[name] ){\r\n return this.form.allForName[name].node;\r\n }\r\n },\r\n setData : function(name, value){\r\n var item = this.macro.form.get(name);\r\n return item ? item.setData(value) : null;\r\n },\r\n getData : function(name){\r\n var item = this.macro.form.get(name);\r\n return item ? item.getData() : null;\r\n },\r\n getRouteConfigList : function(){ //获取当前待办的所有路由设置\r\n if( !this.routeConfigList ){\r\n o2.Actions.get(\"x_processplatform_assemble_surface\").listRoute( {\"valueList\":this.task.routeList} , function( json ){\r\n json.data.each( function(d){\r\n d.selectConfigList = JSON.parse( d.selectConfig || \"[]\" );\r\n }.bind(this));\r\n this.routeConfigList = json.data;\r\n }.bind(this), null, false );\r\n }\r\n return this.routeConfigList;\r\n },\r\n getRouteConfig : function( routeId ){ //根据某个ID获取路由设置\r\n var routeList = this.getRouteConfigList();\r\n for( var i=0; i