From f05c43d0113def7bd61b59e777017cd9ee4e9cf9 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, 12 Aug 2024 14:58:36 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.15.1.2407.01-=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E8=96=AA=E9=85=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/variableSalary.js | 6 +- .../components/advanceInputBtn/index.js | 2 +- .../components/advanceInputBtn/index.less | 4 +- .../components/salaryFileDialog/index.js | 35 ++++++----- .../salaryFileImportDialog/index.js | 14 +++-- .../components/salaryFileList/index.js | 10 ++-- .../pages/variableSalary/conditions.js | 22 +++++-- .../hrmSalary/pages/variableSalary/index.js | 60 +++++++++++++------ 8 files changed, 100 insertions(+), 53 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index c3e3f20a..d172c984 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -1,3 +1,4 @@ +import { WeaTools } from "ecCom"; import { postFetch } from "../util/request"; //浮动薪酬项目列表 @@ -41,4 +42,7 @@ export const deleteVariableSalary = params => { export const getVariableSalaryDetail = params => { return postFetch("/api/bs/hrmsalary/variableSalary/getDetail", params); }; - +// 获取当前管理员下的所有的个税扣缴义务人 +export const getAdminTaxAgentList = () => { + return WeaTools.callApi("/api/bs/hrmsalary/siaccount/getAdminTaxAgentList", "get", {}); +}; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js index 9ef6b2d2..8c0983da 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js @@ -18,7 +18,7 @@ class Index extends Component { render() { const { baseTableStore: { VSalryForm }, searchType } = this.props; return ( -
+
VSalryForm.updateFields({ username: v })} onSearch={this.props.onAdvanceSearch} diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less index ba4f56fc..f301e571 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -1,11 +1,11 @@ -.salaryItem-advance-search { +.variable-advance-search { display: flex; align-items: center; position: relative; top: -1.5px; .wea-advanced-search { - top: 2px; + top: 1px; left: -1px; height: 28px; line-height: 1; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js index 8bcb1e80..281fa13a 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -39,16 +39,24 @@ class Index extends Component { } initForm = (props) => { - const { baseTableStore: { VSSalaryFileForm }, detail } = props; - API.getCreateForm().then(({ status, data }) => { + const { baseTableStore: { VSSalaryFileForm }, detail, taxAgentOption } = props; + API.getCreateForm().then(({ data }) => { this.setState({ conditions: [ ..._.map(salaryFileConditions, item => ({ ...item, - items: _.map(item.items, o => ({ - ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), - value: detail[getKey(o)] || "" - })) + items: _.map(item.items, o => { + if (getKey(o) === "taxAgentIds") { + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + options: taxAgentOption, value: detail[getKey(o)] || "" + }; + } + return { + ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), + value: detail[getKey(o)] || "" + }; + }) })), { items: _.map(data, o => ({ @@ -79,12 +87,11 @@ class Index extends Component { }); }; convertPayload = (payload) => { + const itemValueList = []; return _.reduce(_.keys(payload), (pre, cur) => { if (!_.isNaN(parseInt(cur))) { - const itemValueList = pre.variableItemId || []; - return { - ...pre, itemValueList: [...itemValueList, { variableItemId: cur, itemValue: payload[cur] }] - }; + itemValueList.push({ variableItemId: cur, itemValue: payload[cur] }); + return { ...pre, itemValueList }; } return { ...pre, [cur]: payload[cur] }; }, {}); @@ -94,15 +101,13 @@ class Index extends Component { VSSalaryFileForm.validateForm().then(f => { if (f.isValid) { const payload = VSSalaryFileForm.getFormParams(); - console.log(payload, this.convertPayload(payload)); - return; this.setState({ loading: true }); - API.createVariableSalary({ ...payload, id }) + API.createVariableSalary({ ...this.convertPayload(payload), id }) .then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success(getLabel(30700, "操作成功")); - this.props.onCancel(onSearch()); + this.props.onClose(onSearch()); } else { message.error(errormsg); } @@ -129,7 +134,7 @@ class Index extends Component { }; render() { - const { conditions, loading } = this.state; + const { conditions } = this.state; const { baseTableStore: { VSSalaryFileForm }, onClose } = this.props; return ( onClose()} diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js index 5b8f023d..30268183 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -30,9 +30,9 @@ class Index extends Component { componentWillReceiveProps(nextProps, nextContext) { const { importDialog } = this.state; if (nextProps.visible !== this.props.visible && nextProps.visible) { - const { baseTableStore: { VSalryForm }, salaryMonth } = nextProps; + const { baseTableStore: { VSalryForm }, salaryMonth, taxAgentIds } = nextProps; const payload = { - salaryMonth, ...VSalryForm.getFormParams(), hasData: importDialog.hasData + salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: importDialog.hasData }; this.setState({ importDialog: { ...importDialog, link: `${importDialog.link}?${convertToUrlString(payload)}` } }); } else { @@ -46,10 +46,12 @@ class Index extends Component { } handleImport = (payload) => { - const { salaryMonth } = this.props; + const { salaryMonth, taxAgentIds } = this.props; const { importDialog } = this.state; this.setState({ importDialog: { ...importDialog, nextloading: true } }); - API.importVariableSalary({ ...payload, salaryMonth }).then(({ data, status }) => { + API.importVariableSalary({ + ...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") + }).then(({ data, status }) => { this.setState({ importDialog: { ...importDialog, nextloading: false } }); if (status) { this.setState({ @@ -73,8 +75,8 @@ class Index extends Component { content={getLabel(543208, "导出现有数据")} helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")} onChange={val => { - const { baseTableStore: { VSalryForm }, salaryMonth } = this.props; - const payload = { salaryMonth, ...VSalryForm.getFormParams(), hasData: val === "1" }; + const { baseTableStore: { VSalryForm }, salaryMonth, taxAgentIds } = this.props; + const payload = { salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: val === "1" }; this.setState({ importDialog: { ...importDialog, hasData: val === "1", diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js index 0756b644..ba166f77 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -65,13 +65,13 @@ class Index extends Component { } }; getVariableSalaryList = () => { - const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth } = this.props; + const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth, taxAgentIds } = this.props; const { pageInfo } = this.state; const { departmentIds } = VSalryForm.getFormParams(); this.setState({ loading: true }); getVariableSalaryList({ - ...pageInfo, salaryMonth, ...VSalryForm.getFormParams(), - departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] + ...pageInfo, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(","), + ...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] }).then(({ status, data }) => { this.setState({ loading: false }); if (status) { @@ -113,7 +113,7 @@ class Index extends Component { })); if (!_.isEmpty(columns)) { this.postMessageToChild({ - columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 100, + columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 98, pageInfo: this.state.pageInfo, unitTableType: "variableSalary" }); } @@ -135,7 +135,7 @@ class Index extends Component { const dom = document.querySelector(".wea-new-top-req-content"); let height = 280; if (dom && dataSource.length > 0) { - height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 39 + 113 : dataSource.length < 10 ? dataSource.length * 39 + 113 : parseFloat(dom.style.height) - 16; + height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 46 + 108 : dataSource.length < 10 ? dataSource.length * 46 + 108 : parseFloat(dom.style.height) - 16; } return ( diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index 98ecd684..72ff44cf 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -108,14 +108,26 @@ export const salaryFileConditions = [ { conditionType: "MONTHPICKER", domkey: ["salaryMonth"], - fieldcol: 14, + fieldcol: 16, label: "薪资所属月", lanId: 111, - labelcol: 6, + labelcol: 8, value: "", rules: "required|string", viewAttr: 3 }, + { + conditionType: "SELECT", + domkey: ["taxAgentIds"], + fieldcol: 16, + label: "个税扣缴义务人", + lanId: 111, + labelcol: 8, + value: "", + options: [], + rules: "required|string", + viewAttr: 3 + }, { browserConditionParam: { completeParams: {}, @@ -140,16 +152,16 @@ export const salaryFileConditions = [ }, conditionType: "BROWSER", domkey: ["employeeId"], - fieldcol: 14, + fieldcol: 16, label: "人员", lanId: 111, - labelcol: 6, + labelcol: 8, value: "", rules: "required|string", viewAttr: 3 } ], - title: "", col: 1, + title: "", col: 2, defaultshow: true } ]; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index 4210d4c1..ad97078c 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -9,7 +9,8 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaDatePicker, WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { WeaDatePicker, WeaLocaleProvider, WeaReqTop, WeaSelect } from "ecCom"; +import * as API from "../../apis/variableSalary"; import AdvanceInputBtn from "./components/advanceInputBtn"; import SearchPannel from "./components/searchPannel"; import SalaryItemDialog from "./components/salaryItemDialog"; @@ -31,14 +32,27 @@ class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "salaryFile", isQuery: false, showSearchAd: false, - salaryMonth: moment(new Date()).format("YYYY-MM"), - SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框 - SFDialog: { visible: false, title: "", detail: {} }, //薪资档案编辑弹框 + selectedKey: "salaryFile", isQuery: false, showSearchAd: false, taxAgentIds: "", + salaryMonth: moment(new Date()).format("YYYY-MM"), taxAgentOption: [], + SIDialog: { visible: false, title: "", id: "", taxAgentOption: [] }, //薪资项目薪资编辑弹框 + SFDialog: { visible: false, title: "", detail: {}, taxAgentOption: [] }, //薪资档案编辑弹框 SFImpDialog: { visible: false, title: getLabel(24023, "数据导入") }//薪资档案导入 }; } + componentDidMount() { + API.getAdminTaxAgentList().then(({ status, data }) => { + if (status) { + const taxAgentOption = _.map(data, (o, i) => ({ key: String(o.id), showname: o.name })); + this.setState({ + taxAgentOption, taxAgentIds: _.map(taxAgentOption, o => o.key).join(","), + SIDialog: { ...this.state.SIDialog, taxAgentOption }, + SFDialog: { ...this.state.SFDialog, taxAgentOption } + }); + } + }); + } + handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery }); openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd }); handleOperate = (type, detail = {}) => { @@ -46,7 +60,7 @@ class Index extends Component { case "create": this.setState({ SFDialog: { - visible: true, detail, + ...this.state.SFDialog, visible: true, detail, title: _.isEmpty(detail) ? getLabel(111, "新增薪资档案") : getLabel(111, "查看薪资档案") } }); @@ -56,8 +70,8 @@ class Index extends Component { break; case "export": const { baseTableStore: { VSalryForm } } = this.props; - const { salaryMonth } = this.state; - const payload = { salaryMonth, ...VSalryForm.getFormParams() }; + const { salaryMonth, taxAgentIds } = this.state; + const payload = { salaryMonth, taxAgentIds, ...VSalryForm.getFormParams() }; window.open(`/api/bs/hrmsalary/variableSalary/export?${convertToUrlString(payload)}`, "_blank"); break; default: @@ -66,29 +80,37 @@ class Index extends Component { }; render() { - const { selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery, salaryMonth } = this.state; + const { + selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery, salaryMonth, taxAgentOption, taxAgentIds + } = this.state; const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props; const tabs = [ { - title: getLabel(111, "薪资档案"), key: "salaryFile", + title: getLabel(111, "薪资档案"), key: "salaryFile", showDropIcon: showOperateBtn, + dropMenuDatas: showOperateBtn ? [{ + key: "export", icon: , content: getLabel(111, "导出") + }] : [], buttons: showOperateBtn ? [ , , - , this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>, + this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>, this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> ] : [ this.setState({ salaryMonth: val })}/>, + this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>, this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> ], - children: this.handleOperate("create", data)}/> }, { - title: getLabel(111, "薪资项目"), key: "salaryItem", + title: getLabel(111, "薪资项目"), key: "salaryItem", showDropIcon: false, dropMenuDatas: [], buttons: showOperateBtn ? [