!26 岗位复制及联查部门

Merge pull request !26 from reset/feature/cl
This commit is contained in:
reset 2022-06-01 08:27:45 +00:00 committed by Gitee
commit b8f7c82534
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 584 additions and 481 deletions

View File

@ -4,8 +4,7 @@ import {
} from 'ecCom' } from 'ecCom'
export const getSearchList = (params) => { export const getSearchList = (params) => {
//return WeaTools.callApi('/api/bs/hrmorganization/comp/listComp', 'POST', params); return fetch('/api/bs/hrmorganization/job/listPage', {
return fetch('/api/bs/hrmorganization/comp/listComp', {
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
headers: { headers: {
@ -15,20 +14,8 @@ 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) => { export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/comp/deleteByIds', { return fetch('/api/bs/hrmorganization/job/deleteByIds', {
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
headers: { headers: {
@ -39,11 +26,30 @@ export const deleteTableData = (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/job/getSearchCondition', 'GET', params);
}
export const getHrmListByJobId = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params);
}
export const getCopyForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params);
} }
export const add = (params) => { export const add = (params) => {
return fetch('/api/bs/hrmorganization/comp/saveBaseComp', { return fetch('/api/bs/hrmorganization/job/saveBaseForm', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const copy = (params) => {
return fetch('/api/bs/hrmorganization/job/copyJobItem', {
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
headers: { headers: {
@ -54,19 +60,11 @@ export const add = (params) => {
} }
export const editResource = (params) => { export const editResource = (params) => {
// return fetch('/api/bs/hrmorganization/comp/updateComp', { return WeaTools.callApi('/api/bs/hrmorganization/job/updateForm', 'POST', params);
// 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) => { export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { return fetch('/api/bs/hrmorganization/job/updateForbiddenTagById', {
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
headers: { headers: {
@ -76,16 +74,16 @@ export const updateForbiddenTag = (params) => {
}) })
} }
export const getCompanyForm = (params) => { export const getJobForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/job/getSaveForm', 'GET', params);
} }
export const getCompanyExtendForm = (params) => { export const getJobExtendForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', '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/job/getHasRight', 'GET', params);
} }

View File

@ -1,69 +0,0 @@
import {
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
WeaTable
} from 'ecCom'
import {
Spin,
Button,
Pagination
} from 'antd'
import {
WeaSwitch
} from 'comsMobx'
import {
i18n
} from '../public/i18n';
import '../style/common.less';
export default class NewWeaTable extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
dataSource,
columns,
rowSelection,
loading,
indentSize
} = this.props
const pagination = {
total: dataSource.length,
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange(current, pageSize) {
},
onChange(current) {
},
showTotal(total){
return `${total}`
}
};
return (
loading ? <div className='hrm-new-weatable-spin'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
</div> :
<WeaTable rowKey={record => record.id}
dataSource={dataSource} childrenColumnName="children"
columns={columns}
rowSelection={rowSelection}
pagination={pagination}
loading={loading}
indentSize={indentSize}
/>
)
}
}

View File

@ -0,0 +1,71 @@
import {
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
WeaDialog
} from 'ecCom'
import {
Spin,
Button,
Pagination
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../public/i18n';
import '../style/common.less';
const WeaTable = WeaTableNew.WeaTable;
export default class NewWeaTableDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 800,
}
}
render() {
const {
title,
visible,
onCancel,
height,
tableStore
} = this.props, {
width,
} = this.state;
const buttons = [
//(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
];
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
title={title}
icon="icon-coms-hrm"
iconBgcolor="#217346"
visible={visible}
closable={true}
hasScroll={true}
onCancel={() => onCancel()}
buttons={buttons}
style={{ width: width, height: height }}
>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
/>
</WeaDialog>
)
}
}

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-27 15:05:49 * @LastEditTime: 2022-06-01 11:51:20
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/ */
@ -40,7 +40,7 @@ import '../../style/common.less';
import NewTableDialog from '../NewTableDialog'; import NewTableDialog from '../NewTableDialog';
import NewAndEditDialog from '../NewAndEditDialog'; import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTable from '../NewWeaTable'; import NewWeaTable from '../NewWeaTableDialog';
import { renderLoading } from '../../util'; // 从util文件引入公共的方法 import { renderLoading } from '../../util'; // 从util文件引入公共的方法

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-26 14:05:59 * @Date: 2022-05-26 14:05:59
* @LastEditTime: 2022-05-30 17:08:21 * @LastEditTime: 2022-06-01 16:18:15
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js
*/ */
@ -40,9 +40,8 @@ import {
import '../../style/common.less'; import '../../style/common.less';
import NewTableDialog from '../NewTableDialog';
import NewAndEditDialog from '../NewAndEditDialog'; import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTable from '../NewWeaTable'; import NewWeaTableDialog from '../NewWeaTableDialog';
import { renderLoading } from '../../util'; // 从util文件引入公共的方法 import { renderLoading } from '../../util'; // 从util文件引入公共的方法
@ -82,6 +81,7 @@ export default class Job extends React.Component {
} = this.props; } = this.props;
job.getTableInfo(); job.getTableInfo();
job.getHasRight(); job.getHasRight();
job.getCopyForm();
} }
getTopMenuBtns() { getTopMenuBtns() {
@ -95,10 +95,13 @@ export default class Job extends React.Component {
let btns = []; let btns = [];
topMenu.map((item, i) => { topMenu.map((item, i) => {
if (item.menuFun !== 'batchDelete') { 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>); btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else if (item.menuFun === 'copy') {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
} else {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
} }
}); });
@ -125,20 +128,70 @@ export default class Job extends React.Component {
job.setNeDialogTitle(i18n.label.jobName()); job.setNeDialogTitle(i18n.label.jobName());
job.setNewVisible(true); job.setNewVisible(true);
job.getCompanyForm(); job.getJobForm();
} }
//联查部门 //联查人员
select(id) { select(id) {
const { const {
job job
} = this.props; } = this.props;
job.setNeDialogTitle(i18n.label.jobName()); job.setNeDialogTitle("联查人员");
job.setVisible(true); job.setVisible(true);
job.setDialogLoadingStatus(true); job.getHrmTable(id);
job.getDeptTable(id); }
copy() {
const {
job
} = this.props;
const {
selectedRowKeys
} = job;
let keys = toJS(selectedRowKeys).toString();
job.setIds(keys);
confirm({
title: i18n.confirm.defaultTitle(),
content: this.getCopyForm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
job.copy()
},
onCancel() {
return false;
},
});
}
getCopyForm() {
const {
job
} = this.props;
const {
copyCondition,
form2,
} = job;
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
let arr = [];
isFormInit && copyCondition.map(c => {
c.items.map((field, index) => {
arr.push(
<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>
)
})
})
return arr;
} }
batchDelete() { batchDelete() {
@ -210,6 +263,13 @@ export default class Job extends React.Component {
this[key] && this[key](); this[key] && this[key]();
} }
updateForbiddenTag(checked, id) {
const {
job
} = this.props;
job.updateForbiddenTag(checked, id);
}
onSearchChange(val) { onSearchChange(val) {
@ -220,7 +280,7 @@ export default class Job extends React.Component {
form form
} = job; } = job;
job.setCompanyName(val); job.setJobName(val);
!this.isEmptyObject(form.getFormParams()) && job.updateFields(val); !this.isEmptyObject(form.getFormParams()) && job.updateFields(val);
} }
@ -236,7 +296,7 @@ export default class Job extends React.Component {
return <Switch defaultChecked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} /> return <Switch defaultChecked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
} }
}; };
if (c.dataIndex == 'compName') { if (c.dataIndex == 'jobName') {
c.render = function (text, record) { c.render = function (text, record) {
return <a href='javascript:void(0);' onClick={() => { return <a href='javascript:void(0);' onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank") window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank")
@ -253,7 +313,7 @@ export default class Job extends React.Component {
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a> <a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a> <a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查人员</a>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
) )
@ -504,13 +564,11 @@ export default class Job extends React.Component {
</WeaLeftRightLayout> </WeaLeftRightLayout>
</WeaTop> </WeaTop>
</WeaRightMenu> </WeaRightMenu>
<NewTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`} <NewWeaTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
title={nEdialogTitle} title={nEdialogTitle}
visible={visible} visible={visible}
loading={dialogLoading}
height={400} height={400}
dataSource={deptDataSource} //联查部门数据 tableStore={tableStore}
columns={deptColumns}
onCancel={() => job.setVisible(false)} onCancel={() => job.setVisible(false)}
/> />
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`} <NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
@ -522,7 +580,7 @@ export default class Job extends React.Component {
loading={dialogLoading} loading={dialogLoading}
isEdit={isEdit} isEdit={isEdit}
height={300} height={300}
conditionLen={4} conditionLen={13}
save={() => this.handleSave()} save={() => this.handleSave()}
onCancel={() => job.setNewVisible(false)} onCancel={() => job.setNewVisible(false)}
enable={false} //是否开启字段联动 enable={false} //是否开启字段联动

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-26 14:07:12 * @Date: 2022-05-26 14:07:12
* @LastEditTime: 2022-05-30 17:04:50 * @LastEditTime: 2022-05-30 17:16:47
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js
*/ */
@ -21,7 +21,7 @@
@inject('jobExtend') @inject('jobExtend')
@inject('company') @inject('job')
@observer @observer
export default class JobExtend extends React.Component { export default class JobExtend extends React.Component {
@ -29,8 +29,7 @@
this.init(); this.init();
} }
init = () => { init = () => {
const { jobExtend,company } = this.props; const { jobExtend,job } = this.props;
//const {id} = company;
let {hash} = window.location; let {hash} = window.location;
hash = hash.split("?")[0]; hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0]; let id = hash.match("[^/]+(?=/$|$)")[0];

View File

@ -144,6 +144,7 @@ export const i18n = {
authorizationGroup: () => getLabel(492, '权限组'), authorizationGroup: () => getLabel(492, '权限组'),
allAuthorization: () => getLabel(33363, '全部权限'), allAuthorization: () => getLabel(33363, '全部权限'),
authorizationGroupInfo: () => getLabel(383045, '权限组信息'), authorizationGroupInfo: () => getLabel(383045, '权限组信息'),

View File

@ -1,48 +1,50 @@
import { import {
observable, observable,
action action
} from 'mobx'; } from 'mobx';
import * as mobx from 'mobx'; import * as mobx from 'mobx';
import * as Api from '../apis/job'; // 引入API接口文件 import * as Api from '../apis/job'; // 引入API接口文件
import { import {
WeaForm WeaForm
} from 'comsMobx'; } from 'comsMobx';
import { import {
WeaTableNew WeaTableNew
} from 'comsMobx'; } from 'comsMobx';
import { import {
Modal, Modal,
message, message,
} from 'antd' } from 'antd'
import { import {
i18n i18n
} from '../public/i18n'; } from '../public/i18n';
const toJS = mobx.toJS; const toJS = mobx.toJS;
const { const {
TableStore TableStore
} = WeaTableNew; } = WeaTableNew;
export class JobStore { export class JobStore {
@observable tableStore = new TableStore();
@observable topMenu = [] @observable topMenu = []
@observable rightMenu = []; @observable rightMenu = [];
@observable dataSource = []; @observable dataSource = [];
@observable columns = []; @observable columns = [];
@observable deptDataSource = []; @observable deptDataSource = [];
@observable deptColumns = []; @observable deptColumns = [];
@observable tableStore = new TableStore();
@observable loading = true; @observable loading = true;
@observable dialogLoading = true; @observable dialogLoading = true;
@observable isEdit = true; @observable isEdit = true;
@observable nEdialogTitle = ''; @observable nEdialogTitle = '';
@observable searchCondition = []; @observable searchCondition = [];
@observable condition = []; @observable condition = [];
@observable copyCondition = [];
@observable isPanelShow = false; //高级搜索面板 @observable isPanelShow = false; //高级搜索面板
@observable form = new WeaForm(); @observable form = new WeaForm();
@observable form1 = new WeaForm(); //新增主表表单 @observable form1 = new WeaForm(); //新增主表表单
@observable form2 = new WeaForm(); //复制表单
@observable jobName = ''; @observable jobName = '';
@observable conditionNum = 8; @observable conditionNum = 12;
@observable ids = ''; //选择行id @observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id @observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true; @observable searchConditionLoading = true;
@ -67,8 +69,8 @@ import {
this.setLoading(true); this.setLoading(true);
params = { params = {
...params, ...params,
current:this.current, current: this.current,
pageSize:this.pageSize pageSize: this.pageSize
} }
if (this.isEmptyObject(this.form.getFormParams())) { if (this.isEmptyObject(this.form.getFormParams())) {
params = { params = {
@ -100,27 +102,24 @@ import {
} }
@action("nodetree事件") @action("nodetree事件")
doSearch (params){ doSearch(params) {
this.setInit(true); this.setInit(true);
this.getTableInfo(params); this.getTableInfo(params);
} }
@action("联查部门") @action("联查人员")
getDeptTable(id) { getHrmTable(id) {
let params = { let params = {
parentComp:id jobId: id
} }
Api.getDeptListByPid(params).then(response => { this.tableStore = new TableStore();
return response.json() Api.getHrmListByJobId(params).then(res => {
}).then(res => {
if (res.code === 200) { if (res.code === 200) {
res.data.list && this.setDeptDataSource(res.data.list); res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
res.data.columns && this.setDeptColumns(res.data.columns);
this.setDialogLoadingStatus(false);
} else { } else {
message.warning(res.msg); message.warning(res.msg);
} }
}).catch(error => { }, error => {
message.warning(error.msg); message.warning(error.msg);
}) })
} }
@ -153,7 +152,7 @@ import {
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, 1);
} else { } else {
message.warning(data.msg); message.warning(data.msg);
} }
@ -178,10 +177,10 @@ import {
} }
getCompanyForm() { getJobForm() {
let params = {}; let params = {};
this.setDialogLoadingStatus(true); this.setDialogLoadingStatus(true);
Api.getCompanyForm(params).then(res => { Api.getJobForm(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.setDialogLoadingStatus(false); this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition); res.data.condition && this.setCondition(res.data.condition);
@ -192,9 +191,24 @@ import {
}, error => { }, error => {
message.warning(error.msg); message.warning(error.msg);
}) })
} }
@action("复制表单")
getCopyForm() {
let params = {};
Api.getCopyForm(params).then(res => {
if (res.code === 200) {
res.data && this.setCopyCondition(res.data);
res.data && this.form2.initFormFields(res.data);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
save() { save() {
let params = { let params = {
...this.form1.getFormParams() ...this.form1.getFormParams()
@ -221,6 +235,33 @@ import {
}); });
} }
copy() {
debugger
let params = {
ids: this.ids,
...this.form2.getFormParams()
};
this.form2.validateForm().then(f => {
if (f.isValid) {
Api.copy(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getTableInfo();
} else {
message.error(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
@action @action
getHasRight() { getHasRight() {
@ -276,7 +317,7 @@ import {
} }
setId(id) { setId(id) {
this.id =id; this.id = id;
} }
scLoadingReset() { scLoadingReset() {
@ -350,6 +391,10 @@ import {
this.condition = condition; this.condition = condition;
} }
setCopyCondition(copyCondition) {
this.copyCondition = copyCondition;
}
setNewVisible(bool) { setNewVisible(bool) {
this.formReset(); this.formReset();
this.newVisible = bool; this.newVisible = bool;
@ -371,4 +416,4 @@ import {
this.init = bool; this.init = bool;
} }
} }

View File

@ -126,7 +126,7 @@ export class JobExtendStore {
id: this.id, id: this.id,
viewCondition:this.selectedKey viewCondition:this.selectedKey
} }
Api.getCompanyExtendForm(params).then((res) => { Api.getJobExtendForm(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
res.data.result.conditions && this.setConditions(res.data.result.conditions); res.data.result.conditions && this.setConditions(res.data.result.conditions);