@pangu-backend-ui/user-core 0.0.20 → 0.0.21
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.js +459 -339
- package/index.umd.cjs +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/views/components/CreateUserDialog.vue.d.ts +36 -0
- package/types/views/list.vue.d.ts +36 -0
package/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("element-plus"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","element-plus","@pangu-backend-ui/common"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["pg-user-core"]={},u.Vue,u.pinia,u["element-plus"],u.common))})(this,function(u,e,O,I,j){"use strict";const Y={key:0,class:"container"},A=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(r){const i=r,a=e.ref({plainMobile:null,loading:!1}),l=e.inject("http");function c(){a.value.plainMobile==null&&(a.value.loading=!0,l==null||l.get(`/api/user/${i.userId}/plainmobile`).then(t=>{a.value.plainMobile=t.data,a.value.loading=!1}).finally(()=>{a.value.loading=!1}))}return(t,p)=>{const n=e.resolveComponent("View"),f=e.resolveComponent("el-icon"),C=e.resolveComponent("Loading");return i.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",Y,[a.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(i.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&&i.userId!=null&&t.$hasPer("DECRYPT_MOBILE")?(e.openBlock(),e.createBlock(f,{key:2,class:"view-icon",onClick:c},{default:e.withCtx(()=>[e.createVNode(n)]),_:1})):e.createCommentVNode("",!0),a.value.loading?(e.openBlock(),e.createBlock(f,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(C)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),ae="",F=(r,i)=>{const a=r.__vccOpts||r;for(const[l,c]of i)a[l]=c;return a},y=F(A,[["__scopeId","data-v-dd075891"]]),E={install:r=>{r.component("PgUserMobile",y)}},q=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(r){const i=r,a=e.ref({userId:i.userId,loginTimeStart:null,loginTimeEnd:null}),l=e.ref([]);e.watch(l,p=>{p?(a.value.loginTimeStart=p[0],a.value.loginTimeEnd=p[1]):(a.value.loginTimeStart=null,a.value.loginTimeEnd=null)});const c=e.ref();function t(){c.value.search()}return(p,n)=>{const f=e.resolveComponent("el-date-picker"),C=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),d=e.resolveComponent("el-table-column"),s=e.resolveComponent("el-tag"),m=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(f,{modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=o=>l.value=o),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(C,{type:"primary",icon:"search",onClick:t},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(m,{ref_key:"historiesTable",ref:c,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:a.value},{columns:e.withCtx(()=>[e.createVNode(d,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:o})=>[o.method==="SMS"?(e.openBlock(),e.createBlock(s,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),o.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(s,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),o.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(s,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),o.method==="PASSWORD"?(e.openBlock(),e.createBlock(s,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),D=O.defineStore("pg-user-core-config-store",()=>{const r=[];return r.push({name:"登录历史",code:"LOGIN_HISTORY",component:e.shallowRef(q)}),{userDetailDialogTabs:e.computed(()=>r)}}),H={style:{width:"100%",position:"relative",display:"flex","flex-direction":"column",gap:"5px"}},G=e.defineComponent({__name:"AddFunctionDisableDialog",emits:["success"],setup(r,{expose:i,emit:a}){const l=e.ref(!1),c=e.inject("http"),t=e.ref({functionCode:null,expiry:null,remark:null,disableForever:!0}),p={functionCode:[{required:!0,message:"请选择禁用功能"}],expiry:[{validator:(m,o,V)=>{t.value.disableForever&&(o==null&&V(new Error("请选择结束时间")),new Date(o).getTime()<=new Date().getTime()&&V(new Error("结束时间不能小于当前时间"))),V()}}]},n=e.ref({});async function f(){const m=await(c==null?void 0:c.get("/api/user/function-disable/functions"));n.value=m==null?void 0:m.data}const C=e.ref();function b(){C.value.validate(async m=>{m&&(await(c==null?void 0:c.post(`/api/user/${d}/function-disable`,t.value)),I.ElMessage.success("添加成功"),l.value=!1,t.value.functionCode=null,t.value.expiry=null,t.value.remark=null,t.value.disableForever=!0,a("success"))})}let d=null;function s(m){l.value=!0,d=m,f()}return i({show:s}),(m,o)=>{const V=e.resolveComponent("el-option"),w=e.resolveComponent("el-select"),_=e.resolveComponent("el-form-item"),k=e.resolveComponent("el-checkbox"),g=e.resolveComponent("el-date-picker"),x=e.resolveComponent("el-input"),T=e.resolveComponent("el-form"),B=e.resolveComponent("el-button"),S=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(S,{modelValue:l.value,"onUpdate:modelValue":o[4]||(o[4]=h=>l.value=h),title:"添加功能禁用",width:"500px","append-to-body":""},{footer:e.withCtx(()=>[e.createVNode(B,{type:"primary",size:"mini",onClick:b},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(T,{ref_key:"addDisabledFunctionForm",ref:C,model:t.value,rules:p,"label-position":"top"},{default:e.withCtx(()=>[e.createVNode(_,{label:"禁用功能",prop:"functionCode"},{default:e.withCtx(()=>[e.createVNode(w,{modelValue:t.value.functionCode,"onUpdate:modelValue":o[0]||(o[0]=h=>t.value.functionCode=h),placeholder:"请选择禁用功能"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(h,U)=>(e.openBlock(),e.createBlock(V,{value:U,label:h},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(_,{label:"结束时间",prop:"endDateTime"},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(k,{modelValue:t.value.disableForever,"onUpdate:modelValue":o[1]||(o[1]=h=>t.value.disableForever=h),label:"永久禁用"},null,8,["modelValue"]),t.value.disableForever?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(g,{key:0,type:"datetime",modelValue:t.value.expiry,"onUpdate:modelValue":o[2]||(o[2]=h=>t.value.expiry=h),placeholder:"请输入结束时间","value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},null,8,["modelValue"]))])]),_:1}),e.createVNode(_,{label:"备注"},{default:e.withCtx(()=>[e.createVNode(x,{type:"textarea",placeholder:"请输入备注",modelValue:t.value.remark,"onUpdate:modelValue":o[3]||(o[3]=h=>t.value.remark=h)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),M=e.defineComponent({__name:"FunctionDisableTableDialog",setup(r,{expose:i}){const a=e.inject("http"),l=e.ref(!1),c=e.ref({userId:null}),t=e.ref();function p(d){l.value=!0,c.value.userId=d,e.nextTick(()=>t.value.search())}function n(){t.value.search()}const f=e.ref();function C(){f.value.show(c.value.userId)}async function b(d){await(a==null?void 0:a.post(`/api/user/function-disable/${d}/enable`)),I.ElMessage.success("失效成功"),t.value.search()}return i({show:p}),(d,s)=>{const m=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-tag"),V=e.resolveComponent("el-button"),w=e.resolveComponent("el-popconfirm"),_=e.resolveComponent("pg-table"),k=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(k,{modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=g=>l.value=g),title:"功能禁用",width:"900px","append-to-body":""},{footer:e.withCtx(()=>[e.createVNode(V,{type:"primary",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(" 添加功能禁用 ")]),_:1})]),default:e.withCtx(()=>[e.createVNode(_,{ref_key:"table",ref:t,"data-url":"/api/user/function-disable/page-search","fetch-data":!1,condition:c.value},{default:e.withCtx(()=>[e.createVNode(m,{prop:"id",label:"ID",width:"80",align:"center"}),e.createVNode(m,{label:"功能",prop:"functionLabel",align:"center",width:"120"}),e.createVNode(m,{label:"状态",width:"80",align:"center"},{default:e.withCtx(({row:g})=>[e.createVNode(o,{size:"mini",type:g.expiry==null||new Date(g.expiry).getTime()>=new Date().getTime()?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.expiry==null||new Date(g.expiry).getTime()>=new Date().getTime()?"生效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(m,{label:"结束时间",align:"center",width:"160"},{default:e.withCtx(({row:g})=>[e.createTextVNode(e.toDisplayString(g.expiry?g.expiry:"永久"),1)]),_:1}),e.createVNode(m,{prop:"remark",label:"备注","show-overflow-tooltip":"",align:"center"}),e.createVNode(m,{prop:"createdTime",label:"创建时间",width:"160",align:"center"}),e.createVNode(m,{prop:"操作",width:"120",align:"center"},{default:e.withCtx(({row:g})=>[g.expiry==null||new Date(g.expiry).getTime()>=new Date().getTime()?(e.openBlock(),e.createBlock(w,{key:0,title:"确定当前操作吗?",onConfirm:x=>b(g.id)},{reference:e.withCtx(()=>[e.createVNode(V,{type:"warning"},{default:e.withCtx(()=>[e.createTextVNode("失效")]),_:1})]),_:2},1032,["onConfirm"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"])]),_:1},8,["modelValue"]),e.createVNode(G,{ref_key:"addFunctionDisableDialog",ref:f,onSuccess:n},null,512)],64)}}}),J={key:0},$=e.defineComponent({__name:"UserDetailDialog",setup(r,{expose:i}){const a=D(),l=e.inject("http"),c=e.ref(!1),t=e.ref(),p=e.ref(),n=e.ref({activeName:a.userDetailDialogTabs[0].code,tabs:[]}),f=e.ref(!1);function C(V,w,_){f.value=!0,b(V),w&&(n.value.activeName=w),n.value.tabs.length=0,n.value.tabs=n.value.tabs.concat(a.userDetailDialogTabs),_&&(n.value.tabs=n.value.tabs.concat(_))}function b(V){l==null||l.get(`/api/user/${V}`).then(w=>{t.value=w.data,f.value=!1,c.value=!0,t.value.inBlacklist&&d(V)})}function d(V){l==null||l.get(`/api/user/${V}/blacklist`).then(w=>{p.value=w.data})}const s=e.ref();function m(){s.value.show(t.value.id)}function o(){t.value=null,p.value=null}return i({show:C}),(V,w)=>{const _=e.resolveComponent("el-descriptions-item"),k=e.resolveComponent("el-tag"),g=e.resolveComponent("el-descriptions"),x=e.resolveComponent("el-tab-pane"),T=e.resolveComponent("el-tabs"),B=e.resolveComponent("el-button"),S=e.resolveComponent("el-dialog"),h=e.resolveDirective("loading"),U=e.resolveDirective("permission");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(S,{modelValue:c.value,"onUpdate:modelValue":w[1]||(w[1]=N=>c.value=N),title:"用户详情",width:"1300",onClosed:o},e.createSlots({default:e.withCtx(()=>[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",J,[e.createVNode(g,{border:""},{default:e.withCtx(()=>[e.createVNode(_,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.id),1)]),_:1}),e.createVNode(_,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.nickname),1)]),_:1}),e.createVNode(_,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(y,{"mask-mobile":t.value.mobile,"user-id":t.value.id,key:t.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(_,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.inviteCode),1)]),_:1}),e.createVNode(_,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.touchTime),1)]),_:1}),e.createVNode(_,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.createdTime),1)]),_:1}),e.createVNode(_,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.lastLoginTime),1)]),_:1}),e.createVNode(_,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.updatedTime),1)]),_:1}),e.createVNode(_,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.parentId),1)]),_:1}),e.createVNode(_,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(k,{type:t.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(_,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.relationPath),1)]),_:1})]),_:1}),p.value?(e.openBlock(),e.createBlock(g,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(_,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value.unlockTime),1)]),_:1}),e.createVNode(_,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value.createdTime),1)]),_:1}),e.createVNode(_,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value.allowPermissionCodes?JSON.parse(p.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(_,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(T,{modelValue:n.value.activeName,"onUpdate:modelValue":w[0]||(w[0]=N=>n.value.activeName=N),key:`usr_tab_${t.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value.tabs,(N,ie)=>(e.openBlock(),e.createBlock(x,{label:N.name,name:N.code,key:`user_detail_dialog_${N.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[n.value.activeName==N.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N.component),{key:`ud_tab_${N.code}`,userId:t.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))])),[[h,f.value]]):e.createCommentVNode("",!0)]),_:2},[t.value?{name:"footer",fn:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(B,{icon:"lock",type:"warning",onClick:m},{default:e.withCtx(()=>[e.createTextVNode("添加功能禁用")]),_:1})),[[U,"FUNCTION_DISABLE"]])]),key:"0"}:void 0]),1032,["modelValue"]),e.createVNode(M,{ref_key:"functionDisableTableDialog",ref:s},null,512)],64)}}}),L={install:r=>{r.component("PgUserDetailDialog",$)}},K=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(r,{emit:i}){const a=r,l=e.inject("http");e.onMounted(()=>{a.modelValue&&C(a.modelValue)});const c=e.ref(a.modelValue);e.watch(c,b=>{i("update:modelValue",b)});const t=e.ref(!1),p=e.ref([]);let n=null;function f(b){b&&(t.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{l==null||l.get("/api/user/keyword-search",{keyword:b,pageSize:a.pageSize}).then(d=>{p.value=d.data}).finally(()=>{t.value=!1})},200))}function C(b){t.value=!0,l==null||l.get(`/api/user/${b}`).then(d=>{p.value=[d.data]}).finally(()=>{t.value=!1})}return(b,d)=>{const s=e.resolveComponent("el-option"),m=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(m,{modelValue:c.value,"onUpdate:modelValue":d[0]||(d[0]=o=>c.value=o),filterable:"",remote:"",loading:t.value,"remote-method":f},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,o=>(e.openBlock(),e.createBlock(s,{key:o.id,value:o.id,label:`${o.id} / ${o.nickname} / ${o.mobile} / ${o.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(b.$slots,"default",{user:o},()=>[e.createTextVNode(e.toDisplayString(o.id)+" / "+e.toDisplayString(o.nickname)+" / "+e.toDisplayString(o.mobile)+" / "+e.toDisplayString(o.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),P={install:r=>{r.component("PgUserSelector",K)}},R={install:r=>{r.component("PgFunctionDisableTableDialog",M)}},W=[E,L,P,R],Q=r=>(e.pushScopeId("data-v-391c43be"),r=r(),e.popScopeId(),r),X={class:"page-layout"},Z={style:{"margin-top":"10px"}},v=Q(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),ee=e.defineComponent({__name:"list",setup(r){const i=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),a=e.ref(null);function l(){a.value.search()}const c=e.ref();function t(p){c.value.show(p.id)}return(p,n)=>{const f=e.resolveComponent("el-input"),C=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),d=e.resolveComponent("el-card"),s=e.resolveComponent("el-table-column"),m=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",X,[e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(f,{modelValue:i.value.id,"onUpdate:modelValue":n[0]||(n[0]=o=>i.value.id=o),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(f,{modelValue:i.value.parentId,"onUpdate:modelValue":n[1]||(n[1]=o=>i.value.parentId=o),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(f,{modelValue:i.value.phone,"onUpdate:modelValue":n[2]||(n[2]=o=>i.value.phone=o),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(f,{modelValue:i.value.nicekname,"onUpdate:modelValue":n[3]||(n[3]=o=>i.value.nicekname=o),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(f,{modelValue:i.value.inviteCode,"onUpdate:modelValue":n[4]||(n[4]=o=>i.value.inviteCode=o),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(C,{type:"primary",icon:"search",onClick:l},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",Z,[e.createVNode(e.unref(j.PgTable),{ref_key:"userTable",ref:a,"data-url":"/api/user/page",condition:i.value,onRowDbClick:n[5]||(n[5]=o=>t(o))},{columns:e.withCtx(()=>[e.createVNode(s,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(s,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(o=>[(e.openBlock(),e.createBlock(y,{"mask-mobile":o.row.mobile,"user-id":o.row.id,key:o.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(s,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(o=>[e.createVNode(m,{fit:"cover",size:30,src:o.row.avatar,"preview-teleported":"","preview-src-list":[o.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(s,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(s,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(s,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[v]),_:1})]),_:1},8,["condition"])])]),e.createVNode($,{ref_key:"userDetailDialog",ref:c},null,512)],64)}}}),ne="",te=F(ee,[["__scopeId","data-v-391c43be"]]),oe={install:(r,i)=>{let a=i.router,l=a.getRoutes().find(c=>c.path=="/");l&&l.meta&&a.addRoute({path:"/user",name:"User",redirect:"/user/list",component:l.meta.commonLayout,children:[{path:"list",name:"UserList",component:te}]})}},z=(r,i)=>{const a=D();if(i.userDetailDialogTabs&&i.userDetailDialogTabs.length)for(let l of i.userDetailDialogTabs)a.userDetailDialogTabs.push(l);W.forEach(l=>r.use(l)),r.use(oe,i)},le={install:z};u.FunctionDisableDialog=R,u.UserDetailDialog=L,u.UserMobileComp=E,u.UserSelectComp=P,u.default=le,u.install=z,u.useUserCoreConfigStore=D,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("element-plus"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","element-plus","@pangu-backend-ui/common"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C["pg-user-core"]={},C.Vue,C.pinia,C["element-plus"],C.common))})(this,function(C,e,j,y,O){"use strict";const q={key:0,class:"container"},Y=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(c){const n=c,a=e.ref({plainMobile:null,loading:!1}),l=e.inject("http");function r(){a.value.plainMobile==null&&(a.value.loading=!0,l==null||l.get(`/api/user/${n.userId}/plainmobile`).then(t=>{a.value.plainMobile=t.data,a.value.loading=!1}).finally(()=>{a.value.loading=!1}))}return(t,m)=>{const s=e.resolveComponent("View"),b=e.resolveComponent("el-icon"),_=e.resolveComponent("Loading");return n.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",q,[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&&t.$hasPer("DECRYPT_MOBILE")?(e.openBlock(),e.createBlock(b,{key:2,class:"view-icon",onClick:r},{default:e.withCtx(()=>[e.createVNode(s)]),_:1})):e.createCommentVNode("",!0),a.value.loading?(e.openBlock(),e.createBlock(b,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(_)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),ne="",F=(c,n)=>{const a=c.__vccOpts||c;for(const[l,r]of n)a[l]=r;return a},D=F(Y,[["__scopeId","data-v-dd075891"]]),E={install:c=>{c.component("PgUserMobile",D)}},A=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(c){const n=c,a=e.ref({userId:n.userId,loginTimeStart:null,loginTimeEnd:null}),l=e.ref([]);e.watch(l,m=>{m?(a.value.loginTimeStart=m[0],a.value.loginTimeEnd=m[1]):(a.value.loginTimeStart=null,a.value.loginTimeEnd=null)});const r=e.ref();function t(){r.value.search()}return(m,s)=>{const b=e.resolveComponent("el-date-picker"),_=e.resolveComponent("el-button"),V=e.resolveComponent("el-space"),d=e.resolveComponent("el-table-column"),u=e.resolveComponent("el-tag"),p=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(b,{modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=o=>l.value=o),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(_,{type:"primary",icon:"search",onClick:t},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(p,{ref_key:"historiesTable",ref:r,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:a.value},{columns:e.withCtx(()=>[e.createVNode(d,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:o})=>[o.method==="SMS"?(e.openBlock(),e.createBlock(u,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),o.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(u,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),o.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(u,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),o.method==="PASSWORD"?(e.openBlock(),e.createBlock(u,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(d,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),T=j.defineStore("pg-user-core-config-store",()=>{const c=[];return c.push({name:"登录历史",code:"LOGIN_HISTORY",component:e.shallowRef(A)}),{userDetailDialogTabs:e.computed(()=>c)}}),H={style:{width:"100%",position:"relative",display:"flex","flex-direction":"column",gap:"5px"}},G=e.defineComponent({__name:"AddFunctionDisableDialog",emits:["success"],setup(c,{expose:n,emit:a}){const l=e.ref(!1),r=e.inject("http"),t=e.ref({functionCode:null,expiry:null,remark:null,disableForever:!0}),m={functionCode:[{required:!0,message:"请选择禁用功能"}],expiry:[{validator:(p,o,g)=>{t.value.disableForever&&(o==null&&g(new Error("请选择结束时间")),new Date(o).getTime()<=new Date().getTime()&&g(new Error("结束时间不能小于当前时间"))),g()}}]},s=e.ref({});async function b(){const p=await(r==null?void 0:r.get("/api/user/function-disable/functions"));s.value=p==null?void 0:p.data}const _=e.ref();function V(){_.value.validate(async p=>{p&&(await(r==null?void 0:r.post(`/api/user/${d}/function-disable`,t.value)),y.ElMessage.success("添加成功"),l.value=!1,t.value.functionCode=null,t.value.expiry=null,t.value.remark=null,t.value.disableForever=!0,a("success"))})}let d=null;function u(p){l.value=!0,d=p,b()}return n({show:u}),(p,o)=>{const g=e.resolveComponent("el-option"),i=e.resolveComponent("el-select"),f=e.resolveComponent("el-form-item"),h=e.resolveComponent("el-checkbox"),w=e.resolveComponent("el-date-picker"),x=e.resolveComponent("el-input"),B=e.resolveComponent("el-form"),S=e.resolveComponent("el-button"),U=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(U,{modelValue:l.value,"onUpdate:modelValue":o[4]||(o[4]=N=>l.value=N),title:"添加功能禁用",width:"500px","append-to-body":""},{footer:e.withCtx(()=>[e.createVNode(S,{type:"primary",size:"mini",onClick:V},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(B,{ref_key:"addDisabledFunctionForm",ref:_,model:t.value,rules:m,"label-position":"top"},{default:e.withCtx(()=>[e.createVNode(f,{label:"禁用功能",prop:"functionCode"},{default:e.withCtx(()=>[e.createVNode(i,{modelValue:t.value.functionCode,"onUpdate:modelValue":o[0]||(o[0]=N=>t.value.functionCode=N),placeholder:"请选择禁用功能"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(N,I)=>(e.openBlock(),e.createBlock(g,{value:I,label:N},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"结束时间",prop:"endDateTime"},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(h,{modelValue:t.value.disableForever,"onUpdate:modelValue":o[1]||(o[1]=N=>t.value.disableForever=N),label:"永久禁用"},null,8,["modelValue"]),t.value.disableForever?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(w,{key:0,type:"datetime",modelValue:t.value.expiry,"onUpdate:modelValue":o[2]||(o[2]=N=>t.value.expiry=N),placeholder:"请输入结束时间","value-format":"YYYY-MM-DD HH:mm:ss",clearable:""},null,8,["modelValue"]))])]),_:1}),e.createVNode(f,{label:"备注"},{default:e.withCtx(()=>[e.createVNode(x,{type:"textarea",placeholder:"请输入备注",modelValue:t.value.remark,"onUpdate:modelValue":o[3]||(o[3]=N=>t.value.remark=N)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),M=e.defineComponent({__name:"FunctionDisableTableDialog",setup(c,{expose:n}){const a=e.inject("http"),l=e.ref(!1),r=e.ref({userId:null}),t=e.ref();function m(d){l.value=!0,r.value.userId=d,e.nextTick(()=>t.value.search())}function s(){t.value.search()}const b=e.ref();function _(){b.value.show(r.value.userId)}async function V(d){await(a==null?void 0:a.post(`/api/user/function-disable/${d}/enable`)),y.ElMessage.success("失效成功"),t.value.search()}return n({show:m}),(d,u)=>{const p=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-tag"),g=e.resolveComponent("el-button"),i=e.resolveComponent("el-popconfirm"),f=e.resolveComponent("pg-table"),h=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(h,{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=w=>l.value=w),title:"功能禁用",width:"900px","append-to-body":""},{footer:e.withCtx(()=>[e.createVNode(g,{type:"primary",onClick:_},{default:e.withCtx(()=>[e.createTextVNode(" 添加功能禁用 ")]),_:1})]),default:e.withCtx(()=>[e.createVNode(f,{ref_key:"table",ref:t,"data-url":"/api/user/function-disable/page-search","fetch-data":!1,condition:r.value},{default:e.withCtx(()=>[e.createVNode(p,{prop:"id",label:"ID",width:"80",align:"center"}),e.createVNode(p,{label:"功能",prop:"functionLabel",align:"center",width:"120"}),e.createVNode(p,{label:"状态",width:"80",align:"center"},{default:e.withCtx(({row:w})=>[e.createVNode(o,{size:"mini",type:w.expiry==null||new Date(w.expiry).getTime()>=new Date().getTime()?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.expiry==null||new Date(w.expiry).getTime()>=new Date().getTime()?"生效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(p,{label:"结束时间",align:"center",width:"160"},{default:e.withCtx(({row:w})=>[e.createTextVNode(e.toDisplayString(w.expiry?w.expiry:"永久"),1)]),_:1}),e.createVNode(p,{prop:"remark",label:"备注","show-overflow-tooltip":"",align:"center"}),e.createVNode(p,{prop:"createdTime",label:"创建时间",width:"160",align:"center"}),e.createVNode(p,{prop:"操作",width:"120",align:"center"},{default:e.withCtx(({row:w})=>[w.expiry==null||new Date(w.expiry).getTime()>=new Date().getTime()?(e.openBlock(),e.createBlock(i,{key:0,title:"确定当前操作吗?",onConfirm:x=>V(w.id)},{reference:e.withCtx(()=>[e.createVNode(g,{type:"warning"},{default:e.withCtx(()=>[e.createTextVNode("失效")]),_:1})]),_:2},1032,["onConfirm"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"])]),_:1},8,["modelValue"]),e.createVNode(G,{ref_key:"addFunctionDisableDialog",ref:b,onSuccess:s},null,512)],64)}}}),J={key:0},$=e.defineComponent({__name:"UserDetailDialog",setup(c,{expose:n}){const a=T(),l=e.inject("http"),r=e.ref(!1),t=e.ref(),m=e.ref(),s=e.ref({activeName:a.userDetailDialogTabs[0].code,tabs:[]}),b=e.ref(!1);function _(g,i,f){b.value=!0,V(g),i&&(s.value.activeName=i),s.value.tabs.length=0,s.value.tabs=s.value.tabs.concat(a.userDetailDialogTabs),f&&(s.value.tabs=s.value.tabs.concat(f))}function V(g){l==null||l.get(`/api/user/${g}`).then(i=>{t.value=i.data,b.value=!1,r.value=!0,t.value.inBlacklist&&d(g)})}function d(g){l==null||l.get(`/api/user/${g}/blacklist`).then(i=>{m.value=i.data})}const u=e.ref();function p(){u.value.show(t.value.id)}function o(){t.value=null,m.value=null}return n({show:_}),(g,i)=>{const f=e.resolveComponent("el-descriptions-item"),h=e.resolveComponent("el-tag"),w=e.resolveComponent("el-descriptions"),x=e.resolveComponent("el-tab-pane"),B=e.resolveComponent("el-tabs"),S=e.resolveComponent("el-button"),U=e.resolveComponent("el-dialog"),N=e.resolveDirective("loading"),I=e.resolveDirective("permission");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(U,{modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=k=>r.value=k),title:"用户详情",width:"1300",onClosed:o},e.createSlots({default:e.withCtx(()=>[t.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",J,[e.createVNode(w,{border:""},{default:e.withCtx(()=>[e.createVNode(f,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.id),1)]),_:1}),e.createVNode(f,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.nickname),1)]),_:1}),e.createVNode(f,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(D,{"mask-mobile":t.value.mobile,"user-id":t.value.id,key:t.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(f,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.inviteCode),1)]),_:1}),e.createVNode(f,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.touchTime),1)]),_:1}),e.createVNode(f,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.createdTime),1)]),_:1}),e.createVNode(f,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.lastLoginTime),1)]),_:1}),e.createVNode(f,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.updatedTime),1)]),_:1}),e.createVNode(f,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.parentId),1)]),_:1}),e.createVNode(f,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(h,{type:t.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(f,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.relationPath),1)]),_:1})]),_:1}),m.value?(e.openBlock(),e.createBlock(w,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(f,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.unlockTime),1)]),_:1}),e.createVNode(f,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.createdTime),1)]),_:1}),e.createVNode(f,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.allowPermissionCodes?JSON.parse(m.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(f,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(B,{modelValue:s.value.activeName,"onUpdate:modelValue":i[0]||(i[0]=k=>s.value.activeName=k),key:`usr_tab_${t.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.tabs,(k,re)=>(e.openBlock(),e.createBlock(x,{label:k.name,name:k.code,key:`user_detail_dialog_${k.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[s.value.activeName==k.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(k.component),{key:`ud_tab_${k.code}`,userId:t.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))])),[[N,b.value]]):e.createCommentVNode("",!0)]),_:2},[t.value?{name:"footer",fn:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(S,{icon:"lock",type:"warning",onClick:p},{default:e.withCtx(()=>[e.createTextVNode("添加功能禁用")]),_:1})),[[I,"FUNCTION_DISABLE"]])]),key:"0"}:void 0]),1032,["modelValue"]),e.createVNode(M,{ref_key:"functionDisableTableDialog",ref:u},null,512)],64)}}}),L={install:c=>{c.component("PgUserDetailDialog",$)}},K=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(c,{emit:n}){const a=c,l=e.inject("http");e.onMounted(()=>{a.modelValue&&_(a.modelValue)});const r=e.ref(a.modelValue);e.watch(r,V=>{n("update:modelValue",V)});const t=e.ref(!1),m=e.ref([]);let s=null;function b(V){V&&(t.value=!0,s&&clearTimeout(s),s=setTimeout(()=>{l==null||l.get("/api/user/keyword-search",{keyword:V,pageSize:a.pageSize}).then(d=>{m.value=d.data}).finally(()=>{t.value=!1})},200))}function _(V){t.value=!0,l==null||l.get(`/api/user/${V}`).then(d=>{m.value=[d.data]}).finally(()=>{t.value=!1})}return(V,d)=>{const u=e.resolveComponent("el-option"),p=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(p,{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=o=>r.value=o),filterable:"",remote:"",loading:t.value,"remote-method":b},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,o=>(e.openBlock(),e.createBlock(u,{key:o.id,value:o.id,label:`${o.id} / ${o.nickname} / ${o.mobile} / ${o.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(V.$slots,"default",{user:o},()=>[e.createTextVNode(e.toDisplayString(o.id)+" / "+e.toDisplayString(o.nickname)+" / "+e.toDisplayString(o.mobile)+" / "+e.toDisplayString(o.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),P={install:c=>{c.component("PgUserSelector",K)}},R={install:c=>{c.component("PgFunctionDisableTableDialog",M)}},W=[E,L,P,R],Q={__name:"CreateUserDialog",emits:["success"],setup(c,{expose:n,emit:a}){const l=e.inject("http"),r=e.ref(!1),t=e.ref({mobile:null,password:null,inviteCode:null}),m={mobile:[{required:!0,message:"请输入手机号"}],password:[{required:!0,message:"请输入登录密码"}]},s=e.ref();function b(){s.value.validate(async d=>{d&&(await l.post("/api/user/create",t.value),y.ElMessage.success("创建成功"),a("success"),r.value=!1)})}function _(){r.value=!0}function V(){s.value.resetFields()}return n({show:_}),(d,u)=>{const p=e.resolveComponent("el-input"),o=e.resolveComponent("el-form-item"),g=e.resolveComponent("el-form"),i=e.resolveComponent("el-button"),f=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(f,{modelValue:r.value,"onUpdate:modelValue":u[3]||(u[3]=h=>r.value=h),title:"创建用户",width:"400",onClosed:V},{footer:e.withCtx(()=>[e.createVNode(i,{type:"primary",onClick:b},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(g,{ref_key:"formRef",ref:s,model:t.value,rules:m,"label-position":"top"},{default:e.withCtx(()=>[e.createVNode(o,{label:"手机号",prop:"mobile"},{default:e.withCtx(()=>[e.createVNode(p,{modelValue:t.value.mobile,"onUpdate:modelValue":u[0]||(u[0]=h=>t.value.mobile=h),placeholder:"请输入登录手机号"},null,8,["modelValue"])]),_:1}),e.createVNode(o,{label:"登录密码",prop:"password"},{default:e.withCtx(()=>[e.createVNode(p,{modelValue:t.value.password,"onUpdate:modelValue":u[1]||(u[1]=h=>t.value.password=h),placeholder:"请输入登录密码"},null,8,["modelValue"])]),_:1}),e.createVNode(o,{label:"邀请码",prop:"inviteCode"},{default:e.withCtx(()=>[e.createVNode(p,{modelValue:t.value.inviteCode,"onUpdate:modelValue":u[2]||(u[2]=h=>t.value.inviteCode=h),placeholder:"请输入邀请码"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}},X=c=>(e.pushScopeId("data-v-2dcce2b2"),c=c(),e.popScopeId(),c),Z={class:"page-layout"},v={style:{"margin-top":"10px"}},ee=X(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),te=e.defineComponent({__name:"list",setup(c){const n=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),a=e.ref(null);function l(){a.value.search()}const r=e.ref();function t(b){r.value.show(b.id)}const m=e.ref();function s(){m.value.show()}return(b,_)=>{const V=e.resolveComponent("el-input"),d=e.resolveComponent("el-button"),u=e.resolveComponent("el-space"),p=e.resolveComponent("el-card"),o=e.resolveComponent("el-table-column"),g=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Z,[e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:n.value.id,"onUpdate:modelValue":_[0]||(_[0]=i=>n.value.id=i),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.parentId,"onUpdate:modelValue":_[1]||(_[1]=i=>n.value.parentId=i),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.phone,"onUpdate:modelValue":_[2]||(_[2]=i=>n.value.phone=i),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.nicekname,"onUpdate:modelValue":_[3]||(_[3]=i=>n.value.nicekname=i),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.inviteCode,"onUpdate:modelValue":_[4]||(_[4]=i=>n.value.inviteCode=i),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(d,{type:"primary",icon:"search",onClick:l},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1}),e.createVNode(d,{type:"warning",icon:"plus",onClick:s},{default:e.withCtx(()=>[e.createTextVNode("创建用户")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",v,[e.createVNode(e.unref(O.PgTable),{ref_key:"userTable",ref:a,"data-url":"/api/user/page",condition:n.value,onRowDbClick:_[5]||(_[5]=i=>t(i))},{columns:e.withCtx(()=>[e.createVNode(o,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(o,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(i=>[(e.openBlock(),e.createBlock(D,{"mask-mobile":i.row.mobile,"user-id":i.row.id,key:i.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(o,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(o,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(o,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(o,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(i=>[e.createVNode(g,{fit:"cover",size:30,src:i.row.avatar,"preview-teleported":"","preview-src-list":[i.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(o,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(o,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(o,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(o,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(o,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(o,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[ee]),_:1})]),_:1},8,["condition"])])]),e.createVNode($,{ref_key:"userDetailDialog",ref:r},null,512),e.createVNode(Q,{ref_key:"createUserDialog",ref:m,onSuccess:l},null,512)],64)}}}),ie="",oe=F(te,[["__scopeId","data-v-2dcce2b2"]]),le={install:(c,n)=>{let a=n.router,l=a.getRoutes().find(r=>r.path=="/");l&&l.meta&&a.addRoute({path:"/user",name:"User",redirect:"/user/list",component:l.meta.commonLayout,children:[{path:"list",name:"UserList",component:oe}]})}},z=(c,n)=>{const a=T();if(n.userDetailDialogTabs&&n.userDetailDialogTabs.length)for(let l of n.userDetailDialogTabs)a.userDetailDialogTabs.push(l);W.forEach(l=>c.use(l)),c.use(le,n)},ae={install:z};C.FunctionDisableDialog=R,C.UserDetailDialog=L,C.UserMobileComp=E,C.UserSelectComp=P,C.default=ae,C.install=z,C.useUserCoreConfigStore=T,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.view-icon[data-v-dd075891]{margin-left:3px}.container[data-v-dd075891]{display:flex;align-items:center}.page-layout[data-v-
|
|
1
|
+
.view-icon[data-v-dd075891]{margin-left:3px}.container[data-v-dd075891]{display:flex;align-items:center}.page-layout[data-v-2dcce2b2]{display:flex;flex-direction:column}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default _sfc_main;
|
|
2
|
+
declare namespace _sfc_main {
|
|
3
|
+
const emits: string[];
|
|
4
|
+
function setup(__props: any, { expose, emit: emits }: {
|
|
5
|
+
expose: any;
|
|
6
|
+
emit: any;
|
|
7
|
+
}): {
|
|
8
|
+
http: any;
|
|
9
|
+
emits: any;
|
|
10
|
+
showState: import("vue").Ref<boolean>;
|
|
11
|
+
form: import("vue").Ref<{
|
|
12
|
+
mobile: null;
|
|
13
|
+
password: null;
|
|
14
|
+
inviteCode: null;
|
|
15
|
+
}>;
|
|
16
|
+
formRules: {
|
|
17
|
+
mobile: {
|
|
18
|
+
required: boolean;
|
|
19
|
+
message: string;
|
|
20
|
+
}[];
|
|
21
|
+
password: {
|
|
22
|
+
required: boolean;
|
|
23
|
+
message: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
formRef: import("vue").Ref<any>;
|
|
27
|
+
submit: () => void;
|
|
28
|
+
show: () => void;
|
|
29
|
+
reset: () => void;
|
|
30
|
+
inject: typeof inject;
|
|
31
|
+
ref: typeof ref;
|
|
32
|
+
readonly ElMessage: import("element-plus/es/utils").SFCInstallWithContext<import("element-plus").Message>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
import { inject } from "@vue/runtime-core";
|
|
36
|
+
import { ref } from "@vue/runtime-core";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
1
2
|
declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
2
3
|
condition: import("vue").Ref<{
|
|
3
4
|
id: null;
|
|
@@ -10,6 +11,8 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
|
10
11
|
search: () => void;
|
|
11
12
|
userDetailDialog: import("vue").Ref<any>;
|
|
12
13
|
showDetail: (user: any) => void;
|
|
14
|
+
createUserDialog: import("vue").Ref<any>;
|
|
15
|
+
showCreateUserDialog: () => void;
|
|
13
16
|
UserMobile: import("vue").DefineComponent<{
|
|
14
17
|
userId: {
|
|
15
18
|
type: NumberConstructor;
|
|
@@ -247,5 +250,38 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
|
247
250
|
}, {}>;
|
|
248
251
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
249
252
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
253
|
+
CreateUserDialog: {
|
|
254
|
+
emits: string[];
|
|
255
|
+
setup(__props: any, { expose, emit: emits }: {
|
|
256
|
+
expose: any;
|
|
257
|
+
emit: any;
|
|
258
|
+
}): {
|
|
259
|
+
http: any;
|
|
260
|
+
emits: any;
|
|
261
|
+
showState: import("vue").Ref<boolean>;
|
|
262
|
+
form: import("vue").Ref<{
|
|
263
|
+
mobile: null;
|
|
264
|
+
password: null;
|
|
265
|
+
inviteCode: null;
|
|
266
|
+
}>;
|
|
267
|
+
formRules: {
|
|
268
|
+
mobile: {
|
|
269
|
+
required: boolean;
|
|
270
|
+
message: string;
|
|
271
|
+
}[];
|
|
272
|
+
password: {
|
|
273
|
+
required: boolean;
|
|
274
|
+
message: string;
|
|
275
|
+
}[];
|
|
276
|
+
};
|
|
277
|
+
formRef: import("vue").Ref<any>;
|
|
278
|
+
submit: () => void;
|
|
279
|
+
show: () => void;
|
|
280
|
+
reset: () => void;
|
|
281
|
+
inject: typeof import("vue").inject;
|
|
282
|
+
ref: typeof ref;
|
|
283
|
+
readonly ElMessage: import("element-plus/es/utils").SFCInstallWithContext<import("element-plus").Message>;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
250
286
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
251
287
|
export default _sfc_main;
|