Quellcode durchsuchen

[数据中心]增加清空自建表数据功能

st vor 5 Jahren
Ursprung
Commit
8c32378d00

BIN
o2web/source/x_component_query_TableDesigner/$Main/default/toolbar/clear.png


BIN
o2web/source/x_component_query_TableDesigner/$Main/default/toolbar/clear_gray.png


+ 8 - 6
o2web/source/x_component_query_TableDesigner/$Main/default/toolbars.html

@@ -8,15 +8,17 @@
 
 
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="run.png" title="编译所有数据表" MWFButtonAction="buildAllView" MWFButtonText=""></span>
-	
+
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formExplode.gif" title="数据导出" MWFButtonAction="tableExplode" MWFButtonText=""></span>
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formImplode.gif" title="数据导入" MWFButtonAction="tableImplode" MWFButtonText=""></span>
 
-    <span MWFnodetype="MWFToolBarSeparator"></span>
-	
+	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="clear.png" title="清空表数据" MWFButtonAction="tableClear" MWFButtonText=""></span>
+
+	<span MWFnodetype="MWFToolBarSeparator"></span>
+
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="tableHelp" MWFButtonText=""></span>
 
-    <span MWFnodetype="MWFToolBarSeparator"></span>
-    <input type="checkbox" value="autoSave" id="MWFDictionaryAutoSaveCheck">自动保存
-	
+	<span MWFnodetype="MWFToolBarSeparator"></span>
+	<input type="checkbox" value="autoSave" id="MWFDictionaryAutoSaveCheck">自动保存
+
 </div>

+ 36 - 33
o2web/source/x_component_query_TableDesigner/Main.js

@@ -1,28 +1,28 @@
 MWF.xDesktop.requireApp("query.ViewDesigner", "", null, false);
 MWF.APPDTBD = MWF.xApplication.query.TableDesigner;
 MWF.APPDTBD.options = {
-	"multitask": true,
-	"executable": false
+    "multitask": true,
+    "executable": false
 };
 MWF.xDesktop.requireApp("query.TableDesigner", "Table", null, false);
 
 MWF.xApplication.query.TableDesigner.Main = new Class({
-	Extends: MWF.xApplication.query.ViewDesigner.Main,
-	Implements: [Options, Events],
-	options: {
-		"style": "default",
-		"name": "query.TableDesigner",
-		"icon": "icon.png",
-		"title": MWF.APPDTBD.LP.title,
-		"appTitle": MWF.APPDTBD.LP.title,
-		"id": "",
+    Extends: MWF.xApplication.query.ViewDesigner.Main,
+    Implements: [Options, Events],
+    options: {
+        "style": "default",
+        "name": "query.TableDesigner",
+        "icon": "icon.png",
+        "title": MWF.APPDTBD.LP.title,
+        "appTitle": MWF.APPDTBD.LP.title,
+        "id": "",
         "tooltip": {
             "unCategory": MWF.APPDTBD.LP.unCategory
         },
-		"actions": null,
-		"category": null,
-		"processData": null
-	},
+        "actions": null,
+        "category": null,
+        "processData": null
+    },
 
     onQueryLoad: function(){
         this.shortcut = true;
@@ -105,19 +105,19 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
             }
         }
     },
-	
-	//loadView------------------------------------------
+
+    //loadView------------------------------------------
     loadView: function(){
-		this.getViewData(this.options.id, function(vdata){
+        this.getViewData(this.options.id, function(vdata){
             this.setTitle(this.options.appTitle + "-"+vdata.name);
             this.taskitem.setText(this.options.appTitle + "-"+vdata.name);
             this.options.appTitle = this.options.appTitle + "-"+vdata.name;
             this.table = new MWF.xApplication.query.TableDesigner.Table(this, vdata);
-			this.table.load();
-		}.bind(this));
-	},
+            this.table.load();
+        }.bind(this));
+    },
 
-	loadNewViewData: function(callback){
+    loadNewViewData: function(callback){
         var url = "../x_component_query_TableDesigner/$Table/table.json";
         MWF.getJSON(url, {
             "onSuccess": function(obj){
@@ -136,11 +136,11 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
                 this.notice(xhr.responseText, "error");
             }.bind(this)
         });
-	},
+    },
     loadViewData: function(id, callback){
-		this.actions.getTable(id, function(json){
-			if (json){
-				var data = json.data;
+        this.actions.getTable(id, function(json){
+            if (json){
+                var data = json.data;
                 data.draftData = JSON.decode(data.draftData);
 
                 if (!this.application){
@@ -151,9 +151,9 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
                 }else{
                     if (callback) callback(data);
                 }
-			}
-		}.bind(this));
-	},
+            }
+        }.bind(this));
+    },
 
     saveView: function(){
         this.view.save(function(){
@@ -165,7 +165,7 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
     },
     statusBuild: function(){
         this.view.statusBuild();
-	},
+    },
     statusDraft: function(){
         this.view.statusDraft();
     },
@@ -178,6 +178,9 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
     tableImplode: function(){
         this.view.tableImplode();
     },
+    tableClear: function(){
+        this.view.tableClear();
+    },
     tableHelp: function(){
         var content = new Element("div", {"styles": {"margin": "20px"}});
         content.set("html", this.lp.tableHelp);
@@ -200,8 +203,8 @@ MWF.xApplication.query.TableDesigner.Main = new Class({
     // dictionaryImplode: function(){
     //     this.view.implode();
     // }
-	//recordStatus: function(){
-	//	return {"id": this.options.id};
-	//},
+    //recordStatus: function(){
+    //	return {"id": this.options.id};
+    //},
 
 });

+ 12 - 1
o2web/source/x_component_query_TableDesigner/Table.js

@@ -474,7 +474,18 @@ MWF.xApplication.query.TableDesigner.Table = new Class({
             this.close();
         }, null);
     },
-
+    tableClear: function(e){
+        var _self = this;
+        if (!e) e = this.node;
+        this.designer.confirm("warn", e, MWF.APPDTBD.LP.tableClearTitle, MWF.APPDTBD.LP.tableClearInfo, 480, 120, function(){
+            _self.designer.actions.deleteAllRow(_self.data.id,function(json){
+                this.designer.notice(this.designer.lp.tableClear_success, "success", this.node, {"x": "left", "y": "bottom"});
+            }.bind(_self));
+            this.close();
+        }, function(){
+            this.close();
+        }, null);
+    },
     tableImplode: function(e){
         var _self = this;
         if (!e) e = this.node;

+ 4 - 0
o2web/source/x_component_query_TableDesigner/lp/zh-cn.js

@@ -65,6 +65,10 @@ MWF.xApplication.query.TableDesigner.LP = {
     "tableImplodeInfo": "导入的数据会覆盖。确认是否导入?",
     "tableImplode_success": "导入成功",
 
+    "tableClearTitle": "清空数据",
+    "tableClearInfo": "清空的数据不能恢复!!确认是否清空?",
+    "tableClear_success": "清空成功",
+
 
     "buildAllViewInfor": "即将编译所有数据表,包括所有数据应用中的数据表,编译后您可能需要重启服务器后才能使用此数据表。您确定要执行此操作吗?",
     "buildAllView_success": "已编译所有数据表,新的更改需要您重启服务器后生效",