Skip to content

Commit

Permalink
fix: 修复问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft authored and jianbing.chen committed Dec 18, 2024
1 parent 004a2d1 commit 6cab54c
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 71 deletions.
6 changes: 3 additions & 3 deletions packages/admin/src/components/BreadList/BreadList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default function BreadList() {
const { pageMap, menuMap } = useProjectStore(useShallow((state) => ({ pageMap: state.pageMap, menuMap: state.menuMap })));
// 生成面包屑
useEffect(() => {
const page_id = getPageId(pageId, pageMap);
if (!page_id) return;
const menuItem = pageMap[Number(page_id)];
const id = getPageId(pageId, pageMap);
if (!id) return;
const menuItem = pageMap[Number(id)];
if (pathname.endsWith('/welcome')) {
setMenuPath([{ title: '欢迎页' }]);
return;
Expand Down
18 changes: 9 additions & 9 deletions packages/docs/src/page/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"pageId": 341,
"pageName": "dsfc",
"remark": "432432",
"stg_state": 1,
"pre_state": 1,
"prd_state": 1,
"user_id": 49,
"stgState": 1,
"preState": 1,
"prdState": 1,
"userId": 49,
"config": {
"props": {
"theme": "#1677ff"
Expand Down Expand Up @@ -67,12 +67,12 @@
"timeout": 8,
"timeoutErrorMessage": "请求超时,请稍后再试"
},
"is_public": 1,
"is_edit": 1,
"isPublic": 1,
"isEdit": 1,
"preview_img": null,
"stg_publish_id": 0,
"pre_publish_id": 0,
"prd_publish_id": 0
"stgPublishId": 0,
"prePublishId": 0,
"prdPublishId": 0
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface PublishListParams {
env: 'stg' | 'pre' | 'prd'; // 1 stg 2 pre 3 prod;
start?: string;
end?: string;
publishUserId?: string;
userName?: string;
pageId: number;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/ApiConfig/ApiConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ApiConfigComponent = () => {
() => {
handleUpdate(form.getFieldValue('id'));
},
{ wait: 500 },
{ wait: 800 },
);

// 更新接口配置
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/layout/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const Header = memo(() => {
setLoading(true);
const pageInfo = JSON.stringify({
...pageData,
// 下面字段排除在page_data外
// 下面字段排除在pageData外
stgState: undefined,
preState: undefined,
prdState: undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/layout/components/Menu/CodingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const CodingPanel = () => {
pageData: JSON.stringify({
...pageData,
pageId: undefined,
// 下面字段排除在page_data外
// 下面字段排除在pageData外
stgState: undefined,
preState: undefined,
prdState: undefined,
Expand Down
3 changes: 1 addition & 2 deletions packages/editor/src/packages/Scene/MarsTable/MarsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ const MarsTable = ({ id, type, config, elements, onCheckedChange }: ComponentTyp
}
return {
rowSelection,
...config.props,
rowKey: config.props.rowKey || 'id',
bordered: config.props.bordered,
size: config.props.size,
columns: config.props.columns.map((item, index) => {
return {
...item,
Expand Down
97 changes: 84 additions & 13 deletions packages/editor/src/packages/Scene/MarsTable/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@ export default {
label: '显示边框',
name: ['bordered'],
},
{
type: 'Select',
label: '表格尺寸',
name: ['size'],
props: {
options: [
{ label: '默认', value: 'large' },
{ label: '中等', value: 'middle' },
{ label: '紧凑', value: 'small' },
],
},
},

{
type: 'Select',
label: '单选/多选',
Expand Down Expand Up @@ -73,6 +62,12 @@ export default {
placeholder: 'eg: 600',
},
},
{
type: 'Switch',
label: '虚拟滚动',
name: ['virtual'],
tooltip: '开启虚拟滚动时,必须设置滚动轴X和Y值。',
},
{
type: 'Select',
label: '空值显示',
Expand All @@ -86,6 +81,18 @@ export default {
],
},
},
{
type: 'Select',
label: '表格尺寸',
name: ['size'],
props: {
options: [
{ label: '默认', value: 'large' },
{ label: '中等', value: 'middle' },
{ label: '紧凑', value: 'small' },
],
},
},
{
type: 'Title',
label: '列配置',
Expand All @@ -107,6 +114,27 @@ export default {
return <TableSetting key="TableSetting" form={form} />;
},
},
{
type: 'Title',
label: '展开配置',
key: 'expandable',
tooltip: '树形表格时生效',
},
{
type: 'Input',
label: '树形结构列名',
name: ['expandable', 'childrenColumnName'],
},
{
type: 'Switch',
label: '展开所有',
name: ['expandable', 'defaultExpandAllRows'],
},
{
type: 'InputNumber',
label: '缩进宽度',
name: ['expandable', 'indentSize'],
},
{
type: 'Title',
label: '分页配置',
Expand Down Expand Up @@ -193,13 +221,18 @@ export default {
selectionType: '',
leftTitle: '查询列表',
empty: '-',
expandable: {
defaultExpandAllRows: true,
childrenColumnName: 'children',
indentSize: 15,
},
// 组件默认属性值
columns: [
{
title: '姓名',
dataIndex: 'name',
key: 'name',
width: 90,
width: 190,
align: 'center',
},
{
Expand Down Expand Up @@ -326,6 +359,44 @@ export default {
status: '在售',
createdAt: new Date().getTime(),
area: '热带、亚热带和温带地区',
children: [
{
id: 1002,
name: '萤火虫',
type: '昆虫',
avatar: `${import.meta.env.VITE_CDN_URL}/s1.png`,
time: 10,
skill: ['飞', '发光', '御敌'],
sales: 9.9,
status: '在售',
createdAt: new Date().getTime(),
},
],
},
{
id: 1003,
name: '萤火虫',
type: '昆虫',
avatar: `${import.meta.env.VITE_CDN_URL}/s1.png`,
time: 10,
skill: ['飞', '发光', '御敌'],
sales: 9.9,
status: '在售',
createdAt: new Date().getTime(),
area: '热带、亚热带和温带地区',
children: [
{
id: 1004,
name: '萤火虫',
type: '昆虫',
avatar: `${import.meta.env.VITE_CDN_URL}/s1.png`,
time: 10,
skill: ['飞', '发光', '御敌'],
sales: 9.9,
status: '在售',
createdAt: new Date().getTime(),
},
],
},
],
},
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/pages/admin/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ const Config: React.FC = memo(() => {
const handleSubmit = async () => {
try {
await form.validateFields();
const values = form.getFieldsValue();
const { breadcrumb, tag, footer, ...rest } = form.getFieldsValue();
setLoading(true);
if (type === 'create') {
await addProject(values);
await addProject({ ...rest, tag: tag ? 1 : 0, footer: footer ? 1 : 0, breadcrumb: breadcrumb ? 1 : 0 });
message.success('创建成功');
navigate('/projects');
} else {
await updateProject(values);
await updateProject({ ...rest, tag: tag ? 1 : 0, footer: footer ? 1 : 0, breadcrumb: breadcrumb ? 1 : 0 });
message.success('更新成功');
}
setLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/pages/admin/menu/CreateMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function CreateMenu(props: IModalProp<Menu.EditParams>) {
onCancel={handleCancel}
>
<Spin spinning={loading}>
<Form form={form} labelAlign="right" labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} initialValues={{ type: 1, status: 1, is_create: 2 }}>
<Form form={form} labelAlign="right" labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} initialValues={{ type: 1, status: 1, isCreate: 2 }}>
<Form.Item hidden name="id">
<Input />
</Form.Item>
Expand Down Expand Up @@ -188,7 +188,7 @@ export default function CreateMenu(props: IModalProp<Menu.EditParams>) {
></Select>
</Form.Item>
) : (
<Form.Item label="生成页面" name="is_create" extra="如果你创建的是末级菜单,请给它生成一个页面,父菜单不需要生成。">
<Form.Item label="生成页面" name="isCreate" extra="如果你创建的是末级菜单,请给它生成一个页面,父菜单不需要生成。">
<Radio.Group>
<Radio value={1}></Radio>
<Radio value={2}></Radio>
Expand Down
20 changes: 10 additions & 10 deletions packages/editor/src/pages/editor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Editor = () => {
pageData = JSON.parse(res.pageData || '{}');
} catch (error) {
console.error(error);
console.info('【json数据】', res.page_data);
console.info('【json数据】', res.pageData);
message.error('页面数据格式错误,请检查');
}
savePageInfo({
Expand All @@ -73,15 +73,15 @@ const Editor = () => {
pageId: res.id,
pageName: res.name,
remark: res.remark,
is_public: res.isPublic,
is_edit: res.isEdit,
preview_img: res.previewImg,
stg_publish_id: res.stgPublishId,
pre_publish_id: res.prePublishId,
prd_publish_id: res.prdPublishId,
stg_state: res.stgState,
pre_state: res.preState,
prd_state: res.prdState,
isPublic: res.isPublic,
isEdit: res.isEdit,
previewImg: res.previewImg,
stgPublishId: res.stgPublishId,
prePublishId: res.prePublishId,
prdPublishId: res.prdPublishId,
stgState: res.stgState,
preState: res.preState,
prdState: res.prdState,
userId: res.userId,
});
setLoaded(true);
Expand Down
14 changes: 7 additions & 7 deletions packages/editor/src/pages/publishHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface HistoryItem {
env: EnvType;
pageId: number;
page_name: string;
page_data: string;
pageData: string;
userName: string;
createdAt: string;
updatedAt: string;
Expand Down Expand Up @@ -75,11 +75,11 @@ export default function PublishHistory() {
},
{
title: '页面数据',
key: 'page_data',
key: 'pageData',
align: 'center',
render(_, record) {
return (
<Button type="link" onClick={() => handleView(record.page_data)}>
<Button type="link" onClick={() => handleView(record.pageData)}>
查看页面数据
</Button>
);
Expand Down Expand Up @@ -139,7 +139,7 @@ export default function PublishHistory() {
pageSize: pagination.pageSize,
env: activeKey,
pageId: parseInt(id),
publishUserId: name,
userName: name,
start,
end,
});
Expand All @@ -161,9 +161,9 @@ export default function PublishHistory() {
async function getReleaseVersion() {
const res = await getPageDetail(parseInt(id));
setLastPublish({
stg: res.stg_publish_id,
pre: res.pre_publish_id,
prd: res.prd_publish_id,
stg: res.stgPublishId,
pre: res.prePublishId,
prd: res.prdPublishId,
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/stores/pageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ export const usePageStore = create<PageState & PageAction>((set) => ({
pageId: 0,
pageName: '',
remark: '',
stg_state: 1,
pre_state: 1,
prd_state: 1,
stgState: 1,
preState: 1,
prdState: 1,
userId: '',
config: {
props: {},
Expand Down
Loading

0 comments on commit 6cab54c

Please sign in to comment.