福利台账分权

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), body: JSON.stringify(params),
}).then((res) => res.json()); }).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 React, { Component } from "react";
import { Button, Form, Input } from "antd"; import { Button, Form, Input } from "antd";
import { WeaDatePicker, WeaDialog } from "ecCom"; import { WeaDatePicker, WeaDialog, WeaSelect } from "ecCom";
const createForm = Form.create; const createForm = Form.create;
const FormItem = Form.Item; const FormItem = Form.Item;
@ -56,6 +56,18 @@ class Accountdialog extends Component {
})} })}
/> />
</FormItem> </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="备注"> <FormItem {...formItemLayout} label="备注">
<Input <Input
type="textarea" type="textarea"

View File

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

View File

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

View File

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

View File

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