Compare commits

...

2 Commits

3 changed files with 30 additions and 15 deletions

View File

@ -21,7 +21,7 @@ const { getLabel } = WeaLocaleProvider;
class Index extends Component {
constructor(props) {
super(props);
this.state = { captcha: "", time: 60 };
this.state = { captcha: "", time: 60, loading: false };
this.timeRef = null;
}
@ -31,10 +31,11 @@ class Index extends Component {
componentWillUnmount() {
clearInterval(this.timeRef);
this.setState({ captcha: "", time: 60 });
this.setState({ captcha: "", time: 60, loading: false });
}
handleSendCaptcha = () => {
this.setState({ loading: true });
sendMobileCode({ id: this.props.id }).then(({ status, data }) => {
if (status) {
this.timeRef = setInterval(() => {
@ -42,12 +43,14 @@ class Index extends Component {
this.setState({ time: time - 1 }, () => {
if (this.state.time === -1) {
clearInterval(this.timeRef);
this.setState({ time: 60 });
this.setState({ time: 60, loading: false });
}
});
}, 1000);
} else {
this.setState({ loading: false });
}
});
}).catch(() => this.setState({ loading: false }));
};
handleConfirm = async () => {
const type = getQueryString("type"), f = await form.validateForm();
@ -69,13 +72,13 @@ class Index extends Component {
};
render() {
const { captcha, time } = this.state, type = getQueryString("type");
const { captcha, time, loading } = this.state, type = getQueryString("type");
const itemRender = {
mobileCode: (field, textAreaProps, form, formParams) => {
return (<div className="captchaInputBox">
<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}
onChange={() => this.setState({ captcha: form.getFormParams().mobileCode })}/>
<Button type="primary" onClick={this.handleSendCaptcha} disabled={time !== 60}>
<Button type="primary" onClick={this.handleSendCaptcha} disabled={loading}>
{
time === 60 ? getLabel(111, "发送验证码") : `${time}S`
}
@ -104,7 +107,7 @@ class Index extends Component {
<WeaError tipPosition="bottom" ref="weaError" error={getLabel(111, "验证码未填写")}>
<div className="captchaInputBox">
<WeaInput value={captcha} onChange={captcha => this.setState({ captcha })}/>
<Button type="primary" onClick={this.handleSendCaptcha} disabled={time !== 60}>
<Button type="primary" onClick={this.handleSendCaptcha} disabled={loading}>
{
time === 60 ? getLabel(111, "发送验证码") : `${time}S`
}
@ -120,4 +123,4 @@ class Index extends Component {
}
}
export default Index;
export default Index;

View File

@ -245,13 +245,19 @@ export default class NormalIndex extends Component {
});
};
handleExport = () => {
const { selectedKey } = this.props;
const { selectedKey } = this.props, { formParams } = this.state;
const { departmentIds, subCompanyIds } = formParams;
const urlObj = {
"1": "/api/bs/hrmsalary/welfare/common/export",
"3": "/api/bs/hrmsalary/welfare/supplementary/export"
};
const extraParams = {
...formParams,
departmentIds: departmentIds.join(","),
subCompanyIds: subCompanyIds.join(",")
};
const url = `${window.location
.origin}${urlObj[selectedKey]}?${convertToUrlString(_.pick(this.props, ["billMonth", "paymentOrganization"]))}`;
.origin}${urlObj[selectedKey]}?${convertToUrlString({ ..._.pick(this.props, ["billMonth", "paymentOrganization"]), ...extraParams })}`;
window.open(url, "_blank");
};
handleEditNormalStandingBook = (record) => {
@ -279,12 +285,12 @@ export default class NormalIndex extends Component {
<Col span={12}><WeaFormItem label={getLabel(27511, "部门")} labelCol={{ span: 4 }} wrapperCol={{ span: 18 }}>
<WeaBrowser
isSingle={false} value={departmentIds.join(",")} type={57}
onChange={v => this.setState({ formParams: { ...formParams, departmentIds: v.split(",") } })}/>
onChange={v => this.setState({ formParams: { ...formParams, departmentIds: v ? v.split(",") : [] } })}/>
</WeaFormItem></Col>
<Col span={12}><WeaFormItem label={getLabel(33553, "分部")} labelCol={{ span: 4 }} wrapperCol={{ span: 18 }}>
<WeaBrowser
isSingle={false} value={subCompanyIds.join(",")} type={164}
onChange={v => this.setState({ formParams: { ...formParams, subCompanyIds: v.split(",") } })}/>
onChange={v => this.setState({ formParams: { ...formParams, subCompanyIds: v ? v.split(",") : [] } })}/>
</WeaFormItem></Col>
</Row>
</WeaSearchGroup>;
@ -402,4 +408,4 @@ export default class NormalIndex extends Component {
</div>
);
}
}
}

View File

@ -88,7 +88,13 @@ class Regression extends Component {
});
break;
case "export":
const url = `/api/bs/hrmsalary/welfare/recession/export?${convertToUrlString(_.pick(this.props, ["billMonth", "paymentOrganization", "creator"]))}`;
const extraParams = {
name,
workcode,
departmentIds: this.regTopRef.state.departmentIds,
subCompanyIds: this.regTopRef.state.subCompanyIds
};
const url = `/api/bs/hrmsalary/welfare/recession/export?${convertToUrlString({ ..._.pick(this.props, ["billMonth", "paymentOrganization", "creator"]), ...extraParams })}`;
window.open(url, "_blank");
break;
case "search":
@ -152,4 +158,4 @@ class Regression extends Component {
}
}
export default Regression;
export default Regression;