@pangu-backend-ui/user-core 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k["pg-user-core"]={},k.Vue,k.pinia,k.common))})(this,function(k,e,j,z){"use strict";const O={key:0,class:"container"},q=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(d){const n=d,o=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function p(){o.value.plainMobile==null&&(o.value.loading=!0,i==null||i.get(`/api/user/${n.userId}/plainmobile`).then(a=>{o.value.plainMobile=a.data,o.value.loading=!1}).finally(()=>{o.value.loading=!1}))}return(a,_)=>{const r=e.resolveComponent("View"),V=e.resolveComponent("el-icon"),c=e.resolveComponent("Loading");return n.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",O,[o.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(n.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.value.plainMobile),1)],64)),o.value.plainMobile==null&&!o.value.loading&&n.userId!=null?(e.openBlock(),e.createBlock(V,{key:2,class:"view-icon",onClick:p},{default:e.withCtx(()=>[e.createVNode(r)]),_:1})):e.createCommentVNode("",!0),o.value.loading?(e.openBlock(),e.createBlock(V,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(c)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),te="",U=(d,n)=>{const o=d.__vccOpts||d;for(const[i,p]of n)o[i]=p;return o},T=U(q,[["__scopeId","data-v-76c9c9ae"]]),M={install:d=>{d.component("PgUserMobile",T)}},Y=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(d){const n=d,o=e.ref({userId:n.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,_=>{_?(o.value.loginTimeStart=_[0],o.value.loginTimeEnd=_[1]):(o.value.loginTimeStart=null,o.value.loginTimeEnd=null)});const p=e.ref();function a(){p.value.search()}return(_,r)=>{const V=e.resolveComponent("el-date-picker"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-table-column"),m=e.resolveComponent("el-tag"),C=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:a},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(C,{ref_key:"historiesTable",ref:p,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:o.value},{columns:e.withCtx(()=>[e.createVNode(h,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:s})=>[s.method==="SMS"?(e.openBlock(),e.createBlock(m,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),s.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(m,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),s.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(m,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),s.method==="PASSWORD"?(e.openBlock(),e.createBlock(m,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(h,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),B=j.defineStore("pg-user-core-config-store",()=>{const d=[];return d.push({name:"登录历史",code:"LOGIN_HISTORY",component:Y}),{userDetailDialogTabs:e.computed(()=>d)}}),$=e.defineComponent({__name:"AddBlacklistComp",props:{hiddenEntranceSlot:{type:Boolean,default:!1},userId:{type:Number,required:!0}},emits:["success"],setup(d,{expose:n,emit:o}){const i=d,p=e.inject("http"),a=e.ref(!1);let _=e.ref(null);function r(t){a.value=!0,_.value=t??i.userId,t&&h(_.value)}const V=e.ref({description:[{required:!0,message:"请输入加入黑名单的说明"}],unlockTime:[{required:!0,message:"解锁时间不能为空"}]}),c=e.ref({userId:null,unlockTime:null,permissions:[],description:null}),b=e.ref();function h(t){p==null||p.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then(l=>{var N,x,f,y,D;(N=l.data)!=null&&N.info&&((x=l.data)!=null&&x.info.allowPermissionCodes&&(c.value.permissions=JSON.parse((f=l.data)==null?void 0:f.info.allowPermissionCodes)),c.value.userId=(y=l.data)==null?void 0:y.info.userId,c.value.unlockTime=l.data.info.unlockTime,c.value.description=l.data.info.description),b.value=(D=l.data)==null?void 0:D.permissionCodes})}const m=e.ref();function C(){var t;(t=m.value)==null||t.resetFields()}function s(){var t;(t=m.value)==null||t.validate((l,N)=>{l&&(p==null||p.post(`/api/user/${_.value}/blacklist`,c.value).then(x=>{a.value=!1,o("success")}))})}const w=[{text:"三天",value:()=>{const t=new Date;return t.setDate(t.getDate()+3),t}},{text:"七天",value:()=>{const t=new Date;return t.setDate(t.getDate()+7),t}},{text:"十五天",value:()=>{const t=new Date;return t.setDate(t.getDate()+15),t}},{text:"一个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+1),t}},{text:"三个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+3),t}},{text:"六个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+6),t}},{text:"永久",value:()=>{const t=new Date;return t.setFullYear(t.getFullYear()+100),t}}];return n({show:r}),(t,l)=>{const N=e.resolveComponent("el-button"),x=e.resolveComponent("el-date-picker"),f=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-checkbox"),D=e.resolveComponent("el-checkbox-group"),S=e.resolveComponent("el-input"),I=e.resolveComponent("el-form"),u=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[i.hiddenEntranceSlot?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[e.createVNode(N,{icon:"lock",type:"warning",onClick:l[0]||(l[0]=g=>r())},{default:e.withCtx(()=>[e.createTextVNode("加入黑名单")]),_:1})]),e.createVNode(u,{modelValue:a.value,"onUpdate:modelValue":l[4]||(l[4]=g=>a.value=g),onClosed:C,title:"黑名单管理",width:"500"},{footer:e.withCtx(()=>[e.createVNode(N,{type:"primary",onClick:s},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(I,{ref_key:"form",ref:m,"label-position":"top",rules:V.value,model:c.value},{default:e.withCtx(()=>[e.createVNode(f,{label:"解锁时间",prop:"unlockTime"},{default:e.withCtx(()=>[e.createVNode(x,{type:"datetime",shortcuts:w,modelValue:c.value.unlockTime,"onUpdate:modelValue":l[1]||(l[1]=g=>c.value.unlockTime=g)},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"允许权限",prop:"allowPermissionCodes"},{default:e.withCtx(()=>[e.createVNode(D,{modelValue:c.value.permissions,"onUpdate:modelValue":l[2]||(l[2]=g=>c.value.permissions=g)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(g,R)=>(e.openBlock(),e.createBlock(y,{label:R,key:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"描述",prop:"description"},{default:e.withCtx(()=>[e.createVNode(S,{type:"textarea",modelValue:c.value.description,"onUpdate:modelValue":l[3]||(l[3]=g=>c.value.description=g)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])],64)}}}),L=e.defineComponent({__name:"UserDetailDialog",setup(d,{expose:n}){const o=B(),i=e.inject("http"),p=e.ref(!1),a=e.ref(),_=e.ref(),r=e.ref({activeName:o.userDetailDialogTabs[0].code,tabs:[]}),V=e.ref(!1);function c(w,t,l){V.value=!0,b(w),t&&(r.value.activeName=t),r.value.tabs.length=0,r.value.tabs=r.value.tabs.concat(o.userDetailDialogTabs),l&&(r.value.tabs=r.value.tabs.concat(l))}function b(w){i==null||i.get(`/api/user/${w}`).then(t=>{a.value=t.data,V.value=!1,p.value=!0,a.value.inBlacklist&&h(w)})}function h(w){i==null||i.get(`/api/user/${w}/blacklist`).then(t=>{_.value=t.data})}const m=e.ref();function C(){m.value.show(a.value.id)}function s(){a.value=null,_.value=null}return n({show:c}),(w,t)=>{const l=e.resolveComponent("el-descriptions-item"),N=e.resolveComponent("el-tag"),x=e.resolveComponent("el-descriptions"),f=e.resolveComponent("el-tab-pane"),y=e.resolveComponent("el-tabs"),D=e.resolveComponent("el-button"),S=e.resolveComponent("el-dialog"),I=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives((e.openBlock(),e.createBlock(S,{modelValue:p.value,"onUpdate:modelValue":t[1]||(t[1]=u=>p.value=u),title:"用户详情",width:"1300",onClosed:s},{footer:e.withCtx(()=>[e.createVNode(D,{icon:"lock",type:"warning",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"修改":"加入")+"黑名单",1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(x,{border:""},{default:e.withCtx(()=>[e.createVNode(l,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.id),1)]),_:1}),e.createVNode(l,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.nickname),1)]),_:1}),e.createVNode(l,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":a.value.mobile,"user-id":a.value.id,key:a.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(l,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inviteCode),1)]),_:1}),e.createVNode(l,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.touchTime),1)]),_:1}),e.createVNode(l,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.lastLoginTime),1)]),_:1}),e.createVNode(l,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.updatedTime),1)]),_:1}),e.createVNode(l,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.parentId),1)]),_:1}),e.createVNode(l,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(N,{type:a.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(l,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.relationPath),1)]),_:1})]),_:1}),_.value?(e.openBlock(),e.createBlock(x,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(l,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.unlockTime),1)]),_:1}),e.createVNode(l,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.allowPermissionCodes?JSON.parse(_.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(l,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(y,{modelValue:r.value.activeName,"onUpdate:modelValue":t[0]||(t[0]=u=>r.value.activeName=u),key:`usr_tab_${a.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value.tabs,(u,g)=>(e.openBlock(),e.createBlock(f,{label:u.name,name:u.code,key:`user_detail_dialog_${u.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[r.value.activeName==u.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.component),{key:`ud_tab_${u.code}`,userId:a.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))]),_:1},8,["modelValue"])),[[I,V.value]]),e.createVNode($,{ref_key:"addBlacklistComp",ref:m,onSuccess:t[2]||(t[2]=u=>b(a.value.id)),"hidden-entrance-slot":""},null,512)],64)}}}),E={install:d=>{d.component("PgUserDetailDialog",L)}},P=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(d,{emit:n}){const o=d,i=e.inject("http"),p=e.ref(o.modelValue);e.watch(p,c=>{n("update:modelValue",c)});const a=e.ref(!1),_=e.ref([]);let r=null;function V(c){c&&(a.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{i==null||i.get("/api/user/keyword-search",{keyword:c,pageSize:o.pageSize}).then(b=>{_.value=b.data}).finally(()=>{a.value=!1})},200))}return(c,b)=>{const h=e.resolveComponent("el-option"),m=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(m,{modelValue:p.value,"onUpdate:modelValue":b[0]||(b[0]=C=>p.value=C),filterable:"",remote:"",loading:a.value,"remote-method":V},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,C=>(e.openBlock(),e.createBlock(h,{key:C.id,value:C.id,label:`${C.id} / ${C.nickname} / ${C.mobile} / ${C.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default",{user:C},()=>[e.createTextVNode(e.toDisplayString(C.id)+" / "+e.toDisplayString(C.nickname)+" / "+e.toDisplayString(C.mobile)+" / "+e.toDisplayString(C.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),F={install:d=>{d.component("PgUserSelector",P)}},H=[M,E,F],J=d=>(e.pushScopeId("data-v-391c43be"),d=d(),e.popScopeId(),d),G={class:"page-layout"},K={style:{"margin-top":"10px"}},W=J(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),Q=e.defineComponent({__name:"list",setup(d){const n=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),o=e.ref(null);function i(){o.value.search()}const p=e.ref();function a(_){p.value.show(_.id)}return(_,r)=>{const V=e.resolveComponent("el-input"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-card"),m=e.resolveComponent("el-table-column"),C=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",G,[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:n.value.id,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value.id=s),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.parentId,"onUpdate:modelValue":r[1]||(r[1]=s=>n.value.parentId=s),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.phone,"onUpdate:modelValue":r[2]||(r[2]=s=>n.value.phone=s),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.nicekname,"onUpdate:modelValue":r[3]||(r[3]=s=>n.value.nicekname=s),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.inviteCode,"onUpdate:modelValue":r[4]||(r[4]=s=>n.value.inviteCode=s),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",K,[e.createVNode(e.unref(z.PgTable),{ref_key:"userTable",ref:o,"data-url":"/api/user/page",condition:n.value,onRowDbClick:r[5]||(r[5]=s=>a(s))},{columns:e.withCtx(()=>[e.createVNode(m,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(m,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(s=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":s.row.mobile,"user-id":s.row.id,key:s.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(m,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(s=>[e.createVNode(C,{fit:"cover",size:30,src:s.row.avatar,"preview-teleported":"","preview-src-list":[s.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(m,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[W]),_:1})]),_:1},8,["condition"])])]),e.createVNode(L,{ref_key:"userDetailDialog",ref:p},null,512)],64)}}}),oe="",X=U(Q,[["__scopeId","data-v-391c43be"]]),Z=e.defineComponent({__name:"BlackListView",setup(d){const n=e.inject("http"),o=e.ref({userId:null,status:"VALID"}),i=e.ref();function p(){i.value.search()}function a(V){n==null||n.post(`/api/user/blacklist/${V}/unlock`).then(c=>{p()})}const _=e.ref();function r(V){_.value.show(V)}return(V,c)=>{const b=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),m=e.resolveComponent("el-button"),C=e.resolveComponent("el-space"),s=e.resolveComponent("el-card"),w=e.resolveComponent("el-table-column"),t=e.resolveComponent("el-link"),l=e.resolveComponent("el-tag"),N=e.resolveComponent("el-popconfirm"),x=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(s,null,{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(P,{modelValue:o.value.userId,"onUpdate:modelValue":c[0]||(c[0]=f=>o.value.userId=f),clearable:"",style:{width:"300px"}},null,8,["modelValue"]),e.createVNode(h,{placeholder:"状态",modelValue:o.value.status,"onUpdate:modelValue":c[1]||(c[1]=f=>o.value.status=f),clearable:"",style:{width:"100px"}},{default:e.withCtx(()=>[e.createVNode(b,{value:"VALID",label:"有效"}),e.createVNode(b,{value:"INVALID",label:"失效"})]),_:1},8,["modelValue"]),e.createVNode(m,{icon:"search",type:"primary",onClick:p},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createVNode(x,{ref_key:"table",ref:i,"data-url":"/api/user/blacklist",condition:o.value,style:{"margin-top":"10px"}},{columns:e.withCtx(()=>[e.createVNode(w,{label:"ID",prop:"id",width:"100"}),e.createVNode(w,{label:"用户信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"用户ID",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(t,{type:"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.userId),1)]),_:2},1024)]),_:1}),e.createVNode(w,{label:"手机号",width:"150"},{default:e.withCtx(({row:f})=>[e.createVNode(T,{"user-id":f.userId,"mask-mobile":f.userMobile},null,8,["user-id","mask-mobile"])]),_:1}),e.createVNode(w,{label:"用户昵称",prop:"userNickname"})]),_:1}),e.createVNode(w,{label:"限制信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"描述",prop:"description"}),e.createVNode(w,{label:"允许权限",prop:"allowPermissionCodes","show-overflow-tooltip":""}),e.createVNode(w,{label:"状态",prop:"status",align:"center",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(l,{type:f.status=="VALID"?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.status=="VALID"?"有效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(w,{label:"加入时间",prop:"createdTime",width:"170"}),e.createVNode(w,{label:"解锁时间",prop:"unlockTime",width:"170"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(({row:f})=>[f.status=="VALID"?(e.openBlock(),e.createBlock(N,{key:0,title:"确定要解锁吗?",onConfirm:a},{reference:e.withCtx(()=>[e.createVNode(m,{type:"warning",icon:"unlock"},{default:e.withCtx(()=>[e.createTextVNode("解锁")]),_:1})]),_:1})):e.createCommentVNode("",!0),f.status=="VALID"?(e.openBlock(),e.createBlock(m,{key:1,icon:"edit",onClick:y=>r(f.userId)},{default:e.withCtx(()=>[e.createTextVNode("编辑")]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"]),e.createVNode($,{ref_key:"addBlacklistComp",ref:_,onSuccess:p,"hidden-entrance-slot":""},null,512)],64)}}}),v={install:(d,n)=>{let o=n.router,i=o.getRoutes().find(p=>p.path=="/");i&&i.meta&&o.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:X},{path:"blacklist",name:"BlackListView",component:Z}]})}},A=(d,n)=>{const o=B();if(n.userDetailDialogTabs&&n.userDetailDialogTabs.length)for(let i of n.userDetailDialogTabs)o.userDetailDialogTabs.push(i);H.forEach(i=>d.use(i)),d.use(v,n)},ee={install:A};k.UserDetailDialog=E,k.UserMobileComp=M,k.UserSelectComp=F,k.default=ee,k.install=A,k.useUserCoreConfigStore=B,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b["pg-user-core"]={},b.Vue,b.pinia,b.common))})(this,function(b,e,O,j){"use strict";const z={key:0,class:"container"},q=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(s){const n=s,a=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function d(){a.value.plainMobile==null&&(a.value.loading=!0,i==null||i.get(`/api/user/${n.userId}/plainmobile`).then(l=>{a.value.plainMobile=l.data,a.value.loading=!1}).finally(()=>{a.value.loading=!1}))}return(l,_)=>{const r=e.resolveComponent("View"),h=e.resolveComponent("el-icon"),p=e.resolveComponent("Loading");return n.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",z,[a.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(n.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a.value.plainMobile),1)],64)),a.value.plainMobile==null&&!a.value.loading&&n.userId!=null?(e.openBlock(),e.createBlock(h,{key:2,class:"view-icon",onClick:d},{default:e.withCtx(()=>[e.createVNode(r)]),_:1})):e.createCommentVNode("",!0),a.value.loading?(e.openBlock(),e.createBlock(h,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(p)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),oe="",$=(s,n)=>{const a=s.__vccOpts||s;for(const[i,d]of n)a[i]=d;return a},B=$(q,[["__scopeId","data-v-76c9c9ae"]]),M={install:s=>{s.component("PgUserMobile",B)}},K=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(s){const n=s,a=e.ref({userId:n.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,_=>{_?(a.value.loginTimeStart=_[0],a.value.loginTimeEnd=_[1]):(a.value.loginTimeStart=null,a.value.loginTimeEnd=null)});const d=e.ref();function l(){d.value.search()}return(_,r)=>{const h=e.resolveComponent("el-date-picker"),p=e.resolveComponent("el-button"),V=e.resolveComponent("el-space"),w=e.resolveComponent("el-table-column"),m=e.resolveComponent("el-tag"),f=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(h,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=c=>i.value=c),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(p,{type:"primary",icon:"search",onClick:l},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(f,{ref_key:"historiesTable",ref:d,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:a.value},{columns:e.withCtx(()=>[e.createVNode(w,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(w,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(w,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(w,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:c})=>[c.method==="SMS"?(e.openBlock(),e.createBlock(m,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),c.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(m,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),c.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(m,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),c.method==="PASSWORD"?(e.openBlock(),e.createBlock(m,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(w,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(w,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(w,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),S=O.defineStore("pg-user-core-config-store",()=>{const s=[];return s.push({name:"登录历史",code:"LOGIN_HISTORY",component:e.shallowRef(K)}),{userDetailDialogTabs:e.computed(()=>s)}}),E=e.defineComponent({__name:"AddBlacklistComp",props:{hiddenEntranceSlot:{type:Boolean,default:!1},userId:{type:Number,required:!1}},emits:["success"],setup(s,{expose:n,emit:a}){const i=s,d=e.inject("http"),l=e.ref(!1);let _=e.ref(null);function r(t){l.value=!0;const o=t??i.userId;if(!o)throw Error("未设置用户ID");_.value=o,w(_.value)}const h=e.ref({description:[{required:!0,message:"请输入加入黑名单的说明"}],unlockTime:[{required:!0,message:"解锁时间不能为空"}]}),p=e.ref({userId:null,unlockTime:null,permissions:[],description:null}),V=e.ref();function w(t){d==null||d.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then(o=>{var u,N,x,y,D;(u=o.data)!=null&&u.info&&((N=o.data)!=null&&N.info.allowPermissionCodes&&(p.value.permissions=JSON.parse((x=o.data)==null?void 0:x.info.allowPermissionCodes)),p.value.userId=(y=o.data)==null?void 0:y.info.userId,p.value.unlockTime=o.data.info.unlockTime,p.value.description=o.data.info.description),V.value=(D=o.data)==null?void 0:D.permissionCodes})}const m=e.ref();function f(){var t;(t=m.value)==null||t.resetFields()}function c(){var t;(t=m.value)==null||t.validate((o,u)=>{o&&(d==null||d.post(`/api/user/${_.value}/blacklist`,p.value).then(N=>{l.value=!1,a("success")}))})}const g=[{text:"三天",value:()=>{const t=new Date;return t.setDate(t.getDate()+3),t}},{text:"七天",value:()=>{const t=new Date;return t.setDate(t.getDate()+7),t}},{text:"十五天",value:()=>{const t=new Date;return t.setDate(t.getDate()+15),t}},{text:"一个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+1),t}},{text:"三个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+3),t}},{text:"六个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+6),t}},{text:"永久",value:()=>{const t=new Date;return t.setFullYear(t.getFullYear()+100),t}}];return n({show:r}),(t,o)=>{const u=e.resolveComponent("el-button"),N=e.resolveComponent("el-date-picker"),x=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-checkbox"),D=e.resolveComponent("el-checkbox-group"),k=e.resolveComponent("el-input"),T=e.resolveComponent("el-form"),U=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[i.hiddenEntranceSlot?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[e.createVNode(u,{icon:"lock",type:"warning",onClick:o[0]||(o[0]=C=>r())},{default:e.withCtx(()=>[e.createTextVNode("加入黑名单")]),_:1})]),e.createVNode(U,{modelValue:l.value,"onUpdate:modelValue":o[4]||(o[4]=C=>l.value=C),onClosed:f,title:"黑名单管理",width:"500"},{footer:e.withCtx(()=>[e.createVNode(u,{type:"primary",onClick:c},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(T,{ref_key:"form",ref:m,"label-position":"top",rules:h.value,model:p.value},{default:e.withCtx(()=>[e.createVNode(x,{label:"解锁时间",prop:"unlockTime"},{default:e.withCtx(()=>[e.createVNode(N,{type:"datetime",shortcuts:g,modelValue:p.value.unlockTime,"onUpdate:modelValue":o[1]||(o[1]=C=>p.value.unlockTime=C)},null,8,["modelValue"])]),_:1}),e.createVNode(x,{label:"允许权限",prop:"allowPermissionCodes"},{default:e.withCtx(()=>[e.createVNode(D,{modelValue:p.value.permissions,"onUpdate:modelValue":o[2]||(o[2]=C=>p.value.permissions=C)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,(C,L)=>(e.openBlock(),e.createBlock(y,{label:L,key:L},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(x,{label:"描述",prop:"description"},{default:e.withCtx(()=>[e.createVNode(k,{type:"textarea",modelValue:p.value.description,"onUpdate:modelValue":o[3]||(o[3]=C=>p.value.description=C)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])],64)}}}),Y={key:0},I=e.defineComponent({__name:"UserDetailDialog",setup(s,{expose:n}){const a=S(),i=e.inject("http"),d=e.ref(!1),l=e.ref(),_=e.ref(),r=e.ref({activeName:a.userDetailDialogTabs[0].code,tabs:[]}),h=e.ref(!1);function p(g,t,o){h.value=!0,V(g),t&&(r.value.activeName=t),r.value.tabs.length=0,r.value.tabs=r.value.tabs.concat(a.userDetailDialogTabs),o&&(r.value.tabs=r.value.tabs.concat(o))}function V(g){i==null||i.get(`/api/user/${g}`).then(t=>{l.value=t.data,h.value=!1,d.value=!0,l.value.inBlacklist&&w(g)})}function w(g){i==null||i.get(`/api/user/${g}/blacklist`).then(t=>{_.value=t.data})}const m=e.ref();function f(){m.value.show(l.value.id)}function c(){l.value=null,_.value=null}return n({show:p}),(g,t)=>{const o=e.resolveComponent("el-descriptions-item"),u=e.resolveComponent("el-tag"),N=e.resolveComponent("el-descriptions"),x=e.resolveComponent("el-tab-pane"),y=e.resolveComponent("el-tabs"),D=e.resolveComponent("el-button"),k=e.resolveComponent("el-dialog"),T=e.resolveDirective("loading"),U=e.resolveDirective("permission");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(k,{modelValue:d.value,"onUpdate:modelValue":t[1]||(t[1]=C=>d.value=C),title:"用户详情",width:"1300",onClosed:c},e.createSlots({default:e.withCtx(()=>[l.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(N,{border:""},{default:e.withCtx(()=>[e.createVNode(o,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.id),1)]),_:1}),e.createVNode(o,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.nickname),1)]),_:1}),e.createVNode(o,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(B,{"mask-mobile":l.value.mobile,"user-id":l.value.id,key:l.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(o,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.inviteCode),1)]),_:1}),e.createVNode(o,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.touchTime),1)]),_:1}),e.createVNode(o,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.createdTime),1)]),_:1}),e.createVNode(o,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.lastLoginTime),1)]),_:1}),e.createVNode(o,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.updatedTime),1)]),_:1}),e.createVNode(o,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.parentId),1)]),_:1}),e.createVNode(o,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(u,{type:l.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(o,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.relationPath),1)]),_:1})]),_:1}),_.value?(e.openBlock(),e.createBlock(N,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(o,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.unlockTime),1)]),_:1}),e.createVNode(o,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.createdTime),1)]),_:1}),e.createVNode(o,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.allowPermissionCodes?JSON.parse(_.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(o,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(y,{modelValue:r.value.activeName,"onUpdate:modelValue":t[0]||(t[0]=C=>r.value.activeName=C),key:`usr_tab_${l.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value.tabs,(C,L)=>(e.openBlock(),e.createBlock(x,{label:C.name,name:C.code,key:`user_detail_dialog_${C.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[r.value.activeName==C.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C.component),{key:`ud_tab_${C.code}`,userId:l.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))])),[[T,h.value]]):e.createCommentVNode("",!0)]),_:2},[l.value?{name:"footer",fn:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(D,{icon:"lock",type:"warning",onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.inBlacklist?"修改":"加入")+"黑名单",1)]),_:1})),[[U,"ADD_TO_BLACKLIST"]])]),key:"0"}:void 0]),1032,["modelValue"]),e.createVNode(E,{ref_key:"addBlacklistComp",ref:m,onSuccess:t[2]||(t[2]=C=>V(l.value.id)),"hidden-entrance-slot":""},null,512)],64)}}}),P={install:s=>{s.component("PgUserDetailDialog",I)}},A=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(s,{emit:n}){const a=s,i=e.inject("http"),d=e.ref(a.modelValue);e.watch(d,p=>{n("update:modelValue",p)});const l=e.ref(!1),_=e.ref([]);let r=null;function h(p){p&&(l.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{i==null||i.get("/api/user/keyword-search",{keyword:p,pageSize:a.pageSize}).then(V=>{_.value=V.data}).finally(()=>{l.value=!1})},200))}return(p,V)=>{const w=e.resolveComponent("el-option"),m=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(m,{modelValue:d.value,"onUpdate:modelValue":V[0]||(V[0]=f=>d.value=f),filterable:"",remote:"",loading:l.value,"remote-method":h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,f=>(e.openBlock(),e.createBlock(w,{key:f.id,value:f.id,label:`${f.id} / ${f.nickname} / ${f.mobile} / ${f.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default",{user:f},()=>[e.createTextVNode(e.toDisplayString(f.id)+" / "+e.toDisplayString(f.nickname)+" / "+e.toDisplayString(f.mobile)+" / "+e.toDisplayString(f.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),F={install:s=>{s.component("PgUserSelector",A)}},H=[M,P,F],J=s=>(e.pushScopeId("data-v-391c43be"),s=s(),e.popScopeId(),s),G={class:"page-layout"},W={style:{"margin-top":"10px"}},Q=J(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),X=e.defineComponent({__name:"list",setup(s){const n=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),a=e.ref(null);function i(){a.value.search()}const d=e.ref();function l(_){d.value.show(_.id)}return(_,r)=>{const h=e.resolveComponent("el-input"),p=e.resolveComponent("el-button"),V=e.resolveComponent("el-space"),w=e.resolveComponent("el-card"),m=e.resolveComponent("el-table-column"),f=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",G,[e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(h,{modelValue:n.value.id,"onUpdate:modelValue":r[0]||(r[0]=c=>n.value.id=c),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(h,{modelValue:n.value.parentId,"onUpdate:modelValue":r[1]||(r[1]=c=>n.value.parentId=c),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(h,{modelValue:n.value.phone,"onUpdate:modelValue":r[2]||(r[2]=c=>n.value.phone=c),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(h,{modelValue:n.value.nicekname,"onUpdate:modelValue":r[3]||(r[3]=c=>n.value.nicekname=c),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(h,{modelValue:n.value.inviteCode,"onUpdate:modelValue":r[4]||(r[4]=c=>n.value.inviteCode=c),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(p,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",W,[e.createVNode(e.unref(j.PgTable),{ref_key:"userTable",ref:a,"data-url":"/api/user/page",condition:n.value,onRowDbClick:r[5]||(r[5]=c=>l(c))},{columns:e.withCtx(()=>[e.createVNode(m,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(m,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(c=>[(e.openBlock(),e.createBlock(B,{"mask-mobile":c.row.mobile,"user-id":c.row.id,key:c.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(m,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(c=>[e.createVNode(f,{fit:"cover",size:30,src:c.row.avatar,"preview-teleported":"","preview-src-list":[c.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(m,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[Q]),_:1})]),_:1},8,["condition"])])]),e.createVNode(I,{ref_key:"userDetailDialog",ref:d},null,512)],64)}}}),le="",Z=$(X,[["__scopeId","data-v-391c43be"]]),v=e.defineComponent({__name:"BlackListView",setup(s){const n=e.inject("http"),a=e.ref({userId:null,status:"VALID"}),i=e.ref();function d(){i.value.search()}function l(V){n==null||n.post(`/api/user/blacklist/${V}/unlock`).then(w=>{d()})}const _=e.ref();function r(V){_.value.show(V)}const h=e.ref();function p(V){h.value.show(V)}return(V,w)=>{const m=e.resolveComponent("el-option"),f=e.resolveComponent("el-select"),c=e.resolveComponent("el-button"),g=e.resolveComponent("el-space"),t=e.resolveComponent("el-card"),o=e.resolveComponent("el-table-column"),u=e.resolveComponent("el-link"),N=e.resolveComponent("el-tag"),x=e.resolveComponent("el-popconfirm"),y=e.resolveComponent("pg-table"),D=e.resolveDirective("permission");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(A,{modelValue:a.value.userId,"onUpdate:modelValue":w[0]||(w[0]=k=>a.value.userId=k),clearable:"",style:{width:"300px"}},null,8,["modelValue"]),e.createVNode(f,{placeholder:"状态",modelValue:a.value.status,"onUpdate:modelValue":w[1]||(w[1]=k=>a.value.status=k),clearable:"",style:{width:"100px"}},{default:e.withCtx(()=>[e.createVNode(m,{value:"VALID",label:"有效"}),e.createVNode(m,{value:"INVALID",label:"失效"})]),_:1},8,["modelValue"]),e.createVNode(c,{icon:"search",type:"primary",onClick:d},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createVNode(y,{ref_key:"table",ref:i,"data-url":"/api/user/blacklist",condition:a.value,style:{"margin-top":"10px"}},{columns:e.withCtx(()=>[e.createVNode(o,{label:"ID",prop:"id",width:"100"}),e.createVNode(o,{label:"用户信息"},{default:e.withCtx(()=>[e.createVNode(o,{label:"用户ID",width:"100"},{default:e.withCtx(({row:k})=>[e.createVNode(u,{type:"primary",onClick:T=>p(k.userId)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.userId),1)]),_:2},1032,["onClick"])]),_:1}),e.createVNode(o,{label:"手机号",width:"150"},{default:e.withCtx(({row:k})=>[e.createVNode(B,{"user-id":k.userId,"mask-mobile":k.userMobile},null,8,["user-id","mask-mobile"])]),_:1}),e.createVNode(o,{label:"用户昵称",prop:"userNickname"})]),_:1}),e.createVNode(o,{label:"限制信息"},{default:e.withCtx(()=>[e.createVNode(o,{label:"描述",prop:"description"}),e.createVNode(o,{label:"允许权限",prop:"allowPermissionCodes","show-overflow-tooltip":""}),e.createVNode(o,{label:"状态",prop:"status",align:"center",width:"100"},{default:e.withCtx(({row:k})=>[e.createVNode(N,{type:k.status=="VALID"?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.status=="VALID"?"有效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(o,{label:"加入时间",prop:"createdTime",width:"170"}),e.createVNode(o,{label:"解锁时间",prop:"unlockTime",width:"170"})]),_:1}),e.createVNode(o,null,{default:e.withCtx(({row:k})=>[k.status=="VALID"&&V.$hasPer("BLACKLIST_UNLOCK")?(e.openBlock(),e.createBlock(x,{key:0,title:"确定要解锁吗?",onConfirm:l},{reference:e.withCtx(()=>[e.createVNode(c,{type:"warning",icon:"unlock"},{default:e.withCtx(()=>[e.createTextVNode("解锁")]),_:1})]),_:1})):e.createCommentVNode("",!0),k.status=="VALID"?e.withDirectives((e.openBlock(),e.createBlock(c,{key:1,icon:"edit",onClick:T=>r(k.userId)},{default:e.withCtx(()=>[e.createTextVNode("编辑")]),_:2},1032,["onClick"])),[[D,"ADD_TO_BLACKLIST"]]):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"]),e.createVNode(E,{ref_key:"addBlacklistComp",ref:_,onSuccess:d,"hidden-entrance-slot":""},null,512),e.createVNode(I,{ref_key:"userDetail",ref:h},null,512)],64)}}}),ee={install:(s,n)=>{let a=n.router,i=a.getRoutes().find(d=>d.path=="/");i&&i.meta&&a.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:Z},{path:"blacklist",name:"BlackListView",component:v}]})}},R=(s,n)=>{const a=S();if(n.userDetailDialogTabs&&n.userDetailDialogTabs.length)for(let i of n.userDetailDialogTabs)a.userDetailDialogTabs.push(i);H.forEach(i=>s.use(i)),s.use(ee,n)},te={install:R};b.UserDetailDialog=P,b.UserMobileComp=M,b.UserSelectComp=F,b.default=te,b.install=R,b.useUserCoreConfigStore=S,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pangu-backend-ui/user-core",
3
3
  "private": false,
4
- "version": "0.0.15",
4
+ "version": "0.0.17",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "unpkg": "index.umd.cjs",
@@ -21,7 +21,7 @@
21
21
  "vue": "^3.2.45",
22
22
  "vue-router": "^4.1.6",
23
23
  "pinia": "^2.0.28",
24
- "@pangu-backend-ui/common": "^0.0.18"
24
+ "@pangu-backend-ui/common": "^0.0.24"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public",
@@ -6,7 +6,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
6
6
  };
7
7
  userId: {
8
8
  type: NumberConstructor;
9
- required: true;
9
+ required: false;
10
10
  };
11
11
  }, {
12
12
  http: Http | undefined;
@@ -312,7 +312,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
312
312
  };
313
313
  userId: {
314
314
  type: NumberConstructor;
315
- required: true;
315
+ required: false;
316
316
  };
317
317
  }>> & {
318
318
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -17,127 +17,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
17
17
  tabs: {
18
18
  name: string;
19
19
  code: string;
20
- component: string | import("vue").FunctionalComponent<any, any> | {
21
- new (...args: any[]): any;
22
- __isFragment?: undefined;
23
- __isTeleport?: undefined;
24
- __isSuspense?: undefined;
25
- } | {
26
- [x: string]: any;
27
- setup?: ((this: void, props: Readonly<import("@vue/shared").LooseRequired<any>>, ctx: {
28
- attrs: {
29
- [x: string]: unknown;
30
- };
31
- slots: Readonly<{
32
- [name: string]: import("vue").Slot | undefined;
33
- }>;
34
- emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
35
- expose: (exposed?: Record<string, any> | undefined) => void;
36
- }) => any) | undefined;
37
- name?: string | undefined;
38
- template?: string | object | undefined;
39
- render?: Function | undefined;
40
- components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>> | undefined;
41
- directives?: Record<string, import("vue").Directive<any, any>> | undefined;
42
- inheritAttrs?: boolean | undefined;
43
- emits?: any;
44
- expose?: string[] | undefined;
45
- serverPrefetch?: (() => void | Promise<any>) | undefined;
46
- compilerOptions?: {
47
- isCustomElement?: ((tag: string) => boolean) | undefined;
48
- whitespace?: "preserve" | "condense" | undefined;
49
- comments?: boolean | undefined;
50
- delimiters?: [string, string] | undefined;
51
- } | undefined;
52
- call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
53
- __isFragment?: undefined;
54
- __isTeleport?: undefined;
55
- __isSuspense?: undefined;
56
- __defaults?: {} | undefined;
57
- compatConfig?: {
58
- GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
59
- GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
60
- GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
61
- GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
62
- GLOBAL_SET?: boolean | "suppress-warning" | undefined;
63
- GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
64
- GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
65
- GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
66
- CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
67
- CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
68
- CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
69
- CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
70
- CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
71
- CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
72
- CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
73
- INSTANCE_SET?: boolean | "suppress-warning" | undefined;
74
- INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
75
- INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
76
- INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
77
- INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
78
- INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
79
- INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
80
- INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
81
- INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
82
- OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
83
- OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
84
- OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
85
- OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
86
- WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
87
- PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
88
- V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
89
- CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
90
- ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
91
- ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
92
- TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
93
- TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
94
- COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
95
- COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
96
- COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
97
- RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
98
- FILTERS?: boolean | "suppress-warning" | undefined;
99
- PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
100
- MODE?: 2 | 3 | ((comp: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | null) => 2 | 3) | undefined;
101
- } | undefined;
102
- data?: ((this: any, vm: any) => any) | undefined;
103
- computed?: import("vue").ComputedOptions | undefined;
104
- methods?: import("vue").MethodOptions | undefined;
105
- watch?: {
106
- [x: string]: (string | import("vue").WatchCallback<any, any> | ({
107
- handler: string | import("vue").WatchCallback<any, any>;
108
- } & import("vue").WatchOptions<boolean>)) | (string | import("vue").WatchCallback<any, any> | ({
109
- handler: string | import("vue").WatchCallback<any, any>;
110
- } & import("vue").WatchOptions<boolean>))[];
111
- } | undefined;
112
- provide?: import("vue").ComponentProvideOptions | undefined;
113
- inject?: {} | string[] | undefined;
114
- filters?: Record<string, Function> | undefined;
115
- mixins?: any[] | undefined;
116
- extends?: any;
117
- beforeCreate?: (() => void) | undefined;
118
- created?: (() => void) | undefined;
119
- beforeMount?: (() => void) | undefined;
120
- mounted?: (() => void) | undefined;
121
- beforeUpdate?: (() => void) | undefined;
122
- updated?: (() => void) | undefined;
123
- activated?: (() => void) | undefined;
124
- deactivated?: (() => void) | undefined;
125
- beforeDestroy?: (() => void) | undefined;
126
- beforeUnmount?: (() => void) | undefined;
127
- destroyed?: (() => void) | undefined;
128
- unmounted?: (() => void) | undefined;
129
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
130
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
131
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void) | undefined;
132
- delimiters?: [string, string] | undefined;
133
- __differentiator?: string | number | symbol | undefined;
134
- __isBuiltIn?: boolean | undefined;
135
- __file?: string | undefined;
136
- __name?: string | undefined;
137
- beforeRouteEnter?: import("vue-router").NavigationGuardWithThis<undefined> | undefined;
138
- beforeRouteUpdate?: import("vue-router").NavigationGuard | undefined;
139
- beforeRouteLeave?: import("vue-router").NavigationGuard | undefined;
140
- };
20
+ component: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
141
21
  }[];
142
22
  }>;
143
23
  loading: import("vue").Ref<boolean>;
@@ -184,7 +64,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
184
64
  };
185
65
  userId: {
186
66
  type: NumberConstructor;
187
- required: true;
67
+ required: false;
188
68
  };
189
69
  }, {
190
70
  http: Http | undefined;
@@ -490,7 +370,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
490
370
  };
491
371
  userId: {
492
372
  type: NumberConstructor;
493
- required: true;
373
+ required: false;
494
374
  };
495
375
  }>> & {
496
376
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -1,6 +1,6 @@
1
- import { Component } from "vue";
1
+ import { Component, ShallowRef } from "vue";
2
2
  export default interface UserDetailDialogTabConfig {
3
3
  name: string;
4
4
  code: string;
5
- component: string | Component;
5
+ component: string | ShallowRef<Component>;
6
6
  }