diff --git a/pc4mobx/hrmSalary/apis/archive.js b/pc4mobx/hrmSalary/apis/archive.js index c2299b92..5ce04a25 100644 --- a/pc4mobx/hrmSalary/apis/archive.js +++ b/pc4mobx/hrmSalary/apis/archive.js @@ -261,3 +261,33 @@ export const stopSalary = (params) => { export const getSalaryItemFormByItemId = (params) => { return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/getSalaryItemFormBySalaryArchiveItemId', 'GET', params); } +// 删除薪资项目调薪 +export const deleteSalaryItem = (params) => { + return fetch(`/api/bs/hrmsalary/salaryArchive/deleteSalaryItem?salaryArchiveItemId=${params.salaryArchiveItemId}`, { + method: 'GET', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + }).then(res => res.json()) +} +export const getSingleSalaryItemInfo = (params) => { + return fetch('/api/bs/hrmsalary/salaryArchive/adjustRecord/getSingleSalaryItemInfo', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} +export const editSingleSalaryItem = (params) => { + return fetch('/api/bs/hrmsalary/salaryArchive/adjustRecord/editSingleSalaryItem', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} diff --git a/pc4mobx/hrmSalary/components/selectedTab/index.js b/pc4mobx/hrmSalary/components/selectedTab/index.js index 189736d3..8090c23c 100644 --- a/pc4mobx/hrmSalary/components/selectedTab/index.js +++ b/pc4mobx/hrmSalary/components/selectedTab/index.js @@ -1,33 +1,35 @@ -import React from 'react' -import './index.less' +import React from "react"; +import "./index.less"; export default class SelectedTab extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedKey: "0" - } - } + constructor(props) { + super(props); + this.state = { + selectedKey: "0" + }; + } - handleChange(item) { - this.setState({ - selectedKey: item.key - }) - this.props.onChange(item) - } - render() { - return ( -
- { - this.props.items.map(item => ( -
{ -this.handleChange(item) -}}> - {item.name} -
- )) - } + handleChange(item) { + this.setState({ + selectedKey: item.key + }); + this.props.onChange(item); + } + + render() { + return ( +
+ { + this.props.items.map(item => ( +
{ + this.handleChange(item); + }}> + {item.name}
- ) - } -} \ No newline at end of file + )) + } +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 10ffaca1..626b9ca2 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -8,13 +8,12 @@ import StandingBook from "./pages/socialSecurityBenefits/standingBook"; import StandingBookDetail from "./pages/socialSecurityBenefits/standingBookDetail"; import StandingBookOfflineComparison from "./pages/socialSecurityBenefits/standingBookOfflineComparison"; import SalaryItem from "./pages/salaryItem"; -import SalaryFile from "./pages/salaryFile"; import PayrollFiles from "./pages/payrollFiles"; import CumDeduct from "./pages/dataAcquisition/cumDeduct"; import OtherDeduct from "./pages/dataAcquisition/otherDeduct"; import CumSituation from "./pages/dataAcquisition/cumSituation"; import Attendance from "./pages/dataAcquisition/attendance"; -import SpecialAddDeduction from './pages/dataAcquisition/specialAddDeduction'; +import SpecialAddDeduction from "./pages/dataAcquisition/specialAddDeduction"; import Ledger from "./pages/ledger"; import Calculate from "./pages/calculate"; import Payroll from "./pages/payroll"; @@ -28,10 +27,10 @@ import PlaceOnFileDetail from "./pages/calculateDetail/placeOnFileDetail"; import CompareDetail from "./pages/calculateDetail/compareDetail"; import GenerateDeclarationDetail from "./pages/declare/generateDeclarationDetail"; import TemplatePreview from "./pages/payroll/templatePreview"; -import MobilePayroll from './pages/mobilePayroll'; -import SysConfig from './pages/sysConfig'; -import RuleConfig from './pages/ruleConfig'; -import Appconfig from './pages/appConfig'; +import MobilePayroll from "./pages/mobilePayroll"; +import SysConfig from "./pages/sysConfig"; +import RuleConfig from "./pages/ruleConfig"; +import Appconfig from "./pages/appConfig"; import stores from "./stores"; import "./style/index"; @@ -84,14 +83,14 @@ const Routes = ( path="hrmSalary" onEnter={getLocaleLabel} component={Home}> - + - - - + + + - - + + - - - - - + + + + + - - + + - - - - - + + + + - + - - - - - - - + + + + + + ); module.exports = { Route: Routes, - store: stores, + store: stores }; diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/index.js index 4f7219a5..0a52fceb 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/index.js @@ -19,7 +19,8 @@ import { WeaSlideModal, WeaTab, WeaTable, - WeaTop + WeaTop, + WeaPopoverHrm } from "ecCom"; import { WeaTableNew } from "comsMobx"; import { Button, Dropdown, Menu, message, Modal, Popover } from "antd"; @@ -412,7 +413,21 @@ class Index extends Component { // } // }, ...columns], (item, index) => { - if (item.dataIndex === "operate") { + if (item.dataIndex === "username") { + return { + ...item, + width: item.oldWidth, + render: (text, record) => { + return window.pointerXY(e)} + title={text} + > + {text} + ; + } + }; + }else if (item.dataIndex === "operate") { return { ...item, fixed: "right", @@ -693,7 +708,6 @@ class Index extends Component { className="payrollFilesTab" keyParam="viewcondition" //主键 countParam="groupid" //数量 - // autoCalculateWidth={true} leftStyle={{ paddingRight: $(".payrollFilesTab-right").width() }} selectedKey={selectedKey} onChange={this.handleChangeTab} @@ -721,6 +735,8 @@ class Index extends Component { rowSelection={rowSelection} scroll={{ x: 1200 }} /> + {/*人员卡片*/} + { let dataSource = [...salaryArchiveItems]; dataSource.map(i => { @@ -76,7 +73,8 @@ export default class ChangeSalaryModal extends React.Component { // 解析Columns getColumns() { - const { salaryFileStore: { salaryItemChangeForm } } = this.props; + const { canOperator } = this.state; + const { salaryFileStore: { salaryItemChangeForm }, recordId } = this.props; const { salaryItemList } = salaryItemChangeForm; let { columns } = salaryItemChangeForm; return columns.map(item => { @@ -88,7 +86,7 @@ export default class ChangeSalaryModal extends React.Component { {item.title}; item.render = (text, record) => { return ( - { - this.handleSalaryAfterItemChange(record, value); - }}/> + { + this.handleSalaryAfterItemChange(record, value); + }} + /> ); }; } @@ -145,6 +148,7 @@ export default class ChangeSalaryModal extends React.Component { request.adjustReason = data.adjustReason; request.description = data.description; this.setState({ + canOperator: data.canOperator, salaryArchiveItems: data.dataSource, inited: true, request @@ -161,7 +165,7 @@ export default class ChangeSalaryModal extends React.Component { // 保存 handleSave() { - const { salaryFileStore: { saveSalaryItem, fetchSingleSalaryItemList, getArchiveForm } } = this.props; + const { salaryFileStore: { saveSalaryItem, editSingleSalaryItem, fetchSingleSalaryItemList, getArchiveForm }, recordId } = this.props; let saveRequest = { ...this.state.request }; const { salaryArchiveItems } = this.state; if (salaryArchiveItems.length === 0) { @@ -174,11 +178,19 @@ export default class ChangeSalaryModal extends React.Component { result.adjustValue = item.adjustAfter; return result; }); - saveSalaryItem(saveRequest).then(() => { - getArchiveForm(this.props.currentId); - fetchSingleSalaryItemList({ salaryArchiveId: this.props.currentId }); - this.props.onCancel(); - }); + if (!recordId) { + saveSalaryItem(saveRequest).then(() => { + getArchiveForm(this.props.currentId); + fetchSingleSalaryItemList({ salaryArchiveId: this.props.currentId }); + this.props.onCancel(); + }); + } else { + editSingleSalaryItem({ ...saveRequest, salaryArchiveItemId: recordId }).then(() => { + getArchiveForm(this.props.currentId); + fetchSingleSalaryItemList({ salaryArchiveId: this.props.currentId }); + this.props.onCancel(); + }); + } } onSelectChange = selectedRowKeys => { @@ -199,8 +211,8 @@ export default class ChangeSalaryModal extends React.Component { }; render() { - const { salaryFileStore: { salaryItemChangeForm } } = this.props; - const { request, salaryArchiveItems, selectedRowKeys } = this.state; + const { salaryFileStore: { salaryItemChangeForm }, recordId } = this.props; + const { request, salaryArchiveItems, selectedRowKeys, canOperator } = this.state; const { effectiveTime, adjustReason, description } = request; const rowSelection = { @@ -209,8 +221,10 @@ export default class ChangeSalaryModal extends React.Component { }; return ( { this.props.onCancel(); }} @@ -224,7 +238,7 @@ export default class ChangeSalaryModal extends React.Component { 生效日期 this.handleChange({ adjustReason: value })} options={ !_.isEmpty(salaryItemChangeForm.adjustReasonList) ? @@ -257,10 +271,10 @@ export default class ChangeSalaryModal extends React.Component { 说明 - { this.handleChange({ description: value }); }} @@ -271,27 +285,37 @@ export default class ChangeSalaryModal extends React.Component {
调薪明细 -
- - -
+ { + !recordId && +
+ + +
+ }
{ this.state.inited && - + }
diff --git a/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js index e1ab8be7..046c6877 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js @@ -1,7 +1,9 @@ import React from "react"; +import { Menu, Popover, message } from "antd"; import { WeaTable } from "ecCom"; import { inject, observer } from "mobx-react"; import ChangeSalaryModal from "./changeSalaryModal"; +import { deleteSalaryItem } from '../../apis/archive'; @inject("salaryFileStore") @observer @@ -16,12 +18,12 @@ export default class SalaryItemChangeList extends React.Component { } componentWillMount() { - const { salaryFileStore: { fetchSingleSalaryItemList }, id } = this.props; + const { salaryFileStore: { fetchSingleSalaryItemList } } = this.props; this.searchParams = { salaryArchiveId: this.props.id, current: 1 }; fetchSingleSalaryItemList(this.searchParams); } - handleEdit(record) { + handleEdit = (record) => { this.setState({ recordId: record.id }, () => { @@ -29,15 +31,48 @@ export default class SalaryItemChangeList extends React.Component { changeSalaryVisible: true }); }); - } + }; + deleteSalaryItem = (salaryArchiveItemId) => { + const { salaryFileStore: { fetchSingleSalaryItemList } } = this.props; + deleteSalaryItem({ salaryArchiveItemId }).then(({status, errormsg}) => { + if(status){ + message.success("删除成功") + this.searchParams = { salaryArchiveId: this.props.id, current: 1 }; + fetchSingleSalaryItemList(this.searchParams); + }else{ + message.error(errormsg || "删除失败") + } + }); + }; // 获取Columns getColumns() { - const { salaryFileStore: { singleSalaryItemList } } = this.props; + const { salaryFileStore: { singleSalaryItemList }, selectedKey } = this.props; let columns = []; if (singleSalaryItemList.columns) { columns = [...singleSalaryItemList.columns]; } + if (selectedKey === "fixed") { + columns = [...columns, { + dataIndex: "operate", + title: "操作", + fixed: "right", + width: 100, + render: (text, record) => { + return
+ this.handleEdit(record)}>编辑 + this.deleteSalaryItem(record.id)}> + 删除 + } title=""> + + +
; + } + }]; + } return columns; } @@ -57,6 +92,7 @@ export default class SalaryItemChangeList extends React.Component { dataSource={singleSalaryItemList.list ? singleSalaryItemList.list : []} columns={this.getColumns()} border + scroll={{ x: 500 }} pagination={{ onChange: (value) => { this.handlePageChange(value); diff --git a/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js b/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js index 0be1e741..946d2bc4 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js @@ -67,7 +67,7 @@ export default class SalaryFileViewSlide extends React.Component { const { payEndDate, payStartDate } = result; onChangePaySetParams({ payEndDate, payStartDate }); }); - fetchSingleSalaryItemList({ salaryArchiveId: this.props.id }); + // fetchSingleSalaryItemList({ salaryArchiveId: this.props.id }); } // tab页签切换回调 @@ -189,7 +189,7 @@ export default class SalaryFileViewSlide extends React.Component { > { this.state.selectedTab === "0" ? - : + : } diff --git a/pc4mobx/hrmSalary/stores/salaryFile.js b/pc4mobx/hrmSalary/stores/salaryFile.js index c4a43823..641eb9ab 100644 --- a/pc4mobx/hrmSalary/stores/salaryFile.js +++ b/pc4mobx/hrmSalary/stores/salaryFile.js @@ -205,7 +205,7 @@ export class salaryFileStore { // 获取详情 @action getArchiveForm = (salaryArchiveId) => { - return new Promise((resolve, reject)=>{ + return new Promise((resolve, reject) => { API.getArchiveForm({ salaryArchiveId }).then(res => { if (res.status) { this.detailForm = res.data; @@ -216,7 +216,7 @@ export class salaryFileStore { reject(); } }); - }) + }); }; // 个税义务人表单 @@ -323,6 +323,7 @@ export class salaryFileStore { salaryItemChangeForm.description = resData.salaryArchiveItemForm.description; salaryItemChangeForm.adjustReason = resData.salaryArchiveItemForm.adjustReason; + salaryItemChangeForm.canOperator = resData.canOperator; return salaryItemChangeForm; }; @@ -469,7 +470,24 @@ export class salaryFileStore { } }); }); - + }; + @action("编辑调薪") + editSingleSalaryItem = (params) => { + return new Promise((resolve, reject) => { + if (!this.validateSaveSalaryForm(params)) { + reject("校验失败"); + return; + } + API.editSingleSalaryItem(params).then(res => { + if (res.status) { + message.success("保存成功"); + resolve(); + } else { + message.error(res.errormsg || "保存失败"); + reject(); + } + }); + }); }; // 调整=薪资项目调整-获取调整前的值 @@ -491,7 +509,7 @@ export class salaryFileStore { @action getSalaryItemFormByItemId = (id) => { return new Promise((resolve, reject) => { - API.getSalaryItemFormByItemId({ salaryArchiveItemId: id }).then(res => { + API.getSingleSalaryItemInfo({ id: id }).then(res => { if (res.status) { this.salaryItemChangeForm = this.convertForm(res.data); resolve(this.salaryItemChangeForm); @@ -501,7 +519,6 @@ export class salaryFileStore { } }); }); - }; @action("停薪")