diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index cbe5706f..b749338c 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -149,10 +149,24 @@ export const saveAttendanceFieldSetting = params => { } //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 export const returnToAttendanceFieldSettingDefault = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/fieldSetting/recoverAsDefault', 'POST', params); + return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/recoverAsDefault', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //数据采集-考勤引用-考勤引用字段设置-设为默认设置 export const saveAttendanceFieldSettingAsDefault = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/fieldSetting/saveAsDefault', 'POST', params); + return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/saveAsDefault', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index.js b/pc4mobx/hrmSalary/components/selectItemsModal/index.js index aa54c40b..6c30b268 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/index.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/index.js @@ -30,10 +30,19 @@ export default class SelectItemModal extends React.Component { this.props.onShowChecked(value) } - render(){ + handleMenuClick(e) { + if(e.key == "1") { //恢复默认设置 + this.props.onRestoreDefault() + } else if(e.key == "2") { + this.props.onSetDefault() + } else if(e.key == "3") { + + } + } + render(){ const menu = ( - + this.handleMenuClick(e)}> 恢复默认设置 设置默认设置 操作日志 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index cad11c12..4f8f7624 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -317,6 +317,16 @@ export default class Attendance extends React.Component { } + const handleonRestoreDefault = () => { + const { attendanceStore: {returnToAttendanceFieldSettingDefault}} = this.props; + returnToAttendanceFieldSettingDefault(); + } + + const handleSetDefault = () => { + const { attendanceStore: {saveAttendanceFieldSettingAsDefault}} = this.props; + saveAttendanceFieldSettingAsDefault(); + } + return (
{ this.setState({modalVisiable: false})}} /> - {saveAttendanceFieldSetting()}} onShowChecked={(value) => {handleShowChecked(value)}} onSearch={(value) => {searchFieldSettingList(value)}} visible={this.state.selectItemVisible} onCancel={() => this.setState({selectItemVisible: false})}> + {handleonRestoreDefault()}} onSetDefault={() => {handleSetDefault()}} onSave={() => {saveAttendanceFieldSetting()}} onShowChecked={(value) => {handleShowChecked(value)}} onSearch={(value) => {searchFieldSettingList(value)}} visible={this.state.selectItemVisible} onCancel={() => this.setState({selectItemVisible: false})}>
{setFieldSettingAttendList(value)}} items={fieldSettingAttendList} title={"考勤模块"}/> {setFieldSettingCustomList(value)}} items={fieldSettingCustomList} title={"自定义"}/> diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index ec2e96bd..8a411327 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -264,4 +264,39 @@ export class AttendanceStore { } + //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 + @action + returnToAttendanceFieldSettingDefault = () => { + API.returnToAttendanceFieldSettingDefault({sourceType:'IMPORT'}).then(res => { + if(res.status) { + this.requestFeildAttendList = res.data[0] ? res.data[0].items : [] + this.fieldSettingAttendList = this.requestFeildAttendList + this.requestFeildCustomList = res.data[1] ? res.data[1].items : [] + this.fieldSettingCustomList = this.requestFeildCustomList; + } else { + message.error("获取数据失败") + } + }) + } + + //数据采集-考勤引用-考勤引用字段设置-设为默认设置 + @action + saveAttendanceFieldSettingAsDefault = () => { + + let attendList = this.requestFeildAttendList.map(item => ({id: item.id, checked: item.checked})) + let customList = this.requestFeildCustomList.map(item => ({id: item.id, checked: item.checked})) + let request = { + sourceType:'IMPORT', + currentSettingFields: [...attendList, ...customList] + } + API.saveAttendanceFieldSettingAsDefault(request).then(res => { + if(res.status) { + message.success("设置成功") + } else { + message.error("设置失败") + } + }) + } + + } \ No newline at end of file