Skip to content

Commit 8c3dc80

Browse files
committed
refactor(system/client): 优化客户端配置代码
1 parent 7f982b8 commit 8c3dc80

4 files changed

Lines changed: 45 additions & 42 deletions

File tree

src/apis/system/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ export interface ClientResp {
296296
timeout: string
297297
status: string
298298
isConcurrent: boolean
299-
maxLoginCount: number
300299
replacedRange: string
300+
maxLoginCount: number
301301
overflowLogoutMode: string
302302
createUser: string
303303
createTime: string

src/views/system/config/client/AddModal.vue

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ const [form, resetForm] = useResetReactive({
3939
timeout: 86400,
4040
isConcurrent: true,
4141
maxLoginCount: -1,
42-
replacedRange: 'ALL_DEVICE_TYPE',
43-
overflowLogoutMode: 'KICKOUT',
4442
status: 1,
4543
})
4644
@@ -82,7 +80,7 @@ const columns: ColumnItem[] = reactive([
8280
},
8381
{
8482
label: () => (
85-
<a-tooltip content="-1 代表不限制,永不冻结">
83+
<a-tooltip content="-1:不限制,永不冻结">
8684
Token 最低活跃频率&nbsp;
8785
<icon-question-circle />
8886
</a-tooltip>
@@ -102,7 +100,7 @@ const columns: ColumnItem[] = reactive([
102100
},
103101
{
104102
label: () => (
105-
<a-tooltip content="-1 代表永不过期">
103+
<a-tooltip content="-1:永不过期">
106104
Token 有效期
107105
<icon-question-circle />
108106
</a-tooltip>
@@ -133,10 +131,23 @@ const columns: ColumnItem[] = reactive([
133131
uncheckedText: '不允许',
134132
},
135133
},
134+
{
135+
label: '顶人下线的范围',
136+
field: 'replacedRange',
137+
type: 'select',
138+
span: 12,
139+
props: {
140+
options: replaced_range_enum,
141+
placeholder: '请选择顶人下线的范围',
142+
},
143+
disabled: () => {
144+
return form.isConcurrent
145+
},
146+
},
136147
{
137148
label: () => (
138-
<a-tooltip content="-1 代表不限">
139-
最大登录数量
149+
<a-tooltip content="-1:不限制">
150+
同一账号最大登录数量
140151
<icon-question-circle />
141152
</a-tooltip>
142153
),
@@ -145,11 +156,11 @@ const columns: ColumnItem[] = reactive([
145156
span: 12,
146157
slots: {
147158
append: () => (
148-
<span style={{ width: '80px', textAlign: 'center' }}>个</span>
159+
<span style={{ width: '30px', textAlign: 'center' }}>个</span>
149160
),
150161
},
151162
props: {
152-
placeholder: '请输入最大登录数量',
163+
placeholder: '请输入同一账号最大登录数量',
153164
min: -1,
154165
},
155166
disabled: () => {
@@ -158,35 +169,25 @@ const columns: ColumnItem[] = reactive([
158169
rules: [
159170
{
160171
validator: (value: number, callback: (errorMessage?: string) => void) => {
161-
if (value === 0) {
162-
callback('最大登录数量不能为0,请输入-1或正整数')
172+
if (value <= 0 && value !== -1) {
173+
callback('最大登录数量只能为 -1 或正整数')
163174
}
164175
callback()
165176
},
166177
},
167178
],
168179
},
169180
{
170-
label: '顶人下线的范围',
171-
field: 'replacedRange',
172-
type: 'select',
173-
span: 12,
174-
props: {
175-
options: replaced_range_enum,
176-
placeholder: '请选择顶人下线的范围',
177-
},
178-
disabled: () => {
179-
return form.isConcurrent
180-
},
181-
},
182-
{
183-
label: '溢出人数的注销方式',
181+
label: '溢出人数的下线方式',
184182
field: 'overflowLogoutMode',
185183
type: 'select',
186184
span: 12,
187185
props: {
188186
options: logout_mode_enum,
189-
placeholder: '请选择溢出人数的注销方式',
187+
placeholder: '请选择溢出人数的下线方式',
188+
},
189+
disabled: () => {
190+
return form.maxLoginCount === -1 || form.maxLoginCount === 0
190191
},
191192
},
192193
{

src/views/system/config/client/DetailDrawer.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
<a-tag v-if="dataDetail?.status === 1" color="green">启用</a-tag>
1818
<a-tag v-else color="red">禁用</a-tag>
1919
</a-descriptions-item>
20-
<a-descriptions-item label="是否允许多地登录" :span="2">
20+
<a-descriptions-item label="多地登录">
2121
<a-tag v-if="dataDetail?.isConcurrent" color="blue">允许</a-tag>
2222
<a-tag v-else color="orange">不允许</a-tag>
2323
</a-descriptions-item>
24-
<a-descriptions-item label="最大登录数量">
25-
{{ dataDetail?.maxLoginCount === -1 ? '不限' : dataDetail?.maxLoginCount }}
26-
</a-descriptions-item>
27-
<a-descriptions-item label="顶人下线范围">
24+
<a-descriptions-item label="下线范围">
2825
<GiCellTag :value="dataDetail?.replacedRange" :dict="replaced_range_enum" />
2926
</a-descriptions-item>
30-
<a-descriptions-item label="溢出注销方式" :span="2">
27+
<a-descriptions-item label="登录数量">
28+
{{ dataDetail?.maxLoginCount === -1 ? '不限制' : dataDetail?.maxLoginCount }}
29+
</a-descriptions-item>
30+
<a-descriptions-item label="溢出处理">
3131
<GiCellTag :value="dataDetail?.overflowLogoutMode" :dict="logout_mode_enum" />
3232
</a-descriptions-item>
3333
<a-descriptions-item label="创建人">{{ dataDetail?.createUserString }}</a-descriptions-item>

src/views/system/config/client/index.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:data="dataList"
66
:columns="columns"
77
:loading="loading"
8-
:scroll="{ x: '100%', y: '100%', minWidth: 1200 }"
8+
:scroll="{ x: '100%', y: '100%', minWidth: 1400 }"
99
:pagination="pagination"
1010
:disabled-tools="['size']"
1111
:disabled-column-keys="['clientKey']"
@@ -114,6 +114,7 @@ const columns: TableInstance['columns'] = [
114114
title: '客户端 ID',
115115
dataIndex: 'clientId',
116116
slotName: 'clientId',
117+
width: 180,
117118
ellipsis: true,
118119
tooltip: true,
119120
render: ({ record }) => {
@@ -147,7 +148,7 @@ const columns: TableInstance['columns'] = [
147148
},
148149
},
149150
{ title: 'Token 最低活跃频率', dataIndex: 'activeTimeout', slotName: 'activeTimeout', width: 180, align: 'center', render: ({ record }) => `${record.activeTimeout} 秒` },
150-
{ title: 'Token 有效期', dataIndex: 'timeout', slotName: 'timeout', align: 'center', render: ({ record }) => `${record.timeout} 秒` },
151+
{ title: 'Token 有效期', dataIndex: 'timeout', slotName: 'timeout', width: 180, align: 'center', render: ({ record }) => `${record.timeout} 秒` },
151152
{
152153
title: '状态',
153154
dataIndex: 'status',
@@ -158,31 +159,31 @@ const columns: TableInstance['columns'] = [
158159
},
159160
},
160161
{
161-
title: '是否允许多地登录',
162+
title: '多地登录',
162163
dataIndex: 'isConcurrent',
163164
align: 'center',
164165
render: ({ record }) => {
165166
return <Tag>{record.isConcurrent ? '允许' : '不允许'}</Tag>
166167
},
167168
},
168169
{
169-
title: '最大登录数量',
170-
dataIndex: 'maxLoginCount',
170+
title: '下线范围',
171+
dataIndex: 'replacedRange',
171172
align: 'center',
172173
render: ({ record }) => {
173-
return record.maxLoginCount === -1 ? '不限' : record.maxLoginCount
174+
return <GiCellTag value={record.replacedRange} dict={replaced_range_enum.value} />
174175
},
175176
},
176177
{
177-
title: '顶人下线范围',
178-
dataIndex: 'replacedRange',
178+
title: '登录数量',
179+
dataIndex: 'maxLoginCount',
179180
align: 'center',
180181
render: ({ record }) => {
181-
return <GiCellTag value={record.replacedRange} dict={replaced_range_enum.value} />
182+
return record.maxLoginCount === -1 ? '不限制' : record.maxLoginCount
182183
},
183184
},
184185
{
185-
title: '溢出注销方式',
186+
title: '溢出处理',
186187
dataIndex: 'overflowLogoutMode',
187188
align: 'center',
188189
render: ({ record }) => {
@@ -194,6 +195,7 @@ const columns: TableInstance['columns'] = [
194195
title: '操作',
195196
dataIndex: 'action',
196197
slotName: 'action',
198+
width: 160,
197199
align: 'center',
198200
fixed: !isMobile() ? 'right' : undefined,
199201
show: has.hasPermOr(['system:client:get', 'system:client:update', 'system:client:delete']),

0 commit comments

Comments
 (0)