账套列表
This commit is contained in:
parent
697b799b32
commit
029876f694
|
|
@ -82,10 +82,27 @@ export default class SalaryItemForm extends React.Component {
|
|||
setItemGroups(newItemGroups)
|
||||
}
|
||||
|
||||
// 修改列表数据顺序
|
||||
handleItemDataSourceChange(dataSource, item) {
|
||||
const { ledgerStore: {itemGroups, setItemGroups} } = this.props;
|
||||
dataSource.map((data, index) => {
|
||||
data.sortedIndex = index
|
||||
})
|
||||
itemGroups = itemGroups ? [...itemGroups] : []
|
||||
itemGroups.map(groupItem => {
|
||||
if(groupItem.id == item.id) {
|
||||
groupItem.items = dataSource
|
||||
}
|
||||
})
|
||||
setItemGroups(itemGroups)
|
||||
}
|
||||
|
||||
render() {
|
||||
const {ledgerStore: {itemGroups, salaryItems, empBrowserList, setAddCategoryVisible, addCategoryVisible, baseInfoRequest}} = this.props;
|
||||
const { canEdit="true" } = baseInfoRequest;
|
||||
const { previewVisible } = this.state;
|
||||
|
||||
|
||||
return (
|
||||
<div className="salaryItemForm">
|
||||
<div className="btnBar">
|
||||
|
|
@ -119,10 +136,11 @@ export default class SalaryItemForm extends React.Component {
|
|||
{
|
||||
itemGroups && itemGroups.map(item => {
|
||||
if(item.items) {
|
||||
item.items && item.items.map(i => {i.key = i.id})
|
||||
return (
|
||||
<CanMoveItem disabled={canEdit !== "true"} dataSource={toJS(item.items)} onDataSourceChange={(dataSource) => {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} onGroupDelete={() => {this.handleGroupDelete(item)}} onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/>
|
||||
)
|
||||
<CanMoveItem disabled={canEdit !== "true"} dataSource={toJS(item.items)}
|
||||
onDataSourceChange={(dataSource) => {this.handleItemDataSourceChange(dataSource, item)}}
|
||||
title={item.name} onGroupDelete={() => {this.handleGroupDelete(item)}} onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/>
|
||||
)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,11 @@ export default class AddSalaryItemModal extends React.Component {
|
|||
let selectItems = []
|
||||
|
||||
addSalaryItemDataSource.map(item => {
|
||||
item = {...item}
|
||||
selectedRowKeys.map(key => {
|
||||
if(item.id == key) {
|
||||
item.salaryItemId = item.id
|
||||
item.key = item.id
|
||||
selectItems.push(item)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -127,11 +127,6 @@ export default class CanMoveItem extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
handleTableDrop = (datas) => {
|
||||
// TODO
|
||||
console.log("datas:", datas);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {disabled, ledgerStore: {setAddItemVisible, addItemVisible}} = this.props;
|
||||
const { selectedRowKeys, formalModalVisible, addCategoryVisible } = this.state;
|
||||
|
|
@ -181,8 +176,10 @@ export default class CanMoveItem extends React.Component {
|
|||
moveRow: record,
|
||||
})}
|
||||
pagination={false}
|
||||
onDrop={(datas) => this.handleTableDrop(datas)}
|
||||
draggable={true}/>
|
||||
onDrop={(datas) => this.props.onDataSourceChange(datas)}
|
||||
draggable={true}
|
||||
|
||||
/>
|
||||
}
|
||||
{
|
||||
this.state.addItemVisible && <AddSalaryItemModal
|
||||
|
|
|
|||
|
|
@ -140,7 +140,15 @@ export class LedgerStore {
|
|||
};
|
||||
|
||||
@action
|
||||
setItemGroups = (itemGroups) => (this.itemGroups = itemGroups);
|
||||
setItemGroups = (itemGroups) => {
|
||||
itemGroups = itemGroups ? [...itemGroups] : []
|
||||
itemGroups && itemGroups.map(item => {
|
||||
if(item.items) {
|
||||
item.items && item.items.map(i => {i.key = i.id})
|
||||
}
|
||||
})
|
||||
this.itemGroups = itemGroups
|
||||
};
|
||||
|
||||
@action
|
||||
addItemGroup = (name) => {
|
||||
|
|
@ -687,13 +695,14 @@ export class LedgerStore {
|
|||
API.getLedgerItemForm({ salarySobId: this.salarySobId }).then((res) => {
|
||||
if (res.status) {
|
||||
this.empFields = res.data.empFields;
|
||||
this.itemGroups = res.data.itemGroups;
|
||||
let itemGroups = res.data.itemGroups;
|
||||
let defaultItems = {
|
||||
id: "default",
|
||||
name: "未分类",
|
||||
items: res.data.items,
|
||||
};
|
||||
this.itemGroups.unshift(defaultItems);
|
||||
itemGroups.unshift(defaultItems);
|
||||
this.setItemGroups(itemGroups)
|
||||
API.empFieldList().then((ires) => {
|
||||
if (res.status) {
|
||||
this.empBrowserList = ires.data.map((item) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue