@@ -1,13 +1,13 @@ | |||||
//数据字典 | |||||
export interface DataDictVO{ | |||||
//模板字典 | |||||
export interface TemplateDictVO{ | |||||
description: string; | description: string; | ||||
id: number; | id: number; | ||||
name: string; | name: string; | ||||
createTime?: number; | createTime?: number; | ||||
} | } | ||||
//数据字典详情 | |||||
export interface DataDictDetailVO { | |||||
//模板字典详情 | |||||
export interface TemplateDictDetailVO { | |||||
dictId: number; | dictId: number; | ||||
dictSort: number; | dictSort: number; | ||||
id: number; | id: number; | ||||
@@ -341,13 +341,13 @@ export interface TemplateInfoPageReqVO extends PageParam { | |||||
} | } | ||||
export interface DataDictPageReqVO extends PageParam { | |||||
export interface TemplateDictPageReqVO extends PageParam { | |||||
createTime?: string[]; | createTime?: string[]; | ||||
description?: string; | description?: string; | ||||
name?: string; | name?: string; | ||||
} | } | ||||
export interface DataDictDetaiPageReqVO extends PageParam { | |||||
export interface TemplateDictDetaiPageReqVO extends PageParam { | |||||
createTime?: string[]; | createTime?: string[]; | ||||
dictId?: number; | dictId?: number; | ||||
dictSort?: number; | dictSort?: number; | ||||
@@ -7,16 +7,16 @@ import { t } from '@/utils/i18n'; | |||||
import { PlusOutlined, ExclamationCircleFilled, SearchOutlined } from '@ant-design/icons'; | import { PlusOutlined, ExclamationCircleFilled, SearchOutlined } from '@ant-design/icons'; | ||||
import { antdUtils } from '@/utils/antd'; | import { antdUtils } from '@/utils/antd'; | ||||
import { useRequest } from '@/hooks/use-request'; | import { useRequest } from '@/hooks/use-request'; | ||||
import { DataDictVO, DataDictPageReqVO } from '@/models'; | |||||
import { TemplateDictVO, TemplateDictPageReqVO } from '@/models'; | |||||
import DictEditor from './dict-editor'; | import DictEditor from './dict-editor'; | ||||
import templateDictService from '@/request/service/template-dict'; | import templateDictService from '@/request/service/template-dict'; | ||||
export default (props: { | export default (props: { | ||||
onSelectItem: (item: DataDictVO) => void; | |||||
onSelectItem: (item: TemplateDictVO) => void; | |||||
}) => { | }) => { | ||||
const { onSelectItem } = props; | const { onSelectItem } = props; | ||||
const [dataDicts, setDataDicts] = useState<DataDictVO[]>(); | |||||
const [searchState, setSearchState] = useSetState<DataDictPageReqVO>({ | |||||
const [dataDicts, setDataDicts] = useState<TemplateDictVO[]>(); | |||||
const [searchState, setSearchState] = useSetState<TemplateDictPageReqVO>({ | |||||
pageNo: 1, | pageNo: 1, | ||||
pageSize: 10 | pageSize: 10 | ||||
}); | }); | ||||
@@ -25,7 +25,7 @@ export default (props: { | |||||
const [onSearching, setOnSearching] = useState(false); | const [onSearching, setOnSearching] = useState(false); | ||||
const [editorVisable, seEditorVisable] = useState<boolean>(false); | const [editorVisable, seEditorVisable] = useState<boolean>(false); | ||||
const [editData, seEditData] = useState<DataDictVO>(); | |||||
const [editData, seEditData] = useState<TemplateDictVO>(); | |||||
//获取字典分页数据 | //获取字典分页数据 | ||||
const { runAsync: getDictPageApi } = useRequest(templateDictService.getDictPageApi, { manual: true }); | const { runAsync: getDictPageApi } = useRequest(templateDictService.getDictPageApi, { manual: true }); | ||||
@@ -42,7 +42,7 @@ export default (props: { | |||||
} | } | ||||
} | } | ||||
const showDeleteConfirm = (item: DataDictVO) => { | |||||
const showDeleteConfirm = (item: TemplateDictVO) => { | |||||
antdUtils.modal?.confirm({ | antdUtils.modal?.confirm({ | ||||
title: `确认删除名称为: ${item.name} 的字典吗?`, | title: `确认删除名称为: ${item.name} 的字典吗?`, | ||||
icon: <ExclamationCircleFilled />, | icon: <ExclamationCircleFilled />, | ||||
@@ -64,7 +64,7 @@ export default (props: { | |||||
}); | }); | ||||
}; | }; | ||||
const getColumnSearchProps = (placeholder: string): ColumnType<DataDictVO> => ({ | |||||
const getColumnSearchProps = (placeholder: string): ColumnType<TemplateDictVO> => ({ | |||||
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => ( | filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => ( | ||||
<div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}> | <div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}> | ||||
<Input.Search | <Input.Search | ||||
@@ -99,7 +99,7 @@ export default (props: { | |||||
}, | }, | ||||
}); | }); | ||||
const columns: ColumnsType<DataDictVO> = [ | |||||
const columns: ColumnsType<TemplateDictVO> = [ | |||||
{ | { | ||||
title: '名称', | title: '名称', | ||||
dataIndex: 'name', | dataIndex: 'name', | ||||
@@ -145,8 +145,8 @@ export default (props: { | |||||
load(); | load(); | ||||
}, [searchState]); | }, [searchState]); | ||||
const onChange: TableProps<DataDictVO>['onChange'] = (pagination, filters, sorter, extra) => { | |||||
const state: DataDictPageReqVO = { | |||||
const onChange: TableProps<TemplateDictVO>['onChange'] = (pagination, filters, sorter, extra) => { | |||||
const state: TemplateDictPageReqVO = { | |||||
name: filters.name ? filters.name[0] as string : undefined, | name: filters.name ? filters.name[0] as string : undefined, | ||||
description: filters.description ? filters.description[0] as string : undefined, | description: filters.description ? filters.description[0] as string : undefined, | ||||
pageNo: pagination.current, | pageNo: pagination.current, | ||||
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' | |||||
import { Form, Input, InputNumber, Modal } from 'antd'; | import { Form, Input, InputNumber, Modal } from 'antd'; | ||||
import dictService from '@/request/service/template-dict-detail'; | import dictService from '@/request/service/template-dict-detail'; | ||||
import { useRequest } from '@/hooks/use-request'; | import { useRequest } from '@/hooks/use-request'; | ||||
import type { DataDictDetailVO } from '@/models' | |||||
import type { TemplateDictDetailVO } from '@/models' | |||||
import { antdUtils } from '@/utils/antd'; | import { antdUtils } from '@/utils/antd'; | ||||
const layout = { | const layout = { | ||||
@@ -13,9 +13,9 @@ const layout = { | |||||
export default (props: { | export default (props: { | ||||
visible: boolean; | visible: boolean; | ||||
onCancel: (flag?: boolean) => void; | onCancel: (flag?: boolean) => void; | ||||
onSave: (role: DataDictDetailVO) => void; | |||||
onSave: (role: TemplateDictDetailVO) => void; | |||||
dictId?: number; | dictId?: number; | ||||
data?: DataDictDetailVO | null; | |||||
data?: TemplateDictDetailVO | null; | |||||
}) => { | }) => { | ||||
const { visible, onCancel, onSave, dictId, data } = props; | const { visible, onCancel, onSave, dictId, data } = props; | ||||
@@ -6,12 +6,12 @@ import { t } from '@/utils/i18n'; | |||||
import { PlusOutlined, ExclamationCircleFilled } from '@ant-design/icons'; | import { PlusOutlined, ExclamationCircleFilled } from '@ant-design/icons'; | ||||
import { antdUtils } from '@/utils/antd'; | import { antdUtils } from '@/utils/antd'; | ||||
import { useRequest } from '@/hooks/use-request'; | import { useRequest } from '@/hooks/use-request'; | ||||
import { DataDictVO, DataDictDetailVO, DataDictDetaiPageReqVO } from '@/models'; | |||||
import { TemplateDictVO, TemplateDictDetailVO, TemplateDictDetaiPageReqVO } from '@/models'; | |||||
import DictDetailEditor from './dict-detail-editor'; | import DictDetailEditor from './dict-detail-editor'; | ||||
import templateDictDetailService from '@/request/service/template-dict-detail'; | import templateDictDetailService from '@/request/service/template-dict-detail'; | ||||
export interface DictDetailRef { | export interface DictDetailRef { | ||||
updateDictData: (dictData: DataDictVO) => void; | |||||
updateDictData: (dictData: TemplateDictVO) => void; | |||||
} | } | ||||
const defaultPage = { | const defaultPage = { | ||||
@@ -21,19 +21,19 @@ const defaultPage = { | |||||
export default forwardRef((props, ref) => { | export default forwardRef((props, ref) => { | ||||
const [dict, setDict] = useState<DataDictVO>(); | |||||
const [dataSource, setDataSource] = useState<DataDictDetailVO[]>(); | |||||
const [searchState, setSearchState] = useSetState<DataDictDetaiPageReqVO>(defaultPage); | |||||
const [dict, setDict] = useState<TemplateDictVO>(); | |||||
const [dataSource, setDataSource] = useState<TemplateDictDetailVO[]>(); | |||||
const [searchState, setSearchState] = useSetState<TemplateDictDetaiPageReqVO>(defaultPage); | |||||
const [total, setTotal] = useState(0); | const [total, setTotal] = useState(0); | ||||
const [detailEditorVisable, seEdtailEditorVisable] = useState<boolean>(false); | const [detailEditorVisable, seEdtailEditorVisable] = useState<boolean>(false); | ||||
const [editDetailData, seEditDetailData] = useState<DataDictDetailVO | null>(); | |||||
const [editDetailData, seEditDetailData] = useState<TemplateDictDetailVO | null>(); | |||||
const { runAsync: getPageApi } = useRequest(templateDictDetailService.getPageApi, { manual: true }); | const { runAsync: getPageApi } = useRequest(templateDictDetailService.getPageApi, { manual: true }); | ||||
const { runAsync: deleteApi } = useRequest(templateDictDetailService.deleteApi, { manual: true }); | const { runAsync: deleteApi } = useRequest(templateDictDetailService.deleteApi, { manual: true }); | ||||
useImperativeHandle(ref, () => ({ | useImperativeHandle(ref, () => ({ | ||||
updateDictData: (dictData: DataDictVO) => { | |||||
updateDictData: (dictData: TemplateDictVO) => { | |||||
setDict(dictData); | setDict(dictData); | ||||
setSearchState({...defaultPage, dictId: dictData.id}); | setSearchState({...defaultPage, dictId: dictData.id}); | ||||
}, | }, | ||||
@@ -53,7 +53,7 @@ export default forwardRef((props, ref) => { | |||||
} | } | ||||
}, [searchState]); | }, [searchState]); | ||||
const showDeleteConfirm = (item: DataDictDetailVO) => { | |||||
const showDeleteConfirm = (item: TemplateDictDetailVO) => { | |||||
antdUtils.modal?.confirm({ | antdUtils.modal?.confirm({ | ||||
title: `确认删除标签为: ${item.label} 的字典吗?`, | title: `确认删除标签为: ${item.label} 的字典吗?`, | ||||
icon: <ExclamationCircleFilled />, | icon: <ExclamationCircleFilled />, | ||||
@@ -76,7 +76,7 @@ export default forwardRef((props, ref) => { | |||||
}; | }; | ||||
const columns: ColumnsType<DataDictDetailVO> = [ | |||||
const columns: ColumnsType<TemplateDictDetailVO> = [ | |||||
{ | { | ||||
title: '字典标签', | title: '字典标签', | ||||
dataIndex: 'label', | dataIndex: 'label', | ||||
@@ -123,8 +123,8 @@ export default forwardRef((props, ref) => { | |||||
}, | }, | ||||
]; | ]; | ||||
const onChange: TableProps<DataDictDetailVO>['onChange'] = (pagination, filters, sorter, extra) => { | |||||
const state: DataDictDetaiPageReqVO = { | |||||
const onChange: TableProps<TemplateDictDetailVO>['onChange'] = (pagination, filters, sorter, extra) => { | |||||
const state: TemplateDictDetaiPageReqVO = { | |||||
pageNo: pagination.current, | pageNo: pagination.current, | ||||
pageSize: pagination.pageSize, | pageSize: pagination.pageSize, | ||||
dictId: dict?.id | dictId: dict?.id | ||||
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' | |||||
import { Form, Input, Modal } from 'antd'; | import { Form, Input, Modal } from 'antd'; | ||||
import dictService from '@/request/service/template-dict'; | import dictService from '@/request/service/template-dict'; | ||||
import { useRequest } from '@/hooks/use-request'; | import { useRequest } from '@/hooks/use-request'; | ||||
import type { DataDictVO } from '@/models' | |||||
import type { TemplateDictVO } from '@/models' | |||||
import { antdUtils } from '@/utils/antd'; | import { antdUtils } from '@/utils/antd'; | ||||
const layout = { | const layout = { | ||||
@@ -13,8 +13,8 @@ const layout = { | |||||
export default (props: { | export default (props: { | ||||
visible: boolean; | visible: boolean; | ||||
onCancel: (flag?: boolean) => void; | onCancel: (flag?: boolean) => void; | ||||
onSave: (role: DataDictVO) => void; | |||||
data?: DataDictVO | null; | |||||
onSave: (role: TemplateDictVO) => void; | |||||
data?: TemplateDictVO | null; | |||||
}) => { | }) => { | ||||
const { visible, onCancel, onSave, data } = props; | const { visible, onCancel, onSave, data } = props; | ||||
@@ -1,5 +1,5 @@ | |||||
import React, { useRef } from 'react'; | import React, { useRef } from 'react'; | ||||
import { DataDictVO } from '@/models'; | |||||
import { TemplateDictVO } from '@/models'; | |||||
import DictDetail from './dict-detail'; | import DictDetail from './dict-detail'; | ||||
import DictData from './dict-data'; | import DictData from './dict-data'; | ||||
import type { DictDetailRef } from './dict-detail' | import type { DictDetailRef } from './dict-detail' | ||||
@@ -13,7 +13,7 @@ export default () => { | |||||
<div className='flex flex-row'> | <div className='flex flex-row'> | ||||
<div className='basis-2/5 '> | <div className='basis-2/5 '> | ||||
<DictData | <DictData | ||||
onSelectItem={(item: DataDictVO) => { | |||||
onSelectItem={(item: TemplateDictVO) => { | |||||
detailRef.current?.updateDictData(item); | detailRef.current?.updateDictData(item); | ||||
}} /> | }} /> | ||||
</div> | </div> | ||||
@@ -1,22 +1,22 @@ | |||||
import request from '@/request'; | import request from '@/request'; | ||||
import { DataDictDetaiPageReqVO, DataDictDetailVO, PageData } from '@/models'; | |||||
import { TemplateDictDetaiPageReqVO, TemplateDictDetailVO, PageData } from '@/models'; | |||||
const BASE_URL = '/admin-api/template/dict-detail'; | const BASE_URL = '/admin-api/template/dict-detail'; | ||||
export default { | export default { | ||||
//获取字典详情分页数据 | //获取字典详情分页数据 | ||||
getPageApi(params: DataDictDetaiPageReqVO) { | |||||
return request.get<PageData<DataDictDetailVO>>(`${BASE_URL}/page`, { params }); | |||||
getPageApi(params: TemplateDictDetaiPageReqVO) { | |||||
return request.get<PageData<TemplateDictDetailVO>>(`${BASE_URL}/page`, { params }); | |||||
}, | }, | ||||
//创建模板-数据字典详情 | //创建模板-数据字典详情 | ||||
createApi(data: DataDictDetailVO) { | |||||
return request.post<DataDictDetailVO>(`${BASE_URL}/create`, data); | |||||
createApi(data: TemplateDictDetailVO) { | |||||
return request.post<TemplateDictDetailVO>(`${BASE_URL}/create`, data); | |||||
}, | }, | ||||
//更新模板-数据字典详情 | //更新模板-数据字典详情 | ||||
updateApi(data: DataDictDetailVO) { | |||||
return request.put<DataDictDetailVO>(`${BASE_URL}/update`, data); | |||||
updateApi(data: TemplateDictDetailVO) { | |||||
return request.put<TemplateDictDetailVO>(`${BASE_URL}/update`, data); | |||||
}, | }, | ||||
//删除模板-数据字典详情 | //删除模板-数据字典详情 | ||||
@@ -26,11 +26,11 @@ export default { | |||||
//获取模板-数据字典详情 | //获取模板-数据字典详情 | ||||
getApi(id: number) { | getApi(id: number) { | ||||
return request.get<DataDictDetailVO>(`${BASE_URL}/get?id=${id}`); | |||||
return request.get<TemplateDictDetailVO>(`${BASE_URL}/get?id=${id}`); | |||||
}, | }, | ||||
//获得模板-数据字典详情列表 | //获得模板-数据字典详情列表 | ||||
getListApi(ids: string[]) { | getListApi(ids: string[]) { | ||||
return request.get<PageData<DataDictDetailVO>>(`${BASE_URL}/list`, { params: { ids }}); | |||||
return request.get<PageData<TemplateDictDetailVO>>(`${BASE_URL}/list`, { params: { ids }}); | |||||
}, | }, | ||||
} | } |
@@ -1,13 +1,13 @@ | |||||
import request from '@/request'; | import request from '@/request'; | ||||
import { DataDictVO, DataDictDetailVO, DataDictPageReqVO, PageData } from '@/models'; | |||||
import { TemplateDictVO, TemplateDictDetailVO, TemplateDictPageReqVO, PageData } from '@/models'; | |||||
const BASE_URL = '/admin-api/template/dict'; | const BASE_URL = '/admin-api/template/dict'; | ||||
export default { | export default { | ||||
//获取字典分页 | //获取字典分页 | ||||
getDictPageApi: (params: DataDictPageReqVO) => { | |||||
return request.get<PageData<DataDictVO>>(`${BASE_URL}/page`, { params }); | |||||
getDictPageApi: (params: TemplateDictPageReqVO) => { | |||||
return request.get<PageData<TemplateDictVO>>(`${BASE_URL}/page`, { params }); | |||||
}, | }, | ||||
//获取字典详情 | //获取字典详情 | ||||
@@ -20,11 +20,11 @@ export default { | |||||
return request.get(`${BASE_URL}/list?ids=${ids.join(",")}`); | return request.get(`${BASE_URL}/list?ids=${ids.join(",")}`); | ||||
}, | }, | ||||
createDictApi: (data: DataDictVO) => { | |||||
createDictApi: (data: TemplateDictVO) => { | |||||
return request.post(`${BASE_URL}/create`, data); | return request.post(`${BASE_URL}/create`, data); | ||||
}, | }, | ||||
updateDictApi: (data: DataDictVO) => { | |||||
updateDictApi: (data: TemplateDictVO) => { | |||||
return request.put(`${BASE_URL}/update`, data); | return request.put(`${BASE_URL}/update`, data); | ||||
}, | }, | ||||
@@ -32,7 +32,7 @@ export default { | |||||
return request.delete(`${BASE_URL}/delete?id=${id}`); | return request.delete(`${BASE_URL}/delete?id=${id}`); | ||||
}, | }, | ||||
updateDictDetailApi: (data: DataDictDetailVO) => { | |||||
updateDictDetailApi: (data: TemplateDictDetailVO) => { | |||||
return request.put(`${BASE_URL}/update`, data); | return request.put(`${BASE_URL}/update`, data); | ||||
}, | }, | ||||