账套问题处理

This commit is contained in:
MustangDeng 2022-05-13 15:25:21 +08:00
parent 91c1907b1b
commit 16de38a423
8 changed files with 190 additions and 64 deletions

View File

@ -30,8 +30,8 @@ export default class EditSlideContent extends React.Component {
super(props);
this.state = {
taxAgentId: "",
startDate: moment(new Date()).format("YYYY-MM"),
endDate: moment(new Date()).format("YYYY-MM"),
startDate: "",
endDate: "",
editable: this.props.editable === undefined ? "true": this.props.editable
}
}
@ -60,6 +60,25 @@ export default class EditSlideContent extends React.Component {
getCumDeductDetailList(currentRecord.id, param);
}
// 日期格式变化加载数据
handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
let declareMonth = []
if(startDate != "" && startDate != undefined) {
declareMonth.push(startDate);
}
if(endDate != "" && endDate != undefined) {
declareMonth.push(endDate);
}
let item = {
taxAgentId: taxAgentId
}
if(declareMonth.length != 0) {
item.declareMonth = declareMonth
}
this.fetchCumDeductDetailList(item)
}
render() {
const { taxAgentStore: {taxAgentOption}} = this.props;
@ -76,14 +95,14 @@ export default class EditSlideContent extends React.Component {
<span className="formLabel">申报月份</span>
<div className="weaRangePickerWrapper">
<div className="monthPickerWrapper">
<MonthPicker width={100} format="YYYY-MM" value={startDate}
<MonthPicker width={100} value={startDate}
onChange={(v) => {
let startDate = moment(v).format("YYYY-MM")
let startDate = "";
if(v != "" && v!= undefined) {
startDate = moment(v).format("YYYY-MM")
}
this.setState({startDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>
@ -94,12 +113,12 @@ export default class EditSlideContent extends React.Component {
<MonthPicker width={100}
value={endDate}
onChange={(v) => {
let endDate = moment(v).format("YYYY-MM")
let endDate = ""
if(v != "" && v!= undefined) {
endDate = moment(v).format("YYYY-MM")
}
this.setState({endDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>
@ -114,10 +133,7 @@ export default class EditSlideContent extends React.Component {
value={taxAgentId}
onChange={v => {
this.setState({taxAgentId: v})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: v
})
this.handleFetchCumDeductDetailList(startDate, endDate, v)
}}
/>
</Col>

View File

@ -25,13 +25,12 @@ let emptyItem = {
@inject('cumSituationStore', "taxAgentStore")
@observer
export default class EditSlideContent extends React.Component {
constructor(props) {
super(props);
this.state = {
taxAgentId: "",
startDate: moment(new Date()).format("YYYY-MM"),
endDate: moment(new Date()).format("YYYY-MM"),
startDate: "",
endDate: "",
editable: this.props.editable === undefined ? "true": this.props.editable
}
}
@ -61,6 +60,26 @@ export default class EditSlideContent extends React.Component {
}
// 日期格式变化加载数据
handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
let declareMonth = []
if(startDate != "" && startDate != undefined) {
declareMonth.push(startDate);
}
if(endDate != "" && endDate != undefined) {
declareMonth.push(endDate);
}
let item = {
taxAgentId: taxAgentId
}
if(declareMonth.length != 0) {
item.taxYearMonth = declareMonth
}
this.fetchCumDeductDetailList(item)
}
render() {
const { taxAgentStore: {taxAgentOption}} = this.props;
const { cumSituationStore } = this.props;
@ -78,12 +97,12 @@ export default class EditSlideContent extends React.Component {
<div className="monthPickerWrapper">
<MonthPicker width={100} format="YYYY-MM" value={startDate}
onChange={(v) => {
let startDate = moment(v).format("YYYY-MM")
let startDate = "";
if(v != "" && v!= undefined) {
startDate = moment(v).format("YYYY-MM")
}
this.setState({startDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>
@ -94,12 +113,12 @@ export default class EditSlideContent extends React.Component {
<MonthPicker width={100}
value={endDate}
onChange={(v) => {
let endDate = moment(v).format("YYYY-MM")
let endDate = ""
if(v != "" && v!= undefined) {
endDate = moment(v).format("YYYY-MM")
}
this.setState({endDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>

View File

@ -30,8 +30,8 @@ export default class EditSlideContent extends React.Component {
super(props);
this.state = {
taxAgentId: "",
startDate: moment(new Date()).format("YYYY-MM"),
endDate: moment(new Date()).format("YYYY-MM"),
startDate: "",
endDate: "",
editable: this.props.editable === undefined ? "true": this.props.editable
}
}
@ -60,6 +60,25 @@ export default class EditSlideContent extends React.Component {
getOtherDeductDetailList(currentRecord.id, param);
}
// 日期格式变化加载数据
handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
let declareMonth = []
if(startDate != "" && startDate != undefined) {
declareMonth.push(startDate);
}
if(endDate != "" && endDate != undefined) {
declareMonth.push(endDate);
}
let item = {
taxAgentId: taxAgentId
}
if(declareMonth.length != 0) {
item.declareMonth = declareMonth
}
this.fetchCumDeductDetailList(item)
}
render() {
const { taxAgentStore: {taxAgentOption}} = this.props;
@ -78,12 +97,12 @@ export default class EditSlideContent extends React.Component {
<div className="monthPickerWrapper">
<MonthPicker width={100} format="YYYY-MM" value={startDate}
onChange={(v) => {
let startDate = moment(v).format("YYYY-MM")
let startDate = "";
if(v != "" && v!= undefined) {
startDate = moment(v).format("YYYY-MM")
}
this.setState({startDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>
@ -94,12 +113,12 @@ export default class EditSlideContent extends React.Component {
<MonthPicker width={100}
value={endDate}
onChange={(v) => {
let endDate = moment(v).format("YYYY-MM")
let endDate = ""
if(v != "" && v!= undefined) {
endDate = moment(v).format("YYYY-MM")
}
this.setState({endDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
}}
/>
</div>
@ -114,10 +133,7 @@ export default class EditSlideContent extends React.Component {
value={taxAgentId}
onChange={v => {
this.setState({taxAgentId: v})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: v
})
this.handleFetchCumDeductDetailList(startDate, endDate, v)
}}
/>
</Col>

View File

@ -152,7 +152,9 @@ export default class Ledger extends React.Component {
handleCopySave = (value) => {
const { ledgerStore: { doCopy}} = this.props
doCopy(this.state.currentReocrd.id, value)
doCopy(this.state.currentReocrd.id, value).then(() => {
this.setState({copyFormVisible: false})
})
}
handleNew = () => {

View File

@ -38,7 +38,7 @@ export default class SalaryItemForm extends React.Component {
const {ledgerStore: {itemGroups, setItemGroups}} = this.props;
let groups = [...itemGroups]
groups.map(i => {
if(i.tlitle == item.title) {
if(i.title == item.title) {
item.items = dataSource
}
})
@ -50,8 +50,9 @@ export default class SalaryItemForm extends React.Component {
const { ledgerStore: {itemGroups, setItemGroups} } = this.props;
let newItemGroups = [...itemGroups]
newItemGroups.map(group => {
group.id = item.id
group.items = dataSource
if(group.id == item.id) {
group.items = dataSource
}
})
setItemGroups(newItemGroups)
}
@ -61,6 +62,26 @@ export default class SalaryItemForm extends React.Component {
this.setState({previewVisible: true})
}
// 修改薪资分类标题回调
handleItemTitleChange(item, value) {
const { ledgerStore: {itemGroups, setItemGroups} } = this.props;
let newItemGroups = [...itemGroups]
newItemGroups.map(group => {
if(group.id == item.id) {
group.name = value
}
})
setItemGroups(newItemGroups)
}
// 删除分类回调
handleGroupDelete(item) {
const { ledgerStore: {itemGroups, setItemGroups} } = this.props;
let newItemGroups = [...itemGroups]
newItemGroups = newItemGroups.filter(group => group.id !== item.id)
setItemGroups(newItemGroups)
}
render() {
const {ledgerStore: {itemGroups, salaryItems, empBrowserList, setAddCategoryVisible, addCategoryVisible}} = this.props;
const { previewVisible } = this.state;
@ -99,7 +120,7 @@ export default class SalaryItemForm extends React.Component {
if(item.items) {
item.items.map(i => {i.key = i.id})
return (
<CanMoveItem dataSource={item.items} onDataSourceChange={(dataSource) => {this.handleItemDataSourceChange(dataSource, item)}}title={item.name} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/>
<CanMoveItem dataSource={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 ""

View File

@ -8,7 +8,7 @@ export default class AddCategoryModal extends React.Component {
constructor(props) {
super(props)
this.state = {
name: ""
name: this.props.title ? this.props.title : ""
}
}
render() {

View File

@ -5,6 +5,7 @@ import { slideStep3Columns } from '../columns'
import AddSalaryItemModal from './AddSalaryItemModal'
import { inject, observer } from 'mobx-react';
import FormalFormModal from '../../salaryItem/formalFormModal'
import AddCategoryModal from '../step3/AddCategoryModal'
@inject('ledgerStore')
@observer
@ -35,11 +36,13 @@ export default class CanMoveItem extends React.Component {
showContent: true,
selectedRowKeys: [],
columns,
formalModalVisible: false
formalModalVisible: false,
addCategoryVisible: false
}
this.formulaId = ""
this.record = {}
this.title = ""
}
// 编辑公式
@ -95,18 +98,57 @@ export default class CanMoveItem extends React.Component {
this.props.onDataSourceChange(dataSource)
}
// 编辑分类名称
handleUpdateCategorySave(name) {
this.props.onTitleChange && this.props.onTitleChange(name)
this.setState({
addCategoryVisible: false
})
}
// 修改分类名称,弹出修改弹出
handleEditGroupIconClick(title) {
this.title = title
this.setState({addCategoryVisible : true})
}
// 删除分类回调
handleDeleteGroupIconClick() {
Modal.confirm({
title: '信息确认',
content: '确认删除',
onOk:() => {
this.props.onGroupDelete && this.props.onGroupDelete()
},
onCancel: () => {
},
});
}
render() {
const {ledgerStore: {setAddItemVisible, addItemVisible}} = this.props;
const { selectedRowKeys, formalModalVisible } = this.state;
const { selectedRowKeys, formalModalVisible, addCategoryVisible } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange,
getCheckboxProps: (record) => ({
disabled: !record.canDelete,
}),
};
return (
<div className="tableItemWrapper">
<div style={{padding: "10px"}}>
<span className="itemTitle">{this.props.title}</span>
<span className="itemTitle">{this.props.title}
{
this.props.title !== "未分类" && <span>
<i className="icon-coms-edit" style={{marginLeft: "10px", marginRight: "10px", cursor:"pointer"}} onClick={() => {this.handleEditGroupIconClick(this.props.title)}}/>
<i className="icon-coms-Delete" style={{cursor:"pointer"}} onClick={() => {this.handleDeleteGroupIconClick()}}/>
</span>
}
</span>
<span className="rightBtnsWrapper">
<Icon className="iconItem" type="minus-square" onClick={() => {this.handleDelete()}}/>
<Icon className="iconItem" type="plus-square" onClick={() => { this.setState({addItemVisible: true}) }}/>
@ -138,6 +180,13 @@ export default class CanMoveItem extends React.Component {
/>
}
{/* 编辑分类名称 */}
{
addCategoryVisible &&
<AddCategoryModal title={this.title} onSave={(value) => {this.handleUpdateCategorySave(value)}} visible={addCategoryVisible} onCancel={() => {
this.setState({addCategoryVisible: false})
}} />
}
</div>
)
}

View File

@ -258,14 +258,19 @@ export class LedgerStore {
// 复制
@action doCopy = (id, name) => {
API.duplicateLedger({id, name}).then(res => {
if(res.status) {
message.success("复制成功")
this.getTableDatas({});
} else {
message.error(res.errormsg || "复制失败")
}
return new Promise((resolve, reject) => {
API.duplicateLedger({id, name}).then(res => {
if(res.status) {
message.success("复制成功")
this.getTableDatas({});
resolve();
} else {
message.error(res.errormsg || "复制失败")
reject();
}
})
})
}
@ -543,8 +548,6 @@ export class LedgerStore {
}
})
})
}
// 调薪计薪规则保存