This commit is contained in:
likun 2025-07-14 15:24:04 +08:00
parent 99e277d135
commit d155e57701
24 changed files with 148 additions and 11 deletions

View File

@ -141,7 +141,7 @@ func (svc *CommonResourceService) startLoadAllDelayInvokeDbData() {
}
}
func (svc *CommonResourceService) List(projectId int, resource string, listParams *dto2.CommonListReq) (int, []*dto2.CommonDtoFieldDesc, []dto2.CommonDtoValues, error) {
func (svc *CommonResourceService) List(ctx context.Context, projectId int, resource string, listParams *dto2.CommonListReq) (int, []*dto2.CommonDtoFieldDesc, []dto2.CommonDtoValues, error) {
_, projectEt, find, err := svc.projectRepo.GetById(projectId)
if err != nil {
return 0, nil, nil, err
@ -151,6 +151,24 @@ func (svc *CommonResourceService) List(projectId int, resource string, listParam
}
rRepo := findCommResourceRepo(resource)
if rRepo.Repo.Need(projectEt, resource) {
// 查看当前操作账号是否有审核员
userId := ctx.Value("user_id").(int)
getRsp, err := api2.GetUserApiInstance().OpPermissionNeedReview(context.Background(), &api2.OpPermissionNeedReviewReq{UserId: userId})
if err != nil {
return 0, nil, nil, err
}
if getRsp.IsNeedReview {
// 只能查看自己新增的数据
listParams.ParsedWhereConditions.Conditions = append([]*dto2.GetWhereCondition{&dto2.GetWhereCondition{
Key: "PostUserId",
Op: "eq",
Value1: strconv.Itoa(userId),
}}, listParams.ParsedWhereConditions.Conditions...)
}
}
totalCount, fieldsDescInfo, etList, err := rRepo.Repo.List(projectEt, listParams)
if err != nil {
return 0, nil, nil, err
@ -214,9 +232,13 @@ func (svc *CommonResourceService) Create(ctx context.Context, projectId int, res
if getRsp.IsNeedReview {
createNeedReview = true
obj["ReviewCheckStatus"] = consts.OpReviewStatus_Pending
obj["PostUserId"] = userId
obj["PostUserName"] = getRsp.UserName
obj["ReviewNeedCharacters"] = getRsp.ReviewCharacters
} else {
obj["ReviewCheckStatus"] = consts.OpReviewStatus_DirectOk
obj["PostUserId"] = userId
obj["PostUserName"] = getRsp.UserName
obj["ReviewNeedCharacters"] = make([]string, 0)
}
}
@ -230,7 +252,7 @@ func (svc *CommonResourceService) Create(ctx context.Context, projectId int, res
// 这里转换一次新的数据传输对象因为上一步走了创建会给dto分配id
newObj := et.ToCommonDto()
if !createNeedReview {
if createNeedReview {
return newObj, nil
}

View File

@ -22,7 +22,7 @@ type RoleMail struct {
ID int `gorm:"primarykey" readonly:"true"`
ProjectId int `gorm:"index:idx_project_id"`
ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true" where:"eq"`
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id逗号分隔多个" required:"true"`
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id逗号分隔多个" required:"true" big_column:"true"`
Title string `name:"邮件标题" required:"true" big_column:"true"`
Content string `name:"邮件内容" required:"true" big_column:"true"`
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
@ -31,6 +31,8 @@ type RoleMail struct {
UpdatedAt time.Time `readonly:"true"`
ReviewCheckStatus string `gorm:"type:varchar(20);default:pending" name:"审核状态" type:"tagStatus" choices:"GetStatusChoices" readonly:"true"`
PostUserId int `name:"发送用户id" readonly:"true"`
PostUserName string `name:"发送用户名字" readonly:"true"`
ReviewNeedCharacters []string `gorm:"type:json;serializer:json" name:"审核角色组" readonly:"true"`
ReviewUserId int `name:"审核员id" readonly:"true"`
ReviewUserName string `name:"审核员名字" readonly:"true"`

View File

@ -56,7 +56,7 @@ func (svc *Service) CommonList(ctx context.Context, projectId int, resourceName
Value1: projectId,
}}, params.ParsedWhereConditions.Conditions...)
}
totalCount, fieldsDescInfo, rows, err := svc.resourceSvc.List(projectId, resourceName, params)
totalCount, fieldsDescInfo, rows, err := svc.resourceSvc.List(ctx, projectId, resourceName, params)
itemBags, err := svc.projectSvc.GetAllItemBag(projectId)
if err != nil {
return nil, err

View File

@ -49,6 +49,7 @@ type OpPermissionNeedReviewReq struct {
type OpPermissionNeedReviewRsp struct {
IsNeedReview bool
UserName string
ReviewCharacters []string
}

View File

@ -68,13 +68,13 @@ func (svc *CommonResourceService) GetToken(userId int) (*model.Token, error) {
return tokenInfo, nil
}
func (svc *CommonResourceService) UserHasPermitReviewCharacters(userId int) ([]string, bool, error) {
func (svc *CommonResourceService) UserHasPermitReviewCharacters(userId int) (*entity.User, []string, bool, error) {
user, find, err := svc.userRepo.GetById(userId)
if err != nil {
return nil, false, err
return nil, nil, false, err
}
if !find {
return nil, false, errcode.New(errcode.ParamsInvalid, "not found user %v db data", userId)
return nil, nil, false, errcode.New(errcode.ParamsInvalid, "not found user %v db data", userId)
}
return user.Character.WriteOpCheckCharacters, len(user.Character.WriteOpCheckCharacters) > 0, nil
return user, user.Character.WriteOpCheckCharacters, len(user.Character.WriteOpCheckCharacters) > 0, nil
}

View File

@ -149,12 +149,13 @@ func (svc *Service) ListUserExecHistory(params *dto2.ListUserOpHistoryReq) (*dto
}
func (svc *Service) OpPermissionNeedReview(ctx context.Context, req *apiUser.OpPermissionNeedReviewReq) (*apiUser.OpPermissionNeedReviewRsp, error) {
reviewCharacters, need, err := svc.resourceSvc.UserHasPermitReviewCharacters(req.UserId)
user, reviewCharacters, need, err := svc.resourceSvc.UserHasPermitReviewCharacters(req.UserId)
if err != nil {
return nil, err
}
return &apiUser.OpPermissionNeedReviewRsp{
IsNeedReview: need,
UserName: user.Po.UserName,
ReviewCharacters: reviewCharacters,
}, nil
}

Binary file not shown.

View File

@ -5,8 +5,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<script type="module" crossorigin src="/static/js/index-Cirxlp2u.js"></script>
<link rel="modulepreload" crossorigin href="/static/js/vendor-CF1QNs3T.js">
<script type="module" crossorigin src="/static/js/index-hOIgOejC.js"></script>
<link rel="modulepreload" crossorigin href="/static/js/vendor-B2m3dX6z.js">
<link rel="stylesheet" crossorigin href="/static/css/vendor-DnLjZ1mj.css">
<link rel="stylesheet" crossorigin href="/static/css/index-BqAGgcXq.css">
</head>

View File

@ -0,0 +1 @@
.roleDetailList[data-v-5a8d8958] .el-table__header-wrapper th{word-break:break-word;background-color:#f8f8f9!important;color:#515a6e;height:40px!important;font-size:13px}.roleDetailList[data-v-5a8d8958] .el-table__header .el-table-column--selection .cell{width:60px!important}.roleDetailList[data-v-5a8d8958] .el-table .fixed-width .el-button--small{padding-left:0;padding-right:0;width:20px!important}.roleDetailList[data-v-5a8d8958] .el-table__header{background:#f5f7fa!important}.roleDetailList[data-v-5a8d8958] .el-table__row td{border-color:#ebeef5}.app-content[data-v-0dd2745c]{height:calc(100vh - 100px);display:flex}.app-content .table-content[data-v-0dd2745c]{display:flex;flex-direction:column;justify-content:space-between;height:100%;overflow:auto}.app-content .table-content .table[data-v-0dd2745c]{flex:1;position:relative}.app-content .table-content .table[data-v-0dd2745c] .el-table{flex:1;position:absolute}.app-content .table-content .table[data-v-0dd2745c] .el-popper{max-width:640px;word-break:break-all}.pagination-container .el-pagination[data-v-0dd2745c]{right:0;position:absolute;height:25px;margin-bottom:50px;margin-top:0;padding:10px 30px!important;z-index:2}.pagination-container.hidden[data-v-0dd2745c]{display:none}@media (max-width: 768px){.pagination-container .el-pagination>.el-pagination__jump[data-v-0dd2745c]{display:none!important}.pagination-container .el-pagination>.el-pagination__sizes[data-v-0dd2745c]{display:none!important}}

View File

@ -0,0 +1 @@
import{r as e,ab as a,a as s,o,d as r,b as l,w as n,a0 as t,a3 as u,ac as d,W as i,v as p,$ as c,a9 as m,I as v}from"./vendor-B2m3dX6z.js";import{_ as f,u as _,r as g}from"./index-hOIgOejC.js";const y={class:"login-box"},h={class:m({container:!0,animate__animated:!0,animate__flipInX:!0})},w={class:"form-container sign-in-container"},b=f({__name:"Login",setup(m){e(void 0);const{proxy:f}=a(),b=e({user:"",password:""}),V={user:[{required:!0,trigger:"blur",message:"请输入您的账号"}],password:[{required:!0,trigger:"blur",message:"请输入您的密码"}]},x=e=>{e&&f.$refs.ruleFormRef.validate((e=>{if(!e)return console.log("error submit!"),!1;_().login(b.value.user,b.value.password).then((()=>{console.log("登录成功,推送首页。。"),g.push({path:"/welcome"})}),(e=>{})).catch((()=>{v.error("login response error")}))}))};return(e,a)=>{const m=u,v=t,f=i,_=c;return o(),s("div",y,[r("div",h,[r("div",w,[l(_,{ref:"ruleFormRef",model:b.value,"status-icon":"",rules:V,class:"form"},{default:n((()=>[l(v,{class:"form-item",prop:"username"},{default:n((()=>[l(m,{modelValue:b.value.user,"onUpdate:modelValue":a[0]||(a[0]=e=>b.value.user=e),placeholder:"用户名",autocomplete:"off",onKeyup:a[1]||(a[1]=d((e=>x(b.value)),["enter"]))},null,8,["modelValue"])])),_:1}),l(v,{class:"form-item",prop:"password"},{default:n((()=>[l(m,{modelValue:b.value.password,"onUpdate:modelValue":a[2]||(a[2]=e=>b.value.password=e),placeholder:"密码",type:"password",autocomplete:"off",onKeyup:a[3]||(a[3]=d((e=>x(b.value)),["enter"]))},null,8,["modelValue"])])),_:1}),l(f,{class:"theme-button",type:"primary",onClick:a[4]||(a[4]=e=>x(b.value)),onKeydown:a[5]||(a[5]=d((e=>{var a;13!==a.keyCode&&100!==a.keyCode||x(b.value)}),["enter"]))},{default:n((()=>a[6]||(a[6]=[p("登 陆 ")]))),_:1})])),_:1},8,["model"])]),a[7]||(a[7]=r("div",{class:"overlay_container"},[r("div",{class:"overlay"},[r("div",{class:"overlay_panel overlay_right_container"},[r("h2",{class:"container-title"},"hello friend!"),r("p",null,"输入您的个人信息,以便使用后台管理系统")])])],-1))])])}}},[["__scopeId","data-v-68d4afe9"]]);export{b as default};

View File

@ -0,0 +1 @@
import{t as e}from"./tableUser-CoV5BUx7.js";import{u as r,L as t}from"./index-hOIgOejC.js";import{a as s,o as a,c as o,B as c}from"./vendor-B2m3dX6z.js";import"./resource-D0hLzgq7.js";import"./empty-CvrMoGrV.js";const m={__name:"character",setup(m){let u={meta:{desc:"character",resource:"character",resource_url:"/resource/character",methods:{get:!0,post:!0,put:!0,delete:!0}}};return"admin"!==r().userInfo.character&&(u.meta.methods={}),t.setCache("resource",u),(r,t)=>(a(),s("div",null,[(a(),o(c(e)))]))}};export{m as default};

View File

@ -0,0 +1 @@
import{c as o,o as r,ag as s}from"./vendor-B2m3dX6z.js";import{_ as n}from"./index-hOIgOejC.js";const e=n({},[["render",function(n,e){const t=s;return r(),o(t,{description:"没有权限!请联系管理员添加权限!"})}]]);export{e};

View File

@ -0,0 +1 @@
import{t as s}from"./history-CNMnPJn_.js";import{c as o,o as t,B as e}from"./vendor-B2m3dX6z.js";import"./index-hOIgOejC.js";import"./empty-CvrMoGrV.js";const i={__name:"history",setup:i=>(i,r)=>(t(),o(e(s),{disableConditionInput:false}))};export{i as default};

View File

@ -0,0 +1 @@
import{r as e,T as a,a as l,o as t,c as o,u,B as n,F as s,U as p,w as r,b as d,V as i,a7 as v,a3 as m,a8 as c,W as g,v as h,C as y,d as f,X as V,Y as b,Z as x,D as w,a9 as I}from"./vendor-B2m3dX6z.js";import{_ as k,u as _,a as C}from"./index-hOIgOejC.js";import{e as U}from"./empty-CvrMoGrV.js";const z={class:"table-content"},j={class:"table"},D={class:"pagination-container"},R=k({__name:"history",props:{rowInfo:{},disableConditionInput:!0},setup(k){const R=k;let S=!0;!1===R.disableConditionInput&&(S=!1);const T="admin"===_().userInfo.character,A=e(T),B=e(1),F=e(20),G=e(R.userId);R.rowInfo&&void 0!==R.rowInfo.ID&&(G.value=R.rowInfo.ID);const K=e(""),N=e(""),P=e(""),W=e(""),X=e(!1),Y=[20,50,100],Z=e(0),q=e([]),E=()=>{C(B.value,F.value,G.value,K.value,N.value,P.value,W.value).then((e=>{q.value=e.data.list,Z.value=e.data.totalCount,X.value=!0}),(e=>{}))};a((()=>{E()}));const H=()=>{G.value="",K.value="",N.value="",P.value="",W.value=""},J=e=>{Z.value<=0||F.value*B.value>Z.value&&q.value.length>=Z.value||E()},L=e=>{E()};return(e,a)=>{const k=m,_=g,C=v,R=i,T=b,M=V,O=x,Q=y,$=w;return t(),l("div",{class:I(u(S)?"app-content1":"app-content")},[u(A)?(t(),l(s,{key:1},[u(X)?(t(),o($,{key:0},{default:r((()=>[d(R,{style:{"margin-bottom":"10px"}},{default:r((()=>[d(C,null,{default:r((()=>[!1===u(S)?(t(),o(k,{key:0,modelValue:u(G),"onUpdate:modelValue":a[0]||(a[0]=e=>c(G)?G.value=e:null),placeholder:"用户id",style:{width:"150px","margin-right":"10px"}},null,8,["modelValue"])):p("",!0),!1===u(S)?(t(),o(k,{key:1,modelValue:u(K),"onUpdate:modelValue":a[1]||(a[1]=e=>c(K)?K.value=e:null),placeholder:"操作资源类型",style:{width:"150px","margin-right":"10px"}},null,8,["modelValue"])):p("",!0),!1===u(S)?(t(),o(k,{key:2,modelValue:u(N),"onUpdate:modelValue":a[2]||(a[2]=e=>c(N)?N.value=e:null),placeholder:"操作资源组",style:{width:"150px","margin-right":"10px"}},null,8,["modelValue"])):p("",!0),!1===u(S)?(t(),o(k,{key:3,modelValue:u(P),"onUpdate:modelValue":a[3]||(a[3]=e=>c(P)?P.value=e:null),placeholder:"操作对象",style:{width:"150px","margin-right":"10px"}},null,8,["modelValue"])):p("",!0),!1===u(S)?(t(),o(k,{key:4,modelValue:u(W),"onUpdate:modelValue":a[4]||(a[4]=e=>c(W)?W.value=e:null),placeholder:"操作方法",style:{width:"150px","margin-right":"10px"}},null,8,["modelValue"])):p("",!0),!1===u(S)?(t(),o(_,{key:5,onClick:E,type:"primary",style:{"margin-right":"10px"}},{default:r((()=>a[7]||(a[7]=[h("条件搜索 ")]))),_:1})):p("",!0),!1===u(S)?(t(),o(_,{key:6,onClick:H},{default:r((()=>a[8]||(a[8]=[h("清空条件")]))),_:1})):p("",!0)])),_:1})])),_:1}),d(Q,null,{default:r((()=>[f("div",z,[f("div",j,[d(M,{data:u(q),style:{width:"100%"},"table-layout":"auto",stripe:"","tooltip-effect":"light"},{default:r((()=>[d(T,{prop:"userId",label:"用户id"}),d(T,{prop:"userName",label:"用户名"}),d(T,{prop:"opResourceType",label:"操作资源类型"}),d(T,{prop:"opResourceGroup",label:"操作资源组"}),d(T,{prop:"opResourceKey",label:"操作对象"}),d(T,{prop:"method",label:"操作方法"}),d(T,{prop:"createdAt",label:"创建时间"}),d(T,{prop:"detailInfo",label:"详情数据","show-overflow-tooltip":""})])),_:1},8,["data"])]),f("div",D,[d(O,{"current-page":u(B),"onUpdate:currentPage":a[5]||(a[5]=e=>c(B)?B.value=e:null),"page-size":u(F),"onUpdate:pageSize":a[6]||(a[6]=e=>c(F)?F.value=e:null),"page-sizes":Y,layout:"total, sizes, prev, pager, next, jumper",total:u(Z),onSizeChange:J,onCurrentChange:L},null,8,["current-page","page-size","total"])])])])),_:1})])),_:1})):p("",!0)],64)):(t(),o(n(U),{key:0}))],2)}}},[["__scopeId","data-v-926d7759"]]);export{R as t};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{t as e}from"./table-CdyUIl0m.js";import{L as s,u as a,c as r}from"./index-hOIgOejC.js";import{i as t,a as o,o as m,c,B as p}from"./vendor-B2m3dX6z.js";import"./resource-D0hLzgq7.js";import"./empty-CvrMoGrV.js";const i={__name:"project",setup(i){s.setCache("project",{}),t();let n=r;return"admin"!==a().userInfo.character&&(n.meta.methods={}),s.setCache("resource",n),(s,a)=>(m(),o("div",null,[(m(),c(p(e)))]))}};export{i as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{s as t}from"./index-hOIgOejC.js";function r(r,e){return t({url:r,method:"get",params:e})}function e(r,e){return t({url:r,method:"post",data:{dto:e}})}function o(r,e){return t({url:r,method:"put",data:{dto:e}})}function n(r,e){return t({url:r,method:"delete",data:e})}function u(r,e){return t({url:r+"/selection",method:"post",data:e})}function a(r){return t({url:"/project/"+r.toString()+"/items",method:"get"})}export{n as a,e as b,o as c,a as d,u as e,r};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{t as e}from"./tableUser-CoV5BUx7.js";import{u as s,L as r}from"./index-hOIgOejC.js";import{t}from"./history-CNMnPJn_.js";import{a as o,o as a,c,B as m}from"./vendor-B2m3dX6z.js";import"./resource-D0hLzgq7.js";import"./empty-CvrMoGrV.js";const u={__name:"user",setup(u){let n={meta:{desc:"user",resource:"user",resource_url:"/resource/user",methods:{get:!0,post:!0,put:!0,delete:!0}}};"admin"!==s().userInfo.character&&(n.meta.methods={}),r.setCache("resource",n);const p=[];return p.push({key:"user:exec:history",name:"执行记录",btn_color_type:"info",btn_type:1,btn_callback_component:t}),(s,r)=>(a(),o("div",null,[(a(),c(m(e),{rowClickDialogBtns:p}))]))}};export{u as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{a as s,o as a,d as e,b as n,v as t,t as o,u as r,aa as p,F as l}from"./vendor-B2m3dX6z.js";import{u}from"./index-hOIgOejC.js";const f={style:{"font-size":"40px"}},i={style:{color:"darkslategrey","font-size":"50px"}},m={__name:"welcome",setup(m){const c=u().userInfo;return(u,m)=>{const d=p;return a(),s(l,null,[e("span",f,[m[0]||(m[0]=t("亲爱的")),e("span",i,o(r(c).nick_name),1),m[1]||(m[1]=t("!欢迎使用本公司后台管理系统!"))]),n(d),m[2]||(m[2]=e("span",{style:{"font-size":"40px"}},"硬盘有价,数据无价,操作不规范,亲人两行泪。",-1))],64)}}};export{m as default};

Binary file not shown.