Compare commits

...

36 Commits

Author SHA1 Message Date
Chengliang b94627a73d 保护模式 2022-05-18 16:19:48 +08:00
reset aba9ee3840
!7 集团管理编辑优化
Merge pull request !7 from reset/feature/cl
2022-05-18 07:30:22 +00:00
Chengliang 44715650db 集团编辑功能完善 2022-05-18 15:24:46 +08:00
reset e7e1410cef
!6 1
Merge pull request !6 from reset/feature/cl
2022-05-18 07:02:09 +00:00
Chengliang b96ffa4205 solve conflict 2022-05-18 15:01:04 +08:00
reset 15e223269d
!5 solve conflict
Merge pull request !5 from reset/feature/cl
2022-05-18 06:59:48 +00:00
Chengliang db16ec323a solve conflict 2022-05-18 14:58:44 +08:00
reset c3d7a9db71
!4 1
Merge pull request !4 from reset/feature/cl
2022-05-18 06:56:09 +00:00
Chengliang a89634f0df 1 2022-05-18 14:55:10 +08:00
Chengliang 507ff9df6c solve conflct 2022-05-18 14:53:44 +08:00
Chengliang eff03741b2 solve conflict 2022-05-18 14:49:46 +08:00
Chengliang b073384fc7 solve conflict 2022-05-18 14:46:36 +08:00
Chengliang 98ae042c26 公司/发布列表页面 2022-05-18 14:34:01 +08:00
liyongshun 821c46bb9d Merge branch 'liys_dev' into dev 2022-05-18 14:15:34 +08:00
liyongshun 24f3350420 修改编号设置页面交互 2022-05-18 14:15:10 +08:00
liyongshun 81f9b5ca2f Merge branch 'liys_dev' into dev 2022-05-18 14:08:33 +08:00
liyongshun 9303fe3f3c 编号组成交互的完成 2022-05-18 13:49:24 +08:00
liyongshun e1cc281cff 分部编号设置的页面完成50% 2022-05-17 18:32:09 +08:00
reset e0432a21c5
!3 公司/分部扩展页面
Merge pull request !3 from reset/feature/cl
2022-05-17 06:49:34 +00:00
Chengliang dd9646213f 公司/发布扩展页面 2022-05-17 14:47:54 +08:00
liyongshun 89aab7a742 Merge branch 'dev' of gitee.com:jmlcl/trunk into dev 2022-05-17 14:11:59 +08:00
liyongshun 596816ebb2 删除测试文件 2022-05-17 14:11:56 +08:00
Chengliang 1bf9f9aa81 公司/分部扩展页面 2022-05-16 17:32:27 +08:00
liyongshun aaa31935b3 Merge branch 'dev' of gitee.com:jmlcl/trunk into dev 2022-05-16 17:13:39 +08:00
liyongshun 5bc2f44073 职务管理模块接口联调 2022-05-16 17:13:37 +08:00
Chengliang bb7bd102ec 公司/分部管理 2022-05-16 13:36:54 +08:00
Chengliang 774bd7203f 公司/分部管理初始化 2022-05-16 10:32:21 +08:00
liyongshun 559ed2cbee Merge branch 'dev' of gitee.com:jmlcl/trunk into dev 2022-05-13 18:09:32 +08:00
liyongshun 9e8d36bbc4 职务管理页面的新增 2022-05-13 18:06:15 +08:00
liyongshun 2e167f4099 职务管理页面新增 2022-05-13 18:05:45 +08:00
Chengliang 811c9da4d1 集团管理静态页面 2022-05-13 16:56:52 +08:00
Chengliang 67304df567 完成职等页面 职级页面 2022-05-12 14:57:36 +08:00
Chengliang 8c6d1df37c 等级方案页面完成 职等页面完成静态页面 2022-05-10 18:02:06 +08:00
Chengliang fb6ae67485 等级方案页面完成列表渲染,高级搜索,禁用标记等 2022-05-07 17:46:35 +08:00
Chengliang b7c99835da 等级方案页面 2022-05-06 16:53:43 +08:00
Chengliang a2fa127bfe 测试 2022-05-05 16:28:47 +08:00
43 changed files with 8962 additions and 56 deletions

View File

@ -20,7 +20,7 @@
#### 使用说明 #### 使用说明
1. xxxx 1. 测试保护模式
2. xxxx 2. xxxx
3. xxxx 3. xxxx

1
package-lock.json generated
View File

@ -7,6 +7,7 @@
"dependencies": { "dependencies": {
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"lodash": "^4.17.21",
"orgchart": "^3.1.1", "orgchart": "^3.1.1",
"rc-org-chart": "^1.0.6", "rc-org-chart": "^1.0.6",
"react-org-tree": "^1.0.0", "react-org-tree": "^1.0.0",

View File

@ -2,6 +2,7 @@
"dependencies": { "dependencies": {
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"lodash": "^4.17.21",
"orgchart": "^3.1.1", "orgchart": "^3.1.1",
"rc-org-chart": "^1.0.6", "rc-org-chart": "^1.0.6",
"react-org-tree": "^1.0.0", "react-org-tree": "^1.0.0",

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

@ -0,0 +1,29 @@
import {
WeaTools
} from 'ecCom'
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/group/updateGroup', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getTabInfo = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/group/getTabInfo', 'GET', params);
}
export const getGroupForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/group/getGroupFormField', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/group/getHasRight', 'GET', params);
}

View File

@ -1,6 +1,5 @@
import { WeaTools } from 'ecCom'; import { WeaTools } from 'ecCom';
//组织架构图(简单) //组织架构图(简单)
export const getSimpleOrganizationDatas = params => { export const getSimpleOrganizationDatas = params => {
return WeaTools.callApi('/api/hrm/module/organization/simple/datas', 'GET', params); return WeaTools.callApi('/api/hrm/module/organization/simple/datas', 'GET', params);

View File

@ -0,0 +1,67 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/grade/getGradeTable', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/grade/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/grade/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/grade/saveGrade', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/grade/updateGrade', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/grade/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getGradeForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/grade/getGradeForm', 'GET', params);
}
export const getTabInfo = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/grade/getTabInfo', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/grade/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,68 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelTable', 'GET', 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/level/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/level/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/level/getTableBtn', 'GET', params);
}

View File

@ -0,0 +1,116 @@
/*
* Author: 黎永顺
* Description:
* Date: 2022-05-13 16:36:09
* LastEditTime: 2022-05-16 16:27:08
*/
import { WeaTools } from "ecCom";
export const getHasRight = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getHasRight",
"GET",
params
);
};
export const getSearchCondition = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getSearchCondition",
"GET",
params
);
};
export const getPostInfoForm = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoForm",
"GET",
params
);
};
export const savePostInfo = (params) => {
return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const updatePostInfo = (params) => {
return fetch("/api/bs/hrmorganization/postinfo/updatePostInfo", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const updateForbiddenTagById = (params) => {
return fetch("/api/bs/hrmorganization/postinfo/updateForbiddenTagById", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const savePost = (params) => {
return fetch("/api/bs/hrmorganization/post/savePost", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const deleteByIds = (params) => {
return fetch("/api/bs/hrmorganization/post/deleteByIds", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const deletePostinfoByIds = (params) => {
return fetch("/api/bs/hrmorganization/postinfo/deleteByIds", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
};
export const getTreeData = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/post/getTreeData",
"GET",
params
);
};
export const getPostForm = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/post/getPostForm",
"GET",
params
);
};
export const getPostInfoTable = (params) => {
return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoTable",
"GET",
params
);
};

View File

@ -0,0 +1,66 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params);
}
export const deleteTableData = (params) => {
//return WeaTools.callApi('/api/bs/hrmorganization/scheme/deleteByIds', 'POST', params);
return fetch('/api/bs/hrmorganization/scheme/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params);
}
export const add = (params) => {
//return WeaTools.callApi('/api/bs/hrmorganization/scheme/save', 'POST', params);
return fetch('/api/bs/hrmorganization/scheme/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/scheme/updateScheme', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getSchemeForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params);
}

View File

@ -0,0 +1,69 @@
import {
WeaTools
} from 'ecCom'
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSequenceTable', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/sequence/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/sequence/saveSequence', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/sequence/updateSequence', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const updateForbiddenTag = (params) => {
return fetch('/api/bs/hrmorganization/sequence/updateForbiddenTagById', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getSequenceForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSequenceForm', 'GET', params);
}
export const getTabInfo = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getTabInfo', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getHasRight', 'GET', params);
}

View File

@ -0,0 +1,153 @@
import {
WeaDialog,
WeaFormItem,
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
} from 'ecCom'
import {
Spin,
Button,
} from 'antd'
import {
WeaSwitch
} from 'comsMobx'
import {
i18n
} from '../public/i18n';
export default class NewAndEditDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 700,
enable: props.enable
}
}
getForm() {
const {
condition,
form,
isFormInit,
} = this.props;
let arr = [];
isFormInit && condition.map(c => {
c.items.map((field, index) => {
arr.push(<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@jacv6v@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
error={form.getError(field)}
tipPosition="bottom"
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7vxyfr@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} />}
</WeaFormItem>)
})
})
return <div className="wea-form-item-group">{arr}</div>
}
onChange = data => {
if(this.state.enable && data.schemeId) {
const {
condition,
form,
bindChangeEnvent,
} = this.props;
bindChangeEnvent(data.schemeId.value);
}
};
onBlur = data => {
//console.log("onBlur 回调", data);
};
getSearchGroupForm() {
const {
condition,
form,
isFormInit,
isEdit
} = this.props;
let arr = [];
isFormInit && condition.map((c, i) => {
let _arr = [];
c.items.map((field, index) => {
_arr.push({
com: (
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@merei2@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
error={form.getError(field)}
tipPosition="bottom"
wrapperCol={{ span: `${field.fieldcol}` }}
underline={isEdit ? false : true}
>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@5r6c5a@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange}
onBlur={this.onBlur} />
</WeaFormItem>
),
colSpan: 1
})
})
arr.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@qaih5l@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={_arr} col={1} />)
})
return arr;
}
render() {
const {
title,
visible,
save,
onCancel,
loading,
isEdit,
height,
conditionLen,
} = 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={isEdit ? buttons : buttons.slice(1, 2)}
style={{ width: width, height: height }}
>
{
loading ? <div className='hrm-loading-center-small'>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
</div>
: <div className={conditionLen > 1 ? '' : 'hrm-dialog-form'}>
{conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()}
</div>
}
</WeaDialog>
)
}
}

View File

@ -0,0 +1,348 @@
/*
* Author: 黎永顺
* Description:
* Date: 2022-05-17 16:02:56
* LastEditTime: 2022-05-18 13:46:29
*/
import React, { Component, Fragment } from "react";
import { Button, Modal } from "antd";
import {
WeaTableEdit,
WeaDialog,
WeaMoreButton,
WeaFormItem,
WeaSelect,
WeaInput,
} from "ecCom";
import Preview from "./preview";
import { i18n } from "../../../public/i18n";
import _ from "lodash";
const dataSource = [
{
value: "",
numFieldName: "字符串",
numField: "string",
},
{ value: "3", numFieldName: "流水号位数", numField: "number" },
];
const options = [
{
key: "string",
showname: "字符串",
},
{
key: "year",
showname: "当前年份",
},
{
key: "month",
showname: "当前月份",
},
{
key: "day",
showname: "当前日期",
},
];
class NumberComposition extends Component {
constructor() {
super();
this.state = {
visible: false,
numField: "string",
numFieldName: "字符串",
dataSource,
};
}
/**
* name:复选框禁用
* param undefined
* return {*}
*/
getRowSelection = (rowSelection) => {
const { dataSource } = this.state;
const hasMonthNum = dataSource.some((item) => item.numField === "month");
const hasDayNum = dataSource.some((item) => item.numField === "day");
const sel = { ...rowSelection };
sel.getCheckboxProps = (record) => {
return {
disabled:
record.numField === "number" ||
(hasMonthNum && record.numField === "year") ||
(hasDayNum && record.numField === "month"),
};
};
return sel;
};
/**
* name: 字段保存
* return {*}
*/
handleSave = () => {
const { numField, numFieldName, dataSource } = this.state;
const objWrite = {
value: "",
numFieldName,
numField,
};
const objView = {
com: {
value: [{ key: numField, label: "", type: "TEXT" }],
},
[numField]: "",
numFieldName,
numField,
};
if (numField === "year" || numField === "month" || numField === "day") {
const hasYearOrMonthOrDay = _.some(
dataSource,
(it) => it.numField === numField
);
const hasYearNum = dataSource.some((item) => item.numField === "year");
const hasMonthNum = dataSource.some((item) => item.numField === "month");
if (!hasYearOrMonthOrDay) {
if (numField === "month" && !hasYearNum) {
Modal.warning({
title: "信息确认",
content: `添加【${numFieldName}】时,请先添加【当前年份】!`,
onOk() {},
okText: "确认",
});
return;
}
if (numField === "day" && (!hasYearNum || !hasMonthNum)) {
Modal.warning({
title: "信息确认",
content: `添加【${numFieldName}】时,请先添加【当前年份】和【当前月份】!`,
onOk() {},
okText: "确认",
});
return;
}
this.setState({
visible: false,
numField: "string",
numFieldName: "字符串",
dataSource: [...dataSource, objView],
});
} else {
this.showConfirm();
}
} else {
this.setState({
visible: false,
numField: "string",
numFieldName: "字符串",
dataSource: [...dataSource, objWrite],
});
}
};
/**
* name:年月日字段重复提示
* return {*}
*/
showConfirm = () => {
const { numFieldName } = this.state;
Modal.warning({
title: "信息确认",
content: `已经添加过一个${numFieldName},请选择其他编号字段!`,
footer: [],
onOk() {},
okText: "确认",
});
};
/**
* name: 编号字段删除
* return {*}
*/
handleDeleteTable = (keys, datas) => {
const { dataSource } = this.state;
const stringRow = _.filter(dataSource, (it) => it.numField === "string");
const yearRow = _.filter(dataSource, (it) => it.numField === "year");
const monthRow = _.filter(dataSource, (it) => it.numField === "month");
const dayRow = _.filter(dataSource, (it) => it.numField === "day");
const disableRow = _.filter(dataSource, (it) => it.numField === "number");
const tmpV = [
...stringRow,
...yearRow,
...monthRow,
...dayRow,
...disableRow,
];
this.setState({
dataSource: _.filter(tmpV, (it, idx) => !keys.includes(idx)),
});
};
handleChangeInput = (value, index) => {
const { dataSource } = this.state;
const stringRow = _.filter(dataSource, (it) => it.numField === "string");
const yearRow = _.filter(dataSource, (it) => it.numField === "year");
const monthRow = _.filter(dataSource, (it) => it.numField === "month");
const dayRow = _.filter(dataSource, (it) => it.numField === "day");
const disableRow = _.filter(dataSource, (it) => it.numField === "number");
const tmpV = _.map(
[...stringRow, ...yearRow, ...monthRow, ...dayRow, ...disableRow],
(it, idx) => ({ ...it, key: idx })
);
this.setState({
dataSource: _.map(tmpV, (it) => {
if (it.key === index) {
return {
...it,
value,
};
}
return { ...it };
}),
});
};
render() {
const { visible, numField, dataSource } = this.state;
const columns = [
{
title: "",
dataIndex: "numFieldName",
key: "numFieldName",
colSpan: 1,
com: [{ label: "", type: "TEXT" }],
width: "20%",
},
{
title: "",
useRecord: true,
dataIndex: "custom",
key: "custom",
com: [
{
type: "custom",
key: "custom",
render: (text, record, index) => {
const { numField } = record;
if (
numField === "year" ||
numField === "month" ||
numField === "day"
) {
return <span></span>;
}
return (
<WeaInput
id="custom"
value={record.value}
onChange={(value) =>
this.handleChangeInput(value, index, record)
}
/>
);
},
},
],
// dataIndex: "value",
// key: "value",
// com: [{ label: "", type: "INPUT", viewAttr: 2, key: "value" }],
colSpan: 1,
width: "70%",
},
];
const buttons = [
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@jd6baw`}
onClick={this.handleSave}
type="primary">
{i18n.button.save()}
</Button>,
<WeaMoreButton
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaMoreButton@e4f4n1`}
/>,
];
const stringRow = _.map(
_.filter(dataSource, (it) => it.numField === "string"),
(item, index) => {
return {
...item,
numFieldName: `${item.numFieldName}${index + 1}`,
};
}
);
const yearRow = _.filter(dataSource, (it) => it.numField === "year");
const monthRow = _.filter(dataSource, (it) => it.numField === "month");
const dayRow = _.filter(dataSource, (it) => it.numField === "day");
const disableRow = _.filter(dataSource, (it) => it.numField === "number");
return (
<Fragment>
<WeaTableEdit
draggable={true}
columns={columns}
datas={[
...stringRow,
...yearRow,
...monthRow,
...dayRow,
...disableRow,
]}
getRowSelection={this.getRowSelection}
pushTitleIntoHeader
showCopy={false}
btnsType="inline"
deleteConfirm
addType="func"
addFunc={() =>
this.setState({
visible: true,
})
}
onDelete={this.handleDeleteTable}
/>
{/* 预览 */}
<Preview
dataSource={[
...stringRow,
...yearRow,
...monthRow,
...dayRow,
...disableRow,
]}
/>
{/* 新增弹框 */}
<WeaDialog
onCancel={() =>
this.setState({
visible: false,
})
}
icon="icon-coms-hrm"
iconBgcolor="#217346"
title={i18n.label.addNumberField()}
visible={visible}
hasScroll
maxHeight={150}
buttons={buttons}>
<WeaFormItem
label="编号字段"
style={{ padding: "20px 20%" }}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<WeaSelect
options={options}
value={numField}
style={{ width: "100%" }}
viewAttr={2}
onChange={(numField, numFieldName) => {
this.setState({ numField, numFieldName });
}}
/>
</WeaFormItem>
</WeaDialog>
</Fragment>
);
}
}
export default NumberComposition;

View File

@ -0,0 +1,47 @@
/*
* Author: 黎永顺
* Description: 编号设置预览
* Date: 2022-05-18 10:21:09
* LastEditTime: 2022-05-18 13:26:11
*/
import React, { Component } from "react";
class Preview extends Component {
render() {
const { dataSource } = this.props;
return (
<div className="preview">
<span className="label">预览</span>
<div className="content">
{_.map(
_.map(dataSource, (item) => {
const { numField, numFieldName } = item;
if (
numField === "year" ||
numField === "month" ||
numField === "day"
) {
return {
...item,
value: numFieldName,
};
}
return { ...item };
}),
(it, idx) => {
const { numFieldName, value } = it;
return (
<div className="item" key={idx}>
<div title={numFieldName}>{numFieldName}</div>
<div>{value}</div>
</div>
);
}
)}
</div>
</div>
);
}
}
export default Preview;

View File

@ -0,0 +1,31 @@
/*
* Author: 黎永顺
* Description: 起始编号及预留编号设置
* Date: 2022-05-17 15:51:41
* LastEditTime: 2022-05-17 16:01:33
*/
import React, { Component, Fragment } from "react";
import { WeaFormItem } from "ecCom";
class StartReservedNumberSet extends Component {
render() {
return (
<Fragment>
<WeaFormItem
label="起始编号"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<i className="icon-coms-Flow-setting"></i>
</WeaFormItem>
<WeaFormItem
label="预留编号"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<i className="icon-coms-Flow-setting"></i>
</WeaFormItem>
</Fragment>
);
}
}
export default StartReservedNumberSet;

View File

@ -0,0 +1,101 @@
/*
* Author: 黎永顺
* Description: 分部编号设置
* Date: 2022-05-17 14:30:57
* LastEditTime: 2022-05-18 14:13:24
*/
import React, { Component, Fragment } from "react";
import { Button } from "antd";
import { WeaTop, WeaFormItem, WeaCheckbox, WeaSearchGroup } from "ecCom";
import StartReservedNumberSet from "./components/startReservedNumberSet";
import NumberComposition from "./components/numberComposition";
import { i18n } from "../../public/i18n";
import "./index.less";
const btns = [<Button type="primary">保存</Button>];
const dropMenuDatas = [
{
key: "save",
disabled: false,
icon: <i className="icon-coms-Preservation" />,
content: "保存",
onClick: (key) => alert(`点击了搜索 key = ${key}`),
},
];
export default class BranchNumSetting extends Component {
constructor() {
super();
this.state = {
checkVal: "0",
};
}
componentDidMount() {}
/**
* name:提示文本
* return {*}
*/
helpContent = () => {
return (
<div>
<p>开启后可根据设置的分部编号规则自动生成分部编号涉及场景如下</p>
<p>1.手动新建和手动编辑分部时可选择重新生成编号和选择预留分部编号</p>
<p>2.组织结构导入-添加新分部且分部编号列为空时会自动生成分部编号</p>
<p>3.导入人员-添加时新创建的分部可自动生成分部编号</p>
<p>注意开启前请先确认分部编号字段已启用</p>
</div>
);
};
render() {
const { checkVal } = this.state;
return (
<div className="branch-wapper">
<WeaTop
title={i18n.label.branchNumSetting()}
icon={<i className="icon-coms-hrm" />}
iconBgcolor="#217346"
buttons={btns}
showDropIcon={true}
dropMenuDatas={dropMenuDatas}
/>
<div className="branch-content">
<div className="switch-wrapper">
<WeaFormItem
label="分部编号自动生成"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<WeaCheckbox
value={checkVal}
helpfulTip={this.helpContent}
helpfulTipProps={{ placement: "top" }}
display="switch"
id="num-set-switch"
onChange={(checkVal) => this.setState({ checkVal })}
/>
</WeaFormItem>
</div>
{/* 内容区 */}
{checkVal === "1" && (
<Fragment>
<div className="numberComposition">
<WeaSearchGroup title={"编号组成"} showGroup>
<NumberComposition />
</WeaSearchGroup>
</div>
<div className="startReservedNumberSet">
<WeaSearchGroup
title={"起始编号及预留编号设置"}
showGroup
center>
<StartReservedNumberSet />
</WeaSearchGroup>
</div>
</Fragment>
)}
</div>
</div>
);
}
}

View File

@ -0,0 +1,69 @@
.branch-wapper {
height: 100%;
display: flex;
flex-direction: column;
.branch-content {
flex: 1;
overflow: hidden auto;
.switch-wrapper {
width: 100%;
padding: 20px 20% 40px 30%;
}
.numberComposition .ant-table-thead {
background: #f7fbfe;
}
.numberComposition {
.preview {
margin-top: 20px;
padding-left: 5%;
overflow-x: auto;
width: 100%;
white-space: nowrap;
display: flex;
align-items: center;
.content {
vertical-align: middle;
margin-left: 30px;
white-space: nowrap;
.item {
display: inline-block;
text-align: center;
&>div {
border: 1px solid #0070c0;
margin-left: -1px;
min-width: 100px;
max-width: 200px;
line-height: 30px;
height: 30px;
white-space: nowrap;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
color: #0070c0;
}
&>div:last-child {
margin-top: -1px;
color: #c63;
}
}
}
}
}
.startReservedNumberSet {
.icon-coms-Flow-setting {
font-size: 16px;
cursor: pointer;
line-height: 30px;
}
}
}
}

View File

@ -0,0 +1,277 @@
import { Button, Modal, message, Row, Col, Spin } from 'antd';
import isEmpty from 'lodash/isEmpty'
import cloneDeep from 'lodash/cloneDeep'
import forEach from 'lodash/forEach'
import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom'
import { WeaSwitch } from 'comsMobx';
import { inject, observer } from 'mobx-react';
import * as mobx from 'mobx';
import { i18n } from '../../public/i18n';
const toJS = mobx.toJS;
import '../../style/common.less';
@inject('companyExtend')
@inject('company')
@observer
export default class CompanyExtend extends React.Component {
componentDidMount() {
this.init();
}
init = () => {
const { companyExtend } = this.props;
companyExtend.init();
// companyExtend.hrmId=hrmId;
companyExtend.getData();
}
getTabChildren = () => {
const { companyExtend } = this.props;
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys } = companyExtend;
let tabChildren = [];
tableInfo = toJS(tableInfo);
tableInfo && tableInfo.map((t, i) => {
if (tabkey == i) {
tabChildren.push(
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
//ref={(ref)=>companyExtend.setPersonalEditTables(ref)}
showTitle={isEditor}
// title={'列表信息'}
// addFirstRow={isEditor}
columns={t.tabinfo.columns}
datas={t.tabinfo.datas}
onChange={this.tableEditChange}
selectedRowKeys={toJS(selectedRowKeys)}
onRowSelect={keys => onRowSelect(keys)}
onBtnsSelect={key => this.onBtnsSelect(key, i)}
viewAttr={isEditor ? 2 : 1}
getRowSelection={isEditor ? (rowSelection) => {
Object.assign(rowSelection, {
getCheckboxProps: record => ({
disabled: record.viewAttr === 1, // 配置无法勾选的列
})
})
return rowSelection;
} : () => null}
/>
);
}
})
return tabChildren;
}
onBtnsSelect = (key, index) => {
const {
companyExtend
} = this.props, {
tableInfo,
selectedRows,
setSelectedRowKeys,
selectedRowKeys
} = companyExtend;
const datas = tableInfo[index].tabinfo.datas;
if (key === 'copy') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (!selectedRows[index].includes(i)) {
data.viewAttr = 2;
}
return data
})
}
if (key === 'delete') {
tableInfo[index].tabinfo.datas = datas.map((data, i) => {
if (selectedRows[index].includes(i)) {
data.viewAttr = 1;
}
return data
});
setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row)))
}
}
getSearchs = () => {
const { companyExtend } = this.props;
let { form, conditions, isEditor } = companyExtend;
const { isFormInit } = form;
let group = [];
let tipPosition = 'bottom';
window.e9HideFormFieldKeys = [];
isFormInit && conditions.forEach((c, i) => {
let items = [];
c.items.forEach((field, j) => {
if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
window.e9HideFormFieldKeys.push(field.domkey[0]);
} else {
items.push({
com: (<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@vh6j67@${j}`}
underline={!isEditor}
label={`${field.label}`}
error={form.getError(field)}
tipPosition={tipPosition}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
</WeaFormItem>),
colSpan: 1
});
}
});
group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@x9hby9@${i}`} className={`${isEditor ? 'hrm-center' : ''}`}
needTigger={true} hide={c.hide} title={c.title} showGroup={c.defaultshow} items={items} col={2} />)
});
return group;
}
tableEditChange = (data) => {
const { companyExtend } = this.props;
let { tabkey = '0', tableInfo } = companyExtend;
tableInfo = toJS(tableInfo);
let d = cloneDeep(tableInfo);
d[Number(tabkey)].tabinfo.datas = data;
companyExtend.updateTableInfo(d);
}
getRightMenu = () => {
const { companyExtend } = this.props;
const { isEditor, buttons } = companyExtend;
let arr = [];
try {
if (buttons.hasEdit) {
if (isEditor) {
arr = [{
icon: <i className='icon-coms-common' />,
content: i18n.button.save(),
key: 'save',
onClick: key => {
this.saveEditCard();
}
}, {
icon: <i className='icon-coms-go-back' />,
content: i18n.button.back(),
key: 'back',
onClick: key => {
this.backCard();
}
}]
} else {
arr = [{
icon: <i className='icon-coms-edit' />,
content: i18n.button.modify(),
key: 'editCard',
onClick: key => {
this.editCard();
}
}
]
}
}
} catch (e) { }
return arr;
}
getTopButtons = () => {
const { companyExtend } = this.props;
const { isEditor, buttons } = companyExtend;
const save = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pkes6y`} type="primary" onClick={this.saveEditCard} >{i18n.button.save()}</Button>;
const back = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pl1fw8`} type="primary" onClick={this.backCard} >{i18n.button.back()}</Button>;
const edit = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vkeda5`} type="primary" onClick={this.editCard} >{i18n.button.modify()}</Button>;
const btns = [];
try {
if (isEditor) {
if (buttons.hasSave) {
btns.push(save);
btns.push(back);
}
} else {
if (buttons.hasEdit) {
btns.push(edit);
}
}
} catch (e) { }
return btns;
}
editCard = () => {
const { companyExtend } = this.props;
companyExtend.edit();
}
saveEditCard = () => {
const { companyExtend } = this.props;
companyExtend.save();
}
backCard = () => {
this.init();
}
changeData(key) {
const {
companyExtend
} = this.props;
companyExtend.changeData(key);
}
render() {
const { companyExtend } = this.props;
const { loading, detailSelectedKey, tabInfo,topTab,selectedKey } = companyExtend;
// if(!hasRight && !loading){
// return (
// <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@387kx5`}>
// <div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
// </WeaAlertPage>
// )
// }
// try {
return (
<div className='hrm-my-cardInfo' style={{ height: '100%', position: 'relative' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getRightMenu()}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
loading={true}
buttons={this.getTopButtons()}
showDropIcon={true}
dropMenuDatas={this.getRightMenu()}
>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
datas={topTab}
keyParam="viewCondition" //主键
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
/>
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4fj4z2`} spinning={loading}>
{this.getSearchs()}
{
!isEmpty(tabInfo) && <div className='hrm-my-cardInfo_detial_tabs'>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@vjrq63`}
type='card'
keyParam='key'
datas={toJS(tabInfo)}
selectedKey={detailSelectedKey}
onChange={v => {
companyExtend.updateDetailSelectedKey(v);
}}
/>
{this.getTabChildren()}
</div>
}
</Spin>
</WeaTop>
</WeaRightMenu>
</div>
)
// } catch (e) {
// return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
// <div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
// </WeaAlertPage>
// }
}
}

View File

@ -0,0 +1,383 @@
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';
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

@ -0,0 +1,224 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
@inject('group')
@observer
export default class Group extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
group
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
group
} = this.props;
group.getGroupForm();
group.getHasRight();
}
getTopMenuBtns() {
const {
group
} = this.props;
const {
topMenu,
tableStore
} = group;
let btns = [];
topMenu.map((item, i) => {
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
});
return btns;
}
getDropMenuDatas() {
const {
group
} = this.props;
const {
rightMenu
} = group;
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;
}
doEdit(id) {
const {
group
} = this.props;
group.setNeDialogTitle(i18n.label.editGroup());
group.setVisible(true);
group.getForm();
}
handleSave() {
const {
group
} = this.props;
group.edit();
}
handleMenuClick(key) {
this[key] && this[key]();
}
handleClick(item) {
this[item.menuFun] && this[item.menuFun]();
}
changeData(key) {
const {
group
} = this.props;
group.changeData(key);
}
getFormField() {
const {
group
} = this.props;
const { form1, groupCondition } = group;
const { isFormInit } = form1;
const formParams = form1.getFormParams();
let items = [];
isFormInit && toJS(groupCondition).map(c => {
c.items.map((fields, index) => {
items.push(<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@zzk1d0@${index}`}
underline={true}
label={`${fields.label}`}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p0qhmz@${index}`} fieldConfig={fields} form={form1} formParams={formParams} />
</WeaFormItem>);
});
});
return <div className="wea-form-item-group">{items}</div>;
}
render() {
const {
group
} = this.props;
const {
nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey
} = group;
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.groupInfo()}
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`}
datas={topTab}
keyParam="viewCondition" //主键
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
/>
<div className='organization-group'>
{this.getFormField()}
</div>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => group.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,366 @@
import React, { Component } from "react";
import { Input, Tree, Menu, message, Modal } from "antd";
import { WeaInputSearch } from "ecCom";
import { i18n } from "../../../public/i18n";
import NewAndEditDialog from "../../NewAndEditDialog";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import _ from "lodash";
import "../index.less";
const confirm = Modal.confirm;
const TreeNode = Tree.TreeNode;
const treeData = [
{
title: "0-0",
key: "0-0",
children: [
{
title: "0-0-0",
key: "0-0-0",
children: [
{ title: "0-0-0-0-88", key: "0-0-0-0" },
{ title: "0-0-0-1", key: "0-0-0-1" },
{ title: "0-0-0-2", key: "0-0-0-2" },
],
},
{
title: "0-0-1",
key: "0-0-1",
children: [
{ title: "0-0-1-0", key: "0-0-1-0" },
{ title: "0-0-1-1", key: "0-0-1-1" },
{ title: "0-0-1-2", key: "0-0-1-2" },
],
},
{
title: "0-0-2",
key: "0-0-2",
},
],
},
{
title: "99",
key: "0-1",
children: [
{ title: "0-1-0-0", key: "0-1-0-0" },
{ title: "9988", key: "0-1-0-1" },
{ title: "0-1-0-2-99988", key: "0-1-0-2" },
],
},
{
title: "0-2",
key: "0-2",
},
];
@inject("officeManageStore")
@observer
class LeftTree extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
expandedKeys: [],
treeData: [],
copyTree: [],
copyExpandedKeys: [],
searchValue: "",
rightClickNodeTreeItem: null,
};
}
componentDidMount() {
this.getTreeData();
document.addEventListener("click", this.handleClick);
}
componentWillUnmount() {
document.removeEventListener("click", this.handleClick);
}
getTreeData = () => {
const { officeManageStore } = this.props;
officeManageStore.getTreeData().then((res) => {
const { code, data, msg } = res;
if (code === 200) {
let cp = JSON.stringify([data]);
this.setState({
treeData: [data],
expandedKeys: this.expandedKeysFun([data]),
copyTree: cp,
copyExpandedKeys: [],
});
} else {
message.error(res.msg);
}
});
};
handleClick = () => {
this.setState({ rightClickNodeTreeItem: null });
};
onSelect = (node) => {
const [postId] = node;
const { officeManageStore } = this.props;
officeManageStore.getPostInfoTable(postId);
this.setState({
rightClickNodeTreeItem: null,
});
};
treeNodeonRightClick = (e) => {
this.setState({
rightClickNodeTreeItem: {
pageX: e.event.pageX,
pageY: e.event.pageY,
id: e.node.props["eventKey"],
categoryName: e.node.props["data-title"],
},
});
};
arrayTreeFilter = (data, predicate, filterText) => {
const nodes = data;
if (!(nodes && nodes.length)) {
return;
}
const newChildren = [];
for (const node of nodes) {
if (predicate(node, filterText)) {
newChildren.push(node);
node.children = this.arrayTreeFilter(
node.children,
predicate,
filterText
);
} else {
const subs = this.arrayTreeFilter(node.children, predicate, filterText);
if ((subs && subs.length) || predicate(node, filterText)) {
node.children = subs;
newChildren.push(node);
}
}
}
return newChildren;
};
filterFn = (data, filterText) => {
if (!filterText) {
return true;
}
return new RegExp(filterText, "i").test(data.title);
};
flatTreeFun = (treeData) => {
let arr = [];
const flatTree = (treeData) => {
treeData.map((item, index) => {
arr.push(item);
if (item.children && item.children.length > 0) {
flatTree(item.children);
item.children = [];
}
});
};
flatTree(treeData);
return arr;
};
expandedKeysFun = (treeData) => {
if (treeData && treeData.length == 0) {
return [];
}
let arr = [];
const expandedKeysFn = (treeData) => {
treeData.map((item, index) => {
arr.push(item.key);
if (item.children && item.children.length > 0) {
expandedKeysFn(item.children);
}
});
};
expandedKeysFn(treeData);
return arr;
};
onChange = (value) => {
if (value == "") {
let { copyTree, copyExpandedKeys } = this.state;
this.setState({
treeData: JSON.parse(copyTree),
expandedKeys: copyExpandedKeys,
searchValue: value,
});
} else {
let { copyTree, copyExpandedKeys } = this.state;
let res = this.arrayTreeFilter(
JSON.parse(copyTree),
this.filterFn,
value
);
let expkey = this.expandedKeysFun(res);
this.setState({
treeData: res,
expandedKeys: expkey,
searchValue: value,
});
}
};
getNodeTreeRightClickMenu = () => {
const { pageX, pageY } = { ...this.state.rightClickNodeTreeItem };
const tmpStyle = {
position: "absolute",
left: `${pageX}px`,
top: `${pageY}px`,
};
const menu = (
<Menu
onClick={this.handleMenuClick}
style={tmpStyle}
className="rightmenu">
<Menu.Item key="ADD">新增</Menu.Item>
<Menu.Item key="DELETE">删除</Menu.Item>
</Menu>
);
return this.state.rightClickNodeTreeItem == null ? "" : menu;
};
handleMenuClick = (menu) => {
const { officeManageStore } = this.props;
const { id } = this.state.rightClickNodeTreeItem;
const { key } = menu;
switch (key) {
case "ADD":
officeManageStore.getPostForm();
officeManageStore.setOfficeVisible(true);
break;
case "DELETE":
confirm({
title: i18n.confirm.defaultTitle(),
content: i18n.confirm.delete(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk: () => this.handleDelete(id),
onCancel() {
return false;
},
});
break;
default:
break;
}
};
renderTreeNode = (data) => {
//生成树结构函数
if (data.length == 0) {
return;
}
let { expandedKeys, searchValue } = this.state;
return data.map((item) => {
const index = item.title.indexOf(searchValue);
const beforeStr = item.title.substr(0, index);
const afterStr = item.title.substr(index + searchValue.length);
const title =
index > -1 ? (
<span>
{beforeStr}
<span style={{ color: "red" }}>{searchValue}</span>
{afterStr}
</span>
) : (
<span>{item.title}</span>
);
if (item.children && item.children.length > 0) {
return (
<TreeNode key={item.key} title={title} className="tree-node">
{this.renderTreeNode(item.children)}
</TreeNode>
);
}
return (
<TreeNode key={item.key} title={title} className="tree-node"></TreeNode>
);
});
};
onExpand = (expandedKeys) => {
this.setState({
expandedKeys,
});
};
handleSave = () => {
const { form1, savePost } = this.props.officeManageStore;
form1.validateForm().then((f) => {
if (f.isValid) {
// 验证通过, balabala业务代码
const payload = { ...form1.getFormParams() };
this.setState({ loading: true });
savePost(payload).then(({ code, msg }) => {
this.setState({ loading: false });
if (code === 200) {
message.success("新增成功");
this.getTreeData();
this.props.officeManageStore.setOfficeVisible(false);
} else {
message.error(msg || "新增失败");
}
});
} else {
f.showErrors();
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
}
});
};
handleDelete = (ids) => {
const { deleteByIds } = this.props.officeManageStore;
deleteByIds({ ids }).then(({ code, msg }) => {
if (code === 200) {
message.success("删除成功");
this.getTreeData();
} else {
message.error(msg || "删除失败");
}
});
};
render() {
let { expandedKeys, treeData, searchValue, loading } = this.state;
const { officeManageStore } = this.props;
const { officeCondition, form1, officeVisible } = officeManageStore;
return (
<div>
<div style={{ padding: 10 }}>
<WeaInputSearch
value={searchValue}
style={{ width: "100%" }}
onChange={this.onChange}
/>
</div>
<Tree
onExpand={this.onExpand}
expandedKeys={expandedKeys}
onRightClick={this.treeNodeonRightClick}
onSelect={this.onSelect}>
{this.renderTreeNode(treeData)}
</Tree>
{this.getNodeTreeRightClickMenu()}
<NewAndEditDialog
ecId={`${
(this && this.props && this.props.ecId) || ""
}_NewAndEditDialog@q4rrwm`}
title={i18n.label.newOfficeName()}
visible={officeVisible}
condition={toJS(officeCondition)}
form={form1}
isFormInit={form1.isFormInit}
loading={loading}
isEdit={true}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => officeManageStore.setOfficeVisible(false)}
/>
</div>
);
}
}
export default LeftTree;

View File

@ -0,0 +1,20 @@
// office-wapper
.office-wapper {
height: 100%;
.rightmenu {
border-right: none;
box-shadow: 0 2px 8px rgb(0, 0, 0 /15%);
.ant-menu-item {
padding: 0 40px;
}
}
.tree-node {
.ant-tree-node-content-wrapper {
width: 100%;
}
}
}

View File

@ -0,0 +1,453 @@
import React, { Component } from "react";
import { toJS } from "mobx";
import { inject, observer } from "mobx-react";
import { i18n } from "../../public/i18n";
import LeftTree from "./components/leftTree";
import NewAndEditDialog from "../NewAndEditDialog";
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaLeftRightLayout,
} from "ecCom";
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
import { WeaSwitch, WeaTableNew } from "comsMobx";
import "./index.less";
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject("officeManageStore")
@observer
export default class OfficeManage extends Component {
constructor(props) {
super(props);
this.state = {
date: "",
editId: "",
loading: false,
};
}
componentDidMount() {
const { officeManageStore } = this.props;
officeManageStore.getTreeData && officeManageStore.getTreeData();
officeManageStore.getHasRight && officeManageStore.getHasRight();
officeManageStore.getPostInfoTable && officeManageStore.getPostInfoTable();
}
getDropMenuDatas = () => {
const { officeManageStore } = this.props;
const { rightMenu } = officeManageStore;
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 { officeManageStore } = this.props;
const { isPanelShow } = officeManageStore;
isPanelShow && officeManageStore.setPanelStatus(false);
switch (key) {
case "new":
officeManageStore.getPostInfoForm();
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
break;
default:
break;
}
};
handleSave() {
const { form, condition, savePostInfo, updatePostInfo } =
this.props.officeManageStore;
const { editId } = this.state;
form.validateForm().then((f) => {
if (f.isValid) {
// 验证通过, balabala业务代码
const payload = editId
? { ...form.getFormParams(), id: editId }
: { ...form.getFormParams() };
this.setState({ loading: true });
if (editId) {
updatePostInfo(payload).then(({ code, msg }) => {
this.setState({ loading: false });
if (code === 200) {
message.success("编辑成功");
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable();
this.setState({ editId: "" });
} else {
message.error(msg || "编辑失败");
}
});
return;
}
savePostInfo(payload).then(({ code, msg }) => {
this.setState({ loading: false });
if (code === 200) {
message.success("新增成功");
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable();
this.setState({ editId: "" });
} else {
message.error(msg || "新增失败");
}
});
} else {
f.showErrors();
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
}
});
}
getTopMenuBtns = () => {
const { officeManageStore } = this.props;
const { topMenu, tableStore } = officeManageStore;
let btns = [];
topMenu.map((item, i) => {
if (item.menuFun !== "batchDelete") {
btns.push(
<Button
type="primary"
onClick={() => {
const { officeManageStore } = this.props;
officeManageStore.isPanelShow &&
officeManageStore.setPanelStatus(false);
officeManageStore.getPostInfoForm();
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
}}>
{item.menuName}
</Button>
);
} else {
btns.push(
<Button
type="primary"
onClick={() => {
const { officeManageStore } = this.props;
const { tableStore } = officeManageStore;
const ids = toJS(tableStore.selectedRowKeys).toString();
this.showConfirm("batchDel", ids);
}}
disabled={tableStore.selectedRowKeys.length > 0 ? false : true}>
{item.menuName}
</Button>
);
}
});
return btns;
};
showConfirm = (v, ids) => {
confirm({
title: i18n.confirm.defaultTitle(),
content:
v == "del" ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk: () => this.deletePostinfoByIds(ids),
onCancel() {
return false;
},
});
};
deletePostinfoByIds = (ids) => {
const { officeManageStore } = this.props;
const { deletePostinfoByIds } = officeManageStore;
deletePostinfoByIds({ ids }).then(({ code, msg }) => {
if (code === 200) {
message.success("删除成功");
officeManageStore.getPostInfoTable();
} else {
message.error(msg || "删除失败");
}
});
};
reRenderColumns = (columns) => {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == "forbidden_tag") {
c.render = function (text, record) {
return (
<Switch
checked={record.forbidden_tag == "0" ? true : false}
onChange={(checked) => {
confirm({
title: i18n.confirm.defaultTitle(),
content:
record.forbidden_tag === "0"
? "确定要禁用吗?"
: "确定要启用吗?",
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk: () => _this.updateForbiddenTag(checked, record.id),
onCancel() {
return false;
},
});
}}
/>
);
};
}
});
};
updateForbiddenTag = (forbiddentag, id) => {
const { officeManageStore } = this.props;
const { updateForbiddenTagById } = officeManageStore;
const payload = {
id,
forbiddentag,
};
updateForbiddenTagById(payload).then(({ code, msg }) => {
if (code === 200) {
message.success("操作成功");
officeManageStore.getPostInfoTable();
} else {
message.error(msg || "操作失败");
}
});
};
onOperatesClick = (record, index, operate) => {
operate.index == "0" && this.doEdit(record.randomFieldId);
operate.index === "1" && this.showConfirm("del", record.randomFieldId);
};
doEdit = (editId) => {
this.setState({ editId });
const { officeManageStore } = this.props;
officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false);
officeManageStore.getPostInfoForm(editId);
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.editOfficeName());
};
getPanelComponents = () => {
const { officeManageStore } = this.props;
const { searchCondition, form2, searchConditionLoading } =
officeManageStore;
let arr = [];
let formParams = form2.getFormParams();
const { isFormInit } = form2;
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={form2}
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") {
officeManageStore.getPostInfoTable();
officeManageStore.setPanelStatus(false);
}
}}>
{arr}
</Row>
);
}
};
getTabBtn = () => {
const { officeManageStore } = this.props;
const { form2 } = officeManageStore;
const btn = [
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@bx87i8`}
type="primary"
onClick={() => {
officeManageStore.getPostInfoTable();
officeManageStore.setPanelStatus(false);
}}>
{i18n.button.search()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@218ju6`}
onClick={() => form2.reset()}>
{i18n.button.reset()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`}
onClick={() => officeManageStore.setPanelStatus(false)}>
{i18n.button.cancel()}
</Button>,
];
return btn;
};
onSearchChange = (val) => {
const { officeManageStore } = this.props;
const { form2 } = officeManageStore;
officeManageStore.setPostInfoName(val);
!_.isEmpty(form2.getFormParams()) && officeManageStore.updateFields(val);
};
render() {
const { officeManageStore } = this.props;
const { date, loading } = this.state;
const {
isPanelShow,
form2,
postInfoName,
conditionNum,
tableStore,
nEdialogTitle,
visible,
condition,
form,
dialogLoading,
} = officeManageStore;
return (
<div className="office-wapper">
<WeaLeftRightLayout
isNew={true}
leftWidth={310}
leftCom={<LeftTree />}
onCollapse={(showLeft) => console.log("showLeft:", showLeft)}>
<WeaRightMenu
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaRightMenu@cea97d`}
datas={this.getDropMenuDatas()}
onClick={(key) => this.handleMenuClick(key)}>
<WeaTop
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaTop@446d12`}
title={i18n.label.officeName()}
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@39c727`}
searchType={["base", "advanced"]}
showSearchAd={isPanelShow}
searchsBaseValue={
_.isEmpty(form2.getFormParams())
? postInfoName
: form2.getFormParams().postInfoName
}
setShowSearchAd={(bool) =>
officeManageStore.setPanelStatus(bool)
}
hideSearchAd={() => officeManageStore.setPanelStatus(false)}
searchsAd={
isPanelShow ? this.getPanelComponents() : <div></div>
}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => officeManageStore.getPostInfoTable()}
onSearchChange={(val) => this.onSearchChange(val)}
/>
<WeaTable
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaTable@b43a4c`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
rowSelection={{
getCheckboxProps: (record) => {
console.log(record);
return {
disabled: true, // 配置无法勾选的列
};
},
}}
getColumns={(c) => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) =>
this.onOperatesClick(record, index, operate)
}
/>
</WeaTop>
<NewAndEditDialog
ecId={`${
(this && this.props && this.props.ecId) || ""
}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading || loading}
isEdit={true}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => {
officeManageStore.setVisible(false);
this.setState({ editId: "" });
}}
/>
</WeaRightMenu>
</WeaLeftRightLayout>
</div>
);
}
}

View File

@ -0,0 +1,416 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('jobGrade')
@observer
export default class JobGrade extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
jobGrade
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
jobGrade
} = this.props;
jobGrade.getTableInfo();
jobGrade.getHasRight();
}
getTopMenuBtns() {
const {
jobGrade
} = this.props;
const {
topMenu,
tableStore
} = jobGrade;
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={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
jobGrade
} = this.props;
const {
isPanelShow
} = jobGrade;
isPanelShow && jobGrade.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
jobGrade
} = this.props;
jobGrade.setNeDialogTitle(i18n.label.newJobGrade());
jobGrade.setIsNew(true);
jobGrade.setVisible(true);
jobGrade.getForm();
}
batchDelete() {
const {
jobGrade
} = this.props;
const {
tableStore
} = jobGrade;
let keys = toJS(tableStore.selectedRowKeys).toString();
jobGrade.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 {
jobGrade
} = this.props;
jobGrade.delete();
}
getDropMenuDatas() {
const {
jobGrade
} = this.props;
const {
rightMenu
} = jobGrade;
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 {
jobGrade
} = this.props;
const {
isPanelShow
} = jobGrade;
isPanelShow && jobGrade.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
jobGrade
} = this.props;
const {
form2
} = jobGrade;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { jobGrade.getTableInfo(); jobGrade.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => jobGrade.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
jobGrade
} = this.props;
const {
form2
} = jobGrade;
jobGrade.setGradeName(val);
!this.isEmptyObject(form2.getFormParams()) && jobGrade.updateFields(val);
}
changeData(key) {
const {
jobGrade
} = this.props;
jobGrade.changeData(key);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
}
};
})
}
updateForbiddenTag(checked,id) {
const {
jobGrade
} = this.props;
jobGrade.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
jobGrade
} = this.props;
jobGrade.setNeDialogTitle(i18n.label.editJobGrade());
jobGrade.setGradeId(id);
jobGrade.setIsNew(false);
jobGrade.setVisible(true);
jobGrade.getForm();
}
doDel(id) {
const {
jobGrade
} = this.props;
jobGrade.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
jobGrade
} = this.props;
const {
isNew
} = jobGrade;
isNew && jobGrade.save();
!isNew && jobGrade.edit();
}
getPanelComponents() {
const {
jobGrade
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = jobGrade;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
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={form2} 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") {
jobGrade.getTableInfo();
jobGrade.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
jobGrade
} = this.props;
const {
isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
} = jobGrade;
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.gradeName()}
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`}
datas={topTab}
counts={topTabCount}
keyParam="viewCondition" //主键
countParam="groupId" //数量
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? gradeName : form2.getFormParams().gradeName}
setShowSearchAd={bool => jobGrade.setPanelStatus(bool)}
hideSearchAd={() => jobGrade.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => jobGrade.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={350}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => jobGrade.setVisible(false)}
enable={true} //是否开启字段联动
bindChangeEnvent={val => jobGrade.updateConditions(val)}
/>
</div>
)
}
}

View File

@ -0,0 +1,415 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('jobLevel')
@observer
export default class JobLevel extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
jobLevel
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
jobLevel
} = this.props;
jobLevel.getTableInfo();
jobLevel.getHasRight();
}
getTopMenuBtns() {
const {
jobLevel
} = this.props;
const {
topMenu,
tableStore
} = jobLevel;
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={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
jobLevel
} = this.props;
const {
isPanelShow
} = jobLevel;
isPanelShow && jobLevel.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
jobLevel
} = this.props;
jobLevel.setNeDialogTitle(i18n.label.newJobLevel());
jobLevel.setIsNew(true);
jobLevel.setVisible(true);
jobLevel.getForm();
}
batchDelete() {
const {
jobLevel
} = this.props;
const {
tableStore
} = jobLevel;
let keys = toJS(tableStore.selectedRowKeys).toString();
jobLevel.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 {
jobLevel
} = this.props;
jobLevel.delete();
}
getDropMenuDatas() {
const {
jobLevel
} = this.props;
const {
rightMenu
} = jobLevel;
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 {
jobLevel
} = this.props;
const {
isPanelShow
} = jobLevel;
isPanelShow && jobLevel.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
jobLevel
} = this.props;
const {
form2
} = jobLevel;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { jobLevel.getTableInfo(); jobLevel.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => jobLevel.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
jobLevel
} = this.props;
const {
form2
} = jobLevel;
jobLevel.setLevelName(val);
!this.isEmptyObject(form2.getFormParams()) && jobLevel.updateFields(val);
}
changeData(key) {
const {
jobLevel
} = this.props;
jobLevel.changeData(key);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
}
};
})
}
updateForbiddenTag(checked,id) {
const {
jobLevel
} = this.props;
jobLevel.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
jobLevel
} = this.props;
jobLevel.setNeDialogTitle(i18n.label.editJobLevel());
jobLevel.setLevelId(id);
jobLevel.setIsNew(false);
jobLevel.setVisible(true);
jobLevel.getForm();
}
doDel(id) {
const {
jobLevel
} = this.props;
jobLevel.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
jobLevel
} = this.props;
const {
isNew
} = jobLevel;
isNew && jobLevel.save();
!isNew && jobLevel.edit();
}
getPanelComponents() {
const {
jobLevel
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = jobLevel;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
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={form2} 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") {
jobLevel.getTableInfo();
jobLevel.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
jobLevel
} = this.props;
const {
isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
} = jobLevel;
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.levelName()}
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`}
datas={topTab}
counts={topTabCount}
keyParam="viewCondition" //主键
countParam="groupId" //数量
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? levelName : form2.getFormParams().levelName}
setShowSearchAd={bool => jobLevel.setPanelStatus(bool)}
hideSearchAd={() => jobLevel.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => jobLevel.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={300}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => jobLevel.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,401 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('rankScheme')
@observer
export default class RankScheme extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
rankScheme
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
rankScheme
} = this.props;
rankScheme.getTableInfo();
rankScheme.getHasRight();
}
getTopMenuBtns() {
const {
rankScheme
} = this.props;
const {
topMenu,
tableStore
} = rankScheme;
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={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
rankScheme
} = this.props;
const {
isPanelShow
} = rankScheme;
isPanelShow && rankScheme.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
rankScheme
} = this.props;
rankScheme.setNeDialogTitle(i18n.label.newRankScheme());
rankScheme.setIsNew(true);
rankScheme.setVisible(true);
rankScheme.getForm();
}
batchDelete() {
const {
rankScheme
} = this.props;
const {
tableStore
} = rankScheme;
let keys = toJS(tableStore.selectedRowKeys).toString();
rankScheme.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 {
rankScheme
} = this.props;
rankScheme.delete();
}
getDropMenuDatas() {
const {
rankScheme
} = this.props;
const {
rightMenu
} = rankScheme;
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 {
rankScheme
} = this.props;
const {
isPanelShow
} = rankScheme;
isPanelShow && rankScheme.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
rankScheme
} = this.props;
const {
form2
} = rankScheme;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { rankScheme.getTableInfo(); rankScheme.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => rankScheme.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
rankScheme
} = this.props;
const {
form2
} = rankScheme;
rankScheme.setSchemeName(val);
!this.isEmptyObject(form2.getFormParams()) && rankScheme.updateFields(val);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
}
};
})
}
updateForbiddenTag(checked,id) {
const {
rankScheme
} = this.props;
rankScheme.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
rankScheme
} = this.props;
rankScheme.setNeDialogTitle(i18n.label.editRankScheme());
rankScheme.setSchemeId(id);
rankScheme.setIsNew(false);
rankScheme.setVisible(true);
rankScheme.getForm();
}
doDel(id) {
const {
rankScheme
} = this.props;
rankScheme.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
rankScheme
} = this.props;
const {
isNew
} = rankScheme;
isNew && rankScheme.save();
!isNew && rankScheme.edit();
}
getPanelComponents() {
const {
rankScheme
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = rankScheme;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
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={form2} 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") {
rankScheme.getTableInfo();
rankScheme.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
rankScheme
} = this.props;
const {
isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit
} = rankScheme;
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.schemeName()}
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(form2.getFormParams()) ? schemeName : form2.getFormParams().schemeName}
setShowSearchAd={bool => rankScheme.setPanelStatus(bool)}
hideSearchAd={() => rankScheme.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => rankScheme.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => rankScheme.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -0,0 +1,415 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
} from 'ecCom'
import {
Row,
Col,
Spin,
Modal,
Button,
message,
Switch
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import '../../style/common.less';
import NewAndEditDialog from '../NewAndEditDialog';
const toJS = mobx.toJS;
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject('sequence')
@observer
export default class Sequence extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
sequence
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.init();
}
}
init() {
const {
sequence
} = this.props;
sequence.getTableInfo();
sequence.getHasRight();
}
getTopMenuBtns() {
const {
sequence
} = this.props;
const {
topMenu,
tableStore
} = sequence;
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={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
}
});
return btns;
}
handleClick(item) {
const {
sequence
} = this.props;
const {
isPanelShow
} = sequence;
isPanelShow && sequence.setPanelStatus(false);
this[item.menuFun] && this[item.menuFun]();
}
new() {
const {
sequence
} = this.props;
sequence.setNeDialogTitle(i18n.label.newSequence());
sequence.setIsNew(true);
sequence.setVisible(true);
sequence.getForm();
}
batchDelete() {
const {
sequence
} = this.props;
const {
tableStore
} = sequence;
let keys = toJS(tableStore.selectedRowKeys).toString();
sequence.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 {
sequence
} = this.props;
sequence.delete();
}
getDropMenuDatas() {
const {
sequence
} = this.props;
const {
rightMenu
} = sequence;
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 {
sequence
} = this.props;
const {
isPanelShow
} = sequence;
isPanelShow && sequence.setPanelStatus(false);
this[key] && this[key]();
}
getTabBtn() {
const {
sequence
} = this.props;
const {
form2
} = sequence;
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { sequence.getTableInfo(); sequence.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => sequence.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
return btn;
}
onSearchChange(val) {
const {
sequence
} = this.props;
const {
form2
} = sequence;
sequence.setSequenceName(val);
!this.isEmptyObject(form2.getFormParams()) && sequence.updateFields(val);
}
changeData(key) {
const {
sequence
} = this.props;
sequence.changeData(key);
}
reRenderColumns(columns) {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == 'forbidden_tag') {
c.render = function(text, record) {
return <Switch defaultChecked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked,record.id)} />
}
};
})
}
updateForbiddenTag(checked,id) {
const {
sequence
} = this.props;
sequence.updateForbiddenTag(checked,id);
}
onOperatesClick(record, rowIndex, operate) {
const {
index
} = operate;
(index == '0') && this.doEdit(record.randomFieldId);
(index == '1') && this.doDel(record.randomFieldId);
}
doEdit(id) {
const {
sequence
} = this.props;
sequence.setNeDialogTitle(i18n.label.editSequence());
sequence.setSequenceId(id);
sequence.setIsNew(false);
sequence.setVisible(true);
sequence.getForm();
}
doDel(id) {
const {
sequence
} = this.props;
sequence.setIds(id);
this.showConfirm('del');
}
handleSave() {
const {
sequence
} = this.props;
const {
isNew
} = sequence;
isNew && sequence.save();
!isNew && sequence.edit();
}
getPanelComponents() {
const {
sequence
} = this.props;
const {
searchCondition,
form2,
searchConditionLoading
} = sequence;
let arr = [];
let formParams = form2.getFormParams();
const {
isFormInit
} = form2;
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={form2} 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") {
sequence.getTableInfo();
sequence.setPanelStatus(false)
}
}}>{arr}</Row>
}
}
//非空判断
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
render() {
const {
sequence
} = this.props;
const {
isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition,
form,dialogLoading,isEdit,selectedKey,topTab,topTabCount
} = sequence;
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.sequenceName()}
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`}
datas={topTab}
counts={topTabCount}
keyParam="viewCondition" //主键
countParam="groupId" //数量
selectedKey={selectedKey}
onChange={this.changeData.bind(this)}
searchType={['base', 'advanced']}
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? levelName : form2.getFormParams().levelName}
setShowSearchAd={bool => sequence.setPanelStatus(bool)}
hideSearchAd={() => sequence.setPanelStatus(false)}
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => sequence.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
/>
</WeaTop>
</WeaRightMenu>
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}
form={form}
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={250}
conditionLen={3}
save={() => this.handleSave()}
onCancel={() => sequence.setVisible(false)}
enable={false} //是否开启字段联动
/>
</div>
)
}
}

View File

@ -15,7 +15,7 @@ import '../../style/index.less';
import { Button, Image } from 'antd'; import { Button, Image } from 'antd';
import { WeaLogView } from 'comsMobx'; import { WeaLogView } from 'comsMobx';
import { WeaTop, WeaRightMenu, WeaLocaleProvider, WeaNewScroll } from 'ecCom'; import { WeaTop, WeaRightMenu, WeaLocaleProvider, WeaNewScroll } from 'ecCom';
import { renderNoright, renderLoading, getSearchs,renderNoData,isEmpty } from '../../util'; // 从util文件引入公共的方法 import { renderNoright, renderLoading, getSearchs, renderNoData, isEmpty } from '../../util'; // 从util文件引入公共的方法
const getLabel = WeaLocaleProvider.getLabel; const getLabel = WeaLocaleProvider.getLabel;
const WeaLogViewComp = WeaLogView.Component; const WeaLogViewComp = WeaLogView.Component;
@ -45,14 +45,13 @@ export default class simpleOrg extends React.Component {
render() { render() {
const { simpleOrgStore } = this.props; const { simpleOrgStore } = this.props;
const { loading, hasRight, form, condition, data, horizontal, collapsable, expandAll, labelClassName, treeType,scale } = simpleOrgStore; // 从后台取数据 和 方法 const { loading, hasRight, form, condition, data, horizontal, collapsable, expandAll, labelClassName, treeType, scale } = simpleOrgStore; // 从后台取数据 和 方法
//alert(JSON.stringify(data))
if (!hasRight && !loading) { // 无权限处理 if (!hasRight && !loading) { // 无权限处理
return renderNoright(); return renderNoright();
} }
if(isEmpty(data)) { //无数据处理 if (isEmpty(data)) { //无数据处理
return renderNoData(); return renderNoData();
} }
@ -65,9 +64,9 @@ export default class simpleOrg extends React.Component {
{/* {getSearchs(form, toJS(condition), 1)} 初始化表单*/} {/* {getSearchs(form, toJS(condition), 1)} 初始化表单*/}
<BaseForm getSearch={this.getSearch} /> <BaseForm getSearch={this.getSearch} />
<div className="m-t-lg text-center" id="node" style={{ <div className="m-t-lg text-center" id="node" style={{
transform: `scale(${scale}) translate(${0}px, ${0}px)`, transform: `scale(${scale}) translate(${0}px, ${0}px)`,
transformOrigin: "center top" transformOrigin: "center top"
}}> }}>
<OrgTree <OrgTree
data={toJS(data)} data={toJS(data)}
horizontal={horizontal} horizontal={horizontal}
@ -81,7 +80,7 @@ export default class simpleOrg extends React.Component {
> >
</OrgTree> </OrgTree>
</div> </div>
<AffixComs orgStore={simpleOrgStore}/> <AffixComs orgStore={simpleOrgStore} />
{/* <Slider /> */} {/* <Slider /> */}
</div> </div>
} }

View File

@ -1,25 +1,51 @@
import React from 'react'; import React from "react";
import Route from 'react-router/lib/Route'; import Route from "react-router/lib/Route";
import { WeaLocaleProvider } from 'ecCom' import { WeaLocaleProvider } from "ecCom";
import SimpleOrg from "./components/tree/index";
import StandardOrg from "./components/tree/standard_org";
import RankScheme from "./components/postionrank/RankScheme";
import JobLevel from "./components/postionrank/JobLevel";
import JobGrade from "./components/postionrank/JobGrade";
import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend"
import BranchNumSetting from "./components/branchNumSetting"
import Company from "./components/company/company";
import SimpleOrg from './components/tree/index'; import stores from "./stores";
import StandardOrg from './components/tree/standard_org' import "./style/index";
import stores from './stores';
import './style/index';
// 读取系统多语言配置 // 读取系统多语言配置
let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'ns_demo01'); let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(
this,
"organization"
);
// 不需要读取系统多语言 // 不需要读取系统多语言
getLocaleLabel = function(nextState, replace, callback) { callback();}; getLocaleLabel = function (nextState, replace, callback) {
callback();
};
const Home = props => props.children; const Home = (props) => props.children;
const Routes = ( const Routes = (
<Route key='organization' path='organization' onEnter={getLocaleLabel} component={Home}> <Route
<Route key='index' path='index' component={SimpleOrg} /> key="organization"
<Route key='standard' path='standard' component={StandardOrg} /> path="organization"
onEnter={getLocaleLabel}
component={Home}>
<Route key="index" path="index" component={SimpleOrg} />
<Route key="standard" path="standard" component={StandardOrg} />
<Route key="rankscheme" path="rankscheme" component={RankScheme} />
<Route key="joblevel" path="joblevel" component={JobLevel} />
<Route key="jobgrade" path="jobgrade" component={JobGrade} />
<Route key="sequence" path="sequence" component={Sequence} />
<Route key="group" path="group" component={Group} />
<Route key="officeManage" path="officeManage" component={OfficeManage} />
<Route key="companyExtend" path="companyExtend" component={CompanyExtend} />
<Route key="branchNumSetting" path="branchNumSetting" component={BranchNumSetting} />
<Route key="company" path="company" component={Company} />
</Route> </Route>
); );

View File

@ -1,26 +0,0 @@
---
title: demo01 - 基础表单
order: 0
demos:
- path: /spa/nonstandard/demo01/index.html#/main/ns_demo01/index
title: 基础表单
order: 0
---
## 基础表单
```
1、使用情况弹框新建编辑某个列表的数据、应用设置基本列出了表单用到的所有字段类型
2、引用组件
WeaRightMenu
WeaTop
WeaNewScroll
WeaSearchGroup
WeaFormItem
WeaSwitch
3、说明
[当前案例代码](https://gitee.com/weaver_cs/ecology-9-demo/tree/master/src4js/pc4ns/demo01)
```

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ const Root = () => (
<Provider {...allStore}> <Provider {...allStore}>
<Router history={history}> <Router history={history}>
<Route name='root' breadcrumbName='根路由' path='/' component={Home}> <Route name='root' breadcrumbName='根路由' path='/' component={Home}>
<IndexRedirect to='main/ns_demo01/index' /> <IndexRedirect to='main/organization/index' />
<Route name='main' breadcrumbName='入口' path='/main' component={Home}> <Route name='main' breadcrumbName='入口' path='/main' component={Home}>
{ Module.Route } { Module.Route }
</Route> </Route>

View File

@ -0,0 +1,231 @@
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 toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class CompanyStore {
@observable topMenu = []
@observable rightMenu = [];
@observable dataSource = [];
@observable columns = [];
@observable tableStore = new TableStore();
@observable searchCondition = [];
@observable isPanelShow = false; //高级搜索面板
@observable form = new WeaForm();
@observable companyName = '';
@observable conditionNum = 8;
@observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
@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.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;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,164 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/group'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
export class GroupStore {
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable groupCondition = [];
@observable isEdit = true;
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable selectedKey = 1;
@observable topTab = [];
@observable date = '';
@action
getGroupForm() {
let params = {
viewattr: 1,
id: 1
}
Api.getGroupForm(params).then(res => {
if (res.code === 200) {
res.data.condition && this.setGroupCondition(res.data.condition);
res.data.condition && this.form1.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
this.getTabInfo();
}
getTabInfo() {
Api.getTabInfo().then(res => {
if (res.code === 200) {
res.data.topTabs && this.setTopTab(res.data.topTabs);
} 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);
})
}
edit() {
let params = { ...this.form.getFormParams(), id: 1 };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.getGroupForm();
this.setVisible(false);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
} else {
f.showErrors();
this.setDate(new Date());
}
});
}
getForm() {
let params = {
viewattr: 2,
id:1
}
Api.getGroupForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
changeData(key) {
this.setSelectedKey(key);
}
setVisible(bool) {
this.visible = bool;
}
setGroupCondition(groupCondition) {
this.groupCondition = groupCondition
}
setCondition(condition) {
this.condition = condition;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setTopTab(topTab) {
this.topTab = topTab;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
}

View File

@ -1,8 +1,23 @@
import { SimpleOrgStore } from "./tree/simple_org";
import { SimpleOrgStore } from './tree/simple_org'; import { StandardOrgStore } from "./tree/standard_org";
import {StandardOrgStore} from './tree/standard_org' import { RankSchemeStore } from "./rankscheme";
import { JobLevelStore } from "./joblevel";
import { JobGradeStore } from "./jobgrade";
import { OfficeManageStore } from "./officeManage";
import { SequenceStore } from "./sequence";
import { GroupStore } from "./group";
import {CompanyExtendStore} from "./companyextend";
import {CompanyStore} from "./company"
module.exports = { module.exports = {
simpleOrgStore: new SimpleOrgStore(), simpleOrgStore: new SimpleOrgStore(),
standardOrgStore: new StandardOrgStore() standardOrgStore: new StandardOrgStore(),
rankScheme: new RankSchemeStore(),
jobLevel: new JobLevelStore(),
jobGrade: new JobGradeStore(),
officeManageStore: new OfficeManageStore(),
sequence: new SequenceStore(),
group: new GroupStore(),
companyExtend: new CompanyExtendStore(),
company: new CompanyStore()
}; };

View File

@ -0,0 +1,381 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/jobgrade'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class JobGradeStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable gradeName = '';
@observable conditionNum = 2;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable gradeId = '';
@observable date = '';
@observable selectedKey = -1;
@observable topTab = [];
@observable topTabCount = {};
@observable key = '';//
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
gradeName: this.gradeName,
viewCondition:this.selectedKey
};
} else {
params = {
...this.form2.getFormParams(),
viewCondition:this.selectedKey
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
//获取tab信息
this.getTabInfo();
}
@action
getTabInfo() {
Api.getTabInfo().then(res => {
if (res.code === 200) {
res.data.topTabs && this.setTopTab(res.data.topTabs);
res.data.topTabCount && this.setTopTabCount(res.data.topTabCount);
} else {
message.warning(res.msg);
}
}, 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);
})
}
save() {
let params = {
...this.form.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());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.gradeId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(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());
}
});
}
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);
})
}
getForm() {
let params = this.isNew ? {} : {
id: this.gradeId
}
this.setDialogLoadingStatus(true);
Api.getGradeForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.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({
gradeName: {
value: val
}
});
}
updateConditions(val) {
let currenttime = Date.now();
let key = `schemId_${currenttime}`;
const lastKey = this.key;
// let conditions = [];
// this.condition[0].items.map(item => {
// if(item.domkey[0] === 'levelId') {
// Reflect.deleteProperty(item.browserConditionParam.dataParams,lastKey)
// this.setKey(key);
// //completeParams conditionDataParams
// item.browserConditionParam.dataParams = {
// [key]:val,
// ...item.browserConditionParam.dataParams,
// currenttime: currenttime
// }
// }
// conditions.push(item);
// })
Reflect.deleteProperty(this.condition[0].items[4].browserConditionParam.dataParams,lastKey)
this.setKey(key);
this.condition[0].items[4].browserConditionParam.dataParams = {
[key]:val,
...this.condition[0].items[4].browserConditionParam.dataParams,
currenttime: currenttime
}
this.form.updateFields({
levelId: {
value: ''
}
});
this.setCondition(this.condition);
}
changeData(key) {
this.setSelectedKey(key);
this.getTableInfo();
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setGradeName(val) {
this.gradeName = 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();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setGradeId(gradeId) {
this.gradeId = gradeId;
}
setDate(date) {
this.date = date;
}
setSelectedKey(selectedKey) {
this.selectedKey = selectedKey;
}
setTopTab(topTab) {
this.topTab = topTab;
}
setTopTabCount(topTabCount) {
this.topTabCount = topTabCount;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setKey (key) {
this.key = key;
}
}

View File

@ -0,0 +1,340 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/joblevel'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class JobLevelStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable levelName = '';
@observable conditionNum = 2;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable levelId = '';
@observable date = '';
@observable selectedKey = -1;
@observable topTab = [];
@observable topTabCount = {};
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
levelName: this.levelName,
viewCondition:this.selectedKey
};
} else {
params = {
...this.form2.getFormParams(),
viewCondition:this.selectedKey
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
//获取tab信息
this.getTabInfo();
}
//删除
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);
})
}
save() {
let params = {
...this.form.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());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.levelId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(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());
}
});
}
changeData(key) {
this.setSelectedKey(key);
this.getTableInfo();
}
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);
})
}
getForm() {
let params = this.isNew ? {} : {
id: this.levelId
}
this.setDialogLoadingStatus(true);
Api.getLevelForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action
getTabInfo() {
Api.getTabInfo().then(res => {
if (res.code === 200) {
res.data.topTabs && this.setTopTab(res.data.topTabs);
res.data.topTabCount && this.setTopTabCount(res.data.topTabCount);
} 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({
levelName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setLevelName(val) {
this.levelName = 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();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setLevelId(levelId) {
this.levelId = levelId;
}
setDate(date) {
this.date = date;
}
setSelectedKey(selectedKey) {
this.selectedKey = selectedKey;
}
setTopTab(topTab) {
this.topTab = topTab;
}
setTopTabCount(topTabCount) {
this.topTabCount = topTabCount;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
}

View File

@ -0,0 +1,230 @@
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 * as API from "../apis/officeManage";
import _ from "lodash";
const { TableStore } = WeaTableNew;
export class OfficeManageStore {
@observable tableStore = new TableStore();
@observable topMenu = []; //顶部菜单
@observable rightMenu = []; //右侧更多菜单
@observable condition = []; //新增职务信息form数据
@observable searchCondition = []; //高级搜索框form 数据
@observable officeCondition = []; //新增职务分类form数据
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm(); //高级搜索渲染的表单
@observable form = new WeaForm(); //新增编辑渲染的表单
@observable form1 = new WeaForm(); //职务分类渲染的表单
@observable postInfoName = "";
@observable conditionNum = 2;
@observable ids = ""; //选择行id
@observable searchConditionLoading = false;
@observable nEdialogTitle = "";
@observable officeVisible = false;
@observable visible = false;
@observable dialogLoading = false;
@observable schemeId = "";
@observable date = "";
@action
getHasRight() {
API.getHasRight().then((res) => {
const { code, data, msg } = res;
if (code === 200) {
const { rightMenu, topMenu } = data;
this.topMenu = topMenu;
this.rightMenu = rightMenu;
} else {
message.error(msg);
}
});
}
@action("高级搜索表单渲染")
getSearchCondition() {
this.setScLoadingStatus(true);
API.getSearchCondition().then((res) => {
this.setScLoadingStatus(false);
const { code, data, msg } = res;
if (code === 200) {
res.data.conditions && this.setSearchCondition(data.conditions);
res.data.conditions && this.form2.initFormFields(data.conditions);
} else {
message.error(res.msg);
}
});
}
@action("获取新增/编辑表单")
getPostInfoForm(id) {
this.setDialogLoadingStatus(true);
API.getPostInfoForm({ id }).then((res) => {
this.setDialogLoadingStatus(false);
const { code, data, msg } = res;
if (code === 200) {
console.log();
data.condition && this.setCondition(data.condition);
data.condition && this.form.initFormFields(data.condition);
} else {
message.error(res.msg);
}
});
}
@action("获取表格数据")
getPostInfoTable(postId) {
let params;
this.tableStore = new TableStore();
if (_.isEmpty(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
postId,
postInfoName: this.postInfoName,
};
} else {
params = {
postId,
...this.form2.getFormParams(),
};
}
API.getPostInfoTable(params).then((res) => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.error(res.msg);
}
});
}
@action("获取左侧树")
getTreeData() {
return API.getTreeData();
}
@action("保存职务分类")
savePost(payload) {
return API.savePost(payload).then((response) => {
return response.json();
});
}
@action("删除职务分类")
deleteByIds(payload) {
return API.deleteByIds(payload).then((response) => {
return response.json();
});
}
@action("删除职务信息")
deletePostinfoByIds(payload) {
return API.deletePostinfoByIds(payload).then((response) => {
return response.json();
});
}
@action("获取职务分类表单")
getPostForm(id) {
this.setDialogLoadingStatus(true);
API.getPostForm({ id }).then((res) => {
this.setDialogLoadingStatus(false);
const { code, data, msg } = res;
if (code === 200) {
data.condition && this.setOfficeCondition(data.condition);
data.condition && this.form1.initFormFields(data.condition);
} else {
message.error(res.msg);
}
});
}
@action("展开关闭搜索面板")
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.searchConditionLoading = false;
}
}
@action("新增职务信息")
savePostInfo(payload) {
return API.savePostInfo(payload).then((response) => {
return response.json();
});
}
@action("更新职务信息")
updatePostInfo(payload) {
return API.updatePostInfo(payload).then((response) => {
return response.json();
});
}
@action("更新禁用标识 ")
updateForbiddenTagById(payload) {
return API.updateForbiddenTagById(payload).then((response) => {
return response.json();
});
}
setPostInfoName(val) {
this.postInfoName = val;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setCondition(condition) {
this.condition = condition;
}
setOfficeCondition(condition) {
this.officeCondition = condition;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
if (!bool) this.setDialogLoadingStatus(false);
}
setOfficeVisible(bool) {
this.officeVisible = bool;
this.officeFormReset();
if (!bool) this.setDialogLoadingStatus(false);
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
updateFields(val) {
this.form2.updateFields({
postInfoName: {
value: val,
},
});
}
formReset() {
this.form = new WeaForm();
}
officeFormReset() {
this.form1 = new WeaForm();
}
}

View File

@ -0,0 +1,307 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/rankscheme'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class RankSchemeStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable schemeName = '';
@observable conditionNum = 2;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable schemeId = '';
@observable date = '';
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
schemeName: this.schemeName
};
} else {
params = {
...this.form2.getFormParams()
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, 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);
})
}
save() {
let params = {
...this.form.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());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.schemeId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(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());
}
});
}
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);
})
}
getForm() {
let params = this.isNew ? {} : {
id: this.schemeId
}
this.setDialogLoadingStatus(true);
Api.getSchemeForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.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
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setSchemeName(val) {
this.schemeName = 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();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setSchemeId(schemeId) {
this.schemeId = schemeId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
}

View File

@ -0,0 +1,340 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/sequence'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class SequenceStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable form = new WeaForm();
@observable form1 = new WeaForm();
@observable sequenceName = '';
@observable conditionNum = 2;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@observable nEdialogTitle = '';
@observable visible = false;
@observable dialogLoading = true;
@observable sequenceId = '';
@observable date = '';
@observable selectedKey = -1;
@observable topTab = [];
@observable topTabCount = {};
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...this.form2.getFormParams(),
sequenceName: this.sequenceName,
viewcondition:this.selectedKey
};
} else {
params = {
...this.form2.getFormParams(),
viewcondition:this.selectedKey
};
}
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
//获取tab信息
this.getTabInfo();
}
//删除
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);
})
}
save() {
let params = {
...this.form.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());
}
});
}
edit() {
let params = { ...this.form.getFormParams(), id: this.sequenceId };
this.form.validateForm().then(f => {
if (f.isValid) {
Api.edit(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());
}
});
}
changeData(key) {
this.setSelectedKey(key);
this.getTableInfo();
}
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);
})
}
getForm() {
let params = this.isNew ? {} : {
id: this.sequenceId
}
this.setDialogLoadingStatus(true);
Api.getSequenceForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action
getTabInfo() {
Api.getTabInfo().then(res => {
if (res.code === 200) {
res.data.topTabs && this.setTopTab(res.data.topTabs);
res.data.topTabCount && this.setTopTabCount(res.data.topTabCount);
} 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({
sequenceName: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setSequenceName(val) {
this.sequenceName = 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();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setSequenceId(sequenceId) {
this.sequenceId = sequenceId;
}
setDate(date) {
this.date = date;
}
setSelectedKey(selectedKey) {
this.selectedKey = selectedKey;
}
setTopTab(topTab) {
this.topTab = topTab;
}
setTopTabCount(topTabCount) {
this.topTabCount = topTabCount;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
}

View File

@ -0,0 +1,50 @@
/* 公共样式 */
.hrm-loading-center-small {
position: absolute;
top: 50%;
left: 50%;
margin-left: -8px;
margin-top: -8px;
}
.hrm-dialog-form {
padding-top: 27px;
padding-right: 8%;
padding-left: 8%;
padding-bottom: 25px;
.wea-upload-list-item {
&>div {
width: 400px !important;
line-height: 30px;
}
}
}
//集团管理
.organization-group {
padding-left: 25%;
padding-right: 25%;
padding-top: 28px;
height: calc(100% - 47px);
overflow: auto;
}
//公司、分部管理
.hrm-my-cardInfo {
padding-bottom: 20px;
background: #fff;
a {
color: #123885;
&:hover {
color: red;
}
}
.hrm-center {
.ant-col-24 .wea-form-cell {
padding-left: 25%;
}
}
}

View File

@ -1,4 +1,4 @@
/* 公共样式 */
// loading 效果 // loading 效果
.wea-demo-loading { .wea-demo-loading {