feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-09-11 18:37:01 +08:00
parent 6586f68d58
commit b99a2069d4
26 changed files with 214 additions and 226 deletions

View File

@ -12,7 +12,7 @@ export const taxAgentRangeSync = (params) => {
// 系统管理员权限
export const getPermission = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/taxAgent/permission", "GET", params);
return WeaTools.callApi("/api/bs/hrmsalary/auth/permission", "GET", params);
};
//获取个税扣缴义务人表单

View File

@ -0,0 +1,6 @@
export const PAGE = {
"salaryArchive": ["/hrmSalary/salaryFile"], //薪资档案
"salarySob": ["/hrmSalary/ledger"], //薪资账套
"salaryAcct": ["/hrmSalary/calculate", "/hrmSalary/calcView"], //薪资核算
"salaryBill": ["/hrmSalary/payroll", "/hrmSalary/payrollGrant", "/hrmSalary/payrollDetail"] //工资单
};

View File

@ -8,12 +8,16 @@
* @description:
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
import Authority from "./pages/mySalary/authority";
import stores from "./stores";
const { ls } = WeaTools;
const { getLabel } = WeaLocaleProvider;
@inject("taxAgentStore")
@observer
class Layout extends Component {
constructor(props) {
super(props);
@ -44,9 +48,10 @@ class Layout extends Component {
}
render() {
return (
<WeaLocaleProvider>{this.props.children}</WeaLocaleProvider>
);
const { taxAgentStore: { PageAndOptAuth, loading } } = this.props;
return (<WeaLocaleProvider>
<Authority store={{ loading, hasRight: PageAndOptAuth.able }}>{this.props.children}</Authority>
</WeaLocaleProvider>);
}
}

View File

@ -40,8 +40,9 @@ class Calculate extends Component {
}
renderCalculateOpts = () => {
const { taxAgentStore: { showOperateBtn } } = this.props;
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const { queryParams, isRefresh } = this.state;
const admin = PageAndOptAuth.opts.includes("admin");
let calculateOpts = [
<Button type="primary" onClick={() => this.setState({
calcDaialog: {
@ -54,7 +55,7 @@ class Calculate extends Component {
queryParams: { ...queryParams, ...v }
})} onSearch={() => this.setState({ isRefresh: !isRefresh })}/>
];
return !showOperateBtn ? calculateOpts.slice(1) : calculateOpts;
return !admin ? calculateOpts.slice(1) : calculateOpts;
};
handleCalcOpts = ({ key }, record) => {
const { isRefresh, progressModule } = this.state, { id } = record;
@ -198,8 +199,7 @@ class Calculate extends Component {
key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(545781, "操作日志")
}
]}
>
]}>
<div className="calculate-body">
<CalculateTablelist queryParams={queryParams} isRefresh={isRefresh} onCalcOpts={this.handleCalcOpts}/>
<CalculateDialog {...calcDaialog}

View File

@ -73,7 +73,12 @@ class Index extends Component {
</span>,
render: (__, record) => {
const { operate: opts = [] } = record;
const operate = [...opts, { index: "log", text: getLabel(30586, "查看日志") }];
const admin = record.opts.includes("admin");
const operate = admin ? [...opts, { index: "log", text: getLabel(30586, "查看日志") }] : [
{ index: "3", text: getLabel(111, "查看") },
{ index: "null", text: "" },
{ index: "log", text: getLabel(30586, "查看日志") }
];
return <React.Fragment>
{
_.map(operate.slice(0, 2), f => (

View File

@ -18,23 +18,21 @@ class Layout extends Component {
}
salaryacctAcctresultCheckAuth = () => {
const { taxAgentStore: { getPermission } } = this.props;
this.setState({ store: { ...this.state.store, loading: true } });
getPermission().then(({ data }) => {
const { isOpenDevolution } = data;
if (isOpenDevolution) {
const { routeParams: { salaryAcctRecordId } } = this.props;
salaryacctAcctresultCheckAuth({ salaryAcctRecordId }).then(({ status, data }) => {
this.setState({ store: { ...this.state.store, loading: false, hasRight: status && data } }, () => {
this.state.store.hasRight && this.props.init && this.props.init();
});
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const { isOpenDevolution } = PageAndOptAuth;
if (isOpenDevolution) {
const { routeParams: { salaryAcctRecordId } } = this.props;
this.setState({ store: { ...this.state.store, loading: true } });
salaryacctAcctresultCheckAuth({ salaryAcctRecordId }).then(({ status, data }) => {
this.setState({ store: { ...this.state.store, loading: false, hasRight: status && data } }, () => {
this.state.store.hasRight && this.props.init && this.props.init();
});
} else {
this.setState({ store: { ...this.state.store, loading: false, hasRight: true } }, () => {
this.props.init && this.props.init();
});
}
}).catch(() => this.setState({ store: { ...this.state.store, loading: false } }));
});
} else {
this.setState({ store: { ...this.state.store, loading: false, hasRight: true } }, () => {
this.props.init && this.props.init();
});
}
};
render() {

View File

@ -36,21 +36,19 @@ export default class CompareDetail extends React.Component {
current: 1
};
fetchComparisonResultList(params);
this.salaryacctAcctresultCheckAuth({ salaryAcctRecordId: getQueryString("id") })
this.salaryacctAcctresultCheckAuth({ salaryAcctRecordId: getQueryString("id") });
}
salaryacctAcctresultCheckAuth = (params) => {
const { taxAgentStore: { getPermission } } = this.props;
getPermission().then(({ data }) => {
const { isOpenDevolution } = data;
if (isOpenDevolution) {
salaryacctAcctresultCheckAuth(params).then(({ status, data }) => {
this.setState({ calculateAuth: data && status });
});
} else {
this.setState({ calculateAuth: true });
}
});
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const { isOpenDevolution } = PageAndOptAuth;
if (isOpenDevolution) {
salaryacctAcctresultCheckAuth(params).then(({ status, data }) => {
this.setState({ calculateAuth: data && status });
});
} else {
this.setState({ calculateAuth: true });
}
};
getColumns = (columns) => {

View File

@ -69,17 +69,15 @@ export default class CalculateDetail extends React.Component {
}
salaryacctAcctresultCheckAuth = (params) => {
const { taxAgentStore: { getPermission } } = this.props;
getPermission().then(({ data }) => {
const { isOpenDevolution } = data;
if (isOpenDevolution) {
salaryacctAcctresultCheckAuth(params).then(({ status, data }) => {
this.setState({ calculateAuth: data && status });
});
} else {
this.setState({ calculateAuth: true });
}
});
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const { isOpenDevolution } = PageAndOptAuth;
if (isOpenDevolution) {
salaryacctAcctresultCheckAuth(params).then(({ status, data }) => {
this.setState({ calculateAuth: data && status });
});
} else {
this.setState({ calculateAuth: true });
}
};
Input = (value, key) => {

View File

@ -6,11 +6,8 @@
*/
import React, { Component } from "react";
import { WeaTable } from "ecCom";
import { inject, observer } from "mobx-react";
import LedgerBackCalcEditSlide from "./ledgerBackCalcEditSlide";
@inject("taxAgentStore")
@observer
class LedgerBackCalculatedSalaryItemTable extends Component {
constructor(props) {
super(props);
@ -56,7 +53,8 @@ class LedgerBackCalculatedSalaryItemTable extends Component {
render() {
const { backCalcEditSlide } = this.state;
const { taxAgentStore: { showOperateBtn }, dataSource, editId, saveSalarySobId, key } = this.props;
const { record, dataSource, editId, saveSalarySobId, key } = this.props;
const showOperateBtn = record.opts.includes("admin");
const columns = [
{
dataIndex: "name",

View File

@ -11,9 +11,10 @@ import { duplicateLedger } from "../../../apis/ledger";
import { WeaDialog } from "ecCom";
import { Button, message } from "antd";
import { getSearchs } from "../../../util";
import { postFetch } from "../../../util/request";
import "./index.less";
@inject("ledgerStore", "taxAgentStore")
@inject("ledgerStore")
@observer
class CopyLedgerModal extends Component {
constructor(props) {
@ -31,35 +32,31 @@ class CopyLedgerModal extends Component {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
const { ledgerStore, name, taxAgentId } = nextProps;
const { copyForm: form } = ledgerStore;
form.updateFields({
name: { value: name },
taxAgentId: { value: taxAgentId.toString() }
});
form.updateFields({ name: { value: name }, taxAgentId: { value: taxAgentId } });
}
}
getTaxAgentSelectListAsAdmin = () => {
const { taxAgentStore, ledgerStore } = this.props;
const { ledgerStore } = this.props;
const { copyForm: form } = ledgerStore;
const { getTaxAgentSelectListAsAdmin } = taxAgentStore;
getTaxAgentSelectListAsAdmin().then(({ status, data }) => {
if (status) {
const conditions = _.map(copyConditions, it => {
it.items = _.map(it.items, child => {
if (child.domkey[0] === "taxAgentId") {
return {
...child,
options: _.map(data, it => ({ key: it.id, showname: it.content }))
};
} else {
return { ...child };
}
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" })
.then(({ status, data }) => {
if (status) {
const conditions = _.map(copyConditions, it => {
it.items = _.map(it.items, child => {
if (child.domkey[0] === "taxAgentId") {
return {
...child, options: _.map(data, it => ({ key: String(it.id), showname: it.name }))
};
} else {
return { ...child };
}
});
return { ...it };
});
return { ...it };
});
form.initFormFields(conditions);
}
});
form.initFormFields(conditions);
}
});
};
handleSubmit = () => {
const { ledgerStore, id, onRefreshList, onCancel } = this.props;
@ -84,7 +81,6 @@ class CopyLedgerModal extends Component {
});
};
render() {
const { onCancel, ledgerStore, ...extra } = this.props;
const { loading } = this.state;

View File

@ -5,7 +5,6 @@
* Date: 2022/12/12
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { Button, message, Modal } from "antd";
import { WeaButtonIcon, WeaInputSearch, WeaTab } from "ecCom";
import PersonalScopeTable from "../../../components/PersonalScopeTable";
@ -35,8 +34,6 @@ const APISaveFox = {
save: saveLedgerPersonRange
};
@inject("taxAgentStore")
@observer
class LedgerAssociatedPersonnel extends Component {
constructor(props) {
super(props);
@ -221,7 +218,8 @@ class LedgerAssociatedPersonnel extends Component {
externalPersonModalVisible,
loading, extEmpsWitch
} = this.state;
const { taxAgentStore: { showOperateBtn }, editId, saveSalarySobId } = this.props;
const { record, editId, saveSalarySobId } = this.props;
const admin = record.opts.includes("admin");
const topTab = [
{
title: "关联人员范围",
@ -236,7 +234,7 @@ class LedgerAssociatedPersonnel extends Component {
viewcondition: "externalList"
}
];
const btns = showOperateBtn ? [
const btns = admin ? [
<Button
className="icon-coms-leading-in-btn"
type="primary"
@ -277,7 +275,7 @@ class LedgerAssociatedPersonnel extends Component {
datas={(extEmpsWitch === "0" || !extEmpsWitch) ? _.dropRight(topTab) : topTab}
keyParam="viewcondition" //主键
selectedKey={selectedKey}
buttons={showOperateBtn && selectedKey === "listInclude" ? btns : btns.slice(1)}
buttons={admin && selectedKey === "listInclude" ? btns : btns.slice(1)}
onChange={selectedKey => this.setState({ selectedKey })}
/>
<PersonalScopeTable

View File

@ -19,6 +19,7 @@ import {
prefixAddZero
} from "../../../util/date";
import { commonEnumList } from "../../../apis/ruleconfig";
import { postFetch } from "../../../util/request";
import moment from "moment";
import "./index.less";
@ -108,23 +109,21 @@ class LedgerBaseSetting extends Component {
});
};
getTaxAgentSelectListAsAdmin = () => {
const { taxAgentStore } = this.props;
const { getTaxAgentSelectListAsAdmin } = taxAgentStore;
getTaxAgentSelectListAsAdmin().then(({ status, data }) => {
if (status) {
this.setState({
baseForm: _.map(baseSettingFormItem, it => {
if (it.key === "taxAgentId") {
return {
...it,
options: _.map(data, it => ({ key: it.id, showname: it.content }))
};
}
return { ...it };
})
}, () => this.commonEenumList());
}
});
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" })
.then(({ status, data }) => {
if (status) {
this.setState({
baseForm: _.map(baseSettingFormItem, it => {
if (it.key === "taxAgentId") {
return {
...it, options: _.map(data, o => ({ key: String(o.id), showname: o.name }))
};
}
return { ...it };
})
}, () => this.commonEenumList());
}
});
};
commonEenumList = () => {
const payload = {
@ -161,7 +160,7 @@ class LedgerBaseSetting extends Component {
};
render() {
const { editId, taxAgentStore: { taxAgentOption } } = this.props;
const { editId } = this.props;
const { baseForm, settingBaseInfo } = this.state;
const { canEdit, taxAgentId } = settingBaseInfo;
let taxAgentIdDisabled = false, taxableItemsDisabled = false;
@ -194,8 +193,7 @@ class LedgerBaseSetting extends Component {
</React.Fragment> :
type === "SELECT" ?
<WeaSelect value={settingBaseInfo[key]}
options={((canEdit !== "true" || taxAgentIdDisabled || taxableItemsDisabled) && key === "taxAgentId") ? taxAgentOption : options}
viewAttr={3} multiple={multiple}
options={options} viewAttr={3} multiple={multiple}
disabled={canEdit !== "true" || taxAgentIdDisabled || taxableItemsDisabled}
onChange={(v) => this.handleChangeField(key, v)}/> :
type === "CUSTOM" ?

View File

@ -5,14 +5,11 @@
* Date: 2022/12/12
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaButtonIcon, WeaTab, WeaTable } from "ecCom";
import { Modal } from "antd";
import LedgerAdjustRuleAddModal from "./ledgerAdjustRuleAddModal";
import { listAdjustmentRule } from "../../../apis/ledger";
@inject("taxAgentStore")
@observer
class LedgerSalaryAdjustmentRules extends Component {
constructor(props) {
super(props);
@ -92,9 +89,10 @@ class LedgerSalaryAdjustmentRules extends Component {
};
render() {
const { taxAgentStore: { showOperateBtn }, editId, onSaveParams } = this.props;
const { record, editId, onSaveParams } = this.props;
const { adjustRuleAddModal } = this.state;
const { dataSource } = this.state;
const showOperateBtn = record.opts.includes("admin");
const btns = showOperateBtn ? [
<WeaButtonIcon buttonType="add" type="primary" onClick={this.handleAddAdjustRule}/>
] : [];

View File

@ -140,9 +140,9 @@ class LedgerSalaryItemNormal extends Component {
onChangeSelectedRowKeys,
onAddSalaryItems,
incomeCategoriesTitleName,
taxAgentStore
record
} = this.props;
const { showOperateBtn } = taxAgentStore;
const showOperateBtn = record.opts.includes("admin");
const { categoryModal, addCategoryItemsVisible, moveModalPayload, salaryItemKeywords } = this.state;
const newDateSource = _.map(dataSource, item => {
return {

View File

@ -10,7 +10,7 @@ import { Button } from "antd";
import { WeaSwitch } from "comsMobx";
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { searchConditions } from "../config";
import { getTaxAgentSelectList } from "../../../apis/taxAgent";
import { postFetch } from "../../../util/request";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@ -31,29 +31,28 @@ class LedgerSearchComp extends Component {
getTaxAgentSelectList = () => {
const { ledgerStore: { searchForm } } = this.props;
getTaxAgentSelectList().then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(searchConditions, o => {
return {
...o,
items: _.map(o.items, j => {
if (getKey(j) === "taxAgentId") {
return {
...j,
options: [{ key: "", showname: getLabel(332, "全部") }, ..._.map(data, g => ({
key: g.id,
showname: g.content
}))]
};
}
return { ...j };
})
};
})
}, () => searchForm.initFormFields(this.state.conditions));
}
});
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" })
.then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(searchConditions, o => {
return {
...o,
items: _.map(o.items, j => {
if (getKey(j) === "taxAgentId") {
return {
...j, options: [{ key: "", showname: getLabel(332, "全部") }, ..._.map(data, g => ({
key: String(g.id), showname: g.name
}))]
};
}
return { ...j };
})
};
})
}, () => searchForm.initFormFields(this.state.conditions));
}
});
};
formRender = (form, condition) => {
const { isFormInit } = form, formParams = form.getFormParams();

View File

@ -21,7 +21,7 @@ import "./index.less";
const { getLabel } = WeaLocaleProvider;
const Step = WeaSteps.Step;
@inject("taxAgentStore", "ledgerStore")
@inject("ledgerStore")
@observer
class LedgerSlide extends Component {
constructor(props) {
@ -153,7 +153,7 @@ class LedgerSlide extends Component {
handleSaveSalaryItemParams = (empFields, itemGroups) => this.setState({ empFields, itemGroups });
render() {
const { visible, editId, taxAgentStore: { showOperateBtn } } = this.props;
const { visible, editId, record } = this.props;
const { current, saveSalarySobId, loading } = this.state;
let tabs = [
{
@ -234,7 +234,7 @@ class LedgerSlide extends Component {
measure="%"
title={
!editId ? <WeaTopTitle buttons={_.find(tabs, o => current === o.key).createBtns}/> :
<WeaReqTitle buttons={showOperateBtn ? _.find(tabs, o => current === o.key).editBtns : []}
<WeaReqTitle buttons={record.opts.includes("admin") ? _.find(tabs, o => current === o.key).editBtns : []}
tabDatas={tabs} selectedKey={String(current)}
onChange={cur => this.setState({ current: parseInt(cur) })}/>
}

View File

@ -71,7 +71,7 @@ class LedgerTable extends Component {
return <WeaCheckbox
value={text === 0 ? "1" : "0"}
display="switch"
disabled={!showOperateBtn}
disabled={!record.opts.includes("admin")}
onChange={(disable) => this.changeLedgerStatus({ id: record.id, disable: disable === "0" ? 1 : 0 })}
/>;
};
@ -80,14 +80,14 @@ class LedgerTable extends Component {
item.render = (text, record) => {
return <div className="optWrapper">
<a href="javascript:void(0);" className="mr10"
onClick={() => onEditLedger(record)}>{showOperateBtn ? "编辑" : "查看"}</a>
onClick={() => onEditLedger(record)}>{record.opts.includes("admin") ? "编辑" : "查看"}</a>
{
showOperateBtn &&
record.opts.includes("admin") &&
<a href="javascript:void(0);" className="mr10"
onClick={() => this.handleMenuClick({ key: "copy" }, record)}>复制</a>
}
{
showOperateBtn &&
record.opts.includes("admin") &&
<Popover
overlayClassName="moreIconWrapper"
placement="bottomRight"
@ -148,11 +148,15 @@ class LedgerTable extends Component {
};
handleMenuClick = ({ key }, record) => {
const { copyLedgerModal } = this.state;
const { id, name, taxAgentId } = record;
const { id, name, taxAgentIds } = record;
switch (key) {
case "copy":
this.setState({
copyLedgerModal: { ...copyLedgerModal, visible: true, id, name, taxAgentId }
copyLedgerModal: {
...copyLedgerModal,
visible: true, id, name,
taxAgentId: _.map(taxAgentIds, o => String(o)).join(",")
}
});
break;
case "delete":

View File

@ -19,6 +19,7 @@ export const copyConditions = [
fieldcol: 14,
rules: "required|string",
label: "个税扣缴义务人",
multiple: true,
labelcol: 6,
value: "",
viewAttr: 3

View File

@ -23,34 +23,19 @@ class Index extends Component {
super(props);
this.state = {
searchVal: "", doSearch: false, logDialogVisible: false, filterConditions: "[]",
slideparams: {
visible: false,
title: "新建账套",
editId: ""
}
slideparams: { visible: false, title: "新建账套", editId: "", record: {} }
};
}
componentDidMount() {
const { taxAgentStore } = this.props;
const { fetchTaxAgentOption } = taxAgentStore;
fetchTaxAgentOption();
}
handleEditLedger = (record) => {
const { slideparams } = this.state;
const { id } = record;
this.setState({ slideparams: { ...slideparams, visible: true, title: "编辑账套", editId: id } });
this.setState({ slideparams: { ...slideparams, visible: true, title: "编辑账套", editId: id, record } });
};
handleResetLedger = () => {
const { slideparams } = this.state;
this.setState({
slideparams: {
...slideparams,
visible: false,
title: "新建账套",
editId: ""
}
slideparams: { ...slideparams, visible: false, title: "新建账套", editId: "", record: {} }
});
};
onDropMenuClick = (key, targetid = "") => {
@ -69,7 +54,8 @@ class Index extends Component {
render() {
const { logDialogVisible, filterConditions, doSearch, slideparams } = this.state;
const { taxAgentStore } = this.props;
const { showOperateBtn } = taxAgentStore;
const { PageAndOptAuth } = taxAgentStore;
const admin = PageAndOptAuth.opts.includes("admin");
const btns = [
<Button
type="primary"
@ -80,7 +66,7 @@ class Index extends Component {
return (
<WeaTop
title="薪资账套" className="ledgerOuter" icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={showOperateBtn ? btns : btns.slice(-1)}
buttons={admin ? btns : btns.slice(-1)}
showDropIcon onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={[
{

View File

@ -12,7 +12,6 @@
.ledgerSearch-Wrapper {
min-width: 350px;
margin-top: 5px;
margin-right: 70px;
position: relative;

View File

@ -31,7 +31,7 @@ const APILIST = {
cancelSalarySuspension: API.cancelStop //取消停薪
};
@inject("payrollFilesStore", "taxAgentStore")
@inject("payrollFilesStore")
@observer
class Index extends Component {
constructor(props) {
@ -100,12 +100,12 @@ class Index extends Component {
case "CHANGE-SALARY":
case "VIEW":
case "EDIT":
const { taxAgentStore: { showOperateBtn }, selectedKey: runStatuses } = this.props;
const { record: { id: salaryArchiveId } } = params;
const { selectedKey: runStatuses } = this.props;
const { record: { id: salaryArchiveId, opts } } = params;
this.setState({
salaryFilesEditSlide: {
...this.state.salaryFilesEditSlide, visible: true, salaryArchiveId,
runStatuses, showOperateBtn
runStatuses, showOperateBtn: opts.includes("admin")
}
});
break;
@ -172,7 +172,7 @@ class Index extends Component {
}).catch(() => this.setState({ loading: false }));
};
getColumns = () => {
const { payrollFilesStore: { tableStore }, taxAgentStore: { showOperateBtn } } = this.props;
const { payrollFilesStore: { tableStore } } = this.props;
const columns = _.map(_.filter(toJS(tableStore.columns), (item) => item.display === "true"), (it, idx) => ({
dataIndex: it.dataIndex, title: it.title, align: "left",
width: (it.dataIndex === "taxAgentName" || it.dataIndex === "operate") ? 185 : 150,
@ -181,7 +181,7 @@ class Index extends Component {
}));
if (!_.isEmpty(columns)) {
this.postMessageToChild({
columns, showOperateBtn, selectedKey: this.props.selectedKey,
columns, selectedKey: this.props.selectedKey,
showDelSalaryFileBtn: this.props.showDelSalaryFileBtn,
dataSource: this.state.dataSource, selectedRowKeys: this.state.selectedRowKeys,
showSum: false, pageInfo: this.state.pageInfo

View File

@ -209,7 +209,7 @@ export const renderDropMenuDatas = (selectedKey, showOperateBtn) => {
default:
break;
}
return showOperateBtn ? menus : _.filter(menus, o => o.key === "custom_cols");
return showOperateBtn ? menus : _.filter(menus, o => (o.key === "custom_cols" || o.key === "log"));
};
export const salaryFileSearchConditions = [
@ -440,7 +440,7 @@ export const salaryFilesConditions = [
},
{
defaultshow: true, title: getLabel(543329, "发薪设置"),
col: 1,lanId: 543329,
col: 1, lanId: 543329,
items: [
{
colSpan: 1,
@ -471,7 +471,7 @@ export const salaryFilesConditions = [
defaultshow: true, title: getLabel(538004, "薪资档案"),
titleHelpful: getLabel(543330, "提示:显示已生效的最新数据"),
titleHelpfulLanId: 543330,
col: 2, salaryFile: true,lanId: 538004,
col: 2, salaryFile: true, lanId: 538004,
items: []
}
];

View File

@ -247,15 +247,16 @@ class SalaryFiles extends Component {
selectedKey, topTabCount, showSearchAd, isQuery, showDelSalaryFileBtn, showExtEmpsWitch,
salaryFileImpDialog, salaryImportTypes, logDialogVisible, filterConditions
} = this.state;
const { taxAgentStore: { showOperateBtn } } = this.props;
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const tabs = _.map(tabList, o => ({ ...o, title: getLabel(o.lanId, o.title) }));
const admin = PageAndOptAuth.opts.includes("admin");
return (
<div className="salary-files-wrapper">
<WeaReqTop
title={getLabel(538004, "薪资档案")} buttonSpace={10} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" showDropIcon dropMenuDatas={renderDropMenuDatas(selectedKey, showOperateBtn)}
onDropMenuClick={this.onDropMenuClick}
buttons={renderReqBtns(selectedKey, salaryImportTypes, this.handleReqBtnsCLick, showOperateBtn)}
iconBgcolor="#F14A2D" showDropIcon onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={renderDropMenuDatas(selectedKey, admin)}
buttons={renderReqBtns(selectedKey, salaryImportTypes, this.handleReqBtnsCLick, admin)}
replaceTab={
<WeaTab
datas={!showExtEmpsWitch ? _.dropRight(tabs) : tabs} autoCalculateWidth
@ -274,7 +275,7 @@ class SalaryFiles extends Component {
</div>
{/*列表*/}
<SalaryFileList isQuery={isQuery} ref={dom => this.salaryFileListRef = dom}
selectedKey={selectedKey} showOperateBtn={showOperateBtn}
selectedKey={selectedKey} showOperateBtn={admin}
showDelSalaryFileBtn={showDelSalaryFileBtn}
onChangeTopTabCount={this.queryInsuranceTabTotal}
onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)}

View File

@ -24,7 +24,7 @@ export default class StandingBook extends React.Component {
value: "",
selectedKey: "0",
tableParams: {
startTime: moment(new Date()).subtract(1, 'year').startOf("year").format("YYYY-MM"),
startTime: moment(new Date()).subtract(1, "year").startOf("year").format("YYYY-MM"),
endTime: moment(new Date()).endOf("year").format("YYYY-MM"),
paymentOrganization: ""
},
@ -68,49 +68,45 @@ export default class StandingBook extends React.Component {
init = () => {
const { current, dialogProps } = this.state;
const {
taxAgentStore: { getPermission, fetchTaxAgentOption },
taxAgentStore: { PageAndOptAuth, fetchTaxAgentOption },
standingBookStore: { getAdminTaxAgentList }
} = this.props;
getPermission().then(({ status, data }) => {
if (status) {
this.setState({ adminData: data });
if (data.isOpenDevolution) {
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
}
});
});
} else {
fetchTaxAgentOption().then(({ data }) => {
let taxAgentList = data.map(item => {
let result = {};
result.showname = item.content;
result.key = item.id + "";
result.selected = false;
return result;
});
this.setState({
dialogProps: {
...dialogProps,
options: taxAgentList
}
});
});
}
this.getCommonList({ ...this.state.tableParams, current });
}
});
this.setState({ adminData: PageAndOptAuth });
if (data.isOpenDevolution) {
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
}
});
});
} else {
fetchTaxAgentOption().then(({ data }) => {
let taxAgentList = data.map(item => {
let result = {};
result.showname = item.content;
result.key = item.id + "";
result.selected = false;
return result;
});
this.setState({
dialogProps: {
...dialogProps,
options: taxAgentList
}
});
});
}
this.getCommonList({ ...this.state.tableParams, current });
};
getCommonList = (payload = {}) => {

View File

@ -48,13 +48,9 @@ export default class TaxAgent extends React.Component {
}
getPermission = () => {
const { getPermission } = this.props.taxAgentStore;
getPermission().then(({ status, data }) => {
if (status) {
this.setState({ permission: data }, () => {
this.getTaxAgentBaseForm();
});
}
const { PageAndOptAuth } = this.props.taxAgentStore;
this.setState({ permission: PageAndOptAuth }, () => {
this.getTaxAgentBaseForm();
});
};

View File

@ -4,6 +4,7 @@ import { WeaForm, WeaTableNew } from "comsMobx";
import * as API from "../apis/taxAgent"; // 引入API接口文件
import { decentralizationConditions, editConditions } from "../pages/taxAgent/editConditions";
import { PAGE } from "../config";
const { TableStore } = WeaTableNew;
@ -12,6 +13,7 @@ export class TaxAgentStore {
@action initRoleForm = () => this.roleForm = new WeaForm();
@observable roleOperatorForm = new WeaForm(); //权限-角色操作者form表单
@action initRoleOperatorForm = () => this.roleOperatorForm = new WeaForm();
@observable PageAndOptAuth = { able: false, opts: [] }; // 业务线页面权限
@observable tableStore = new TableStore(); // new table
@ -143,9 +145,15 @@ export class TaxAgentStore {
@action
getPermission = params => {
_.map(_.keys(PAGE), page => {
if (_.some(PAGE[page], k => window.location.hash.indexOf(k) !== -1)) params = { ...params, page };
});
this.loading = true;
return new Promise((resolve, reject) => {
API.getPermission(params).then(({ status, data }) => {
this.loading = false;
if (status) {
this.PageAndOptAuth = data;
const { isAdminEnable, isChief, isOpenDevolution } = data;
this.setShowOperateBtn(
!isOpenDevolution ? true : isAdminEnable ? true : false