fix(share)
This commit is contained in:
parent
e534e62d68
commit
604cb87c53
Binary file not shown.
Before Width: | Height: | Size: 123 KiB |
|
@ -100,9 +100,11 @@ const BTable = (props: any) => {
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
<Button type="default" onClick={() => addHandler()}>
|
{
|
||||||
{btnText ?? "添加部门"}
|
config ? <Button type="default" onClick={() => addHandler()}>
|
||||||
</Button>
|
{btnText ?? "添加部门"}
|
||||||
|
</Button> : null
|
||||||
|
}
|
||||||
<Table
|
<Table
|
||||||
style={{ height: "100%", overflow: "auto" }}
|
style={{ height: "100%", overflow: "auto" }}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
|
@ -123,45 +125,48 @@ const BTable = (props: any) => {
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Modal
|
{
|
||||||
title={!record?.id ? "添加" : "编辑"}
|
config ? <Modal
|
||||||
width={800}
|
title={!record?.id ? "添加" : "编辑"}
|
||||||
open={isModalOpen}
|
width={800}
|
||||||
afterClose={() => formRef.current?.resetFields()}
|
open={isModalOpen}
|
||||||
onOk={() => formRef.current?.submit()}
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
okText="确定"
|
onOk={() => formRef.current?.submit()}
|
||||||
cancelText="取消"
|
okText="确定"
|
||||||
onCancel={() => {
|
cancelText="取消"
|
||||||
setIsModalOpen(false);
|
onCancel={() => {
|
||||||
}}
|
setIsModalOpen(false);
|
||||||
>
|
}}
|
||||||
<SimpleForm
|
>
|
||||||
formName={"user_form"}
|
<SimpleForm
|
||||||
formRef={formRef}
|
formName={"user_form"}
|
||||||
colProps={25}
|
formRef={formRef}
|
||||||
onFinish={() => {
|
colProps={25}
|
||||||
if (!record) {
|
onFinish={() => {
|
||||||
store.add(formRef.current?.getFieldsValue()).then((res) => {
|
if (!record) {
|
||||||
|
store.add(formRef.current?.getFieldsValue()).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
store.putItem(record.identity, formRef.current?.getFieldsValue()).then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
setIsModalOpen(false);
|
setIsModalOpen(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return
|
}}
|
||||||
}
|
createCallback={() => {
|
||||||
store.putItem(record.identity, formRef.current?.getFieldsValue()).then((res) => {
|
formRef.current?.setFieldsValue(record);
|
||||||
if (res) {
|
}}
|
||||||
setIsModalOpen(false);
|
formDatas={config}
|
||||||
}
|
>
|
||||||
});
|
{children ?? null}
|
||||||
}}
|
</SimpleForm>
|
||||||
createCallback={() => {
|
</Modal> : null
|
||||||
formRef.current?.setFieldsValue(record);
|
}
|
||||||
}}
|
|
||||||
formDatas={config}
|
|
||||||
>
|
|
||||||
{children ?? null}
|
|
||||||
</SimpleForm>
|
|
||||||
</Modal>
|
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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",
|
||||||
|
},
|
||||||
|
];
|
|
@ -1,5 +1,16 @@
|
||||||
export const My = () => {
|
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>
|
return <div>
|
||||||
my
|
<Tabs
|
||||||
|
defaultActiveKey="1"
|
||||||
|
items={items}
|
||||||
|
indicator={{ size: (origin) => origin - 20 }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
|
@ -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));
|
|
@ -0,0 +1,5 @@
|
||||||
|
const Used = () => {
|
||||||
|
return <p>常用</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Used;
|
|
@ -61,18 +61,18 @@ const routers = createHashRouter([
|
||||||
index: true,
|
index: true,
|
||||||
element: <Company />,
|
element: <Company />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/my/use",
|
||||||
|
index: true,
|
||||||
|
element: <My />,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
element: <Login />,
|
element: <Login />,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/my/use",
|
|
||||||
index: true,
|
|
||||||
element: <My />,
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export { routers };
|
export { routers };
|
||||||
|
|
|
@ -46,5 +46,12 @@ class EventConfig {
|
||||||
static ThingList: string = "/thing/byIdcard";
|
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 };
|
|
@ -5,6 +5,7 @@ import menuStore from './menu';
|
||||||
import depStore from './dep';
|
import depStore from './dep';
|
||||||
import companyStore from './company';
|
import companyStore from './company';
|
||||||
import thingStore from './thing';
|
import thingStore from './thing';
|
||||||
|
import shareStore from './share';
|
||||||
|
|
||||||
const store = {
|
const store = {
|
||||||
usrStore,
|
usrStore,
|
||||||
|
@ -14,6 +15,7 @@ const store = {
|
||||||
depStore,
|
depStore,
|
||||||
companyStore,
|
companyStore,
|
||||||
thingStore,
|
thingStore,
|
||||||
|
shareStore,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default store;
|
export default store;
|
|
@ -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;
|
Loading…
Reference in New Issue