查看详情
This commit is contained in:
parent
132f49e8d6
commit
5082b4192e
|
|
@ -30,7 +30,7 @@ export const deleteTaxAgent = params => {
|
|||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
})
|
||||
}).then(res => res.json())
|
||||
}
|
||||
|
||||
//个税扣缴义务人下拉列表
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const saveTaxRate = params => {
|
|||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
})
|
||||
}).then(res => res.json())
|
||||
}
|
||||
|
||||
//编辑税率表
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default class EditableTable extends React.Component {
|
|||
<EditableCell
|
||||
value={text}
|
||||
record={record}
|
||||
onChange={this.onCellChange(record.key, item.dataIndex)}
|
||||
onChange={this.onCellChange(record.indexNum, item.dataIndex)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ export default class EditableTable extends React.Component {
|
|||
child.render = (text, record) => (
|
||||
<EditableCell
|
||||
value={text}
|
||||
onChange={this.onCellChange(record.key, child.dataIndex)}
|
||||
onChange={this.onCellChange(record.indexNum, child.dataIndex)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
@ -73,10 +73,10 @@ export default class EditableTable extends React.Component {
|
|||
})
|
||||
|
||||
}
|
||||
onCellChange = (key, dataIndex) => {
|
||||
onCellChange = (indexNum, dataIndex) => {
|
||||
return (value) => {
|
||||
const dataSource = [...this.props.dataSource];
|
||||
const target = dataSource.find(item => item.key === key);
|
||||
const target = dataSource.find(item => item.indexNum === indexNum);
|
||||
if (target) {
|
||||
target[dataIndex] = value;
|
||||
this.props.onDataSourceChange(dataSource)
|
||||
|
|
|
|||
|
|
@ -82,16 +82,6 @@ export default class TaxAgent extends React.Component {
|
|||
}
|
||||
return newColumn;
|
||||
});
|
||||
columns.push(
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: 'operate',
|
||||
key: 'operate',
|
||||
render: (text, record) => {
|
||||
return <a onClick={() => {this.onEdit(record)}}></a>
|
||||
}
|
||||
}
|
||||
)
|
||||
return newColumns;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,14 +84,14 @@ export const slideColumns = [
|
|||
children: [
|
||||
{
|
||||
title: '下限(不含)',
|
||||
dataIndex: 'taxableIncomeLLimit',
|
||||
key: 'taxableIncomeLLimit',
|
||||
dataIndex: 'taxableIncomeLl',
|
||||
key: 'taxableIncomeLl',
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
title: '上限(含)',
|
||||
dataIndex: 'taxableIncomeULimit',
|
||||
key: 'taxableIncomeULimit',
|
||||
dataIndex: 'taxableIncomeUl',
|
||||
key: 'taxableIncomeUl',
|
||||
editable: true
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ let emptyItem = {
|
|||
incomeUpperLimit: "0.00",
|
||||
dutyFreeValue: "0.00",
|
||||
dutyFreeRate: "0.00",
|
||||
taxableIncomeLLimit: "0.00",
|
||||
taxableIncomeULimit: "0.00",
|
||||
taxableIncomeLl: "0.00",
|
||||
taxableIncomeUl: "0.00",
|
||||
taxRate: "0.00",
|
||||
taxDeduction: "0.00"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,37 @@ export default class TaxRate extends React.Component {
|
|||
doInit();
|
||||
}
|
||||
|
||||
// 增加编辑功能,重写columns绑定事件
|
||||
getColumns = (columns) => {
|
||||
let newColumns = '';
|
||||
newColumns = columns.map(column => {
|
||||
let newColumn = column;
|
||||
newColumn.render = (text, record, index) => { //前端元素转义
|
||||
let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex];
|
||||
switch(newColumn.dataIndex) {
|
||||
case "name":
|
||||
return <a onClick={() => {this.onEdit(record)}}
|
||||
dangerouslySetInnerHTML={{ __html: valueSpan }} />
|
||||
default:
|
||||
return <div dangerouslySetInnerHTML={{ __html: valueSpan }} />
|
||||
}
|
||||
}
|
||||
return newColumn;
|
||||
});
|
||||
return newColumns;
|
||||
}
|
||||
|
||||
onEdit = (record) => {
|
||||
const {taxRateStore: {setSlideVisiable, emptyForm, getItemInform }} = this.props;
|
||||
emptyForm();
|
||||
setSlideVisiable(true);
|
||||
getItemInform(record.id)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { taxRateStore } = this.props;
|
||||
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = taxRateStore;
|
||||
const { doSave, slideVisiable, setSlideVisiable } = taxRateStore
|
||||
const { doSave, slideVisiable, setSlideVisiable, emptyForm } = taxRateStore
|
||||
if (!hasRight && !loading) { // 无权限处理
|
||||
return renderNoright();
|
||||
}
|
||||
|
|
@ -69,11 +96,15 @@ export default class TaxRate extends React.Component {
|
|||
|
||||
const renderSearchOperationItem = () => {
|
||||
return <div>
|
||||
<Button type="primary" onClick={() => { setSlideVisiable(true) }}>新建</Button>
|
||||
<Button type="primary" onClick={() => {
|
||||
emptyForm();
|
||||
setSlideVisiable(true)
|
||||
}}>新建</Button>
|
||||
{' '}
|
||||
<WeaInputSearch
|
||||
placeholder={'请输入个税税率表名称'}
|
||||
onSearch={(name) => {doSearch({name})}}
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -106,12 +137,13 @@ export default class TaxRate extends React.Component {
|
|||
comsWeaTableStore={tableStore} // table store
|
||||
hasOrder={true} // 是否启用排序
|
||||
needScroll={true} // 是否启用table内部列表滚动,将自适应到父级高度
|
||||
|
||||
getColumns={this.getColumns}
|
||||
/>
|
||||
</WeaTop>
|
||||
</WeaRightMenu>
|
||||
|
||||
<WeaSlideModal visible={slideVisiable}
|
||||
{
|
||||
slideVisiable && <WeaSlideModal visible={slideVisiable}
|
||||
top={0}
|
||||
width={40}
|
||||
height={100}
|
||||
|
|
@ -128,6 +160,7 @@ export default class TaxRate extends React.Component {
|
|||
onClose={() => setSlideVisiable(false)}
|
||||
showMask={true}
|
||||
closeMaskOnClick={() => setSlideVisiable(false)} />
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,28 @@ export class taxRateStore {
|
|||
this.showSearchAd = false;
|
||||
this.setSlideVisiable(false);
|
||||
} else {
|
||||
message.error("保存失败");
|
||||
message.warning("保存失败: " + res.errormsg ? res.errormsg: "");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@action emptyForm = () => {
|
||||
this.setDataSource([]);
|
||||
this.setNameValue("");
|
||||
this.setRemarkValue("");
|
||||
}
|
||||
|
||||
// 获取表单数据
|
||||
@action getItemInform = (id) => {
|
||||
API.getTaxRateForm({id}).then(res => {
|
||||
|
||||
if(res.status) {
|
||||
let { taxRateBatch, taxRateRecords } = res.data.form
|
||||
this.setNameValue(taxRateBatch.name);
|
||||
this.setRemarkValue(taxRateBatch.description);
|
||||
this.setDataSource(taxRateRecords)
|
||||
} else {
|
||||
message.error("获取数据失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue