Commit 0db038b2d771030d9e744b99b7e5028b18c6c96d

Authored by Shinner
1 parent 78f597bb

请假设置增加单位;考勤组设置增加配置项

src/pages/attendance/Attend/subpages/AttendanceGroup/api.ts
1 -import { http,PromisePageResp } from "@/typing/http"; 1 +import { http, PromisePageResp } from "@/typing/http";
2 import request from "@/utils/request"; 2 import request from "@/utils/request";
3 import { ATTENDANCE_HOST } from "@/utils/host"; 3 import { ATTENDANCE_HOST } from "@/utils/host";
4 4
@@ -70,10 +70,15 @@ export function saveApi(params?: Item): P<void> { @@ -70,10 +70,15 @@ export function saveApi(params?: Item): P<void> {
70 } 70 }
71 71
72 interface BaseSettingItem { 72 interface BaseSettingItem {
73 - id?: number;  
74 - noticeTime?: number; //待办提前通知时间(分钟)  
75 - defectTime?: number; //严重迟到时间判定(分钟)  
76 - lackTime?: number; //缺卡判定时间 73 + id?: number; // 主键
  74 + groupId?: number; // 集团id
  75 + defectTime?: number; // 严重迟到时间判定(分钟)
  76 + onDutyNoticeTime?: number; // 上班待办提前通知时间(分钟)
  77 + offDutyNoticeTime?: number; // 下班待办延后通知时间(分钟)
  78 + onDutyLackTime?: number; // 上班缺卡时间判定(分钟)
  79 + offDutyLackTime?: number; // 下班缺卡时间判定(分钟)
  80 + outsideRemainingHour?: number; // 外勤结束时间离门店下班时间≤?小时不用打考勤卡
  81 + travelRemainingHour?: number; // 出差结束时间离门店下班时间≤?小时不用打考勤卡
77 } 82 }
78 /**获取考勤组基础设置 83 /**获取考勤组基础设置
79 * /attendance/base/setting/get 84 * /attendance/base/setting/get
src/pages/attendance/Attend/subpages/AttendanceGroup/components/TimeConfig.tsx
1 -import { Button, Form, InputNumber, message, Popconfirm, Radio, Row, Select } from "antd"; 1 +import { Button, Form, InputNumber, message, Popconfirm, Row } from "antd";
2 import React, { useEffect, useState } from "react"; 2 import React, { useEffect, useState } from "react";
3 import useInitial from "@/hooks/useInitail"; 3 import useInitial from "@/hooks/useInitail";
4 -import { fetchBaseSettingApi, saveOrUpdateApi } from "@/pages/attendance/Attend/subpages/AttendanceGroup/api"; 4 +import {
  5 + fetchBaseSettingApi,
  6 + saveOrUpdateApi,
  7 +} from "@/pages/attendance/Attend/subpages/AttendanceGroup/api";
5 8
6 const FormItem = Form.Item; 9 const FormItem = Form.Item;
7 10
@@ -49,7 +52,12 @@ export default function TimeConfig() { @@ -49,7 +52,12 @@ export default function TimeConfig() {
49 52
50 return ( 53 return (
51 <div> 54 <div>
52 - <Form form={form} onFinish={submit} labelCol={{ span: 6 }} wrapperCol={{ span: 15 }}> 55 + <Form
  56 + form={form}
  57 + onFinish={submit}
  58 + labelCol={{ span: 6 }}
  59 + wrapperCol={{ span: 15 }}
  60 + >
53 <div 61 <div
54 style={{ 62 style={{
55 display: "flex", 63 display: "flex",
@@ -77,7 +85,8 @@ export default function TimeConfig() { @@ -77,7 +85,8 @@ export default function TimeConfig() {
77 /> 85 />
78 </FormItem> 86 </FormItem>
79 <span style={{ marginLeft: 5 }}> 87 <span style={{ marginLeft: 5 }}>
80 - 到应打卡时间 <span style={{ color: "#999999" }}>(除最后一次应打卡)</span> 88 + 到应打卡时间{" "}
  89 + <span style={{ color: "#999999" }}>(除最后一次应打卡)</span>
81 </span> 90 </span>
82 </div> 91 </div>
83 </div> 92 </div>
@@ -93,7 +102,10 @@ export default function TimeConfig() { @@ -93,7 +102,10 @@ export default function TimeConfig() {
93 > 102 >
94 <span style={{ color: "#ff4d4f" }}>*</span> 最后一次应打卡时间要求: 103 <span style={{ color: "#ff4d4f" }}>*</span> 最后一次应打卡时间要求:
95 <div> 104 <div>
96 - <span style={{ marginRight: 5, marginLeft: 5 }}> 应打卡时间延后</span> 105 + <span style={{ marginRight: 5, marginLeft: 5 }}>
  106 + {" "}
  107 + 应打卡时间延后
  108 + </span>
97 <FormItem 109 <FormItem
98 name="offDutyNoticeTime" 110 name="offDutyNoticeTime"
99 label="打卡时间要求" 111 label="打卡时间要求"
@@ -108,7 +120,9 @@ export default function TimeConfig() { @@ -108,7 +120,9 @@ export default function TimeConfig() {
108 disabled={!edit} 120 disabled={!edit}
109 /> 121 />
110 </FormItem> 122 </FormItem>
111 - <span style={{ color: "#999999", marginLeft: 5 }}>(当天仅一次打卡不计此情况)</span> 123 + <span style={{ color: "#999999", marginLeft: 5 }}>
  124 + (当天仅一次打卡不计此情况)
  125 + </span>
112 </div> 126 </div>
113 </div> 127 </div>
114 128
@@ -123,9 +137,17 @@ export default function TimeConfig() { @@ -123,9 +137,17 @@ export default function TimeConfig() {
123 > 137 >
124 <span style={{ color: "#ff4d4f" }}>*</span> 严重迟到判定: 138 <span style={{ color: "#ff4d4f" }}>*</span> 严重迟到判定:
125 <div> 139 <div>
126 - <span style={{ marginLeft: 5, marginRight: 5 }}>在应打卡时间延后</span> 140 + <span style={{ marginLeft: 5, marginRight: 5 }}>
  141 + 在应打卡时间延后
  142 + </span>
127 143
128 - <FormItem name="defectTime" noStyle rules={[{ required: true, message: "请填写严重迟到时间判定(分钟)" }]}> 144 + <FormItem
  145 + name="defectTime"
  146 + noStyle
  147 + rules={[
  148 + { required: true, message: "请填写严重迟到时间判定(分钟)" },
  149 + ]}
  150 + >
129 <InputNumber 151 <InputNumber
130 min={0} 152 min={0}
131 style={{ width: 200 }} 153 style={{ width: 200 }}
@@ -147,7 +169,10 @@ export default function TimeConfig() { @@ -147,7 +169,10 @@ export default function TimeConfig() {
147 > 169 >
148 <span style={{ color: "#ff4d4f" }}>*</span> 上班缺卡时间判定: 170 <span style={{ color: "#ff4d4f" }}>*</span> 上班缺卡时间判定:
149 <div> 171 <div>
150 - <span style={{ marginRight: 5, marginLeft: 5 }}> 应打卡时间延后</span> 172 + <span style={{ marginRight: 5, marginLeft: 5 }}>
  173 + {" "}
  174 + 应打卡时间延后
  175 + </span>
151 <FormItem 176 <FormItem
152 name="onDutyLackTime" 177 name="onDutyLackTime"
153 label="打卡时间要求" 178 label="打卡时间要求"
@@ -175,8 +200,14 @@ export default function TimeConfig() { @@ -175,8 +200,14 @@ export default function TimeConfig() {
175 > 200 >
176 <span style={{ color: "#ff4d4f" }}>*</span> 下班缺卡时间判定: 201 <span style={{ color: "#ff4d4f" }}>*</span> 下班缺卡时间判定:
177 <div> 202 <div>
178 - <span style={{ marginRight: 5, marginLeft: 5 }}>在应打卡时间延后</span>  
179 - <FormItem name="offDutyLackTime" noStyle rules={[{ required: true, message: "请填写缺卡时间判定(分钟)" }]}> 203 + <span style={{ marginRight: 5, marginLeft: 5 }}>
  204 + 在应打卡时间延后
  205 + </span>
  206 + <FormItem
  207 + name="offDutyLackTime"
  208 + noStyle
  209 + rules={[{ required: true, message: "请填写缺卡时间判定(分钟)" }]}
  210 + >
180 <InputNumber 211 <InputNumber
181 min={0} 212 min={0}
182 style={{ width: 200 }} 213 style={{ width: 200 }}
@@ -188,6 +219,66 @@ export default function TimeConfig() { @@ -188,6 +219,66 @@ export default function TimeConfig() {
188 <span style={{ marginLeft: 5 }}>后不允许打卡</span> 219 <span style={{ marginLeft: 5 }}>后不允许打卡</span>
189 </div> 220 </div>
190 </div> 221 </div>
  222 + <div
  223 + style={{
  224 + display: "flex",
  225 + justifyContent: "flex-start",
  226 + alignItems: "center",
  227 + marginTop: 20,
  228 + paddingLeft: "20%",
  229 + }}
  230 + >
  231 + <span style={{ color: "#ff4d4f" }}>*</span> 外勤结束时间:
  232 + <div>
  233 + <span style={{ marginLeft: 5, marginRight: 5 }}>
  234 + 离门店下班时间提前
  235 + </span>
  236 + <FormItem
  237 + name="outsideRemainingHour"
  238 + noStyle
  239 + rules={[{ required: true, message: "请填写打卡时间要求" }]}
  240 + >
  241 + <InputNumber
  242 + min={0}
  243 + style={{ width: 200 }}
  244 + formatter={(value) => `${value}小时`}
  245 + parser={(value: any) => value.replace("小时", "")}
  246 + disabled={!edit}
  247 + />
  248 + </FormItem>
  249 + <span style={{ marginLeft: 5, marginRight: 5 }}>不用考勤打卡</span>
  250 + </div>
  251 + </div>
  252 + <div
  253 + style={{
  254 + display: "flex",
  255 + justifyContent: "flex-start",
  256 + alignItems: "center",
  257 + marginTop: 20,
  258 + paddingLeft: "20%",
  259 + }}
  260 + >
  261 + <span style={{ color: "#ff4d4f" }}>*</span> 出差结束时间:
  262 + <div>
  263 + <span style={{ marginLeft: 5, marginRight: 5 }}>
  264 + 离门店下班时间提前
  265 + </span>
  266 + <FormItem
  267 + name="travelRemainingHour"
  268 + noStyle
  269 + rules={[{ required: true, message: "请填写打卡时间要求" }]}
  270 + >
  271 + <InputNumber
  272 + min={0}
  273 + style={{ width: 200 }}
  274 + formatter={(value) => `${value}小时`}
  275 + parser={(value: any) => value.replace("小时", "")}
  276 + disabled={!edit}
  277 + />
  278 + </FormItem>
  279 + <span style={{ marginLeft: 5, marginRight: 5 }}>不用考勤打卡</span>
  280 + </div>
  281 + </div>
191 </Form> 282 </Form>
192 <Row style={{ width: "80%", marginTop: 20 }} justify="center"> 283 <Row style={{ width: "80%", marginTop: 20 }} justify="center">
193 {!edit ? ( 284 {!edit ? (
@@ -196,7 +287,11 @@ export default function TimeConfig() { @@ -196,7 +287,11 @@ export default function TimeConfig() {
196 </Button> 287 </Button>
197 ) : ( 288 ) : (
198 <div> 289 <div>
199 - <Button type="primary" onClick={form.submit} loading={confirmLoading}> 290 + <Button
  291 + type="primary"
  292 + onClick={form.submit}
  293 + loading={confirmLoading}
  294 + >
200 确定 295 确定
201 </Button> 296 </Button>
202 <Popconfirm 297 <Popconfirm
src/pages/attendance/Leave/components/Modal.tsx
@@ -22,8 +22,9 @@ const CreateModal = (props: Props) =&gt; { @@ -22,8 +22,9 @@ const CreateModal = (props: Props) =&gt; {
22 useEffect(() => { 22 useEffect(() => {
23 if (visiable && type === 1) { 23 if (visiable && type === 1) {
24 API.fetchDetail(1).then((res: any) => { 24 API.fetchDetail(1).then((res: any) => {
25 - setYear(res.data);  
26 - setYearData(res.data.conditions); 25 + const data = res.data || {};
  26 + setYear(data);
  27 + setYearData(data.conditions);
27 }); 28 });
28 } 29 }
29 }, [visiable]); 30 }, [visiable]);
@@ -91,7 +92,7 @@ const CreateModal = (props: Props) =&gt; { @@ -91,7 +92,7 @@ const CreateModal = (props: Props) =&gt; {
91 rules={[{ required: !(type === 1 || type === 8 || type === 6) }]} 92 rules={[{ required: !(type === 1 || type === 8 || type === 6) }]}
92 hidden={type === 1 || type === 8 || type === 6 || type === 10} 93 hidden={type === 1 || type === 8 || type === 6 || type === 10}
93 > 94 >
94 - <InputNumber min={1} style={{ width: 200 }} /> 95 + <InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
95 </FormItem> 96 </FormItem>
96 <FormItem 97 <FormItem
97 name="annualWay" 98 name="annualWay"
@@ -110,7 +111,7 @@ const CreateModal = (props: Props) =&gt; { @@ -110,7 +111,7 @@ const CreateModal = (props: Props) =&gt; {
110 rules={[{ required: type === 1 }]} 111 rules={[{ required: type === 1 }]}
111 hidden={!(type === 1)} 112 hidden={!(type === 1)}
112 > 113 >
113 - <InputNumber min={1} style={{ width: 200 }} /> 114 + <InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
114 </FormItem> 115 </FormItem>
115 <FormItem 116 <FormItem
116 name="advanceDays" 117 name="advanceDays"
@@ -127,7 +128,7 @@ const CreateModal = (props: Props) =&gt; { @@ -127,7 +128,7 @@ const CreateModal = (props: Props) =&gt; {
127 ]} 128 ]}
128 hidden={type === 3 || type === 8 || type === 5 || type === 10} 129 hidden={type === 3 || type === 8 || type === 5 || type === 10}
129 > 130 >
130 - <InputNumber min={1} style={{ width: 200 }} /> 131 + <InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
131 </FormItem> 132 </FormItem>
132 <FormItem 133 <FormItem
133 name="times" 134 name="times"
@@ -135,7 +136,7 @@ const CreateModal = (props: Props) =&gt; { @@ -135,7 +136,7 @@ const CreateModal = (props: Props) =&gt; {
135 rules={[{ required: type === 6 || type === 8 }]} 136 rules={[{ required: type === 6 || type === 8 }]}
136 hidden={!(type === 6 || type === 8)} 137 hidden={!(type === 6 || type === 8)}
137 > 138 >
138 - <InputNumber min={1} style={{ width: 200 }} /> 139 + <InputNumber min={1} style={{ width: 200 }} addonAfter="次" />
139 </FormItem> 140 </FormItem>
140 <FormItem 141 <FormItem
141 name="conditions" 142 name="conditions"
src/pages/attendance/Leave/index.tsx
1 -import React, { useState } from 'react'; 1 +import React, { useState } from "react";
2 import { PageHeaderWrapper } from "@ant-design/pro-layout"; 2 import { PageHeaderWrapper } from "@ant-design/pro-layout";
3 -import { Button, Card, Table } from 'antd';  
4 -import * as TYPE from './entity';  
5 -import Modal from './components/Modal';  
6 -import useInitial from '@/hooks/useInitail';  
7 -import * as API from './api'; 3 +import { Button, Card, Table } from "antd";
  4 +import * as TYPE from "./entity";
  5 +import Modal from "./components/Modal";
  6 +import useInitial from "@/hooks/useInitail";
  7 +import * as API from "./api";
8 8
9 const Column = Table.Column; 9 const Column = Table.Column;
10 10
@@ -13,7 +13,7 @@ const Leave = () =&gt; { @@ -13,7 +13,7 @@ const Leave = () =&gt; {
13 const [type, setType] = useState<number>(0); 13 const [type, setType] = useState<number>(0);
14 const { data, setParams } = useInitial(API.fetchDetail, {}, type); 14 const { data, setParams } = useInitial(API.fetchDetail, {}, type);
15 15
16 - const onEdit = (record:any) => { 16 + const onEdit = (record: any) => {
17 setParams(record.type, true); 17 setParams(record.type, true);
18 setType(record.type); 18 setType(record.type);
19 setVisiable(true); 19 setVisiable(true);
@@ -40,10 +40,10 @@ const Leave = () =&gt; { @@ -40,10 +40,10 @@ const Leave = () =&gt; {
40 visiable={visiable} 40 visiable={visiable}
41 setVisiable={setVisiable} 41 setVisiable={setVisiable}
42 type={type} 42 type={type}
43 - data={data} 43 + data={data || {}}
44 /> 44 />
45 </PageHeaderWrapper> 45 </PageHeaderWrapper>
46 ); 46 );
47 }; 47 };
48 48
49 -export default Leave;  
50 \ No newline at end of file 49 \ No newline at end of file
  50 +export default Leave;