commit
87b2bf78f5
|
|
@ -175,7 +175,7 @@ export default class Group extends React.Component {
|
|||
group
|
||||
} = this.props;
|
||||
const {
|
||||
nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey,date,hasRight
|
||||
nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey, date, hasRight,loading
|
||||
} = group;
|
||||
|
||||
if (hasRight === false) {
|
||||
|
|
@ -205,7 +205,10 @@ export default class Group extends React.Component {
|
|||
onChange={this.changeData.bind(this)}
|
||||
/>
|
||||
<div className='organization-group'>
|
||||
{this.getFormField()}
|
||||
{
|
||||
loading ? <div className='organization-group-loading'>
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||
</div> : this.getFormField()}
|
||||
</div>
|
||||
</WeaTop>
|
||||
</WeaRightMenu>
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ export default class JobLevel extends React.Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ export default class RankScheme extends React.Component {
|
|||
this.init();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
debugger
|
||||
alert('组件销毁?')
|
||||
}
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const {
|
||||
rankScheme
|
||||
|
|
|
|||
|
|
@ -0,0 +1,467 @@
|
|||
import React from 'react'
|
||||
import * as mobx from 'mobx'
|
||||
import {
|
||||
inject,
|
||||
observer,
|
||||
} from 'mobx-react'
|
||||
import {
|
||||
WeaTop,
|
||||
WeaTab,
|
||||
WeaFormItem,
|
||||
WeaRightMenu,
|
||||
WeaLeftRightLayout,
|
||||
WeaLeftTree
|
||||
} 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';
|
||||
import { renderNoright } from '../../util';
|
||||
|
||||
|
||||
const toJS = mobx.toJS;
|
||||
const confirm = Modal.confirm;
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
|
||||
|
||||
@inject('resourceBasicInfo')
|
||||
@observer
|
||||
export default class ResourceBasicInfo extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
|
||||
if (this.props.location.key !== nextProps.location.key) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
resourceBasicInfo.getHasRight();
|
||||
resourceBasicInfo.initData();
|
||||
}
|
||||
|
||||
getTopMenuBtns() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
topMenu,
|
||||
tableStore
|
||||
} = resourceBasicInfo;
|
||||
|
||||
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 {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
isPanelShow
|
||||
} = resourceBasicInfo;
|
||||
|
||||
isPanelShow && resourceBasicInfo.setPanelStatus(false);
|
||||
this[item.menuFun] && this[item.menuFun]();
|
||||
}
|
||||
|
||||
new() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
|
||||
resourceBasicInfo.setNeDialogTitle(i18n.label.newJobLevel());
|
||||
resourceBasicInfo.setIsNew(true);
|
||||
resourceBasicInfo.setVisible(true);
|
||||
resourceBasicInfo.getForm();
|
||||
}
|
||||
|
||||
batchDelete() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
tableStore
|
||||
} = resourceBasicInfo;
|
||||
|
||||
let keys = toJS(tableStore.selectedRowKeys).toString();
|
||||
resourceBasicInfo.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 {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
resourceBasicInfo.delete();
|
||||
}
|
||||
|
||||
|
||||
getDropMenuDatas() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
rightMenu
|
||||
} = resourceBasicInfo;
|
||||
|
||||
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 {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
isPanelShow
|
||||
} = resourceBasicInfo;
|
||||
|
||||
isPanelShow && resourceBasicInfo.setPanelStatus(false);
|
||||
this[key] && this[key]();
|
||||
}
|
||||
|
||||
getTabBtn() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
form2
|
||||
} = resourceBasicInfo;
|
||||
|
||||
const btn = [
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { resourceBasicInfo.getTableInfo(); resourceBasicInfo.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={() => resourceBasicInfo.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||
];
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
onSearchChange(val) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
form2
|
||||
} = resourceBasicInfo;
|
||||
|
||||
resourceBasicInfo.setLevelName(val);
|
||||
!this.isEmptyObject(form2.getFormParams()) && resourceBasicInfo.updateFields(val);
|
||||
}
|
||||
|
||||
changeData(key) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
resourceBasicInfo.changeData(key);
|
||||
}
|
||||
|
||||
reRenderColumns(columns) {
|
||||
let _this = this;
|
||||
columns.forEach((c, index) => {
|
||||
if (c.dataIndex == 'forbidden_tag') {
|
||||
c.render = function (text, record) {
|
||||
return <Switch checked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
updateForbiddenTag(checked, id) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk() {
|
||||
resourceBasicInfo.updateForbiddenTag(checked, id);
|
||||
},
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onOperatesClick(record, rowIndex, operate) {
|
||||
const {
|
||||
index
|
||||
} = operate;
|
||||
(index == '0') && this.doEdit(record.randomFieldId);
|
||||
(index == '1') && this.doDel(record.randomFieldId);
|
||||
}
|
||||
|
||||
custom = () => {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props, {
|
||||
tableStore,
|
||||
} = resourceBasicInfo;
|
||||
|
||||
tableStore.setColSetVisible(true);
|
||||
tableStore.tableColSet(true);
|
||||
}
|
||||
|
||||
doEdit(id) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
|
||||
resourceBasicInfo.setNeDialogTitle(i18n.label.editJobLevel());
|
||||
resourceBasicInfo.setLevelId(id);
|
||||
resourceBasicInfo.setIsNew(false);
|
||||
resourceBasicInfo.setVisible(true);
|
||||
resourceBasicInfo.getForm();
|
||||
}
|
||||
|
||||
doDel(id) {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
resourceBasicInfo.setIds(id);
|
||||
this.showConfirm('del');
|
||||
}
|
||||
|
||||
|
||||
handleSave() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
isNew
|
||||
} = resourceBasicInfo;
|
||||
|
||||
isNew && resourceBasicInfo.save();
|
||||
!isNew && resourceBasicInfo.edit();
|
||||
}
|
||||
|
||||
getPanelComponents() {
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
searchCondition,
|
||||
form2,
|
||||
searchConditionLoading
|
||||
} = resourceBasicInfo;
|
||||
|
||||
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") {
|
||||
resourceBasicInfo.getTableInfo();
|
||||
resourceBasicInfo.setPanelStatus(false)
|
||||
}
|
||||
}}>{arr}</Row>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//非空判断
|
||||
isEmptyObject(obj) {
|
||||
for (let key in obj) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
log = () => {
|
||||
window.setLogViewProp({
|
||||
logMoudleType: 2,
|
||||
keys: new Date().getTime(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
const {
|
||||
resourceBasicInfo
|
||||
} = this.props;
|
||||
const {
|
||||
isPanelShow, form2, levelName, conditionNum, tableStore, nEdialogTitle, visible, condition,
|
||||
form, dialogLoading, isEdit, selectedKey, topTab, topTabCount, date, hasRight, treeConfig, treeLoading
|
||||
} = resourceBasicInfo;
|
||||
|
||||
if (hasRight === false) {
|
||||
return renderNoright();
|
||||
}
|
||||
|
||||
const {
|
||||
data,
|
||||
onSelectedTreeNode,
|
||||
selectedKeys,
|
||||
onExpand,
|
||||
treeExpandKeys
|
||||
} = toJS(treeConfig);
|
||||
const treeCom = (
|
||||
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
|
||||
datas={data}
|
||||
searchLabel={"等级方案"}
|
||||
onSelect={onSelectedTreeNode}
|
||||
selectedKeys={selectedKeys}
|
||||
onExpand={onExpand}
|
||||
loading={treeLoading}
|
||||
expandedKeys={treeExpandKeys} />
|
||||
)
|
||||
|
||||
return (
|
||||
hasRight && <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.resourceBasicInfo()}
|
||||
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@q6b87k`} leftCom={treeCom}>
|
||||
|
||||
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||
datas={topTab}
|
||||
counts={topTabCount}
|
||||
keyParam="viewCondition" //主键
|
||||
countParam="groupId" //数量
|
||||
selectedKey={selectedKey}
|
||||
onChange={this.changeData.bind(this)}
|
||||
searchType={['base', 'advanced']}
|
||||
showSearchAd={isPanelShow}
|
||||
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? levelName : form2.getFormParams().levelName}
|
||||
setShowSearchAd={bool => resourceBasicInfo.setPanelStatus(bool)}
|
||||
hideSearchAd={() => resourceBasicInfo.setPanelStatus(false)}
|
||||
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||
hasMask={false}
|
||||
buttonsAd={this.getTabBtn()}
|
||||
onSearch={() => resourceBasicInfo.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)}
|
||||
/>
|
||||
</WeaLeftRightLayout>
|
||||
</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={300}
|
||||
conditionLen={3}
|
||||
save={() => this.handleSave()}
|
||||
onCancel={() => resourceBasicInfo.setVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ import BasicInfoImport from "./components/import";
|
|||
import HrmInfoExtend from "./components/resource/HrmInfoExtend";
|
||||
import NewImport from "./components/newImport"
|
||||
import StaffWorkflowSet from "./components/staff/StaffWorkflowSet"
|
||||
import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
|
||||
|
||||
import stores from "./stores";
|
||||
import "./style/index";
|
||||
|
|
@ -92,6 +93,7 @@ const Routes = (
|
|||
<Route key="basicinfoimport" path="basicinfoimport" component={BasicInfoImport} />
|
||||
<Route key="newImport" path="newImport" component={NewImport} />
|
||||
<Route key="staffWorkflowSet" path="staffWorkflowSet" component={StaffWorkflowSet} />
|
||||
<Route key="resourceBasicInfo" path="resourceBasicInfo" component={ResourceBasicInfo} />
|
||||
|
||||
</Route>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ export const i18n = {
|
|||
ResourceName: () => getLabel(385936, '人员'),
|
||||
newPeople: () => getLabel(386246, '新建人员'),
|
||||
resourceMange: () => getLabel(386246, '人员管理'),
|
||||
|
||||
resourceBasicInfo: () => getLabel(386246, '人员信息'),
|
||||
|
||||
|
||||
authorizationGroup: () => getLabel(492, '权限组'),
|
||||
allAuthorization: () => getLabel(33363, '全部权限'),
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export class GroupStore {
|
|||
@observable topTab = [];
|
||||
@observable date = '';
|
||||
@observable hasRight = '';
|
||||
@observable loading = true;
|
||||
|
||||
@action
|
||||
getGroupForm() {
|
||||
|
|
@ -39,10 +40,13 @@ export class GroupStore {
|
|||
viewattr: 1,
|
||||
id: 1
|
||||
}
|
||||
this.setLoading(true);
|
||||
this.form1 = new WeaForm();
|
||||
Api.getGroupForm(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data.condition && this.setGroupCondition(res.data.condition);
|
||||
res.data.condition && this.form1.initFormFields(res.data.condition);
|
||||
this.setLoading(false);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
|
|
@ -90,8 +94,8 @@ export class GroupStore {
|
|||
return response.json()
|
||||
}).then(data => {
|
||||
if (data.code === 200) {
|
||||
message.success(data.msg);
|
||||
this.getGroupForm();
|
||||
message.success(data.msg);
|
||||
this.setVisible(false);
|
||||
} else {
|
||||
message.warning(data.msg);
|
||||
|
|
@ -165,4 +169,12 @@ export class GroupStore {
|
|||
this.hasRight = bool;
|
||||
}
|
||||
|
||||
setDate(date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
setLoading(bool) {
|
||||
this.loading = bool;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import {HrmImportResource} from "./importresource";
|
|||
import {HrmImportCommon} from "./importCommon";
|
||||
import {HrmBasicDataImport} from "./import";
|
||||
import {newImportStore} from "./newImport";
|
||||
import {ResourceBasicInfoStore} from "./reserouseBasicInfo"
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
|
@ -50,5 +51,6 @@ module.exports = {
|
|||
hrmImportResource:new HrmImportResource(),
|
||||
hrmImportCommon:new HrmImportCommon(),
|
||||
hrmBasicDataImport:new HrmBasicDataImport(),
|
||||
newImport: new newImportStore()
|
||||
newImport: new newImportStore(),
|
||||
resourceBasicInfo: new ResourceBasicInfoStore(),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,385 @@
|
|||
import {
|
||||
observable,
|
||||
action
|
||||
} from 'mobx';
|
||||
import * as mobx from 'mobx';
|
||||
import * as Api from '../apis/joblevel'; // 引入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 ResourceBasicInfoStore {
|
||||
@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 levelName = '';
|
||||
@observable conditionNum = 2;
|
||||
@observable ids = ''; //选择行id
|
||||
@observable searchConditionLoading = true;
|
||||
@observable nEdialogTitle = '';
|
||||
@observable visible = false;
|
||||
@observable dialogLoading = true;
|
||||
@observable levelId = '';
|
||||
@observable date = '';
|
||||
@observable selectedKey = -1;
|
||||
@observable topTab = [];
|
||||
@observable topTabCount = {};
|
||||
@observable hasRight = '';
|
||||
@observable treeLoading = true;
|
||||
|
||||
@observable treeConfig = {
|
||||
data: [],
|
||||
selectedKeys: [],
|
||||
treeExpandKeys: [],
|
||||
onExpand: (keys) => {
|
||||
this.treeConfig.treeExpandKeys = keys;
|
||||
},
|
||||
onSelectedTreeNode: (key, count, countType) => {
|
||||
this.treeConfig.selectedKeys = [key];
|
||||
this.selectedTreeNodeInfo = countType.node.props.data;
|
||||
this.getTableInfo();
|
||||
}
|
||||
}
|
||||
//选中树节点的信息
|
||||
@observable selectedTreeNodeInfo;
|
||||
|
||||
@action initData = () => {
|
||||
this.selectedTreeNodeInfo = null;
|
||||
this.treeConfig.treeExpandKeys.length = 0;
|
||||
Api.getTree().then(res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data.length > 0) {
|
||||
this.treeConfig.data = res.data;
|
||||
this.treeConfig.selectedKeys = [res.data[0].key];
|
||||
this.treeConfig.treeExpandKeys = "-1";
|
||||
this.selectedTreeNodeInfo = res.data[0];
|
||||
this.getTableInfo();
|
||||
this.setTreeLoading(false);
|
||||
}
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
}
|
||||
}, error => { })
|
||||
}
|
||||
|
||||
|
||||
@action
|
||||
getTableInfo() {
|
||||
let params = {
|
||||
schemeId: this.selectedTreeNodeInfo && this.selectedTreeNodeInfo.domid,
|
||||
}
|
||||
this.tableStore = new TableStore();
|
||||
if (this.isEmptyObject(this.form2.getFormParams())) {
|
||||
params = {
|
||||
...params,
|
||||
levelName: this.levelName,
|
||||
};
|
||||
} else {
|
||||
params = {
|
||||
...params,
|
||||
...this.form2.getFormParams(),
|
||||
};
|
||||
}
|
||||
Api.getSearchList(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.setHasRight(res.data.hasRight);
|
||||
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.levelId };
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
changeData(key) {
|
||||
this.setSelectedKey(key);
|
||||
this.getTableInfo();
|
||||
}
|
||||
|
||||
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);
|
||||
})
|
||||
}
|
||||
|
||||
getForm() {
|
||||
let params = this.isNew ? {} : {
|
||||
id: this.levelId
|
||||
}
|
||||
this.setDialogLoadingStatus(true);
|
||||
Api.getLevelForm(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
|
||||
getTabInfo() {
|
||||
Api.getTabInfo().then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data.topTabs && this.setTopTab(res.data.topTabs);
|
||||
res.data.topTabCount && this.setTopTabCount(res.data.topTabCount);
|
||||
} 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({
|
||||
levelName: {
|
||||
value: val
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSearchCondition(condition) {
|
||||
this.searchCondition = condition;
|
||||
}
|
||||
|
||||
setScLoadingStatus(bool) {
|
||||
this.searchConditionLoading = bool;
|
||||
}
|
||||
|
||||
setPanelStatus(bool) {
|
||||
this.isPanelShow = bool;
|
||||
bool && this.getSearchCondition();
|
||||
if (!bool) {
|
||||
this.scLoadingReset();
|
||||
}
|
||||
}
|
||||
|
||||
setLevelName(val) {
|
||||
this.levelName = 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;
|
||||
}
|
||||
|
||||
setLevelId(levelId) {
|
||||
this.levelId = levelId;
|
||||
}
|
||||
|
||||
setDate(date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
setSelectedKey(selectedKey) {
|
||||
this.selectedKey = selectedKey;
|
||||
}
|
||||
|
||||
setTopTab(topTab) {
|
||||
this.topTab = topTab;
|
||||
}
|
||||
|
||||
setTopTabCount(topTabCount) {
|
||||
this.topTabCount = topTabCount;
|
||||
}
|
||||
|
||||
setTopMenu(topMenu) {
|
||||
this.topMenu = topMenu;
|
||||
}
|
||||
|
||||
setRightMenu(rightMenu) {
|
||||
this.rightMenu = rightMenu;
|
||||
}
|
||||
|
||||
setHasRight(bool) {
|
||||
this.hasRight = bool;
|
||||
}
|
||||
|
||||
setTreeLoading(bool) {
|
||||
this.treeLoading = bool;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -46,6 +46,10 @@
|
|||
overflow: auto;
|
||||
}
|
||||
|
||||
.organization-group-loading{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
//公司、分部管理
|
||||
.hrm-my-cardInfo {
|
||||
padding-bottom: 20px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue