Merge branch 'release/2.15.2.2409.01' into feature/2.15.2.2409.01合并业务线测试

# Conflicts:
#	pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js
#	pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileImportDialog/index.js
#	pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js
#	pc4mobx/hrmSalary/pages/variableSalary/components/searchPannel/index.js
#	pc4mobx/hrmSalary/pages/variableSalary/index.js
#	pc4mobx/hrmSalary/pages/variableSalary/index.less
This commit is contained in:
lys 2024-10-16 11:11:23 +08:00
commit 73de6b8417
9 changed files with 152 additions and 70 deletions

View File

@ -1,3 +1,4 @@
import React, { Component } from "react";
import { WeaSwitch } from "comsMobx";
import { WeaButtonIcon, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";

View File

@ -68,7 +68,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
@ -127,10 +127,7 @@ class Index extends Component {
<div className="title">{title}</div>
</div>
<div className="titleCol titleRightBox">
{
_.isEmpty(detail) &&
<Button type="primary" loading={loading} onClick={this.save}>{getLabel(537558, "保存")}</Button>
}
<Button type="primary" loading={loading} onClick={this.save}>{getLabel(537558, "保存")}</Button>
</div>
</div>;
};

View File

@ -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 <div style={{ padding: "8px 16px", border: "1px solid #e5e5e5", margin: "4px 0" }}>
<WeaFormItem label={getLabel(111, "薪资所属月")} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<WeaDatePicker format="YYYY-MM" value={month}
onChange={val => {
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",

View File

@ -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
@ -24,11 +30,31 @@ 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: [], 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();
@ -56,10 +82,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,12 +98,11 @@ 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();
this.setState({ loading: true });
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 }) => {
@ -101,7 +130,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);
}
@ -117,32 +146,41 @@ 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, "删除")
};
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 (
<React.Fragment>
<div className="extraFormQuery form-dialog-layout">
{getSearchs(VExtraSalryForm, condtions, 2, false, () => this.getVariableSalaryList())}
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={() => this.getVariableSalaryList()}/>
</div>
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
<SearchPannel onCancel={() => this.setState({ showSearchAd: false })} onAdSearch={this.handleAdvanceSearch}/>
</div>
<div style={{ height: height + "px" }}>
<Spin spinning={loading}>
<iframe

View File

@ -7,11 +7,9 @@
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
import { Button } from "antd";
import { postFetch } from "../../../../util/request";
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;
@ -26,21 +24,12 @@ class VariableSalarySearchPannel extends Component {
};
}
async componentDidMount() {
const { data } = await postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "QUERY_DATA" });
componentDidMount() {
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: String(o.id), showname: o.name, selected: true }))
};
}
return { ...child, label: getLabel(child.lanId, child.label) };
})
items: _.map(item.items, child => ({ ...child, label: getLabel(child.lanId, child.label) }))
};
})
}, () => {
@ -63,10 +52,7 @@ class VariableSalarySearchPannel extends Component {
<Button type="primary" onClick={this.props.onAdSearch}>{getLabel(388113, "搜索")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={() => {
VSalryForm.resetForm();
VSalryForm.updateFields({ salaryMonth: moment(new Date()).format("YYYY-MM") });
}}>{getLabel(2022, "重置")}</Button>
<Button type="ghost" onClick={() => VSalryForm.resetForm()}>{getLabel(2022, "重置")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(31129, "取消")}</Button>

View File

@ -92,6 +92,36 @@ export const conditions = [
defaultshow: true
}
];
export const extraConditions = [
{
items: [
{
conditionType: "MONTHPICKER",
domkey: ["salaryMonth"],
fieldcol: 16,
label: "薪资所属月",
lanId: 111,
labelcol: 8,
value: moment(new Date()).format("YYYY-MM"),
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["taxAgentIds"],
fieldcol: 16,
label: "个税扣缴义务人",
lanId: 111,
labelcol: 8,
value: "",
options: [],
multiple: true,
viewAttr: 2
}
],
title: "",
defaultshow: true
}
];
export const salaryItemsConditions = [
{
items: [
@ -181,7 +211,7 @@ export const salaryFileConditions = [
lanId: 111,
labelcol: 8,
value: "",
rules: "required|string",
rules: "required",
viewAttr: 3
}
],

View File

@ -13,13 +13,12 @@ import { toJS } from "mobx";
import { WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop } from "ecCom";
import * as API from "../../apis/variableSalary";
import AdvanceInputBtn from "./components/advanceInputBtn";
import SearchPannel from "./components/searchPannel";
import SalaryItemDialog from "./components/salaryItemDialog";
import SalaryFileDialog from "./components/salaryFileDialog";
import SalaryItemList from "./components/salaryItemList";
import SalaryFileList from "./components/salaryFileList";
import SalaryFileImportDialog from "./components/salaryFileImportDialog";
import { Button } from "antd";
import { Button, message } from "antd";
import cs from "classnames";
import "./index.less";
@ -31,7 +30,7 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "salaryFile", isQuery: false, showSearchAd: false,
selectedKey: "salaryFile", isQuery: false,
SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框
SFDialog: { visible: false, title: "", detail: {} }, //薪资档案编辑弹框
SFImpDialog: { visible: false, title: getLabel(24023, "数据导入") }//薪资档案导入
@ -39,15 +38,14 @@ class Index extends Component {
}
handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery });
openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd });
handleOperate = (type, detail = {}) => {
const { baseTableStore: { SFTableStore, VSalryForm } } = this.props;
const { baseTableStore: { SFTableStore, VSalryForm, VExtraSalryForm } } = this.props;
switch (type) {
case "create":
this.setState({
SFDialog: {
...this.state.SFDialog, visible: true, detail,
title: _.isEmpty(detail) ? getLabel(111, "新增薪资档案") : getLabel(111, "查看薪资档案")
title: _.isEmpty(detail) ? getLabel(111, "新增薪资档案") : getLabel(111, "编辑薪资档案")
}
});
break;
@ -56,9 +54,9 @@ class Index extends Component {
break;
case "export":
const columns = _.map(_.filter(toJS(SFTableStore.columns), (item) => item.display === "true"), it => it.dataIndex);
const { taxAgentIds, departmentIds } = VSalryForm.getFormParams();
const { taxAgentIds } = VExtraSalryForm.getFormParams(), { departmentIds } = VSalryForm.getFormParams();
const payload = {
...VSalryForm.getFormParams(),
...VSalryForm.getFormParams(), ...VExtraSalryForm.getFormParams(),
taxAgentIds: !_.isEmpty(taxAgentIds) ? taxAgentIds.split(",") : [],
departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [],
columns
@ -70,14 +68,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 } = this.state;
const { taxAgentStore: { PageAndOptAuth }, baseTableStore: { VSSalaryItemForm, VSalryForm } } = this.props;
const { selectedKey, SIDialog, SFDialog, SFImpDialog, isQuery } = this.state;
const { taxAgentStore: { PageAndOptAuth }, baseTableStore: { VSSalaryItemForm } } = this.props;
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
const tabs = [
{
@ -91,14 +97,10 @@ class Index extends Component {
buttons: showOperateBtn ? [
<Button type="primary" onClick={() => this.handleOperate("create")}>{getLabel(111, "新建")}</Button>,
<Button type="ghost" onClick={() => this.handleOperate("import")}>{getLabel(111, "导入")}</Button>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
] : [
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
],
children: !_.isEmpty(VSalryForm.getFormParams()) ? <SalaryFileList {...this.props} isQuery={isQuery}
onViewSalaryFile={(data) => this.handleOperate("create", data)}/> : null
<Button type="primary" onClick={() => this.handleOperate("batchDel")}>{getLabel(111, "批量删除")}</Button>
] : [],
children: <SalaryFileList {...this.props} isQuery={isQuery} ref={dom => this.salaryListRef = dom}
onViewSalaryFile={(data) => this.handleOperate("create", data)}/>
},
{
title: getLabel(111, "字段管理"), key: "salaryItem", showDropIcon: false, dropMenuDatas: [],
@ -124,9 +126,6 @@ class Index extends Component {
showDropIcon={_.find(tabs, o => selectedKey === o.key).showDropIcon} onDropMenuClick={this.handleOperate}
dropMenuDatas={_.find(tabs, o => selectedKey === o.key).dropMenuDatas}
>
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
<SearchPannel onCancel={() => this.setState({ showSearchAd: false })} onAdSearch={this.handleAdvanceSearch}/>
</div>
{_.find(tabs, o => selectedKey === o.key).children}
{/*薪资项目*/}
<SalaryItemDialog {...SIDialog} onSearch={this.handleAdvanceSearch} onCancel={callback => this.setState({

View File

@ -3,8 +3,30 @@
right: 16px !important;
}
.extraFormQuery {
display: flex;
align-items: center;
justify-content: space-between;
background: #FFF;
margin-bottom: 8px;
padding-right: 8px;
.wea-search-group {
padding: 0;
flex: 1;
.wea-content {
max-width: 50%;
.wea-form-cell-wrapper, .wea-form-cell {
border: none;
}
}
}
}
.wea-new-top-req-content {
padding: 16px;
padding: 8px 16px 0 16px;
.wea-new-table {
background: #FFF;
@ -31,7 +53,7 @@
}
.wea-advanced-searchsAd {
height: 155px;
height: 108px;
overflow: hidden auto;
.formItem-delete {

View File

@ -16,6 +16,7 @@ export class BaseTableStore {
@observable loading = true; // 数据加载状态
// 浮动薪酬相关
@observable VExtraSalryForm = new WeaForm(); // 浮动薪酬extra查询form
@observable VSalryForm = new WeaForm(); // 浮动薪酬查询form
@observable VSSalaryItemForm = new WeaForm(); // 新增编辑浮动薪酬项目form
@action initVSSalaryItemForm = () => this.VSSalaryItemForm = new WeaForm();