diff --git a/src/pages/notic/notic_config.tsx b/src/pages/notic/notic_config.tsx index 9ee1675..10547fd 100644 --- a/src/pages/notic/notic_config.tsx +++ b/src/pages/notic/notic_config.tsx @@ -10,19 +10,27 @@ export const columns: ColumnsType = [ { title: "通知描述", dataIndex: "notic_desc", - },{ + }, + { title: "通知开始时间", dataIndex: "start_time", - render: (start_time) => <>{ {dayjs(start_time).format("YYYY-MM-DD")}}, - },{ + render: (start_time) => ( + <>{{dayjs(start_time).format("YYYY-MM-DD")}} + ), + }, + { title: "通知有效结束时间", dataIndex: "end_time", - render: (end_time) => <>{ {dayjs(end_time).format("YYYY-MM-DD")}}, + render: (end_time) => ( + <>{{dayjs(end_time).format("YYYY-MM-DD")}} + ), }, { title: "发布时间", dataIndex: "created_date", - render: (created_date) => <>{ {dayjs(created_date).format("YYYY-MM-DD")}}, + render: (created_date) => ( + <>{{dayjs(created_date).format("YYYY-MM-DD")}} + ), }, ]; @@ -30,16 +38,24 @@ export const userColumns: ColumnsType = [ { title: "姓名", dataIndex: "users", - render: (users) => <>{ {users.user_name}}, + render: (users) => <>{{users.user_name}}, }, { title: "是否查看", dataIndex: "status", - render: (status) => <>{ {status === 1 ? "已查看" : "未查看"}}, + render: (status) => ( + <>{{status === 1 ? "已查看" : "未查看"}} + ), }, { title: "查看时间", - render: (record) => <>{ record.stauts===1 ? <>{ {dayjs(record.updated_date).format("YYYY-MM-DD")}} : ""}, + render: (record) => { + if (record.status===1){ + return {dayjs(record.created_at).format("YYYY-MM-DD")} + }else{ + return + } + }, }, ]; diff --git a/src/pages/signin/column.tsx b/src/pages/signin/column.tsx index add6622..57d4745 100644 --- a/src/pages/signin/column.tsx +++ b/src/pages/signin/column.tsx @@ -6,6 +6,7 @@ export const studyColumns: ColumnsType = [ { title: "姓名", dataIndex: "user_name", + width:100, }, { title: "身份证", diff --git a/src/pages/signin/index.tsx b/src/pages/signin/index.tsx index 34e380d..55f43b8 100644 --- a/src/pages/signin/index.tsx +++ b/src/pages/signin/index.tsx @@ -6,6 +6,8 @@ import { Store } from "antd/lib/form/interface"; import React from "react"; import { serchConfig, studyColumns } from "./column"; import SimpleForm from "@/components/form/simple_form"; +import { getTimes } from "@/util/util"; +import dayjs from "dayjs"; const { Option } = Select; const Signin = (props: Store) => { @@ -14,7 +16,14 @@ const Signin = (props: Store) => { const [tagList, setTagList] = useState([]); useEffect(() => { - signinStore.getlist(); + let query = { + start_time: dayjs(getTimes() + " 00:00").format("YYYY-MM-DD HH:mm"), + end_time: dayjs(getTimes() + " 23:59").format("YYYY-MM-DD HH:mm"), + page: 1, + page_size: 20, + }; + signinStore.querys = query; + signinStore.getlist(query); setTagList([ { id: 0, @@ -24,10 +33,6 @@ const Signin = (props: Store) => { id: 1, name: "网格员", }, - { - id: 2, - name: "微网格员", - }, { id: 3, name: "基干民兵", @@ -44,13 +49,17 @@ const Signin = (props: Store) => { }, [signinStore]); const onSerchFinish = (values: any) => { - let query = { + 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: 20, }; + if(!query.start_time || !query.end_time){ + query.start_time = dayjs(getTimes() + " 00:00").format("YYYY-MM-DD HH:mm"); + query.end_time = dayjs(getTimes() + " 23:59").format("YYYY-MM-DD HH:mm"); + } signinStore.querys = query; signinStore.getlist(signinStore.querys); }; @@ -113,7 +122,19 @@ const Signin = (props: Store) => { - + +

网格员签到人数 : {signinStore.record?.total?.grid ?? 0}

+

基干民兵签到人数 : {signinStore.record?.total?.militia ?? 0}

+

普通民兵签到人数 : {signinStore.record?.total?.militias ?? 0}

+

+ 巡防大队签到人数 : {signinStore.record?.total?.patrol_user ?? 0} +

+
+ ); diff --git a/src/store/baseStore.ts b/src/store/baseStore.ts index 37fbb6e..f57f858 100644 --- a/src/store/baseStore.ts +++ b/src/store/baseStore.ts @@ -18,6 +18,7 @@ interface BaseStoreInterface { class BaseStore implements BaseStoreInterface { querys?: {} + record?: {} urlConfig: { DELETE: string; ADD: string; EDIT: string; LIST: string; } constructor(urlConfig) { makeObservable(this, { @@ -105,6 +106,7 @@ class BaseStore implements BaseStoreInterface { runInAction(() => { this.list = data; this.total = res.data.count + this.record = res.data }) this.listStatus = false; } catch (error) { diff --git a/src/store/singin.ts b/src/store/singin.ts index 03cb915..29d38d1 100644 --- a/src/store/singin.ts +++ b/src/store/singin.ts @@ -11,11 +11,13 @@ class SigninConfig { } class SigninStore extends BaseStore { signList = [] + totalSigin = {} constructor() { super(SigninConfig) makeObservable(this, { signList: observable, getSignList: action, + totalSigin: observable, }) } async getSignList(query) { @@ -28,6 +30,8 @@ class SigninStore extends BaseStore { end_time: query?.end_time, }) this.signList = list?.data.record; + this.totalSigin = list.data.total + console.log(this.totalSigin); } async exports(query) { diff --git a/src/util/util.ts b/src/util/util.ts index f29a278..c636d32 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -9,11 +9,23 @@ function getBirthDateAndGender(idNumber) { } function getAgeByIDCard(idCard) { - if(!idCard)return 0 + if (!idCard) return 0 const birthYear = idCard.substring(6, 10); const currentYear = new Date().getFullYear(); const age = currentYear - parseInt(birthYear); return age; } -export { getAgeByIDCard, getBirthDateAndGender } \ No newline at end of file +function getTimes() { + var date = new Date(); + var year = date.getFullYear(); // 年份 + var month: any = date.getMonth() + 1; // 月份,返回值为0-11,所以需要加1 + var day: any = date.getDate(); // 日期 + // 对月份和日期进行补零 + month = month < 10 ? '0' + month : month.toString(); + day = day < 10 ? '0' + day : day.toString(); + var currentDate = year + "-" + month + "-" + day; + console.log(currentDate) + return currentDate; +} +export { getAgeByIDCard, getBirthDateAndGender, getTimes } \ No newline at end of file