Przeglądaj źródła

[流程表单]增加表单版本恢复功能

st 5 lat temu
rodzic
commit
305020577b

+ 3 - 1
o2web/source/x_component_process_FormDesigner/$Main/default/formToolbars.html

@@ -17,7 +17,9 @@
 	</span>
 
 	<span MWFnodetype="MWFToolBarSeparator"></span>
-	
+	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="resume.png" title="查看所有表单版本" MWFButtonAction="showFormVersion" MWFButtonText=""></span>
+	<span MWFnodetype="MWFToolBarSeparator"></span>
+
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="formHelp" MWFButtonText=""></span>
 
     <span MWFnodetype="MWFToolBarSeparator"></span>

BIN
o2web/source/x_component_process_FormDesigner/$Main/default/formtoolbar/resume.png


+ 3 - 0
o2web/source/x_component_process_FormDesigner/Main.js

@@ -1603,6 +1603,9 @@ MWF.xApplication.process.FormDesigner.Main = new Class({
 	recordStatus: function(){
 		return {"id": this.options.id};
 	},
+    showFormVersion: function(){
+        this.form.showFormVersion();
+    },
     onPostClose: function(){
         if (this.pcForm){
             MWF.release(this.pcForm.moduleList);

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

@@ -994,6 +994,82 @@ MWF.xApplication.process.FormDesigner.Module.Form = MWF.FCForm = new Class({
             MWF.FormImport.create("office", this);
         }.bind(this));
     },
+	showFormVersion: function(){
+		this.versionNode = new Element("div");
+		this.dlg = o2.DL.open({
+			"title": MWF.APPFD.LP.version["title"],
+			"content": this.versionNode,
+			"offset": {"y": -100},
+			"isMax": false,
+			"width": 500,
+			"height": 300,
+			"buttonList": [
+				{
+					"type": "cancel",
+					"text": MWF.APPFD.LP.version["close"],
+					"action": function(){ this.close(); }
+				}
+			],
+			"onPostShow": function(){
+				this.loadVersionList();
+			}.bind(this),
+			"onPostClose": function(){
+				this.dlg = null;
+			}.bind(this)
+		});
+	},
+	loadVersionList : function(){
+		var tableHtml = "<table width='100%' cellspacing='0' cellpadding='3' style='margin-top: 1px'><tr>" +
+			"<th>"+MWF.APPFD.LP.version["no"]+"</th>" +
+			"<th>"+MWF.APPFD.LP.version["updateTime"]+"</th>" +
+			"<th>"+MWF.APPFD.LP.version["op"]+"</th>" +
+			"</tr></table>";
+		this.versionNode.set("html", tableHtml);
+		this.versionTable = this.versionNode.getElement("table");
+		this.action = o2.Actions.load("x_processplatform_assemble_designer");
+		this.action.FormVersionAction.listWithForm(this.form.json.id, function(json){
+			this.versionList = json.data;
+			this.versionList.each(function (version,index) {
+				var node = new Element("tr").inject(this.versionTable);
+				var html = "<td>"+(index+1)+"</td>" +
+					"<td>"+version.updateTime+"</td>" +
+					"<td></td>";
+				node.set("html", html);
+				var actionNode = new Element("div",{"styles":{
+						"width": "30px",
+						"padding": "0px 3px",
+						"border-radius": "20px",
+						"cursor" : "pointer",
+						"color": "#ffffff",
+						"background-color": "#4A90E2",
+						"float": "left",
+						"margin-right": "2px",
+						"text-align": "center",
+						"font-weight": "100"
+					}}).inject(node.getLast("td"));
+				actionNode.set("text", MWF.APPFD.LP.version["resume"]);
+				actionNode.addEvent("click",function (e) {
+					var _self = this;
+					this.designer.confirm("warn", e,  MWF.APPFD.LP.version["resumeConfirm"], MWF.APPFD.LP.version["resumeInfo"], 460, 120, function(){
+						_self.resumeForm(version);
+						this.close();
+					}, function(){
+						this.close();
+					});
+				}.bind(this));
+			}.bind(this))
+		}.bind(this));
+	},
+	resumeForm : function(version){
+		this.action.FormVersionAction.get(version.id, function( json ){
+			var formData = JSON.parse(json.data.data);
+			this.action.FormAction.update(version.form, formData,function( json ){
+				this.designer.notice(MWF.APPFD.LP.version["resumeSuccess"]);
+				this.reload(JSON.decode(MWF.decodeJsonString(formData.data)));
+				this.dlg.close();
+			}.bind(this), null, false);
+		}.bind(this), null, false);
+	},
 	deletePropertiesOrStyles: function(name, key){
 		if (name=="styles"){
 			try{

+ 11 - 1
o2web/source/x_component_process_FormDesigner/lp/zh-cn.js

@@ -12,7 +12,17 @@ MWF.xApplication.process.FormDesigner.LP = {
 			"ok": "确定",
 			"cancel": "取消"
 		},
-		
+        "version" : {
+            "title" : "查看表单版本记录",
+            "close" : "关闭",
+            "no":"序号",
+            "updateTime":"更新时间",
+            "op":"操作",
+            "resume" : "恢复",
+            "resumeConfirm" : "恢复确认",
+            "resumeInfo" : "您确认是否需要执行表单恢复操作?",
+            "resumeSuccess" :"恢复成功"
+        },
 		"notice": {
 			"save_success": "表单保存成功!",
             "saveTemplate_success": "表单模板保存成功!",