福利台账分权

This commit is contained in:
MustangDeng 2022-06-09 18:30:19 +08:00
parent adc089b033
commit aebb43b461
7 changed files with 112 additions and 43 deletions

View File

@ -170,3 +170,13 @@ export const commonAccount = (params) => {
body: JSON.stringify(params),
}).then((res) => res.json());
};
// 获取当前管理员下的所有的个税扣缴义务人
export const getAdminTaxAgentList = () => {
return WeaTools.callApi(
"/api/bs/hrmsalary/siaccount/getAdminTaxAgentList",
"get",
{}
);
}

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { Button, Form, Input } from "antd";
import { WeaDatePicker, WeaDialog } from "ecCom";
import { WeaDatePicker, WeaDialog, WeaSelect } from "ecCom";
const createForm = Form.create;
const FormItem = Form.Item;
@ -56,6 +56,18 @@ class Accountdialog extends Component {
})}
/>
</FormItem>
{
this.props.isAdmin && <FormItem {...formItemLayout} label="个税扣缴义务人">
<WeaSelect
style={{ width: "100%" }}
options={this.props.options}
{...getFieldProps("paymentOrganization", {
initialValue: "",
rules: [{ required: true, message: "请选择个税扣缴义务人" }],
})}
/>
</FormItem>
}
<FormItem {...formItemLayout} label="备注">
<Input
type="textarea"

View File

@ -18,7 +18,7 @@ import _ from "lodash";
// import { columns, dataSource } from './columns';
import "./index.less";
@inject("standingBookStore")
@inject("standingBookStore", "taxAgentStore")
@observer
export default class StandingBook extends React.Component {
constructor(props) {
@ -34,6 +34,8 @@ export default class StandingBook extends React.Component {
dialogProps: {
title: "",
visible: false,
options: [],
isAdmin: false
},
drawerProps: {
title: "",
@ -48,14 +50,39 @@ export default class StandingBook extends React.Component {
list: [],
total: 0,
},
adminData: {}
};
this.payload = {}
this.pageInfo = {current: 1, pageSize: 10}
}
componentDidMount() {
const { current } = this.state;
this.getCommonList({ ...this.state.tableParams, current });
const { current, dialogProps } = this.state;
const { taxAgentStore: {getPermission}, standingBookStore: {getAdminTaxAgentList}} = this.props
getPermission().then(({status, data}) => {
if(status) {
console.log("data:", data);
this.setState({adminData : data})
if(data.isAdminEnable) {
getAdminTaxAgentList().then((data) => {
let taxAgentList = data.map(item => {
let result = {}
result.showname = item.name
result.key = item.id + ""
result.selected = false
return result
})
this.setState({dialogProps: {
...dialogProps,
options: taxAgentList,
isAdmin: true
}})
})
}
this.getCommonList({ ...this.state.tableParams, current });
}
})
}
getCommonList = (payload = {}) => {
@ -71,7 +98,7 @@ export default class StandingBook extends React.Component {
<a
href="javascript:;"
className="linkTo"
onClick={() => this.handleGoDetail(billMonth)}>
onClick={() => this.handleGoDetail(billMonth, "detail", r.paymentOrganizationId)}>
{text}
</a>
);
@ -85,7 +112,7 @@ export default class StandingBook extends React.Component {
list,
columns: [
...columns,
{
(!this.state.adminData.isDefaultOpen || (this.state.adminData.isDefaultOpen && this.state.adminData.isAdminEnable)) ? {
title: "操作",
dataIndex: "action",
key: "action",
@ -97,7 +124,7 @@ export default class StandingBook extends React.Component {
<a
href="javascript:;"
className="linkTo"
onClick={() => this.handleGoDetail(billMonth)}>
onClick={() => this.handleGoDetail(billMonth, "", r.paymentOrganizationId)}>
{" "}
核算{" "}
</a>
@ -107,7 +134,7 @@ export default class StandingBook extends React.Component {
overlay={
<Menu
onClick={({ key }) =>
this.handleOperate({ key, billMonth })
this.handleOperate({ key, billMonth, paymentOrganizationId: r.paymentOrganizationId })
}>
<Menu.Item key="archive">归档</Menu.Item>
{/* <Menu.Item key="detail">异常详情</Menu.Item> */}
@ -123,7 +150,7 @@ export default class StandingBook extends React.Component {
overlay={
<Menu
onClick={({ key }) =>
this.handleOperate({ key, billMonth })
this.handleOperate({ key, billMonth, paymentOrganizationId: r.paymentOrganizationId})
}>
<Menu.Item key="view">查看</Menu.Item>
{/* <Menu.Item key="operate">操作日志</Menu.Item> */}
@ -135,7 +162,7 @@ export default class StandingBook extends React.Component {
</React.Fragment>
);
},
},
} : {},
],
total,
},
@ -171,14 +198,14 @@ export default class StandingBook extends React.Component {
});
}
handleGoDetail = (billMonth, detail) => {
handleGoDetail = (billMonth, detail, paymentOrganization) => {
if(detail) {
window.open(
`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?type=${detail}&billMonth=${billMonth}`
`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?type=${detail}&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`
);
} else {
window.open(
`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?billMonth=${billMonth}`
`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`
);
}
@ -192,7 +219,7 @@ export default class StandingBook extends React.Component {
handleOperate = (payload) => {
const { siaccountFile, siaccountDelete, deleteLoading } =
this.props.standingBookStore;
const { key, billMonth } = payload;
const { key, billMonth, paymentOrganizationId } = payload;
switch (key) {
case "archive":
Modal.confirm({
@ -235,7 +262,7 @@ export default class StandingBook extends React.Component {
});
break;
case "view":
this.handleGoDetail(billMonth, "detail");
this.handleGoDetail(billMonth, "detail", paymentOrganizationId);
break;
default:
break;
@ -244,6 +271,7 @@ export default class StandingBook extends React.Component {
handleOk = (formVal) => {
const { save } = this.props.standingBookStore;
const { billMonth, ...extra } = formVal;
console.log("extra:", extra);
const payload = {
billMonth: moment(billMonth).format("YYYY-MM"),
...extra,
@ -255,7 +283,7 @@ export default class StandingBook extends React.Component {
...this.state.tableParams,
current: this.state.current,
});
this.handleGoDetail(moment(billMonth).format("YYYY-MM"));
this.handleGoDetail(moment(billMonth).format("YYYY-MM"), "", extra.paymentOrganization ? extra.paymentOrganization : "");
});
};
@ -325,7 +353,7 @@ export default class StandingBook extends React.Component {
return renderNoright();
}
const rightBtns = [
const rightBtns = (!this.state.adminData.isDefaultOpen || this.state.adminData.isDefaultOpen && this.state.adminData.isAdminEnable) ? [
// 右键菜单
<Button
type="primary"
@ -340,7 +368,7 @@ export default class StandingBook extends React.Component {
}}>
核算
</Button>
];
] : [];
const rightMenu = [
// 右键菜单
{

View File

@ -36,36 +36,36 @@ export default class NormalIndex extends Component {
}
componentDidMount() {
const { billMonth, selectedKey } = this.props;
const { billMonth, selectedKey, paymentOrganization } = this.props;
const { current } = this.state;
selectedKey === "1"
? this.getNormalList({ billMonth, current })
: this.getSupplementaryList({ billMonth, current });
? this.getNormalList({ billMonth, current, paymentOrganization })
: this.getSupplementaryList({ billMonth, current, paymentOrganization });
}
componentWillReceiveProps(nextProps) {
if (nextProps.selectedKey != this.props.selectedKey) {
const { billMonth } = nextProps;
const { billMonth, paymentOrganization } = nextProps;
const { current } = this.state;
nextProps.selectedKey === "1"
? this.getNormalList({ billMonth, current })
: this.getSupplementaryList({ billMonth, current });
? this.getNormalList({ billMonth, current, paymentOrganization })
: this.getSupplementaryList({ billMonth, current, paymentOrganization });
}
}
handleSearch(value) {
const { billMonth, selectedKey } = this.props;
const { billMonth, selectedKey, paymentOrganization } = this.props;
const { current } = this.state;
selectedKey === "1"
? this.getNormalList({ billMonth, current, userName:value })
: this.getSupplementaryList({ billMonth, current, userName:value });
? this.getNormalList({ billMonth, current, paymentOrganization, userName:value })
: this.getSupplementaryList({ billMonth, current, paymentOrganization, userName:value });
}
handleSave = () => {
const { siaccountCommonSave, siaccountSupplementarySave, form } =
this.props.standingBookStore;
const { billMonth, selectedKey } = this.props;
const { billMonth, selectedKey, paymentOrganization } = this.props;
if (selectedKey === "1") {
const { includes, excludes } = form.getFormParams();
const payload = {
@ -75,7 +75,7 @@ export default class NormalIndex extends Component {
};
siaccountCommonSave(payload).then(() => {
message.success("添加成功");
this.getNormalList({ billMonth, current: this.state.current });
this.getNormalList({ billMonth, paymentOrganization, current: this.state.current });
this.setState({
addProps: {
...this.state.addProps,
@ -206,7 +206,7 @@ export default class NormalIndex extends Component {
const { siaccountCommonDelete } = this.props.standingBookStore;
const { list } = this.state.tableData;
const { selectedRowKeys } = this.state;
const { billMonth, selectedKey } = this.props;
const { billMonth, selectedKey, paymentOrganization } = this.props;
if (_.isEmpty(selectedRowKeys)) {
message.warning("未勾选数据!");
} else {
@ -222,10 +222,11 @@ export default class NormalIndex extends Component {
message.success("删除成功");
this.setState({ selectedRowKeys: [] });
selectedKey === "1"
? this.getNormalList({ billMonth, current: this.state.current })
? this.getNormalList({ billMonth, paymentOrganization, current: this.state.current })
: this.getSupplementaryList({
billMonth,
current: this.state.current,
paymentOrganization
});
});
},
@ -253,15 +254,15 @@ export default class NormalIndex extends Component {
// 核算按钮点击
handleCommonAccountClick() {
const { remarks, billMonth, selectedKey } = this.props;
const { remarks, billMonth, selectedKey, paymentOrganization } = this.props;
const { commonAccount } =
this.props.standingBookStore;
commonAccount({
billMonth, includes: []
}).then(() => {
selectedKey === "1"
? this.getNormalList({ billMonth, current: this.state.current })
: this.getSupplementaryList({ billMonth, current: this.state.current });
? this.getNormalList({ billMonth, paymentOrganization, current: this.state.current })
: this.getSupplementaryList({ billMonth, paymentOrganization, current: this.state.current });
})
}
render() {
@ -311,7 +312,7 @@ export default class NormalIndex extends Component {
)}
<div className="tabOption">
{
this.props.type !== "detail" ?
this.props.type !== "detail" && this.props.selectedKey == "3" ?
<span>
<Tooltip title="批量删除">
<i
@ -357,7 +358,7 @@ export default class NormalIndex extends Component {
<Tooltip title="导出全部">
<i className="icon-coms02-coms2-export" />
</Tooltip> */}
{selectedKey === "1" && this.props.type !== "detail" && <Button type="primary" onClick={() => {this.handleCommonAccountClick()}}>核算</Button>}
{/* {selectedKey === "1" && this.props.type !== "detail" && <Button type="primary" onClick={() => {this.handleCommonAccountClick()}}>核算</Button>} */}
<WeaInputSearch value={this.state.searchValue} onChange={(value) => {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/>
</div>

View File

@ -26,8 +26,8 @@ export default class OverViewIndex extends Component {
}
componentDidMount() {
const { billMonth } = this.props;
this.getOverViewList({ billMonth });
const { billMonth, paymentOrganization } = this.props;
this.getOverViewList({ billMonth, paymentOrganization });
}
getOverViewList = (payload = {}) => {
@ -63,7 +63,7 @@ export default class OverViewIndex extends Component {
);
};
render() {
const { remarks, billMonth, selectedKey } = this.props;
const { remarks, billMonth, selectedKey, paymentOrganization } = this.props;
const { selectedRowKeys } = this.state;
const { loading } = this.props.standingBookStore;
let { list, columns, total } = this.state.tableData;

View File

@ -23,17 +23,20 @@ class StandingBookDetail extends Component {
billMonth: '',
}
this.type = ""
this.paymentOrganization = ""
}
componentDidMount() {
this.getTabList();
}
getTabList = (payload = {}) => {
const { getTabList } = this.props.standingBookStore;
const billMonth = this.props.location.query.billMonth;
this.paymentOrganization = this.props.location.query.paymentOrganization;
this.type = this.props.location.query.type;
getTabList({ billMonth }).then(({ data }) => {
getTabList({ billMonth, paymentOrganization: this.paymentOrganization }).then(({ data }) => {
const { tabList, remarks, billMonth } = data;
let newTabList = tabList.filter(item => item.id != "2")
this.setState({
@ -58,15 +61,15 @@ class StandingBookDetail extends Component {
/>
{
(selectedKey === '1' || selectedKey === '3') &&
<NormalIndex selectedKey={selectedKey} remarks={remarks} billMonth={billMonth} type={this.type}/>
<NormalIndex selectedKey={selectedKey} remarks={remarks} billMonth={billMonth} type={this.type} paymentOrganization={this.paymentOrganization}/>
}
{
selectedKey === '2' &&
<AbnormalListIndex billMonth={billMonth} type={this.type}/>
<AbnormalListIndex billMonth={billMonth} type={this.type} paymentOrganization={this.paymentOrganization}/>
}
{
selectedKey === '4' &&
<OverViewIndex billMonth={billMonth} type={this.type}/>
<OverViewIndex billMonth={billMonth} type={this.type} paymentOrganization={this.paymentOrganization}/>
}
</div>
);

View File

@ -364,4 +364,19 @@ export class StandingBookStore {
})
}
// 获取当前管理员下的所有个税扣缴义务人
@action
getAdminTaxAgentList = () => {
return new Promise((resolve, reject) => {
API.getAdminTaxAgentList().then(res => {
if(res.status) {
resolve(res.data);
} else {
message.error(res.errormsg || "接口调用失败!")
reject();
}
})
})
}
}