fix(api):update store
This commit is contained in:
parent
dc86692261
commit
836806a12c
|
@ -26,24 +26,24 @@ const BTable = (props: any) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Table
|
<Table
|
||||||
style={{height:"100%",overflow:"auto"}}
|
style={{ height: "100%", overflow: "auto" }}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
loading={store.listStatus}
|
loading={store.listStatus}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
columns={props.columns}
|
columns={props.columns}
|
||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
/>
|
/>
|
||||||
<div style={{textAlign:"right",padding:"10px"}}>
|
<div style={{ textAlign: "right", padding: "10px" }}>
|
||||||
<Pagination
|
<Pagination
|
||||||
size="small"
|
size="small"
|
||||||
defaultCurrent={1}
|
defaultCurrent={1}
|
||||||
pageSize={20}
|
pageSize={20}
|
||||||
showSizeChanger={true}
|
showSizeChanger={true}
|
||||||
total={store.total}
|
total={store.total}
|
||||||
onShowSizeChange= {onShowSizeChange}
|
onShowSizeChange={onShowSizeChange}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,12 +10,14 @@ export enum FormType {
|
||||||
cehckbox = "checkbox",
|
cehckbox = "checkbox",
|
||||||
password = "password",
|
password = "password",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FormDatas {
|
export interface FormDatas {
|
||||||
type: string,
|
type: string,
|
||||||
label: string,
|
label: string,
|
||||||
name: string,
|
name: string,
|
||||||
value: any,
|
value: any,
|
||||||
selectUrl?: string,
|
selectUrl?: string,
|
||||||
|
selectList?: Array<selectItem>
|
||||||
rules: Array<rules>
|
rules: Array<rules>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,4 +38,10 @@ export interface SimpleFormData {
|
||||||
export interface rules {
|
export interface rules {
|
||||||
required: boolean,
|
required: boolean,
|
||||||
message: string,
|
message: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface selectItem {
|
||||||
|
name: string,
|
||||||
|
id: number,
|
||||||
}
|
}
|
|
@ -4,21 +4,23 @@ import { useEffect, useState } from "react";
|
||||||
import baseHttp from "@/service/base";
|
import baseHttp from "@/service/base";
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
export const FormSelect = (v: FormDatas) => {
|
export const FormSelect = (v: FormDatas) => {
|
||||||
const [list, setList] = useState([]);
|
const [list, setList] = useState<any>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
baseHttp
|
if (v.selectList && v.selectList.length > 0) {
|
||||||
.get(`${v.selectUrl}/?size=100&offset=1` ?? "", "")
|
setList(v.selectList);
|
||||||
.then((res) => {
|
} else {
|
||||||
|
baseHttp.get(`${v.selectUrl}/?size=50&offset=1` ?? "", "").then((res) => {
|
||||||
setList(res.data.record ?? []);
|
setList(res.data.record ?? []);
|
||||||
});
|
});
|
||||||
}, [v.selectUrl]);
|
}
|
||||||
|
}, [v.selectUrl, v.selectList]);
|
||||||
return (
|
return (
|
||||||
<Form.Item key={v.label} label={v.label} name={v.name} rules={v.rules}>
|
<Form.Item key={v.label} label={v.label} name={v.name} rules={v.rules}>
|
||||||
<Select placeholder="">
|
<Select placeholder="">
|
||||||
{list?.map((v: any) => {
|
{list?.map((v: any) => {
|
||||||
return (
|
return (
|
||||||
<Option key={v.id} value={v.id}>
|
<Option key={v.id} value={v.id}>
|
||||||
{v.dep_name}
|
{v.name}
|
||||||
</Option>
|
</Option>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Content, Header } from "antd/es/layout/layout";
|
||||||
import "./layout.less";
|
import "./layout.less";
|
||||||
import { Menu } from "antd";
|
import { Menu } from "antd";
|
||||||
import { Footer } from "antd/lib/layout/layout";
|
import { Footer } from "antd/lib/layout/layout";
|
||||||
import { Outlet, useNavigate } from "react-router";
|
import { Outlet, useLocation, useNavigate } from "react-router";
|
||||||
import { HomeTwoTone } from "@ant-design/icons";
|
import { HomeTwoTone } from "@ant-design/icons";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import { Store } from "antd/es/form/interface";
|
import { Store } from "antd/es/form/interface";
|
||||||
|
@ -10,11 +10,14 @@ import { useEffect } from "react";
|
||||||
const LayOut = (props: Store) => {
|
const LayOut = (props: Store) => {
|
||||||
const { usrStore } = props;
|
const { usrStore } = props;
|
||||||
const nav = useNavigate();
|
const nav = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (usrStore.isNeedLogin) {
|
if (usrStore.isNeedLogin) {
|
||||||
nav("/login");
|
nav("/login");
|
||||||
}
|
}
|
||||||
}, [usrStore,nav]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [usrStore.isNeedLogin]);
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
key: "/admin/user",
|
key: "/admin/user",
|
||||||
|
@ -29,9 +32,13 @@ const LayOut = (props: Store) => {
|
||||||
label: `档案管理`,
|
label: `档案管理`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "/admin/whseMgmt",
|
key: "/admin/whse/whseMgmt",
|
||||||
label: `仓库管理`,
|
label: `仓库管理`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/materialMgmt",
|
||||||
|
label: `物资管理`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "/admin/leaveApproval",
|
key: "/admin/leaveApproval",
|
||||||
label: `请假审批`,
|
label: `请假审批`,
|
||||||
|
@ -44,10 +51,7 @@ const LayOut = (props: Store) => {
|
||||||
key: `/admin/polRegulations`,
|
key: `/admin/polRegulations`,
|
||||||
label: `政治法规管理`,
|
label: `政治法规管理`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: "/admin/materialMgmt",
|
|
||||||
label: `物资管理`,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: "/admin/teamMgmt",
|
key: "/admin/teamMgmt",
|
||||||
label: `队伍属性管理`,
|
label: `队伍属性管理`,
|
||||||
|
@ -68,6 +72,7 @@ const LayOut = (props: Store) => {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
padding: "0 10px",
|
padding: "0 10px",
|
||||||
|
boxSizing: "border-box"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<HomeTwoTone
|
<HomeTwoTone
|
||||||
|
@ -77,7 +82,7 @@ const LayOut = (props: Store) => {
|
||||||
<Menu
|
<Menu
|
||||||
theme="dark"
|
theme="dark"
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
defaultSelectedKeys={["/admin/user"]}
|
defaultSelectedKeys={[location.pathname]}
|
||||||
items={items}
|
items={items}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
nav(e.key);
|
nav(e.key);
|
||||||
|
|
|
@ -8,11 +8,12 @@ const Login = (props) => {
|
||||||
const { usrStore } = props;
|
const { usrStore } = props;
|
||||||
const formRef = React.useRef<FormInstance>(null);
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const onFinish = (values: any) => {
|
const onFinish = async (values: any) => {
|
||||||
usrStore.login({
|
await usrStore.login({
|
||||||
userName: values.account,
|
userName: values.account,
|
||||||
passWord: values.password,
|
passWord: values.password,
|
||||||
});
|
});
|
||||||
|
usrStore.closeLoginDilog()
|
||||||
navigate("/admin/user", { replace: true });
|
navigate("/admin/user", { replace: true });
|
||||||
};
|
};
|
||||||
const onFinishFailed = () => {};
|
const onFinishFailed = () => {};
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
|
import { Tabs, TabsProps } from "antd";
|
||||||
|
import MaterialCat from "./materialCat";
|
||||||
|
import Material from "./material";
|
||||||
|
|
||||||
const MaterialMgmt = () => {
|
const MaterialMgmt = () => {
|
||||||
|
const onChange = (key: string) => {
|
||||||
|
console.log(key);
|
||||||
|
};
|
||||||
|
const items: TabsProps['items'] = [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
label: '物资分类管理',
|
||||||
|
children: <MaterialCat />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2',
|
||||||
|
label: '物资管理',
|
||||||
|
children: <Material />
|
||||||
|
},
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>MaterialMgmt</p>
|
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,127 @@
|
||||||
|
import { Button, Space, Modal, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import BTable from "@/components/b_table";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { columns, defaultConfig } from "./material_column";
|
||||||
|
|
||||||
|
const Material = (props: Store) => {
|
||||||
|
const { materialStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
materialStore.getlist();
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
}, [materialStore]);
|
||||||
|
const column_widget = (any, record) => {
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
materialStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const edit = (record) => {
|
||||||
|
setIsModalOpen(true);
|
||||||
|
setRecord(record);
|
||||||
|
};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
pid:values.pid??0
|
||||||
|
};
|
||||||
|
if (!record?.id) {
|
||||||
|
materialStore.add(data);
|
||||||
|
} else {
|
||||||
|
materialStore.putItem(record.id, data);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(null);
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加物资
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<BTable
|
||||||
|
store={materialStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={materialStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={!record?.id ? "添加物资" : "编辑物资"}
|
||||||
|
width={1200}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
if (record?.id) {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
} else {
|
||||||
|
formRef.current?.setFieldsValue(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("materialStore")(observer(Material));
|
|
@ -0,0 +1,127 @@
|
||||||
|
import { Button, Space, Modal, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import BTable from "@/components/b_table";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { columns, defaultConfig } from "./mcat_column";
|
||||||
|
|
||||||
|
const MaterialCat = (props: Store) => {
|
||||||
|
const { materialCatStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
materialCatStore.getlist();
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
}, [materialCatStore]);
|
||||||
|
const column_widget = (any, record) => {
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
materialCatStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const edit = (record) => {
|
||||||
|
setIsModalOpen(true);
|
||||||
|
setRecord(record);
|
||||||
|
};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
pid:values.pid??0
|
||||||
|
};
|
||||||
|
if (!record?.id) {
|
||||||
|
materialCatStore.add(data);
|
||||||
|
} else {
|
||||||
|
materialCatStore.putItem(record.id, data);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(null);
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加物资分类
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<BTable
|
||||||
|
store={materialCatStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={materialCatStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={!record?.id ? "添加个人属性" : "编辑个人属性"}
|
||||||
|
width={1200}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
if (record?.id) {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
} else {
|
||||||
|
formRef.current?.setFieldsValue(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("materialCatStore")(observer(MaterialCat));
|
|
@ -0,0 +1,89 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "物资名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "物资描述",
|
||||||
|
dataIndex: "desc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "过期时间",
|
||||||
|
dataIndex: "storage_identity",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "货架名称",
|
||||||
|
dataIndex: "expiry_date",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "货架位置",
|
||||||
|
dataIndex: "storage_cloumn",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "所属仓库",
|
||||||
|
dataIndex: "expiry_date",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: FormType.select,
|
||||||
|
label: "所属仓库",
|
||||||
|
name: "stash_identity",
|
||||||
|
value: "",
|
||||||
|
selectUrl:"storage/list",
|
||||||
|
rules: [{ required: true, message: "请输入物资名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "所属货架",
|
||||||
|
name: "storage_identity",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请选择货架!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "货架位置",
|
||||||
|
name: "storage_cloumn",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请选择货架位置!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.select,
|
||||||
|
label: "物资分类",
|
||||||
|
name: "catory_identity",
|
||||||
|
value: 0,
|
||||||
|
selectUrl:"suppliesCat/list",
|
||||||
|
rules: [{ required: true, message: "请选择物资分类!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "物资名称",
|
||||||
|
name: "name",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入物资名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "物资描述",
|
||||||
|
name: "desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入物资描述!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.date,
|
||||||
|
label: "过期时间",
|
||||||
|
name: "expiry_date",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请选择过期时间!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.upload,
|
||||||
|
label: "物资图片",
|
||||||
|
name: "supplie_piker",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
];
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "分类名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "分类描述",
|
||||||
|
dataIndex: "desc",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "分类名称",
|
||||||
|
name: "name",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.select,
|
||||||
|
label: "上级分类",
|
||||||
|
name: "pid",
|
||||||
|
value: 0,
|
||||||
|
selectUrl:"suppliesCat/list",
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "分类描述",
|
||||||
|
name: "desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库位置信息!" }],
|
||||||
|
},
|
||||||
|
];
|
|
@ -1,10 +1,128 @@
|
||||||
const PersMgmt = () => {
|
import { Button, Space, Modal, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import BTable from "@/components/b_table";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { columns, defaultConfig } from "./pers_column";
|
||||||
|
|
||||||
|
const PersMgmt = (props: Store) => {
|
||||||
|
const { persMgmtStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
persMgmtStore.getlist();
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
}, [persMgmtStore]);
|
||||||
|
const column_widget = (any, record) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<Space wrap>
|
||||||
<p>PersMgmt</p>
|
<Button
|
||||||
</>
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
persMgmtStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const edit = (record) => {
|
||||||
export default PersMgmt;
|
setIsModalOpen(true);
|
||||||
|
setRecord(record);
|
||||||
|
};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
score: Number(values.score),
|
||||||
|
};
|
||||||
|
data.file_url = "";
|
||||||
|
if (!record?.id) {
|
||||||
|
persMgmtStore.add(data);
|
||||||
|
} else {
|
||||||
|
persMgmtStore.putItem(record.id, data);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(null);
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加个人属性
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<BTable
|
||||||
|
store={persMgmtStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={persMgmtStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={!record?.id ? "添加个人属性" : "编辑个人属性"}
|
||||||
|
width={1200}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
if (record?.id) {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
} else {
|
||||||
|
formRef.current?.setFieldsValue(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("persMgmtStore")(observer(PersMgmt));
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "个人属性名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "个人属性描述",
|
||||||
|
dataIndex: "desc",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "个人属性名称",
|
||||||
|
name: "name",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "个人属性描述",
|
||||||
|
name: "desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库位置信息!" }],
|
||||||
|
},
|
||||||
|
];
|
|
@ -0,0 +1,130 @@
|
||||||
|
import { Button, Space, Modal, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import BTable from "@/components/b_table";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { columns, defaultConfig } from "./storage_column";
|
||||||
|
import { useParams } from "react-router";
|
||||||
|
|
||||||
|
const Storage = (props: Store) => {
|
||||||
|
const { storageStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
const { id } = useParams();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
storageStore.getlist({ stash_identity: id });
|
||||||
|
}, [id, storageStore]);
|
||||||
|
const column_widget = (any, record) => {
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
storageStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const edit = (record) => {
|
||||||
|
setIsModalOpen(true);
|
||||||
|
setRecord(record);
|
||||||
|
};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
column_all_num: Number(values.column_all_num),
|
||||||
|
stash_identity: id,
|
||||||
|
};
|
||||||
|
if (!record?.id) {
|
||||||
|
storageStore.add(data,{stash_identity:id});
|
||||||
|
} else {
|
||||||
|
storageStore.putItem(record.id, data,{stash_identity:id});
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(null);
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加货架
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<BTable
|
||||||
|
store={storageStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={storageStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={!record?.id ? "添加个人属性" : "编辑个人属性"}
|
||||||
|
width={1200}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
if (record?.id) {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
} else {
|
||||||
|
formRef.current?.setFieldsValue(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("storageStore")(observer(Storage));
|
|
@ -0,0 +1,41 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "货架名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "货架描述",
|
||||||
|
dataIndex: "desc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "货架总层数",
|
||||||
|
dataIndex: "column_all_num",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "货架名称",
|
||||||
|
name: "name",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入货架名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "货架描述",
|
||||||
|
name: "desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入货架描述!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "货架总层数",
|
||||||
|
name: "column_all_num",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入货架总层数!" }],
|
||||||
|
},
|
||||||
|
];
|
|
@ -1,10 +1,128 @@
|
||||||
const TeamMgmt = () => {
|
import { Button, Space, Modal, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import BTable from "@/components/b_table";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { columns, defaultConfig } from "./team_column";
|
||||||
|
|
||||||
|
const TeamMgmt = (props: Store) => {
|
||||||
|
const { teamStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
teamStore.getlist();
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
}, [teamStore]);
|
||||||
|
const column_widget = (any, record) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<Space wrap>
|
||||||
<p>TeamMgmt</p>
|
<Button
|
||||||
</>
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
teamStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const edit = (record) => {
|
||||||
export default TeamMgmt;
|
setIsModalOpen(true);
|
||||||
|
setRecord(record);
|
||||||
|
};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
score: Number(values.score),
|
||||||
|
};
|
||||||
|
data.file_url = "";
|
||||||
|
if (!record?.id) {
|
||||||
|
teamStore.add(data);
|
||||||
|
} else {
|
||||||
|
teamStore.putItem(record.id, data);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(null);
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
新增团队
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<BTable
|
||||||
|
store={teamStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={teamStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={!record?.id ? "添加团队" : "编辑团队"}
|
||||||
|
width={1200}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
if (record?.id) {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
} else {
|
||||||
|
formRef.current?.setFieldsValue(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("teamStore")(observer(TeamMgmt));
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "团队属性名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队属性描述",
|
||||||
|
dataIndex: "desc",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "团队属性名称",
|
||||||
|
name: "name",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.input,
|
||||||
|
label: "团队属性描述",
|
||||||
|
name: "desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入仓库位置信息!" }],
|
||||||
|
},
|
||||||
|
];
|
|
@ -6,9 +6,11 @@ import { Store } from "antd/lib/form/interface";
|
||||||
import SimpleForm from "@/components/form/simple_form";
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { columns, defaultConfig } from "./whseMgmt_column";
|
import { columns, defaultConfig } from "./whseMgmt_column";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
|
||||||
const WhseMgmt = (props: Store) => {
|
const WhseMgmt = (props: Store) => {
|
||||||
const { stashStore } = props;
|
const { stashStore } = props;
|
||||||
|
const nav = useNavigate();
|
||||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
const formRef = React.useRef<FormInstance>(null);
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
@ -20,10 +22,22 @@ const WhseMgmt = (props: Store) => {
|
||||||
const column_widget = (any, record) => {
|
const column_widget = (any, record) => {
|
||||||
return (
|
return (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button type="dashed" size="small" onClick={() => {}}>
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/admin/whse/storage/" + record.identity);
|
||||||
|
}}
|
||||||
|
>
|
||||||
货架管理
|
货架管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="dashed" size="small" onClick={()=>{edit(record)}}>
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
@ -90,7 +104,7 @@ const WhseMgmt = (props: Store) => {
|
||||||
dataSource={stashStore.list}
|
dataSource={stashStore.list}
|
||||||
/>
|
/>
|
||||||
<Modal
|
<Modal
|
||||||
title={!record?.id ? "添加文章" : "编辑文章"}
|
title={!record?.id ? "添加仓库" : "编辑仓库"}
|
||||||
width={1200}
|
width={1200}
|
||||||
open={isModalOpen}
|
open={isModalOpen}
|
||||||
afterClose={() => formRef.current?.resetFields()}
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Outlet } from "react-router";
|
||||||
|
|
||||||
|
const WhseMgmtRoute = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Outlet />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WhseMgmtRoute
|
|
@ -11,6 +11,8 @@ import Tag from "@/pages/tag/tag";
|
||||||
import TeamMgmt from "@/pages/teamMgmt";
|
import TeamMgmt from "@/pages/teamMgmt";
|
||||||
import User from "@/pages/user/user";
|
import User from "@/pages/user/user";
|
||||||
import WhseMgmt from "@/pages/whseMgmt";
|
import WhseMgmt from "@/pages/whseMgmt";
|
||||||
|
import Storage from "@/pages/storage";
|
||||||
|
import WhseMgmtRoute from "@/pages/whseMgmt/whseMgmt_route";
|
||||||
export const homeRouter = [
|
export const homeRouter = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
|
@ -77,10 +79,22 @@ export const homeRouter = [
|
||||||
element: <TeamMgmt />,
|
element: <TeamMgmt />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/admin/whseMgmt",
|
path: "/admin/whse",
|
||||||
index: true,
|
element: <WhseMgmtRoute />,
|
||||||
element: <WhseMgmt />,
|
children:[
|
||||||
|
{
|
||||||
|
path: "/admin/whse/whseMgmt",
|
||||||
|
index: true,
|
||||||
|
element: <WhseMgmt />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/whse/storage/:id",
|
||||||
|
index: true,
|
||||||
|
element: <Storage />,
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -24,6 +24,7 @@ axios.interceptors.response.use((res: AxiosResponse) => {
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
console.log(err.status===401);
|
||||||
if (err.status === 401) {
|
if (err.status === 401) {
|
||||||
store.usrStore.openLoginDilog()
|
store.usrStore.openLoginDilog()
|
||||||
store.usrStore.logOut()
|
store.usrStore.logOut()
|
||||||
|
|
|
@ -38,7 +38,7 @@ class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
await baseHttp.delete(this.urlConfig.DELETE + "/" + id, {})
|
await baseHttp.delete(this.urlConfig.DELETE + "/" + id, {})
|
||||||
this.getlist()
|
this.getlist()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 分页
|
// 分页
|
||||||
|
@ -47,32 +47,33 @@ class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
this.getlist()
|
this.getlist()
|
||||||
}
|
}
|
||||||
// 添加
|
// 添加
|
||||||
async add(param: any) {
|
async add(param: any,listParam?:any) {
|
||||||
try {
|
try {
|
||||||
await baseHttp.post(this.urlConfig.ADD, param)
|
await baseHttp.post(this.urlConfig.ADD, param)
|
||||||
this.getlist()
|
this.getlist(listParam)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
async putItem(id: string, param: any) {
|
async putItem(id: string, param: any,listParam?:any) {
|
||||||
try {
|
try {
|
||||||
await baseHttp.put(this.urlConfig.EDIT + "/" + id, param)
|
await baseHttp.put(this.urlConfig.EDIT + "/" + id, param)
|
||||||
this.getlist()
|
this.getlist(listParam)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
async getlist() {
|
async getlist(params?: any) {
|
||||||
this.listStatus = true;
|
this.listStatus = true;
|
||||||
try {
|
try {
|
||||||
let res = await baseHttp.get(this.urlConfig.LIST, {
|
let res = await baseHttp.get(this.urlConfig.LIST, {
|
||||||
size: this.page?.Size | 20,
|
size: this.page?.Size | 20,
|
||||||
offset: this.page?.Offset | 1,
|
offset: this.page?.Offset | 1,
|
||||||
|
...params
|
||||||
});
|
});
|
||||||
let data: Array<B> = []
|
let data: Array<B> = []
|
||||||
if (!res?.data?.record) {
|
if (!res?.data?.record) {
|
||||||
|
|
|
@ -6,6 +6,11 @@ import folderStore from '@/store/folder';
|
||||||
import { acStore } from '@/store/archives_category';
|
import { acStore } from '@/store/archives_category';
|
||||||
import { politicalStudyStore } from "./political_study";
|
import { politicalStudyStore } from "./political_study";
|
||||||
import { stashStore } from "@/store/stash"
|
import { stashStore } from "@/store/stash"
|
||||||
|
import { teamStore } from './team';
|
||||||
|
import { persMgmtStore } from './persMgmt';
|
||||||
|
import { storageStore } from './storage';
|
||||||
|
import { materialCatStore } from './materialCat';
|
||||||
|
import { materialStore } from './materialStore';
|
||||||
|
|
||||||
const store = {
|
const store = {
|
||||||
usrStore,
|
usrStore,
|
||||||
|
@ -15,7 +20,12 @@ const store = {
|
||||||
folderStore,
|
folderStore,
|
||||||
acStore,
|
acStore,
|
||||||
politicalStudyStore,
|
politicalStudyStore,
|
||||||
stashStore
|
stashStore,
|
||||||
|
teamStore,
|
||||||
|
persMgmtStore,
|
||||||
|
storageStore,
|
||||||
|
materialCatStore,
|
||||||
|
materialStore,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default store;
|
export default store;
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 用户信息
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class MaterialCatConfig {
|
||||||
|
static LIST: string = "suppliesCat/list"
|
||||||
|
static ADD: string = "suppliesCat"
|
||||||
|
static DELETE: string = "suppliesCat"
|
||||||
|
static EDIT: string = "suppliesCat"
|
||||||
|
}
|
||||||
|
class MaterialCatStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(MaterialCatConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const materialCatStore = new MaterialCatStore();
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 用户信息
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class MaterialConfig {
|
||||||
|
static LIST: string = "supplies/list"
|
||||||
|
static ADD: string = "supplies"
|
||||||
|
static DELETE: string = "supplies"
|
||||||
|
static EDIT: string = "supplies"
|
||||||
|
}
|
||||||
|
class MaterialStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(MaterialConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const materialStore = new MaterialStore();
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 用户信息
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class PersMgmtConfig {
|
||||||
|
static LIST: string = "persMgmt/list"
|
||||||
|
static ADD: string = "persMgmt"
|
||||||
|
static DELETE: string = "persMgmt"
|
||||||
|
static EDIT: string = "persMgmt"
|
||||||
|
}
|
||||||
|
class PersMgmtStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(PersMgmtConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const persMgmtStore = new PersMgmtStore();
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 用户信息
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class StoreageConfig {
|
||||||
|
static LIST: string = "storage/list"
|
||||||
|
static ADD: string = "storage"
|
||||||
|
static DELETE: string = "storage"
|
||||||
|
static EDIT: string = "storage"
|
||||||
|
}
|
||||||
|
class StorageStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(StoreageConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const storageStore = new StorageStore();
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 用户信息
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class TeamConfig {
|
||||||
|
static LIST: string = "team/list"
|
||||||
|
static ADD: string = "team"
|
||||||
|
static DELETE: string = "team"
|
||||||
|
static EDIT: string = "team"
|
||||||
|
}
|
||||||
|
class TeamStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(TeamConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const teamStore = new TeamStore();
|
Loading…
Reference in New Issue