solve conflct

This commit is contained in:
Chengliang 2022-05-18 14:53:44 +08:00
commit 507ff9df6c
7 changed files with 680 additions and 32 deletions

View File

@ -0,0 +1,77 @@
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 deleteTableData = (params) => {
// return fetch('/api/bs/hrmorganization/level/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/level/saveLevel', {
// method: 'POST',
// mode: 'cors',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(params)
// })
// }
// export const edit = (params) => {
// return fetch('/api/bs/hrmorganization/level/updateLevel', {
// method: 'POST',
// mode: 'cors',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(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 getLevelForm = (params) => {
// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params);
// }
// export const getTabInfo = (params) => {
// return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params);
// }
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params);
}

View File

@ -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

@ -1,9 +1,383 @@
import React, { Component } from 'react'
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
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
export default class Company extends Component {
render() {
return (
<div>C</div>
)
}
}
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
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.newcompany());
// company.setIsNew(true);
// company.setVisible(true);
// company.getForm();
}
batchDelete() {
const {
company
} = this.props;
const {
tableStore
} = company;
let keys = toJS(tableStore.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) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
}
};
if (c.dataIndex == 'compName') {
c.render = function (text, record) {
return <a href='/spa/organization/static/index.html#/main/organization/companyExtend' target='_blank'>{text}</a>
}
}
})
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;
// const {
// isNew
// } = company;
// isNew && company.save();
// !isNew && company.edit();
}
getTabBtn() {
const {
company
} = this.props;
const {
form
} = company;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { 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 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
} = company;
const rowSelection = {
onChange(selectedRowKeys, selectedRows) {
company.setSelectedRowKeys(selectedRowKeys);
},
};
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.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable rowKey={record => record.id}
dataSource={dataSource} childrenColumnName="children"
columns={this.reRenderColumns(columns)}
rowSelection={rowSelection}
indentSize={15}
defaultExpandedRowKeys={[1,2]}
/>
</WeaTop>
</WeaRightMenu>
</div>
)
}
}

View File

@ -10,7 +10,11 @@ import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend"
<<<<<<< HEAD
import BranchNumSetting from "./components/branchNumSetting"
=======
import Company from "./components/company/company";
>>>>>>> feature/cl
import stores from "./stores";
import "./style/index";
@ -42,7 +46,11 @@ const Routes = (
<Route key="group" path="group" component={Group} />
<Route key="officeManage" path="officeManage" component={OfficeManage} />
<Route key="companyExtend" path="companyExtend" component={CompanyExtend} />
<<<<<<< HEAD
<Route key="branchNumSetting" path="branchNumSetting" component={BranchNumSetting} />
=======
<Route key="company" path="company" component={Company} />
>>>>>>> feature/cl
</Route>
);

View File

@ -129,7 +129,7 @@ export const i18n = {
editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
branchNumSetting: () => getLabel(386246, '分部编号设置'),
companyName: () => getLabel(385936, '分部'),
authorizationGroup: () => getLabel(492, '权限组'),

View File

@ -1,43 +1,231 @@
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 { TableStore } = WeaTableNew;
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class CompanyStore {
@observable tableStore = new TableStore();
@observable topMenu = [];
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable dataSource = [];
@observable columns = [];
@observable tableStore = new TableStore();
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable conditionNum = 2;
@observable ids = ""; //选择行id
@observable companyName = '';
@observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
@observable date = "";
@observable companyId = '';
@observable selectedRowKeys = '';
@observable date = '';
@action
getTableInfo() {
let params;
if (this.isEmptyObject(this.form.getFormParams())) {
params = {
...this.form.getFormParams(),
//companyName: this.companyName,
};
} else {
params = {
...this.form.getFormParams(),
};
}
Api.getSearchList(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
} else {
message.warning(res.msg);
}
}).catch(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);
// })
}
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);
})
}
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);
})
}
@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,
},
this.form.updateFields({
companyName: {
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;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
}
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
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;
}
setColumns(columns) {
this.columns = columns
}
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
}
}

View File

@ -4,6 +4,7 @@ import isEmpty from 'lodash/isEmpty'
import { WeaTableNew } from "comsMobx";
import { Modal, message } from "antd";
import { i18n } from "../public/i18n";
import * as Api from '../apis/company'; // 引入API接口文件
export class CompanyExtendStore {