Просмотр исходного кода

Merge branch 'develop' into 'fix/commponent_order'

# Conflicts:
#   o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/schedule/InitComponents.java
o2null 5 лет назад
Родитель
Сommit
e94f21fbf7
42 измененных файлов с 952 добавлено и 298 удалено
  1. 48 0
      Jenkinsfile_release
  2. 13 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java
  3. 10 9
      o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/schedule/InitComponents.java
  4. 3 3
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionListNext.java
  5. 2 2
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionListPrev.java
  6. 18 4
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionSave.java
  7. 1 1
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java
  8. 1 0
      o2web/source/o2_core/o2/widget/Dialog.js
  9. 17 2
      o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js
  10. 12 2
      o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json
  11. 1 1
      o2web/source/o2_core/o2/xDesktop/$Default/blue/style-pc.css
  12. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/cyan/style-pc.css
  13. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/darkgreen/style-pc.css
  14. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/gray/style-pc.css
  15. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/green/style-pc.css
  16. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/navy/style-pc.css
  17. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/orange/style-pc.css
  18. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/purple/style-pc.css
  19. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/red/style-pc.css
  20. 2 2
      o2web/source/o2_core/o2/xDesktop/$Default/tan/style-pc.css
  21. 4 2
      o2web/source/o2_core/o2/xDesktop/Default.js
  22. 3 2
      o2web/source/o2_core/o2/xDesktop/Dialog.js
  23. 2 0
      o2web/source/x_component_Homepage/$Main/default/taskContent.html
  24. 92 0
      o2web/source/x_component_Homepage/TaskContent.js
  25. 1 0
      o2web/source/x_component_Homepage/lp/zh-cn.js
  26. 0 1
      o2web/source/x_component_process_FormDesigner/Module/Form.js
  27. 50 33
      o2web/source/x_component_process_ProcessDesigner/$Process/process.html
  28. BIN
      o2web/source/x_component_process_TaskCenter/$Main/default/tab/draft.png
  29. BIN
      o2web/source/x_component_process_TaskCenter/$Main/default/tab/draft_cur.png
  30. 109 0
      o2web/source/x_component_process_TaskCenter/DraftList.js
  31. 13 5
      o2web/source/x_component_process_TaskCenter/List.js
  32. 70 5
      o2web/source/x_component_process_TaskCenter/Main.js
  33. 1 3
      o2web/source/x_component_process_TaskCenter/ProcessStarter.js
  34. 1 0
      o2web/source/x_component_process_TaskCenter/lp/zh-cn.js
  35. 2 0
      o2web/source/x_component_process_Work/$Main/default/css.wcss
  36. 1 1
      o2web/source/x_component_process_Work/$Processor/process/css.wcss
  37. 103 75
      o2web/source/x_component_process_Work/Main.js
  38. 15 1
      o2web/source/x_component_process_Work/Processor.js
  39. 14 2
      o2web/source/x_component_process_Xform/Actionbar.js
  40. 5 3
      o2web/source/x_component_process_Xform/Attachment.js
  41. 317 123
      o2web/source/x_component_process_Xform/Form.js
  42. 5 0
      o2web/source/x_component_process_Xform/lp/zh-cn.js

+ 48 - 0
Jenkinsfile_release

@@ -0,0 +1,48 @@
+pipeline {
+    agent {label 'release'}
+    stages {
+        stage('Stop Server') {
+            steps {
+                catchError(buildResult: 'SUCCESS') {
+                    sh 'target/o2server/stop_windows.sh'
+                }
+            }
+        }
+        stage('init') {
+            steps {
+                sh 'npm install'
+                sh 'npm run clear'
+            }
+        }
+        stage('dependency') {
+            steps {
+                sh 'npm run preperation:win'
+            }
+        }
+        stage('build') {
+            parallel {
+                stage('build server') {
+                    steps {
+                        sh 'id'
+                        sh 'npm run build_server'
+                    }
+                }
+                stage('build web') {
+                    steps {
+                        sh 'npm run build_web'
+                    }
+                }
+            }
+        }
+        stage('deploy') {
+            steps {
+                sh 'npm run deploy:win'
+            }
+        }
+        stage('run') {
+            steps {
+                sh 'JENKINS_NODE_COOKIE=dontKillMe start /min target/o2server/start_windows.bat>>output.txt'
+            }
+        }
+    }
+}

+ 13 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/container/EntityManagerContainer.java

@@ -550,6 +550,19 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
 		return new ArrayList<T>(query.getResultList());
 	}
 
+	public <T extends JpaObject, W extends Object> List<T> listEqualOrIn(Class<T> cls, String attribute, Object value,
+			String otherAttribute, Collection<W> otherValues) throws Exception {
+		EntityManager em = this.get(cls);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<T> cq = cb.createQuery(cls);
+		Root<T> root = cq.from(cls);
+		Predicate p = cb.equal(root.get(attribute), value);
+		p = cb.or(p, cb.isMember(root.get(otherAttribute), cb.literal(otherValues)));
+		List<T> os = em.createQuery(cq.select(root).where(p)).getResultList();
+		List<T> list = new ArrayList<>(os);
+		return list;
+	}
+
 	public <T extends JpaObject> List<T> listNotEqual(Class<T> cls, String attribute, Object value) throws Exception {
 		EntityManager em = this.get(cls);
 		CriteriaBuilder cb = em.getCriteriaBuilder();

+ 10 - 9
o2server/x_component_assemble_control/src/main/java/com/x/component/assemble/control/schedule/InitComponents.java

@@ -9,6 +9,7 @@ import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.entity.annotation.CheckRemoveType;
 import com.x.base.core.project.config.Components;
 import com.x.base.core.project.config.Config;
+import com.x.base.core.project.gson.XGsonBuilder;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.schedule.AbstractJob;
@@ -34,12 +35,15 @@ public class InitComponents extends AbstractJob {
 
 	private void init() throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			List<String> names = ListTools.extractProperty(Config.components().getSystems(), Component.name_FIELDNAME, String.class, true,
-					true);
-			List<Component> os = emc.listEqual(Component.class, Component.type_FIELDNAME, Component.TYPE_SYSTEM);
+
+			List<Component> os = emc.listEqualOrIn(Component.class, Component.type_FIELDNAME, Component.TYPE_SYSTEM,
+					Component.name_FIELDNAME, Components.SYSTEM_NAME_NAMES);
+
+			List<String> existNames = ListTools.extractProperty(os, Component.name_FIELDNAME, String.class, true, true);
+
 			List<Component> removes = new ArrayList<>();
 			for (Component o : os) {
-				if (!names.contains(o.getName())) {
+				if (!Components.SYSTEM_NAME_NAMES.contains(o.getName())) {
 					removes.add(o);
 				}
 			}
@@ -50,12 +54,9 @@ public class InitComponents extends AbstractJob {
 				}
 				emc.commit();
 			}
-			for (Component o : os) {
-				names.remove(o.getName());
-			}
 			List<Component> adds = new ArrayList<>();
-			for (Components.Component o : Config.components().getSystems()) {
-				if (!names.contains(o.getName())) {
+			for (com.x.base.core.project.config.Components.Component o : Config.components().getSystems()) {
+				if (!existNames.contains(o.getName())) {
 					Component component = new Component();
 					component.setName(o.getName());
 					component.setPath(o.getPath());

+ 3 - 3
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionListNext.java

@@ -23,9 +23,9 @@ class ActionListNext extends BaseAction {
 	public static class Wo extends Draft {
 
 		private static final long serialVersionUID = 2279846765261247910L;
-
-		static WrapCopier<Draft, Wo> copier = WrapCopierFactory.wo(Draft.class, Wo.class, null,
-				JpaObject.FieldsInvisible);
+		
+		static WrapCopier<Draft, Wo> copier = WrapCopierFactory.wo(Draft.class, Wo.class,
+				JpaObject.singularAttributeField(Draft.class, true, true), null);
 
 		@FieldDescribe("排序号")
 		private Long rank;

+ 2 - 2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionListPrev.java

@@ -24,8 +24,8 @@ class ActionListPrev extends BaseAction {
 
 		private static final long serialVersionUID = 2279846765261247910L;
 
-		static WrapCopier<Draft, Wo> copier = WrapCopierFactory.wo(Draft.class, Wo.class, null,
-				JpaObject.FieldsInvisible);
+		static WrapCopier<Draft, Wo> copier = WrapCopierFactory.wo(Draft.class, Wo.class,
+				JpaObject.singularAttributeField(Draft.class, true, true), null);
 
 		@FieldDescribe("排序号")
 		private Long rank;

+ 18 - 4
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/ActionSave.java

@@ -1,6 +1,7 @@
 package com.x.processplatform.assemble.surface.jaxrs.draft;
 
 import java.util.List;
+import java.util.Objects;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
@@ -10,6 +11,7 @@ import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.exception.ExceptionAccessDenied;
 import com.x.base.core.project.exception.ExceptionEntityNotExist;
 import com.x.base.core.project.gson.GsonPropertyObject;
+import com.x.base.core.project.gson.XGsonBuilder;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
@@ -54,14 +56,14 @@ class ActionSave extends BaseAction {
 			if (StringUtils.isEmpty(wi.getWork().getId())) {
 				draft = new Draft();
 				this.update(draft, wi, application, process, person, identity, unit);
-				emc.check(draft, CheckPersistType.all);
+				emc.persist(draft, CheckPersistType.all);
 			} else {
 				draft = emc.find(wi.getWork().getId(), Draft.class);
 				if (null == draft) {
 					throw new ExceptionEntityNotExist(wi.getWork().getId(), Draft.class);
 				}
 				this.update(draft, wi, application, process, person, identity, unit);
-				emc.persist(draft, CheckPersistType.all);
+				emc.check(draft, CheckPersistType.all);
 			}
 			emc.commit();
 			Wo wo = new Wo();
@@ -82,14 +84,26 @@ class ActionSave extends BaseAction {
 		draft.setPerson(person);
 		draft.setIdentity(identity);
 		draft.setUnit(unit);
-		draft.setTitle(wi.getWork().getTitle());
+		String title = wi.getWork().getTitle();
+		if (null != wi.getData()) {
+			Object value = wi.getData().getOrDefault("subject", null);
+			if (null != value) {
+				title = Objects.toString(value);
+			} else {
+				value = wi.getData().getOrDefault("title", null);
+				if (null != value) {
+					title = Objects.toString(value);
+				}
+			}
+		}
+		draft.setTitle(title);
 		draft.getProperties().setData(wi.getData());
 	}
 
 	public static class Wi extends GsonPropertyObject {
 
 		@FieldDescribe("数据")
-		private Data data;
+		private Data data = new Data();
 
 		@FieldDescribe("工作")
 		private Work work;

+ 1 - 1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/draft/DraftAction.java

@@ -92,7 +92,7 @@ public class DraftAction extends StandardJaxrsAction {
 	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
 	@Consumes(MediaType.APPLICATION_JSON)
 	@JaxrsMethodDescribe(value = "保存草稿.", action = ActionSave.class)
-	public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+	public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
 			JsonElement jsonElement) {
 		ActionResult<ActionSave.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);

+ 1 - 0
o2web/source/o2_core/o2/widget/Dialog.js

@@ -36,6 +36,7 @@ o2.widget.Dialog = o2.DL = new Class({
         "container": null
 	},
 	initialize: function(options){
+		debugger;
 		this.setOptions(options);
 
 		this.path = o2.session.path+"/widget/$Dialog/";

+ 17 - 2
o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js

@@ -96,7 +96,22 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_surface"] = new Class
     getJobDataByPath: function(id, path, success, failure, async){
         var p = path.replace(/\./g, "/");
         this.action.invoke({"name": "getJobDataByPath","async": async, "parameter": {"id": id, "path": p},	"success": success,	"failure": failure, "urlEncode":false});
-    }
-
+    },
 
+    startWork: function(par1, par2, par3, par4, async){
+        var process = par3, data = par4, success = par1, failure = par2;
+        if (o2.typeOf(par1)==="string"){
+            process = par1;
+            data = par2;
+            success = par3;
+            failure = par4;
+        }
+        this.getProcess(process, function(json){
+            if (json.data.defaultStartMode=="draft"){
+                this.draw(process, data, success, failure, async)
+            }else{
+                this.createtWork(process, data, success, failure, async)
+            }
+        }.bind(this), failure, async);
+    }
 });

+ 12 - 2
o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json

@@ -60,8 +60,6 @@
 
   "checkDraft": {"uri": "/jaxrs/work/{id}/close/check", "method": "GET"},
 
-
-
   "removeTask": {"uri": "/jaxrs/task/{id}/manage", "method": "DELETE"},
   "removeDone": {"uri": "/jaxrs/taskcompleted/{id}/manage", "method": "DELETE"},
   "removeRead": {"uri": "/jaxrs/read/{id}/manage", "method": "DELETE"},
@@ -106,6 +104,17 @@
   "startWork": {"uri": "/jaxrs/work/process/{processId}", "method": "POST"},
   "processWork": {"uri": "/jaxrs/work/{id}/processing", "method": "PUT"},
 
+  "createtWork": {"uri": "/jaxrs/work/process/{processId}", "method": "POST"},
+
+  "draw": {"uri": "/jaxrs/draft/process/{processFlag}", "method": "POST"},
+  "saveDraft": {"uri": "/jaxrs/draft", "method": "PUT"},
+  "getDraft": {"uri": "/jaxrs/draft/{id}"},
+  "listDraftNext": {"uri": "/jaxrs/draft/list/{id}/next/{count}"},
+  "listDraftPrev": {"uri": "/jaxrs/draft/list/{id}/prev/{count}"},
+  "listDraftPage": {"uri": "/jaxrs/draft/list/my/paging/{page}/size/{size}", "method": "POST"},
+  "listDraftApplication": {"uri": "/jaxrs/draft/list/count/application"},
+  "startDraft": {"uri": "/jaxrs/draft/{id}/start"},
+  "deleteDraftWork": {"uri":  "/jaxrs/draft/{id}", "method": "DELETE"},
 
   "getTask": {"uri": "/jaxrs/task/{id}"},
   "saveTask": {"uri": "/jaxrs/task/{id}", "method": "POST"},
@@ -246,6 +255,7 @@
   "getView": {"uri": "/jaxrs/view/{id}"},
 
   "getForm": {"uri": "/jaxrs/form/{id}/application/{applicationFlag}"},
+  "getFormMobile": {"uri": "/jaxrs/form/{id}/application/{applicationFlag}/mobile"},
   "getScript": {"uri": "/jaxrs/script/{flag}/application/{applicationFlag}"},
   "getScriptByName": {"uri": "/jaxrs/script/{name}/application/{applicationId}","method": "POST"},
 

+ 1 - 1
o2web/source/o2_core/o2/xDesktop/$Default/blue/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/cyan/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/darkgreen/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/gray/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/green/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/navy/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/orange/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/purple/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/red/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 2 - 2
o2web/source/o2_core/o2/xDesktop/$Default/tan/style-pc.css

@@ -131,7 +131,7 @@
 
 /*taskbar*/
 .layout_content_taskbar {
-    height: 74px;
+    height: 71px;
     display: table-cell;
 }
 .layout_content_taskbar_area {
@@ -179,7 +179,7 @@
     cursor: pointer;
 }
 .layout_content_taskbar_area_action_msg {
- }
+}
 .layout_content_taskbar_area_action_skin {
 }
 .layout_content_taskbar_area_action_skin_focus {

+ 4 - 2
o2web/source/o2_core/o2/xDesktop/Default.js

@@ -151,9 +151,11 @@ o2.xDesktop.Default = new Class({
 
     loadLayout: function(callback){
         this.session.user.iconUrl = o2.Actions.get("x_organization_assemble_control").getPersonIcon(this.session.user.id);
-        var css = this.path+this.options.style+ ((o2.session.isMobile || layout.mobile) ? "/style-mobile.css" : "/style-pc.css");
+        //var css = this.path+this.options.style+ ((o2.session.isMobile || layout.mobile) ? "/style-mobile.css" : "/style-pc.css");
+        var css = this.path+this.options.style+ ((o2.session.isMobile || layout.mobile) ? "/style-pc.css" : "/style-pc.css");
         var skinCss = this.path+this.options.style+ "/style-skin.css";
-        var html = this.path+this.options.style+((o2.session.isMobile || layout.mobile) ? "/layout-mobile.html" : "/layout-pc.html");
+        //var html = this.path+this.options.style+((o2.session.isMobile || layout.mobile) ? "/layout-mobile.html" : "/layout-pc.html");
+        var html = this.path+this.options.style+((o2.session.isMobile || layout.mobile) ? "/layout-pc.html" : "/layout-pc.html");
 
         this.node.loadAll({ "css": [css], "html": [html]}, {"bind": {"user": this.session.user}, "module": this},function(){
             this.node.loadCss(skinCss);

+ 3 - 2
o2web/source/o2_core/o2/xDesktop/Dialog.js

@@ -820,6 +820,7 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
     }
 });
 o2.DL.open = function(options){
+    debugger;
     if (!options) options = {};
     if (!options.style) options.style = "user";
     //if (!options.transition) options.transition = Fx.Transitions.Back.easeOut;
@@ -827,14 +828,14 @@ o2.DL.open = function(options){
     if (options.isClose!==false) options.isClose = true;
 
     var size;
-    if (!options.width && !options.contentWidth){
+    if ((!options.width || options.width=="auto") && !options.contentWidth){
         if (options.content){
             options.content.show();
             size = options.content.getComputedSize();
             options.contentWidth = size.totalWidth.toFloat();
         }
     }
-    if (!options.height && !options.contentHeight){
+    if ((!options.height || options.height=="auto") && !options.contentHeight){
         if (options.content){
             if (!size){
                 options.content.show();

+ 2 - 0
o2web/source/x_component_Homepage/$Main/default/taskContent.html

@@ -9,6 +9,8 @@
         <div class="o2_homepage_title_tab" data-o2-element="taskCompletedTab" data-o2-events="click:loadTaskCompleted;mouseover:tabover;mouseout:tabout">{{$.lp.myTaskCompleted}}</div>
         <div class="o2_homepage_title_tab" data-o2-element="readCompletedTab" data-o2-events="click:loadReadCompleted;mouseover:tabover;mouseout:tabout">{{$.lp.myReadCompleted}}</div>
         <div class="o2_homepage_title_tab" data-o2-element="draftTab" data-o2-events="click:loadDraft;mouseover:tabover;mouseout:tabout">{{$.lp.myDraft}}</div>
+        <div class="o2_homepage_title_tab" data-o2-element="processDraftTab" data-o2-events="click:loadProcessDraft;mouseover:tabover;mouseout:tabout">{{$.lp.myProcessDraft}}</div>
+
     </div>
 
 </div>

+ 92 - 0
o2web/source/x_component_Homepage/TaskContent.js

@@ -102,6 +102,15 @@ MWF.xApplication.Homepage.TaskContent = new Class({
 
             this.fireEvent("loadDraftCount");
         }.bind(this));
+        o2.Actions.load("x_processplatform_assemble_surface").DraftAction.listNext("(0)", 1, function(json){
+            debugger;
+            if (!this.itemCounts) this.itemCounts = {};
+            this.itemCounts.processDraft = json.count;
+
+            this.showTabCount(this.processDraftTab, json.count);
+
+            this.fireEvent("loadProcessDraftCount");
+        }.bind(this));
     },
     showTabCount: function(node, count){
         var text = node.get("text");
@@ -168,6 +177,16 @@ MWF.xApplication.Homepage.TaskContent = new Class({
             }
             this.currentTab = this.draftContentTab;
         }
+    },
+    loadProcessDraft: function(){
+        if (!this.isLoading){
+            if (!this.processDraftContentTab){
+                this.processDraftContentTab = new MWF.xApplication.Homepage.TaskContent.ProcessDraft(this, this.processDraftTab);
+            }else{
+                this.processDraftContentTab.reload();
+            }
+            this.currentTab = this.processDraftContentTab;
+        }
     }
 });
 
@@ -783,3 +802,76 @@ MWF.xApplication.Homepage.TaskContent.Draft = new Class({
         //     }.bind(this));
     },
 });
+
+MWF.xApplication.Homepage.TaskContent.ProcessDraft = new Class({
+    Extends: MWF.xApplication.Homepage.TaskContent.TaskCompleted,
+    Implements: [Options, Events],
+    options: {
+        "type": "processDraft"
+    },
+    loadItemsRes: function(){
+        o2.Actions.load("x_processplatform_assemble_surface").DraftAction.listMyPaging(this.page, this.pageSize, {}, function(json){
+            if (json.data && json.data.length){
+                this.loadItems(json.data);
+                this.checkLoadPage();
+            }else{
+                this.emptyLoadContent();
+            }
+        }.bind(this));
+    },
+
+    loadItemRow: function(table, d, i){
+        var row = table.insertRow(-1).addClass("o2_homepage_task_item_row");
+        var idx = (this.page-1)*this.pageSize+i+1;
+        var idxShow = (idx>99) ? "···" : idx;
+
+        var cell = row.insertCell(-1).addClass("o2_homepage_task_item_cell_number");
+        var numberNode = new Element("div.o2_homepage_task_item_number", {"text": idxShow, "title":idx}).inject(cell);
+
+        //var subject = "<span>["+d.processName+"]</span> "+(d.title || this.app.lp.noSubject);
+        var subject = "["+d.processName+"] "+(d.title || this.app.lp.noSubject);
+        cell = row.insertCell(-1).addClass("o2_homepage_task_item_cell_subject");
+        new Element("div.o2_homepage_task_item_subject", {"html": subject, "title":subject}).inject(cell);
+
+        cell = row.insertCell(-1).addClass("o2_homepage_task_item_cell_activity");
+        new Element("div.o2_homepage_task_item_activity", {"text": this.app.lp.myProcessDraft, "title": this.app.lp.currentActivity+": "+this.app.lp.myProcessDraft}).inject(cell);
+
+        var user = o2.name.cn(layout.session.user.name)
+        cell = row.insertCell(-1).addClass("o2_homepage_task_item_cell_creator");
+        new Element("div.o2_homepage_task_item_creator", {"text": user, "title": this.app.lp.currentUser+": "+user}).inject(cell);
+
+        var time = d.createTime.substr(0,10);
+        cell = row.insertCell(-1).addClass("o2_homepage_task_item_cell_time");
+        new Element("div.o2_homepage_task_item_time", {"text": time, "title": this.app.lp.draftTime+": "+time}).inject(cell);
+
+        return row;
+    },
+
+    addLoadPageEvent: function(){
+        var loadPage = function(){
+            this.getPageCount();
+            this.loadPage();
+            this.content.removeEvent("loadProcessDraftCount", loadPage);
+        }.bind(this);
+        this.content.addEvent("loadProcessDraftCount", loadPage);
+    },
+    getPageCount:function(){
+        var n = this.content.itemCounts.processDraft/this.pageSize;
+        var nInt = n.toInt();
+        this.pages = (nInt===n) ? nInt : nInt+1;
+    },
+    open: function(e, d){
+        //     this._getJobByTask(function(data){
+        var options = {
+            "draftId": d.id, "appId": "process.Work"+ d.id,
+            "onAfterProcess": this.reloadTasks.bind(this),
+            "onAfterReset": this.reloadTasks.bind(this),
+            "onAfterRetract": this.reloadTasks.bind(this),
+            "onAfterReroute": this.reloadTasks.bind(this),
+            "onAfterDelete": this.reloadTasks.bind(this),
+            "onAfterReaded": this.reloadReads.bind(this),
+        };
+        layout.openApplication(e, "process.Work", options);
+        //     }.bind(this));
+    },
+});

+ 1 - 0
o2web/source/x_component_Homepage/lp/zh-cn.js

@@ -5,6 +5,7 @@ MWF.xApplication.Homepage.LP = o2.HPLP = {
 	"myRead": "待阅",
 	"myReadCompleted": "已阅",
 	"myDraft": "拟稿",
+	"myProcessDraft": "草稿",
 	"startProcess": "发起流程",
 	"noSubject": "无标题",
 	"noWork": "暂时没有工作",

+ 0 - 1
o2web/source/x_component_process_FormDesigner/Module/Form.js

@@ -85,7 +85,6 @@ MWF.xApplication.process.FormDesigner.Module.Form = MWF.FCForm = new Class({
         this.selected();
     },
 	load : function(data){
-		debugger;
 		this.data = data;
 		this.json = data.json;
 		this.html = data.html;

+ 50 - 33
o2web/source/x_component_process_ProcessDesigner/$Process/process.html

@@ -50,14 +50,6 @@
                 <td class="editTableTitle">图标:</td>
                 <td class="editTableValue"><div class="MWFIcon" name="icon"></div></td>
             </tr>
-            <tr>
-                <td class="editTableTitle">新建检查:</td>
-                <td class="editTableValue">
-                    <input class="editTableRadio" name="checkDraft" text{($.checkDraft===true)?'checked':''} type="radio" value="true"/>是
-                    <input class="editTableRadio" name="checkDraft" text{($.checkDraft!==true)?'checked':''} type="radio" value="false"/>否
-                    <br/>(选择“是”:未保存过的流程实例不会保留)
-                </td>
-            </tr>
             <tr>
                 <td class="editTableTitle">使用路由名称作为缺省意见:</td>
                 <td class="editTableValue">
@@ -67,32 +59,57 @@
                 </td>
             </tr>
         </table>
+        <div style="height: 22px; line-height: 22px; background-color: #f1f1f1; text-align: center; font-weight: bold; border-top: 1px solid #cccccc">启 动</div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">启动模式:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="defaultStartMode" onclick="if (this.checked){ $('text{$.id}checkDraftArea').setStyle('display', 'block');}"  text{($.defaultStartMode!=='draft')?'checked':''} type="radio" value="instance"/>实例模式
+                    <span style="color: #999999; font-size: 12px"> (新建流程时直接创建流程实例,给拟稿人生成待办)</span>
+                    <br/><input class="editTableRadio" name="defaultStartMode" onclick="if (this.checked){ $('text{$.id}checkDraftArea').setStyle('display', 'none');}" text{($.defaultStartMode==='draft')?'checked':''} type="radio" value="draft"/>草稿模式
+                    <span style="color: #999999; font-size: 12px"> (新建流程时不创建流程实例,不生成待办,产生一个草稿文档,直到流转时才创建流程实例)</span>
+                </td>
+            </tr>
+        </table>
+
+        <div id="text{$.id}checkDraftArea" style="display: text{($.defaultStartMode=='draft')?'none':'block'};">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">新建检查:</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="checkDraft" text{($.checkDraft===true)?'checked':''} type="radio" value="true"/>是
+                        <input class="editTableRadio" name="checkDraft" text{($.checkDraft!==true)?'checked':''} type="radio" value="false"/>否
+                        <br/>(选择“是”:未保存过的流程实例不会保留)
+                    </td>
+                </tr>
+            </table>
+        </div>
         <div style="height: 22px; line-height: 22px; background-color: #f1f1f1; text-align: center; font-weight: bold; border-top: 1px solid #cccccc">权 限</div>
-        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable" id="processEditStarter"">
-        <tr>
-            <td class="editTableTitle">启动人:</td>
-            <td class="editTableValue">
-                <div class="MWFPersonIdentity" name="startableIdentityList"></div>
-            </td>
-        </tr>
-        <tr>
-            <td class="editTableTitle">启动组织:</td>
-            <td class="editTableValue">
-                <div class="MWFPersonUnit" name="startableUnitList"></div>
-            </td>
-        </tr>
-        <!--<tr>-->
-        <!--<td class="editTableTitle">启动部门:</td>-->
-        <!--<td class="editTableValue">-->
-        <!--<div class="MWFPersonDepartment" name="startableDepartmentList"></div>-->
-        <!--</td>-->
-        <!--</tr>-->
-        <!--<tr>-->
-        <!--<td class="editTableTitle">启动公司:</td>-->
-        <!--<td class="editTableValue">-->
-        <!--<div class="MWFPersonCompany" name="startableCompanyList"></div>-->
-        <!--</td>-->
-        <!--</tr>-->
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable" id="processEditStarter">
+            <tr>
+                <td class="editTableTitle">启动人:</td>
+                <td class="editTableValue">
+                    <div class="MWFPersonIdentity" name="startableIdentityList"></div>
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">启动组织:</td>
+                <td class="editTableValue">
+                    <div class="MWFPersonUnit" name="startableUnitList"></div>
+                </td>
+            </tr>
+            <!--<tr>-->
+            <!--<td class="editTableTitle">启动部门:</td>-->
+            <!--<td class="editTableValue">-->
+            <!--<div class="MWFPersonDepartment" name="startableDepartmentList"></div>-->
+            <!--</td>-->
+            <!--</tr>-->
+            <!--<tr>-->
+            <!--<td class="editTableTitle">启动公司:</td>-->
+            <!--<td class="editTableValue">-->
+            <!--<div class="MWFPersonCompany" name="startableCompanyList"></div>-->
+            <!--</td>-->
+            <!--</tr>-->
         </table>
         <hr />
         <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">

BIN
o2web/source/x_component_process_TaskCenter/$Main/default/tab/draft.png


BIN
o2web/source/x_component_process_TaskCenter/$Main/default/tab/draft_cur.png


+ 109 - 0
o2web/source/x_component_process_TaskCenter/DraftList.js

@@ -0,0 +1,109 @@
+MWF.xDesktop.requireApp("process.TaskCenter", "TaskCompletedList", null, false);
+MWF.xApplication.process.TaskCenter.DraftList = new Class({
+    Extends: MWF.xApplication.process.TaskCenter.TaskCompletedList,
+    initData: function(){
+        this.count = 0;
+        this.isCountShow = false;
+        this.currentPage = 1;
+        this.pageCount = 20;
+        this.pages = 0;
+
+        this.items = [];
+        this.isItemsLoaded = false;
+        this.isItemLoadding = false;
+        this.loadItemQueue = 0;
+
+        this.filterApplication = "";
+        this.currentFilterNode = null;
+        this.filterListNode = null;
+    },
+    refresh: function(){
+        this.mask = new MWF.widget.Mask({"style": "desktop"});
+        this.mask.loadNode(this.app.content);
+        this.initData();
+        this.filterData = null;
+        if (this.applicationFilterAreaNode) this.applicationFilterAreaNode.empty();
+        this.createAppFilterNodes();
+        this.listAreaNode.empty();
+        this.resetListAreaHeight();
+        this.app.getWorkCounts();
+    },
+    _getCurrentPageData: function(callback, count){
+        this.app.getAction(function(){
+            if (this.filterData){
+                this.filterListNode.empty();
+                var data = {};
+                Object.each(this.filterData, function(v, key){
+                    if (key!="key"){
+                        if (v) {
+                            //data[this.app.options.filterMap[key]] = v.value;
+                            if (!data[this.app.options.filterMap[key]]) data[this.app.options.filterMap[key]] = [];
+                            data[this.app.options.filterMap[key]].push(v.value);
+                            this.createFilterItemNode(key, v);
+                        }
+                    }else{
+                        data.key = v;
+                    }
+                }.bind(this));
+                if (this.filterData.key){
+                    this.createFilterItemNode("key", {"name": this.filterData.key});
+                }
+
+                var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
+                this.app.action.listReviewFilter(function(json){
+
+                    if (callback) callback(json);
+                }, null, id, count || this.pageCount, data);
+
+            }else{
+                var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
+                this.app.action.listDraftNext(function(json){
+                    if (callback) callback(json);
+                }, null, id, count || this.pageCount);
+
+            }
+
+        }.bind(this));
+    },
+    // createActionBarNode: function(){
+    //     return false;
+    // },
+
+    _getApplicationCount: function(callback){
+        // this.app.getAction(function(){
+        //     this.app.action.listReviewApplication(function(json){
+        //         if (callback) callback(json);
+        //     }.bind(this));
+        // }.bind(this));
+    },
+    _createItem: function(task){
+        return new MWF.xApplication.process.TaskCenter.DraftList.Item(task, this)
+    },
+    _getFilterCount: function(callback){
+        // this.app.action.listReviewFilterCount(function(json){
+        //     if (callback) callback(json);
+        // });
+    }
+});
+
+MWF.xApplication.process.TaskCenter.DraftList.Item = new Class({
+    Extends: MWF.xApplication.process.TaskCenter.List.Item,
+    setContent: function(){
+        this.applicationTitleNode.set("text", this.data.applicationName);
+        this.titleNode.set("html", "<font style=\"color: #333;\">["+this.data.processName+"]&nbsp;&nbsp;</font>"+this.data.title);
+        this.titleNode.set("title", this.data.title);
+        this.activityNode.set("text", "( "+this.list.app.lp.draftTab+" )");
+
+        this.timeContentNode.set("text", this.list.app.lp.list_createDate+": "+this.data.createTime);
+
+        this.loadActions();
+        this.loadApplicationIcon();
+        //this.setTimeIconNode();
+    },
+    openTask: function(e){
+        //     this._getJobByTask(function(data){
+        var options = {"draftId": this.data.id, "appId": "process.Work"+this.data.id};
+        this.list.app.desktop.openApplication(e, "process.Work", options);
+        //     }.bind(this));
+    }
+});

+ 13 - 5
o2web/source/x_component_process_TaskCenter/List.js

@@ -50,7 +50,7 @@ MWF.xApplication.process.TaskCenter.List = new Class({
         this.mask.loadNode(this.app.content);
         this.initData();
         this.filterData = null;
-        this.applicationFilterAreaNode.empty();
+        if (this.applicationFilterAreaNode) this.applicationFilterAreaNode.empty();
         this.createAppFilterNodes();
         this.listAreaNode.empty();
         this.resetListAreaHeight();
@@ -435,8 +435,11 @@ MWF.xApplication.process.TaskCenter.List = new Class({
         this.contentNode.setStyle("width", ""+contentSize.x+"px");
 
         var size = this.contentNode.getSize();
-        var barSize = this.actionBarNode.getSize();
-        var y = size.y - barSize.y;
+        var y = size.y;
+        if (this.actionBarNode){
+            var barSize = this.actionBarNode.getSize();
+            y = size.y - barSize.y;
+        }
 
         this.listScrollAreaNode.setStyle("height", ""+y+"px");
         if (this.listAreaNode){
@@ -467,8 +470,13 @@ MWF.xApplication.process.TaskCenter.List = new Class({
         this.contentNode.setStyle("width", ""+contentSize.x+"px");
 
         var size = this.contentNode.getSize();
-        var barSize = this.actionBarNode.getSize();
-        var y = size.y - barSize.y;
+        var y = size.y;
+        if (this.actionBarNode){
+            var barSize = this.actionBarNode.getSize();
+            y = size.y - barSize.y;
+        }
+        // var barSize = this.actionBarNode.getSize();
+        // var y = size.y - barSize.y;
 
         this.listScrollAreaNode.setStyle("height", ""+y+"px");
 

+ 70 - 5
o2web/source/x_component_process_TaskCenter/Main.js

@@ -7,6 +7,8 @@ MWF.xDesktop.requireApp("process.TaskCenter", "TaskCompletedList", null, false);
 MWF.xDesktop.requireApp("process.TaskCenter", "ReadList", null, false);
 MWF.xDesktop.requireApp("process.TaskCenter", "ReadCompletedList", null, false);
 MWF.xDesktop.requireApp("process.TaskCenter", "ReviewList", null, false);
+MWF.xDesktop.requireApp("process.TaskCenter", "DraftList", null, false);
+
 if (MWF.xApplication.process.TaskCenter.options) MWF.xApplication.process.TaskCenter.options.multitask = false;
 MWF.xApplication.process.TaskCenter.Main = new Class({
     Extends: MWF.xApplication.Common.Main,
@@ -57,7 +59,7 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
         this.loadSearchNode();
     },
     loadTitleBar: function () {
-        this.taskTitleBar = new Element("div", {
+        this.taskTitleBar = new Element("div.mainColor_bg", {
             "styles": this.css.taskTitleBar
         }).inject(this.content);
     },
@@ -151,6 +153,10 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
         this.createTabItem(this.lp.readed, "readed.png", "readCompleted", function () {
             this.showReaded();
         }.bind(this));
+
+        this.createTabItem(this.lp.draftTab, "draft.png", "draft", function () {
+            this.showDraft();
+        }.bind(this));
         //this.createTabItem(this.lp.review, "review.png", "review", function(){this.showReview();}.bind(this));
 
         this.getWorkCounts();
@@ -246,6 +252,9 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
                 this["readCompletedCountNode"].set("text", "( " + ((this.counts.readCompleted > 100) ? "99" : this.counts.readCompleted) + " )");
                 //this["reviewCountNode"].set("text", "[ "+((this.counts.review>100) ? "99" : this.counts.review)+" ]");
             }.bind(this), null, this.desktop.session.user.distinguishedName);
+            this.action.listDraftNext("(0)", 1, function (json) {
+                this["draftCountNode"].set("text", "( " + ((json.count > 100) ? "99" : json.count) + " )");
+            }.bind(this));
         }.bind(this));
     },
     loadContent: function(){
@@ -290,6 +299,9 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
             case "review":
                 this.showReview();
                 break;
+            case "draft":
+                this.showDraft();
+                break;
             default:
                 this.showTask();
                 break;
@@ -309,7 +321,8 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
         } else {
             if (this.taskList) this.taskList.refresh();
         }
-        //this.searchBarAreaNode.setStyle("display", "none");
+        this.searchBarAreaNode.setStyle("display", "block");
+        this.searchBarInputNode.set("value", this.lp.searchKey);
     },
     showTab: function (idx) {
         this.tabs.each(function (node, i) {
@@ -707,6 +720,28 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
         this.searchBarAreaNode.setStyle("display", "block");
     },
 
+    createDraftList: function (filterData) {
+        if (!this.contentNode) this.loadContent();
+        this.draftList = new MWF.xApplication.process.TaskCenter.DraftList(this.contentListAreaNode, this, filterData);
+    },
+    showDraft: function(){
+        if (this.currentTab !== "draft") {
+            this.showTab(4);
+            this.currentTab = "draft";
+            if (!this.draftList) {
+                this.createDraftList((this.status) ? this.status.filter : null);
+                this.draftList.show();
+            } else {
+                this.draftList.show();
+                if (this.draftList) this.draftList.refresh();
+            }
+
+        } else {
+            if (this.draftList) this.draftList.refresh();
+        }
+        this.searchBarAreaNode.setStyle("display", "none");
+    },
+
     recordStatus: function(){
         var tab = this.currentTab || "task";
         var filter = null;
@@ -722,6 +757,9 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
         if (tab==="review"){
             filter = this.reviewList.filterData;
         }
+        if (tab==="draft"){
+            filter = this.draftList.filterData;
+        }
         return {"navi": this.currentTab || "task", "filter": filter};
     },
 
@@ -755,6 +793,11 @@ MWF.xApplication.process.TaskCenter.Main = new Class({
                     this.reviewList.filterData.key = keyWord;
                     this.reviewList.refilter();
                     break;
+                case "draft":
+                    if (!this.draftList.filterData) this.draftList.filterData  = {};
+                    this.draftList.filterData.key = keyWord;
+                    this.draftList.refilter();
+                    break;
             }
 
         }
@@ -1007,24 +1050,46 @@ MWF.xApplication.process.TaskCenter.Process = new Class({
     },
     afterStartProcess: function(data, title, processName){
         this.recordProcessData();
+
+        //if (data[0].startMode==="draft"){
+        debugger;
+        if (data.work){
+            this.startProcessDraft(data, title, processName);
+        }else{
+            this.startProcessInstance(data, title, processName);
+        }
+        this.starter.fireEvent("startProcess");
+    },
+    startProcessDraft: function(data, title, processName){
+        var work = data.work;
+        var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false};
+        this.app.desktop.openApplication(null, "process.Work", options);
+
+        // var msg = {
+        //     "subject": this.app.lp.processStarted,
+        //     "content": "<div>"+this.app.lp.processStartedMessage+"“["+processName+"]"+title+"”</div>"
+        // };
+        // var tooltip = layout.desktop.message.addTooltip(msg);
+        // var item = layout.desktop.message.addMessage(msg);
+    },
+    startProcessInstance: function(data, title, processName){
         var workInfors = [];
         var currentTask = [];
-
         data.each(function(work){
             if (work.currentTaskIndex !== -1) currentTask.push(work.taskList[work.currentTaskIndex].work);
             workInfors.push(this.getStartWorkInforObj(work));
         }.bind(this));
 
         if (currentTask.length===1){
-            var options = {"workId": currentTask[0], "appId": currentTask[0]};
+            var options = {"workId": currentTask[0], "appId": "process.Work"+currentTask[0]};
             this.app.desktop.openApplication(null, "process.Work", options);
 
             if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, false);
         }else{
             if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, true);
         }
-        this.starter.fireEvent("startProcess");
     },
+
     getStartWorkInforObj: function(work){
         var users = [];
         var currentTask = "";

+ 1 - 3
o2web/source/x_component_process_TaskCenter/ProcessStarter.js

@@ -51,10 +51,8 @@ MWF.xApplication.process.TaskCenter.ProcessStarter = new Class({
                                 this.mask = new MWF.widget.Mask({"style": "desktop"});
                                 this.mask.loadNode(this.app.content);
                                 this.getWorkAction(function(){
-
-
-
                                     this.workAction.startWork(function(json){
+                                        debugger;
                                         this.mask.hide();
                                         //this.markNode.destroy();
                                         //this.areaNode.destroy();

+ 1 - 0
o2web/source/x_component_process_TaskCenter/lp/zh-cn.js

@@ -16,6 +16,7 @@ MWF.xApplication.process.TaskCenter.LP = {
     "startProcess": "可启动流程",
     "back": "返回",
     "unnamed": "无标题",
+    "draftTab": "草稿",
 
 
     "list_title": "标题",

+ 2 - 0
o2web/source/x_component_process_Work/$Main/default/css.wcss

@@ -32,6 +32,8 @@
     },
     "processNode_Area": {
         "height": "300px",
+        "width": "700px",
+        "padding": "10px",
         "background-color": "#FFF",
         "overflow": "hidden"
     },

+ 1 - 1
o2web/source/x_component_process_Work/$Processor/process/css.wcss

@@ -89,7 +89,7 @@
         "float": "left",
         "margin-left": "20px",
         "padding-left" : "26px",
-        "border-radius": "5px",
+        "border-radius": "20px",
         "min-height": "24px",
         "line-height": "24px",
         "margin-top": "8px",

+ 103 - 75
o2web/source/x_component_process_Work/Main.js

@@ -11,6 +11,8 @@ MWF.xApplication.process.Work.Main = new Class({
 		"height": "800",
 		"title": MWF.xApplication.process.Work.LP.title,
         "workId": "",
+        "draftId": "",
+        "draft": null,
         "workCompletedId": "",
         "taskId": "",
         "jobId": "",
@@ -22,12 +24,14 @@ MWF.xApplication.process.Work.Main = new Class({
         "worklogType": "record" //record, worklog
 	},
 	onQueryLoad: function(){
+	    debugger;
 		this.lp = MWF.xApplication.process.Work.LP;
         if (!this.status) {
         } else {
             this.options.workId = this.status.workId;
             this.options.workCompletedId = this.status.workCompletedId;
             this.options.jobId = this.status.jobId;
+            this.options.draftId = this.status.draftId;
             this.options.priorityWork = this.status.priorityWork;
             this.options.readonly = (this.status.readonly === "true");
         }
@@ -108,7 +112,6 @@ MWF.xApplication.process.Work.Main = new Class({
         }
     },
     loadWork: function(){
-        // var method = "";
         var id = this.options.workCompletedId || this.options.workId || this.options.workid || this.options.workcompletedid;
         // var methods = {
         //     "loadWork": false,
@@ -116,36 +119,32 @@ MWF.xApplication.process.Work.Main = new Class({
         //     "getForm": false
         // };
         if (id){
-
-            // o2.Actions.invokeAsync2([
-            //     {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm", "par": [id], "cache": true},
-            //     {"action": this.action, "name": "loadWork", "par": [id]},
-            //     {"action": this.action, "name": "getWorkControl", "par": [id]},
-            //     {"action": this.action, "name": "getWorkLog", "par": [id]},
-            //     {"action": this.action, "name": "listAttachments", "par": [id]}
-            // ], {
-            //     "success": function(json_form, json_work, json_control, json_log, json_att){
-            //         if (json_work && json_control && json_form && json_log && json_att){
-            //             this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_att.data);
-            //
-            //             //if (layout.mobile) this.loadMobileActions();
-            //             this.openWork();
-            //         } else{
-            //             this.close();
-            //         }
-            //     }.bind(this), "failure": function(){}
-            // });
-            //var getWorkLogMothed = "getWorkLog";    //以前使用worklog,现在改成record了
-            var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
-            if (this.options.form && this.options.form.id && this.options.form.app){
-                o2.Actions.invokeAsync([
-                    {"action": this.action, "name": "getForm"},
-                    {"action": this.action, "name": "loadWork"},
-                    {"action": this.action, "name": "getWorkControl"},
-                    {"action": this.action, "name": "getWorkLog"},
-                    {"action": this.action, "name": "getRecordLog"},
-                    {"action": this.action, "name": "listAttachments"}
-                ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
+            this.loadWorkByWork(id);
+           // }.bind(this), "failure": function(){}}, [id, true, true, true], id);
+        }else if (this.options.draftId || this.options.draftid){
+            var draftId = this.options.draftId || this.options.draftid;
+            MWF.Actions.get("x_processplatform_assemble_surface").getDraft(draftId, function(json){
+                this.loadWorkByDraft(json.data.work, json.data.data);
+            }.bind(this));
+        }else if (this.options.draft){
+            this.loadWorkByDraft(this.options.draft);
+        }else if (this.options.jobId || this.options.jobid || this.options.job){
+            var jobId = this.options.jobId || this.options.jobid || this.options.job;
+            this.loadWorkByJob(jobId);
+        }
+    },
+    loadWorkByWork: function(id){
+        //var getWorkLogMothed = "getWorkLog";    //以前使用worklog,现在改成record了
+        var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
+        if (this.options.form && this.options.form.id && this.options.form.app){
+            o2.Actions.invokeAsync([
+                {"action": this.action, "name": "getForm"},
+                {"action": this.action, "name": "loadWork"},
+                {"action": this.action, "name": "getWorkControl"},
+                {"action": this.action, "name": "getWorkLog"},
+                {"action": this.action, "name": "getRecordLog"},
+                {"action": this.action, "name": "listAttachments"}
+            ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
                     if (json_work && json_control && json_form && json_log && json_att){
                         this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
                         if (this.mask) this.mask.hide();
@@ -164,15 +163,15 @@ MWF.xApplication.process.Work.Main = new Class({
                         }
                     }
                 }.bind(this), "failure": function(){}}, [this.options.form.id, this.options.form.app], id);
-            }else{
-                o2.Actions.invokeAsync([
-                    {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm"},
-                    {"action": this.action, "name": "loadWork"},
-                    {"action": this.action, "name": "getWorkControl"},
-                    {"action": this.action, "name": "getWorkLog"},
-                    {"action": this.action, "name": "getRecordLog"},
-                    {"action": this.action, "name": "listAttachments"}
-                ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
+        }else{
+            o2.Actions.invokeAsync([
+                {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm"},
+                {"action": this.action, "name": "loadWork"},
+                {"action": this.action, "name": "getWorkControl"},
+                {"action": this.action, "name": "getWorkLog"},
+                {"action": this.action, "name": "getRecordLog"},
+                {"action": this.action, "name": "listAttachments"}
+            ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
                     if (json_work && json_control && json_form && json_log && json_att){
                         this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
                         if (this.mask) this.mask.hide();
@@ -191,42 +190,69 @@ MWF.xApplication.process.Work.Main = new Class({
                         }
                     }
                 }.bind(this), "failure": function(){}}, id);
-            }
-           // }.bind(this), "failure": function(){}}, [id, true, true, true], id);
-        }else if (this.options.jobId || this.options.jobid || this.options.job){
-            var jobId = this.options.jobId || this.options.jobid || this.options.job;
-            MWF.Actions.get("x_processplatform_assemble_surface").listWorkByJob(jobId, function(json){
-                var workCompletedCount = json.data.workCompletedList.length;
-                var workCount = json.data.workList.length;
-                var count = workCount+workCompletedCount;
-                if (count===1){
-                    this.options.workId = (json.data.workList.length) ? json.data.workList[0].id : json.data.workCompletedList[0].id;
+        }
+    },
+    loadWorkByJob: function(jobId){
+        MWF.Actions.get("x_processplatform_assemble_surface").listWorkByJob(jobId, function(json){
+            var workCompletedCount = json.data.workCompletedList.length;
+            var workCount = json.data.workList.length;
+            var count = workCount+workCompletedCount;
+            if (count===1){
+                this.options.workId = (json.data.workList.length) ? json.data.workList[0].id : json.data.workCompletedList[0].id;
+                this.loadWork();
+            }else if (count>1){
+                var id = this.filterId(json.data.workList, json.data.workCompletedList, this.options.priorityWork);
+                if (id) {
+                    this.options.workId = id;
                     this.loadWork();
-                }else if (count>1){
-                    var id = this.filterId(json.data.workList, json.data.workCompletedList, this.options.priorityWork);
-                    if (id) {
-                        this.options.workId = id;
-                        this.loadWork();
-                    }else{
-                        var worksAreaNode = this.createWorksArea();
-                        // for (var x=0;x<3;x++){
-                        json.data.workList.each(function(work){
-                            this.createWorkNode(work, worksAreaNode);
-                        }.bind(this));
-                        json.data.workCompletedList.each(function(work){
-                            this.createWorkCompletedNode(work, worksAreaNode);
-                        }.bind(this));
-                        // }
-                        if (this.mask) this.mask.hide();
-                        this.formNode.setStyles(this.css.formNode_bg);
-
-                    }
                 }else{
+                    var worksAreaNode = this.createWorksArea();
+                    // for (var x=0;x<3;x++){
+                    json.data.workList.each(function(work){
+                        this.createWorkNode(work, worksAreaNode);
+                    }.bind(this));
+                    json.data.workCompletedList.each(function(work){
+                        this.createWorkCompletedNode(work, worksAreaNode);
+                    }.bind(this));
+                    // }
+                    if (this.mask) this.mask.hide();
+                    this.formNode.setStyles(this.css.formNode_bg);
 
                 }
-            }.bind(this));
-        }
+            }else{
+
+            }
+        }.bind(this));
     },
+    loadWorkByDraft: function(work, data){
+	    debugger;
+        o2.Actions.invokeAsync([
+            {"action": this.action, "name": (layout.mobile) ? "getFormMobile": "getForm"}
+        ], {"success": function(json_form){
+            if (json_form){
+                var workData = {
+                    "activity": {},
+                    "data": data || {},
+                    "taskList": [],
+                    "work": work
+                };
+                var control = {
+                    "allowVisit": true,
+                    "allowProcessing": true,
+                    "allowSave": true,
+                    "allowDelete": true
+                };
+
+                this.parseData(workData, control, json_form.data, [], [], []);
+                if (this.mask) this.mask.hide();
+                //if (layout.mobile) this.loadMobileActions();
+                this.openWork();
+                this.unLoading();
+
+            }
+        }.bind(this), "failure": function(){}}, [work.form, work.application]);
+    },
+
     createWorkNode: function(work, node, completed){
 	    var contentNode = node.getLast();
 	    var workNode = new Element("div", {"styles": this.css.workItemNode}).inject(contentNode);
@@ -323,9 +349,11 @@ MWF.xApplication.process.Work.Main = new Class({
         //this.inheritedAttachmentList = data.inheritedAttachmentList;
 
         this.control = controlData;
-        this.form = (formData.data) ? JSON.decode(MWF.decodeJsonString(formData.data)): null;
-        delete formData.data;
-        this.formInfor = formData;
+        if (formData){
+            this.form = (formData.data) ? JSON.decode(MWF.decodeJsonString(formData.data)): null;
+            delete formData.data;
+            this.formInfor = formData;
+        }
     },
 
     // loadWork2: function(){
@@ -540,7 +568,7 @@ MWF.xApplication.process.Work.Main = new Class({
 
     recordStatus: function(){
 	    debugger;
-        return {"workId": this.options.workId, "workCompletedId": this.options.workCompletedId, "jobId": this.options.jobId, "priorityWork": this.options.priorityWork, "readonly": this.readonly};
+        return {"workId": this.options.workId, "workCompletedId": this.options.workCompletedId, "jobId": this.options.jobId, "draftId": this.options.draftId, "priorityWork": this.options.priorityWork, "readonly": this.readonly};
     },
     onPostClose: function(){
         if (this.appForm){

+ 15 - 1
o2web/source/x_component_process_Work/Processor.js

@@ -62,7 +62,7 @@ MWF.xApplication.process.Work.Processor = new Class({
             if( layout.mobile ){
                 this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.node);
                 this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea);
-                this.orgsArea.hide()
+                this.orgsArea.hide();
             }else{
                 this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.node);
                 this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea);
@@ -248,9 +248,11 @@ MWF.xApplication.process.Work.Processor = new Class({
         if (this.selectedRouteGroup){
             if (this.selectedRouteGroup.get("text") != node.get("text")){
                 this.selectedRouteGroup.setStyles(this.css.routeGroupNode);
+                //this.selectedRouteGroup.removeClass("mainColor_bg");
 
                 this.selectedRouteGroup = node;
                 this.selectedRouteGroup.setStyles(this.css.routeGroupNode_selected);
+                //this.selectedRouteGroup.addClass("mainColor_bg");
 
                 var routeList = this.selectedRouteGroup.retrieve("routeList");
                 this.setRouteList( routeList );
@@ -265,6 +267,7 @@ MWF.xApplication.process.Work.Processor = new Class({
         }else{
             this.selectedRouteGroup = node;
             node.setStyles(this.css.routeGroupNode_selected);
+            //this.selectedRouteGroup.addClass("mainColor_bg");
 
             var routeList = this.selectedRouteGroup.retrieve("routeList");
             this.setRouteList( routeList );
@@ -341,19 +344,23 @@ MWF.xApplication.process.Work.Processor = new Class({
         if (this.selectedRoute){
             if (this.selectedRoute.get("text") != node.get("text")){
                 node.setStyles(this.css.routeNode_over);
+                node.addClass("lightColor_bg");
                 //node.setStyle("background-color", "#f7e1d0");
             }
         }else{
             node.setStyles(this.css.routeNode_over);
+            node.addClass("lightColor_bg");
         }
     },
     outRoute: function(node){
         if (this.selectedRoute){
             if (this.selectedRoute.get("text") != node.get("text")){
                 node.setStyles(this.css.routeNode);
+                node.removeClass("lightColor_bg");
             }
         }else{
             node.setStyles(this.css.routeNode);
+            node.removeClass("lightColor_bg");
         }
     },
     selectRoute_noform: function(node){
@@ -378,17 +385,22 @@ MWF.xApplication.process.Work.Processor = new Class({
         if (this.selectedRoute){
             if (this.selectedRoute.get("text") != node.get("text")){
                 this.selectedRoute.setStyles(this.css.routeNode);
+                this.selectedRoute.removeClass("mainColor_bg");
                 //this.selectedRoute.getFirst().setStyles(this.css.routeIconNode);
                 //this.selectedRoute.getLast().setStyles(this.css.routeTextNode);
 
                 this.selectedRoute = node;
                 node.setStyles(this.css.routeNode_selected);
+                node.addClass("mainColor_bg");
+                node.removeClass("lightColor_bg");
                 //node.setStyle("background-color", "#da7429");
                 //node.getFirst().setStyle("background-image", "url("+"/x_component_process_Work/$Processor/default/checked.png)");
                 //node.getLast().setStyle("color", "#FFF");
 
             }else{
                 this.selectedRoute.setStyles(this.css.routeNode);
+                this.selectedRoute.addClass("mainColor_bg");
+                this.selectedRoute.removeClass("lightColor_bg");
                 //this.selectedRoute.getFirst().setStyles(this.css.routeIconNode);
                 //this.selectedRoute.getLast().setStyles(this.css.routeTextNode);
 
@@ -397,6 +409,8 @@ MWF.xApplication.process.Work.Processor = new Class({
         }else{
             this.selectedRoute = node;
             node.setStyles(this.css.routeNode_selected);
+            node.addClass("mainColor_bg");
+            node.removeClass("lightColor_bg");
             //node.setStyle("background-color", "#da7429");
             //node.getFirst().setStyle("background-image", "url("+"/x_component_process_Work/$Processor/default/checked.png)");
             //node.getLast().setStyle("color", "#FFF");

+ 14 - 2
o2web/source/x_component_process_Xform/Actionbar.js

@@ -123,11 +123,23 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar =  new Class({
             var hideFlag = this.form.Macro.exec(tool.condition, this);
             flag = flag && (!hideFlag);
         }
-        if (tool.id == "action_processWork"){
-            if (!this.form.businessData.task){
+        // if (tool.id == "action_processWork"){
+        //     if (!this.form.businessData.task){
+        //         flag = false;
+        //     }
+        // }
+        if (tool.id == "action_downloadAll" || tool.id == "action_print"){
+            if (!this.form.businessData.activity || !this.form.businessData.activity.id){
+                flag = false;
+            }
+        }
+        if (tool.id == "action_delete"){
+            if (!this.form.businessData.work || !this.form.businessData.work.id){
                 flag = false;
             }
         }
+
+
         if (tool.id == "action_rollback") tool.read = true;
         if (readonly) if (!tool.read) flag = false;
         if (flag){

+ 5 - 3
o2web/source/x_component_process_Xform/Attachment.js

@@ -1031,8 +1031,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
 
     _loadUserInterface: function () {
         this.node.empty();
-        this.loadAttachmentController();
-        this.fireEvent("load");
+        if (this.form.businessData.activity && this.form.businessData.activity.id){
+            this.loadAttachmentController();
+            this.fireEvent("load");
+        }
     },
     loadAttachmentController: function () {
         //MWF.require("MWF.widget.AttachmentController", function() {
@@ -1103,7 +1105,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
 
     },
     getData: function () {
-        return this.attachmentController.getAttachmentNames();
+        return (this.attachmentController) ? this.attachmentController.getAttachmentNames() : null;
     },
     createUploadFileNode: function () {
         var accept = "*";

+ 317 - 123
o2web/source/x_component_process_Xform/Form.js

@@ -991,8 +991,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
     },
 
     saveWork: function (callback, silent ) {
+        debugger;
         if (this.businessData.control["allowSave"]) {
             this.fireEvent("beforeSave");
+
             if (this.app && this.app.fireEvent) this.app.fireEvent("beforeSave");
             this.saveFormData(function (json) {
                 if (this.app && !silent) this.app.notice(MWF.xApplication.process.Xform.LP.dataSaved, "success");
@@ -1000,11 +1002,13 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 this.fireEvent("afterSave");
                 if (this.app && this.app.fireEvent) this.app.fireEvent("afterSave");
             }.bind(this));
+
         } else {
             MWF.xDesktop.notice("error", { x: "right", y: "top" }, "Permission Denied");
             //if (failure) failure(null, "Permission Denied", "");
         }
     },
+
     getSectionList: function () {
         return Object.keys(this.sectionListObj).map(function (p) {
             var o = { "path": p };
@@ -1072,6 +1076,13 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
     },
 
     saveFormData: function (callback, failure, history, data, issubmit) {
+        if (this.businessData.activity && this.businessData.activity.id){
+            this.saveFormDataInstance(callback, failure, history, data, issubmit);
+        }else{
+            this.saveFormDataDraft(callback, failure, history, data, issubmit);
+        }
+    },
+    saveFormDataInstance: function(callback, failure, history, data, issubmit){
         if (this.officeList) {
             this.officeList.each(function (module) {
                 module.save(history);
@@ -1079,16 +1090,6 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
         var data = data || this.getData(issubmit);
 
-        //this.setProcessorSectionOrgList(data);
-        //
-        //var sectionList = this.getSectionList();
-        //var formData = {
-        //    "data": data,
-        //    "sectionList": sectionList
-        //};
-
-        debugger;
-
         this.modifedData = {};
         this.setModifedData(data);
 
@@ -1096,10 +1097,35 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
 
         this.businessData.originalData = null;
         this.businessData.originalData = Object.clone(data);
-
-        //this.workAction.saveSectionData(callback, failure, this.businessData.work.id, formData);
     },
+    saveFormDataDraft:function(callback, failure, history, data, issubmit){
+        if (this.officeList) {
+            this.officeList.each(function (module) {
+                module.save(history);
+            });
+        }
+        var data = data || this.getData(issubmit);
+        var draft = {
+            "data": data,
+            "work": this.businessData.work,
+            "identity": this.businessData.work.creatorIdentity
+        }
+        this.workAction.saveDraft(draft, function(json){
+            this.workAction.getDraft(json.data.id, function(json){
+                this.businessData.work = json.data.work;
+                this.app.options.draftId = json.data.work.id;
+                this.app.options.desktopReload = true;
+
+                this.app.appId = "process.Work"+json.data.work.id,
+                delete layout.desktop.apps[this.app.options.appId];
+                layout.desktop.apps[this.app.appId] = this.app;
 
+                if (callback) callback();
+            }.bind(this));
+        }.bind(this), failure);
+        this.businessData.originalData = null;
+        this.businessData.originalData = Object.clone(data);
+    },
     setProcessorSectionOrgList: function (data) {
         if (!this.routeDataList) this.getRouteDataList();
         var routeList = this.routeDataList;
@@ -1131,7 +1157,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             //    this.fireEvent("afterClose");
         }
         if (!this.options.readonly) {
-            if (this.businessData.work){
+            if (this.businessData.work && this.businessData.work.id){
                 if (this.app.inBrowser && navigator.sendBeacon){
                     debugger;
                     var obj = this.workAction.action.actions["checkDraft"];
@@ -1582,82 +1608,160 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         var dlg = o2.DL.open(options);
 
     },
+    startDraftProcess: function(){
+        if (!this.formCustomValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
+        }
+        if (!this.formValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
+        }
+        this.saveFormData(function(){
+            this.workAction.startDraft(this.businessData.work.id, function(json){
+                this.app.options.workId = json.data[0].work;
+                var msg = {
+                    "subject": MWF.xApplication.process.Xform.LP.processStarted,
+                    "content": "<div>"+MWF.xApplication.process.Xform.LP.processStartedMessage+"“["+json.data[0].processName+"]"+(this.businessData.data.title || this.businessData.data.subject)+"”</div>"
+                };
+                var tooltip = layout.desktop.message.addTooltip(msg);
+                var item = layout.desktop.message.addMessage(msg);
+
+                this.app.reload();
+
+                //this.app.notice(MWF.xApplication.process.Xform.LP.dataSaved, "success");
+                //草稿模式暂时不能上传附件,不能直接流转文件
+                // o2.Actions.invokeAsync([
+                //     {"action": this.workAction, "name": "loadWork"},
+                //     {"action": this.workAction, "name": "getWorkControl"},
+                //     {"action": this.workAction, "name": "getWorkLog"},
+                //     {"action": this.workAction, "name": "getRecordLog"},
+                //     {"action": this.workAction, "name": "listAttachments"}
+                // ], {"success": function(json_work, json_control, json_log, json_record, json_att){
+                //     if (json_work && json_control && json_log && json_att){
+                //         this.app.parseData(json_work.data, json_control.data, null, json_log.data, json_record.data, json_att.data);
+                //         var workData = json_work.data;
+                //         this.businessData.activity = workData.activity;
+                //         this.businessData.originalData = Object.clone( this.businessData.data );
+                //         this.businessData.taskList = workData.taskList;
+                //         this.businessData.task = this.getCurrentTaskData(workData);
+                //         this.businessData.taskList = workData.taskList;
+                //         this.businessData.readList = workData.readList;
+                //         this.businessData.work = workData.work;
+                //         this.businessData.workCompleted = (workData.work.completedTime) ? workData.work : null;
+                //
+                //         this.businessData.workLogList = json_log.data;
+                //         this.businessData.recordList = json_record.data;
+                //         this.businessData.attachmentList = json_att.data;
+                //         this.businessData.control = json_control.data;
+                //
+                //         if (this.businessData.task){
+                //             this.processWork();
+                //         }else{
+                //             this.app.options.workId = json.data[0].work;
+                //             this.app.reload();
+                //         }
+                //     }
+                // }.bind(this), "failure": function(){}}, json.data[0].work);
+
+            }.bind(this));
+        }.bind(this), null, false, null, false)
+    },
+    getCurrentTaskData: function(data){
+        if ((data.currentTaskIndex || data.currentTaskIndex===0) && data.currentTaskIndex != -1){
+            this.app.options.taskId = this.businessData.taskList[data.currentTaskIndex].id;
+            return this.businessData.taskList[data.currentTaskIndex];
+        }
+        return null;
+    },
+
     processWork: function () {
-        if (this.json.mode == "Mobile") {
-            this.processWork_mobile();
-        } else {
-            this.fireEvent("beforeProcessWork");
-            if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
+        if (!this.businessData.activity || !this.businessData.activity.id){
+            this.startDraftProcess();
+        }else {
+            if (this.json.mode == "Mobile") {
+                this.processWork_mobile();
+            } else {
+                this.fireEvent("beforeProcessWork");
+                if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
 
-            if (!this.formCustomValidation("", "")) {
-                this.app.content.unmask();
-                //    if (callback) callback();
-                return false;
-            }
-            // MWF.require("MWF.widget.Mask", function() {
-            //     this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
-            //     this.mask.loadNode(this.app.content);
-
-            if (!this.formValidation("", "")) {
-                this.app.content.unmask();
-                //    if (callback) callback();
-                return false;
-            }
+                if (!this.formCustomValidation("", "")) {
+                    this.app.content.unmask();
+                    //    if (callback) callback();
+                    return false;
+                }
+                // MWF.require("MWF.widget.Mask", function() {
+                //     this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
+                //     this.mask.loadNode(this.app.content);
+
+                if (!this.formValidation("", "")) {
+                    this.app.content.unmask();
+                    //    if (callback) callback();
+                    return false;
+                }
 
-            var setSize = function (notRecenter) {
-                var dlg = this;
-                if (!dlg || !dlg.node) return;
-                dlg.node.setStyle("display", "block");
-                var size = processNode.getSize();
-                dlg.content.setStyles({
-                    "height": size.y,
-                    "width": size.x
-                });
-                var s = dlg.setContentSize();
-                if (dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto") {
-                    dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
-                    dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
+                var setSize = function (notRecenter) {
+                    debugger;
+                    var dlg = this;
+                    if (!dlg || !dlg.node) return;
+                    dlg.node.setStyle("display", "block");
+                    var size = processNode.getSize();
+                    dlg.content.setStyles({
+                        "height": size.y,
+                        "width": size.x
+                    });
+                    var s = dlg.setContentSize();
+                    if (dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto") {
+                        dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
+                        dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
+                    }
+                    if (!notRecenter) dlg.reCenter();
                 }
-                if (!notRecenter) dlg.reCenter();
-            }
 
-            //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
-            var processNode = new Element("div", { "styles": this.app.css.processNode_Area }).inject(this.app.content);
-            this.setProcessNode(processNode, "process", function () {
-                this.processDlg = o2.DL.open({
-                    "title": this.app.lp.process,
-                    "style": this.json.dialogStyle || "user",
-                    "isResize": false,
-                    "content": processNode,
-                    "positionHeight": 800,
-                    "maxHeight": 800,
-                    "maxHeightPercent": "98%",
-                    "minTop": 5,
-                    "width": "auto", //processNode.retrieve("width") || 1000, //600,
-                    "height": "auto", //processNode.retrieve("height") || 401,
-                    "buttonList": [
-                        {
-                            "type": "ok",
-                            "text": MWF.LP.process.button.ok,
-                            "action": function (d, e) {
-                                if (this.processor) this.processor.okButton.click();
-                            }.bind(this)
-                        },
-                        {
-                            "type": "cancel",
-                            "text": MWF.LP.process.button.cancel,
-                            "action": function () { this.processDlg.close(); }.bind(this)
+                //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
+                var processNode = new Element("div", {"styles": this.app.css.processNode_Area}).inject(this.node);
+                this.setProcessNode(processNode, "process", function () {
+                    this.processDlg = o2.DL.open({
+                        "title": this.app.lp.process,
+                        "style": this.json.dialogStyle || "user",
+                        "isResize": false,
+                        "content": processNode,
+                        "maskNode": this.app.content,
+                        "positionHeight": 800,
+                        "maxHeight": 800,
+                        "maxHeightPercent": "98%",
+                        "minTop": 5,
+                        "width": "auto", //processNode.retrieve("width") || 1000, //600,
+                        "height": "auto", //processNode.retrieve("height") || 401,
+                        "buttonList": [
+                            {
+                                "type": "ok",
+                                "text": MWF.LP.process.button.ok,
+                                "action": function (d, e) {
+                                    if (this.processor) this.processor.okButton.click();
+                                }.bind(this)
+                            },
+                            {
+                                "type": "cancel",
+                                "text": MWF.LP.process.button.cancel,
+                                "action": function () {
+                                    this.processDlg.close();
+                                    if (this.processor) this.processor.destroy();
+                                }.bind(this)
+                            }
+                        ],
+                        "onPostLoad": function () {
+                            setSize.call(this)
                         }
-                    ],
-                    "onPostLoad": function () {
-                        setSize.call(this)
-                    }
-                });
+                    });
 
-            }.bind(this), function () {
-                setSize.call(this.processDlg, true)
-            }.bind(this));
+                }.bind(this), function () {
+                    if (this.processDlg) setSize.call(this.processDlg, true)
+                }.bind(this));
 
+            }
         }
     },
     processWork_mobile: function () {
@@ -3150,28 +3254,29 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
     },
 
-    deleteWork: function () {
+    deleteDraftWork: function(){
         var _self = this;
         if (this.json.mode === "Mobile") {
             if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
                 MWF.require("MWF.widget.Mask", function () {
-                    _self.mask = new MWF.widget.Mask({ "style": "desktop", "zIndex": 50000 });
+                    _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
                     _self.mask.loadNode(_self.app.content);
 
-                    _self.fireEvent("beforeDelete");
-                    if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
-
                     _self.doDeleteWork(function () {
-                        _self.fireEvent("afterDelete");
-                        if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
                         _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
-                        if (_self.mask) { _self.mask.hide(); _self.mask = null; }
+                        if (_self.mask) {
+                            _self.mask.hide();
+                            _self.mask = null;
+                        }
                         _self.finishOnMobile()
                     }.bind(this), function (xhr, text, error) {
                         var errorText = error + ":" + text;
                         if (xhr) errorText = xhr.responseText;
                         _self.app.notice("request json error: " + errorText, "error", dlg.node);
-                        if (_self.mask) { _self.mask.hide(); _self.mask = null; }
+                        if (_self.mask) {
+                            _self.mask.hide();
+                            _self.mask = null;
+                        }
                     }.bind(this));
                 }.bind(this));
             }
@@ -3186,58 +3291,147 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 }
             };
             this.app.confirm("infor", event, MWF.xApplication.process.Xform.LP.deleteWorkTitle, MWF.xApplication.process.Xform.LP.deleteWorkText, 380, 120, function () {
-                // _self.app.content.mask({
-                //    "style": {
-                //        "background-color": "#999",
-                //        "opacity": 0.6
-                //    }
-                // });
-
-
                 MWF.require("MWF.widget.Mask", function () {
-                    _self.mask = new MWF.widget.Mask({ "style": "desktop", "zIndex": 50000 });
+                    _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
                     _self.mask.loadNode(_self.app.content);
 
-                    _self.fireEvent("beforeDelete");
-                    if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
-
                     _self.doDeleteWork(function () {
-                        _self.fireEvent("afterDelete");
-                        if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
                         _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
                         _self.app.close();
                         this.close();
-                        if (_self.mask) { _self.mask.hide(); _self.mask = null; }
+                        if (_self.mask) {
+                            _self.mask.hide();
+                            _self.mask = null;
+                        }
                     }.bind(this), function (xhr, text, error) {
                         var errorText = error + ":" + text;
                         if (xhr) errorText = xhr.responseText;
                         _self.app.notice("request json error: " + errorText, "error", dlg.node);
-                        if (_self.mask) { _self.mask.hide(); _self.mask = null; }
+                        if (_self.mask) {
+                            _self.mask.hide();
+                            _self.mask = null;
+                        }
                     }.bind(this));
                 }.bind(this));
-
-
-
-                //_self.workAction.deleteWork(function(json){
-                //    _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete+": “"+_self.businessData.work.title+"”", "success");
-                //    _self.app.close();
-                //    this.close();
-                //}.bind(this), null, _self.businessData.work.id);
-                //this.close();
             }, function () {
                 this.close();
             }, null, this.app.content, this.json.confirmStyle);
         }
     },
+    deleteWork: function () {
+        if (!this.businessData.activity || !this.businessData.activity.id) {
+            this.deleteDraftWork();
+        }else {
+            var _self = this;
+            if (this.json.mode === "Mobile") {
+                if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
+                    MWF.require("MWF.widget.Mask", function () {
+                        _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
+                        _self.mask.loadNode(_self.app.content);
+
+                        _self.fireEvent("beforeDelete");
+                        if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
+
+                        _self.doDeleteWork(function () {
+                            _self.fireEvent("afterDelete");
+                            if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
+                            _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
+                            if (_self.mask) {
+                                _self.mask.hide();
+                                _self.mask = null;
+                            }
+                            _self.finishOnMobile()
+                        }.bind(this), function (xhr, text, error) {
+                            var errorText = error + ":" + text;
+                            if (xhr) errorText = xhr.responseText;
+                            _self.app.notice("request json error: " + errorText, "error", dlg.node);
+                            if (_self.mask) {
+                                _self.mask.hide();
+                                _self.mask = null;
+                            }
+                        }.bind(this));
+                    }.bind(this));
+                }
+            } else {
+                var p = MWF.getCenterPosition(this.app.content, 380, 150);
+                var event = {
+                    "event": {
+                        "x": p.x,
+                        "y": p.y - 200,
+                        "clientX": p.x,
+                        "clientY": p.y - 200
+                    }
+                };
+                this.app.confirm("infor", event, MWF.xApplication.process.Xform.LP.deleteWorkTitle, MWF.xApplication.process.Xform.LP.deleteWorkText, 380, 120, function () {
+                    // _self.app.content.mask({
+                    //    "style": {
+                    //        "background-color": "#999",
+                    //        "opacity": 0.6
+                    //    }
+                    // });
+
+
+                    MWF.require("MWF.widget.Mask", function () {
+                        _self.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
+                        _self.mask.loadNode(_self.app.content);
+
+                        _self.fireEvent("beforeDelete");
+                        if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
+
+                        _self.doDeleteWork(function () {
+                            _self.fireEvent("afterDelete");
+                            if (_self.app && _self.app.fireEvent) _self.app.fireEvent("afterDelete");
+                            _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
+                            _self.app.close();
+                            this.close();
+                            if (_self.mask) {
+                                _self.mask.hide();
+                                _self.mask = null;
+                            }
+                        }.bind(this), function (xhr, text, error) {
+                            var errorText = error + ":" + text;
+                            if (xhr) errorText = xhr.responseText;
+                            _self.app.notice("request json error: " + errorText, "error", dlg.node);
+                            if (_self.mask) {
+                                _self.mask.hide();
+                                _self.mask = null;
+                            }
+                        }.bind(this));
+                    }.bind(this));
+
+
+                    //_self.workAction.deleteWork(function(json){
+                    //    _self.app.notice(MWF.xApplication.process.Xform.LP.workDelete+": “"+_self.businessData.work.title+"”", "success");
+                    //    _self.app.close();
+                    //    this.close();
+                    //}.bind(this), null, _self.businessData.work.id);
+                    //this.close();
+                }, function () {
+                    this.close();
+                }, null, this.app.content, this.json.confirmStyle);
+            }
+        }
+    },
+    doDeleteDraftWork: function(success, failure){
+        this.workAction.deleteDraftWork(function (json) {
+            if (success) success(json);
+        }.bind(this), function (xhr, text, error) {
+            if (failure) failure(xhr, text, error);
+        }, this.businessData.work.id);
+    },
     doDeleteWork: function (success, failure) {
-        if (this.businessData.control["allowDelete"]) {
-            this.workAction.deleteWork(function (json) {
-                if (success) success(json);
-            }.bind(this), function (xhr, text, error) {
-                if (failure) failure(xhr, text, error);
-            }, this.businessData.work.id);
-        } else {
-            if (failure) failure(null, "Permission Denied", "");
+        if (!this.businessData.activity || !this.businessData.activity.id) {
+            this.doDeleteDraftWork(success, failure);
+        }else {
+            if (this.businessData.control["allowDelete"]) {
+                this.workAction.deleteWork(function (json) {
+                    if (success) success(json);
+                }.bind(this), function (xhr, text, error) {
+                    if (failure) failure(xhr, text, error);
+                }, this.businessData.work.id);
+            } else {
+                if (failure) failure(null, "Permission Denied", "");
+            }
         }
     },
 

+ 5 - 0
o2web/source/x_component_process_Xform/lp/zh-cn.js

@@ -18,6 +18,11 @@ MWF.xApplication.process.Xform.LP = {
     "arrivedUsers": "到达处理人",
     "replace": "代",
 
+    "processStarted": "文件已启动",
+    "processStartedMessage": "您启动了一个新的工作:",
+
+    "draftStart": "流程已启动",
+
     "taskCompleted": "待办已处理",
     "workCompleted": "工作流转已完成",
     "arrivedActivity": "工作已到达活动:",