/*! * build: Hopaheal * copyright: Mead * time: 2023-3-13 15:21:04 */ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-41ea6cc6"],{3097:function(t,e,a){"use strict";a.r(e),a.d(e,"getList",(function(){return r})),a.d(e,"doEdit",(function(){return o})),a.d(e,"doAdd",(function(){return i})),a.d(e,"doDelete",(function(){return n})),a.d(e,"menuTree",(function(){return l}));var s=a("b775");function r(t){return Object(s["default"])({url:"/base/role",method:"get",params:t})}function o(t){return Object(s["default"])({url:"/base/role/"+t.id,method:"put",data:t})}function i(t){return Object(s["default"])({url:"/base/role",method:"post",data:t})}function n(t){return Object(s["default"])({url:"/base/role/"+t,method:"delete"})}function l(t){return Object(s["default"])({url:"/base/menu-tree",method:"get",params:t})}},4763:function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:t.title,visible:t.dialogFormVisible,width:"800px"},on:{"update:visible":function(e){t.dialogFormVisible=e},close:t.close},scopedSlots:t._u([{key:"footer",fn:function(){return[a("el-button",{on:{click:t.close}},[t._v("取 消")]),"编辑"==t.title?a("el-button",{attrs:{type:"primary"},on:{click:t.save}},[t._v(" 确 定 ")]):t._e(),"添加"==t.title?a("el-button",{attrs:{type:"primary"},on:{click:t.add}},[t._v(" 添 加 ")]):t._e()]},proxy:!0}])},[a("el-form",{ref:"form",attrs:{"label-width":"100px",model:t.form,rules:t.rules}},[a("el-form-item",{attrs:{label:"角色名称",prop:"nickname"}},[a("el-input",{model:{value:t.form.nickname,callback:function(e){t.$set(t.form,"nickname",e)},expression:"form.nickname"}})],1),a("el-form-item",{attrs:{label:"角色关键字",prop:"name"}},[a("el-input",{attrs:{disabled:"编辑"==t.title},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"排序",prop:"sort"}},[a("el-input",{attrs:{type:"number"},model:{value:t.form.sort,callback:function(e){t.$set(t.form,"sort",e)},expression:"form.sort"}})],1),a("el-form-item",{attrs:{label:"状态",prop:"status"}},[a("el-radio-group",{model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}},[a("el-radio",{attrs:{label:1}},[t._v("正常")]),a("el-radio",{attrs:{label:0}},[t._v("禁用")])],1)],1)],1)],1)},r=[],o=a("3097"),i={name:"DepartmentManagementEdit",data(){return{form:{parent_id:0,status:1,parent_name:"",sort:0,guard_name:"admins"},rules:{name:[{required:!0,trigger:"blur",message:"请输入角色"}],nickname:[{required:!0,trigger:"blur",message:"请输入角色关键字"}],sort:[{required:!0,trigger:"blur",message:"请输入排序"}],status:[{required:!0,trigger:"blur",message:"请选择状态"}]},title:"",dialogFormVisible:!1}},methods:{showEdit(t){console.log(this.form),t?(this.title="编辑",this.form=Object.assign({},t)):this.title="添加",this.dialogFormVisible=!0},close(){this.$refs["form"].resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1},save(){console.log(this.form,"pppppp"),this.$refs["form"].validate(async t=>{if(t){const{message:t}=await Object(o["doEdit"])(this.form);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.$emit("fetch-data"),this.close()}})},add(){this.$refs["form"].validate(async t=>{if(t){const{message:t}=await Object(o["doAdd"])(this.form);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.$emit("fetch-data"),this.close()}})}}},n=i,l=a("0b56"),u=Object(l["a"])(n,s,r,!1,null,null,null);e["default"]=u.exports},"811db":function(t,e,a){"use strict";a("dab0")},dab0:function(t,e,a){},ebe0:function(t,e,a){"use strict";a.r(e),a.d(e,"getList",(function(){return r})),a.d(e,"doEdit",(function(){return o})),a.d(e,"doAdd",(function(){return i})),a.d(e,"doDelete",(function(){return n})),a.d(e,"menuTree",(function(){return l}));var s=a("b775");function r(t){return Object(s["default"])({url:"/base/role",method:"get",params:t})}function o(t){return Object(s["default"])({url:"/base/role/"+t.id,method:"put",data:t})}function i(t){return Object(s["default"])({url:"/base/role",method:"post",data:t})}function n(t){return Object(s["default"])({url:"/base/role/"+t,method:"delete"})}function l(t){return Object(s["default"])({url:"/base/menu-tree",method:"get",params:t})}},ef17:function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"role-management-container"},[s("vab-query-form",[s("vab-query-form-left-panel",{attrs:{span:12}},[s("el-button",{attrs:{icon:"el-icon-plus",type:"primary"},on:{click:t.handleEdit}},[t._v(" 添加 ")])],1),s("vab-query-form-right-panel",{attrs:{span:12}},[s("el-form",{attrs:{inline:!0,model:t.queryForm},nativeOn:{submit:function(t){t.preventDefault()}}},[s("el-form-item",[s("el-input",{attrs:{clearable:"",placeholder:"请输入角色"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.queryData(e)}},model:{value:t.queryForm.nickname,callback:function(e){t.$set(t.queryForm,"nickname","string"===typeof e?e.trim():e)},expression:"queryForm.nickname"}})],1),s("el-form-item",[s("el-button",{attrs:{icon:"el-icon-search",type:"primary"},on:{click:t.queryData}},[t._v(" 查询 ")])],1)],1)],1)],1),s("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{border:"",data:t.list},scopedSlots:t._u([{key:"empty",fn:function(){return[s("el-image",{staticClass:"vab-data-empty",attrs:{src:a("f1f0")}})]},proxy:!0}])},[s("el-table-column",{attrs:{align:"center",label:"序号",sortable:"",type:"index",width:"80"}}),s("el-table-column",{attrs:{align:"center",label:"角色名称",prop:"nickname","show-overflow-tooltip":""}}),s("el-table-column",{attrs:{align:"center",label:"角色关键字",prop:"name","show-overflow-tooltip":""}}),s("el-table-column",{attrs:{align:"center",label:"排序",prop:"sort","show-overflow-tooltip":"",sortable:""},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[s("div",{staticClass:"edit"},[t.authForm.id==a.id&&1==t.editStatus?s("i",{staticClass:"el-icon-circle-close",on:{click:function(e){return e.stopPropagation(),t.cancelSort(a)}}}):t._e(),t.authForm.id!==a.id||0==t.editStatus?s("span",{staticClass:"sort-num"},[t._v(" "+t._s(a.sort)+" ")]):t._e(),t.authForm.id==a.id&&1==t.editStatus?s("el-input",{ref:"getFocus",staticClass:"input-sort",on:{input:t.inputSort},model:{value:a.sort,callback:function(e){t.$set(a,"sort",e)},expression:"row.sort"}}):t._e(),t.authForm.id!==a.id||0==t.editStatus?s("i",{staticClass:"el-icon-edit",on:{click:function(e){return t.changeSort(a)}}}):t._e(),t.authForm.id==a.id&&1==t.editStatus?s("i",{staticClass:"el-icon-circle-check",on:{click:t.sureChange}}):t._e()],1)]}}])}),s("el-table-column",{attrs:{align:"center",label:"创建时间",prop:"created_at","show-overflow-tooltip":""}}),s("el-table-column",{attrs:{align:"center",label:"状态",prop:"status","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[1==a.status?s("el-tag",[t._v("正常")]):t._e(),0==a.status?s("el-tag",{attrs:{type:"danger"}},[t._v("禁用")]):t._e()]}}])}),s("el-table-column",{attrs:{align:"center",label:"操作","show-overflow-tooltip":"",width:"170"},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[s("el-button",{attrs:{type:"text"},on:{click:function(e){return t.authoriza(a)}}},[t._v("授权")]),s("el-button",{attrs:{type:"text"},on:{click:function(e){return t.handleEdit(a)}}},[t._v("编辑")]),s("el-button",{attrs:{disabled:1==a.is_delete,type:"text"},on:{click:function(e){return t.handleDelete(a)}}},[t._v(" 删除 ")])]}}])})],1),s("el-pagination",{attrs:{background:"","current-page":t.queryForm.page,layout:t.layout,"page-size":t.queryForm.per_page,"page-sizes":[15,20,30,40,50,100],total:t.total},on:{"current-change":t.handleCurrentChange,"size-change":t.handleSizeChange}}),s("edit",{ref:"edit",on:{"fetch-data":t.fetchData}}),s("el-dialog",{attrs:{title:"授权",visible:t.authorizaFormVisible,width:"800px"},on:{"update:visible":function(e){t.authorizaFormVisible=e},close:t.close},scopedSlots:t._u([{key:"footer",fn:function(){return[s("el-button",{on:{click:t.close}},[t._v("取 消")]),s("el-button",{attrs:{type:"primary"},on:{click:t.saveAuthoriz}},[t._v("确 定")])]},proxy:!0}])},[s("el-tree",{ref:"tree",attrs:{data:t.menuList,"default-checked-keys":t.nodeArr,"default-expand-all":"","node-key":"id",props:t.zh_defaultProps,"show-checkbox":!0},on:{check:t.checkNode}})],1)],1)},r=[],o=a("ebe0"),i=a("4763"),n={name:"RoleManagement",components:{Edit:i["default"]},data(){return{authorizaFormVisible:!1,list:[],listLoading:!0,layout:"total, sizes, prev, pager, next, jumper",total:0,selectRows:"",queryForm:{page:1,per_page:15},oldSort:0,editStatus:0,flag:!1,menuList:[],zh_defaultProps:{children:"children",label:function(t){return t.zh_title}},en_defaultProps:{children:"children",label:function(t){return t.en_title}},authForm:{id:"",menuIds:[]},nodeArr:[]}},created(){this.fetchData()},methods:{close(){this.authorizaFormVisible=!1,this.authForm.menuIds=[]},checkNode(t){console.log(t,"pppppppppppppp"),this.authForm.menus=this.$refs.tree.getCheckedKeys(),this.authForm.parent_menus=this.authForm.menus.concat(this.$refs.tree.getHalfCheckedKeys()),console.log(this.authForm.parent_menus,"this.authForm.parent_menus")},async authoriza(t){this.authForm=t;const{data:e}=await Object(o["menuTree"])();this.menuList=e,this.authForm=t,this.nodeArr=this.authForm.menus,this.authorizaFormVisible=!0},saveAuthoriz(){this.authForm.parent_menus=this.authForm.menus.concat(this.$refs.tree.getHalfCheckedKeys()),console.log(this.authForm,"this.authForm"),this.auth_sureChange(this.authForm),this.authorizaFormVisible=!1},setSelectRows(t){this.selectRows=t},handleEdit(t){t.id?this.$refs["edit"].showEdit(t):this.$refs["edit"].showEdit()},handleDelete(t){this.$baseConfirm("你确定要删除当前项吗",null,async()=>{const{message:e}=await Object(o["doDelete"])(t.id);this.$baseMessage(e,"success",!1,"vab-hey-message-success"),await this.fetchData()})},handleSizeChange(t){this.queryForm.per_page=t,this.fetchData()},handleCurrentChange(t){this.queryForm.page=t,this.fetchData()},queryData(){this.queryForm.page=1,this.fetchData()},async fetchData(){this.listLoading=!0;const{data:t}=await Object(o["getList"])(this.queryForm);console.log(t,"角色列表"),this.list=t.list;const{meta:e}=t;this.total=e.pagination.total,this.listLoading=!1},async auth_sureChange(){this.authForm.guard_name="admins";const{message:t}=await Object(o["doEdit"])(this.authForm);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.fetchData()},inputSort(t){console.log(t,"inputSort"),this.authForm.sort=t},cancelSort(){console.log("cancelSort"),this.editStatus=0,this.authForm.sort=this.oldSort},async changeSort(t){console.log("changeSort"),this.editStatus=1,this.authForm=t,this.oldSort=t.sort,this.$nextTick(()=>{this.$refs["getFocus"].focus()})},async sureChange(){if(console.log("sureChange"),this.editStatus=0,this.oldSort!==this.authForm.sort){this.authForm.guard_name="admins";const{message:t}=await Object(o["doEdit"])(this.authForm);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.fetchData()}}}},l=n,u=(a("811db"),a("0b56")),c=Object(u["a"])(l,s,r,!1,null,"1a8cf03f",null);e["default"]=c.exports},f1f0:function(t,e,a){t.exports=a.p+"static/img/data_empty.f2997617.png"}}]);