From e552f34103a70605d9d439fe948c3906ef1b31ee Mon Sep 17 00:00:00 2001 From: liyongshun <971387674@qq.com> Date: Thu, 2 Jun 2022 17:11:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/attendance.js | 416 ++++++------ .../attendance/refereAttendFormModal.js | 17 +- .../pages/dataAcquisition/cumDeduct/index.js | 12 + .../dataAcquisition/cumSituation/index.js | 12 + .../dataAcquisition/otherDeduct/index.js | 12 + .../hrmSalary/pages/ledger/addUserModal.js | 297 +++++---- pc4mobx/hrmSalary/pages/ledger/index.js | 2 +- pc4mobx/hrmSalary/pages/salaryFile/index.js | 593 +++++++++++------- .../pages/taxAgent/addTaxAgentModal.js | 11 + pc4mobx/hrmSalary/stores/attendanceStore.js | 467 +++++++------- pc4mobx/hrmSalary/style/index.less | 5 + 11 files changed, 1078 insertions(+), 766 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index 710233df..4b7ea0f7 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -1,236 +1,286 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; //数据采集-考勤引用-考勤数据列表 -export const getAttendanceList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const checkOperation = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/checkOperation", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; +//数据采集-考勤引用-考勤数据列表 +export const getAttendanceList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤数据-获取导入参数 -export const getImportAttendanceParam = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getImportParams', 'get', params); -} +export const getImportAttendanceParam = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getImportParams", + "get", + params + ); +}; //数据采集-考勤引用-获取账套列表 -export const getLedgerList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/selectSalarySobList', 'get', params); -} +export const getLedgerList = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/selectSalarySobList", + "get", + params + ); +}; //数据采集-考勤引用-获取引用考勤表单 -export const getAttendanceReferForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSyncForm', 'get', params); -} +export const getAttendanceReferForm = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSyncForm", + "get", + params + ); +}; //数据采集-考勤引用-获取引用考勤表单周期数据 -export const getAttendanceReferPeriod = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle', 'post', params); -} +export const getAttendanceReferPeriod = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", + "post", + params + ); +}; //数据采集-考勤引用-同步引用考勤数据 -export const syncAttendanceRefer = 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()) -} +export const syncAttendanceRefer = (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()); +}; //数据采集-考勤引用-查看考勤数据 -export const getAttendanceDetail = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/view', 'get', params); -} +export const getAttendanceDetail = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/view", "get", params); +}; //数据采集-考勤引用-删除考勤数据 -export const deleteAttendance = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/delete', 'POST', params); -} +export const deleteAttendance = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/delete", + "POST", + params + ); +}; //数据采集-考勤引用-导出考勤数据 -export const exportAttendance = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/export', 'POST', params); -} +export const exportAttendance = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/export", + "POST", + params + ); +}; //数据采集- 考勤应用-导出模版+全量数据 -export const exportForTemplate = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/exportForTemplate', 'POST', params); -} +export const exportForTemplate = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/exportForTemplate", + "POST", + params + ); +}; //数据采集-考勤引用-考勤字段管理列表 -export const getAttendanceFieldList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const getAttendanceFieldList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-获取考勤字段表单 -export const getAttendanceFieldForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getFieldForm', 'get', params); -} +export const getAttendanceFieldForm = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getFieldForm", + "get", + params + ); +}; //数据采集-考勤引用-新建考勤字段 -export const saveAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/saveField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const saveAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/saveField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-修改考勤字段 -export const updateAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/updateField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const updateAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/updateField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-启用/停用自定义字段 -export const updateAttendanceFieldStatus = params => { - return fetch('/api/bs/hrmsalary/attendQuote/updateEnableStatus', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const updateAttendanceFieldStatus = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/updateEnableStatus", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-删除考勤字段 -export const deleteAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/deleteField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const deleteAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/deleteField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-列表 -export const getAttendanceFieldSettingList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getAttendanceFieldSettingList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-保存 -export const saveAttendanceFieldSetting = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const saveAttendanceFieldSetting = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 -export const returnToAttendanceFieldSettingDefault = 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 returnToAttendanceFieldSettingDefault = (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 fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/saveAsDefault', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const saveAttendanceFieldSettingAsDefault = (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()); +}; // 考勤导入模板下载 export const downloadTemplate = (salaryYearMonth, salarySobId) => { - // /api/bs/hrmsalary/attendQuote/downloadTemplate - fetch('/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=' + salaryYearMonth + "&salarySobId=" + salarySobId).then(res => res.blob().then(blob => { - var filename=`考勤导入模板.xlsx` - var a = document.createElement('a'); - var url = window.URL.createObjectURL(blob); - a.href = url; - a.download = filename; - a.click(); - window.URL.revokeObjectURL(url); - })) -} + // /api/bs/hrmsalary/attendQuote/downloadTemplate + fetch( + "/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=" + + salaryYearMonth + + "&salarySobId=" + + salarySobId + ).then((res) => + res.blob().then((blob) => { + var filename = `考勤导入模板.xlsx`; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + }) + ); +}; // 考勤导入预览 export const previewAttendQuote = (params) => { - return fetch('/api/bs/hrmsalary/attendQuote/preview', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/preview", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 考勤数据导入 export const importAttendQuoteData = (params) => { - return fetch('/api/bs/hrmsalary/attendQuote/importAttendQuoteData', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/importAttendQuoteData", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; -// 查看考勤详情 +// 查看考勤详情 export const viewAttendQuote = (ids) => { - return fetch('/api/bs/hrmsalary/attendQuote/view', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(ids) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/view", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(ids), + }).then((res) => res.json()); +}; // 根据所属月和账套获取周期 export const getSalaryCycleAndAttendCycle = (params) => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle', 'get', params); - -} + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", + "get", + params + ); +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js index 63f67d6b..31373dc9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js @@ -50,12 +50,23 @@ export default class RefereAttendFormModal extends React.Component { // 同步点击回调 handleSync() { - const { attendanceStore: {syncAttendanceRefer}} = this.props + const { attendanceStore: {syncAttendanceRefer, checkOperation}} = this.props if(!this.validate()) { return } - syncAttendanceRefer(this.state.request).then(() => { - this.props.onCancel() + const { salarySobId, salaryYearMonth:salaryYearMonthStr }=this.state.request + const payload={ + salaryYearMonthStr, + salarySobId + } + checkOperation(payload).then(({status, data, errorMsg})=>{ + if(status && data){ + syncAttendanceRefer(this.state.request).then(() => { + this.props.onCancel() + }) + }else{ + message.warning('已经核算过不可操作'); + } }) } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 994c1168..1076750b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -405,9 +405,21 @@ export default class CumDeduct extends React.Component { showSizeChanger: true, onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, onChange(current) { setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, }; const rowSelection = { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index b3e6a754..1bfc725d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -407,9 +407,21 @@ export default class CumSituation extends React.Component { showSizeChanger: true, onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, onChange(current) { setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, }; const rowSelection = { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index b78e9c6e..3d0a49f0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -406,9 +406,21 @@ export default class OtherDeduct extends React.Component { showSizeChanger: true, onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, onChange(current) { setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); }, }; diff --git a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js index 2e74c9a8..7591af61 100644 --- a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js +++ b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js @@ -1,134 +1,181 @@ -import React from 'react' -import { Modal, Button, Row, Col, Radio } from 'antd' -import { WeaSelect, WeaBrowser } from "ecCom" -import { inject, observer } from 'mobx-react'; -import RequiredLabelTip from '../../components/requiredLabelTip'; +import React from "react"; +import { Modal, Button, Row, Col, Radio } from "antd"; +import { WeaSelect, WeaBrowser } from "ecCom"; +import { inject, observer } from "mobx-react"; +import RequiredLabelTip from "../../components/requiredLabelTip"; const objectOptions = [ - { - key: "EMPLOYEE", - showname: "人员", - selected: false - }, - { - key: "DEPT", - showname: "部门", - selected: false - }, - { - key: "POSITION", - showname: "岗位", - selected: false - } - -] + { + key: "EMPLOYEE", + showname: "人员", + selected: false, + }, + { + key: "SUBCOMPANY", + showname: "分部", + selected: false, + }, + { + key: "DEPT", + showname: "部门", + selected: false, + }, + { + key: "POSITION", + showname: "岗位", + selected: false, + }, +]; -@inject('ledgerStore') +@inject("ledgerStore") @observer export default class AddUserModal extends React.Component { - constructor(props) { - super(props) - this.state = { - selectedKey: "EMPLOYEE", - radioValue: "ALL", - ids: "" - } - } + constructor(props) { + super(props); + this.state = { + selectedKey: "EMPLOYEE", + radioValue: "ALL", + ids: "", + }; + } - onRadioChange(e) { - this.setState({radioValue: e.target.value}) - } + onRadioChange(e) { + this.setState({ radioValue: e.target.value }); + } - // 保存 - handleSave() { - const { ledgerStore: {saveLedgerPersonRange, salarySobId, includeType} } = this.props; - saveLedgerPersonRange({ - salarySobId: salarySobId, - includeType: includeType, - employeeStatus: this.state.radioValue, - targetParams: this.state.ids.split(",").map(id => ({targetType: this.state.selectedKey, targetId: id})) - }) - } + // 保存 + handleSave() { + const { + ledgerStore: { saveLedgerPersonRange, salarySobId, includeType }, + } = this.props; + saveLedgerPersonRange({ + salarySobId: salarySobId, + includeType: includeType, + employeeStatus: this.state.radioValue, + targetParams: this.state.ids + .split(",") + .map((id) => ({ targetType: this.state.selectedKey, targetId: id })), + }); + } - // 重置 - handleReset() { - this.setState({ - selectedKey: "EMPLOYEE", - radioValue: "ALL", - ids: "" - }) - } + // 重置 + handleReset() { + this.setState({ + selectedKey: "EMPLOYEE", + radioValue: "ALL", + ids: "", + }); + } - render() { - return ( - {this.props.onCancel()}} width={600} - title="关联人员" - footer={ -
- - -
- } - > -
- - 对象类型 - -
- { - this.setState({selectedKey: value, ids: ""}) - }}/> -
-
- { - this.state.selectedKey == "EMPLOYEE" && { - this.setState({ids}) - }} - /> - } - { - this.state.selectedKey == "DEPT" && { - this.setState({ids}) - }} - /> - } - { - this.state.selectedKey == "POSITION" && { - this.setState({ids}) - }} - /> - } -
- -
- - 选择员工状态 - - this.onRadioChange(e)} value={this.state.radioValue}> - 全部 - 在职 - 离职 - - - -
- -
- ) - } -} \ No newline at end of file + render() { + return ( + { + this.props.onCancel(); + }} + width={600} + title="关联人员" + footer={ +
+ + +
+ }> +
+ + + 对象类型 + + + +
+ { + this.setState({ selectedKey: value, ids: "" }); + }} + /> +
+
+ {this.state.selectedKey == "EMPLOYEE" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "DEPT" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "SUBCOMPANY" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "POSITION" && ( + { + this.setState({ ids }); + }} + /> + )} +
+ +
+ + + 选择员工状态 + + + + this.onRadioChange(e)} + value={this.state.radioValue}> + 全部 + 在职 + 离职 + + + +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js index 8dc84b74..2326ade3 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.js +++ b/pc4mobx/hrmSalary/pages/ledger/index.js @@ -577,7 +577,7 @@ export default class Ledger extends React.Component { { title: "薪资项目", key: 2 }, { title: "调薪计薪规则", key: 3 }, ]} - editable={canEdit !== "true"} + editable={canEdit === "true"} selectedTab={selectedTab} onSave={() => this.handleEditSlideSave()} subItemChange={(item) => { diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index 821a7b4a..a50f5798 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -1,32 +1,49 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; -import { Button, Table, DatePicker, Dropdown, Menu, message } from 'antd'; +import { + Button, + Table, + DatePicker, + Dropdown, + Menu, + message, + Modal, +} from "antd"; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable, - WeaInputSearch, WeaSlideModal, WeaCheckbox, WeaHelpfulTip } from 'ecCom'; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaTable, + WeaInputSearch, + WeaSlideModal, + WeaCheckbox, + WeaHelpfulTip, +} from "ecCom"; -import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../components/customTab'; -import ContentWrapper from '../../components/contentWrapper'; +import { renderNoright, getSearchs } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../components/customTab"; +import ContentWrapper from "../../components/contentWrapper"; -import { columns, dataSource } from './columns'; +import { columns, dataSource } from "./columns"; -import ChangeSalaryModal from "./changeSalaryModal" -import EditAgentModal from './editAgentModal'; -import SlideModalTitle from '../../components/slideModalTitle' -import SlideSalaryItem from './slideSalaryItem' -import SlideAgent from './slideAgent' -import ImportModal from '../../components/importModal' -import SalaryFileViewSlide from './saralyFileViewSlide' +import ChangeSalaryModal from "./changeSalaryModal"; +import EditAgentModal from "./editAgentModal"; +import SlideModalTitle from "../../components/slideModalTitle"; +import SlideSalaryItem from "./slideSalaryItem"; +import SlideAgent from "./slideAgent"; +import ImportModal from "../../components/importModal"; +import SalaryFileViewSlide from "./saralyFileViewSlide"; const { MonthPicker } = DatePicker; -import "./index.less" -import CustomTable from '../../components/customTable'; +import "./index.less"; +import CustomTable from "../../components/customTable"; -@inject('salaryFileStore') +@inject("salaryFileStore") @observer export default class SalaryFile extends React.Component { constructor(props) { @@ -45,203 +62,269 @@ export default class SalaryFile extends React.Component { selectedRowKeys: [], showSearchBar: false, importResult: {}, - searchValue: "" - } + searchValue: "", + }; } componentWillMount() { - const { salaryFileStore: {doInit} } = this.props; + const { + salaryFileStore: { doInit }, + } = this.props; doInit(); } // 设置导入步数 setStep(step) { - this.setState({step}) + this.setState({ step }); } // 渲染导入模板附加元素 renderFormComponent() { return ( -
+
+ width={200} + title="提示:建议先导出现有最新数据,修改后再导入" + placement="topLeft" + />
- ) + ); } - // 导入预览 handlePreviewImport(params) { - const { salaryFileStore: {importPreview}} = this.props; + const { + salaryFileStore: { importPreview }, + } = this.props; params.importType = this.state.importType; - importPreview(params) + importPreview(params); } // 导入档案 handleImportFile(params) { - const { salaryFileStore: {importSalaryArchive}} = this.props; - params.importType = this.state.importType - importSalaryArchive(params).then(data => { - data.errorData = data.errorNotice + const { + salaryFileStore: { importSalaryArchive }, + } = this.props; + params.importType = this.state.importType; + importSalaryArchive(params).then((data) => { + data.errorData = data.errorNotice; this.setState({ - importResult: data - }) - }) + importResult: data, + }); + }); } - // 导入完成按钮操作 handleImportFinish() { - this.setState({modalVisiable: false, step: 0}) + this.setState({ modalVisiable: false, step: 0 }); } // 导出全部 handleExportAll() { - const { salaryFileStore: {exportSalaryArchive}} = this.props; + const { + salaryFileStore: { exportSalaryArchive }, + } = this.props; exportSalaryArchive(); } // 定制列 getColumns() { - const { salaryFileStore: {tableStore}} = this.props; - return tableStore.columns.filter(item => item.display == "true").map(item => { - item.width = item.oldWidth - if(item.dataIndex == "operate") { - item.render = (text, record) => ( - this.handleEdit(record)}>查看 - ) - item.fixed = 'right' - } else if(item.dataIndex == "username"){ - item.fixed = 'left' - } - return item - }) + const { + salaryFileStore: { tableStore }, + } = this.props; + return tableStore.columns + .filter((item) => item.display == "true") + .map((item) => { + item.width = item.oldWidth; + if (item.dataIndex == "operate") { + item.render = (text, record) => ( + this.handleEdit(record)}>查看 + ); + item.fixed = "right"; + } else if (item.dataIndex == "username") { + item.fixed = "left"; + } + return item; + }); } // 编辑行 handleEdit(record) { - this.setState({editSlideVisible: true}) - const { salaryFileStore: {setCurrentId}} = this.props; - setCurrentId(record.id) + this.setState({ editSlideVisible: true }); + const { + salaryFileStore: { setCurrentId }, + } = this.props; + setCurrentId(record.id); } // 显示调整个税扣缴义务人表单 handSildeOptionMenuClick(e) { - const { salaryFileStore: {setEditAgentVisible}} = this.props; - setEditAgentVisible(true) + const { + salaryFileStore: { setEditAgentVisible }, + } = this.props; + setEditAgentVisible(true); } // 查看 Slide 头部操作按钮 renderEditSlideOperate() { - return
- - 调整个税扣缴义务人 - - } onClick={() => {this.setState({changeSalaryVisible: true})}}>调薪 + return ( +
+ + 调整个税扣缴义务人 + + } + onClick={() => { + this.setState({ changeSalaryVisible: true }); + }}> + 调薪 +
+ ); } // table选中条目 - onSelectChange = selectedRowKeys => { + onSelectChange = (selectedRowKeys) => { this.setState({ selectedRowKeys }); }; // 显示影响搜索面板 handleShowSearchBar = () => { this.setState({ - showSearchBar: !this.state.showSearchBar - }) - } + showSearchBar: !this.state.showSearchBar, + }); + }; // 页面跳转 handlePageChange = (value) => { - const { salaryFileStore: {getTableDatas, form}} = this.props; - getTableDatas({ current: value }) - } - + const { + salaryFileStore: { getTableDatas, form }, + } = this.props; + getTableDatas({ current: value }); + }; + // 搜索 handleSearch(value) { - const { salaryFileStore: {getTableDatas, form}} = this.props; - getTableDatas({username: value}) + const { + salaryFileStore: { getTableDatas, form }, + } = this.props; + getTableDatas({ username: value }); } // 初始化导入参数 handleInitModal() { - const { salaryFileStore: { setPreviewDataSource } } = this.props; - setPreviewDataSource([]) + const { + salaryFileStore: { setPreviewDataSource }, + } = this.props; + setPreviewDataSource([]); this.setState({ - importResult: {} - }) + importResult: {}, + }); } render() { const { salaryFileStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryFileStore; - const { importType, previewColumns, previewDataSource, dataSource, currentId, editAgentVisible, setEditAgentVisible, pageInfo } = salaryFileStore; - + const { + loading, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + } = salaryFileStore; + const { + importType, + previewColumns, + previewDataSource, + dataSource, + currentId, + editAgentVisible, + setEditAgentVisible, + pageInfo, + } = salaryFileStore; + const { selectedTab, step, selectedRowKeys } = this.state; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn + const rightMenu = [ + // 右键菜单 + { + key: "BTN_COLUMN", + icon: , + content: "显示列定制", + onClick: this.showColumn, }, ]; - const collectParams = { // 收藏功能配置 - favname: '薪资档案', + const collectParams = { + // 收藏功能配置 + favname: "薪资档案", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', + link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; - const renderSearchOperationItem = () => { - - } + const renderSearchOperationItem = () => {}; const handleMenuClick = (e) => { - this.setState({importType: e.key, modalVisiable: true, step: 0}) - } + const { key } = e; + if (key === "init") { + Modal.confirm({ + title: "信息确认", + content: `若导入表格中的人员已存在在薪资档案中,初始化导入会将档案中该人员的数据清除再导入,点击确定继续导入`, + onOk: () => { + this.setState({ importType: e.key, modalVisiable: true, step: 0 }); + }, + onCancel() {}, + }); + } else { + this.setState({ importType: e.key, modalVisiable: true, step: 0 }); + } + }; const handleMenuClick2 = () => { const { electedRowKeys } = this.state; - if(selectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; } - const { salaryFileStore: {exportSalaryArchive}} = this.props; - exportSalaryArchive(selectedRowKeys.join(",")) - } + const { + salaryFileStore: { exportSalaryArchive }, + } = this.props; + exportSalaryArchive(selectedRowKeys.join(",")); + }; const menu = ( - { - importType.map(item => ( - {item.content} - )) - } + {importType.map((item) => ( + {item.content} + ))} ); - const menu2 = ( 导出所选 @@ -249,53 +332,82 @@ export default class SalaryFile extends React.Component { ); const renderRightOperation = () => { - return ( -
- + - 导入 - {this.handleExportAll()}}>导出全部 - - {this.setState({ - searchValue: value - })}} onSearch={(value) => {this.handleSearch(value)}}/> - {/* */} -
- ) - } + placement="topLeft" + /> + + 导入 + + { + this.handleExportAll(); + }}> + 导出全部 + + + { + this.setState({ + searchValue: value, + }); + }} + onSearch={(value) => { + this.handleSearch(value); + }} + /> + {/* */} +
+ ); + }; - const handleSlideMoreMenuClick = () => { - - } + const handleSlideMoreMenuClick = () => {}; const slideMoreMenu = ( 导出全部 ); - + const renderCustomOperate = () => { return ( -
- 导出 +
+ + 导出 +
- ) - } + ); + }; const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange, + selectedRowKeys, + onChange: this.onSelectChange, }; return ( @@ -306,39 +418,35 @@ export default class SalaryFile extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 > - - + {this.handlePageChange(value)}, + onChange: (value) => { + this.handlePageChange(value); + }, total: pageInfo.total, showTotal: (total) => `共 ${total} 条`, - current: pageInfo.pageNum + current: pageInfo.pageNum, }} - scroll={{x: 2300}} + scroll={{ x: 2300 }} /> - - { - this.state.modalVisiable && - { - this.handleInitModal() + this.handleInitModal(); }} params={{}} columns={previewColumns} @@ -346,89 +454,110 @@ export default class SalaryFile extends React.Component { setStep={this.setStep.bind(this)} slideDataSource={previewDataSource} importResult={this.state.importResult} - onFinish={() => {this.handleImportFinish()}} - previewImport={(params) => { - this.handlePreviewImport(params) + onFinish={() => { + this.handleImportFinish(); + }} + previewImport={(params) => { + this.handlePreviewImport(params); + }} + importFile={(params) => { + this.handleImportFile(params); + }} + templateLink={ + "/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + + this.state.importType + } + renderFormComponent={() => { + this.renderFormComponent(); + }} + visiable={this.state.modalVisiable} + onCancel={() => { + this.setState({ modalVisiable: false }); }} - importFile={(params) => {this.handleImportFile(params)}} - templateLink={"/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + this.state.importType} - renderFormComponent={() => {this.renderFormComponent()}} - visiable={this.state.modalVisiable} - onCancel={() => { this.setState({modalVisiable: false})}} /> - } - { - this.state.changeSalaryVisible && {this.setState({changeSalaryVisible: false})}} + onCancel={() => { + this.setState({ changeSalaryVisible: false }); + }} /> - } + )} - { - editAgentVisible && {setEditAgentVisible(false)}} + onCancel={() => { + setEditAgentVisible(false); + }} /> - } + )} {/* 操作记录 */} - { - this.state.recordSlideVisible && - {renderCustomOperate()}} - subItemChange={ - (item) => {this.setState({selectedTab: item.key})} - } - /> - } - content={
- { - selectedTab == 0 && - } - { - selectedTab == 1 && - } -
} - onClose={() => this.setState({recordSlideVisible: false})} - showMask={true} - closeMaskOnClick={() => this.setState({recordSlideVisible: false})} /> - } + {this.state.recordSlideVisible && ( + { + renderCustomOperate(); + }} + subItemChange={(item) => { + this.setState({ selectedTab: item.key }); + }} + /> + } + content={ +
+ {selectedTab == 0 && } + {selectedTab == 1 && } +
+ } + onClose={() => this.setState({ recordSlideVisible: false })} + showMask={true} + closeMaskOnClick={() => + this.setState({ recordSlideVisible: false }) + } + /> + )} - { - this.state.editSlideVisible && - - } - content={} - onClose={() => this.setState({editSlideVisible: false})} - showMask={true} - closeMaskOnClick={() => this.setState({editSlideVisible: false})} /> - } - + {this.state.editSlideVisible && ( + + } + content={} + onClose={() => this.setState({ editSlideVisible: false })} + showMask={true} + closeMaskOnClick={() => this.setState({ editSlideVisible: false })} + /> + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js index d41b4e7d..a311613e 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js @@ -107,6 +107,17 @@ export default class AddTaxAgentModal extends React.Component { }} /> )} + {this.state.selectedKey == "SUBCOMPANY" && ( + { + this.setState({ ids }); + }} + /> + )} {this.state.selectedKey == "POSITION" && ( { this.previewAttendQuoteColumns = previewAttendQuoteColumns; - } + }; @action setPreviewAttendQuoteDataSource = (previewAttendQuoteDataSource) => { - this.previewAttendQuoteDataSource = previewAttendQuoteDataSource - } + this.previewAttendQuoteDataSource = previewAttendQuoteDataSource; + }; @action setImportResult = (importResult) => { - this.importResult = importResult - } - // ** 设置导入参数 end ** - + this.importResult = importResult; + }; + // ** 设置导入参数 end ** @action searchFieldSettingList = (value) => { - if(value != "") { + if (value != "") { let requestFeildAttendList = [...this.requestFeildAttendList]; - this.fieldSettingAttendList = requestFeildAttendList.filter(item => item.name.indexOf(value) > -1) - let requestFeildCustomList = [...this.requestFeildCustomList] - this.fieldSettingCustomList = requestFeildCustomList.filter(item => item.name.indexOf(value) > -1) + this.fieldSettingAttendList = requestFeildAttendList.filter( + (item) => item.name.indexOf(value) > -1 + ); + let requestFeildCustomList = [...this.requestFeildCustomList]; + this.fieldSettingCustomList = requestFeildCustomList.filter( + (item) => item.name.indexOf(value) > -1 + ); } else { this.fieldSettingAttendList = [...this.requestFeildAttendList]; this.fieldSettingCustomList = [...this.requestFeildCustomList]; } - - } + }; @action - setFieldSettingAttendList = fieldSettingAttendList => - { - this.fieldSettingAttendList = fieldSettingAttendList - let requestFeildAttendList = [...this.requestFeildAttendList] - requestFeildAttendList.map(item => { - this.fieldSettingAttendList.map(inner => { - - if(inner.id == item.id && inner.checked != item.checked) { - item.checked = inner.checked + setFieldSettingAttendList = (fieldSettingAttendList) => { + this.fieldSettingAttendList = fieldSettingAttendList; + let requestFeildAttendList = [...this.requestFeildAttendList]; + requestFeildAttendList.map((item) => { + this.fieldSettingAttendList.map((inner) => { + if (inner.id == item.id && inner.checked != item.checked) { + item.checked = inner.checked; } - }) - }) + }); + }); this.requestFeildAttendList = requestFeildAttendList; - } + }; @action - setFieldSettingCustomList = fieldSettingCustomList => - { - this.fieldSettingCustomList = fieldSettingCustomList - let requestFeildCustomList = [...this.requestFeildCustomList] - requestFeildCustomList.map(item => { - this.fieldSettingCustomList.map(inner => { - if(inner.id == item.id && inner.checked != item.checked) { - item.checked = inner.checked + setFieldSettingCustomList = (fieldSettingCustomList) => { + this.fieldSettingCustomList = fieldSettingCustomList; + let requestFeildCustomList = [...this.requestFeildCustomList]; + requestFeildCustomList.map((item) => { + this.fieldSettingCustomList.map((inner) => { + if (inner.id == item.id && inner.checked != item.checked) { + item.checked = inner.checked; } - }) - }) - } + }); + }); + }; @action - setCurrentItem = currentItem => this.currentItem = currentItem; + setCurrentItem = (currentItem) => (this.currentItem = currentItem); @action - setCurrentItemOperate = currentItemOperate => this.currentItemOperate = currentItemOperate; + setCurrentItemOperate = (currentItemOperate) => + (this.currentItemOperate = currentItemOperate); @action - setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + setSlideVisiable = (slideVisiable) => (this.slideVisiable = slideVisiable); @action - setStep = step => this.step = step + setStep = (step) => (this.step = step); @action - setModalVisiable = modalVisiable => this.modalVisiable = modalVisiable - + setModalVisiable = (modalVisiable) => (this.modalVisiable = modalVisiable); + // 初始化操作 @action doInit = () => { // this.getCondition(); // this.getTableDatas(); - this.getAttendanceList({}) + this.getAttendanceList({}); // this.getAttendanceFieldSettingList({sourceType:'IMPORT'}) - } + }; // 获得高级搜索表单数据 @action getCondition = () => { - API.getCondition().then(action(res => { - if (res.api_status) { // 接口请求成功/失败处理 - this.condition = res.condition; - this.form.initFormFields(res.condition); // 渲染高级搜索form表单 - } else { - message.error(res.errormsg || '接口调用失败!') - } - })); - } + API.getCondition().then( + action((res) => { + if (res.api_status) { + // 接口请求成功/失败处理 + this.condition = res.condition; + this.form.initFormFields(res.condition); // 渲染高级搜索form表单 + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 渲染table数据 @action @@ -153,298 +156,318 @@ export class AttendanceStore { this.loading = true; const formParams = this.form.getFormParams() || {}; params = params || formParams; - API.getTableDatas(params).then(action(res => { - if (res.api_status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.datas); // table 请求数据 - this.hasRight = res.hasRight; - } else { - message.error(res.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + API.getTableDatas(params).then( + action((res) => { + if (res.api_status) { + // 接口请求成功/失败处理 + this.tableStore.getDatas(res.datas); // table 请求数据 + this.hasRight = res.hasRight; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + this.loading = false; + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 字段列表 @action getAttendanceFieldList = (params) => { this.loading = true; - API.getAttendanceFieldList(params).then(res => { - if (res.status) { // 接口请求成功/失败处理 + API.getAttendanceFieldList(params).then((res) => { + if (res.status) { + // 接口请求成功/失败处理 this.fieldTableStore.getDatas(res.data.dataKey.datas); // table 请求数据 - this.fieldDataSource = res.data.pageInfo.list - this.fieldPageInfo = res.data.pageInfo + this.fieldDataSource = res.data.pageInfo.list; + this.fieldPageInfo = res.data.pageInfo; } else { - message.error(res.errormsg || '接口调用失败!') + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - } + }); + }; @action saveAttendanceField = (params) => { - API.saveAttendanceField(params).then(res => { - if(res.status) { - message.success("保存成功") + API.saveAttendanceField(params).then((res) => { + if (res.status) { + message.success("保存成功"); } else { - message.error(res.errormsg ||"保存失败") + message.error(res.errormsg || "保存失败"); } - }) - } + }); + }; @action deleteAttendanceField = (params) => { - API.deleteAttendanceField(params).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteAttendanceField(params).then((res) => { + if (res.status) { + message.success("删除成功"); } else { - message.error(res.errormsg ||"删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 批量删除 @action doBatchDelete = () => { - let ids = toJS(this.tableStore.selectedRowKeys) - if(ids.length == 0) { + let ids = toJS(this.tableStore.selectedRowKeys); + if (ids.length == 0) { message.warning("未选择任何条目"); - return + return; } - API.deleteAttendanceField(this.tableStore.selectedRowKeys).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteAttendanceField(this.tableStore.selectedRowKeys).then((res) => { + if (res.status) { + message.success("删除成功"); } else { - message.error(res.errormsg || "删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 更新 @action updateAttendanceField = (params) => { - API.updateAttendanceField(params).then(res => { - if(res.status) { - message.success("修改成功") + API.updateAttendanceField(params).then((res) => { + if (res.status) { + message.success("修改成功"); } else { - message.error(res.errormsg || "修改失败") + message.error(res.errormsg || "修改失败"); } - }) - } + }); + }; // 更新状态 @action updateAttendanceFieldStatus = (params) => { - return API.updateAttendanceFieldStatus(params).then(res => { - if(res.status) { + return API.updateAttendanceFieldStatus(params).then((res) => { + if (res.status) { message.success("修改成功"); return new Promise((resolve, reject) => { resolve(true); - }) + }); } else { - message.error( res.errormsg || "修改失败") + message.error(res.errormsg || "修改失败"); return new Promise((resolve, reject) => { resolve(false); - }) + }); } - }) - } + }); + }; // 考勤数据列表 @action getAttendanceList = (params) => { this.loading = true; - API.getAttendanceList(params).then(res => { - if (res.status) { // 接口请求成功/失败处理 + API.getAttendanceList(params).then((res) => { + if (res.status) { + // 接口请求成功/失败处理 // this.attendTableStore.getDatas(res.data.datas); // table 请求数据 this.attendanceDataSource = res.data.list; this.attendancePageInfo = res.data; - this.attendanceColumns = res.data.columns + this.attendanceColumns = res.data.columns; } else { - message.error(res.errormsg || '接口调用失败!') + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - } + }); + }; //数据采集-考勤引用-考勤引用字段设置-列表 @action getAttendanceFieldSettingList = (params) => { this.loading = true; - API.getAttendanceFieldSettingList(params).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 : [] + API.getAttendanceFieldSettingList(params).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(res.errormsg || "接口调用失败!") + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - - } + }); + }; //数据采集-考勤引用-考勤引用字段设置-保存 - @action + @action saveAttendanceFieldSetting = (sourceType = "IMPORT") => { - 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 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: sourceType, - currentSettingFields: [...attendList, ...customList] - } - API.saveAttendanceFieldSetting(request).then(res => { - if(res.status) { - message.success("保存成功") + currentSettingFields: [...attendList, ...customList], + }; + API.saveAttendanceFieldSetting(request).then((res) => { + if (res.status) { + message.success("保存成功"); } else { - message.error(res.errormsg || "保存失败") + message.error(res.errormsg || "保存失败"); } - }) - } - + }); + }; //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 @action returnToAttendanceFieldSettingDefault = (sourceType = "IMPORT") => { - API.returnToAttendanceFieldSettingDefault({sourceType: sourceType}).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(res.errormsg || "获取数据失败") + API.returnToAttendanceFieldSettingDefault({ sourceType: sourceType }).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(res.errormsg || "获取数据失败"); + } } - }) - } + ); + }; //数据采集-考勤引用-考勤引用字段设置-设为默认设置 @action saveAttendanceFieldSettingAsDefault = (sourceType = "IMPORT") => { - - 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 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:sourceType, - currentSettingFields: [...attendList, ...customList] - } - API.saveAttendanceFieldSettingAsDefault(request).then(res => { - if(res.status) { - message.success("设置成功") + sourceType: sourceType, + currentSettingFields: [...attendList, ...customList], + }; + API.saveAttendanceFieldSettingAsDefault(request).then((res) => { + if (res.status) { + message.success("设置成功"); } else { - message.error( res.errormsg || "设置失败") + message.error(res.errormsg || "设置失败"); } - }) - } + }); + }; // 导入表单-账套列表 @action getLedgerList = () => { return new Promise((resolve, reject) => { - API.getLedgerList({}).then(res => { - if(res.status) { - this.importLedgerList = res.data - resolve(this.importLedgerList) + API.getLedgerList({}).then((res) => { + if (res.status) { + this.importLedgerList = res.data; + resolve(this.importLedgerList); } else { - message.error(res.errormsg || "获取失败") - reject() + message.error(res.errormsg || "获取失败"); + reject(); } - }) - }) - - } + }); + }); + }; // 下载导入模板 @action downloadTemplate = (salaryYearMonth, salarySobId) => { - API.downloadTemplate(salaryYearMonth, salarySobId) - } + API.downloadTemplate(salaryYearMonth, salarySobId); + }; // 导入预览 @action previewAttendQuote = (params) => { - API.previewAttendQuote(params).then(res => { - if(res.status) { - this.previewAttendQuoteList = res.data + API.previewAttendQuote(params).then((res) => { + if (res.status) { + this.previewAttendQuoteList = res.data; this.previewAttendQuoteColumns = res.data.headers.map((item, index) => { - let column = {} - column.title = item; + let column = {}; + column.title = item; column.dataIndex = "" + index; - column.key = index + "" - return column - }) + column.key = index + ""; + return column; + }); this.previewAttendQuoteDataSource = res.data.list.map((item) => { - let data = {} + let data = {}; item.map((i, index) => { - data[index + ''] = i - }) - return data - }) - + data[index + ""] = i; + }); + return data; + }); } else { message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 考勤导入 @action importAttendQuoteData = (params) => { - API.importAttendQuoteData(params).then(res => { - if(res.status) { - this.importResult = res.data + API.importAttendQuoteData(params).then((res) => { + if (res.status) { + this.importResult = res.data; } else { - message.error(res.errormsg || "导入失败") + message.error(res.errormsg || "导入失败"); } - }) - } - + }); + }; + // 考勤数据详情 @action viewAttendQuote = (params = {}) => { - API.viewAttendQuote(params).then(res => { - if(res.status) { - this.attendQuoteDetailPageInfo = res.data.pageInfo - this.attendQuoteDetailTableStore.getDatas(res.data.dataKey.datas) + API.viewAttendQuote(params).then((res) => { + if (res.status) { + this.attendQuoteDetailPageInfo = res.data.pageInfo; + this.attendQuoteDetailTableStore.getDatas(res.data.dataKey.datas); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 考勤引用同步 @action syncAttendanceRefer = (params) => { return new Promise((resolve, reject) => { - API.syncAttendanceRefer(params).then(res => { - if(res.status) { - message.success("同步成功") - resolve() + API.syncAttendanceRefer(params).then((res) => { + if (res.status) { + message.success("同步成功"); + resolve(); } else { - message.error(res.errormsg || "同步失败") + message.error(res.errormsg || "同步失败"); reject(); } - }) - }) - } + }); + }); + }; + // 考勤引用同步 + @action + checkOperation = (params) => { + return API.checkOperation(params); + }; // 根据所属月和账套获取周期 @action getSalaryCycleAndAttendCycle = (salaryYearMonthStr, salarySobId) => { - API.getSalaryCycleAndAttendCycle({salaryYearMonthStr, salarySobId}).then(res => { - if(res.status) { - this.cycle = res.data - } else { - message.error(res.errormsg || "获取失败") + API.getSalaryCycleAndAttendCycle({ salaryYearMonthStr, salarySobId }).then( + (res) => { + if (res.status) { + this.cycle = res.data; + } else { + message.error(res.errormsg || "获取失败"); + } } - - }) - } -} \ No newline at end of file + ); + }; +} diff --git a/pc4mobx/hrmSalary/style/index.less b/pc4mobx/hrmSalary/style/index.less index 92ab7c56..57689171 100644 --- a/pc4mobx/hrmSalary/style/index.less +++ b/pc4mobx/hrmSalary/style/index.less @@ -5,6 +5,7 @@ position: relative; height: 100%; text-align: center; + >div { position: absolute; top: 50%; @@ -29,3 +30,7 @@ overflow: hidden; } + +.ant-checkbox-wrapper+.ant-checkbox-wrapper { + margin-left: 0 !important; +} \ No newline at end of file