feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-10-11 15:19:38 +08:00
parent c72d34fb9a
commit 167c2c5a20
3 changed files with 56 additions and 175 deletions

View File

@ -14,6 +14,18 @@
.wea-tab, .wea-new-table {
background: #FFF;
}
.icon-refresh {
display: flex;
justify-content: center;
align-items: center;
width: 20px;
height: 20px;
color: #fff;
background: #55a1f8;
cursor: pointer;
border-radius: 3px;
}
}
.baseSettingWrapper, .taxDeclarationInfoWrapper {

View File

@ -5,22 +5,22 @@
* Date: 2022/11/30
*/
import React, { Component } from "react";
import { Button, message, Modal } from "antd";
import { message, Modal } from "antd";
import { inject, observer } from "mobx-react";
import { WeaButtonIcon, WeaInputSearch, WeaTab } from "ecCom";
import { WeaButtonIcon, WeaInputSearch, WeaLocaleProvider, WeaTab } from "ecCom";
import {
taxAgentRangeDelete,
taxAgentRangeExtDelete,
taxAgentRangeExtSave,
taxAgentRangeImportData,
taxAgentRangePreview
taxAgentRangeImportData
} from "../../../apis/taxAgent";
import { sysinfo } from "../../../apis/ruleconfig";
import PersonalScopeTable from "./personalScopeTable";
import PersonalScopeModal from "./personalScopeModal";
import ImportModal from "../../../components/importModal";
import ImportDialog from "../../../components/importDialog";
import ExternalPersonModal from "../../../components/externalPersonModal";
import { importEmployColumns } from "../../taxAgent/columns";
const getLabel = WeaLocaleProvider.getLabel;
@inject("taxAgentStore")
@observer
@ -28,17 +28,14 @@ class PersonalScope extends Component {
constructor(props) {
super(props);
this.state = {
searchValue: "", selectedKey: "listInclude",
rowKeys: [], personalAddModal: {
visible: false, externalVisible: false,
title: "关联人员", includeType: ""
},
previewDataSource: [], importParams: {
visible: false,
step: 0,
importResult: {}
}, extEmpsWitch: "1", //非系统人员开关, 1 开启, 0关闭
loading: false
searchValue: "", selectedKey: "listInclude", rowKeys: [], loading: false,
extEmpsWitch: "1", //非系统人员开关, 1 开启, 0关闭
personalAddModal: { visible: false, externalVisible: false, title: getLabel(111, "关联人员"), includeType: "" },
importParams: {
visible: false, title: getLabel(111, "数据导入"), nextloading: false, importResult: {}, imageId: "",
link: `/api/bs/hrmsalary/taxAgent/range/downloadTemplate?taxAgentId=${props.taxAgentId}`,
previewUrl: "/api/bs/hrmsalary/taxAgent/range/preview"
}
};
this.personalScopeTableRef = null;
}
@ -103,26 +100,15 @@ class PersonalScope extends Component {
}
});
};
salaryArchivePreview = (params) => {
taxAgentRangePreview(params).then(({ status, data }) => {
if (status) {
const { preview } = data;
this.setState({
previewDataSource: preview
});
}
});
};
handleImportFile = (params) => {
const { taxAgentId } = this.props;
taxAgentRangeImportData({ ...params, taxAgentId }).then(({ status, data }) => {
const { taxAgentId } = this.props, { importParams } = this.state;
this.setState({ importParams: { ...importParams, nextloading: true } });
taxAgentRangeImportData({ ...params, taxAgentId }).then(({ status, errormsg, data }) => {
this.setState({ importParams: { ...importParams, nextloading: false } });
if (status) {
this.setState({
importParams: {
...this.state.importParams,
importResult: data
}
});
this.setState({ importParams: { ...importParams, importResult: data } });
} else {
message.warning(errormsg);
}
});
};
@ -153,10 +139,7 @@ class PersonalScope extends Component {
};
render() {
const {
selectedKey, searchValue, rowKeys, personalAddModal,
importParams, previewDataSource, extEmpsWitch, loading
} = this.state;
const { selectedKey, searchValue, rowKeys, personalAddModal, importParams, extEmpsWitch, loading } = this.state;
const { taxAgentStore: { PageAndOptAuth }, taxAgentId } = this.props;
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
const topTab = [
@ -174,12 +157,9 @@ class PersonalScope extends Component {
}
];
const btns = showOperateBtn ? [
<Button
type="primary"
onClick={() => {
this.setState({ importParams: { ...importParams, visible: true, step: 0 } });
}}
>导入</Button>,
<span className="icon-refresh" title={getLabel(111, "导入")} onClick={() => {
this.setState({ importParams: { ...importParams, visible: true } });
}}><i className="icon-coms-leading-in"/></span>,
<WeaButtonIcon
buttonType="del"
type="primary"
@ -234,33 +214,15 @@ class PersonalScope extends Component {
}, () => callback && callback())
}
/>
{importParams.visible && (
<ImportModal
isInit={false}
columns={importEmployColumns}
slideDataSource={previewDataSource}
step={importParams.step}
setStep={(step) => {
this.setState({ importParams: { ...this.state.importParams, step } });
}}
importResult={importParams.importResult}
onFinish={() => {
this.setState({
importParams: {
...this.state.importParams,
visible: false
}
}, () => this.personalScopeTableRef.getPersonalScopeList());
}}
previewImport={(params) => this.salaryArchivePreview(params)}
importFile={(params) => this.handleImportFile(params)}
templateLink={`/api/bs/hrmsalary/taxAgent/range/downloadTemplate?taxAgentId=${taxAgentId}`}
visiable={importParams.visible}
onCancel={() => {
this.setState({ importParams: { ...this.state.importParams, visible: false } });
}}
/>
)}
<ImportDialog {...importParams}
nextCallback={imageId => this.setState({ importParams: { ...importParams, imageId } })}
nextUplaodCallback={imageId => this.handleImportFile({ imageId })}
onResetImportResult={() => this.setState(({
importParams: { ...importParams, importResult: {}, imageId: "" }
}))}
onCancel={(callback) => this.setState({
importParams: { ...importParams, visible: false }
}, () => callback && this.personalScopeTableRef.getPersonalScopeList(selectedKey, 1))}/>
</div>
);
}

View File

@ -7,7 +7,7 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaSwitch } from "comsMobx";
import { WeaBrowser, WeaCheckbox, WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { WeaCheckbox, WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { Button, message } from "antd";
import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent";
import { personScopeConditions, scopeSelectLinkageDatas } from "./constants";
@ -21,13 +21,7 @@ class PersonalScopeModal extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, conditions: [],
employeeStatus: [],
targetType: "EMPLOYEE",
targetTypeIds: "",
targetTypeIdsNames: "",
status: "",
statusAll: ""
loading: false, conditions: [], employeeStatus: []
};
}
@ -36,10 +30,6 @@ class PersonalScopeModal extends Component {
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initPersonScopeForm();
}
componentDidMount() {
// this.getTaxAgentRangeForm();
}
getTaxAgentRangeForm = () => {
getTaxAgentRangeForm().then(({ status, data }) => {
if (status) {
@ -73,9 +63,11 @@ class PersonalScopeModal extends Component {
const { employeeStatus, targetType, target } = personScopeForm.getFormParams();
const { includeType, taxAgentId } = this.props;
const payload = {
includeType, taxAgentId,
employeeStatus: employeeStatus.split(","),
targetParams: _.map(target.split(","), it => ({ targetType, targetId: it }))
includeType, taxAgentId, employeeStatus: employeeStatus.split(","),
targetParams: _.map(target.split(","), it => ({
targetType, targetId: targetType === "SQL" ? "0" : it,
target: targetType === "SQL" ? target : ""
}))
};
this.setState({ loading: true });
taxAgentRangeSave(payload).then(({ status, errormsg }) => {
@ -92,37 +84,6 @@ class PersonalScopeModal extends Component {
}
});
};
renderBrowser = () => {
const { targetType, targetTypeIds, targetTypeIdsNames } = this.state;
let browserType = {};
switch (targetType) {
case "EMPLOYEE":
browserType = { ...browserType, type: 17, title: "人员选择" };
break;
case "DEPT":
browserType = { ...browserType, type: 57, title: "部门选择" };
break;
case "SUBCOMPANY":
browserType = { ...browserType, type: 164, title: "分部选择" };
break;
case "POSITION":
browserType = { ...browserType, type: 278, title: "岗位选择" };
break;
default:
break;
}
return <WeaBrowser
{...browserType}
viewAttr={3}
isSingle={false}
value={targetTypeIds}
valueSpan={targetTypeIdsNames}
inputStyle={{ width: 200 }}
onChange={(targetTypeIds, targetTypeIdsNames) => {
this.setState({ targetTypeIds, targetTypeIdsNames });
}}
/>;
};
renderForm = () => {
const { taxAgentStore: { personScopeForm } } = this.props;
const { conditions, employeeStatus } = this.state, { isFormInit } = personScopeForm,
@ -158,68 +119,14 @@ class PersonalScopeModal extends Component {
};
render() {
const { onCancel, title, visible, taxAgentStore: { personScopeForm } } = this.props;
const { employeeStatus, targetTypeList, targetType, status, statusAll, loading, conditions } = this.state;
const { title, taxAgentStore: { personScopeForm } } = this.props, { loading } = this.state;
const buttons = [
<Button type="primary" onClick={this.taxAgentRangeSave} loading={loading}>确定</Button>,
<Button type="ghost" onClick={() => personScopeForm.resetForm()}>重置</Button>
<Button type="primary" onClick={this.taxAgentRangeSave} loading={loading}>{getLabel(111, "确定")}</Button>,
<Button type="ghost" onClick={() => personScopeForm.resetForm()}>{getLabel(111, "重置")}</Button>
];
return (
<WeaDialog {...this.props} initLoadCss title={title} style={{ width: 600 }} buttons={buttons}>
<div className="form-dialog-layout">{this.renderForm()}</div>
{/*<WeaSearchGroup col={1} needTigger title="" showGroup center>*/}
{/* <WeaFormItem*/}
{/* label="对象类型"*/}
{/* labelCol={{ span: 6 }}*/}
{/* wrapperCol={{ span: 18 }}*/}
{/* >*/}
{/* <div style={{ display: "flex", alignItems: "center" }}>*/}
{/* <WeaSelect*/}
{/* style={{ width: 60, marginRight: 12 }}*/}
{/* value={targetType}*/}
{/* options={targetTypeList}*/}
{/* onChange={(targetType) => this.setState({ targetType })}*/}
{/* />*/}
{/* {this.renderBrowser()}*/}
{/* </div>*/}
{/* </WeaFormItem>*/}
{/* {*/}
{/* SelectWithAll({*/}
{/* label: "选择员工状态",*/}
{/* options: employeeStatus,*/}
{/* detailtype: 2,*/}
{/* valueAll: statusAll,*/}
{/* value: status,*/}
{/* onChangeAll: ({ selected }) => {*/}
{/* if (selected) {*/}
{/* this.setState({*/}
{/* status: _.map(employeeStatus, it => it.key).join(","),*/}
{/* statusAll: selected*/}
{/* });*/}
{/* } else {*/}
{/* this.setState({*/}
{/* status: "",*/}
{/* statusAll: selected*/}
{/* });*/}
{/* }*/}
{/* },*/}
{/* onChange: ({ selected }) => {*/}
{/* const bool = _.every(_.map(employeeStatus, it => it.key), item => selected.split(",").includes(item));*/}
{/* if (bool) {*/}
{/* this.setState({*/}
{/* status: selected,*/}
{/* statusAll: "0"*/}
{/* });*/}
{/* } else {*/}
{/* this.setState({*/}
{/* status: selected,*/}
{/* statusAll: ""*/}
{/* });*/}
{/* }*/}
{/* }*/}
{/* })*/}
{/* }*/}
{/*</WeaSearchGroup>*/}
</WeaDialog>
);
}