公司/分部接口对接

This commit is contained in:
Chengliang 2022-05-23 17:28:38 +08:00
parent de7e0d50c6
commit 4c2ff27e46
6 changed files with 282 additions and 1148 deletions

View File

@ -15,43 +15,55 @@ export const getSearchList = (params) => {
}) })
} }
export const getDeptListByPid = (params) => {
return fetch('/api/bs/hrmorganization/dept/getDeptListByPid', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
// export const deleteTableData = (params) => {
// return fetch('/api/bs/hrmorganization/level/deleteByIds', { export const deleteTableData = (params) => {
// method: 'POST', return fetch('/api/bs/hrmorganization/comp/deleteByIds', {
// mode: 'cors', method: 'POST',
// headers: { mode: 'cors',
// 'Content-Type': 'application/json' headers: {
// }, 'Content-Type': 'application/json'
// body: JSON.stringify(params) },
// }) body: JSON.stringify(params)
// } })
}
export const getAdvanceSearchCondition = (params) => { export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params);
} }
// export const add = (params) => { export const add = (params) => {
// return fetch('/api/bs/hrmorganization/level/saveLevel', { return fetch('/api/bs/hrmorganization/comp/saveBaseComp', {
// method: 'POST', method: 'POST',
// mode: 'cors', mode: 'cors',
// headers: { headers: {
// 'Content-Type': 'application/json' 'Content-Type': 'application/json'
// }, },
// body: JSON.stringify(params) body: JSON.stringify(params)
// }) })
// } }
// export const edit = (params) => { export const editResource = (params) => {
// return fetch('/api/bs/hrmorganization/level/updateLevel', { // return fetch('/api/bs/hrmorganization/comp/updateComp', {
// method: 'POST', // method: 'POST',
// mode: 'cors', // mode: 'cors',
// headers: { // headers: {
// 'Content-Type': 'application/json' // 'Content-Type': 'application/json'
// }, // },
// body: JSON.stringify(params) // body: JSON.stringify(params)
// }) // })
// } return WeaTools.callApi('/api/bs/hrmorganization/comp/updateComp', 'POST', params);
}
export const updateForbiddenTag = (params) => { export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', {
@ -64,13 +76,15 @@ export const updateForbiddenTag = (params) => {
}) })
} }
// export const getLevelForm = (params) => { export const getCompanyForm = (params) => {
// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params);
// } }
export const getCompanyExtendForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params);
}
// export const getTabInfo = (params) => {
// return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params);
// }
export const getHasRight = (params) => { export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params);

View File

@ -60,17 +60,13 @@ export default class NewTableDialog extends React.Component {
buttons={buttons} buttons={buttons}
style={{ width: width, height: height }} style={{ width: width, height: height }}
> >
{ <WeaTable rowKey={record => record.id}
loading ? <div className='hrm-loading-center-small'> dataSource={dataSource} childrenColumnName="children"
<Spin spinning={loading}></Spin> columns={columns}
</div> indentSize={15}
: <WeaTable rowKey={record => record.id} loading={loading}
dataSource={dataSource} childrenColumnName="children" defaultExpandedRowKeys={[1, 2]}
columns={columns} />
indentSize={15}
defaultExpandedRowKeys={[1, 2]}
/>
}
</WeaDialog> </WeaDialog>
) )
} }

View File

@ -33,17 +33,17 @@ export default class CompanyExtend extends React.Component {
getTabChildren = () => { getTabChildren = () => {
const { companyExtend } = this.props; const { companyExtend } = this.props;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys } = companyExtend; let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = companyExtend;
let tabChildren = []; let tabChildren = [];
tableInfo = toJS(tableInfo); tableInfo = toJS(tableInfo);
tableInfo && tableInfo.map((t, i) => { tableInfo && tableInfo.map((t, i) => {
if (tabkey == i) { if (detailSelectedKey == i) {
tabChildren.push( tabChildren.push(
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`} <WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
//ref={(ref)=>companyExtend.setPersonalEditTables(ref)} ref={(ref)=>companyExtend.setPersonalEditTables(ref)}
showTitle={isEditor} showTitle={isEditor}
// title={'列表信息'} // title={'列表信息'}
// addFirstRow={isEditor} //addFirstRow={isEditor}
columns={t.tabinfo.columns} columns={t.tabinfo.columns}
datas={t.tabinfo.datas} datas={t.tabinfo.datas}
onChange={this.tableEditChange} onChange={this.tableEditChange}
@ -131,10 +131,10 @@ export default class CompanyExtend extends React.Component {
tableEditChange = (data) => { tableEditChange = (data) => {
const { companyExtend } = this.props; const { companyExtend } = this.props;
let { tabkey = '0', tableInfo } = companyExtend; let { detailSelectedKey = '0', tableInfo } = companyExtend;
tableInfo = toJS(tableInfo); tableInfo = toJS(tableInfo);
let d = cloneDeep(tableInfo); let d = cloneDeep(tableInfo);
d[Number(tabkey)].tabinfo.datas = data; d[Number(detailSelectedKey)].tabinfo.datas = data;
companyExtend.updateTableInfo(d); companyExtend.updateTableInfo(d);
} }
@ -221,7 +221,7 @@ export default class CompanyExtend extends React.Component {
render() { render() {
const { companyExtend } = this.props; const { companyExtend } = this.props;
const { loading, detailSelectedKey, tabInfo,topTab,selectedKey,date } = companyExtend; const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = companyExtend;
// if(!hasRight && !loading){ // if(!hasRight && !loading){
// return ( // return (

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-18 16:23:32 * @Date: 2022-05-18 16:23:32
* @LastEditTime: 2022-05-19 15:00:16 * @LastEditTime: 2022-05-23 16:55:22
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/ */
@ -121,20 +121,19 @@ export default class Company extends React.Component {
company.setNeDialogTitle(i18n.label.companyName()); company.setNeDialogTitle(i18n.label.companyName());
company.setNewVisible(true); company.setNewVisible(true);
//company.getTable(); company.getCompanyForm();
company.setDialogLoadingStatus(false);
} }
//联查部门 //联查部门
select() { select(id) {
const { const {
company company
} = this.props; } = this.props;
company.setNeDialogTitle(i18n.label.companyName()); company.setNeDialogTitle(i18n.label.companyName());
company.setVisible(true); company.setVisible(true);
//company.getTable(); company.getDeptTable(id);
company.setDialogLoadingStatus(false); company.setDialogLoadingStatus(false);
} }
@ -143,10 +142,9 @@ export default class Company extends React.Component {
company company
} = this.props; } = this.props;
const { const {
tableStore selectedRowKeys
} = company; } = company;
let keys = toJS(selectedRowKeys).toString();
let keys = toJS(tableStore.selectedRowKeys).toString();
company.setIds(keys); company.setIds(keys);
this.showConfirm('batchDel'); this.showConfirm('batchDel');
} }
@ -246,7 +244,7 @@ export default class Company extends React.Component {
return <span> return <span>
<a onClick={() => { _this.doDel(record.id) }}>删除</a> <a onClick={() => { _this.doDel(record.id) }}>删除</a>
<span className="ant-divider"></span> <span className="ant-divider"></span>
<a onClick={() => { _this.select() }}>联查部门</a> <a onClick={() => { _this.select(record.id) }}>联查部门</a>
</span> </span>
} }
} }
@ -360,15 +358,27 @@ export default class Company extends React.Component {
} = this.props; } = this.props;
const { const {
isPanelShow, companyName, conditionNum, visible, condition, form, isPanelShow, companyName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date,nEdialogTitle,dialogLoading, tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1,isEdit,newVisible form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total
} = company; } = company;
const rowSelection = { const rowSelection = {
onChange(selectedRowKeys, selectedRows) { onChange(selectedRowKeys, selectedRows) {
company.setSelectedRowKeys(selectedRowKeys); company.setSelectedRowKeys(selectedRowKeys);
},
};
const pagination = {
total: total,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
// company.setCurrent(current);
// company.setPageSize(pageSize);
},
onChange(current) {
//company.setCurrent(current);
}, },
}; };
@ -410,6 +420,12 @@ export default class Company extends React.Component {
dataSource={dataSource} childrenColumnName="children" dataSource={dataSource} childrenColumnName="children"
columns={this.reRenderColumns(columns)} columns={this.reRenderColumns(columns)}
rowSelection={rowSelection} rowSelection={rowSelection}
pagination={pagination}
onChange={(pagination, filters, sorter) => {
company.setCurrent(pagination.current);
company.setPageSize(pagination.pageSize);
company.getTableInfo();
}}
indentSize={15} indentSize={15}
/> />
} }
@ -420,9 +436,9 @@ export default class Company extends React.Component {
title={nEdialogTitle} title={nEdialogTitle}
visible={visible} visible={visible}
loading={dialogLoading} loading={dialogLoading}
height={450} height={400}
dataSource = {dataSource} //联查部门数据 dataSource={deptDataSource} //联查部门数据
columns= {columns} columns={deptColumns}
onCancel={() => company.setVisible(false)} onCancel={() => company.setVisible(false)}
/> />
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`} <NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}

View File

@ -29,6 +29,8 @@ export class CompanyStore {
@observable rightMenu = []; @observable rightMenu = [];
@observable dataSource = []; @observable dataSource = [];
@observable columns = []; @observable columns = [];
@observable deptDataSource = [];
@observable deptColumns = [];
@observable tableStore = new TableStore(); @observable tableStore = new TableStore();
@observable loading = true; @observable loading = true;
@observable dialogLoading = true; @observable dialogLoading = true;
@ -49,20 +51,29 @@ export class CompanyStore {
@observable companyId = ''; @observable companyId = '';
@observable selectedRowKeys = ''; @observable selectedRowKeys = '';
@observable date = ''; @observable date = '';
@observable total = 0;
@observable current = 1;
@observable pageSize = 10;
@action @action
getTableInfo() { getTableInfo() {
let params; this.setLoading(true);
let params = {
current:this.current,
pageSize:this.pageSize
}
if (this.isEmptyObject(this.form.getFormParams())) { if (this.isEmptyObject(this.form.getFormParams())) {
params = { params = {
...params,
...this.form.getFormParams(), ...this.form.getFormParams(),
//companyName: this.companyName, compName: this.companyName,
pageSize:20
}; };
} else { } else {
params = { params = {
...params,
...this.form.getFormParams(), ...this.form.getFormParams(),
}; };
} }
@ -72,6 +83,7 @@ export class CompanyStore {
if (res.code === 200) { if (res.code === 200) {
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
res.data.pageInfo.total && this.setTotal(res.data.pageInfo.total )
this.setLoading(false); this.setLoading(false);
} else { } else {
message.warning(res.msg); message.warning(res.msg);
@ -81,6 +93,30 @@ export class CompanyStore {
}) })
}
@action("联查部门")
getDeptTable(id) {
let params = {
parentComp:id
}
this.setLoading(true);
Api.getDeptListByPid(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
res.data.list && this.setDeptDataSource(res.data.list);
res.data.columns && this.setDeptColumns(res.data.columns);
this.setLoading(false);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} }
//删除 //删除
@ -88,18 +124,18 @@ export class CompanyStore {
let params = { let params = {
ids: this.ids ids: this.ids
}; };
// Api.deleteTableData(params).then(response => { Api.deleteTableData(params).then(response => {
// return response.json() return response.json()
// }).then(data => { }).then(data => {
// if (data.code === 200) { if (data.code === 200) {
// message.success(i18n.message.deleteSuccess()); message.success(i18n.message.deleteSuccess());
// this.getTableInfo(); this.getTableInfo();
// } else { } else {
// message.warning(data.msg); message.warning(data.msg);
// } }
// }).catch(error => { }).catch(error => {
// message.warning(error.msg); message.warning(error.msg);
// }) })
} }
updateForbiddenTag(checked, id) { updateForbiddenTag(checked, id) {
@ -136,46 +172,47 @@ export class CompanyStore {
} }
getForm() { getCompanyForm() {
// this.setDialogLoadingStatus(true); let params = {};
// Api.getCompanyForm(params).then(res => { this.setDialogLoadingStatus(true);
// if (res.code === 200) { Api.getCompanyForm(params).then(res => {
// this.setDialogLoadingStatus(false); if (res.code === 200) {
// res.data.condition && this.setCondition(res.data.condition); this.setDialogLoadingStatus(false);
// res.data.condition && this.form1.initFormFields(res.data.condition); res.data.condition && this.setCondition(res.data.condition);
// } else { res.data.condition && this.form1.initFormFields(res.data.condition);
// message.warning(res.msg); } else {
// } message.warning(res.msg);
// }, error => { }
// message.warning(error.msg); }, error => {
// }) message.warning(error.msg);
})
} }
save() { save() {
// let params = { let params = {
// ...this.form1.getFormParams() ...this.form1.getFormParams()
// }; };
// this.form.validateForm().then(f => { this.form1.validateForm().then(f => {
// if (f.isValid) { if (f.isValid) {
// Api.add(params).then(response => { Api.add(params).then(response => {
// return response.json() return response.json()
// }).then(data => { }).then(data => {
// if (data.code === 200) { if (data.code === 200) {
// message.success(data.msg); message.success(data.msg);
// this.getTableInfo(); this.getTableInfo();
// this.setVisible(false); this.setNewVisible(false);
// } else { } else {
// message.warning(data.msg); message.warning(data.msg);
// } }
// }).catch(error => { }).catch(error => {
// message.warning(error.msg); message.warning(error.msg);
// }) })
// } else { } else {
// f.showErrors(); f.showErrors();
// this.setDate(new Date()); this.setDate(new Date());
// } }
// }); });
} }
@ -195,7 +232,7 @@ save() {
updateFields(val) { updateFields(val) {
this.form.updateFields({ this.form.updateFields({
companyName: { compName: {
value: val value: val
} }
}); });
@ -242,7 +279,7 @@ save() {
formReset() { formReset() {
this.form = new WeaForm(); this.form1 = new WeaForm();
} }
@ -279,10 +316,18 @@ save() {
this.dataSource = dataSource; this.dataSource = dataSource;
} }
setDeptDataSource(deptDataSource) {
this.deptDataSource = deptDataSource;
}
setColumns(columns) { setColumns(columns) {
this.columns = columns this.columns = columns
} }
setDeptColumns(deptColumns) {
this.deptColumns = deptColumns
}
setSelectedRowKeys(selectedRowKeys) { setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
} }
@ -300,7 +345,20 @@ save() {
} }
setNewVisible(bool) { setNewVisible(bool) {
this.formReset();
this.newVisible = bool; this.newVisible = bool;
} }
setTotal(total) {
this.total = total;
}
setCurrent(current) {
this.current = current;
}
setPageSize(pageSize) {
this.pageSize = pageSize;
}
} }

File diff suppressed because it is too large Load Diff