first commit
This commit is contained in:
parent
d304ca5365
commit
31063a8407
20
src/App.tsx
20
src/App.tsx
|
@ -5,13 +5,23 @@ const socketService = SocketService.getInstance();
|
|||
const onMessage = (e: any) => {
|
||||
let data = JSON.parse(e);
|
||||
if (data.type === "accpt") {
|
||||
let maker: any = null;
|
||||
let body = JSON.parse(data.content.body);
|
||||
MapUtl.addMaker({
|
||||
lng: 103.872802,
|
||||
lat: 30.523876,
|
||||
title: body?.user_name,
|
||||
users: body,
|
||||
MapUtl.makerList?.forEach((e) => {
|
||||
if (e.userIdentity === body?.user.user_identity) {
|
||||
maker = e.marker;
|
||||
}
|
||||
});
|
||||
if (maker) {
|
||||
maker?.setPosition([body.address.long, body.address.lat]);
|
||||
} else {
|
||||
MapUtl.addMaker({
|
||||
lng: body.address.long ?? 103.872802,
|
||||
lat: body.address.lat ?? 30.523876,
|
||||
title: body?.user.user_name,
|
||||
users: body.user,
|
||||
});
|
||||
}
|
||||
} else if (data.type === "move") {
|
||||
let maker: any = null;
|
||||
let body = JSON.parse(data.content.body);
|
||||
|
|
|
@ -42,6 +42,7 @@ export interface SimpleFormData {
|
|||
createCallback?: Function
|
||||
children?: React.ReactElement
|
||||
childrenPosi?: boolean
|
||||
layout?: "vertical" | "horizontal" | "inline"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,11 +26,10 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
form={form}
|
||||
labelCol={{ span: props.span ?? 4 }}
|
||||
wrapperCol={{ span: props.colProps }}
|
||||
layout="horizontal"
|
||||
layout={props.layout}
|
||||
initialValues={{ menubar: true }}
|
||||
onFinish={onFinish}
|
||||
>
|
||||
{props.childrenPosi ? null : props.children ?? props.children}
|
||||
{props.formDatas.map((v) => {
|
||||
switch (v.type) {
|
||||
case FormType.input:
|
||||
|
@ -55,18 +54,7 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
<InputNumber defaultValue={v.value} value={v.value} />
|
||||
</Form.Item>
|
||||
);
|
||||
// case FormType.fetchList:
|
||||
// return (
|
||||
// <Form.Item
|
||||
// key={v.label}
|
||||
// label={v.label}
|
||||
// name={v.name}
|
||||
// rules={v.rules}
|
||||
// >
|
||||
// <Dumbselect />
|
||||
// </Form.Item>
|
||||
// );
|
||||
case "password":
|
||||
case FormType.password:
|
||||
return (
|
||||
<Form.Item
|
||||
key={v.label}
|
||||
|
@ -203,7 +191,7 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
name={v.name}
|
||||
rules={v.rules}
|
||||
>
|
||||
<DatePicker />
|
||||
<DatePicker format="YYYY-MM-DD HH:mm:ss" showTime />
|
||||
</Form.Item>
|
||||
);
|
||||
case FormType.map:
|
||||
|
@ -234,7 +222,7 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
);
|
||||
}
|
||||
})}
|
||||
{props.childrenPosi ? props.children ?? props.children : null}
|
||||
{props.childrenPosi ? null : props.children ?? props.children}
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.ant-menu-submenu-title{
|
||||
color: rgba(255, 255, 255, 0.6) !important;
|
||||
}
|
||||
|
||||
.loginOut {
|
||||
cursor: pointer;
|
||||
|
|
|
@ -15,7 +15,6 @@ import SimpleForm from "@/components/form/simple_form";
|
|||
import React from "react";
|
||||
import { FormType } from "@/components/form/interface";
|
||||
import DirectoryTree from "antd/lib/tree/DirectoryTree";
|
||||
import { DataNode } from "antd/lib/tree";
|
||||
const { Option } = Select;
|
||||
const Dep = (props: Store) => {
|
||||
const { depStore } = props;
|
||||
|
@ -35,20 +34,20 @@ const Dep = (props: Store) => {
|
|||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(data);
|
||||
setRecord(data);
|
||||
setId(record.key);
|
||||
setId(record.id);
|
||||
};
|
||||
const onFinish = (values: any) => {
|
||||
const onFinish =async (values: any) => {
|
||||
if (!tagId) {
|
||||
depStore.add(values);
|
||||
await depStore.add(values);
|
||||
} else {
|
||||
depStore.putItem(tagId, values);
|
||||
await depStore.putItem(tagId, values);
|
||||
}
|
||||
getOrg();
|
||||
await getOrg();
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
depStore.getlist();
|
||||
getOrg();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [depStore]);
|
||||
|
||||
const getOrg = () => {
|
||||
|
@ -123,10 +122,11 @@ const Dep = (props: Store) => {
|
|||
onSelect={onSelect}
|
||||
onExpand={onExpand}
|
||||
treeData={org}
|
||||
titleRender={(nodeData: DataNode) => {
|
||||
titleRender={(nodeData: any) => {
|
||||
console.log(nodeData)
|
||||
return (
|
||||
<>
|
||||
{nodeData.title}
|
||||
{nodeData.dep_name}
|
||||
<span
|
||||
style={{ marginLeft: "10px", color: "blue" }}
|
||||
onClick={() => {
|
||||
|
@ -138,8 +138,9 @@ const Dep = (props: Store) => {
|
|||
<span
|
||||
style={{ marginLeft: "10px", color: "blue" }}
|
||||
onClick={() => {
|
||||
depStore.deleteItem(nodeData.key);
|
||||
getOrg()
|
||||
depStore.deleteItem(nodeData.id).then(()=>{
|
||||
getOrg()
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
|
|
|
@ -50,11 +50,14 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 5;
|
||||
flex: 4;
|
||||
.title_img {
|
||||
margin-left: 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
}
|
||||
img{
|
||||
width: 100px;
|
||||
}
|
||||
.on_to {
|
||||
transform: rotate(-180deg) rotateY(0deg);
|
||||
|
@ -121,6 +124,15 @@
|
|||
opacity: 1;
|
||||
background: rgba(37, 52, 70, 0.4);
|
||||
backdrop-filter: blur(10px);
|
||||
height: 100%;
|
||||
}
|
||||
.map_container_b_check{
|
||||
position: absolute;
|
||||
bottom: 40px;
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.map_container_b {
|
||||
position: absolute;
|
||||
|
@ -151,7 +163,6 @@
|
|||
|
||||
.map_video_container {
|
||||
position: absolute;
|
||||
width: 350px;
|
||||
top: 70px;
|
||||
right: 300px;
|
||||
right: calc(20%);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { useNavigate } from "react-router";
|
|||
import Weather from "./homeLeft/weather";
|
||||
import Timer from "./homeLeft/timer";
|
||||
import HomeVideo from "./home_video";
|
||||
import HomeCheck from "./home_check";
|
||||
|
||||
const Home = observer(() => {
|
||||
const navigate = useNavigate();
|
||||
|
@ -30,7 +31,7 @@ const Home = observer(() => {
|
|||
onClick={() => {
|
||||
navigate("admin/user");
|
||||
}}
|
||||
style={{ fontSize: "20px", color: "#f9f9f9", cursor: "pointer" }}
|
||||
style={{ fontSize: "1rem", color: "#f9f9f9", cursor: "pointer" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,6 +54,9 @@ const Home = observer(() => {
|
|||
<div className="map_container_r">
|
||||
<HomeRight />
|
||||
</div>
|
||||
<div className="map_container_b_check">
|
||||
<HomeCheck />
|
||||
</div>
|
||||
<div className="map_container_b">
|
||||
<HomeBottom />
|
||||
</div>
|
||||
|
|
|
@ -98,6 +98,8 @@ const Dispath = (props: Store) => {
|
|||
};
|
||||
data.task_video = task_videos;
|
||||
trainingStore.add(data).then(()=>{
|
||||
console.log("添加成功")
|
||||
message.error("任务发布成功");
|
||||
homeStore.getNewTask()
|
||||
});
|
||||
|
||||
|
|
|
@ -3,57 +3,7 @@ import WhichVideo from "./which_video";
|
|||
import Ec from "./ec";
|
||||
import Emr from "./emr";
|
||||
import "./bot.less";
|
||||
import { Radio } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/es/form/interface";
|
||||
import MapUtl from "@/components/map/mapUtil";
|
||||
|
||||
const HomeBottom = (props: Store) => {
|
||||
const { homeStore } = props;
|
||||
const [size, changeSize] = useState("1");
|
||||
const handleSizeChange = (e: any) => {
|
||||
changeSize(e.target.value);
|
||||
getUlist(e.target.value);
|
||||
};
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
getUlist("1");
|
||||
}, 2000);
|
||||
}, []);
|
||||
|
||||
const getUlist = (type) => {
|
||||
let query = {};
|
||||
switch (type) {
|
||||
case "1":
|
||||
query = { militia: 1 };
|
||||
break;
|
||||
case "2":
|
||||
query = { grid_officer: 1 };
|
||||
break;
|
||||
case "3":
|
||||
query = { patrol_brigade: 1 };
|
||||
break;
|
||||
}
|
||||
let marks = MapUtl.makerList;
|
||||
if (marks.length) {
|
||||
marks.forEach((item) => {
|
||||
item?.marker.remove();
|
||||
});
|
||||
}
|
||||
homeStore.getContact(query).then((res) => {
|
||||
let list = res.data.record;
|
||||
list.forEach((element) => {
|
||||
if (!element.lat || !element.long) return;
|
||||
MapUtl.addMaker({
|
||||
lng: element.long,
|
||||
lat: element.lat,
|
||||
title: element.user_name,
|
||||
users: element,
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
const HomeBottom = () => {
|
||||
return (
|
||||
<div className="bottom_container">
|
||||
<div className="bottom_content">
|
||||
|
@ -61,16 +11,10 @@ const HomeBottom = (props: Store) => {
|
|||
<Emr />
|
||||
<Ec />
|
||||
<WhichVideo />
|
||||
{/* 切换marker查看 */}
|
||||
<Radio.Group value={size} onChange={handleSizeChange}>
|
||||
<Radio.Button value="1">民兵</Radio.Button>
|
||||
<Radio.Button value="2">网格员</Radio.Button>
|
||||
<Radio.Button value="3">巡防</Radio.Button>
|
||||
</Radio.Group>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// export default HomeBottom;
|
||||
export default inject("homeStore")(observer(HomeBottom));
|
||||
export default HomeBottom;
|
||||
|
|
|
@ -20,7 +20,7 @@ const Timer = () => {
|
|||
clearInterval(tim);
|
||||
};
|
||||
}, []);
|
||||
return <span>{times} </span>;
|
||||
return <span style={{fontSize:"1rem"}}>{times} </span>;
|
||||
};
|
||||
|
||||
export default Timer;
|
||||
|
|
|
@ -21,7 +21,7 @@ const Weather = () => {
|
|||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: "13px",
|
||||
fontSize: ".8rem",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
|
@ -32,7 +32,7 @@ const Weather = () => {
|
|||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: "13px",
|
||||
fontSize: ".8rem",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
import { Radio } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/es/form/interface";
|
||||
import MapUtl from "@/components/map/mapUtil";
|
||||
|
||||
const HomeCheck = (props: Store) => {
|
||||
const { homeStore } = props;
|
||||
const [size, changeSize] = useState("1");
|
||||
const handleSizeChange = (e: any) => {
|
||||
changeSize(e.target.value);
|
||||
getUlist(e.target.value);
|
||||
};
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
getUlist("1");
|
||||
}, 2000);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const getUlist = (type) => {
|
||||
let query = {};
|
||||
switch (type) {
|
||||
case "1":
|
||||
query = { militia: 1 };
|
||||
break;
|
||||
case "2":
|
||||
query = { grid_officer: 1 };
|
||||
break;
|
||||
case "3":
|
||||
query = { patrol_brigade: 1 };
|
||||
break;
|
||||
}
|
||||
let marks = MapUtl.makerList;
|
||||
if (marks.length) {
|
||||
marks.forEach((item) => {
|
||||
item?.marker.remove();
|
||||
});
|
||||
}
|
||||
homeStore.getContact(query).then((res) => {
|
||||
let list = res.data.record;
|
||||
list.forEach((element) => {
|
||||
if (!element.lat || !element.long) return;
|
||||
MapUtl.addMaker({
|
||||
lng: element.long,
|
||||
lat: element.lat,
|
||||
title: element.user_name,
|
||||
users: element,
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Radio.Group value={size} onChange={handleSizeChange}>
|
||||
<Radio.Button value="1">民兵</Radio.Button>
|
||||
<Radio.Button value="2">网格员</Radio.Button>
|
||||
<Radio.Button value="3">巡防</Radio.Button>
|
||||
</Radio.Group>
|
||||
);
|
||||
};
|
||||
|
||||
// export default HomeBottom;
|
||||
export default inject("homeStore")(observer(HomeCheck));
|
|
@ -7,21 +7,17 @@ import "./video.less";
|
|||
const HomeVideo = (props: Store) => {
|
||||
const { homeStore } = props;
|
||||
const [videoUrls, setVideoUrl] = useState<Array<string> | null>([]);
|
||||
const [showVideo, setShowVideo] = useState<boolean>(false);
|
||||
useEffect(() => {
|
||||
// 获取最新任务
|
||||
homeStore.getNewTask().then((res) => {
|
||||
setVideoUrl(res);
|
||||
});
|
||||
}, [homeStore]);
|
||||
setShowVideo(homeStore.showVideo);
|
||||
}, [homeStore, homeStore.showVideo]);
|
||||
return (
|
||||
<div>
|
||||
{homeStore.showVideo ? (
|
||||
<div
|
||||
className="homeVideoBox"
|
||||
style={{
|
||||
width: "350px",
|
||||
}}
|
||||
>
|
||||
<>
|
||||
{showVideo ? (
|
||||
<div className="homeVideoBox" style={{width: "300px"}}>
|
||||
{videoUrls?.map((videoUrl, index) => {
|
||||
return (
|
||||
<div key={videoUrl} style={{ flex: "1", margin: "5px" }}>
|
||||
|
@ -31,7 +27,7 @@ const HomeVideo = (props: Store) => {
|
|||
})}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,78 +1,18 @@
|
|||
// import { Store } from "antd/es/form/interface";
|
||||
// import { useEffect, useRef } from "react";
|
||||
// import videojs from "video.js";
|
||||
// import "video.js/dist/video-js.css";
|
||||
|
||||
// const Videos = (props: Store) => {
|
||||
// const { onReady } = props;
|
||||
// let videoRef = useRef<HTMLDivElement>(null);
|
||||
// let playerRef = useRef<any>(null); // 使用 any 类型
|
||||
// const videoJsOptions = {
|
||||
// autoplay: true,
|
||||
// controls: true,
|
||||
// responsive: true,
|
||||
// fluid: true,
|
||||
// sources: [
|
||||
// {
|
||||
// src: "",
|
||||
// type: "application/x-mpegURL",
|
||||
// },
|
||||
// ],
|
||||
// };
|
||||
// useEffect(() => {
|
||||
// if (!props.url) return;
|
||||
// videoJsOptions.sources[0].src = props.url;
|
||||
// if (!playerRef.current && videoRef.current) {
|
||||
// const videoElement = document.createElement(`video-js`);
|
||||
// videoElement.classList.add(`vjs-big-play-centered${props.url}`);
|
||||
// videoRef.current.appendChild(videoElement);
|
||||
// const player = (playerRef.current = videojs(
|
||||
// videoElement,
|
||||
// videoJsOptions,
|
||||
// () => {
|
||||
// videojs.log("player is ready");
|
||||
// onReady && onReady(player);
|
||||
// }
|
||||
// ));
|
||||
// } else {
|
||||
// const player = playerRef.current;
|
||||
// player?.autoplay(videoJsOptions?.autoplay);
|
||||
// player.src(videoJsOptions?.sources);
|
||||
// }
|
||||
// return () => {
|
||||
// if (playerRef.current) {
|
||||
// playerRef.current.dispose();
|
||||
// playerRef.current = null;
|
||||
// }
|
||||
// };
|
||||
// }, [videoRef, onReady, props.url]);
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// <div data-vjs-player style={{ width: "100%", height: "100%" }}>
|
||||
// <div ref={videoRef} style={{ width: "100%", height: "100%" }} />
|
||||
// </div>
|
||||
// </>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default Videos;
|
||||
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import flvjs from 'flv.js';
|
||||
import { Store } from 'antd/es/form/interface';
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import flvjs from "flv.js";
|
||||
import { Store } from "antd/es/form/interface";
|
||||
|
||||
const VideoPlayer = (props: Store) => {
|
||||
const videoRef = useRef<HTMLVideoElement | null>(null);
|
||||
let player: flvjs.Player | null = null;
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!props.url)return;
|
||||
if (!props.url) return;
|
||||
if (flvjs.isSupported()) {
|
||||
const videoElement = videoRef.current;
|
||||
if (videoElement) {
|
||||
player = flvjs.createPlayer({
|
||||
type: 'mp4',
|
||||
type: "mp4",
|
||||
url: props.url,
|
||||
});
|
||||
player.attachMediaElement(videoElement);
|
||||
|
@ -93,15 +33,13 @@ const VideoPlayer = (props: Store) => {
|
|||
}, [props.url]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<video
|
||||
ref={videoRef}
|
||||
style={{ width: '100%', height: '500px' }}
|
||||
controls
|
||||
autoPlay
|
||||
/>
|
||||
</div>
|
||||
<video
|
||||
ref={videoRef}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
controls
|
||||
autoPlay
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoPlayer;
|
||||
export default VideoPlayer;
|
||||
|
|
|
@ -13,6 +13,7 @@ const Login = (props) => {
|
|||
userName: values.account,
|
||||
passWord: values.password,
|
||||
});
|
||||
console.log(status)
|
||||
await usrStore.loginVideo()
|
||||
if (status) {
|
||||
usrStore.closeLoginDilog();
|
||||
|
|
|
@ -47,7 +47,7 @@ export const traningConfig = [
|
|||
label: "训练次数",
|
||||
name: "count",
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "请输入训练次数!" }],
|
||||
rules: [],
|
||||
},
|
||||
{
|
||||
type: FormType.treeVideo,
|
||||
|
|
|
@ -1,12 +1,41 @@
|
|||
import MapContainer from "@/components/map/MapComponent";
|
||||
import MapUtl from "@/components/map/mapUtil";
|
||||
import { Button, message, Modal } from "antd";
|
||||
import { Button, message, Modal, Space } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useState } from "react";
|
||||
import { DatePicker } from "antd";
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
const Move = (props) => {
|
||||
const { usrStore, id } = props;
|
||||
const [isOpen, setOpen] = useState<boolean>(false);
|
||||
const [times, setTimes] = useState<string[]>([]);
|
||||
const serchSD = () => {
|
||||
if (times.length===0){
|
||||
message.error("请选择时间区间")
|
||||
return
|
||||
}
|
||||
usrStore.getSite({
|
||||
"id":id,
|
||||
"start_time":times[0],
|
||||
"end_time":times[1],
|
||||
}).then((res) => {
|
||||
let data: any = [];
|
||||
if (res.data && res.data.record) {
|
||||
res.data.record.forEach((element) => {
|
||||
data.push([element.long, element.lat]);
|
||||
});
|
||||
if (data.length === 0) {
|
||||
message.info("暂无轨迹数据");
|
||||
return;
|
||||
}
|
||||
if (data.length > 0) {
|
||||
MapUtl.polyline(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
|
@ -18,9 +47,10 @@ const Move = (props) => {
|
|||
>
|
||||
查看轨迹信息
|
||||
</Button>
|
||||
|
||||
<Modal
|
||||
title={"轨迹回放"}
|
||||
width={"80%"}
|
||||
width={"70%"}
|
||||
open={isOpen}
|
||||
centered
|
||||
okText="确定"
|
||||
|
@ -32,29 +62,20 @@ const Move = (props) => {
|
|||
}}
|
||||
>
|
||||
<div>
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
usrStore.getSite(id).then((res) => {
|
||||
let data: any = [];
|
||||
if (res.data && res.data.record) {
|
||||
res.data.record.forEach((element) => {
|
||||
data.push([element.long, element.lat]);
|
||||
});
|
||||
if (data.length === 0) {
|
||||
message.info("暂无轨迹数据");
|
||||
return;
|
||||
}
|
||||
if (data.length > 0) {
|
||||
MapUtl.polyline(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
查看轨迹信息
|
||||
</Button>
|
||||
<Space>
|
||||
<RangePicker onChange={(v,s)=>{
|
||||
setTimes(s);
|
||||
}} />
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
serchSD();
|
||||
}}
|
||||
>
|
||||
查看轨迹信息
|
||||
</Button>
|
||||
</Space>
|
||||
<div style={{ height: "10px" }}></div>
|
||||
<MapContainer />
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ 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 "./user_config";
|
||||
import { columns, defaultConfig, userSerchConfig } from "./user_config";
|
||||
import "./user.less";
|
||||
import Move from "./move";
|
||||
import dayjs from "dayjs";
|
||||
|
@ -16,6 +16,7 @@ const User = (props: Store) => {
|
|||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const serchFormRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [team, setTeam] = useState<any>(null);
|
||||
const [per, setPer] = useState<any>(null);
|
||||
|
@ -23,16 +24,18 @@ const User = (props: Store) => {
|
|||
const [depList, setDeplist] = useState<any>([]);
|
||||
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
let records = {
|
||||
...record,
|
||||
vet_in_time: dayjs(record.vet_in_time),
|
||||
vet_out_time: dayjs(record.vet_out_time),
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
team_link_user:record.team.map(item => item.team_identity),
|
||||
pers_link_user:record.pers.map(item=>item.pers_identity)
|
||||
};
|
||||
setProjectConfig(defaultConfig(team, per));
|
||||
setIsModalOpen(true);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
setRecord(records);
|
||||
setId(records.id);
|
||||
};
|
||||
const onFinish = async (values: any) => {
|
||||
let data = {
|
||||
|
@ -45,7 +48,6 @@ const User = (props: Store) => {
|
|||
}
|
||||
if (!userId) {
|
||||
let res = await usrStore.add(data);
|
||||
console.log(res);
|
||||
if (res) {
|
||||
setIsModalOpen(false);
|
||||
}
|
||||
|
@ -83,17 +85,55 @@ const User = (props: Store) => {
|
|||
const addHandler = () => {
|
||||
setProjectConfig(defaultConfig(team, per));
|
||||
setId(null);
|
||||
setRecord(null)
|
||||
setRecord(null);
|
||||
setIsModalOpen(true);
|
||||
};
|
||||
const onSerchFinish = (values: any) => {
|
||||
usrStore.getlist(values);
|
||||
};
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Space direction="horizontal" size={"middle"}>
|
||||
<Space
|
||||
direction="horizontal"
|
||||
size={"middle"}
|
||||
style={{ display: "flex", justifyContent: "space-between" }}
|
||||
>
|
||||
<Button type="default" onClick={() => addHandler()}>
|
||||
添加民兵
|
||||
</Button>
|
||||
<SimpleForm
|
||||
formRef={serchFormRef}
|
||||
createCallback={() => {}}
|
||||
formName="serch_basic"
|
||||
colProps={30}
|
||||
span={8}
|
||||
layout="inline"
|
||||
formDatas={userSerchConfig}
|
||||
onFinish={onSerchFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
>
|
||||
<Space>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
serchFormRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
查询
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
serchFormRef.current?.resetFields();
|
||||
serchFormRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
重置
|
||||
</Button>
|
||||
</Space>
|
||||
</SimpleForm>
|
||||
</Space>
|
||||
<BTable
|
||||
store={usrStore}
|
||||
|
@ -113,7 +153,7 @@ const User = (props: Store) => {
|
|||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Move id={record.identity}/>
|
||||
<Move id={record.identity} />
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { FormType } from "@/components/form/interface";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { Image } from "antd";
|
||||
import { Avatar, Image } from "antd";
|
||||
import { getAgeByIDCard, getBirthDateAndGender } from "@/util/util";
|
||||
export const defaultConfig =(team,per)=>
|
||||
[
|
||||
|
@ -225,6 +225,22 @@ export const defaultConfig =(team,per)=>
|
|||
},
|
||||
];
|
||||
|
||||
export const userSerchConfig = [
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "用户名",
|
||||
name: "user_name",
|
||||
value: "",
|
||||
rules: [],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "身份证号",
|
||||
name: "id_card",
|
||||
value: "",
|
||||
rules: [],
|
||||
},
|
||||
];
|
||||
export const columns: ColumnsType<UserDataType> = [
|
||||
{
|
||||
title: "用户名",
|
||||
|
@ -247,10 +263,9 @@ export const columns: ColumnsType<UserDataType> = [
|
|||
dataIndex: "head_img",
|
||||
width: 150,
|
||||
render: (head_img) =>{
|
||||
return <Image src={head_img}></Image>
|
||||
return <Avatar size={64} shape="square" src={<Image src={head_img}></Image>} />
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
title: "登录账号",
|
||||
width: 150,
|
||||
|
@ -271,26 +286,7 @@ export const columns: ColumnsType<UserDataType> = [
|
|||
width: 150,
|
||||
dataIndex: "pos_held",
|
||||
},
|
||||
{
|
||||
title: "通讯地址",
|
||||
width: 150,
|
||||
dataIndex: "mail_addr",
|
||||
},
|
||||
{
|
||||
title: "服役部队",
|
||||
width: 150,
|
||||
dataIndex: "serv_unit",
|
||||
},
|
||||
{
|
||||
title: "贯籍",
|
||||
width: 150,
|
||||
dataIndex: "porig",
|
||||
},
|
||||
{
|
||||
title: "专业特长",
|
||||
width: 150,
|
||||
dataIndex: "spec",
|
||||
},
|
||||
|
||||
{
|
||||
title: "邮箱",
|
||||
width: 150,
|
||||
|
@ -301,11 +297,6 @@ export const columns: ColumnsType<UserDataType> = [
|
|||
width: 150,
|
||||
dataIndex: "tel",
|
||||
},
|
||||
{
|
||||
title: "民族",
|
||||
width: 150,
|
||||
dataIndex: "eth",
|
||||
},
|
||||
{
|
||||
title: "是否党员",
|
||||
width: 150,
|
||||
|
|
|
@ -48,7 +48,6 @@ class BaseHttp {
|
|||
let res = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
|
||||
params
|
||||
});
|
||||
return res.data;
|
||||
|
|
|
@ -64,7 +64,7 @@ class HomeStore extends BaseStore<TagDataType> {
|
|||
// 获取视频推流连接
|
||||
async getVideoUrlList() {
|
||||
try {
|
||||
let data = await baseHttp.gets(HomeConfig.deviceList, {
|
||||
let data = await baseHttp.gets(Config.videoApi+HomeConfig.deviceList, {
|
||||
start: 0,
|
||||
limit: 30
|
||||
})
|
||||
|
@ -77,7 +77,7 @@ class HomeStore extends BaseStore<TagDataType> {
|
|||
// 通道列表
|
||||
async getChannerUrlList(deviceId) {
|
||||
try {
|
||||
let data = await baseHttp.gets(Config.baseUrl+HomeConfig.channerList, {
|
||||
let data = await baseHttp.gets(Config.videoApi+HomeConfig.channerList, {
|
||||
start: 0,
|
||||
limit: 30,
|
||||
device: deviceId
|
||||
|
@ -90,7 +90,7 @@ class HomeStore extends BaseStore<TagDataType> {
|
|||
// 获取通道流
|
||||
async getChannerStrem(deviceId, channel) {
|
||||
try {
|
||||
let data = await baseHttp.gets(HomeConfig.channelstream, {
|
||||
let data = await baseHttp.gets(Config.videoApi+HomeConfig.channelstream, {
|
||||
device: deviceId,
|
||||
channel: channel,
|
||||
protocol: "fmp4"
|
||||
|
@ -112,6 +112,7 @@ class HomeStore extends BaseStore<TagDataType> {
|
|||
}
|
||||
this.getTaskUserList()
|
||||
this.showVideoHandler(true)
|
||||
|
||||
}
|
||||
return urls;
|
||||
} catch (error) {
|
||||
|
@ -133,6 +134,7 @@ class HomeStore extends BaseStore<TagDataType> {
|
|||
}
|
||||
showVideoHandler(status) {
|
||||
this.showVideo = status
|
||||
console.log("homeStore.showVideo",this.showVideo,status)
|
||||
}
|
||||
ogMap!: Object;
|
||||
showVideo!: boolean;
|
||||
|
|
|
@ -4,6 +4,7 @@ import baseHttp from "@/service/base";
|
|||
import BaseStore from "./baseStore";
|
||||
import { UserDataType, UserInfos } from "@/model/userModel";
|
||||
import { message } from "antd";
|
||||
import Config from "@/util/config";
|
||||
class UserConfig {
|
||||
static LOGINURI: string = "/v1/anth/login/pc"
|
||||
static LIST: string = "/v1/user/list"
|
||||
|
@ -15,7 +16,7 @@ class UserConfig {
|
|||
static per: string = "/v1/persMgmt/list"
|
||||
static serch: string = "/v1/user/serch"
|
||||
static getPatrol: string = "/v1/user/getPatrol"
|
||||
static videoLogin: string = "api/v1/login"
|
||||
static videoLogin: string = "/api/v1/login"
|
||||
static siteList: string = "/v1/user/site"
|
||||
|
||||
|
||||
|
@ -64,7 +65,7 @@ class UserStore extends BaseStore<UserDataType> {
|
|||
}
|
||||
|
||||
async getSite(id) {
|
||||
return await baseHttp.get(UserConfig.siteList + "/" + id, {})
|
||||
return await baseHttp.put(UserConfig.siteList + "/" + id.id, id)
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,7 +107,7 @@ class UserStore extends BaseStore<UserDataType> {
|
|||
|
||||
async loginVideo() {
|
||||
try {
|
||||
let data = await baseHttp.get(UserConfig.videoLogin, {
|
||||
let data = await baseHttp.get(Config.videoApi + UserConfig.videoLogin, {
|
||||
username: "easycvr",
|
||||
password: "4092c09db0af030641a977d76044de4f",
|
||||
})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class Config {
|
||||
static baseUrl = "https://www.hswzct.cn:12016";
|
||||
static ws = "wss://www.hswzct.cn:12016/wsadmin?id=admin";
|
||||
static userStatic = "https://www.hswzct.cn:12016/uploads/user/";
|
||||
static videoApi = "https://sprh.hswzct.cn:4443/"; //
|
||||
static baseUrl = "https://rw.quwanya.cn/";
|
||||
static ws = "wss://rw.quwanya.cn/wsadmin?id=admin";
|
||||
static userStatic = "https://rw.quwanya.cn/api/uploads/user/";
|
||||
static videoApi = "https://sprh.hswzct.cn:4443"; //
|
||||
static videoApis = "https://sprh.hswzct.cn:4443"; //
|
||||
}
|
||||
export default Config;
|
||||
|
|
Loading…
Reference in New Issue