From 9253a1b75603488a1a50b4198170e20051ea5ae2 Mon Sep 17 00:00:00 2001
From: zhangyanpeng <bob.zhang@highdatas.com>
Date: 星期日, 25 八月 2024 20:18:15 +0800
Subject: [PATCH] 调整

---
 module/config/page/sys_menu_add.html |   85 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/module/config/page/sys_menu_add.html b/module/config/page/sys_menu_add.html
index 4b66a50..62289c6 100644
--- a/module/config/page/sys_menu_add.html
+++ b/module/config/page/sys_menu_add.html
@@ -32,7 +32,9 @@
 							//id: uuid_short(),
 							// code: createCode("BA"),
 						},
-						formData: {},
+						formData: {
+							title: "",
+						},
 						
 						dataRequest: [
 							{
@@ -63,6 +65,9 @@
 						
 						pageid: "", // 鏂伴〉闈d
 						parent_menuobj: {}, // 鐖剁骇鑿滃崟
+						
+						isAddMenu: false, // 浠呮坊鍔犱竴涓彍鍗�
+						treeoptions: []
 					},
 					created() {
 						this.popupParames = clone(Root.popupParames);
@@ -72,13 +77,41 @@
 						// }
 
 						if (this.popupParames.data) {
-							this.parent_menuobj = this.popupParames.data;
 							if (this.popupParames.sceneCode) {
-								if (this.popupParames.sceneCode == 'add') {
-									this.pageid = createCode("R_");
+								if (this.popupParames.sceneCode == 'addmenu') {
+									this.isAddMenu = true;
+									this.parent_menuobj = this.popupParames.data;
+									if (this.parent_menuobj && this.parent_menuobj.id) {
+										this.formData.parent_id = this.parent_menuobj.id
+									}
+								}
+								else if (this.popupParames.sceneCode == 'add') {
+									this.parent_menuobj = this.popupParames.data;
+									this.pageid = createCode("M_P");
 									this.formData.parent_id = this.popupParames.data.id;
-								} else if (this.popupParames.sceneCode == 'edit') {
+								} 
+								else if (this.popupParames.sceneCode == 'edit') {
 									this.pageid = this.popupParames.data.page_id;
+									
+									this.parent_menuobj = {
+										id: this.popupParames.data.parent_id,
+										type_code: this.popupParames.data.type_code
+									};
+									if (this.popupParames.data.url &&  this.popupParames.data.url.indexOf("viewlet=") > 0) {
+										var url_ = this.popupParames.data.url.split("viewlet=")
+										var url_parame_ = url_[1].split("&")
+										
+										if (url_parame_[1] && url_parame_[1] == "op=write") {
+											this.popupParames.data.reporttype = "write"
+										}
+										else if (url_parame_[1] && url_parame_[1] == "op=view") {
+											this.popupParames.data.reporttype = "view"
+										}
+										else {
+											this.popupParames.data.reporttype = ""
+										}
+										this.popupParames.data.url = url_parame_[0]
+									}
 									this.formData = clone(this.popupParames.data);
 								}
 							}
@@ -157,8 +190,13 @@
 										}
 										formFields_.push(clone(f));
 									})
-									var page_url = {isshow: "T", field: "url", name: "璺緞", type: "input", required: true}
-									formFields_.push(clone(page_url));
+									// if (!me.isAddMenu) {
+									// 	var page_url = {isshow: "T", field: "url", name: "璺緞", type: "input", required: true, placeholder: "濡傦細patch_report/DMS_index_mysql.frm", appendix: "鎶ヨ〃涓殑鍙傛暟鍖呭惈actor锛堣鑹茬被鍨婳rg/Business/Sales/Customer/Admin锛夈�乼arget_id锛堥攢鍞矖浣岻D/DMS寮�鎴稩D锛夈�乧ompany_id銆乥u_id", isvalexplain_br: true}
+									// 	var page_reporttype = {isshow: "T", field: "reporttype", name: "绫诲瀷", type: "radio", options: [{code: "", value: "棰勮"}, {code: "write", value: "濉姤"},{code: "view", value: "鍒嗘瀽"}]}
+									// 	formFields_.push(clone(page_url));
+									// 	formFields_.push(clone(page_reporttype));
+									// }
+									
 									if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
 										me.formFields = clone(formFields_);
 										
@@ -269,11 +307,12 @@
 							var me = this;
 							if (this.pageid) {
 								var entity_ = clone(this.formData);
+								
 								var entity = {
 									id: this.pageid,
 									code: this.pageid,
 									title: entity_.title,
-									url: "module/report/page/report_iframe.html?viewlet=" + entity_.url,
+									url: entity_.url ? entity_.url : "module/model/model_iframe.html",
 									is_active: "T"
 								};
 								
@@ -298,12 +337,13 @@
 							var me = this;
 							var entity_ = clone(this.formData);
 							var entity = {
-								parent_id: this.parent_menuobj.id,
-								type_code: this.parent_menuobj.type_code,
-								page_id: this.pageid,
+								parent_id: this.parent_menuobj.id || null,
+								type_code: this.parent_menuobj.type_code || "Z",
+								open_type: "arrange",
+								page_id: this.pageid || null,
 								title: entity_.title,
 								icon: entity_.icon,
-								order_no: this.parent_menuobj.children.length + 1,
+								order_no: entity_.order_no ? entity_.order_no : (this.parent_menuobj.children ? this.parent_menuobj.children.length + 1 : 1),
 							};
 							
 							if (entity_.id) {
@@ -317,6 +357,26 @@
 							param.data[this.dataname] = entity;
 							Server.call("root/data/saveEntity", param, function(result) {
 								console.log(result);
+								if (me.pageid) {
+									me.onRefreshCacheByPageId(me.pageid);
+								}
+								else {
+									Root.message({
+										type: 'success',
+										message: '淇濆瓨鎴愬姛'
+									}); 
+									me.saveAfter();
+								}
+							});
+						},
+						
+						// 鍒锋柊缂撳瓨
+						onRefreshCacheByPageId(PageId) {
+							var me = this;
+							let param_ = {
+								page_id: PageId
+							}
+							Server.call("root/system/reloadMenuByPage", param_, function(result) {
 								if (result.success) {
 									let param_ = {
 										dataname: "sys_menu",
@@ -334,7 +394,6 @@
 								}
 							});
 						},
-						
 						
 					}
 				});

--
Gitblit v1.8.0