fix(amap):core

This commit is contained in:
wang_yp 2024-10-13 23:30:33 +08:00
parent 144afd93f7
commit 4a7f57bb3c
21 changed files with 271 additions and 69 deletions

58
package-lock.json generated
View File

@ -71,6 +71,7 @@
"react-app-polyfill": "^3.0.0", "react-app-polyfill": "^3.0.0",
"react-dev-utils": "^12.0.1", "react-dev-utils": "^12.0.1",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-player": "^2.16.0",
"react-refresh": "^0.11.0", "react-refresh": "^0.11.0",
"react-router": "^6.4.2", "react-router": "^6.4.2",
"react-router-dom": "^6.4.2", "react-router-dom": "^6.4.2",
@ -15903,6 +15904,11 @@
"resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
}, },
"node_modules/load-script": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/load-script/-/load-script-1.0.0.tgz",
"integrity": "sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA=="
},
"node_modules/loader-runner": { "node_modules/loader-runner": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz", "resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz",
@ -16173,6 +16179,11 @@
"node": ">= 4.0.0" "node": ">= 4.0.0"
} }
}, },
"node_modules/memoize-one": {
"version": "5.2.1",
"resolved": "https://registry.npmmirror.com/memoize-one/-/memoize-one-5.2.1.tgz",
"integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
},
"node_modules/memory-fs": { "node_modules/memory-fs": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmmirror.com/memory-fs/-/memory-fs-0.4.1.tgz", "resolved": "https://registry.npmmirror.com/memory-fs/-/memory-fs-0.4.1.tgz",
@ -20268,11 +20279,31 @@
"resolved": "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "resolved": "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
}, },
"node_modules/react-fast-compare": {
"version": "3.2.2",
"resolved": "https://registry.npmmirror.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
"integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ=="
},
"node_modules/react-is": { "node_modules/react-is": {
"version": "17.0.2", "version": "17.0.2",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-17.0.2.tgz", "resolved": "https://registry.npmmirror.com/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
}, },
"node_modules/react-player": {
"version": "2.16.0",
"resolved": "https://registry.npmmirror.com/react-player/-/react-player-2.16.0.tgz",
"integrity": "sha512-mAIPHfioD7yxO0GNYVFD1303QFtI3lyyQZLY229UEAp/a10cSW+hPcakg0Keq8uWJxT2OiT/4Gt+Lc9bD6bJmQ==",
"dependencies": {
"deepmerge": "^4.0.0",
"load-script": "^1.0.0",
"memoize-one": "^5.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.0.1"
},
"peerDependencies": {
"react": ">=16.6.0"
}
},
"node_modules/react-refresh": { "node_modules/react-refresh": {
"version": "0.11.0", "version": "0.11.0",
"resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.11.0.tgz", "resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.11.0.tgz",
@ -45134,6 +45165,11 @@
"resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
}, },
"load-script": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/load-script/-/load-script-1.0.0.tgz",
"integrity": "sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA=="
},
"loader-runner": { "loader-runner": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz", "resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz",
@ -45363,6 +45399,11 @@
"fs-monkey": "^1.0.4" "fs-monkey": "^1.0.4"
} }
}, },
"memoize-one": {
"version": "5.2.1",
"resolved": "https://registry.npmmirror.com/memoize-one/-/memoize-one-5.2.1.tgz",
"integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
},
"memory-fs": { "memory-fs": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmmirror.com/memory-fs/-/memory-fs-0.4.1.tgz", "resolved": "https://registry.npmmirror.com/memory-fs/-/memory-fs-0.4.1.tgz",
@ -48183,11 +48224,28 @@
"resolved": "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "resolved": "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
}, },
"react-fast-compare": {
"version": "3.2.2",
"resolved": "https://registry.npmmirror.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
"integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ=="
},
"react-is": { "react-is": {
"version": "17.0.2", "version": "17.0.2",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-17.0.2.tgz", "resolved": "https://registry.npmmirror.com/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
}, },
"react-player": {
"version": "2.16.0",
"resolved": "https://registry.npmmirror.com/react-player/-/react-player-2.16.0.tgz",
"integrity": "sha512-mAIPHfioD7yxO0GNYVFD1303QFtI3lyyQZLY229UEAp/a10cSW+hPcakg0Keq8uWJxT2OiT/4Gt+Lc9bD6bJmQ==",
"requires": {
"deepmerge": "^4.0.0",
"load-script": "^1.0.0",
"memoize-one": "^5.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.0.1"
}
},
"react-refresh": { "react-refresh": {
"version": "0.11.0", "version": "0.11.0",
"resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.11.0.tgz", "resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.11.0.tgz",

View File

@ -66,6 +66,7 @@
"react-app-polyfill": "^3.0.0", "react-app-polyfill": "^3.0.0",
"react-dev-utils": "^12.0.1", "react-dev-utils": "^12.0.1",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-player": "^2.16.0",
"react-refresh": "^0.11.0", "react-refresh": "^0.11.0",
"react-router": "^6.4.2", "react-router": "^6.4.2",
"react-router-dom": "^6.4.2", "react-router-dom": "^6.4.2",

View File

@ -16,7 +16,7 @@ export default function MapContainer() {
const Amap = await AMapLoader.load({ const Amap = await AMapLoader.load({
key: "d58999d072ed7e5897d3900a769cfda0", // 申请好的Web端开发者Key首次调用 load 时必填 key: "d58999d072ed7e5897d3900a769cfda0", // 申请好的Web端开发者Key首次调用 load 时必填
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: ["AMap.Scale","AMap.MoveAnimation"], plugins: ["AMap.Scale","AMap.MoveAnimation","AMap.Weather"],
}); });
amap = new Amap.Map("container", { amap = new Amap.Map("container", {
@ -30,9 +30,10 @@ export default function MapContainer() {
// addMaket(Amap,amap); // addMaket(Amap,amap);
MapUtl.loadMap = Amap; MapUtl.loadMap = Amap;
MapUtl.amap = amap; MapUtl.amap = amap;
var weather = new Amap.Weather();
MapUtl.wecherInfo = weather
amap.setFitView(); amap.setFitView();
}; };
return <div id="container" style={{ height: "100vh" }}></div>; return <div id="container" style={{ height: "100vh" }}></div>;
} }

View File

@ -47,6 +47,7 @@ export default function MapFrom(props:any) {
}); });
mouseTool.marker(); mouseTool.marker();
}); });
setmaps(Amap); setmaps(Amap);
}; };

View File

@ -2,6 +2,7 @@ class MapUtl {
static makerList: any[] = []; static makerList: any[] = [];
static amap: any = null; static amap: any = null;
static loadMap: any = null; static loadMap: any = null;
static wecherInfo: any = null;
static addMaker(data: any) { static addMaker(data: any) {
const { lng, lat, title, users } = data; const { lng, lat, title, users } = data;
@ -61,12 +62,14 @@ class MapUtl {
}); });
MapUtl.amap.setFitView(); MapUtl.amap.setFitView();
marker.moveAlong(lineArr, { marker.moveAlong(lineArr, {
// 每一段的时长
duration: 500,//可根据实际采集时间间隔设置 duration: 500,//可根据实际采集时间间隔设置
// JSAPI2.0 是否延道路自动设置角度在 moveAlong 里设置
autoRotation: true, autoRotation: true,
}); });
} }
static getWecher(){
}
} }
export default MapUtl; export default MapUtl;

View File

@ -84,7 +84,7 @@ const OrgChartSelf = (props: Store) => {
backgroundColor: "#fff", backgroundColor: "#fff",
}} }}
width={50} width={50}
// src="https://img1.baidu.com/it/u=1746619441,3368766734&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400" src="https://pic.aigexing.net/uploads/5/1253/3721116011/92968290915/8785297.jpg"
alt="" alt=""
/> />
<span className="userNmae">{v1.user_name}</span> <span className="userNmae">{v1.user_name}</span>
@ -103,7 +103,7 @@ const OrgChartSelf = (props: Store) => {
backgroundColor: "#fff", backgroundColor: "#fff",
}} }}
width={50} width={50}
// src="https://img1.baidu.com/it/u=1746619441,3368766734&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400" src="https://pic.aigexing.net/uploads/5/1253/3721116011/92968290915/8785297.jpg"
alt="" alt=""
/> />
<span className="userNmae">{v1.user_name}</span> <span className="userNmae">{v1.user_name}</span>
@ -140,7 +140,7 @@ const OrgChartSelf = (props: Store) => {
backgroundColor: "#fff", backgroundColor: "#fff",
}} }}
width={50} width={50}
// src="https://img1.baidu.com/it/u=1746619441,3368766734&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400" src="https://pic.aigexing.net/uploads/5/1253/3721116011/92968290915/8785297.jpg"
alt="" alt=""
/> />
<span className="userNmae">{v1.user_name}</span> <span className="userNmae">{v1.user_name}</span>

View File

@ -16,7 +16,6 @@ const Dep = (props: Store) => {
const formRef = React.useRef<FormInstance>(null); const formRef = React.useRef<FormInstance>(null);
const [record, setRecord] = useState<any>(null); const [record, setRecord] = useState<any>(null);
const [tagId, setId] = useState<Number | null>(null); const [tagId, setId] = useState<Number | null>(null);
const [stoList, setStolist] = useState<any>([]);
const columns: ColumnsType<UserDataType> = [ const columns: ColumnsType<UserDataType> = [
{ title: "部门名称", dataIndex: "dep_name" }, { title: "部门名称", dataIndex: "dep_name" },
{ title: "部门描述", dataIndex: "remark" }, { title: "部门描述", dataIndex: "remark" },
@ -51,7 +50,6 @@ const Dep = (props: Store) => {
}, },
]; ];
const edit = (record) => { const edit = (record) => {
let data = { let data = {
...record, ...record,
head_img: [{ url: record.head_img }], head_img: [{ url: record.head_img }],
@ -71,9 +69,7 @@ const Dep = (props: Store) => {
setIsModalOpen(false); setIsModalOpen(false);
}; };
useEffect(() => { useEffect(() => {
depStore.getlist().then(() => { depStore.getlist();
setStolist(depStore.list);
});
}, [depStore]); }, [depStore]);
const defaultConfig = [ const defaultConfig = [
{ {
@ -132,7 +128,7 @@ const Dep = (props: Store) => {
open={isModalOpen} open={isModalOpen}
afterClose={() => formRef.current?.resetFields()} afterClose={() => formRef.current?.resetFields()}
onOk={() => formRef.current?.submit()} onOk={() => formRef.current?.submit()}
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
onCancel={() => { onCancel={() => {
setId(null); setId(null);
@ -153,13 +149,9 @@ const Dep = (props: Store) => {
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
> >
<> <>
<Form.Item <Form.Item key="pdep_id" label="上级部门" name="pdep_id">
key="pdep_id"
label="上级部门"
name="pdep_id"
>
<Select placeholder=""> <Select placeholder="">
{stoList?.map((v: any) => { {depStore.list?.map((v: any) => {
return ( return (
<Option key={v.id} value={v.id}> <Option key={v.id} value={v.id}>
{v.dep_name} {v.dep_name}

View File

@ -0,0 +1,44 @@
import BTable from "@/components/b_table";
import { UserDataType } from "@/model/userModel";
import { Store } from "antd/es/form/interface";
import { ColumnsType } from "antd/lib/table";
import { inject, observer } from "mobx-react";
import { useEffect, useState } from "react";
interface EmUser {
emergencyStore?: Store;
id?: string;
}
const EmUser = (props: EmUser) => {
const { emergencyStore, id } = props;
const [ulist, setUlist] = useState<number | null>(0);
useEffect(() => {
emergencyStore?.getUserlist(id).then((e) => {
setUlist(e.data.record);
});
}, [emergencyStore, id]);
const _columns: ColumnsType<UserDataType> = [
{ title: "民兵名称", dataIndex: "user_name" },
{ title: "民兵描述", dataIndex: "remark" },
{ title: "民兵账号", dataIndex: "account" },
{ title: "是否接收任务", dataIndex: "is_accept",render(value, record, index) {
return value ? "是" : "否";
}, },
];
return (
<>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p>
</div>
<BTable
store={emergencyStore}
columns={_columns}
dataSource={ulist}
selectCallback={(e) => {}}
/>
</>
);
};
export default inject("emergencyStore")(observer(EmUser));

View File

@ -20,12 +20,16 @@ import baseHttp from "@/service/base";
import MinusCircleOutlined from "@ant-design/icons/lib/icons/MinusCircleOutlined"; import MinusCircleOutlined from "@ant-design/icons/lib/icons/MinusCircleOutlined";
import { EmConfig } from "./em_column"; import { EmConfig } from "./em_column";
import TaskArchives from "../training/task_archives"; import TaskArchives from "../training/task_archives";
import EmUser from "./emUser";
const Emergency = (props: Store) => { const Emergency = (props: Store) => {
const { emergencyStore } = props; const { emergencyStore, trainingStore } = props;
const [isModalOpen, setIsModalOpen] = useState<boolean>(false); const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const [emUserModel, setEmUserModel] = useState<boolean>(false);
const [projectConfig, setProjectConfig] = useState<any>([]); const [projectConfig, setProjectConfig] = useState<any>([]);
const formRef = React.useRef<FormInstance>(null); const formRef = React.useRef<FormInstance>(null);
const [record, setRecord] = useState<any>(null); const [record, setRecord] = useState<any>(null);
const [identity, setIdentity] = useState<any>(null);
const [tagId, setId] = useState<Number | null>(null); const [tagId, setId] = useState<Number | null>(null);
const [userList, setUserList] = useState<Array<any>>([]); const [userList, setUserList] = useState<Array<any>>([]);
const [data, setData] = useState<SelectProps["options"]>([]); const [data, setData] = useState<SelectProps["options"]>([]);
@ -46,6 +50,12 @@ const Emergency = (props: Store) => {
<span style={{ color: "green" }}></span> <span style={{ color: "green" }}></span>
), ),
}, },
{
title: "物资归还状态",
dataIndex: "supplies_status",
render: (supplies_status) =>
supplies_status === 2 ? "已归还" : "未归还",
},
{ {
title: "操作", title: "操作",
dataIndex: "id", dataIndex: "id",
@ -60,17 +70,17 @@ const Emergency = (props: Store) => {
> >
</Button> </Button>
{ {record.status === 0 ? (
record.status === 0 ? <Button <Button
type="dashed" type="dashed"
size="small" size="small"
onClick={() => { onClick={() => {
emergencyStore.fish(record.identity); emergencyStore.fish(record.identity);
}} }}
> >
</Button>:null </Button>
} ) : null}
<Button <Button
type="dashed" type="dashed"
danger danger
@ -81,17 +91,31 @@ const Emergency = (props: Store) => {
> >
</Button> </Button>
<TaskArchives taskId={record?.identity} category_identity={record.archives_category_identity}/> <TaskArchives
taskId={record?.identity}
category_identity={record.archives_category_identity}
/>
<Button <Button
type="dashed" type="dashed"
size="small" size="small"
onClick={() => { onClick={() => {
// trainingStore.id = record?.identity; setIdentity(record?.identity);
// setIsModalOpenUser(true); setEmUserModel(true);
}} }}
> >
</Button> </Button>
{record.supplies_status === 2 ? null : (
<Button
type="dashed"
size="small"
onClick={() => {
trainingStore.back(record?.identity, 1);
}}
>
</Button>
)}
</Space> </Space>
), ),
}, },
@ -170,6 +194,17 @@ const Emergency = (props: Store) => {
columns={columns} columns={columns}
dataSource={emergencyStore.list} dataSource={emergencyStore.list}
/> />
<Modal
title="训练人员"
width={1200}
open={emUserModel}
footer={null}
onCancel={() => {
setEmUserModel(false);
}}
>
<EmUser id={identity} />
</Modal>
<Modal <Modal
title={!tagId ? "任务发布" : "任务编辑"} title={!tagId ? "任务发布" : "任务编辑"}
width={1200} width={1200}
@ -224,7 +259,7 @@ const Emergency = (props: Store) => {
}))} }))}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
{...restField} {...restField}
name={[name, "num"]} name={[name, "num"]}
label={"数量"} label={"数量"}
@ -257,4 +292,4 @@ const Emergency = (props: Store) => {
); );
}; };
export default inject("emergencyStore")(observer(Emergency)); export default inject("emergencyStore", "trainingStore")(observer(Emergency));

View File

@ -27,7 +27,7 @@
display: inline-block; display: inline-block;
animation: scrollText 10s linear infinite; /* 动画 */ animation: scrollText 10s linear infinite; /* 动画 */
} }
:hover >span{ :hover > span {
animation-play-state: paused; animation-play-state: paused;
} }
} }
@ -56,7 +56,7 @@
width: 20px; width: 20px;
height: 20px; height: 20px;
} }
.on_to{ .on_to {
transform: rotate(-180deg) rotateY(0deg); transform: rotate(-180deg) rotateY(0deg);
} }
.twp { .twp {
@ -91,10 +91,11 @@
} }
} }
.map_container_t_r { .map_container_t_r {
flex: 1; flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
text-align: right; text-align: right;
padding-right: 10px; padding-right: 10px;
} }
@ -148,3 +149,12 @@
} }
} }
} }
.map_video_container {
position: absolute;
width: 200px;
height: 400px;
top: 40px;
z-index: 9;
right: 288px;
}

View File

@ -8,9 +8,13 @@ import image2 from "@/static/title_line@1x.png";
import { SettingOutlined } from "@ant-design/icons"; import { SettingOutlined } from "@ant-design/icons";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import MapUtl from "@/components/map/mapUtil";
import ReactPlayer from "react-player";
const Home = observer(() => { const Home = observer(() => {
const navigate = useNavigate(); const navigate = useNavigate();
const [times, setTimes] = useState<any>(); const [times, setTimes] = useState<any>();
const [wechaer, setWechaer] = useState<any>();
const updateTime = () => { const updateTime = () => {
const date = new Date(); const date = new Date();
const month = (date.getMonth() + 1).toString().padStart(2, "0"); const month = (date.getMonth() + 1).toString().padStart(2, "0");
@ -26,6 +30,11 @@ const Home = observer(() => {
// 每秒钟更新一次时间 // 每秒钟更新一次时间
useEffect(() => { useEffect(() => {
let tim = setInterval(updateTime, 1000); let tim = setInterval(updateTime, 1000);
setTimeout(() => {
MapUtl.wecherInfo?.getLive("双流区", (err, data) => {
setWechaer(data);
});
}, 2000);
return () => { return () => {
clearInterval(tim); clearInterval(tim);
}; };
@ -42,6 +51,20 @@ const Home = observer(() => {
<img className="twp" src={image2} alt="" /> <img className="twp" src={image2} alt="" />
</div> </div>
<div className="map_container_t_r"> <div className="map_container_t_r">
<div
style={{
flex: "1",
display: "flex",
alignItems: "center",
justifyContent: "space-around",
color: "#fff",
}}
>
<p>:{wechaer?.weather}</p>
<p>:{wechaer?.windDirection}</p>
<p>:{wechaer?.windPower}</p>
<p>湿:{wechaer?.humidity}</p>
</div>
<SettingOutlined <SettingOutlined
onClick={() => { onClick={() => {
navigate("admin/user"); navigate("admin/user");
@ -63,6 +86,16 @@ const Home = observer(() => {
<HomeLeft /> <HomeLeft />
</div> </div>
<MapContainer /> <MapContainer />
<div className="map_video_container">
{/* <ReactPlayer
className="react-player"
url="https://www.119.gov.cn/images/qmxfxw/expd/2024/07/01/1719818550990010367.mp4" //地址
width="100%" //宽度
height="100%" //高度
playing={true} //是否自动播放
controls //控制
/> */}
</div>
<div className="map_container_r"> <div className="map_container_r">
<HomeRight /> <HomeRight />
</div> </div>

View File

@ -3,8 +3,6 @@ import Orgin from "./orgin";
import Pover from "./pover"; import Pover from "./pover";
import Turn from './turn'; import Turn from './turn';
const HomeLeft = () => { const HomeLeft = () => {
// const openDispatch = () => { // const openDispatch = () => {
// 位置移动 // 位置移动
// MapUtl.makerList[0].setPosition([103.55, 30.342]); // MapUtl.makerList[0].setPosition([103.55, 30.342]);

View File

@ -73,6 +73,7 @@ const Turn = (props: Store) => {
{trainingStore.list?.map((item) => { {trainingStore.list?.map((item) => {
return ( return (
<p <p
key={item.identity}
style={{ style={{
color: item.identity === taskId ? "blue" : "#fff", color: item.identity === taskId ? "blue" : "#fff",
cursor: "pointer", cursor: "pointer",

View File

@ -104,7 +104,7 @@ const Trainings = (props: Store) => {
type="dashed" type="dashed"
size="small" size="small"
onClick={() => { onClick={() => {
trainingStore.back(record?.identity); trainingStore.back(record?.identity,2);
}} }}
> >

View File

@ -8,6 +8,7 @@ import React from "react";
import { columns, defaultConfig } from "./user_config"; import { columns, defaultConfig } from "./user_config";
import "./user.less"; import "./user.less";
import Move from "./move"; import Move from "./move";
import dayjs from "dayjs";
const { Option } = Select; const { Option } = Select;
const User = (props: Store) => { const User = (props: Store) => {
@ -24,15 +25,16 @@ const User = (props: Store) => {
const edit = (record) => { const edit = (record) => {
record = { record = {
...record, ...record,
vet_in_time: dayjs(record.vet_in_time),
vet_out_time: dayjs(record.vet_out_time),
imageUrl: [{ url: record.imageUrl }], imageUrl: [{ url: record.imageUrl }],
}; };
setProjectConfig(defaultConfig(team, per)); setProjectConfig(defaultConfig(team, per));
setIsModalOpen(true); setIsModalOpen(true);
formRef.current?.setFieldsValue(record);
setRecord(record); setRecord(record);
setId(record.id); setId(record.id);
}; };
const onFinish = (values: any) => { const onFinish = async (values: any) => {
let data = { let data = {
...values, ...values,
}; };
@ -42,10 +44,17 @@ const User = (props: Store) => {
data.head_img = ""; data.head_img = "";
} }
if (!userId) { if (!userId) {
usrStore.add(data); let res = await usrStore.add(data);
console.log(res);
if (res) {
setIsModalOpen(false);
}
} else { } else {
let res = await usrStore.putItem(userId, data);
if (res) {
setIsModalOpen(false);
}
} }
setIsModalOpen(false);
}; };
useEffect(() => { useEffect(() => {
usrStore.getlist(); usrStore.getlist();
@ -74,6 +83,7 @@ const User = (props: Store) => {
const addHandler = () => { const addHandler = () => {
setProjectConfig(defaultConfig(team, per)); setProjectConfig(defaultConfig(team, per));
setId(null); setId(null);
setRecord(null)
setIsModalOpen(true); setIsModalOpen(true);
}; };
const onFinishFailed = () => {}; const onFinishFailed = () => {};
@ -104,7 +114,6 @@ const User = (props: Store) => {
</Button> </Button>
<Move /> <Move />
<Button <Button
type="dashed" type="dashed"
danger danger
@ -121,7 +130,7 @@ const User = (props: Store) => {
]} ]}
dataSource={usrStore.list} dataSource={usrStore.list}
/> />
<Modal <Modal
title={!userId ? "添加民兵" : "编辑民兵"} title={!userId ? "添加民兵" : "编辑民兵"}
width={800} width={800}

View File

@ -1,5 +1,6 @@
import baseHttp from "@/service/base"; import baseHttp from "@/service/base";
import { Pages } from "@/util/model/interface"; import { Pages } from "@/util/model/interface";
import { message } from "antd";
import { action, makeObservable, observable, runInAction } from "mobx"; import { action, makeObservable, observable, runInAction } from "mobx";
interface BaseStoreInterface<T> { interface BaseStoreInterface<T> {
list: Array<T> list: Array<T>
@ -47,20 +48,31 @@ class BaseStore<B> implements BaseStoreInterface<B> {
this.getlist() this.getlist()
} }
// 添加 // 添加
async add(param: any,listParam?:any) { async add(param: any, listParam?: any) {
try { try {
await baseHttp.post(this.urlConfig.ADD, param) let res = await baseHttp.post(this.urlConfig.ADD, param)
if (res.code !== 200) {
message.error(res.msg)
return false
}
this.getlist(listParam) this.getlist(listParam)
return true;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
} }
// 更新 // 更新
async putItem(id: string, param: any,listParam?:any) { async putItem(id: string, param: any, listParam?: any) {
try { try {
await baseHttp.put(this.urlConfig.EDIT + "/" + id, param) let res = await baseHttp.put(this.urlConfig.EDIT + "/" + id, param)
if (res.code !== 200) {
message.error(res.msg)
return false
}
this.getlist(listParam) this.getlist(listParam)
return true;
} catch (error) { } catch (error) {
} }

View File

@ -12,6 +12,7 @@ class EmergencyConfig {
static EDIT: string = "emerg" static EDIT: string = "emerg"
static ACCESS: string = "emerg/accept" static ACCESS: string = "emerg/accept"
static fish: string = "emerg/fish" static fish: string = "emerg/fish"
static USERLIST: string = "emerg/user"
} }
class EmergencyStore extends BaseStore<TagDataType> { class EmergencyStore extends BaseStore<TagDataType> {
@ -29,6 +30,9 @@ class EmergencyStore extends BaseStore<TagDataType> {
await baseHttp.put(EmergencyConfig.fish + "/" + id, {}) await baseHttp.put(EmergencyConfig.fish + "/" + id, {})
this.getlist() this.getlist()
} }
async getUserlist(id: string) {
return await baseHttp.get(EmergencyConfig.USERLIST + "/" + id, {})
}
} }
export const emergencyStore = new EmergencyStore() export const emergencyStore = new EmergencyStore()

View File

@ -49,8 +49,8 @@ class TrainingStore extends BaseStore<TagDataType> {
return await baseHttp.post(TrainingConfig.addAchives, param) return await baseHttp.post(TrainingConfig.addAchives, param)
} }
// 添加档案到培训 // 添加档案到培训
async back(id: string) { async back(id: string,task_type:number) {
return await baseHttp.put(TrainingConfig.back + "/" + id, {task_type:2}) return await baseHttp.put(TrainingConfig.back + "/" + id, {task_type})
} }
async getUserListByTraning() { async getUserListByTraning() {
let res = await baseHttp.get(TrainingConfig.tran_user + "/" + this.id, null) let res = await baseHttp.get(TrainingConfig.tran_user + "/" + this.id, null)

View File

@ -6,7 +6,7 @@ class Config {
static ws = "ws://127.0.0.1:12214/ws?id=admin"; static ws = "ws://127.0.0.1:12214/ws?id=admin";
static baseUrl = "http://127.0.0.1:12214/"; static baseUrl = "http://127.0.0.1:12214/";
static uploadUrl = "http://127.0.0.1:12214/"; static uploadUrl = "http://127.0.0.1:12214/";
// static ws = "wss://rw.quwanya.cn/ws"; static rtc = "wss://rw.quwanya.cn/ws";
} }
export default Config; export default Config;

View File

@ -14,7 +14,7 @@ export type AutoReconnectOptions = boolean | {
class SocketService { class SocketService {
private static instance: SocketService | null = null private static instance: SocketService | null = null
private ws: WebSocket | null = null private adminws: WebSocket | null = null
private listeners: Record<string, Function[]> = {} private listeners: Record<string, Function[]> = {}
private autoReconnect: AutoReconnectOptions = true private autoReconnect: AutoReconnectOptions = true
private times: any = null private times: any = null
@ -35,20 +35,20 @@ export type AutoReconnectOptions = boolean | {
public setAutoReconnectOptions(options: AutoReconnectOptions) { public setAutoReconnectOptions(options: AutoReconnectOptions) {
this.autoReconnect = options this.autoReconnect = options
} }
public connect() { public connect() {
this.ws = new WebSocket(Config.ws) this.adminws = new WebSocket(Config.ws)
this.ws.onopen = () => { this.adminws.onopen = () => {
this.connectionStatus = ConnectionStatus.Connected this.connectionStatus = ConnectionStatus.Connected
this.emit('connected', null) this.emit('connected', null)
this.hert() this.hert()
} }
this.ws.onerror = () => { this.adminws.onerror = () => {
this.connectionStatus = ConnectionStatus.Error this.connectionStatus = ConnectionStatus.Error
clearTimeout(this.times) clearTimeout(this.times)
this.emit('error', null) this.emit('error', null)
} }
this.ws.onclose = () => { this.adminws.onclose = () => {
this.connectionStatus = ConnectionStatus.Disconnected this.connectionStatus = ConnectionStatus.Disconnected
clearTimeout(this.times) clearTimeout(this.times)
this.emit('disconnected', null) this.emit('disconnected', null)
@ -56,7 +56,7 @@ export type AutoReconnectOptions = boolean | {
setTimeout(() => this.connect(), this.getRetryInterval()) setTimeout(() => this.connect(), this.getRetryInterval())
} }
} }
this.ws.onmessage = (event) => { this.adminws.onmessage = (event) => {
this.emit('message', event.data) this.emit('message', event.data)
} }
} }
@ -92,16 +92,16 @@ export type AutoReconnectOptions = boolean | {
} }
public send(data: any) { public send(data: any) {
if (this.ws && this.ws.readyState === WebSocket.OPEN) { if (this.adminws && this.adminws.readyState === WebSocket.OPEN) {
this.ws.send(JSON.stringify(data)) this.adminws.send(JSON.stringify(data))
} else { } else {
console.error('WebSocket 连接未打开') console.error('WebSocket 连接未打开')
} }
} }
public close() { public close() {
if (this.ws) { if (this.adminws) {
this.ws.close() this.adminws.close()
SocketService.instance = null SocketService.instance = null
} }
} }

View File

@ -17,7 +17,7 @@ class WebRtc {
})) }))
} }
async init() { async init() {
this.ws = new WebSocket(Config.ws) this.ws = new WebSocket(Config.rtc)
this.ws.addEventListener('open', this.open); this.ws.addEventListener('open', this.open);
let that = this; let that = this;
this.createOffer() this.createOffer()
@ -147,8 +147,8 @@ class WebRtc {
} }
} }
)); ));
(this.mediaStream as MediaStream)?.getTracks().forEach(track => track.stop()); (this.mediaStream as MediaStream)?.getTracks().forEach(track => track.stop());
this.ws?.close()
} }
} }