NGToolsAdmin/unpackage/dist/build/web/static/js/pages-system-menu-list.deaa443b.js

1 line
32 KiB
JavaScript
Raw Permalink Normal View History

2024-09-13 08:39:31 +00:00
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-system-menu-list"],{"1dc6":function(e,t,n){"use strict";(function(e){n("6a54");var i=n("f5bd").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i(n("2634")),s=i(n("9b1b")),o=i(n("2fdc")),r=i(n("b7c7"));n("bf0f"),n("2797"),n("de6c"),n("aa9c"),n("aa77"),n("fd3c"),n("a578"),n("c223"),n("d4b5");var u=n("6a33"),c=i(n("f37f")),d=e.database(),l=[];function p(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.forEach((function(i){i.menu_id===t&&i.parent_id&&(n=n+1+p(e,i.parent_id,n))})),n}var m={data:function(){return{query:"",where:"",orderby:"create_date asc",options:{pageSize:2e4,pageCurrent:1},selectedIndexs:[],loading:!0,menus:[],errMsg:"",currentTab:"menus",selectedPluginMenuIndexs:[]}},computed:{pluginMenus:function(){var e=[];if(!this.$hasRole("admin"))return e;var t=this.menus;return t.length?(l.forEach((function(n){t.find((function(e){return e.menu_id===n.menu_id}))||e.push(n)})),e):e}},watch:{pluginMenus:function(e){e.length||(this.currentTab="menus")}},methods:{enableChange:function(e){e.enable=!e.enable,d.collection("opendb-admin-menus").doc(e._id).update({enable:e.enable})},getSortMenu:function(e){return e.map((function(t){e.some((function(e){return e.parent_id===t.menu_id}))||(t.isLeafNode=!0)})),(0,u.buildMenus)(e)},onqueryload:function(e){for(var t=0;t<e.length;t++){var n=e[t],i=p(e,n.menu_id);n.name=(i?" ".repeat(i)+"|-":"")+n.name}var a=this.getSortMenu(e),s=[];this.patTree(a,s),e.length=0,e.push.apply(e,s),this.menus=e},patTree:function(e,t){var n=this;return e.forEach((function(e){t.push(e),e.children.length&&n.patTree(e.children,t)})),t},switchTab:function(e){this.currentTab=e},loadData:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.$refs.udb.loadData({clear:e})},navigateTo:function(e,t){var n=this;uni.navigateTo({url:e,events:{refreshData:function(){n.loadData(t)}}})},confirmDelete:function(e){var t=this,n=e._id,i="是否删除该菜单?",a=function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t.find((function(e){return e.parent_id===n}))&&t.forEach((function(a){a.parent_id===n&&(i.push(a._id),e(t,a.menu_id,i))})),i}(this.menus,e.menu_id);a.length&&(i="是否删除该菜单及其子菜单?"),n=[n].concat((0,r.default)(a)),uni.showModal({title:"提示",content:i,success:function(e){e.confirm&&t.$refs.udb.remove(n,{needConfirm:!1})}})},pluginMenuSelectChange:function(e){this.selectedPluginMenuIndexs=e.detail.index},addPluginMenus:function(t){var n=this;if(!this.selectedPluginMenuIndexs.length)return uni.showModal({title:"提示",content:"请选择要添加的菜单!",showCancel:!1});var i=this.pluginMenus,a=[];this.selectedPluginMenuIndexs.forEach((function(e){var t=i[e];if(t){var n=JSON.parse(JSON.stringify(t));n.enable=!0,delete n.json,a.push(n)}})),uni.showModal({title:"提示",content:"您确认要添加已选中的菜单吗?",success:function(t){if(t.confirm){uni.showLoading({mask:!0});var s=a.length===i.length;e.database().collection("opendb-admin-menus").add(a).then((function(e){uni.showModal({title:"提示",content:"添加菜单成功!",showCancel:!1,success:function(){n.$refs.pluginMenusTable.clearSelection(),s&&(n.currentTab="menus"),n.loadData()}})})).catch((function(e){uni.showModal({title:"提示",content:e.message,showCancel:!1})})).finally((function(){uni.hideLoading()}))}}})},updateBuiltInMenu:function(){return(0,o.default)((0,a.default)().mark((function t(){return(0,a.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:uni.showModal({title:"提示",content:"确定更新内置菜单吗?\n该操作不会影响现有的菜单",success:function(){var t=(0,o.default)((0,a.default)().mark((function t(n){var i,o,r,u,d,l,p;return(0,a.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!n.confirm){t.next=29;break}return i=e.database(),o=i.command,r=c.default.map((function(e,t){return e.menu_id})),uni.showLoading({title:"更新中...",mask:!0}),t.prev=5,u=[],t.nex