列表管理

dev
truthhun 11 months ago
parent 51e052d25d
commit 10bdfada92

@ -42,10 +42,11 @@ type Punishment struct {
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Type int32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"`
Enable int32 `protobuf:"varint,4,opt,name=enable,proto3" json:"enable,omitempty"`
Enable bool `protobuf:"varint,4,opt,name=enable,proto3" json:"enable,omitempty"`
Operators string `protobuf:"bytes,5,opt,name=operators,proto3" json:"operators,omitempty"`
Remark string `protobuf:"bytes,10,opt,name=remark,proto3" json:"remark,omitempty"`
Reason string `protobuf:"bytes,11,opt,name=reason,proto3" json:"reason,omitempty"`
Username string `protobuf:"bytes,12,opt,name=username,proto3" json:"username,omitempty"`
}
func (m *Punishment) Reset() { *m = Punishment{} }
@ -130,11 +131,11 @@ func (m *Punishment) GetType() int32 {
return 0
}
func (m *Punishment) GetEnable() int32 {
func (m *Punishment) GetEnable() bool {
if m != nil {
return m.Enable
}
return 0
return false
}
func (m *Punishment) GetOperators() string {
@ -158,6 +159,13 @@ func (m *Punishment) GetReason() string {
return ""
}
func (m *Punishment) GetUsername() string {
if m != nil {
return m.Username
}
return ""
}
type CancelPunishmentRequest struct {
Id []int64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"`
}
@ -409,49 +417,50 @@ func init() {
func init() { proto.RegisterFile("api/v1/punishment.proto", fileDescriptor_165d39e292001fbd) }
var fileDescriptor_165d39e292001fbd = []byte{
// 670 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4c,
0x10, 0xae, 0xe3, 0x34, 0x69, 0xa6, 0x6a, 0xd5, 0x7f, 0xff, 0xd0, 0xb8, 0x6e, 0x9b, 0x18, 0x1f,
0x50,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xfe, 0x40, 0x7b, 0x7b, 0x37, 0x62,
0x29, 0x25, 0x6c, 0xa0, 0x58, 0xb6, 0x8e, 0x37, 0x0f, 0x6b, 0x52, 0xe9, 0xc9, 0xbf, 0x00, 0x00,
0x00, 0xff, 0xff, 0x26, 0x59, 0x4f, 0x8f, 0x21, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -700,6 +709,13 @@ func (m *Punishment) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Username) > 0 {
i -= len(m.Username)
copy(dAtA[i:], m.Username)
i = encodeVarintPunishment(dAtA, i, uint64(len(m.Username)))
i--
dAtA[i] = 0x62
}
if len(m.Reason) > 0 {
i -= len(m.Reason)
copy(dAtA[i:], m.Reason)
@ -761,8 +777,13 @@ func (m *Punishment) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x2a
}
if m.Enable != 0 {
i = encodeVarintPunishment(dAtA, i, uint64(m.Enable))
if m.Enable {
i--
if m.Enable {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
@ -1035,8 +1056,8 @@ func (m *Punishment) Size() (n int) {
if m.Type != 0 {
n += 1 + sovPunishment(uint64(m.Type))
}
if m.Enable != 0 {
n += 1 + sovPunishment(uint64(m.Enable))
if m.Enable {
n += 2
}
l = len(m.Operators)
if l > 0 {
@ -1066,6 +1087,10 @@ func (m *Punishment) Size() (n int) {
if l > 0 {
n += 1 + l + sovPunishment(uint64(l))
}
l = len(m.Username)
if l > 0 {
n += 1 + l + sovPunishment(uint64(l))
}
return n
}
@ -1261,7 +1286,7 @@ func (m *Punishment) Unmarshal(dAtA []byte) error {
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Enable", wireType)
}
m.Enable = 0
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowPunishment
@ -1271,11 +1296,12 @@ func (m *Punishment) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Enable |= int32(b&0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Enable = bool(v != 0)
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Operators", wireType)
@ -1516,6 +1542,38 @@ func (m *Punishment) Unmarshal(dAtA []byte) error {
}
m.Reason = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowPunishment
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthPunishment
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthPunishment
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Username = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipPunishment(dAtA[iNdEx:])

@ -21,10 +21,11 @@ message Punishment {
int64 id = 1;
int64 user_id = 2;
int32 type = 3;
int32 enable = 4;
bool enable = 4;
string operators = 5;
string remark = 10;
string reason = 11;
string username = 12;
}
message CancelPunishmentRequest { repeated int64 id = 1; }

@ -150,7 +150,7 @@ func (s *AttachmentAPIService) ListAttachment(ctx context.Context, req *pb.ListA
util.CopyStruct(&attachments, &pbAttachments)
var (
userIds []interface{}
userIds []int64
userIdIndexMap = make(map[int64][]int)
)

@ -165,6 +165,36 @@ func (s *PunishmentAPIService) ListPunishment(ctx context.Context, req *pb.ListP
return nil, status.Errorf(codes.Internal, err.Error())
}
if len(res.Punishment) > 0 {
var (
userIds []int64
userIdMapIndexes = make(map[int64][]int)
)
for i, v := range res.Punishment {
userIds = append(userIds, v.UserId)
userIdMapIndexes[v.UserId] = append(userIdMapIndexes[v.UserId], i)
}
users, _, _ := s.dbModel.GetUserList(&model.OptionGetUserList{
Ids: userIds,
WithCount: false,
SelectFields: []string{
"id",
"username",
},
})
for _, v := range users {
if indexes, ok := userIdMapIndexes[v.Id]; ok {
for _, index := range indexes {
res.Punishment[index].Username = v.Username
}
}
}
}
return res, nil
}

@ -384,12 +384,8 @@ func (s *UserAPIService) ListUser(ctx context.Context, req *pb.ListUserRequest)
}
if len(req.Id) > 0 {
var ids []interface{}
for _, id := range req.Id {
ids = append(ids, id)
}
opt.WithCount = false
opt.Ids = ids
opt.Ids = req.Id
}
if len(req.GroupId) > 0 {

@ -192,7 +192,7 @@ type OptionGetUserList struct {
Page int
Size int
WithCount bool // 是否返回总数
Ids []interface{} // id列表
Ids []int64 // id列表
SelectFields []string // 查询字段
QueryRange map[string][2]interface{} // map[field][]{min,max}
QueryIn map[string][]interface{} // map[field][]{value1,value2,...}

@ -22,6 +22,7 @@
:show-edit="true"
:show-delete="false"
:show-select="true"
:actions-min-width="80"
@selectRow="selectRow"
@editRow="editRow"
/>
@ -63,12 +64,14 @@ import { genLinkHTML, parseQueryIntArray } from '~/utils/utils'
import TableList from '~/components/TableList.vue'
import FormSearch from '~/components/FormSearch.vue'
import FormPunishment from '~/components/FormPunishment.vue'
import { punishmentTypeOptions } from '~/utils/enum'
import { mapGetters } from 'vuex'
export default {
components: { TableList, FormSearch, FormPunishment },
layout: 'admin',
data() {
return {
punishmentTypeOptions,
loading: false,
formPunishmentVisible: false,
search: {
@ -190,37 +193,44 @@ export default {
},
{
type: 'select',
label: '',
name: 'enable',
placeholder: '',
label: '',
name: 'type',
placeholder: '',
multiple: true,
options: [
{ label: '', value: 1 },
{ label: '', value: 0 },
],
options: this.punishmentTypeOptions,
},
]
},
initTableListFields() {
const enumOptions = {}
this.punishmentTypeOptions.map((item) => {
enumOptions[item.value] = item
})
this.tableListFields = [
{ prop: 'id', label: 'ID', width: 80, type: 'number', fixed: 'left' },
{
prop: 'type',
label: '',
minWidth: 120,
type: 'enum',
enum: enumOptions,
},
{
prop: 'enable',
label: '',
label: '',
width: 80,
type: 'bool',
fixed: 'left',
},
{
prop: 'title_html',
label: '',
prop: 'user_id',
label: '',
minWidth: 150,
fixed: 'left',
type: 'html',
},
{ prop: 'link', label: '', minWidth: 250 },
{ prop: 'sort', label: '', width: 80, type: 'number' },
{ prop: 'description', label: '', minWidth: 250 },
{ prop: 'reason', label: '', minWidth: 250 },
{ prop: 'remark', label: '', minWidth: 250 },
{ prop: 'start_time', label: '', width: 160, type: 'datetime' },
{ prop: 'end_time', label: '', width: 160, type: 'datetime' },
{ prop: 'created_at', label: '', width: 160, type: 'datetime' },
{ prop: 'updated_at', label: '', width: 160, type: 'datetime' },
]

@ -124,3 +124,11 @@ export const datetimePickerOptions = {
},
],
}
export const punishmentTypeOptions = [
{ label: '', value: 1, type: 'danger' },
{ label: '', value: 2, type: 'warning' },
{ label: '', value: 3, type: 'warning' },
{ label: '', value: 4, type: 'warning' },
{ label: '', value: 5, type: 'warning' },
]

Loading…
Cancel
Save