From 2b6157788d44c5ef53d239b99ac9917fdb3b0883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 17 Feb 2023 10:59:04 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/cumDeduct/index.js | 879 +----------------- .../dataAcquisition/cumDeduct/indexcopy.js | 855 +++++++++++++++++ 2 files changed, 898 insertions(+), 836 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index ff7727d5..e7cd2ea3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,855 +1,62 @@ -import React from "react"; -import { inject, observer } from "mobx-react"; -import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; -import { WeaDatePicker, WeaHelpfulTip, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom"; -import moment from "moment"; -import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import ImportModal from "../../../components/importModal"; -import { dataCollectCondition, modalColumns } from "./columns"; -import { optionAddAll } from "../../../util/options"; -import SlideModalTitle from "../../../components/slideModalTitle"; -import EditSlideContent from "./components/editSlideContent"; -import AddItems from "../addItems"; -import * as API from "../../../apis/cumDeduct"; -import "./index.less"; +import React, { Component } from "react"; +import { getCumDeductList } from "../../../apis/cumDeduct"; +import { WeaTable } from "ecCom"; -@inject("cumDeductStore", "taxAgentStore") -@observer -export default class CumDeduct extends React.Component { + +class Index extends Component { constructor(props) { super(props); this.state = { - addVisible: false, - editId: {}, - saveLoading: false, - addAllLoading: false, - value: "", - selectedKey: [], - slideSelectedKey: [], //详情表格的选中项 - visiable: false, - monthValue: moment(new Date()).format("YYYY-MM"), - taxAgentId: "All", - datetime: "", - inited: false, - modalParam: { - declareMonth: "", - taxAgentId: "" - } + columns: [], dataSource: [] }; } - componentWillMount() { - // 初始化渲染页面 - const { - cumDeductStore: { doInit, addForm }, - taxAgentStore: { fetchTaxAgentOption, getTaxAgentSelectListAsAdmin } - } = this.props; - addForm.initFormFields(dataCollectCondition); - doInit({ declareMonth: [this.state.monthValue], taxAgentId: "" }); - getTaxAgentSelectListAsAdmin(); - fetchTaxAgentOption().then((res) => { + componentDidMount() { + this.getCumDeductList(); + } + + getCumDeductList = () => { + getCumDeductList({ declareMonth: ["2023-02"], taxAgentId: "" }).then(res => { this.setState({ - inited: true - }); - }); - } - - getSearchsAdQuick() { - const { monthValue, taxAgentId } = this.state; - const { - taxAgentStore: { taxAgentOption }, - cumDeductStore: { form, getTableDatas } - } = this.props; - return ( -
-
- 税款所属期: - { - this.setState({ monthValue: v }); - let params = {}; - if (taxAgentId == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = taxAgentId; - } - if (v != null && v != "") { - params.declareMonth = [v]; - } - getTableDatas(params); - }} - /> -
- -
- -
- -
- 个税扣缴义务人: - - { - this.state.inited && { - let params = {}; - if (v == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = v; - } - if (monthValue != null && monthValue != "") { - params.declareMonth = [monthValue]; - } - getTableDatas(params); - this.setState({ taxAgentId: v }); - }} - /> + columns: _.map(res.data.columns, item => { + if (item.dataIndex === "username") { + return { + ...item, + fixed: "left", + width: "20%" + }; } -
-
- ); - } - - renderFormComponent() { - const { modalParam } = this.state; - const { - taxAgentStore: { taxAgentAdminOption } - } = this.props; - return ( - - - - 税款所属期 - - - this.setState({ - modalParam: { ...modalParam, declareMonth: value } - }) - } - /> - - - - 个税扣缴义务人 - - { - this.setState({ modalParam: { ...modalParam, taxAgentId: v } }); - }} - /> - - - ); - } - - onEdit = (record) => { - const { - cumDeductStore: { - slideVisiable, - setSlideVisiable, - getCumDeductDetailList, - setCurrentRecord - } - } = this.props; - setSlideVisiable(true); - setCurrentRecord(record); - getCumDeductDetailList(record.id, { taxAgentId: record.taxAgentId }); - }; - - // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { - let newColumns = ""; - newColumns = columns.map((column) => { - let newColumn = column; - newColumn.render = (text, record, index) => { - //前端元素转义 - let valueSpan = - record[newColumn.dataIndex + "span"] !== undefined - ? record[newColumn.dataIndex + "span"] - : record[newColumn.dataIndex]; - switch (newColumn.dataIndex) { - case "username": - return ( - { - this.onEdit(record); - }}> - {text} - - ); - case "operate": - return ( - { - this.onEdit(record); - }}> - 查看明细 - - ); - default: - return
; - } - }; - return newColumn; - }); - return newColumns; - }; - - handleCancel() { - const { cumDeductStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = cumDeductStore; - setModalVisiable(false); - setStep(0); - } - - onOperatesClick = (record, index, operate, flag) => { - switch (operate.index.toString()) { - case "0": // 查看明细 - this.onEdit(record); - break; - } - }; - - showColumn = () => { - const { - cumDeductStore: { tableStore } - } = this.props; - tableStore.setColSetVisible(true); - tableStore.tableColSet(true); - }; - - // 初始化导入参数 - handleInitModal() { - const { - cumDeductStore: { setSlideDataSource, setImportResult } - } = this.props; - setSlideDataSource([]); - setImportResult({}); - } - - onSelectChange = (val) => { - this.setState({ - selectedKey: val - }); - }; - - handleSearch = () => { - const { cumDeductStore: { getTableDatas } } = this.props; - const { monthValue, taxAgentId } = this.state; - let params = {}; - if (monthValue != null && monthValue !== "") { - params.declareMonth = [monthValue]; - } - if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") { - params.taxAgentId = taxAgentId; - } - getTableDatas({ ...params, current: 1 }); - }; - - //新功能 - handleSaveDeduction = (payload) => { - const { editId } = this.state; - this.setState({ saveLoading: true }); - if (!_.isEmpty(editId)) { - API.editAddUpDeduction({ ...payload, id: editId.id }).then(({ status, errormsg }) => { - this.setState({ saveLoading: false }); - if (status) { - message.success("编辑成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); - } else { - message.error(errormsg || "编辑失败"); - } - }); - } else { - API.createAddUpDeduction(payload).then(({ status, errormsg }) => { - this.setState({ saveLoading: false }); - if (status) { - message.success("新增成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); - } else { - message.error(errormsg || "新增失败"); - } - }); - } - }; - deleteSelectAddUpDeduction = () => { - const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - if (selectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const payload = { - declareMonth, - ids: selectedKey - }; - Modal.confirm({ - title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", - onOk: () => { - API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); + if (item.dataIndex === "taxAgentName") { + return { + ...item, + fixed: "left", + width: "25%" + }; } - }); - }, - onCancel: () => { - } - }); - - }; - deleteAllAddUpDeduction = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - const payload = { - declareMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }; - Modal.confirm({ - title: "信息确认", - content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); + if (item.dataIndex === "operate") { + return { + ...item, + fixed: "right", + width: "100px" + }; } - }); - } - }); - }; - handleOperate = ({ key }, row) => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - if (key === "edit") { - this.setState({ - addVisible: true - }, () => { - API.getAddUpDeduction({ id: row.id }).then(({ status, data }) => { - if (status) { - this.setState({ editId: data }); - } - }); - }); - } else if (key === "delete") { - const payload = { - declareMonth, - ids: [row.id] - }; - Modal.confirm({ - title: "信息确认", - content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - } - }; - autoAddAll = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - this.setState({ addAllLoading: true }); - API.autoAddAll({ yearMonth: declareMonth }).then(({ status, data, errormsg }) => { - this.setState({ addAllLoading: false }); - if (status) { - message.success(data || "操作成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "操作失败"); - } - }).catch(() => this.setState({ addAllLoading: false })); - }; - handleButtonClick = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(this.handleChange, 500); - } - this.handleChangeDebounce(); - }; - handleChange = e => { - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - }; - handleExportAllDetailClick = () => { - if (!this.handleChangeDebounce) { - const { - cumDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - } - this.handleChangeDebounce(); + return { + ...item, + width: "25%" + }; + }), + dataSource: res.data.list + }); + }); }; render() { - const { - modalParam, - slideSelectedKey, - monthValue, - taxAgentId, - addVisible, - editId, - saveLoading, - addAllLoading - } = this.state; - const { cumDeductStore, taxAgentStore } = this.props; - const { - loading, - dataSource, - columns, - pageObj, - addForm, - form, - condition, - tableStore, - showSearchAd, - getTableDatas, - doSearch, - setShowSearchAd, - previewImport, - importFile - } = cumDeductStore; - const { taxAgentOption, showOperateBtn } = taxAgentStore; - const { - slideVisiable, - setSlideVisiable, - modalVisiable, - setModalVisiable, - slideTableStore, - step, - setStep, - slideDataSource, - importResult, - setPageObj - } = cumDeductStore; - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - - const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - - const rightMenu = [ - // 右键菜单 - // { - // key: "BTN_COLUMN", - // icon: , - // content: "显示列定制", - // onClick: this.showColumn, - // }, - ]; - const adBtn = [ - // 高级搜索内部按钮 - , - , - - ]; - - const topTab = []; - - const renderSearchOperationItem = () => { - return
; - }; - - const handleMenuClick = () => { - if (this.state.selectedKey.length == 0) { - message.warning("未选择条目"); - return; - } - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=${this.state.selectedKey.join( - "," - )}&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - }; - - const handleBtnImport = () => { - const { - cumDeductStore: { setModalVisiable, setStep } - } = this.props; - setStep(0); - setModalVisiable(true); - }; - - const btns = [ - , - - 导出选中 - - } - type="ghost"> - 导出全部 - , - , - - 删除所选 - - } - type="ghost"> - 一键清空 - , - - ]; - - const handleExportSelectedDetailClick = () => { - if (this.state.slideSelectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const { - cumDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - }; - - const renderBtns = () => { - return [ - - 导出选中 - - } - type="primary"> - 导出全部 - - ]; - }; - - const pagination = { - total: pageObj.total, - showTotal: (total) => `共 ${total} 条`, - pageSizeOptions: ["10", "20", "50", "100"], - showSizeChanger: true, - onShowSizeChange(current, pageSize) { - setPageObj({ ...pageObj, current, pageSize }); - getTableDatas({ - current, - pageSize, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - }, - onChange(current) { - setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); - getTableDatas({ - current, - pageSize: pageObj.pageSize, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - } - }; - const rowSelection = { - selectedRowKeys: this.state.selectedKey, - onChange: this.onSelectChange - }; - const newColumns = _.map([...columns], (item) => { - if (item.dataIndex === "username") { - return { - ...item, - width: 100, - fixed: "left", - render: (text, record) => ( -
- this.onEdit(record)}> - {text} - -
- ) - }; - } else if (item.dataIndex === "taxAgentName") { - return { - ...item, - width: 180, - fixed: "left" - }; - } else if (item.dataIndex === "operate") { - return { - ...item, - width: 120, - fixed: "right", - render: (text, record) => ( -
- this.onEdit(record)}> - 查看明细 - - { - showOperateBtn && - this.handleOperate(e, record)}> - 编辑 - 删除 - } title=""> - - - } -
- ) - }; - } else { - return { ...item, width: 150 }; - } - }); - if (_.isEmpty(newColumns)) { - return renderLoading(); - } + const { columns, dataSource } = this.state; return ( -
- } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - buttons={showOperateBtn ? btns : []} - > -
- setShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 - buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={(v) => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 - searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 - /> -
-
- - - -
-
- {modalVisiable && ( - { - this.handleInitModal(); - }} - onValidate={() => { - this.handleValidate(); - }} - params={modalParam} - columns={modalColumns} - step={step} - setStep={setStep} - slideDataSource={slideDataSource} - importResult={importResult} - onFinish={() => { - setModalVisiable(false); - setStep(0); - doSearch({ - declareMonth: this.state.monthValue ? [this.state.monthValue] : "", - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - }} - previewImport={(params) => { - previewImport(params); - }} - importFile={(params) => { - importFile(params); - }} - templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { - this.handleCancel(); - }} - /> - )} - - {(slideVisiable || addVisible) && ( - { - const { baseInfo } = this.addItemRef.state; - const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - if (!bool && _.isEmpty(editId)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const payload = { - ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), - ...addForm.getFormParams() - }; - this.handleSaveDeduction(payload); - }} - editable={!!addVisible} - showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} - /> - } - content={ - addVisible ? - this.addItemRef = dom} - taxAgentOption={taxAgentOption} - form={addForm} - editId={editId} - condition={dataCollectCondition} - /> : - - this.setState({ slideSelectedKey: val }) - } - /> - } - onClose={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - showMask={true} - closeMaskOnClick={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - /> - )} -
+ ); } } + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js new file mode 100644 index 00000000..ff7727d5 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js @@ -0,0 +1,855 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; +import { WeaDatePicker, WeaHelpfulTip, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom"; +import moment from "moment"; +import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import ImportModal from "../../../components/importModal"; +import { dataCollectCondition, modalColumns } from "./columns"; +import { optionAddAll } from "../../../util/options"; +import SlideModalTitle from "../../../components/slideModalTitle"; +import EditSlideContent from "./components/editSlideContent"; +import AddItems from "../addItems"; +import * as API from "../../../apis/cumDeduct"; +import "./index.less"; + +@inject("cumDeductStore", "taxAgentStore") +@observer +export default class CumDeduct extends React.Component { + constructor(props) { + super(props); + this.state = { + addVisible: false, + editId: {}, + saveLoading: false, + addAllLoading: false, + value: "", + selectedKey: [], + slideSelectedKey: [], //详情表格的选中项 + visiable: false, + monthValue: moment(new Date()).format("YYYY-MM"), + taxAgentId: "All", + datetime: "", + inited: false, + modalParam: { + declareMonth: "", + taxAgentId: "" + } + }; + } + + componentWillMount() { + // 初始化渲染页面 + const { + cumDeductStore: { doInit, addForm }, + taxAgentStore: { fetchTaxAgentOption, getTaxAgentSelectListAsAdmin } + } = this.props; + addForm.initFormFields(dataCollectCondition); + doInit({ declareMonth: [this.state.monthValue], taxAgentId: "" }); + getTaxAgentSelectListAsAdmin(); + fetchTaxAgentOption().then((res) => { + this.setState({ + inited: true + }); + }); + } + + getSearchsAdQuick() { + const { monthValue, taxAgentId } = this.state; + const { + taxAgentStore: { taxAgentOption }, + cumDeductStore: { form, getTableDatas } + } = this.props; + return ( +
+
+ 税款所属期: + { + this.setState({ monthValue: v }); + let params = {}; + if (taxAgentId == "All") { + params.taxAgentId = ""; + } else { + params.taxAgentId = taxAgentId; + } + if (v != null && v != "") { + params.declareMonth = [v]; + } + getTableDatas(params); + }} + /> +
+ +
+ +
+ +
+ 个税扣缴义务人: + + { + this.state.inited && { + let params = {}; + if (v == "All") { + params.taxAgentId = ""; + } else { + params.taxAgentId = v; + } + if (monthValue != null && monthValue != "") { + params.declareMonth = [monthValue]; + } + getTableDatas(params); + this.setState({ taxAgentId: v }); + }} + /> + } +
+
+ ); + } + + renderFormComponent() { + const { modalParam } = this.state; + const { + taxAgentStore: { taxAgentAdminOption } + } = this.props; + return ( + + + + 税款所属期 + + + this.setState({ + modalParam: { ...modalParam, declareMonth: value } + }) + } + /> + + + + 个税扣缴义务人 + + { + this.setState({ modalParam: { ...modalParam, taxAgentId: v } }); + }} + /> + + + ); + } + + onEdit = (record) => { + const { + cumDeductStore: { + slideVisiable, + setSlideVisiable, + getCumDeductDetailList, + setCurrentRecord + } + } = this.props; + setSlideVisiable(true); + setCurrentRecord(record); + getCumDeductDetailList(record.id, { taxAgentId: record.taxAgentId }); + }; + + // 增加编辑功能,重写columns绑定事件 + getColumns = (columns) => { + let newColumns = ""; + newColumns = columns.map((column) => { + let newColumn = column; + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { + case "username": + return ( + { + this.onEdit(record); + }}> + {text} + + ); + case "operate": + return ( + { + this.onEdit(record); + }}> + 查看明细 + + ); + default: + return
; + } + }; + return newColumn; + }); + return newColumns; + }; + + handleCancel() { + const { cumDeductStore } = this.props; + const { modalVisiable, setModalVisiable, setStep } = cumDeductStore; + setModalVisiable(false); + setStep(0); + } + + onOperatesClick = (record, index, operate, flag) => { + switch (operate.index.toString()) { + case "0": // 查看明细 + this.onEdit(record); + break; + } + }; + + showColumn = () => { + const { + cumDeductStore: { tableStore } + } = this.props; + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + }; + + // 初始化导入参数 + handleInitModal() { + const { + cumDeductStore: { setSlideDataSource, setImportResult } + } = this.props; + setSlideDataSource([]); + setImportResult({}); + } + + onSelectChange = (val) => { + this.setState({ + selectedKey: val + }); + }; + + handleSearch = () => { + const { cumDeductStore: { getTableDatas } } = this.props; + const { monthValue, taxAgentId } = this.state; + let params = {}; + if (monthValue != null && monthValue !== "") { + params.declareMonth = [monthValue]; + } + if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") { + params.taxAgentId = taxAgentId; + } + getTableDatas({ ...params, current: 1 }); + }; + + //新功能 + handleSaveDeduction = (payload) => { + const { editId } = this.state; + this.setState({ saveLoading: true }); + if (!_.isEmpty(editId)) { + API.editAddUpDeduction({ ...payload, id: editId.id }).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("编辑成功"); + this.setState({ + addVisible: false, + editId: {} + }, () => { + const { cumDeductStore: { doSearch, addForm } } = this.props; + const { monthValue, taxAgentId } = this.state; + doSearch({ + declareMonth: [monthValue], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + addForm.resetForm(); + }); + } else { + message.error(errormsg || "编辑失败"); + } + }); + } else { + API.createAddUpDeduction(payload).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("新增成功"); + this.setState({ + addVisible: false, + editId: {} + }, () => { + const { cumDeductStore: { doSearch, addForm } } = this.props; + const { monthValue, taxAgentId } = this.state; + doSearch({ + declareMonth: [monthValue], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + addForm.resetForm(); + }); + } else { + message.error(errormsg || "新增失败"); + } + }); + } + }; + deleteSelectAddUpDeduction = () => { + const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + if (selectedKey.length === 0) { + message.warning("未选择条目"); + return; + } + const payload = { + declareMonth, + ids: selectedKey + }; + Modal.confirm({ + title: "信息确认", + content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + onOk: () => { + API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error(errormsg || "删除失败"); + } + }); + }, + onCancel: () => { + } + }); + + }; + deleteAllAddUpDeduction = () => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + const payload = { + declareMonth, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; + handleOperate = ({ key }, row) => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + if (key === "edit") { + this.setState({ + addVisible: true + }, () => { + API.getAddUpDeduction({ id: row.id }).then(({ status, data }) => { + if (status) { + this.setState({ editId: data }); + } + }); + }); + } else if (key === "delete") { + const payload = { + declareMonth, + ids: [row.id] + }; + Modal.confirm({ + title: "信息确认", + content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + } + }; + autoAddAll = () => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + this.setState({ addAllLoading: true }); + API.autoAddAll({ yearMonth: declareMonth }).then(({ status, data, errormsg }) => { + this.setState({ addAllLoading: false }); + if (status) { + message.success(data || "操作成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error(errormsg || "操作失败"); + } + }).catch(() => this.setState({ addAllLoading: false })); + }; + handleButtonClick = () => { + if (!this.handleChangeDebounce) { + this.handleChangeDebounce = _.debounce(this.handleChange, 500); + } + this.handleChangeDebounce(); + }; + + handleChange = e => { + const url = `${window.location + .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" + ? "" + : this.state.taxAgentId}`; + window.open(url, "_self"); + }; + handleExportAllDetailClick = () => { + if (!this.handleChangeDebounce) { + const { + cumDeductStore: { currentRecord } + } = this.props; + const url = `${window.location + .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`; + window.open(url, "_self"); + } + this.handleChangeDebounce(); + }; + + render() { + const { + modalParam, + slideSelectedKey, + monthValue, + taxAgentId, + addVisible, + editId, + saveLoading, + addAllLoading + } = this.state; + const { cumDeductStore, taxAgentStore } = this.props; + const { + loading, + dataSource, + columns, + pageObj, + addForm, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + previewImport, + importFile + } = cumDeductStore; + const { taxAgentOption, showOperateBtn } = taxAgentStore; + const { + slideVisiable, + setSlideVisiable, + modalVisiable, + setModalVisiable, + slideTableStore, + step, + setStep, + slideDataSource, + importResult, + setPageObj + } = cumDeductStore; + const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; + + const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; + + const rightMenu = [ + // 右键菜单 + // { + // key: "BTN_COLUMN", + // icon: , + // content: "显示列定制", + // onClick: this.showColumn, + // }, + ]; + const adBtn = [ + // 高级搜索内部按钮 + , + , + + ]; + + const topTab = []; + + const renderSearchOperationItem = () => { + return
; + }; + + const handleMenuClick = () => { + if (this.state.selectedKey.length == 0) { + message.warning("未选择条目"); + return; + } + const url = `${window.location + .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=${this.state.selectedKey.join( + "," + )}&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" + ? "" + : this.state.taxAgentId}`; + window.open(url, "_self"); + }; + + const handleBtnImport = () => { + const { + cumDeductStore: { setModalVisiable, setStep } + } = this.props; + setStep(0); + setModalVisiable(true); + }; + + const btns = [ + , + + 导出选中 + + } + type="ghost"> + 导出全部 + , + , + + 删除所选 + + } + type="ghost"> + 一键清空 + , + + ]; + + const handleExportSelectedDetailClick = () => { + if (this.state.slideSelectedKey.length === 0) { + message.warning("未选择条目"); + return; + } + const { + cumDeductStore: { currentRecord } + } = this.props; + const url = `${window.location + .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`; + window.open(url, "_self"); + }; + + const renderBtns = () => { + return [ + + 导出选中 + + } + type="primary"> + 导出全部 + + ]; + }; + + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions: ["10", "20", "50", "100"], + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId, + declareMonth: monthValue && [monthValue] + }); + }, + onChange(current) { + setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId, + declareMonth: monthValue && [monthValue] + }); + } + }; + const rowSelection = { + selectedRowKeys: this.state.selectedKey, + onChange: this.onSelectChange + }; + const newColumns = _.map([...columns], (item) => { + if (item.dataIndex === "username") { + return { + ...item, + width: 100, + fixed: "left", + render: (text, record) => ( + + ) + }; + } else if (item.dataIndex === "taxAgentName") { + return { + ...item, + width: 180, + fixed: "left" + }; + } else if (item.dataIndex === "operate") { + return { + ...item, + width: 120, + fixed: "right", + render: (text, record) => ( +
+ this.onEdit(record)}> + 查看明细 + + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } +
+ ) + }; + } else { + return { ...item, width: 150 }; + } + }); + if (_.isEmpty(newColumns)) { + return renderLoading(); + } + return ( +
+ } // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 + showDropIcon={false} // 是否显示下拉按钮 + dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) + buttons={showOperateBtn ? btns : []} + > +
+ setShowSearchAd(bool)} //高级搜索面板受控 + searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 + buttonsAd={adBtn} // 高级搜索内部按钮 + onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 + searchsAdQuick={this.getSearchsAdQuick()} + onSearchChange={(v) => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 + /> +
+
+ + + +
+
+ {modalVisiable && ( + { + this.handleInitModal(); + }} + onValidate={() => { + this.handleValidate(); + }} + params={modalParam} + columns={modalColumns} + step={step} + setStep={setStep} + slideDataSource={slideDataSource} + importResult={importResult} + onFinish={() => { + setModalVisiable(false); + setStep(0); + doSearch({ + declareMonth: this.state.monthValue ? [this.state.monthValue] : "", + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + }} + previewImport={(params) => { + previewImport(params); + }} + importFile={(params) => { + importFile(params); + }} + templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { + this.handleCancel(); + }} + /> + )} + + {(slideVisiable || addVisible) && ( + { + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); + if (!bool && _.isEmpty(editId)) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.handleSaveDeduction(payload); + }} + editable={!!addVisible} + showOperateBtn={showOperateBtn} + customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} + /> + } + content={ + addVisible ? + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + editId={editId} + condition={dataCollectCondition} + /> : + + this.setState({ slideSelectedKey: val }) + } + /> + } + onClose={() => { + setSlideVisiable(false); + this.setState({ + addVisible: false, + editId: {} + }); + }} + showMask={true} + closeMaskOnClick={() => { + setSlideVisiable(false); + this.setState({ + addVisible: false, + editId: {} + }); + }} + /> + )} +
+ ); + } +} From 67b211e65633903b0dd707f6ccacfe0a11d1bd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 17 Feb 2023 17:21:05 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=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 | 53 ++++--- .../components/UnifiedTable/index.js | 26 ++++ .../components/UnifiedTable/index.less | 24 +++ .../pages/dataAcquisition/cumDeduct/index.js | 144 ++++++++++++------ .../pages/dataAcquisition/dataTables.js | 112 ++++++++++++++ .../pages/dataAcquisition/index.less | 55 ++++++- .../hrmSalary/pages/dataAcquisition/layout.js | 61 ++++++++ 7 files changed, 404 insertions(+), 71 deletions(-) create mode 100644 pc4mobx/hrmSalary/components/UnifiedTable/index.js create mode 100644 pc4mobx/hrmSalary/components/UnifiedTable/index.less create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/layout.js diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 8d54f306..90057b60 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -1,5 +1,5 @@ import { WeaTools } from "ecCom"; -import { postFetch } from '../util/request'; +import { postFetch } from "../util/request"; //数据采集-累计专项附加扣除列表 export const getCumDeductList = (params) => { @@ -7,9 +7,9 @@ export const getCumDeductList = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -52,9 +52,9 @@ export const getCumDeductDetailList = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -62,9 +62,9 @@ export const getCumDeductDetailList = (params) => { export const exportCumDeductDetailList = (id, ids = "") => { fetch( "/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=" + - id + - "&ids=" + - ids+ "&taxAgentId=" + taxAgentId + id + + "&ids=" + + ids + "&taxAgentId=" + taxAgentId ).then((res) => res.blob().then((blob) => { var filename = `累计专项附加扣除.xlsx`; @@ -84,9 +84,9 @@ export const importCumDeductParam = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; @@ -96,34 +96,39 @@ export const importCumDeductPreview = (params) => { method: "POST", mode: "cors", headers: { - "Content-Type": "application/json", + "Content-Type": "application/json" }, - body: JSON.stringify(params), + body: JSON.stringify(params) }).then((res) => res.json()); }; //新增累计专项附加扣除 export const createAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction", params); +}; //查看信息 export const getAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction", params); +}; //编辑累计专项附加扣除 export const editAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction", params); +}; //批量删除累计专项附加扣除 export const deleteSelectAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction", params); +}; //一键清空累计专项附加扣除 export const deleteAllAddUpDeduction = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction", params); +}; //一键累计 export const autoAddAll = (params) => { - return postFetch('/api/bs/hrmsalary/addUpDeduction/autoAddAll', params); -} + return postFetch("/api/bs/hrmsalary/addUpDeduction/autoAddAll", params); +}; + +//数据采集列表查询 +export const getTableDate = ({ url, ...params }) => { + return postFetch(url, params); +}; diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.js b/pc4mobx/hrmSalary/components/UnifiedTable/index.js new file mode 100644 index 00000000..4e6aa12e --- /dev/null +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.js @@ -0,0 +1,26 @@ +import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import "./index.less"; + +class Index extends Component { + + render() { + const { columns } = this.props; + const unifiedColumns = _.map(columns, (item, index) => { + if (index === 0 || index === 2) { + return { ...item, fixed: "left", width: 150 }; + } else if (index === 1) { + return { ...item, fixed: "left", width: 176 }; + } + if (item.dataIndex === "operate") { + return { ...item, fixed: "right", width: "120px" }; + } + return { ...item, width: "33%" }; + }); + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.less b/pc4mobx/hrmSalary/components/UnifiedTable/index.less new file mode 100644 index 00000000..e1dbaf1d --- /dev/null +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.less @@ -0,0 +1,24 @@ +.unifiedTable { + .ellipsis { + display: inline-block; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .linkWapper { + a { + color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; + } + + a:hover { + text-decoration: none; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index e7cd2ea3..a442c1f9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,62 +1,118 @@ import React, { Component } from "react"; -import { getCumDeductList } from "../../../apis/cumDeduct"; -import { WeaTable } from "ecCom"; - +import { inject, observer } from "mobx-react"; +import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; +import { Button, Dropdown, Menu } from "antd"; +import DataTables from "../dataTables"; +import Layout from "../layout"; +import moment from "moment"; +import "../index.less"; +@inject("taxAgentStore") +@observer class Index extends Component { constructor(props) { super(props); this.state = { - columns: [], dataSource: [] + declareMonth: moment(new Date()).format("YYYY-MM"), + taxAgentId: "", + innerWidth: window.innerWidth }; } - componentDidMount() { - this.getCumDeductList(); - } - - getCumDeductList = () => { - getCumDeductList({ declareMonth: ["2023-02"], taxAgentId: "" }).then(res => { - this.setState({ - columns: _.map(res.data.columns, item => { - if (item.dataIndex === "username") { - return { - ...item, - fixed: "left", - width: "20%" - }; - } - if (item.dataIndex === "taxAgentName") { - return { - ...item, - fixed: "left", - width: "25%" - }; - } - if (item.dataIndex === "operate") { - return { - ...item, - fixed: "right", - width: "100px" - }; - } - - return { - ...item, - width: "25%" - }; - }), - dataSource: res.data.list - }); - }); + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * Author: 黎永顺 + * Description: 筛选组件 + * Params: + * Date: 2023/2/17 + */ + getScreen = () => { + const { taxAgentStore: { taxAgentOption } } = this.props; + const { declareMonth, taxAgentId, innerWidth } = this.state; + const items = [ + { + com: DataCollectionDatePicker({ + label: "税款所属期", + value: declareMonth, + onChange: this.screenChange, + key: "declareMonth" + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId" + }) + } + ]; + return ; + }; + screenChange = ({ key, value }) => { + console.log(key, value); + }; + /* + * Author: 黎永顺 + * Description: 顶部操作按钮 + * Params: + * Date: 2023/2/17 + */ + getTopBtns = () => { + return [ + , + , + , + + 批量删除 + 一键清空 + 导出选中 + 导出全部 + + } + > + + + ]; + }; + handleMenuClick = ({ key }) => { + console.log(key); }; render() { - const { columns, dataSource } = this.state; + const { declareMonth, taxAgentId } = this.state; + const tablePayload = { + declareMonth: [declareMonth], + taxAgentId + }; return ( - + + + ); } } export default Index; + +const DataCollectionDatePicker = (props) => { + const { value, label, onChange, format = "YYYY-MM", key } = props; + return + onChange({ key, value })} format={format}/> + + ; +}; +const DataCollectionSelect = (props) => { + const { value, label, onChange, options, key } = props; + return + onChange({ key, value })} options={options}/> + ; +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js new file mode 100644 index 00000000..674f8399 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -0,0 +1,112 @@ +/* + * Author: 黎永顺 + * name: 数据采集-列表 + * Description: + * Date: 2023/2/17 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import UnifiedTable from "../../components/UnifiedTable"; +import { getTableDate } from "../../apis/cumDeduct"; +import { Menu, Popover } from "antd"; + +@inject("taxAgentStore") +@observer +class DataTables extends Component { + constructor(props) { + super(props); + this.state = { + loading: { + query: false + }, + dataSource: [], + columns: [], + selectedRowKeys: [], + pageInfo: { + current: 1, pageSize: 10, total: 0 + } + }; + } + + componentDidMount() { + this.getTableDate(); + } + + getTableDate = () => { + const { loading, pageInfo } = this.state; + const { url, payload } = this.props; + const module = { url, ...payload }; + this.setState({ loading: { ...loading, query: true } }); + getTableDate(module).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 } })); + }; + + render() { + const { columns, dataSource, loading } = this.state; + const { taxAgentStore: { showOperateBtn } } = this.props; + return { + const { dataIndex } = item; + if (dataIndex === "username") { + return { + ...item, + render: (text, record) => { + return window.pointerXY(e)} + title={text} + > + {text} + ; + } + }; + } else if (dataIndex === "operate") { + return { + ...item, + render: (text, record) => ( +
+ 查看明细 + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } +
+ ) + }; + } else { + return { + ...item, + render: (text) => { + return {text} ; + } + }; + } + })} + dataSource={dataSource} + // pagination={pagination} + loading={loading.query} + />; + } +} + +export default DataTables; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less index b583068d..23d27e5f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less @@ -1,9 +1,10 @@ -.tipWrapper{ +.tipWrapper { display: flex; flex-direction: column; margin: 0 25px 20px 25px; border: 1px solid #e5e5e5; - .title{ + + .title { border-bottom: 1px solid #e5e5e5; height: 40px; line-height: 40px; @@ -11,7 +12,8 @@ background: #f6f6f6; font-size: 14px; } - .content{ + + .content { width: 100%; display: flex; flex-direction: column; @@ -19,3 +21,50 @@ color: #999; } } + +.layoutWrapper { + height: 100%; + display: flex; + flex-direction: column; + + .wea-tab-left { + min-width: 600px !important; + max-width: 600px !important; + } + + .screenWrapper { + padding: 0; + + .wea-content { + padding: 0; + } + + .wea-form-cell { + padding: 0 16px; + + .wea-date-picker { + width: 85%; + } + } + + .wea-helpful-tip { + padding-left: 10px; + } + } + + .dataContent { + flex: 1; + overflow: hidden; + } + +} + +//下拉框菜单样式 +.dropdownMenuWrapper { + .ant-menu-item { + border-right: none; + padding: 0 16px; + height: 30px; + line-height: 30px; + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js new file mode 100644 index 00000000..a5eca7ad --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -0,0 +1,61 @@ +/* + * Author: 黎永顺 + * name: 数据采集-组件框 + * Description: + * Date: 2023/2/17 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaNewScroll, WeaTab, WeaTop } from "ecCom"; +import "./index.less"; + +@inject("taxAgentStore") +@observer +class Layout extends Component { + constructor(props) { + super(props); + this.state = { + showSearchAd: false + }; + } + + componentDidMount() { + const { taxAgentStore: { fetchTaxAgentOption } } = this.props; + fetchTaxAgentOption(); + window.addEventListener("resize", this.resizeUpdate); + } + + componentWillUnmount() { + window.removeEventListener("resize", this.resizeUpdate); + } + + resizeUpdate = () => { + const { onResizeWindowInnerWidth } = this.props; + onResizeWindowInnerWidth(window.innerWidth); + }; + + render() { + const { showSearchAd } = this.state; + const { title, btns, leftComp, children, taxAgentStore: { showOperateBtn } } = this.props; + return ( +
+ } + iconBgcolor="#F14A2D" showDropIcon={false} + /> + 1111} + showSearchAd={showSearchAd} + setShowSearchAd={bool => this.setState({ showSearchAd: bool })} + /> +
+ {children} +
+
+ ); + } +} + +export default Layout; From 3affb156b9ad46d557de3a40c118c7b7fe7b70b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 20 Feb 2023 09:41:36 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/cumDeduct/index.js | 90 +++++++++++++++---- .../pages/dataAcquisition/dataTables.js | 38 ++++++-- .../pages/dataAcquisition/index.less | 35 ++++++-- .../hrmSalary/pages/dataAcquisition/layout.js | 48 +++++++++- 4 files changed, 179 insertions(+), 32 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index a442c1f9..1c7be755 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,11 +1,11 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; -import { Button, Dropdown, Menu } from "antd"; +import { Button, Dropdown, Menu, message } from "antd"; +import { autoAddAll } from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; import Layout from "../layout"; import moment from "moment"; -import "../index.less"; @inject("taxAgentStore") @observer @@ -15,11 +15,68 @@ class Index extends Component { this.state = { declareMonth: moment(new Date()).format("YYYY-MM"), taxAgentId: "", - innerWidth: window.innerWidth + innerWidth: window.innerWidth, + addAllLoading: false, + slidePayload: { + visible: false, + title: "", + children: null, + id: "" + } }; + this.tableRef = null; } + /* + * Author: 黎永顺 + * Description:一键累计 + * Params: + * Date: 2023/2/17 + */ + autoAddAll = () => { + const { monthValue: declareMonth } = this.state; + this.setState({ addAllLoading: true }); + autoAddAll({ yearMonth: declareMonth }).then(({ status, data, errormsg }) => { + this.setState({ addAllLoading: false }); + if (status) { + message.success(data || "操作成功"); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "操作失败"); + } + }).catch(() => this.setState({ addAllLoading: false })); + }; + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * Author: 黎永顺 + * Description:新增数据采集-累计专项附加扣除 + * Params: + * Date: 2023/2/20 + */ + handleAddData = () => { + const { slidePayload } = this.state; + this.setState({ + slidePayload: { + ...slidePayload, + visible: true, + title: "新建", + chidren:

3433333

+ } + }); + }; + handleCloseSlide = () => { + const { slidePayload } = this.state; + this.setState({ + slidePayload: { + ...slidePayload, + visible: false, + title: "", + chidren: null, + id: "" + } + }); + }; /* * Author: 黎永顺 * Description: 筛选组件 @@ -52,7 +109,7 @@ class Index extends Component { col={innerWidth < 900 ? 1 : 2}/>; }; screenChange = ({ key, value }) => { - console.log(key, value); + this.setState({ [key]: value }, () => this.tableRef.getTableDate()); }; /* * Author: 黎永顺 @@ -61,10 +118,11 @@ class Index extends Component { * Date: 2023/2/17 */ getTopBtns = () => { + const { addAllLoading } = this.state; return [ - , - , - , + , + , + , @@ -84,17 +142,19 @@ class Index extends Component { }; render() { - const { declareMonth, taxAgentId } = this.state; - const tablePayload = { - declareMonth: [declareMonth], - taxAgentId - }; + const { taxAgentStore: { showOperateBtn } } = this.props; + const { declareMonth, taxAgentId, slidePayload } = this.state; + const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( + onResizeWindowInnerWidth={this.handleResize} slidePayload={...slidePayload} + onClose={this.handleCloseSlide} + > this.tableRef = dom} url="/api/bs/hrmsalary/addUpDeduction/list" payload={tablePayload} + showOperateBtn={showOperateBtn} /> ); @@ -106,13 +166,13 @@ export default Index; const DataCollectionDatePicker = (props) => { const { value, label, onChange, format = "YYYY-MM", key } = props; return - onChange({ key, value })} format={format}/> + onChange({ key, value: val })} format={format}/> ; }; const DataCollectionSelect = (props) => { const { value, label, onChange, options, key } = props; return - onChange({ key, value })} options={options}/> + onChange({ key, value: val })} options={options}/> ; }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index 674f8399..c6f8b5c5 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -5,13 +5,10 @@ * Date: 2023/2/17 */ import React, { Component } from "react"; -import { inject, observer } from "mobx-react"; import UnifiedTable from "../../components/UnifiedTable"; import { getTableDate } from "../../apis/cumDeduct"; import { Menu, Popover } from "antd"; -@inject("taxAgentStore") -@observer class DataTables extends Component { constructor(props) { super(props); @@ -35,7 +32,7 @@ class DataTables extends Component { getTableDate = () => { const { loading, pageInfo } = this.state; const { url, payload } = this.props; - const module = { url, ...payload }; + const module = { ...pageInfo, url, ...payload }; this.setState({ loading: { ...loading, query: true } }); getTableDate(module).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); @@ -51,11 +48,36 @@ class DataTables extends Component { }; render() { - const { columns, dataSource, loading } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { columns, dataSource, loading, selectedRowKeys, pageInfo } = this.state; + const { showOperateBtn } = this.props; + 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.getTableDate(); + }); + }, + onChange: (current) => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + this.getTableDate(); + }); + } + }; return { const { dataIndex } = item; if (dataIndex === "username") { @@ -103,7 +125,7 @@ class DataTables extends Component { } })} dataSource={dataSource} - // pagination={pagination} + pagination={pagination} loading={loading.query} />; } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less index 23d27e5f..467167f8 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less @@ -59,12 +59,33 @@ } -//下拉框菜单样式 -.dropdownMenuWrapper { - .ant-menu-item { - border-right: none; - padding: 0 16px; - height: 30px; - line-height: 30px; +.slideOuterWrapper { + .wea-slide-modal-title { + height: initial; + line-height: initial; + text-align: left; + } + + .rodal-close { + z-index: 99; + top: 10px !important; + } + +} + +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; + } } } + +@media screen and (min-width: 1060px) and (max-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; + } + } +} + diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js index a5eca7ad..0a335857 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -6,7 +6,8 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaNewScroll, WeaTab, WeaTop } from "ecCom"; +import { WeaNewScroll, WeaSlideModal, WeaTab, WeaTop } from "ecCom"; +import SlideModalTitle from "../../components/slideModalTitle"; import "./index.less"; @inject("taxAgentStore") @@ -36,7 +37,11 @@ class Layout extends Component { render() { const { showSearchAd } = this.state; - const { title, btns, leftComp, children, taxAgentStore: { showOperateBtn } } = this.props; + const { + title, btns, leftComp, children, taxAgentStore: { showOperateBtn }, + slidePayload, onClose + } = this.props; + const { visible, title: subtitle, children: slideChildren, id } = slidePayload; return (
{children} + {/* 新增-编辑-详情弹框 */} + { + // const { baseInfo } = this.addItemRef.state; + // const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); + // if (!bool && _.isEmpty(editId)) { + // Modal.warning({ + // title: "信息确认", + // content: "必要信息不完整,红色*为必填项!" + // }); + // return; + // } + // const payload = { + // ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + // ...addForm.getFormParams() + // }; + // this.handleSaveDeduction(payload); + }} + editable={true} + showOperateBtn={showOperateBtn} + customOperate={[]} + /> + } + content={slideChildren} + onClose={onClose} + />
); From 751659d569292758d769b48125b72f44a6d0785c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 20 Feb 2023 09:44:00 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=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/pages/dataAcquisition/cumDeduct/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 1c7be755..3a946903 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -147,7 +147,7 @@ class Index extends Component { const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( Date: Mon, 20 Feb 2023 10:24:40 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/cumDeduct/index.js | 71 ++++++++++++++++--- .../pages/dataAcquisition/dataTables.js | 7 ++ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 3a946903..f9ddb4f8 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,7 +1,8 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; -import { Button, Dropdown, Menu, message } from "antd"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import * as API from "../../../apis/cumDeduct"; import { autoAddAll } from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; import Layout from "../layout"; @@ -46,6 +47,60 @@ class Index extends Component { } }).catch(() => this.setState({ addAllLoading: false })); }; + /* + * Author: 黎永顺 + * Description: 一键清空 + * Params: + * Date: 2023/2/20 + */ + deleteAllAddUpDeduction = () => { + const { declareMonth, taxAgentId } = this.state; + const payload = { declareMonth, taxAgentId }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 删除所选 + * Params: + * Date: 2023/2/20 + */ + deleteSelectAddUpDeduction = () => { + const { declareMonth } = this.state; + const { selectedRowKeys: ids } = this.tableRef.state; + if (ids.length === 0) { + message.warning("请选择表格数据"); + return; + } + const payload = { declareMonth, ids }; + Modal.confirm({ + title: "信息确认", + content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + onOk: () => { + API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.tableRef.getTableDate(); + this.tableRef.handleClearRows(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; handleResize = (innerWidth) => this.setState({ innerWidth }); /* @@ -61,7 +116,7 @@ class Index extends Component { ...slidePayload, visible: true, title: "新建", - chidren:

3433333

+ children:

3433333

} }); }; @@ -125,21 +180,19 @@ class Index extends Component { , - 批量删除 - 一键清空 + + 批量删除 + 一键清空 导出选中 导出全部 } > - + ]; }; - handleMenuClick = ({ key }) => { - console.log(key); - }; + handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc](); render() { const { taxAgentStore: { showOperateBtn } } = this.props; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index c6f8b5c5..0065f92a 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -46,6 +46,13 @@ class DataTables extends Component { } }).catch(() => this.setState({ loading: { ...loading, query: false } })); }; + /* + * Author: 黎永顺 + * Description: 清空所选 + * Params: + * Date: 2023/2/20 + */ + handleClearRows = () => this.setState({ selectedRowKeys: [] }); render() { const { columns, dataSource, loading, selectedRowKeys, pageInfo } = this.state; From 1674f9071f19c6d9bc7211fae21295b7c685a205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 20 Feb 2023 10:53:45 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/dataAcquisition/addItems.js | 2 +- .../pages/dataAcquisition/cumDeduct/index.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index f241aca8..5b0705f5 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -167,7 +167,7 @@ class AddItems extends Component { + needTigger showGroup/> { getSearchs(form, condition, 2) } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index f9ddb4f8..9e1403bb 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -5,10 +5,12 @@ import { Button, Dropdown, Menu, message, Modal } from "antd"; import * as API from "../../../apis/cumDeduct"; import { autoAddAll } from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; +import AddItems from "../addItems"; +import { dataCollectCondition } from "./columns"; import Layout from "../layout"; import moment from "moment"; -@inject("taxAgentStore") +@inject("taxAgentStore", "cumDeductStore") @observer class Index extends Component { constructor(props) { @@ -110,13 +112,21 @@ class Index extends Component { * Date: 2023/2/20 */ handleAddData = () => { + const { taxAgentStore, cumDeductStore: { addForm } } = this.props; const { slidePayload } = this.state; + const { taxAgentOption } = taxAgentStore; this.setState({ slidePayload: { ...slidePayload, visible: true, title: "新建", - children:

3433333

+ children: this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + editId={{}} + condition={dataCollectCondition} + /> } }); }; From 6cff75a9b5a18915383432424de8fd88a270a9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 20 Feb 2023 13:21:04 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/addItems.js | 3 +- .../pages/dataAcquisition/cumDeduct/index.js | 44 ++++++++++++++----- .../pages/dataAcquisition/dataTables.js | 8 ++-- .../pages/dataAcquisition/index.less | 31 +++++++++++++ 4 files changed, 69 insertions(+), 17 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 5b0705f5..463f1562 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -165,9 +165,10 @@ class AddItems extends Component { return (
+ needTigger showGroup col={1}/> { getSearchs(form, condition, 2) } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 9e1403bb..5714053f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -2,8 +2,12 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; import { Button, Dropdown, Menu, message, Modal } from "antd"; -import * as API from "../../../apis/cumDeduct"; -import { autoAddAll } from "../../../apis/cumDeduct"; +import { + autoAddAll, + deleteAllAddUpDeduction, + deleteSelectAddUpDeduction, + getAddUpDeduction +} from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; import AddItems from "../addItems"; import { dataCollectCondition } from "./columns"; @@ -62,7 +66,7 @@ class Index extends Component { title: "信息确认", content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, onOk: () => { - API.deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { + deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); this.tableRef.getTableDate(); @@ -79,19 +83,21 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - deleteSelectAddUpDeduction = () => { + deleteSelectAddUpDeduction = (record = {}) => { const { declareMonth } = this.state; const { selectedRowKeys: ids } = this.tableRef.state; - if (ids.length === 0) { + const { id, departmentName, username } = record; + if (ids.length === 0 && !id) { message.warning("请选择表格数据"); return; } - const payload = { declareMonth, ids }; + const payload = { declareMonth, ids: !id ? ids : [id] }; Modal.confirm({ title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" : + `确定删除${departmentName}${username}(税款所属期:${declareMonth})的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, onOk: () => { - API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { + deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); this.tableRef.getTableDate(); @@ -111,25 +117,38 @@ class Index extends Component { * Params: * Date: 2023/2/20 */ - handleAddData = () => { + handleAddData = (title = "新建", editId = {}) => { const { taxAgentStore, cumDeductStore: { addForm } } = this.props; + addForm.initFormFields(dataCollectCondition); const { slidePayload } = this.state; const { taxAgentOption } = taxAgentStore; this.setState({ slidePayload: { ...slidePayload, visible: true, - title: "新建", + title, children: this.addItemRef = dom} taxAgentOption={taxAgentOption} form={addForm} - editId={{}} + editId={editId} condition={dataCollectCondition} /> } }); }; + /* + * Author: 黎永顺 + * Description:列表操作 + * Params: + * Date: 2023/2/20 + */ + handleTableOperate = ({ key }, record) => { + const { id } = record; + key === "handleAddData" ? getAddUpDeduction({ id }).then(({ status, data }) => { + if (status) this[key]("编辑", data); + }) : this[key](record); + }; handleCloseSlide = () => { const { slidePayload } = this.state; this.setState({ @@ -186,7 +205,7 @@ class Index extends Component { const { addAllLoading } = this.state; return [ , - , + , , ); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index 0065f92a..289479b0 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 } = this.props; + const { showOperateBtn, onTableOperate } = this.props; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) @@ -112,9 +112,9 @@ class DataTables extends Component { this.handleOperate(e, record)}> - 编辑 - 删除 + content={ onTableOperate(e, record)}> + 编辑 + 删除 } title=""> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less index 467167f8..af9a1fa2 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less @@ -22,6 +22,37 @@ } } +.addItemsWrapper { + .baseForm { + .wea-form-cell { + padding-right: 20% !important; + } + } + + .wea-search-group { + .wea-form-cell-wrapper { + border: 1px solid #e5e5e5; + + & > div:last-child { + border-bottom: none + } + + .wea-form-cell { + padding: 4px 16px; + border-bottom: 1px solid #e5e5e5; + + .wea-form-item-wrapper { + line-height: 30px; + } + + .wea-form-item { + padding: 0; + } + } + } + } +} + .layoutWrapper { height: 100%; display: flex; From b6849400d75ad18887ad0a8d0681f6de723d93b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 20 Feb 2023 14:28:08 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/addItems.js | 21 +++++- .../pages/dataAcquisition/cumDeduct/index.js | 67 +++++++++++++++++-- .../pages/dataAcquisition/dataTables.js | 4 +- .../hrmSalary/pages/dataAcquisition/layout.js | 23 ++----- 4 files changed, 88 insertions(+), 27 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 463f1562..6ce5d59d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -26,7 +26,26 @@ class AddItems extends Component { } }; } - + componentDidMount() { + this.setState({ + baseInfo: { + ...this.state.baseInfo, + declareMonth: this.props.editId.declareMonth, + taxAgentId: this.props.editId.taxAgentId, + taxAgentName: this.props.editId.taxAgentName, + employeeId: this.props.editId.employeeId, + employeeName: this.props.editId.username + } + }); + const fields = _.map(this.props.condition[0].items, it => { + return it.domkey[0]; + }); + fields.map(item => { + this.props.form.updateFields({ + [item]: this.props.editId[item] || "" + }); + }); + } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.editId !== this.props.editId) { this.setState({ diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 5714053f..a0a98009 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -4,8 +4,10 @@ import { WeaDatePicker, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } import { Button, Dropdown, Menu, message, Modal } from "antd"; import { autoAddAll, + createAddUpDeduction, deleteAllAddUpDeduction, deleteSelectAddUpDeduction, + editAddUpDeduction, getAddUpDeduction } from "../../../apis/cumDeduct"; import DataTables from "../dataTables"; @@ -24,11 +26,12 @@ class Index extends Component { taxAgentId: "", innerWidth: window.innerWidth, addAllLoading: false, + saveLoading: false, slidePayload: { visible: false, title: "", children: null, - id: "" + data: {} } }; this.tableRef = null; @@ -109,7 +112,59 @@ class Index extends Component { } }); }; + /* + * Author: 黎永顺 + * Description: 数据采集-信息保存 + * Params: + * Date: 2023/2/20 + */ + handleSaveDeduction = (payload) => { + const { slidePayload } = this.state; + const { data } = slidePayload; + const { id } = data; + this.setState({ saveLoading: true }); + if (!_.isEmpty(data)) { + editAddUpDeduction({ ...payload, id }).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("编辑成功"); + this.handleCloseSlide(); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "编辑失败"); + } + }); + } else { + createAddUpDeduction(payload).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("新增成功"); + this.handleCloseSlide(); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "新增失败"); + } + }); + } + }; + handleSaveData = () => { + const { cumDeductStore: { addForm } } = this.props; + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !!v); + if (!bool) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.handleSaveDeduction(payload); + }; handleResize = (innerWidth) => this.setState({ innerWidth }); /* * Author: 黎永顺 @@ -127,6 +182,7 @@ class Index extends Component { ...slidePayload, visible: true, title, + data: editId, children: this.addItemRef = dom} taxAgentOption={taxAgentOption} @@ -157,7 +213,7 @@ class Index extends Component { visible: false, title: "", chidren: null, - id: "" + data: {} } }); }; @@ -193,7 +249,7 @@ class Index extends Component { col={innerWidth < 900 ? 1 : 2}/>; }; screenChange = ({ key, value }) => { - this.setState({ [key]: value }, () => this.tableRef.getTableDate()); + this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 })); }; /* * Author: 黎永顺 @@ -225,12 +281,13 @@ class Index extends Component { render() { const { taxAgentStore: { showOperateBtn } } = this.props; - const { declareMonth, taxAgentId, slidePayload } = this.state; + const { declareMonth, taxAgentId, slidePayload, saveLoading } = this.state; const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( this.tableRef = dom} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index 289479b0..9c0900cd 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -29,10 +29,10 @@ class DataTables extends Component { this.getTableDate(); } - getTableDate = () => { + getTableDate = (extraPayload = {}) => { const { loading, pageInfo } = this.state; const { url, payload } = this.props; - const module = { ...pageInfo, url, ...payload }; + const module = { ...pageInfo, url, ...payload, ...extraPayload }; this.setState({ loading: { ...loading, query: true } }); getTableDate(module).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js index 0a335857..d57176aa 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -39,9 +39,9 @@ class Layout extends Component { const { showSearchAd } = this.state; const { title, btns, leftComp, children, taxAgentStore: { showOperateBtn }, - slidePayload, onClose + slidePayload, onClose, onSave, slideLoading } = this.props; - const { visible, title: subtitle, children: slideChildren, id } = slidePayload; + const { visible, title: subtitle, children: slideChildren } = slidePayload; return (
{ - // const { baseInfo } = this.addItemRef.state; - // const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - // if (!bool && _.isEmpty(editId)) { - // Modal.warning({ - // title: "信息确认", - // content: "必要信息不完整,红色*为必填项!" - // }); - // return; - // } - // const payload = { - // ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), - // ...addForm.getFormParams() - // }; - // this.handleSaveDeduction(payload); - }} + loading={slideLoading} + onSave={onSave} editable={true} showOperateBtn={showOperateBtn} customOperate={[]} 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 09/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=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} From 87024ceda9516b93e753515e355c5b1f002dee00 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 18:05:54 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/addItems.js | 6 +- .../dataAcquisition/components/tableRecord.js | 86 +- .../cumDeduct/components/importFormCom.js | 6 +- .../pages/dataAcquisition/cumDeduct/index.js | 80 +- .../dataAcquisition/cumSituation/columns.js | 132 +- .../cumSituation/editSlideContent.js | 201 --- .../cumSituation/editSlideContent.less | 22 - .../dataAcquisition/cumSituation/index.js | 1179 +++++++--------- .../dataAcquisition/cumSituation/index.less | 64 - .../pages/dataAcquisition/index.less | 24 + .../dataAcquisition/otherDeduct/columns.js | 62 - .../otherDeduct/editSlideContent.js | 213 --- .../otherDeduct/editSlideContent.less | 22 - .../dataAcquisition/otherDeduct/index.js | 1216 +++++++---------- .../components/inlineForm.js | 25 - .../components/specialAddContent.js | 87 -- .../specialAddDeduction/index.js | 998 ++++++-------- .../specialAddDeduction/index.less | 98 -- 18 files changed, 1490 insertions(+), 3031 deletions(-) delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 6ce5d59d..07dcad4d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -26,11 +26,12 @@ class AddItems extends Component { } }; } + componentDidMount() { this.setState({ baseInfo: { ...this.state.baseInfo, - declareMonth: this.props.editId.declareMonth, + declareMonth: this.props.editId.declareMonth || this.props.editId.taxYearMonth, taxAgentId: this.props.editId.taxAgentId, taxAgentName: this.props.editId.taxAgentName, employeeId: this.props.editId.employeeId, @@ -46,12 +47,13 @@ class AddItems extends Component { }); }); } + componentWillReceiveProps(nextProps, nextContext) { if (nextProps.editId !== this.props.editId) { this.setState({ baseInfo: { ...this.state.baseInfo, - declareMonth: nextProps.editId.declareMonth, + declareMonth: nextProps.editId.declareMonth || nextProps.editId.taxYearMonth, taxAgentId: nextProps.editId.taxAgentId, taxAgentName: nextProps.editId.taxAgentName, employeeId: nextProps.editId.employeeId, diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js index bd6007b8..616a36f0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/components/tableRecord.js @@ -30,21 +30,45 @@ class TableRecord extends Component { accumulatedSituationId: "", specialAddDeductionId: "", taxAgentId: "", - declareMonth: [] + declareMonth: null, + taxYearMonth: null } }; } componentDidMount() { - this.getTableRecordData(); + this.convertData(this.props); } - getTableRecordData = (payload) => { - const { loading, pageInfo } = this.state; - const { url, ...extraPayload } = this.props; - const module = { ...pageInfo, url, ...extraPayload, ...payload }; + componentWillReceiveProps(nextProps, nextContext) { + this.convertData(nextProps); + } + + convertData = (props) => { + const { recordPayload } = this.state; + const { record, screenParams } = props; + const modules = _.reduce(screenParams, (pre, cur) => (_.assign(pre, { + [cur]: record[cur], + [screenParams[0]]: record.id + })), {}); + this.setState({ + recordPayload: { + ...recordPayload, + ...modules + } + }, () => this.getTableRecordData()); + }; + + getTableRecordData = () => { + const { loading, pageInfo, recordPayload } = this.state; + const { url, screenParams } = this.props; + const monthkey = screenParams[screenParams.length - 1]; + const module = { + ...pageInfo, ...recordPayload, url, + [monthkey]: Object.prototype.toString.call(recordPayload[monthkey]) === "[object Array]" ? _.compact(recordPayload[monthkey]) : recordPayload[monthkey] + }; this.setState({ loading: { ...loading, query: true } }); - getTableRecordDate(_.omit(module, ["className", "items", "total"])).then(({ status, data }) => { + getTableRecordDate(_.pick(module, [...screenParams, "current", "pageSize", "url"])).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; @@ -65,17 +89,30 @@ class TableRecord extends Component { */ handleTablerecordScreen = ({ key, value }) => { const { recordPayload } = this.state; - // this.setState({ - // recordPayload: { - // ...recordPayload, - // [key]: value - // } - // }, () => { - // this.tableRecordRef.getTableRecordData(this.state.recordPayload); - // }); + this.setState({ + recordPayload: { + ...recordPayload, + [key]: value + } + }, () => this.getTableRecordData()); }; + handleResetSelectKeys = () => { + this.setState({ + selectedRowKeys: [], + recordPayload: { + accumulatedSpecialAdditionalDeductionId: "", + otherTaxExemptDeductionId: "", + accumulatedSituationId: "", + specialAddDeductionId: "", + taxAgentId: "", + declareMonth: null, + taxYearMonth: null + } + }); + }; + render() { - const { className, screenParams, taxAgentOption } = this.props; + const { className, screenParams, taxAgentOption, record } = this.props; const { columns, dataSource, loading, selectedRowKeys, pageInfo, recordPayload } = this.state; const rowSelection = { selectedRowKeys, @@ -102,16 +139,20 @@ class TableRecord extends Component { }); } }; - const items = [ + const items = screenParams.length === 1 ? [ { - com: Input({ value: editId.username }) + com: Input({ value: record.username }) + } + ] : [ + { + com: Input({ value: record.username }) }, { com: DataCollectionDateRangePick({ label: "税款所属期", - range: recordPayload.declareMonth, + range: recordPayload[screenParams[screenParams.length - 1]] || [], onChange: this.handleTablerecordScreen, - key: "declareMonth" + key: screenParams[screenParams.length - 1] }) }, { @@ -126,7 +167,10 @@ class TableRecord extends Component { ]; return (
- + { + !_.isEmpty(screenParams) && + + } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 7665c194..7999bc35 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -272,7 +272,7 @@ class Index extends Component { /* * Author: 黎永顺 * Description:新增数据采集-累计专项附加扣除 - * Params: + * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 * Date: 2023/2/20 */ handleAddData = (title = "新建", editId = {}) => { @@ -299,6 +299,7 @@ class Index extends Component { className="accumulated" taxAgentOption={taxAgentOption} url="/api/bs/hrmsalary/addUpDeduction/getDetailList" + record={editId} screenParams={["accumulatedSpecialAdditionalDeductionId", "taxAgentId", "declareMonth"]} /> } @@ -327,6 +328,8 @@ class Index extends Component { data: {} } }); + this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys(); + this.handleDebounce = null; }; /* * Author: 黎永顺 @@ -401,20 +404,47 @@ class Index extends Component { */ getDetailOptBtns = () => { return [ - - 导出选中 - - } - type="primary"> + + 导出选中 + } + type="primary"> 导出全部 ]; }; + /* + * Author: 黎永顺 + * Description: 导出详情数据 + * Params: + * Date: 2023/2/21 + */ + handleExportDetail = (url) => { + if (!this.handleDebounce) { + this.handleDebounce = _.debounce(() => { + window.open(`${window.location.origin}/api/bs/hrmsalary/addUpDeduction/exportDetail${url}`, "_self"); + this.handleDebounce = null; + }, 500); + } + this.handleDebounce(); + }; + handleExportSelectDetail = () => { + const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=${ids.join(",")}`; + this.handleExportDetail(payload); + }; + handleExportAllDetail = () => { + const { recordPayload } = this.tableRecordRef.state; + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=`; + this.handleExportDetail(payload); + }; /* * Author: 黎永顺 * Description: 数据采集-导入相关 @@ -494,18 +524,22 @@ class Index extends Component { export default Index; export const DataCollectionDatePicker = (props) => { - const { value, label, onChange, format = "YYYY-MM", key, screen = true } = props; - return + const { + value, label, onChange, format = "YYYY-MM", key, screen = true, + tip = "提示:默认显示本年截至当前月所有员工申报的累计专项附加及其他扣除额", + labelCol = 8, wrapperCol = 16 + } = props; + return onChange({ key, value: val })} format={format}/> { screen && - + } ; }; export const DataCollectionSelect = (props) => { - const { value, label, onChange, options, key } = props; - return + const { value, label, onChange, options, key, labelCol = 10, wrapperCol = 14 } = props; + return onChange({ key, value: val })} options={options}/> ; }; @@ -518,8 +552,18 @@ 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: [val, value2] })} format={format} + disabledDate={(current) => { + return current && value2 && current.getTime() > new Date(value2).getTime(); + }} + /> - onChange({ key, value: [value1, val] })} format={format}/> + onChange({ key, value: [value1, val] })} format={format} + disabledDate={(current) => { + return current && value1 && current.getTime() < new Date(value1).getTime(); + }} + /> ; }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js index 45fab4e4..689db6a4 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/columns.js @@ -65,133 +65,6 @@ export const columns = [ key: "title" } ]; - -export const modalColumns = [ - { - title: "姓名", - dataIndex: "username", - key: "username" - }, - { - title: "个税扣缴义务人", - dataIndex: "taxAgentName", - key: "taxAgentName" - }, - { - title: "部门", - dataIndex: "departmentName", - key: "departmentName" - }, - { - title: "手机号", - dataIndex: "mobile", - key: "mobile" - }, - { - title: "工号", - dataIndex: "jobNum", - key: "jobNum" - }, - { - title: "证件号码", - dataIndex: "idNo", - key: "idNo" - }, - { - title: "入职日期", - dataIndex: "hiredate", - key: "hiredate" - }, - { - title: "累计收入额", - dataIndex: "addUpIncome", - key: "addUpIncome" - }, - { - title: "累计减除费用", - dataIndex: "addUpSubtraction", - key: "addUpSubtraction" - }, - { - title: "累计社保个人合计", - dataIndex: "addUpSocialSecurityTotal", - key: "addUpSocialSecurityTotal" - }, - { - title: "累计公积金个人合计", - dataIndex: "addUpAccumulationFundTotal", - key: "addUpAccumulationFundTotal" - }, - { - title: "累计子女教育", - dataIndex: "addUpChildEducation", - key: "addUpChildEducation" - }, - { - title: "累计继续教育", - dataIndex: "addUpContinuingEducation", - key: "addUpContinuingEducation" - }, - { - title: "累计住房贷款利息", - dataIndex: "addUpHousingLoanInterest", - key: "addUpHousingLoanInterest" - }, - { - title: "累计住房租金", - dataIndex: "addUpHousingRent", - key: "addUpHousingRent" - }, - { - title: "累计赡养老人", - dataIndex: "addUpSupportElderly", - key: "addUpSupportElderly" - }, - { - title: "累计企业(职业)年金及其他福利", - dataIndex: "addUpEnterpriseAndOther", - key: "addUpEnterpriseAndOther" - }, - { - title: "累计其他免税扣除", - dataIndex: "addUpOtherDeduction", - key: "addUpOtherDeduction" - }, - { - title: "累计免税收入", - dataIndex: "addUpTaxExemptIncome", - key: "addUpTaxExemptIncome" - }, - { - title: "累计准予扣除的捐赠额", - dataIndex: "addUpAllowedDonation", - key: "addUpAllowedDonation" - }, - { - title: "累计减免税额", - dataIndex: "addUpTaxSavings", - key: "addUpTaxSavings" - }, - { - title: "累计已预扣预缴税额", - dataIndex: "addUpAdvanceTax", - key: "addUpAdvanceTax" - }, - { - title: "累计婴幼儿照护", - dataIndex: "addUpInfantCare", - key: "addUpInfantCare" - }, - { - title: "累计大病医疗", - dataIndex: "addUpIllnessMedical", - key: "addUpIllnessMedical" - } - -]; - -export const dataSource = []; - export const dataCollectCondition = [ { items: [ @@ -353,11 +226,10 @@ export const dataCollectCondition = [ defaultshow: true } ]; - export const taxOptions = [ { key: "01", - showname: "一月", + showname: "一月" }, { key: "02", @@ -402,5 +274,5 @@ export const taxOptions = [ { key: "12", showname: "十二月" - }, + } ]; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js deleted file mode 100644 index 4ef993a4..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js +++ /dev/null @@ -1,201 +0,0 @@ -import React from "react"; -import { Col, DatePicker, Row } from "antd"; -import { inject, observer } from "mobx-react"; -import { WeaTable } from "ecCom"; -import "./editSlideContent.less"; -import moment from "moment"; - -const { MonthPicker } = DatePicker; - -let emptyItem = { - incomeLowerLimit: "0.00", - incomeUpperLimit: "0.00", - dutyFreeValue: "0.00", - dutyFreeRate: "0.00", - taxableIncomeLl: "0.00", - taxableIncomeUl: "0.00", - taxRate: "0.00", - taxDeduction: "0.00" -}; - -@inject("cumSituationStore", "taxAgentStore") -@observer -export default class EditSlideContent extends React.Component { - constructor(props) { - super(props); - this.state = { - taxAgentId: "", - startDate: "", - endDate: "", - editable: - this.props.editable === undefined ? "true" : this.props.editable - }; - } - - componentWillMount() { - // 初始化渲染页面 - const { - taxAgentStore: { fetchTaxAgentOption } - } = this.props; - fetchTaxAgentOption(); - } - - addItem() { - const { - taxRateStore: { setDataSource } - } = this.props; - let dataSource = [...this.props.taxRateStore.dataSource]; - let indexNum = 1; - if (dataSource.length > 0) { - indexNum = dataSource[dataSource.length - 1].indexNum + 1; - } - let item = { ...emptyItem }; - item.indexNum = indexNum; - dataSource.push(item); - setDataSource(dataSource); - } - - fetchCumDeductDetailList(param) { - const { cumSituationStore } = this.props; - const { getCumDeductDetailList, currentRecord } = cumSituationStore; - getCumDeductDetailList(currentRecord.id, param); - } - - // 日期格式变化加载数据 - handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { - let declareMonth = []; - if (startDate != "" && startDate != undefined) { - declareMonth.push(startDate); - } - - if (endDate != "" && endDate != undefined) { - declareMonth.push(endDate); - } - let item = { - taxAgentId: taxAgentId - }; - if (declareMonth.length != 0) { - item.taxYearMonth = declareMonth; - } - this.fetchCumDeductDetailList(item); - } - - onSelectChange = (val) => { - const { onChangeSlideSelectKey } = this.props; - onChangeSlideSelectKey && onChangeSlideSelectKey(val); - }; - - render() { - const { cumSituationStore } = this.props; - const { startDate, endDate, taxAgentId } = this.state; - const { - getCumDeductDetailList, - currentRecord, - slideColumns, - slidePageObj, - slideTableDataSource, - setSlidePageObj, - slideLoading - } = cumSituationStore; - const declareMonth = [startDate, endDate]; - - const pagination = { - current: slidePageObj.current, - pageSize: slidePageObj.pageSize, - total: slidePageObj.total, - showTotal: (total) => `共 ${total} 条`, - showSizeChanger: true, - onShowSizeChange(current, pageSize) { - setSlidePageObj({ ...slidePageObj, current, pageSize }); - getCumDeductDetailList(currentRecord.id, { - ...slidePageObj, - current, - pageSize,taxAgentId:currentRecord.taxAgentId, - declareMonth: _.filter(declareMonth, item => item) - }); - }, - onChange(current) { - setSlidePageObj({ - ...slidePageObj, - current,taxAgentId:currentRecord.taxAgentId, - pageSize: slidePageObj.pageSize - }); - getCumDeductDetailList(currentRecord.id, { - ...slidePageObj, - current, - pageSize, - declareMonth: _.filter(declareMonth, item => item) - }); - } - }; - const newColumns = _.map([...slideColumns], (item) => ({ ...item })); - const rowSelection = { - selectedRowKeys: this.props.slideSelectedKey, - onChange: this.onSelectChange - }; - return ( -
- - - {currentRecord.username} - - - 申报月份 -
-
- { - let startDate = ""; - if (v != "" && v != undefined) { - startDate = moment(v).format("YYYY-MM"); - } - this.setState({ startDate }); - this.handleFetchCumDeductDetailList( - startDate, - endDate, - taxAgentId - ); - }} - /> -
- -
- { - let endDate = ""; - if (v != "" && v != undefined) { - endDate = moment(v).format("YYYY-MM"); - } - this.setState({ endDate }); - this.handleFetchCumDeductDetailList( - startDate, - endDate, - currentRecord.taxAgentId - ); - }} - /> -
-
- -
- -
- -
-
- ); - } -} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less deleted file mode 100644 index 14f22326..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.less +++ /dev/null @@ -1,22 +0,0 @@ -.cumDeductSlide { - .topLabelBar { - padding: 10px 20px; - height: 40px; - line-height: 40px; - margin-bottom: 10px; - } - .formLabel { - margin-right: 10px; - } - .weaRangePickerWrapper { - display: inline-block; - .monthPickerWrapper { - width: 100px; - display: inline-block; - } - .betweenLable { - margin-left: 10px; - margin-right: 10px; - } - } -} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index ac2b13e8..d49ff237 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -1,789 +1,532 @@ -import React from "react"; +/* + * Author: 黎永顺 + * name:往期累计情况(工资、薪金) + * Description: + * Date: 2023/2/21 + */ +import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; -import { WeaDatePicker, WeaHelpfulTip, WeaNewScroll, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; +import { WeaSearchGroup } from "ecCom"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import { + createAddUpSituation, + deleteAllAddUpSituation, + deleteSelectAddUpSituation, + editAddUpSituation, + getAddUpSituation, + getCumSituationSaCondition, + importCumSituationParam, + importCumSituationPreview +} from "../../../apis/cumSituation"; +import { removePropertyCondition } from "../../../util/response"; +import DataTables from "../dataTables"; +import Layout from "../layout"; +import ImportFormCom from "../cumDeduct/components/importFormCom"; +import { DataCollectionDatePicker, DataCollectionSelect } from "../cumDeduct"; import moment from "moment"; -import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import ImportModal from "../../../components/importModal"; -import { dataCollectCondition, modalColumns, taxOptions } from "./columns"; -import { optionAddAll } from "../../../util/options"; -import SlideModalTitle from "../../../components/slideModalTitle"; -import EditSlideContent from "./editSlideContent"; +import { dataCollectCondition, taxOptions } from "./columns"; import AddItems from "../addItems"; -import * as API from "../../../apis/cumSituation"; -import "./index.less"; +import TableRecord from "../components/tableRecord"; -@inject("cumSituationStore", "taxAgentStore") +@inject("taxAgentStore", "cumSituationStore") @observer -export default class CumSituation extends React.Component { +class Index extends Component { constructor(props) { super(props); this.state = { - saveLoading: false, - addVisible: false, - editId: {}, - value: "", - selectedKey: [], - slideSelectedKey: [], //详情表格的选中项 - visiable: false, - inited: false, - monthValue: moment(new Date()).format("YYYY"), - taxYearMonth: moment(new Date()).month() + 1 > 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1), - taxAgentId: "All", - modalParam: { - taxYearMonth: "" - } - }; - } - - componentWillMount() { - // 初始化渲染页面 - const { - cumSituationStore: { doInit, addForm }, - taxAgentStore: { fetchTaxAgentOption } - } = this.props; - addForm.initFormFields(dataCollectCondition); - doInit({ - year: this.state.monthValue, + year: moment(new Date()).format("YYYY"), + declareMonth: moment(new Date()).month() + 1 > 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1), taxAgentId: "", - taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth - }); - fetchTaxAgentOption().then(() => { - this.setState({ - inited: true - }); - }); + innerWidth: window.innerWidth, + addAllLoading: false, + saveLoading: false, + slidePayload: { + visible: false, + title: "", + children: null, + data: {} + }, + importPayload: { + visible: false, + importOpts: { + declareMonth: moment(new Date()).format("YYYY-MM") + }, + importFormComponent: null, + step: 0, + importResult: {}, + slideDataSource: [] + }, + exportPayloadUrl: "", + advanceCondition: null + }; + this.tableRef = null; + this.addItemRef = null; + this.tableRecordRef = null; } - getSearchsAdQuick() { - const { monthValue, taxAgentId, taxYearMonth } = this.state; - const { - taxAgentStore: { taxAgentOption }, - cumSituationStore: { form, getTableDatas } - } = this.props; - return ( -
-
- 纳税年度: - { - this.setState({ monthValue: c, taxYearMonth: "01" }); - let params = {}; - if (taxAgentId == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = taxAgentId; - } - if (c != null && c !== "") { - params.year = c; - } - getTableDatas({ ...params, taxYearMonth: c + "-" + taxYearMonth }); - }} - /> -
-
- -
- -
- 税款所属期: - { - this.setState({ taxYearMonth: v }); - let params = {}; - if (taxAgentId == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = taxAgentId; - } - if (v != null && v != "") { - params.taxYearMonth = monthValue + "-" + v; - } - getTableDatas({ ...params, year: monthValue }); - }} - /> -
-
- 个税扣缴义务人: - {this.state.inited && - { - let params = {}; - if (v === "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = v; - } - if (monthValue != null && monthValue !== "") { - params.year = monthValue; - } - getTableDatas({ ...params, taxYearMonth: monthValue + "-" + taxYearMonth }); - this.setState({ taxAgentId: v }); - }} - />} -
-
- ); + componentDidMount() { + this.getAdvanceCondition(); } - renderFormComponent() { - const { modalParam } = this.state; - const { taxAgentStore: { taxAgentOption } } = this.props; - return ( - - - - 税款所属期 - - - this.setState({ modalParam: { taxYearMonth: value } })} - /> - - - ); - } - - onEdit = record => { - const { - cumSituationStore: { - slideVisiable, - setSlideVisiable, - getCumDeductDetailList, - setCurrentRecord + /* + * Author: 黎永顺 + * Description: 高级搜素框-表单项 + * Params: + * Date: 2023/2/20 + */ + getAdvanceCondition = () => { + const { cumSituationStore: { form } } = this.props; + getCumSituationSaCondition().then(({ status, data }) => { + if (status) { + this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + form.initFormFields(removePropertyCondition(data.condition)); } - } = this.props; - setSlideVisiable(true); - setCurrentRecord(record); - getCumDeductDetailList(record.id, { taxAgentId: record.taxAgentId }); - }; - - // 增加编辑功能,重写columns绑定事件 - getColumns = columns => { - let newColumns = []; - if (!columns) { - return []; - } - newColumns = columns.map(column => { - let newColumn = column; - newColumn.render = (text, record, index) => { - //前端元素转义 - let valueSpan = - record[newColumn.dataIndex + "span"] !== undefined - ? record[newColumn.dataIndex + "span"] - : record[newColumn.dataIndex]; - switch (newColumn.dataIndex) { - case "username": - return ( - { - this.onEdit(record); - }} - dangerouslySetInnerHTML={{ __html: valueSpan }} - /> - ); - case "operate": - return ( - { - this.onEdit(record); - }}> - 查看明细 - - ); - default: - return
; - } - }; - return newColumn; - }); - return newColumns; - }; - - handleCancel() { - const { cumSituationStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = cumSituationStore; - setModalVisiable(false); - setStep(0); - } - - showColumn = () => { - const { cumSituationStore: { tableStore } } = this.props; - tableStore.setColSetVisible(true); - tableStore.tableColSet(true); - }; - - // 导入参数初始化 - handleInitImport = () => { - const { - cumSituationStore: { setSlideDataSource, setImportResult } - } = this.props; - setSlideDataSource([]); - setImportResult({}); - }; - - onSelectChange = val => { - this.setState({ - selectedKey: val }); }; - - // 搜索 - handleSearch = () => { - const { cumSituationStore: { getTableDatas } } = this.props; - const { monthValue, taxAgentId, taxYearMonth } = this.state; - let params = {}; - if (monthValue != null && monthValue !== "") { - params.year = monthValue; - } - if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") { - params.taxAgentId = taxAgentId; - } - getTableDatas({ ...params, taxYearMonth: monthValue + "-" + taxYearMonth, current: 1 }); - }; - //新功能 - handleCreateUpSituation = (payload) => { - const { editId } = this.state; + /* + * Author: 黎永顺 + * Description: 数据采集-信息保存 + * Params: + * Date: 2023/2/20 + */ + handleSaveDeduction = (payload) => { + const { slidePayload } = this.state; + const { data } = slidePayload; + const { id } = data; this.setState({ saveLoading: true }); - if (!_.isEmpty(editId)) { - API.editAddUpSituation({ ...payload, id: editId.id }).then(({ status, errormsg }) => { + if (!_.isEmpty(data)) { + editAddUpSituation({ ...payload, id }).then(({ status, errormsg }) => { this.setState({ saveLoading: false }); if (status) { message.success("编辑成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumSituationStore: { addForm } } = this.props; - this.handleSearch(); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "编辑失败"); } }); } else { - API.createAddUpSituation(payload).then(({ status, errormsg }) => { + createAddUpSituation(payload).then(({ status, errormsg }) => { this.setState({ saveLoading: false }); if (status) { message.success("新增成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumSituationStore: { addForm } } = this.props; - this.handleSearch(); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "新增失败"); } }); } }; - handleOperate = ({ key }, row) => { - const { monthValue: declareMonth, taxYearMonth } = this.state; - if (key === "edit") { - this.setState({ - addVisible: true - }, () => { - API.getAddUpSituation({ id: row.id }).then(({ status, data }) => { + /* + * Author: 黎永顺 + * Description: 导入数据采集数据 + * Params: + * Date: 2023/2/20 + */ + handleImportFile = (params) => { + importCumSituationParam(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) => { + 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:列表操作 + * Params: + * Date: 2023/2/20 + */ + handleTableOperate = ({ key }, record) => { + const { id } = record; + key === "handleAddData" ? getAddUpSituation({ id }).then(({ status, data }) => { + if (status) this[key]("编辑", data); + }) : this.deleteSelectAddUpSituation(record); + }; + /* + * Author: 黎永顺 + * Description:新增数据采集-往期累计情况(工资、薪金) + * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 + * Date: 2023/2/20 + */ + handleAddData = (title = "新建", editId = {}) => { + const { taxAgentStore, cumSituationStore: { addForm } } = this.props; + const { slidePayload } = this.state; + const { taxAgentOption } = taxAgentStore; + addForm.initFormFields(dataCollectCondition); + this.setState({ + slidePayload: { + ...slidePayload, + visible: true, + title, + data: editId, + children: title.length <= 2 ? + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + isCum + editId={editId} + condition={dataCollectCondition} + /> : + this.tableRecordRef = dom} + className="accumulated" + taxAgentOption={taxAgentOption} + url="/api/bs/hrmsalary/addUpSituation/getDetailList" + record={editId} + screenParams={["accumulatedSituationId", "taxAgentId", "taxYearMonth"]} + /> + } + }); + }; + /* + * Author: 黎永顺 + * Description: 一键清空 + * Params: + * Date: 2023/2/20 + */ + deleteAllAddUpSituation = () => { + const { declareMonth, year } = this.state; + const payload = { + taxYearMonth: year + "-" + declareMonth + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${year}-${declareMonth}的所有往期累计情况的数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + deleteAllAddUpSituation(payload).then(({ status, errormsg }) => { if (status) { - this.setState({ editId: data }); + message.success("删除成功"); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "删除失败"); } }); - }); - } else if (key === "delete") { - const payload = { - taxYearMonth: declareMonth + "-" + taxYearMonth, - ids: [row.id] - }; - Modal.confirm({ - title: "信息确认", - content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的往期累计情况数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - this.handleSearch(); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - } + } + }); }; - deleteSelectAddUpSituation = () => { - const { monthValue: declareMonth, selectedKey, taxYearMonth } = this.state; - if (selectedKey.length === 0) { - message.warning("未选择条目"); + /* + * Author: 黎永顺 + * Description: 删除所选 + * Params: + * Date: 2023/2/20 + */ + deleteSelectAddUpSituation = (record = {}) => { + const { declareMonth, year } = this.state; + const { selectedRowKeys: ids } = this.tableRef.state; + const { id, departmentName, username } = record; + if (ids.length === 0 && !id) { + message.warning("请选择表格数据"); return; } const payload = { - taxYearMonth: declareMonth + "-" + taxYearMonth, - ids: selectedKey + taxYearMonth: year + "-" + declareMonth, + ids: !id ? ids : [id] }; Modal.confirm({ title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" : + `确定删除${departmentName}${username}(税款所属期:${declareMonth})的往期累计情况数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, onOk: () => { - API.deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => { + deleteSelectAddUpSituation(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); - this.handleSearch(); + this.tableRef.getTableDate(); + this.tableRef.handleClearRows(); } else { message.error(errormsg || "删除失败"); } }); + } + }); + }; + /* + * Author: 黎永顺 + * Description:数据采集-导出全部 + * Params: + * Date: 2023/2/20 + */ + handleExportAll = () => { + const { declareMonth, taxAgentId, year } = this.state; + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description:数据采集-导出选中 + * Params: + * Date: 2023/2/20 + */ + handleExportSelect = () => { + const { selectedRowKeys: ids } = this.tableRef.state; + const { declareMonth, taxAgentId, year } = this.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=${ids.join(",")}&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description: 顶部操作按钮 + * Params: + * Date: 2023/2/17 + */ + getTopBtns = () => { + const { addAllLoading } = this.state; + return [ + , + , + + 批量删除 + 一键清空 + 导出选中 + 导出全部 + + } + > + + + ]; + }; + handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc](); + /* + * Author: 黎永顺 + * Description: 筛选组件 + * Params: + * Date: 2023/2/17 + */ + getScreen = () => { + const { taxAgentStore: { taxAgentOption } } = this.props; + const { declareMonth, year, taxAgentId, innerWidth } = this.state; + const items = [ + { + com: DataCollectionDatePicker({ + label: "纳税年度", + value: year, + onChange: this.screenChange, + key: "year", + format: "YYYY", + tip: "提示:默认显示本年截至上次所有员工的累计收入及各项累计扣除额、已预扣税额,与本月应发和各项应扣除项一起计算出本月应缴纳税额", + labelCol: 11, + wrapperCol: 13 + }) }, - onCancel: () => { + { + com: DataCollectionSelect({ + label: "税款所属期", + value: declareMonth, + onChange: this.screenChange, + options: taxOptions, + key: "declareMonth", + labelCol: 12, + wrapperCol: 12 + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId", + labelCol: 16, + wrapperCol: 8 + }) + } + ]; + return ; + }; + screenChange = ({ key, value }) => { + this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 })); + }; + handleAdSearch = () => { + const { cumSituationStore: { form } } = this.props; + this.tableRef.getTableDate({ ...form.getFormParams(), current: 1 }); + }; + handleCloseSlide = () => { + const { slidePayload } = this.state; + this.setState({ + slidePayload: { + ...slidePayload, + visible: false, + title: "", + chidren: null, + data: {} } }); - + this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys(); + this.handleDebounce = null; }; - deleteAllAddUpSituation = () => { - const { monthValue: declareMonth, taxYearMonth } = this.state; + handleSaveData = () => { + const { cumSituationStore: { addForm } } = this.props; + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !!v); + if (!bool) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } const payload = { - taxYearMonth: declareMonth + "-" + taxYearMonth + taxYearMonth: baseInfo.declareMonth, + ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() }; - Modal.confirm({ - title: "信息确认", - content: `确定清空税款所属期为${declareMonth}-${taxYearMonth}的所有往期累计情况的数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteAllAddUpSituation(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - this.handleSearch(); - } else { - message.error(errormsg || "删除失败"); - } - }); + this.handleSaveDeduction(payload); + }; + + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * Author: 黎永顺 + * Description: 数据采集-导入相关 + * Params: + * Date: 2023/2/20 + */ + handleOpenImport = () => { + const { importPayload } = this.state; + const { importOpts } = importPayload; + this.setState({ + importPayload: { + ...importPayload, + visible: true, step: 0, + importResult: {}, slideDataSource: [], + importFormComponent: } }); }; - - handleButtonClick = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(this.handleChange, 500); - } - this.handleChangeDebounce(); + 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") + }, importResult: {}, slideDataSource: [] + } + }, () => doSearch && this.tableRef.getTableDate()); }; - - handleChange = e => { - const taxYearMonth = this.state.monthValue + "-" + this.state.taxYearMonth; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${this - .state.monthValue}&taxYearMonth=${taxYearMonth}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); + handleChangeImportForm = (key, value) => { + const { importPayload } = this.state; + const { importOpts } = importPayload; + this.setState({ + importPayload: { ...importPayload, importOpts: { ...importOpts, [key]: value } } + }); }; - - handleExportAllDetailClick = () => { - if (!this.handleChangeDebounce) { - const { - cumSituationStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); + handleImportSetStep = (step) => { + const { importPayload } = this.state; + this.setState({ + importPayload: { ...importPayload, step } + }); + }; + /* + * Author: 黎永顺 + * Description:详情页面-操作按钮 + * Params: + * Date: 2023/2/20 + */ + getDetailOptBtns = () => { + return [ + + 导出选中 + } + type="primary"> + 导出全部 + + ]; + }; + /* + * Author: 黎永顺 + * Description: 导出详情数据 + * Params: + * Date: 2023/2/21 + */ + handleExportDetail = (url) => { + if (!this.handleDebounce) { + this.handleDebounce = _.debounce(() => { + window.open(`${window.location.origin}/api/bs/hrmsalary/addUpSituation/exportDetail${url}`, "_self"); + this.handleDebounce = null; + }, 500); } - this.handleChangeDebounce(); + this.handleDebounce(); + }; + handleExportSelectDetail = () => { + const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=${ids.join(",")}`; + this.handleExportDetail(payload); + }; + handleExportAllDetail = () => { + const { recordPayload } = this.tableRecordRef.state; + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=`; + this.handleExportDetail(payload); }; render() { - const { cumSituationStore, taxAgentStore } = this.props; - const { slideSelectedKey, addVisible, editId, saveLoading } = this.state; + const { taxAgentStore: { showOperateBtn }, cumSituationStore: { form } } = this.props; const { - loading, - dataSource, - columns, - pageObj, - form, - addForm, - condition, - tableStore, - showSearchAd, - getTableDatas, - doSearch, - setShowSearchAd, - previewImport, - importFile - } = cumSituationStore; - const { taxAgentOption, showOperateBtn } = taxAgentStore; - const { - slideVisiable, - setSlideVisiable, - modalVisiable, - setModalVisiable, - slideTableStore, - step, - setStep, - slideDataSource, - importResult, - setPageObj - } = cumSituationStore; - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - const { modalParam, monthValue, taxAgentId } = this.state; - const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - const rightMenu = [ - // 右键菜单 - // { - // key: "BTN_COLUMN", - // icon: , - // content: "显示列定制", - // onClick: this.showColumn, - // }, - ]; - const collectParams = { - // 收藏功能配置 - favname: "往期累计情况(工资、薪金)", - favouritetype: 1, - objid: 0, - link: "wui/index.html#/ns_demo03/index", - importantlevel: 1 - }; - const adBtn = [ - // 高级搜索内部按钮 - , - , - - ]; - - const handleMenuClick = () => { - const { selectedKey } = this.state; - if (_.isEmpty(selectedKey)) { - message.warning("未选择条目"); - return; - } - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpSituation/export?ids=${selectedKey.join( - "," - )}&year=${this.state.monthValue}&taxAgentId=${this.state - .taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - // const { - // cumSituationStore: { exportCumDeductList }, - // } = this.props; - // exportCumDeductList(selectedRowKeys.join(",")); - }; - - const handleBtnImport = () => { - const { cumSituationStore: { setModalVisiable, setStep } } = this.props; - setStep(0); - setModalVisiable(true); - }; - - const btns = [ - , - - 导出选中 - - } - type="ghost"> - 导出全部 - , - , - - 删除所选 - - } - type="ghost"> - 一键清空 - - ]; - - - const handleExportSelectedDetailClick = () => { - if (this.state.slideSelectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const { - cumSituationStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - }; - - const renderBtns = () => { - return [ - - 导出选中 - - } - type="primary"> - 导出全部 - - ]; - }; - - const pagination = { - total: pageObj.total, - showTotal: total => `共 ${total} 条`, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: (current, pageSize) => { - setPageObj({ ...pageObj, current, pageSize }); - getTableDatas({ - current, - pageSize, - taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - year: monthValue - }); - }, - onChange: (current) => { - setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); - getTableDatas({ - current, - pageSize: pageObj.pageSize, - taxYearMonth: this.state.monthValue + "-" + this.state.taxYearMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - year: monthValue - }); - } - }; - const rowSelection = { - selectedRowKeys: this.state.selectedKey, - onChange: this.onSelectChange - }; - const newColumns = _.map([...columns], item => { - if (item.dataIndex === "username") { - return { - ...item, - width: 100, - fixed: "left", - render: (text, record) => - - }; - } else if (item.dataIndex === "taxAgentName") { - return { - ...item, - width: 180, - fixed: "left" - }; - } else if (item.dataIndex === "operate") { - return { - ...item, - width: 120, - fixed: "right", - render: (text, record) => -
- this.onEdit(record)}> - 查看明细 - - { - showOperateBtn && - this.handleOperate(e, record)}> - 编辑 - 删除 - } title=""> - - - } -
- }; - } else { - return { ...item, width: 150 }; - } - }); - if (_.isEmpty(newColumns)) { - return renderLoading(); - } + declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, + importPayload, year + } = this.state; + const tablePayload = { taxYearMonth: `${year}-${declareMonth}`, year, taxAgentId }; return ( -
- } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={showOperateBtn ? btns : []}> -
- setShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 - buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 - searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 - /> -
-
- - - -
-
- {modalVisiable && - { - this.handleInitImport(); - }} - templateLink={"/api/bs/hrmsalary/addUpSituation/downloadTemplate"} - params={modalParam} - columns={modalColumns} - step={step} - setStep={setStep} - onFinish={() => { - setModalVisiable(false); - setStep(0); - doSearch(); - }} - slideDataSource={slideDataSource} - importResult={importResult} - previewImport={params => { - previewImport(params); - }} - importFile={params => { - importFile(params); - }} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { - this.handleCancel(); - }} - />} - {(slideVisiable || addVisible) && - { - const { baseInfo } = this.addItemRef.state; - const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - if (!bool && _.isEmpty(editId)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const payload = { - taxYearMonth: baseInfo.declareMonth, - ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]), - ...addForm.getFormParams() - }; - this.handleCreateUpSituation(payload); - }} - editable={!!addVisible} - showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} - /> - } - content={ - addVisible ? - this.addItemRef = dom} - taxAgentOption={taxAgentOption} - form={addForm} - isCum - editId={!_.isEmpty(editId) ? { ...editId, declareMonth: editId.taxYearMonth } : editId} - condition={dataCollectCondition}/> : - - this.setState({ slideSelectedKey: val })} - /> - } - onClose={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - showMask={true} - closeMaskOnClick={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - />} -
+ + this.tableRef = dom} + url="/api/bs/hrmsalary/addUpSituation/list" + payload={tablePayload} + showOperateBtn={showOperateBtn} + onTableOperate={this.handleTableOperate} + onViewDetails={(record) => this.handleAddData("往期累计情况(工资、薪金)记录", record)} + /> + ); } } + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less deleted file mode 100644 index 833b1df9..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less +++ /dev/null @@ -1,64 +0,0 @@ -.slideOuterWrapper { - .wea-slide-modal-title { - height: initial; - line-height: initial; - text-align: left; - } - - .rodal-close { - z-index: 99; - top: 10px !important; - } - - .linkWapper { - a { - color: #4d7ad8; - margin-right: 8px; - } - - i { - cursor: pointer; - } - - a:hover { - text-decoration: none; - } - } - -} - -.moreIconWrapper { - .ant-popover-inner { - min-width: 106px - } - - .ant-popover-inner-content { - padding: 0; - - .ant-menu { - .ant-menu-item { - border-right: none; - height: 30px; - line-height: 30px; - text-align: center; - padding: 0; - } - } - } -} - -@media (min-width: 1260px) { - .slideOuterWrapper { - .reqTopWrapper .wea-new-top-req-title > div:first-child > div { - max-width: 100% !important; - } - } -} - -@media screen and (min-width: 1060px) and (max-width: 1260px) { - .slideOuterWrapper { - .reqTopWrapper .wea-new-top-req-title > div:first-child > div { - max-width: calc(100% - 96px) !important; - } - } -} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less index af9a1fa2..a580739f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/index.less @@ -83,6 +83,30 @@ } } + .screenSituationWrapper { + padding: 0; + + .wea-content { + padding: 0; + } + + .wea-form-cell { + padding: 0 16px; + + .wea-date-picker { + width: 70%; + + input { + min-width: inherit !important; + } + } + } + + .wea-helpful-tip { + padding-left: 10px; + } + } + .dataContent { flex: 1; overflow: hidden; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js index 2d1dfb19..cb2efd8f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js @@ -65,68 +65,6 @@ export const columns = [ key: "title" } ]; - - -export const modalColumns = [ - { - title: "姓名", - dataIndex: "username", - key: "username" - }, - { - title: "个税扣缴义务人", - dataIndex: "taxAgentName", - key: "taxAgentName" - }, - { - title: "部门", - dataIndex: "departmentName", - key: "departmentName" - }, - { - title: "手机号", - dataIndex: "mobile", - key: "mobile" - }, - { - title: "工号", - dataIndex: "jobNum", - key: "jobNum" - }, - { - title: "证件号码", - dataIndex: "idNo", - key: "idNo" - }, - { - title: "入职日期", - dataIndex: "hiredate", - key: "hiredate" - }, - { - title: "商业健康保险", - dataIndex: "businessHealthyInsurance", - key: "businessHealthyInsurance" - }, - { - title: "税延养老保险", - dataIndex: "taxDelayEndowmentInsurance", - key: "taxDelayEndowmentInsurance" - }, - { - title: "其他", - dataIndex: "otherDeduction", - key: "otherDeduction" - }, - { - title: "准予扣除的捐赠额", - dataIndex: "deductionAllowedDonation", - key: "deductionAllowedDonation" - } -]; - -export const dataSource = []; - export const dataCollectCondition = [ { items: [ diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js deleted file mode 100644 index e66c6b4f..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js +++ /dev/null @@ -1,213 +0,0 @@ -import React from "react"; -import { Col, DatePicker, Row } from "antd"; -import { inject, observer } from "mobx-react"; -import { WeaTable } from "ecCom"; -import "./editSlideContent.less"; -import moment from "moment"; - -const { MonthPicker } = DatePicker; - -let emptyItem = { - incomeLowerLimit: "0.00", - incomeUpperLimit: "0.00", - dutyFreeValue: "0.00", - dutyFreeRate: "0.00", - taxableIncomeLl: "0.00", - taxableIncomeUl: "0.00", - taxRate: "0.00", - taxDeduction: "0.00" -}; - -@inject("otherDeductStore", "taxAgentStore") -@observer -export default class EditSlideContent extends React.Component { - constructor(props) { - super(props); - this.state = { - taxAgentId: "", - startDate: "", - endDate: "", - editable: - this.props.editable === undefined ? "true" : this.props.editable - }; - } - - componentWillMount() { - // 初始化渲染页面 - const { - taxAgentStore: { fetchTaxAgentOption } - } = this.props; - fetchTaxAgentOption(); - } - - addItem() { - const { - taxRateStore: { setDataSource } - } = this.props; - let dataSource = [...this.props.taxRateStore.dataSource]; - let indexNum = 1; - if (dataSource.length > 0) { - indexNum = dataSource[dataSource.length - 1].indexNum + 1; - } - let item = { ...emptyItem }; - item.indexNum = indexNum; - dataSource.push(item); - setDataSource(dataSource); - } - - fetchCumDeductDetailList(param) { - const { otherDeductStore } = this.props; - const { getOtherDeductDetailList, currentRecord } = otherDeductStore; - getOtherDeductDetailList(currentRecord.id, param); - } - - // 日期格式变化加载数据 - handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { - let declareMonth = []; - if (startDate != "" && startDate != undefined) { - declareMonth.push(startDate); - } - - if (endDate != "" && endDate != undefined) { - declareMonth.push(endDate); - } - let item = { - taxAgentId: taxAgentId - }; - if (declareMonth.length != 0) { - item.declareMonth = declareMonth; - } - this.fetchCumDeductDetailList(item); - } - - onSelectChange = (val) => { - const { onChangeSlideSelectKey } = this.props; - onChangeSlideSelectKey && onChangeSlideSelectKey(val); - }; - - render() { - const { otherDeductStore } = this.props; - const { - getOtherDeductDetailList, - currentRecord, - slideColumns, - slidePageObj, - slideTableDataSource, - setSlidePageObj, - slideLoading - } = otherDeductStore; - const { startDate, endDate, taxAgentId } = this.state; - const declareMonth = [startDate, endDate]; - - const pagination = { - current: slidePageObj.current, - pageSize: slidePageObj.pageSize, - total: slidePageObj.total, - showTotal: (total) => `共 ${total} 条`, - showSizeChanger: true, - onShowSizeChange(current, pageSize) { - setSlidePageObj({ ...slidePageObj, current, pageSize }); - getOtherDeductDetailList(currentRecord.id, { - ...slidePageObj, - current, - pageSize, - declareMonth: _.filter(declareMonth, item => item) - }); - }, - onChange(current) { - setSlidePageObj({ - ...slidePageObj, - current, taxAgentId: currentRecord.taxAgentId, - pageSize: slidePageObj.pageSize - }); - getOtherDeductDetailList(currentRecord.id, { - ...slidePageObj, - current, taxAgentId: currentRecord.taxAgentId, - declareMonth: _.filter(declareMonth, item => item) - }); - } - }; - const newColumns = _.map([...slideColumns], (item) => ({ ...item })); - const rowSelection = { - selectedRowKeys: this.props.slideSelectedKey, - onChange: this.onSelectChange - }; - return ( -
- - - {currentRecord.username} - - - 税款所属期 -
-
- { - let startDate = ""; - if (v != "" && v != undefined) { - startDate = moment(v).format("YYYY-MM"); - } - this.setState({ startDate }); - this.handleFetchCumDeductDetailList( - startDate, - endDate, - taxAgentId - ); - }} - /> -
- -
- { - let endDate = ""; - if (v != "" && v != undefined) { - endDate = moment(v).format("YYYY-MM"); - } - this.setState({ endDate }); - this.handleFetchCumDeductDetailList( - startDate, - endDate, - currentRecord.taxAgentId - ); - }} - /> -
-
- - {/**/} - {/* 个税扣缴义务人*/} - {/* {*/} - {/* this.setState({ taxAgentId: v });*/} - {/* this.handleFetchCumDeductDetailList(startDate, endDate, v);*/} - {/* }}*/} - {/* />*/} - {/**/} -
- -
- -
-
- ); - } -} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less deleted file mode 100644 index 14f22326..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.less +++ /dev/null @@ -1,22 +0,0 @@ -.cumDeductSlide { - .topLabelBar { - padding: 10px 20px; - height: 40px; - line-height: 40px; - margin-bottom: 10px; - } - .formLabel { - margin-right: 10px; - } - .weaRangePickerWrapper { - display: inline-block; - .monthPickerWrapper { - width: 100px; - display: inline-block; - } - .betweenLable { - margin-left: 10px; - margin-right: 10px; - } - } -} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index d53144ef..3930168a 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -1,380 +1,207 @@ -import React from "react"; +/* + * Author: 黎永顺 + * name: 其他免税扣除 + * Description: + * Date: 2023/2/21 + */ +import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; -import { WeaDatePicker, WeaHelpfulTip, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom"; +import { WeaSearchGroup } from "ecCom"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import { + createData, + deleteAllData, + deleteSelectData, + editData, + extendToLastMonth, getData, + getOtherDeductSaCondition, + importOtherDeductionParam, + importOtherDeductionPreview +} from "../../../apis/otherDeduct"; +import { removePropertyCondition } from "../../../util/response"; +import DataTables from "../dataTables"; +import Layout from "../layout"; import moment from "moment"; -import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import ImportModal from "../../../components/importModal"; -import { dataCollectCondition, modalColumns } from "./columns"; +import ImportFormCom from "../cumDeduct/components/importFormCom"; +import { DataCollectionDatePicker, DataCollectionSelect } from "../cumDeduct"; +import { getAddUpDeduction } from "../../../apis/cumDeduct"; +import { dataCollectCondition } from "./columns"; import AddItems from "../addItems"; -import SlideModalTitle from "../../../components/slideModalTitle"; -import EditSlideContent from "./editSlideContent"; -import { optionAddAll } from "../../../util/options"; -import * as API from "../../../apis/otherDeduct"; -import "./index.less"; +import TableRecord from "../components/tableRecord"; -@inject("otherDeductStore", "taxAgentStore") +@inject("taxAgentStore", "otherDeductStore") @observer -export default class OtherDeduct extends React.Component { +class Index extends Component { constructor(props) { super(props); this.state = { - saveLoading: false, + declareMonth: moment(new Date()).format("YYYY-MM"), + taxAgentId: "", + innerWidth: window.innerWidth, lastLoading: false, - addVisible: false, - editId: {}, - value: "", - selectedKey: [], - slideSelectedKey: [], //详情表格的选中项 - visiable: false, - monthValue: moment(new Date()).format("YYYY-MM"), - taxAgentId: "All", - inited: false, - modalParam: { - declareMonth: "" - } + saveLoading: false, + slidePayload: { + visible: false, + title: "", + children: null, + data: {} + }, + importPayload: { + visible: false, + importOpts: { + declareMonth: moment(new Date()).format("YYYY-MM") + }, + importFormComponent: null, + step: 0, + importResult: {}, + slideDataSource: [] + }, + exportPayloadUrl: "", + advanceCondition: null }; + this.tableRef = null; + this.addItemRef = null; + this.tableRecordRef = null; } - componentWillMount() { - // 初始化渲染页面 - const { - otherDeductStore: { doInit, addForm }, - taxAgentStore: { fetchTaxAgentOption } - } = this.props; - addForm.initFormFields(dataCollectCondition); - doInit({ declareMonth: [this.state.monthValue], taxAgentId: "" }); - fetchTaxAgentOption().then(() => { - this.setState({ - inited: true - }); - }); + componentDidMount() { + this.getAdvanceCondition(); } - getSearchsAdQuick() { - const { monthValue, taxAgentId } = this.state; - const { - taxAgentStore: { taxAgentOption }, - otherDeductStore: { form, getTableDatas } - } = this.props; - return ( -
-
- 税款所属期: - { - this.setState({ monthValue: v }); - let params = {}; - if (taxAgentId == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = taxAgentId; - } - if (v != null && v != "") { - params.declareMonth = [v]; - } - getTableDatas(params); - }} - /> -
- -
- -
- -
- 个税扣缴义务人: - {this.state.inited && - { - let params = {}; - if (v == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = v; - } - if (monthValue != null && monthValue != "") { - params.declareMonth = [monthValue]; - } - getTableDatas(params); - this.setState({ taxAgentId: v }); - }} - />} -
-
- ); - } - - onEdit = record => { - const { - otherDeductStore: { - slideVisiable, - setSlideVisiable, - getOtherDeductDetailList, - setCurrentRecord + /* + * Author: 黎永顺 + * Description: 高级搜素框-表单项 + * Params: + * Date: 2023/2/20 + */ + getAdvanceCondition = () => { + const { otherDeductStore: { form } } = this.props; + getOtherDeductSaCondition().then(({ status, data }) => { + if (status) { + this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + form.initFormFields(removePropertyCondition(data.condition)); } - } = this.props; - setSlideVisiable(true); - setCurrentRecord(record); - getOtherDeductDetailList(record.id, { taxAgentId: record.taxAgentId }); - }; - - // 增加编辑功能,重写columns绑定事件 - getColumns = columns => { - let newColumns = ""; - newColumns = columns.map(column => { - let newColumn = column; - newColumn.render = (text, record, index) => { - //前端元素转义 - let valueSpan = - record[newColumn.dataIndex + "span"] !== undefined - ? record[newColumn.dataIndex + "span"] - : record[newColumn.dataIndex]; - switch (newColumn.dataIndex) { - case "username": - return ( - { - this.onEdit(record); - }} - dangerouslySetInnerHTML={{ __html: valueSpan }} - /> - ); - case "operate": - return ( - { - this.onEdit(record); - }}> - 查看明细 - - ); - default: - return
; - } - }; - return newColumn; - }); - return newColumns; - }; - - handleCancel() { - const { otherDeductStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = otherDeductStore; - setModalVisiable(false); - setStep(0); - } - - onOperatesClick = (record, index, operate, flag) => { - switch (operate.index.toString()) { - case "0": // 查看明细 - this.onEdit(record); - break; - } - }; - - renderFormComponent() { - const { modalParam } = this.state; - return ( - - - - 税款所属期 - - - this.setState({ modalParam: { declareMonth: value } })} - /> - - - ); - } - - showColumn = () => { - const { otherDeductStore: { tableStore } } = this.props; - tableStore.setColSetVisible(true); - tableStore.tableColSet(true); - }; - - // 初始化导入参数 - handleInitImport() { - const { - otherDeductStore: { setSlideDataSource, setImportResult } - } = this.props; - setSlideDataSource([]); - setImportResult({}); - } - - onSelectChange = val => { - this.setState({ - selectedKey: val }); }; - - handleSearch = () => { - const { otherDeductStore: { getTableDatas } } = this.props; - const { monthValue, taxAgentId } = this.state; - let params = {}; - if (monthValue != null && monthValue !== "") { - params.declareMonth = [monthValue]; - } - if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") { - params.taxAgentId = taxAgentId; - } - getTableDatas({ ...params, current: 1 }); + /* + * Author: 黎永顺 + * Description: 沿用上月 + * Params: + * Date: 2023/2/21 + */ + extendToLastMonth = () => { + const { declareMonth, taxAgentId } = this.state; + const payload = { declareMonth, taxAgentId }; + this.setState({ lastLoading: true }); + extendToLastMonth(payload).then(({ status, data, errormsg }) => { + this.setState({ lastLoading: false }); + if (status) { + message.success(data || "操作成功"); + this.tableRef.getTableDate(); + } else { + message.error(errormsg || "操作失败"); + } + }).catch(() => this.setState({ lastLoading: false })); }; - - //新功能 - handleCreateData = (payload) => { - const { editId } = this.state; + /* + * Author: 黎永顺 + * Description: 数据采集-信息保存 + * Params: + * Date: 2023/2/20 + */ + handleSaveDeduction = (payload) => { + const { slidePayload } = this.state; + const { data } = slidePayload; + const { id } = data; this.setState({ saveLoading: true }); - if (!_.isEmpty(editId)) { - API.editData({ ...payload, id: editId.id }).then(({ status, errormsg }) => { + if (!_.isEmpty(data)) { + editData({ ...payload, id }).then(({ status, errormsg }) => { this.setState({ saveLoading: false }); if (status) { message.success("编辑成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { otherDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "编辑失败"); } }); } else { - API.createData(payload).then(({ status, errormsg }) => { + createData(payload).then(({ status, errormsg }) => { this.setState({ saveLoading: false }); if (status) { message.success("新增成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { otherDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "新增失败"); } }); } }; - handleOperate = ({ key }, row) => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { otherDeductStore: { doSearch } } = this.props; - if (key === "edit") { - this.setState({ - addVisible: true - }, () => { - API.getData({ id: row.id }).then(({ status, data }) => { - if (status) { - this.setState({ editId: data }); - } + /* + * 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 } }); - }); - } else if (key === "delete") { - const payload = { - declareMonth, - ids: [row.id] - }; - Modal.confirm({ - title: "信息确认", - content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteSelectData(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - } - }; - deleteSelectData = () => { - const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; - const { otherDeductStore: { doSearch } } = this.props; - if (selectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const payload = { - declareMonth, - ids: selectedKey - }; - Modal.confirm({ - title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", - onOk: () => { - API.deleteSelectData(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - }, - onCancel: () => { } }); - }; + /* + * Author: 黎永顺 + * Description: 导入数据采集-数据查看 + * Params: + * Date: 2023/2/20 + */ + handlePreviewImport = (params) => { + importOtherDeductionPreview(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:列表操作 + * Params: + * Date: 2023/2/20 + */ + handleTableOperate = ({ key }, record) => { + const { id } = record; + key === "handleAddData" ? getData({ id }).then(({ status, data }) => { + if (status) this[key]("编辑", data); + }) : this.deleteSelectData(record); + }; + /* + * Author: 黎永顺 + * Description: 一键清空 + * Params: + * Date: 2023/2/20 + */ deleteAllData = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { otherDeductStore: { doSearch } } = this.props; - const payload = { - declareMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }; + const { declareMonth, taxAgentId } = this.state; + const payload = { declareMonth, taxAgentId }; Modal.confirm({ title: "信息确认", content: `确定清空税款所属期为${declareMonth}的所有其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, onOk: () => { - API.deleteAllData(payload).then(({ status, errormsg }) => { + deleteAllData(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); + this.tableRef.getTableDate(); } else { message.error(errormsg || "删除失败"); } @@ -382,447 +209,322 @@ export default class OtherDeduct extends React.Component { } }); }; - - //沿用上月 - extendToLastMonth = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { otherDeductStore: { doSearch } } = this.props; - const payload = { - declareMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }; - this.setState({ lastLoading: true }); - API.extendToLastMonth(payload).then(({ status, data, errormsg }) => { - this.setState({ lastLoading: false }); - if (status) { - message.success(data || "操作成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId + /* + * Author: 黎永顺 + * Description: 删除所选 + * Params: + * Date: 2023/2/20 + */ + deleteSelectData = (record = {}) => { + const { declareMonth } = this.state; + const { selectedRowKeys: ids } = this.tableRef.state; + const { id, departmentName, username } = record; + if (ids.length === 0 && !id) { + message.warning("请选择表格数据"); + return; + } + const payload = { declareMonth, ids: !id ? ids : [id] }; + Modal.confirm({ + title: "信息确认", + content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" : + `确定删除${departmentName}${username}(税款所属期:${declareMonth})的其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + deleteSelectData(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.tableRef.getTableDate(); + this.tableRef.handleClearRows(); + } else { + message.error(errormsg || "删除失败"); + } }); - } else { - message.error(errormsg || "操作失败"); } - }).catch(() => this.setState({ lastLoading: false })); + }); }; - handleButtonClick = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(this.handleChange, 500); + /* + * Author: 黎永顺 + * Description:数据采集-导出全部 + * Params: + * Date: 2023/2/20 + */ + handleExportAll = () => { + const { declareMonth, taxAgentId } = this.state; + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/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.handleChangeDebounce(); + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=${ids.join(",")}&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description:新增数据采集-累计专项附加扣除 + * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 + * Date: 2023/2/20 + */ + handleAddData = (title = "新建", editId = {}) => { + const { taxAgentStore, otherDeductStore: { addForm } } = this.props; + const { slidePayload } = this.state; + const { taxAgentOption } = taxAgentStore; + addForm.initFormFields(dataCollectCondition); + this.setState({ + slidePayload: { + ...slidePayload, + visible: true, + title, + data: editId, + 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/otherDeduction/getDetailList" + record={editId} + screenParams={["otherTaxExemptDeductionId", "taxAgentId", "declareMonth"]} + /> + } + }); + }; + /* + * Author: 黎永顺 + * Description: 顶部操作按钮 + * Params: + * Date: 2023/2/17 + */ + getTopBtns = () => { + const { lastLoading } = this.state; + return [ + , + , + , + + 批量删除 + 一键清空 + 导出选中 + 导出全部 + + } + > + + + ]; + }; + handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc](); + /* + * Author: 黎永顺 + * Description: 筛选组件 + * Params: + * Date: 2023/2/17 + */ + getScreen = () => { + const { taxAgentStore: { taxAgentOption } } = this.props; + const { declareMonth, taxAgentId, innerWidth } = this.state; + const items = [ + { + com: DataCollectionDatePicker({ + label: "税款所属期", + value: declareMonth, + onChange: this.screenChange, + key: "declareMonth", + tip: "提示:默认显示当前月所有员工申报的其他免税扣除额" + }) + }, + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId" + }) + } + ]; + return ; + }; + screenChange = ({ key, value }) => { + this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 })); + }; + handleCloseSlide = () => { + const { slidePayload } = this.state; + this.setState({ + slidePayload: { + ...slidePayload, + visible: false, + title: "", + chidren: null, + data: {} + } + }); + this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys(); + this.handleDebounce = null; + }; + handleSaveData = () => { + const { otherDeductStore: { addForm } } = this.props; + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !!v); + if (!bool) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.handleSaveDeduction(payload); + }; + handleAdSearch = () => { + const { otherDeductStore: { form } } = this.props; + this.tableRef.getTableDate({ ...form.getFormParams(), current: 1 }); }; - handleChange = e => { - const { selectedKey } = this.state; - const url = `${window.location - .origin}/api/bs/hrmsalary/otherDeduction/export?ids=&declareMonth=${this - .state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * Author: 黎永顺 + * Description: 数据采集-导入相关 + * Params: + * Date: 2023/2/20 + */ + handleOpenImport = () => { + const { importPayload } = this.state; + const { importOpts } = importPayload; + this.setState({ + importPayload: { + ...importPayload, + visible: true, step: 0, + importResult: {}, slideDataSource: [], + importFormComponent: + } + }); }; - handleExportAllDetailClick = () => { - if (!this.handleChangeDebounce) { - const { - otherDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); + 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") + }, 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 } + }); + }; + /* + * Author: 黎永顺 + * Description:详情页面-操作按钮 + * Params: + * Date: 2023/2/20 + */ + getDetailOptBtns = () => { + return [ + + 导出选中 + } + type="primary"> + 导出全部 + + ]; + }; + /* + * Author: 黎永顺 + * Description: 导出详情数据 + * Params: + * Date: 2023/2/21 + */ + handleExportDetail = (url) => { + if (!this.handleDebounce) { + this.handleDebounce = _.debounce(() => { + window.open(`${window.location.origin}/api/bs/hrmsalary/otherDeduction/exportDetail${url}`, "_self"); + this.handleDebounce = null; + }, 500); } - this.handleChangeDebounce(); + this.handleDebounce(); + }; + handleExportSelectDetail = () => { + const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=${ids.join(",")}`; + this.handleExportDetail(payload); + }; + handleExportAllDetail = () => { + const { recordPayload } = this.tableRecordRef.state; + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=`; + this.handleExportDetail(payload); }; render() { - const { otherDeductStore, taxAgentStore } = this.props; + const { taxAgentStore: { showOperateBtn }, otherDeductStore: { form } } = this.props; const { - loading, - dataSource, - columns, - pageObj, - hasRight, - form, - condition, - tableStore, - showSearchAd, - getTableDatas, - doSearch, - setShowSearchAd, - previewImport, - importFile, - addForm - } = otherDeductStore; - const { taxAgentOption, showOperateBtn } = taxAgentStore; - const { - slideVisiable, - setSlideVisiable, - modalVisiable, - setModalVisiable, - slideTableStore, - step, - setStep, - slideDataSource, - importResult, - setPageObj - } = otherDeductStore; - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - const { - modalParam, - monthValue, - taxAgentId, - slideSelectedKey, - addVisible, - editId, - saveLoading, - lastLoading + declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, + importPayload } = this.state; - - const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - - const rightMenu = [ - // 右键菜单 - // { - // key: "BTN_COLUMN", - // icon: , - // content: "显示列定制", - // onClick: this.showColumn, - // }, - ]; - const collectParams = { - // 收藏功能配置 - favname: "其他免税扣除", - favouritetype: 1, - objid: 0, - link: "wui/index.html#/ns_demo03/index", - importantlevel: 1 - }; - const adBtn = [ - // 高级搜索内部按钮 - , - , - - ]; - - const handleMenuClick = () => { - const { selectedKey } = this.state; - if (_.isEmpty(selectedKey)) { - message.warning("未选择条目"); - return; - } - - const url = `${window.location - .origin}/api/bs/hrmsalary/otherDeduction/export?ids=${selectedKey.join( - "," - )}&declareMonth=${this.state.monthValue}&taxAgentId=${this.state - .taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - // const { - // otherDeductStore: { exportOtherDeductList }, - // } = this.props; - // exportOtherDeductList(selectedKey.join(",")); - }; - - const handleBtnImport = () => { - const { otherDeductStore: { setModalVisiable, setStep } } = this.props; - setStep(0); - setModalVisiable(true); - }; - - const btns = [ - , - - 导出选中 - - } - type="ghost"> - 导出全部 - , - , - - 删除所选 - - } - type="ghost"> - 一键清空 - , - - ]; - - const handleExportSelectedDetailClick = () => { - if (this.state.slideSelectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const { - otherDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - }; - - const renderBtns = () => { - return [ - - 导出选中 - - } - type="primary"> - 导出全部 - - ]; - }; - - const rowSelection = { - selectedRowKeys: this.state.selectedKey, - onChange: this.onSelectChange - }; - const pagination = { - total: pageObj.total, - showTotal: total => `共 ${total} 条`, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange(current, pageSize) { - setPageObj({ ...pageObj, current, pageSize }); - getTableDatas({ - current, - pageSize, - taxAgentIdL: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - }, - onChange(current) { - setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); - getTableDatas({ - current, - pageSize: pageObj.pageSize, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - } - }; - - const newColumns = _.map([...columns], item => { - if (item.dataIndex === "username") { - return { - ...item, - render: (text, record) => - - }; - } else if (item.dataIndex === "taxAgentName") { - return { - ...item - }; - } else if (item.dataIndex === "operate") { - return { - ...item, - render: (text, record) => -
- this.onEdit(record)}> - 查看明细 - - { - showOperateBtn && - this.handleOperate(e, record)}> - 编辑 - 删除 - } title=""> - - - } -
- }; - } else { - return { ...item }; - } - }); - if (_.isEmpty(newColumns)) { - return renderLoading(); - } - + const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( -
- } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={showOperateBtn ? btns : []}> -
- setShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 - buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 - searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 - /> -
-
- - - -
-
- {modalVisiable && - { - this.handleInitImport(); - }} - templateLink={"/api/bs/hrmsalary/otherDeduction/downloadTemplate"} - params={modalParam} - columns={modalColumns} - step={step} - setStep={setStep} - onFinish={() => { - setModalVisiable(false); - setStep(0); - doSearch({ - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - }} - importResult={importResult} - slideDataSource={slideDataSource} - previewImport={params => { - previewImport(params); - }} - importFile={params => { - importFile(params); - }} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { - this.handleCancel(); - }} - />} - {(slideVisiable || addVisible) && - { - const { baseInfo } = this.addItemRef.state; - const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - if (!bool && _.isEmpty(editId)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const payload = { - ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), - ...addForm.getFormParams() - }; - this.handleCreateData(payload); - }} - loading={saveLoading} - editable={!!addVisible} - showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} - /> - } - content={ - addVisible ? - this.addItemRef = dom} - taxAgentOption={taxAgentOption} - form={addForm} - editId={editId} - condition={dataCollectCondition} - /> : - - this.setState({ slideSelectedKey: val })} - /> - } - onClose={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - showMask={true} - closeMaskOnClick={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - />} -
+ + this.tableRef = dom} + url="/api/bs/hrmsalary/otherDeduction/list" + payload={tablePayload} + showOperateBtn={showOperateBtn} + onTableOperate={this.handleTableOperate} + onViewDetails={(record) => this.handleAddData("其他免税扣除记录", record)} + /> + ); } } + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js deleted file mode 100644 index 30a44c4e..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/inlineForm.js +++ /dev/null @@ -1,25 +0,0 @@ -import React, { Component } from "react"; -import { Form } from "antd"; -import { WeaSelect } from "ecCom"; -import { optionAddWhole } from "../../../../util/options"; - -class InlineForm extends Component { - - render() { - const { taxAgentOption = [], form, onChange } = this.props; - return ( -
- - - -
- ); - } -} - -export default Form.create()(InlineForm); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js deleted file mode 100644 index cfdfff2c..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js +++ /dev/null @@ -1,87 +0,0 @@ -import React, { Component } from "react"; -import { WeaTable } from "ecCom"; -import * as API from "../../../../apis/special"; - -class SpecialAddContent extends Component { - constructor(props) { - super(props); - this.state = { - dataSource: [], - columns: [], - loading: { - query: false - }, - selectedRowKeys: [], - pageInfo: { - current: 1, - pageSize: 10, - total: 0 - } - }; - } - - componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.specialId !== this.props.specialId) { - nextProps.specialId && this.specialAddDeductionGetDetailList({ specialAddDeductionId: nextProps.specialId }); - } - } - - specialAddDeductionGetDetailList = (payload) => { - this.setState({ loading: { ...this.state.loading, query: true } }); - API.specialAddDeductionGetDetailList(payload).then(({ status, data }) => { - this.setState({ loading: { ...this.state.loading, query: false } }); - if (status) { - const { columns, list: dataSource, pageSize, pageNum, total } = data; - this.setState({ - columns, dataSource, - pageInfo: { - ...this.pageInfo, - pageSize, pageNum, total - } - }); - } - }); - }; - - render() { - const { columns, dataSource, pageInfo, selectedRowKeys, loading } = this.state; - const { specialId } = this.props; - 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.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current, pageSize }); - }); - }, - onChange: (current) => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => { - this.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current }); - }); - } - }; - const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) - }; - return ( - - ); - } -} - -export default SpecialAddContent; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index 0d31317b..92460e95 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -1,293 +1,165 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; -import { WeaPopoverHrm, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTools, WeaTop, WeaNewScroll } from "ecCom"; -import InlineForm from "./components/inlineForm"; -import { getSearchs, renderLoading } from "../../../util"; -import * as API from "../../../apis/special"; -import SlideModalTitle from "../../../components/slideModalTitle"; +import { WeaSearchGroup } from "ecCom"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import DataTables from "../dataTables"; +import Layout from "../layout"; +import { + getSearchCondition, + getSpecialAddDeduction, + specialAddDeductionCreateData, + specialAddDeductionDeleteAllData, + specialAddDeductionDeleteSelectData, + specialAddDeductionEditData, + specialAddDeductionImportData, + specialAddDeductionPreview +} from "../../../apis/special"; +import { removePropertyCondition } from "../../../util/response"; +import { DataCollectionSelect } from "../cumDeduct"; +import ImportFormCom from "../cumDeduct/components/importFormCom"; +import { condition } from "./components/condition"; import AddItems from "../addItems"; -import SpecialAddContent from "./components/specialAddContent"; -import { condition, searchCondition } from "./components/condition"; -import ImportModal from "../../../components/importModal"; -import { specialModalColumns } from "../cumDeduct/columns"; -import "./index.less"; +import TableRecord from "../components/tableRecord"; -@inject("specialAddStore", "taxAgentStore") +@inject("taxAgentStore", "specialAddStore") @observer -class SpecialAddDeduction extends Component { +class Index extends Component { constructor(props) { super(props); this.state = { - loading: { - query: false - }, - advanceParams: { //高级搜索参数 + taxAgentId: "", + innerWidth: window.innerWidth, + saveLoading: false, + slidePayload: { visible: false, - condition: [] + title: "", + children: null, + data: {} }, - drawerParams: { //抽屜弹框参数 - visible: false, title: "新建", - loading: false, isView: true, - editId: {} + importPayload: { + visible: false, + importOpts: { + taxAgentId: "" + }, + importFormComponent: null, + step: 0, + importResult: {}, + slideDataSource: [] }, - importParams: { //导入弹框参数 - visible: false, step: 0, - importResult: [], - payload: { taxAgentId: "" } - }, - dataSource: [], - columns: [], - selectedRowKeys: [], - pageInfo: { - current: 1, pageSize: 10, total: 0 - } + exportPayloadUrl: "", + advanceCondition: null }; - this.inlineForm = null; + this.tableRef = null; this.addItemRef = null; - this.specialContentRef = null; + this.tableRecordRef = null; } componentDidMount() { - const { taxAgentStore: { getTaxAgentSelectListAsAdmin }, specialAddStore: { addForm } } = this.props; - addForm.initFormFields(condition); - getTaxAgentSelectListAsAdmin(); - this.getSearchCondition(); - this.specialAddDeductionList(); + this.getAdvanceCondition(); } - getSearchCondition = () => { - const { specialAddStore: { advanceForm } } = this.props; - const { advanceParams } = this.state; - API.getSearchCondition().then(({ status, data }) => { - if (status) { - const { condition } = data; - this.setState({ - advanceParams: { - ...advanceParams, - condition: condition - } - }, () => advanceForm.initFormFields(this.state.advanceParams.condition)); - } - }); - }; - specialAddDeductionList = (params = {}) => { - const { loading, pageInfo } = this.state; - const { specialAddStore: { advanceForm } } = this.props; - const queryParams = advanceForm.getFormParams(); - const extraParams = this.inlineForm ? this.inlineForm.getFieldsValue() : {}; - const payload = { - ...pageInfo, - ...queryParams, - ...extraParams, - ...params - }; - this.setState({ loading: { ...loading, query: true } }); - API.specialAddDeductionList(payload).then(({ status, data }) => { - this.setState({ loading: { ...loading, query: false } }); - if (status) { - const { columns, list: dataSource, pageNum: current, pageSize, total } = data; - const { userid } = WeaTools.ls.getJSONObj("theme-account") || {}; - this.setState({ - pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource, - columns: _.map(columns, item => { - const { dataIndex } = item; - if (dataIndex === "username") { - return { - ...item, - render: (text, record) => { - return window.pointerXY(e)} - title={text} - > - {text} - ; - } - }; - } else if (dataIndex === "operate") { - return { - ...item, - render: (text, record) => ( -
- { - this.setState({ - drawerParams: { - ...this.state.drawerParams, - visible: true, - isView: true, - title: "专项附加扣除记录", - editId: record - } - }); - }}> - 查看明细 - - { - (!this.props.taxAgentStore.showOperateBtn && userid == record.employeeId) && - this.handleOperate(e, record)}> - 编辑 - } title=""> - - - } - { - this.props.taxAgentStore.showOperateBtn && - this.handleOperate(e, record)}> - 编辑 - 删除 - } title=""> - - - } -
- ) - }; - } else { - return { ...item }; - } - }) - }); - } - }); - }; - handleSaveSpecialList = (payload) => { - const { drawerParams } = this.state; - this.setState({ drawerParams: { ...drawerParams, loading: true } }); - if (!_.isEmpty(drawerParams.editId)) { - API.specialAddDeductionEditData({ ...payload, id: drawerParams.editId.id }).then(({ status, errormsg }) => { - this.setState({ drawerParams: { ...drawerParams, loading: false } }); + /* + * Author: 黎永顺 + * Description: 数据采集-信息保存 + * Params: + * Date: 2023/2/20 + */ + handleSaveDeduction = (payload) => { + const { slidePayload } = this.state; + const { data } = slidePayload; + const { id } = data; + this.setState({ saveLoading: true }); + if (!_.isEmpty(data)) { + specialAddDeductionEditData({ ...payload, id }).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); if (status) { message.success("编辑成功"); - this.setState({ - drawerParams: { - ...drawerParams, - visible: false, - isView: true, - editId: {} - } - }, () => { - const { specialAddStore: { addForm } } = this.props; - this.specialAddDeductionList(); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "编辑失败"); } }); } else { - API.specialAddDeductionCreateData(payload).then(({ status, errormsg }) => { - this.setState({ drawerParams: { ...drawerParams, loading: false } }); + specialAddDeductionCreateData(payload).then(({ status, errormsg }) => { + this.setState({ saveLoading: false }); if (status) { message.success("新增成功"); - this.setState({ - drawerParams: { - ...drawerParams, - visible: false, - isView: true, - editId: {} - } - }, () => { - const { specialAddStore: { addForm } } = this.props; - this.specialAddDeductionList(); - addForm.resetForm(); - }); + this.handleCloseSlide(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "新增失败"); } }); } }; - handleOperate = ({ key }, row) => { - const { drawerParams } = this.state; - if (key === "edit") { - this.setState({ - drawerParams: { - ...drawerParams, - visible: true, - isView: false, - title: "编辑" - } - }, () => { - const { drawerParams: params } = this.state; - API.getSpecialAddDeduction({ id: row.id }).then(({ status, data }) => { - if (status) { - this.setState({ - drawerParams: { - ...params, - editId: data - } - }); - } + /* + * 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 } }); - }); - } else if (key === "delete") { - const payload = { - ids: [row.id] - }; - Modal.confirm({ - title: "信息确认", - content: `确定删除${row.departmentName}${row.username}的专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - this.specialAddDeductionList(); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - } - }; - deleteSelectAddUpDeduction = () => { - const { selectedRowKeys } = this.state; - if (selectedRowKeys.length === 0) { - message.warning("未选择条目"); - return; - } - const payload = { - ids: selectedRowKeys - }; - Modal.confirm({ - title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", - onOk: () => { - API.specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - this.specialAddDeductionList(); - } else { - message.error(errormsg || "删除失败"); - } - }); - }, - onCancel: () => { } }); - }; + /* + * 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: 高级搜素框-表单项 + * Params: + * Date: 2023/2/20 + */ + getAdvanceCondition = () => { + const { specialAddStore: { advanceForm } } = this.props; + getSearchCondition().then(({ status, data }) => { + if (status) { + this.setState({ advanceCondition: removePropertyCondition(data.condition) }); + advanceForm.initFormFields(removePropertyCondition(data.condition)); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 一键清空 + * Params: + * Date: 2023/2/20 + */ specialAddDeductionDeleteAllData = () => { - const extraParams = this.inlineForm ? this.inlineForm.getFieldsValue() : {}; - const payload = { - ...extraParams - }; + const { taxAgentId } = this.state; + const payload = { taxAgentId }; Modal.confirm({ title: "信息确认", content: `确定清空所有专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, onOk: () => { - API.specialAddDeductionDeleteAllData(payload).then(({ status, errormsg }) => { + specialAddDeductionDeleteAllData(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); - this.specialAddDeductionList(); + this.tableRef.getTableDate(); } else { message.error(errormsg || "删除失败"); } @@ -295,370 +167,318 @@ class SpecialAddDeduction extends Component { } }); }; - specialAddDeductionPreview = (payload) => { - const { importParams } = this.state; - API.specialAddDeductionPreview(payload).then(({ status, data }) => { - if (status) { - const { preview: slideDataSource } = data; - this.setState({ - importParams: { - ...importParams, - slideDataSource + /* + * Author: 黎永顺 + * Description: 删除所选 + * Params: + * Date: 2023/2/20 + */ + specialAddDeductionDeleteSelectData = (record = {}) => { + const { selectedRowKeys: ids } = this.tableRef.state; + const { id, departmentName, username } = record; + if (ids.length === 0 && !id) { + message.warning("请选择表格数据"); + return; + } + const payload = { ids: !id ? ids : [id] }; + Modal.confirm({ + title: "信息确认", + content: !id ? "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。" : + `确定删除${departmentName}${username}的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.tableRef.getTableDate(); + this.tableRef.handleClearRows(); + } else { + message.error(errormsg || "删除失败"); } }); } }); }; - specialAddDeductionImportData = (payload) => { - const { importParams } = this.state; - API.specialAddDeductionImportData(payload).then(({ status, data: importResult }) => { - if (status) { - this.setState({ - importParams: { - ...importParams, - step: 2, - importResult - } - }); + /* + * Author: 黎永顺 + * Description:数据采集-导出全部 + * Params: + * Date: 2023/2/20 + */ + handleExportAll = () => { + const { taxAgentId } = this.state; + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description:数据采集-导出选中 + * Params: + * Date: 2023/2/20 + */ + handleExportSelect = () => { + const { selectedRowKeys: ids } = this.tableRef.state; + const { taxAgentId } = this.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); + return; + } + this.setState({ + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${ids.join(",")}&taxAgentId=${taxAgentId}` + }); + }; + /* + * Author: 黎永顺 + * Description: 筛选组件 + * Params: + * Date: 2023/2/17 + */ + getScreen = () => { + const { taxAgentStore: { taxAgentOption } } = this.props; + const { taxAgentId } = this.state; + const items = [ + { + com: DataCollectionSelect({ + label: "个税扣缴义务人", + value: taxAgentId, + onChange: this.screenChange, + options: [{ key: "", showname: "全部" }, ...taxAgentOption], + key: "taxAgentId" + }) + } + ]; + return ; + }; + screenChange = ({ key, value }) => { + this.setState({ [key]: value }, () => this.tableRef.getTableDate({ current: 1 })); + }; + /* + * Author: 黎永顺 + * Description: 顶部操作按钮 + * Params: + * Date: 2023/2/17 + */ + getTopBtns = () => { + return [ + , + , + + 批量删除 + 一键清空 + 导出选中 + 导出全部 + + } + > + + + ]; + }; + handleDataMenuClick = ({ key: keyFunc }) => this[keyFunc](); + /* + * Author: 黎永顺 + * Description:新增数据采集-专项附加扣除 + * Params: screenParams规则:日期必须放在数组最后一位,人员信息必须第一位 + * Date: 2023/2/20 + */ + handleAddData = (title = "新建", editId = {}) => { + const { taxAgentStore, specialAddStore: { addForm } } = this.props; + const { slidePayload } = this.state; + const { taxAgentOption } = taxAgentStore; + addForm.initFormFields(condition); + this.setState({ + slidePayload: { + ...slidePayload, + visible: true, + title, + data: editId, + children: title.length <= 2 ? + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + isSpecial + editId={editId} + condition={condition} + /> : + this.tableRecordRef = dom} + className="accumulated" + taxAgentOption={taxAgentOption} + url="/api/bs/hrmsalary/specialAddDeduction/getDetailList" + record={editId} + screenParams={["specialAddDeductionId"]} + /> } }); }; - specialAddDeductionExport = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(() => { - const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`; - window.open(url, "_self"); + /* + * Author: 黎永顺 + * Description:列表操作 + * Params: + * Date: 2023/2/20 + */ + handleTableOperate = ({ key }, record) => { + const { id } = record; + key === "handleAddData" ? getSpecialAddDeduction({ id }).then(({ status, data }) => { + if (status) this[key]("编辑", data); + }) : this.specialAddDeductionDeleteSelectData(record); + }; + handleCloseSlide = () => { + const { slidePayload } = this.state; + this.setState({ + slidePayload: { + ...slidePayload, + visible: false, + title: "", + chidren: null, + data: {} + } + }); + this.tableRecordRef && this.tableRecordRef.handleResetSelectKeys(); + this.handleDebounce = null; + }; + handleSaveData = () => { + const { specialAddStore: { addForm } } = this.props; + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["taxAgentId", "employeeId"]), v => !!v); + if (!bool) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.handleSaveDeduction(payload); + }; + handleAdSearch = () => { + const { specialAddStore: { advanceForm } } = this.props; + this.tableRef.getTableDate({ ...advanceForm.getFormParams(), current: 1 }); + }; + + handleResize = (innerWidth) => this.setState({ innerWidth }); + /* + * 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: { + 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 } + }); + }; + /* + * Author: 黎永顺 + * Description:详情页面相关-操作按钮 + * Params: + * Date: 2023/2/20 + */ + getDetailOptBtns = () => { + return [ + + 导出选中 + } + type="primary"> + 导出全部 + + ]; + }; + handleExportDetail = (url) => { + if (!this.handleDebounce) { + this.handleDebounce = _.debounce(() => { + window.open(`${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export${url}`, "_self"); + this.handleDebounce = null; }, 500); } - this.handleChangeDebounce(); + this.handleDebounce(); }; - - specialAddDeductionExportSelect = () => { - const { selectedRowKeys } = this.state; - if (selectedRowKeys.length === 0) { - message.warning("未选择条目"); + handleExportSelectDetail = () => { + const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state; + if (ids.length === 0) { + message.warning("请选择需要导出的数据"); return; } - const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`; - window.open(url, "_self"); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=${ids.join(",")}`; + this.handleExportDetail(payload); }; - handleExportSelectSpecialDetail = () => { - const { state: { selectedRowKeys } } = this.specialContentRef; - if (selectedRowKeys.length === 0) { - message.warning("未选择条目"); - return; - } - const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}`; - window.open(url, "_self"); - }; - getSearchsAdQuick = (isAd) => { - const { advanceParams } = this.state; - // advanceParams.condition - const { taxAgentStore: { taxAgentAdminOption }, specialAddStore: { advanceForm } } = this.props; - return isAd ? getSearchs(advanceForm, searchCondition, 2) - : this.inlineForm = dom} - taxAgentOption={taxAgentAdminOption} - onChange={(taxAgentId) => this.specialAddDeductionList({ taxAgentId })} - />; - }; - renderImportormComponent = () => { - const { importParams } = this.state; - const { taxAgentStore: { taxAgentAdminOption } } = this.props; - return ( - - - - 个税扣缴义务人 - - { - this.setState({ importParams: { ...importParams, payload: { taxAgentId: v } } }); - }} - /> - - - ); - }; - - handleExportAllSpecialDetail = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(this.handleChange, 500); - } - this.handleChangeDebounce(); - }; - - handleChange = e => { - const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export`; - window.open(url, "_self"); + handleExportAllDetail = () => { + const { recordPayload } = this.tableRecordRef.state; + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const payload = `?${exportParams}&ids=`; + this.handleExportDetail(payload); }; render() { + const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props; const { - advanceParams, - dataSource, - columns, - loading, - selectedRowKeys, - pageInfo, - drawerParams, - importParams + declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, + importPayload } = this.state; - const { userid } = WeaTools.ls.getJSONObj("theme-account") || {}; - const { taxAgentStore, specialAddStore: { advanceForm, addForm } } = this.props; - const { showOperateBtn, taxAgentAdminOption } = taxAgentStore; - const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) - }; - const customBtns = [ - - 导出选中 - - } - type="primary" - > - 导出全部 - - ]; - const btns = [ - , - - 导出选中 - - } - type="ghost" - > - 导出全部 - , - , - - 删除所选 - - } - type="ghost" - > - 一键清空 - - ]; - 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.specialAddDeductionList({ - current, - pageSize - }); - }); - }, - onChange: (current) => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => { - this.specialAddDeductionList({ - current - }); - }); - } - }; - //加载数据 - if (_.isEmpty(columns)) { - // 无权限处理 - return renderLoading(); - } + const tablePayload = { taxAgentId }; return ( -
- } - iconBgcolor="#F14A2D" - buttons={showOperateBtn ? btns : []} - > -
- advanceForm.updateFields({ username: v })} - onAdReset={() => advanceForm.reset()} - onAdSearch={() => this.specialAddDeductionList({ current: 1 })} - onSearch={() => this.specialAddDeductionList({ current: 1 })} - searchsAdQuick={this.getSearchsAdQuick()} - searchsAd={this.getSearchsAdQuick(true)} - setShowSearchAd={bool => this.setState({ advanceParams: { ...advanceParams, visible: bool } })} - /> -
- - - -
- { - const { baseInfo } = this.addItemRef.state; - const bool = _.every(_.pick(baseInfo, ["taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - if (!bool && _.isEmpty(drawerParams.editId)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const payload = { - ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]), - ...addForm.getFormParams() - }; - this.handleSaveSpecialList(payload); - }} - editable={(showOperateBtn && !drawerParams.isView)} - showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && drawerParams.isView) ? customBtns : (!showOperateBtn && userid == drawerParams.editId.employeeId) ? [ - - ] : []} - /> - } - content={ - !drawerParams.isView ? - this.addItemRef = dom} - taxAgentOption={taxAgentAdminOption} - form={addForm} - isSpecial - editId={drawerParams.editId} - condition={condition} - /> : - this.specialContentRef = dom} specialId={drawerParams.editId.id}/> - } - onClose={() => this.setState({ - drawerParams: { - ...drawerParams, - visible: false, - isView: true, - editId: {} - } - })} - showMask={true} - closeMaskOnClick={() => this.setState({ - drawerParams: { - ...drawerParams, - visible: false, - isView: true, - editId: {} - } - })} - /> - {/*人员卡片*/} - - {/* 导入模板*/} - { - importParams.visible && - this.setState({ importParams: { ...importParams, step } })} - slideDataSource={importParams.slideDataSource} - importResult={importParams.importResult} - onFinish={() => { - this.setState({ importParams: { ...importParams, step: 0, visible: false } }, () => { - this.specialAddDeductionList(); - localStorage.removeItem("fileList"); - }); - }} - previewImport={this.specialAddDeductionPreview} - importFile={this.specialAddDeductionImportData} - templateLink="/api/bs/hrmsalary/specialAddDeduction/downloadTemplate" - renderFormComponent={this.renderImportormComponent} - visiable={importParams.visible} - onCancel={() => { - localStorage.removeItem("fileList"); - this.setState({ - importParams: { - ...importParams, - step: 0, visible: false, - slideDataSource: [], importResult: [], - payload: { taxAgentId: "" } - } - }); - }} - /> - } -
-
-
+ + this.tableRef = dom} + url="/api/bs/hrmsalary/specialAddDeduction/list" + payload={tablePayload} + showOperateBtn={showOperateBtn} + onTableOperate={this.handleTableOperate} + onViewDetails={(record) => this.handleAddData("专项附加扣除记录", record)} + /> + ); } } -export default SpecialAddDeduction; - +export default Index; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less deleted file mode 100644 index 18e24685..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less +++ /dev/null @@ -1,98 +0,0 @@ -.specialAddWrapper { - height: 100%; - - .wea-new-top-wapper { - .specialAddContent { - height: 100%; - display: flex; - flex-direction: column; - overflow: hidden; - - .tableWrapper { - flex: 1; - overflow: hidden; - } - - .wea-tab-search-ad-quick { - .wea-tab-left { - display: flex; - align-items: center; - } - - .wea-tab-right { - margin-top: 0; - } - - .wea-search-container-search-ad-quick { - top: 47px !important; - } - } - } - } - - .linkWapper { - a { - color: #4d7ad8; - margin-right: 8px; - } - - i { - cursor: pointer; - } - - a:hover { - text-decoration: none; - } - } -} - -.moreIconWrapper { - .ant-popover-inner { - min-width: 106px - } - - .ant-popover-inner-content { - padding: 0; - - .ant-menu { - .ant-menu-item { - border-right: none; - height: 30px; - line-height: 30px; - text-align: center; - padding: 0; - } - } - } -} - -.specialAddSlideWrapper { - .wea-slide-modal-title { - height: initial; - line-height: initial; - text-align: left; - } - - .rodal-close { - z-index: 99; - top: 10px !important; - } - -} - -@media (min-width: 1260px) { - .specialAddSlideWrapper { - .reqTopWrapper .wea-new-top-req-title > div:first-child > div { - max-width: 100% !important; - } - } -} - -@media screen and (min-width: 1060px) and (max-width: 1260px) { - .specialAddSlideWrapper { - .reqTopWrapper .wea-new-top-req-title > div:first-child > div { - max-width: calc(100% - 96px) !important; - } - } -} - From ccb9297e6c22dc17db8f323f112b04555f07c63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 22 Feb 2023 13:36:59 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/UnifiedTable/index.js | 4 +- .../dataAcquisition/cumDeduct/indexcopy.js | 855 ------------------ .../hrmSalary/pages/dataAcquisition/layout.js | 4 +- pc4mobx/hrmSalary/pages/payrollFiles/index.js | 44 +- .../socialSecurityBenefits/archives/index.js | 41 +- .../standingBook/index.js | 58 +- 6 files changed, 69 insertions(+), 937 deletions(-) delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js diff --git a/pc4mobx/hrmSalary/components/UnifiedTable/index.js b/pc4mobx/hrmSalary/components/UnifiedTable/index.js index 4e6aa12e..8f406f4f 100644 --- a/pc4mobx/hrmSalary/components/UnifiedTable/index.js +++ b/pc4mobx/hrmSalary/components/UnifiedTable/index.js @@ -5,7 +5,7 @@ import "./index.less"; class Index extends Component { render() { - const { columns } = this.props; + const { columns, xWidth = 1440 } = this.props; const unifiedColumns = _.map(columns, (item, index) => { if (index === 0 || index === 2) { return { ...item, fixed: "left", width: 150 }; @@ -18,7 +18,7 @@ class Index extends Component { return { ...item, width: "33%" }; }); return ( - + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js deleted file mode 100644 index ff7727d5..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/indexcopy.js +++ /dev/null @@ -1,855 +0,0 @@ -import React from "react"; -import { inject, observer } from "mobx-react"; -import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; -import { WeaDatePicker, WeaHelpfulTip, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom"; -import moment from "moment"; -import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import ImportModal from "../../../components/importModal"; -import { dataCollectCondition, modalColumns } from "./columns"; -import { optionAddAll } from "../../../util/options"; -import SlideModalTitle from "../../../components/slideModalTitle"; -import EditSlideContent from "./components/editSlideContent"; -import AddItems from "../addItems"; -import * as API from "../../../apis/cumDeduct"; -import "./index.less"; - -@inject("cumDeductStore", "taxAgentStore") -@observer -export default class CumDeduct extends React.Component { - constructor(props) { - super(props); - this.state = { - addVisible: false, - editId: {}, - saveLoading: false, - addAllLoading: false, - value: "", - selectedKey: [], - slideSelectedKey: [], //详情表格的选中项 - visiable: false, - monthValue: moment(new Date()).format("YYYY-MM"), - taxAgentId: "All", - datetime: "", - inited: false, - modalParam: { - declareMonth: "", - taxAgentId: "" - } - }; - } - - componentWillMount() { - // 初始化渲染页面 - const { - cumDeductStore: { doInit, addForm }, - taxAgentStore: { fetchTaxAgentOption, getTaxAgentSelectListAsAdmin } - } = this.props; - addForm.initFormFields(dataCollectCondition); - doInit({ declareMonth: [this.state.monthValue], taxAgentId: "" }); - getTaxAgentSelectListAsAdmin(); - fetchTaxAgentOption().then((res) => { - this.setState({ - inited: true - }); - }); - } - - getSearchsAdQuick() { - const { monthValue, taxAgentId } = this.state; - const { - taxAgentStore: { taxAgentOption }, - cumDeductStore: { form, getTableDatas } - } = this.props; - return ( -
-
- 税款所属期: - { - this.setState({ monthValue: v }); - let params = {}; - if (taxAgentId == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = taxAgentId; - } - if (v != null && v != "") { - params.declareMonth = [v]; - } - getTableDatas(params); - }} - /> -
- -
- -
- -
- 个税扣缴义务人: - - { - this.state.inited && { - let params = {}; - if (v == "All") { - params.taxAgentId = ""; - } else { - params.taxAgentId = v; - } - if (monthValue != null && monthValue != "") { - params.declareMonth = [monthValue]; - } - getTableDatas(params); - this.setState({ taxAgentId: v }); - }} - /> - } -
-
- ); - } - - renderFormComponent() { - const { modalParam } = this.state; - const { - taxAgentStore: { taxAgentAdminOption } - } = this.props; - return ( - - - - 税款所属期 - - - this.setState({ - modalParam: { ...modalParam, declareMonth: value } - }) - } - /> - - - - 个税扣缴义务人 - - { - this.setState({ modalParam: { ...modalParam, taxAgentId: v } }); - }} - /> - - - ); - } - - onEdit = (record) => { - const { - cumDeductStore: { - slideVisiable, - setSlideVisiable, - getCumDeductDetailList, - setCurrentRecord - } - } = this.props; - setSlideVisiable(true); - setCurrentRecord(record); - getCumDeductDetailList(record.id, { taxAgentId: record.taxAgentId }); - }; - - // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { - let newColumns = ""; - newColumns = columns.map((column) => { - let newColumn = column; - newColumn.render = (text, record, index) => { - //前端元素转义 - let valueSpan = - record[newColumn.dataIndex + "span"] !== undefined - ? record[newColumn.dataIndex + "span"] - : record[newColumn.dataIndex]; - switch (newColumn.dataIndex) { - case "username": - return ( - { - this.onEdit(record); - }}> - {text} - - ); - case "operate": - return ( - { - this.onEdit(record); - }}> - 查看明细 - - ); - default: - return
; - } - }; - return newColumn; - }); - return newColumns; - }; - - handleCancel() { - const { cumDeductStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = cumDeductStore; - setModalVisiable(false); - setStep(0); - } - - onOperatesClick = (record, index, operate, flag) => { - switch (operate.index.toString()) { - case "0": // 查看明细 - this.onEdit(record); - break; - } - }; - - showColumn = () => { - const { - cumDeductStore: { tableStore } - } = this.props; - tableStore.setColSetVisible(true); - tableStore.tableColSet(true); - }; - - // 初始化导入参数 - handleInitModal() { - const { - cumDeductStore: { setSlideDataSource, setImportResult } - } = this.props; - setSlideDataSource([]); - setImportResult({}); - } - - onSelectChange = (val) => { - this.setState({ - selectedKey: val - }); - }; - - handleSearch = () => { - const { cumDeductStore: { getTableDatas } } = this.props; - const { monthValue, taxAgentId } = this.state; - let params = {}; - if (monthValue != null && monthValue !== "") { - params.declareMonth = [monthValue]; - } - if (taxAgentId != null && taxAgentId !== "" && taxAgentId !== "All") { - params.taxAgentId = taxAgentId; - } - getTableDatas({ ...params, current: 1 }); - }; - - //新功能 - handleSaveDeduction = (payload) => { - const { editId } = this.state; - this.setState({ saveLoading: true }); - if (!_.isEmpty(editId)) { - API.editAddUpDeduction({ ...payload, id: editId.id }).then(({ status, errormsg }) => { - this.setState({ saveLoading: false }); - if (status) { - message.success("编辑成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); - } else { - message.error(errormsg || "编辑失败"); - } - }); - } else { - API.createAddUpDeduction(payload).then(({ status, errormsg }) => { - this.setState({ saveLoading: false }); - if (status) { - message.success("新增成功"); - this.setState({ - addVisible: false, - editId: {} - }, () => { - const { cumDeductStore: { doSearch, addForm } } = this.props; - const { monthValue, taxAgentId } = this.state; - doSearch({ - declareMonth: [monthValue], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - addForm.resetForm(); - }); - } else { - message.error(errormsg || "新增失败"); - } - }); - } - }; - deleteSelectAddUpDeduction = () => { - const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - if (selectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const payload = { - declareMonth, - ids: selectedKey - }; - Modal.confirm({ - title: "信息确认", - content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", - onOk: () => { - API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - }, - onCancel: () => { - } - }); - - }; - deleteAllAddUpDeduction = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - const payload = { - declareMonth, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }; - Modal.confirm({ - title: "信息确认", - content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteAllAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - }; - handleOperate = ({ key }, row) => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - if (key === "edit") { - this.setState({ - addVisible: true - }, () => { - API.getAddUpDeduction({ id: row.id }).then(({ status, data }) => { - if (status) { - this.setState({ editId: data }); - } - }); - }); - } else if (key === "delete") { - const payload = { - declareMonth, - ids: [row.id] - }; - Modal.confirm({ - title: "信息确认", - content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, - onOk: () => { - API.deleteSelectAddUpDeduction(payload).then(({ status, errormsg }) => { - if (status) { - message.success("删除成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "删除失败"); - } - }); - } - }); - } - }; - autoAddAll = () => { - const { monthValue: declareMonth, taxAgentId } = this.state; - const { cumDeductStore: { doSearch } } = this.props; - this.setState({ addAllLoading: true }); - API.autoAddAll({ yearMonth: declareMonth }).then(({ status, data, errormsg }) => { - this.setState({ addAllLoading: false }); - if (status) { - message.success(data || "操作成功"); - doSearch({ - declareMonth: [declareMonth], - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - } else { - message.error(errormsg || "操作失败"); - } - }).catch(() => this.setState({ addAllLoading: false })); - }; - handleButtonClick = () => { - if (!this.handleChangeDebounce) { - this.handleChangeDebounce = _.debounce(this.handleChange, 500); - } - this.handleChangeDebounce(); - }; - - handleChange = e => { - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - }; - handleExportAllDetailClick = () => { - if (!this.handleChangeDebounce) { - const { - cumDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - } - this.handleChangeDebounce(); - }; - - render() { - const { - modalParam, - slideSelectedKey, - monthValue, - taxAgentId, - addVisible, - editId, - saveLoading, - addAllLoading - } = this.state; - const { cumDeductStore, taxAgentStore } = this.props; - const { - loading, - dataSource, - columns, - pageObj, - addForm, - form, - condition, - tableStore, - showSearchAd, - getTableDatas, - doSearch, - setShowSearchAd, - previewImport, - importFile - } = cumDeductStore; - const { taxAgentOption, showOperateBtn } = taxAgentStore; - const { - slideVisiable, - setSlideVisiable, - modalVisiable, - setModalVisiable, - slideTableStore, - step, - setStep, - slideDataSource, - importResult, - setPageObj - } = cumDeductStore; - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - - const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - - const rightMenu = [ - // 右键菜单 - // { - // key: "BTN_COLUMN", - // icon: , - // content: "显示列定制", - // onClick: this.showColumn, - // }, - ]; - const adBtn = [ - // 高级搜索内部按钮 - , - , - - ]; - - const topTab = []; - - const renderSearchOperationItem = () => { - return
; - }; - - const handleMenuClick = () => { - if (this.state.selectedKey.length == 0) { - message.warning("未选择条目"); - return; - } - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/export?ids=${this.state.selectedKey.join( - "," - )}&declareMonth=${this.state.monthValue}&taxAgentId=${this.state.taxAgentId == "All" - ? "" - : this.state.taxAgentId}`; - window.open(url, "_self"); - }; - - const handleBtnImport = () => { - const { - cumDeductStore: { setModalVisiable, setStep } - } = this.props; - setStep(0); - setModalVisiable(true); - }; - - const btns = [ - , - - 导出选中 - - } - type="ghost"> - 导出全部 - , - , - - 删除所选 - - } - type="ghost"> - 一键清空 - , - - ]; - - const handleExportSelectedDetailClick = () => { - if (this.state.slideSelectedKey.length === 0) { - message.warning("未选择条目"); - return; - } - const { - cumDeductStore: { currentRecord } - } = this.props; - const url = `${window.location - .origin}/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=${currentRecord.id}&ids=${this.state.slideSelectedKey.join(",")}&taxAgentId=${currentRecord.taxAgentId}`; - window.open(url, "_self"); - }; - - const renderBtns = () => { - return [ - - 导出选中 - - } - type="primary"> - 导出全部 - - ]; - }; - - const pagination = { - total: pageObj.total, - showTotal: (total) => `共 ${total} 条`, - pageSizeOptions: ["10", "20", "50", "100"], - showSizeChanger: true, - onShowSizeChange(current, pageSize) { - setPageObj({ ...pageObj, current, pageSize }); - getTableDatas({ - current, - pageSize, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - }, - onChange(current) { - setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); - getTableDatas({ - current, - pageSize: pageObj.pageSize, - taxAgentId: taxAgentId === "All" ? "" : taxAgentId, - declareMonth: monthValue && [monthValue] - }); - } - }; - const rowSelection = { - selectedRowKeys: this.state.selectedKey, - onChange: this.onSelectChange - }; - const newColumns = _.map([...columns], (item) => { - if (item.dataIndex === "username") { - return { - ...item, - width: 100, - fixed: "left", - render: (text, record) => ( - - ) - }; - } else if (item.dataIndex === "taxAgentName") { - return { - ...item, - width: 180, - fixed: "left" - }; - } else if (item.dataIndex === "operate") { - return { - ...item, - width: 120, - fixed: "right", - render: (text, record) => ( -
- this.onEdit(record)}> - 查看明细 - - { - showOperateBtn && - this.handleOperate(e, record)}> - 编辑 - 删除 - } title=""> - - - } -
- ) - }; - } else { - return { ...item, width: 150 }; - } - }); - if (_.isEmpty(newColumns)) { - return renderLoading(); - } - return ( -
- } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - buttons={showOperateBtn ? btns : []} - > -
- setShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 - buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={(v) => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 - searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 - /> -
-
- - - -
-
- {modalVisiable && ( - { - this.handleInitModal(); - }} - onValidate={() => { - this.handleValidate(); - }} - params={modalParam} - columns={modalColumns} - step={step} - setStep={setStep} - slideDataSource={slideDataSource} - importResult={importResult} - onFinish={() => { - setModalVisiable(false); - setStep(0); - doSearch({ - declareMonth: this.state.monthValue ? [this.state.monthValue] : "", - taxAgentId: taxAgentId === "All" ? "" : taxAgentId - }); - }} - previewImport={(params) => { - previewImport(params); - }} - importFile={(params) => { - importFile(params); - }} - templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { - this.handleCancel(); - }} - /> - )} - - {(slideVisiable || addVisible) && ( - { - const { baseInfo } = this.addItemRef.state; - const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); - if (!bool && _.isEmpty(editId)) { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); - return; - } - const payload = { - ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), - ...addForm.getFormParams() - }; - this.handleSaveDeduction(payload); - }} - editable={!!addVisible} - showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} - /> - } - content={ - addVisible ? - this.addItemRef = dom} - taxAgentOption={taxAgentOption} - form={addForm} - editId={editId} - condition={dataCollectCondition} - /> : - - this.setState({ slideSelectedKey: val }) - } - /> - } - onClose={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - showMask={true} - closeMaskOnClick={() => { - setSlideVisiable(false); - this.setState({ - addVisible: false, - editId: {} - }); - }} - /> - )} -
- ); - } -} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js index 43cbe828..3fe21509 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -62,7 +62,7 @@ class Layout extends Component { const { visible, title: subtitle, children: slideChildren } = slidePayload; const { visible: importVisiable, step, importFormComponent, importOpts, - importResult, slideDataSource + importResult, slideDataSource, templateLink } = importPayload; return (
@@ -96,7 +96,7 @@ class Layout extends Component { slideDataSource={slideDataSource} previewImport={onPreviewImport} importFile={onImportFile} - templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} + templateLink={templateLink} renderFormComponent={() => importFormComponent} visiable={importVisiable} onCancel={onCancel} diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/index.js index 960efb1b..fa245b51 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/index.js @@ -20,7 +20,6 @@ import { WeaSelect, WeaSlideModal, WeaTab, - WeaTable, WeaTop } from "ecCom"; import { WeaTableNew } from "comsMobx"; @@ -33,6 +32,7 @@ import SlideModalTitle from "../../components/slideModalTitle"; import SalaryFileViewSlide from "../salaryFile/saralyFileViewSlide"; import ChangeSalaryModal from "../salaryFile/changeSalaryModal"; import "./index.less"; +import UnifiedTable from "../../components/UnifiedTable"; const WeaTableComx = WeaTableNew.WeaTable; @@ -445,29 +445,19 @@ class Index extends Component { return []; }; getColumns = () => { - const { pageInfo, selectedKey } = this.state; + const { selectedKey } = this.state; const { payrollFilesStore: { tableStore }, taxAgentStore: { showOperateBtn } } = this.props; let columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true"); return _.map([ - // { - // title: "序号", - // dataIndex: "index", - // align: "left", - // oldWidth: 60, - // render: (text, record, index) => { - // const { current, pageSize } = pageInfo; - // return (current - 1) * pageSize + index + 1; - // } - // }, - ...columns], (item, index) => { + ...columns], item => { if (item.dataIndex === "username") { return { ...item, - width: item.oldWidth, render: (text, record) => { return window.pointerXY(e)} + className="ellipsis" title={text} > {text} @@ -477,8 +467,6 @@ class Index extends Component { } else if (item.dataIndex === "operate") { return { ...item, - fixed: "right", - width: 150, render: (text, record) => { if (!showOperateBtn) { return
@@ -532,9 +520,8 @@ class Index extends Component { } return { ...item, - width: item.oldWidth, render: (text) => { - return {text}; + return {text}; } }; }); @@ -793,14 +780,25 @@ class Index extends Component { />
- record.archiveStatus === "ARCHIVE" ? "archiveRow" : ""} + loading={loading.query} + columns={this.getColumns()} + dataSource={dataSource} + pagination={pagination} rowSelection={rowSelection} - scroll={{ x: 1200 }} + xWidth={this.getColumns().length * 120} /> + {/* record.archiveStatus === "ARCHIVE" ? "archiveRow" : ""}*/} + {/* // rowSelection={rowSelection}*/} + {/* // scroll={{ x: 1200 }}*/} + {/*/>*/} {/*人员卡片*/} item.display === "TRUE"), (item, index) => { - if (index === 0) { - return { - ...item, dataIndex: item.column, - fixed: "left", - title: item.text - }; - } + let tmpV = _.map(columns.filter(item => item.display === "TRUE"), item => { return { ...item, - dataIndex: - item.column, + dataIndex: item.column, title: item.text, render: (text) => { - return {text}; + return {text}; } }; }); return tmpV.length > 0 ? [ - // { - // title: "序号", - // dataIndex: "index", - // width: 60, - // fixed: "left", - // render: (text, record, index) => { - // const { current, pageSize } = pageInfo; - // return (current - 1) * pageSize + index + 1; - // } - // }, ...tmpV, { title: "操作", dataIndex: "operate", - fixed: "right", - width: "120px", render: (text, record) => { return (
@@ -762,12 +743,14 @@ export default class Archives extends React.Component { />
- { !_.isEmpty(this.getColumns()) && diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js index dbfec775..9e41557a 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js @@ -2,15 +2,15 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, DatePicker, Dropdown, Menu, message, Modal } from "antd"; import { WeaNewScroll, WeaTop } from "ecCom"; -import { renderNoright } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import { renderNoright } from "../../../util"; import Accountdialog from "./components/accountDialog"; import AbnormalDrawer from "./components/abnormalDrawer"; -import CustomPaginationTable from "../../../components/customPaginationTable"; import moment from "moment"; import _ from "lodash"; import ProgressModal from "../../../components/progressModal"; import { getCalculateProgress } from "../../../apis/calculate"; import "./index.less"; +import UnifiedTable from "../../../components/UnifiedTable"; const MonthPicker = DatePicker.MonthPicker; @@ -138,9 +138,8 @@ export default class StandingBook extends React.Component { ...columns, { title: "操作", - dataIndex: "action", - key: "action", - fixed: "right", + dataIndex: "operate", + key: "operate", render: (text, r) => { const { billStatus, billMonth, creator } = r; return ( @@ -441,6 +440,22 @@ export default class StandingBook extends React.Component { 核算 ]; + const pagination = { + ...this.pageInfo, + total: total, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions: ["10", "20", "50", "100"], + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange: (current, pageSize) => { + this.pageInfo = { ...this.pageInfo, current, pageSize }; + this.handleShowSizeChange(this.pageInfo); + }, + onChange: (current) => { + this.pageInfo = { ...this.pageInfo, current }; + this.handleShowSizeChange(this.pageInfo); + } + }; return (
@@ -472,31 +487,22 @@ export default class StandingBook extends React.Component {
- it.dataIndex !== "id").map(item => { - item.width = "150px"; - if (item.dataIndex === "billMonth") item.fixed = "left"; - if (item.dataIndex === "action") return { ...item }; - return { - ...item, - render: (text) => { - return {text}; - } - }; + if (item.dataIndex !== "operate") { + return { + ...item, + render: (text) => { + return {text}; + } + }; + } + return { ...item }; })} dataSource={list} - total={total} - current={this.state.current} - pageSize={this.pageInfo.pageSize} - onPageChange={(current) => { - this.handleShowSizeChange({ ...this.pageInfo, current }); - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = { current, pageSize }; - this.handleShowSizeChange(this.pageInfo); - }} - scroll={{ x: 2300 }} + pagination={pagination} + xWidth={columns.length * 120} />
From a77c8009952881c54193441467b73eb09400ccc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 22 Feb 2023 14:00:34 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/cumDeduct/index.js | 5 +- .../dataAcquisition/cumSituation/index.js | 5 +- .../pages/dataAcquisition/dataTables.js | 43 +++++++++++----- .../dataAcquisition/otherDeduct/index.js | 5 +- .../specialAddDeduction/index.js | 50 ++----------------- 5 files changed, 44 insertions(+), 64 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 7999bc35..6b719b11 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -47,6 +47,7 @@ class Index extends Component { }, importFormComponent: null, step: 0, + templateLink: "/api/bs/hrmsalary/addUpDeduction/downloadTemplate", importResult: {}, slideDataSource: [] }, @@ -435,13 +436,13 @@ class Index extends Component { message.warning("请选择需要导出的数据"); return; } - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=${ids.join(",")}`; this.handleExportDetail(payload); }; handleExportAllDetail = () => { const { recordPayload } = this.tableRecordRef.state; - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=`; this.handleExportDetail(payload); }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index d49ff237..15561afc 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -53,6 +53,7 @@ class Index extends Component { }, importFormComponent: null, step: 0, + templateLink: "/api/bs/hrmsalary/addUpSituation/downloadTemplate", importResult: {}, slideDataSource: [] }, @@ -488,13 +489,13 @@ class Index extends Component { message.warning("请选择需要导出的数据"); return; } - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=${ids.join(",")}`; this.handleExportDetail(payload); }; handleExportAllDetail = () => { const { recordPayload } = this.tableRecordRef.state; - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=`; this.handleExportDetail(payload); }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index fd7cade5..b3600cff 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, onViewDetails } = this.props; + const { showOperateBtn, onTableOperate, onViewDetails, isSpecial = false } = this.props; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) @@ -106,18 +106,37 @@ class DataTables extends Component { ...item, render: (text, record) => (
- onViewDetails(record)}>查看明细 { - showOperateBtn && - onTableOperate(e, record)}> - 编辑 - 删除 - } title=""> - - + !isSpecial && + + onViewDetails(record)}>查看明细 + { + showOperateBtn && + onTableOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } + + } + { + isSpecial && + + { + showOperateBtn && + + onTableOperate({ key: "handleAddData" }, record)}>编辑 + onTableOperate({ key: "deleteSelectAddUpDeduction" }, record)}>删除 + + } + }
) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index 3930168a..780dcf6d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -53,6 +53,7 @@ class Index extends Component { }, importFormComponent: null, step: 0, + templateLink: "/api/bs/hrmsalary/otherDeduction/downloadTemplate", importResult: {}, slideDataSource: [] }, @@ -486,13 +487,13 @@ class Index extends Component { message.warning("请选择需要导出的数据"); return; } - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=${ids.join(",")}`; this.handleExportDetail(payload); }; handleExportAllDetail = () => { const { recordPayload } = this.tableRecordRef.state; - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); + const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `${pre && "&"}${cur}=${recordPayload[cur]}`, ""); const payload = `?${exportParams}&ids=`; this.handleExportDetail(payload); }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index 92460e95..94d384b9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -43,6 +43,7 @@ class Index extends Component { }, importFormComponent: null, step: 0, + templateLink: "/api/bs/hrmsalary/specialAddDeduction/downloadTemplate", importResult: {}, slideDataSource: [] }, @@ -407,55 +408,11 @@ class Index extends Component { importPayload: { ...importPayload, step } }); }; - /* - * Author: 黎永顺 - * Description:详情页面相关-操作按钮 - * Params: - * Date: 2023/2/20 - */ - getDetailOptBtns = () => { - return [ - - 导出选中 - } - type="primary"> - 导出全部 - - ]; - }; - handleExportDetail = (url) => { - if (!this.handleDebounce) { - this.handleDebounce = _.debounce(() => { - window.open(`${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export${url}`, "_self"); - this.handleDebounce = null; - }, 500); - } - this.handleDebounce(); - }; - handleExportSelectDetail = () => { - const { selectedRowKeys: ids, recordPayload } = this.tableRecordRef.state; - if (ids.length === 0) { - message.warning("请选择需要导出的数据"); - return; - } - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); - const payload = `?${exportParams}&ids=${ids.join(",")}`; - this.handleExportDetail(payload); - }; - handleExportAllDetail = () => { - const { recordPayload } = this.tableRecordRef.state; - const exportParams = _.reduce(_.keys(_.omitBy(recordPayload, it => !it)), (pre, cur) => pre + `&${cur}=${recordPayload[cur]}`, ""); - const payload = `?${exportParams}&ids=`; - this.handleExportDetail(payload); - }; render() { const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props; const { - declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, - importPayload + taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, importPayload } = this.state; const tablePayload = { taxAgentId }; return ( @@ -466,12 +423,13 @@ class Index extends Component { form={advanceForm} condition={advanceCondition} onAdSearch={this.handleAdSearch} onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport} importPayload={importPayload} onImportFile={this.handleImportFile} - onPreviewImport={this.handlePreviewImport} detailOptBtns={this.getDetailOptBtns()} + onPreviewImport={this.handlePreviewImport} detailOptBtns={[]} > this.tableRef = dom} url="/api/bs/hrmsalary/specialAddDeduction/list" payload={tablePayload} + isSpecial showOperateBtn={showOperateBtn} onTableOperate={this.handleTableOperate} onViewDetails={(record) => this.handleAddData("专项附加扣除记录", record)}