feature/2.9.42310.02-社保福利档案页面重构

This commit is contained in:
黎永顺 2023-11-06 16:09:23 +08:00
parent 68bd42c2c0
commit eefa47164a
11 changed files with 346 additions and 162 deletions

View File

@ -1,5 +1,4 @@
import { WeaTools } from "ecCom";
import { postFetch } from "../util/request";
/**
* 薪资档案api
@ -292,7 +291,3 @@ export const editSingleSalaryItem = (params) => {
body: JSON.stringify(params)
}).then(res => res.json());
};
// 基数调整记录列表
export const getAdjustHistoryList = (params) => {
return postFetch("/api/bs/hrmsalary/archives/getAdjustHistoryList", params);
};

View File

@ -150,5 +150,8 @@ export const exportArchives = (ids) => {
window.URL.revokeObjectURL(url);
}));
};
// 基数调整记录列表
export const getAdjustHistoryList = (params) => {
return postFetch("/api/bs/hrmsalary/archives/getAdjustHistoryList", params);
};

View File

@ -1,10 +1,3 @@
import { WeaSwitch } from "comsMobx";
import { Button } from "antd";
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
export const tabCondition = [
{
color: "#000000",
@ -42,97 +35,3 @@ export const tabCondition = [
viewcondition: "ext"
}
];
export const logConditions = [
{
items: [
{
colSpan: 1,
conditionType: "BROWSER",
browserConditionParam: {
completeParams: {},
conditionDataParams: {},
dataParams: {},
destDataParams: {},
hasAddBtn: false,
hasAdvanceSerach: true,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: true,
linkUrl: "/hrm/resource/HrmResource.jsp?id=",
pageSize: 10,
quickSearchName: "",
replaceDatas: [],
title: "",
type: "1"
},
domkey: ["employeeId"],
fieldcol: 17,
label: "对象",
lanId: 106,
labelcol: 7,
value: ""
},
{
colSpan: 1,
conditionType: "BROWSER",
browserConditionParam: {
completeParams: {},
conditionDataParams: {},
dataParams: {},
destDataParams: {},
hasAddBtn: false,
hasAdvanceSerach: true,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: true,
linkUrl: "/hrm/resource/HrmResource.jsp?id=",
pageSize: 10,
quickSearchName: "",
replaceDatas: [],
title: "",
type: "1"
},
domkey: ["operator"],
fieldcol: 17,
label: "操作人",
lanId: 111,
labelcol: 7,
value: ""
}
],
defaultshow: true
}
];
export const getLogSearchsForm = (form, condition, onSearch = () => void (0)) => {
const { isFormInit } = form;
const formParams = form.getFormParams();
let group = [];
isFormInit && condition && condition.map(c => {
let items = [];
c.items.map(fields => {
items.push({
com: (
<WeaFormItem
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom"
>
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}/>
{
getKey(fields) === "operator" &&
<Button type="primary" onClick={onSearch} style={{ position: "absolute", right: "-70px", top: "0" }}>{getLabel(388113, "搜索")}</Button>
}
</WeaFormItem>),
colSpan: 1
});
});
group.push(
<WeaSearchGroup col={4} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} center={false}
/>);
});
return group;
};

View File

@ -17,7 +17,7 @@ import UnifiedTable from "../../../components/UnifiedTable";
import { convertToUrlString, getURLParameters } from "../../../util/url";
import { salaryArchiveDelete } from "../../../apis/payrollFiles";
import ImportDialog from "../../../components/importDialog";
import OperateLogDialog from "./operateLogDialog";
import OperateLogDialog from "../welfareArchive/components/logDialog";
import "./index.less";
import { sysinfo } from "../../../apis/ruleconfig";

View File

@ -85,36 +85,3 @@
}
}
}
//重构-社保福利档案
.logDialog {
.wea-dialog-body {
overflow-y: hidden;
}
.logDialogContent {
background: #F6F6F6;
padding: 16px;
width: 100%;
height: 100%;
.wea-search-group {
padding: 0;
margin-bottom: 10px;
background: #FFF;
.wea-form-cell {
padding: 0;
.wea-form-item {
padding: 10px;
}
}
}
.logTable {
background: #FFFFFF;
}
}
}

View File

@ -1,15 +1,16 @@
/*
* Author: 黎永顺
* name: 社保福利档案-操作日志
* name:社保福利档案-操作日志
* Description:
* Date: 2023/10/23
* Date: 2023/11/6
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom";
import { getAdjustHistoryList } from "../../../../apis/archive";
import { getLogSearchsForm, logConditions } from "../config";
import { getAdjustHistoryList } from "../../../../../apis/welfareArchive";
import { getLogSearchsForm, logConditions } from "../../config";
import moment from "moment";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;

View File

@ -0,0 +1,31 @@
//重构-社保福利档案
.logDialog {
.wea-dialog-body {
overflow-y: hidden;
}
.logDialogContent {
background: #F6F6F6;
padding: 16px;
width: 100%;
height: 100%;
.wea-search-group {
padding: 0;
margin-bottom: 10px;
background: #FFF;
.wea-form-cell {
padding: 0;
.wea-form-item {
padding: 10px;
}
}
}
.logTable {
background: #FFFFFF;
}
}
}

View File

@ -0,0 +1,102 @@
/*
* Author: 黎永顺
* name: 社保福利档案页面重构-导入
* Description:
* Date: 2023/11/6
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaCheckbox, WeaLocaleProvider } from "ecCom";
import ImportDialog from "../../../../../components/importDialog";
import { convertToUrlString, getURLParameters } from "../../../../../util/url";
import { importBatch } from "../../../../../apis/welfareArchive";
const getLabel = WeaLocaleProvider.getLabel;
@inject("archivesStore")
@observer
class Index extends Component {
constructor(props) {
super(props);
this.state = {
importDialog: {
nextloading: false, link: "", importResult: {}, imageId: "",
previewUrl: "/api/bs/hrmsalary/scheme/preview"
}
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
const { runStatuses, archivesStore: { welfareForm } } = nextProps;
const payload = {
[runStatuses !== "ext" ? "exportData" : "extWelArchiveList"]: "false",
runStatuses, ...welfareForm.getFormParams()
};
this.setState({
importDialog: {
...this.state.importDialog,
link: `/api/bs/hrmsalary/scheme/template/export?${convertToUrlString(payload)}`
}
});
} else {
this.setState({
importDialog: {
nextloading: false, link: "", importResult: {}, imageId: "",
previewUrl: "/api/bs/hrmsalary/scheme/preview"
}
});
}
}
handleImport = (payload) => {
const { importDialog } = this.state, { runStatuses: runStatus } = this.props;
this.setState({ importDialog: { ...importDialog, nextloading: true } });
importBatch({ ...payload, runStatus: runStatus.split(",")[0] }).then(({ data, status }) => {
this.setState({ importDialog: { ...importDialog, nextloading: false } });
if (status) {
this.setState({
importDialog: { ...importDialog, ...payload, importResult: data }
});
}
}).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } }));
};
render() {
const { runStatuses, archivesStore: { welfareForm } } = this.props;
const { importDialog } = this.state;
const { link } = importDialog;
return (
<ImportDialog
{...this.props} {...importDialog}
onResetImportResult={() => this.setState({
importDialog: {
...importDialog, importResult: {}, imageId: "", link: ""
}
})}
exportDataDom={
<WeaCheckbox
value={getURLParameters(link)[runStatuses !== "ext" ? "exportData" : "extWelArchiveList"] === "true" ? "1" : "0"}
content={getLabel(543208, "导出现有数据")}
helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")}
onChange={val => {
const payload = {
[runStatuses !== "ext" ? "exportData" : "extWelArchiveList"]: val === "1",
runStatuses, ...welfareForm.getFormParams()
};
this.setState({
importDialog: {
...importDialog,
link: `/api/bs/hrmsalary/scheme/template/export?${convertToUrlString(payload)}`
}
});
}}
/>
}
nextCallback={imageId => this.handleImport({ imageId })}
/>
);
}
}
export default Index;

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
import { message, Spin } from "antd";
import { message, Modal, Spin } from "antd";
import { inject, observer } from "mobx-react";
import * as API from "../../../../../apis/welfareArchive";
@ -15,7 +15,11 @@ const APILIST = {
runStatuses: API.queryList,
ext: API.getExtTable,
delToDo: API.updateRunStatus, //删除待办
addToPay: API.stayAddToPay //增员
delArchive: API.deleteArchive, //删除档案
addToPay: API.stayAddToPay, //增员
stayDelToStop: API.stayDelToStop, //减员
delToDoStay: API.cancelStayDel, //待减员-删除待办
cancelStop: API.cancelStopPayment //停缴员工-取消停缴
};
@inject("archivesStore")
@ -73,10 +77,21 @@ class Index extends Component {
this.setState({ selectedRowKeys });
break;
case "ADD-TO-PAY":
case "STAY-DEL-TO-STOP":
case "CANCEL-STOP":
case "DEL-TO-DO":
const module = id === "ADD-TO-PAY" ? [baseInfo] : { ids: [baseInfo], ...interfaceParams };
case "DEL-TO-DO-STAY":
const module = (id === "ADD-TO-PAY" || id === "STAY-DEL-TO-STOP" || id === "CANCEL-STOP") ?
[baseInfo] : { ids: [baseInfo], ...interfaceParams };
this.handleWelfareOpts(_.camelCase(id), module);
break;
case "DEL-ARCHIVE":
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(388758, "确认要删除吗?"),
onOk: () => this.handleWelfareOpts(_.camelCase(id), [baseInfo])
});
break;
default:
break;
}

View File

@ -1,21 +1,43 @@
import React from "react";
import { WeaHelpfulTip } from "ecCom";
import { WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { WeaSwitch } from "comsMobx";
import { Button } from "antd";
import AdvanceInputBtn from "./components/advanceInputBtn";
import { CancelHelpfulDiv, HelpfulDiv } from "./components/welfareTip";
export const optTypeEnum = [ //批量操作列表
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
//批量操作列表
export const optTypeEnum = [
//批量增员
{
key: "batchStaffIncrease",
type: "addToPay",
payload: null
},
// 批量删除待办
// 待增员-批量删除待办
{
key: "batchDeleteTodolist",
type: "delToDo",
payload: { runStatus: "4" }
},
// 待减员-批量删除待办
{
key: "batchDeleteTodolistStayDel",
type: "delToDoStay",
payload: { runStatus: "3" }
},
//批量减员
{
key: "batchReduction",
type: "stayDelToStop",
payload: null
},
//批量取消停缴
{
key: "batchCancellationOfSuspended",
type: "cancelStop",
payload: null
}
];
export const tabList = [
@ -168,7 +190,7 @@ export const renderDropMenuDatas = (selectedKey, getLabel) => {
content: getLabel(543188, "批量减员")
},
{
key: "batchDeleteTodolist",
key: "batchDeleteTodolistStayDel",
icon: <i className="iconfont icon-piliangshanchu"/>,
content: getLabel(543186, "批量删除待办")
},
@ -210,9 +232,9 @@ export const renderDropMenuDatas = (selectedKey, getLabel) => {
}
return menus;
};
export const renderReqBtns = (selectedKey, getLabel, onOpenAdvanceSearch, onAdvanceSearch) => {
export const renderReqBtns = (selectedKey, getLabel, onOpenAdvanceSearch, onAdvanceSearch, onImport) => {
let reqBtns = [
<Button type="primary">{getLabel(32935, "导入")}</Button>,
<Button type="primary" onClick={onImport}>{getLabel(32935, "导入")}</Button>,
<AdvanceInputBtn onOpenAdvanceSearch={onOpenAdvanceSearch} onAdvanceSearch={onAdvanceSearch}/>
];
switch (selectedKey) {
@ -245,3 +267,98 @@ export const renderReqBtns = (selectedKey, getLabel, onOpenAdvanceSearch, onAdva
}
return reqBtns;
};
export const logConditions = [
{
items: [
{
colSpan: 1,
conditionType: "BROWSER",
browserConditionParam: {
completeParams: {},
conditionDataParams: {},
dataParams: {},
destDataParams: {},
hasAddBtn: false,
hasAdvanceSerach: true,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: true,
linkUrl: "/hrm/resource/HrmResource.jsp?id=",
pageSize: 10,
quickSearchName: "",
replaceDatas: [],
title: "",
type: "1"
},
domkey: ["employeeId"],
fieldcol: 17,
label: "对象",
lanId: 106,
labelcol: 7,
value: ""
},
{
colSpan: 1,
conditionType: "BROWSER",
browserConditionParam: {
completeParams: {},
conditionDataParams: {},
dataParams: {},
destDataParams: {},
hasAddBtn: false,
hasAdvanceSerach: true,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: true,
linkUrl: "/hrm/resource/HrmResource.jsp?id=",
pageSize: 10,
quickSearchName: "",
replaceDatas: [],
title: "",
type: "1"
},
domkey: ["operator"],
fieldcol: 17,
label: "操作人",
lanId: 111,
labelcol: 7,
value: ""
}
],
defaultshow: true
}
];
export const getLogSearchsForm = (form, condition, onSearch = () => void (0)) => {
const { isFormInit } = form;
const formParams = form.getFormParams();
let group = [];
isFormInit && condition && condition.map(c => {
let items = [];
c.items.map(fields => {
items.push({
com: (
<WeaFormItem
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom"
>
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}/>
{
getKey(fields) === "operator" &&
<Button type="primary" onClick={onSearch}
style={{ position: "absolute", right: "-70px", top: "0" }}>{getLabel(388113, "搜索")}</Button>
}
</WeaFormItem>),
colSpan: 1
});
});
group.push(
<WeaSearchGroup col={4} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} center={false}
/>);
});
return group;
};

View File

@ -10,13 +10,20 @@ import { message } from "antd";
import { inject, observer } from "mobx-react";
import WelfareAdvanceSearchPannel from "./components/welfareAdvanceSearchPannel";
import WelfareTableList from "./components/welfareTableList";
import WelfareArchivesImportDialog from "./components/welfareArchivesImportDialog";
import WelfareTip from "./components/welfareTip";
import LogDialog from "./components/logDialog";
import * as API from "../../../apis/welfareArchive";
import { optTypeEnum, renderDropMenuDatas, renderReqBtns, tabList, welfareTipList } from "./config";
import { convertToUrlString } from "../../../util/url";
import cs from "classnames";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
const APILIST = {
fullStaffIncrease: API.allStayAddToPay,
fullReduction: API.allStayDelToStop
};
@inject("taxAgentStore")
@observer
@ -24,8 +31,9 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "1", showSearchAd: false, isQuery: false,
topTabCount: { stayAdd: 0, paying: 0, stayDel: 0, stopPay: 0, ext: 0 }
selectedKey: "1", showSearchAd: false, isQuery: false, logDialogVisible: false,
topTabCount: { stayAdd: 0, paying: 0, stayDel: 0, stopPay: 0, ext: 0 },
welfareImpDialog: { visible: false, title: getLabel(24023, "数据导入"), runStatuses: "" }
};
}
@ -41,26 +49,44 @@ class Index extends Component {
};
handleOpenAdvanceSearch = () => this.setState({ showSearchAd: true });
handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery });
handleImport = () => {
this.setState({
welfareImpDialog: {
...this.state.welfareImpDialog, visible: true,
runStatuses: this.state.selectedKey
}
});
};
onDropMenuClick = (key) => {
console.log(key);
switch (key) {
case "fullStaffIncrease":
this.allStayAddToPay();
case "fullReduction":
this.handleFullOptions(key);
break;
case "batchStaffIncrease":
case "batchDeleteTodolist":
case "batchReduction":
case "batchCancellationOfSuspended":
case "batchDeleteTodolistStayDel":
const type = _.find(optTypeEnum, o => o.key === key).type;
const payload = _.find(optTypeEnum, o => o.key === key).payload;
this.welfareListRef.wrappedInstance.handleBatchOpt(type, payload);
break;
case "exportAll":
case "exportSelected":
this.handleExport(key);
break;
case "log":
this.setState({ logDialogVisible: true });
break;
default:
break;
}
};
onAdSearch = () => this.setState({ showSearchAd: false, isQuery: !this.state.isQuery });
allStayAddToPay = () => {
handleFullOptions = (key) => {
WeaLoadingGlobal.start();
API.allStayAddToPay().then(({ status, data, errormsg }) => {
APILIST[key]().then(({ status, data, errormsg }) => {
WeaLoadingGlobal.destroy();
if (status) {
const { type, msg } = data;
@ -75,9 +101,24 @@ class Index extends Component {
}
}).catch(() => WeaLoadingGlobal.destroy());
};
handleExport = (key) => {
const {
state: { selectedRowKeys },
props: { archivesStore: { welfareForm } }
} = this.welfareListRef.wrappedInstance,
{ selectedKey: runStatuses } = this.state;
let payload = { runStatuses };
if (key.indexOf("Selected") !== -1 && _.isEmpty(selectedRowKeys)) {
message.warning(getLabel(543303, "请选择表格数据"));
return;
}
payload = { ...payload, ids: selectedRowKeys.join(",") };
key.indexOf("Selected") === -1 && (payload = { ...payload, ids: "", ...welfareForm.getFormParams() });
window.open(`/api/bs/hrmsalary/scheme/export?${convertToUrlString(payload)}`, "_blank");
};
render() {
const { selectedKey, topTabCount, showSearchAd, isQuery } = this.state;
const { selectedKey, topTabCount, showSearchAd, isQuery, logDialogVisible, welfareImpDialog } = this.state;
const { taxAgentStore: { showOperateBtn } } = this.props;
const tipList = _.find(welfareTipList, o => o.viewcondition === selectedKey).list;
return (
@ -86,7 +127,7 @@ class Index extends Component {
title={getLabel(538001, "社保福利档案")} buttonSpace={10} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" showDropIcon onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={renderDropMenuDatas(selectedKey, getLabel)}
buttons={renderReqBtns(selectedKey, getLabel, this.handleOpenAdvanceSearch, this.handleAdvanceSearch)}
buttons={renderReqBtns(selectedKey, getLabel, this.handleOpenAdvanceSearch, this.handleAdvanceSearch, this.handleImport)}
replaceTab={
<WeaTab
datas={_.map(tabList, o => ({ ...o, title: getLabel(o.lanId, o.title) }))} autoCalculateWidth
@ -110,6 +151,19 @@ class Index extends Component {
/>
{/*提示*/}
{!_.isEmpty(tipList) && <WelfareTip dataSource={tipList}/>}
{/*操作日志*/}
<LogDialog visible={logDialogVisible} onCancel={() => this.setState({ logDialogVisible: false })}/>
{/* 导入*/}
<WelfareArchivesImportDialog {...welfareImpDialog}
onCancel={(isFresh) => {
this.setState({
isQuery: isFresh ? !isQuery : isQuery,
welfareImpDialog: {
...this.state.welfareImpDialog, visible: false,
runStatuses: ""
}
});
}}/>
</div>
</WeaReqTop>
</div>