|
|
@@ -143,66 +143,142 @@ MWF.xApplication.process.Work.Main = new Class({
|
|
|
},
|
|
|
loadWorkByWork: function(id){
|
|
|
//var getWorkLogMothed = "getWorkLog"; //以前使用worklog,现在改成record了
|
|
|
- var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
|
|
|
+ //var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
|
|
|
+
|
|
|
+ var loadFormFlag = false;
|
|
|
+ var loadWorkFlag = false;
|
|
|
+
|
|
|
+ var json_work, json_log, json_control, json_form;
|
|
|
+
|
|
|
+ var check = function(){
|
|
|
+ if (loadWorkFlag && loadFormFlag){
|
|
|
+ if (json_work && json_control && json_form && json_log){
|
|
|
+ this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_work.data.recordList, json_work.data.attachmentList);
|
|
|
+ if (this.mask) this.mask.hide();
|
|
|
+ //if (layout.mobile) this.loadMobileActions();
|
|
|
+ this.openWork();
|
|
|
+ this.unLoading();
|
|
|
+ } else{
|
|
|
+ if (this.options.jobId || this.options.jobid || this.options.job){
|
|
|
+ delete this.options.workCompletedId;
|
|
|
+ delete this.options.workId;
|
|
|
+ delete this.options.workid;
|
|
|
+ delete this.options.workcompletedid;
|
|
|
+ this.loadWork();
|
|
|
+ }else{
|
|
|
+ this.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.bind(this);
|
|
|
+
|
|
|
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": "loadWorkV2"},
|
|
|
{"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();
|
|
|
- //if (layout.mobile) this.loadMobileActions();
|
|
|
- this.openWork();
|
|
|
- this.unLoading();
|
|
|
- } else{
|
|
|
- if (this.options.jobId || this.options.jobid || this.options.job){
|
|
|
- delete this.options.workCompletedId;
|
|
|
- delete this.options.workId;
|
|
|
- delete this.options.workid;
|
|
|
- delete this.options.workcompletedid;
|
|
|
- this.loadWork();
|
|
|
- }else{
|
|
|
- this.close();
|
|
|
- }
|
|
|
- }
|
|
|
+ {"action": this.action, "name": "getWorkControl"},
|
|
|
+ {"action": this.action, "name": "getForm"}
|
|
|
+ ], {"success": function(jsonWork, jsonLog, jsonControl, jsonForm){
|
|
|
+ json_work = jsonWork;
|
|
|
+ json_log = jsonLog;
|
|
|
+ json_control = jsonControl;
|
|
|
+ json_form = jsonForm;
|
|
|
+ loadWorkFlag = true;
|
|
|
+ loadFormFlag = true;
|
|
|
+ check();
|
|
|
}.bind(this), "failure": function(){
|
|
|
//this.close();
|
|
|
- }.bind(this)}, [this.options.form.id, this.options.form.app], id);
|
|
|
+ }.bind(this)}, id, id, id, [this.options.form.id, this.options.form.app]);
|
|
|
}else{
|
|
|
+ this.action.lookupFormWithWork(id, function(json){
|
|
|
+ var formId = json.data.id;
|
|
|
+ this.action[((layout.mobile) ? "getFormV2Mobile": "getFormV2")](formId, function(formJson){
|
|
|
+ json_form = formJson;
|
|
|
+ loadFormFlag = true;
|
|
|
+ check();
|
|
|
+ }, function(){
|
|
|
+ loadFormFlag = true;
|
|
|
+ check();
|
|
|
+ });
|
|
|
+ }.bind(this), function(){
|
|
|
+ loadFormFlag = true;
|
|
|
+ check();
|
|
|
+ });
|
|
|
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();
|
|
|
- //if (layout.mobile) this.loadMobileActions();
|
|
|
- this.openWork();
|
|
|
- this.unLoading();
|
|
|
- } else{
|
|
|
- if (this.options.jobId || this.options.jobid || this.options.job){
|
|
|
- delete this.options.workCompletedId;
|
|
|
- delete this.options.workId;
|
|
|
- delete this.options.workid;
|
|
|
- delete this.options.workcompletedid;
|
|
|
- this.loadWork();
|
|
|
- }else{
|
|
|
- this.close();
|
|
|
- }
|
|
|
- }
|
|
|
- }.bind(this), "failure": function(){
|
|
|
- //this.close();
|
|
|
- }.bind(this)}, id);
|
|
|
+ {"action": this.action, "name": "loadWorkV2"},
|
|
|
+ {"action": this.action, "name": "getWorkLog"},
|
|
|
+ {"action": this.action, "name": "getWorkControl"}
|
|
|
+ ], {"success": function(jsonWork, jsonLog, jsonControl){
|
|
|
+ json_work = jsonWork;
|
|
|
+ json_log = jsonLog;
|
|
|
+ json_control = jsonControl;
|
|
|
+ loadWorkFlag = true;
|
|
|
+ check();
|
|
|
+ }.bind(this), "failure": function(){
|
|
|
+ //this.close();
|
|
|
+ }.bind(this)}, id
|
|
|
+ );
|
|
|
}
|
|
|
+
|
|
|
+ // if (this.options.form && this.options.form.id && this.options.form.app){
|
|
|
+ // o2.Actions.invokeAsync([
|
|
|
+ // {"action": this.action, "name": "loadWork"},
|
|
|
+ // {"action": this.action, "name": "getWorkLog"},
|
|
|
+ // {"action": this.action, "name": "getRecordLog"},
|
|
|
+ // {"action": this.action, "name": "getWorkControl"},
|
|
|
+ // {"action": this.action, "name": "listAttachments"},
|
|
|
+ // {"action": this.action, "name": "getForm"}
|
|
|
+ // ], {"success": function(json_work, json_log, json_record, json_control, json_att, json_form){
|
|
|
+ // 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();
|
|
|
+ // //if (layout.mobile) this.loadMobileActions();
|
|
|
+ // this.openWork();
|
|
|
+ // this.unLoading();
|
|
|
+ // } else{
|
|
|
+ // if (this.options.jobId || this.options.jobid || this.options.job){
|
|
|
+ // delete this.options.workCompletedId;
|
|
|
+ // delete this.options.workId;
|
|
|
+ // delete this.options.workid;
|
|
|
+ // delete this.options.workcompletedid;
|
|
|
+ // this.loadWork();
|
|
|
+ // }else{
|
|
|
+ // this.close();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }.bind(this), "failure": function(){
|
|
|
+ // //this.close();
|
|
|
+ // }.bind(this)}, id, id, id, id, id, [this.options.form.id, this.options.form.app]);
|
|
|
+ // }else{
|
|
|
+ // o2.Actions.invokeAsync([
|
|
|
+ // {"action": this.action, "name": "loadWork"},
|
|
|
+ // {"action": this.action, "name": "getWorkLog"},
|
|
|
+ // {"action": this.action, "name": "getRecordLog"},
|
|
|
+ // {"action": this.action, "name": "getWorkControl"},
|
|
|
+ // {"action": this.action, "name": "listAttachments"},
|
|
|
+ // {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm"}
|
|
|
+ // ], {"success": function(json_work, json_log, json_record, json_control, json_att, json_form){
|
|
|
+ // 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();
|
|
|
+ // //if (layout.mobile) this.loadMobileActions();
|
|
|
+ // this.openWork();
|
|
|
+ // this.unLoading();
|
|
|
+ // } else{
|
|
|
+ // if (this.options.jobId || this.options.jobid || this.options.job){
|
|
|
+ // delete this.options.workCompletedId;
|
|
|
+ // delete this.options.workId;
|
|
|
+ // delete this.options.workid;
|
|
|
+ // delete this.options.workcompletedid;
|
|
|
+ // this.loadWork();
|
|
|
+ // }else{
|
|
|
+ // this.close();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }.bind(this), "failure": function(){
|
|
|
+ // //this.close();
|
|
|
+ // }.bind(this)}, id);
|
|
|
+ //}
|
|
|
},
|
|
|
loadWorkByJob: function(jobId){
|
|
|
MWF.Actions.get("x_processplatform_assemble_surface").listWorkByJob(jobId, function(json){
|