a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
1
|
import React, { useEffect, useState } from "react";
|
9f5a48a9
zhangkang
修复最低标准考勤 数据不刷新 增加...
|
2
|
import { Modal, Form, InputNumber, message, Radio } from "antd";
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
3
4
5
|
import * as API from "../api";
import * as TYPE from "../entity";
import LeaveDetail from "./LeaveDetail/index";
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
6
7
|
interface Props {
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
8
9
10
|
type: number;
visiable: boolean;
setVisiable: (value: any) => any;
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
11
12
13
14
15
16
17
18
19
20
21
22
23
|
data: any;
}
const FormItem = Form.Item;
const CreateModal = (props: Props) => {
const { type, visiable, setVisiable, data } = props;
const [form] = Form.useForm();
const [year, setYear] = useState([]);
const [yearData, setYearData] = useState<any>();
useEffect(() => {
if (visiable && type === 1) {
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
24
|
API.fetchDetail(1).then((res: any) => {
|
0db038b2
Shinner
请假设置增加单位;考勤组设置增加配置项
|
25
26
27
|
const data = res.data || {};
setYear(data);
setYearData(data.conditions);
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
28
29
30
31
32
33
34
35
36
37
|
});
}
}, [visiable]);
useEffect(() => {
form.setFieldsValue({
days: data.days,
advanceDays: data.advanceDays,
times: data.times,
years: data.years,
|
9f5a48a9
zhangkang
修复最低标准考勤 数据不刷新 增加...
|
38
|
conditions: data.conditions,
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
39
40
|
annualWay: data.annualWay,
needAdvancePay: data.needAdvancePay,
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
41
42
43
44
45
46
47
48
49
50
51
52
|
});
}, [data]);
function submit(item: any) {
const params = {
id: data.id,
type,
conditions: yearData,
advanceDays: item.advanceDays,
years: item.years,
days: item.days,
times: item.times,
|
9f5a48a9
zhangkang
修复最低标准考勤 数据不刷新 增加...
|
53
|
annualWay: item.annualWay,
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
54
|
needAdvancePay: item.needAdvancePay,
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
55
|
};
|
2ee474b7
zhangkang
设置调整
|
56
57
58
59
60
61
62
63
64
65
66
67
|
if (type === 10) {
setVisiable(false);
} else {
API.saveApi(params)
.then((res) => {
message.success("保存成功");
setVisiable(false);
})
.catch((err) => {
message.error("请填写参数", err);
});
}
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
68
69
70
71
|
}
const onAdd = () => {
setVisiable(false);
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
72
|
};
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
return (
<Modal
title={`${TYPE.typeEnum[type]}设置`}
visible={visiable}
onOk={form.submit}
onCancel={() => onAdd()}
maskClosable={false}
getContainer={false}
width={1000}
>
<Form
form={form}
onFinish={submit}
labelCol={{ span: 8 }}
wrapperCol={{ span: 15 }}
>
<FormItem
name="days"
|
2ee474b7
zhangkang
设置调整
|
91
|
label="假期"
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
92
|
rules={[{ required: !(type === 1 || type === 8 || type === 6) }]}
|
2ee474b7
zhangkang
设置调整
|
93
|
hidden={type === 1 || type === 8 || type === 6 || type === 10}
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
94
|
>
|
0db038b2
Shinner
请假设置增加单位;考勤组设置增加配置项
|
95
|
<InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
96
97
|
</FormItem>
<FormItem
|
9f5a48a9
zhangkang
修复最低标准考勤 数据不刷新 增加...
|
98
99
100
101
102
103
104
105
106
107
108
|
name="annualWay"
rules={[{ required: type === 1 }]}
hidden={!(type === 1)}
label="年假方式"
>
<Radio.Group>
<Radio value={1}>自然年</Radio>
<Radio value={2}>转正日期滚动12个月</Radio>
</Radio.Group>
</FormItem>
<FormItem
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
109
110
111
112
113
|
name="years"
label="前置条件(入职需>)"
rules={[{ required: type === 1 }]}
hidden={!(type === 1)}
>
|
0db038b2
Shinner
请假设置增加单位;考勤组设置增加配置项
|
114
|
<InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
115
116
117
118
|
</FormItem>
<FormItem
name="advanceDays"
label="需提前请假"
|
838ef601
zhangkang
请假设置
|
119
120
121
122
123
124
125
126
127
128
129
|
rules={[
{
required: !(
type === 3 ||
type === 8 ||
type === 5 ||
type === 10
),
},
]}
hidden={type === 3 || type === 8 || type === 5 || type === 10}
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
130
|
>
|
0db038b2
Shinner
请假设置增加单位;考勤组设置增加配置项
|
131
|
<InputNumber min={1} style={{ width: 200 }} addonAfter="天" />
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
132
133
134
135
136
137
138
|
</FormItem>
<FormItem
name="times"
label="月请假次数"
rules={[{ required: type === 6 || type === 8 }]}
hidden={!(type === 6 || type === 8)}
>
|
0db038b2
Shinner
请假设置增加单位;考勤组设置增加配置项
|
139
|
<InputNumber min={1} style={{ width: 200 }} addonAfter="次" />
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
140
141
142
143
|
</FormItem>
<FormItem
name="conditions"
label="年假范围"
|
838ef601
zhangkang
请假设置
|
144
145
|
rules={[{ required: type === 1 }]}
hidden={!(type === 1)}
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
146
|
>
|
838ef601
zhangkang
请假设置
|
147
148
149
150
151
|
<LeaveDetail
year={year}
yearData={yearData}
setYearData={setYearData}
/>
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
152
|
</FormItem>
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
153
154
155
156
157
158
159
160
161
162
163
|
<FormItem
name="needAdvancePay"
label="提前预缴产假保险费"
rules={[{ required: type === 4 }]}
hidden={type !== 4}
>
<Radio.Group>
<Radio value>是</Radio>
<Radio value={false}>否</Radio>
</Radio.Group>
</FormItem>
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
164
|
</Form>
|
9f5a48a9
zhangkang
修复最低标准考勤 数据不刷新 增加...
|
165
166
167
|
{type === 10 && (
<div style={{ textAlign: "center" }}>假期(需审批,不限天数)</div>
)}
|
cc26d1fc
张志伟
🎉 重新构建项目,解决项目过大的问题
|
168
169
170
171
|
</Modal>
);
};
|
a368ea1f
王强
修改 请假设置-产假,添加 提前预...
|
172
|
export default CreateModal;
|