release/2.15.2.2409.01

This commit is contained in:
黎永顺 2024-10-14 14:20:02 +08:00
parent 2b541a85df
commit 7980acc6c2
7 changed files with 107 additions and 76 deletions

View File

@ -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 {
<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,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 <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 = { 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",

View File

@ -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, "删除")
};

View File

@ -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 {
<Button type="primary" onClick={this.props.onAdSearch}>{getLabel(388113, "搜索")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={() => VSalryForm.resetForm()}>{getLabel(2022, "重置")}</Button>
<Button type="ghost" onClick={() => {
VSalryForm.resetForm();
VSalryForm.updateFields({ salaryMonth: moment(new Date()).format("YYYY-MM") });
}}>{getLabel(2022, "重置")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(31129, "取消")}</Button>

View File

@ -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
}
],

View File

@ -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 ? [
<Button type="primary" onClick={() => this.handleOperate("create")}>{getLabel(111, "新建")}</Button>,
<Button type="ghost" onClick={() => this.handleOperate("import")}>{getLabel(111, "导入")}</Button>,
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={val => this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>,
<WeaSelect options={taxAgentOption} style={{ width: 200, display: "flex" }} multiple value={taxAgentIds}
onChange={val => this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>,
<Button type="primary" onClick={() => this.handleOperate("batchDel")}>{getLabel(111, "批量删除")}</Button>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
] : [
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={val => this.setState({ salaryMonth: val }, () => this.handleAdvanceSearch())}/>,
<WeaSelect options={taxAgentOption} style={{ width: 200, display: "flex" }} multiple value={taxAgentIds}
onChange={val => this.setState({ taxAgentIds: val }, () => this.handleAdvanceSearch())}/>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
],
children: <SalaryFileList {...this.props} salaryMonth={salaryMonth} taxAgentIds={taxAgentIds} isQuery={isQuery}
onViewSalaryFile={(data) => this.handleOperate("create", data)}/>
children: !_.isEmpty(VSalryForm.getFormParams()) ?
<SalaryFileList {...this.props} isQuery={isQuery} ref={dom => 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 (
<WeaReqTop
title={getLabel(111, "浮动薪酬")} icon={<i className="icon-coms-fa"/>} selectedKey={selectedKey}
title={getLabel(111, "浮动数据")} icon={<i className="icon-coms-fa"/>} 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())}/>
{/* 薪资档案导入*/}
<SalaryFileImportDialog {...this.props} {...SFImpDialog} salaryMonth={salaryMonth} taxAgentIds={taxAgentIds}
onCancel={callback => {
this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } },
() => callback && this.handleAdvanceSearch());
}}/>
<SalaryFileImportDialog {...this.props} {...SFImpDialog} onCancel={callback => {
this.setState({ SFImpDialog: { ...SFImpDialog, visible: false } },
() => callback && this.handleAdvanceSearch());
}}/>
</WeaReqTop>
);
}

View File

@ -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;
}
}
}