自定义列

This commit is contained in:
MustangDeng 2022-03-28 10:53:19 +08:00
parent e67a33af72
commit fbe5a338ef
11 changed files with 155 additions and 23 deletions

View File

@ -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())
};

View File

@ -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 (
<div style={{padding: "20px"}}>
{
@ -18,12 +25,12 @@ export default class CustomForm extends React.Component {
<Col span={18}>
{
item.conditionType == "INPUT" &&
<WeaInput value={item.value} />
<WeaInput value={request[item.domkey[0]]} onChange={(value) => {this.handleChange({[item.domkey[0]]: value})}}/>
}
{
item.conditionType == "RADIO" && item.options &&
<Radio.Group>
<Radio.Group onChange={(e) => this.handleChange({[item.domkey[0]]: e.target.value})}>
{
item.options.map(o => (
<Radio value={o.key}>{o.showname}</Radio>
@ -35,7 +42,7 @@ export default class CustomForm extends React.Component {
{
item.conditionType == "CHECKBOX" &&
item.options &&
<CheckboxGroup options={item.options.map(o => ({label: o.showname, value: o.key}))} />
<CheckboxGroup options={item.options.map(o => ({label: o.showname, value: o.key}))} onChange={(value) => this.handleChange({[item.domkey[0]]: value}) }/>
}
</Col>
</Row>

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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})
}
}

View File

@ -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 (
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}} title="新建自定义福利">
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}} title="新建自定义福利" onOk={() => {this.handleOK()}}>
{/* {getCustomSearchs(this.props.form, toJS(this.props.condition), 1)} */}
<CustomForm condition={this.props.condition}/>
<CustomForm condition={this.props.condition} request={customRequest} onChange={(value) => {setCustomRequest(value)}}/>
</Modal>
)
}

View File

@ -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 (
<div className="mySalaryBenefitsWrapper">
<WeaRightMenu
@ -328,7 +337,8 @@ export default class Programme extends React.Component {
}
</WeaTop>
</WeaRightMenu>
<WeaSlideModal visible={this.state.slideVisiable}
{
this.state.slideVisiable && <WeaSlideModal visible={this.state.slideVisiable}
top={0}
width={40}
height={100}
@ -346,10 +356,11 @@ export default class Programme extends React.Component {
content={(<DefaultSlideForm requestParams={requestParams} onChange={(requestParams) => {
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 && <CopySchemaModal
@ -363,11 +374,11 @@ export default class Programme extends React.Component {
}
{
this.state.customNewVisible && <CustomNewModal
visible={this.state.customNewVisible}
customNewVisible && <CustomNewModal
visible={customNewVisible}
condition={formCondition}
form={form}
onCancel={() => {this.setState({customNewVisible: false})}}
onCancel={() => {setCustomNewVisible(false)}}
/>
}
</div>

View File

@ -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={
<SlideModalTitle
subtitle={!this.state.editable ? "查看社保方案" : this.state.currentOperate == "add" ? "新建社保方案" : "编辑社保方案" }
subtitle={!this.state.editable ? "查看个税税率表" : this.state.currentOperate == "add" ? "新建个税税率表" : "编辑个税税率表" }
subTabs={[{title: "基础设置"}]}
onSave={() => {this.state.currentOperate == "add" ? doSave() : doUpdate()}}
editable={this.state.editable}

View File

@ -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 || "修改失败")
}
})
}
}

View File

@ -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) => {