考勤引用
This commit is contained in:
parent
9fbf1e988e
commit
88caca1d04
|
|
@ -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())
|
||||
}
|
||||
|
||||
//数据采集-考勤引用-查看考勤数据
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
<WeaTable
|
||||
columns={this.getColumns(attendQuoteDetailTableStore.columns ? attendQuoteDetailTableStore.columns : [])}
|
||||
dataSource={attendQuoteDetailPageInfo.list ? attendQuoteDetailPageInfo.list : []}
|
||||
scroll={{x: 1300}}
|
||||
scroll={{x: this.getScrollWidth()}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
</div>
|
||||
</SelectItemModal>
|
||||
|
||||
<RefereAttendFormModal onSave={() => {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 && <RefereAttendFormModal onSave={() => {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 && <ItemMangeFormModal visible={this.state.itemMangeVisible} onUpdate={(value) => {handleItemMangeUpdate(value)}} onSave={(value) => handleItemMangeSave(value)} onCancel={() => {this.setState({itemMangeVisible: false})}}/>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Modal width={600} title="引用考勤数据" footer={
|
||||
<div style={{display: "inline-block"}}>
|
||||
<Button type="primary">同步</Button>
|
||||
<Button type="primary" onClick={() => {this.handleSync()}}>同步</Button>
|
||||
<Button type="default" onClick={() => {this.handleHeaderSet()}}>表头设置</Button>
|
||||
</div>
|
||||
} visible={this.props.visible} onCancel={this.props.onCancel}>
|
||||
<Row style={{marginBottom: "10px"}}>
|
||||
<Col span={8}>薪资所属月:</Col>
|
||||
<Col span={8}>薪资所属月: <RequiredLabelTip /></Col>
|
||||
<Col span={16}>
|
||||
<WeaDatePicker
|
||||
format="yyyy-MM"
|
||||
style={{width: 200}}
|
||||
value={this.state.request.salaryYearMonth}
|
||||
onChange={(value) => {
|
||||
this.handleRequestChange({salaryYearMonth: value})
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginBottom: "10px"}}>
|
||||
<Col span={8}>薪资账套:</Col>
|
||||
<Col span={8}>薪资账套:<RequiredLabelTip /></Col>
|
||||
<Col span={16}>
|
||||
<WeaSelect
|
||||
showSearch // 设置select可搜索
|
||||
style={{ width: 200, display: "inline-block" }}
|
||||
/>
|
||||
{
|
||||
this.state.inited && <Select
|
||||
defaultValue={this.state.request.salarySobId} value={this.state.request.salarySobId} style={{ width: "200px" }} onChange={(value) => {
|
||||
this.handleRequestChange({salarySobId: value})
|
||||
}}>
|
||||
{importLedgerList.map(item => (
|
||||
<Option value={item.id} key={item.id}>{item.content}</Option>
|
||||
))}
|
||||
</Select>
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginBottom: "10px"}}>
|
||||
<Col span={8}>添加账套外人员</Col>
|
||||
<Col span={16}>
|
||||
<WeaInput style={{width: 200}} />
|
||||
<WeaBrowser
|
||||
type={17}
|
||||
textDecoration={true}
|
||||
inputStyle={{ width: 200 }}
|
||||
onChange={(ids, names, datas) =>
|
||||
this.handleRequestChange({employeeIds: ids.split(",")})
|
||||
}
|
||||
isSingle={false}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginBottom: "10px"}}>
|
||||
<Col span={8}>备注</Col>
|
||||
<Col span={16}>
|
||||
<WeaInput style={{width: 200}} />
|
||||
<WeaInput style={{width: 200}} value={this.state.request.description} onChange={(value) => {
|
||||
this.handleRequestChange({description: value})
|
||||
}}/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue