捕梦者基础前端框架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
9.9 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-35b425da","chunk-2d2084d5","chunk-2d228ffc"],{"70eb":function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"ele-body"},[a("el-card",{attrs:{shadow:"never"}},[a("el-form",{staticClass:"ele-form-search",attrs:{model:e.where,"label-width":"77px"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.reload(t)},submit:function(e){e.preventDefault()}}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{md:6,sm:12}},[a("el-form-item",{attrs:{label:"角色名称:"}},[a("el-input",{attrs:{placeholder:"请输入",clearable:""},model:{value:e.where.title,callback:function(t){e.$set(e.where,"title",t)},expression:"where.title"}})],1)],1),a("el-col",{attrs:{md:6,sm:12}},[a("el-form-item",{attrs:{label:"角色标识:"}},[a("el-input",{attrs:{placeholder:"请输入",clearable:""},model:{value:e.where.role_code,callback:function(t){e.$set(e.where,"role_code",t)},expression:"where.role_code"}})],1)],1),a("el-col",{attrs:{md:6,sm:12}},[a("div",{staticClass:"ele-form-actions"},[a("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.reload}},[e._v("查询 ")]),a("el-button",{on:{click:e.reset}},[e._v("重置")])],1)])],1)],1),a("ele-pro-table",{ref:"table",attrs:{datasource:e.url,columns:e.columns,where:e.where,selection:e.selection},on:{"update:selection":function(t){e.selection=t}},scopedSlots:e._u([{key:"status",fn:function(t){var o=t.row;return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(t){return e.editStatus(o)}},model:{value:o.status,callback:function(t){e.$set(o,"status",t)},expression:"row.status"}})]}},{key:"action",fn:function(t){var o=t.row;return[a("el-link",{attrs:{icon:"el-icon-edit",type:"primary",underline:!1},on:{click:function(t){return e.openEdit(o)}}},[e._v("修改 ")]),a("el-link",{attrs:{icon:"el-icon-finished",type:"primary",underline:!1},on:{click:function(t){return e.openAuth(o)}}},[e._v("分配权限 ")]),a("el-popconfirm",{staticClass:"ele-action",attrs:{title:"确定要删除此角色吗?"},on:{confirm:function(t){return e.remove(o)}}},[a("el-link",{attrs:{slot:"reference",icon:"el-icon-delete",type:"danger",underline:!1},slot:"reference"},[e._v("删除 ")])],1)]}}])},[a("template",{slot:"toolbar"},[a("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:function(t){return e.openEdit(null)}}},[e._v("添加 ")]),a("el-button",{staticClass:"ele-btn-icon",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:e.removeBatch}},[e._v("删除 ")])],1)],2)],1),a("role-edit",{attrs:{visible:e.showEdit,data:e.current},on:{"update:visible":function(t){e.showEdit=t},done:e.reload}}),a("role-auth",{attrs:{visible:e.showAuth,data:e.current},on:{"update:visible":function(t){e.showAuth=t}}})],1)},s=[],i=(a("d81d"),a("dc29")),l=a("a3e2"),r={name:"SystemRole",components:{RoleEdit:i["default"],RoleAuth:l["default"]},data:function(){return{url:"/group/index",columns:[{columnKey:"selection",type:"selection",width:45,align:"center",fixed:"left"},{columnKey:"index",type:"index",width:45,align:"center",fixed:"left",showOverflowTooltip:!0},{prop:"title",label:"角色名称",sortable:!1,showOverflowTooltip:!0,minWidth:110},{prop:"role_code",label:"角色标识",sortable:!1,showOverflowTooltip:!0,minWidth:70},{prop:"remark",label:"备注",sortable:!1,showOverflowTooltip:!0,minWidth:110},{prop:"create_time",label:"创建时间",sortable:"custom",showOverflowTooltip:!0,minWidth:110},{prop:"status",label:"状态",align:"center",sortable:"custom",width:80,resizable:!1,slot:"status"},{columnKey:"action",label:"操作",width:230,align:"center",resizable:!1,slot:"action"}],where:{},selection:[],current:null,showEdit:!1,showAuth:!1}},methods:{reload:function(){this.$refs.table.reload({page:1})},reset:function(){var e=this;this.where={},this.$nextTick((function(){e.reload()}))},openEdit:function(e){this.current=e,this.showEdit=!0},openAuth:function(e){this.current=e,this.showAuth=!0},remove:function(e){var t=this,a=this.$loading({lock:!0}),o=new FormData;o.append("id",e.id),o.append("title",e.title),this.$http.post("/group/delete/",o).then((function(e){a.close(),0===e.data.code?(t.$message({type:"success",message:e.data.msg}),t.reload()):t.$message.error(e.data.msg)})).catch((function(e){a.close(),t.$message.error(e.message)}))},removeBatch:function(){var e=this;this.selection.length?this.$confirm("确定要删除选中的角色吗?","提示",{type:"warning"}).then((function(){var t=e.$loading({lock:!0}),a=new FormData;a.append("id",e.selection.map((function(e){return e.id}))),a.append("title",e.selection.map((function(e){return e.title}))),e.$http.post("/group/delete",a).then((function(a){t.close(),0===a.data.code?(e.$message({type:"success",message:a.data.msg}),e.reload()):e.$message.error(a.data.msg)})).catch((function(a){t.close(),e.$message.error(a.message)}))})).catch((function(){})):this.$message.error("请至少选择一条数据")},editStatus:function(e){var t=this,a=this.$loading({lock:!0}),o=new FormData;o.append("status",e.status),o.append("title",e.title),o.append("id",e.id),this.$http.post("/group/status",o).then((function(o){a.close(),0===o.data.code?t.$message({type:"success",message:o.data.msg}):(e.status=e.status?0:1,t.$message.error(o.data.msg))})).catch((function(e){a.close(),t.$message.error(e.message)}))}}},n=r,c=a("2877"),d=Object(c["a"])(n,o,s,!1,null,"459e4a7a",null);t["default"]=d.exports},a3e2:function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-dialog",{attrs:{title:"分配权限",visible:e.visible,width:"520px","destroy-on-close":!0,"lock-scroll":!1},on:{"update:visible":e.updateVisible}},[a("el-scrollbar",{directives:[{name:"loading",rawName:"v-loading",value:e.authLoading,expression:"authLoading"}],staticStyle:{height:"50vh"},attrs:{wrapStyle:"overflow-x: hidden;"}},[a("el-tree",{ref:"tree",attrs:{data:e.authData,props:{label:"title"},"node-key":"id","default-expand-all":!0,"default-checked-keys":e.checked,"show-checkbox":""}})],1),a("div",{attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){return e.updateVisible(!1)}}},[e._v("取消")]),a("el-button",{attrs:{type:"primary",loading:e.loading},on:{click:e.save}},[e._v("保存 ")])],1)],1)},s=[],i=(a("99af"),{name:"RoleAuth",props:{visible:Boolean,data:Object},data:function(){return{authData:[],authLoading:!1,loading:!1}},computed:{checked:function(){var e=[];return this.$util.eachTreeData(this.authData,(function(t){!t.checked||t.children&&t.children.length||e.push(t.id)})),e}},watch:{visible:function(){this.visible&&this.query()}},methods:{query:function(){var e=this;this.authData=[],this.data&&(this.authLoading=!0,this.$http.get("/group/getGrouprule",{params:{role_id:this.data.id}}).then((function(t){e.authLoading=!1,0===t.data.code?e.authData=e.$util.toTreeData(t.data.data,"id","parent_id"):e.$message.error(t.data.msg)})).catch((function(t){e.authLoading=!1,e.$message.error(t.message)})))},save:function(){var e=this;this.loading=!0;var t=this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());this.$http.post("/group/addGroupRule/role_id/"+this.data.id,{menu_id:t,title:this.data.title}).then((function(t){e.loading=!1,0===t.data.code?(e.$message({type:"success",message:t.data.msg}),e.updateVisible(!1)):e.$message.error(t.data.msg)})).catch((function(t){e.loading=!1,e.$message.error(t.message)}))},updateVisible:function(e){this.$emit("update:visible",e)}}}),l=i,r=a("2877"),n=Object(r["a"])(l,o,s,!1,null,"531f090d",null);t["default"]=n.exports},dc29:function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-dialog",{attrs:{title:e.isUpdate?"修改角色":"添加角色",visible:e.visible,width:"400px","destroy-on-close":!0,"lock-scroll":!1},on:{"update:visible":e.updateVisible}},[a("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"82px"}},[a("el-form-item",{attrs:{label:"角色名称:",prop:"title"}},[a("el-input",{attrs:{placeholder:"请输入角色名称",clearable:""},model:{value:e.form.title,callback:function(t){e.$set(e.form,"title",t)},expression:"form.title"}})],1),a("el-form-item",{attrs:{label:"角色标识:",prop:"role_code"}},[a("el-input",{attrs:{placeholder:"请输入角色标识",clearable:""},model:{value:e.form.role_code,callback:function(t){e.$set(e.form,"role_code",t)},expression:"form.role_code"}})],1),a("el-form-item",{attrs:{label:"备注:"}},[a("el-input",{attrs:{placeholder:"请输入备注",rows:4,type:"textarea"},model:{value:e.form.remark,callback:function(t){e.$set(e.form,"remark",t)},expression:"form.remark"}})],1)],1),a("div",{attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){return e.updateVisible(!1)}}},[e._v("取消")]),a("el-button",{attrs:{type:"primary",loading:e.loading},on:{click:e.save}},[e._v("保存 ")])],1)],1)},s=[],i={name:"RoleEdit",props:{visible:Boolean,data:Object},data:function(){return{form:Object.assign({},this.data),rules:{title:[{required:!0,message:"请输入角色名称",trigger:"blur"}],role_code:[{required:!0,message:"请输入角色标识",trigger:"blur"}]},loading:!1,isUpdate:!1}},watch:{data:function(){this.data?(this.form=Object.assign({},this.data),this.isUpdate=!0):(this.form={},this.isUpdate=!1)}},methods:{save:function(){var e=this;this.$refs["form"].validate((function(t){if(!t)return!1;e.loading=!0,e.$http.post("/group/"+(e.isUpdate?"edit":"add"),e.form).then((function(t){e.loading=!1,0===t.data.code?(e.$message({type:"success",message:t.data.msg}),e.isUpdate||(e.form={}),e.updateVisible(!1),e.$emit("done")):e.$message.error(t.data.msg)})).catch((function(t){e.loading=!1,e.$message.error(t.message)}))}))},updateVisible:function(e){this.$emit("update:visible",e)}}},l=i,r=a("2877"),n=Object(r["a"])(l,o,s,!1,null,"b4003c5e",null);t["default"]=n.exports}}]);