From 7980acc6c253864d8167cf5d6ffb0d7737f39338 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, 14 Oct 2024 14:20:02 +0800 Subject: [PATCH 01/11] release/2.15.2.2409.01 --- .../components/salaryFileDialog/index.js | 15 ++-- .../salaryFileImportDialog/index.js | 22 +++--- .../components/salaryFileList/index.js | 26 ++++--- .../components/searchPannel/index.js | 16 ++++- .../pages/variableSalary/conditions.js | 26 ++++++- .../hrmSalary/pages/variableSalary/index.js | 72 ++++++++----------- .../hrmSalary/pages/variableSalary/index.less | 6 +- 7 files changed, 107 insertions(+), 76 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js index 1635c3a4..d0b0d7f4 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -38,8 +38,9 @@ class Index extends Component { } } - initForm = (props) => { - const { baseTableStore: { VSSalaryFileForm }, detail, taxAgentOption } = props; + initForm = async (props) => { + const { baseTableStore: { VSSalaryFileForm }, detail } = props; + const { data: taxAgentOption } = await API.getAdminTaxAgentList(); API.getCreateForm().then(({ data }) => { this.setState({ conditions: [ @@ -48,7 +49,8 @@ class Index extends Component { if (getKey(o) === "taxAgentIds") { return { ...o, viewAttr: !_.isEmpty(detail) ? 1 : 3, label: getLabel(o.lanId, o.label), - options: taxAgentOption, value: detail[getKey(o)] || "" + value: detail[getKey(o)] || "", + options: _.map(taxAgentOption, (o, i) => ({ key: o.id, showname: o.content })) }; } return { @@ -65,7 +67,7 @@ class Index extends Component { label: o.name, labelcol: 6, value: detail[`${String(o.id)}_variableItem`] || "", - viewAttr: !_.isEmpty(detail) ? 1 : 2 + viewAttr: 2 })), title: "", col: 2, defaultshow: true @@ -124,10 +126,7 @@ class Index extends Component {
{title}
- { - _.isEmpty(detail) && - - } +
; }; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js index c8917e45..53a96c2b 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -30,12 +30,13 @@ class Index extends Component { componentWillReceiveProps(nextProps, nextContext) { const { importDialog } = this.state; if (nextProps.visible !== this.props.visible && nextProps.visible) { - const { baseTableStore: { VSalryForm }, salaryMonth, taxAgentIds } = nextProps; - const payload = { - salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: importDialog.hasData - }; + const { baseTableStore: { VSalryForm } } = nextProps; + const payload = { ...VSalryForm.getFormParams(), hasData: importDialog.hasData }; this.setState({ - importDialog: { ...importDialog, salaryMonth, link: `${importDialog.link}?${convertToUrlString(payload)}` } + importDialog: { + ...importDialog, salaryMonth: VSalryForm.getFormParams().salaryMonth, + link: `${importDialog.link}?${convertToUrlString(payload)}` + } }); } else { this.setState({ @@ -48,9 +49,10 @@ class Index extends Component { } handleImport = (payload) => { - const { taxAgentIds } = this.props; + const { baseTableStore: { VSalryForm } } = this.props; const { importDialog } = this.state; const { salaryMonth } = importDialog; + const { taxAgentIds } = VSalryForm.getFormParams(); this.setState({ importDialog: { ...importDialog, nextloading: true } }); API.importVariableSalary({ ...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") @@ -64,14 +66,14 @@ class Index extends Component { }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); }; renderFormComponent = () => { - const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { baseTableStore: { VSalryForm } } = this.props; const { importDialog } = this.state; const { salaryMonth: month, hasData } = importDialog; return
{ - const payload = { salaryMonth: val, hasData, taxAgentIds, ...VSalryForm.getFormParams() }; + const payload = { ...VSalryForm.getFormParams(), salaryMonth: val, hasData }; this.setState({ importDialog: { ...importDialog, salaryMonth: val, @@ -98,9 +100,9 @@ class Index extends Component { content={getLabel(543208, "导出现有数据")} helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")} onChange={val => { - const { baseTableStore: { VSalryForm }, taxAgentIds } = this.props; + const { baseTableStore: { VSalryForm } } = this.props; const { salaryMonth } = importDialog; - const payload = { salaryMonth, taxAgentIds, ...VSalryForm.getFormParams(), hasData: val === "1" }; + const payload = { salaryMonth, ...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 f3b0e52a..6b4fcf8b 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -24,7 +24,8 @@ class Index extends Component { constructor(props) { super(props); this.state = { - pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [] + pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [], + selectedRowKeys: [] }; } @@ -56,10 +57,14 @@ class Index extends Component { pageInfo: { ...this.state.pageInfo, ...params } }, () => this.getVariableSalaryList()); break; + case "CHECKBOX": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); + break; case "DEL": this.handleDelete([params.id]); break; - case "VIEW": + case "EDIT": this.handleView(params.id); break; default: @@ -68,13 +73,14 @@ class Index extends Component { } }; getVariableSalaryList = () => { - const { baseTableStore: { VSalryForm, getVariableSalaryList }, salaryMonth, taxAgentIds } = this.props; + const { baseTableStore: { VSalryForm, getVariableSalaryList } } = this.props; const { pageInfo } = this.state; - const { departmentIds } = VSalryForm.getFormParams(); + const { departmentIds, taxAgentIds } = VSalryForm.getFormParams(); this.setState({ loading: true }); getVariableSalaryList({ - ...pageInfo, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(","), - ...VSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [] + ...pageInfo, ...VSalryForm.getFormParams(), + departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [], + taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") }).then(({ status, data }) => { this.setState({ loading: false }); if (status) { @@ -100,7 +106,7 @@ class Index extends Component { API.deleteVariableSalary({ ids }).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "删除成功")); - this.getVariableSalaryList(); + this.setState({ selectedRowKeys: [] }, () => this.getVariableSalaryList()); } else { message.error(errormsg); } @@ -116,15 +122,15 @@ class Index extends Component { })); if (!_.isEmpty(columns)) { this.postMessageToChild({ - columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 98, - pageInfo: this.state.pageInfo, unitTableType: "variableSalary" + columns, showOperateBtn, dataSource: this.state.dataSource, scrollHeight: 95, + pageInfo: this.state.pageInfo, unitTableType: "variableSalary", selectedRowKeys: this.state.selectedRowKeys }); } return columns; }; postMessageToChild = (payload = {}) => { const i18n = { - "操作": getLabel(30585, "操作"), "查看详情": getLabel(111, "查看详情"), + "操作": getLabel(30585, "操作"), "编辑": getLabel(111, "编辑"), "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), "删除": getLabel(111, "删除") }; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js index d5b274a9..8d47fc7a 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js @@ -6,10 +6,12 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaTools } from "ecCom"; +import * as API from "../../../../apis/variableSalary"; import { Button } from "antd"; import { inject, observer } from "mobx-react"; import { getSearchs } from "../../../../util"; import { conditions } from "../../conditions"; +import moment from "moment"; const getLabel = WeaLocaleProvider.getLabel; const getKey = WeaTools.getKey; @@ -24,12 +26,19 @@ class VariableSalarySearchPannel extends Component { }; } - componentDidMount() { + async componentDidMount() { + const { data } = await API.getAdminTaxAgentList(); this.setState({ searchConditions: _.map(conditions, item => { return { ...item, items: _.map(item.items, child => { + if (getKey(child) === "taxAgentIds") { + return { + ...child, label: getLabel(child.lanId, child.label), + options: _.map(data, o => ({ key: o.id, showname: o.content, selected: true })) + }; + } return { ...child, label: getLabel(child.lanId, child.label) }; }) }; @@ -54,7 +63,10 @@ class VariableSalarySearchPannel extends Component { - + diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index 72ff44cf..8486fdb7 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -1,3 +1,5 @@ +import moment from "moment"; + export const conditions = [ { items: [ @@ -22,6 +24,28 @@ export const conditions = [ value: "", viewAttr: 2 }, + { + conditionType: "MONTHPICKER", + domkey: ["salaryMonth"], + fieldcol: 14, + label: "薪资所属月", + lanId: 111, + labelcol: 6, + value: moment(new Date()).format("YYYY-MM"), + viewAttr: 2 + }, + { + conditionType: "SELECT", + domkey: ["taxAgentIds"], + fieldcol: 14, + label: "个税扣缴义务人", + lanId: 111, + labelcol: 6, + value: "", + options: [], + multiple: true, + viewAttr: 2 + }, { browserConditionParam: { completeParams: {}, @@ -157,7 +181,7 @@ export const salaryFileConditions = [ lanId: 111, labelcol: 8, value: "", - rules: "required|string", + rules: "required", viewAttr: 3 } ], diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index f8b13f3b..f2ea52c1 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -10,7 +10,7 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { WeaDatePicker, WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop, WeaSelect } from "ecCom"; +import { WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop } from "ecCom"; import * as API from "../../apis/variableSalary"; import AdvanceInputBtn from "./components/advanceInputBtn"; import SearchPannel from "./components/searchPannel"; @@ -19,8 +19,7 @@ import SalaryFileDialog from "./components/salaryFileDialog"; import SalaryItemList from "./components/salaryItemList"; import SalaryFileList from "./components/salaryFileList"; import SalaryFileImportDialog from "./components/salaryFileImportDialog"; -import moment from "moment"; -import { Button } from "antd"; +import { Button, message } from "antd"; import cs from "classnames"; import "./index.less"; @@ -32,27 +31,13 @@ class Index extends Component { constructor(props) { super(props); this.state = { - 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: [] }, //薪资档案编辑弹框 + selectedKey: "salaryFile", isQuery: false, showSearchAd: false, + SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框 + SFDialog: { visible: false, title: "", detail: {} }, //薪资档案编辑弹框 SFImpDialog: { visible: false, title: getLabel(24023, "数据导入") }//薪资档案导入 }; } - componentDidMount() { - API.getAdminTaxAgentList().then(({ status, data }) => { - if (status) { - const taxAgentOption = _.map(data, (o, i) => ({ key: o.id, showname: o.content })); - 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 = {}) => { @@ -62,7 +47,7 @@ class Index extends Component { this.setState({ SFDialog: { ...this.state.SFDialog, visible: true, detail, - title: _.isEmpty(detail) ? getLabel(111, "新增薪资档案") : getLabel(111, "查看薪资档案") + title: _.isEmpty(detail) ? getLabel(111, "新增薪资档案") : getLabel(111, "编辑薪资档案") } }); break; @@ -71,12 +56,12 @@ class Index extends Component { break; case "export": const columns = _.map(_.filter(toJS(SFTableStore.columns), (item) => item.display === "true"), it => it.dataIndex); - const { salaryMonth, taxAgentIds } = this.state; + const { taxAgentIds, departmentIds } = VSalryForm.getFormParams(); const payload = { ...VSalryForm.getFormParams(), taxAgentIds: !_.isEmpty(taxAgentIds) ? taxAgentIds.split(",") : [], - departmentIds: !_.isEmpty(VSalryForm.getFormParams().taxAgentIds) ? VSalryForm.getFormParams().taxAgentIds.split(",") : [], - salaryMonth, columns + departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [], + columns }; WeaLoadingGlobal.start(); const promise = API.exportVariableSalary(payload); @@ -85,16 +70,22 @@ class Index extends Component { SFTableStore.setColSetVisible(true); SFTableStore.tableColSet(true); break; + case "batchDel": + const { state: { selectedRowKeys }, handleDelete } = this.salaryListRef.wrappedInstance; + if (_.isEmpty(selectedRowKeys)) { + message.warning(getLabel(111, "请选择数据!")); + return; + } + handleDelete(selectedRowKeys); + break; default: break; } }; render() { - const { - selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery, salaryMonth, taxAgentOption, taxAgentIds - } = this.state; - const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props; + const { selectedKey, SIDialog, SFDialog, SFImpDialog, showSearchAd, isQuery } = this.state; + const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm, VSalryForm } } = this.props; const tabs = [ { title: getLabel(111, "浮动数据"), key: "salaryFile", showDropIcon: true, @@ -107,22 +98,16 @@ class Index extends Component { buttons: showOperateBtn ? [ , , - this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>, - this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>, + , this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> ] : [ - this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>, - this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>, this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> ], - children: this.handleOperate("create", data)}/> + children: !_.isEmpty(VSalryForm.getFormParams()) ? + this.salaryListRef = dom} + onViewSalaryFile={(data) => this.handleOperate("create", data)}/> : null }, { title: getLabel(111, "字段管理"), key: "salaryItem", showDropIcon: false, dropMenuDatas: [], @@ -141,7 +126,7 @@ class Index extends Component { ]; return ( } selectedKey={selectedKey} + title={getLabel(111, "浮动数据")} icon={} selectedKey={selectedKey} iconBgcolor="#F14A2D" tabDatas={tabs} className="variable_salary_wrapper" buttons={_.find(tabs, o => selectedKey === o.key).buttons} buttonSpace={10} onChange={selectedKey => this.setState({ selectedKey, SFDialog: { ...SFDialog, visible: false } })} @@ -161,11 +146,10 @@ class Index extends Component { SFDialog: { ...SFDialog, visible: false } }, () => callback && callback())}/> {/* 薪资档案导入*/} - { - this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } }, - () => callback && this.handleAdvanceSearch()); - }}/> + { + this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } }, + () => callback && this.handleAdvanceSearch()); + }}/> ); } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less index 55dbb34b..ffe361cd 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -4,6 +4,7 @@ } .wea-new-top-req-content { + padding: 8px 16px 0 16px; .wea-new-table { background: #FFF; @@ -30,7 +31,7 @@ } .wea-advanced-searchsAd { - height: 108px; + height: 155px; overflow: hidden auto; .formItem-delete { @@ -56,6 +57,9 @@ } } + .wea-form-item-wrapper { + display: block !important; + } } } From b954e1696eb383992ef554ca2a92e2dfb1cd8e6c 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, 14 Oct 2024 16:02:12 +0800 Subject: [PATCH 02/11] release/2.15.2.2409.01 --- .../salaryFileImportDialog/index.js | 26 ++++++---- .../components/salaryFileList/index.js | 52 +++++++++++++++---- .../components/searchPannel/index.js | 20 ++----- .../pages/variableSalary/conditions.js | 52 +++++++++++-------- .../hrmSalary/pages/variableSalary/index.js | 32 ++++-------- .../hrmSalary/pages/variableSalary/index.less | 24 ++++++++- pc4mobx/hrmSalary/stores/baseTable.js | 1 + 7 files changed, 127 insertions(+), 80 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js index 53a96c2b..415f7e33 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js @@ -30,11 +30,13 @@ class Index extends Component { componentWillReceiveProps(nextProps, nextContext) { const { importDialog } = this.state; if (nextProps.visible !== this.props.visible && nextProps.visible) { - const { baseTableStore: { VSalryForm } } = nextProps; - const payload = { ...VSalryForm.getFormParams(), hasData: importDialog.hasData }; + const { baseTableStore: { VSalryForm, VExtraSalryForm } } = nextProps; + const payload = { + ...VSalryForm.getFormParams(), ...VExtraSalryForm.getFormParams(), hasData: importDialog.hasData + }; this.setState({ importDialog: { - ...importDialog, salaryMonth: VSalryForm.getFormParams().salaryMonth, + ...importDialog, salaryMonth: VExtraSalryForm.getFormParams().salaryMonth, link: `${importDialog.link}?${convertToUrlString(payload)}` } }); @@ -49,10 +51,10 @@ class Index extends Component { } handleImport = (payload) => { - const { baseTableStore: { VSalryForm } } = this.props; + const { baseTableStore: { VExtraSalryForm } } = this.props; const { importDialog } = this.state; const { salaryMonth } = importDialog; - const { taxAgentIds } = VSalryForm.getFormParams(); + const { taxAgentIds } = VExtraSalryForm.getFormParams(); this.setState({ importDialog: { ...importDialog, nextloading: true } }); API.importVariableSalary({ ...payload, salaryMonth, taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") @@ -66,14 +68,17 @@ class Index extends Component { }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); }; renderFormComponent = () => { - const { baseTableStore: { VSalryForm } } = this.props; + const { baseTableStore: { VSalryForm, VExtraSalryForm } } = this.props; const { importDialog } = this.state; const { salaryMonth: month, hasData } = importDialog; return
{ - const payload = { ...VSalryForm.getFormParams(), salaryMonth: val, hasData }; + const payload = { + ...VSalryForm.getFormParams(), ...VExtraSalryForm.getFormParams(), + salaryMonth: val, hasData + }; this.setState({ importDialog: { ...importDialog, salaryMonth: val, @@ -100,9 +105,12 @@ class Index extends Component { content={getLabel(543208, "导出现有数据")} helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")} onChange={val => { - const { baseTableStore: { VSalryForm } } = this.props; + const { baseTableStore: { VSalryForm, VExtraSalryForm } } = this.props; const { salaryMonth } = importDialog; - const payload = { salaryMonth, ...VSalryForm.getFormParams(), hasData: val === "1" }; + const payload = { + salaryMonth, ...VSalryForm.getFormParams(), ...VExtraSalryForm.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 6b4fcf8b..01969697 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -9,14 +9,20 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaLocaleProvider } from "ecCom"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; import { WeaTableNew } from "comsMobx"; import { message, Modal, Spin } from "antd"; import * as API from "../../../../apis/variableSalary"; +import { getSearchs } from "../../../../util"; +import { extraConditions } from "../../conditions"; +import AdvanceInputBtn from "../advanceInputBtn"; +import SearchPannel from "../searchPannel"; import { toJS } from "mobx"; +import cs from "classnames"; const WeaTableComx = WeaTableNew.WeaTable; const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; @inject("baseTableStore") @observer @@ -25,11 +31,30 @@ class Index extends Component { super(props); this.state = { pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: [], - selectedRowKeys: [] + selectedRowKeys: [], condtions: [], showSearchAd: false }; } - componentDidMount() { + async componentDidMount() { + const { data: taxAgentOption } = await API.getAdminTaxAgentList(); + this.setState({ + condtions: _.map(extraConditions, item => { + return { + ...item, items: _.map(item.items, child => { + if (getKey(child) === "taxAgentIds") { + return { + ...child, label: getLabel(child.lanId, child.label), + options: _.map(taxAgentOption, o => ({ key: o.id, showname: o.content })) + }; + } + return { ...child, label: getLabel(child.lanId, child.label) }; + }) + }; + }) + }, () => { + const { baseTableStore: { VExtraSalryForm } } = this.props; + VExtraSalryForm.initFormFields(this.state.condtions); + }); window.addEventListener("message", this.handleReceive, false); window.addEventListener("resize", this.handleResize, false); this.getVariableSalaryList(); @@ -73,12 +98,12 @@ class Index extends Component { } }; getVariableSalaryList = () => { - const { baseTableStore: { VSalryForm, getVariableSalaryList } } = this.props; + const { baseTableStore: { VSalryForm, VExtraSalryForm, getVariableSalaryList } } = this.props; const { pageInfo } = this.state; - const { departmentIds, taxAgentIds } = VSalryForm.getFormParams(); + const { taxAgentIds } = VExtraSalryForm.getFormParams(), { departmentIds } = VSalryForm.getFormParams(); this.setState({ loading: true }); getVariableSalaryList({ - ...pageInfo, ...VSalryForm.getFormParams(), + ...pageInfo, ...VSalryForm.getFormParams(), ...VExtraSalryForm.getFormParams(), departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [], taxAgentIds: _.isEmpty(taxAgentIds) ? [] : taxAgentIds.split(",") }).then(({ status, data }) => { @@ -137,17 +162,26 @@ class Index extends Component { const childFrameObj = document.getElementById("unitTable"); childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; + openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd }); render() { - const { loading, dataSource } = this.state; - const { baseTableStore: { SFTableStore } } = this.props; + const { loading, dataSource, condtions, showSearchAd } = this.state; + const { baseTableStore: { SFTableStore, VExtraSalryForm } } = this.props; 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 * 46 + 108 : dataSource.length < 10 ? dataSource.length * 46 + 108 : 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) - 62; } return ( +
+ {getSearchs(VExtraSalryForm, condtions, 2, false, () => this.getVariableSalaryList())} + this.openAdvanceSearch()} + onAdvanceSearch={() => this.getVariableSalaryList()}/> +
+
+ this.setState({ showSearchAd: false })} onAdSearch={this.handleAdvanceSearch}/> +