diff --git a/pc4mobx/hrmSalary/apis/welfareScheme.js b/pc4mobx/hrmSalary/apis/welfareScheme.js index f4a017ef..3d5aa4e0 100644 --- a/pc4mobx/hrmSalary/apis/welfareScheme.js +++ b/pc4mobx/hrmSalary/apis/welfareScheme.js @@ -41,7 +41,14 @@ export const getCustomCategoryList = params => { return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryList', 'get', params); }; export const createSICategory = params => { - return WeaTools.callApi('/api/bs/hrmsalary/sicategory/createSICategory', 'post', params); + return fetch('/api/bs/hrmsalary/sicategory/createSICategory', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) }; export const updateCustomCategory = params => { return WeaTools.callApi('/api/bs/hrmsalary/sicategory/updateCustomCategory', 'post', params); @@ -50,5 +57,12 @@ export const deleteCustomCategory = params => { return WeaTools.callApi('/api/bs/hrmsalary/sicategory/deleteCustomCategory', 'post', params); }; export const updateCustomCategoryStatus = params => { - return WeaTools.callApi('/api/bs/hrmsalary/sicategory/updateCustomCategoryStatus', 'post', params); + return fetch('/api/bs/hrmsalary/sicategory/updateCustomCategoryStatus', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) }; diff --git a/pc4mobx/hrmSalary/components/customForm/index.js b/pc4mobx/hrmSalary/components/customForm/index.js index 534e8e6a..ddc675bd 100644 --- a/pc4mobx/hrmSalary/components/customForm/index.js +++ b/pc4mobx/hrmSalary/components/customForm/index.js @@ -5,7 +5,14 @@ const CheckboxGroup = Checkbox.Group; export default class CustomForm extends React.Component { + + handleChange(params) { + let request = {...this.props.request, ...params} + this.props.onChange(request); + } + render() { + const { request } = this.props; return (
{ @@ -18,12 +25,12 @@ export default class CustomForm extends React.Component { { item.conditionType == "INPUT" && - + {this.handleChange({[item.domkey[0]]: value})}}/> } { item.conditionType == "RADIO" && item.options && - + this.handleChange({[item.domkey[0]]: e.target.value})}> { item.options.map(o => ( {o.showname} @@ -35,7 +42,7 @@ export default class CustomForm extends React.Component { { item.conditionType == "CHECKBOX" && item.options && - ({label: o.showname, value: o.key}))} /> + ({label: o.showname, value: o.key}))} onChange={(value) => this.handleChange({[item.domkey[0]]: value}) }/> } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index d64fde44..3cf3b681 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -167,6 +167,13 @@ export default class CumDeduct extends React.Component { } }; + + showColumn = () => { + const { cumDeductStore: { tableStore } } = this.props; + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + render() { const { modalParam } = this.state; const { cumDeductStore, taxAgentStore } = this.props; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index 130178aa..1419f17b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -154,6 +154,12 @@ export default class CumSituation extends React.Component { } }; + showColumn = () => { + const { cumSituationStore: { tableStore } } = this.props; + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + render() { const { cumSituationStore, taxAgentStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = cumSituationStore; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index 6ea3ca1c..049e301c 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -154,6 +154,12 @@ export default class OtherDeduct extends React.Component { ) } + showColumn = () => { + const { otherDeductStore: { tableStore } } = this.props; + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + render() { const { otherDeductStore, taxAgentStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = otherDeductStore; diff --git a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js index 074e9c93..62930955 100644 --- a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js +++ b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js @@ -49,9 +49,9 @@ export default class SlideRefereUser extends React.Component { handleSearch = (value) => { const { ledgerStore: {includeType, salarySobId, getLedgerPersonRangeInclude, getLedgerPersonRangeExclude}} = this.props; if(includeType == 1) { - getLedgerPersonRangeInclude({salarySobId: salarySobId, name: value}) + getLedgerPersonRangeInclude({salarySobId: salarySobId, targetName: value}) } else { - getLedgerPersonRangeExclude({salarySobId: salarySobId, name: value}) + getLedgerPersonRangeExclude({salarySobId: salarySobId, targetName: value}) } } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js index 0ced8ca3..d2022b77 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js @@ -2,14 +2,27 @@ import React from 'react' import { getCustomSearchs, getSearchs } from '../../../util'; import { Modal } from 'antd' import { observable, action, toJS } from 'mobx'; +import { inject, observer } from 'mobx-react'; import CustomForm from '../../../components/customForm' +@inject('programmeStore') +@observer export default class CustomNewModal extends React.Component { + constructor(props) { + super(props) + } + + handleOK() { + const { programmeStore: {createSICategory, setCustomRequest, customRequest}} = this.props; + createSICategory(customRequest) + } + render() { + const { programmeStore: {customRequest}} = this.props; return ( - {this.props.onCancel()}} title="新建自定义福利"> + {this.props.onCancel()}} title="新建自定义福利" onOk={() => {this.handleOK()}}> {/* {getCustomSearchs(this.props.form, toJS(this.props.condition), 1)} */} - + {setCustomRequest(value)}}/> ) } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index 54da9821..ebef4966 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -129,16 +129,17 @@ export default class Programme extends React.Component { } onCustomEdit(record) { - this.setState({customNewVisible: true}) - const { programmeStore: {getCustomForm}} = this.props; - getCustomForm({id: record.id}) + const { programmeStore: {getCustomForm, setCustomNewVisible, setCustomRequest}} = this.props; + setCustomNewVisible(true) + alert(JSON.stringify(record)) + setCustomRequest(record) } render() { const { programmeStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = programmeStore; const { selectedKey, setSelectedKey, getCustomCategoryList, customTableStore, - customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition } = programmeStore; + customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition, setCustomNewVisible, customNewVisible } = programmeStore; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } @@ -199,13 +200,15 @@ export default class Programme extends React.Component { ] const handleNewClick = () => { + const { programmeStore: {initSlideParms}} = this.props; + initSlideParms(); this.setState({ slideVisiable: true, currentOperate: "add" }) } const handleCustomNewClick = () => { - const { programmeStore : { getCustomForm, getCumCustomForm }} = this.props; + const { programmeStore : { getCustomForm, getCumCustomForm, setCustomNewVisible }} = this.props; getCustomForm() - this.setState({ customNewVisible: true}) + setCustomNewVisible(true) } @@ -275,6 +278,12 @@ export default class Programme extends React.Component { this.setState({copyModalVisible : false}) } + const handleSlideClose = () => { + this.setState({ slideVisiable: false }) + const { programmeStore: {initSlideParms} } = this.props; + initSlideParms() + } + return (
- { setRequestParams(requestParams) }}/>)} - onClose={() => this.setState({ slideVisiable: false })} + onClose={() => {handleSlideClose()}} showMask={true} - closeMaskOnClick={() => this.setState({ slideVisiable: false })} + closeMaskOnClick={() => {handleSlideClose()}} onAnimationEnd={() => console.log('onAnimationEnd')} /> + } { this.state.copyModalVisible && {this.setState({customNewVisible: false})}} + onCancel={() => {setCustomNewVisible(false)}} /> }
diff --git a/pc4mobx/hrmSalary/pages/taxRate/index.js b/pc4mobx/hrmSalary/pages/taxRate/index.js index af6c117e..4ae2e348 100644 --- a/pc4mobx/hrmSalary/pages/taxRate/index.js +++ b/pc4mobx/hrmSalary/pages/taxRate/index.js @@ -66,12 +66,13 @@ export default class TaxRate extends React.Component { } handleInsertBtnClick = () => { - const {taxRateStore: {setSlideVisiable, emptyForm }} = this.props; + const {taxRateStore: {setSlideVisiable, emptyForm, initDataSource }} = this.props; this.setState({ currentOperate: "add", editable: true }) emptyForm(); + initDataSource(); setSlideVisiable(true) } @@ -186,7 +187,7 @@ export default class TaxRate extends React.Component { measure={'%'} title={ {this.state.currentOperate == "add" ? doSave() : doUpdate()}} editable={this.state.editable} diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index 502e15bc..a60cc31e 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -24,6 +24,14 @@ export class ProgrammeStore { } @observable form = new WeaForm(); @observable formCondition = []; // 存储后台得到的form数据 + @observable customNewVisible = false; + @observable customRequest = {} + + @action + setCustomRequest = customRequest => this.customRequest = customRequest + + @action + setCustomNewVisible = customNewVisible => this.customNewVisible = customNewVisible; @action setRequestParams = requestParams => this.requestParams = requestParams; @@ -34,6 +42,17 @@ export class ProgrammeStore { @action setDefaultCompanyDataSource = defaultCompanyDataSource => this.defaultCompanyDataSource = defaultCompanyDataSource; + @action + initSlideParms = () => { + this.requestParams = { + schemeName: "", + remarks: "", + paymentArea: "1" + } + this.defaultPersonDataSource = []; + this.defaultCompanyDataSource = []; + } + @action setCustomSelectkey = customSelectkey => this.customSelectkey = customSelectkey; @@ -169,4 +188,33 @@ export class ProgrammeStore { } }) } + + // 新增自定义福利 + @action createSICategory = (params) => { + API.createSICategory(params).then(res => { + if(res.status) { + message.success("新增成功") + this.getCustomCategoryList() + } else { + message.error(res.errormsg || "新增失败") + } + }) + } + + // 自定义福利启用、停用 + @action + updateCustomCategoryStatus = (params) => { + API.updateCustomCategoryStatus(params).then(res => { + if(res.status) { + message.success("修改成功") + this.getCustomCategoryList() + } else { + message.error(res.errormsg || "修改失败") + } + }) + } + + + + } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/taxRate.js b/pc4mobx/hrmSalary/stores/taxRate.js index 6c4e0bcd..76b9ddcd 100644 --- a/pc4mobx/hrmSalary/stores/taxRate.js +++ b/pc4mobx/hrmSalary/stores/taxRate.js @@ -6,6 +6,19 @@ import * as API from '../apis/taxRate'; // 引入API接口文件 const { TableStore } = WeaTableNew; +let emptyItem = { + indexNum: 1, + incomeLowerLimit: "0.00", + incomeUpperLimit: "0.00", + dutyFreeValue: "0.00", + dutyFreeRate: "0.00", + taxableIncomeLl: "0.00", + taxableIncomeUl: "0.00", + taxRate: "0.00", + taxDeduction: "0.00" +} + + export class taxRateStore { @observable tableStore = new TableStore(); // new table @observable form = new WeaForm(); // nrew 一个form @@ -38,6 +51,12 @@ export class taxRateStore { this.getTableDatas(); } + @action + initDataSource = () => { + this.dataSource = [] + this.dataSource.push(emptyItem) + } + // 渲染table数据 @action getTableDatas = (params) => {