diff --git a/pc4mobx/hrmSalary/apis/archive.js b/pc4mobx/hrmSalary/apis/archive.js index 08e77645..0be88382 100644 --- a/pc4mobx/hrmSalary/apis/archive.js +++ b/pc4mobx/hrmSalary/apis/archive.js @@ -212,4 +212,9 @@ export const singleTaxAgentList = (params) => { }, body: JSON.stringify(params) }).then(res => res.json()) +} + +// 调整-义务扣缴人-通过薪资档案的个税扣缴义务人id获取个税扣缴义务人调整表单 +export const getTaxAgentFormBySalaryArchiveTaxAgentId = (params) => { + return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/getTaxAgentFormBySalaryArchiveTaxAgentId', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/salaryFile/editAgentModal.js b/pc4mobx/hrmSalary/pages/salaryFile/editAgentModal.js index 8ff93a65..56e65b61 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/editAgentModal.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/editAgentModal.js @@ -18,8 +18,9 @@ export default class EditAgentModal extends React.Component { adjustReason: 'INIT', taxAgentId: "" } - } + + } getAdjustReasonList() { @@ -45,14 +46,6 @@ export default class EditAgentModal extends React.Component { }) } - componentWillMount() { - const { salaryFileStore: {salaryArchiveTaxAgentForm, getTaxAgentForm}} = this.props; - getTaxAgentForm(this.props.currentId).then(() => { - this.setState({initSelected: true}) - }) - } - - handleSave() { const { salaryFileStore: {saveTaxAgent}} = this.props; saveTaxAgent(this.state.request).then(() => { @@ -68,6 +61,27 @@ export default class EditAgentModal extends React.Component { }) } + componentWillMount() { + const { salaryFileStore: {salaryArchiveTaxAgentForm, getTaxAgentForm, fetchSingleTaxAgentList, getTaxAgentFormByTaxAgentId}} = this.props; + if(this.props.recordId) { // 点击条目进入 + getTaxAgentFormByTaxAgentId(this.props.recordId).then(() => { + this.setState({ + // taxAgentId: "25", + taxAgentId: salaryArchiveTaxAgentForm.ad1justAfter != undefined ? salaryArchiveTaxAgentForm.adjustAfter + "": "", + adjustReason:salaryArchiveTaxAgentForm.adjustReason != undefined ? salaryArchiveTaxAgentForm.adjustReason : "" + }, () => { + this.setState({ + initSelected: true + }) + }) + }) + } else { + getTaxAgentForm(this.props.currentId).then(() => { + this.setState({initSelected: true}) + }) + } + } + render() { const { salaryFileStore } = this.props; const { salaryArchiveTaxAgentForm } = salaryFileStore diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index 1b55d525..348e9d93 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -39,7 +39,6 @@ export default class SalaryFile extends React.Component { modalVisiable: false, step: 0, recordSlideVisible: false, - currentId: "", selectedRowKeys: [] } } @@ -101,7 +100,7 @@ export default class SalaryFile extends React.Component { return tableStore.columns.filter(item => item.hide == "false").map(item => { if(item.dataIndex == "operate") { item.render = (text, record) => ( - this.handleEdit(record)}>编辑 + this.handleEdit(record)}>查看 ) } return item @@ -110,7 +109,9 @@ export default class SalaryFile extends React.Component { // 编辑行 handleEdit(record) { - this.setState({editSlideVisible: true, currentId: record.id}) + this.setState({editSlideVisible: true}) + const { salaryFileStore: {setCurrentId}} = this.props; + setCurrentId(record.id) } // 显示调整个税扣缴义务人表单 @@ -138,7 +139,7 @@ export default class SalaryFile extends React.Component { render() { const { salaryFileStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryFileStore; - const { importType, previewColumns, previewDataSource, dataSource } = salaryFileStore; + const { importType, previewColumns, previewDataSource, dataSource, currentId, editAgentVisible, setEditAgentVisible } = salaryFileStore; const { selectedTab, step, selectedRowKeys } = this.state; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); @@ -303,17 +304,17 @@ export default class SalaryFile extends React.Component { { this.state.changeSalaryVisible && {this.setState({changeSalaryVisible: false})}} /> } { - this.state.editAgentVisible && {this.setState({editAgentVisible: false})}} + editAgentVisible && {setEditAgentVisible(false)}} /> } @@ -365,7 +366,7 @@ export default class SalaryFile extends React.Component { customOperate={this.renderEditSlideOperate()} /> } - content={} + content={} onClose={() => this.setState({editSlideVisible: false})} showMask={true} closeMaskOnClick={() => this.setState({editSlideVisible: false})} /> diff --git a/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js new file mode 100644 index 00000000..877f0d64 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/salaryFile/salaryItemChangeList.js @@ -0,0 +1,26 @@ +import React from 'react'; +import { Table } from 'antd' +import { inject, observer } from 'mobx-react'; + +@inject('salaryFileStore') +@observer +export default class SalaryItemChangeList extends React.Component { + constructor(props) { + super(props) + } + + componentWillMount() { + const { salaryFileStore: { fetchSingleSalaryItemList }} = this.props; + fetchSingleSalaryItemList({salaryArchiveId: this.props.id}) + } + + render() { + const { salaryFileStore } = this.props; + const { singleSalaryItemList } = salaryFileStore + return ( +
+ + + ) + } +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js b/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js index 0b6507a3..6a578182 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/saralyFileViewSlide.js @@ -5,6 +5,8 @@ import GroupCard from "../../components/groupCard" import { inject, observer } from 'mobx-react'; import "./index.less" import SelectedTab from '../../components/selectedTab' +import SalaryItemChangeList from "./salaryItemChangeList"; +import TaxAgentChangeList from "./taxAgentChangeList"; const selectedTabItems = [ { @@ -111,8 +113,9 @@ export default class SalaryFileViewSlide extends React.Component { } {this.handleTabChange(item)}}/>} items={[]} onVisibleChange={(value) => {this.setState({salaryItemVisible: value})}}/> - - + { + this.state.selectedTab == "0" ? : + }
diff --git a/pc4mobx/hrmSalary/pages/salaryFile/taxAgentChangeList.js b/pc4mobx/hrmSalary/pages/salaryFile/taxAgentChangeList.js new file mode 100644 index 00000000..aa1e4b95 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/salaryFile/taxAgentChangeList.js @@ -0,0 +1,70 @@ +import React from 'react'; +import { Table } from 'antd' +import { inject, observer } from 'mobx-react'; +import EditAgentModal from './editAgentModal' + +@inject('salaryFileStore') +@observer +export default class TaxAgentChangeList extends React.Component { + constructor(props) { + super(props) + this.state = { + recordId: '', + editAgentVisible: false + } + } + + componentWillMount() { + const { salaryFileStore: { fetchSingleTaxAgentList }} = this.props; + fetchSingleTaxAgentList({salaryArchiveId: this.props.id}) + } + + // 编辑回调 + handleEdit(record) { + const { salaryFileStore: {setEditAgentVisible} } = this.props; + this.setState({ + recordId: record.id, + editAgentVisible: true + }) + } + + // 获取Columns + getColumns() { + const { salaryFileStore: {singleTaxAgentList} } = this.props; + let columns = [] + if(singleTaxAgentList.columns) { + columns = [...singleTaxAgentList.columns] + } + if(columns.length > 0) { + columns.push({ + title: '操作', + key: "cz", + dataIndex: "cz", + render: (text, record) => { + return ( + {this.handleEdit(record)}}>编辑 + ) + } + }) + } + return columns + } + + render() { + const { salaryFileStore } = this.props; + const { singleTaxAgentList } = salaryFileStore + return ( +
+
+ { + this.state.editAgentVisible && {this.setState({editAgentVisible: false})}} + /> + } + + ) + } +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/salaryFile.js b/pc4mobx/hrmSalary/stores/salaryFile.js index 13250a8c..93760bf5 100644 --- a/pc4mobx/hrmSalary/stores/salaryFile.js +++ b/pc4mobx/hrmSalary/stores/salaryFile.js @@ -1,6 +1,7 @@ import { observable, action, toJS } from 'mobx'; import { message } from 'antd'; import { WeaForm, WeaTableNew } from 'comsMobx'; +import moment from 'moment' import * as API from '../apis/archive'; // 引入API接口文件 import { notNull } from '../util/validate' @@ -27,6 +28,11 @@ export class salaryFileStore { @observable singleSalaryItemList = [] @observable singleTaxAgentList = [] + @observable currentId = "" + @observable editAgentVisible = false + + + // 初始化操作 @action @@ -295,15 +301,38 @@ export class salaryFileStore { API.singleTaxAgentList(params).then(res => { if(res.status) { this.singleTaxAgentList = res.data + } else { message.error(res.errormsg || "获取失败") } }) } - - + // 设置当前查看的数据id + @action + setCurrentId = (id) => this.currentId = id + // 设置编辑个税义务人修改表modal + @action + setEditAgentVisible = editAgentVisible => this.editAgentVisible = editAgentVisible; + // 通过个税义务人编辑进入列表 + @action + getTaxAgentFormByTaxAgentId = (id) => { + return new Promise((resolve, reject) => { + API.getTaxAgentFormBySalaryArchiveTaxAgentId({salaryArchiveTaxAgentId: id}).then(res => { + if(res.status) { + let form = res.data.salaryArchiveTaxAgentForm + form.effectiveTime = moment(new Date(form.effectiveTime)).format("YYYY-MM-DD") + this.salaryArchiveTaxAgentForm = form + resolve() + } else { + message.error(res.errormsg || "获取失败") + reject() + } + }) + }) + + } } \ No newline at end of file