feature/2.15.2.2411.01业务线-数据推送
This commit is contained in:
parent
5014859171
commit
4473d8dad5
|
|
@ -1,111 +0,0 @@
|
|||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { toJS } from "mobx";
|
||||
|
||||
import { Button } from "antd";
|
||||
import { WeaLogView } from "comsMobx";
|
||||
import { WeaLocaleProvider, WeaNewScroll, WeaTop } from "ecCom";
|
||||
|
||||
import { getSearchs, renderLoading, renderNoright } from "../util"; // 从util文件引入公共的方法
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const WeaLogViewComp = WeaLogView.Component;
|
||||
|
||||
@inject("baseFormStore")
|
||||
@observer
|
||||
export default class BaseForm extends React.Component {
|
||||
componentWillMount() { // 初始化渲染页面
|
||||
const { baseFormStore: { doInit } } = this.props;
|
||||
doInit();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { baseFormStore: { doInit } } = this.props;
|
||||
if (this.props.location.key !== nextProps.location.key) { // 手动刷新、切换菜单 重新初始化
|
||||
doInit();
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染右键菜单和顶部下拉菜单
|
||||
getRightMenu() {
|
||||
const { baseFormStore: { setLogVisible, saveForm } } = this.props;
|
||||
let btnArr = [
|
||||
{
|
||||
key: "BTN_SAVE",
|
||||
icon: <i className="icon-coms-Preservation"/>,
|
||||
content: `${getLabel(86, "保存")}`,
|
||||
onClick: () => saveForm()
|
||||
},
|
||||
{
|
||||
key: "log",
|
||||
content: getLabel(83, "日志"),
|
||||
icon: <i className="icon-coms-Print-log"/>,
|
||||
onClick: () => setLogVisible(true)
|
||||
}];
|
||||
return btnArr;
|
||||
}
|
||||
|
||||
render() {
|
||||
/* 页面渲染说明:
|
||||
1、判断是否无权限: 是显示无权限页面
|
||||
2、渲染form页面:
|
||||
2-1: WeaRightMenu 右键菜单
|
||||
2-2: WeaTop: 顶部: 包括下拉菜单
|
||||
2-3: renderLoading: 加载数据中的loading效果(统一封装在util中)
|
||||
2-4: WeaNewScroll 顶部以下超长滚动处理
|
||||
2-5: 通过getSearchs方法渲染form
|
||||
*/
|
||||
const { baseFormStore } = this.props;
|
||||
const {
|
||||
loading,
|
||||
hasRight,
|
||||
form,
|
||||
condition,
|
||||
logVisible,
|
||||
logStore,
|
||||
saveLoading,
|
||||
setLogVisible,
|
||||
saveForm
|
||||
} = baseFormStore; // 从后台取数据 和 方法
|
||||
|
||||
if (!hasRight && !loading) { // 无权限处理
|
||||
return renderNoright();
|
||||
}
|
||||
|
||||
const btns = [ // 顶部按钮
|
||||
<Button type="primary" loading={saveLoading} onClick={() => saveForm()}>保存</Button>
|
||||
];
|
||||
const collectParams = { // 收藏功能配置
|
||||
favname: "基础表单",
|
||||
favouritetype: 1,
|
||||
objid: 0,
|
||||
link: "wui/index.html#/ns_demo01/index",
|
||||
importantlevel: 1
|
||||
};
|
||||
return (
|
||||
<WeaTop
|
||||
title="基础表单" // title
|
||||
icon={<i className="icon-coms-fa"/>} // 左侧图标
|
||||
iconBgcolor="#F14A2D" // 左侧图标背景色
|
||||
buttons={btns} // 顶部按钮: 这里是保存按钮,不需要可以不显示
|
||||
buttonSpace={10} // 按钮之间的间隔
|
||||
showDropIcon={true} // 是否显示右侧下拉按钮
|
||||
dropMenuDatas={this.getRightMenu()} // 下拉菜单(和页面的右键菜单相同)
|
||||
dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能
|
||||
>
|
||||
{loading ? renderLoading() :
|
||||
<WeaNewScroll height="100%">
|
||||
{getSearchs(form, toJS(condition), 1)}
|
||||
</WeaNewScroll>
|
||||
}
|
||||
<WeaLogViewComp // 日志功能(一般后端的应用设置是需要的)
|
||||
visible={logVisible} // 日志弹框的显示隐藏
|
||||
onCancel={() => setLogVisible(false)} // 关闭日志弹框时的操作:设置logVisible属性为false
|
||||
logStore={logStore} // 日志的store
|
||||
logType="1" // 模块编码: 该参数要根据模块来给
|
||||
logSmallType="1" // 细分模块编码: 该参数要根据模块来给
|
||||
/>
|
||||
</WeaTop>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,5 +18,6 @@ export const PAGE = {
|
|||
"salaryField": ["/hrmSalary/fieldManagement"], //字段管理
|
||||
"salaryItem": ["/hrmSalary/salaryItem"], //薪资项目管理
|
||||
"siScheme": ["/socialSecurityBenefits/programme"], //社保福利方案
|
||||
"report": ["/hrmSalary/analysisOfSalaryStatistics", "/hrmSalary/reportView"] //报表
|
||||
"report": ["/hrmSalary/analysisOfSalaryStatistics", "/hrmSalary/reportView"], //报表
|
||||
"dataPush": ["/hrmSalary/datapush"] //数据推送
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import AdjustSalaryManage from "./pages/adjustSalaryManage";
|
|||
import TopologyMap from "./pages/topologyMap";
|
||||
import SupplementaryCalc from "./pages/supplementaryCalc";
|
||||
import VariableSalary from "./pages/variableSalary";
|
||||
import Datapush from "./pages/datapush";
|
||||
import Layout from "./layout";
|
||||
import stores from "./stores";
|
||||
import "./style/index";
|
||||
|
|
@ -116,6 +117,7 @@ const Routes = (
|
|||
<Route key="fieldManagement" path="fieldManagement" component={FieldManagement}/>
|
||||
<Route key="analysisOfSalaryStatistics" path="analysisOfSalaryStatistics" component={AnalysisOfSalaryStatistics}/>
|
||||
<Route key="analysisOfSalaryStatisticsId" path="analysisOfSalaryStatistics/:employeeId" component={EmployeeList}/>
|
||||
<Route key="datapush" path="datapush" component={Datapush}/>
|
||||
<Route key="reportView" path="reportView" component={ReportView}/>
|
||||
<Route key="externalPersonManage" path="externalPersonManage" component={ExternalPersonManage}/>
|
||||
<Route key="topologyView" path="topologyView/:salarySobId/:salaryItemId" component={TopologyMap}/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 数据推送
|
||||
*
|
||||
* @Author: 黎永顺
|
||||
* @Date: 2024/11/19
|
||||
* @Wechat:
|
||||
* @Email: 971387674@qq.com
|
||||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
|
||||
import { Button } from "antd";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject("taxAgentStore", "baseFormStore")
|
||||
@observer
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectedKey: "datapush", isQuery: false
|
||||
};
|
||||
}
|
||||
|
||||
handleOperate = () => {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { selectedKey } = this.state;
|
||||
const { taxAgentStore: { PageAndOptAuth }, baseFormStore: { form } } = this.props;
|
||||
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
|
||||
const tabs = [
|
||||
{
|
||||
title: getLabel(111, "数据推送"), key: "datapush", showDropIcon: false, dropMenuDatas: [],
|
||||
buttons: showOperateBtn ? [
|
||||
<Button type="primary" onClick={() => this.handleOperate("create")}>{getLabel(111, "新建")}</Button>
|
||||
] : [],
|
||||
children: null
|
||||
}
|
||||
];
|
||||
return (
|
||||
<WeaReqTop
|
||||
title={getLabel(111, "数据推送")} icon={<i className="icon-coms-fa"/>} selectedKey={selectedKey}
|
||||
iconBgcolor="#F14A2D" tabDatas={tabs} className="datapush_wrapper" buttonSpace={10}
|
||||
buttons={_.find(tabs, o => selectedKey === o.key).buttons}
|
||||
onChange={selectedKey => this.setState({ selectedKey })}
|
||||
showDropIcon={_.find(tabs, o => selectedKey === o.key).showDropIcon} onDropMenuClick={this.handleOperate}
|
||||
dropMenuDatas={_.find(tabs, o => selectedKey === o.key).dropMenuDatas}
|
||||
>
|
||||
{_.find(tabs, o => selectedKey === o.key).children}
|
||||
</WeaReqTop>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Index;
|
||||
|
|
@ -19,7 +19,6 @@ import SalaryItemList from "./components/salaryItemList";
|
|||
import SalaryFileList from "./components/salaryFileList";
|
||||
import SalaryFileImportDialog from "./components/salaryFileImportDialog";
|
||||
import { Button, message } from "antd";
|
||||
import cs from "classnames";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
|
|
|||
|
|
@ -1,64 +1,12 @@
|
|||
import { action, observable } from "mobx";
|
||||
import { message } from "antd";
|
||||
import { WeaForm, WeaLogView } from "comsMobx";
|
||||
import { WeaLocaleProvider } from "ecCom";
|
||||
import { WeaForm } from "comsMobx";
|
||||
|
||||
import * as API from "../apis"; // 引入API接口文件
|
||||
|
||||
const { LogStore } = WeaLogView;
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
export class BaseFormStore {
|
||||
// 全局设置仓库
|
||||
@observable form = new WeaForm(); // 规则渲染form
|
||||
|
||||
@observable logStore = new LogStore();
|
||||
@observable condition = []; // 存储后台得到的form数据
|
||||
@observable saveLoading = false; // 保存状态处理:保证保存的时候接口只走一次
|
||||
@observable loading = true; // 页面初始化的loading状态:数据加载成功前后前使用
|
||||
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
|
||||
@action("初始化form表单") initForm = () => this.form = new WeaForm();
|
||||
@observable logVisible = false; // 控制日志弹框的显影
|
||||
|
||||
@action // 初始化操作: 一般用来初始化获取后台数据
|
||||
doInit = () => {
|
||||
this.getBaseForm();
|
||||
};
|
||||
|
||||
@action // 获得form配置数据
|
||||
getBaseForm = () => {
|
||||
API.getBaseForm().then(action(result => {
|
||||
this.loading = false;
|
||||
this.hasRight = result.hasRight;
|
||||
if (result.hasRight) {
|
||||
this.condition = result.condition;
|
||||
this.form.initFormFields(result.condition);
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
@action // 保存
|
||||
saveForm = () => {
|
||||
this.form.validateForm().then(action(f => { // 表单的校验: 直接使用form的validateForm方法即可
|
||||
if (f.isValid) { // 校验听过: 走保存接口
|
||||
this.saveLoading = true;
|
||||
const params = this.form.getFormParams();
|
||||
API.saveForm(params).then(action(
|
||||
result => {
|
||||
this.saveLoading = false;
|
||||
if (result.api_status) { // 保存成功: 1、给出提示 2、刷新form数据
|
||||
message.success(`${getLabel(18758, "保存成功")}`);
|
||||
this.getBaseForm();
|
||||
} else {
|
||||
message.error(`${getLabel(22620, "保存失败")}`);
|
||||
}
|
||||
}
|
||||
));
|
||||
} else {
|
||||
f.showErrors();
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
@action
|
||||
@action("日志显隐开关")
|
||||
setLogVisible = bool => this.logVisible = bool;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue