fix(staff)
This commit is contained in:
parent
db6ab6fab7
commit
7fb88159b8
|
@ -29,7 +29,10 @@
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:where(.css-dev-only-do-not-override-nqoqt9).ant-menu-dark .ant-menu-item-selected, :where(.css-dev-only-do-not-override-nqoqt9).ant-menu-dark>.ant-menu .ant-menu-item-selected {
|
||||
color: rgba(22, 119, 255,0.8);
|
||||
background-color: transparent
|
||||
}
|
||||
.loginOut {
|
||||
cursor: pointer;
|
||||
padding-right: 20px;
|
||||
|
|
|
@ -36,9 +36,9 @@ const LayOut = (props: Store) => {
|
|||
{ title: "数据管理" },
|
||||
];
|
||||
useEffect(() => {
|
||||
// if (usrStore.isNeedLogin) {
|
||||
// nav("/login");
|
||||
// }
|
||||
if (usrStore.isNeedLogin) {
|
||||
nav("/login");
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [usrStore.isNeedLogin]);
|
||||
|
||||
|
@ -46,9 +46,9 @@ const LayOut = (props: Store) => {
|
|||
<Layout>
|
||||
<Header style={headStyle}>
|
||||
<div style={logoStyle}>logo</div>
|
||||
{/* <Dropdown menu={{ items }}> */}
|
||||
<Avatar icon={<UserOutlined />} />
|
||||
{/* </Dropdown> */}
|
||||
<Dropdown menu={{ items }}>
|
||||
<Avatar icon={<UserOutlined />} />
|
||||
</Dropdown>
|
||||
</Header>
|
||||
<Layout>
|
||||
<Sider
|
||||
|
|
|
@ -54,12 +54,6 @@ export const items: ItemType<MenuItemType>[] = [
|
|||
{ label: `员工管理`, key: "/rbac/staff" },
|
||||
],
|
||||
},
|
||||
{
|
||||
icon: <FileSyncOutlined />,
|
||||
key: "/city",
|
||||
label: `区域管理`,
|
||||
children: [{ label: `区域列表`, key: "/city/list" }],
|
||||
},
|
||||
{
|
||||
key: "/sys",
|
||||
label: `系统管理`,
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
let fs = require("fs")
|
||||
let fileName = "test.tsx";
|
||||
let path = "pages/test"
|
||||
let storeName = "TestStore"
|
||||
let className = "Test"
|
||||
|
||||
let str =`
|
||||
import { Tooltip } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import BTable from "@/components/useTable";
|
||||
import { UserDataType } from "@/store/user";
|
||||
|
||||
const ${className} = (props) => {
|
||||
const { ${storeName} } = props;
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<BTable store={${storeName}} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("${storeName}")(observer(${className}));
|
||||
`
|
||||
|
||||
fs.mkdirSync(path);
|
||||
fs.writeFile(path + "/" + fileName, str, function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
|
||||
fs.writeFile(path + "/" + fileName, str, function (err) {
|
||||
console.log(err);
|
||||
})
|
|
@ -0,0 +1,87 @@
|
|||
let fs = require("fs")
|
||||
let fileName = "index.tsx";
|
||||
let path = "../pages/order"
|
||||
let storeName = "OrderStore"
|
||||
let className = "Order"
|
||||
|
||||
let str = `
|
||||
import React from "react";
|
||||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { columns, formConfig } from "./config";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
|
||||
const ${className} = (props) => {
|
||||
const { ${storeName} } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [userId, setId] = useState<Number | null>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
// 获取列表数据
|
||||
useEffect(() => {
|
||||
${storeName}.getlist();
|
||||
}, [${storeName}]);
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Button type="default" onClick={() => setIsModalOpen(true)}>
|
||||
添加
|
||||
</Button>
|
||||
<BTable
|
||||
store={${storeName}}
|
||||
scroll={{ x: "max-content" }}
|
||||
columns={columns}
|
||||
dataSource={${storeName}.list}
|
||||
deleteCallback={(record) => {
|
||||
${storeName}.deleteItem(record);
|
||||
}}
|
||||
editCallback={(record) => {
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={!userId ? "添加" : "编辑"}
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setRecord(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formName={"city_form"}
|
||||
formRef={formRef}
|
||||
colProps={25}
|
||||
onFinish={() => {
|
||||
${storeName}.add(formRef.current?.getFieldsValue())
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formDatas={formConfig as any}
|
||||
></SimpleForm>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("${storeName}")(observer(${className}));
|
||||
`
|
||||
fs.mkdirSync(path);
|
||||
fs.writeFile(path + "/" + fileName, str, function (err) {
|
||||
console.log(err);
|
||||
})
|
|
@ -0,0 +1,26 @@
|
|||
let fs = require("fs")
|
||||
let fileName = "order.tsx";
|
||||
let path = "../store"
|
||||
let storeName = "OrderStore"
|
||||
let storeNames = "orderStore"
|
||||
let config = "OrderConfig"
|
||||
|
||||
let str =`
|
||||
import { makeObservable } from "mobx";
|
||||
import BaseStore from "./baseStore";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { ${config} } from "@/service/config";
|
||||
|
||||
class ${storeName} extends BaseStore<UserDataType> {
|
||||
constructor() {
|
||||
super(${config})
|
||||
makeObservable(this, {})
|
||||
}
|
||||
}
|
||||
const ${storeNames} = new ${storeName}();
|
||||
export default ${storeNames};
|
||||
`
|
||||
|
||||
fs.writeFile(path + "/" + fileName, str, function (err) {
|
||||
console.log(err);
|
||||
})
|
|
@ -0,0 +1,63 @@
|
|||
import { FormType } from "@/components/form/interface";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
export const formConfig = [
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "城市名称",
|
||||
name: "city_name",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "城市名称不能为空!" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "城市编码",
|
||||
name: "code",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "城市编码不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.inputNumber,
|
||||
label: "经度",
|
||||
name: "lat",
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "经度不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.inputNumber,
|
||||
label: "纬度",
|
||||
name: "long",
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "纬度不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "所属省份",
|
||||
name: "pidentity",
|
||||
value: "",
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: ColumnsType<UserDataType> = [
|
||||
{
|
||||
title: "城市名称",
|
||||
dataIndex: "city_name",
|
||||
fixed: "left",
|
||||
},
|
||||
{
|
||||
title: "城市编码",
|
||||
dataIndex: "code",
|
||||
},
|
||||
{
|
||||
title: "纬度",
|
||||
dataIndex: "lat",
|
||||
},
|
||||
{
|
||||
title: "经度",
|
||||
dataIndex: "long",
|
||||
},
|
||||
{
|
||||
title: "所属省份",
|
||||
dataIndex: "pidentity",
|
||||
},
|
||||
];
|
|
@ -1,5 +1,76 @@
|
|||
const City = () => {
|
||||
return <div>City</div>;
|
||||
import React from "react";
|
||||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { columns, formConfig } from "./config";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
const City = (props: Store) => {
|
||||
const { cityStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [userId, setId] = useState<Number | null>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
|
||||
// 获取列表数据
|
||||
useEffect(() => {
|
||||
cityStore.getlist();
|
||||
}, [cityStore]);
|
||||
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Button type="default" onClick={() => setIsModalOpen(true)}>
|
||||
添加
|
||||
</Button>
|
||||
<BTable
|
||||
store={cityStore}
|
||||
scroll={{ x: "max-content" }}
|
||||
columns={columns}
|
||||
dataSource={cityStore.list}
|
||||
deleteCallback={(record) => {
|
||||
cityStore.deleteItem(record);
|
||||
}}
|
||||
editCallback={(record) => {
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={!userId ? "添加" : "编辑"}
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setRecord(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formName={"city_form"}
|
||||
formRef={formRef}
|
||||
colProps={25}
|
||||
onFinish={() => {
|
||||
cityStore.add(formRef.current?.getFieldsValue())
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formDatas={formConfig as any}
|
||||
></SimpleForm>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default City;
|
||||
export default inject("cityStore")(observer(City));
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
import { FormType } from "@/components/form/interface";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
export const formConfig = [
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "城市名称",
|
||||
name: "city_name",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "城市名称不能为空!" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "城市编码",
|
||||
name: "code",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "城市编码不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.inputNumber,
|
||||
label: "经度",
|
||||
name: "lat",
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "经度不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.inputNumber,
|
||||
label: "纬度",
|
||||
name: "long",
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "纬度不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "所属省份",
|
||||
name: "pidentity",
|
||||
value: "",
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: ColumnsType<UserDataType> = [
|
||||
{
|
||||
title: "城市名称",
|
||||
dataIndex: "city_name",
|
||||
fixed: "left",
|
||||
},
|
||||
{
|
||||
title: "城市编码",
|
||||
dataIndex: "code",
|
||||
},
|
||||
{
|
||||
title: "纬度",
|
||||
dataIndex: "lat",
|
||||
},
|
||||
{
|
||||
title: "经度",
|
||||
dataIndex: "long",
|
||||
},
|
||||
{
|
||||
title: "所属省份",
|
||||
dataIndex: "pidentity",
|
||||
},
|
||||
];
|
|
@ -1,9 +1,75 @@
|
|||
const Order = () => {
|
||||
return (
|
||||
<div>
|
||||
订单管理
|
||||
</div>
|
||||
)
|
||||
}
|
||||
import React from "react";
|
||||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import { columns, formConfig } from "./config";
|
||||
|
||||
export default Order
|
||||
const Order = (props: Store) => {
|
||||
const { orderStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [userId, setId] = useState<Number | null>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
// 获取列表数据
|
||||
useEffect(() => {
|
||||
orderStore.getlist();
|
||||
}, [orderStore]);
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Button type="default" onClick={() => setIsModalOpen(true)}>
|
||||
添加
|
||||
</Button>
|
||||
<BTable
|
||||
store={orderStore}
|
||||
scroll={{ x: "max-content" }}
|
||||
columns={columns}
|
||||
dataSource={orderStore.list}
|
||||
deleteCallback={(record) => {
|
||||
orderStore.deleteItem(record);
|
||||
}}
|
||||
editCallback={(record) => {
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={!userId ? "添加" : "编辑"}
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setRecord(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formName={"city_form"}
|
||||
formRef={formRef}
|
||||
colProps={25}
|
||||
onFinish={() => {
|
||||
orderStore.add(formRef.current?.getFieldsValue());
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formDatas={formConfig as any}
|
||||
></SimpleForm>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("orderStore")(observer(Order));
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
class UserConfig {
|
||||
static LOGINURI: string = "/anth/login"
|
||||
static ADD: string = "/user";
|
||||
static EDIT: string = "/user";
|
||||
static LIST: string = "/user/list";
|
||||
static DELETE: string = "/user";
|
||||
}
|
||||
|
||||
|
||||
class CityConfig {
|
||||
static ADD: string = "/city";
|
||||
static EDIT: string = "/city";
|
||||
static LIST: string = "/city/list";
|
||||
static DELETE: string = "/city";
|
||||
}
|
||||
|
||||
|
||||
class Skuconfig {
|
||||
static ADD: string = "/sku";
|
||||
static EDIT: string = "/sku";
|
||||
static LIST: string = "/sku/list";
|
||||
static DELETE: string = "/sku";
|
||||
}
|
||||
|
||||
class SkuCatconfig {
|
||||
static ADD: string = "/skuCat";
|
||||
static EDIT: string = "/skuCat";
|
||||
static LIST: string = "/skuCat/list";
|
||||
static DELETE: string = "/skuCat";
|
||||
}
|
||||
|
||||
class Orderconfig {
|
||||
static ADD: string = "/order";
|
||||
static EDIT: string = "/order";
|
||||
static LIST: string = "/order/list";
|
||||
static DELETE: string = "/order";
|
||||
}
|
||||
|
||||
export { UserConfig, CityConfig, SkuCatconfig, Skuconfig, Orderconfig };
|
|
@ -1,9 +0,0 @@
|
|||
class UserConfig {
|
||||
static LOGINURI: string = "/anth/login"
|
||||
static ADD: string = "/user";
|
||||
static EDIT: string = "/user";
|
||||
static LIST: string = "/user/list";
|
||||
static DELETE: string = "/user";
|
||||
}
|
||||
|
||||
export default UserConfig;
|
|
@ -0,0 +1,13 @@
|
|||
import { makeObservable } from "mobx";
|
||||
import BaseStore from "./baseStore";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { CityConfig } from "@/service/config";
|
||||
|
||||
class CityStore extends BaseStore<UserDataType> {
|
||||
constructor() {
|
||||
super(CityConfig)
|
||||
makeObservable(this, {})
|
||||
}
|
||||
}
|
||||
const cityStore = new CityStore();
|
||||
export default cityStore;
|
|
@ -1,7 +1,11 @@
|
|||
import usrStore from '@/store/user'
|
||||
import cityStore from '@/store/city'
|
||||
import orderStore from './order';
|
||||
|
||||
const store = {
|
||||
usrStore,
|
||||
cityStore,
|
||||
orderStore
|
||||
};
|
||||
|
||||
export default store;
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
import { makeObservable } from "mobx";
|
||||
import BaseStore from "./baseStore";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { Orderconfig } from "@/service/config";
|
||||
|
||||
class OrderStore extends BaseStore<UserDataType> {
|
||||
constructor() {
|
||||
super(Orderconfig)
|
||||
makeObservable(this, {})
|
||||
}
|
||||
}
|
||||
const orderStore = new OrderStore();
|
||||
export default orderStore;
|
|
@ -3,7 +3,7 @@ import { base } from "@/service/base";
|
|||
import BaseStore from "./baseStore";
|
||||
import { UserDataType, UserInfos } from "@/model/userModel";
|
||||
import { message } from "antd";
|
||||
import UserConfig from "@/service/user_config";
|
||||
import { UserConfig } from "@/service/config";
|
||||
|
||||
class UserStore extends BaseStore<UserDataType> {
|
||||
_userinfo: UserInfos = {}; // 用户信息
|
||||
|
|
Loading…
Reference in New Issue