Эх сурвалжийг харах

新增启动模式:“草稿模式”

huqi 5 жил өмнө
parent
commit
6a75fab390

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

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

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

@@ -113,8 +113,8 @@
   "listDraftPrev": {"uri": "/jaxrs/draft/list/{id}/prev/{count}"},
   "listDraftPrev": {"uri": "/jaxrs/draft/list/{id}/prev/{count}"},
   "listDraftPage": {"uri": "/jaxrs/draft/list/my/paging/{page}/size/{size}", "method": "POST"},
   "listDraftPage": {"uri": "/jaxrs/draft/list/my/paging/{page}/size/{size}", "method": "POST"},
   "listDraftApplication": {"uri": "/jaxrs/draft/list/count/application"},
   "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}"},
   "getTask": {"uri": "/jaxrs/task/{id}"},
   "saveTask": {"uri": "/jaxrs/task/{id}", "method": "POST"},
   "saveTask": {"uri": "/jaxrs/task/{id}", "method": "POST"},

+ 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){
 o2.DL.open = function(options){
+    debugger;
     if (!options) options = {};
     if (!options) options = {};
     if (!options.style) options.style = "user";
     if (!options.style) options.style = "user";
     //if (!options.transition) options.transition = Fx.Transitions.Back.easeOut;
     //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;
     if (options.isClose!==false) options.isClose = true;
 
 
     var size;
     var size;
-    if (!options.width && !options.contentWidth){
+    if ((!options.width || options.width=="auto") && !options.contentWidth){
         if (options.content){
         if (options.content){
             options.content.show();
             options.content.show();
             size = options.content.getComputedSize();
             size = options.content.getComputedSize();
             options.contentWidth = size.totalWidth.toFloat();
             options.contentWidth = size.totalWidth.toFloat();
         }
         }
     }
     }
-    if (!options.height && !options.contentHeight){
+    if ((!options.height || options.height=="auto") && !options.contentHeight){
         if (options.content){
         if (options.content){
             if (!size){
             if (!size){
                 options.content.show();
                 options.content.show();

+ 1 - 1
o2web/source/x_component_process_TaskCenter/DraftList.js

@@ -23,7 +23,7 @@ MWF.xApplication.process.TaskCenter.DraftList = new Class({
         this.initData();
         this.initData();
         this.filterData = null;
         this.filterData = null;
         if (this.applicationFilterAreaNode) this.applicationFilterAreaNode.empty();
         if (this.applicationFilterAreaNode) this.applicationFilterAreaNode.empty();
-        //this.createAppFilterNodes();
+        this.createAppFilterNodes();
         this.listAreaNode.empty();
         this.listAreaNode.empty();
         this.resetListAreaHeight();
         this.resetListAreaHeight();
         this.app.getWorkCounts();
         this.app.getWorkCounts();

+ 6 - 6
o2web/source/x_component_process_TaskCenter/Main.js

@@ -1065,12 +1065,12 @@ MWF.xApplication.process.TaskCenter.Process = new Class({
         var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false};
         var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false};
         this.app.desktop.openApplication(null, "process.Work", options);
         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);
+        // 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){
     startProcessInstance: function(data, title, processName){
         var workInfors = [];
         var workInfors = [];

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

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

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

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

+ 6 - 4
o2web/source/x_component_process_Work/Main.js

@@ -240,7 +240,7 @@ MWF.xApplication.process.Work.Main = new Class({
                     "allowVisit": true,
                     "allowVisit": true,
                     "allowProcessing": true,
                     "allowProcessing": true,
                     "allowSave": true,
                     "allowSave": true,
-                    "allowDelete": false
+                    "allowDelete": true
                 };
                 };
 
 
                 this.parseData(workData, control, json_form.data, [], [], []);
                 this.parseData(workData, control, json_form.data, [], [], []);
@@ -349,9 +349,11 @@ MWF.xApplication.process.Work.Main = new Class({
         //this.inheritedAttachmentList = data.inheritedAttachmentList;
         //this.inheritedAttachmentList = data.inheritedAttachmentList;
 
 
         this.control = controlData;
         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(){
     // loadWork2: function(){

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

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

+ 12 - 0
o2web/source/x_component_process_Xform/Actionbar.js

@@ -128,6 +128,18 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar =  new Class({
         //         flag = false;
         //         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 (tool.id == "action_rollback") tool.read = true;
         if (readonly) if (!tool.read) flag = false;
         if (readonly) if (!tool.read) flag = false;
         if (flag){
         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 () {
     _loadUserInterface: function () {
         this.node.empty();
         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 () {
     loadAttachmentController: function () {
         //MWF.require("MWF.widget.AttachmentController", function() {
         //MWF.require("MWF.widget.AttachmentController", function() {
@@ -1103,7 +1105,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
 
 
     },
     },
     getData: function () {
     getData: function () {
-        return this.attachmentController.getAttachmentNames();
+        return (this.attachmentController) ? this.attachmentController.getAttachmentNames() : null;
     },
     },
     createUploadFileNode: function () {
     createUploadFileNode: function () {
         var accept = "*";
         var accept = "*";

+ 278 - 110
o2web/source/x_component_process_Xform/Form.js

@@ -1608,82 +1608,160 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         var dlg = o2.DL.open(options);
         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 () {
     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 () {
     processWork_mobile: function () {
@@ -3176,28 +3254,29 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
         }
     },
     },
 
 
-    deleteWork: function () {
+    deleteDraftWork: function(){
         var _self = this;
         var _self = this;
         if (this.json.mode === "Mobile") {
         if (this.json.mode === "Mobile") {
             if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
             if (window.confirm(MWF.xApplication.process.Xform.LP.deleteWorkText.text)) {
                 MWF.require("MWF.widget.Mask", function () {
                 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.mask.loadNode(_self.app.content);
 
 
-                    _self.fireEvent("beforeDelete");
-                    if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
-
                     _self.doDeleteWork(function () {
                     _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.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()
                         _self.finishOnMobile()
                     }.bind(this), function (xhr, text, error) {
                     }.bind(this), function (xhr, text, error) {
                         var errorText = error + ":" + text;
                         var errorText = error + ":" + text;
                         if (xhr) errorText = xhr.responseText;
                         if (xhr) errorText = xhr.responseText;
                         _self.app.notice("request json error: " + errorText, "error", dlg.node);
                         _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));
                 }.bind(this));
                 }.bind(this));
             }
             }
@@ -3212,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 () {
             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 () {
                 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.mask.loadNode(_self.app.content);
 
 
-                    _self.fireEvent("beforeDelete");
-                    if (_self.app && _self.app.fireEvent) _self.app.fireEvent("beforeDelete");
-
                     _self.doDeleteWork(function () {
                     _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.notice(MWF.xApplication.process.Xform.LP.workDelete + ": “" + _self.businessData.work.title + "”", "success");
                         _self.app.close();
                         _self.app.close();
                         this.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) {
                     }.bind(this), function (xhr, text, error) {
                         var errorText = error + ":" + text;
                         var errorText = error + ":" + text;
                         if (xhr) errorText = xhr.responseText;
                         if (xhr) errorText = xhr.responseText;
                         _self.app.notice("request json error: " + errorText, "error", dlg.node);
                         _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));
                 }.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 () {
             }, function () {
                 this.close();
                 this.close();
             }, null, this.app.content, this.json.confirmStyle);
             }, 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) {
     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": "到达处理人",
     "arrivedUsers": "到达处理人",
     "replace": "代",
     "replace": "代",
 
 
+    "processStarted": "文件已启动",
+    "processStartedMessage": "您启动了一个新的工作:",
+
+    "draftStart": "流程已启动",
+
     "taskCompleted": "待办已处理",
     "taskCompleted": "待办已处理",
     "workCompleted": "工作流转已完成",
     "workCompleted": "工作流转已完成",
     "arrivedActivity": "工作已到达活动:",
     "arrivedActivity": "工作已到达活动:",