From bfc9f1363c5f4c3c592d7e9f9c32b795ea477b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 17 Aug 2023 08:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E5=AF=B9=E6=8E=A5-=E8=96=AA?= =?UTF-8?q?=E8=B5=84=E8=B4=A6=E5=A5=97=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AF=B9=E5=BA=94=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/index.js | 6 ++ .../ledgerPage/components/incomeTaxFields.js | 98 ++++++++++++++++-- .../pages/ledgerPage/components/index.less | 57 ++++++++++- .../components/ledgerFieldsItemPopver.js | 99 +++++++++++++++++++ .../components/ledgerFieldsTable.js | 35 +++++++ .../ledgerPage/components/ledgerSlide.js | 53 ++++++++-- 6 files changed, 334 insertions(+), 14 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsItemPopver.js create mode 100644 pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsTable.js diff --git a/pc4mobx/hrmSalary/apis/index.js b/pc4mobx/hrmSalary/apis/index.js index 854c9bf6..bec52975 100644 --- a/pc4mobx/hrmSalary/apis/index.js +++ b/pc4mobx/hrmSalary/apis/index.js @@ -1,4 +1,5 @@ import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; // form基础数据 export const getBaseForm = (params) => { @@ -19,3 +20,8 @@ export const getCondition = (params) => { export const getTableDatas = (params) => { return WeaTools.callApi("/api/demo03/weatableDemo", "GET", params); }; + +// 薪资账套-浏览按钮数据 +export const commonBrowserData = (params) => { + return postFetch("/api/bs/hrmsalary/common/browser/data", params); +}; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js index e72d81db..be71c342 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js @@ -5,15 +5,20 @@ * Date: 2023/2/16 */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import { WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaTab } from "ecCom"; +import LedgerFieldsItemPopver from "./ledgerFieldsItemPopver"; import { taxreportruleGetForm } from "../../../apis/ledger"; +import LedgerFieldsTable from "./ledgerFieldsTable"; const { getLabel } = WeaLocaleProvider; class IncomeTaxFields extends Component { constructor(props) { super(props); - this.state = {}; + this.state = { + selectedKey: "", tabs: [], + incomeTaxFields: [], + }; } componentDidMount() { @@ -23,16 +28,97 @@ class IncomeTaxFields extends Component { taxreportruleGetForm = () => { const { editId, saveSalarySobId } = this.props; taxreportruleGetForm({ id: saveSalarySobId || editId }).then(({ status, data }) => { - if (status) { - console.log(data); + if (status && !_.isEmpty(data)) { + this.setState({ + tabs: _.map(data, it => ({ viewcondition: it.incomeCategoryId, title: it.incomeCategoryName })), + selectedKey: _.take(data)[0].incomeCategoryId, + incomeTaxFields: data + }); } }); }; + handleChangeSwitch = (visible, id) => { + const { incomeTaxFields, selectedKey } = this.state; + this.setState({ + incomeTaxFields: _.map(incomeTaxFields, it => { + if (it.incomeCategoryId === selectedKey) { + return { + ...it, + taxReportRules: _.map(it.taxReportRules, child => { + if (child.id === id) { + return { ...child, visible }; + } + return { ...child, visible: false }; + }) + }; + } + return { ...it }; + }) + }); + }; + handleChangeIncomeFieldsItem = (salaryItem, recordRuleId) => { + const { incomeTaxFields, selectedKey } = this.state; + this.setState({ + incomeTaxFields: _.map(incomeTaxFields, it => { + if (it.incomeCategoryId === selectedKey) { + return { + ...it, + taxReportRules: _.map(it.taxReportRules, child => { + if (child.id === recordRuleId) { + return { ...child, visible: false, salaryItem: [salaryItem] }; + } + return { ...child, visible: false }; + }) + }; + } + return { ...it }; + }) + }); + }; render() { + const { editId, saveSalarySobId } = this.props; + const { selectedKey, tabs, incomeTaxFields, visible } = this.state; + const dataSource = _.takeWhile(incomeTaxFields, it => it.incomeCategoryId === selectedKey); return ( - 个税申报字段对应} showGroup needTigger={false}> - + + + + } + > + + {getLabel(111, "个税申报表字段")} + + , + width: "50%", + dataIndex: "reportColumnName" + }, + { + title: getLabel(111, "对应本账套薪资项目"), + width: "50%", + dataIndex: "salaryItem", + render: (_, record) => ( + + ) + } + ]} + dataSource={dataSource} + /> ); } diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/index.less b/pc4mobx/hrmSalary/pages/ledgerPage/components/index.less index b0f3e1b0..3d1d5d05 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/index.less +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/index.less @@ -233,7 +233,6 @@ color: #55a1f8; } - .moveModalWrapper { .ant-radio-group { display: flex; @@ -244,3 +243,59 @@ } } } + +//个税申报字段对应 +.incomeWrapper { + padding: 0; + + .wea-content { + padding: 10px 16px; + } +} + +.income_pop_wrapper .ant-popover-inner-content { + padding: 8px; +} + +.income_pop_wrapper { + width: 180px !important; +} + +.income_result_wrapper { + display: flex; + flex-direction: column; + min-height: 80px; + max-height: 250px; + overflow-y: auto; +} + +.income_result_wrapper li { + line-height: 30px; + cursor: pointer; +} + +.income_result_wrapper li:not(.emptyLi):hover { + background: #e9f7ff; +} + +.income_result_wrapper li.emptyLi { + text-align: center; + + .anticon-inbox { + color: #5d9cec; + font-size: 24px; + } +} + +.incomeSearchGroup { + input { + border-right: none; + } + + button { + border-left: none; + border-radius: 0; + height: 28px; + line-height: 28px; + } +} diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsItemPopver.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsItemPopver.js new file mode 100644 index 00000000..1d206a80 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsItemPopver.js @@ -0,0 +1,99 @@ +/* + * Author: 黎永顺 + * name: 薪资账套-申报字段对应查询弹框 + * Description: + * Date: 2023/8/16 + */ +import React, { Component } from "react"; +import { Button, Icon, Input, Popover } from "antd"; +import { WeaLocaleProvider } from "ecCom"; +import { commonBrowserData } from "../../../apis"; + +const { getLabel } = WeaLocaleProvider; +const InputGroup = Input.Group; + +class LedgerFieldsItemPopver extends Component { + constructor(props) { + super(props); + this.state = { + dataList: [], + keywords: "" + }; + this.handleDebounce = null; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.record !== this.props.record && nextProps.record.visible) { + this.commonBrowserData(nextProps); + } else { + this.setState({ dataList: [] }); + } + } + + commonBrowserData = (props) => { + const { salarySobId } = props; + const { keywords } = this.state; + const payload = { + type: "salaryItemBrowser", + jsonParam: JSON.stringify({ salarySobId, key: keywords }) + }; + commonBrowserData(payload).then(({ status, data }) => { + if (status) { + const { list: dataList } = data; + this.setState({ dataList }); + } + }); + }; + handleSearch = () => { + if (!this.handleDebounce) { + this.handleDebounce = _.debounce(() => { + this.commonBrowserData(this.props); + this.handleDebounce = null; + }, 500); + } + this.handleDebounce(); + }; + handleClickItem = (item) => { + this.setState({ + keywords: item.name + }, () => this.props.onChange(item, this.props.record.id)); + }; + + render() { + const { keywords, dataList } = this.state; + const { record, onChangeSwitch } = this.props; + const salaryItemName = record.salaryItem[0] ? record.salaryItem[0].name : ""; + return ( + + { + !_.isEmpty(dataList) ? + _.map(dataList, it => (
  • this.handleClickItem(it)}>{it.name}
  • )) : +
  • + +

    {getLabel(83553, "暂无数据")}

    +
  • + } + + } trigger="click" placement="right" overlayClassName="income_pop_wrapper" + visible={record.visible} + onVisibleChange={(visible) => onChangeSwitch(visible, record.id)} + > + + onChangeSwitch(true, record.id)} style={{ width: "auto" }} + onChange={(e) => this.setState({ keywords: e.target.value }, () => this.handleSearch())} + /> + ] : [ - + ]; break; case 6: