From 483bc1220bcccaf257e9fd9f0645992ba5605f51 Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Tue, 25 Feb 2025 00:33:41 +0800 Subject: [PATCH] first commit --- src/components/form/simple_form.tsx | 2 + src/components/layout/layout_config.ts | 10 ++++ src/pages/home/home_video.tsx | 31 ++++++++-- src/pages/signin/column.tsx | 68 +++++++++++++++++++++ src/pages/signin/index.tsx | 82 ++++++++++++++++++++++++++ src/pages/user/user.tsx | 15 ++++- src/pages/user/user_config.tsx | 46 +++++++++++++++ src/router/routers/home_router.tsx | 5 ++ src/store/index.ts | 5 +- src/store/singin.ts | 46 +++++++++++++++ src/store/user.ts | 7 +++ 11 files changed, 310 insertions(+), 7 deletions(-) create mode 100644 src/pages/signin/column.tsx create mode 100644 src/pages/signin/index.tsx create mode 100644 src/store/singin.ts diff --git a/src/components/form/simple_form.tsx b/src/components/form/simple_form.tsx index ae5fad9..0937c5a 100644 --- a/src/components/form/simple_form.tsx +++ b/src/components/form/simple_form.tsx @@ -111,6 +111,7 @@ const SimpleForm = (props: SimpleFormData) => { case FormType.select: return FormSelect(v); case FormType.upload: + console.log(form.getFieldValue(v.name)) return ( { if (Array.isArray(e)) { return e; } + console.log(e) return e && e.fileList; }} > diff --git a/src/components/layout/layout_config.ts b/src/components/layout/layout_config.ts index 6abdbee..16fe6da 100644 --- a/src/components/layout/layout_config.ts +++ b/src/components/layout/layout_config.ts @@ -74,6 +74,16 @@ export const items = [ { label: "训练任务", key: "/admin/training" }, ], }, + { + key: "/admin/kaoqin", + label: `考勤管理`, + children: [ + { + key: "/admin/singin", + label: `签到管理`, + }, + ], + }, { key: "/admin/sys", label: `系统管理`, diff --git a/src/pages/home/home_video.tsx b/src/pages/home/home_video.tsx index de18f22..5506720 100644 --- a/src/pages/home/home_video.tsx +++ b/src/pages/home/home_video.tsx @@ -3,11 +3,14 @@ import { inject, observer } from "mobx-react"; import { useEffect, useState } from "react"; import Video from "./video"; import "./video.less"; - +import { ZoomInOutlined } from "@ant-design/icons"; const HomeVideo = (props: Store) => { const { homeStore } = props; const [videoUrls, setVideoUrl] = useState | null>([]); const [showVideo, setShowVideo] = useState(false); + const [obj, setPbj] = useState({ + width: "300px", + }); useEffect(() => { homeStore.getNewTask().then((res) => { setVideoUrl(res); @@ -15,9 +18,29 @@ const HomeVideo = (props: Store) => { setShowVideo(homeStore.showVideo); }, [homeStore, homeStore.showVideo]); return ( - <> +
+ { + if (obj.width === "300px") { + setPbj({ + width: "0px", + }); + } else { + setPbj({ + width: "300px", + }); + } + }} + /> {showVideo ? ( -
+
{videoUrls?.map((videoUrl, index) => { return (
@@ -27,7 +50,7 @@ const HomeVideo = (props: Store) => { })}
) : null} - +
); }; diff --git a/src/pages/signin/column.tsx b/src/pages/signin/column.tsx new file mode 100644 index 0000000..0a0de03 --- /dev/null +++ b/src/pages/signin/column.tsx @@ -0,0 +1,68 @@ +import { FormType } from "@/components/form/interface"; +import { UserDataType } from "@/model/userModel"; +import { ColumnsType } from "antd/lib/table"; +import dayjs from "dayjs"; +export const studyColumns: ColumnsType = [ + { + title: "姓名", + dataIndex: "user_name", + }, + { + title: "身份证", + dataIndex: "id_card", + }, + { + title: "联系电话", + dataIndex: "tel", + }, + { + title: "签到时间", + dataIndex: "created_at", + render(leave_start_time) { + return dayjs(leave_start_time).format("YYYY-MM-DD HH:mm"); + }, + }, + { + title: "签到地址", + dataIndex: "address", + }, + // { + // title: "经度", + // dataIndex: "long", + // }, + // { + // title: "纬度", + // dataIndex: "lat", + // }, +]; + +export const serchConfig = [ + { + type: FormType.input, + label: "用户名", + name: "user_name", + value: "", + rules: [], + }, + { + type: FormType.input, + label: "身份证号", + name: "id_card", + value: "", + rules: [], + }, + { + type: FormType.date, + label: "开始时间", + name: "start_time", + value: "", + rules: [], + }, + { + type: FormType.date, + label: "结束时间", + name: "end_time", + value: "", + rules: [], + }, +]; \ No newline at end of file diff --git a/src/pages/signin/index.tsx b/src/pages/signin/index.tsx new file mode 100644 index 0000000..be01793 --- /dev/null +++ b/src/pages/signin/index.tsx @@ -0,0 +1,82 @@ +import { Button, FormInstance, Space } from "antd"; +import { inject, observer } from "mobx-react"; +import BTable from "@/components/b_table"; +import { useEffect } from "react"; +import { Store } from "antd/lib/form/interface"; +import React from "react"; +import { serchConfig, studyColumns } from "./column"; +import SimpleForm from "@/components/form/simple_form"; + +const Signin = (props: Store) => { + const { signinStore } = props; + const serchFormRef = React.useRef(null); + useEffect(() => { + signinStore.getSignList(); + }, [signinStore]); + + const onSerchFinish = (values: any) => { + let query = { + ...values, + start_time: values.start_time?.format("YYYY-MM-DD HH:mm"), + end_time: values.end_time?.format("YYYY-MM-DD HH:mm"), + page: 1, + page_size: 10, + }; + signinStore.getSignList(query); + }; + const onFinishFailed = () => {}; + return ( +
+ + + {}} + formName="serch_basic" + colProps={30} + span={8} + layout="inline" + formDatas={serchConfig} + onFinish={onSerchFinish} + initialValues={true} + onFinishFailed={onFinishFailed} + > + + + + + + + + + + +
+ ); +}; + +export default inject("signinStore")(observer(Signin)); diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index 5ae7ed7..bb4629d 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -28,11 +28,13 @@ const User = (props: Store) => { ...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) + pers_link_user:record.pers.map(item=>item.pers_identity), + head_img:[{ url: record.head_img }], }; + setProjectConfig(defaultConfig(team, per)); + console.log(records) setIsModalOpen(true); setRecord(records); setId(records.id); @@ -164,6 +166,15 @@ const User = (props: Store) => { > 删除 + ), }, diff --git a/src/pages/user/user_config.tsx b/src/pages/user/user_config.tsx index 33fa529..8f4a206 100644 --- a/src/pages/user/user_config.tsx +++ b/src/pages/user/user_config.tsx @@ -46,6 +46,40 @@ export const defaultConfig =(team,per)=> value: 0, rules: [{ required: true, message: "请选择是否网格员" }], }, + { + type: FormType.radio, + label: "是否微网格员", + name: "grid_letter_user", + radioData: [ + { + key: "是", + val: 1, + }, + { + key: "否", + val: 2, + }, + ], + value: 0, + rules: [], + }, + { + type: FormType.radio, + label: "是否两委人员", + name: "two_committees", + radioData: [ + { + key: "是", + val: 1, + }, + { + key: "否", + val: 2, + }, + ], + value: 0, + rules: [], + }, { type: FormType.radio, label: "是否为巡防大队", @@ -309,6 +343,18 @@ export const columns: ColumnsType = [ dataIndex: "vet", render: (vet) => {vet === 1 ? "是" : "否"}, }, + { + title: "是否两委人员", + dataIndex: "two_committees", + width: 150, + render: (vet) => {vet === 1 ? "是" : "否"}, + }, + { + title: "是否微网格员", + dataIndex: "grid_letter_user", + width: 150, + render: (vet) => {vet === 1 ? "是" : "否"}, + }, { title: "备注", width: 150, diff --git a/src/router/routers/home_router.tsx b/src/router/routers/home_router.tsx index abf7bab..ec074d4 100644 --- a/src/router/routers/home_router.tsx +++ b/src/router/routers/home_router.tsx @@ -27,6 +27,7 @@ import Grid from "@/pages/grid"; import Community from "@/pages/community"; import PatrolBrigade from "@/pages/patrolBrigade"; import ExceCompet from "@/pages/exce_compet"; +import Signin from "@/pages/signin"; export const homeRouter = [ { path: "/", @@ -166,6 +167,10 @@ export const homeRouter = [ }, ], }, + { + path: "/admin/singin", + element: , + }, { path: "/admin/sys", element: , diff --git a/src/store/index.ts b/src/store/index.ts index 23ae437..d3d029f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -26,6 +26,8 @@ import { communityStore } from './community'; import { gridStore } from './grid'; import { patrolBrigadeStore } from './patrol_brigade'; import { exceCompetStore } from './exce_compet'; +import signinStore from './singin'; + @@ -57,7 +59,8 @@ const store = { gridStore, communityStore, patrolBrigadeStore, - exceCompetStore + exceCompetStore, + signinStore }; export default store; \ No newline at end of file diff --git a/src/store/singin.ts b/src/store/singin.ts new file mode 100644 index 0000000..c1eb2b4 --- /dev/null +++ b/src/store/singin.ts @@ -0,0 +1,46 @@ +import { action, makeObservable, observable } from "mobx"; +// 用户信息 +import BaseStore from "./baseStore"; +import { TagDataType } from "@/model/userModel"; +import baseHttp from '@/service/base'; + +class SigninConfig { + static LISTs: string = "/v1/user/signin" + static Export: string = "/v1/user/signin/export" + +} +class SigninStore extends BaseStore { + signList = [] + constructor() { + super(SigninConfig) + makeObservable(this, { + signList: observable, + getSignList: action, + }) + } + async getSignList(query) { + let list =await baseHttp.get(SigninConfig.LISTs, { + size: query?.Size ?? 20, + offset: query?.Offset ?? 1, + user_name: query?.user_name, + id_card: query?.id_card ?? '', + start_time: query?.start_time , + end_time: query?.end_time , + }) + this.signList = list?.data.record; + } + + async exports(query) { + await baseHttp.get(SigninConfig.Export, { + size: query?.Size ?? 20, + offset: query?.Offset ?? 1, + user_name: query?.user_name, + id_card: query?.id_card ?? '', + start_time: query?.start_time , + end_time: query?.end_time , + }) + } +} + +export const signinStore = new SigninStore(); +export default signinStore; diff --git a/src/store/user.ts b/src/store/user.ts index bf08831..a8894cf 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -18,6 +18,8 @@ class UserConfig { static getPatrol: string = "/v1/user/getPatrol" static videoLogin: string = "/api/v1/login" static siteList: string = "/v1/user/site" + static reSetPwd: string = "/v1/user/reSetPwd" + @@ -68,6 +70,11 @@ class UserStore extends BaseStore { return await baseHttp.put(UserConfig.siteList + "/" + id.id, id) } + async reSetPwd(id) { + await baseHttp.put(UserConfig.reSetPwd+"/"+id,{}) + message.success("密码重置成功") + } + get userInfo(): UserInfos {