config.d.ts
4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tinymce } from '/@/components/Tinymce/index';
// import { findDictItemByCode } from '/@/api/system/dict';
import { getOrganizationList } from '/@/api/system/system';
import { copyTransFun } from '/@/utils/fnUtils';
import { Tag } from 'ant-design-vue';
import { NotificationTitleMaxLength } from '/@/utils/rules';
export enum IsOrgEnum {
IS_ORG_ENUM = '1',
}
export const isOrg = (type: string) => {
return type === IsOrgEnum.IS_ORG_ENUM;
};
export const columns: BasicColumn[] = [
{
title: '类型',
dataIndex: 'type',
width: 200,
format: (_text: string, record: Recordable) => {
return record.type === 'NOTICE'
? '公告'
: record.type === 'MEETING'
? '会议'
: record.type === 'OTHER'
? '其他'
: '';
},
},
{
title: '标题',
dataIndex: 'title',
width: 200,
},
{
title: '内容',
dataIndex: 'content',
width: 120,
format: (text: string, record: Recordable) => {
return !record.content ? '' : record.content.slice(3, record.content.length - 4);
},
},
{
title: '发送者',
dataIndex: 'senderName',
width: 200,
format: (text: string, record: Recordable) => {
return record.senderName ? record.senderName : '无';
},
},
{
title: '状态',
dataIndex: 'status',
width: 200,
customRender: ({ record }) => {
const status = record.status;
const enable = status === '已发布' ? '已发布' : status === '草稿' ? '草稿' : '其他';
const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red';
const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他';
return h(Tag, { color: color }, () => text);
},
},
];
export const formSchema: FormSchema[] = [
{
field: 'type',
label: '类型',
colProps: { span: 24 },
required: true,
component: 'RadioGroup',
componentProps: {
options: [
{
label: '公告',
value: 'NOTICE',
},
{
label: '会议',
value: 'MEETING',
},
{
label: '其他',
value: 'OTHER',
},
],
},
},
{
field: 'title',
label: '标题',
required: true,
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '请输入标题',
maxLength: 200,
},
rules: NotificationTitleMaxLength,
},
{
field: 'content',
component: 'Input',
colProps: { span: 24 },
label: '内容',
required: true,
defaultValue: '',
render: ({ model, field }) => {
return h(Tinymce, {
value: model[field],
onChange: (value: string) => {
model[field] = value;
},
});
},
},
{
field: 'receiverType',
required: true,
label: '接收者',
colProps: { span: 13 },
component: 'Select',
componentProps: {
placeholder: '接收者',
options: [
{ label: '全部', value: '0' },
{ label: '组织', value: '1' },
],
},
},
{
field: 'organizationId',
label: '所属组织',
colProps: { span: 13 },
component: 'ApiTreeSelect',
required: true,
componentProps: {
multiple: true,
api: async () => {
const data = await getOrganizationList();
copyTransFun(data as any as any[]);
return data;
},
},
ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')),
},
{
field: 'abc',
component: 'Input',
label: '',
colProps: {
span: 12,
},
slot: 'add',
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'type',
label: '',
colProps: { span: 8 },
component: 'Select',
componentProps: {
options: [
{
label: '公告',
value: 'NOTICE',
},
{
label: '会议',
value: 'MEETING',
},
{
label: '其他',
value: 'OTHER',
},
],
},
},
];
export const detailColumns: BasicColumn[] = [
{
title: '接收者',
dataIndex: 'user.realName',
width: 200,
},
{
title: '阅读状态',
dataIndex: 'readStatus',
width: 200,
slots: { customRender: 'readStatus' },
},
{
title: '阅读时间',
dataIndex: 'readDate',
width: 200,
},
];