1 |
- webpackJsonp([22],{"W+29":function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=i("YLOf"),s=i("lbyi"),n={name:"menuManage",mixins:[s.a],props:["subId","acIdx"],components:{noData:a.a},data:function(){return{loading:!1,sortFlag:!1,dialogTableVisible:!1,dialogTitleName:"添加菜单",menuName:"",routeName:"",menuid:""}},created:function(){},methods:{openDialog:function(t,e){this.dialogTitleName="edit"==t?"编辑菜单":"添加菜单",this.dialogTableVisible=!0,e?(this.menuName=e.title,this.routeName=e.route,this.menuid=e.id):(this.menuName="",this.routeName="",this.menuid="")},init:function(){var t=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.menu_list,{params:{parent_id:this.subId,view_type:this.acIdx}}).then(function(e){(e=e.data)&&0==e.errno?t.tableData=e.rst:4002!=e.errno&&t.$message({message:e.err,type:"warning"}),t.loading=!1}).catch(function(e){t.loading=!1,t.$message({message:e,type:"warning"})})},sortClick:function(){var t=this,e=[];this.tableData.forEach(function(t){e.push(t.id)}),this.$axios.post(this.URL.BASEURL+this.URL.menu_sort,{parent_id:this.subId,p_id:e,view_type:this.acIdx}).then(function(e){(e=e.data)&&0==e.errno&&(t.sortFlag=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})})},add_level2:function(){var t=this;return this.subId?""==this.menuName||""==this.routeName?(this.$message({message:"以上均为必填项",type:"warning"}),!1):void this.$axios.post(this.URL.BASEURL+this.URL.add_menu_l2,{parent_id:this.subId,title:this.menuName,route:this.routeName,view_type:this.acIdx}).then(function(e){(e=e.data)&&0==e.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})}):(this.$message({message:"父级id获取不到",type:"warning"}),!1)},edit_level2:function(){var t=this;return""==this.menuid?(this.$message({message:"id获取不到",type:"warning"}),!1):""==this.menuName||""==this.routeName?(this.$message({message:"以上均为必填项",type:"warning"}),!1):void this.$axios.get(this.URL.BASEURL+this.URL.edit_menu_l2,{params:{id:this.menuid,title:this.menuName,route:this.routeName,view_type:this.acIdx}}).then(function(e){(e=e.data)&&0==e.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})})},dele_menu:function(t){var e=this;if(""==t)return this.$message({message:"权限id未得到",type:"warning"}),!1;this.$confirm("是否删除此菜单","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){e.$axios.post(e.URL.BASEURL+e.URL.menu_dele,{id:t,view_type:e.acIdx}).then(function(t){(t=t.data)&&0==t.errno&&e.init(),e.$message({message:t.err,type:"warning"})}).catch(function(t){e.$message({message:t,type:"warning"})})}).catch(function(){})}}},o={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"con"},[i("div",[1==t.$cookie.getCookie("isSuperManage")?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.openDialog("add")}}},[t._v("添加二级菜单")]):t._e(),t._v(" "),!t.sortFlag&&t.tableData&&t.tableData.length>1?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.sortFlag=!0}}},[t._v("二级菜单排序")]):t._e(),t._v(" "),t.sortFlag&&t.tableData&&t.tableData.length>1?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.sortClick()}}},[t._v("确定排序")]):t._e(),t._v(" "),t.sortFlag?i("span",{staticClass:"f12 c-FF604D"},[t._v("*排序完成后,请点确定排序,否则排序不生效。")]):t._e()],1),t._v(" "),i("table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"tableCon tableCon_sub"},[t._m(0),t._v(" "),t.tableData&&t.tableData.length>0?[i("tbody",{staticClass:"bodyCon"},t._l(t.tableData,function(e,a){return i("tr",{key:e.id},[i("td",[t._v(t._s(e.id))]),t._v(" "),i("td",[t._v("\n "+t._s(e.title)+"\n "),t.sortFlag?[i("span",{staticClass:"f12 pointer c-448AFF",style:0==a?"color:#999;cursor:not-allowed":"",on:{click:function(e){return t.upClick(a)}}},[t._v("上移")]),t._v(" "),i("span",{staticClass:"f12 pointer c-448AFF",style:a==t.tableData.length-1?"color:#999;cursor:not-allowed":"",on:{click:function(e){return t.downClick(a)}}},[t._v("下移")])]:t._e()],2),t._v(" "),i("td",[t._v(t._s(e.route))]),t._v(" "),i("td",[i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(i){return t.openDialog("edit",e)}}},[t._v("修改")]),t._v(" "),i("el-button",{attrs:{size:"mini"},on:{click:function(i){return t.dele_menu(e.id)}}},[t._v("删除")])],1)])}),0)]:t._e()],2),t._v(" "),t.tableData&&0==t.tableData.length?i("noData"):t._e(),t._v(" "),i("el-dialog",{staticClass:"dialogCon_permission",attrs:{title:t.dialogTitleName,visible:t.dialogTableVisible,"append-to-body":!0,width:"500px"},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[i("div",{staticClass:"dialogCon"},[i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("二级菜单名称:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{attrs:{size:"small",placeholder:"请输入二级菜单名称"},model:{value:t.menuName,callback:function(e){t.menuName=e},expression:"menuName"}})],1)]),t._v(" "),1==t.$cookie.getCookie("isSuperManage")?i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("页面路由:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{attrs:{size:"small",placeholder:"请输入页面路由"},model:{value:t.routeName,callback:function(e){t.routeName=e},expression:"routeName"}})],1)]):t._e()]),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{size:"mini"},on:{click:function(e){t.dialogTableVisible=!1}}},[t._v("取 消")]),t._v(" "),i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){"添加菜单"==t.dialogTitleName?t.add_level2():t.edit_level2()}}},[t._v("确 定")])],1)])],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("thead",[e("tr",[e("th",[this._v("ID")]),this._v(" "),e("th",[this._v("二级菜单标题")]),this._v(" "),e("th",[this._v("路由")]),this._v(" "),e("th",[this._v("操作")])])])}]};var l=i("VU/8")(n,o,!1,function(t){i("wY6g"),i("ZS0/")},"data-v-e7d11500",null).exports,r={name:"menuManage",mixins:[s.a],components:{subMenu:l,noData:a.a},data:function(){return{sortFlag:!1,dialogTableVisible:!1,subMenuVisible:!1,subMenuTitle:"",dialogTitleName:"添加菜单",menuName:"",routeName:"",iconName:"",menuid:"",loading:!1,subId:"",acIdx:"helper",arr1:[]}},created:function(){this.init()},methods:{switchList:function(t){this.acIdx=t,this.init()},openDialog:function(t,e){this.dialogTitleName="edit"==t?"编辑菜单":"添加菜单",this.dialogTableVisible=!0,e?(this.menuName=e.title,this.routeName=e.route,this.iconName=e.icon,this.menuid=e.id):(this.menuName="",this.routeName="",this.iconName="",this.menuid="")},openSubMenu:function(t){var e=this;this.subMenuVisible=!0,this.subMenuTitle="二级菜单("+t.title+")",this.subId=t.id,this.$nextTick(function(){e.$refs.subMenu.init()})},sortClick:function(){var t=this,e=[];this.tableData.forEach(function(t){e.push(t.id)});var i={view_type:this.acIdx,parent_id:0,p_id:e};this.$axios.post(this.URL.BASEURL+this.URL.menu_sort,i).then(function(e){(e=e.data)&&0==e.errno&&(t.sortFlag=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})})},init:function(){var t=this;this.loading=!0,this.$axios.get(this.URL.BASEURL+this.URL.menu_list,{params:{view_type:this.acIdx}}).then(function(e){(e=e.data)&&0==e.errno?t.tableData=e.rst:4002!=e.errno&&t.$message({message:e.err,type:"warning"}),t.loading=!1}).catch(function(e){t.loading=!1,t.$message({message:e,type:"warning"})})},add_level1:function(){var t=this;if(""==this.menuName||""==this.iconName)return this.$message({message:"一级菜单名称和图标名为必填项",type:"warning"}),!1;var e={title:this.menuName,icon:this.iconName,route:this.routeName,view_type:this.acIdx};this.$axios.post(this.URL.BASEURL+this.URL.add_menu_l1,e).then(function(e){(e=e.data)&&0==e.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})})},edit_level1:function(){var t=this;if(""==this.menuName||""==this.iconName||""==this.menuid)return this.$message({message:"以上均为必填项",type:"warning"}),!1;var e={params:{id:this.menuid,title:this.menuName,icon:this.iconName,route:this.routeName,view_type:this.acIdx}};this.$axios.get(this.URL.BASEURL+this.URL.edit_menu_l1,e).then(function(e){(e=e.data)&&0==e.errno&&(t.dialogTableVisible=!1,t.init()),t.$message({message:e.err,type:"warning"})}).catch(function(e){t.$message({message:e,type:"warning"})})},dele_menu:function(t){var e=this;if(""==t)return this.$message({message:"权限id未得到",type:"warning"}),!1;this.$confirm("是否删除此菜单","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var i={id:t,view_type:e.acIdx};e.$axios.post(e.URL.BASEURL+e.URL.menu_dele,i).then(function(t){(t=t.data)&&0==t.errno&&e.init(),e.$message({message:t.err,type:"warning"})}).catch(function(t){e.$message({message:t,type:"warning"})})}).catch(function(){})}}},c={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"con"},[i("div",[1==t.$cookie.getCookie("isSuperManage")?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.openDialog("add")}}},[t._v("添加一级菜单")]):t._e(),t._v(" "),!t.sortFlag&&t.tableData&&t.tableData.length>1?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.sortFlag=!0}}},[t._v("一级菜单排序")]):t._e(),t._v(" "),t.sortFlag&&t.tableData&&t.tableData.length>1?i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.sortClick()}}},[t._v("确定排序")]):t._e(),t._v(" "),t.sortFlag?i("span",{staticClass:"f12 c-FF604D"},[t._v("*排序完成后,请点确定排序,否则排序不生效。")]):t._e()],1),t._v(" "),i("table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"tableCon"},[t._m(0),t._v(" "),t.tableData&&t.tableData.length>0?[i("tbody",t._l(t.tableData,function(e,a){return i("tr",{key:e.id},[i("td",[t._v(t._s(e.id))]),t._v(" "),i("td",[t._v("\n "+t._s(e.title)+"\n "),t.sortFlag?[i("span",{staticClass:"f12 pointer c-00B38A",style:0==a?"color:#999;cursor:not-allowed":"",on:{click:function(e){return t.upClick(a)}}},[t._v("上移")]),t._v(" "),i("span",{staticClass:"f12 pointer c-00B38A",style:a==t.tableData.length-1?"color:#999;cursor:not-allowed":"",on:{click:function(e){return t.downClick(a)}}},[t._v("下移")])]:t._e()],2),t._v(" "),i("td",[t._v(t._s(e.route))]),t._v(" "),i("td",[i("div",{staticClass:"f14 c-00B38A pointer",on:{click:function(i){return t.openSubMenu(e)}}},[t._v("查看下级 ("+t._s(e.sub_num)+"个)")])]),t._v(" "),i("td",[t._v(t._s(e.icon))]),t._v(" "),i("td",[i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(i){return t.openDialog("edit",e)}}},[t._v("修改")]),t._v(" "),i("el-button",{attrs:{size:"mini"},on:{click:function(i){return t.dele_menu(e.id)}}},[t._v("删除")])],1)])}),0)]:t._e()],2),t._v(" "),t.tableData&&0==t.tableData.length?i("noData"):t._e(),t._v(" "),i("el-dialog",{staticClass:"dialogCon_permission",attrs:{title:t.dialogTitleName,visible:t.dialogTableVisible,width:"500px"},on:{"update:visible":function(e){t.dialogTableVisible=e}}},[i("div",{staticClass:"dialogCon"},[i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("一级菜单名称:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{attrs:{size:"small",placeholder:"请输入一级菜单名称"},model:{value:t.menuName,callback:function(e){t.menuName=e},expression:"menuName"}})],1)]),t._v(" "),1==t.$cookie.getCookie("isSuperManage")?i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("页面路由:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{attrs:{size:"small",placeholder:"请输入页面路由"},model:{value:t.routeName,callback:function(e){t.routeName=e},expression:"routeName"}})],1)]):t._e(),t._v(" "),1==t.$cookie.getCookie("isSuperManage")?i("div",{staticClass:"itemBox"},[i("div",{staticClass:"name"},[t._v("页面图标:")]),t._v(" "),i("div",{staticClass:"ipt"},[i("el-input",{attrs:{size:"small",placeholder:"请输入页面图标"},model:{value:t.iconName,callback:function(e){t.iconName=e},expression:"iconName"}})],1)]):t._e()]),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{size:"mini"},on:{click:function(e){t.dialogTableVisible=!1}}},[t._v("取 消")]),t._v(" "),i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){"添加菜单"==t.dialogTitleName?t.add_level1():t.edit_level1()}}},[t._v("确 定")])],1)]),t._v(" "),i("el-dialog",{staticClass:"dialogCon_subMenu",attrs:{title:t.subMenuTitle,visible:t.subMenuVisible},on:{"update:visible":function(e){t.subMenuVisible=e}}},[i("subMenu",{ref:"subMenu",attrs:{subId:t.subId,acIdx:t.acIdx}}),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.subMenuVisible=!1,t.init()}}},[t._v("关 闭")])],1)],1)],1)},staticRenderFns:[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("thead",[i("tr",[i("th",[t._v("ID")]),t._v(" "),i("th",[t._v("一级菜单标题")]),t._v(" "),i("th",[t._v("路由")]),t._v(" "),i("th",[t._v("下级模块及个数")]),t._v(" "),i("th",[t._v("页面图标")]),t._v(" "),i("th",[t._v("操作")])])])}]};var u=i("VU/8")(r,c,!1,function(t){i("wRsI"),i("gS/E")},"data-v-27e598ff",null);e.default=u.exports},"ZS0/":function(t,e){},"gS/E":function(t,e){},lbyi:function(t,e,i){"use strict";e.a={data:function(){return{tableData:[]}},methods:{upClick:function(t){if(0==t)return!1;this.tableData=this.swapItems(this.tableData,t,t-1),"tagManage"==this.$route.name&&this.orderList()},downClick:function(t){if(t==this.tableData.length-1)return!1;this.tableData=this.swapItems(this.tableData,t,t+1),"tagManage"==this.$route.name&&this.orderList()},swapItems:function(t,e,i){return t[e]=t.splice(i,1,t[e])[0],t}}}},wRsI:function(t,e){},wY6g:function(t,e){}});
|