hotfix/3.0.0.2403.01

数据采集页面导入修改重构
This commit is contained in:
黎永顺 2024-03-13 17:27:49 +08:00
parent ffaf5dc036
commit 0771ad9ed3
8 changed files with 152 additions and 207 deletions

View File

@ -120,6 +120,30 @@
}
}
.import-option {
.screenWrapper {
padding: 0;
margin: 10px;
border: 1px solid #e5e5e5;
.wea-content {
padding: 0;
}
.wea-form-cell {
padding: 0 16px;
.wea-date-picker {
width: 85%;
}
}
.wea-helpful-tip {
padding-left: 10px;
}
}
}
}
}

View File

@ -32,7 +32,7 @@ class ImportFormCom extends Component {
value: taxAgentId || "",
onChange: this.screenChange,
options: [{ key: "", showname: "全部" }, ...taxAgentOption],
key: "taxAgentId"
key: "taxAgentId", viewAttr: 3
})
}
];

View File

@ -19,14 +19,13 @@ import {
editAddUpDeduction,
getAddUpDeduction,
getCumDeductSaCondition,
importCumDeductParam,
importCumDeductPreview
importCumDeductParam
} from "../../../apis/cumDeduct";
import DataTables from "../dataTables";
import AddItems from "../addItems";
import ImportFormCom from "./components/importFormCom";
import TableRecord from "../components/tableRecord";
import { dataCollectCondition, modalColumns } from "./columns";
import { dataCollectCondition } from "./columns";
import { removePropertyCondition } from "../../../util/response";
import { convertToUrlString } from "../../../util/url";
import Layout from "../layout";
@ -59,10 +58,9 @@ class Index extends Component {
taxAgentId: ""
},
importFormComponent: null,
step: 0,
templateLink: "/api/bs/hrmsalary/addUpDeduction/downloadTemplate",
importResult: {},
slideDataSource: []
previewUrl: "/api/bs/hrmsalary/addUpDeduction/preview"
},
exportPayloadUrl: "",
exportPayloadType: false,
@ -200,41 +198,6 @@ class Index extends Component {
exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpDeduction/export?ids=${ids.join(",")}&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}`
});
};
/*
* Author: 黎永顺
* Description: 导入数据采集数据
* Params:
* Date: 2023/2/20
*/
handleImportFile = (params) => {
importCumDeductParam(params).then(({ status, data }) => {
if (status) {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, importResult: data }
});
}
});
};
/*
* Author: 黎永顺
* Description: 导入数据采集-数据查看
* Params:
* Date: 2023/2/20
*/
handlePreviewImport = (params) => {
importCumDeductPreview(params).then(({ status, data, errormsg }) => {
if (status) {
const { preview = [] } = data;
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, slideDataSource: preview }
});
} else {
message.error(errormsg || "预览失败");
}
});
};
/*
* Author: 黎永顺
* Description: 数据采集-信息保存
@ -530,12 +493,6 @@ class Index extends Component {
importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
});
};
handleImportSetStep = (step) => {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, step }
});
};
render() {
const { taxAgentStore: { showOperateBtn }, cumDeductStore: { form } } = this.props;
@ -551,11 +508,9 @@ class Index extends Component {
slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl}
exportPayloadType={exportPayloadType} logFunction="addupdeduction"
form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch}
onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport}
importPayload={importPayload} onImportFile={this.handleImportFile}
onPreviewImport={this.handlePreviewImport} detailOptBtns={this.getDetailOptBtns()}
onCancel={this.handleCloseImport} onImportFile={importCumDeductParam}
importPayload={importPayload} detailOptBtns={this.getDetailOptBtns()}
targetid={targetid} onClearTargrtid={() => this.setState({ targetid: "" })}
columns={modalColumns}
>
<DataTables
ref={dom => this.tableRef = dom}
@ -588,9 +543,9 @@ export const DataCollectionDatePicker = (props) => {
</WeaFormItem>;
};
export const DataCollectionSelect = (props) => {
const { value, label, onChange, options, key, labelCol = 10, wrapperCol = 14 } = props;
const { value, label, onChange, options, key, labelCol = 10, wrapperCol = 14, viewAttr = 2 } = props;
return <WeaFormItem label={label} labelCol={{ span: labelCol }} wrapperCol={{ span: wrapperCol }}>
<WeaSelect value={value} onChange={(val) => onChange({ key, value: val })} options={options}/>
<WeaSelect value={value} onChange={(val) => onChange({ key, value: val })} options={options} viewAttr={viewAttr}/>
</WeaFormItem>;
};

View File

@ -15,8 +15,7 @@ import {
editAddUpSituation,
getAddUpSituation,
getCumSituationSaCondition,
importCumSituationParam,
importCumSituationPreview
importCumSituationParam
} from "../../../apis/cumSituation";
import { removePropertyCondition } from "../../../util/response";
import DataTables from "../dataTables";
@ -27,7 +26,6 @@ import moment from "moment";
import { dataCollectCondition, taxOptions } from "./columns";
import AddItems from "../addItems";
import TableRecord from "../components/tableRecord";
import { situationModalColumns } from "../cumDeduct/columns";
import { convertToUrlString } from "../../../util/url";
const getKey = WeaTools.getKey;
@ -57,10 +55,9 @@ class Index extends Component {
declareMonth: moment(new Date()).format("YYYY-MM")
},
importFormComponent: null,
step: 0,
templateLink: "/api/bs/hrmsalary/addUpSituation/downloadTemplate",
importResult: {},
slideDataSource: []
previewUrl: "/api/bs/hrmsalary/addUpSituation/preview"
},
exportPayloadUrl: "",
exportPayloadType: false,
@ -126,46 +123,6 @@ class Index extends Component {
});
}
};
/*
* Author: 黎永顺
* Description: 导入数据采集数据
* Params:
* Date: 2023/2/20
*/
handleImportFile = (params) => {
const { declareMonth, ...extra } = params;
const payload = {
taxYearMonth: declareMonth,
...extra
};
importCumSituationParam(payload).then(({ status, data }) => {
if (status) {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, importResult: data }
});
}
});
};
/*
* Author: 黎永顺
* Description: 导入数据采集-数据查看
* Params:
* Date: 2023/2/20
*/
handlePreviewImport = (params) => {
importCumSituationPreview(params).then(({ status, data, errormsg }) => {
if (status) {
const { preview = [] } = data;
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, slideDataSource: preview }
});
} else {
message.error(errormsg || "预览失败");
}
});
};
/*
* Author: 黎永顺
* Description:列表操作
@ -485,12 +442,6 @@ class Index extends Component {
importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
});
};
handleImportSetStep = (step) => {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, step }
});
};
/*
* Author: 黎永顺
* Description:详情页面-操作按钮
@ -555,10 +506,9 @@ class Index extends Component {
slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl}
exportPayloadType={exportPayloadType} logFunction="addupsituation"
form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch}
onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport}
onCancel={this.handleCloseImport} onImportFile={importCumSituationParam}
detailOptBtns={this.getDetailOptBtns()}
importPayload={{ ...importPayload, importOpts: { taxYearMonth: importPayload.importOpts.declareMonth } }}
onImportFile={this.handleImportFile} columns={situationModalColumns}
onPreviewImport={this.handlePreviewImport} detailOptBtns={this.getDetailOptBtns()}
targetid={targetid} onClearTargrtid={() => this.setState({ targetid: "" })}
>
<DataTables

View File

@ -0,0 +1,84 @@
/*
* Author: 黎永顺
* name: 最优年终奖计税方案-策略-导入
* Description:
* Date: 2024/3/1
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaCheckbox, WeaLocaleProvider } from "ecCom";
import ImportDialog from "../../components/importDialog";
import { convertToUrlString } from "../../util/url";
const getLabel = WeaLocaleProvider.getLabel;
@inject("specialAddStore")
@observer
class Index extends Component {
constructor(props) {
super(props);
this.state = {
hasData: false,
importDialog: {
nextloading: false, link: "", importResult: {}, imageId: "", params: {},
previewUrl: ""
}
};
}
componentWillReceiveProps(nextProps, nextContext) {
const { hasData, importDialog } = this.state;
const { templateLink, importOpts, importResult, previewUrl } = nextProps;
this.setState({
importDialog: {
...importDialog, link: `${templateLink}?${convertToUrlString({ ...importOpts, hasData })}`,
importResult, params: importOpts, previewUrl
}
});
}
handleImport = (payload) => {
const { importDialog } = this.state, { onImportFile, importOpts } = this.props;
this.setState({ importDialog: { ...importDialog, nextloading: true } });
onImportFile({ ...payload, ...importOpts }).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 { importDialog, hasData } = this.state;
const { visible, onCancel, importParams, templateLink, importOpts } = this.props;
return (
<ImportDialog
visible={visible} onCancel={onCancel} {...importDialog} title={getLabel(24023, "数据导入")}
importParams={importParams} onResetImportResult={() => this.setState({
importDialog: { ...importDialog, importResult: {}, imageId: "", link: "" }
})}
exportDataDom={
<WeaCheckbox
value={hasData ? "1" : "0"}
content={getLabel(543208, "导出现有数据")}
helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")}
onChange={val => this.setState({ hasData: val === "1" }, () => {
this.setState({
importDialog: {
...importDialog,
link: `${templateLink}?${convertToUrlString({ ...importOpts, hasData: this.state.hasData })}`
}
});
})}
/>
}
nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
nextUplaodCallback={imageId => this.handleImport({ imageId })}
/>
);
}
}
export default Index;

View File

@ -8,11 +8,11 @@ import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { WeaLocaleProvider, WeaNewScroll, WeaSlideModal, WeaTab, WeaTop } from "ecCom";
import ImportModal from "../../components/importModal";
import ImportModal from "./importDialog";
import LogDialog from "../../components/logViewModal";
import SlideModalTitle from "../../components/slideModalTitle";
import { getSearchs } from "../../util";
import "./index.less";
import LogDialog from "../../components/logViewModal";
const getLabel = WeaLocaleProvider.getLabel;
@ -78,14 +78,13 @@ class Layout extends Component {
const { showSearchAd, logDialogVisible, filterConditions } = this.state;
const {
title, btns, leftComp, children, taxAgentStore: { showOperateBtn },
slidePayload, onClose, onSave, slideLoading, form, condition,
onAdSearch, onCancel, importPayload, onImportSetStep, onImportFile,
onPreviewImport, detailOptBtns, columns, logFunction, onClearTargrtid
slidePayload, onClose, onSave, slideLoading, form, condition, onImportFile,
onAdSearch, onCancel, importPayload, detailOptBtns, logFunction, onClearTargrtid
} = this.props;
const { visible, title: subtitle, children: slideChildren } = slidePayload;
const {
visible: importVisiable, step, importFormComponent, importOpts,
importResult, slideDataSource, templateLink
visible: importVisiable, importFormComponent, importOpts,
importResult, templateLink, previewUrl
} = importPayload;
return (
<div className="layoutWrapper">
@ -115,21 +114,26 @@ class Layout extends Component {
<WeaNewScroll height="100%">{children}</WeaNewScroll>
{/*导入弹框*/}
<ImportModal
needimportSelected //下载模板需要带上导入所选项
columns={columns}
params={importOpts}
step={step}
setStep={onImportSetStep}
importResult={importResult}
onFinish={() => onCancel(true)}
slideDataSource={slideDataSource}
previewImport={onPreviewImport}
importFile={onImportFile}
templateLink={templateLink}
renderFormComponent={() => importFormComponent}
visiable={importVisiable}
onCancel={onCancel}
visible={importVisiable} onCancel={onCancel} importParams={importFormComponent}
importOpts={importOpts} importResult={importResult} templateLink={templateLink}
previewUrl={previewUrl} onImportFile={onImportFile}
/>
{/*<ImportModal*/}
{/* needimportSelected //下载模板需要带上导入所选项*/}
{/* columns={columns}*/}
{/* params={importOpts}*/}
{/* step={step}*/}
{/* setStep={onImportSetStep}*/}
{/* importResult={importResult}*/}
{/* onFinish={() => onCancel(true)}*/}
{/* slideDataSource={slideDataSource}*/}
{/* previewImport={onPreviewImport}*/}
{/* importFile={onImportFile}*/}
{/* templateLink={templateLink}*/}
{/* renderFormComponent={() => importFormComponent}*/}
{/* visiable={importVisiable}*/}
{/* onCancel={onCancel}*/}
{/*/>*/}
{/* 新增-编辑-详情弹框 */}
<WeaSlideModal
className="slideOuterWrapper"

View File

@ -28,7 +28,6 @@ import { DataCollectionDatePicker, DataCollectionSelect } from "../cumDeduct";
import { dataCollectCondition } from "./columns";
import AddItems from "../addItems";
import TableRecord from "../components/tableRecord";
import { otherModalColumns } from "../cumDeduct/columns";
import { convertToUrlString } from "../../../util/url";
const getKey = WeaTools.getKey;
@ -57,10 +56,9 @@ class Index extends Component {
declareMonth: moment(new Date()).format("YYYY-MM")
},
importFormComponent: null,
step: 0,
templateLink: "/api/bs/hrmsalary/otherDeduction/downloadTemplate",
importResult: {},
slideDataSource: []
previewUrl: "/api/bs/hrmsalary/otherDeduction/preview"
},
exportPayloadUrl: "",
exportPayloadType: false,
@ -146,22 +144,6 @@ class Index extends Component {
});
}
};
/*
* Author: 黎永顺
* Description: 导入数据采集数据
* Params:
* Date: 2023/2/20
*/
handleImportFile = (params) => {
importOtherDeductionParam(params).then(({ status, data }) => {
if (status) {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, importResult: data }
});
}
});
};
/*
* Author: 黎永顺
* Description: 导入数据采集-数据查看
@ -479,12 +461,6 @@ class Index extends Component {
importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
});
};
handleImportSetStep = (step) => {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, step }
});
};
/*
* Author: 黎永顺
* Description:详情页面-操作按钮
@ -549,11 +525,9 @@ class Index extends Component {
slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl}
exportPayloadType={exportPayloadType} logFunction="otherdeduction"
form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch}
onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport}
importPayload={importPayload} onImportFile={this.handleImportFile}
onPreviewImport={this.handlePreviewImport} detailOptBtns={this.getDetailOptBtns()}
onCancel={this.handleCloseImport} importPayload={importPayload}
detailOptBtns={this.getDetailOptBtns()} onImportFile={importOtherDeductionParam}
targetid={targetid} onClearTargrtid={() => this.setState({ targetid: "" })}
columns={otherModalColumns}
>
<DataTables
ref={dom => this.tableRef = dom}

View File

@ -11,8 +11,7 @@ import {
specialAddDeductionDeleteAllData,
specialAddDeductionDeleteSelectData,
specialAddDeductionEditData,
specialAddDeductionImportData,
specialAddDeductionPreview
specialAddDeductionImportData
} from "../../../apis/special";
import { removePropertyCondition } from "../../../util/response";
import { DataCollectionSelect } from "../cumDeduct";
@ -20,7 +19,6 @@ import ImportFormCom from "../cumDeduct/components/importFormCom";
import { condition } from "./components/condition";
import AddItems from "../addItems";
import TableRecord from "../components/tableRecord";
import { specialModalColumns } from "../cumDeduct/columns";
import { convertToUrlString } from "../../../util/url";
const getKey = WeaTools.getKey;
@ -47,10 +45,9 @@ class Index extends Component {
taxAgentId: ""
},
importFormComponent: null,
step: 0,
templateLink: "/api/bs/hrmsalary/specialAddDeduction/downloadTemplate",
importResult: {},
slideDataSource: []
previewUrl: "/api/bs/hrmsalary/specialAddDeduction/preview"
},
exportPayloadUrl: "",
exportPayloadType: false,
@ -101,41 +98,6 @@ class Index extends Component {
});
}
};
/*
* Author: 黎永顺
* Description: 导入数据采集数据
* Params:
* Date: 2023/2/20
*/
handleImportFile = (params) => {
specialAddDeductionImportData(params).then(({ status, data }) => {
if (status) {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, importResult: data }
});
}
});
};
/*
* Author: 黎永顺
* Description: 导入数据采集-数据查看
* Params:
* Date: 2023/2/20
*/
handlePreviewImport = (params) => {
specialAddDeductionPreview(params).then(({ status, data, errormsg }) => {
if (status) {
const { preview = [] } = data;
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, slideDataSource: preview }
});
} else {
message.error(errormsg || "预览失败");
}
});
};
/*
* Author: 黎永顺
* Description: 高级搜素框-表单项
@ -439,12 +401,6 @@ class Index extends Component {
importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } }
});
};
handleImportSetStep = (step) => {
const { importPayload } = this.state;
this.setState({
importPayload: { ...importPayload, step }
});
};
render() {
const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props;
@ -460,11 +416,9 @@ class Index extends Component {
slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl}
exportPayloadType={exportPayloadType} logFunction="specialAddDeduction"
form={advanceForm} condition={advanceCondition} onAdSearch={this.handleAdSearch}
onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport}
importPayload={importPayload} onImportFile={this.handleImportFile}
onPreviewImport={this.handlePreviewImport} detailOptBtns={[]}
onCancel={this.handleCloseImport} detailOptBtns={[]}
importPayload={importPayload} onImportFile={specialAddDeductionImportData}
targetid={targetid} onClearTargrtid={() => this.setState({ targetid: "" })}
columns={specialModalColumns}
>
<DataTables
ref={dom => this.tableRef = dom}