考勤引用页面重构

This commit is contained in:
黎永顺 2023-03-01 16:28:34 +08:00
parent c9560ae679
commit fe71ce161b
3 changed files with 45 additions and 6 deletions

View File

@ -93,12 +93,12 @@ export const conditions = [
labelcol: 6,
options: [
{
key: "1",
key: "NUMBER",
selected: true,
showname: "数值"
},
{
key: "2",
key: "TEXT",
selected: false,
showname: "文本"
}

View File

@ -7,9 +7,10 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog } from "ecCom";
import { Button } from "antd";
import { Button, message } from "antd";
import { conditions } from "../columns";
import { getSearchs } from "../../../../util";
import { saveAttendanceField } from "../../../../apis/attendance";
import "./index.less";
@inject("attendanceStore")
@ -20,14 +21,49 @@ class AttendanceCustomFieldsModal extends Component {
form.initFormFields(conditions);
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible) this.handleResetForm();
}
/*
* Author: 黎永顺
* Description: 保存考勤字段
* Params:
* Date: 2023/3/1
*/
handleSubmitFields = () => {
const { attendanceStore: { form }, onRefresh, onCancel } = this.props;
form.validateForm().then(f => {
if (f.isValid) {
const payload = form.getFormParams();
saveAttendanceField(payload).then(({ status, errormsg }) => {
if (status) {
message.success("新增成功");
onCancel();
onRefresh();
} else {
message.error(errormsg || "新增失败");
}
});
} else {
f.showErrors();
}
});
};
handleResetForm = () => {
const { attendanceStore: { form } } = this.props;
form.resetForm();
};
render() {
const { attendanceStore: { form } } = this.props;
const buttons = [
<Button type="primary">保存</Button>
<Button type="primary" onClick={this.handleSubmitFields}>保存</Button>
];
return (
<WeaDialog
{...this.props} style={{ width: 440, height: 100 }}
{...this.props} style={{ width: 440, height: 202 }}
buttons={buttons} hasScroll initLoadCss
className="modalWrapper"
>

View File

@ -111,7 +111,10 @@ class FieldMangComp extends Component {
pagination={pagination}
loading={loading.query}
/>
<AttendanceCustomFieldsModal {...addPayload} onCancel={this.handleTriggerAttendFileds}/>
<AttendanceCustomFieldsModal
{...addPayload} onCancel={this.handleTriggerAttendFileds}
onRefresh={this.getAttendanceFieldList}
/>
</Col>
<Col xs={24} sm={24} md={8} lg={6}>
<TipLabel