From a11ad9d7d164bc2e17e6f14cd8b203c73ae072fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 21 Feb 2023 09:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/cumDeduct.js | 5 + .../dataAcquisition/components/index.less | 27 ++ .../dataAcquisition/components/tableRecord.js | 148 +++++++++++ .../cumDeduct/components/importFormCom.js | 46 ++++ .../pages/dataAcquisition/cumDeduct/index.js | 247 ++++++++++++++++-- .../pages/dataAcquisition/dataTables.js | 4 +- .../hrmSalary/pages/dataAcquisition/layout.js | 54 +++- 7 files changed, 504 insertions(+), 27 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/components/index.less create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/components/importFormCom.js diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 90057b60..fc963bb5 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -132,3 +132,8 @@ export const autoAddAll = (params) => { export const getTableDate = ({ url, ...params }) => { return postFetch(url, params); }; +//数据采集列表详情记录查询 +export const getTableRecordDate = ({ url, ...params }) => { + return postFetch(url, params); +}; + diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/components/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/components/index.less new file mode 100644 index 00000000..80d08cf2 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/components/index.less @@ -0,0 +1,27 @@ +.tableRecordWrapper { + .accumulated { + .wea-form-cell-wrapper { + & > div:first-child { + width: 10% !important; + line-height: 46px; + } + + & > div:nth-child(2) { + width: 40% !important; + + .wea-form-item-wrapper { + display: flex !important; + align-items: center; + + .to { + padding: 0 10px; + } + } + } + + & > div:last-child { + width: 40% !important; + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js new file mode 100644 index 00000000..bd6007b8 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js @@ -0,0 +1,148 @@ +/* + * Author: 黎永顺 + * name: 数据采集-详情记录页面 + * Description: + * Date: 2023/2/20 + */ +import React, { Component } from "react"; +import { WeaSearchGroup } from "ecCom"; +import UnifiedTable from "../../../components/UnifiedTable"; +import { getTableRecordDate } from "../../../apis/cumDeduct"; +import { DataCollectionDateRangePick, DataCollectionSelect, Input } from "../cumDeduct"; +import "./index.less"; + +class TableRecord extends Component { + constructor(props) { + super(props); + this.state = { + loading: { + query: false + }, + dataSource: [], + columns: [], + selectedRowKeys: [], + pageInfo: { + current: 1, pageSize: 10, total: 0 + }, + recordPayload: { + accumulatedSpecialAdditionalDeductionId: "", + otherTaxExemptDeductionId: "", + accumulatedSituationId: "", + specialAddDeductionId: "", + taxAgentId: "", + declareMonth: [] + } + }; + } + + componentDidMount() { + this.getTableRecordData(); + } + + getTableRecordData = (payload) => { + const { loading, pageInfo } = this.state; + const { url, ...extraPayload } = this.props; + const module = { ...pageInfo, url, ...extraPayload, ...payload }; + this.setState({ loading: { ...loading, query: true } }); + getTableRecordDate(_.omit(module, ["className", "items", "total"])).then(({ status, data }) => { + this.setState({ loading: { ...loading, query: false } }); + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource, + columns + }); + } + }).catch(() => this.setState({ loading: { ...loading, query: false } })); + }; + + /* + * Author: 黎永顺 + * Description: 详情页面-筛选操作 + * Params: + * Date: 2023/2/20 + */ + handleTablerecordScreen = ({ key, value }) => { + const { recordPayload } = this.state; + // this.setState({ + // recordPayload: { + // ...recordPayload, + // [key]: value + // } + // }, () => { + // this.tableRecordRef.getTableRecordData(this.state.recordPayload); + // }); + }; + render() { + const { className, screenParams, taxAgentOption } = this.props; + const { columns, dataSource, loading, selectedRowKeys, pageInfo, recordPayload } = this.state; + const rowSelection = { + selectedRowKeys, + onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) + }; + const pagination = { + ...pageInfo, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions: ["10", "20", "50", "100"], + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => { + this.getTableRecordData(); + }); + }, + onChange: (current) => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + this.getTableRecordData(); + }); + } + }; + const items = [ + { + com: Input({ value: editId.username }) + }, + { + com: DataCollectionDateRangePick({ + label: "税款所属期", + range: recordPayload.declareMonth, + onChange: this.handleTablerecordScreen, + key: "declareMonth" + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: !_.isNil(recordPayload.taxAgentId) ? recordPayload.taxAgentId.toString() : "", + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + onChange: this.handleTablerecordScreen, + key: "taxAgentId" + }) + } + ]; + return ( +
+ + ({ + ...item, + render: (text) => { + return {text} ; + } + }))} + dataSource={dataSource} + pagination={pagination} + loading={loading.query} + /> +
+ ); + } +} + +export default TableRecord; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/components/importFormCom.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/components/importFormCom.js new file mode 100644 index 00000000..f1edb3d2 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/components/importFormCom.js @@ -0,0 +1,46 @@ +/* + * Author: 黎永顺 + * name: 数据采集-导入选项 + * Description: + * Date: 2023/2/20 + */ +import React, { Component } from "react"; +import { WeaSearchGroup } from "ecCom"; +import { DataCollectionDatePicker, DataCollectionSelect } from "../index"; + +class ImportFormCom extends Component { + screenChange = ({ key, value }) => { + const { onChangeImportForm } = this.props; + onChangeImportForm(key, value); + }; + + render() { + const { taxAgentOption, declareMonth, taxAgentId } = this.props; + const items = [ + { + com: DataCollectionDatePicker({ + label: "税款所属期", + value: declareMonth, + onChange: this.screenChange, + key: "declareMonth", + screen: false + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId" + }) + } + ]; + return ( + + ); + } +} + +export default ImportFormCom; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index a0a98009..7665c194 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; +import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaInput, WeaSearchGroup, WeaSelect } from "ecCom"; import { Button, Dropdown, Menu, message, Modal } from "antd"; import { autoAddAll, @@ -8,11 +8,17 @@ import { deleteAllAddUpDeduction, deleteSelectAddUpDeduction, editAddUpDeduction, - getAddUpDeduction + getAddUpDeduction, + getCumDeductSaCondition, + importCumDeductParam, + importCumDeductPreview } from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; import AddItems from "../addItems"; +import ImportFormCom from "./components/importFormCom"; +import TableRecord from "../components/tableRecord"; import { dataCollectCondition } from "./columns"; +import { removePropertyCondition } from "../../../util/response"; import Layout from "../layout"; import moment from "moment"; @@ -32,9 +38,28 @@ class Index extends Component { title: "", children: null, data: {} - } + }, + importPayload: { + visible: false, + importOpts: { + declareMonth: moment(new Date()).format("YYYY-MM"), + taxAgentId: "" + }, + importFormComponent: null, + step: 0, + importResult: {}, + slideDataSource: [] + }, + exportPayloadUrl: "", + advanceCondition: null }; this.tableRef = null; + this.addItemRef = null; + this.tableRecordRef = null; + } + + componentDidMount() { + this.getAdvanceCondition(); } /* @@ -56,6 +81,21 @@ class Index extends Component { } }).catch(() => this.setState({ addAllLoading: false })); }; + /* + * Author: 黎永顺 + * Description: 高级搜素框-表单项 + * Params: + * Date: 2023/2/20 + */ + getAdvanceCondition = () => { + const { cumDeductStore: { form } } = this.props; + getCumDeductSaCondition().then(({ status, data }) => { + if (status) { + this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + form.initFormFields(removePropertyCondition(data.condition)); + } + }); + }; /* * Author: 黎永顺 * Description: 一键清空 @@ -112,6 +152,70 @@ class Index extends Component { } }); }; + /* + * Author: 黎永顺 + * Description:数据采集-导出全部 + * Params: + * Date: 2023/2/20 + */ + handleExportAll = () => { + const { declareMonth, taxAgentId } = this.state; + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description:数据采集-导出选中 + * Params: + * Date: 2023/2/20 + */ + handleExportSelect = () => { + const { selectedRowKeys: ids } = this.tableRef.state; + const { declareMonth, taxAgentId } = this.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + this.setState({ + 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: 数据采集-信息保存 @@ -147,7 +251,6 @@ class Index extends Component { }); } }; - handleSaveData = () => { const { cumDeductStore: { addForm } } = this.props; const { baseInfo } = this.addItemRef.state; @@ -174,22 +277,30 @@ class Index extends Component { */ handleAddData = (title = "新建", editId = {}) => { const { taxAgentStore, cumDeductStore: { addForm } } = this.props; - addForm.initFormFields(dataCollectCondition); const { slidePayload } = this.state; const { taxAgentOption } = taxAgentStore; + addForm.initFormFields(dataCollectCondition); this.setState({ slidePayload: { ...slidePayload, visible: true, title, data: editId, - children: this.addItemRef = dom} - taxAgentOption={taxAgentOption} - form={addForm} - editId={editId} - condition={dataCollectCondition} - /> + children: title.length <= 2 ? + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + editId={editId} + condition={dataCollectCondition} + /> : + this.tableRecordRef = dom} + className="accumulated" + taxAgentOption={taxAgentOption} + url="/api/bs/hrmsalary/addUpDeduction/getDetailList" + screenParams={["accumulatedSpecialAdditionalDeductionId", "taxAgentId", "declareMonth"]} + /> } }); }; @@ -251,6 +362,10 @@ class Index extends Component { screenChange = ({ key, value }) => { this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 })); }; + handleAdSearch = () => { + const { cumDeductStore: { form } } = this.props; + this.tableRef.getTableDate({ ...form.getFormParams(), current: 1 }); + }; /* * Author: 黎永顺 * Description: 顶部操作按钮 @@ -260,7 +375,7 @@ class Index extends Component { getTopBtns = () => { const { addAllLoading } = this.state; return [ - , + , , , this[keyFunc](); + /* + * Author: 黎永顺 + * Description:详情页面-操作按钮 + * Params: + * Date: 2023/2/20 + */ + getDetailOptBtns = () => { + return [ + + 导出选中 + + } + type="primary"> + 导出全部 + + ]; + }; + /* + * Author: 黎永顺 + * Description: 数据采集-导入相关 + * Params: + * Date: 2023/2/20 + */ + handleOpenImport = () => { + const { importPayload } = this.state; + const { importOpts } = importPayload; + const { taxAgentStore: { taxAgentOption } } = this.props; + this.setState({ + importPayload: { + ...importPayload, + visible: true, step: 0, + importResult: {}, slideDataSource: [], + importFormComponent: + } + }); + }; + handleCloseImport = (doSearch = false) => { + const { importPayload } = this.state; + this.setState({ + importPayload: { + ...importPayload, visible: false, importFormComponent: null, step: 0, + importOpts: { + declareMonth: moment(new Date()).format("YYYY-MM"), + taxAgentId: "" + }, importResult: {}, slideDataSource: [] + } + }, () => doSearch && this.tableRef.getTableDate()); + }; + handleChangeImportForm = (key, value) => { + const { importPayload } = this.state; + const { importOpts } = importPayload; + this.setState({ + importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } } + }); + }; + handleImportSetStep = (step) => { + const { importPayload } = this.state; + this.setState({ + importPayload: { ...importPayload, step } + }); + }; render() { - const { taxAgentStore: { showOperateBtn } } = this.props; - const { declareMonth, taxAgentId, slidePayload, saveLoading } = this.state; + const { taxAgentStore: { showOperateBtn }, cumDeductStore: { form } } = this.props; + const { + declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, + importPayload + } = this.state; const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( this.tableRef = dom} @@ -295,6 +484,7 @@ class Index extends Component { payload={tablePayload} showOperateBtn={showOperateBtn} onTableOperate={this.handleTableOperate} + onViewDetails={(record) => this.handleAddData("累计专项附加扣除记录", record)} /> ); @@ -303,16 +493,33 @@ class Index extends Component { export default Index; -const DataCollectionDatePicker = (props) => { - const { value, label, onChange, format = "YYYY-MM", key } = props; +export const DataCollectionDatePicker = (props) => { + const { value, label, onChange, format = "YYYY-MM", key, screen = true } = props; return onChange({ key, value: val })} format={format}/> - + { + screen && + + } ; }; -const DataCollectionSelect = (props) => { +export const DataCollectionSelect = (props) => { const { value, label, onChange, options, key } = props; return onChange({ key, value: val })} options={options}/> ; }; + +export const Input = (props) => { + const { value } = props; + return (); +}; +export const DataCollectionDateRangePick = (props) => { + const { range, label, onChange, format = "YYYY-MM", key } = props; + const [value1 = "", value2 = ""] = range; + return + onChange({ key, value: [val, value2] })} format={format}/> + + onChange({ key, value: [value1, val] })} format={format}/> + ; +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index 9c0900cd..fd7cade5 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -56,7 +56,7 @@ class DataTables extends Component { render() { const { columns, dataSource, loading, selectedRowKeys, pageInfo } = this.state; - const { showOperateBtn, onTableOperate } = this.props; + const { showOperateBtn, onTableOperate, onViewDetails } = this.props; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) @@ -106,7 +106,7 @@ class DataTables extends Component { ...item, render: (text, record) => (
- 查看明细 + onViewDetails(record)}>查看明细 { showOperateBtn && 1111} + searchsAd={getSearchs(form, toJS(condition), 2)} showSearchAd={showSearchAd} setShowSearchAd={bool => this.setState({ showSearchAd: bool })} + onAdReset={() => form.resetForm()} + onAdSearch={onAdSearch} + onSearch={onAdSearch} + onSearchChange={(v) => form.updateFields({ username: v })} + searchsBaseValue={form.getFormParams().username} />
{children} + {/*导入弹框*/} + onCancel(true)} + slideDataSource={slideDataSource} + previewImport={onPreviewImport} + importFile={onImportFile} + templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} + renderFormComponent={() => importFormComponent} + visiable={importVisiable} + onCancel={onCancel} + /> {/* 新增-编辑-详情弹框 */} } content={slideChildren}