Merge branch 'feature/2.15.1.2407.01-权限' into feature/2.15.2.2409.01合并业务线测试

This commit is contained in:
黎永顺 2024-09-30 10:30:32 +08:00
commit 3107914834
15 changed files with 328 additions and 117 deletions

View File

@ -160,3 +160,11 @@ export const getAuthOptTree = (params) => {
export const getRole = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/auth/role/getRole", "GET", params);
};
//成员明细列表
export const authMemberDetail = (params) => {
return postFetch("/api/bs/hrmsalary/auth/member/detail", params);
};
//数据明细列表
export const authDataDetail = (params) => {
return postFetch("/api/bs/hrmsalary/auth/data/detail", params);
};

View File

@ -97,7 +97,6 @@ class CustomBrowserDialog extends Component {
}
}
};
onLeftListCheck = (keys, datas) => {
const { leftListSelectedData } = this.state;
let targets = leftListSelectedData.concat(datas);
@ -154,6 +153,31 @@ class CustomBrowserDialog extends Component {
}
return bool;
};
renderTitle = () => {
const { dialogType, searchParamsKey, isSingle } = this.props, {
query, pageInfo, selectedRowKeys, singleFilterVal
} = this.state;
return (<div className="wea-hr-muti-dialog-title">
<span>{getLabel(111, "数据选择")}</span>
{
dialogType === "table" ?
<WeaInputSearch
value={query[searchParamsKey]} style={{ width: 220 }}
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
onSearch={() => {
this.setState({ pageInfo: { ...pageInfo, current: 1 } }, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
}}/> : isSingle ?
<WeaInputSearch value={singleFilterVal} onChange={singleFilterVal => this.setState({ singleFilterVal })}/> :
<div/>
}
</div>);
};
render() {
const {
@ -161,7 +185,7 @@ class CustomBrowserDialog extends Component {
singleFilterVal
} = this.state;
const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props;
const sheight = this.dialog ? this.dialog.state.height - 55 : 260;
const sheight = this.dialog ? this.dialog.state.height - 116 : 260;
const buttons = [
<Button type="primary" onClick={this.handleOk}
disabled={dialogType !== "table" && _.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
@ -172,7 +196,7 @@ class CustomBrowserDialog extends Component {
if (rightCheckedKeys && rightCheckedKeys.length > 0) leftActive = true;
if (rightDatas && rightDatas.length > 0) rightAllActive = true;
let dom = <Spin spinning={loading}>
<div style={{ padding: 10, height: "100%" }} className="wea-hr-muti-dialog">
<div className="wea-hr-muti-dialog">
{
!isSingle ? <React.Fragment>
<div className="wea-hr-muti-input-left">
@ -184,7 +208,7 @@ class CustomBrowserDialog extends Component {
</Col>
</Row>
<div>
<WeaNewScroll height={sheight}>
<WeaNewScroll height={this.dialog ? this.dialog.state.height - 51 : 260}>
<CustomBrowserMutiLeft
filterData={rightDatas}
datas={listDatas}
@ -209,19 +233,16 @@ class CustomBrowserDialog extends Component {
</div>
<div className="wea-hr-muti-input-right">
<CustomBrowserMutiRight
height={sheight} data={rightDatas} checkedKeys={rightCheckedKeys}
height={this.dialog ? this.dialog.state.height - 51 : 260}
data={rightDatas} checkedKeys={rightCheckedKeys}
checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })}
onDoubleClick={this.onRightDoubleClick}
/>
</div>
</React.Fragment> :
<React.Fragment>
<WeaInputSearch value={singleFilterVal} style={{ width: "100%", marginBottom: 10 }}
onChange={singleFilterVal => this.setState({ singleFilterVal })}/>
<WeaTransferList height={this.dialog ? this.dialog.state.height - 65 : 260} checkedKeys={[]}
checkedCb={([id]) => this.handleRowClick(_.find(listDatas, item => item.id === id))}
data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/>
</React.Fragment>
<WeaTransferList height={this.dialog ? this.dialog.state.height - 16 : 260} checkedKeys={[]}
checkedCb={([id]) => this.handleRowClick(_.find(listDatas, item => item.id === id))}
data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/>
}
</div>
</Spin>;
@ -257,33 +278,20 @@ class CustomBrowserDialog extends Component {
selectedRowKeys,
onChange: selectedRowKeys => this.setState({ selectedRowKeys })
};
dom = <React.Fragment>
<WeaInputSearch value={query[searchParamsKey]} className="tableSearch"
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
onSearch={() => {
this.setState({ pageInfo: { ...pageInfo, current: 1 } }, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
}}/>
dom = <div className="wea-hr-muti-input-table">
<WeaTable dataSource={listDatas} loading={loading} pagination={pagination} scroll={{ y: sheight }}
onRowClick={this.handleRowClick} rowSelection={!isSingle ? rowSelection : null}
rowKey={rowKey || "id"} columns={columns}/>
</React.Fragment>;
</div>;
}
dialogType === "table" && isSingle && buttons.splice(0, 1);
return (
<WeaDialog
{...this.props} initLoadCss ref={dom => this.dialog = dom} title={getLabel(111, "数据选择")}
className="custom_browser_dialog" style={{
{...this.props} initLoadCss ref={dom => this.dialog = dom} title={this.renderTitle()}
className="custom_browser_dialog" draggable={false} style={{
width: 784, height: 460, minHeight: 200, minWidth: 380,
maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)"
}} buttons={buttons}>
{dom}
</WeaDialog>
}} buttons={buttons}>{dom}</WeaDialog>
);
}
}

View File

@ -1,10 +1,18 @@
.custom_browser_dialog {
.tableSearch {
float: right;
margin: 16px;
position: relative;
z-index: 99;
min-width: 200px;
.wea-hr-muti-dialog-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.wea-hr-muti-input-table {
background: #f6f6f6;
padding: 8px 16px;
height: 100%;
.wea-new-table {
background: #FFF;
}
}
.ant-spin-nested-loading, .ant-spin-container {
@ -12,6 +20,19 @@
}
.wea-hr-muti-dialog {
height: 100%;
background: #f6f6f6;
padding: 8px 16px;
.wea-hr-muti-input-left, .wea-hr-muti-input-right {
background: #FFF;
}
.wea-transfer-list {
background: #FFF;
border: 1px solid #e9e9e9;
}
.wea-input-focus {
height: 35px !important;
width: 100% !important;

View File

@ -99,3 +99,22 @@
}
}
}
.authDetail_dialog {
.authDetail-dialog-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.authDetail-table {
background: #f6f6f6;
padding: 8px 16px;
height: 100%;
.wea-new-table {
background: #FFF;
}
}
}

View File

@ -0,0 +1,97 @@
/*
* 角色详情设置弹窗
* 成员数据明细查询
* @Author: 黎永顺
* @Date: 2024/9/27
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaTable } from "ecCom";
import * as API from "../../../../apis/taxAgent";
import "../index.less";
const getLabel = WeaLocaleProvider.getLabel;
const APIFOX = {
"auth.MemberTargetTypeEnum": API.authMemberDetail,
"auth.DataTargetTypeEnum": API.authDataDetail
};
class DetailDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 },
query: { username: "" }, dataSource: [], columns: []
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getData(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({
query: { username: "" }, pageInfo: { current: 1, pageSize: 10, total: 0 }
});
}
getData = (props) => {
const { pageInfo, query } = this.state, { roleId, selectedKey } = props || this.props;
let payload = { ...pageInfo, ...query, roleId };
this.setState({ loading: true });
APIFOX[selectedKey](payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
this.setState({
columns, dataSource, pageInfo: { ...pageInfo, current, pageSize, total }
});
}
});
};
renderTitle = () => {
const { selectedKey } = this.props, { query } = this.state;
const title = selectedKey === "auth.MemberTargetTypeEnum" ? getLabel(111, "成员明细") : getLabel(111, "数据明细");
return (<div className="authDetail-dialog-title">
<span>{title}</span>
<WeaInputSearch value={query.username} onChange={v => this.setState({ query: { username: v } })}
onSearch={v => this.setState({ pageInfo: { current: 1 } }, () => this.getData())}/>
</div>);
};
render() {
const { loading, dataSource, pageInfo, columns } = this.state;
const sheight = this.dialog ? this.dialog.state.height - 120 : 260;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getData());
},
onChange: current => {
this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getData());
}
};
return (
<WeaDialog
{...this.props} initLoadCss ref={dom => this.dialog = dom} title={this.renderTitle()}
className="authDetail_dialog" style={{
width: 784, height: 460, minHeight: 200, minWidth: 380,
maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)"
}} buttons={[]}>
<div className="authDetail-table">
<WeaTable dataSource={dataSource} loading={loading} pagination={pagination} scroll={{ y: sheight }}
rowKey="id" columns={columns}/>
</div>
</WeaDialog>
);
}
}
export default DetailDialog;

View File

@ -24,6 +24,7 @@ import {
} from "ecCom";
import { commonEnumList } from "../../../../apis/archive";
import EditRoleDialog from "./editRoleDialog";
import DetailDialog from "./detailDialog";
import AuthTree from "./authTree";
import * as API from "../../../../apis/taxAgent";
import { Button, Col, message, Modal, Row } from "antd";
@ -55,6 +56,7 @@ class Index extends Component {
replaceDatas: [], loading: { set: false, query: false, async: false, delete: false },
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
editOperatorDialog: { visible: false, linkOptions: [], record: {} },
detailDialog: { visible: false, roleId: "", selectedKey: "" },
dataTargetSettings: { link: "OR", sortedIndex: null }, conditions: [],
formData: { taxAgentIds: [], sobIds: [] }
};
@ -63,7 +65,11 @@ class Index extends Component {
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
this.setState({
name: nextProps.name, selectedKey: nextProps.selectedKey || "baseinfo"
name: nextProps.name, selectedKey: nextProps.selectedKey || "baseinfo",
detailDialog: {
...this.state.detailDialog, roleId: nextProps.roleId,
selectedKey: nextProps.selectedKey || "baseinfo"
}
}, () => {
!["auth.AuthTargetTypeEnum", "baseinfo"].includes(this.state.selectedKey) && this.getEnumList();
!["auth.AuthTargetTypeEnum", "baseinfo"].includes(this.state.selectedKey) && this.getSettingRoler(nextProps.roleId);
@ -220,6 +226,7 @@ class Index extends Component {
this.setState({ loading: { ...this.state.loading, set: false } });
if (status) {
message.success(getLabel(111, "操作成功!"));
this.props.onSearch && this.props.onSearch();
} else {
message.error(errormsg);
}
@ -253,6 +260,7 @@ class Index extends Component {
this.setState({ async: false });
if (status) {
message.success(getLabel(111, "操作成功!"));
this.props.onSearch && this.props.onSearch();
} else {
message.error(errormsg);
}
@ -345,17 +353,19 @@ class Index extends Component {
};
render() {
const { roleId, taxAgentStore } = this.props;
const { roleId, taxAgentStore, counts } = this.props;
const {
selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys, editOperatorDialog,
dataTargetSettings
dataTargetSettings, detailDialog
} = this.state;
const { linkOptions } = editOperatorDialog;
const tabs = [
{ title: getLabel(111, "基础信息"), viewcondition: "baseinfo" },
{ title: getLabel(111, "成员设置"), viewcondition: "auth.MemberTargetTypeEnum" },
{ title: getLabel(111, "功能权限"), viewcondition: "auth.AuthTargetTypeEnum" },
{ title: getLabel(111, "数据范围"), viewcondition: "auth.DataTargetTypeEnum" }
{ title: getLabel(111, "基础信息"), viewcondition: "baseinfo", showcount: true, count: "resources" },
{
title: getLabel(111, "成员设置"), viewcondition: "auth.MemberTargetTypeEnum", showcount: true, count: "members"
},
{ title: getLabel(111, "功能权限"), viewcondition: "auth.AuthTargetTypeEnum", showcount: true, count: "opts" },
{ title: getLabel(111, "数据范围"), viewcondition: "auth.DataTargetTypeEnum", showcount: true, count: "datas" }
];
const pagination = {
...pageInfo,
@ -383,6 +393,11 @@ class Index extends Component {
];
["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && buttons.shift();
!["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && buttons.pop();
!["auth.AuthTargetTypeEnum", "baseinfo"].includes(selectedKey) && buttons.unshift(
<Button type="primary" onClick={() => this.setState({
detailDialog: { ...detailDialog, visible: true }
})}>{selectedKey === "auth.MemberTargetTypeEnum" ? getLabel(111, "成员明细") : getLabel(111, "数据明细")}</Button>
);
return (
<WeaDialog
{...this.props} hasScroll className="tax_role_set_dialog" initLoadCss
@ -395,9 +410,10 @@ class Index extends Component {
<div className="tax_role_set_container">
<Row>
<div className="tax_role_form_item">
<WeaTab datas={tabs} keyParam="viewcondition" selectedKey={selectedKey}
<WeaTab datas={tabs} keyParam="viewcondition" selectedKey={selectedKey} countParam="count" counts={counts}
onChange={v => this.setState({
selectedKey: v, replaceDatas: [], selectedRowKeys: []
selectedKey: v, replaceDatas: [], selectedRowKeys: [],
detailDialog: { ...detailDialog, selectedKey: v }
}, () => {
taxAgentStore.roleForm.resetForm();
const { selectedKey } = this.state;
@ -464,6 +480,9 @@ class Index extends Component {
onCancel={callback => this.setState({
editOperatorDialog: { ...editOperatorDialog, visible: false, record: {} }
}, () => callback && callback())}/>
{/*成员、数据明细查看*/}
<DetailDialog {...detailDialog}
onCancel={() => this.setState({ detailDialog: { ...detailDialog, visible: false } })}/>
</Col>
</Row>
}

View File

@ -30,8 +30,11 @@ class Index extends Component {
this.state = {
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
loading: false, selectedRowKeys: [], addRoleDialog: { taxAgentId: "", visible: false },
roleSetDialog: { visible: false, roleId: "", name: "", selectedKey: "" },
logDialogVisible: false, filterConditions: "", showSearchAd: false, syncLoading: false
logDialogVisible: false, filterConditions: "", showSearchAd: false, syncLoading: false,
roleSetDialog: {
visible: false, roleId: "", name: "", selectedKey: "",
counts: { datas: 0, members: 0, resources: 0, opts: 0 }
}
};
}
@ -106,12 +109,30 @@ class Index extends Component {
</React.Fragment>
)
}]
}, () => {
const { roleSetDialog, dataSource } = this.state;
roleSetDialog.roleId && this.setState({
roleSetDialog: {
...roleSetDialog, counts: {
...roleSetDialog.counts, ..._.reduce(_.keys(roleSetDialog.counts), (pre, cur) => ({
...pre, [cur]: _.find(dataSource, o => o.id === roleSetDialog.roleId)[cur] || 0
}), {})
}
}
});
});
}
});
};
showRoleSetDialog = (role) => this.setState({
roleSetDialog: { visible: true, roleId: role.id, name: role.name, selectedKey: role.selectedKey }
roleSetDialog: {
visible: true, roleId: role.id, name: role.name, selectedKey: role.selectedKey,
counts: {
...this.state.roleSetDialog.counts, ..._.reduce(_.keys(this.state.roleSetDialog.counts), (pre, cur) => ({
...pre, [cur]: role[cur] || 0
}), {})
}
}
});
deleteAuthRole = (payload) => {
Modal.confirm({
@ -204,7 +225,7 @@ class Index extends Component {
{/*角色详情设置*/}
<RoleDetailSetDialog {...roleSetDialog} onSearch={this.getRoleList}
onCancel={callback => this.setState({
roleSetDialog: { ...roleSetDialog, visible: false }
roleSetDialog: { ...roleSetDialog, visible: false, roleId: "" }
}, () => {
this.props.taxAgentStore.initRoleForm();
callback && callback();

View File

@ -14,6 +14,7 @@ import { Button, message } from "antd";
import { getSearchs } from "../../../../util";
import { salaryFileConditions } from "../../conditions";
import * as API from "../../../../apis/variableSalary";
import { postFetch } from "../../../../util/request";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@ -38,8 +39,9 @@ class Index extends Component {
}
}
initForm = (props) => {
const { baseTableStore: { VSSalaryFileForm }, detail, taxAgentOption } = props;
initForm = async (props) => {
const { baseTableStore: { VSSalaryFileForm }, detail } = props;
const { data: taxAgentOption } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" });
API.getCreateForm().then(({ data }) => {
this.setState({
conditions: [
@ -48,7 +50,8 @@ class Index extends Component {
if (getKey(o) === "taxAgentIds") {
return {
...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label),
options: taxAgentOption, value: detail[getKey(o)] || ""
options: _.map(taxAgentOption, o => ({ key: String(o.id), showname: o.name })),
value: detail[getKey(o)] ? String(detail[getKey(o)]) : ""
};
}
return {

View File

@ -30,12 +30,13 @@ class Index extends Component {
componentWillReceiveProps(nextProps, nextContext) {
const { importDialog } = this.state;
if (nextProps.visible !== this.props.visible && nextProps.visible) {
const { baseTableStore: { VSalryForm }, salaryMonth, taxAgentIds } = nextProps;
const payload = {
salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: importDialog.hasData
};
const { baseTableStore: { VSalryForm } } = nextProps;
const payload = { ...VSalryForm.getFormParams(), hasData: importDialog.hasData };
this.setState({
importDialog: { ...importDialog, salaryMonth, link: `${importDialog.link}?${convertToUrlString(payload)}` }
importDialog: {
...importDialog, salaryMonth: VSalryForm.getFormParams().salaryMonth,
link: `${importDialog.link}?${convertToUrlString(payload)}`
}
});
} else {
this.setState({
@ -48,9 +49,10 @@ class Index extends Component {
}
handleImport = (payload) => {
const { taxAgentIds } = this.props;
const { baseTableStore: { VSalryForm } } = this.props;
const { importDialog } = this.state;
const { salaryMonth } = importDialog;
const { taxAgentIds } = VSalryForm.getFormParams();
this.setState({ importDialog: { ...importDialog, nextloading: true } });
API.importVariableSalary({
...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",")
@ -64,14 +66,14 @@ class Index extends Component {
}).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } }));
};
renderFormComponent = () => {
const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props;
const { baseTableStore: { VSalryForm } } = this.props;
const { importDialog } = this.state;
const { salaryMonth: month, hasData } = importDialog;
return <div style={{ padding: "8px 16px", border: "1px solid #e5e5e5", margin: "4px 0" }}>
<WeaFormItem label={getLabel(111, "薪资所属月")} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<WeaDatePicker format="YYYY-MM" value={month}
onChange={val => {
const payload = { salaryMonth: val, hasData, taxAgentIds, ...VSalryForm.getFormParams() };
const payload = { ...VSalryForm.getFormParams(), salaryMonth: val, hasData };
this.setState({
importDialog: {
...importDialog, salaryMonth: val,
@ -98,9 +100,9 @@ class Index extends Component {
content={getLabel(543208, "导出现有数据")}
helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")}
onChange={val => {
const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props;
const { baseTableStore: { VSalryForm } } = this.props;
const { salaryMonth } = importDialog;
const payload = { salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: val === "1" };
const payload = { salaryMonth, ...VSalryForm.getFormParams(), hasData: val === "1" };
this.setState({
importDialog: {
...importDialog, hasData: val === "1",

View File

@ -42,7 +42,7 @@ class Index extends Component {
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.isQuery !== this.props.isQuery) this.setState({
pageInfo: { ...this.state.pageInfo, current: 1 }
}, () => this.getVariableSalaryList());
}, () => this.getVariableSalaryList(nextProps));
}
handleReceive = async ({ data }) => {
@ -68,13 +68,14 @@ class Index extends Component {
}
};
getVariableSalaryList = () => {
const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth, taxAgentIds } = this.props;
const { baseTableStore: { VSalryForm, getVariableSalaryList } } = this.props;
const { pageInfo } = this.state;
const { departmentIds } = VSalryForm.getFormParams();
const { departmentIds, taxAgentIds } = VSalryForm.getFormParams();
this.setState({ loading: true });
getVariableSalaryList({
...pageInfo, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(","),
...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : []
...pageInfo, ...VSalryForm.getFormParams(),
departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [],
taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",")
}).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {

View File

@ -9,7 +9,7 @@
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { message, Modal } from "antd";
import { message, Modal, Spin } from "antd";
import * as API from "../../../../apis/variableSalary";
const getLabel = WeaLocaleProvider.getLabel;
@ -103,9 +103,10 @@ class Index extends Component {
}, () => this.getVariableSalaryItemList());
}
};
return (
<WeaTable columns={columns} dataSource={dataSource} loading={loading} bordered
pagination={pagination} scroll={{ y: `calc(100vh - 170px)` }}/>
return (<Spin spinning={loading && pageInfo.total === 0}>
<WeaTable columns={columns} dataSource={dataSource} loading={loading} bordered
pagination={pagination} scroll={{ y: `calc(100vh - 170px)` }}/>
</Spin>
);
}
}

View File

@ -7,9 +7,11 @@
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
import { Button } from "antd";
import { postFetch } from "../../../../util/request";
import { inject, observer } from "mobx-react";
import { getSearchs } from "../../../../util";
import { conditions } from "../../conditions";
import moment from "moment";
const getLabel = WeaLocaleProvider.getLabel;
const getKey = WeaTools.getKey;
@ -24,12 +26,19 @@ class VariableSalarySearchPannel extends Component {
};
}
componentDidMount() {
async componentDidMount() {
const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" });
this.setState({
searchConditions: _.map(conditions, item => {
return {
...item,
items: _.map(item.items, child => {
if (getKey(child) === "taxAgentIds") {
return {
...child, label: getLabel(child.lanId, child.label),
options: _.map(data, o => ({ key: String(o.id), showname: o.name, selected: true }))
};
}
return { ...child, label: getLabel(child.lanId, child.label) };
})
};
@ -54,7 +63,10 @@ class VariableSalarySearchPannel extends Component {
<Button type="primary" onClick={this.props.onAdSearch}>{getLabel(388113, "搜索")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={() => VSalryForm.resetForm()}>{getLabel(2022, "重置")}</Button>
<Button type="ghost" onClick={() => {
VSalryForm.resetForm();
VSalryForm.updateFields({ salaryMonth: moment(new Date()).format("YYYY-MM") });
}}>{getLabel(2022, "重置")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(31129, "取消")}</Button>

View File

@ -1,3 +1,5 @@
import moment from "moment";
export const conditions = [
{
items: [
@ -22,6 +24,28 @@ export const conditions = [
value: "",
viewAttr: 2
},
{
conditionType: "MONTHPICKER",
domkey: ["salaryMonth"],
fieldcol: 14,
label: "薪资所属月",
lanId: 111,
labelcol: 6,
value: moment(new Date()).format("YYYY-MM"),
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["taxAgentIds"],
fieldcol: 14,
label: "个税扣缴义务人",
lanId: 111,
labelcol: 6,
value: "",
options: [],
multiple: true,
viewAttr: 2
},
{
browserConditionParam: {
completeParams: {},

View File

@ -10,7 +10,7 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { WeaDatePicker, WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop, WeaSelect } from "ecCom";
import { WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop } from "ecCom";
import * as API from "../../apis/variableSalary";
import AdvanceInputBtn from "./components/advanceInputBtn";
import SearchPannel from "./components/searchPannel";
@ -19,8 +19,6 @@ import SalaryFileDialog from "./components/salaryFileDialog";
import SalaryItemList from "./components/salaryItemList";
import SalaryFileList from "./components/salaryFileList";
import SalaryFileImportDialog from "./components/salaryFileImportDialog";
import { postFetch } from "../../util/request";
import moment from "moment";
import { Button } from "antd";
import cs from "classnames";
import "./index.less";
@ -33,28 +31,13 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "salaryFile", isQuery: false, showSearchAd: false, taxAgentIds: "",
salaryMonth: moment(new Date()).format("YYYY-MM"), taxAgentOption: [],
SIDialog: { visible: false, title: "", id: "", taxAgentOption: [] }, //薪资项目薪资编辑弹框
SFDialog: { visible: false, title: "", detail: {}, taxAgentOption: [] }, //薪资档案编辑弹框
selectedKey: "salaryFile", isQuery: false, showSearchAd: false,
SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框
SFDialog: { visible: false, title: "", detail: {} }, //薪资档案编辑弹框
SFImpDialog: { visible: false, title: getLabel(24023, "数据导入") }//薪资档案导入
};
}
async componentDidMount() {
const [queryTax, adminTax] = await Promise.all([
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" }),
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" })
]);
const taxAgentOption = _.map(adminTax.data, o => ({ key: String(o.id), showname: o.name }));
this.setState({
taxAgentOption: _.map(queryTax.data, o => ({ key: String(o.id), showname: o.name })),
taxAgentIds: _.map(queryTax.data, o => String(o.id)).join(","),
SIDialog: { ...this.state.SIDialog, taxAgentOption },
SFDialog: { ...this.state.SFDialog, taxAgentOption }
});
}
handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery });
openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd });
handleOperate = (type, detail = {}) => {
@ -73,12 +56,12 @@ class Index extends Component {
break;
case "export":
const columns = _.map(_.filter(toJS(SFTableStore.columns), (item) => item.display === "true"), it => it.dataIndex);
const { salaryMonth, taxAgentIds } = this.state;
const { taxAgentIds, departmentIds } = VSalryForm.getFormParams();
const payload = {
...VSalryForm.getFormParams(),
taxAgentIds: !_.isEmpty(taxAgentIds) ? taxAgentIds.split(",") : [],
departmentIds: !_.isEmpty(VSalryForm.getFormParams().taxAgentIds) ? VSalryForm.getFormParams().taxAgentIds.split(",") : [],
salaryMonth, columns
departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [],
columns
};
WeaLoadingGlobal.start();
const promise = API.exportVariableSalary(payload);
@ -93,10 +76,8 @@ class Index extends Component {
};
render() {
const {
selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery, salaryMonth, taxAgentOption, taxAgentIds
} = this.state;
const { taxAgentStore: { PageAndOptAuth }, baseTableStore: { VSSalaryItemForm } } = this.props;
const { selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery } = this.state;
const { taxAgentStore: { PageAndOptAuth }, baseTableStore: { VSSalaryItemForm, VSalryForm } } = this.props;
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
const tabs = [
{
@ -110,22 +91,14 @@ class Index extends Component {
buttons: showOperateBtn ? [
<Button type="primary" onClick={() => this.handleOperate("create")}>{getLabel(111, "新建")}</Button>,
<Button type="ghost" onClick={() => this.handleOperate("import")}>{getLabel(111, "导入")}</Button>,
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={val => this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>,
<WeaSelect options={taxAgentOption} style={{ width: 200, display: "flex" }} multiple value={taxAgentIds}
onChange={val => this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
] : [
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={val => this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>,
<WeaSelect options={taxAgentOption} style={{ width: 200, display: "flex" }} multiple value={taxAgentIds}
onChange={val => this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
],
children: <SalaryFileList {...this.props} salaryMonth={salaryMonth} taxAgentIds={taxAgentIds} isQuery={isQuery}
onViewSalaryFile={(data) => this.handleOperate("create", data)}/>
children: !_.isEmpty(VSalryForm.getFormParams()) ? <SalaryFileList {...this.props} isQuery={isQuery}
onViewSalaryFile={(data) => this.handleOperate("create", data)}/> : null
},
{
title: getLabel(111, "字段管理"), key: "salaryItem", showDropIcon: false, dropMenuDatas: [],
@ -164,11 +137,10 @@ class Index extends Component {
SFDialog: { ...SFDialog, visible: false }
}, () => callback && callback())}/>
{/* 薪资档案导入*/}
<SalaryFileImportDialog {...this.props} {...SFImpDialog} salaryMonth={salaryMonth} taxAgentIds={taxAgentIds}
onCancel={callback => {
this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } },
() => callback && this.handleAdvanceSearch());
}}/>
<SalaryFileImportDialog {...this.props} {...SFImpDialog} onCancel={callback => {
this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } },
() => callback && this.handleAdvanceSearch());
}}/>
</WeaReqTop>
);
}

View File

@ -31,7 +31,7 @@
}
.wea-advanced-searchsAd {
height: 108px;
height: 155px;
overflow: hidden auto;
.formItem-delete {
@ -57,6 +57,9 @@
}
}
.wea-form-item-wrapper {
display: block !important;
}
}
}