diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js index 816dec2d..9d141953 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js @@ -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, diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js index e87e1eed..9ddc8380 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -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 (
@@ -245,7 +248,7 @@ class ReportContent extends Component {
{/*侧边栏*/} - + {/* 图表范围数据设置框 */} @@ -32,8 +32,11 @@ class RightOptions extends Component { onClick={() => onChange("1", "bar")}/> onChange("2", "line")}/> onChange("0", "pie")}/> - onChange("1", "setting")}/> + { + !isShare && + onChange("1", "setting")}/> + }
{ - 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
{getLabel(111, "统计项目")} @@ -198,19 +207,25 @@ class StatisticalMicroSettingsSlide extends Component { />
- - this.setState({ - statisticalItemPayload: { - visible: true, id, dimension, - statisticsItemId: "" - } - })} - /> + { + !isShare && + + } + { + !isShare && + this.setState({ + statisticalItemPayload: { + visible: true, id, dimension, + statisticsItemId: "" + } + })} + /> + }
; }; @@ -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 ( - this.setState({ - statisticalItemPayload: { visible: true, id, dimension, statisticsItemId: record.id } - })}>{txt} + { + if (isShare) return; + this.setState({ + statisticalItemPayload: { visible: true, id, dimension, statisticsItemId: record.id } + }); + }}>{txt} ); } }, @@ -238,7 +256,7 @@ class StatisticalMicroSettingsSlide extends Component { dataIndex: "unitType", render: (txt, record) => { return 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 ( } + title={} content={ - this.setState({ salaryMonth: v })}/> @@ -319,16 +340,19 @@ const TitleDialog = (props) => {
- + { + !props.isShare && + + }
; }; export const MonthRangePicker = (props) => { - const { dateRange, onChange, viewAttr } = props; + const { dateRange, onChange, viewAttr, disabled = false } = props; const [startDate, endDate] = dateRange || []; return
{ return current && endDate && current.getTime() > new Date(endDate).getTime(); }} @@ -338,7 +362,7 @@ export const MonthRangePicker = (props) => { /> { return current && startDate && current.getTime() < new Date(startDate).getTime(); }} diff --git a/pc4mobx/hrmSalary/pages/reportView/index.js b/pc4mobx/hrmSalary/pages/reportView/index.js index 4e0829a3..2db97c5c 100644 --- a/pc4mobx/hrmSalary/pages/reportView/index.js +++ b/pc4mobx/hrmSalary/pages/reportView/index.js @@ -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 ( } iconBgcolor="#F14A2D" className="reportViewWrapper" - buttons={showOperateBtn ? [] : []} + buttons={(showOperateBtn && !isShare) ? [] : []} >
{getLabel(111, "统计维度")}: - this.handleChangeDimension(key, showname)}/>
@@ -150,10 +149,10 @@ class Index extends Component { {/*统计数据范围及规则设置弹框*/} 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))} />