commit
ced190d417
|
|
@ -0,0 +1,64 @@
|
||||||
|
|
||||||
|
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 updateForbiddenTag = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @Author: 程亮
|
* @Author: 程亮
|
||||||
* @Date: 2022-05-18 16:23:32
|
* @Date: 2022-05-18 16:23:32
|
||||||
* @LastEditTime: 2022-05-23 16:55:22
|
* @LastEditTime: 2022-05-23 18:54:44
|
||||||
* @Description:
|
* @Description:
|
||||||
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
|
||||||
*/
|
*/
|
||||||
|
|
@ -374,11 +374,11 @@ export default class Company extends React.Component {
|
||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
onShowSizeChange(current, pageSize) {
|
onShowSizeChange(current, pageSize) {
|
||||||
// company.setCurrent(current);
|
company.setCurrent(current);
|
||||||
// company.setPageSize(pageSize);
|
company.setPageSize(pageSize);
|
||||||
},
|
},
|
||||||
onChange(current) {
|
onChange(current) {
|
||||||
//company.setCurrent(current);
|
company.setCurrent(current);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -421,11 +421,11 @@ export default class Company extends React.Component {
|
||||||
columns={this.reRenderColumns(columns)}
|
columns={this.reRenderColumns(columns)}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
onChange={(pagination, filters, sorter) => {
|
loading={loading}
|
||||||
company.setCurrent(pagination.current);
|
// onChange={(pagination, filters, sorter) => {
|
||||||
company.setPageSize(pagination.pageSize);
|
// debugger
|
||||||
company.getTableInfo();
|
// company.getTableInfo();
|
||||||
}}
|
// }}
|
||||||
indentSize={15}
|
indentSize={15}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,401 @@
|
||||||
|
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.newRankScheme());
|
||||||
|
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.editRankScheme());
|
||||||
|
staffScheme.setSchemeId(id);
|
||||||
|
staffScheme.setIsNew(false);
|
||||||
|
staffScheme.setVisible(true);
|
||||||
|
staffScheme.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.schemeName()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => this.handleMenuClick(e)}
|
||||||
|
>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||||
|
searchType={['base', 'advanced']}
|
||||||
|
showSearchAd={isPanelShow}
|
||||||
|
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? schemeName : form2.getFormParams().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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,7 @@ import OfficeManage from "./components/office/officeManage";
|
||||||
import CompanyExtend from "./components/company/CompanyExtend"
|
import CompanyExtend from "./components/company/CompanyExtend"
|
||||||
import BranchNumSetting from "./components/branchNumSetting"
|
import BranchNumSetting from "./components/branchNumSetting"
|
||||||
import Company from "./components/company/company";
|
import Company from "./components/company/company";
|
||||||
|
import StaffScheme from "./components/staff/StaffScheme";
|
||||||
|
|
||||||
import stores from "./stores";
|
import stores from "./stores";
|
||||||
import "./style/index";
|
import "./style/index";
|
||||||
|
|
@ -46,6 +47,8 @@ const Routes = (
|
||||||
<Route key="companyExtend" path="companyExtend/:id" component={CompanyExtend} />
|
<Route key="companyExtend" path="companyExtend/:id" component={CompanyExtend} />
|
||||||
<Route key="branchNumSetting" path="branchNumSetting" component={BranchNumSetting} />
|
<Route key="branchNumSetting" path="branchNumSetting" component={BranchNumSetting} />
|
||||||
<Route key="company" path="company" component={Company} />
|
<Route key="company" path="company" component={Company} />
|
||||||
|
|
||||||
|
<Route key="staffscheme" path="staffscheme" component={StaffScheme} />
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { SequenceStore } from "./sequence";
|
||||||
import { GroupStore } from "./group";
|
import { GroupStore } from "./group";
|
||||||
import {CompanyExtendStore} from "./companyextend";
|
import {CompanyExtendStore} from "./companyextend";
|
||||||
import {CompanyStore} from "./company"
|
import {CompanyStore} from "./company"
|
||||||
|
import {StaffSchemeStore} from "./staffscheme";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
simpleOrgStore: new SimpleOrgStore(),
|
simpleOrgStore: new SimpleOrgStore(),
|
||||||
|
|
@ -19,5 +20,6 @@ module.exports = {
|
||||||
sequence: new SequenceStore(),
|
sequence: new SequenceStore(),
|
||||||
group: new GroupStore(),
|
group: new GroupStore(),
|
||||||
companyExtend: new CompanyExtendStore(),
|
companyExtend: new CompanyExtendStore(),
|
||||||
company: new CompanyStore()
|
company: new CompanyStore(),
|
||||||
|
staffScheme: new StaffSchemeStore()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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 = 2;
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue