fix(check)
This commit is contained in:
parent
a56f8456be
commit
94d3ae2e6a
|
@ -43,4 +43,6 @@ You don’t have to ever use `eject`. The curated feature set is suitable for sm
|
||||||
|
|
||||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||||
|
|
||||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||||
|
|
||||||
|
"proxy":"https://www.hswzct.cn:12016",
|
|
@ -93,7 +93,7 @@
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
"test": "node scripts/test.js"
|
"test": "node scripts/test.js"
|
||||||
},
|
},
|
||||||
"proxy":"https://www.hswzct.cn:12016",
|
"proxy":"http://127.0.0.1:12214",
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"react-app",
|
"react-app",
|
||||||
|
|
|
@ -89,6 +89,7 @@ export const items = [
|
||||||
label: `系统管理`,
|
label: `系统管理`,
|
||||||
children: [
|
children: [
|
||||||
{ label: `部门管理`, key: "/admin/dep" },
|
{ label: `部门管理`, key: "/admin/dep" },
|
||||||
|
{ label: `通知管理`, key: "/admin/sys/notic" },
|
||||||
{ label: "系统设置", key: "/admin/sys/setting" },
|
{ label: "系统设置", key: "/admin/sys/setting" },
|
||||||
{ label: "光荣牌审核", key: "/admin/sys/gp" },
|
{ label: "光荣牌审核", key: "/admin/sys/gp" },
|
||||||
{ label: "评优审核", key: "/admin/sys/exce_compet" },
|
{ label: "评优审核", key: "/admin/sys/exce_compet" },
|
||||||
|
|
|
@ -64,16 +64,7 @@ const Material = (props: Store) => {
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* <Button
|
|
||||||
type="dashed"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
materialStore.deleteItem(record.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
物资出库
|
|
||||||
</Button> */}
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="出库操作"
|
title="出库操作"
|
||||||
description="请确认是否出库该物资?"
|
description="请确认是否出库该物资?"
|
||||||
|
|
|
@ -0,0 +1,141 @@
|
||||||
|
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 baseHttp from "@/service/base";
|
||||||
|
import { columns, noticConfig, userColumns } from "./notic_config";
|
||||||
|
const Emergency = (props: Store) => {
|
||||||
|
const { noticStore } = props;
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
|
const [isUserModalOpen, setIsUserModalOpen] = useState<boolean>(false);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
const [tagId, setId] = useState<Number | null>(null);
|
||||||
|
const [userList, setUserList] = useState<Array<any>>([]);
|
||||||
|
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let data = {
|
||||||
|
...values,
|
||||||
|
};
|
||||||
|
if (!tagId) {
|
||||||
|
noticStore.add(data);
|
||||||
|
} else {
|
||||||
|
noticStore.putItem(tagId, data);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
noticStore.getlist();
|
||||||
|
baseHttp.get("/v1/team/list", null).then((res) => {
|
||||||
|
let data = res.data?.record ?? [];
|
||||||
|
data.forEach((item) => {
|
||||||
|
item.label = item.name;
|
||||||
|
item.value = item.identity;
|
||||||
|
});
|
||||||
|
setUserList(data ?? []);
|
||||||
|
});
|
||||||
|
}, [noticStore]);
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
const column_widget = (any, record) => {
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
setRecord(record);
|
||||||
|
setIsUserModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看参与人员
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
// 用户选择回调
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Space direction="horizontal" size={"middle"}>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
setProjectConfig(noticConfig(userList));
|
||||||
|
setId(null);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
发布通知
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<BTable
|
||||||
|
store={noticStore}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => column_widget(any, record),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
dataSource={noticStore.list}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={"参与人员"}
|
||||||
|
width={800}
|
||||||
|
open={isUserModalOpen}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
onCancel={() => {
|
||||||
|
setIsUserModalOpen(false);
|
||||||
|
}}
|
||||||
|
onOk={() => setIsUserModalOpen(false)}
|
||||||
|
>
|
||||||
|
<BTable
|
||||||
|
store={noticStore}
|
||||||
|
columns={userColumns}
|
||||||
|
dataSource={record?.user}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
<Modal
|
||||||
|
title="发布通知"
|
||||||
|
width={800}
|
||||||
|
open={isModalOpen}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
onCancel={() => {
|
||||||
|
setId(null);
|
||||||
|
setIsModalOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={25}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("noticStore")(observer(Emergency));
|
|
@ -0,0 +1,83 @@
|
||||||
|
import { FormType } from "@/components/form/interface";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { ColumnsType } from "antd/lib/table";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "通知标题",
|
||||||
|
dataIndex: "title",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "通知描述",
|
||||||
|
dataIndex: "notic_desc",
|
||||||
|
},{
|
||||||
|
title: "通知开始时间",
|
||||||
|
dataIndex: "start_time",
|
||||||
|
render: (start_time) => <>{ <span>{dayjs(start_time).format("YYYY-MM-DD")}</span>}</>,
|
||||||
|
},{
|
||||||
|
title: "通知有效结束时间",
|
||||||
|
dataIndex: "end_time",
|
||||||
|
render: (end_time) => <>{ <span>{dayjs(end_time).format("YYYY-MM-DD")}</span>}</>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "发布时间",
|
||||||
|
dataIndex: "created_date",
|
||||||
|
render: (created_date) => <>{ <span>{dayjs(created_date).format("YYYY-MM-DD")}</span>}</>,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const userColumns: ColumnsType<UserDataType> = [
|
||||||
|
{
|
||||||
|
title: "姓名",
|
||||||
|
dataIndex: "users",
|
||||||
|
render: (users) => <>{ <span>{users.user_name}</span>}</>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "是否查看",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (status) => <>{ <span>{status === 1 ? "已查看" : "未查看"}</span>}</>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "查看时间",
|
||||||
|
render: (record) => <>{ record.stauts===1 ? <>{ <span>{dayjs(record.updated_date).format("YYYY-MM-DD")}</span>}</> : ""}</>,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const noticConfig = (userList) => [
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "通知标题",
|
||||||
|
name: "title",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入通知标题!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "通知描述",
|
||||||
|
name: "notic_desc",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入通知描述" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.date,
|
||||||
|
label: "通知有效时间",
|
||||||
|
name: "start_time",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入开始时间" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.date,
|
||||||
|
label: "通知有效结束",
|
||||||
|
name: "end_time",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入结束时间" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: FormType.cehckboxGroup,
|
||||||
|
label: "参与队伍",
|
||||||
|
name: "user_identity",
|
||||||
|
value: [],
|
||||||
|
checkboxData: userList,
|
||||||
|
rules: [{ required: true, message: "参与队伍不能为空!" }],
|
||||||
|
},
|
||||||
|
];
|
|
@ -28,6 +28,7 @@ import Community from "@/pages/community";
|
||||||
import PatrolBrigade from "@/pages/patrolBrigade";
|
import PatrolBrigade from "@/pages/patrolBrigade";
|
||||||
import ExceCompet from "@/pages/exce_compet";
|
import ExceCompet from "@/pages/exce_compet";
|
||||||
import Signin from "@/pages/signin";
|
import Signin from "@/pages/signin";
|
||||||
|
import Notic from "@/pages/notic";
|
||||||
export const homeRouter = [
|
export const homeRouter = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
|
@ -180,6 +181,11 @@ export const homeRouter = [
|
||||||
index: true,
|
index: true,
|
||||||
element: <SystemPage />,
|
element: <SystemPage />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/sys/notic",
|
||||||
|
index: true,
|
||||||
|
element: <Notic />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/admin/sys/gp",
|
path: "/admin/sys/gp",
|
||||||
index: true,
|
index: true,
|
||||||
|
|
|
@ -27,6 +27,7 @@ import { gridStore } from './grid';
|
||||||
import { patrolBrigadeStore } from './patrol_brigade';
|
import { patrolBrigadeStore } from './patrol_brigade';
|
||||||
import { exceCompetStore } from './exce_compet';
|
import { exceCompetStore } from './exce_compet';
|
||||||
import signinStore from './singin';
|
import signinStore from './singin';
|
||||||
|
import noticStore from './notic';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +61,8 @@ const store = {
|
||||||
communityStore,
|
communityStore,
|
||||||
patrolBrigadeStore,
|
patrolBrigadeStore,
|
||||||
exceCompetStore,
|
exceCompetStore,
|
||||||
signinStore
|
signinStore,
|
||||||
|
noticStore
|
||||||
};
|
};
|
||||||
|
|
||||||
export default store;
|
export default store;
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { makeObservable } from "mobx";
|
||||||
|
// 光荣牌
|
||||||
|
import BaseStore from "./baseStore";
|
||||||
|
import { TagDataType } from "@/model/userModel";
|
||||||
|
|
||||||
|
class NoticConfig {
|
||||||
|
static LIST: string = "/v1/notic/list"
|
||||||
|
static ADD: string = "/v1/notic"
|
||||||
|
static DELETE: string = "/v1/notic"
|
||||||
|
static EDIT: string = "/v1/notic"
|
||||||
|
}
|
||||||
|
class NoticStore extends BaseStore<TagDataType> {
|
||||||
|
constructor() {
|
||||||
|
super(NoticConfig)
|
||||||
|
makeObservable(this, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const noticStore = new NoticStore()
|
||||||
|
export default noticStore;
|
||||||
|
|
Loading…
Reference in New Issue