!14 接口对接

Merge pull request !14 from reset/feature/cl
This commit is contained in:
reset 2022-05-23 09:30:16 +00:00 committed by Gitee
commit 502f084452
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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', {
// method: 'POST',
// mode: 'cors',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(params)
// })
// }
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/comp/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 add = (params) => {
return fetch('/api/bs/hrmorganization/comp/saveBaseComp', {
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 editResource = (params) => {
// return fetch('/api/bs/hrmorganization/comp/updateComp', {
// method: 'POST',
// mode: 'cors',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(params)
// })
return WeaTools.callApi('/api/bs/hrmorganization/comp/updateComp', 'POST', params);
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', {
@ -64,13 +76,15 @@ export const updateForbiddenTag = (params) => {
})
}
// export const getLevelForm = (params) => {
// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params);
// }
export const getCompanyForm = (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) => {
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}
style={{ width: width, height: height }}
>
{
loading ? <div className='hrm-loading-center-small'>
<Spin spinning={loading}></Spin>
</div>
: <WeaTable rowKey={record => record.id}
dataSource={dataSource} childrenColumnName="children"
columns={columns}
indentSize={15}
defaultExpandedRowKeys={[1, 2]}
/>
}
<WeaTable rowKey={record => record.id}
dataSource={dataSource} childrenColumnName="children"
columns={columns}
indentSize={15}
loading={loading}
defaultExpandedRowKeys={[1, 2]}
/>
</WeaDialog>
)
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ export class CompanyStore {
@observable rightMenu = [];
@observable dataSource = [];
@observable columns = [];
@observable deptDataSource = [];
@observable deptColumns = [];
@observable tableStore = new TableStore();
@observable loading = true;
@observable dialogLoading = true;
@ -49,20 +51,29 @@ export class CompanyStore {
@observable companyId = '';
@observable selectedRowKeys = '';
@observable date = '';
@observable total = 0;
@observable current = 1;
@observable pageSize = 10;
@action
getTableInfo() {
let params;
this.setLoading(true);
let params = {
current:this.current,
pageSize:this.pageSize
}
if (this.isEmptyObject(this.form.getFormParams())) {
params = {
...params,
...this.form.getFormParams(),
//companyName: this.companyName,
pageSize:20
compName: this.companyName,
};
} else {
params = {
...params,
...this.form.getFormParams(),
};
}
@ -72,6 +83,7 @@ export class CompanyStore {
if (res.code === 200) {
res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
res.data.pageInfo.total && this.setTotal(res.data.pageInfo.total )
this.setLoading(false);
} else {
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 = {
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);
// })
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) {
@ -136,46 +172,47 @@ export class CompanyStore {
}
getForm() {
// this.setDialogLoadingStatus(true);
// Api.getCompanyForm(params).then(res => {
// if (res.code === 200) {
// this.setDialogLoadingStatus(false);
// res.data.condition && this.setCondition(res.data.condition);
// res.data.condition && this.form1.initFormFields(res.data.condition);
// } else {
// message.warning(res.msg);
// }
// }, error => {
// message.warning(error.msg);
// })
getCompanyForm() {
let params = {};
this.setDialogLoadingStatus(true);
Api.getCompanyForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form1.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
save() {
// let params = {
// ...this.form1.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());
// }
// });
let params = {
...this.form1.getFormParams()
};
this.form1.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.setNewVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
@ -195,7 +232,7 @@ save() {
updateFields(val) {
this.form.updateFields({
companyName: {
compName: {
value: val
}
});
@ -242,7 +279,7 @@ save() {
formReset() {
this.form = new WeaForm();
this.form1 = new WeaForm();
}
@ -279,10 +316,18 @@ save() {
this.dataSource = dataSource;
}
setDeptDataSource(deptDataSource) {
this.deptDataSource = deptDataSource;
}
setColumns(columns) {
this.columns = columns
}
setDeptColumns(deptColumns) {
this.deptColumns = deptColumns
}
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
}
@ -300,7 +345,20 @@ save() {
}
setNewVisible(bool) {
this.formReset();
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