import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; import { WeaTableNew } from "comsMobx"; import { Button, Table, DatePicker, Dropdown, Menu, message, Modal, } from "antd"; import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable, WeaInputSearch, WeaSlideModal, WeaCheckbox, WeaHelpfulTip, } from "ecCom"; const WeaTableComx = WeaTableNew.WeaTable; import { renderNoright, getSearchs } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; import ContentWrapper from "../../components/contentWrapper"; import { columns, dataSource } from "./columns"; import ChangeSalaryModal from "./changeSalaryModal" import EditAgentModal from './editAgentModal'; import SlideModalTitle from '../../components/slideModalTitle' import SlideSalaryItem from './slideSalaryItem' import SlideAgent from './slideAgent' import ImportModal from '../../components/importModal' import SalaryFileViewSlide from './saralyFileViewSlide' import CustomPaginationTable from "../../components/customPaginationTable" const { MonthPicker } = DatePicker; import "./index.less"; import CustomTable from "../../components/customTable"; @inject("salaryFileStore") @observer export default class SalaryFile extends React.Component { constructor(props) { super(props); this.state = { value: "", selectedKey: "0", changeSalaryVisible: false, editAgentVisible: false, selectedTab: 0, editSlideVisible: false, importType: "", isInit: false, //是否是初始化导入 modalVisiable: false, step: 0, recordSlideVisible: false, selectedRowKeys: [], showSearchBar: false, importResult: {}, searchValue: "" } this.pageInfo = {current: 1, pageSize: 10} } componentWillMount() { const { salaryFileStore: { doInit }, } = this.props; doInit(); } // 设置导入步数 setStep(step) { this.setState({ step }); } // 渲染导入模板附加元素 renderFormComponent() { return (
); } // 导入预览 handlePreviewImport(params) { const { salaryFileStore: { importPreview }, } = this.props; params.importType = this.state.importType; importPreview(params); } // 导入档案 handleImportFile(params) { const { salaryFileStore: { importSalaryArchive }, } = this.props; params.importType = this.state.importType; importSalaryArchive(params).then((data) => { data.errorData = data.errorNotice; this.setState({ importResult: data, }); }); } // 导入完成按钮操作 handleImportFinish() { this.setState({ modalVisiable: false, step: 0 }); } // 导出全部 handleExportAll() { const { salaryFileStore: { exportSalaryArchive }, } = this.props; exportSalaryArchive(); } // 定制列 getColumns() { const { salaryFileStore: { tableStore }, } = this.props; return tableStore.columns .filter((item) => item.display == "true") .map((item) => { item.width = item.oldWidth; if (item.dataIndex == "operate") { item.render = (text, record) => ( this.handleEdit(record)}>查看 ); item.fixed = "right"; } else if (item.dataIndex == "username") { item.fixed = "left"; } return item; }); } // 编辑行 handleEdit(record) { this.setState({ editSlideVisible: true }); const { salaryFileStore: { setCurrentId }, } = this.props; setCurrentId(record.id); } // 显示调整个税扣缴义务人表单 handSildeOptionMenuClick(e) { const { salaryFileStore: { setEditAgentVisible }, } = this.props; setEditAgentVisible(true); } // 查看 Slide 头部操作按钮 renderEditSlideOperate() { return (
调整个税扣缴义务人 } onClick={() => { this.setState({ changeSalaryVisible: true }); }}> 调薪
); } // table选中条目 onSelectChange = (selectedRowKeys) => { this.setState({ selectedRowKeys }); }; // 显示影响搜索面板 handleShowSearchBar = () => { this.setState({ showSearchBar: !this.state.showSearchBar, }); }; // 页面跳转 handlePageChange = (value) => { const { salaryFileStore: {getTableDatas, form}} = this.props; this.pageInfo.current = value; getTableDatas(this.pageInfo) } handleShowSizeChange(pageInfo) { const { salaryFileStore: {getTableDatas, form}} = this.props; getTableDatas(pageInfo) } // 搜索 handleSearch(value) { const { salaryFileStore: { getTableDatas, form }, } = this.props; getTableDatas({ username: value }); } // 初始化导入参数 handleInitModal() { const { salaryFileStore: { setPreviewDataSource }, } = this.props; setPreviewDataSource([]); this.setState({ importResult: {}, }); } showColumn = () => { const { salaryFileStore: { tableStore } } = this.props; console.log("showColumn:", tableStore.setColSetVisible(true)); tableStore.setColSetVisible(true); tableStore.tableColSet(true); console.log("showColumn:") } render() { const { salaryFileStore } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, } = salaryFileStore; const { importType, previewColumns, previewDataSource, dataSource, currentId, editAgentVisible, setEditAgentVisible, pageInfo, } = salaryFileStore; const { selectedTab, step, selectedRowKeys } = this.state; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } const rightMenu = [ // 右键菜单 { key: "BTN_COLUMN", icon: , content: "显示列定制", onClick: this.showColumn, }, ]; const collectParams = { // 收藏功能配置 favname: "薪资档案", favouritetype: 1, objid: 0, link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; const adBtn = [ // 高级搜索内部按钮 , , , ]; const topTab = []; const renderSearchOperationItem = () => {}; const handleMenuClick = (e) => { const { key } = e; if (key === "init") { Modal.confirm({ title: "信息确认", content: `若导入表格中的人员已存在在薪资档案中,初始化导入会将档案中该人员的数据清除再导入,点击确定继续导入`, onOk: () => { this.setState({ importType: e.key, isInit: true, modalVisiable: true, step: 0 }); }, onCancel() {}, }); } else { this.setState({ importType: e.key, isInit: false, modalVisiable: true, step: 0 }); } }; const handleMenuClick2 = () => { const { electedRowKeys } = this.state; if (selectedRowKeys.length == 0) { message.warning("未选择条目"); return; } const { salaryFileStore: { exportSalaryArchive }, } = this.props; exportSalaryArchive(selectedRowKeys.join(",")); }; const menu = ( {importType.map((item) => ( {item.content} ))} ); const menu2 = ( 导出所选 ); const renderRightOperation = () => { return (
导入 { this.handleExportAll(); }}> 导出全部 { this.setState({ searchValue: value, }); }} onSearch={(value) => { this.handleSearch(value); }} /> {/* */}
); }; const handleSlideMoreMenuClick = () => {}; const slideMoreMenu = ( 导出全部 ); const renderCustomOperate = () => { return (
导出
); }; const rowSelection = { selectedRowKeys, onChange: this.onSelectChange, }; return (
} // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 > { this.handlePageChange(value) }} onShowSizeChange={(current, pageSize) => { this.pageInfo = {current, pageSize} this.handleShowSizeChange(this.pageInfo) }} /> {this.state.modalVisiable && ( { this.handleInitModal(); }} isInit={this.state.isInit} params={{}} columns={previewColumns} step={step} setStep={this.setStep.bind(this)} slideDataSource={previewDataSource} importResult={this.state.importResult} onFinish={() => { this.handleImportFinish(); }} previewImport={(params) => { this.handlePreviewImport(params); }} importFile={(params) => { this.handleImportFile(params); }} templateLink={ "/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + this.state.importType } renderFormComponent={() => { this.renderFormComponent(); }} visiable={this.state.modalVisiable} onCancel={() => { this.setState({ modalVisiable: false }); }} /> )} {this.state.changeSalaryVisible && ( { this.setState({ changeSalaryVisible: false }); }} /> )} {editAgentVisible && ( { setEditAgentVisible(false); }} /> )} {/* 操作记录 */} {this.state.recordSlideVisible && ( { renderCustomOperate(); }} subItemChange={(item) => { this.setState({ selectedTab: item.key }); }} /> } content={
{selectedTab == 0 && } {selectedTab == 1 && }
} onClose={() => this.setState({ recordSlideVisible: false })} showMask={true} closeMaskOnClick={() => this.setState({ recordSlideVisible: false }) } /> )} {this.state.editSlideVisible && ( } content={} onClose={() => this.setState({ editSlideVisible: false })} showMask={true} closeMaskOnClick={() => this.setState({ editSlideVisible: false })} /> )}
); } }