组织架构树

This commit is contained in:
Chengliang 2022-05-30 09:49:02 +08:00
parent 34107bee55
commit 211c0e6634
5 changed files with 152 additions and 94 deletions

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-18 16:23:32
* @LastEditTime: 2022-05-26 09:12:59
* @LastEditTime: 2022-05-27 15:05:49
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/
@ -25,7 +25,8 @@ import {
Modal,
Button,
message,
Switch
Switch,
Menu, Dropdown, Icon
} from 'antd'
import {
WeaSwitch,
@ -227,6 +228,40 @@ export default class Company extends React.Component {
company
} = this.props;
let _this = this;
// `${columns}` && columns.push({
// title: '',
// dataIndex: 'ops',
// key: 'ops',
// width: 80,
// className:"wea-table-operates",
// render: ( text, record, index )=> {
// const menu = (
// <Menu>
// <Menu.Item>
// <a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
// </Menu.Item>
// <Menu.Item>
// <a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
// </Menu.Item>
// </Menu>
// )
// return (
// <Dropdown overlay={menu}>
// <i class="icon-coms-more" />
// </Dropdown>
// )
// }
// });
const menu = (
<Menu>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
</Menu.Item>
</Menu>
)
columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') {
c.render = function (text, record) {
@ -241,16 +276,27 @@ export default class Company extends React.Component {
}
}
if (c.dataIndex == 'operate') {
c.className = "wea-table-operates"
c.width = 80
c.render = function (text, record) {
return <span>
<a onClick={() => { _this.doDel(record.id) }}>删除</a>
<span className="ant-divider"></span>
<a onClick={() => { _this.select(record.id) }}>联查部门</a>
</span>
const menu = (
<Menu>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
</Menu.Item>
</Menu>
)
return <Dropdown overlay={menu}>
<i class="icon-coms-more" />
</Dropdown>
}
}
})
return columns;
}
@ -286,7 +332,7 @@ export default class Company extends React.Component {
} = company;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { company.setCurrent(1); company.setPageSize(10);company.getTableInfo(); company.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => company.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
@ -360,7 +406,7 @@ export default class Company extends React.Component {
const {
isPanelShow, companyName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total,current,pageSize,init
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init
} = company;
const rowSelection = {
@ -370,8 +416,8 @@ export default class Company extends React.Component {
};
const pagination = {
current:current,
pageSize:pageSize,
current: current,
pageSize: pageSize,
total: total,
showSizeChanger: true,
showQuickJumper: true,
@ -379,7 +425,7 @@ export default class Company extends React.Component {
},
onChange(current) {
},
showTotal(total){
showTotal(total) {
return `${total}`
}
};

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-26 14:05:59
* @LastEditTime: 2022-05-26 16:42:44
* @LastEditTime: 2022-05-30 09:48:35
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js
*/
@ -18,6 +18,7 @@ import {
WeaRightMenu,
WeaTable,
WeaLeftRightLayout,
WeaOrgTree
} from 'ecCom'
import {
Row,
@ -26,7 +27,8 @@ import {
Modal,
Button,
message,
Switch
Switch,
Menu, Dropdown, Icon
} from 'antd'
import {
WeaSwitch,
@ -236,31 +238,34 @@ export default class Job extends React.Component {
};
if (c.dataIndex == 'compName') {
c.render = function (text, record) {
return <a onClick={() => {
return <a href='javascript:void(0);' onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank")
}}>{text}</a>
}
}
if (c.dataIndex == 'operate') {
c.className = "wea-table-operates"
c.width = 80
c.render = function (text, record) {
return <span>
<a onClick={() => { _this.doDel(record.id) }}>删除</a>
<span className="ant-divider"></span>
<a onClick={() => { _this.select(record.id) }}>联查部门</a>
</span>
const menu = (
<Menu>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item>
<Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
</Menu.Item>
</Menu>
)
return <Dropdown overlay={menu}>
<i class="icon-coms-more" />
</Dropdown>
}
}
})
return columns;
}
updateForbiddenTag(checked, id) {
const {
job
} = this.props;
job.updateForbiddenTag(checked, id);
}
doDel(id) {
const {
@ -353,55 +358,60 @@ export default class Job extends React.Component {
//左侧树
getTree = () => {
// const {
// hrmAddressBook
// } = this.props;
// const {
// companysId,
// hrmAddressBookPlus: plusStore
// } = hrmAddressBook, {
// leftTabDatas,
// leftTab,
// ORGTREE,
// } = plusStore;
// Object.assign(ORGTREE,{
// expandAllChildrenOnSearch:true
// });
// let tree;
// if (leftTab.selectedKey === '0') {
// tree = (
// <WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
// ref='WeaOrgTree'
// loading
// needSearch
// noCache={true}
// needDropMenu={true}
// onSelect={this.selectVirtual}
// isLoadSubDepartment={true}
// topPrefix={'hrmSearch'}
// companysId={companysId}
// inputLeftDom = {`<b>${i18n.label.organization()}</b`}
// treeNodeClick={this.treeNodeClick}
// expandAllChildrenOnSearch={true}
// />
// )
// } else {
// tree = <OrgTree ecId={`${this && this.props && this.props.ecId || ''}_OrgTree@xphsyb`} ORGTREE={ORGTREE}/>;
// }
// const leftCom = (
// <div style={{height:'100%'}} className='leftCom'>
// <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@80rg76`} {...leftTabDatas} {...leftTab}/>
// <div className='orgTree'>
// {
// tree
// }
// </div>
// </div>
// )
return <div></div>;
}
const {
job
} = this.props;
const {
companysId,
} = job
let tree = (
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
ref='WeaOrgTree'
//dataUrl={"/api/bs/hrmorganization/job/getSearchTree"}
loading
needSearch
noCache={true}
needDropMenu={false}
//onSelect={this.selectVirtual} //组织维度回调函数
isLoadSubDepartment={true}
topPrefix={'hrmSearch'}
companysId={companysId}
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
treeNodeClick={this.treeNodeClick}
expandAllChildrenOnSearch={true}
/>
)
return tree;
}
treeNodeClick = (event, ids, nodeids, nodes) => {
const {
job
} = this.props;
const {
form,
companysId
} = job;
const type = event.node.props.type || '0';
const id = event.node.props.id || '';
let params = {};
form.resetConditionValue();
job.setPanelStatus(false)
// job.tabkey = 'default_3';
job.nodeType = type;
if (type == '0') {
params['virtualtype'] = companysId;
}
if (type == '1') {
params['subcompanyid1'] = id;
}
if (type == '2') {
params['departmentid'] = id;
}
job.doSearch(params);
}
@ -490,14 +500,6 @@ export default class Job extends React.Component {
}}
indentSize={15}
/>
// <NewWeaTable ecId={`${this && this.props && this.props.ecId || ''}_NewWeaTable@q4rrwm`}
// dataSource={dataSource}
// columns={this.reRenderColumns(columns)}
// rowSelection={rowSelection}
// pagination={pagination}
// loading={loading}
// indentSize={15}
// />
}
</WeaLeftRightLayout>
</WeaTop>

View File

@ -121,7 +121,7 @@ export class CompanyStore {
}
//删除
delete() {
@action delete() {
let params = {
ids: this.ids
};
@ -149,6 +149,7 @@ export class CompanyStore {
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
} else {
message.warning(data.msg);
}

View File

@ -56,15 +56,17 @@ import {
@observable current = 1;
@observable pageSize = 10;
@observable defaultShowLeft = true
@observable defaultShowLeft = true;
@observable companysId = 1
@action
getTableInfo() {
getTableInfo(params) {
this.setLoading(true);
let params = {
params = {
...params,
current:this.current,
pageSize:this.pageSize
}
@ -94,12 +96,13 @@ import {
}
}).catch(error => {
message.warning(error.msg);
})
})
}
@action("nodetree事件")
doSearch (params){
this.setInit(true);
this.getTableInfo(params);
}
@action("联查部门")

View File

@ -31,6 +31,12 @@
}
.wea-table-operates {
width: 70px !important;
}
//集团管理
.organization-group {
padding-left: 25%;