From a8961c1d00c17a5aa2658884df9479ed6fba94c3 Mon Sep 17 00:00:00 2001 From: zhangyanpeng <bob.zhang@highdatas.com> Date: 星期二, 27 八月 2024 12:40:32 +0800 Subject: [PATCH] 调整 --- module/config/page/sys_menu_add.html | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 107 insertions(+), 13 deletions(-) diff --git a/module/config/page/sys_menu_add.html b/module/config/page/sys_menu_add.html index 4b66a50..cca28cc 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: [ { @@ -48,6 +50,7 @@ dataRequestObj: {}, options_menumap: {}, options_menutree: [], + listoptions: [], //鎸夐敭鏉冮檺璁剧疆 isedit: false,//鎻愪氦鍓嶇紪杈戯紝淇濆瓨/鎻愪氦 @@ -63,6 +66,9 @@ pageid: "", // 鏂伴〉闈d parent_menuobj: {}, // 鐖剁骇鑿滃崟 + + isAddMenu: false, // 浠呮坊鍔犱竴涓彍鍗� + treeoptions: [] }, created() { this.popupParames = clone(Root.popupParames); @@ -72,13 +78,42 @@ // } 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.pageid = createCode("M_P"); + 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); } } @@ -126,7 +161,8 @@ var me = this; if(this.popupParames.callback) { let obj = { - options: this.treeoptions, + treeoptions: this.options_menutree, + listoptions: this.listoptions } this.popupParames.callback(obj, function() { me.closeDialog(); @@ -157,8 +193,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 +310,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,16 +340,20 @@ 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) { entity.id = entity_.id + } + else { + entity.id = createCode("M") } let param = { @@ -317,12 +363,36 @@ param.data[this.dataname] = entity; Server.call("root/data/saveEntity", param, function(result) { console.log(result); + if (me.pageid) { + me.onRefreshCacheByPageId(me.pageid); + } + else if (entity.id) { + me.onRefreshCacheByMenuId(entity.id); + } + 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", filter: "page_id is null", } Server.call("root/data/getEntitySet", param_, function(result2){ + me.listoptions = clone(result2.data.entityset); let agm_category_ = ArrayToTree(clone(result2.data.entityset), "title", "parent_id"); me.options_menutree = agm_category_; Root.message({ @@ -335,6 +405,30 @@ }); }, + onRefreshCacheByMenuId(MenuId) { + var me = this; + let param_ = { + menu_id: MenuId + } + Server.call("root/system/reloadOneMenu", param_, function(result) { + if (result.success) { + let param_ = { + dataname: "sys_menu", + filter: "page_id is null", + } + Server.call("root/data/getEntitySet", param_, function(result2){ + me.listoptions = clone(result2.data.entityset); + let agm_category_ = ArrayToTree(clone(result2.data.entityset), "title", "parent_id"); + me.options_menutree = agm_category_; + Root.message({ + type: 'success', + message: '淇濆瓨鎴愬姛' + }); + me.saveAfter(); + }); + } + }); + } } }); -- Gitblit v1.8.0