Commit 1f3ebf8af304ba3c50b9ab1aa8a759dce33f9076
Merge branch 'Shinner-addonAfter' into 'master'
请假设置增加单位;考勤组设置增加配置项 See merge request !196
Showing
4 changed files
with
133 additions
and
32 deletions
src/pages/attendance/Attend/subpages/AttendanceGroup/api.ts
1 | -import { http,PromisePageResp } from "@/typing/http"; | |
1 | +import { http, PromisePageResp } from "@/typing/http"; | |
2 | 2 | import request from "@/utils/request"; |
3 | 3 | import { ATTENDANCE_HOST } from "@/utils/host"; |
4 | 4 | |
... | ... | @@ -70,10 +70,15 @@ export function saveApi(params?: Item): P<void> { |
70 | 70 | } |
71 | 71 | |
72 | 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 | 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 | 2 | import React, { useEffect, useState } from "react"; |
3 | 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 | 9 | const FormItem = Form.Item; |
7 | 10 | |
... | ... | @@ -49,7 +52,12 @@ export default function TimeConfig() { |
49 | 52 | |
50 | 53 | return ( |
51 | 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 | 61 | <div |
54 | 62 | style={{ |
55 | 63 | display: "flex", |
... | ... | @@ -77,7 +85,8 @@ export default function TimeConfig() { |
77 | 85 | /> |
78 | 86 | </FormItem> |
79 | 87 | <span style={{ marginLeft: 5 }}> |
80 | - 到应打卡时间 <span style={{ color: "#999999" }}>(除最后一次应打卡)</span> | |
88 | + 到应打卡时间{" "} | |
89 | + <span style={{ color: "#999999" }}>(除最后一次应打卡)</span> | |
81 | 90 | </span> |
82 | 91 | </div> |
83 | 92 | </div> |
... | ... | @@ -93,7 +102,10 @@ export default function TimeConfig() { |
93 | 102 | > |
94 | 103 | <span style={{ color: "#ff4d4f" }}>*</span> 最后一次应打卡时间要求: |
95 | 104 | <div> |
96 | - <span style={{ marginRight: 5, marginLeft: 5 }}> 应打卡时间延后</span> | |
105 | + <span style={{ marginRight: 5, marginLeft: 5 }}> | |
106 | + {" "} | |
107 | + 应打卡时间延后 | |
108 | + </span> | |
97 | 109 | <FormItem |
98 | 110 | name="offDutyNoticeTime" |
99 | 111 | label="打卡时间要求" |
... | ... | @@ -108,7 +120,9 @@ export default function TimeConfig() { |
108 | 120 | disabled={!edit} |
109 | 121 | /> |
110 | 122 | </FormItem> |
111 | - <span style={{ color: "#999999", marginLeft: 5 }}>(当天仅一次打卡不计此情况)</span> | |
123 | + <span style={{ color: "#999999", marginLeft: 5 }}> | |
124 | + (当天仅一次打卡不计此情况) | |
125 | + </span> | |
112 | 126 | </div> |
113 | 127 | </div> |
114 | 128 | |
... | ... | @@ -123,9 +137,17 @@ export default function TimeConfig() { |
123 | 137 | > |
124 | 138 | <span style={{ color: "#ff4d4f" }}>*</span> 严重迟到判定: |
125 | 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 | 151 | <InputNumber |
130 | 152 | min={0} |
131 | 153 | style={{ width: 200 }} |
... | ... | @@ -147,7 +169,10 @@ export default function TimeConfig() { |
147 | 169 | > |
148 | 170 | <span style={{ color: "#ff4d4f" }}>*</span> 上班缺卡时间判定: |
149 | 171 | <div> |
150 | - <span style={{ marginRight: 5, marginLeft: 5 }}> 应打卡时间延后</span> | |
172 | + <span style={{ marginRight: 5, marginLeft: 5 }}> | |
173 | + {" "} | |
174 | + 应打卡时间延后 | |
175 | + </span> | |
151 | 176 | <FormItem |
152 | 177 | name="onDutyLackTime" |
153 | 178 | label="打卡时间要求" |
... | ... | @@ -175,8 +200,14 @@ export default function TimeConfig() { |
175 | 200 | > |
176 | 201 | <span style={{ color: "#ff4d4f" }}>*</span> 下班缺卡时间判定: |
177 | 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 | 211 | <InputNumber |
181 | 212 | min={0} |
182 | 213 | style={{ width: 200 }} |
... | ... | @@ -188,6 +219,66 @@ export default function TimeConfig() { |
188 | 219 | <span style={{ marginLeft: 5 }}>后不允许打卡</span> |
189 | 220 | </div> |
190 | 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 | 282 | </Form> |
192 | 283 | <Row style={{ width: "80%", marginTop: 20 }} justify="center"> |
193 | 284 | {!edit ? ( |
... | ... | @@ -196,7 +287,11 @@ export default function TimeConfig() { |
196 | 287 | </Button> |
197 | 288 | ) : ( |
198 | 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 | 296 | </Button> |
202 | 297 | <Popconfirm | ... | ... |
src/pages/attendance/Leave/components/Modal.tsx
... | ... | @@ -22,8 +22,9 @@ const CreateModal = (props: Props) => { |
22 | 22 | useEffect(() => { |
23 | 23 | if (visiable && type === 1) { |
24 | 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 | 30 | }, [visiable]); |
... | ... | @@ -91,7 +92,7 @@ const CreateModal = (props: Props) => { |
91 | 92 | rules={[{ required: !(type === 1 || type === 8 || type === 6) }]} |
92 | 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 | 96 | </FormItem> |
96 | 97 | <FormItem |
97 | 98 | name="annualWay" |
... | ... | @@ -110,7 +111,7 @@ const CreateModal = (props: Props) => { |
110 | 111 | rules={[{ required: type === 1 }]} |
111 | 112 | hidden={!(type === 1)} |
112 | 113 | > |
113 | - <InputNumber min={1} style={{ width: 200 }} /> | |
114 | + <InputNumber min={1} style={{ width: 200 }} addonAfter="天" /> | |
114 | 115 | </FormItem> |
115 | 116 | <FormItem |
116 | 117 | name="advanceDays" |
... | ... | @@ -127,7 +128,7 @@ const CreateModal = (props: Props) => { |
127 | 128 | ]} |
128 | 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 | 132 | </FormItem> |
132 | 133 | <FormItem |
133 | 134 | name="times" |
... | ... | @@ -135,7 +136,7 @@ const CreateModal = (props: Props) => { |
135 | 136 | rules={[{ required: type === 6 || type === 8 }]} |
136 | 137 | hidden={!(type === 6 || type === 8)} |
137 | 138 | > |
138 | - <InputNumber min={1} style={{ width: 200 }} /> | |
139 | + <InputNumber min={1} style={{ width: 200 }} addonAfter="次" /> | |
139 | 140 | </FormItem> |
140 | 141 | <FormItem |
141 | 142 | name="conditions" | ... | ... |
src/pages/attendance/Leave/index.tsx
1 | -import React, { useState } from 'react'; | |
1 | +import React, { useState } from "react"; | |
2 | 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 | 9 | const Column = Table.Column; |
10 | 10 | |
... | ... | @@ -13,7 +13,7 @@ const Leave = () => { |
13 | 13 | const [type, setType] = useState<number>(0); |
14 | 14 | const { data, setParams } = useInitial(API.fetchDetail, {}, type); |
15 | 15 | |
16 | - const onEdit = (record:any) => { | |
16 | + const onEdit = (record: any) => { | |
17 | 17 | setParams(record.type, true); |
18 | 18 | setType(record.type); |
19 | 19 | setVisiable(true); |
... | ... | @@ -40,10 +40,10 @@ const Leave = () => { |
40 | 40 | visiable={visiable} |
41 | 41 | setVisiable={setVisiable} |
42 | 42 | type={type} |
43 | - data={data} | |
43 | + data={data || {}} | |
44 | 44 | /> |
45 | 45 | </PageHeaderWrapper> |
46 | 46 | ); |
47 | 47 | }; |
48 | 48 | |
49 | -export default Leave; | |
50 | 49 | \ No newline at end of file |
50 | +export default Leave; | ... | ... |