fix(check)

This commit is contained in:
wang_yp 2025-04-14 23:00:01 +08:00
parent 94d3ae2e6a
commit 4920710aa8
6 changed files with 73 additions and 17 deletions

View File

@ -10,19 +10,27 @@ export const columns: ColumnsType<UserDataType> = [
{ {
title: "通知描述", title: "通知描述",
dataIndex: "notic_desc", dataIndex: "notic_desc",
},{ },
{
title: "通知开始时间", title: "通知开始时间",
dataIndex: "start_time", dataIndex: "start_time",
render: (start_time) => <>{ <span>{dayjs(start_time).format("YYYY-MM-DD")}</span>}</>, render: (start_time) => (
},{ <>{<span>{dayjs(start_time).format("YYYY-MM-DD")}</span>}</>
),
},
{
title: "通知有效结束时间", title: "通知有效结束时间",
dataIndex: "end_time", dataIndex: "end_time",
render: (end_time) => <>{ <span>{dayjs(end_time).format("YYYY-MM-DD")}</span>}</>, render: (end_time) => (
<>{<span>{dayjs(end_time).format("YYYY-MM-DD")}</span>}</>
),
}, },
{ {
title: "发布时间", title: "发布时间",
dataIndex: "created_date", dataIndex: "created_date",
render: (created_date) => <>{ <span>{dayjs(created_date).format("YYYY-MM-DD")}</span>}</>, render: (created_date) => (
<>{<span>{dayjs(created_date).format("YYYY-MM-DD")}</span>}</>
),
}, },
]; ];
@ -30,16 +38,24 @@ export const userColumns: ColumnsType<UserDataType> = [
{ {
title: "姓名", title: "姓名",
dataIndex: "users", dataIndex: "users",
render: (users) => <>{ <span>{users.user_name}</span>}</>, render: (users) => <>{<span>{users.user_name}</span>}</>,
}, },
{ {
title: "是否查看", title: "是否查看",
dataIndex: "status", dataIndex: "status",
render: (status) => <>{ <span>{status === 1 ? "已查看" : "未查看"}</span>}</>, render: (status) => (
<>{<span>{status === 1 ? "已查看" : "未查看"}</span>}</>
),
}, },
{ {
title: "查看时间", title: "查看时间",
render: (record) => <>{ record.stauts===1 ? <>{ <span>{dayjs(record.updated_date).format("YYYY-MM-DD")}</span>}</> : ""}</>, render: (record) => {
if (record.status===1){
return <span>{dayjs(record.created_at).format("YYYY-MM-DD")}</span>
}else{
return <span></span>
}
},
}, },
]; ];

View File

@ -6,6 +6,7 @@ export const studyColumns: ColumnsType<UserDataType> = [
{ {
title: "姓名", title: "姓名",
dataIndex: "user_name", dataIndex: "user_name",
width:100,
}, },
{ {
title: "身份证", title: "身份证",

View File

@ -6,6 +6,8 @@ import { Store } from "antd/lib/form/interface";
import React from "react"; import React from "react";
import { serchConfig, studyColumns } from "./column"; import { serchConfig, studyColumns } from "./column";
import SimpleForm from "@/components/form/simple_form"; import SimpleForm from "@/components/form/simple_form";
import { getTimes } from "@/util/util";
import dayjs from "dayjs";
const { Option } = Select; const { Option } = Select;
const Signin = (props: Store) => { const Signin = (props: Store) => {
@ -14,7 +16,14 @@ const Signin = (props: Store) => {
const [tagList, setTagList] = useState<any>([]); const [tagList, setTagList] = useState<any>([]);
useEffect(() => { 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([ setTagList([
{ {
id: 0, id: 0,
@ -24,10 +33,6 @@ const Signin = (props: Store) => {
id: 1, id: 1,
name: "网格员", name: "网格员",
}, },
{
id: 2,
name: "微网格员",
},
{ {
id: 3, id: 3,
name: "基干民兵", name: "基干民兵",
@ -51,6 +56,10 @@ const Signin = (props: Store) => {
page: 1, page: 1,
page_size: 20, 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.querys = query;
signinStore.getlist(signinStore.querys); signinStore.getlist(signinStore.querys);
}; };
@ -113,7 +122,19 @@ const Signin = (props: Store) => {
</Space> </Space>
</SimpleForm> </SimpleForm>
</Space> </Space>
<BTable store={signinStore} columns={studyColumns} dataSource={signinStore.list}/> <Space>
<p> : {signinStore.record?.total?.grid ?? 0}</p>
<p> : {signinStore.record?.total?.militia ?? 0}</p>
<p> : {signinStore.record?.total?.militias ?? 0}</p>
<p>
: {signinStore.record?.total?.patrol_user ?? 0}
</p>
</Space>
<BTable
store={signinStore}
columns={studyColumns}
dataSource={signinStore.list}
/>
</Space> </Space>
</div> </div>
); );

View File

@ -18,6 +18,7 @@ interface BaseStoreInterface<T> {
class BaseStore<B> implements BaseStoreInterface<B> { class BaseStore<B> implements BaseStoreInterface<B> {
querys?: {} querys?: {}
record?: {}
urlConfig: { DELETE: string; ADD: string; EDIT: string; LIST: string; } urlConfig: { DELETE: string; ADD: string; EDIT: string; LIST: string; }
constructor(urlConfig) { constructor(urlConfig) {
makeObservable(this, { makeObservable(this, {
@ -105,6 +106,7 @@ class BaseStore<B> implements BaseStoreInterface<B> {
runInAction(() => { runInAction(() => {
this.list = data; this.list = data;
this.total = res.data.count this.total = res.data.count
this.record = res.data
}) })
this.listStatus = false; this.listStatus = false;
} catch (error) { } catch (error) {

View File

@ -11,11 +11,13 @@ class SigninConfig {
} }
class SigninStore extends BaseStore<TagDataType> { class SigninStore extends BaseStore<TagDataType> {
signList = [] signList = []
totalSigin = {}
constructor() { constructor() {
super(SigninConfig) super(SigninConfig)
makeObservable(this, { makeObservable(this, {
signList: observable, signList: observable,
getSignList: action, getSignList: action,
totalSigin: observable,
}) })
} }
async getSignList(query) { async getSignList(query) {
@ -28,6 +30,8 @@ class SigninStore extends BaseStore<TagDataType> {
end_time: query?.end_time, end_time: query?.end_time,
}) })
this.signList = list?.data.record; this.signList = list?.data.record;
this.totalSigin = list.data.total
console.log(this.totalSigin);
} }
async exports(query) { async exports(query) {

View File

@ -9,11 +9,23 @@ function getBirthDateAndGender(idNumber) {
} }
function getAgeByIDCard(idCard) { function getAgeByIDCard(idCard) {
if(!idCard)return 0 if (!idCard) return 0
const birthYear = idCard.substring(6, 10); const birthYear = idCard.substring(6, 10);
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const age = currentYear - parseInt(birthYear); const age = currentYear - parseInt(birthYear);
return age; return age;
} }
export { getAgeByIDCard, getBirthDateAndGender } 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 }