Files
PropertyDeployment/resources/Web/MicroCommunityMallWeb/html/js/chunk-6263ee30.bd8687aa.js
Anfioo adfd019d2d 江门
1
2026-02-01 15:37:55 +08:00

2 lines
28 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6263ee30"],{"15d5":function(e,t,a){},"1bf7":function(e,t,a){},"1f46":function(e,t,a){},"2c05":function(e,t,a){},"2d6c":function(e,t,a){},"2fc0":function(e,t,a){},4341:function(e,t,a){"use strict";a("2fc0")},"446b":function(e,t,a){"use strict";a("5b88")},5252:function(e,t,a){"use strict";a("1bf7")},"57f9":function(e,t,a){"use strict";a("b191")},"5b88":function(e,t,a){},"5c29":function(e,t,a){"use strict";a("8d40")},"66d54":function(e,t,a){"use strict";a("2d6c")},"8a39":function(e,t,a){},"8d2c":function(e,t,a){"use strict";a("c3d4")},"8d40":function(e,t,a){},"948e":function(e,t,a){"use strict";a("8a39")},"9d3e":function(e,t,a){"use strict";a("e070")},a5ed:function(e,t,a){"use strict";a("2c05")},b191:function(e,t,a){},bec4:function(e,t,a){"use strict";a("1f46")},c3d4:function(e,t,a){},ce03:function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e._self._c;return t("div",[t("el-row",{attrs:{gutter:20}},[t("el-col",{staticClass:"pr-0",attrs:{span:4}},[t("role-div",{on:{switchRole:e.handleSwitchRole}})],1),t("el-col",{staticClass:"mt-xs vc-org-page",attrs:{span:20}},[t("div",{staticClass:"bg-white border-radius padding text-left"},[t("h5",{staticClass:"role-title"},[e._v(e._s(e.roleInfo.curRole.name))]),t("div",{staticClass:"role-context"},[e._v(e._s(e.roleInfo.curRole.description))]),t("div",{staticClass:"line-x margin-top"}),t("div",{staticClass:"role-menu flex justify-start"},[t("div",{staticClass:"item margin-right",class:{active:"privilege"==e.roleInfo.tabName},on:{click:function(t){return e.changeRoleTab("privilege")}}},[e._v(" 功能授权 ")]),t("div",{staticClass:"item margin-right",class:{active:"shop"==e.roleInfo.tabName},on:{click:function(t){return e.changeRoleTab("shop")}}},[e._v(" 店铺授权 ")]),t("div",{staticClass:"item margin-right",class:{active:"staff"==e.roleInfo.tabName},on:{click:function(t){return e.changeRoleTab("staff")}}},[e._v(" 员工关联 ")])]),"privilege"==e.roleInfo.tabName?t("div",[t("privilege-tree",{ref:"privilegeTree",attrs:{pgId:e.roleInfo.curRole.pgId}})],1):e._e(),"shop"==e.roleInfo.tabName?t("div",[t("role-shop",{ref:"roleShop"})],1):e._e(),"staff"==e.roleInfo.tabName?t("div",[t("role-staff",{ref:"roleStaff"})],1):e._e()])])],1)],1)},s=[],i=function(){var e=this,t=e._self._c;return t("div",{staticClass:"bg-white margin-top-xs padding border-radius"},[t("div",{staticClass:"mb-10"},[t("el-button",{attrs:{size:"small",type:"text"},on:{click:e.openAddModal}},[e._v(" 添加 ")]),t("el-button",{attrs:{size:"small",type:"text"},on:{click:e.openEditModal}},[e._v(" 修改 ")]),t("el-button",{attrs:{size:"small",type:"text"},on:{click:e.openDeleteModal}},[e._v(" 删除 ")])],1),t("div",{staticClass:"vc-org margin-top"},[t("ul",e._l(e.roleDivInfo.roles,(function(a,o){return t("li",{key:o,class:{active:a.pgId==e.roleDivInfo.curRole.pgId},on:{click:function(t){return e.switchRole(a)}}},[e._v(" "+e._s(a.name)+" ")])})),0)]),t("add-privilege-group",{ref:"addPrivilegeGroup",on:{refresh:function(t){return e.loadRoles()}}}),t("edit-privilege-group",{ref:"editPrivilegeGroup",on:{refresh:function(t){return e.loadRoles()}}}),t("delete-privilege-group",{ref:"deletePrivilegeGroup",on:{refresh:function(t){return e.loadRoles()}}})],1)},r=[],l=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"添加角色",visible:e.dialogVisible,width:"50%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"角色名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"必填,请填写角色名称",clearable:""},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"角色描述",prop:"description"}},[t("el-input",{attrs:{type:"textarea",placeholder:"选填,请填写角色描述",rows:3},model:{value:e.form.description,callback:function(t){e.$set(e.form,"description",t)},expression:"form.description"}})],1)],1),e.errorInfo?t("div",{staticClass:"error-message"},[e._v(e._s(e.errorInfo))]):e._e(),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},n=[],c=a("b775"),d=a("7323");function h(e){return new Promise((t,a)=>{Object(c["a"])({url:"/query.store.privilegeGroup",method:"get",params:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function p(e){return new Promise((t,a)=>{Object(c["a"])({url:"/privilegeGroup.savePrivilegeGroup",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function f(e){return new Promise((t,a)=>{Object(c["a"])({url:"/privilegeGroup.updatePrivilegeGroup",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function u(e){return new Promise((t,a)=>{Object(c["a"])({url:"/privilegeGroup.deletePrivilegeGroup",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}var g={name:"AddPrivilegeGroup",data(){return{dialogVisible:!1,form:{name:"",description:""},rules:{name:[{required:!0,message:"角色名称不能为空",trigger:"blur"},{min:2,max:10,message:"角色名称长度必须在2位至10位",trigger:"blur"}],description:[{max:200,message:"角色描述长度不能超过200位",trigger:"blur"}]},errorInfo:""}},methods:{open(){this.dialogVisible=!0},handleClose(){this.$refs.form.resetFields(),this.errorInfo=""},handleSubmit(){this.$refs.form.validate(async e=>{if(e)try{const e=await p(this.form);0===e.code?(this.$message.success("添加成功"),this.dialogVisible=!1,this.$emit("refresh")):this.errorInfo=e.msg}catch(t){console.error("添加角色失败:",t),this.errorInfo="添加角色失败"}})}}},m=g,b=(a("9d3e"),a("2877")),v=Object(b["a"])(m,l,n,!1,null,"2d72979e",null),I=v.exports,S=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"编辑角色",visible:e.dialogVisible,width:"50%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"角色名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"必填,请填写角色名称",clearable:""},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"角色描述",prop:"description"}},[t("el-input",{attrs:{type:"textarea",placeholder:"选填,请填写角色描述",rows:3},model:{value:e.form.description,callback:function(t){e.$set(e.form,"description",t)},expression:"form.description"}})],1)],1),e.errorInfo?t("div",{staticClass:"error-message"},[e._v(e._s(e.errorInfo))]):e._e(),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},y=[],C={name:"EditPrivilegeGroup",data(){return{dialogVisible:!1,form:{pgId:"",name:"",description:""},rules:{name:[{required:!0,message:"角色名称不能为空",trigger:"blur"},{min:2,max:10,message:"角色名称长度必须在2位至10位",trigger:"blur"}],description:[{max:200,message:"角色描述长度不能超过200位",trigger:"blur"}]},errorInfo:""}},methods:{open(e){this.form={pgId:e.pgId,name:e.name,description:e.description},this.dialogVisible=!0},handleClose(){this.$refs.form.resetFields(),this.errorInfo=""},async handleSubmit(){this.$refs.form.validate(async e=>{if(e)try{const e=await f(this.form);0===e.code?(this.$message.success("修改成功"),this.dialogVisible=!1,this.$emit("refresh")):this.errorInfo=e.msg}catch(t){console.error("修改角色失败:",t),this.errorInfo="修改角色失败"}})}}},_=C,w=(a("dc70"),Object(b["a"])(_,S,y,!1,null,"27afbc0e",null)),R=w.exports,k=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"请确认您的操作",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"confirm-content"},[t("p",[e._v("删除权限组同时会删除权限组下的所有权限,确认是否删除角色-"+e._s(e.form.name)+"")])]),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("点错了")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleConfirm}},[e._v("确认删除")])],1)])},D=[],P={name:"DeletePrivilegeGroup",data(){return{dialogVisible:!1,form:{pgId:"",name:""}}},methods:{open(e){this.form={pgId:e.pgId,name:e.name},this.dialogVisible=!0},handleClose(){this.form={pgId:"",name:""}},async handleConfirm(){try{const e=await u(this.form);0===e.code?(this.$message.success("删除成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(e.msg)}catch(e){console.error("删除角色失败:",e),this.$message.error("删除角色失败")}}}},x=P,$=(a("446b"),Object(b["a"])(x,k,D,!1,null,"248b483c",null)),z=$.exports,j={name:"RoleDiv",components:{AddPrivilegeGroup:I,EditPrivilegeGroup:R,DeletePrivilegeGroup:z},data(){return{roleDivInfo:{roles:[],curRole:{}}}},created(){this.loadRoles()},methods:{async loadRoles(){try{const e={shopId:Object(d["f"])()},t=await h(e);this.roleDivInfo.roles=t,t&&t.length>0&&this.switchRole(t[0])}catch(e){console.error("获取角色列表失败:",e)}},switchRole(e){this.roleDivInfo.curRole=e,this.$emit("switchRole",e)},openAddModal(){this.$refs.addPrivilegeGroup.open()},openEditModal(){this.roleDivInfo.curRole.pgId?this.$refs.editPrivilegeGroup.open(this.roleDivInfo.curRole):this.$message.warning("请先选择角色")},openDeleteModal(){this.roleDivInfo.curRole.pgId?this.$refs.deletePrivilegeGroup.open(this.roleDivInfo.curRole):this.$message.warning("请先选择角色")}}},V=j,O=(a("948e"),Object(b["a"])(V,i,r,!1,null,"b72838e8",null)),N=O.exports,G=function(){var e=this,t=e._self._c;return t("div",{staticClass:"privilege-tree"},[t("el-tree",{ref:"privilegeTree",attrs:{data:e.treeData,props:e.defaultProps,"show-checkbox":"","node-key":"id","default-expanded-keys":e.expandedKeys,"default-checked-keys":e.checkedKeys},on:{check:e.handleCheckChange}})],1)},F=[];function K(e){return new Promise((t,a)=>{Object(c["a"])({url:"/query.privilegeGroup.noAddPrivilege",method:"get",params:{...e}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function M(e){return new Promise((t,a)=>{Object(c["a"])({url:"/add.privilege.PrivilegeGroup",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function A(e){return new Promise((t,a)=>{Object(c["a"])({url:"/delete.privilege.PrivilegeGroup",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}var T={name:"PrivilegeTree",props:{pgId:{type:String,default:""}},data(){return{privileges:[],treeData:[],defaultProps:{children:"children",label:"text"},expandedKeys:[],checkedKeys:[],previousCheckedKeys:[]}},watch:{pgId:{immediate:!0,handler(e){e&&""!==e.trim()?this.loadPrivileges(e):(this.privileges=[],this.treeData=[],this.checkedKeys=[],this.previousCheckedKeys=[])}}},methods:{async loadPrivileges(e){try{const t={pgId:e},a=await K(t);this.privileges=a,this.checkedKeys=[],this.formatTreeData(),this.previousCheckedKeys=[...this.checkedKeys]}catch(t){this.$message.error(t.message)}},formatTreeData(){const e=[],t=[];this.privileges.forEach(a=>{if(!e.some(e=>e.gId===a.gId)){const o={id:"g_"+a.gId,gId:a.gId,text:a.gName,children:this.formatMenuData(a.gId)};e.push(o),t.push("g_"+a.gId)}}),this.treeData=e,this.expandedKeys=t},formatMenuData(e){const t=[];return this.privileges.filter(t=>t.gId===e).forEach(e=>{if(!t.some(t=>t.mId===e.mId)){const a={id:"m_"+e.mId,mId:e.mId,text:e.mName,children:this.formatPrivilegeData(e.mId)};t.push(a)}}),t},formatPrivilegeData(e){return this.privileges.filter(t=>t.mId===e).map(e=>{const t={id:"p_"+e.pId,pId:e.pId,text:e.pName};return e.pgId&&this.checkedKeys.push("p_"+e.pId),t})},async handleCheckChange(e,{checkedKeys:t}){const a=t.filter(e=>e.startsWith("p_")).map(e=>e.replace("p_","")),o=a.filter(e=>!this.previousCheckedKeys.includes("p_"+e)),s=this.previousCheckedKeys.filter(e=>e.startsWith("p_")).map(e=>e.replace("p_","")).filter(e=>!a.includes(e));try{o.length>0&&await M({pgId:this.pgId,pIds:o.map(e=>({pId:e}))}),s.length>0&&await A({pgId:this.pgId,pIds:s.map(e=>({pId:e}))}),this.previousCheckedKeys=[...t]}catch(i){this.$message.error(i.message),this.$nextTick(()=>{this.$refs.privilegeTree.setCheckedKeys([...this.previousCheckedKeys])})}}}},E=T,q=(a("5252"),Object(b["a"])(E,G,F,!1,null,"6539a4df",null)),J=q.exports,W=function(){var e=this,t=e._self._c;return t("div",{staticClass:"margin-top"},[t("div",{staticClass:"text-left mb-10"},[t("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.openAddModal}},[e._v(" 关联店铺 ")])],1),t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.roleShopInfo.roleShops,border:""}},[t("el-table-column",{attrs:{prop:"shopId",label:"店铺编号",align:"center"}}),t("el-table-column",{attrs:{prop:"shopName",label:"店铺名称",align:"center"}}),t("el-table-column",{attrs:{label:"操作",align:"center",width:"150"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(t){return e.openDeleteModal(a.row)}}},[e._v("删除")])]}}])})],1),t("el-pagination",{staticClass:"mt-10",attrs:{"current-page":e.pagination.currentPage,"page-sizes":[10,20,30,50],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),t("add-role-shop",{ref:"addRoleShop",on:{refresh:e.loadRoleShops}}),t("delete-role-shop",{ref:"deleteRoleShop",on:{refresh:e.loadRoleShops}})],1)},B=[],H=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"店铺",visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"search-container mb-10"},[t("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:"输入店铺名称",clearable:""},model:{value:e.searchForm.shopName,callback:function(t){e.$set(e.searchForm,"shopName",t)},expression:"searchForm.shopName"}}),t("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"primary"},on:{click:e.handleSearch}},[e._v("查询")])],1),t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData,border:""},on:{"selection-change":e.handleSelectionChange}},[t("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),t("el-table-column",{attrs:{prop:"shopId",label:"店铺ID",align:"center"}}),t("el-table-column",{attrs:{prop:"shopName",label:"店铺名称",align:"center"}}),t("el-table-column",{attrs:{prop:"sendAddress",label:"店铺地址",align:"center"}})],1),t("el-pagination",{staticClass:"mt-10",attrs:{"current-page":e.pagination.currentPage,"page-sizes":[10,20,30,50],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("提交")])],1)],1)},L=[];function Q(e){return new Promise((t,a)=>{Object(c["a"])({url:"/roleShop.listRoleShop",method:"get",params:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function U(e){return new Promise((t,a)=>{Object(c["a"])({url:"/org.listOrgNoShops",method:"get",params:{...e}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function X(e){return new Promise((t,a)=>{Object(c["a"])({url:"/roleShop.saveRoleShop",method:"post",data:{...e}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function Y(e){return new Promise((t,a)=>{Object(c["a"])({url:"/roleShop.deleteRoleShop",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}var Z={name:"AddRoleShop",data(){return{dialogVisible:!1,searchForm:{shopName:""},tableData:[],selectedShops:[],formData:{roleId:"",shops:[]},pagination:{currentPage:1,pageSize:10,total:0}}},methods:{open(e){this.formData.roleId=e.roleId,this.dialogVisible=!0,this.loadShops()},async loadShops(){try{const e={page:this.pagination.currentPage,row:this.pagination.pageSize,name:this.searchForm.shopName,roleId:this.formData.roleId},t=await U(e);this.tableData=t.data,this.pagination.total=t.records}catch(e){console.error("获取店铺列表失败:",e)}},handleSearch(){this.pagination.currentPage=1,this.loadShops()},handleSelectionChange(e){this.selectedShops=e},handleSizeChange(e){this.pagination.pageSize=e,this.loadShops()},handleCurrentChange(e){this.pagination.currentPage=e,this.loadShops()},async handleSubmit(){if(0!==this.selectedShops.length)try{const e={roleId:this.formData.roleId,communitys:this.selectedShops.map(e=>({communityId:e.shopId,communityName:e.shopName}))},t=await X(e);0===t.code?(this.$message.success("关联成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(t.msg)}catch(e){console.error("关联店铺失败:",e),this.$message.error("关联店铺失败")}else this.$message.warning("请选择店铺")},handleClose(){this.searchForm.shopName="",this.selectedShops=[],this.pagination.currentPage=1}}},ee=Z,te=(a("a5ed"),Object(b["a"])(ee,H,L,!1,null,"0ec428ab",null)),ae=te.exports,oe=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"请确认您的操作",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"confirm-content"},[t("p",[e._v("确定取消授权吗?")])]),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("点错了")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleConfirm}},[e._v("确认删除")])],1)])},se=[],ie={name:"DeleteRoleShop",data(){return{dialogVisible:!1,formData:{roleId:"",rcId:"",shopId:""}}},methods:{open(e){this.formData={roleId:e.roleId,rcId:e.rcId,shopId:e.shopId},this.dialogVisible=!0},async handleConfirm(){try{const e=await Y(this.formData);0===e.code?(this.$message.success("删除成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(e.msg)}catch(e){console.error("删除店铺授权失败:",e),this.$message.error("删除店铺授权失败")}},handleClose(){this.formData={roleId:"",shopId:""}}}},re=ie,le=(a("57f9"),Object(b["a"])(re,oe,se,!1,null,"aeda4328",null)),ne=le.exports,ce={name:"RoleShop",components:{AddRoleShop:ae,DeleteRoleShop:ne},data(){return{roleShopInfo:{roleShops:[],pgId:""},pagination:{currentPage:1,pageSize:10,total:0}}},methods:{openRoleShop(e){this.roleShopInfo.pgId=e.pgId,this.loadRoleShops()},async loadRoleShops(){try{const e={page:this.pagination.currentPage,row:this.pagination.pageSize,roleId:this.roleShopInfo.pgId},t=await Q(e);this.roleShopInfo.roleShops=t.data,this.pagination.total=t.records}catch(e){console.error("获取店铺列表失败:",e)}},openAddModal(){this.$refs.addRoleShop.open({roleId:this.roleShopInfo.pgId})},openDeleteModal(e){this.$refs.deleteRoleShop.open(e)},handleSizeChange(e){this.pagination.pageSize=e,this.loadRoleShops()},handleCurrentChange(e){this.pagination.currentPage=e,this.loadRoleShops()}}},de=ce,he=(a("4341"),Object(b["a"])(de,W,B,!1,null,"4e96408b",null)),pe=he.exports,fe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"margin-top"},[t("el-row",{staticClass:"mb-10",attrs:{gutter:20}},[t("el-col",{attrs:{span:6}},[t("el-input",{attrs:{placeholder:"请填写员工名称",clearable:""},model:{value:e.searchForm.staffName,callback:function(t){e.$set(e.searchForm,"staffName",t)},expression:"searchForm.staffName"}})],1),t("el-col",{attrs:{span:10}},[t("el-button",{attrs:{type:"primary"},on:{click:e.handleSearch}},[t("i",{staticClass:"el-icon-search"}),e._v("查询 ")]),t("el-button",{attrs:{type:"primary"},on:{click:e.openAddModal}},[t("i",{staticClass:"el-icon-plus"}),e._v("关联员工 ")])],1)],1),t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData,border:""}},[t("el-table-column",{attrs:{prop:"name",label:"名称",align:"center"}}),t("el-table-column",{attrs:{prop:"tel",label:"手机号",align:"center"}}),t("el-table-column",{attrs:{prop:"email",label:"邮箱",align:"center"}}),t("el-table-column",{attrs:{prop:"address",label:"地址",align:"center"}}),t("el-table-column",{attrs:{prop:"sex",label:"性别",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(" "+e._s(0===t.row.sex?"男":"女")+" ")]}}])}),t("el-table-column",{attrs:{label:"操作",align:"center",width:"180"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(t){return e.openDeleteModal(a.row)}}},[e._v("删除")]),t("el-button",{attrs:{size:"mini",type:"text"},on:{click:function(t){return e.toStaffDetail(a.row)}}},[e._v("详情")])]}}])})],1),t("el-pagination",{staticClass:"mt-10",attrs:{"current-page":e.pagination.currentPage,"page-sizes":[10,20,30,50],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),t("add-role-staff",{ref:"addRoleStaff",on:{refresh:e.loadStaffs}}),t("delete-role-staff",{ref:"deleteRoleStaff",on:{refresh:e.loadStaffs}})],1)},ue=[],ge=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"员工",visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"search-container mb-10"},[t("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:"输入员工名称",clearable:""},model:{value:e.searchForm.staffName,callback:function(t){e.$set(e.searchForm,"staffName",t)},expression:"searchForm.staffName"}}),t("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"primary"},on:{click:e.handleSearch}},[e._v("查询")])],1),t("el-table",{staticStyle:{width:"100%"},attrs:{data:e.tableData,border:""},on:{"selection-change":e.handleSelectionChange}},[t("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),t("el-table-column",{attrs:{prop:"userId",label:"员工编号",align:"center"}}),t("el-table-column",{attrs:{prop:"name",label:"员工名称",align:"center"}}),t("el-table-column",{attrs:{prop:"address",label:"员工地址",align:"center"}})],1),t("el-pagination",{staticClass:"mt-10",attrs:{"current-page":e.pagination.currentPage,"page-sizes":[10,20,30,50],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("提交")])],1)],1)},me=[];function be(e){return new Promise((t,a)=>{Object(c["a"])({url:"/role.listRoleStaff",method:"get",params:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function ve(e){return new Promise((t,a)=>{Object(c["a"])({url:"/role.listStaffsNoRole",method:"get",params:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function Ie(e){return new Promise((t,a)=>{Object(c["a"])({url:"/role.saveRoleStaff",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}function Se(e){return new Promise((t,a)=>{Object(c["a"])({url:"/role.deleteRoleStaff",method:"post",data:{...e,shopId:Object(d["f"])()}}).then(e=>{const a=e.data;t(a)}).catch(e=>{a(e)})})}var ye={name:"AddRoleStaff",data(){return{dialogVisible:!1,searchForm:{staffName:""},tableData:[],selectedStaffs:[],formData:{roleId:"",staffs:[]},pagination:{currentPage:1,pageSize:10,total:0}}},methods:{open(e){this.formData.roleId=e.roleId,this.dialogVisible=!0,this.loadStaffs()},async loadStaffs(){try{const e={page:this.pagination.currentPage,row:this.pagination.pageSize,userName:this.searchForm.staffName,roleId:this.formData.roleId},t=await ve(e);this.tableData=t.data,this.pagination.total=t.records}catch(e){console.error("获取员工列表失败:",e)}},handleSearch(){this.pagination.currentPage=1,this.loadStaffs()},handleSelectionChange(e){this.selectedStaffs=e},handleSizeChange(e){this.pagination.pageSize=e,this.loadStaffs()},handleCurrentChange(e){this.pagination.currentPage=e,this.loadStaffs()},async handleSubmit(){if(0!==this.selectedStaffs.length)try{const e={roleId:this.formData.roleId,staffs:this.selectedStaffs.map(e=>({staffId:e.userId,staffName:e.name}))},t=await Ie(e);0===t.code?(this.$message.success("关联成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(t.msg)}catch(e){console.error("关联员工失败:",e),this.$message.error("关联员工失败")}else this.$message.warning("请选择员工")},handleClose(){this.searchForm.staffName="",this.selectedStaffs=[],this.pagination.currentPage=1}}},Ce=ye,_e=(a("bec4"),Object(b["a"])(Ce,ge,me,!1,null,"571204d9",null)),we=_e.exports,Re=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"请确认您的操作",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.handleClose}},[t("div",{staticClass:"confirm-content"},[t("p",[e._v("确定取消员工授权吗?")])]),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("点错了")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleConfirm}},[e._v("确认删除")])],1)])},ke=[],De={name:"DeleteRoleStaff",data(){return{dialogVisible:!1,formData:{roleId:"",staffId:"",userId:""}}},methods:{open(e){this.formData={roleId:e.roleId,staffId:e.userId,userId:e.userId},this.dialogVisible=!0},async handleConfirm(){try{const e=await Se(this.formData);0===e.code?(this.$message.success("删除成功"),this.dialogVisible=!1,this.$emit("refresh")):this.$message.error(e.msg)}catch(e){console.error("删除员工授权失败:",e),this.$message.error("删除员工授权失败")}},handleClose(){this.formData={roleId:"",staffId:"",userId:""}}}},Pe=De,xe=(a("8d2c"),Object(b["a"])(Pe,Re,ke,!1,null,"1aa28834",null)),$e=xe.exports,ze={name:"RoleStaff",components:{AddRoleStaff:we,DeleteRoleStaff:$e},data(){return{searchForm:{staffName:""},tableData:[],pagination:{currentPage:1,pageSize:10,total:0},roleId:""}},methods:{openRoleStaff(e){this.roleId=e.pgId,this.loadStaffs()},async loadStaffs(){try{const e={page:this.pagination.currentPage,row:this.pagination.pageSize,roleId:this.roleId,userName:this.searchForm.staffName},t=await be(e);this.tableData=t.data,this.pagination.total=t.records}catch(e){console.error("获取员工列表失败:",e)}},handleSearch(){this.pagination.currentPage=1,this.loadStaffs()},openAddModal(){this.$refs.addRoleStaff.open({roleId:this.roleId})},openDeleteModal(e){this.$refs.deleteRoleStaff.open({...e,roleId:this.roleId})},toStaffDetail(e){this.$router.push("/pages/frame/staffDetail?staffId="+e.userId)},handleSizeChange(e){this.pagination.pageSize=e,this.loadStaffs()},handleCurrentChange(e){this.pagination.currentPage=e,this.loadStaffs()}}},je=ze,Ve=(a("66d54"),Object(b["a"])(je,fe,ue,!1,null,"75e48890",null)),Oe=Ve.exports,Ne={name:"Role",components:{RoleDiv:N,PrivilegeTree:J,RoleShop:pe,RoleStaff:Oe},data(){return{roleInfo:{curRole:{},tabName:"privilege"}}},methods:{handleSwitchRole(e){this.roleInfo.curRole=e,this.changeRoleTab("privilege")},changeRoleTab(e){this.roleInfo.tabName=e,setTimeout(()=>{"privilege"===e||("shop"===e?this.$refs.roleShop.openRoleShop({pgId:this.roleInfo.curRole.pgId}):"staff"===e&&this.$refs.roleStaff.openRoleStaff({pgId:this.roleInfo.curRole.pgId}))},100)}}},Ge=Ne,Fe=(a("5c29"),Object(b["a"])(Ge,o,s,!1,null,"06a547f8",null));t["default"]=Fe.exports},dc70:function(e,t,a){"use strict";a("15d5")},e070:function(e,t,a){}}]);
//# sourceMappingURL=chunk-6263ee30.bd8687aa.js.map