等级方案页面

This commit is contained in:
Chengliang 2022-05-06 16:53:43 +08:00
parent a2fa127bfe
commit b7c99835da
10 changed files with 1423 additions and 40 deletions

View File

@ -1,6 +1,6 @@
import { WeaTools } from 'ecCom';
//组织架构图(简单)
//组织架构图(简单)
export const getSimpleOrganizationDatas = params => {
return WeaTools.callApi('/api/hrm/module/organization/simple/datas', 'GET', params);
};

View File

View File

@ -0,0 +1,246 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('rankScheme')
@observer
export default class RankScheme extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
rankScheme
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
rankScheme
} = this.props;
rankScheme.getTableInfo();
rankScheme.getHasRight();
}
getTopMenuBtns() {
const {
rankScheme
} = this.props;
const {
topMenu,
tableStore
} = rankScheme;
let btns = [];
topMenu.map((item, i) => {
if (item.menuFun !== 'batchDelete') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
} else {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
//点击事件
handleClick(item) {
}
getDropMenuDatas() {
const {
rankScheme
} = this.props;
const {
rightMenu
} = rankScheme;
let menus = [];
toJS(rightMenu).map((item, index) => {
let obj = {
key: item.menuFun,
icon: <i className={`${item.menuIcon}`} />,
content: item.menuName,
}
if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') {
obj.disabled = true;
}
menus.push(obj);
})
return menus;
}
handleMenuClick(key) {
}
getTabBtn() {
const {
rankScheme
} = this.props;
const {
form2
} = rankScheme;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { rankScheme.getTableInfo(); rankScheme.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => rankScheme.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
rankScheme
} = this.props;
const {
form2
} = rankScheme;
rankScheme.schemeName(val);
//!this.isEmptyObject(form2.getFormParams()) && hrmOfficeAddress.updateFields(val);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
// if (c.dataIndex == 'schemename') {
// c.render = function(text, record) {
// return <a onClick={() => _this.doEdit(record.randomFieldId)} >{record.locationname}</a>
// }
// };
})
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
// (index == '0') && this.doEdit(record.randomFieldId);
// (index == '1') && this.doDel(record.randomFieldId);
// (index == '2') && this.deLog(record.randomFieldId);
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
// 通过 rowSelection 对象表明需要行选择
const rowSelection = {
onChange(selectedRowKeys, selectedRows) {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
},
onSelect(record, selected, selectedRows) {
console.log(record, selected, selectedRows);
},
onSelectAll(selected, selectedRows, changeRows) {
console.log(selected, selectedRows, changeRows);
},
};
const {
rankScheme
} = this.props;
const {
isPanelShow, form2, schemeName, conditionNum, tableStore
} = rankScheme;
return (
<div ref='page' style={{ height: '100%' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getDropMenuDatas()}
onClick={key => this.handleMenuClick(key)}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
title={i18n.label.schemeName()}
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(e) => this.handleMenuClick(e)}
>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? schemeName : form2.getFormParams().name}
setShowSearchAd={bool => rankScheme.setPanelStatus(bool)}
hideSearchAd={() => rankScheme.setPanelStatus(false)}
// searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => rankScheme.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
rowSelection={rowSelection}
/>
</WeaTop>
</WeaRightMenu>
</div>
)
}
}

View File

@ -15,7 +15,7 @@ import '../../style/index.less';
import { Button, Image } from 'antd';
import { WeaLogView } from 'comsMobx';
import { WeaTop, WeaRightMenu, WeaLocaleProvider, WeaNewScroll } from 'ecCom';
import { renderNoright, renderLoading, getSearchs,renderNoData,isEmpty } from '../../util'; // 从util文件引入公共的方法
import { renderNoright, renderLoading, getSearchs, renderNoData, isEmpty } from '../../util'; // 从util文件引入公共的方法
const getLabel = WeaLocaleProvider.getLabel;
const WeaLogViewComp = WeaLogView.Component;
@ -45,14 +45,13 @@ export default class simpleOrg extends React.Component {
render() {
const { simpleOrgStore } = this.props;
const { loading, hasRight, form, condition, data, horizontal, collapsable, expandAll, labelClassName, treeType,scale } = simpleOrgStore; // 从后台取数据 和 方法
//alert(JSON.stringify(data))
const { loading, hasRight, form, condition, data, horizontal, collapsable, expandAll, labelClassName, treeType, scale } = simpleOrgStore; // 从后台取数据 和 方法
if (!hasRight && !loading) { // 无权限处理
return renderNoright();
}
if(isEmpty(data)) { //无数据处理
if (isEmpty(data)) { //无数据处理
return renderNoData();
}
@ -65,9 +64,9 @@ export default class simpleOrg extends React.Component {
{/* {getSearchs(form, toJS(condition), 1)} 初始化表单*/}
<BaseForm getSearch={this.getSearch} />
<div className="m-t-lg text-center" id="node" style={{
transform: `scale(${scale}) translate(${0}px, ${0}px)`,
transformOrigin: "center top"
}}>
transform: `scale(${scale}) translate(${0}px, ${0}px)`,
transformOrigin: "center top"
}}>
<OrgTree
data={toJS(data)}
horizontal={horizontal}
@ -81,7 +80,7 @@ export default class simpleOrg extends React.Component {
>
</OrgTree>
</div>
<AffixComs orgStore={simpleOrgStore}/>
<AffixComs orgStore={simpleOrgStore} />
{/* <Slider /> */}
</div>
}

View File

@ -1,15 +1,14 @@
import React from 'react';
import Route from 'react-router/lib/Route';
import { WeaLocaleProvider } from 'ecCom'
import SimpleOrg from './components/tree/index';
import StandardOrg from './components/tree/standard_org'
import RankScheme from './components/postionrank/RankScheme';
import stores from './stores';
import './style/index';
// 读取系统多语言配置
let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'ns_demo01');
let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'organization');
// 不需要读取系统多语言
getLocaleLabel = function(nextState, replace, callback) { callback();};
@ -20,6 +19,7 @@ const Routes = (
<Route key='organization' path='organization' onEnter={getLocaleLabel} component={Home}>
<Route key='index' path='index' component={SimpleOrg} />
<Route key='standard' path='standard' component={StandardOrg} />
<Route key='rankscheme' path='rankscheme' component={RankScheme} />
</Route>
);

View File

@ -1,26 +0,0 @@
---
title: demo01 - 基础表单
order: 0
demos:
- path: /spa/nonstandard/demo01/index.html#/main/ns_demo01/index
title: 基础表单
order: 0
---
## 基础表单
```
1、使用情况弹框新建编辑某个列表的数据、应用设置基本列出了表单用到的所有字段类型
2、引用组件
WeaRightMenu
WeaTop
WeaNewScroll
WeaSearchGroup
WeaFormItem
WeaSwitch
3、说明
[当前案例代码](https://gitee.com/weaver_cs/ecology-9-demo/tree/master/src4js/pc4ns/demo01)
```

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ const Root = () => (
<Provider {...allStore}>
<Router history={history}>
<Route name='root' breadcrumbName='根路由' path='/' component={Home}>
<IndexRedirect to='main/ns_demo01/index' />
<IndexRedirect to='main/organization/index' />
<Route name='main' breadcrumbName='入口' path='/main' component={Home}>
{ Module.Route }
</Route>

View File

@ -1,8 +1,10 @@
import { SimpleOrgStore } from './tree/simple_org';
import {StandardOrgStore} from './tree/standard_org'
import {RankSchemeStore} from './rankscheme';
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
standardOrgStore: new StandardOrgStore()
standardOrgStore: new StandardOrgStore(),
rankScheme: new RankSchemeStore()
};

View File

@ -0,0 +1,131 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as API from '../apis/rankscheme'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class RankSchemeStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable isEdit = true;
@observable isPanelShow = true; //高级搜索面板
@observable form2 = new WeaForm();
@observable schemeName = '';
@observable conditionNum = 2;
@action
getTableInfo() {
let params = { ...this.form2.getFormParams()};
this.tableStore = new TableStore();
this.tableStore.getDatas("de13a6ef-76e4-40d2-b9ff-01d8a37e7dfe_0638F7675486BD6B43E8CA8FD921E4EB", 1);
// Api.getSearchList(params).then(res => {
// if (res.api_status) {
// res.sessionkey && this.tableStore.getDatas("de13a6ef-76e4-40d2-b9ff-01d8a37e7dfe_0638F7675486BD6B43E8CA8FD921E4EB", 1);
// } else {
// message.warning(data.message);
// }
// }, error => {
// message.warning(error.message);
// })
}
@action
getHasRight() {
this.topMenu = [
{
"isBatch": "1",
"isTop": "1",
"menuFun": "new",
"menuIcon": "icon-coms-New-Flow",
"menuName": "新建",
"type": "BTN_Addnew"
},
{
"isBatch": "1",
"isTop": "1",
"menuFun": "import",
"menuIcon": "icon-coms-leading-in",
"menuName": "导入",
"type": "BTN_Import"
},
{
"isBatch": "1",
"isTop": "1",
"menuFun": "batchDelete",
"menuIcon": "icon-coms-Batch-delete",
"menuName": "批量删除",
"type": "BTN_BatchDelete"
}
];
this.rightMenu = [
{
"isBatch": "0",
"isTop": "1",
"menuFun": "new",
"menuIcon": "icon-coms-New-Flow",
"menuName": "新建",
"type": "BTN_Addnew"
},
{
"isBatch": "0",
"isTop": "1",
"menuFun": "import",
"menuIcon": "icon-coms-leading-in",
"menuName": "导入",
"type": "BTN_Import"
},
{
"isBatch": "0",
"isTop": "0",
"menuFun": "log",
"menuIcon": "icon-coms-Print-log",
"menuName": "日志",
"type": "BTN_log"
},
{
"isBatch": "0",
"isTop": "0",
"menuFun": "custom",
"menuIcon": "icon-coms-task-list",
"menuName": "显示列定制",
"type": "BTN_COLUMN"
}
]
}
setPanelStatus(bool) {
this.isPanelShow = bool;
}
setSchemeName(val) {
this.schemeName = val;
}
}