diff --git a/src/App.tsx b/src/App.tsx index bd6943a..d91d599 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,23 +7,29 @@ const onMessage = (e: any) => { let data = JSON.parse(e); if (data.type === "accpt") { let body = JSON.parse(data.content.body); - console.log(body); MapUtl.addMaker({ lng: 103.55, lat: 30.342, title: body?.user_name, users: body, }); + } else if (data.type === "move") { + let maker: any = null; + let body = JSON.parse(data.content.body); + MapUtl.makerList?.forEach((e) => { + if (e.userIdentity === body?.user_identity) { + maker = e.marker; + } + }); + maker?.setPosition([body.long, body.lat]); } }; -console.log("init"); socketService.on("message", onMessage); const App = () => { useEffect(() => { return () => { console.log("uninstall"); - socketService.off("message", onMessage); }; }, []); diff --git a/src/components/map/mapUtil.ts b/src/components/map/mapUtil.ts index cc19c38..3cb8eac 100644 --- a/src/components/map/mapUtil.ts +++ b/src/components/map/mapUtil.ts @@ -1,5 +1,9 @@ +interface makersInf { + userIdentity:string, + marker:any +} class MapUtl { - static makerList: any[] = []; + static makerList: makersInf[] = []; static amap: any = null; static loadMap: any = null; static wecherInfo: any = null; @@ -12,8 +16,8 @@ class MapUtl { }); var content = [ "
姓名 :" + users?.user_name + "", - "职位 : " + users.pos_held, - "电话 : " + users.tel, + "职位 : " + users.pos_held, + "电话 : " + users.tel, "
", ]; var infoWindow = new MapUtl.loadMap.InfoWindow({ @@ -25,6 +29,11 @@ class MapUtl { infoWindow.open(MapUtl.amap, e.target.getPosition()); }); MapUtl.amap?.add(marker); + // 将maker添加到数组 + MapUtl.makerList.push({ + userIdentity:users.identity, + marker:marker + }) } static setMakericon = (maker) => { maker.setPosition([103.55, 30.342]); diff --git a/src/index.less b/src/index.less index 364a0c0..afe4c74 100644 --- a/src/index.less +++ b/src/index.less @@ -82,14 +82,13 @@ code { background-repeat: no-repeat; /* 确保图片不会重复 */ padding-bottom: 0px; .ant-modal-header { - padding: 30px 30px; color: rgba(0, 0, 0, 0.85); background: none; border-bottom: 0px solid #f0f0f0; align-items: center; padding-left: 40px; position: relative; - top: -38px; + top: -10px; left: -30px; .ant-modal-title { color: #fff; diff --git a/src/pages/OrgChart.tsx b/src/pages/OrgChart.tsx index a0cb0e3..0b9be2c 100644 --- a/src/pages/OrgChart.tsx +++ b/src/pages/OrgChart.tsx @@ -3,15 +3,17 @@ import "./org_chart.less"; import { inject, observer } from "mobx-react"; import { useEffect, useState } from "react"; import { orgData } from "./org_config"; +import PoverDetail from "./poverDetail"; const OrgChartSelf = (props: Store) => { const { depStore } = props; const [data, setOrgData] = useState([]); + const [detail, setDetail] = useState(false); useEffect(() => { depStore.getOrg().then((res) => { // setOrgData(res.data.record) // setOrgData(orgData); }); - }, []); + }, [depStore]); const getArrayDepth = (arr) => { let maxDepth = 0; @@ -55,47 +57,98 @@ const OrgChartSelf = (props: Store) => { }; const renderTree = (list: Array) => { return ( -
- {list?.map((v, _) => { - if (v.children) { - return ( -
- {v.depId !== 2 ? ( - - {v.dep_name} - - ) : null} - {v.depId === 1 ? ( -
- {v.users?.map((v1, _) => { - return ( -
- - {v1.user_name} -
- ); - })} + <> + {detail ? ( +
{ + setDetail(false) + }}> + +
+ ) : ( +
+ {list?.map((v, _) => { + if (v.children) { + return ( +
+ {v.depId !== 2 ? ( + + {v.dep_name} + + ) : null} + {v.depId === 1 ? ( +
+ {v.users?.map((v1, _) => { + return ( +
+ + {v1.user_name} +
+ ); + })} +
+ ) : ( + v.users?.map((v1, _) => { + return ( +
+ + {v1.user_name} +
+ ); + }) + )} + {v.depId !== 2 ? ( +
+
+
+
+ ) : null} + {renderTree(v.children)}
- ) : ( - v.users?.map((v1, _) => { + ); + } + return ( +
+ {v.users?.map((v1, _) => { return ( -
+
{ + setDetail(true); + }} + > { {v1.user_name}
); - }) - )} - {v.depId !== 2 ? ( -
-
-
-
- ) : null} - {renderTree(v.children)} -
- ); - } - return ( -
- {v.users?.map((v1, _) => { - return ( -
- - {v1.user_name} -
- ); - })} -
- ); - })} -
+ })} +
+ ); + })} +
+ )} + ); }; return
{renderTree(orgData)}
; diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 775ee1e..c99f7c3 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -9,7 +9,7 @@ import { SettingOutlined } from "@ant-design/icons"; import { useNavigate } from "react-router"; import { useEffect, useState } from "react"; import MapUtl from "@/components/map/mapUtil"; -import ReactPlayer from "react-player"; +import Video from "./video"; const Home = observer(() => { const navigate = useNavigate(); @@ -87,14 +87,7 @@ const Home = observer(() => {
- {/* */} +
diff --git a/src/pages/home/homeBottom/dispath.tsx b/src/pages/home/homeBottom/dispath.tsx index 7fd0bc5..23ac5bd 100644 --- a/src/pages/home/homeBottom/dispath.tsx +++ b/src/pages/home/homeBottom/dispath.tsx @@ -1,6 +1,14 @@ import SimpleForm from "@/components/form/simple_form"; import { traningConfig } from "@/pages/training/traning_config"; -import { Button, Form, FormInstance, Modal, Select } from "antd"; +import { + Button, + Form, + FormInstance, + InputNumber, + Modal, + Select, + SelectProps, +} from "antd"; import React from "react"; import { useState } from "react"; import baseHttp from "@/service/base"; @@ -8,10 +16,17 @@ import "./bot.less"; import { Store } from "antd/es/form/interface"; import { inject, observer } from "mobx-react"; import { FormType } from "@/components/form/interface"; +import MinusCircleOutlined from "@ant-design/icons/lib/icons/MinusCircleOutlined"; const { Option } = Select; const Dispath = (props: Store) => { const { trainingStore, trainingCatStore } = props; + const formRef = React.useRef(null); + const [isModalOpen, setIsModalOpen] = useState(false); + const [projectConfig, setProjectConfig] = useState([]); + const [stashList, setStashList] = useState([]); + const [userList, setUserList] = useState([]); + const [data, setData] = useState([]); const openDispatch = async () => { await getList(); setIsModalOpen(true); @@ -48,13 +63,8 @@ const Dispath = (props: Store) => { setIsModalOpen(false); }; const handleSubmit = () => { - setIsModalOpen(false); + formRef.current?.submit(); }; - const formRef = React.useRef(null); - const [isModalOpen, setIsModalOpen] = useState(false); - const [projectConfig, setProjectConfig] = useState([]); - const [stashList, setStashList] = useState([]); - const [userList, setUserList] = useState([]); const onFinish = (values: any) => { let data = { @@ -65,11 +75,25 @@ const Dispath = (props: Store) => { trainingStore.add(data); setIsModalOpen(false); }; + const handleSearch = (newValue: string) => { + if (newValue === "") return; + baseHttp.get("/supplies/list/serch", { name: newValue }).then((res) => { + let data = res.data?.record ?? []; + data.forEach((item) => { + item.text = item.name; + item.value = item.identity; + }); + setData(data ?? []); + }); + }; + const handleChange = (newValue: string) => { + // setValue(newValue); + }; return ( <> - 巡防调度 + 训练任务 { })} + + {(fields, { add, remove }) => ( + <> + {fields.map(({ key, name, ...restField }) => ( +
+ +