Quellcode durchsuchen

update: rename DataDict to TemplateDict

dev
powersir vor 1 Jahr
Ursprung
Commit
ae31a6e8fa
8 geänderte Dateien mit 50 neuen und 50 gelöschten Zeilen
  1. +6
    -6
      src/models/template.data.ts
  2. +10
    -10
      src/pages/custom/template/dict/dict-data.tsx
  3. +3
    -3
      src/pages/custom/template/dict/dict-detail-editor.tsx
  4. +11
    -11
      src/pages/custom/template/dict/dict-detail.tsx
  5. +3
    -3
      src/pages/custom/template/dict/dict-editor.tsx
  6. +2
    -2
      src/pages/custom/template/dict/index.tsx
  7. +9
    -9
      src/request/service/template-dict-detail.ts
  8. +6
    -6
      src/request/service/template-dict.ts

+ 6
- 6
src/models/template.data.ts Datei anzeigen

@@ -1,13 +1,13 @@
//数据字典
export interface DataDictVO{
//模板字典
export interface TemplateDictVO{
description: string;
id: number;
name: string;
createTime?: number;
}

//数据字典详情
export interface DataDictDetailVO {
//模板字典详情
export interface TemplateDictDetailVO {
dictId: number;
dictSort: number;
id: number;
@@ -341,13 +341,13 @@ export interface TemplateInfoPageReqVO extends PageParam {
}


export interface DataDictPageReqVO extends PageParam {
export interface TemplateDictPageReqVO extends PageParam {
createTime?: string[];
description?: string;
name?: string;
}

export interface DataDictDetaiPageReqVO extends PageParam {
export interface TemplateDictDetaiPageReqVO extends PageParam {
createTime?: string[];
dictId?: number;
dictSort?: number;


+ 10
- 10
src/pages/custom/template/dict/dict-data.tsx Datei anzeigen

@@ -7,16 +7,16 @@ import { t } from '@/utils/i18n';
import { PlusOutlined, ExclamationCircleFilled, SearchOutlined } from '@ant-design/icons';
import { antdUtils } from '@/utils/antd';
import { useRequest } from '@/hooks/use-request';
import { DataDictVO, DataDictPageReqVO } from '@/models';
import { TemplateDictVO, TemplateDictPageReqVO } from '@/models';
import DictEditor from './dict-editor';
import templateDictService from '@/request/service/template-dict';

export default (props: {
onSelectItem: (item: DataDictVO) => void;
onSelectItem: (item: TemplateDictVO) => void;
}) => {
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,
pageSize: 10
});
@@ -25,7 +25,7 @@ export default (props: {
const [onSearching, setOnSearching] = useState(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 });
@@ -42,7 +42,7 @@ export default (props: {
}
}

const showDeleteConfirm = (item: DataDictVO) => {
const showDeleteConfirm = (item: TemplateDictVO) => {
antdUtils.modal?.confirm({
title: `确认删除名称为: ${item.name} 的字典吗?`,
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 }) => (
<div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}>
<Input.Search
@@ -99,7 +99,7 @@ export default (props: {
},
});

const columns: ColumnsType<DataDictVO> = [
const columns: ColumnsType<TemplateDictVO> = [
{
title: '名称',
dataIndex: 'name',
@@ -145,8 +145,8 @@ export default (props: {
load();
}, [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,
description: filters.description ? filters.description[0] as string : undefined,
pageNo: pagination.current,


+ 3
- 3
src/pages/custom/template/dict/dict-detail-editor.tsx Datei anzeigen

@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
import { Form, Input, InputNumber, Modal } from 'antd';
import dictService from '@/request/service/template-dict-detail';
import { useRequest } from '@/hooks/use-request';
import type { DataDictDetailVO } from '@/models'
import type { TemplateDictDetailVO } from '@/models'
import { antdUtils } from '@/utils/antd';

const layout = {
@@ -13,9 +13,9 @@ const layout = {
export default (props: {
visible: boolean;
onCancel: (flag?: boolean) => void;
onSave: (role: DataDictDetailVO) => void;
onSave: (role: TemplateDictDetailVO) => void;
dictId?: number;
data?: DataDictDetailVO | null;
data?: TemplateDictDetailVO | null;
}) => {

const { visible, onCancel, onSave, dictId, data } = props;


+ 11
- 11
src/pages/custom/template/dict/dict-detail.tsx Datei anzeigen

@@ -6,12 +6,12 @@ import { t } from '@/utils/i18n';
import { PlusOutlined, ExclamationCircleFilled } from '@ant-design/icons';
import { antdUtils } from '@/utils/antd';
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 templateDictDetailService from '@/request/service/template-dict-detail';

export interface DictDetailRef {
updateDictData: (dictData: DataDictVO) => void;
updateDictData: (dictData: TemplateDictVO) => void;
}

const defaultPage = {
@@ -21,19 +21,19 @@ const defaultPage = {

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 [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: deleteApi } = useRequest(templateDictDetailService.deleteApi, { manual: true });

useImperativeHandle(ref, () => ({
updateDictData: (dictData: DataDictVO) => {
updateDictData: (dictData: TemplateDictVO) => {
setDict(dictData);
setSearchState({...defaultPage, dictId: dictData.id});
},
@@ -53,7 +53,7 @@ export default forwardRef((props, ref) => {
}
}, [searchState]);

const showDeleteConfirm = (item: DataDictDetailVO) => {
const showDeleteConfirm = (item: TemplateDictDetailVO) => {
antdUtils.modal?.confirm({
title: `确认删除标签为: ${item.label} 的字典吗?`,
icon: <ExclamationCircleFilled />,
@@ -76,7 +76,7 @@ export default forwardRef((props, ref) => {
};


const columns: ColumnsType<DataDictDetailVO> = [
const columns: ColumnsType<TemplateDictDetailVO> = [
{
title: '字典标签',
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,
pageSize: pagination.pageSize,
dictId: dict?.id


+ 3
- 3
src/pages/custom/template/dict/dict-editor.tsx Datei anzeigen

@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
import { Form, Input, Modal } from 'antd';
import dictService from '@/request/service/template-dict';
import { useRequest } from '@/hooks/use-request';
import type { DataDictVO } from '@/models'
import type { TemplateDictVO } from '@/models'
import { antdUtils } from '@/utils/antd';

const layout = {
@@ -13,8 +13,8 @@ const layout = {
export default (props: {
visible: boolean;
onCancel: (flag?: boolean) => void;
onSave: (role: DataDictVO) => void;
data?: DataDictVO | null;
onSave: (role: TemplateDictVO) => void;
data?: TemplateDictVO | null;
}) => {

const { visible, onCancel, onSave, data } = props;


+ 2
- 2
src/pages/custom/template/dict/index.tsx Datei anzeigen

@@ -1,5 +1,5 @@
import React, { useRef } from 'react';
import { DataDictVO } from '@/models';
import { TemplateDictVO } from '@/models';
import DictDetail from './dict-detail';
import DictData from './dict-data';
import type { DictDetailRef } from './dict-detail'
@@ -13,7 +13,7 @@ export default () => {
<div className='flex flex-row'>
<div className='basis-2/5 '>
<DictData
onSelectItem={(item: DataDictVO) => {
onSelectItem={(item: TemplateDictVO) => {
detailRef.current?.updateDictData(item);
}} />
</div>


+ 9
- 9
src/request/service/template-dict-detail.ts Datei anzeigen

@@ -1,22 +1,22 @@
import request from '@/request';
import { DataDictDetaiPageReqVO, DataDictDetailVO, PageData } from '@/models';
import { TemplateDictDetaiPageReqVO, TemplateDictDetailVO, PageData } from '@/models';

const BASE_URL = '/admin-api/template/dict-detail';

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) {
return request.get<DataDictDetailVO>(`${BASE_URL}/get?id=${id}`);
return request.get<TemplateDictDetailVO>(`${BASE_URL}/get?id=${id}`);
},
//获得模板-数据字典详情列表
getListApi(ids: string[]) {
return request.get<PageData<DataDictDetailVO>>(`${BASE_URL}/list`, { params: { ids }});
return request.get<PageData<TemplateDictDetailVO>>(`${BASE_URL}/list`, { params: { ids }});
},
}

+ 6
- 6
src/request/service/template-dict.ts Datei anzeigen

@@ -1,13 +1,13 @@
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';

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(",")}`);
},

createDictApi: (data: DataDictVO) => {
createDictApi: (data: TemplateDictVO) => {
return request.post(`${BASE_URL}/create`, data);
},

updateDictApi: (data: DataDictVO) => {
updateDictApi: (data: TemplateDictVO) => {
return request.put(`${BASE_URL}/update`, data);
},

@@ -32,7 +32,7 @@ export default {
return request.delete(`${BASE_URL}/delete?id=${id}`);
},

updateDictDetailApi: (data: DataDictDetailVO) => {
updateDictDetailApi: (data: TemplateDictDetailVO) => {
return request.put(`${BASE_URL}/update`, data);
},



Laden…
Abbrechen
Speichern