diff --git a/src/pages/emergency/emUser.tsx b/src/pages/emergency/emUser.tsx index 0292cff..2792433 100644 --- a/src/pages/emergency/emUser.tsx +++ b/src/pages/emergency/emUser.tsx @@ -4,11 +4,11 @@ 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 { +interface EmUserInterface { emergencyStore?: Store; id?: string; } -const EmUser = (props: EmUser) => { +const EmUser = (props: EmUserInterface) => { const { emergencyStore, id } = props; const [ulist, setUlist] = useState(0); @@ -22,9 +22,14 @@ const EmUser = (props: EmUser) => { { title: "民兵名称", dataIndex: "user_name" }, { title: "民兵描述", dataIndex: "remark" }, { title: "民兵账号", dataIndex: "account" }, - { title: "是否接收任务", dataIndex: "is_accept",render(value, record, index) { - return value ? "是" : "否"; - }, }, + { + title: "是否接收任务", + dataIndex: "acce_status", + render(value, record, index) { + return value ? "是" : "否"; + } + }, + { title: "拒绝原因", dataIndex: "reject" }, ]; return ( <> diff --git a/src/pages/emergency/index.tsx b/src/pages/emergency/index.tsx index e21abf8..351ed58 100644 --- a/src/pages/emergency/index.tsx +++ b/src/pages/emergency/index.tsx @@ -42,9 +42,9 @@ const Emergency = (props: Store) => { { title: "任务描述", dataIndex: "desc" }, { title: "完成状态", - dataIndex: "status", + dataIndex: "accomplish", render: (status) => - status === 0 ? ( + status === 1 ? ( 进行中 ) : ( 已完成 diff --git a/src/store/home.ts b/src/store/home.ts index ab68411..a09b220 100644 --- a/src/store/home.ts +++ b/src/store/home.ts @@ -3,6 +3,7 @@ import { action, makeObservable, observable } from "mobx"; import baseHttp from "@/service/base"; import BaseStore from "./baseStore"; import { TagDataType } from "@/model/userModel"; +import MapUtl from "@/components/map/mapUtil"; class HomeConfig { static os: string = "public/os" @@ -12,6 +13,7 @@ class HomeConfig { static rm: string = "public/rm" static ae: string = "public/ae" static newTask: string = "user/newTask" + static taskulist: string = "public/taskInUser" } class HomeStore extends BaseStore { constructor() { @@ -21,7 +23,9 @@ class HomeStore extends BaseStore { ogMap: observable, alist: observable, showVideo: observable, + ulist: observable, showVideoHandler: action, + getTaskUserList: action, }) } @@ -48,15 +52,30 @@ class HomeStore extends BaseStore { async getNewTask() { let res = await baseHttp.get(HomeConfig.newTask, {}); if (res.data?.record) { + this.getTaskUserList() this.showVideoHandler(true) } } + async getTaskUserList() { + let res = await baseHttp.get(HomeConfig.taskulist, {}); + if (res.data?.record?.ulist && res.data?.record.ulist.length > 0) { + res.data?.record?.ulist.forEach(element => { + MapUtl.addMaker({ + lng: element.long, + lat: element.lat, + title: element.user_name, + users: element + }) + }); + } + } showVideoHandler(status) { this.showVideo = status } ogMap!: Object; showVideo!: boolean; alist!: Array; + ulist!: Array; } const homeStore = new HomeStore() export default homeStore; diff --git a/src/util/socket.ts b/src/util/socket.ts index 2f08559..146ca18 100644 --- a/src/util/socket.ts +++ b/src/util/socket.ts @@ -61,7 +61,7 @@ export type AutoReconnectOptions = boolean | { } } public hert(){ - this.times = setTimeout(() => this.send({"type":"heartbeat"}), 3000) + this.times = setInterval(() => this.send({"type":"heartbeat"}), 3000) } private shouldReconnect(): boolean { if (typeof this.autoReconnect === 'boolean') {