Merge pull request 'feature/cl' (#7) from feature/cl into dev
Reviewed-on: http://221.226.25.34:3000/liang.cheng/trunk/pulls/7
This commit is contained in:
commit
c9b6f9d701
|
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/scheme/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/scheme/save', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const edit = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/scheme/updateScheme', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSchemeForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,437 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaAlertPage
|
||||||
|
} 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'; // 从util文件引入公共的方法
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
@inject('managerDetach')
|
||||||
|
@observer
|
||||||
|
export default class ManagerDetach extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.getHasRight();
|
||||||
|
managerDetach.getTableInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
tableStore
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isPanelShow && managerDetach.setPanelStatus(false);
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
managerDetach.setNeDialogTitle(i18n.label.newRankScheme());
|
||||||
|
managerDetach.setIsNew(true);
|
||||||
|
managerDetach.setVisible(true);
|
||||||
|
managerDetach.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
tableStore
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
let keys = toJS(tableStore.selectedRowKeys).toString();
|
||||||
|
managerDetach.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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isPanelShow && managerDetach.setPanelStatus(false);
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { managerDetach.getTableInfo(); managerDetach.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={() => managerDetach.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearchChange(val) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
managerDetach.setSchemeName(val);
|
||||||
|
!this.isEmptyObject(form2.getFormParams()) && managerDetach.updateFields(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
managerDetach
|
||||||
|
} = 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() {
|
||||||
|
managerDetach.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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
doEdit(id) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
managerDetach.setNeDialogTitle(i18n.label.editRankScheme());
|
||||||
|
managerDetach.setSchemeId(id);
|
||||||
|
managerDetach.setIsNew(false);
|
||||||
|
managerDetach.setVisible(true);
|
||||||
|
managerDetach.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 1,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isNew
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isNew && managerDetach.save();
|
||||||
|
!isNew && managerDetach.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form2,
|
||||||
|
searchConditionLoading
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
managerDetach.getTableInfo();
|
||||||
|
managerDetach.setPanelStatus(false)
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, form2, schemeName, conditionNum, tableStore, nEdialogTitle, visible, condition,
|
||||||
|
form, dialogLoading, isEdit, date, hasRight
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.mangerDetachName()}
|
||||||
|
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 => managerDetach.setPanelStatus(bool)}
|
||||||
|
hideSearchAd={() => managerDetach.setPanelStatus(false)}
|
||||||
|
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||||
|
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
onSearch={() => managerDetach.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={() => managerDetach.setVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ export default class RankScheme extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import NewImport from "./components/newImport"
|
||||||
import StaffWorkflowSet from "./components/staff/StaffWorkflowSet"
|
import StaffWorkflowSet from "./components/staff/StaffWorkflowSet"
|
||||||
import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
|
import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
|
||||||
import ResourceCard from "./components/resource/ResourceCard";
|
import ResourceCard from "./components/resource/ResourceCard";
|
||||||
|
import ManagerDetach from "./components/detach/ManagerDetach";
|
||||||
|
|
||||||
import stores from "./stores";
|
import stores from "./stores";
|
||||||
import "./style/index";
|
import "./style/index";
|
||||||
|
|
@ -96,6 +97,7 @@ const Routes = (
|
||||||
<Route key="staffWorkflowSet" path="staffWorkflowSet" component={StaffWorkflowSet} />
|
<Route key="staffWorkflowSet" path="staffWorkflowSet" component={StaffWorkflowSet} />
|
||||||
<Route key="resourceBasicInfo" path="resourceBasicInfo" component={ResourceBasicInfo} />
|
<Route key="resourceBasicInfo" path="resourceBasicInfo" component={ResourceBasicInfo} />
|
||||||
<Route key="resourceCard" path="resourceCard/:id" component={ResourceCard} />
|
<Route key="resourceCard" path="resourceCard/:id" component={ResourceCard} />
|
||||||
|
<Route key="managerDetach" path="managerDetach" component={ManagerDetach} />
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,8 @@ export const i18n = {
|
||||||
newResourceBasicType: () => getLabel(386246, '新建人员资料类型'),
|
newResourceBasicType: () => getLabel(386246, '新建人员资料类型'),
|
||||||
editResourceBasicInfo: () => getLabel(386246, '编辑人员资料'),
|
editResourceBasicInfo: () => getLabel(386246, '编辑人员资料'),
|
||||||
editResourceBasicType: () => getLabel(386246, '编辑人员资料类型'),
|
editResourceBasicType: () => getLabel(386246, '编辑人员资料类型'),
|
||||||
forbidden: () => getLabel('531114', '已禁用'),
|
forbidden: () => getLabel(531114, '已禁用'),
|
||||||
|
mangerDetachName: () => getLabel(385936, '模块管理分权'),
|
||||||
|
|
||||||
authorizationGroup: () => getLabel(492, '权限组'),
|
authorizationGroup: () => getLabel(492, '权限组'),
|
||||||
allAuthorization: () => getLabel(33363, '全部权限'),
|
allAuthorization: () => getLabel(33363, '全部权限'),
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import {NewImportStore} from "./newImport";
|
||||||
import {ResourceBasicInfoStore} from "./reserouseBasicInfo";
|
import {ResourceBasicInfoStore} from "./reserouseBasicInfo";
|
||||||
import {ImportDialogStore} from "./importDialog";
|
import {ImportDialogStore} from "./importDialog";
|
||||||
import {ResourceCardStore} from "./resourceCard";
|
import {ResourceCardStore} from "./resourceCard";
|
||||||
|
import {ManagerDetachStore} from "./managerDetach";
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
@ -56,5 +57,6 @@ module.exports = {
|
||||||
newImport: new NewImportStore(),
|
newImport: new NewImportStore(),
|
||||||
resourceBasicInfo: new ResourceBasicInfoStore(),
|
resourceBasicInfo: new ResourceBasicInfoStore(),
|
||||||
importDialog: new ImportDialogStore(),
|
importDialog: new ImportDialogStore(),
|
||||||
resourceCard:new ResourceCardStore()
|
resourceCard:new ResourceCardStore(),
|
||||||
|
managerDetach: new ManagerDetachStore()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,286 @@
|
||||||
|
import {
|
||||||
|
observable,
|
||||||
|
action
|
||||||
|
} from 'mobx';
|
||||||
|
import * as mobx from 'mobx';
|
||||||
|
import * as Api from '../apis/managerDetach';
|
||||||
|
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 ManagerDetachStore {
|
||||||
|
@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 managerName = '';
|
||||||
|
@observable conditionNum = 2;
|
||||||
|
@observable ids = ''; //选择行id
|
||||||
|
@observable searchConditionLoading = true;
|
||||||
|
@observable nEdialogTitle = '';
|
||||||
|
@observable visible = false;
|
||||||
|
@observable dialogLoading = true;
|
||||||
|
@observable detachId = '';
|
||||||
|
@observable date = '';
|
||||||
|
@observable hasRight = '';
|
||||||
|
|
||||||
|
@action("列表数据加载") getTableInfo(isOnChange = false) {
|
||||||
|
let params;
|
||||||
|
const { current } = this.tableStore;
|
||||||
|
if (this.isEmptyObject(this.form2.getFormParams())) {
|
||||||
|
params = {
|
||||||
|
...this.form2.getFormParams(),
|
||||||
|
managerName: this.managerName
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
params = {
|
||||||
|
...this.form2.getFormParams()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Api.getSearchList(params).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.setHasRight(res.data.hasRight);
|
||||||
|
isOnChange ? this.tableStore.getDatas(res.data.datas, current) : this.tableStore.getDatas(res.data.datas,1);
|
||||||
|
} else {
|
||||||
|
message.warning(res.msg);
|
||||||
|
}
|
||||||
|
}, 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) {
|
||||||
|
this.getTableInfo();
|
||||||
|
message.success(i18n.message.deleteSuccess());
|
||||||
|
} else {
|
||||||
|
message.warning(data.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
message.warning(error.msg);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@action("新建删除") 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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@action("编辑保存") edit() {
|
||||||
|
let params = { ...this.form.getFormParams(), id: this.detachId };
|
||||||
|
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(true);
|
||||||
|
this.setVisible(false);
|
||||||
|
} else {
|
||||||
|
message.warning(data.msg);
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
message.warning(error.msg);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
f.showErrors();
|
||||||
|
this.setDate(new Date());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@action("新建编辑表单") getForm() {
|
||||||
|
let params = this.isNew ? {} : {
|
||||||
|
id: this.detachId
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@action("高级搜索") 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({
|
||||||
|
managerName: {
|
||||||
|
value: val
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setSearchCondition(condition) {
|
||||||
|
this.searchCondition = condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
setScLoadingStatus(bool) {
|
||||||
|
this.searchConditionLoading = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
setPanelStatus(bool) {
|
||||||
|
this.isPanelShow = bool;
|
||||||
|
bool && this.getSearchCondition();
|
||||||
|
if (!bool) {
|
||||||
|
this.scLoadingReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setManagerName(val) {
|
||||||
|
this.managerName = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDetachId(detachId) {
|
||||||
|
this.detachId = detachId;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDate(date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTopMenu(topMenu) {
|
||||||
|
this.topMenu = topMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRightMenu(rightMenu) {
|
||||||
|
this.rightMenu = rightMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
setHasRight(bool) {
|
||||||
|
this.hasRight = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -295,7 +295,6 @@ export class RankSchemeStore {
|
||||||
this.schemeId = schemeId;
|
this.schemeId = schemeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
|
||||||
setDate(date) {
|
setDate(date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue