diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js
index 12a33bfc..06341d88 100644
--- a/pc4mobx/hrmSalary/pages/salaryFile/index.js
+++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js
@@ -4,7 +4,8 @@ import { toJS } from 'mobx';
import { Button, Table, DatePicker, Dropdown, Menu } from 'antd';
-import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable, WeaInputSearch, WeaSlideModal } from 'ecCom';
+import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable,
+ WeaInputSearch, WeaSlideModal, WeaCheckbox, WeaHelpfulTip } from 'ecCom';
import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
import CustomTab from '../../components/customTab';
@@ -17,11 +18,12 @@ import EditAgentModal from './editAgentModal';
import SlideModalTitle from '../../components/slideModalTitle'
import SlideSalaryItem from './slideSalaryItem'
import SlideAgent from './slideAgent'
+import ImportModal from '../../components/importModal'
const { MonthPicker } = DatePicker;
-@inject('baseTableStore')
+@inject('salaryFileStore')
@observer
export default class SalaryFile extends React.Component {
constructor(props) {
@@ -32,13 +34,51 @@ export default class SalaryFile extends React.Component {
changeSalaryVisible: false,
editAgentVisible: false,
selectedTab: 0,
- editSlideVisible: false
+ editSlideVisible: false,
+ importType: "",
+ modalVisiable: false,
+ step: 0
}
}
+
+ componentWillMount() {
+ const { salaryFileStore: {getImportTypes} } = this.props;
+ getImportTypes();
+ }
+
+ // 设置导入步数
+ setStep(step) {
+ this.setState({step})
+ }
+
+ // 渲染导入模板附加元素
+ renderFormComponent() {
+ return (
+
+
+
+
+ )
+ }
+
+
+ // 导入预览
+ handlePreviewImport(params) {
+ const { salaryFileStore: {importPreview}} = this.props;
+ params.importType = this.state.importType;
+ importPreview(params)
+ }
+
+
render() {
- const { baseTableStore } = this.props;
- const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = baseTableStore;
- const { selectedTab } = this.state;
+ const { salaryFileStore } = this.props;
+ const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryFileStore;
+ const { importType } = salaryFileStore;
+ const { selectedTab, step } = this.state;
if (!hasRight && !loading) { // 无权限处理
return renderNoright();
}
@@ -73,24 +113,7 @@ export default class SalaryFile extends React.Component {
}
const handleMenuClick = (e) => {
- if(e.key == "1") {
- this.setState({
- changeSalaryVisible: true
- })
- }
-
- switch(e.key) {
- case "1":
- this.setState({
- changeSalaryVisible: true
- })
- break;
- case "2":
- this.setState({
- editAgentVisible: true
- })
- break;
- }
+ this.setState({importType: e.key, modalVisiable: true})
}
const handleMenuClick2 = () => {
@@ -99,9 +122,11 @@ export default class SalaryFile extends React.Component {
const menu = (
);
@@ -115,6 +140,18 @@ export default class SalaryFile extends React.Component {
const renderRightOperation = () => {
return (
+
导入
导出
@@ -164,6 +201,29 @@ export default class SalaryFile extends React.Component {
+
+
+ {
+ this.state.modalVisiable &&
+ {}}
+ previewImport={(params) => {
+ this.handlePreviewImport(params)
+ }}
+ importFile={(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.getCondition();
+ // this.getTableDatas();
+ this.getImportTypes();
+ }
+
+ // 获取导入类型
+ @action
+ getImportTypes = () => {
+ API.getImportTypes().then(res => {
+ if(res.status) {
+ this.importType = res.data
+ } else {
+ message.error(res.errormsg || "获取失败")
+ }
+ })
+ }
+
+ // 获得高级搜索表单数据
+ @action
+ getCondition = () => {
+ API.getCondition().then(action(res => {
+ if (res.api_status) { // 接口请求成功/失败处理
+ this.condition = res.condition;
+ this.form.initFormFields(res.condition); // 渲染高级搜索form表单
+ } else {
+ message.error(res.msg || '接口调用失败!')
+ }
+ }));
+ }
+
+ // 渲染table数据
+ @action
+ getTableDatas = (params) => {
+ this.loading = true;
+ const formParams = this.form.getFormParams() || {};
+ params = params || formParams;
+ API.getTableDatas(params).then(action(res => {
+ if (res.api_status) { // 接口请求成功/失败处理
+ this.tableStore.getDatas(res.datas); // table 请求数据
+ this.hasRight = res.hasRight;
+ } else {
+ message.error(res.msg || '接口调用失败!')
+ }
+ this.loading = false;
+ }));
+ }
+
+ @action
+ setShowSearchAd = bool => this.showSearchAd = bool;
+
+ // 高级搜索 - 搜索
+ @action doSearch = () => {
+ this.getTableDatas();
+ this.showSearchAd = false;
+ }
+
+ // 导入预览
+ @action
+ importPreview = (params) => {
+ API.importPreview(params).then(res => {
+ if(res.state) {
+
+ } else {
+ message.error(res.errormsg || "获取数据失败")
+ }
+ })
+ }
+
+}
\ No newline at end of file