/* * Author: 黎永顺 * name: 分享记录-查看分享记录详情 * Description: * Date: 2023/9/19 */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaButtonIcon, WeaDialog, WeaHelpfulTip, WeaInputSearch, WeaLocaleProvider, WeaSearchGroup, WeaTable, WeaTools } from "ecCom"; import { message, Modal } from "antd"; import { shareLogCondition } from "./condition"; import { getConditionDomkeys, getSearchs } from "../../../util"; import { salaryStatisticsPushcancel, salaryStatisticsPushGetDetail } from "../../../apis/statistics"; import SalaryStatisticsDetailSharePersonDialog from "./salaryStatisticsDetailSharePersonDialog"; import "./index.less"; const getKey = WeaTools.getKey; const { getLabel } = WeaLocaleProvider; @inject("attendanceStore") @observer class SalaryStatisticsDetailShareLogDialog extends Component { constructor(props) { super(props); this.state = { conditions: [], loading: false, dataSource: [], columns: [], userNameSearch: "", sharePerDialog: { visible: false, id: "" } }; } componentWillReceiveProps(nextProps, nextContext) { const { attendanceStore: { initShareLogForm } } = nextProps; if (nextProps.visible !== this.props.visible && nextProps.visible) { this.salaryStatisticsPushGetDetail(nextProps); } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { initShareLogForm(); } } renderShareLogTitle = () => { return
{getLabel(111, "被分享人")}
this.setState({ sharePerDialog: { ...this.state.sharePerDialog, visible: true, id: this.props.id } })}/> this.setState({ userNameSearch: v })} onSearch={() => this.salaryStatisticsPushGetDetail(this.props)} />
; }; salaryStatisticsPushGetDetail = (props) => { const { userNameSearch } = this.state; const { attendanceStore: { shareLogForm }, id } = props; this.setState({ loading: true }); salaryStatisticsPushGetDetail({ id, userNameSearch }).then(({ status, data }) => { this.setState({ loading: false }); if (status) { const { detailForm, detailTable } = data; const { columns, list: dataSource } = detailTable; this.setState({ columns, dataSource, conditions: _.map(shareLogCondition, item => { return { ...item, items: _.map(item.items, o => { if (getKey(o) === "effectiveTime") { return { ...o, helpfulTitle: getLabel(111, "有效时间之外,被分享人无法查看您分享的报表") }; } return { ...o }; }) }; }) }, () => { shareLogForm.initFormFields(this.state.conditions); getConditionDomkeys(this.state.conditions).map(key => { shareLogForm.updateFields({ [key]: detailForm[key] || "" }); }); }); } }).catch(() => this.setState({ loading: false })); }; salaryStatisticsPushcancel = (id) => { Modal.confirm({ title: getLabel(131329, "信息确认"), content: getLabel(111, "确定要全部撤回吗?"), onOk: () => { salaryStatisticsPushcancel({ id }).then(({ status, errormsg }) => { if (status) { message.success(getLabel(505793, "撤回成功!")); this.salaryStatisticsPushGetDetail(this.props); this.props.onGetTable(); } else { message.error(errormsg); } }); } }); }; render() { const { attendanceStore: { shareLogForm } } = this.props; const { conditions, dataSource, columns, loading, sharePerDialog } = this.state; return (
{getSearchs(shareLogForm, conditions, 1, false)} {getLabel(30585, "操作")}

{getLabel(111, "1、分享状态为成功且撤回状态为空时,可操作撤回;")}

{/*

{getLabel(111, "2、撤回后不可重新分享;")}

*/} {/*

{getLabel(111, "3、分享状态为失败,可操作重新分享;")}

*/} {/*

{getLabel(111, "4、重新分享:以当前分享记录的分享报表、有效时间、渠道和说明重新分享,分享后自动刷新分享时间和分享状态")}

*/}
} /> , render: (__, record) => (_.isEmpty(record.rebackStatus) ? this.salaryStatisticsPushcancel(record.id)}>{getLabel(32025, "撤回")} : null) } ]} /> this.setState({ sharePerDialog: { ...sharePerDialog, visible: false, id: "" } })} onGetTable={() => { this.salaryStatisticsPushGetDetail(this.props); this.props.onGetTable(); }} />
); } } export default SalaryStatisticsDetailShareLogDialog;