添加审核功能

This commit is contained in:
likun 2025-07-11 03:28:23 +08:00
parent bcc8bc6c98
commit 26ef60a1ad
8 changed files with 93 additions and 39 deletions

View File

@ -67,7 +67,7 @@ func (svc *CommonResourceService) initCommonResourcesRepo(db *gorm.DB) {
{
roleMailRepo := r(consts.ResourcesName_MailRole, "个人邮件", repo.NewCommonResourceRepo(db, &model.RoleMail{}), ShowMethod_Get|ShowMethod_Post)
roleMailRepo.RowBtns = []*ResourceBtnInfo{
{&api.ResourceBtnInfo{Key: consts.BtnKeyRow_RoleMailReview, Name: "确认审核", BtnColorType: "primary"}, svc.handleServerUpOrDown},
{&api.ResourceBtnInfo{Key: consts.BtnKeyRow_RoleMailReview, Name: "确认审核", BtnColorType: "primary"}, svc.handleReviewRows},
}
} // 个人邮件发放就没法撤回?
@ -215,6 +215,9 @@ func (svc *CommonResourceService) Create(ctx context.Context, projectId int, res
createNeedReview = true
obj["ReviewCheckStatus"] = consts.OpReviewStatus_Pending
obj["ReviewNeedCharacters"] = getRsp.ReviewCharacters
} else {
obj["ReviewCheckStatus"] = consts.OpReviewStatus_DirectOk
obj["ReviewNeedCharacters"] = make([]string, 0)
}
}

View File

@ -201,8 +201,8 @@ func (svc *CommonResourceService) handleReviewRows(ctx context.Context, projectE
if resourceRepo.Repo.Need(projectEt, resourceName) {
for _, dtoObj := range params.Rows {
opRowId := dtoObj["ID"].(int)
_, dbEt, find, err := resourceRepo.Repo.GetById(projectEt, opRowId)
opRowId := dtoObj["ID"].(float64)
_, dbEt, find, err := resourceRepo.Repo.GetById(projectEt, int(opRowId))
if err != nil {
return nil, err
}
@ -217,11 +217,12 @@ func (svc *CommonResourceService) handleReviewRows(ctx context.Context, projectE
return nil, errcode.New(errcode.ParamsInvalid, "resource %v db data already review:%v", resourceName, opRowId)
}
dbObj["ProjectId"] = projectEt.GetProjectID()
dbObj["ReviewCheckStatus"] = consts.OpReviewStatus_Ok
dbObj["ReviewUserId"] = userId
dbObj["ReviewUserName"] = getRsp.User.UserName
_, err = resourceRepo.Repo.Edit(projectEt, dtoObj)
_, err = resourceRepo.Repo.Edit(projectEt, dbObj)
if err != nil {
return nil, err
}

View File

@ -56,5 +56,6 @@ func (m *RoleMail) GetStatusChoices(project *Project) []*dto.CommonDtoFieldChoic
return []*dto.CommonDtoFieldChoice{
{Desc: "审核通过已发放", Value: consts.OpReviewStatus_Ok, Type: 2}, // type: 0:plain 1:primary 2:success 3:info 4:warning 5:danger
{Desc: "待审核", Value: consts.OpReviewStatus_Pending, Type: 3},
{Desc: "已发放", Value: consts.OpReviewStatus_DirectOk, Type: 2},
}
}

View File

@ -19,7 +19,7 @@ type Permission struct {
type Character struct {
ID int `gorm:"primarykey" readonly:"true"`
Name string `name:"角色名" desc:"区别一组用户的名字例如qa、策划、运营" gorm:"type:varchar(255);unique" required:"true" uneditable:"true"`
WriteOpCheckCharacters []string `gorm:"type:varchar(255);" name:"操作审核员" desc:"不选表示敏感操作无需审核" choices:"GetCharChoices" multi_choice:"true"`
WriteOpCheckCharacters []string `gorm:"type:json;serializer:json" name:"操作审核员" desc:"不选表示敏感操作无需审核" type:"[]string" choices:"GetCharChoices" multi_choice:"true"`
// 权限列表,格式就是 ["project:<projectId>:<resource>:<get>", "sys:user:get", ...]
// 例如项目3封禁功能的列表获取权限"project:3:ban:list"
Permissions []string `gorm:"type:json;serializer:json" name:"权限列表" type:"Permissions"`

View File

@ -97,4 +97,5 @@ const (
const (
OpReviewStatus_Ok = "reviewed" // 审核通过
OpReviewStatus_Pending = "pending" // 待审核
OpReviewStatus_DirectOk = "dir_reviewed" // 无须审核直接通过
)

Binary file not shown.

View File

@ -15,6 +15,7 @@ import empty from '@/components/restful/empty.vue';
import {getWhereConditionDesc} from "@/utils/string.js";
import UserDetail from "@/components/game/userDetail.vue";
import router from "@/router/index.js";
import userStore from "@/stores/user.js";
const props = defineProps({
rowClickDialogBtns: Array,
@ -206,6 +207,10 @@ onMounted(() => {
listData();
})
const curCharacter = userStore().userInfo.character
console.log("当前用户角色:", curCharacter)
const dialogAddVisible = ref(false)
const dialogEditVisible = ref(false)
const dialogAddFormRef = ref(null)
@ -395,19 +400,41 @@ const handleDelete = (index, row) => {
}
function addItem(fieldDescInfo) {
let hasValidInput = false;
if (selectedItemBag.value != null && selectedItemBag.value.name !== undefined && selectedItemBag.value.name !== '') {
selectedItemBag.value.items.forEach((bagItem) => {
function itemBagSelectChange() {
console.log("选择礼包:", selectedItemBag.value)
let hasValidInput = false
if (selectedItemBag.value != null) {
selectedItemBag.value.forEach(bag => {
if (bag.name !== undefined && bag.name !== '') {
bag.items.forEach((bagItem) => {
if (typeof dialogObjectForm.value.Attach === typeof "") {
dialogObjectForm.value.Attach = [];
}
let d = {id: bagItem.item_id, num: bagItem.item_num, desc: bagItem.desc, item_type: bagItem.item_type};
dialogObjectForm.value.Attach.push(d);
})
console.log("添加礼包:", selectedItemBag.value)
console.log("添加礼包:", bag)
hasValidInput = true;
}
})
}
// if (!hasValidInput) {
// console.log("", selectedItemBag.value)
// ElMessage('')
// }
if (dialogAddVisible.value) {
dialogAddFormRef.value.validateField("Attach");
} else if (dialogEditVisible.value) {
// console.log("", rules.value)
// console.log("", dialogEditFormRef.value)
dialogEditFormRef.value.validateField("Attach");
}
}
function addItem(fieldDescInfo) {
let hasValidInput = false;
if (selectedItem.value !== null && selectedItem.value.value !== undefined && selectedItem.value.value !== '') {
if (selectedItemNum.value <= 0) {
ElMessage('请输入有效道具数量!')
@ -430,7 +457,6 @@ function addItem(fieldDescInfo) {
}
if (!hasValidInput) {
console.log("道具:", selectedItem.value)
console.log("礼包:", selectedItemBag.value)
ElMessage('请选择道具或者礼包!')
}
@ -693,8 +719,21 @@ const handleGenRandAccount = () => {
</el-button>
<template v-for="(btn, index) in rowClickBtns">
<template v-if="btn.btn_type === 0"> <!--直接发送选择行数据到服务器的按钮类型-->
<template v-if="scope.row['ReviewNeedCharacters'] !== undefined &&
scope.row['ReviewNeedCharacters'] !== null">
<el-button
:size="funcBtnSize"
:type="btn.btn_color_type"
@click="tableSelectRows2(btn, scope.$index, scope.row)"
v-if="scope.row['ReviewNeedCharacters'].includes(curCharacter) &&
scope.row['ReviewCheckStatus'] === 'pending'">
{{ btn.name }}
</el-button>
<div v-else/>
</template>
<el-button :size="funcBtnSize" :type="btn.btn_color_type"
@click="tableSelectRows2(btn, scope.$index, scope.row)">
@click="tableSelectRows2(btn, scope.$index, scope.row)" v-else>
{{ btn.name }}
</el-button>
</template>
@ -753,32 +792,35 @@ const handleGenRandAccount = () => {
<el-form :inline="true" :model="selectedItem" label-position="right">
<el-form-item :label="fieldDescInfo.name" :prop="fieldDescInfo.key" label-width="130px">
<el-tooltip effect="light" :content="fieldDescInfo.help_text" placement="top-start">
<el-select v-model="selectedItem" placeholder="--搜索道具--" style="width: 150px"
<el-select v-model="selectedItem" placeholder="--搜索道具--" style="width: 200px"
filterable remote clearable
:remote-method="handleQueryItem"
:loading="loadingRemoteItems"
value-key="value"
>
<el-option v-for="info in itemChoices" :key="info.value" :label="info.desc"
<el-option v-for="info in itemChoices" :key="info.value" :label="info.desc+'('+info.value+')'"
:value="info"></el-option>
</el-select>
</el-tooltip>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input type="number" v-model="selectedItemNum" placeholder="请输入数量" style="width: 150px"/>
<el-input type="number" v-model="selectedItemNum" placeholder="请输入数量" style="width: 100px"/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addItem(fieldDescInfo)">添加</el-button>
</el-form-item>
<!-- 选择礼包 -->
<el-form-item v-if="cachedResource.meta.resource !== 'item_bag'">
<el-tooltip effect="light" content="选择礼包,点击添加到奖励列表">
<el-select placeholder="--礼包--" v-model="selectedItemBag" clearable style="width: 150px"
value-key="name">
value-key="name" multiple @blur="itemBagSelectChange">
<el-option v-for="bag in itemBags" :key="bag.name" :label="bag.name" :value="bag"></el-option>
</el-select>
</el-tooltip>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addItem(fieldDescInfo)">添加</el-button>
</el-form-item>
</el-form>
<el-form-item label="奖励列表" prop="Attach">
<el-table :data="dialogObjectForm.Attach" border>
@ -875,36 +917,42 @@ const handleGenRandAccount = () => {
<!--如果是items类型就是物品下拉框+道具组合-->
<template v-if="(fieldDescInfo.type === 'items')">
<el-row>
<el-form :inline="true" :model="selectedItem" label-position="right"
label-width="130px">
<el-form-item :label="fieldDescInfo.name" :prop="fieldDescInfo.key">
<el-tooltip effect="light" :content="fieldDescInfo.help_text" placement="top-start">
<el-select placeholder="--搜索道具--" v-model="selectedItem" style="width: 150px"
<el-select placeholder="--搜索道具--" v-model="selectedItem" style="width: 200px"
filterable remote :remote-method="handleQueryItem"
:loading="loadingRemoteItems"
value-key="value"
>
<el-option v-for="info in itemChoices" :key="info.value" :label="info.desc"
<el-option v-for="info in itemChoices" :key="info.value" :label="info.desc+'('+info.value+')'"
:value="info"></el-option>
</el-select>
</el-tooltip>
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input type="number" v-model="selectedItemNum" placeholder="请输入数量" style="width: 150px"/>
<el-form-item label="数量" prop="number" label-width="40px">
<el-input type="number" v-model="selectedItemNum" placeholder="请输入数量" style="width: 100px"/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addItem(fieldDescInfo)">添加</el-button>
</el-form-item>
<!-- 选择礼包 -->
<el-form-item v-if="cachedResource.meta.resource !== 'item_bag'">
<el-tooltip effect="light" content="选择礼包,点击添加到奖励列表">
<el-select placeholder="--礼包--" v-model="selectedItemBag" clearable style="width: 150px"
value-key="name">
value-key="name" multiple @blur="itemBagSelectChange">
<el-option v-for="bag in itemBags" :key="bag.name" :label="bag.name" :value="bag"></el-option>
</el-select>
</el-tooltip>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addItem(fieldDescInfo)">添加</el-button>
</el-form-item>
</el-form>
</el-row>
<el-form-item label="奖励列表" prop="Attach">
<el-table :data="dialogObjectForm.Attach" border>
<el-table-column label="道具id" prop="id"/>

View File

@ -258,10 +258,10 @@ const userStore = defineStore(
]
}
projectRoute.children.push(biDashboardRoute)
projectRoute.children.push(biAnalyseRoute)
this.pushDynamicRouteChildren(biDashboardRoute)
this.pushDynamicRouteChildren(biAnalyseRoute)
// projectRoute.children.push(biDashboardRoute)
// projectRoute.children.push(biAnalyseRoute)
// this.pushDynamicRouteChildren(biDashboardRoute)
// this.pushDynamicRouteChildren(biAnalyseRoute)
// 添加游戏后台gm管理资源菜单
const resourceList = project.resource_list