diff --git a/pc4mobx/hrmSalary/pages/salary/components/index.less b/pc4mobx/hrmSalary/pages/salary/components/index.less index 921c6451..9eed4669 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/index.less +++ b/pc4mobx/hrmSalary/pages/salary/components/index.less @@ -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 { diff --git a/pc4mobx/hrmSalary/pages/salary/components/personalScope.js b/pc4mobx/hrmSalary/pages/salary/components/personalScope.js index 698d181d..451fbda8 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/personalScope.js +++ b/pc4mobx/hrmSalary/pages/salary/components/personalScope.js @@ -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 ? [ - , + { + this.setState({ importParams: { ...importParams, visible: true } }); + }}>, callback && callback()) } /> - {importParams.visible && ( - { - 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 } }); - }} - /> - )} + 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))}/> ); } diff --git a/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js b/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js index ab9d5dcb..3e649880 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js +++ b/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js @@ -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 { - 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 = [ - , - + , + ]; return (
{this.renderForm()}
- {/**/} - {/* */} - {/*
*/} - {/* this.setState({ targetType })}*/} - {/* />*/} - {/* {this.renderBrowser()}*/} - {/*
*/} - {/* */} - {/* {*/} - {/* 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: ""*/} - {/* });*/} - {/* }*/} - {/* }*/} - {/* })*/} - {/* }*/} - {/*
*/}
); }