fix(share)

This commit is contained in:
wang_yp 2025-07-07 23:14:25 +08:00
parent e534e62d68
commit 604cb87c53
10 changed files with 133 additions and 47 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

View File

@ -100,9 +100,11 @@ const BTable = (props: any) => {
};
return (
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
<Button type="default" onClick={() => addHandler()}>
{
config ? <Button type="default" onClick={() => addHandler()}>
{btnText ?? "添加部门"}
</Button>
</Button> : null
}
<Table
style={{ height: "100%", overflow: "auto" }}
pagination={false}
@ -123,7 +125,8 @@ const BTable = (props: any) => {
onChange={onChange}
/>
</div>
<Modal
{
config ? <Modal
title={!record?.id ? "添加" : "编辑"}
width={800}
open={isModalOpen}
@ -161,7 +164,9 @@ const BTable = (props: any) => {
>
{children ?? null}
</SimpleForm>
</Modal>
</Modal> : null
}
</Space>
);
};

18
src/pages/my/config.tsx Normal file
View File

@ -0,0 +1,18 @@
import { UserDataType } from "@/model/userModel";
import { ColumnsType } from "antd/lib/table";
export const columns: ColumnsType<UserDataType> = [
{
title: "分享内容",
dataIndex: "user_identity",
width: 200,
fixed: "left",
},
{
title: "分享类型",
dataIndex: "share_type",
},
{
title: "分享单位",
dataIndex: "company_identity",
},
];

View File

@ -1,5 +1,16 @@
import { Tabs, TabsProps } from "antd";
import MuShare from "./mu_share";
import Used from "./used";
export const My = () => {
const items: TabsProps['items'] = [
{ key: '1', label: '我的分享', children: <MuShare /> },
{ key: '2', label: '常用数据', children: <Used />},
];
return <div>
my
<Tabs
defaultActiveKey="1"
items={items}
indicator={{ size: (origin) => origin - 20 }}
/>
</div>
}

24
src/pages/my/mu_share.tsx Normal file
View File

@ -0,0 +1,24 @@
import BTable from "@/components/b_table";
import { Store } from "antd/es/form/interface";
import { inject, observer } from "mobx-react";
import { columns } from "./config";
import { useEffect } from "react";
const MuShare = (props: Store) => {
const { shareStore } = props;
useEffect(() => {
shareStore.getlist();
}, [shareStore]);
return <BTable
store={shareStore}
scroll={{ x: "max-content" }}
columns={columns}
btnText="添加人员"
dataSource={shareStore.list}
deleteCallback={(record) => {
shareStore.deleteItem(record);
}}
/>
}
export default inject("shareStore")(observer(MuShare));

5
src/pages/my/used.tsx Normal file
View File

@ -0,0 +1,5 @@
const Used = () => {
return <p></p>
}
export default Used;

View File

@ -61,18 +61,18 @@ const routers = createHashRouter([
index: true,
element: <Company />,
},
{
path: "/my/use",
index: true,
element: <My />,
},
],
},
{
path: "/login",
element: <Login />,
},
{
path: "/my/use",
index: true,
element: <My />,
},
]);
export { routers };

View File

@ -46,5 +46,12 @@ class EventConfig {
static ThingList: string = "/thing/byIdcard";
}
class ShareConfig {
static ADD: string = "/share";
static EDIT: string = "/share";
static LIST: string = "/share/list";
static DELETE: string = "/share";
}
export { RoleConfig, UserConfig, MenuConfig, DepConfig, CompanyConfig, EventConfig };
export { RoleConfig, UserConfig, MenuConfig, DepConfig, CompanyConfig, EventConfig,ShareConfig };

View File

@ -5,6 +5,7 @@ import menuStore from './menu';
import depStore from './dep';
import companyStore from './company';
import thingStore from './thing';
import shareStore from './share';
const store = {
usrStore,
@ -14,6 +15,7 @@ const store = {
depStore,
companyStore,
thingStore,
shareStore,
};
export default store;

14
src/store/share.ts Normal file
View File

@ -0,0 +1,14 @@
import { makeObservable } from "mobx";
import BaseStore from "./baseStore";
import { UserDataType } from "@/model/userModel";
import { ShareConfig } from "@/service/user_config";
class ShareStore extends BaseStore<UserDataType> {
constructor() {
super(ShareConfig)
makeObservable(this, {
})
}
}
const shareStore = new ShareStore();
export default shareStore;