Merge branch 'dev' into liys_dev

This commit is contained in:
liyongshun 2022-06-04 21:50:09 +08:00
commit f3877c843f
42 changed files with 6507 additions and 1394 deletions

View File

@ -0,0 +1,25 @@
import {
WeaTools
} from 'ecCom'
/**
* 获取权限
* @param {[type]} moduleName [模块名]
* @param {Object} params [description]
* @return {[type]} [description]
*/
export const authorized = (moduleName, params = {}, apiMethod = 'getHasRight') => WeaTools.callApi(`/api/hrm/${moduleName}/${apiMethod}`, 'POST', params);
/**
* 应用分权
*/
export const detachable = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachable', 'GET', params);
export const getDetachableAll = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachableAll', 'GET', params);
export const checkAuthAndDetach = (moduleName, params = {}, apiMethod = 'getHasRight') => Promise.all([authorized(moduleName, params = {}, apiMethod || 'getHasRight'), detachable()])
export const exportExcel = (params = {}) => WeaTools.callApi('/api/ec/dev/table/export', 'POST', params)
export const isEnableMultiLang = (params = {}) => WeaTools.callApi('/api/hrm/common/isEnableMultiLang', 'GET', params)
export const getPinYin = (params = {}) => WeaTools.callApi('/api/workflow/formSetting/fieldSet/getPinYin', 'POST', params)

View File

@ -0,0 +1,91 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
//return WeaTools.callApi('/api/bs/hrmorganization/comp/listComp', 'POST', params);
return fetch('/api/bs/hrmorganization/comp/listComp', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getDeptListByPid = (params) => {
return fetch('/api/bs/hrmorganization/dept/getDeptListByPid', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/comp/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/comp/saveBaseComp', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const editResource = (params) => {
// return fetch('/api/bs/hrmorganization/comp/updateComp', {
// method: 'POST',
// mode: 'cors',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(params)
// })
return WeaTools.callApi('/api/bs/hrmorganization/comp/updateComp', 'POST', params);
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getCompanyForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params);
}
export const getCompanyExtendForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,89 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return fetch('/api/bs/hrmorganization/dept/listPage', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/dept/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/dept/getSearchCondition', 'GET', params);
}
export const getHrmListByJobId = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params);
}
export const getCopyForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/dept/saveBaseForm', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const copy = (params) => {
return fetch('/api/bs/hrmorganization/job/copyJobItem', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const editResource = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/dept/updateForm', 'POST', params);
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getDeptForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/dept/getSaveForm', 'GET', params);
}
export const getDeptExtendForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/dept/getDeptBaseForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/dept/getHasRight', 'GET', params);
}

View File

@ -5,7 +5,7 @@ import {
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/scheme/updateScheme', {
return fetch('/api/bs/hrmorganization/group/updateGroup', {
method: 'POST',
mode: 'cors',
headers: {
@ -21,7 +21,7 @@ export const getTabInfo = (params) => {
export const getGroupForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/group/getCompanyFormField', 'GET', params);
return WeaTools.callApi('/api/bs/hrmorganization/group/getGroupFormField', 'GET', params);
}
export const getHasRight = (params) => {

View File

@ -0,0 +1,89 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return fetch('/api/bs/hrmorganization/job/listPage', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/job/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getSearchCondition', 'GET', params);
}
export const getHrmListByJobId = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params);
}
export const getCopyForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/job/saveBaseForm', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const copy = (params) => {
return fetch('/api/bs/hrmorganization/job/copyJobItem', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const editResource = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/updateForm', 'POST', params);
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/job/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getJobForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getSaveForm', 'GET', params);
}
export const getJobExtendForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,53 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/staff/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/staff/saveStaff', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/staff/updateStaff', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,64 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getTable', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/staffplan/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getSchemeForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,78 @@
import {
WeaPopoverHrm,
WeaLocaleProvider
} from 'ecCom';
import {
WeaLogView
} from 'comsMobx';
import {
isEnableMultiLang
} from '../apis/common';
const WeaLogViewComp = WeaLogView.Component;
const {
LogStore
} = WeaLogView;
class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
key: new Date().getTime(),
visible: false,
logStore: new LogStore(),
logType: '4',
logSmallType: ''
}
window.setLogViewProps = this.setLogViewProps;
}
componentDidMount(){
isEnableMultiLang().then(data => {
window.inputType = {
inputType: 'NORMAL'
}
if (data.status === '1') {
if (data.isEnableMultiLang) {
window.inputType = {
inputType: 'MULTILANG',
isBase64: true
}
}
}
}, error => {
window.inputType = {
inputType: 'NORMAL'
}
});
}
setLogViewProps = (props) => {
this.setState({
key: new Date().getTime(),
targetId: '',
visible: true,
logType: '4',
logStore: new LogStore(),
...props
});
}
onCancel = () => {
this.setState({
visible: false
})
}
render() {
//const isSingle = window.location.pathname.indexOf('/spa/hrm/engine') > -1;
return (
<div style={{height:"100%"}}>
<WeaPopoverHrm ecId={`${this && this.props && this.props.ecId || ''}_WeaPopoverHrm@jp3tsb`} />
<WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@mc1954`} {...this.state} onCancel={this.onCancel}/>
<WeaLocaleProvider ecId={`${this && this.props && this.props.ecId || ''}_WeaLocaleProvider@3on3aj`}>
{this.props.children}
</WeaLocaleProvider>
</div>
)
}
}
export default Home

View File

@ -0,0 +1,91 @@
import {
WeaDialog,
WeaFormItem,
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
WeaTable
} from 'ecCom'
import {
Spin,
Button,
} from 'antd'
import {
WeaSwitch
} from 'comsMobx'
import {
i18n
} from '../public/i18n';
export default class NewTableDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 800,
}
}
render() {
const {
title,
visible,
onCancel,
loading,
height,
dataSource,
columns
} = this.props, {
width,
} = this.state;
const pagination = {
total: dataSource.length,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
},
onChange(current) {
},
showTotal(total) {
return `${total}`
}
};
const buttons = [
//(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
];
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
title={title}
icon="icon-coms-hrm"
iconBgcolor="#217346"
visible={visible}
closable={true}
hasScroll={true}
onCancel={() => onCancel()}
buttons={buttons}
style={{ width: width, height: height }}
>
{
loading ? <div className='hrm-loading-center-small'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
</div> : <WeaTable rowKey={record => record.id}
dataSource={dataSource} childrenColumnName="children"
columns={columns}
loading={loading}
pagination={pagination}
indentSize={15}
/>
}
</WeaDialog>
)
}
}

View File

@ -0,0 +1,71 @@
import {
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
WeaDialog
} from 'ecCom'
import {
Spin,
Button,
Pagination
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../public/i18n';
import '../style/common.less';
const WeaTable = WeaTableNew.WeaTable;
export default class NewWeaTableDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 800,
}
}
render() {
const {
title,
visible,
onCancel,
height,
tableStore
} = this.props, {
width,
} = this.state;
const buttons = [
//(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
];
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
title={title}
icon="icon-coms-hrm"
iconBgcolor="#217346"
visible={visible}
closable={true}
hasScroll={true}
onCancel={() => onCancel()}
buttons={buttons}
style={{ width: width, height: height }}
>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
/>
</WeaDialog>
)
}
}

View File

@ -1,3 +1,10 @@
/**
* @Author: 程亮
* @Date: 2022-05-18 14:52:39
* @LastEditTime: 2022-05-26 17:11:02
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js
*/
import { Button, Modal, message, Row, Col, Spin } from 'antd';
import isEmpty from 'lodash/isEmpty'
import cloneDeep from 'lodash/cloneDeep'
@ -21,22 +28,26 @@ export default class CompanyExtend extends React.Component {
this.init();
}
init = () => {
const { companyExtend } = this.props;
const { companyExtend,company } = this.props;
//const {id} = company;
let {hash} = window.location;
hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0];
companyExtend.init();
// companyExtend.hrmId=hrmId;
companyExtend.setId(id);
companyExtend.getData();
}
getTabChildren = () => {
const { companyExtend } = this.props;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys } = companyExtend;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = companyExtend;
let tabChildren = [];
tableInfo = toJS(tableInfo);
tableInfo && tableInfo.map((t, i) => {
if (tabkey == i) {
if (detailSelectedKey == i) {
tabChildren.push(
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
//ref={(ref)=>companyExtend.setPersonalEditTables(ref)}
ref={(ref)=>companyExtend.setPersonalEditTables(ref)}
showTitle={isEditor}
// title={'列表信息'}
//addFirstRow={isEditor}
@ -127,10 +138,10 @@ export default class CompanyExtend extends React.Component {
tableEditChange = (data) => {
const { companyExtend } = this.props;
let { tabkey = '0', tableInfo } = companyExtend;
let { detailSelectedKey = '0', tableInfo } = companyExtend;
tableInfo = toJS(tableInfo);
let d = cloneDeep(tableInfo);
d[Number(tabkey)].tabinfo.datas = data;
d[Number(detailSelectedKey)].tabinfo.datas = data;
companyExtend.updateTableInfo(d);
}
@ -217,7 +228,7 @@ export default class CompanyExtend extends React.Component {
render() {
const { companyExtend } = this.props;
const { loading, detailSelectedKey, tabInfo,topTab,selectedKey } = companyExtend;
const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = companyExtend;
// if(!hasRight && !loading){
// return (
@ -227,7 +238,7 @@ export default class CompanyExtend extends React.Component {
// )
// }
// try {
try {
return (
<div className='hrm-my-cardInfo' style={{ height: '100%', position: 'relative' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
@ -267,11 +278,11 @@ export default class CompanyExtend extends React.Component {
</div>
)
// } catch (e) {
// return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
// <div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
// </WeaAlertPage>
// }
} catch (e) {
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
</WeaAlertPage>
}
}
}

View File

@ -1,9 +1,509 @@
import React, { Component } from 'react'
/**
* @Author: 程亮
* @Date: 2022-05-18 16:23:32
* @LastEditTime: 2022-06-01 17:15:50
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaTable
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch,
Menu, Dropdown, Icon
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
export default class Company extends Component {
render() {
import '../../style/common.less';
import NewTableDialog from '../NewTableDialog';
import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTable from '../NewWeaTableDialog';
import { renderLoading } from '../../util'; // 从util文件引入公共的方法
const toJS = mobx.toJS;
const confirm = Modal.confirm;
//const WeaTable = WeaTableNew.WeaTable
@inject('company')
@observer
export default class Company extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
company
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
company
} = this.props;
company.getTableInfo();
company.getHasRight();
}
getTopMenuBtns() {
const {
company
} = this.props;
const {
topMenu,
selectedRowKeys
} = company;
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={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
company
} = this.props;
const {
isPanelShow
} = company;
isPanelShow && company.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
company
} = this.props;
company.setNeDialogTitle(i18n.label.companyName());
company.setNewVisible(true);
company.getCompanyForm();
}
//联查部门
select(id) {
const {
company
} = this.props;
company.setNeDialogTitle(i18n.label.companyName());
company.setVisible(true);
company.setDialogLoadingStatus(true);
company.getDeptTable(id);
}
batchDelete() {
const {
company
} = this.props;
const {
selectedRowKeys
} = company;
let keys = toJS(selectedRowKeys).toString();
company.setIds(keys);
this.showConfirm('batchDel');
}
showConfirm(v) {
let _this = this;
confirm({
title: i18n.confirm.defaultTitle(),
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
_this.onOk();
},
onCancel() {
return false;
},
});
}
onOk() {
const {
company
} = this.props;
company.delete();
}
getDropMenuDatas() {
const {
company
} = this.props;
const {
rightMenu
} = company;
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) {
const {
company
} = this.props;
const {
isPanelShow
} = company;
isPanelShow && company.setPanelStatus(false);
this[key] && this[key]();
}
onSearchChange(val) {
const {
company
} = this.props;
const {
form
} = company;
company.setCompanyName(val);
!this.isEmptyObject(form.getFormParams()) && company.updateFields(val);
}
reRenderColumns(columns) {
const {
company
} = this.props;
let _this = this;
// `${columns}` && columns.push({
// title: '',
// dataIndex: 'ops',
// key: 'ops',
// width: 80,
// className:"wea-table-operates",
// render: ( text, record, index )=> {
// const menu = (
// <Menu>
// <Menu.Item>
// <a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
// </Menu.Item>
// <Menu.Item>
// <a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
// </Menu.Item>
// </Menu>
// )
// return (
// <Dropdown overlay={menu}>
// <i class="icon-coms-more" />
// </Dropdown>
// )
// }
// });
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
return <Switch defaultChecked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'compName') {
c.render = function (text, record) {
return <a onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank")
}}>{text}</a>
}
}
if (c.dataIndex == 'operate') {
c.className = "wea-table-operates"
c.width = 80
c.render = function (text, record) {
const menu = (
<Menu>
{
record.isUsed === 0 ? <Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item> : ''
}
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
</Menu.Item>
</Menu>
)
return <Dropdown overlay={menu}>
<i class="icon-coms-more" />
</Dropdown>
}
}
})
return columns;
}
updateForbiddenTag(checked, id) {
const {
company
} = this.props;
company.updateForbiddenTag(checked, id);
}
doDel(id) {
const {
company
} = this.props;
company.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
company
} = this.props;
company.save();
}
getTabBtn() {
const {
company
} = this.props;
const {
form
} = company;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => company.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
getPanelComponents() {
const {
company
} = this.props;
const {
searchCondition,
form,
searchConditionLoading
} = company;
let arr = [];
let formParams = form.getFormParams();
const {
isFormInit
} = form;
isFormInit && searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index % 2 == 0) ? 10 : 11} offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
})
if (searchConditionLoading) {
return (
<div>C</div>
<div className='hrm-loading-center-small' style={{ top: '25%' }}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
company.getTableInfo();
company.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
company
} = this.props;
const {
isPanelShow, companyName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init
} = company;
const rowSelection = {
onChange(selectedRowKeys, selectedRows) {
company.setSelectedRowKeys(selectedRowKeys);
},
getCheckboxProps: record => ({
disabled: record.isUsed === 1, // 配置无法勾选的列
}),
};
const pagination = {
current: current,
pageSize: pageSize,
total: total,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
},
onChange(current) {
},
showTotal(total) {
return `${total}`
}
};
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.companyName()}
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(form.getFormParams()) ? companyName : form.getFormParams().companyName}
setShowSearchAd={bool => company.setPanelStatus(bool)}
hideSearchAd={() => company.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => {
company.setCurrent(1);
company.setPageSize(10);
company.getTableInfo()
}}
onSearchChange={val => this.onSearchChange(val)}
/>
{
init ? <div className='hrm-new-weatable-spin'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
</div> :
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
loading={loading}
dataSource={dataSource} childrenColumnName="children"
columns={this.reRenderColumns(columns)}
rowSelection={rowSelection}
pagination={pagination}
onChange={(pagination, filters, sorter) => {
company.setCurrent(pagination.current);
company.setPageSize(pagination.pageSize);
company.getTableInfo();
}}
indentSize={15}
/>
}
</WeaTop>
</WeaRightMenu>
<NewTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
loading={dialogLoading}
height={400}
dataSource={deptDataSource} //联查部门数据
columns={deptColumns}
onCancel={() => company.setVisible(false)}
/>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={newVisible}
condition={toJS(condition)}
form={form1}
isFormInit={form1.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={300}
conditionLen={4}
save={() => this.handleSave()}
onCancel={() => company.setNewVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,92 @@
import {
WeaDialog,
WeaFormItem,
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
} from 'ecCom'
import {
Spin,
Button,
} from 'antd'
import {
WeaSwitch
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
export default class NewPopconfirm extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 700,
}
}
getForm() {
const {
condition,
form,
isFormInit,
} = this.props;
let arr = [];
isFormInit && condition.map(c => {
c.items.map((field, index) => {
arr.push(<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@jacv6v@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
error={form.getError(field)}
tipPosition="bottom"
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7vxyfr@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} />}
</WeaFormItem>)
})
})
return <div className="wea-form-item-group">{arr}</div>
}
render() {
const {
title,
visible,
save,
onCancel,
loading,
height,
} = this.props, {
width,
} = this.state;
const buttons = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.ok()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => onCancel()} disabled={loading}>{i18n.button.cancel()}</Button>)
];
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
title={title}
icon="icon-coms-hrm"
iconBgcolor="#217346"
visible={visible}
closable={true}
hasScroll={true}
onCancel={() => onCancel()}
buttons={buttons}
style={{ width: width, height: height }}
>
{
loading ? <div className='hrm-loading-center-small'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
</div>
: this.getForm()
}
</WeaDialog>
)
}
}

View File

@ -0,0 +1,635 @@
/**
* @Author: 程亮
* @Date: 2022-06-02 09:19:37
* @LastEditTime: 2022-06-02 16:41:55
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js
*/
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaTable,
WeaLeftRightLayout,
WeaOrgTree
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch,
Menu, Dropdown, Icon
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTableDialog from '../NewWeaTableDialog';
import NewPopconfirm from './NewPopconfirm'
const toJS = mobx.toJS;
const confirm = Modal.confirm;
@inject('department')
@observer
export default class Department extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
department
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
department
} = this.props;
department.getTableInfo();
department.getHasRight();
department.getCopyForm();
}
getTopMenuBtns() {
const {
department
} = this.props;
const {
topMenu,
selectedRowKeys
} = department;
let btns = [];
topMenu.map((item, i) => {
if (item.menuFun === 'batchDelete') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else if (item.menuFun === 'copy') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
department
} = this.props;
const {
isPanelShow
} = department;
isPanelShow && department.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
department
} = this.props;
department.setNeDialogTitle(i18n.label.deptManage());
department.setNewVisible(true);
department.getDeptForm();
}
//联查岗位
select(id) {
// const {
// department
// } = this.props;
// department.setNeDialogTitle("联查人员");
// department.setVisible(true);
// department.getHrmTable(id);
}
//合并
merge(id){
const {
department
} = this.props;
department.setNeDialogTitle(i18n.label.mergeDept());
department.confirmVisible(true);
department.getMergeForm();
}
//转移
transfer(id) {
const {
department
} = this.props;
department.setNeDialogTitle(i18n.label.mergeDept());
department.confirmVisible(true);
department.getTransferForm();
}
copy() {
const {
department
} = this.props;
const {
selectedRowKeys
} = department;
let keys = toJS(selectedRowKeys).toString();
department.setIds(keys);
confirm({
title: i18n.confirm.defaultTitle(),
content: this.getCopyForm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
department.copy()
},
onCancel() {
return false;
},
});
}
getCopyForm() {
const {
department
} = this.props;
const {
copyCondition,
form2,
} = department;
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
let arr = [];
isFormInit && copyCondition.map(c => {
c.items.map((field, index) => {
arr.push(
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
</WeaFormItem>
)
})
})
return arr;
}
batchDelete() {
const {
department
} = this.props;
const {
selectedRowKeys
} = department;
let keys = toJS(selectedRowKeys).toString();
department.setIds(keys);
this.showConfirm('batchDel');
}
showConfirm(v) {
let _this = this;
confirm({
title: i18n.confirm.defaultTitle(),
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
_this.onOk();
},
onCancel() {
return false;
},
});
}
onOk() {
const {
department
} = this.props;
department.delete();
}
getDropMenuDatas() {
const {
department
} = this.props;
const {
rightMenu
} = department;
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) {
const {
department
} = this.props;
const {
isPanelShow
} = department;
isPanelShow && department.setPanelStatus(false);
this[key] && this[key]();
}
updateForbiddenTag(checked, id) {
const {
department
} = this.props;
department.updateForbiddenTag(checked, id);
}
onSearchChange(val) {
const {
department
} = this.props;
const {
form
} = department;
department.setDepartmentName(val);
!this.isEmptyObject(form.getFormParams()) && department.updateFields(val);
}
reRenderColumns(columns) {
const {
department
} = this.props;
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
return <Switch defaultChecked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'deptName') {
c.render = function (text, record) {
return <a href='javascript:void(0);' onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${record.id}`, "_blank")
}}>{text}</a>
}
}
if (c.dataIndex == 'operate') {
c.className = "wea-table-operates"
c.width = 80
c.render = function (text, record) {
const menu = (
<Menu>
{
record.isUsed === 0 ? <Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item> : ''
}
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.merge(record.id) }}>合并</a>
</Menu.Item>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.transfer(record.id) }}>转移</a>
</Menu.Item>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查岗位</a>
</Menu.Item>
</Menu>
)
return <Dropdown overlay={menu}>
<i class="icon-coms-more" />
</Dropdown>
}
}
})
return columns;
}
doDel(id) {
const {
department
} = this.props;
department.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
department
} = this.props;
department.save();
}
getTabBtn() {
const {
department
} = this.props;
const {
form
} = department;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { department.setCurrent(1); department.setPageSize(10); department.getTableInfo(); department.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => department.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
getPanelComponents() {
const {
department
} = this.props;
const {
searchCondition,
form,
searchConditionLoading
} = department;
let arr = [];
let formParams = form.getFormParams();
const {
isFormInit
} = form;
isFormInit && searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index % 2 == 0) ? 10 : 11} offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
})
if (searchConditionLoading) {
return (
<div className='hrm-loading-center-small' style={{ top: '25%' }}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
department.getTableInfo();
department.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
//左侧树
getTree = () => {
const {
department
} = this.props;
const {
companysId,
} = department
let tree = (
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
ref='WeaOrgTree'
dataUrl={"/api/bs/hrmorganization/dept/getSearchTree"}
loading
needSearch
noCache={true}
needDropMenu={false}
//onSelect={this.selectVirtual} //组织维度回调函数
isLoadSubDepartment={true}
topPrefix={'hrmSearch'}
companysId={companysId}
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
treeNodeClick={this.treeNodeClick}
expandAllChildrenOnSearch={true}
/>
)
return tree;
}
treeNodeClick = (event, ids, nodeids, nodes) => {
const {
department
} = this.props;
const {
form,
companysId
} = department;
const type = event.node.props.type || '0';
const id = event.node.props.id || '';
let params = {};
form.resetConditionValue();
department.setPanelStatus(false)
// department.tabkey = 'default_3';
department.nodeType = type;
if (type == '0') {
params['virtualtype'] = companysId;
}
if (type == '1') {
params['subcompanyid1'] = id;
}
if (type == '2') {
params['departmentid'] = id;
}
department.doSearch(params);
}
render() {
const {
department
} = this.props;
const {
isPanelShow, departmentName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init,
defaultShowLeft,confirmVisible,confirmLoading
} = department;
const rowSelection = {
onChange(selectedRowKeys, selectedRows) {
department.setSelectedRowKeys(selectedRowKeys);
},
getCheckboxProps: record => ({
disabled: record.isUsed === 1, // 配置无法勾选的列
}),
};
const pagination = {
current: current,
pageSize: pageSize,
total: total,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
},
onChange(current) {
},
showTotal(total) {
return `${total}`
}
};
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.deptManage()}
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(e) => this.handleMenuClick(e)}
>
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@7muhhb`} isNew={true} showLeft={defaultShowLeft} leftCom={this.getTree()}>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form.getFormParams()) ? departmentName : form.getFormParams().departmentName}
setShowSearchAd={bool => department.setPanelStatus(bool)}
hideSearchAd={() => department.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => {
department.setCurrent(1);
department.setPageSize(10);
department.getTableInfo()
}}
onSearchChange={val => this.onSearchChange(val)}
/>
{
init ? <div className='hrm-new-weatable-spin'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
</div> :
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
loading={loading}
dataSource={dataSource} childrenColumnName="children"
columns={this.reRenderColumns(columns)}
rowSelection={rowSelection}
pagination={pagination}
onChange={(pagination, filters, sorter) => {
department.setCurrent(pagination.current);
department.setPageSize(pagination.pageSize);
department.getTableInfo();
}}
indentSize={15}
/>
}
</WeaLeftRightLayout>
</WeaTop>
</WeaRightMenu>
<NewWeaTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
height={400}
tableStore={tableStore}
onCancel={() => department.setVisible(false)}
/>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={newVisible}
condition={toJS(condition)}
form={form1}
isFormInit={form1.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={300}
conditionLen={13}
save={() => this.handleSave()}
onCancel={() => department.setNewVisible(false)}
enable={false} //是否开启字段联动
/>
<NewPopconfirm ecId={`${this && this.props && this.props.ecId || ''}_NewPopconfirm@q4rrwm`}
title={nEdialogTitle}
visible={confirmVisible}
condition={toJS(condition)}
form={form1}
isFormInit={form1.isFormInit}
loading={confirmLoading}
height={300}
save={() => this.handleSave()}
onCancel={() => department.setNewVisible(false)}
/>
</div>
)
}
}

View File

@ -0,0 +1,282 @@
/**
* @Author: 程亮
* @Date: 2022-06-02 09:20:03
* @LastEditTime: 2022-06-02 11:40:57
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js
*/
import { Button, Modal, message, Row, Col, Spin } from 'antd';
import isEmpty from 'lodash/isEmpty'
import cloneDeep from 'lodash/cloneDeep'
import forEach from 'lodash/forEach'
import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom'
import { WeaSwitch } from 'comsMobx';
import { inject, observer } from 'mobx-react';
import * as mobx from 'mobx';
import { i18n } from '../../public/i18n';
const toJS = mobx.toJS;
import '../../style/common.less';
@inject('departmentExtend')
@inject('department')
@observer
export default class DepartmentExtendStore extends React.Component {
componentDidMount() {
this.init();
}
init = () => {
const { departmentExtend,department } = this.props;
let {hash} = window.location;
hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0];
departmentExtend.init();
departmentExtend.setId(id);
departmentExtend.getData();
}
getTabChildren = () => {
const { departmentExtend } = this.props;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = departmentExtend;
let tabChildren = [];
tableInfo = toJS(tableInfo);
tableInfo && tableInfo.map((t, i) => {
if (detailSelectedKey == i) {
tabChildren.push(
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
ref={(ref)=>departmentExtend.setPersonalEditTables(ref)}
showTitle={isEditor}
// title={'列表信息'}
//addFirstRow={isEditor}
columns={t.tabinfo.columns}
datas={t.tabinfo.datas}
onChange={this.tableEditChange}
selectedRowKeys={toJS(selectedRowKeys)}
onRowSelect={keys => onRowSelect(keys)}
onBtnsSelect={key => this.onBtnsSelect(key, i)}
viewAttr={isEditor ? 2 : 1}
getRowSelection={isEditor ? (rowSelection) => {
Object.assign(rowSelection, {
getCheckboxProps: record => ({
disabled: record.viewAttr === 1, // 配置无法勾选的列
})
})
return rowSelection;
} : () => null}
/>
);
}
})
return tabChildren;
}
onBtnsSelect = (key, index) => {
const {
departmentExtend
} = this.props, {
tableInfo,
selectedRows,
setSelectedRowKeys,
selectedRowKeys
} = departmentExtend;
const datas = tableInfo[index].tabinfo.datas;
if (key === 'copy') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (!selectedRows[index].includes(i)) {
data.viewAttr = 2;
}
return data
})
}
if (key === 'delete') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (selectedRows[index].includes(i)) {
data.viewAttr = 1;
}
return data
});
setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row)))
}
}
getSearchs = () => {
const { departmentExtend } = this.props;
let { form, conditions, isEditor } = departmentExtend;
const { isFormInit } = form;
let group = [];
let tipPosition = 'bottom';
window.e9HideFormFieldKeys = [];
isFormInit && conditions.forEach((c, i) => {
let items = [];
c.items.forEach((field, j) => {
if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
window.e9HideFormFieldKeys.push(field.domkey[0]);
} else {
items.push({
com: (<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@vh6j67@${j}`}
underline={!isEditor}
label={`${field.label}`}
error={form.getError(field)}
tipPosition={tipPosition}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
</WeaFormItem>),
colSpan: 1
});
}
});
group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@x9hby9@${i}`} className={`${isEditor ? 'hrm-center' : ''}`}
needTigger={true} hide={c.hide} title={c.title} showGroup={c.defaultshow} items={items} col={2} />)
});
return group;
}
tableEditChange = (data) => {
const { departmentExtend } = this.props;
let { detailSelectedKey = '0', tableInfo } = departmentExtend;
tableInfo = toJS(tableInfo);
let d = cloneDeep(tableInfo);
d[Number(detailSelectedKey)].tabinfo.datas = data;
departmentExtend.updateTableInfo(d);
}
getRightMenu = () => {
const { departmentExtend } = this.props;
const { isEditor, buttons } = departmentExtend;
let arr = [];
try {
if (buttons.hasEdit) {
if (isEditor) {
arr = [{
icon: <i className='icon-coms-common' />,
content: i18n.button.save(),
key: 'save',
onClick: key => {
this.saveEditCard();
}
}, {
icon: <i className='icon-coms-go-back' />,
content: i18n.button.back(),
key: 'back',
onClick: key => {
this.backCard();
}
}]
} else {
arr = [{
icon: <i className='icon-coms-edit' />,
content: i18n.button.modify(),
key: 'editCard',
onClick: key => {
this.editCard();
}
}
]
}
}
} catch (e) { }
return arr;
}
getTopButtons = () => {
const { departmentExtend } = this.props;
const { isEditor, buttons } = departmentExtend;
const save = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pkes6y`} type="primary" onClick={this.saveEditCard} >{i18n.button.save()}</Button>;
const back = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pl1fw8`} type="primary" onClick={this.backCard} >{i18n.button.back()}</Button>;
const edit = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vkeda5`} type="primary" onClick={this.editCard} >{i18n.button.modify()}</Button>;
const btns = [];
try {
if (isEditor) {
if (buttons.hasSave) {
btns.push(save);
btns.push(back);
}
} else {
if (buttons.hasEdit) {
btns.push(edit);
}
}
} catch (e) { }
return btns;
}
editCard = () => {
const { departmentExtend } = this.props;
departmentExtend.edit();
}
saveEditCard = () => {
const { departmentExtend } = this.props;
departmentExtend.save();
}
backCard = () => {
this.init();
}
changeData(key) {
const {
departmentExtend
} = this.props;
departmentExtend.changeData(key);
}
render() {
const { departmentExtend } = this.props;
const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = departmentExtend;
try {
return (
<div className='hrm-my-cardInfo' style={{ height: '100%', position: 'relative' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getRightMenu()}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
loading={true}
buttons={this.getTopButtons()}
showDropIcon={true}
dropMenuDatas={this.getRightMenu()}
>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
datas={topTab}
keyParam="viewCondition" //主键
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
/>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4fj4z2`} spinning={loading}>
{this.getSearchs()}
{
!isEmpty(tabInfo) && <div className='hrm-my-cardInfo_detial_tabs'>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@vjrq63`}
type='card'
keyParam='key'
datas={toJS(tabInfo)}
selectedKey={detailSelectedKey}
onChange={v => {
departmentExtend.updateDetailSelectedKey(v);
}}
/>
{this.getTabChildren()}
</div>
}
</Spin>
</WeaTop>
</WeaRightMenu>
</div>
)
} catch (e) {
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
</WeaAlertPage>
}
}
}

View File

@ -1,268 +0,0 @@
/*
* Author: 黎永顺
* Description: 部门管理
* Date: 2022-05-20 08:54:59
* LastEditTime: 2022-05-20 09:34:30
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { i18n } from "../../public/i18n";
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaLeftRightLayout,
WeaTable,
} from "ecCom";
const data = [
{
key: 1,
name: "a",
age: 32,
address: "我是a",
children: [
{
key: 11,
name: "aa",
age: 33,
address: "我是aa",
},
{
key: 12,
name: "ab",
age: 33,
address: "我是ab",
children: [
{
key: 121,
name: "aba",
age: 33,
address: "我是aba",
},
],
},
{
key: 13,
name: "ac",
age: 33,
address: "我是ac",
children: [
{
key: 131,
name: "aca",
age: 33,
address: "我是aca",
children: [
{
key: 1311,
name: "acaa",
age: 33,
address: "我是acaa",
},
{
key: 1312,
name: "acab",
age: 33,
address: "我是acab",
},
],
},
],
},
],
},
{
key: 2,
name: "b",
age: 32,
address: "我是b",
},
];
@observer
class DepartmentManage extends Component {
constructor(props) {
super(props);
this.state = {};
}
/**
* name: 右击菜单列表
* return {*}
*/
getDropMenuDatas = () => {
let menus = [];
[].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;
};
/**
* name: 右键菜单点击的回调
* param undefined
* return {*}
*/
handleMenuClick = (key) => {
// const { officeManageStore } = this.props;
// const { isPanelShow } = officeManageStore;
// isPanelShow && officeManageStore.setPanelStatus(false);
switch (key) {
case "new":
default:
break;
}
};
/**
* name: 顶部操作按钮
* return {*}
*/
getTopMenuBtns = () => {
let btns = [
<Button type="primary">新增</Button>,
<Button type="primary">复制</Button>,
<Button type="primary">批量删除</Button>,
];
// [].map((item, i) => {
// if (item.menuFun !== "batchDelete") {
// btns.push(<Button type="primary">新增</Button>);
// btns.push(<Button type="primary">复制</Button>);
// } else {
// btns.push(
// <Button type="primary" disabled={true}>
// 批量删除
// </Button>
// );
// }
// });
return btns;
};
/**
* name: 搜索面板底部按钮组
* return {*}
*/
getTabBtn = () => {
const btn = [
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5b3aeb`}
type="primary">
{i18n.button.search()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@8acd45`}>
{i18n.button.reset()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@06e592`}>
{i18n.button.cancel()}
</Button>,
];
return btn;
};
/**
* name: 表格内复选框设置
* return {*}
*/
rowSelection = () => {
return {
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);
},
};
};
render() {
const columns = [
{
title: "姓名",
dataIndex: "name",
key: "name",
width: "40%",
},
{
title: "年龄",
dataIndex: "age",
key: "age",
width: "30%",
},
{
title: "住址",
dataIndex: "address",
key: "address",
width: "30%",
},
];
return (
<div className="depart-wapper">
<WeaRightMenu
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaRightMenu@a3ba4d`}
datas={this.getDropMenuDatas()}
onClick={(key) => this.handleMenuClick(key)}>
<WeaTop
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaTop@7547ff`}
title={i18n.label.departName()}
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@daa881`}
searchType={["base", "advanced"]}
showSearchAd={false} //标准高级搜索显隐
searchsBaseValue={""} //普通 base input 搜索值外部受控
setShowSearchAd={(bool) => console.log(bool)}
hideSearchAd={() => console.log(false)} //隐藏高级搜索回调
searchsAd={<div></div>} //标准高级搜索条目组
advanceHeight={Math.ceil(2 / 2) * 52 + 20} //高级搜索面板的高度
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => console.log()} //点搜索按钮时的回调
onSearchChange={(val) => console.log(val)} //在搜索框中输入的文字改变时的回调
/>
<WeaTable
columns={columns}
rowSelection={this.rowSelection}
dataSource={data}
/>
</WeaTop>
</WeaRightMenu>
</div>
);
}
}
export default DepartmentManage;

View File

@ -174,7 +174,7 @@ export default class Group extends React.Component {
group
} = this.props;
const {
nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey
nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey,date
} = group;
return (

View File

@ -0,0 +1,597 @@
/**
* @Author: 程亮
* @Date: 2022-05-26 14:05:59
* @LastEditTime: 2022-06-02 15:51:37
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
*/
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaTable,
WeaLeftRightLayout,
WeaOrgTree
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch,
Menu, Dropdown, Icon
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTableDialog from '../NewWeaTableDialog';
import { renderLoading } from '../../util'; // 从util文件引入公共的方法
const toJS = mobx.toJS;
const confirm = Modal.confirm;
//const WeaTable = WeaTableNew.WeaTable
@inject('job')
@observer
export default class Job extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
job
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
job
} = this.props;
job.getTableInfo();
job.getHasRight();
job.getCopyForm()
}
getTopMenuBtns() {
const {
job
} = this.props;
const {
topMenu,
selectedRowKeys
} = job;
let btns = [];
topMenu.map((item, i) => {
if (item.menuFun === 'batchDelete') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else if (item.menuFun === 'copy') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
job
} = this.props;
const {
isPanelShow
} = job;
isPanelShow && job.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
job
} = this.props;
job.setNeDialogTitle(i18n.label.jobName());
job.setNewVisible(true);
job.getJobForm();
}
//联查人员
select(id) {
const {
job
} = this.props;
job.setNeDialogTitle("联查人员");
job.setVisible(true);
job.getHrmTable(id);
}
copy() {
const {
job
} = this.props;
const {
selectedRowKeys,
} = job;
let keys = toJS(selectedRowKeys).toString();
job.setIds(keys);
confirm({
title: i18n.confirm.defaultTitle(),
content: this.getCopyForm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
job.copy()
},
onCancel() {
return false;
},
});
}
getCopyForm() {
const {
job
} = this.props;
const {
copyCondition,
form2,
} = job;
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
let arr = [];
isFormInit && copyCondition.map(c => {
c.items.map((field, index) => {
arr.push(
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
</WeaFormItem>
)
})
})
return arr;
}
batchDelete() {
const {
job
} = this.props;
const {
selectedRowKeys
} = job;
let keys = toJS(selectedRowKeys).toString();
job.setIds(keys);
this.showConfirm('batchDel');
}
showConfirm(v) {
let _this = this;
confirm({
title: i18n.confirm.defaultTitle(),
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
_this.onOk();
},
onCancel() {
return false;
},
});
}
onOk() {
const {
job
} = this.props;
job.delete();
}
getDropMenuDatas() {
const {
job
} = this.props;
const {
rightMenu
} = job;
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) {
const {
job
} = this.props;
const {
isPanelShow
} = job;
isPanelShow && job.setPanelStatus(false);
this[key] && this[key]();
}
updateForbiddenTag(checked, id) {
const {
job
} = this.props;
job.updateForbiddenTag(checked, id);
}
onSearchChange(val) {
const {
job
} = this.props;
const {
form
} = job;
job.setJobName(val);
!this.isEmptyObject(form.getFormParams()) && job.updateFields(val);
}
reRenderColumns(columns) {
const {
job
} = this.props;
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
return <Switch defaultChecked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'jobName') {
c.render = function (text, record) {
return <a href='javascript:void(0);' onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank")
}}>{text}</a>
}
}
if (c.dataIndex == 'operate') {
c.className = "wea-table-operates"
c.width = 80
c.render = function (text, record) {
const menu = (
<Menu>
{
record.isUsed === 0 ? <Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item> : ''
}
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查人员</a>
</Menu.Item>
</Menu>
)
return <Dropdown overlay={menu}>
<i class="icon-coms-more" />
</Dropdown>
}
}
})
return columns;
}
doDel(id) {
const {
job
} = this.props;
job.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
job
} = this.props;
job.save();
}
getTabBtn() {
const {
job
} = this.props;
const {
form
} = job;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { job.setCurrent(1); job.setPageSize(10); job.getTableInfo(); job.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => job.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
getPanelComponents() {
const {
job
} = this.props;
const {
searchCondition,
form,
searchConditionLoading
} = job;
let arr = [];
let formParams = form.getFormParams();
const {
isFormInit
} = form;
isFormInit && searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index % 2 == 0) ? 10 : 11} offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
})
if (searchConditionLoading) {
return (
<div className='hrm-loading-center-small' style={{ top: '25%' }}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
job.getTableInfo();
job.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
//左侧树
getTree = () => {
const {
job
} = this.props;
const {
companysId,
} = job
let tree = (
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
ref='WeaOrgTree'
dataUrl={"/api/bs/hrmorganization/job/getSearchTree"}
loading
needSearch
noCache={true}
needDropMenu={false}
//onSelect={this.selectVirtual} //组织维度回调函数
isLoadSubDepartment={true}
topPrefix={'hrmSearch'}
companysId={companysId}
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
treeNodeClick={this.treeNodeClick}
expandAllChildrenOnSearch={true}
/>
)
return tree;
}
treeNodeClick = (event, ids, nodeids, nodes) => {
const {
job
} = this.props;
const {
form,
companysId
} = job;
const type = event.node.props.type || '0';
const id = event.node.props.id || '';
let params = {};
form.resetConditionValue();
job.setPanelStatus(false)
// job.tabkey = 'default_3';
job.nodeType = type;
if (type == '0') {
params['virtualtype'] = companysId;
}
if (type == '1') {
params['subcompanyid1'] = id;
}
if (type == '2') {
params['departmentid'] = id;
}
job.doSearch(params);
}
render() {
const {
job
} = this.props;
const {
isPanelShow, jobName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1, isEdit, newVisible,selectedRowKeys, total, current, pageSize, init,
defaultShowLeft,form2
} = job;
const rowSelection = {
onChange(selectedRowKeys, selectedRows) {
job.setSelectedRowKeys(selectedRowKeys);
},
getCheckboxProps: record => ({
disabled: record.isUsed === 1, // 配置无法勾选的列
}),
};
const pagination = {
current: current,
pageSize: pageSize,
total: total,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
},
onChange(current) {
},
showTotal(total) {
return `${total}`
}
};
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.jobName()}
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(e) => this.handleMenuClick(e)}
>
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@7muhhb`} isNew={true} showLeft={defaultShowLeft} leftCom={this.getTree()}>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form.getFormParams()) ? jobName : form.getFormParams().jobName}
setShowSearchAd={bool => job.setPanelStatus(bool)}
hideSearchAd={() => job.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => {
job.setCurrent(1);
job.setPageSize(10);
job.getTableInfo()
}}
onSearchChange={val => this.onSearchChange(val)}
/>
{
init ? <div className='hrm-new-weatable-spin'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
</div> :
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
loading={loading}
dataSource={dataSource} childrenColumnName="children"
columns={this.reRenderColumns(columns)}
rowSelection={rowSelection}
pagination={pagination}
onChange={(pagination, filters, sorter) => {
job.setCurrent(pagination.current);
job.setPageSize(pagination.pageSize);
job.getTableInfo();
}}
indentSize={15}
/>
}
</WeaLeftRightLayout>
</WeaTop>
</WeaRightMenu>
<NewWeaTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
height={400}
tableStore={tableStore}
onCancel={() => job.setVisible(false)}
/>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={newVisible}
condition={toJS(condition)}
form={form1}
isFormInit={form1.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={300}
conditionLen={13}
save={() => this.handleSave()}
onCancel={() => job.setNewVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,289 @@
/**
* @Author: 程亮
* @Date: 2022-05-26 14:07:12
* @LastEditTime: 2022-05-30 17:16:47
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js
*/
import { Button, Modal, message, Row, Col, Spin } from 'antd';
import isEmpty from 'lodash/isEmpty'
import cloneDeep from 'lodash/cloneDeep'
import forEach from 'lodash/forEach'
import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom'
import { WeaSwitch } from 'comsMobx';
import { inject, observer } from 'mobx-react';
import * as mobx from 'mobx';
import { i18n } from '../../public/i18n';
const toJS = mobx.toJS;
import '../../style/common.less';
@inject('jobExtend')
@inject('job')
@observer
export default class JobExtend extends React.Component {
componentDidMount() {
this.init();
}
init = () => {
const { jobExtend,job } = this.props;
let {hash} = window.location;
hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0];
jobExtend.init();
jobExtend.setId(id);
jobExtend.getData();
}
getTabChildren = () => {
const { jobExtend } = this.props;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = jobExtend;
let tabChildren = [];
tableInfo = toJS(tableInfo);
tableInfo && tableInfo.map((t, i) => {
if (detailSelectedKey == i) {
tabChildren.push(
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
ref={(ref)=>jobExtend.setPersonalEditTables(ref)}
showTitle={isEditor}
// title={'列表信息'}
//addFirstRow={isEditor}
columns={t.tabinfo.columns}
datas={t.tabinfo.datas}
onChange={this.tableEditChange}
selectedRowKeys={toJS(selectedRowKeys)}
onRowSelect={keys => onRowSelect(keys)}
onBtnsSelect={key => this.onBtnsSelect(key, i)}
viewAttr={isEditor ? 2 : 1}
getRowSelection={isEditor ? (rowSelection) => {
Object.assign(rowSelection, {
getCheckboxProps: record => ({
disabled: record.viewAttr === 1, // 配置无法勾选的列
})
})
return rowSelection;
} : () => null}
/>
);
}
})
return tabChildren;
}
onBtnsSelect = (key, index) => {
const {
jobExtend
} = this.props, {
tableInfo,
selectedRows,
setSelectedRowKeys,
selectedRowKeys
} = jobExtend;
const datas = tableInfo[index].tabinfo.datas;
if (key === 'copy') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (!selectedRows[index].includes(i)) {
data.viewAttr = 2;
}
return data
})
}
if (key === 'delete') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (selectedRows[index].includes(i)) {
data.viewAttr = 1;
}
return data
});
setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row)))
}
}
getSearchs = () => {
const { jobExtend } = this.props;
let { form, conditions, isEditor } = jobExtend;
const { isFormInit } = form;
let group = [];
let tipPosition = 'bottom';
window.e9HideFormFieldKeys = [];
isFormInit && conditions.forEach((c, i) => {
let items = [];
c.items.forEach((field, j) => {
if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
window.e9HideFormFieldKeys.push(field.domkey[0]);
} else {
items.push({
com: (<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@vh6j67@${j}`}
underline={!isEditor}
label={`${field.label}`}
error={form.getError(field)}
tipPosition={tipPosition}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
</WeaFormItem>),
colSpan: 1
});
}
});
group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@x9hby9@${i}`} className={`${isEditor ? 'hrm-center' : ''}`}
needTigger={true} hide={c.hide} title={c.title} showGroup={c.defaultshow} items={items} col={2} />)
});
return group;
}
tableEditChange = (data) => {
const { jobExtend } = this.props;
let { detailSelectedKey = '0', tableInfo } = jobExtend;
tableInfo = toJS(tableInfo);
let d = cloneDeep(tableInfo);
d[Number(detailSelectedKey)].tabinfo.datas = data;
jobExtend.updateTableInfo(d);
}
getRightMenu = () => {
const { jobExtend } = this.props;
const { isEditor, buttons } = jobExtend;
let arr = [];
try {
if (buttons.hasEdit) {
if (isEditor) {
arr = [{
icon: <i className='icon-coms-common' />,
content: i18n.button.save(),
key: 'save',
onClick: key => {
this.saveEditCard();
}
}, {
icon: <i className='icon-coms-go-back' />,
content: i18n.button.back(),
key: 'back',
onClick: key => {
this.backCard();
}
}]
} else {
arr = [{
icon: <i className='icon-coms-edit' />,
content: i18n.button.modify(),
key: 'editCard',
onClick: key => {
this.editCard();
}
}
]
}
}
} catch (e) { }
return arr;
}
getTopButtons = () => {
const { jobExtend } = this.props;
const { isEditor, buttons } = jobExtend;
const save = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pkes6y`} type="primary" onClick={this.saveEditCard} >{i18n.button.save()}</Button>;
const back = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pl1fw8`} type="primary" onClick={this.backCard} >{i18n.button.back()}</Button>;
const edit = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vkeda5`} type="primary" onClick={this.editCard} >{i18n.button.modify()}</Button>;
const btns = [];
try {
if (isEditor) {
if (buttons.hasSave) {
btns.push(save);
btns.push(back);
}
} else {
if (buttons.hasEdit) {
btns.push(edit);
}
}
} catch (e) { }
return btns;
}
editCard = () => {
const { jobExtend } = this.props;
jobExtend.edit();
}
saveEditCard = () => {
const { jobExtend } = this.props;
jobExtend.save();
}
backCard = () => {
this.init();
}
changeData(key) {
const {
jobExtend
} = this.props;
jobExtend.changeData(key);
}
render() {
const { jobExtend } = this.props;
const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = jobExtend;
// if(!hasRight && !loading){
// return (
// <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@387kx5`}>
// <div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
// </WeaAlertPage>
// )
// }
try {
return (
<div className='hrm-my-cardInfo' style={{ height: '100%', position: 'relative' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getRightMenu()}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
loading={true}
buttons={this.getTopButtons()}
showDropIcon={true}
dropMenuDatas={this.getRightMenu()}
>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
datas={topTab}
keyParam="viewCondition" //主键
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
/>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4fj4z2`} spinning={loading}>
{this.getSearchs()}
{
!isEmpty(tabInfo) && <div className='hrm-my-cardInfo_detial_tabs'>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@vjrq63`}
type='card'
keyParam='key'
datas={toJS(tabInfo)}
selectedKey={detailSelectedKey}
onChange={v => {
jobExtend.updateDetailSelectedKey(v);
}}
/>
{this.getTabChildren()}
</div>
}
</Spin>
</WeaTop>
</WeaRightMenu>
</div>
)
} catch (e) {
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
</WeaAlertPage>
}
}
}

View File

@ -58,7 +58,7 @@ export default class OfficeManage extends Component {
handleMenuClick = (key) => {
const { officeManageStore } = this.props;
const { isPanelShow } = officeManageStore;
const { isPanelShow,tableStore} = officeManageStore;
isPanelShow && officeManageStore.setPanelStatus(false);
switch (key) {
case "new":
@ -66,6 +66,10 @@ export default class OfficeManage extends Component {
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
break;
case "custom":
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
break;
default:
break;
}
@ -239,6 +243,17 @@ export default class OfficeManage extends Component {
officeManageStore.setNeDialogTitle(i18n.label.editOfficeName());
};
custom = () => {
debugger
const {
officeManageStore
} = this.props, {
tableStore,
} = officeManageStore;
}
getPanelComponents = () => {
const { officeManageStore } = this.props;
const { searchCondition, form2, searchConditionLoading } =

View File

@ -116,6 +116,19 @@ export default class JobGrade extends React.Component {
jobGrade.getForm();
}
custom = () => {
const {
jobGrade
} = this.props, {
tableStore,
} = jobGrade;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
batchDelete() {
const {
jobGrade
@ -347,7 +360,7 @@ export default class JobGrade extends React.Component {
} = this.props;
const {
isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date
} = jobGrade;

View File

@ -245,7 +245,17 @@ export default class JobLevel extends React.Component {
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
custom = () => {
const {
jobLevel
} = this.props, {
tableStore,
} = jobLevel;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
doEdit(id) {
@ -347,7 +357,7 @@ export default class JobLevel extends React.Component {
} = this.props;
const {
isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date
} = jobLevel;

View File

@ -2,7 +2,7 @@ import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
observer
} from 'mobx-react'
import {
WeaTop,
@ -202,6 +202,17 @@ export default class RankScheme extends React.Component {
return btn;
}
custom = () => {
const {
rankScheme
} = this.props, {
tableStore,
} = rankScheme;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
onSearchChange(val) {
const {
rankScheme
@ -340,7 +351,7 @@ export default class RankScheme extends React.Component {
} = this.props;
const {
isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit
form,dialogLoading,isEdit,date
} = rankScheme;
return (

View File

@ -232,6 +232,17 @@ export default class Sequence extends React.Component {
})
}
custom = () => {
const {
sequence
} = this.props, {
tableStore,
} = sequence;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
updateForbiddenTag(checked,id) {
const {
sequence
@ -347,7 +358,7 @@ export default class Sequence extends React.Component {
} = this.props;
const {
isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date
} = sequence;

View File

@ -0,0 +1,414 @@
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,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('staff')
@observer
export default class Staff extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
staff
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
staff
} = this.props;
staff.getTableInfo();
staff.getHasRight();
}
getTopMenuBtns() {
const {
staff
} = this.props;
const {
topMenu,
tableStore
} = staff;
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) {
const {
staff
} = this.props;
const {
isPanelShow
} = staff;
isPanelShow && staff.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
staff
} = this.props;
staff.setNeDialogTitle(i18n.label.newStaff());
staff.setIsNew(true);
staff.setVisible(true);
staff.getForm();
}
batchDelete() {
const {
staff
} = this.props;
const {
tableStore
} = staff;
let keys = toJS(tableStore.selectedRowKeys).toString();
staff.setIds(keys);
this.showConfirm('batchDel');
}
showConfirm(v) {
let _this = this;
confirm({
title: i18n.confirm.defaultTitle(),
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
_this.onOk();
},
onCancel() {
return false;
},
});
}
onOk() {
const {
staff
} = this.props;
staff.delete();
}
getDropMenuDatas() {
const {
staff
} = this.props;
const {
rightMenu
} = staff;
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) {
const {
staff
} = this.props;
const {
isPanelShow
} = staff;
isPanelShow && staff.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
staff
} = this.props;
const {
form2
} = staff;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { staff.getTableInfo(); staff.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={() => staff.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
staff
} = this.props;
const {
form2
} = staff;
staff.setSchemeName(val);
!this.isEmptyObject(form2.getFormParams()) && staff.updateFields(val);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
// if (c.dataIndex == 'forbidden_tag') {
// c.render = function(text, record) {
// return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
// }
// };
})
}
updateForbiddenTag(checked,id) {
const {
staff
} = this.props;
staff.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
staff
} = this.props;
staff.setNeDialogTitle(i18n.label.editStaff());
staff.setSchemeId(id);
staff.setIsNew(false);
staff.setVisible(true);
staff.getForm();
}
custom = () => {
const {
staff
} = this.props, {
tableStore,
} = staff;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
doDel(id) {
const {
staff
} = this.props;
staff.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
staff
} = this.props;
const {
isNew
} = staff;
isNew && staff.save();
!isNew && staff.edit();
}
getPanelComponents() {
const {
staff
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = staff;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
isFormInit && searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index%2 == 0) ? 10 : 11} offset={1}>
<div style={{marginTop: 20}}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{span: `${field.labelcol}`}}
wrapperCol={{span: `${field.fieldcol}`}}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
})
if (searchConditionLoading) {
return (
<div className='hrm-loading-center-small' style={{top:'25%'}}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
if ( e.keyCode == 13 && e.target.tagName === "INPUT") {
staff.getTableInfo();
staff.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
staff
} = this.props;
const {
isPanelShow, form2, staffName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,date
} = staff;
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.staffName()}
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()) ? staffName : form2.getFormParams().staffName}
setShowSearchAd={bool => staff.setPanelStatus(bool)}
hideSearchAd={() => staff.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => staff.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)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => staff.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,422 @@
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,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('staffScheme')
@observer
export default class StaffScheme extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
staffScheme
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
staffScheme
} = this.props;
staffScheme.getTableInfo();
staffScheme.getHasRight();
}
getTopMenuBtns() {
const {
staffScheme
} = this.props;
const {
topMenu,
tableStore
} = staffScheme;
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) {
const {
staffScheme
} = this.props;
const {
isPanelShow
} = staffScheme;
isPanelShow && staffScheme.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
staffScheme
} = this.props;
staffScheme.setNeDialogTitle(i18n.label.newStaffScheme());
staffScheme.setIsNew(true);
staffScheme.setVisible(true);
staffScheme.getForm();
}
batchDelete() {
const {
staffScheme
} = this.props;
const {
tableStore
} = staffScheme;
let keys = toJS(tableStore.selectedRowKeys).toString();
staffScheme.setIds(keys);
this.showConfirm('batchDel');
}
showConfirm(v) {
let _this = this;
confirm({
title: i18n.confirm.defaultTitle(),
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
_this.onOk();
},
onCancel() {
return false;
},
});
}
onOk() {
const {
staffScheme
} = this.props;
staffScheme.delete();
}
getDropMenuDatas() {
const {
staffScheme
} = this.props;
const {
rightMenu
} = staffScheme;
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) {
const {
staffScheme
} = this.props;
const {
isPanelShow
} = staffScheme;
isPanelShow && staffScheme.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
staffScheme
} = this.props;
const {
form2
} = staffScheme;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { staffScheme.getTableInfo(); staffScheme.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={() => staffScheme.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
staffScheme
} = this.props;
const {
form2
} = staffScheme;
staffScheme.setSchemeName(val);
!this.isEmptyObject(form2.getFormParams()) && staffScheme.updateFields(val);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
}
};
})
}
updateForbiddenTag(checked,id) {
const {
staffScheme
} = this.props;
staffScheme.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
staffScheme
} = this.props;
staffScheme.setNeDialogTitle(i18n.label.ediStaffScheme());
staffScheme.setSchemeId(id);
staffScheme.setIsNew(false);
staffScheme.setVisible(true);
staffScheme.getForm();
}
log = () => {
window.setLogViewProps({
logSmallType: '3010',
});
}
custom = () => {
const {
staffScheme
} = this.props, {
tableStore,
} = staffScheme;
tableStore.setColSetVisible(true);
tableStore.tableColSet(true);
}
doDel(id) {
const {
staffScheme
} = this.props;
staffScheme.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
staffScheme
} = this.props;
const {
isNew
} = staffScheme;
isNew && staffScheme.save();
!isNew && staffScheme.edit();
}
getPanelComponents() {
const {
staffScheme
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = staffScheme;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
isFormInit && searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index%2 == 0) ? 10 : 11} offset={1}>
<div style={{marginTop: 20}}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{span: `${field.labelcol}`}}
wrapperCol={{span: `${field.fieldcol}`}}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
})
if (searchConditionLoading) {
return (
<div className='hrm-loading-center-small' style={{top:'25%'}}>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
if ( e.keyCode == 13 && e.target.tagName === "INPUT") {
staffScheme.getTableInfo();
staffScheme.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
staffScheme
} = this.props;
const {
isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,date
} = staffScheme;
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.staffSchemeName()}
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().schemeName}
setShowSearchAd={bool => staffScheme.setPanelStatus(bool)}
hideSearchAd={() => staffScheme.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => staffScheme.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)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => staffScheme.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -26,7 +26,6 @@ const WeaLogViewComp = WeaLogView.Component;
export default class simpleOrg extends React.Component {
componentWillMount() { // 初始化渲染页面
debugger
const { simpleOrgStore: { doInit } } = this.props;
doInit();
}

View File

@ -1,6 +1,7 @@
import React from "react";
import Route from "react-router/lib/Route";
import { WeaLocaleProvider } from "ecCom";
import Home from "./components/Home";
import SimpleOrg from "./components/tree/index";
import StandardOrg from "./components/tree/standard_org";
import RankScheme from "./components/postionrank/RankScheme";
@ -11,7 +12,15 @@ import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend";
import BranchNumSetting from "./components/branchNumSetting";
import Company from "./components/company/company";
import DepartmentManage from "./components/deptment";
import StaffScheme from "./components/staff/StaffScheme";
import Staff from "./components/staff/Staff";
import Job from "./components/job/Job";
import JobExtend from "./components/job/JobExtend";
import Department from "./components/department/department";
import DepartmentExtendStore from "./components/department/departmentExtend";
import stores from "./stores";
import "./style/index";
@ -26,7 +35,7 @@ getLocaleLabel = function (nextState, replace, callback) {
callback();
};
const Home = (props) => props.children;
//const Home = (props) => props.children;
const Routes = (
<Route
@ -48,15 +57,73 @@ const Routes = (
path="branchNumSetting"
component={BranchNumSetting}
/>
<Route
key="departmentManage"
path="departmentManage"
component={DepartmentManage}
/>
<Route key="company" path="company" component={Company} />
<Route key="department" path="department" component={Department} />
<Route key="departmentExtend" path="departmentExtend/:id" component={DepartmentExtendStore} />
<Route key="staffscheme" path="staffscheme" component={StaffScheme} />
<Route key="staff" path="staff" component={Staff} />
<Route key="job" path="job" component={Job} />
<Route key="jobExtend" path="jobExtend/:id" component={JobExtend} />
</Route>
);
const OutSignAppSettingProvider = (props) => (
<Provider
ecId={`${(this && this.props && this.props.ecId) || ""}_Provider@tqobex`}
outSignAppSetting={stores.outSignAppSetting}>
<OutSignAppSetting
ecId={`${
(this && this.props && this.props.ecId) || ""
}_OutSignAppSetting@cli4xv`}
{...props}
/>
</Provider>
);
class NetworkStrategy extends React.Component {
constructor(props) {
super(props);
this.state = {
reRender: false,
};
}
componentDidMount() {
// 多语言加载之后,已经 mount 的组件,需要重新 render 一次,刷新多语言配置。
// getLocaleLabelByCode('hrm').then(() => this.setState({
// reRender: true
// }));
}
render = () => (
<Provider
ecId={`${(this && this.props && this.props.ecId) || ""}_Provider@is207z`}
{...stores}>
<Home
ecId={`${(this && this.props && this.props.ecId) || ""}_Home@6rat5p`}>
<SecuritySetting
ecId={`${
(this && this.props && this.props.ecId) || ""
}_SecuritySetting@d7jz8e`}
single="1"
type="network"
{...this.props}
/>
</Home>
</Provider>
);
}
module.exports = {
Route: Routes,
store: stores,
com: {
OutSignAppSettingProvider: OutSignAppSettingProvider,
NetworkStrategy,
},
};
// module.exports = {
// Route: Routes,
// store: stores,
// };

View File

@ -129,7 +129,19 @@ export const i18n = {
editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
branchNumSetting: () => getLabel(386246, '分部编号设置'),
departName: () => getLabel(386246, '部门管理'),
companyName: () => getLabel(385937, '分部'),
staffSchemeName: () => getLabel(385936, '编制方案'),
newStaffScheme: () => getLabel(386246, '新建编制方案'),
ediStaffScheme: () => getLabel(386247, '编辑编制方案'),
staffName: () => getLabel(385936, '编制上报'),
newStaff: () => getLabel(386246, '新建编制'),
editStaff: () => getLabel(386247, '编辑编制'),
jobName: () => getLabel(385936, '岗位'),
newJob: () => getLabel(386246, '新建岗位'),
editJob: () => getLabel(386247, '编辑岗位'),
deptManage: () => getLabel(385936, '部门管理'),
newDept: () => getLabel(386246, '新建部门'),
mergeDept:()=> getLabel(386246, '合并部门'),

View File

@ -1,43 +1,371 @@
import { observable, action, toJS } from "mobx";
import { WeaForm } from "comsMobx";
import { WeaTableNew } from "comsMobx";
import { Modal, message } from "antd";
import { i18n } from "../public/i18n";
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/company'; // 引入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;
const { TableStore } = WeaTableNew;
export class CompanyStore {
@observable tableStore = new TableStore();
@observable topMenu = [];
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable dataSource = [];
@observable columns = [];
@observable deptDataSource = [];
@observable deptColumns = [];
@observable tableStore = new TableStore();
@observable loading = true;
@observable dialogLoading = true;
@observable isEdit = true;
@observable isNew = true;
@observable nEdialogTitle = '';
@observable searchCondition = [];
@observable condition = [];
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable conditionNum = 2;
@observable ids = ""; //选择行id
@observable form1 = new WeaForm(); //新增主表表单
@observable companyName = '';
@observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
@observable date = "";
@observable newVisible = false; //新增弹窗
@observable companyId = '';
@observable selectedRowKeys = '';
@observable date = '';
@observable init = true; //是否首次加载
@observable total = '';
@observable current = 1;
@observable pageSize = 10;
@action
getHasRight() {
getTableInfo() {
this.setLoading(true);
let params = {
current:this.current,
pageSize:this.pageSize
}
if (this.isEmptyObject(this.form.getFormParams())) {
params = {
...params,
...this.form.getFormParams(),
compName: this.companyName
};
} else {
params = {
...params,
...this.form.getFormParams(),
};
}
Api.getSearchList(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
this.setTotal(res.data.pageInfo.total);
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
this.setLoading(false);
this.setInit(false);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form2.updateFields({
schemeName: {
value: val,
},
@action("联查部门")
getDeptTable(id) {
let params = {
parentComp:id
}
Api.getDeptListByPid(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.list && this.setDeptDataSource(res.data.list);
res.data.columns && this.setDeptColumns(res.data.columns);
this.setDialogLoadingStatus(false);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
//删除
@action delete() {
let params = {
ids: this.ids
};
Api.deleteTableData(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.setSelectedRowKeys('');
this.getTableInfo();
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
updateForbiddenTag(checked, id) {
let params = {
forbiddenTag: checked,
id: id
}
Api.updateForbiddenTag(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(true);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getCompanyForm() {
let params = {};
this.setDialogLoadingStatus(true);
Api.getCompanyForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form1.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
save() {
let params = {
...this.form1.getFormParams()
};
this.form1.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setNewVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
@action
getHasRight() {
Api.getHasRight().then(res => {
if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form.updateFields({
compName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setCompanyName(val) {
this.companyName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
setId(id) {
this.id =id;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
this.form1 = new WeaForm();
}
setVisible(bool) {
this.visible = bool;
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setSearchCondition(searchCondition) {
this.searchCondition = searchCondition;
}
setCompanyId(companyId) {
this.companyId = companyId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setDataSource(dataSource) {
this.dataSource = dataSource;
}
setDeptDataSource(deptDataSource) {
this.deptDataSource = deptDataSource;
}
setColumns(columns) {
this.columns = columns
}
setDeptColumns(deptColumns) {
this.deptColumns = deptColumns
}
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
}
setLoading(bool) {
this.loading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title
}
setCondition(condition) {
this.condition = condition;
}
setNewVisible(bool) {
this.formReset();
this.newVisible = bool;
}
setTotal(total) {
this.total = total;
}
setCurrent(current) {
this.current = current;
}
setPageSize(pageSize) {
this.pageSize = pageSize;
}
setInit(bool) {
this.init = bool;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,457 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/department'; // 引入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 DepartmentStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable dataSource = [];
@observable columns = [];
@observable jobDataSource = [];
@observable jobColumns = [];
@observable loading = true;
@observable dialogLoading = true;
@observable isEdit = true;
@observable nEdialogTitle = '';
@observable searchCondition = [];
@observable condition = [];
@observable copyCondition = [];
@observable isPanelShow = false; //高级搜索面板
@observable form = new WeaForm();
@observable form1 = new WeaForm(); //新增主表表单
@observable form2 = new WeaForm(); //复制表单
@observable departmentName = '';
@observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
@observable newVisible = false; //新增弹窗
@observable departmentId = '';
@observable selectedRowKeys = '';
@observable date = '';
@observable init = true; //是否首次加载
@observable total = '';
@observable current = 1;
@observable pageSize = 10;
@observable defaultShowLeft = true;
@observable companysId = 1 //集团id
@observable confirmVisible = false;
@observable confirmLoading = true;
@action
getTableInfo(params) {
this.setLoading(true);
params = {
...params,
current: this.current,
pageSize: this.pageSize
}
if (this.isEmptyObject(this.form.getFormParams())) {
params = {
...params,
...this.form.getFormParams(),
departmentName: this.departmentName
};
} else {
params = {
...params,
...this.form.getFormParams(),
};
}
Api.getSearchList(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
this.setTotal(res.data.pageInfo.total);
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
this.setLoading(false);
this.setInit(false);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@action("nodetree事件")
doSearch(params) {
this.setInit(true);
this.getTableInfo(params);
}
@action("联查人员")
getHrmTable(id) {
// let params = {
// departmentId: id
// }
// this.tableStore = new TableStore();
// Api.getHrmListBydepartmentId(params).then(res => {
// if (res.code === 200) {
// res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
// } else {
// message.warning(res.msg);
// }
// }, error => {
// message.warning(error.msg);
// })
}
//删除
delete() {
let params = {
ids: this.ids
};
Api.deleteTableData(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.setSelectedRowKeys('');
this.getTableInfo();
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
updateForbiddenTag(checked, id) {
let params = {
forbiddenTag: checked,
id: id
}
Api.updateForbiddenTag(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg, 1);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(true);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getDeptForm() {
let params = {};
this.setDialogLoadingStatus(true);
Api.getDeptForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form1.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("合并部门")
getMergeForm() {
// let params = {};
// this.setConfirmLoading(true);
// Api.getDeptForm(params).then(res => {
// if (res.code === 200) {
// this.setConfirmLoading(false);
// res.data.condition && this.setCondition(res.data.condition);
// res.data.condition && this.form1.initFormFields(res.data.condition);
// } else {
// message.warning(res.msg);
// }
// }, error => {
// message.warning(error.msg);
// })
}
@action("转移部门")
getTransferForm() {
// let params = {};
// this.setConfirmLoading(true);
// Api.getDeptForm(params).then(res => {
// if (res.code === 200) {
// this.setConfirmLoading(false);
// res.data.condition && this.setCondition(res.data.condition);
// res.data.condition && this.form1.initFormFields(res.data.condition);
// } else {
// message.warning(res.msg);
// }
// }, error => {
// message.warning(error.msg);
// })
}
@action("复制表单")
getCopyForm() {
let params = {};
Api.getCopyForm(params).then(res => {
if (res.code === 200) {
res.data && this.setCopyCondition(res.data);
res.data && this.form2.initFormFields(res.data);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
save() {
let params = {
...this.form1.getFormParams()
};
this.form1.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setNewVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
copy() {
let params = {
ids: this.ids,
...this.form2.getFormParams()
};
Api.copy(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.form2 = new WeaForm();
this.setSelectedRowKeys('');
} else {
message.error(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@action
getHasRight() {
Api.getHasRight().then(res => {
if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form.updateFields({
compName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setDepartmentName(val) {
this.departmentName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
setId(id) {
this.id = id;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form1 = new WeaForm();
}
setVisible(bool) {
this.visible = bool;
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setSearchCondition(searchCondition) {
this.searchCondition = searchCondition;
}
setDepartmentId(departmentId) {
this.departmentId = departmentId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setDataSource(dataSource) {
this.dataSource = dataSource;
}
setJobDataSource(jobDataSource) {
this.jobDataSource = jobDataSource;
}
setColumns(columns) {
this.columns = columns
}
setJobColumns(jobColumns) {
this.jobColumns = jobColumns
}
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
}
setLoading(bool) {
this.loading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title
}
setCondition(condition) {
this.condition = condition;
}
setCopyCondition(copyCondition) {
this.copyCondition = copyCondition;
}
setNewVisible(bool) {
this.formReset();
this.newVisible = bool;
}
setTotal(total) {
this.total = total;
}
setCurrent(current) {
this.current = current;
}
setPageSize(pageSize) {
this.pageSize = pageSize;
}
setInit(bool) {
this.init = bool;
}
setConfirmVisible(confirmVisible) {
this.confirmVisible = confirmVisible;
}
setConfirmLoading(confirmLoading) {
this.confirmLoading = confirmLoading;
}
}

View File

@ -0,0 +1,235 @@
import { observable, action, toJS } from "mobx";
import { WeaForm } from "comsMobx";
import isEmpty from 'lodash/isEmpty'
import { WeaTableNew } from "comsMobx";
import { Modal, message } from "antd";
import { i18n } from "../public/i18n";
import forEach from 'lodash/forEach'
import * as Api from '../apis/department'; // 引入API接口文件
export class DepartmentExtendStore {
@observable form = new WeaForm();
@observable tableInfo = []
@observable conditions = [];
@observable isEditor = false;
@observable isNew = true;
@observable loading = true;
@observable tabInfo = [];
@observable selectedKey = '0';
@observable detailSelectedKey = '0';
@observable topTab = [];
@observable buttons = {};
@observable id = ''; //部门id
@observable date = '';
@observable personalEditTables;
@observable tabkey = '0'
@observable selectedRowKeys = [];
@observable selectedRows = [];
@action onRowSelect = (keys) => {
this.setSelectedRowKeys(keys);
}
@action setSelectedRowKeys = (keys) => {
this.selectedRowKeys = keys;
}
@action
edit = () => {
this.isEditor = true;
this.getData();
this.getTabInfo();
this.detailSelectedKey = '0'
}
init = () => {
this.detailSelectedKey = '0'
this.isEditor = false;
}
save = () => {
if (this.loading)
return;
this.loading = true;
this.form.validateForm().then(f => {
if (f.isValid) {
if (this.personalEditTables) {
const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
if (isPass) {
this.editResource()
} else {
this.loading = false;
}
} else {
this.editResource();
}
} else {
f.showErrors();
this.setDate(new Date());
this.loading = false;
}
})
}
editResource = () => {
let pDatas = this.form.getFormParams();
Api.editResource({ ...{
id: this.id
},
...pDatas,
...this.getTableEditParams()
}).then(data => {
if (data.code == 200) {
message.success(i18n.message.saveSuccess());
this.init();
this.getData();
this.selectedRowKeys = [];
} else {
message.warning(data.message);
}
this.loading = false;
}, error => {
message.warning(error.message);
this.loading = false;
})
}
getTableEditParams = () => {
const params = {};
this.tableInfo && this.tableInfo.forEach(t => {
t.tabinfo.datas = t.tabinfo.datas || [];
params[t.tabinfo.rownum] = t.tabinfo.datas.length;
t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => {
!isEmpty(item) && forEach(item, (value, key) => {
Object.assign(params, {
[`${key}_${index}`]: value
});
})
})
})
return params
}
getData = () => {
this.setLoading(true);
let params = {
viewAttr: this.isEditor ? 2 : 1,
id: this.id,
viewCondition:this.selectedKey
}
Api.getDeptExtendForm(params).then((res) => {
if (res.code === 200) {
res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
res.data.result.conditions && this.setConditions(res.data.result.conditions);
this.tableInfo = this.handleTable(res.data.result.tables);
this.getTabInfo();
res.data.result.buttons && this.setButtons(res.data.result.buttons);
res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
this.isEditor && this.getSelectedRows();
this.setLoading(false);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
handleTable = (datas) => {
return datas && datas.map(data => {
const { tabinfo: { columns } } = data;
const length = columns.length;
columns.map(c => {
c.width = `${95 / length}%`
})
return data
})
}
getTabInfo = () => {
this.tabInfo = [];
this.tableInfo && this.tableInfo.forEach((c, idx) => {
if (!c.hide) {
this.tabInfo.push({
key: `${idx}`,
title: c.tabname,
})
}
})
if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key;
}
setLoading(val) {
this.loading = val;
}
updateTabKey = (key) => {
this.tabKey = key;
}
updateDetailSelectedKey =(key) => {
this.detailSelectedKey = key;
}
updateTableInfo = (data) => {
this.tableInfo = data
}
setSelectedKey = (key) => {
this.selectedKey = key;
}
getSelectedRows = () => {
const selectedRows = [];
this.tableInfo.forEach(t => {
const singleTableRows = [];
t.tabinfo.datas.forEach((data, i) => {
if (data.viewAttr === 1) {
singleTableRows.push(i);
}
});
selectedRows.push(singleTableRows);
})
this.selectedRows = selectedRows;
}
setTopTab(topTab) {
this.topTab = topTab;
}
changeData(key) {
this.setSelectedKey(key);
this.getData();
}
setId(id) {
this.id = id;
}
setPersonalEditTables = (ref) => {
this.personalEditTables = ref;
}
setConditions(conditions) {
this.conditions = conditions;
}
setButtons(buttons) {
this.buttons = buttons;
}
}

View File

@ -81,28 +81,27 @@ export class GroupStore {
edit() {
// let params = { ...this.form.getFormParams(), id: this.schemeId };
// this.form.validateForm().then(f => {
// if (f.isValid) {
// Api.edit(params).then(response => {
// return response.json()
// }).then(data => {
// if (data.code === 200) {
// message.success(data.msg);
// this.getTableInfo();
// this.setVisible(false);
// } else {
// message.warning(data.msg);
// }
// }).catch(error => {
// message.warning(error.msg);
// })
// } else {
// f.showErrors();
// this.setDate(new Date());
// }
// });
let params = { ...this.form.getFormParams(), id: 1 };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getGroupForm();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
getForm() {

View File

@ -7,7 +7,14 @@ import { OfficeManageStore } from "./officeManage";
import { SequenceStore } from "./sequence";
import { GroupStore } from "./group";
import {CompanyExtendStore} from "./companyextend";
import {CompanyStore} from "./company"
import {CompanyStore} from "./company";
import {DepartmentStore} from "./department";
import {DepartmentExtendStore} from "./departmentextend";
import {StaffSchemeStore} from "./staffscheme";
import {StaffStore} from "./staff";
import {JobStore} from "./job";
import {JobExtendStore} from "./jobextend";
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
@ -19,5 +26,11 @@ module.exports = {
sequence: new SequenceStore(),
group: new GroupStore(),
companyExtend: new CompanyExtendStore(),
company: new CompanyStore()
company: new CompanyStore(),
department: new DepartmentStore(),
departmentExtend: new DepartmentExtendStore(),
staffScheme: new StaffSchemeStore(),
staff: new StaffStore(),
job: new JobStore(),
jobExtend: new JobExtendStore(),
};

View File

@ -0,0 +1,405 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/job'; // 引入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 JobStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable dataSource = [];
@observable columns = [];
@observable loading = true;
@observable dialogLoading = true;
@observable isEdit = true;
@observable nEdialogTitle = '';
@observable searchCondition = [];
@observable condition = [];
@observable copyCondition = [];
@observable isPanelShow = false; //高级搜索面板
@observable form = new WeaForm();
@observable form1 = new WeaForm(); //新增主表表单
@observable form2 = new WeaForm(); //复制表单
@observable jobName = '';
@observable conditionNum = 12;
@observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
@observable newVisible = false; //新增弹窗
@observable jobId = '';
@observable selectedRowKeys = '';
@observable date = '';
@observable init = true; //是否首次加载
@observable total = '';
@observable current = 1;
@observable pageSize = 10;
@observable defaultShowLeft = true;
@observable companysId = 1
@action
getTableInfo(params) {
this.setLoading(true);
params = {
...params,
current: this.current,
pageSize: this.pageSize
}
if (this.isEmptyObject(this.form.getFormParams())) {
params = {
...params,
...this.form.getFormParams(),
compName: this.jobName
};
} else {
params = {
...params,
...this.form.getFormParams(),
};
}
Api.getSearchList(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
this.setTotal(res.data.pageInfo.total);
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
this.setLoading(false);
this.setInit(false);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@action("nodetree事件")
doSearch(params) {
this.setInit(true);
this.getTableInfo(params);
}
@action("联查人员")
getHrmTable(id) {
let params = {
jobId: id
}
this.tableStore = new TableStore();
Api.getHrmListByJobId(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
//删除
delete() {
let params = {
ids: this.ids
};
Api.deleteTableData(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.setSelectedRowKeys('');
this.getTableInfo();
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
updateForbiddenTag(checked, id) {
let params = {
forbiddenTag: checked,
id: id
}
Api.updateForbiddenTag(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg, 1);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(true);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getJobForm() {
let params = {};
this.setDialogLoadingStatus(true);
Api.getJobForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form1.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("复制表单")
getCopyForm() {
let params = {};
Api.getCopyForm(params).then(res => {
if (res.code === 200) {
res.data && this.setCopyCondition(res.data);
res.data && this.form2.initFormFields(res.data);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
save() {
let params = {
...this.form1.getFormParams()
};
this.form1.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setNewVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
copy() {
let params = {
ids: this.ids,
...this.form2.getFormParams()
};
Api.copy(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.form2 = new WeaForm();
this.setSelectedRowKeys('');
} else {
message.error(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@action
getHasRight() {
Api.getHasRight().then(res => {
if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form.updateFields({
compName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setJobName(val) {
this.jobName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
setId(id) {
this.id = id;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form1 = new WeaForm();
}
setVisible(bool) {
this.visible = bool;
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setSearchCondition(searchCondition) {
this.searchCondition = searchCondition;
}
setJobId(jobId) {
this.jobId = jobId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setDataSource(dataSource) {
this.dataSource = dataSource;
}
setColumns(columns) {
this.columns = columns
}
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
}
setLoading(bool) {
this.loading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title
}
setCondition(condition) {
this.condition = condition;
}
setCopyCondition(copyCondition) {
this.copyCondition = copyCondition;
}
setNewVisible(bool) {
this.formReset();
this.newVisible = bool;
}
setTotal(total) {
this.total = total;
}
setCurrent(current) {
this.current = current;
}
setPageSize(pageSize) {
this.pageSize = pageSize;
}
setInit(bool) {
this.init = bool;
}
}

View File

@ -0,0 +1,239 @@
import { observable, action, toJS } from "mobx";
import { WeaForm } from "comsMobx";
import isEmpty from 'lodash/isEmpty'
import { WeaTableNew } from "comsMobx";
import { Modal, message } from "antd";
import { i18n } from "../public/i18n";
import forEach from 'lodash/forEach'
import * as Api from '../apis/job'; // 引入API接口文件
export class JobExtendStore {
@observable form = new WeaForm();
@observable tableInfo = []
@observable conditions = [];
@observable isEditor = false;
@observable isNew = true;
@observable loading = true;
@observable tabInfo = [];
@observable selectedKey = '0';
@observable detailSelectedKey = '0';
@observable topTab = [];
@observable buttons = {};
@observable id = ''; //岗位id
@observable date = '';
@observable personalEditTables;
@observable tabkey = '0'
@observable selectedRowKeys = [];
@observable selectedRows = [];
@action onRowSelect = (keys) => {
this.setSelectedRowKeys(keys);
}
@action setSelectedRowKeys = (keys) => {
this.selectedRowKeys = keys;
}
@action
edit = () => {
this.isEditor = true;
this.getData();
this.getTabInfo();
//this.tabkey = '0';
this.detailSelectedKey = '0'
}
init = () => {
//this.tabkey = '0';
this.detailSelectedKey = '0'
this.isEditor = false;
}
save = () => {
if (this.loading)
return;
this.loading = true;
this.form.validateForm().then(f => {
if (f.isValid) {
if (this.personalEditTables) {
const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
if (isPass) {
this.editResource()
} else {
this.loading = false;
}
} else {
this.editResource();
}
} else {
f.showErrors();
this.setDate(new Date());
this.loading = false;
}
})
}
editResource = () => {
let pDatas = this.form.getFormParams();
Api.editResource({ ...{
id: this.id
},
...pDatas,
...this.getTableEditParams()
}).then(data => {
if (data.code == 200) {
message.success(i18n.message.saveSuccess());
this.init();
this.getData();
this.selectedRowKeys = [];
} else {
message.warning(data.message);
}
this.loading = false;
}, error => {
message.warning(error.message);
this.loading = false;
})
}
getTableEditParams = () => {
const params = {};
this.tableInfo && this.tableInfo.forEach(t => {
t.tabinfo.datas = t.tabinfo.datas || [];
params[t.tabinfo.rownum] = t.tabinfo.datas.length;
t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => {
!isEmpty(item) && forEach(item, (value, key) => {
Object.assign(params, {
[`${key}_${index}`]: value
});
})
})
})
return params
}
getData = () => {
this.setLoading(true);
let params = {
viewAttr: this.isEditor ? 2 : 1,
id: this.id,
viewCondition:this.selectedKey
}
Api.getJobExtendForm(params).then((res) => {
if (res.code === 200) {
res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
res.data.result.conditions && this.setConditions(res.data.result.conditions);
this.tableInfo = this.handleTable(res.data.result.tables);
this.getTabInfo();
res.data.result.buttons && this.setButtons(res.data.result.buttons);
res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
this.isEditor && this.getSelectedRows();
this.setLoading(false);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
handleTable = (datas) => {
return datas && datas.map(data => {
const { tabinfo: { columns } } = data;
const length = columns.length;
columns.map(c => {
c.width = `${95 / length}%`
})
return data
})
}
getTabInfo = () => {
this.tabInfo = [];
this.tableInfo && this.tableInfo.forEach((c, idx) => {
if (!c.hide) {
this.tabInfo.push({
key: `${idx}`,
title: c.tabname,
})
}
})
//if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key;
if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key;
}
setLoading(val) {
this.loading = val;
}
updateTabKey = (key) => {
this.tabKey = key;
}
updateDetailSelectedKey =(key) => {
this.detailSelectedKey = key;
}
updateTableInfo = (data) => {
this.tableInfo = data
}
setSelectedKey = (key) => {
this.selectedKey = key;
}
getSelectedRows = () => {
const selectedRows = [];
this.tableInfo.forEach(t => {
const singleTableRows = [];
t.tabinfo.datas.forEach((data, i) => {
if (data.viewAttr === 1) {
singleTableRows.push(i);
}
});
selectedRows.push(singleTableRows);
})
this.selectedRows = selectedRows;
}
setTopTab(topTab) {
this.topTab = topTab;
}
changeData(key) {
this.setSelectedKey(key);
this.getData();
}
setId(id) {
this.id = id;
}
setPersonalEditTables = (ref) => {
this.personalEditTables = ref;
}
setConditions(conditions) {
this.conditions = conditions;
}
setButtons(buttons) {
this.buttons = buttons;
}
}

View File

@ -53,6 +53,8 @@ export class JobLevelStore {
@action
getTableInfo() {
let params;
//获取tab信息
this.getTabInfo();
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
@ -75,8 +77,6 @@ export class JobLevelStore {
}, error => {
message.warning(error.msg);
})
//获取tab信息
this.getTabInfo();
}

View File

@ -292,6 +292,7 @@ export class RankSchemeStore {
this.schemeId = schemeId;
}
@action
setDate(date) {
this.date = date;
}

View File

@ -0,0 +1,290 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/staff'; // 引入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 StaffStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable staffName = '';
@observable conditionNum = 10;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable staffId = '';
@observable date = '';
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
staffName: this.staffName
};
} else {
params = {
...this.form2.getFormParams()
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
//删除
delete() {
let params = {
ids: this.ids
};
Api.deleteTableData(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.getTableInfo();
} else {
message.warning(data.msg);
}
})
.catch(error => {
message.warning(error.msg);
})
}
save() {
let params = {
...this.form.getFormParams()
};
this.form.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.staffId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
getForm() {
let params = this.isNew ? {} : {
id: this.staffId
}
this.setDialogLoadingStatus(true);
Api.getForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action
getHasRight() {
Api.getHasRight().then(res => {
if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form2.updateFields({
staffName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setStaffName(staffName) {
this.staffName = staffName;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setStaffId(staffId) {
this.staffId = staffId;
}
@action
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
}

View File

@ -0,0 +1,308 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/staffscheme'; // 引入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 StaffSchemeStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable schemeName = '';
@observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable schemeId = '';
@observable date = '';
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
schemeName: this.schemeName
};
} else {
params = {
...this.form2.getFormParams()
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
//删除
delete() {
let params = {
ids: this.ids
};
Api.deleteTableData(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.getTableInfo();
} else {
message.warning(data.msg);
}
})
.catch(error => {
message.warning(error.msg);
})
}
save() {
let params = {
...this.form.getFormParams()
};
this.form.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.schemeId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
updateForbiddenTag(checked, id) {
let params = {
forbiddenTag: checked,
id: id
}
Api.updateForbiddenTag(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
getForm() {
let params = this.isNew ? {} : {
id: this.schemeId
}
this.setDialogLoadingStatus(true);
Api.getSchemeForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action
getHasRight() {
Api.getHasRight().then(res => {
if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form2.updateFields({
schemeName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setSchemeName(val) {
this.schemeName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setSchemeId(schemeId) {
this.schemeId = schemeId;
}
@action
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
}

View File

@ -21,6 +21,21 @@
}
}
.hrm-new-weatable-spin {
text-align: center;
margin-top: 10px;
}
.wea-left-right-layout-right {
overflow: scroll !important;
}
.wea-table-operates {
width: 70px !important;
}
//集团管理
.organization-group {
@ -47,4 +62,6 @@
padding-left: 25%;
}
}
}