diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index 3fa34512..bd61c9a3 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -34,7 +34,14 @@ export const getAttendanceReferPeriod = params => { //数据采集-考勤引用-同步引用考勤数据 export const syncAttendanceRefer = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/syncAttendQuoteData', 'POST', params); + return fetch('/api/bs/hrmsalary/attendQuote/syncAttendQuoteData', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //数据采集-考勤引用-查看考勤数据 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js index 16b771ca..cbfad2eb 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js @@ -41,6 +41,13 @@ export default class EditSlideContent extends React.Component { return result.filter(item => item.hide == "false") } + getScrollWidth() { + const { attendanceStore } = this.props; + const { attendQuoteDetailTableStore} = attendanceStore; + return this.getColumns(attendQuoteDetailTableStore.columns ? attendQuoteDetailTableStore.columns : []).length * 150 + } + + render() { const { attendanceStore } = this.props; const { attendQuoteDetailPageInfo, attendQuoteDetailTableStore} = attendanceStore; @@ -56,7 +63,7 @@ export default class EditSlideContent extends React.Component { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index ac07039b..3fcbd485 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -169,6 +169,14 @@ export default class Attendance extends React.Component { setSlideVisiable(true) } + // 引用同步Cancel事件 + handleRefereCancel() { + this.setState({refereAttendFormVisible: false}) + const { attendanceStore: { getAttendanceList }} = this.props; + this.listSearch.current = 1 + getAttendanceList(this.listSearch) + } + render() { const { attendanceStore } = this.props; const { modalParam } = this.state; @@ -582,7 +590,11 @@ export default class Attendance extends React.Component { - {saveAttendanceFieldSetting("QUOTE")}} onRestoreDefault={() => {handleonRestoreDefault("QUOTE")}} onSetDefault={() => {handleSetDefault("QUOTE")}} onShowChecked={(value) => {handleShowChecked(value)}} onSearch={(value) => {searchFieldSettingList(value)}} onChange={(value) => {setFieldSettingAttendList(value)}} items={fieldSettingAttendList} onHeaderSet={() => {handleRefereHeaderSet()}} visible={this.state.refereAttendFormVisible} onCancel={() => this.setState({refereAttendFormVisible: false})}/> + { + this.state.refereAttendFormVisible && {saveAttendanceFieldSetting("QUOTE")}} onRestoreDefault={() => {handleonRestoreDefault("QUOTE")}} onSetDefault={() => {handleSetDefault("QUOTE")}} onShowChecked={(value) => {handleShowChecked(value)}} onSearch={(value) => {searchFieldSettingList(value)}} onChange={(value) => {setFieldSettingAttendList(value)}} items={fieldSettingAttendList} onHeaderSet={() => {handleRefereHeaderSet()}} visible={this.state.refereAttendFormVisible} onCancel={() => { + this.handleRefereCancel() + }}/> + } { this.state.itemMangeVisible && {handleItemMangeUpdate(value)}} onSave={(value) => handleItemMangeSave(value)} onCancel={() => {this.setState({itemMangeVisible: false})}}/> } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js index f2726f94..63f67d6b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js @@ -1,16 +1,28 @@ import React from 'react' -import { Modal, Row, Col, Button } from 'antd' +import { Modal, Row, Col, Button, Select, message } from 'antd' +import moment from 'moment' import { WeaSelect, WeaInput, WeaBrowser, WeaDatePicker } from "ecCom" import SelectItemModal, {items} from '../../../components/selectItemsModal' import SelectItemsWrapper from '../../../components/selectItemsModal/selectItemsWrapper' +import { inject, observer } from 'mobx-react'; +import RequiredLabelTip from '../../../components/requiredLabelTip' +import { notNull } from '../../../util/validate' +const { Option } = Select - - +@inject('attendanceStore') +@observer export default class RefereAttendFormModal extends React.Component { constructor(props) { super(props) this.state = { - headerSetVisible: false + headerSetVisible: false, + inited: false, + request: { + salarySobId: "", + salaryYearMonth: moment(new Date()).format("YYYY-MM"), + employeeIds: [], + description: "" + } } } @@ -19,42 +31,106 @@ export default class RefereAttendFormModal extends React.Component { this.props.onHeaderSet(); } + componentWillMount() { + const { attendanceStore: { getLedgerList }} = this.props; + getLedgerList().then(() => { + this.setState({ + inited: true + }) + }) + } + + // 请求参数改变事件 + handleRequestChange(params) { + const { request } = this.state; + let result = { ...request, ...params } + this.setState({request: result}) + } + + + // 同步点击回调 + handleSync() { + const { attendanceStore: {syncAttendanceRefer}} = this.props + if(!this.validate()) { + return + } + syncAttendanceRefer(this.state.request).then(() => { + this.props.onCancel() + }) + } + + // 校验数据 + validate() { + const { request } = this.state; + if(!notNull(request.salarySobId)) { + message.warning("薪资账套不能为空"); + return false; + } + if(!notNull(request.salaryYearMonth)) { + message.warning("薪资所属月不能为空") + return false; + } + return true; + } + + render() { + const { attendanceStore: { importLedgerList }} = this.props; return ( - + } visible={this.props.visible} onCancel={this.props.onCancel}> - 薪资所属月: + 薪资所属月: { + this.handleRequestChange({salaryYearMonth: value}) + }} /> - 薪资账套: + 薪资账套: - + { + this.state.inited && + } 添加账套外人员 - + + this.handleRequestChange({employeeIds: ids.split(",")}) + } + isSingle={false} + /> 备注 - + { + this.handleRequestChange({description: value}) + }}/> diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 93e80f01..ba0ca649 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -398,4 +398,21 @@ export class AttendanceStore { } }) } + + // 考勤引用同步 + @action + syncAttendanceRefer = (params) => { + return new Promise((resolve, reject) => { + API.syncAttendanceRefer(params).then(res => { + if(res.status) { + message.success("同步成功") + resolve() + } else { + message.error(res.errormsg || "同步失败") + reject(); + } + }) + }) + + } } \ No newline at end of file