feature/2.9.42309.01-薪酬统计报表分享报表
This commit is contained in:
parent
10c7280b43
commit
6ac979e9e7
|
|
@ -215,16 +215,26 @@ export const shareCondition = [
|
|||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
colSpan: 1,
|
||||
conditionType: "RANGEPICKER",
|
||||
domkey: ["startTime", "endTime"],
|
||||
colSpan: 2,
|
||||
conditionType: "DATEPICKER",
|
||||
domkey: ["startTime"],
|
||||
fieldcol: 12,
|
||||
label: "报表查看有效时间",
|
||||
label: "报表查看有效开始时间",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required",
|
||||
viewAttr: 3
|
||||
viewAttr: 2
|
||||
},
|
||||
{
|
||||
colSpan: 2,
|
||||
conditionType: "DATEPICKER",
|
||||
domkey: ["endTime"],
|
||||
fieldcol: 12,
|
||||
label: "报表查看有效结束时间",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 2
|
||||
},
|
||||
{
|
||||
colSpan: 1,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class ReportContent extends Component {
|
|||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.report !== this.props.report && nextProps.report.dimensionId) {
|
||||
this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId);
|
||||
this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId, nextProps.report.isShare);
|
||||
this.setState({ viewType: "dataView", chartsInfo: {} });
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,8 @@ class ReportContent extends Component {
|
|||
//数据透视弹框
|
||||
if (id === "PIVOTCHART") {
|
||||
const { record } = params;
|
||||
const { dimension: dimensionValue } = record;
|
||||
const { dimension: dimensionValue, isShare } = record;
|
||||
if (isShare) return;
|
||||
const { id: pivotId, dimensionId } = this.props.report;
|
||||
this.setState({
|
||||
povitView: {
|
||||
|
|
@ -81,8 +82,8 @@ class ReportContent extends Component {
|
|||
dataSource, columns, showSum, countResult
|
||||
}), "*");
|
||||
};
|
||||
reportStatisticsReportGetData = (id, dimensionId) => {
|
||||
const payload = { id, dimensionId };
|
||||
reportStatisticsReportGetData = (id, dimensionId, isShare) => {
|
||||
const payload = { id, dimensionId, isShare };
|
||||
this.setState({ loading: true });
|
||||
reportStatisticsReportGetData(payload).then(({ status, data }) => {
|
||||
this.setState({ loading: false });
|
||||
|
|
@ -191,13 +192,13 @@ class ReportContent extends Component {
|
|||
handleChangeChartOpts = (chartsType, viewType) => {
|
||||
this.setState({ chartsInfo: {} });
|
||||
if (this.refs.chart && viewType !== "setting" && viewType !== "dataView" && !this.state.rangSet.visible) this.refs.chart.clear();
|
||||
const { report: { id: reportId, dimensionId } } = this.props;
|
||||
const { report: { id: reportId, dimensionId, isShare } } = this.props;
|
||||
const { rangSet } = this.state;
|
||||
viewType !== "setting" && this.setState({ chartsType, viewType }, () => {
|
||||
const { viewType, chartsType } = this.state;
|
||||
viewType !== "dataView" ?
|
||||
this.queryRangeSetting({ reportId, chartsType }, true) :
|
||||
this.reportStatisticsReportGetData(reportId, dimensionId);
|
||||
this.reportStatisticsReportGetData(reportId, dimensionId, isShare);
|
||||
});
|
||||
viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId } }, () => {
|
||||
this.queryRangeSetting({ reportId, chartsType });
|
||||
|
|
@ -213,8 +214,8 @@ class ReportContent extends Component {
|
|||
};
|
||||
handleGetData = () => {
|
||||
const { report } = this.props;
|
||||
const { id, dimensionId } = report;
|
||||
this.setState({ viewType: "dataView" }, () => this.reportStatisticsReportGetData(id, dimensionId));
|
||||
const { id, dimensionId, isShare } = report;
|
||||
this.setState({ viewType: "dataView" }, () => this.reportStatisticsReportGetData(id, dimensionId, isShare));
|
||||
};
|
||||
renderCharts = () => {
|
||||
const { chartsInfo, viewType } = this.state;
|
||||
|
|
@ -229,6 +230,8 @@ class ReportContent extends Component {
|
|||
|
||||
render() {
|
||||
const { loading, viewType, rangSet, columns, povitView } = this.state;
|
||||
const { report } = this.props;
|
||||
const { isShare } = report;
|
||||
return (
|
||||
<div className="layoutContent">
|
||||
<div className="layoutBox">
|
||||
|
|
@ -245,7 +248,7 @@ class ReportContent extends Component {
|
|||
</Spin>
|
||||
</div>
|
||||
{/*侧边栏*/}
|
||||
<RightOptions onChange={this.handleChangeChartOpts}/>
|
||||
<RightOptions isShare={isShare} onChange={this.handleChangeChartOpts}/>
|
||||
{/* 图表范围数据设置框 */}
|
||||
<ChartsRangeSettingsModal
|
||||
{...rangSet}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class RightOptions extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { onChange } = this.props;
|
||||
const { onChange, isShare } = this.props;
|
||||
const { show } = this.state;
|
||||
return (
|
||||
<div className="layoutSide" style={{ width: show ? "30px" : 0 }}>
|
||||
|
|
@ -32,8 +32,11 @@ class RightOptions extends Component {
|
|||
onClick={() => onChange("1", "bar")}/>
|
||||
<i className="icon-coms-Line" title={getLabel(111, "折线图")} onClick={() => onChange("2", "line")}/>
|
||||
<i className="icon-coms-Pie" title={getLabel(111, "饼图")} onClick={() => onChange("0", "pie")}/>
|
||||
<i className="icon-coms-Flow-setting" title={getLabel(111, "设置")}
|
||||
onClick={() => onChange("1", "setting")}/>
|
||||
{
|
||||
!isShare &&
|
||||
<i className="icon-coms-Flow-setting" title={getLabel(111, "设置")}
|
||||
onClick={() => onChange("1", "setting")}/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<span className="show-btn-right"
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class SalaryStatisticsDetailShareDialog extends Component {
|
|||
className="shareDialogWrapper"
|
||||
style={{
|
||||
width: 750,
|
||||
height: 275.6,
|
||||
height: 375.6,
|
||||
minHeight: 200,
|
||||
minWidth: 380,
|
||||
maxHeight: "60%",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* Date: 2023/4/21
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { toJS } from "mobx";
|
||||
import {
|
||||
WeaButtonIcon,
|
||||
WeaDatePicker,
|
||||
|
|
@ -16,12 +15,12 @@ import {
|
|||
WeaSearchGroup,
|
||||
WeaSelect,
|
||||
WeaSlideModal,
|
||||
WeaTable
|
||||
WeaTable,
|
||||
WeaTools
|
||||
} from "ecCom";
|
||||
import CustomStatisticsItemsModal from "./customStatisticsItemsModal";
|
||||
import moment from "moment";
|
||||
import { Button, message, Modal } from "antd";
|
||||
import { condition } from "./condition";
|
||||
import { getSearchs } from "../../../util";
|
||||
import {
|
||||
deleteRangeSetting,
|
||||
|
|
@ -31,8 +30,11 @@ import {
|
|||
statisticsItemList
|
||||
} from "../../../apis/statistics";
|
||||
import { commonEnumList } from "../../../apis/ruleconfig";
|
||||
import { getTaxAgentSelectList } from "../../../apis/taxAgent";
|
||||
import { condition } from "./condition";
|
||||
import "../index.less";
|
||||
|
||||
const getKey = WeaTools.getKey;
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
|
||||
class StatisticalMicroSettingsSlide extends Component {
|
||||
|
|
@ -53,26 +55,8 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.taxAgentAdminOption !== this.props.taxAgentAdminOption && !_.isEmpty(nextProps.taxAgentAdminOption)) {
|
||||
const conditions = _.map(condition, item => {
|
||||
return {
|
||||
...item,
|
||||
items: _.map(item.items, child => {
|
||||
if (child.domkey[0] === "taxAgent") {
|
||||
return {
|
||||
...child,
|
||||
options: toJS(nextProps.taxAgentAdminOption)
|
||||
};
|
||||
}
|
||||
return { ...child };
|
||||
})
|
||||
};
|
||||
});
|
||||
this.setState({ conditions });
|
||||
nextProps.form.initFormFields(condition);
|
||||
}
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxAgentSelectList(nextProps);
|
||||
if (nextProps.id !== this.props.id && !_.isEmpty(nextProps.id)) {
|
||||
this.reportStatisticsGetSearchCondition(nextProps.id);
|
||||
this.statisticsItemList(nextProps.id).then(r => {
|
||||
});
|
||||
}
|
||||
|
|
@ -82,6 +66,31 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
getTaxAgentSelectList = (props) => {
|
||||
getTaxAgentSelectList().then(({ status, data }) => {
|
||||
if (status) {
|
||||
const conditions = _.map(condition, item => {
|
||||
return {
|
||||
...item,
|
||||
items: _.map(item.items, child => {
|
||||
if (getKey(child) === "taxAgent") {
|
||||
return {
|
||||
...child, viewAttr: props.isShare ? 1 : child.viewAttr,
|
||||
options: _.map(data, o => ({ key: o.id, showname: o.content }))
|
||||
};
|
||||
}
|
||||
return { ...child, viewAttr: props.isShare ? 1 : child.viewAttr };
|
||||
})
|
||||
};
|
||||
});
|
||||
this.setState({ conditions }, () => {
|
||||
props.form.initFormFields(this.state.conditions);
|
||||
props.id && this.reportStatisticsGetSearchCondition(props.id);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
reportStatisticsGetSearchCondition = (id) => {
|
||||
const { conditions } = this.state;
|
||||
const { form } = this.props;
|
||||
|
|
@ -189,7 +198,7 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
};
|
||||
renderProjectTitle = () => {
|
||||
const { selectedRowKeys } = this.state;
|
||||
const { id, dimension } = this.props;
|
||||
const { id, dimension, isShare } = this.props;
|
||||
return <div className="groupPorjectTitleWrapper">
|
||||
<div>
|
||||
<span>{getLabel(111, "统计项目")}</span>
|
||||
|
|
@ -198,19 +207,25 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
/>
|
||||
</div>
|
||||
<div>
|
||||
<WeaButtonIcon
|
||||
buttonType="del" type="primary" disabled={_.isEmpty(selectedRowKeys)}
|
||||
onClick={this.reportStatisticsItemDelete}
|
||||
/>
|
||||
<WeaButtonIcon
|
||||
buttonType="add" type="primary"
|
||||
onClick={() => this.setState({
|
||||
statisticalItemPayload: {
|
||||
visible: true, id, dimension,
|
||||
statisticsItemId: ""
|
||||
}
|
||||
})}
|
||||
/>
|
||||
{
|
||||
!isShare &&
|
||||
<WeaButtonIcon
|
||||
buttonType="del" type="primary" disabled={_.isEmpty(selectedRowKeys)}
|
||||
onClick={this.reportStatisticsItemDelete}
|
||||
/>
|
||||
}
|
||||
{
|
||||
!isShare &&
|
||||
<WeaButtonIcon
|
||||
buttonType="add" type="primary"
|
||||
onClick={() => this.setState({
|
||||
statisticalItemPayload: {
|
||||
visible: true, id, dimension,
|
||||
statisticsItemId: ""
|
||||
}
|
||||
})}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
</div>;
|
||||
};
|
||||
|
|
@ -220,16 +235,19 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
salaryMonth, conditions, selectedRowKeys, loading,
|
||||
statisticalItemPayload, dataSource, unitTypeList
|
||||
} = this.state;
|
||||
const { id, dimension } = this.props;
|
||||
const { id, dimension, isShare } = this.props;
|
||||
const columns = [
|
||||
{
|
||||
title: "统计项名称",
|
||||
dataIndex: "itemName",
|
||||
render: (txt, record) => {
|
||||
return (
|
||||
<a href="javascript: void(0);" onClick={() => this.setState({
|
||||
statisticalItemPayload: { visible: true, id, dimension, statisticsItemId: record.id }
|
||||
})}>{txt}</a>
|
||||
<a href="javascript: void(0);" onClick={() => {
|
||||
if (isShare) return;
|
||||
this.setState({
|
||||
statisticalItemPayload: { visible: true, id, dimension, statisticsItemId: record.id }
|
||||
});
|
||||
}}>{txt}</a>
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
@ -238,7 +256,7 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
dataIndex: "unitType",
|
||||
render: (txt, record) => {
|
||||
return <WeaSelect
|
||||
value={!_.isNil(txt) ? txt.toString() : ""} options={unitTypeList} style={{ width: 150 }}
|
||||
value={!_.isNil(txt) ? txt.toString() : ""} options={unitTypeList} style={{ width: 150 }} disabled={isShare}
|
||||
onChange={unitType => this.customStatisticsItemsRef.reportStatisticsItemSave({ id: record.id, unitType })}
|
||||
/>;
|
||||
}
|
||||
|
|
@ -248,7 +266,10 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
selectedRowKeys,
|
||||
onChange: (selectedRowKeys) => {
|
||||
this.setState({ selectedRowKeys });
|
||||
}
|
||||
},
|
||||
getCheckboxProps: record => ({
|
||||
disabled: isShare
|
||||
})
|
||||
};
|
||||
return (
|
||||
<WeaSlideModal
|
||||
|
|
@ -262,13 +283,13 @@ class StatisticalMicroSettingsSlide extends Component {
|
|||
height={100}
|
||||
measureY="%"
|
||||
direction={"right"}
|
||||
title={<TitleDialog loading={loading} onSave={this.reportStatisticsSaveSearchCondition}/>}
|
||||
title={<TitleDialog loading={loading} isShare={isShare} onSave={this.reportStatisticsSaveSearchCondition}/>}
|
||||
content={
|
||||
<React.Fragment>
|
||||
<WeaSearchGroup title={getLabel(111, "统计时间范围")} col={2} showGroup needTigger>
|
||||
<WeaFormItem label={getLabel(111, "薪资所属月")} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }}>
|
||||
<WeaError tipPosition="bottom" ref="weaError" error={getLabel(111, "此项必填")}>
|
||||
<MonthRangePicker viewAttr={3} dateRange={salaryMonth}
|
||||
<MonthRangePicker viewAttr={3} dateRange={salaryMonth} disabled={isShare}
|
||||
onChange={v => this.setState({ salaryMonth: v })}/>
|
||||
</WeaError>
|
||||
</WeaFormItem>
|
||||
|
|
@ -319,16 +340,19 @@ const TitleDialog = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
<div className="titleCol titleRightBox">
|
||||
<Button type="primary" loading={props.loading} onClick={props.onSave}>{getLabel(111, "保存")}</Button>
|
||||
{
|
||||
!props.isShare &&
|
||||
<Button type="primary" loading={props.loading} onClick={props.onSave}>{getLabel(111, "保存")}</Button>
|
||||
}
|
||||
</div>
|
||||
</div>;
|
||||
};
|
||||
export const MonthRangePicker = (props) => {
|
||||
const { dateRange, onChange, viewAttr } = props;
|
||||
const { dateRange, onChange, viewAttr, disabled = false } = props;
|
||||
const [startDate, endDate] = dateRange || [];
|
||||
return <div className="rangePickerBox">
|
||||
<WeaDatePicker
|
||||
value={startDate}
|
||||
value={startDate} disabled={disabled}
|
||||
disabledDate={(current) => {
|
||||
return current && endDate && current.getTime() > new Date(endDate).getTime();
|
||||
}}
|
||||
|
|
@ -338,7 +362,7 @@ export const MonthRangePicker = (props) => {
|
|||
/>
|
||||
<span className="to" style={{ margin: "0 10px" }}>至</span>
|
||||
<WeaDatePicker
|
||||
value={endDate}
|
||||
value={endDate} disabled={disabled}
|
||||
disabledDate={(current) => {
|
||||
return current && startDate && current.getTime() < new Date(startDate).getTime();
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ class Index extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { taxAgentStore: { fetchTaxAgentOption } } = this.props;
|
||||
this.reportGetForm();
|
||||
fetchTaxAgentOption();
|
||||
}
|
||||
|
||||
reportGetForm = () => {
|
||||
|
|
@ -94,18 +92,19 @@ class Index extends Component {
|
|||
*/
|
||||
exportData = () => {
|
||||
const { report } = this.state;
|
||||
const { id, dimensionId } = report;
|
||||
window.open(`${window.location.origin}/api/bs/hrmsalary/report/statistics/report/exportData?id=${id}&dimensionId=${dimensionId}`, "_self");
|
||||
const { id, dimensionId, isShare } = report;
|
||||
window.open(`${window.location.origin}/api/bs/hrmsalary/report/statistics/report/exportData?id=${id}&dimensionId=${dimensionId}&isShare=${isShare}`, "_self");
|
||||
};
|
||||
|
||||
render() {
|
||||
const { report, dimensionList, statisticalPayload } = this.state;
|
||||
const { isShare } = report;
|
||||
const { attendanceStore: { settingForm }, taxAgentStore: { taxAgentOption, showOperateBtn } } = this.props;
|
||||
return (
|
||||
<WeaTop
|
||||
title={getLabel(111, "报表查看")} icon={<i className="icon-coms-fa"/>}
|
||||
iconBgcolor="#F14A2D" className="reportViewWrapper"
|
||||
buttons={showOperateBtn ? [<TopBtns/>] : []}
|
||||
buttons={(showOperateBtn && !isShare) ? [<TopBtns/>] : []}
|
||||
>
|
||||
<WeaLeftRightLayout
|
||||
leftWidth={210}
|
||||
|
|
@ -128,7 +127,7 @@ class Index extends Component {
|
|||
<div className="rightColTitle">
|
||||
<div className="dimension">
|
||||
<span>{getLabel(111, "统计维度")}:</span>
|
||||
<WeaSelect value={report.dimensionId} options={dimensionList}
|
||||
<WeaSelect value={report.dimensionId} options={dimensionList} disabled={isShare}
|
||||
onChange={(key, showname) => this.handleChangeDimension(key, showname)}/>
|
||||
</div>
|
||||
<div className="iconWrapper">
|
||||
|
|
@ -150,10 +149,10 @@ class Index extends Component {
|
|||
{/*统计数据范围及规则设置弹框*/}
|
||||
<StatisticalMicroSettingsSlide
|
||||
{...statisticalPayload} form={settingForm}
|
||||
taxAgentAdminOption={taxAgentOption}
|
||||
taxAgentAdminOption={taxAgentOption} isShare={isShare}
|
||||
onClose={(isRefresh) => this.setState({
|
||||
statisticalPayload: { visible: false, id: "", dimension: "" }
|
||||
}, () => isRefresh && this.reportRef.reportStatisticsReportGetData(report.id, report.dimensionId))}
|
||||
}, () => isRefresh && this.reportRef.reportStatisticsReportGetData(report.id, report.dimensionId, report.isShare))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue