custom/万君筑天科技-合并业务线
This commit is contained in:
parent
4eb957cb17
commit
e7d241cdba
|
|
@ -78,3 +78,11 @@ export const viewAttendQuote = (params) => {
|
|||
export const getSalaryCycleAndAttendCycle = (params) => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", "get", params);
|
||||
};
|
||||
// 获取考勤详情信息
|
||||
export const getAttendQuoteData = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/attendQuote/getData", params);
|
||||
};
|
||||
// 编辑考勤引用数据
|
||||
export const editAttendQuoteData = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/attendQuote/editData", params);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,37 +7,100 @@
|
|||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaLocaleProvider, WeaSlideModal } from "ecCom";
|
||||
import { Button } from "antd";
|
||||
import { WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
|
||||
import { editAttendQuoteData, getAttendQuoteData } from "../../../../apis/attendance";
|
||||
import FormInfo from "../../../../components/FormInfo";
|
||||
import { WeaForm } from "comsMobx";
|
||||
import { Button, message } from "antd";
|
||||
import "./index.less";
|
||||
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
const form = new WeaForm();
|
||||
const baseInforFields = ["username", "departmentName", "mobile", "jobNum", "idNo"];
|
||||
|
||||
class AttendanceDataEditSlide extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
this.state = { conditions: [], loading: false };
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance");
|
||||
this.getAttendQuoteData(nextProps);
|
||||
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
document.querySelector(".attendanceRefWrapper").classList.remove("zIndex0-attendance");
|
||||
form.resetForm();
|
||||
}
|
||||
}
|
||||
|
||||
getAttendQuoteData = (props) => {
|
||||
const { record } = props || this.props, { id } = record;
|
||||
getAttendQuoteData({ id }).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { columns, data: result } = data;
|
||||
this.setState({
|
||||
conditions: [{
|
||||
defaultshow: true,
|
||||
items: [
|
||||
..._.map(baseInforFields, o => ({
|
||||
conditionType: "INPUT",
|
||||
domkey: [o],
|
||||
fieldcol: 14,
|
||||
label: _.find(columns, k => k.column === o).text,
|
||||
labelcol: 8,
|
||||
value: result[o] || "",
|
||||
viewAttr: 1
|
||||
})),
|
||||
..._.map(_.filter(columns, o => !baseInforFields.includes(o.column)), k => ({
|
||||
conditionType: "INPUT",
|
||||
domkey: [k.column],
|
||||
fieldcol: 14,
|
||||
rules: "",
|
||||
label: k.text,
|
||||
labelcol: 8,
|
||||
value: result[k.column] || "",
|
||||
viewAttr: 2
|
||||
}))
|
||||
]
|
||||
}]
|
||||
}, () => form.initFormFields(this.state.conditions));
|
||||
}
|
||||
});
|
||||
};
|
||||
save = () => {
|
||||
form.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
const { record } = this.props, { id } = record;
|
||||
const { username, departmentName, mobile, jobNum, idNo, ...formData } = form.getFormParams();
|
||||
const payload = { id, attendQuoteData: { ...formData } };
|
||||
this.setState({ loading: true });
|
||||
editAttendQuoteData(payload).then(({ status, errormsg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status) {
|
||||
message.success(getLabel(30700, "操作成功"));
|
||||
this.props.onClose();
|
||||
this.props.onSuccess();
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
} else {
|
||||
f.showErrors();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { record } = this.props, { username } = record, { conditions, loading } = this.state;
|
||||
const btns = [
|
||||
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(111, "保存")}</Button>
|
||||
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "保存")}</Button>
|
||||
];
|
||||
return (
|
||||
<WeaSlideModal {...this.props} className="attendanceSlideWrapper" top={0} height={100} width={800}
|
||||
measureX="px" measureT="%" measureY="%" direction="right"
|
||||
title="郑世珍"
|
||||
content={<div></div>}
|
||||
/>
|
||||
);
|
||||
return (<WeaSlideModal {...this.props} className="editAttendanceSlide" top={0} height={100} width={1000}
|
||||
measureX="px" measureT="%" measureY="%" direction="right"
|
||||
title={<WeaTop title={username} icon={<i className="icon-coms-fa"/>}
|
||||
iconBgcolor="#F14A2D" buttons={btns}/>}
|
||||
content={<FormInfo className="form-dialog-layout" center={false} itemRender={{}} form={form}
|
||||
formFields={conditions} colCount={2}/>
|
||||
}/>);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AttendanceDataViewSlide extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
loading: { query: false }, keyword: "", dataSource: [], columns: [],
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, visible: false
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -46,8 +46,9 @@ class AttendanceDataViewSlide extends Component {
|
|||
..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })),
|
||||
{
|
||||
title: getLabel(111, "操作"), dataIndex: "operate", width: 80,
|
||||
render: () => (<a href="JavaScript:void(0);"
|
||||
onClick={() => this.setState({ visible: true })}>{getLabel(111, "编辑")}</a>)
|
||||
render: (__, record) => (<a href="JavaScript:void(0);" onClick={() => this.setState({
|
||||
attendanceSlide: { visible: true, record }
|
||||
})}>{getLabel(111, "编辑")}</a>)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -68,7 +69,7 @@ class AttendanceDataViewSlide extends Component {
|
|||
|
||||
render() {
|
||||
const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
|
||||
const { columns, dataSource, loading, pageInfo, keyword, visible } = this.state;
|
||||
const { columns, dataSource, loading, pageInfo, keyword, attendanceSlide } = this.state;
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
|
|
@ -110,7 +111,11 @@ class AttendanceDataViewSlide extends Component {
|
|||
<WeaTable
|
||||
columns={columns} dataSource={dataSource} bordered pagination={pagination}
|
||||
loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 240px)` }}/>
|
||||
<AttendanceDataEditSlide visible={visible} onClose={() => this.setState({ visible: false })}/>
|
||||
<AttendanceDataEditSlide {...attendanceSlide}
|
||||
onSuccess={() => this.viewAttendQuote({}, this.props)}
|
||||
onClose={() => this.setState({
|
||||
attendanceSlide: { ...attendanceSlide, visible: false }
|
||||
})}/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -3,19 +3,21 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.wea-form-item {
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
background: #FFF;
|
||||
margin: 8px 16px 0 16px;
|
||||
.wea-new-top-req-content {
|
||||
& > .wea-form-item {
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
background: #FFF;
|
||||
margin: 8px 16px 0 16px;
|
||||
|
||||
.wea-form-item-label {
|
||||
line-height: 46px !important;
|
||||
padding-left: 8px !important;
|
||||
}
|
||||
.wea-form-item-label {
|
||||
line-height: 46px !important;
|
||||
padding-left: 8px !important;
|
||||
}
|
||||
|
||||
.to {
|
||||
padding: 0 10px
|
||||
.to {
|
||||
padding: 0 10px
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue