From e96a1efe476be0b29937cc7f990af6f5048151b3 Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Fri, 1 Nov 2024 02:51:58 +0800 Subject: [PATCH] fix(amap):core --- src/App.tsx | 7 ++-- src/pages/home/homeBottom/ec.tsx | 2 +- src/pages/patrol/index.tsx | 69 ++++++++++++++++++++++++-------- src/pages/user/user_config.tsx | 5 ++- src/util/config.ts | 10 ++--- 5 files changed, 64 insertions(+), 29 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 344a22d..3058d97 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,8 +1,7 @@ import { Outlet } from "react-router"; import MapUtl from "./components/map/mapUtil"; -import { useEffect } from "react"; -// import SocketService from "./util/socket"; -// const socketService = SocketService.getInstance(); +import SocketService from "./util/socket"; +const socketService = SocketService.getInstance(); const onMessage = (e: any) => { let data = JSON.parse(e); if (data.type === "accpt") { @@ -25,7 +24,7 @@ const onMessage = (e: any) => { } }; -// socketService.on("message", onMessage); +socketService.on("message", onMessage); const App = () => { return ( <> diff --git a/src/pages/home/homeBottom/ec.tsx b/src/pages/home/homeBottom/ec.tsx index 6d0e807..c614722 100644 --- a/src/pages/home/homeBottom/ec.tsx +++ b/src/pages/home/homeBottom/ec.tsx @@ -48,7 +48,7 @@ const Ec = (props: Store) => { {userList.map((item: any) => { return (
-
姓名:{item.account} : 未在线
+
姓名:{item.user_name} : 未在线

点击呼叫: diff --git a/src/pages/patrol/index.tsx b/src/pages/patrol/index.tsx index 7ef88e8..3297cf4 100644 --- a/src/pages/patrol/index.tsx +++ b/src/pages/patrol/index.tsx @@ -1,4 +1,4 @@ -import { Button, Space, Modal, FormInstance } from "antd"; +import { Button, Space, Modal, FormInstance, Form } from "antd"; import { inject, observer } from "mobx-react"; import type { ColumnsType } from "antd/es/table"; import BTable from "@/components/b_table"; @@ -10,15 +10,21 @@ import React from "react"; import { FormType } from "@/components/form/interface"; import baseHttp from "@/service/base"; import dayjs from "dayjs"; - +import DebounceSelect from "@/components/form/featch_select"; +interface UserValue { + label: string; + value: string; +} const Patrol = (props: Store) => { - const { patrolStore } = props; + const { patrolStore, usrStore } = props; const [isModalOpen, setIsModalOpen] = 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 [value, setValue] = useState([]); + const columns: ColumnsType = [ { title: "任务标题", dataIndex: "title" }, { title: "任务描述", dataIndex: "patrol_desc" }, @@ -54,7 +60,10 @@ const Patrol = (props: Store) => { type="dashed" size="small" onClick={() => { - patrolStore.deleteItem(record.id); + patrolStore.putItem(record.id, { + ...record, + status: 1, + }); }} > 完成 @@ -64,7 +73,7 @@ const Patrol = (props: Store) => { danger size="small" onClick={() => { - patrolStore.deleteItem(record.id); + patrolStore.deleteItem(record.identity); }} > 删除 @@ -89,6 +98,7 @@ const Patrol = (props: Store) => { let data = { ...values, score: Number(values.score ?? 0), + user_identity: values.user_identity.map((item) => item.value), }; if (!tagId) { patrolStore.add(data); @@ -102,7 +112,7 @@ const Patrol = (props: Store) => { baseHttp.get("/user/list", null).then((res) => { let data = res.data?.record ?? []; data.forEach((item) => { - item.label = item.account; + item.label = item.user_name; item.value = item.identity; }); setUserList(data ?? []); @@ -121,7 +131,6 @@ const Patrol = (props: Store) => { label: "任务描述", name: "patrol_desc", value: "", - rules: [{ required: true, message: "请输入任务描述!" }], }, { type: FormType.input, @@ -151,16 +160,24 @@ const Patrol = (props: Store) => { value: "", rules: [{ required: true, message: "请输入任务积分!" }], }, - { - type: FormType.cehckboxGroup, - label: "任务参与人", - name: "user_identity", - value: [], - checkboxData: userList, - rules: [{ required: true, message: "请选择参与人!" }], - }, + // { + // type: FormType.cehckboxGroup, + // label: "任务参与人", + // name: "user_identity", + // value: [], + // checkboxData: userList, + // rules: [{ required: true, message: "请选择参与人!" }], + // }, ]; const onFinishFailed = () => {}; + async function fetchUserList(username: string): Promise { + return usrStore.serchUser(username).then((res) => { + return res.data.record.map((item) => ({ + label: item.user_name, + value: item.identity, + })); + }); + } // 用户选择回调 return (
@@ -208,11 +225,29 @@ const Patrol = (props: Store) => { onFinish={onFinish} initialValues={true} onFinishFailed={onFinishFailed} - /> + childrenPosi={true} + > + <> + + + + +
); }; -export default inject("patrolStore")(observer(Patrol)); +export default inject("patrolStore", "usrStore")(observer(Patrol)); diff --git a/src/pages/user/user_config.tsx b/src/pages/user/user_config.tsx index 70b719c..eb1d0b4 100644 --- a/src/pages/user/user_config.tsx +++ b/src/pages/user/user_config.tsx @@ -2,6 +2,7 @@ import { FormType } from "@/components/form/interface"; import { UserDataType } from "@/model/userModel"; import { ColumnsType } from "antd/lib/table"; import { Image } from "antd"; +import Config from "@/util/config"; export const defaultConfig =(team,per)=> [ { @@ -315,7 +316,9 @@ export const columns: ColumnsType = [ title: "头像", dataIndex: "head_img", width: 150, - render: (headImg) => , + render: (headImg) =>{ + return + }, }, { diff --git a/src/util/config.ts b/src/util/config.ts index 0cbcda6..acca640 100644 --- a/src/util/config.ts +++ b/src/util/config.ts @@ -1,12 +1,10 @@ class Config { - // static baseUrl = "https://rw.quwanya.cn/"; + static baseUrl = "https://rw.quwanya.cn/"; static uploadUrl = "https://rw.quwanya.cn/"; - // static ws = "wss://rw.quwanya.cn/wsadmin?id=admin"; + static ws = "wss://rw.quwanya.cn/wsadmin?id=admin"; static rtc = "wss://rw.quwanya.cn/ws"; - static ws = "ws://127.0.0.1:12214/ws?id=admin"; - static baseUrl = "http://127.0.0.1:12214/"; - // static uploadUrl = "http://127.0.0.1:12214/"; - + static userStatic = "https://rw.quwanya.cn/uploads/user/"; + // https://rw.quwanya.cn/uploads/user/%E5%B4%94%E6%96%87%E8%8C%9C.jpg } export default Config;