diff --git a/README.md b/README.md index 69dcd47..693d78e 100644 --- a/README.md +++ b/README.md @@ -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). -To learn React, check out the [React documentation](https://reactjs.org/). \ No newline at end of file +To learn React, check out the [React documentation](https://reactjs.org/). + +"proxy":"https://www.hswzct.cn:12016", \ No newline at end of file diff --git a/package.json b/package.json index a88a462..f0db4ab 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "build": "node scripts/build.js", "test": "node scripts/test.js" }, - "proxy":"https://www.hswzct.cn:12016", + "proxy":"http://127.0.0.1:12214", "eslintConfig": { "extends": [ "react-app", diff --git a/src/components/layout/layout_config.ts b/src/components/layout/layout_config.ts index 16fe6da..aebcdce 100644 --- a/src/components/layout/layout_config.ts +++ b/src/components/layout/layout_config.ts @@ -89,6 +89,7 @@ export const items = [ label: `系统管理`, children: [ { label: `部门管理`, key: "/admin/dep" }, + { label: `通知管理`, key: "/admin/sys/notic" }, { label: "系统设置", key: "/admin/sys/setting" }, { label: "光荣牌审核", key: "/admin/sys/gp" }, { label: "评优审核", key: "/admin/sys/exce_compet" }, diff --git a/src/pages/materialMgmt/material.tsx b/src/pages/materialMgmt/material.tsx index c161058..6fc3e4b 100644 --- a/src/pages/materialMgmt/material.tsx +++ b/src/pages/materialMgmt/material.tsx @@ -64,16 +64,7 @@ const Material = (props: Store) => { > 编辑 - - {/* */} + { + const { noticStore } = props; + const [isModalOpen, setIsModalOpen] = useState(false); + const [isUserModalOpen, setIsUserModalOpen] = useState(false); + const [projectConfig, setProjectConfig] = useState([]); + const formRef = React.useRef(null); + const [record, setRecord] = useState(null); + const [tagId, setId] = useState(null); + const [userList, setUserList] = useState>([]); + + 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 ( + + + + ); + }; + // 用户选择回调 + return ( +
+ + + + + + column_widget(any, record), + }, + ]} + dataSource={noticStore.list} + /> + { + setIsUserModalOpen(false); + }} + onOk={() => setIsUserModalOpen(false)} + > + + + formRef.current?.resetFields()} + onOk={() => formRef.current?.submit()} + okText="确定" + cancelText="取消" + onCancel={() => { + setId(null); + setIsModalOpen(false); + }} + > + { + formRef.current?.setFieldsValue(record); + }} + formName="card_basic" + colProps={25} + subBtnName="提交" + formDatas={projectConfig} + onFinish={onFinish} + initialValues={true} + onFinishFailed={onFinishFailed} + /> + + +
+ ); +}; + +export default inject("noticStore")(observer(Emergency)); diff --git a/src/pages/notic/notic_config.tsx b/src/pages/notic/notic_config.tsx new file mode 100644 index 0000000..9ee1675 --- /dev/null +++ b/src/pages/notic/notic_config.tsx @@ -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 = [ + { + title: "通知标题", + dataIndex: "title", + }, + { + title: "通知描述", + dataIndex: "notic_desc", + },{ + title: "通知开始时间", + dataIndex: "start_time", + render: (start_time) => <>{ {dayjs(start_time).format("YYYY-MM-DD")}}, + },{ + title: "通知有效结束时间", + dataIndex: "end_time", + render: (end_time) => <>{ {dayjs(end_time).format("YYYY-MM-DD")}}, + }, + { + title: "发布时间", + dataIndex: "created_date", + render: (created_date) => <>{ {dayjs(created_date).format("YYYY-MM-DD")}}, + }, +]; + +export const userColumns: ColumnsType = [ + { + title: "姓名", + dataIndex: "users", + render: (users) => <>{ {users.user_name}}, + }, + { + title: "是否查看", + dataIndex: "status", + render: (status) => <>{ {status === 1 ? "已查看" : "未查看"}}, + }, + { + title: "查看时间", + render: (record) => <>{ record.stauts===1 ? <>{ {dayjs(record.updated_date).format("YYYY-MM-DD")}} : ""}, + }, +]; + +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: "参与队伍不能为空!" }], + }, +]; diff --git a/src/router/routers/home_router.tsx b/src/router/routers/home_router.tsx index ec074d4..02d774f 100644 --- a/src/router/routers/home_router.tsx +++ b/src/router/routers/home_router.tsx @@ -28,6 +28,7 @@ import Community from "@/pages/community"; import PatrolBrigade from "@/pages/patrolBrigade"; import ExceCompet from "@/pages/exce_compet"; import Signin from "@/pages/signin"; +import Notic from "@/pages/notic"; export const homeRouter = [ { path: "/", @@ -180,6 +181,11 @@ export const homeRouter = [ index: true, element: , }, + { + path: "/admin/sys/notic", + index: true, + element: , + }, { path: "/admin/sys/gp", index: true, diff --git a/src/store/index.ts b/src/store/index.ts index d3d029f..7635086 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -27,6 +27,7 @@ import { gridStore } from './grid'; import { patrolBrigadeStore } from './patrol_brigade'; import { exceCompetStore } from './exce_compet'; import signinStore from './singin'; +import noticStore from './notic'; @@ -60,7 +61,8 @@ const store = { communityStore, patrolBrigadeStore, exceCompetStore, - signinStore + signinStore, + noticStore }; export default store; \ No newline at end of file diff --git a/src/store/notic.ts b/src/store/notic.ts new file mode 100644 index 0000000..0d01f61 --- /dev/null +++ b/src/store/notic.ts @@ -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 { + constructor() { + super(NoticConfig) + makeObservable(this, {}) + } +} +const noticStore = new NoticStore() +export default noticStore; +