/*! * build: Hopaheal * copyright: Mead * time: 2022-9-23 10:41:22 */ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-46f42866"],{"0ca6":function(t,e,a){"use strict";a("3b79")},2817: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.translateTitle(t.title),visible:t.dialogFormVisible,width:"500px"},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._s(t.translateTitle("取 消")))]),"编辑"==t.title?a("el-button",{attrs:{type:"primary"},on:{click:t.save}},[t._v(" "+t._s(t.translateTitle("确 定"))+" ")]):t._e(),"添加"==t.title?a("el-button",{attrs:{type:"primary"},on:{click:t.add}},[t._v(" "+t._s(t.translateTitle("添 加"))+" ")]):t._e()]},proxy:!0}])},[a("el-form",{ref:"form",attrs:{"label-width":"80px",model:t.form,rules:t.rules}},[a("el-form-item",{attrs:{label:t.translateTitle("角色"),prop:"name"}},[a("el-input",{model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:t.translateTitle("排序"),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:t.translateTitle("状态"),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(t._s(t.translateTitle("正常")))]),a("el-radio",{attrs:{label:0}},[t._v(t._s(t.translateTitle("禁用")))])],1)],1)],1)],1)},r=[],i=a("cd3f"),o=a("79fa"),l={name:"DepartmentManagementEdit",data(){return{typeArray:[{type:0,type_text:"饮片"},{type:1,type_text:"颗粒"}],form:{parent_id:0,status:1,parent_name:"",sort:0},rules:{name:[{required:!0,trigger:"blur",message:this.translateTitle("请输入角色")}],sort:[{required:!0,trigger:"blur",message:this.translateTitle("请输入排序")}],status:[{required:!0,trigger:"blur",message:this.translateTitle("请选择状态")}]},title:"",dialogFormVisible:!1}},created(){},methods:{translateTitle:o["translateTitle"],showEdit(t){t?(this.title="编辑",this.form=Object.assign({},t),null==this.form.parent_name&&(this.form.parent_name="顶级课程")):this.title="添加",console.log(typeof this.form.parent_id,"第一步编辑"),this.dialogFormVisible=!0},close(){this.$refs["form"].resetFields(),this.dialogFormVisible=!1},save(){this.$refs["form"].validate(async t=>{if(t){const{message:t}=await Object(i["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(i["doAdd"])(this.form);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.$emit("fetch-data"),this.close()}})}}},n=l,u=a("0b56"),c=Object(u["a"])(n,s,r,!1,null,null,null);e["default"]=c.exports},"3b79":function(t,e,a){},"5f50":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(" "+t._s(t.translateTitle("添加"))+" ")])],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:t.translateTitle("请输入角色")},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.name,callback:function(e){t.$set(t.queryForm,"name","string"===typeof e?e.trim():e)},expression:"queryForm.name"}})],1),s("el-form-item",[s("el-button",{attrs:{icon:"el-icon-search",type:"primary"},on:{click:t.queryData}},[t._v(" "+t._s(t.translateTitle("查询"))+" ")])],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:t.translateTitle("序号"),sortable:"",type:"index",width:"80"}}),s("el-table-column",{attrs:{align:"center",label:t.translateTitle("角色"),prop:"name","show-overflow-tooltip":""}}),s("el-table-column",{attrs:{align:"center",label:t.translateTitle("排序"),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:t.translateTitle("创建时间"),prop:"created_at","show-overflow-tooltip":""}}),s("el-table-column",{attrs:{align:"center",label:t.translateTitle("状态"),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:t.translateTitle("操作"),"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(" "+t._s(t.translateTitle("授权"))+" ")]),s("el-button",{attrs:{type:"text"},on:{click:function(e){return t.handleEdit(a)}}},[t._v(" "+t._s(t.translateTitle("编辑"))+" ")]),s("el-button",{attrs:{disabled:1==a.is_delete,type:"text"},on:{click:function(e){return t.handleDelete(a)}}},[t._v(" "+t._s(t.translateTitle("删除"))+" ")])]}}])})],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:t.translateTitle("授权"),visible:t.authorizaFormVisible,width:"500px"},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(t._s(t.translateTitle("取 消")))]),s("el-button",{attrs:{type:"primary"},on:{click:t.saveAuthoriz}},[t._v(" "+t._s(t.translateTitle("确 定"))+" ")])]},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=[],i=a("cd3f"),o=a("2817"),l=a("79fa"),n={name:"RoleManagement",components:{Edit:o["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:{translateTitle:l["translateTitle"],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(i["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(i["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(i["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(){const{message:t}=await Object(i["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){const{message:t}=await Object(i["doEdit"])(this.authForm);this.$baseMessage(t,"success",!1,"vab-hey-message-success"),this.fetchData()}}}},u=n,c=(a("0ca6"),a("0b56")),h=Object(c["a"])(u,s,r,!1,null,"633c6170",null);e["default"]=h.exports},cd3f:function(t,e,a){"use strict";a.r(e),a.d(e,"getList",(function(){return r})),a.d(e,"doEdit",(function(){return i})),a.d(e,"doAdd",(function(){return o})),a.d(e,"doDelete",(function(){return l})),a.d(e,"menuTree",(function(){return n}));var s=a("b775");function r(t){return Object(s["default"])({url:"/base/role",method:"get",params:t})}function i(t){return Object(s["default"])({url:"/base/role/"+t.id,method:"put",data:t})}function o(t){return Object(s["default"])({url:"/base/role",method:"post",data:t})}function l(t){return Object(s["default"])({url:"/base/role/"+t,method:"delete"})}function n(t){return Object(s["default"])({url:"/base/menu-tree",method:"get",params:t})}},f1f0:function(t,e,a){t.exports=a.p+"static/img/data_empty.f2997617.png"}}]);