Skip to content

Commit 25da301

Browse files
committed
refactor(system/storage): 重构存储管理页面,分页列表 => 无分页卡片
1 parent 819fe61 commit 25da301

File tree

13 files changed

+840
-363
lines changed

13 files changed

+840
-363
lines changed

src/apis/system/storage.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export type * from './type'
66
const BASE_URL = '/system/storage'
77

88
/** @desc 查询存储列表 */
9-
export function listStorage(query: T.StoragePageQuery) {
10-
return http.get<PageRes<T.StorageResp[]>>(`${BASE_URL}`, query)
9+
export function listStorage(query: T.StorageQuery) {
10+
return http.get<T.StorageResp[]>(`${BASE_URL}/list`, query)
1111
}
1212

1313
/** @desc 查询存储详情 */
@@ -29,3 +29,13 @@ export function updateStorage(data: any, id: string) {
2929
export function deleteStorage(id: string) {
3030
return http.del(`${BASE_URL}/${id}`)
3131
}
32+
33+
/** @desc 修改存储状态 */
34+
export function updateStorageStatus(data: any, id: string) {
35+
return http.put(`${BASE_URL}/${id}/status`, data)
36+
}
37+
38+
/** @desc 设置默认存储 */
39+
export function setDefaultStorage(id: string) {
40+
return http.put(`${BASE_URL}/${id}/default`)
41+
}

src/apis/system/type.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,9 @@ export interface StorageResp {
253253
}
254254
export interface StorageQuery {
255255
description?: string
256-
status?: number
256+
type?: number
257257
sort: Array<string>
258258
}
259-
export interface StoragePageQuery extends StorageQuery, PageQuery {
260-
}
261259

262260
/** 终端类型 */
263261
export interface ClientResp {

src/components/GiForm/src/GiForm.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ const dicData: Record<string, any> = reactive({})
142142
const getComponentBindProps = (item: ColumnItem) => {
143143
// 组件默认配置映射表
144144
const ConfigMap = new Map<ColumnItem['type'], Partial<ColumnItem['props'] & { placeholder: string }>>([
145-
['input', { allowClear: true, placeholder: `请输入${item.label}`, maxLength: 255 }],
145+
['input', { allowClear: true, placeholder: `请输入${item.label}`, maxLength: 255, showWordLimit: true }],
146146
['input-number', { placeholder: `请输入${item.label}` }],
147-
['textarea', { allowClear: false, placeholder: `请输入${item.label}`, maxLength: 200 }],
147+
['textarea', { allowClear: false, placeholder: `请输入${item.label}`, maxLength: 200, showWordLimit: true, autoSize: { minRows: 3, maxRows: 5 } }],
148148
['input-tag', { allowClear: true, placeholder: `请输入${item.label}` }],
149149
['mention', { allowClear: true, placeholder: `请输入${item.label}` }],
150150
['select', { allowClear: true, placeholder: `请选择${item.label}`, options: dicData[item.field] || [] }],
@@ -169,7 +169,8 @@ const valueChange = (value: any, field: string) => {
169169
/** 表单项校验规则 */
170170
const getFormItemRules = (item: ColumnItem) => {
171171
if (item.required) {
172-
return [{ required: true, message: `${item.label}为必填项` }, ...(Array.isArray(item.rules) ? item.rules : [])]
172+
const defaultProps = getComponentBindProps(item)
173+
return [{ required: true, message: defaultProps.placeholder || `请输入${item.label}` }, ...(Array.isArray(item.rules) ? item.rules : [])]
173174
}
174175
return item.rules
175176
}

src/styles/global.scss

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,19 @@
213213

214214
// 卡片标题,标题左侧的伪类样式
215215
.gi_card_title {
216-
.arco-card-header-title::before {
217-
content: '';
218-
width: 4px;
219-
height: 50%;
220-
position: absolute;
221-
left: 0;
222-
top: 50%;
223-
transform: translateY(-50%);
224-
background-color: rgb(var(--warning-5));
225-
border-radius: 0 4px 4px 0;
216+
> .arco-card-header {
217+
border-bottom: none;
218+
.arco-card-header-title::before {
219+
content: '';
220+
width: 4px;
221+
height: 50%;
222+
position: absolute;
223+
left: 0;
224+
top: 50%;
225+
transform: translateY(-50%);
226+
background-color: rgb(var(--primary-5));
227+
border-radius: 0 4px 4px 0;
228+
}
226229
}
227230
}
228231

src/views/system/config/index.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ const change = (key: string | number) => {
5757
<style scoped lang="scss">
5858
.gi_table_page {
5959
overflow-y: auto;
60+
61+
:deep(.arco-tabs) {
62+
overflow: visible;
63+
}
6064
}
65+
6166
:deep(.arco-tabs .arco-tabs-nav-type-card-gutter .arco-tabs-tab-active) {
6267
box-shadow: inset 0 2px 0 rgb(var(--primary-6)), inset -1px 0 0 var(--color-border-2),
6368
inset 1px 0 0 var(--color-border-2);
@@ -77,10 +82,6 @@ const change = (key: string | number) => {
7782
right: -20px;
7883
}
7984
80-
:deep(.arco-tabs) {
81-
overflow: visible;
82-
}
83-
8485
:deep(.arco-tabs-nav) {
8586
overflow: visible;
8687
}

src/views/system/storage/StorageAddDrawer.vue

Lines changed: 0 additions & 198 deletions
This file was deleted.

0 commit comments

Comments
 (0)