Compare commits
283 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b673efe31b | |
|
|
3eebf5cb54 | |
|
|
089cab455f | |
|
|
a2066e8d68 | |
|
|
b71b401d7a | |
|
|
95735084d9 | |
|
|
fc1184c64d | |
|
|
5baac661e2 | |
|
|
07cc8573be | |
|
|
b15b08433f | |
|
|
8df95c873e | |
|
|
d98f86be17 | |
|
|
a88de27c35 | |
|
|
bd5d3b1704 | |
|
|
9560631638 | |
|
|
7dfc190df6 | |
|
|
a9bdbe3d2d | |
|
|
a3950f3343 | |
|
|
80b9c2f288 | |
|
|
54305211d4 | |
|
|
39da6bcd15 | |
|
|
72263eb5f7 | |
|
|
faf2782dba | |
|
|
1d1d974e8d | |
|
|
69620d54c4 | |
|
|
a709470921 | |
|
|
17063a3f10 | |
|
|
68c07ee8b9 | |
|
|
458606d1a4 | |
|
|
27729bf7c0 | |
|
|
55b503dc88 | |
|
|
04403d5d26 | |
|
|
2a79641bc8 | |
|
|
267e71e9ef | |
|
|
814cf971e0 | |
|
|
d48b404468 | |
|
|
28cbe4d7e1 | |
|
|
5cce357d78 | |
|
|
82b09416bb | |
|
|
aa77770e09 | |
|
|
9eeadb416e | |
|
|
6a6587bea7 | |
|
|
4318dc9830 | |
|
|
17bd109269 | |
|
|
25dd4020ca | |
|
|
1cdf8f6487 | |
|
|
bd5db8d4c0 | |
|
|
5b091c5e82 | |
|
|
3dbcad0bd0 | |
|
|
6b3f35374c | |
|
|
daea5ba97b | |
|
|
1fd6a4c644 | |
|
|
62e8ef22c1 | |
|
|
ddb59fa9f9 | |
|
|
71bc20765d | |
|
|
21002e1e7d | |
|
|
c4e93a30c7 | |
|
|
1a1441ac95 | |
|
|
967453d11b | |
|
|
3b4592adb5 | |
|
|
69441eca6c | |
|
|
9a3164e386 | |
|
|
bfc78bee60 | |
|
|
f2e3c11733 | |
|
|
8931a06127 | |
|
|
710293d536 | |
|
|
f4f27c8ad0 | |
|
|
a9282a27e1 | |
|
|
748aa1f740 | |
|
|
238ccbabf8 | |
|
|
9a9c243ec7 | |
|
|
f804b45dfa | |
|
|
291015e859 | |
|
|
4d79c64bcd | |
|
|
f4b11171b1 | |
|
|
ebf82547d2 | |
|
|
c9b6f9d701 | |
|
|
f9cb61f140 | |
|
|
8ca38016a7 | |
|
|
1e450a2c3c | |
|
|
edd7e4c2a6 | |
|
|
f3cfd3493f | |
|
|
e498634292 | |
|
|
7d73c055f0 | |
|
|
89587a6b1a | |
|
|
1db5570f3b | |
|
|
d651883081 | |
|
|
444a3576c0 | |
|
|
01dc126302 | |
|
|
29297b5c56 | |
|
|
0d3d6c79f0 | |
|
|
173de38912 | |
|
|
dfda1222c4 | |
|
|
c044172c8a | |
|
|
0b5f70a080 | |
|
|
b63006a7bc | |
|
|
e8c4068085 | |
|
|
f79a0a3ef5 | |
|
|
57b165f6d8 | |
|
|
a7592b2777 | |
|
|
cbfed11819 | |
|
|
bf8b1fecc4 | |
|
|
fc9c510619 | |
|
|
8a44f31d64 | |
|
|
ac8f61cc15 | |
|
|
4394a1abcb | |
|
|
8db2ed84c6 | |
|
|
59a0564a67 | |
|
|
64cfbffaf0 | |
|
|
579900a9fc | |
|
|
a578e4e3ab | |
|
|
d8909f5145 | |
|
|
2128fcae7c | |
|
|
aa80d43966 | |
|
|
67ccf9cbba | |
|
|
87b2bf78f5 | |
|
|
766df1a634 | |
|
|
210e79a145 | |
|
|
07d2ff9832 | |
|
|
7ba0a51fd4 | |
|
|
95afc993f0 | |
|
|
1d9ac506e8 | |
|
|
74f7329524 | |
|
|
919b778398 | |
|
|
5830d46577 | |
|
|
68af2808dd | |
|
|
f619a3cce0 | |
|
|
5849a22514 | |
|
|
5b24ef6e9f | |
|
|
9263c27fd3 | |
|
|
5977ad0d08 | |
|
|
d3ca08680f | |
|
|
cb010edefa | |
|
|
58b440ad47 | |
|
|
b5d1e00b91 | |
|
|
72ac0c5afe | |
|
|
234ca66f99 | |
|
|
39e60335ec | |
|
|
00fad37019 | |
|
|
38ceda8153 | |
|
|
db5101250e | |
|
|
cb020c5f66 | |
|
|
b5334c6830 | |
|
|
c52834678b | |
|
|
6e152af3a2 | |
|
|
dd023861d7 | |
|
|
d5e13c6057 | |
|
|
ba2d6f7f8b | |
|
|
0f4c438bbf | |
|
|
6609f8f886 | |
|
|
98bb6e3ae4 | |
|
|
07dec3350f | |
|
|
4630958a14 | |
|
|
c52d10323a | |
|
|
c51824695f | |
|
|
58b118ebe3 | |
|
|
b9d63ec406 | |
|
|
82b54b8bde | |
|
|
8de8feb216 | |
|
|
09d7776a3e | |
|
|
0c5e3cae8f | |
|
|
ebf1cb58d9 | |
|
|
fda7c7c0d0 | |
|
|
4878b6be1d | |
|
|
c81ff2bca5 | |
|
|
4102c1e135 | |
|
|
9fa6b9da32 | |
|
|
32a0c9cbd2 | |
|
|
74d5522239 | |
|
|
5bd1d12a76 | |
|
|
ed990bcfb2 | |
|
|
1dce448427 | |
|
|
860dd0212c | |
|
|
19e1d07e3c | |
|
|
2d1c756985 | |
|
|
5be0bb68e6 | |
|
|
a633a3a28c | |
|
|
8f0306b95f | |
|
|
2b1093ca1d | |
|
|
34d7ab154a | |
|
|
88dd830ce3 | |
|
|
1a35ec1bd5 | |
|
|
aa499d7855 | |
|
|
5bfb129380 | |
|
|
938e17aaad | |
|
|
6248c7d184 | |
|
|
74879c046d | |
|
|
d724566384 | |
|
|
faf37dba1d | |
|
|
88bf00cc8d | |
|
|
f50c8f2bde | |
|
|
cbaea8f2da | |
|
|
76c5ceed96 | |
|
|
14b7080a28 | |
|
|
dbc6134ccf | |
|
|
76051adc16 | |
|
|
d3f49f9be6 | |
|
|
ce77261397 | |
|
|
79916567d5 | |
|
|
58b99e41ff | |
|
|
84b6f732c6 | |
|
|
cca368c495 | |
|
|
772f0b66ee | |
|
|
3b49f1e92e | |
|
|
2b34890e6d | |
|
|
204613099a | |
|
|
f3877c843f | |
|
|
aefcb9772b | |
|
|
f5afc77283 | |
|
|
e2f8c060a6 | |
|
|
b8f7c82534 | |
|
|
064c40d299 | |
|
|
95b756b71d | |
|
|
24d9f3bc9e | |
|
|
5c2268f4f9 | |
|
|
74e4f4ca88 | |
|
|
211c0e6634 | |
|
|
3591986440 | |
|
|
88b8e435df | |
|
|
34107bee55 | |
|
|
4668fb43e1 | |
|
|
27c8a11576 | |
|
|
c195435037 | |
|
|
ed3a11e7b6 | |
|
|
35317e4b20 | |
|
|
3c8f0cbfaf | |
|
|
2a8f30575b | |
|
|
bb8920e3a0 | |
|
|
539a7e7ddd | |
|
|
5f478dcbfd | |
|
|
5172007efe | |
|
|
786bac5aa1 | |
|
|
ced190d417 | |
|
|
0d449516e2 | |
|
|
a907ebf6dd | |
|
|
395fdad5ac | |
|
|
502f084452 | |
|
|
4c2ff27e46 | |
|
|
d2305558be | |
|
|
de7e0d50c6 | |
|
|
2a0a1eb81d | |
|
|
669f92dbf2 | |
|
|
6dafc9b020 | |
|
|
d52cf8170e | |
|
|
fdc7db75d1 | |
|
|
337f8f8dff | |
|
|
6e7e5fa991 | |
|
|
8eb704e23d | |
|
|
aba9ee3840 | |
|
|
44715650db | |
|
|
e7e1410cef | |
|
|
b96ffa4205 | |
|
|
15e223269d | |
|
|
db16ec323a | |
|
|
c3d7a9db71 | |
|
|
a89634f0df | |
|
|
507ff9df6c | |
|
|
eff03741b2 | |
|
|
b073384fc7 | |
|
|
98ae042c26 | |
|
|
821c46bb9d | |
|
|
24f3350420 | |
|
|
81f9b5ca2f | |
|
|
9303fe3f3c | |
|
|
e1cc281cff | |
|
|
e0432a21c5 | |
|
|
dd9646213f | |
|
|
89aab7a742 | |
|
|
596816ebb2 | |
|
|
1bf9f9aa81 | |
|
|
aaa31935b3 | |
|
|
5bc2f44073 | |
|
|
bb7bd102ec | |
|
|
774bd7203f | |
|
|
559ed2cbee | |
|
|
9e8d36bbc4 | |
|
|
2e167f4099 | |
|
|
811c9da4d1 | |
|
|
67304df567 | |
|
|
8c6d1df37c | |
|
|
fb6ae67485 | |
|
|
b7c99835da | |
|
|
a2fa127bfe |
|
|
@ -1 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
|
|
||||||
41
README.md
41
README.md
|
|
@ -8,35 +8,16 @@
|
||||||
泛微前端脚手架--组织架构图
|
泛微前端脚手架--组织架构图
|
||||||
|
|
||||||
|
|
||||||
#### 软件架构
|
#### 版本1.0 已封版
|
||||||
软件架构说明
|
|
||||||
|
该版本组织分为2套数据 采用单向同步的方式
|
||||||
|
|
||||||
|
#### 功能介绍
|
||||||
|
|
||||||
|
组织架构图
|
||||||
|
组织分权
|
||||||
|
人员卡片等自定义功能
|
||||||
|
|
||||||
|
|
||||||
#### 安装教程
|
#### 迭代计划
|
||||||
|
由于当前版本两套数据不好管理 下版计划将数据源统一换成ecology数据源
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### 使用说明
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### 参与贡献
|
|
||||||
|
|
||||||
1. Fork 本仓库
|
|
||||||
2. 新建 Feat_xxx 分支
|
|
||||||
3. 提交代码
|
|
||||||
4. 新建 Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### 特技
|
|
||||||
|
|
||||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
|
||||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
|
||||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
||||||
|
|
@ -5,8 +5,10 @@
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"baidu-template-pro": "^1.0.0",
|
||||||
"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",
|
||||||
|
|
@ -300,6 +302,11 @@
|
||||||
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
||||||
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/baidu-template-pro": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/baidu-template-pro/-/baidu-template-pro-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-gnw6uvCn4CvZZ9d1Tu+a0B7BjQuNXvDcxsJk7bwxTpNutj6JFIxcy2sS0rB2/0/t9GwatoEIXd8HV0qkXpdRow=="
|
||||||
|
},
|
||||||
"node_modules/base64-arraybuffer": {
|
"node_modules/base64-arraybuffer": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
|
||||||
|
|
@ -2212,6 +2219,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"baidu-template-pro": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/baidu-template-pro/-/baidu-template-pro-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-gnw6uvCn4CvZZ9d1Tu+a0B7BjQuNXvDcxsJk7bwxTpNutj6JFIxcy2sS0rB2/0/t9GwatoEIXd8HV0qkXpdRow=="
|
||||||
|
},
|
||||||
"base64-arraybuffer": {
|
"base64-arraybuffer": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"baidu-template-pro": "^1.0.0",
|
||||||
"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",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getBasicDataImportHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/hrm/import/resource/getBasicDataImportHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { WeaTools } from 'ecCom'
|
||||||
|
|
||||||
|
export const getTableEdit = (params) => {
|
||||||
|
return WeaTools.callApi('/api/hrm/carddisplay/getCustomCardTable', 'GET', params);
|
||||||
|
}
|
||||||
|
export const userDefineCardItemSave = (params) => {
|
||||||
|
return WeaTools.callApi('/api/hrm/carddisplay/saveCustomCard', 'POST', params);
|
||||||
|
}
|
||||||
|
export const hasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/hasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
export const getTable = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
export const cardAccessSave = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/save', 'POST', params);
|
||||||
|
}
|
||||||
|
export const getCardButtonTable = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET', params);
|
||||||
|
}
|
||||||
|
export const saveFieldDefinedInfo = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/saveCardButton', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取权限
|
||||||
|
* @param {[type]} moduleName [模块名]
|
||||||
|
* @param {Object} params [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
export const authorized = (moduleName, params = {}, apiMethod = 'getHasRight') => WeaTools.callApi(`/api/hrm/${moduleName}/${apiMethod}`, 'POST', params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用分权
|
||||||
|
*/
|
||||||
|
export const detachable = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachable', 'GET', params);
|
||||||
|
export const getDetachableAll = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachableAll', 'GET', params);
|
||||||
|
|
||||||
|
export const checkAuthAndDetach = (moduleName, params = {}, apiMethod = 'getHasRight') => Promise.all([authorized(moduleName, params = {}, apiMethod || 'getHasRight'), detachable()])
|
||||||
|
|
||||||
|
export const exportExcel = (params = {}) => WeaTools.callApi('/api/ec/dev/table/export', 'POST', params)
|
||||||
|
|
||||||
|
export const isEnableMultiLang = (params = {}) => WeaTools.callApi('/api/hrm/common/isEnableMultiLang', 'GET', params)
|
||||||
|
|
||||||
|
export const getPinYin = (params = {}) => WeaTools.callApi('/api/workflow/formSetting/fieldSet/getPinYin', 'POST', params)
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/comp/listComp', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDeptListByPid = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/getDeptListByPid', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/comp/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/saveBaseComp', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const version = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/subcompanyfielddefined/save', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const selectVersions = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/subcompanyfielddefined/getVersion', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const editResource = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/updateComp', 'POST', 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 move = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/comp/moveCompany', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCompanyForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getMoveForm = () => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/getMoveForm', 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCompanyExtendForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { WeaTools } from 'ecCom'
|
||||||
|
|
||||||
|
//作废
|
||||||
|
//获取导入表单
|
||||||
|
export const getImportForm = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
|
||||||
|
}
|
||||||
|
//导入文件提交
|
||||||
|
export const saveImport = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取导入结果回调数据
|
||||||
|
export const getImportProcessLog = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
|
||||||
|
}
|
||||||
|
//获取导入结果
|
||||||
|
export const getImportResult = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportResult`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/listPage', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPostionTable = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getJobListByPid', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCopyForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getCopyForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMergeForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getMergeForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const version = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/departmentfielddefined/save', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const selectVersions = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/departmentfielddefined/getVersion', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTransferForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getMoveForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/saveBaseForm', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const copy = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/copyDepartment', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const merge = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/mergeDepartment', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const transfer = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/moveDepartment', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const editResource = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/updateForm', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateForbiddenTag = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDeptForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getSaveForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getDeptExtendForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getDeptBaseForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/dept/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取tab数据
|
||||||
|
* @param {Object} params [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
export const getHasRight = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getHasRight`, 'GET', params)
|
||||||
|
|
||||||
|
export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params)
|
||||||
|
|
||||||
|
export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
|
||||||
|
|
||||||
|
export const saveFieldDefinedInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const removeFieldDefinedInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const saveGroupInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const saveGroupSettingInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const changeTypeInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const removeGroupInfo = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)
|
||||||
|
|
||||||
|
export const saveTree = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTree = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const changeGroup = (moduleName,params) => {
|
||||||
|
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)
|
||||||
|
|
||||||
|
export const saveEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/saveEncryptFieldSettingForm`, 'POST', params)
|
||||||
|
|
||||||
|
//获取字段可查看范围列表
|
||||||
|
export const getEncryptFieldScopeList = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/getEncryptFieldScopeList', 'POST', params);
|
||||||
|
|
||||||
|
//获取字段可查看范围表单
|
||||||
|
export const getEncryptFieldScopeForm = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/getEncryptFieldScopeForm', 'GET', params);
|
||||||
|
|
||||||
|
//保存字段可查看范围
|
||||||
|
export const saveEncryptFieldScopeSetting = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/saveEncryptFieldScopeSetting', 'POST', params);
|
||||||
|
|
||||||
|
//删除字段可查看范围
|
||||||
|
export const delEncryptFieldScopeSetting = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/delEncryptFieldScopeSetting', 'POST', params);
|
||||||
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom';
|
||||||
|
|
||||||
|
export const editResource = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getResourceExtendForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getTabForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { WeaTools } from 'ecCom'
|
||||||
|
|
||||||
|
//获取导入表单
|
||||||
|
export const getImportForm = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getCommonForm`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入文件提交
|
||||||
|
export const saveImport = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveCommonImport`, 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取导入结果
|
||||||
|
export const getImportResult = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getImportResult`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { WeaTools } from 'ecCom'
|
||||||
|
//获取导入表单
|
||||||
|
export const getImportForm = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
|
||||||
|
}
|
||||||
|
//导入文件提交
|
||||||
|
export const saveImport = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
|
||||||
|
}
|
||||||
|
//获取导入结果回调数据
|
||||||
|
export const getImportProcessLog = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
|
||||||
|
}
|
||||||
|
//获取导入结果
|
||||||
|
export const getImportResult = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportResult`, 'GET', params);
|
||||||
|
}
|
||||||
|
//历史导入信息查询
|
||||||
|
export const getImportHistory = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportHistory`, 'GET', params);
|
||||||
|
}
|
||||||
|
//导入日志
|
||||||
|
export const getImportLogDetail = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getImportColResultLog`, 'GET', params);
|
||||||
|
}
|
||||||
|
//导入日志 - 高级搜索
|
||||||
|
export const getImportLogSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/hrm/importlog/getHistorySearchCondition`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/listPage', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHrmListByJobId = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCopyForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const refresh = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/refresh', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/saveBaseForm', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const copy = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/copyJobItem', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const editResource = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/updateForm', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateForbiddenTag = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/updateForbiddenTagById', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getJobForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getSaveForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSchemeInfo = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSchemeInfo', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getJobExtendForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getLevelId = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/grade/getLevelId', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMergeForm = (params = {}) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/job/getMergeForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const merge = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/job/mergeJob', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTree = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTreeData', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTree = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTreeData', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getLogList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/log/listPage', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/log/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/detach/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/detach/getTableBtn', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/detach/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/detach/getForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const doDetachSwitch = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/detach/doDetach', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/detach/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/detach/save', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const edit = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/detach/update', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { WeaTools } from 'ecCom'
|
||||||
|
|
||||||
|
//导入页面权限
|
||||||
|
export const getHasRight = () => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getHasRight`, 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
//选择导入字段
|
||||||
|
export const getImportFields = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getImportFields`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入文件提交
|
||||||
|
export const saveImport = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImport`, 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取导入表单
|
||||||
|
export const getImportForm = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getImportForm`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取导入结果
|
||||||
|
export const getImportResult = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/getImportResult`, 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description:
|
||||||
|
* Date: 2022-06-07 09:52:01
|
||||||
|
* LastEditTime: 2022-06-15 13:06:02
|
||||||
|
*/
|
||||||
|
import { WeaTools } from "ecCom";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name:获取编号设置
|
||||||
|
* param {*} params serialtype, SUBCOMPANY:分部
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const getCodeSetting = (params) => {
|
||||||
|
return WeaTools.callApi("/api/hrm/codeSetting/getCodeSetting", "GET", params);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 保存编号设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const saveOrUpdateCodeSetting = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/saveOrUpdateCodeSetting",
|
||||||
|
"POST",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 保存起始编号设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const saveStartNum = (params) => {
|
||||||
|
return WeaTools.callApi("/api/hrm/codeSetting/saveStartNum", "POST", params);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 起始编号设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const getStartNumForm = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/getStartNumForm",
|
||||||
|
"GET",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 高级搜索条件
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/getAdvanceSearchCondition",
|
||||||
|
"GET",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 预留编号设置列表查询
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const getSearchReservedCodeList = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/getSearchReservedCodeList",
|
||||||
|
"POST",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 保存预留编号设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const saveReservedCode = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/saveReservedCode",
|
||||||
|
"POST",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 新增预留编号表单查询
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const getReservedCodeFrom = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/getReservedCodeFrom",
|
||||||
|
"GET",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 删除预留编号
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
export const deleteReservedCodeById = (params) => {
|
||||||
|
return WeaTools.callApi(
|
||||||
|
"/api/hrm/codeSetting/deleteReservedCodeById",
|
||||||
|
"POST",
|
||||||
|
params
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description:
|
||||||
|
* Date: 2022-05-13 16:36:09
|
||||||
|
* LastEditTime: 2022-06-22 14:37:27
|
||||||
|
*/
|
||||||
|
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 updatePost = params => {
|
||||||
|
return fetch("/api/bs/hrmorganization/post/updatePost", {
|
||||||
|
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
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getHasRight = () => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/personnelresume/hasRight', 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getPersonnelResume = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/personnelresume/getResumeList', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/personnelresume/personnelScreening', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const downloadPerResume = (type) => {
|
||||||
|
fetch(`/api/bs/hrmorganization/personnelresume/downloadPerResume?type=${type}`).then(res => res.blob().then(blob => {
|
||||||
|
var filename= type == 0 ? `人员简历合并导出.docx` : `全部简历.zip`
|
||||||
|
var a = document.createElement('a');
|
||||||
|
var url = window.URL.createObjectURL(blob);
|
||||||
|
a.href = url;
|
||||||
|
a.download = filename;
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/listPage', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/hrmresource/saveBaseForm', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getSchemeForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getSaveForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const editResource = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getResourceExtendForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getBaseForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const version = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/resourcefielddefined/save', 'POST', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const exportResource = (ids) => {
|
||||||
|
fetch('/api/bs/hrmorganization/common/resource/export?ids='+ids).then(res => res.blob().then(blob => {
|
||||||
|
var filename=`人员档案.xlsx`
|
||||||
|
var a = document.createElement('a');
|
||||||
|
var url = window.URL.createObjectURL(blob);
|
||||||
|
a.href = url;
|
||||||
|
a.download = filename;
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const saveSearchTemplate = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/hrmresource/saveSearchTemplate', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const saveCustomTemplate = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/hrmresource/saveCustomTemplate', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const deleteSearchTemplate = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/hrmresource/deleteSearchTemplate', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSearchTemplate = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getSearchTemplate`, 'GET',params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTemplateSelectKeys = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getTemplateSelectKeys`, 'GET',params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateCustomTemplate = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/updateCustomTemplate`, 'POST',params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const saveColumnsCustomTemplate = (params) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/saveColumnsCustomTemplate`, 'POST',params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getEditTable = () => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getCustomTemplate', 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCustomTransferData = (id) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getCustomTransferData?templateId=${id}`, 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/delete', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const recoverData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/recover', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addType = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/saveResourceItemClass', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const editType = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/updateResourceItemClass', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteType = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/deleteResourceItemClass', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTypeForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getItemClassForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/save', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const edit = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/resourceBasicInfo/update', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTree = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getTreeData', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getCardData = (id) => {
|
||||||
|
return WeaTools.callApi(`/api/bs/hrmorganization/personnelcard/getPersonnelCard?id=${id}`, 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const selectVersions = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/version/resourcefielddefined/getVersion', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staff/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staff/saveStaff', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const edit = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staff/updateStaff', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staff/getForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staff/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaTools
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
export const getSearchList = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getTable', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteTableData = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staffplan/deleteByIds', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdvanceSearchCondition = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getSearchCondition', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const edit = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateForbiddenTag = (params) => {
|
||||||
|
return fetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSchemeForm = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getForm', 'GET', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getHasRight = (params) => {
|
||||||
|
return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getHasRight', 'GET', params);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
import {
|
||||||
|
WeaPopoverHrm,
|
||||||
|
WeaLocaleProvider
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
WeaLogView
|
||||||
|
} from 'comsMobx';
|
||||||
|
import {
|
||||||
|
isEnableMultiLang
|
||||||
|
} from '../apis/common';
|
||||||
|
const WeaLogViewComp = WeaLogView.Component;
|
||||||
|
const {
|
||||||
|
LogStore
|
||||||
|
} = WeaLogView;
|
||||||
|
import LogView from "./log/LogView";
|
||||||
|
|
||||||
|
import {LogViewStore} from "../stores/logview"
|
||||||
|
|
||||||
|
class Home extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
visible: false,
|
||||||
|
logViewStore: new LogViewStore()
|
||||||
|
|
||||||
|
}
|
||||||
|
window.setLogViewProp = this.setLogViewProp;
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
isEnableMultiLang().then(data => {
|
||||||
|
window.inputType = {
|
||||||
|
inputType: 'NORMAL'
|
||||||
|
}
|
||||||
|
if (data.status === '1') {
|
||||||
|
if (data.isEnableMultiLang) {
|
||||||
|
window.inputType = {
|
||||||
|
inputType: 'MULTILANG',
|
||||||
|
isBase64: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
window.inputType = {
|
||||||
|
inputType: 'NORMAL'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setLogViewProp = (props) => {
|
||||||
|
this.setState({
|
||||||
|
visible: true,
|
||||||
|
logViewStore: new LogViewStore(),
|
||||||
|
...props
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onCancel = () => {
|
||||||
|
this.setState({
|
||||||
|
visible: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
//const isSingle = window.location.pathname.indexOf('/spa/hrm/engine') > -1;
|
||||||
|
return (
|
||||||
|
<div style={{height:"100%"}}>
|
||||||
|
<WeaPopoverHrm inDialog={true} ecId={`${this && this.props && this.props.ecId || ''}_WeaPopoverHrm@jp3tsb`} />
|
||||||
|
<LogView ecId={`${this && this.props && this.props.ecId || ''}_LogView@mc1954`} {...this.state} onCancel={this.onCancel}/>
|
||||||
|
<WeaLocaleProvider ecId={`${this && this.props && this.props.ecId || ''}_WeaLocaleProvider@3on3aj`}>
|
||||||
|
{this.props.children}
|
||||||
|
</WeaLocaleProvider>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Home
|
||||||
|
|
@ -0,0 +1,240 @@
|
||||||
|
import {
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaDialog
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Pagination,
|
||||||
|
Steps,
|
||||||
|
Upload,
|
||||||
|
Icon,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Progress
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../public/i18n';
|
||||||
|
import { addContentPath } from '../util/index.js'
|
||||||
|
|
||||||
|
const Step = Steps.Step;
|
||||||
|
const Dragger = Upload.Dragger;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
@inject("importDialog")
|
||||||
|
@observer
|
||||||
|
export default class ImportDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
title: '数据导入',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getCircle() {
|
||||||
|
let style = {
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
backgroundColor: '#D8D8D8',
|
||||||
|
webkitBorderRadius: 10,
|
||||||
|
mozBorderRadius: 10,
|
||||||
|
msBorderRadius: 10,
|
||||||
|
oBorderRadius: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
//paddingLeft: 6,
|
||||||
|
textAlign: 'center',
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIllustration(val, url, index, link) {
|
||||||
|
let p;
|
||||||
|
if (index == 0) {
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}: <a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
next() {
|
||||||
|
const { importDialog } = this.props;
|
||||||
|
let { current, steps } = importDialog;
|
||||||
|
current = current + 1;
|
||||||
|
if (current === steps.length) {
|
||||||
|
current = 0;
|
||||||
|
importDialog.init();
|
||||||
|
}
|
||||||
|
importDialog.current = current;
|
||||||
|
current === steps.length - 1 && importDialog.startImport();
|
||||||
|
}
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
importDialog
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
condition
|
||||||
|
} = importDialog;
|
||||||
|
let _arr = [];
|
||||||
|
|
||||||
|
condition.map((c, i) => {
|
||||||
|
let arr = [];
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}>
|
||||||
|
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||||
|
{this.getIllustration(field.value, field.link, index, field)}
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||||
|
|
||||||
|
});
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFileId(fileInfo) {
|
||||||
|
const { importDialog } = this.props;
|
||||||
|
fileInfo.file.response && importDialog.setExcelfile(fileInfo.file.response.data.fileid);
|
||||||
|
importDialog.filelist = fileInfo.fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(c) {
|
||||||
|
c.forEach(item => {
|
||||||
|
if (item.dataIndex == 'operatedetail') {
|
||||||
|
item.render = function (text, record) {
|
||||||
|
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
importDialog
|
||||||
|
} = this.props, {
|
||||||
|
importVisible,steps,current, pvisable, percent, failnum, succnum, importResultTip, importResultStore, importStatus, loading, date
|
||||||
|
} = importDialog, {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
title
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => this.next()}>{current === steps.length - 1 ? '关闭' : '开始导入'}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
name: 'file',
|
||||||
|
action: '/api/doc/upload/uploadFile',
|
||||||
|
accept: '.xls,.xlsx',
|
||||||
|
multiple:false
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
title={title}
|
||||||
|
icon="icon-coms-upload"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={importVisible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => importDialog.init()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: width, height: height }}
|
||||||
|
>
|
||||||
|
<div style={{ marginTop: 24 }}>
|
||||||
|
<Steps current={current}>
|
||||||
|
{steps.map((s, i) => <Step key={i} title={s.title} description={s.description} />)}
|
||||||
|
</Steps>
|
||||||
|
</div>
|
||||||
|
<div style={{ padding: 24 }}>
|
||||||
|
{
|
||||||
|
current == 0 && <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} ref="scrollBar">
|
||||||
|
<Dragger
|
||||||
|
{...props}
|
||||||
|
onChange={
|
||||||
|
(fileInfo) => {
|
||||||
|
this.setFileId(fileInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div style={{ padding: '25px 0' }}>
|
||||||
|
<p className="ant-upload-drag-icon">
|
||||||
|
<Icon type="inbox" />
|
||||||
|
</p>
|
||||||
|
<p className="ant-upload-text">点击或将文件拖拽到此区域上传</p>
|
||||||
|
<p className="ant-upload-hint">支持单个或批量上传,严禁上传公司内部资料及其他违禁文件</p>
|
||||||
|
</div>
|
||||||
|
</Dragger>
|
||||||
|
{this.getForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
current == 1 && <div>
|
||||||
|
{
|
||||||
|
importStatus == 'over' && <div className="hrm-import-result-icon" style={{ paddingTop: failnum == 0 ? 100 : 15 }}>
|
||||||
|
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor: succnum > 0 ? '#54D3A2' : '#FF0000' }}>
|
||||||
|
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@2fblod`} type={succnum > 0 ? 'check' : 'cross'} style={{ color: '#fff' }} />
|
||||||
|
</div><span style={{ paddingLeft: 5 }}>{importResultTip}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
failnum > 0 &&
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@h7l6fo`}
|
||||||
|
comsWeaTableStore={importResultStore}
|
||||||
|
bordered
|
||||||
|
needScroll={true}
|
||||||
|
scroll={{ y: 330 }}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
<WeaDialog
|
||||||
|
title="导入进度"
|
||||||
|
onCancel={() => importDialog.pvisable = false}
|
||||||
|
visible={pvisable}
|
||||||
|
style={{ width: 300, height: 50 }}
|
||||||
|
>
|
||||||
|
<div style={{ "padding": "15px" }}>
|
||||||
|
<Progress percent={percent} strokeWidth={7} />
|
||||||
|
</div>
|
||||||
|
</WeaDialog>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,169 @@
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaPopoverHrm
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../public/i18n';
|
||||||
|
import AttachToNumberField from './NewNumberField';
|
||||||
|
import "../style/common.less";
|
||||||
|
|
||||||
|
export default class NewAndEditDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 700,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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()} onChange={this.onChange} />}
|
||||||
|
{field.domkey[0] == 'subcompanycode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{/* {field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} */}
|
||||||
|
</WeaFormItem>)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return <div style={{"height":"100%","padding":"30px"}} className="wea-form-item-group">{arr}</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange = data => {
|
||||||
|
const {
|
||||||
|
bindChangeEnvent,
|
||||||
|
moduleName
|
||||||
|
} = this.props;
|
||||||
|
if (moduleName == 'jobGrade' && data.schemeId) {
|
||||||
|
bindChangeEnvent(data.schemeId.value);
|
||||||
|
}
|
||||||
|
if (moduleName == 'staffScheme' && data.planYear) {
|
||||||
|
bindChangeEnvent(data.planYear.value);
|
||||||
|
}
|
||||||
|
if (moduleName == 'staff' && data.planId) {
|
||||||
|
bindChangeEnvent(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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} />
|
||||||
|
{field.domkey[0] == 'subcompanycode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{/* {field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} */}
|
||||||
|
|
||||||
|
</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,
|
||||||
|
saveAndSetting
|
||||||
|
} = 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>),
|
||||||
|
(saveAndSetting && <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => saveAndSetting()} disabled={loading}>{i18n.button.saveAndSetting()}</Button>),
|
||||||
|
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
className="new-edit-wrapper"
|
||||||
|
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 }}
|
||||||
|
initLoadCss
|
||||||
|
>
|
||||||
|
{
|
||||||
|
loading ? <div className='hrm-loading-center-small'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||||
|
</div>
|
||||||
|
: conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()}
|
||||||
|
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
import React, { PureComponent } from "react";
|
||||||
|
import { i18n } from "../public/i18n";
|
||||||
|
import { WeaTools } from "ecCom";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加多级路径
|
||||||
|
*
|
||||||
|
* @param {*} url
|
||||||
|
*/
|
||||||
|
export const addContentPath = (url) => {
|
||||||
|
const ecologyContentPath = window.ecologyContentPath || "";
|
||||||
|
if (url && ecologyContentPath) {
|
||||||
|
//避免重复添加ecologyContentPath
|
||||||
|
//避免传入的参数不是链接
|
||||||
|
if (url.startsWith("/") && !url.startsWith(ecologyContentPath)) {
|
||||||
|
url = ecologyContentPath + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class AttachToNumberField extends PureComponent {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
canRe: false,
|
||||||
|
canCheck: false,
|
||||||
|
canNew: false
|
||||||
|
};
|
||||||
|
this.typeMap = {
|
||||||
|
subcompanycode: "SUBCOMPANY",
|
||||||
|
departmentcode: "DEPARTMENT",
|
||||||
|
job_no: "JOBTITLES",
|
||||||
|
// work_code: "USER"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
const { field: { domkey: [targetKey] } } = this.props;
|
||||||
|
this.targetKey = targetKey;
|
||||||
|
this.type = this.typeMap[this.targetKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init(this.props.isEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (nextProps.form != this.props.form) {
|
||||||
|
this.init(nextProps.isEdit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init = (isEdit) => {
|
||||||
|
WeaTools.callApi("/api/hrm/codeSetting/getHasSelect", "GET", {}).then(res => {
|
||||||
|
if (res) {
|
||||||
|
//后台设置页面开关关闭,接口不会返回对应的权限,所以这里做下兼容
|
||||||
|
const target = res[this.type] || { hasSelect: false, hasRight: false };
|
||||||
|
const { hasSelect, hasRight } = target;
|
||||||
|
this.setState({
|
||||||
|
canRe: hasSelect && isEdit,
|
||||||
|
canCheck: hasSelect,
|
||||||
|
canNew: hasRight
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleClick = (e) => {
|
||||||
|
const urlMap = {
|
||||||
|
select: {
|
||||||
|
title: i18n.label.selectReserveNumber(),
|
||||||
|
url: addContentPath(`/spa/hrm/engine.html#/hrmengine/reservedNumber?type=${this.type}&isSimple=1`)
|
||||||
|
},
|
||||||
|
add: {
|
||||||
|
title: i18n.label.newReserveNumber(),
|
||||||
|
url: addContentPath(`/spa/hrm/engine.html#/hrmengine/newReservedNumberContent?type=${this.type}`)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const { title, url } = urlMap[e.target.id];
|
||||||
|
|
||||||
|
ecCom.WeaTools.createDialog({
|
||||||
|
title,
|
||||||
|
url,
|
||||||
|
moduleName: "hrm",
|
||||||
|
style: { width: 800, height: 600 },
|
||||||
|
callback: this.updateFormField,
|
||||||
|
onCancel: () => { // 关闭通信
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
};
|
||||||
|
updateFormField = (value) => {
|
||||||
|
const { form } = this.props;
|
||||||
|
form.updateFields({
|
||||||
|
[this.targetKey]: value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
//重新生成编号
|
||||||
|
reNumber = () => {
|
||||||
|
const { form, useId } = this.props;
|
||||||
|
const fieldMap = {
|
||||||
|
subcompanycode: "subshowid",
|
||||||
|
departmentcode: "showid",
|
||||||
|
jobtitlecode: "jobactivityid",
|
||||||
|
workcode: "useid"
|
||||||
|
},
|
||||||
|
fieldname = fieldMap[this.targetKey];
|
||||||
|
|
||||||
|
WeaTools.callApi("/api/hrm/codeSetting/regenerateCode", "POST", {
|
||||||
|
serialtype: this.type,
|
||||||
|
[`${this.type.toLocaleLowerCase()}id`]: form.getFormParams()[fieldname] || useId
|
||||||
|
}).then(res => {
|
||||||
|
const { api_status, code } = res;
|
||||||
|
if (api_status) {
|
||||||
|
if (code) {
|
||||||
|
this.updateFormField(code);
|
||||||
|
} else {
|
||||||
|
message.error(res.api_errormsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { canRe, canCheck, canNew } = this.state;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{canRe && <a onClick={this.reNumber}>{i18n.label.reNumber()}</a>}
|
||||||
|
{canCheck && <a onClick={this.handleClick} style={{ marginLeft: canRe && 10 }}
|
||||||
|
id="select">{i18n.label.selectReserveNumber()}</a>}
|
||||||
|
{canCheck && canNew &&
|
||||||
|
<a style={{ marginLeft: 10 }} onClick={this.handleClick} id="add">{i18n.label.newReserveNumber()}</a>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaTable
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../public/i18n';
|
||||||
|
|
||||||
|
export default class NewTableDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 800,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
onCancel,
|
||||||
|
loading,
|
||||||
|
height,
|
||||||
|
dataSource,
|
||||||
|
columns
|
||||||
|
} = this.props, {
|
||||||
|
width,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const pagination = {
|
||||||
|
total: dataSource.length,
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
onShowSizeChange(current, pageSize) {
|
||||||
|
},
|
||||||
|
onChange(current) {
|
||||||
|
},
|
||||||
|
showTotal(total) {
|
||||||
|
return `共 ${total} 条`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
//(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
|
||||||
|
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
title={title}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: width, height: height }}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
loading ? <div className='hrm-loading-center-small'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||||
|
</div> : <WeaTable rowKey={record => record.id}
|
||||||
|
dataSource={dataSource} childrenColumnName="children"
|
||||||
|
columns={columns}
|
||||||
|
loading={loading}
|
||||||
|
pagination={pagination}
|
||||||
|
indentSize={15}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
import {
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaDialog
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Pagination
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../public/i18n';
|
||||||
|
|
||||||
|
import '../style/common.less';
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
export default class NewWeaTableDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 800,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
onCancel,
|
||||||
|
height,
|
||||||
|
tableStore
|
||||||
|
} = this.props, {
|
||||||
|
width,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
//(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
|
||||||
|
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
title={title}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: width, height: height }}
|
||||||
|
>
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
|
||||||
|
comsWeaTableStore={tableStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
/>
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
import {
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
WeaTableEdit
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button, Modal
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import * as mobx from "mobx";
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class NewWeaTableEditDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
onRowSelect = (sRowKeys, rows, dataIndex, selectedDatas) => {
|
||||||
|
const { store } = this.props;
|
||||||
|
if (dataIndex === undefined || selectedDatas === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.setEnableRows(selectedDatas.isused);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
store,
|
||||||
|
} = this.props, {
|
||||||
|
temlateManageDialog,
|
||||||
|
relatedData
|
||||||
|
} = store;
|
||||||
|
const { datas, columns, loading,selectedData } = relatedData;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog
|
||||||
|
{...temlateManageDialog}
|
||||||
|
initLoadCss
|
||||||
|
>
|
||||||
|
<WeaTableEdit
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
|
||||||
|
draggable
|
||||||
|
deleteConfirm
|
||||||
|
title="模板"
|
||||||
|
showCopy={false}
|
||||||
|
columns={toJS(columns)}
|
||||||
|
datas={toJS(datas)}
|
||||||
|
copyFilterProps={["id"]}
|
||||||
|
selectedData={!loading && toJS(selectedData)}
|
||||||
|
onChange={e => store.setTableEditDatas(e)}
|
||||||
|
onRowSelect={(sRowKeys, rows, dataIndex, selectedDatas) => this.onRowSelect(sRowKeys, rows, dataIndex, selectedDatas)}
|
||||||
|
/>
|
||||||
|
</WeaDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaPopoverHrm
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../public/i18n';
|
||||||
|
import AttachToNumberField from './NewNumberField';
|
||||||
|
import "../style/common.less";
|
||||||
|
|
||||||
|
export default class SearchPanelDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 700,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
condition,
|
||||||
|
form,
|
||||||
|
isFormInit,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && condition.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={form.getFormParams()} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</Col>)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
getSearchGroupForm() {
|
||||||
|
const {
|
||||||
|
condition,
|
||||||
|
form,
|
||||||
|
isFormInit,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && condition.map((c, i) => {
|
||||||
|
let _arr = [];
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
_arrarr.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={form.getFormParams()} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</Col>)
|
||||||
|
})
|
||||||
|
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 <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`}>{arr}</Row>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
search,
|
||||||
|
onCancel,
|
||||||
|
loading,
|
||||||
|
height,
|
||||||
|
conditionLen,
|
||||||
|
form
|
||||||
|
} = this.props, {
|
||||||
|
width,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => search()} disabled={loading}>{i18n.button.search()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} onClick={() => form.reset()} disabled={loading}>{i18n.button.reset()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} onClick={() => onCancel()} disabled={loading}>{i18n.button.cancel()}</Button>)
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
className="new-edit-wrapper"
|
||||||
|
title={title}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: width, height: height }}
|
||||||
|
initLoadCss
|
||||||
|
>
|
||||||
|
{
|
||||||
|
loading ? <div className='hrm-loading-center-small'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||||
|
</div>
|
||||||
|
: conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()}
|
||||||
|
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
WeaTab,
|
||||||
|
WeaTableEdit
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Tooltip,
|
||||||
|
Row, Col, Select
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
|
||||||
|
import { chunk, isEmpty } from 'lodash';
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
const Option = Select.Option;
|
||||||
|
|
||||||
|
export default class VersionsSlider extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
versionList,
|
||||||
|
handleChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const newData = chunk(versionList.datas, 2);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<div style={{ "marginTop": "50px", "paddingLeft": "30px", "height": "30px", "lineHeight": "30px", "paddingRight": "30px" }}>
|
||||||
|
<Row>
|
||||||
|
<Col span={8}>
|
||||||
|
<p>操作人: {versionList.operateName}</p>
|
||||||
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<p>操作时间: {versionList.operateTime}</p>
|
||||||
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<div>版本: <Select showSearch
|
||||||
|
style={{ width: 100 }}
|
||||||
|
placeholder="请选择版本"
|
||||||
|
defaultValue="1.0"
|
||||||
|
optionFilterProp="children"
|
||||||
|
notFoundContent="无法找到"
|
||||||
|
onChange={handleChange}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
versionList.versions.map((item) => {
|
||||||
|
return (<Option value={item.value}>V{item.value}</Option>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</Select></div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<div style={{ "marginTop": "30px", "width": "100%" }}>
|
||||||
|
{newData.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<div key={index} style={{ "display": "flex" }}>
|
||||||
|
{item.map((subItem) => {
|
||||||
|
return (
|
||||||
|
<div style={{ "width": "50%", "height": "40px", "overflow": "hidden", "testOverflow": "ellipsis", "whiteSpace": "nowrap" }}>
|
||||||
|
<span style={{ "width": "80px", "display": "inline-block", "textAlign": "right", "color": "#999999" }}>{subItem.fieldId}</span>
|
||||||
|
{subItem.fieldValue.length > 10 ? <Tooltip placement="topLeft" title={subItem.fieldValue}>
|
||||||
|
<span style={{ "marginLeft": "20px" }}>{subItem.fieldValue}</span>
|
||||||
|
</Tooltip> : <span style={{ "marginLeft": "20px" }}>{subItem.fieldValue}</span>}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { WeaTableEdit } from "ecCom";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
|
||||||
|
@inject("columnSetting")
|
||||||
|
@observer
|
||||||
|
class CustomItem extends Component {
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init = () => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
columnSetting.loadTabThreeRelatedData();
|
||||||
|
};
|
||||||
|
|
||||||
|
onRowSelect = (sRowKeys, rows, dataIndex, selectedDatas) => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
if (dataIndex === undefined || selectedDatas === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
columnSetting.setEnableThreeRows(selectedDatas.status);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { columnSetting } = this.props, { tabThreeRelatedData } = columnSetting;
|
||||||
|
const { datas, columns, selectedData, loading } = tabThreeRelatedData;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<WeaTableEdit
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
|
||||||
|
draggable
|
||||||
|
deleteConfirm
|
||||||
|
title=""
|
||||||
|
columns={toJS(columns)}
|
||||||
|
datas={toJS(datas)}
|
||||||
|
copyFilterProps={["id"]}
|
||||||
|
selectedData={!loading && toJS(selectedData)}
|
||||||
|
onChange={e => columnSetting.setCustomTableEditDatas(e)}
|
||||||
|
onRowSelect={(sRowKeys, rows, dataIndex, selectedDatas) => this.onRowSelect(sRowKeys, rows, dataIndex, selectedDatas)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CustomItem;
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { WeaTableEdit } from "ecCom";
|
||||||
|
import * as mobx from "mobx";
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
|
||||||
|
@inject("columnSetting")
|
||||||
|
@observer
|
||||||
|
export default class DefineShowItems extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init = () => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
columnSetting.loadTabTwoRelatedData();
|
||||||
|
};
|
||||||
|
|
||||||
|
onRowSelect = (sRowKeys, rows, dataIndex, selectedDatas) => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
if (dataIndex === undefined || selectedDatas === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
columnSetting.setEnableRows(selectedDatas.isused);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { columnSetting } = this.props, { tabTwoRelatedData } = columnSetting;
|
||||||
|
const { datas, columns, selectedData, loading } = tabTwoRelatedData;
|
||||||
|
return (
|
||||||
|
<WeaTableEdit
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
|
||||||
|
draggable
|
||||||
|
deleteConfirm
|
||||||
|
title=""
|
||||||
|
columns={toJS(columns)}
|
||||||
|
datas={toJS(datas)}
|
||||||
|
copyFilterProps={["id"]}
|
||||||
|
selectedData={!loading && toJS(selectedData)}
|
||||||
|
onChange={e => columnSetting.setTableEditDatas(e)}
|
||||||
|
onRowSelect={(sRowKeys, rows, dataIndex, selectedDatas) => this.onRowSelect(sRowKeys, rows, dataIndex, selectedDatas)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { WeaRightMenu, WeaTab, WeaTop } from "ecCom";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Button } from "antd";
|
||||||
|
import PermissionItem from "./permissionItem";
|
||||||
|
import DefineShowItems from "./defineShowItems";
|
||||||
|
import CustomItem from "./customItem";
|
||||||
|
import { i18n } from "../../public/i18n";
|
||||||
|
import { renderNoright } from "../../util";
|
||||||
|
|
||||||
|
@inject("columnSetting")
|
||||||
|
@observer
|
||||||
|
class ColumnSetting extends Component {
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init = () => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
columnSetting.getRight();
|
||||||
|
};
|
||||||
|
|
||||||
|
getTopMenuBtns = () => {
|
||||||
|
return [
|
||||||
|
<Button type="primary" onClick={this.save}>保存</Button>
|
||||||
|
];
|
||||||
|
};
|
||||||
|
getDropMenuDatas = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
key: "save",
|
||||||
|
icon: <i className="icon-coms-Preservation"/>,
|
||||||
|
content: "保存"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
getTabName = () => {
|
||||||
|
return [{
|
||||||
|
key: "0",
|
||||||
|
title: i18n.label.defineShowItems()
|
||||||
|
}, {
|
||||||
|
key: "1",
|
||||||
|
title: i18n.label.columnPermission()
|
||||||
|
}, {
|
||||||
|
key: "2",
|
||||||
|
title: i18n.label.columnCustom()
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
save = () => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
const { selectedKey } = columnSetting;
|
||||||
|
selectedKey === "0" ?
|
||||||
|
columnSetting.userDefineCardItemSave() :
|
||||||
|
selectedKey === "1" ?
|
||||||
|
columnSetting.columnPermissionSave() : columnSetting.customItemSave();
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
const { selectedKey, authorized } = columnSetting;
|
||||||
|
if (authorized === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
authorized && <div style={{ height: "100%" }}>
|
||||||
|
<WeaRightMenu
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaRightMenu@k6oc4u`}
|
||||||
|
datas={[{
|
||||||
|
key: "save",
|
||||||
|
icon: <i className="icon-coms-Preservation"/>,
|
||||||
|
content: "保存"
|
||||||
|
}]}
|
||||||
|
onClick={key => (key && this[key]())}
|
||||||
|
>
|
||||||
|
<WeaTop
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTop@bj98s7`}
|
||||||
|
title={i18n.label.cardColumnSet()}
|
||||||
|
icon={<i className="icon-coms-hrm"/>}
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => (e && this[e]())}
|
||||||
|
/>
|
||||||
|
<WeaTab
|
||||||
|
ecId={`${this && this.props && this.props.ecId || ""}_WeaTab@8mmoen`}
|
||||||
|
selectedKey={selectedKey}
|
||||||
|
datas={this.getTabName()}
|
||||||
|
keyParam="key"
|
||||||
|
onChange={(key) => columnSetting.setSelectedKey(key)}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
selectedKey === "0" ?
|
||||||
|
<DefineShowItems ecId={`${this && this.props && this.props.ecId || ""}_DefineShowItems@q1hmoj`}/> :
|
||||||
|
selectedKey === "1" ?
|
||||||
|
<PermissionItem ecId={`${this && this.props && this.props.ecId || ""}_SysShowItems@0wqtjk`}/> :
|
||||||
|
<CustomItem ecId={`${this && this.props && this.props.ecId || ""}_CustomItems@0wqtjk`}/>
|
||||||
|
}
|
||||||
|
</WeaRightMenu>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ColumnSetting;
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { WeaTableNew } from "comsMobx";
|
||||||
|
import { WeaBrowser, WeaCheckbox } from "ecCom";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
@inject("columnSetting")
|
||||||
|
@observer
|
||||||
|
class PermissionItem extends Component {
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init = () => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
columnSetting.loadTabOneRelatedData();
|
||||||
|
};
|
||||||
|
changeSaveParams = (record, value, dataIndex) => {
|
||||||
|
const { columnSetting } = this.props;
|
||||||
|
const list = _.isEmpty(columnSetting.columnsPermissionData) ? toJS(columnSetting.tableStore.datas) : columnSetting.columnsPermissionData;
|
||||||
|
const dataSource = _.map([...list], it => {
|
||||||
|
if (record.id === it.id) {
|
||||||
|
return {
|
||||||
|
...it,
|
||||||
|
[dataIndex]: value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { ...it };
|
||||||
|
});
|
||||||
|
columnSetting.setColumnsPermissionData(dataSource);
|
||||||
|
};
|
||||||
|
renderRenderColumns = columns => {
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex === "status" || c.dataIndex === "all_people" ||
|
||||||
|
c.dataIndex === "superior" || c.dataIndex === "all_superior") {
|
||||||
|
c.render = (text, record) => {
|
||||||
|
return (
|
||||||
|
<WeaCheckbox
|
||||||
|
value={record[c.dataIndex]}
|
||||||
|
onChange={value => {
|
||||||
|
this.changeSaveParams(record, value, c.dataIndex);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
} else if (c.dataIndex === "custom") {
|
||||||
|
c.render = (text, record) => {
|
||||||
|
const custom = record[c.dataIndex].split(",");
|
||||||
|
const customspan = record[`${c.dataIndex}span`].split(",");
|
||||||
|
const replaceDatas = _.map(custom, (item, index) => ({ id: custom[index], name: customspan[index] }));
|
||||||
|
return (
|
||||||
|
<WeaBrowser
|
||||||
|
inputStyle={{ width: 200 }}
|
||||||
|
type={65}
|
||||||
|
isSingle={false}
|
||||||
|
title="多角色"
|
||||||
|
linkUrl="/spa/hrm/engine.html#/hrmengine/roleInfo/info?id="
|
||||||
|
replaceDatas={replaceDatas}
|
||||||
|
onChange={value => {
|
||||||
|
this.changeSaveParams(record, value, c.dataIndex);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { columnSetting } = this.props, { tableStore } = columnSetting;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<WeaTable
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""}_WeaTable@b43a4c`}
|
||||||
|
comsWeaTableStore={tableStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
getColumns={c => this.renderRenderColumns(c)}
|
||||||
|
onOperatesClick={(record, index, operate) =>
|
||||||
|
this.onOperatesClick(record, index, operate)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PermissionItem;
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-05-18 14:52:39
|
||||||
|
* @LastEditTime: 2022-12-16 17:48:54
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js
|
||||||
|
*/
|
||||||
|
import { Button, Modal, message, Row, Col, Spin, Select,Tooltip } from 'antd';
|
||||||
|
import { chunk,isEmpty } from 'lodash';
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
import forEach from 'lodash/forEach'
|
||||||
|
import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab, WeaTop, WeaSlideModal } from 'ecCom'
|
||||||
|
import { WeaSwitch } from 'comsMobx';
|
||||||
|
import { inject, observer } from 'mobx-react';
|
||||||
|
import * as mobx from 'mobx';
|
||||||
|
import { i18n } from '../../public/i18n';
|
||||||
|
import '../../style/common.less';
|
||||||
|
import VersionsSlider from '../VersionsSlider';
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
import '../../style/common.less';
|
||||||
|
import AttachToNumberField from "../NewNumberField";
|
||||||
|
|
||||||
|
|
||||||
|
@inject('companyExtend')
|
||||||
|
@inject('company')
|
||||||
|
@observer
|
||||||
|
export default class CompanyExtend extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
init = () => {
|
||||||
|
const { companyExtend, company } = this.props;
|
||||||
|
//const {id} = company;
|
||||||
|
let { hash } = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
companyExtend.init();
|
||||||
|
companyExtend.setId(id);
|
||||||
|
companyExtend.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabChildren = () => {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys, detailSelectedKey } = companyExtend;
|
||||||
|
let tabChildren = [];
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
tableInfo && tableInfo.map((t, i) => {
|
||||||
|
if (detailSelectedKey == 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}
|
||||||
|
className={j === 1 && "minH5"}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
|
||||||
|
{field.domkey[0] == 'subcompanycode' && <AttachToNumberField field={field} form={form} isEdit={true} />}
|
||||||
|
</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 { detailSelectedKey = '0', tableInfo } = companyExtend;
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
let d = cloneDeep(tableInfo);
|
||||||
|
d[Number(detailSelectedKey)].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();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
icon: <i className='icon-coms-common' />,
|
||||||
|
content: i18n.button.version(),
|
||||||
|
key: 'view',
|
||||||
|
onClick: key => {
|
||||||
|
this.view();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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 view = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vkeda5`} type="primary" onClick={this.view} >{i18n.button.version()}</Button>;
|
||||||
|
const btns = [];
|
||||||
|
try {
|
||||||
|
if (isEditor) {
|
||||||
|
if (buttons.hasSave) {
|
||||||
|
btns.push(save);
|
||||||
|
btns.push(back);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (buttons.hasEdit) {
|
||||||
|
btns.push(edit);
|
||||||
|
btns.push(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
editCard = () => {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
companyExtend.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
saveEditCard = () => {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
companyExtend.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
backCard = () => {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
view = () => {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
companyExtend.selectVersions();
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose = () => {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
companyExtend.open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
changeData(key) {
|
||||||
|
const {
|
||||||
|
companyExtend
|
||||||
|
} = this.props;
|
||||||
|
companyExtend.changeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { companyExtend } = this.props;
|
||||||
|
const { loading, tabkey, tabInfo, topTab, selectedKey, date, detailSelectedKey, isEditor, open, versionList } = companyExtend;
|
||||||
|
|
||||||
|
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}
|
||||||
|
title={isEditor ? i18n.label.updateCompany() : i18n.label.viewCompany()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
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>
|
||||||
|
|
||||||
|
<WeaSlideModal visible={open}
|
||||||
|
top={6}
|
||||||
|
width={40}
|
||||||
|
height={94}
|
||||||
|
direction={'right'}
|
||||||
|
measure={'%'}
|
||||||
|
content={!isEmpty(versionList) ? <VersionsSlider versionList={versionList} handleChange={val => companyExtend.changeVersion(val)}/> : <div style={{"textAlign":"center","color":"red","fontSize":"20px","marginTop": "50px"}}> 暂无历史版本 </div>}
|
||||||
|
onClose={this.onClose}
|
||||||
|
onAnimationEnd={() => console.log('onAnimationEnd')} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
|
||||||
|
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
|
||||||
|
</WeaAlertPage>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,627 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-05-18 16:23:32
|
||||||
|
* @LastEditTime: 2022-12-16 17:17:45
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
|
||||||
|
*/
|
||||||
|
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,
|
||||||
|
Menu, Dropdown, Icon,Tooltip
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
import NewTableDialog from '../NewTableDialog';
|
||||||
|
import NewAndEditDialog from '../NewAndEditDialog';
|
||||||
|
import NewWeaTable from '../NewWeaTableDialog';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
import {
|
||||||
|
CompanyExtendStore
|
||||||
|
} from '../../stores/companyextend';
|
||||||
|
|
||||||
|
const companyExtend = new CompanyExtendStore();
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
|
||||||
|
|
||||||
|
@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();
|
||||||
|
company.getMoveForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 8,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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.setNewVisible(true);
|
||||||
|
company.getCompanyForm();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//联查部门
|
||||||
|
select(id) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
company.setNeDialogTitle(i18n.label.selectDept());
|
||||||
|
company.setVisible(true);
|
||||||
|
company.setDialogLoadingStatus(true);
|
||||||
|
company.getDeptTable(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查看
|
||||||
|
view(id) {
|
||||||
|
//companyExtend.isEditor = true;
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${id}`, "_blank")
|
||||||
|
}
|
||||||
|
|
||||||
|
transfer(id) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: this.getTransferForm(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
company.transfer(id)
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
version(record) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: `确认将{${record.subCompanyDesc}}存为新版本?`,
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
company.version(record.id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getTransferForm() {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
transferCondition,
|
||||||
|
form2,
|
||||||
|
} = company;
|
||||||
|
let formParams = form2.getFormParams();
|
||||||
|
const {
|
||||||
|
isFormInit
|
||||||
|
} = form2;
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && transferCondition.map(c => {
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push(
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
selectedRowKeys
|
||||||
|
} = company;
|
||||||
|
let keys = toJS(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) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
let _this = this;
|
||||||
|
// `${columns}` && columns.push({
|
||||||
|
// title: '',
|
||||||
|
// dataIndex: 'ops',
|
||||||
|
// key: 'ops',
|
||||||
|
// width: 80,
|
||||||
|
// className:"wea-table-operates",
|
||||||
|
// render: ( text, record, index )=> {
|
||||||
|
// const menu = (
|
||||||
|
// <Menu>
|
||||||
|
// <Menu.Item>
|
||||||
|
// <a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
|
||||||
|
// </Menu.Item>
|
||||||
|
// <Menu.Item>
|
||||||
|
// <a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
|
||||||
|
// </Menu.Item>
|
||||||
|
// </Menu>
|
||||||
|
// )
|
||||||
|
// return (
|
||||||
|
// <Dropdown overlay={menu}>
|
||||||
|
// <i class="icon-coms-more" />
|
||||||
|
// </Dropdown>
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex == 'canceled') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <Switch checked={record.canceled == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (c.dataIndex == 'subCompanyDesc') {
|
||||||
|
c.className = "wea-table-indent"
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <a onClick={() => {
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank")
|
||||||
|
}}>{text}</a>
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c.dataIndex == 'operate') {
|
||||||
|
c.className = "wea-table-operates"
|
||||||
|
c.width = 80
|
||||||
|
c.render = function (text, record) {
|
||||||
|
const menu = (
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item key="1" disabled={record.isUsed === 0 ? false : true} style={record.isUsed === 0 ?{display:'block'} :{display:'none'}}>
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="2">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查部门</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="3">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.view(record.id) }}>查看</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="4">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.transfer(record.id) }}>转移</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="5">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.version(record) }}>另存为版本</a>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
return <Dropdown overlay={menu}>
|
||||||
|
<i class="icon-coms-more" />
|
||||||
|
</Dropdown>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
company.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
company.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
company.setSaveAndSetting(false);
|
||||||
|
company.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSaveAndSetting() {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
company.setSaveAndSetting(true);
|
||||||
|
company.save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
company
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = company;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@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, loading, date, nEdialogTitle, dialogLoading,
|
||||||
|
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init,hasRight
|
||||||
|
} = company;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowSelection = {
|
||||||
|
selectedRowKeys:selectedRowKeys,
|
||||||
|
type: "checkbox",
|
||||||
|
onChange(selectedRowKeys, selectedRows) {
|
||||||
|
company.setSelectedRowKeys(selectedRowKeys);
|
||||||
|
},
|
||||||
|
getCheckboxProps: record => ({
|
||||||
|
disabled: record.isUsed === 1, // 配置无法勾选的列
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const pagination = {
|
||||||
|
current: current,
|
||||||
|
pageSize: pageSize,
|
||||||
|
total: total,
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
onShowSizeChange(current, pageSize) {
|
||||||
|
},
|
||||||
|
onChange(current) {
|
||||||
|
},
|
||||||
|
showTotal(total) {
|
||||||
|
return `共 ${total} 条`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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.setCurrent(1);
|
||||||
|
company.setPageSize(10);
|
||||||
|
company.getTableInfo()
|
||||||
|
}}
|
||||||
|
onSearchChange={val => this.onSearchChange(val)}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
init ? <div className='hrm-new-weatable-spin'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
|
||||||
|
</div> :
|
||||||
|
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
|
||||||
|
loading={loading}
|
||||||
|
dataSource={dataSource} childrenColumnName="children"
|
||||||
|
columns={this.reRenderColumns(columns)}
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
pagination={pagination}
|
||||||
|
onChange={(pagination, filters, sorter) => {
|
||||||
|
company.setSortParams(sorter);
|
||||||
|
company.setCurrent(pagination.current);
|
||||||
|
company.setPageSize(pagination.pageSize);
|
||||||
|
company.getTableInfo();
|
||||||
|
}}
|
||||||
|
indentSize={15}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
|
</WeaTop>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<NewTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={visible}
|
||||||
|
loading={dialogLoading}
|
||||||
|
height={400}
|
||||||
|
dataSource={deptDataSource} //联查部门数据
|
||||||
|
columns={deptColumns}
|
||||||
|
onCancel={() => company.setVisible(false)}
|
||||||
|
/>
|
||||||
|
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={newVisible}
|
||||||
|
condition={toJS(condition)}
|
||||||
|
form={form1}
|
||||||
|
isFormInit={form1.isFormInit}
|
||||||
|
loading={dialogLoading}
|
||||||
|
isEdit={isEdit}
|
||||||
|
height={350}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => company.setNewVisible(false)}
|
||||||
|
saveAndSetting = {() => this.handleSaveAndSetting()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
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 NewPopconfirm extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
value: '0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderComponent(field, index,form) {
|
||||||
|
return <WeaFormItem style={{ margin: "10px" }} 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()}
|
||||||
|
onChange={this.onChange} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
condition,
|
||||||
|
form,
|
||||||
|
isFormInit,
|
||||||
|
isMerge
|
||||||
|
} = this.props, {
|
||||||
|
value
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && condition.map(c => {
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
if(!isMerge){
|
||||||
|
if (field.domkey[0] !== 'company' && field.domkey[0] !== 'department') {
|
||||||
|
arr.push(
|
||||||
|
this.renderComponent(field,index,form)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
value === '0' && field.domkey[0] === 'company' && arr.push(
|
||||||
|
this.renderComponent(field,index,form)
|
||||||
|
)
|
||||||
|
value === '1' && field.domkey[0] === 'department' && arr.push(
|
||||||
|
this.renderComponent(field,index,form)
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
arr.push(
|
||||||
|
this.renderComponent(field,index,form))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return <div className="wea-form-item-group">{arr}</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange = data => {
|
||||||
|
data.moveType && this.setState({
|
||||||
|
value:data.moveType.value
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
save,
|
||||||
|
onCancel,
|
||||||
|
loading,
|
||||||
|
height,
|
||||||
|
width
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => {save();this.setState({value:"0"})}} disabled={loading}>{i18n.button.ok()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => {this.setState({value:"0"});onCancel()}} disabled={loading}>{i18n.button.cancel()}</Button>)
|
||||||
|
];
|
||||||
|
|
||||||
|
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={() => {this.setState({value:"0"});onCancel()}}
|
||||||
|
buttons={buttons}
|
||||||
|
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>
|
||||||
|
: this.getForm()
|
||||||
|
}
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,736 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-06-02 09:19:37
|
||||||
|
* @LastEditTime: 2022-12-16 17:47:38
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaTable,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaOrgTree,
|
||||||
|
WeaDialog,
|
||||||
|
WeaPopoverHrm
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
message,
|
||||||
|
Switch,
|
||||||
|
Menu, Dropdown, Icon
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
import NewAndEditDialog from '../NewAndEditDialog';
|
||||||
|
import NewTableDialog from '../NewTableDialog';
|
||||||
|
import NewPopconfirm from './NewPopconfirm'
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
|
||||||
|
|
||||||
|
@inject('department')
|
||||||
|
@observer
|
||||||
|
export default class Department extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.getTableInfo();
|
||||||
|
department.getHasRight();
|
||||||
|
department.getCopyForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
selectedRowKeys,
|
||||||
|
selectTreeNodeInfo
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
let btns = [];
|
||||||
|
topMenu.map((item, i) => {
|
||||||
|
if (item.menuFun === 'batchDelete') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else if (item.menuFun === 'copy') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(item) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
isPanelShow && department.setPanelStatus(false);
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
department.setNeDialogTitle(i18n.label.newDept());
|
||||||
|
department.setNewVisible(true);
|
||||||
|
department.getDeptForm();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//联查岗位
|
||||||
|
select(id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
department.setNeDialogTitle("联查岗位");
|
||||||
|
department.setVisible(true);
|
||||||
|
department.setDialogLoadingStatus(true);
|
||||||
|
department.getPostionTable(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//合并
|
||||||
|
merge(id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
department.setNeDialogTitle(i18n.label.mergeDept());
|
||||||
|
department.setConfirmVisible(true);
|
||||||
|
department.setIds(id);
|
||||||
|
department.setIsMerge(true);
|
||||||
|
department.getMergeForm(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//转移
|
||||||
|
transfer(id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.setNeDialogTitle(i18n.label.transferDept());
|
||||||
|
department.setConfirmVisible(true);
|
||||||
|
department.setIds(id);
|
||||||
|
department.setIsMerge(false);
|
||||||
|
department.getTransferForm(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//查看
|
||||||
|
view(id) {
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${id}`, "_blank")
|
||||||
|
}
|
||||||
|
|
||||||
|
copy(id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
selectedRowKeys
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
let keys = id == undefined ? toJS(selectedRowKeys).toString() : id;
|
||||||
|
department.setIds(keys);
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: this.getCopyForm(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
department.copy()
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getCopyForm() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
copyCondition,
|
||||||
|
form2,
|
||||||
|
} = department;
|
||||||
|
let formParams = form2.getFormParams();
|
||||||
|
const {
|
||||||
|
isFormInit
|
||||||
|
} = form2;
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && copyCondition.map(c => {
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push(
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 9,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
selectedRowKeys
|
||||||
|
} = department;
|
||||||
|
let keys = toJS(selectedRowKeys).toString();
|
||||||
|
department.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 {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
isPanelShow && department.setPanelStatus(false);
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
department.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onSearchChange(val) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
department.setDepartmentName(val);
|
||||||
|
!this.isEmptyObject(form.getFormParams()) && department.updateFields(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
version(record) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: `确认将{${record.departmentMark}}存为新版本?`,
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
department.version(record.id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
reRenderColumns(columns) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
let _this = this;
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex == 'canceled') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <Switch checked={record.canceled == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (c.dataIndex == 'departmentMark') {
|
||||||
|
c.className = "wea-table-indent"
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <a href='javascript:void(0);' onClick={() => {
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${record.id}`, "_blank")
|
||||||
|
}}>{text}</a>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c.dataIndex == 'operate') {
|
||||||
|
c.className = "wea-table-operates"
|
||||||
|
c.width = 80
|
||||||
|
c.render = function (text, record) {
|
||||||
|
const menu = (
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item key="0">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.view(record.id) }}>查看</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="1" disabled={record.isUsed === 0 ? false : true} style={record.isUsed === 0 ? { display: 'block' } : { display: 'none' }}>
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="2">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.merge(record.id) }}>合并</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="3">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.transfer(record.id) }}>转移</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="4">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查岗位</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="5">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.copy(record.id) }}>复制</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="6">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.version(record) }}>另存为版本</a>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
return <Dropdown overlay={menu}>
|
||||||
|
<i class="icon-coms-more" />
|
||||||
|
</Dropdown>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.setSaveAndSetting(false);
|
||||||
|
department.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSaveAndSetting() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
department.setSaveAndSetting(true);
|
||||||
|
department.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
PopconfirmSave() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const { isMerge } = department;
|
||||||
|
isMerge && department.merge();
|
||||||
|
!isMerge && department.transfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { department.setCurrent(1); department.setPageSize(10); department.getTableInfo(); department.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={() => department.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form,
|
||||||
|
searchConditionLoading
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
department.getTableInfo();
|
||||||
|
department.setPanelStatus(false)
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//非空判断
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//左侧树
|
||||||
|
getTree = () => {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
companysId,
|
||||||
|
} = department
|
||||||
|
|
||||||
|
let tree = (
|
||||||
|
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
|
||||||
|
ref='WeaOrgTree'
|
||||||
|
dataUrl={"/api/bs/hrmorganization/dept/getSearchTree"}
|
||||||
|
loading
|
||||||
|
needSearch
|
||||||
|
noCache={true}
|
||||||
|
needDropMenu={false}
|
||||||
|
//onSelect={this.selectVirtual} //组织维度回调函数
|
||||||
|
isLoadSubDepartment={true}
|
||||||
|
topPrefix={'hrmSearch'}
|
||||||
|
companysId={companysId}
|
||||||
|
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
|
||||||
|
treeNodeClick={this.treeNodeClick}
|
||||||
|
expandAllChildrenOnSearch={true}
|
||||||
|
renderNode={item => this.renderNode(item)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNode(item) {
|
||||||
|
return <div className='text-elli' title={item.name}>
|
||||||
|
<i className={item.icon} style={{ marginRight: '5px' }}></i>
|
||||||
|
{item.name}
|
||||||
|
{item.canceled && <span style={{ color: 'red' }}>({i18n.label.forbidden()})</span>}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
treeNodeClick = (event, ids, nodeids, nodes) => {
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
companysId
|
||||||
|
} = department;
|
||||||
|
const type = event.node.props.type || '0';
|
||||||
|
const id = event.node.props.id || '';
|
||||||
|
let params = {};
|
||||||
|
form.resetConditionValue();
|
||||||
|
department.setPanelStatus(false)
|
||||||
|
// department.tabkey = 'default_3';
|
||||||
|
department.nodeType = type;
|
||||||
|
if (type == '0') {
|
||||||
|
params['virtualtype'] = companysId;
|
||||||
|
}
|
||||||
|
if (type == '1') {
|
||||||
|
params['subcompanyid1'] = id;
|
||||||
|
}
|
||||||
|
if (type == '2') {
|
||||||
|
params['departmentid'] = id;
|
||||||
|
}
|
||||||
|
department.doSearch(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
department
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, departmentName, conditionNum, visible, condition, form,
|
||||||
|
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
|
||||||
|
form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init,
|
||||||
|
defaultShowLeft, confirmVisible, confirmLoading, postionDataSource, postionColumns, isMerge, hasRight
|
||||||
|
} = department;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowSelection = {
|
||||||
|
selectedRowKeys: selectedRowKeys,
|
||||||
|
type: "checkbox",
|
||||||
|
onChange(selectedRowKeys, selectedRows) {
|
||||||
|
department.setSelectedRowKeys(selectedRowKeys);
|
||||||
|
},
|
||||||
|
getCheckboxProps: record => ({
|
||||||
|
disabled: record.isUsed === 1, // 配置无法勾选的列
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const pagination = {
|
||||||
|
current: current,
|
||||||
|
pageSize: pageSize,
|
||||||
|
total: total,
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
onShowSizeChange(current, pageSize) {
|
||||||
|
},
|
||||||
|
onChange(current) {
|
||||||
|
},
|
||||||
|
showTotal(total) {
|
||||||
|
return `共 ${total} 条`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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.deptManage()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => this.handleMenuClick(e)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@7muhhb`} isNew={true} showLeft={defaultShowLeft} leftCom={this.getTree()}>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||||
|
searchType={['base', 'advanced']}
|
||||||
|
showSearchAd={isPanelShow}
|
||||||
|
searchsBaseValue={this.isEmptyObject(form.getFormParams()) ? departmentName : form.getFormParams().departmentName}
|
||||||
|
setShowSearchAd={bool => department.setPanelStatus(bool)}
|
||||||
|
hideSearchAd={() => department.setPanelStatus(false)}
|
||||||
|
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||||
|
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
onSearch={() => {
|
||||||
|
department.setCurrent(1);
|
||||||
|
department.setPageSize(10);
|
||||||
|
department.getTableInfo()
|
||||||
|
}}
|
||||||
|
onSearchChange={val => this.onSearchChange(val)}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
init ? <div className='hrm-new-weatable-spin'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
|
||||||
|
</div> :
|
||||||
|
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
|
||||||
|
loading={loading}
|
||||||
|
dataSource={dataSource} childrenColumnName="children"
|
||||||
|
columns={this.reRenderColumns(columns)}
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
pagination={pagination}
|
||||||
|
onChange={(pagination, filters, sorter) => {
|
||||||
|
department.setSortParams(sorter);
|
||||||
|
department.setCurrent(pagination.current);
|
||||||
|
department.setPageSize(pagination.pageSize);
|
||||||
|
department.getTableInfo();
|
||||||
|
}}
|
||||||
|
indentSize={15}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</WeaTop>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<NewTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={visible}
|
||||||
|
loading={dialogLoading}
|
||||||
|
height={400}
|
||||||
|
dataSource={postionDataSource} //联查岗位数据
|
||||||
|
columns={postionColumns}
|
||||||
|
onCancel={() => department.setVisible(false)}
|
||||||
|
/>
|
||||||
|
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={newVisible}
|
||||||
|
condition={toJS(condition)}
|
||||||
|
form={form1}
|
||||||
|
isFormInit={form1.isFormInit}
|
||||||
|
loading={dialogLoading}
|
||||||
|
isEdit={isEdit}
|
||||||
|
height={400}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => department.setNewVisible(false)}
|
||||||
|
saveAndSetting={() => this.handleSaveAndSetting()}
|
||||||
|
moduleName={"department"}
|
||||||
|
bindChangeEnvent={val => department.updateConditions(val)}
|
||||||
|
>
|
||||||
|
</NewAndEditDialog>
|
||||||
|
<NewPopconfirm ecId={`${this && this.props && this.props.ecId || ''}_NewPopconfirm@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={confirmVisible}
|
||||||
|
condition={toJS(condition)}
|
||||||
|
form={form1}
|
||||||
|
isFormInit={form1.isFormInit}
|
||||||
|
loading={confirmLoading}
|
||||||
|
height={100}
|
||||||
|
width={320}
|
||||||
|
isMerge={isMerge}
|
||||||
|
defaultValue={"0"}
|
||||||
|
save={() => this.PopconfirmSave()}
|
||||||
|
onCancel={() => department.setConfirmVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,317 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-06-02 09:20:03
|
||||||
|
* @LastEditTime: 2022-12-16 16:35:02
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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,WeaSlideModal } from 'ecCom'
|
||||||
|
import { WeaSwitch } from 'comsMobx';
|
||||||
|
import { inject, observer } from 'mobx-react';
|
||||||
|
import * as mobx from 'mobx';
|
||||||
|
import { i18n } from '../../public/i18n';
|
||||||
|
import AttachToNumberField from "../NewNumberField";
|
||||||
|
import VersionsSlider from '../VersionsSlider';
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
|
||||||
|
@inject('departmentExtend')
|
||||||
|
@inject('department')
|
||||||
|
@observer
|
||||||
|
export default class DepartmentExtendStore extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
init = () => {
|
||||||
|
const { departmentExtend, department } = this.props;
|
||||||
|
let { hash } = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
departmentExtend.init();
|
||||||
|
departmentExtend.setId(id);
|
||||||
|
departmentExtend.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
view = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
departmentExtend.selectVersions();
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
departmentExtend.open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabChildren = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys, detailSelectedKey } = departmentExtend;
|
||||||
|
let tabChildren = [];
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
tableInfo && tableInfo.map((t, i) => {
|
||||||
|
if (detailSelectedKey == i) {
|
||||||
|
tabChildren.push(
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
|
||||||
|
ref={(ref) => departmentExtend.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 {
|
||||||
|
departmentExtend
|
||||||
|
} = this.props, {
|
||||||
|
tableInfo,
|
||||||
|
selectedRows,
|
||||||
|
setSelectedRowKeys,
|
||||||
|
selectedRowKeys
|
||||||
|
} = departmentExtend;
|
||||||
|
|
||||||
|
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 { departmentExtend } = this.props;
|
||||||
|
let { form, conditions, isEditor } = departmentExtend;
|
||||||
|
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}
|
||||||
|
className={j === 1 && "minH5"}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
|
||||||
|
{field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
</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 { departmentExtend } = this.props;
|
||||||
|
let { detailSelectedKey = '0', tableInfo } = departmentExtend;
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
let d = cloneDeep(tableInfo);
|
||||||
|
d[Number(detailSelectedKey)].tabinfo.datas = data;
|
||||||
|
departmentExtend.updateTableInfo(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRightMenu = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = departmentExtend;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
icon: <i className='icon-coms-common' />,
|
||||||
|
content: i18n.button.version(),
|
||||||
|
key: 'view',
|
||||||
|
onClick: key => {
|
||||||
|
this.view();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopButtons = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = departmentExtend;
|
||||||
|
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 view = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@vkeda5`} type="primary" onClick={this.view} >{i18n.button.version()}</Button>;
|
||||||
|
|
||||||
|
const btns = [];
|
||||||
|
try {
|
||||||
|
if (isEditor) {
|
||||||
|
if (buttons.hasSave) {
|
||||||
|
btns.push(save);
|
||||||
|
btns.push(back);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (buttons.hasEdit) {
|
||||||
|
btns.push(edit);
|
||||||
|
btns.push(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
editCard = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
departmentExtend.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
saveEditCard = () => {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
departmentExtend.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
backCard = () => {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
changeData(key) {
|
||||||
|
const {
|
||||||
|
departmentExtend
|
||||||
|
} = this.props;
|
||||||
|
departmentExtend.changeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { departmentExtend } = this.props;
|
||||||
|
const { loading, tabkey, tabInfo, topTab, selectedKey, date, detailSelectedKey,isEditor,open, versionList } = departmentExtend;
|
||||||
|
|
||||||
|
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={loading}
|
||||||
|
title={isEditor ? i18n.label.editDept() : i18n.label.departmentInfo()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
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 => {
|
||||||
|
departmentExtend.updateDetailSelectedKey(v);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{this.getTabChildren()}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</Spin>
|
||||||
|
</WeaTop>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<WeaSlideModal visible={open}
|
||||||
|
top={6}
|
||||||
|
width={40}
|
||||||
|
height={94}
|
||||||
|
direction={'right'}
|
||||||
|
measure={'%'}
|
||||||
|
content={!isEmpty(versionList) ? <VersionsSlider versionList={versionList} handleChange={val => departmentExtend.changeVersion(val)}/> : <div style={{"textAlign":"center","color":"red","fontSize":"20px","marginTop": "50px"}}> 暂无历史版本 </div>}
|
||||||
|
onClose={this.onClose}
|
||||||
|
onAnimationEnd={() => console.log('onAnimationEnd')} />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@h1wgnu`}>
|
||||||
|
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
|
||||||
|
</WeaAlertPage>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,439 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaAlertPage
|
||||||
|
} 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';
|
||||||
|
import { renderNoright } from '../../util'; // 从util文件引入公共的方法
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
@inject('managerDetach')
|
||||||
|
@observer
|
||||||
|
export default class ManagerDetach extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.getHasRight();
|
||||||
|
managerDetach.getTableInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
tableStore
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isPanelShow && managerDetach.setPanelStatus(false);
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
managerDetach.setNeDialogTitle(i18n.label.newManagerDetach());
|
||||||
|
managerDetach.setIsNew(true);
|
||||||
|
managerDetach.setVisible(true);
|
||||||
|
managerDetach.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
tableStore
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
let keys = toJS(tableStore.selectedRowKeys).toString();
|
||||||
|
managerDetach.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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isPanelShow && managerDetach.setPanelStatus(false);
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { managerDetach.getTableInfo(); managerDetach.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={() => managerDetach.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearchChange(val) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
managerDetach.setManagerName(val);
|
||||||
|
!this.isEmptyObject(form2.getFormParams()) && managerDetach.updateFields(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(columns) {
|
||||||
|
let _this = this;
|
||||||
|
// columns.forEach((c, index) => {
|
||||||
|
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
doDetachSwitch(checked) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? "确定启用组织管理分权吗" : "确定取消组织管理分权",
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
managerDetach.setDetach(checked);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onOperatesClick(record, rowIndex, operate) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = operate;
|
||||||
|
(index == '0') && this.doEdit(record.randomFieldId);
|
||||||
|
(index == '1') && this.doDel(record.randomFieldId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
doEdit(id) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
managerDetach.setNeDialogTitle(i18n.label.editManagerDetach());
|
||||||
|
managerDetach.setDetachId(id);
|
||||||
|
managerDetach.setIsNew(false);
|
||||||
|
managerDetach.setVisible(true);
|
||||||
|
managerDetach.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
managerDetach.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 14,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isNew
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
isNew && managerDetach.save();
|
||||||
|
!isNew && managerDetach.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form2,
|
||||||
|
searchConditionLoading
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
managerDetach.getTableInfo();
|
||||||
|
managerDetach.setPanelStatus(false)
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
managerDetach
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, form2, managerName, conditionNum, tableStore, nEdialogTitle, visible, condition,
|
||||||
|
form, dialogLoading, isEdit, date, hasRight,isDetach
|
||||||
|
} = managerDetach;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <div ref='page' style={{ height: '100%' }}>
|
||||||
|
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
|
||||||
|
datas={this.getDropMenuDatas()}
|
||||||
|
onClick={key => this.handleMenuClick(key)}
|
||||||
|
>
|
||||||
|
<div style={{"width":"100%","height":"50px","lineHeight":"50px"}}>
|
||||||
|
<span style={{"marginLeft":"20px","fontWeight":"bold"}}>启用组织管理分权:</span>
|
||||||
|
<Switch style={{"marginLeft":"20px"}} checked={isDetach == "true" ? true : false} onChange={checked => this.doDetachSwitch(checked)} />
|
||||||
|
</div>
|
||||||
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
|
||||||
|
title={i18n.label.mangerDetachName()}
|
||||||
|
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()) ? managerName : form2.getFormParams().ecManager}
|
||||||
|
setShowSearchAd={bool => managerDetach.setPanelStatus(bool)}
|
||||||
|
hideSearchAd={() => managerDetach.setPanelStatus(false)}
|
||||||
|
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||||
|
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
onSearch={() => managerDetach.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={200}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => managerDetach.setVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
import React, {
|
||||||
|
Component
|
||||||
|
} from 'react';
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Form,
|
||||||
|
Row,
|
||||||
|
Col
|
||||||
|
} from 'antd';
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
export default class AdvanceSearchFormInfo extends Component {
|
||||||
|
renderForm = () => {
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
formFields,
|
||||||
|
itemRender
|
||||||
|
} = this.props;
|
||||||
|
let arr = [];
|
||||||
|
let formParams = form.getFormParams();
|
||||||
|
formFields.map(c => {
|
||||||
|
let _arr = [];
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null;
|
||||||
|
const itemProps = {
|
||||||
|
ratio1to2: true,
|
||||||
|
label: field.label,
|
||||||
|
labelCol: {
|
||||||
|
span: `${window.HrmEngineLabelCol}`
|
||||||
|
},
|
||||||
|
error: form.getError(field),
|
||||||
|
tipPosition: 'bottom',
|
||||||
|
wrapperCol: {
|
||||||
|
span: `${window.HrmEngineWrapperCol}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let coms;
|
||||||
|
if (customerRender == null) {
|
||||||
|
coms = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@2tsobq@${index}`} fieldConfig={field} form={form}/>;
|
||||||
|
} else {
|
||||||
|
coms = customerRender(field, form, formParams);
|
||||||
|
}
|
||||||
|
coms != null && _arr.push(
|
||||||
|
(
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@xgrs6h@${index}`} span={11} offset={index % 2 === 0 ? 1 : 0}>
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@l40w8j@${index}`}
|
||||||
|
ratio1to2
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{span: `${window.HrmEngineLabelCol}`}}
|
||||||
|
error={form.getError(field)}
|
||||||
|
tipPosition={'bottom'}
|
||||||
|
wrapperCol={{span: `${window.HrmEngineWrapperCol}`}}
|
||||||
|
>
|
||||||
|
{coms}
|
||||||
|
</WeaFormItem>
|
||||||
|
</Col>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (_arr.length === 2 || index === c.items.length - 1) {
|
||||||
|
const clone = [..._arr];
|
||||||
|
_arr.length = 0;
|
||||||
|
arr.push(<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@s73jjd@${index}`} gutter={8} style={{marginTop: '10px'}}>{clone}</Row>);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return <Form ecId={`${this && this.props && this.props.ecId || ''}_Form@ojbzkx`}>{arr}</Form>;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderGroupForm = () => {
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
formFields,
|
||||||
|
itemRender
|
||||||
|
} = this.props;
|
||||||
|
let formParams = form.getFormParams();
|
||||||
|
let arr = [];
|
||||||
|
formFields.map((c, i) => {
|
||||||
|
let _arr = [];
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null;
|
||||||
|
const itemProps = {
|
||||||
|
ratio1to2: true,
|
||||||
|
label: field.label,
|
||||||
|
labelCol: {
|
||||||
|
span: `${window.HrmEngineLabelCol}`
|
||||||
|
},
|
||||||
|
error: form.getError(field),
|
||||||
|
tipPosition: 'bottom',
|
||||||
|
wrapperCol: {
|
||||||
|
span: `${window.HrmEngineWrapperCol}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let coms;
|
||||||
|
if (customerRender == null) {
|
||||||
|
coms = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@baa9pz@${index}`} fieldConfig={field} form={form}/>;
|
||||||
|
} else {
|
||||||
|
coms = customerRender(field, form, formParams);
|
||||||
|
}
|
||||||
|
coms != null && _arr.push({
|
||||||
|
com: (
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@t6u2oa@${index}`}
|
||||||
|
ratio1to2
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{span: `${window.HrmEngineLabelCol}`}}
|
||||||
|
error={form.getError(field)}
|
||||||
|
wrapperCol={{span: `${window.HrmEngineWrapperCol}`}}
|
||||||
|
>
|
||||||
|
{coms}
|
||||||
|
</WeaFormItem>
|
||||||
|
),
|
||||||
|
col: field.colSpan || 2
|
||||||
|
})
|
||||||
|
})
|
||||||
|
arr.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@w7lkbb@${i}`} showGroup={c.defaultshow} items={_arr} fontSize={13}/>);
|
||||||
|
})
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderFormComponent = () => {
|
||||||
|
const {
|
||||||
|
formFields
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const com = formFields.length > 1 ? this.renderGroupForm() : this.renderForm();
|
||||||
|
return com;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@sx3az2`} height={'100%'}>
|
||||||
|
{this.renderGroupForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {observer} from 'mobx-react';
|
||||||
|
import { WeaDialog } from "ecCom";
|
||||||
|
import Tip from './Tip';
|
||||||
|
import FormInfo from './FormInfo';
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class EncryptSetting extends Component{
|
||||||
|
render(){
|
||||||
|
const {store} = this.props;
|
||||||
|
const {encryptDialogProps, formTarget, encryptFormItemRender} = store;
|
||||||
|
const {
|
||||||
|
encryptForm,
|
||||||
|
encryptFormFields,
|
||||||
|
} = formTarget;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@9corpv`} {...encryptDialogProps}>
|
||||||
|
<Tip ecId={`${this && this.props && this.props.ecId || ''}_Tip@p2simx`} />
|
||||||
|
<div className='encryptForm' style={{width: '70%', marginLeft: '15%'}}>
|
||||||
|
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@0dc7ac`} center={false} form={encryptForm} formFields={encryptFormFields} itemRender={encryptFormItemRender}/>
|
||||||
|
</div>
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,193 @@
|
||||||
|
import React, {
|
||||||
|
Component
|
||||||
|
} from 'react';
|
||||||
|
import {
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaTableEdit,
|
||||||
|
WeaDialog
|
||||||
|
} from 'ecCom';
|
||||||
|
import classnames from 'classnames';
|
||||||
|
import EncryptSetting from './EncryptSetting';
|
||||||
|
import ViewRangeForm from './ViewRangeForm';
|
||||||
|
import ViewRangeSetting from './ViewRangeSetting';
|
||||||
|
import FormInfo from './FormInfo';
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class FieldDef extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
resize: new Date().getTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
window.addEventListener('resize', this.resizeHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener('resize', this.resizeHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
resizeHandle = (e) => {
|
||||||
|
this.setState({
|
||||||
|
resize: new Date().getTime()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
resize
|
||||||
|
} = this.state;
|
||||||
|
const {
|
||||||
|
rightMenu,
|
||||||
|
store,
|
||||||
|
resetClass
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
setEditTable,
|
||||||
|
tableEditConfig,
|
||||||
|
formTarget,
|
||||||
|
dialogParams,
|
||||||
|
setDialogVisible,
|
||||||
|
getDialogOpButtons,
|
||||||
|
showError,
|
||||||
|
editorDialogRightMenu,
|
||||||
|
refreshFeildDef,
|
||||||
|
refreshForm,
|
||||||
|
dropdownSelectedKey,
|
||||||
|
|
||||||
|
moduleName,
|
||||||
|
isJobTreeNode
|
||||||
|
} = store;
|
||||||
|
const classes = classnames({
|
||||||
|
['tabPane']: true,
|
||||||
|
['tabPane-include']: resetClass
|
||||||
|
})
|
||||||
|
const {
|
||||||
|
groupInfoFrom,
|
||||||
|
groupInfoFromFields,
|
||||||
|
typeInfoFrom,
|
||||||
|
typeInfoFromFields,
|
||||||
|
childInfoForm,
|
||||||
|
childInfoFormFields
|
||||||
|
} = formTarget;
|
||||||
|
const {
|
||||||
|
editGroupInfo,
|
||||||
|
editTypeInfo,
|
||||||
|
groupInfoSetting,
|
||||||
|
createChildInfo,
|
||||||
|
childInfoSetting
|
||||||
|
} = dialogParams;
|
||||||
|
|
||||||
|
let tableProps = {};
|
||||||
|
if (this.tabDom) {
|
||||||
|
tableProps = {
|
||||||
|
scroll: {
|
||||||
|
y: this.tabDom.offsetHeight - 80,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//人员卡片字段定义页面
|
||||||
|
// if (moduleName === 'resourcefielddefined') {
|
||||||
|
// if ((window.e9_locale.userLanguage == 7)) { //系统语言为中文
|
||||||
|
// Object.assign(tableProps.scroll, {
|
||||||
|
// x: 1200
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// Object.assign(tableProps.scroll, {
|
||||||
|
// x: isJobTreeNode ? 1400 : 1900
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)]
|
||||||
|
return (
|
||||||
|
<div className={classes} ref={dom => { this.tabDom = dom }}>
|
||||||
|
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@43qdk8`} datas={rMenu}>
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@5fu5eh`} tableProps={tableProps} viewAttr={3} rowKey={'fieldidrowKey'}
|
||||||
|
ref={(editTable) => setEditTable(editTable, 'fieldDef')}
|
||||||
|
{...tableEditConfig['fieldDef']}
|
||||||
|
/>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<EncryptSetting ecId={`${this && this.props && this.props.ecId || ''}_EncryptSetting@imlc4x`} store={store} />
|
||||||
|
<ViewRangeSetting ecId={`${this && this.props && this.props.ecId || ''}_ViewRangeSetting@2vmdra`} store={store} />
|
||||||
|
<ViewRangeForm ecId={`${this && this.props && this.props.ecId || ''}_ViewRangeForm@bg4o68`} store={store} />
|
||||||
|
{/* 新增分组 */}
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@etbstc`}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
style={{ width: 440, height: 70 }}
|
||||||
|
title={editGroupInfo.title}
|
||||||
|
visible={editGroupInfo.visible}
|
||||||
|
onCancel={() => setDialogVisible('editGroupInfo', false)}
|
||||||
|
buttons={getDialogOpButtons()}
|
||||||
|
moreBtn={{ datas: editorDialogRightMenu }}
|
||||||
|
>
|
||||||
|
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@x4akor`} center={false} form={groupInfoFrom} formFields={groupInfoFromFields} menu={editorDialogRightMenu} />
|
||||||
|
</WeaDialog>
|
||||||
|
{/* 新增类型 */}
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@etbstc`}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
style={{ width: 440, height: 70 }}
|
||||||
|
title={editTypeInfo.title}
|
||||||
|
visible={editTypeInfo.visible}
|
||||||
|
onCancel={() => setDialogVisible('editTypeInfo', false)}
|
||||||
|
buttons={getDialogOpButtons()}
|
||||||
|
moreBtn={{ datas: editorDialogRightMenu }}
|
||||||
|
>
|
||||||
|
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@x4akor`} center={false} form={typeInfoFrom} formFields={typeInfoFromFields} menu={editorDialogRightMenu} />
|
||||||
|
</WeaDialog>
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@hxqf4v`}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
style={{ width: 620, height: 450 }}
|
||||||
|
title={groupInfoSetting.title}
|
||||||
|
visible={groupInfoSetting.visible}
|
||||||
|
onCancel={() => setDialogVisible('groupInfoSetting', false, '')}
|
||||||
|
buttons={getDialogOpButtons()}
|
||||||
|
moreBtn={{ datas: editorDialogRightMenu }}
|
||||||
|
>
|
||||||
|
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@u3ghz1`} datas={editorDialogRightMenu}>
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@9x9otf`}
|
||||||
|
ref={(editTable) => setEditTable(editTable, 'groupSetting')}
|
||||||
|
tableProps={{ scroll: { y: 360 } }}
|
||||||
|
{...tableEditConfig['groupSetting']} />
|
||||||
|
</WeaRightMenu>
|
||||||
|
</WeaDialog>
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@dirux3`}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
style={{ width: 440, height: createChildInfo.height }}
|
||||||
|
title={createChildInfo.title}
|
||||||
|
visible={createChildInfo.visible}
|
||||||
|
onCancel={() => setDialogVisible('createChildInfo', false)}
|
||||||
|
buttons={getDialogOpButtons()}
|
||||||
|
moreBtn={{ datas: editorDialogRightMenu }}
|
||||||
|
>
|
||||||
|
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@mypkxi`} center={false} form={childInfoForm} formFields={childInfoFormFields} menu={editorDialogRightMenu} />
|
||||||
|
</WeaDialog>
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@k8ta6q`}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
style={{ width: 620, height: 450 }}
|
||||||
|
title={childInfoSetting.title}
|
||||||
|
visible={childInfoSetting.visible}
|
||||||
|
onCancel={() => setDialogVisible('childInfoSetting', false, '')}
|
||||||
|
buttons={getDialogOpButtons()}
|
||||||
|
moreBtn={{ datas: editorDialogRightMenu }}
|
||||||
|
>
|
||||||
|
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@i9bjcx`} datas={editorDialogRightMenu}>
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@mma0l9`}
|
||||||
|
ref={(editTable) => setEditTable(editTable, 'childInfoSetting')}
|
||||||
|
tableProps={{ scroll: { y: 360 } }}
|
||||||
|
{...tableEditConfig['childInfoSetting']} />
|
||||||
|
</WeaRightMenu>
|
||||||
|
</WeaDialog>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
import '../../style/index.less';
|
||||||
|
import React, {
|
||||||
|
Component
|
||||||
|
} from 'react';
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaAlertPage,
|
||||||
|
WeaLeftTree,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaDropdown
|
||||||
|
} from 'ecCom';
|
||||||
|
import { Spin } from 'antd';
|
||||||
|
import Tabs from './Tabs';
|
||||||
|
import FieldDef from './FieldDef';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
const { ButtonSelect } = WeaDropdown;
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
@inject('fieldDefined')
|
||||||
|
@observer
|
||||||
|
export default class FieldDefined extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
logSmallType: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init(this.props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init(nextProps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init = (props) => {
|
||||||
|
const {
|
||||||
|
fieldDefined: store,
|
||||||
|
params
|
||||||
|
} = props, {
|
||||||
|
checkAuthorized,
|
||||||
|
initData,
|
||||||
|
initResourceData
|
||||||
|
} = store, {
|
||||||
|
type: moduleType
|
||||||
|
} = params
|
||||||
|
let moduleName, logSmallType;
|
||||||
|
if (moduleType === 'subCompany') {
|
||||||
|
moduleName = 'subcompanyfielddefined';
|
||||||
|
} else if (moduleType === 'department') {
|
||||||
|
moduleName = 'departmentfielddefined';
|
||||||
|
} else if(moduleType === 'job') {
|
||||||
|
moduleName = 'jobfielddefined';
|
||||||
|
}else {
|
||||||
|
moduleName = 'resourcefielddefined';
|
||||||
|
}
|
||||||
|
// let callbackFunc = () => initData(false, true, moduleName);
|
||||||
|
// if (moduleType === 'resource')
|
||||||
|
//let callbackFunc = () => initResourceData(moduleName);
|
||||||
|
//checkAuthorized(moduleName, null, callbackFunc);
|
||||||
|
initResourceData(moduleName);
|
||||||
|
this.setState({ logSmallType })
|
||||||
|
}
|
||||||
|
|
||||||
|
tabChangeHandle = (key) => {
|
||||||
|
const {
|
||||||
|
fieldDefined: store
|
||||||
|
} = this.props, {
|
||||||
|
tabConfig
|
||||||
|
} = store;
|
||||||
|
store.setActiveTab(tabConfig, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
fieldDefined: store,
|
||||||
|
params
|
||||||
|
} = this.props, {
|
||||||
|
//containerInitFinished,//权限验证
|
||||||
|
refreshMainTabComponent,
|
||||||
|
spinning,
|
||||||
|
hasRight
|
||||||
|
} = store, {
|
||||||
|
type: moduleType
|
||||||
|
} = params, {
|
||||||
|
tabConfig,
|
||||||
|
btnsAndMenus,
|
||||||
|
formTarget,
|
||||||
|
activeTabInfo,
|
||||||
|
treeConfig,
|
||||||
|
refreshTree,
|
||||||
|
selectedTreeNodeInfo,
|
||||||
|
dropdownProps,
|
||||||
|
feildDefRemoveable
|
||||||
|
} = store, {
|
||||||
|
btns,
|
||||||
|
menus,
|
||||||
|
tabBtnDef
|
||||||
|
} = btnsAndMenus(tabConfig), {
|
||||||
|
conditionForm: form,
|
||||||
|
conditionFormFields: fields,
|
||||||
|
} = formTarget, tabProps = {
|
||||||
|
tabConfig: tabConfig,
|
||||||
|
tabChangeHandle: this.tabChangeHandle,
|
||||||
|
activeTabInfo,
|
||||||
|
rightMenu: menus,
|
||||||
|
store: store,
|
||||||
|
conditionForm: form,
|
||||||
|
conditionFormFields: fields,
|
||||||
|
tabBtnDef: [
|
||||||
|
...tabBtnDef,
|
||||||
|
<ButtonSelect ecId={`${this && this.props && this.props.ecId || ''}_ButtonSelect@qbn2pl`}
|
||||||
|
{...dropdownProps()}
|
||||||
|
btnProps={{
|
||||||
|
style: { padding: 0, background: 'transparent', border: 'none', color: feildDefRemoveable ? '#dadada' : '#34A2FF', fontSize: 20, marginTop: 2 },
|
||||||
|
disabled: feildDefRemoveable,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
]
|
||||||
|
}, title = moduleType === 'subCompany' ? i18n.module.subCompanyFieldDef() : moduleType === 'department' ? i18n.module.departmentFieldDef() : moduleType === 'job' ? i18n.module.jobFieldDef() : i18n.module.resourceFieldDef(),
|
||||||
|
topProps = {
|
||||||
|
title,
|
||||||
|
icon: <i className='icon-coms-hrm' />,
|
||||||
|
iconBgcolor: '#217346',
|
||||||
|
showDropIcon: true,
|
||||||
|
buttons: btns,
|
||||||
|
dropMenuDatas: menus
|
||||||
|
};
|
||||||
|
let logType;
|
||||||
|
let children = [];
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
onSelectedTreeNode,
|
||||||
|
selectedKeys,
|
||||||
|
onExpand,
|
||||||
|
treeExpandKeys
|
||||||
|
} = store.toJS(treeConfig);
|
||||||
|
const treeCom = (
|
||||||
|
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
|
||||||
|
datas={data}
|
||||||
|
onSelect={onSelectedTreeNode}
|
||||||
|
selectedKeys={selectedKeys}
|
||||||
|
onExpand={onExpand}
|
||||||
|
expandedKeys={treeExpandKeys} />
|
||||||
|
)
|
||||||
|
children = [
|
||||||
|
(
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@hwytf7`} spinning={spinning}>
|
||||||
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@rdv0wt`} {...topProps}>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
|
||||||
|
{
|
||||||
|
<Tabs ecId={`${this && this.props && this.props.ecId || ''}_Tabs@4k4wsi`} {...tabProps}>
|
||||||
|
<FieldDef ecId={`${this && this.props && this.props.ecId || ''}_FieldDef@pliw94`} logSmallType={logType || this.state.logSmallType} targetId={activeTabInfo.tabInfo ? activeTabInfo.tabInfo.groupid : ''} resetClass={true} />
|
||||||
|
</Tabs>
|
||||||
|
}
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</WeaTop>
|
||||||
|
</Spin>
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <div className="hrm_module_container fieldDef">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
import React, {
|
||||||
|
Component
|
||||||
|
} from 'react';
|
||||||
|
import {
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
Button
|
||||||
|
} from 'antd';
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaCheckbox
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx';
|
||||||
|
import findIndex from 'lodash/findIndex';
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class FormInfo extends Component {
|
||||||
|
renderForm = () => {
|
||||||
|
const {
|
||||||
|
formFields,
|
||||||
|
form,
|
||||||
|
colCount,
|
||||||
|
itemRender,
|
||||||
|
onSelectedChangeHandle,
|
||||||
|
showLabel,
|
||||||
|
multiColumn,
|
||||||
|
custLabelCol,
|
||||||
|
childrenComponents,
|
||||||
|
onSwitchChange,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let groupArr = [];
|
||||||
|
const formParams = form.getFormParams();
|
||||||
|
const labelVisible = showLabel == null || showLabel == true;
|
||||||
|
const col = colCount ? colCount : 1;
|
||||||
|
const labelCol = labelVisible ? (custLabelCol || `${window.HrmEngineLabelCol}`) : 0;
|
||||||
|
const itemProps = {
|
||||||
|
ratio1to2: labelVisible && custLabelCol == null,
|
||||||
|
style: {
|
||||||
|
marginLeft: 0 //labelVisible ? -30 : 0
|
||||||
|
},
|
||||||
|
tipPosition: 'bottom',
|
||||||
|
labelCol: {
|
||||||
|
span: labelCol
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
span: 24 - labelCol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const textAreaProps = {
|
||||||
|
minRows: 4,
|
||||||
|
maxRows: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
formFields.map((fields, i) => {
|
||||||
|
let formItems = [];
|
||||||
|
fields.items.map((field, index) => {
|
||||||
|
const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null;
|
||||||
|
const showCheckbox = field.checkbox || false;
|
||||||
|
let label = field.label;
|
||||||
|
if (showCheckbox)
|
||||||
|
label = <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@1id63c@${index}`} content={label} value={field.checkboxValue} onChange={(v) => {field.checkboxValue = v === '1'; onSelectedChangeHandle && onSelectedChangeHandle(field, v)}}/>
|
||||||
|
|
||||||
|
let coms;
|
||||||
|
if (customerRender == null) {
|
||||||
|
coms = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7zfwo9@${index}`} fieldConfig={{...field, ...textAreaProps, hasBorder: field.viewAttr === 1}} form={form} formParams={formParams} onChange={datas => onSwitchChange && onSwitchChange(datas)}/>;
|
||||||
|
} else {
|
||||||
|
coms = customerRender(field, textAreaProps, form, formParams);
|
||||||
|
}
|
||||||
|
Object.assign(itemProps, {
|
||||||
|
label,
|
||||||
|
error: form.getError(field)
|
||||||
|
})
|
||||||
|
let col = 1;
|
||||||
|
if (multiColumn != null) { //检查有哪些字段需要一行显示多个
|
||||||
|
const idx = findIndex(multiColumn, item => item.key === field.domkey[0]);
|
||||||
|
if (idx > -1) {
|
||||||
|
col = field.colSpan || 1;
|
||||||
|
if (multiColumn[idx].labelCol != null) //检查字段是否有配置标题宽度
|
||||||
|
Object.assign(itemProps, {
|
||||||
|
labelCol: {
|
||||||
|
span: multiColumn[idx].labelCol
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
span: 24 - multiColumn[idx].labelCol
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Object.assign(itemProps, {
|
||||||
|
labelCol: {
|
||||||
|
span: labelCol
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
span: 24 - labelCol
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
coms != null && formItems.push({
|
||||||
|
com: (
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@rv2s0m@${index}`} {...itemProps}>
|
||||||
|
{coms}
|
||||||
|
</WeaFormItem>
|
||||||
|
),
|
||||||
|
col
|
||||||
|
})
|
||||||
|
|
||||||
|
if (childrenComponents && childrenComponents[field.domkey[0]]) {
|
||||||
|
childrenComponents[field.domkey[0]]().map(child => formItems.push(child));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
groupArr.push(
|
||||||
|
(
|
||||||
|
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@zglygj@${i}`}
|
||||||
|
center={this.props.center != null ? this.props.center : true}
|
||||||
|
needTigger={true}
|
||||||
|
title={formFields.length < 2 ? null : fields.title}
|
||||||
|
showGroup={true}
|
||||||
|
items={formItems}
|
||||||
|
col={col}
|
||||||
|
fontSize={14}/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
return groupArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
formFields,
|
||||||
|
className,
|
||||||
|
showError
|
||||||
|
} = this.props;
|
||||||
|
if (formFields == null)
|
||||||
|
return (<div></div>)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
{this.renderForm()}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,220 @@
|
||||||
|
import React, {
|
||||||
|
Component
|
||||||
|
} from 'react';
|
||||||
|
import {
|
||||||
|
WeaTab
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
Button
|
||||||
|
} from 'antd';
|
||||||
|
import AdvanceSearchFormInfo from './AdvanceSearchFormInfo';
|
||||||
|
import {
|
||||||
|
cloneDeep
|
||||||
|
} from 'lodash';
|
||||||
|
import {
|
||||||
|
calFormHeight
|
||||||
|
} from '../../util/index';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class Tabs extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
showSearchAd: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
doSearch = () => {
|
||||||
|
const {
|
||||||
|
conditionForm,
|
||||||
|
tabConfig,
|
||||||
|
activeTabInfo,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let tabInfo = tabConfig.tabs[activeTabInfo.activeTabIndex];
|
||||||
|
tabInfo.doSearch(conditionForm.getFormParams());
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
doReset = () => {
|
||||||
|
const {
|
||||||
|
conditionForm
|
||||||
|
} = this.props;
|
||||||
|
conditionForm.resetConditionValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
doCancel = () => {
|
||||||
|
const {
|
||||||
|
conditionForm
|
||||||
|
} = this.props;
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabButtonsAd() {
|
||||||
|
return [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@xygary`} type="primary" onClick={this.doSearch}>{i18n.button.search()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5l4fsp`} type="ghost" onClick={this.doReset}>{i18n.button.reset()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@yktxms`} type="ghost" onClick={this.doCancel}>{i18n.button.cancel()}</Button>)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
renderForm = () => {
|
||||||
|
const {
|
||||||
|
conditionForm,
|
||||||
|
conditionFormFields,
|
||||||
|
itemRender
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isFormInit
|
||||||
|
} = conditionForm;
|
||||||
|
if (isFormInit)
|
||||||
|
return <AdvanceSearchFormInfo ecId={`${this && this.props && this.props.ecId || ''}_AdvanceSearchFormInfo@5us8i8`} form={conditionForm} formFields={conditionFormFields} itemRender={itemRender}/>
|
||||||
|
else
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
initTab = (props) => {
|
||||||
|
return React.cloneElement(<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@3x9y9h`}/>, {
|
||||||
|
...props
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTabNav = () => {
|
||||||
|
//data
|
||||||
|
const {
|
||||||
|
activeTabInfo,
|
||||||
|
tabConfig,
|
||||||
|
tabChangeHandle,
|
||||||
|
tabBtnDef,
|
||||||
|
conditionForm,
|
||||||
|
conditionFormFields,
|
||||||
|
advanceHeight,
|
||||||
|
store,
|
||||||
|
leftStyle,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let tabInfo = tabConfig.tabs[activeTabInfo.activeTabIndex];
|
||||||
|
let tabsData = cloneDeep(tabConfig.tabs) || [];
|
||||||
|
tabsData != null && tabsData.map(tab => {
|
||||||
|
if (typeof(tab.title) == 'function'){
|
||||||
|
tab.title = tab.title();
|
||||||
|
}
|
||||||
|
delete tab.topButtonDef;
|
||||||
|
delete tab.tabButtonDef;
|
||||||
|
});
|
||||||
|
let tabProps = {
|
||||||
|
type: 'editable-inline',
|
||||||
|
datas: tabsData,
|
||||||
|
keyParam: tabConfig.keyParam,
|
||||||
|
selectedKey: tabConfig.activeTabKey,
|
||||||
|
onChange: tabChangeHandle,
|
||||||
|
leftStyle
|
||||||
|
}
|
||||||
|
tabBtnDef && Object.assign(tabProps, {
|
||||||
|
buttons: tabBtnDef
|
||||||
|
});
|
||||||
|
const searchType = tabInfo.searchType || [];
|
||||||
|
if (searchType.length > 0) {
|
||||||
|
Object.assign(tabProps, {
|
||||||
|
searchType: searchType,
|
||||||
|
onSearch: (value) => {
|
||||||
|
if (searchType.indexOf('advanced') >= 0) {
|
||||||
|
tabInfo.doSearch(conditionForm.getFormParams());
|
||||||
|
} else {
|
||||||
|
tabInfo.doSearch({
|
||||||
|
[tabInfo.searchKey]: value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (searchType.indexOf('advanced') >= 0 && conditionForm != null && conditionForm.isFormInit) {
|
||||||
|
const formParams = conditionForm.getFormParams();
|
||||||
|
Object.assign(tabProps, {
|
||||||
|
searchsBaseValue: formParams[tabInfo.searchKey] || '',
|
||||||
|
showSearchAd: this.state.showSearchAd,
|
||||||
|
setShowSearchAd: (bool) => {
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: bool
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSearchChange: (value) => conditionForm.updateFields({
|
||||||
|
[tabInfo.searchKey]: {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}, false),
|
||||||
|
buttonsAd: this.getTabButtonsAd(),
|
||||||
|
searchsAd: <div
|
||||||
|
onKeyDown={(e) =>{
|
||||||
|
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||||
|
tabInfo.doSearch(conditionForm.getFormParams());
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
>{this.renderForm()}</div>
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.assign(tabProps, {
|
||||||
|
//advanceHeight: calFormHeight(conditionFormFields.length, _.keys(formParams).length)
|
||||||
|
advanceHeight: advanceHeight ? advanceHeight : calFormHeight(conditionFormFields.length, conditionForm.fieldArr)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tabConfig.onTabEdit && Object.assign(tabProps, {
|
||||||
|
onEdit: tabConfig.onTabEdit
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.initTab(tabProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTabContent = () => {
|
||||||
|
const {
|
||||||
|
children,
|
||||||
|
activeTabInfo,
|
||||||
|
rightMenu,
|
||||||
|
store
|
||||||
|
} = this.props;
|
||||||
|
if (Array.isArray(children)) {
|
||||||
|
return React.cloneElement(children[activeTabInfo.activeTabIndex], {
|
||||||
|
rightMenu,
|
||||||
|
activeTabIndex: activeTabInfo.activeTabIndex,
|
||||||
|
store
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return React.cloneElement(children, {
|
||||||
|
rightMenu,
|
||||||
|
activeTabIndex: activeTabInfo.activeTabIndex,
|
||||||
|
store
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
tabConfig
|
||||||
|
} = this.props;
|
||||||
|
return (
|
||||||
|
<div style={{width: '100%', height: '100%'}}>
|
||||||
|
{tabConfig.tabs.length > 0 && this.renderTabNav()}
|
||||||
|
{tabConfig.tabs.length > 0 && this.renderTabContent()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {WeaLocaleProvider} from 'ecCom';
|
||||||
|
|
||||||
|
const {getLabel} = WeaLocaleProvider;
|
||||||
|
|
||||||
|
export default class Tip extends Component{
|
||||||
|
render(){
|
||||||
|
const label = this.props.label || getLabel('524355','提示: 字段一旦加密后无法取消,同时加密后的字段不支持查询,请谨慎操作!');
|
||||||
|
return (
|
||||||
|
<div className={'data_security_tip_info' || this.props.className}><i className="icon-coms-Invalid" />{label}</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {observer} from 'mobx-react';
|
||||||
|
import { WeaAuth } from "ecCom";
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class ViewRangeForm extends Component{
|
||||||
|
render(){
|
||||||
|
const {store} = this.props;
|
||||||
|
const {viewRangeAuthProps} = store;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaAuth ecId={`${this && this.props && this.props.ecId || ''}_WeaAuth@xuisnk`} {...viewRangeAuthProps}>
|
||||||
|
</WeaAuth>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {observer} from 'mobx-react';
|
||||||
|
import { WeaDialog, WeaTab } from "ecCom";
|
||||||
|
import {WeaTableNew} from "comsMobx";
|
||||||
|
|
||||||
|
const {WeaTable} = WeaTableNew;
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class ViewRangeSetting extends Component{
|
||||||
|
render(){
|
||||||
|
const {store} = this.props;
|
||||||
|
const {dialogProps, rangeViewTabProps, rangeViewTableProps} = store;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@hsilps`} {...dialogProps}>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@36lgpj`} {...rangeViewTabProps} />
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@fjlkzk`} {...rangeViewTableProps} />
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
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';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
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, date, hasRight,loading
|
||||||
|
} = group;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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'>
|
||||||
|
{
|
||||||
|
loading ? <div className='organization-group-loading'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||||
|
</div> : 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)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,345 @@
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaUpload,
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSelect,
|
||||||
|
WeaInput,
|
||||||
|
WeaAlertPage,
|
||||||
|
WeaLocaleProvider
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Button,
|
||||||
|
Spin
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
import { addContentPath, renderNoright } from '../../util/index.js'
|
||||||
|
import '../../style/common.less'
|
||||||
|
const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
|
@inject('datasImport')
|
||||||
|
@inject('resource')
|
||||||
|
@observer
|
||||||
|
export default class DatasImport extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
datasImport.list = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCircle() {
|
||||||
|
let style = {
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
backgroundColor: '#D8D8D8',
|
||||||
|
webkitBorderRadius: 10,
|
||||||
|
mozBorderRadius: 10,
|
||||||
|
msBorderRadius: 10,
|
||||||
|
oBorderRadius: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
//paddingLeft: 6,
|
||||||
|
textAlign: 'center',
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
condition
|
||||||
|
} = datasImport;
|
||||||
|
let _arr = [];
|
||||||
|
|
||||||
|
condition.map((c, i) => {
|
||||||
|
let arr = [];
|
||||||
|
if (i == 0) { //基本信息
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m9t2kn@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@rc5who@${index}`} span={1} offset={4}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}><div style={{ paddingTop: 2 }}>{index + 1}</div></div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@f1sc6s@${index}`} span={14}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@5gsx6o@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@qrdxst@${index}`} span={field.labelcol} style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }} title={field.label}>{field.label}:</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7jy5um@${index}`} span={field.fieldcol}>
|
||||||
|
{this.getDom(field)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (i == 1) { //导入说明
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}>
|
||||||
|
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||||
|
{this.getIllustration(field.value, field.link, index, field)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||||
|
|
||||||
|
});
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDom(field) {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
templetName,
|
||||||
|
filelist,
|
||||||
|
getTemplateUrl,
|
||||||
|
importParams
|
||||||
|
} = datasImport;
|
||||||
|
let dom;
|
||||||
|
let domkey = field.domkey;
|
||||||
|
if (domkey[0] == 'templet') {
|
||||||
|
dom = <a href={addContentPath(field.value)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
} else if (domkey[0] === 'exportData') {
|
||||||
|
const href = datasImport.operateType === 'add' ? field.otherParams.fileVal[0].add : field.otherParams.fileVal[0].update;
|
||||||
|
if (datasImport.importType === 'matrix') {
|
||||||
|
dom = <a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType, importParams) }}>{i18n.label.importTemplate()}</a>
|
||||||
|
} else
|
||||||
|
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
} else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
|
||||||
|
dom = (<div>
|
||||||
|
<div style={{ float: 'left', marginTop: -10 }}>
|
||||||
|
<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@iu8n01`}
|
||||||
|
uploadUrl='/api/doc/upload/uploadFile'
|
||||||
|
category='string'
|
||||||
|
limitType='xls,xlsx'
|
||||||
|
maxFilesNumber={1}
|
||||||
|
datas={filelist}
|
||||||
|
{...field.otherParams}
|
||||||
|
onChange={
|
||||||
|
(ids, list) => {
|
||||||
|
this.setFileId(ids, list)
|
||||||
|
}
|
||||||
|
} >
|
||||||
|
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@87232v`}>{i18n.button.selectFile()}</Button>
|
||||||
|
</WeaUpload>
|
||||||
|
</div>
|
||||||
|
<div style={{ float: 'left', paddingLeft: 10 }}>
|
||||||
|
{filelist.length == 0 ? <p>{i18n.label.noFileSelected()}</p> : filelist.map(file => <p>{file.filename}</p>)}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
} else if (domkey[0].indexOf('keyField') > -1) {
|
||||||
|
const vals = field.options.filter(v => v.selected == true);
|
||||||
|
let val = '';
|
||||||
|
vals.length > 0 && (val = vals[0].key);
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@yzc92h`}
|
||||||
|
style={{ width: 200 }}
|
||||||
|
options={field.options}
|
||||||
|
value={datasImport.importParams[domkey[0]] || field.value || val}
|
||||||
|
onChange={(v) => { datasImport.setParam(domkey[0], v) }}
|
||||||
|
/>
|
||||||
|
} else if (domkey[0] == 'importType') {
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@holhhb`}
|
||||||
|
style={{ width: 200 }}
|
||||||
|
options={field.options}
|
||||||
|
value={datasImport.operateType}
|
||||||
|
onChange={(v) => { datasImport.operateType = v }}
|
||||||
|
/>
|
||||||
|
} else {
|
||||||
|
dom = <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@rg6f3p`} hasBorder={true} viewAttr={1} value={field.value} />
|
||||||
|
}
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIllustration(val, url, index, link) {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
templetName,
|
||||||
|
getTemplateUrl,
|
||||||
|
importParams
|
||||||
|
} = datasImport;
|
||||||
|
let p;
|
||||||
|
if (index == 0) {
|
||||||
|
if (url instanceof Object) {
|
||||||
|
const href = datasImport.operateType === 'add' ? url.add : url.update;
|
||||||
|
let dom;
|
||||||
|
if (datasImport.importType === 'matrix') {
|
||||||
|
dom = <a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType, importParams) }}>{i18n.label.importTemplate()}</a>
|
||||||
|
} else
|
||||||
|
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:{dom}</p>);
|
||||||
|
} else if (url != null) {
|
||||||
|
if (datasImport.importType === 'matrix') {
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:<a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType) }}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
} else
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:<a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFileId(ids, list) {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
datasImport.excelfile = ids;
|
||||||
|
datasImport.filelist = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUploading(s) {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
datasImport.status = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
const {
|
||||||
|
datasImport,
|
||||||
|
resource
|
||||||
|
} = this.props;
|
||||||
|
datasImport.saveImport({}, () => {
|
||||||
|
this.refs.scroll && this.refs.scroll.scrollToLast();
|
||||||
|
});
|
||||||
|
|
||||||
|
// resource.getTableInfo();
|
||||||
|
// resource.getHasRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
const {
|
||||||
|
datasImport,
|
||||||
|
onClose
|
||||||
|
} = this.props;
|
||||||
|
datasImport.visible = false
|
||||||
|
datasImport.init();
|
||||||
|
onClose && onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
importHistoryQuery() {
|
||||||
|
const {
|
||||||
|
datasImport
|
||||||
|
} = this.props;
|
||||||
|
datasImport.visibleHistory = true;
|
||||||
|
datasImport.getImportHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
datasImport,
|
||||||
|
mainTitle,
|
||||||
|
importLog,
|
||||||
|
viewLog,
|
||||||
|
viewLogTitle,
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
titleResult,
|
||||||
|
visibleResult,
|
||||||
|
importResultColumns,
|
||||||
|
importProcessLogDatas,
|
||||||
|
failnum,
|
||||||
|
succnum,
|
||||||
|
importResultTip,
|
||||||
|
importResultStore,
|
||||||
|
importStatus,
|
||||||
|
errorInfo,
|
||||||
|
setScrollRef,
|
||||||
|
single,
|
||||||
|
showLoadingSpin,
|
||||||
|
condition
|
||||||
|
} = datasImport;
|
||||||
|
const buttons = condition.length ? [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ip7b32`} type="primary" onClick={() => this.submit()}>{i18n.button.submit()}</Button>),
|
||||||
|
] : [];
|
||||||
|
|
||||||
|
let dialogHeight = window.innerHeight - 150;
|
||||||
|
if (dialogHeight > 560) dialogHeight = 560;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@s55z5q`}
|
||||||
|
title={mainTitle || title}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
onCancel={() => this.cancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: 870, height: dialogHeight }}
|
||||||
|
moreBtn={{
|
||||||
|
datas: condition ? [{
|
||||||
|
key: '1',
|
||||||
|
content: i18n.button.submit(),
|
||||||
|
icon: <i className='icon-coms-Preservation' />,
|
||||||
|
onClick: () => this.submit(),
|
||||||
|
}] : []
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{condition.length ? (
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@1fvd3j`} spinning={showLoadingSpin}>
|
||||||
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} height={dialogHeight} ref="scrollBar">
|
||||||
|
{this.getForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
</Spin>
|
||||||
|
) : <div></div>
|
||||||
|
}
|
||||||
|
</WeaDialog>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,204 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
toJS
|
||||||
|
} from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaAlertPage,
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
} from 'antd';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
import ImportResource from '../importresource/Import';
|
||||||
|
//import Import from '../importRelatedComponet/index'
|
||||||
|
import {addContentPath} from '../../util/index.js'
|
||||||
|
import '../../style/import.css'
|
||||||
|
|
||||||
|
@inject('hrmBasicDataImport')
|
||||||
|
@inject('hrmImportResource')
|
||||||
|
@inject('hrmImportCommon')
|
||||||
|
@observer
|
||||||
|
export default class BasicInfoImport extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
let bool = window.location.href.indexOf('/spa/hrm/engine.html') > -1;
|
||||||
|
if (bool) {
|
||||||
|
document.title = i18n.module.basicInfoImport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
hrmBasicDataImport
|
||||||
|
} = this.props, {
|
||||||
|
getRight
|
||||||
|
} = hrmBasicDataImport;
|
||||||
|
|
||||||
|
getRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
getImportCard = () => {
|
||||||
|
const {
|
||||||
|
hrmBasicDataImport
|
||||||
|
} = this.props, {
|
||||||
|
isMouseOver,
|
||||||
|
curIndex,
|
||||||
|
cardConfig,
|
||||||
|
setMouseStatus,
|
||||||
|
} = hrmBasicDataImport;
|
||||||
|
|
||||||
|
let arr = [];
|
||||||
|
|
||||||
|
cardConfig.map((c, index) => {
|
||||||
|
arr.push(<div className='hrm-card-out' style={(index == 0 || index == 4) ? {marginLeft:0} : {}} onMouseEnter={() => setMouseStatus(index, true)} onMouseLeave={() => setMouseStatus(index, false)}>
|
||||||
|
<div className='hrm-card-inwrap' style={curIndex==index&&isMouseOver?{backgroundColor:'#858585'}:{backgroundColor:c.bgColor}}>
|
||||||
|
{ curIndex == index && isMouseOver ? this.getLinkName(c.linkName,index) : this.getIcon(c.icon)}
|
||||||
|
{ curIndex == index && isMouseOver ? this.getSubTitle(c.subTitle,c.url) : this.getTitle(c.title)}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
});
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIcon = (icon) => {
|
||||||
|
return (<div className='hrm-card-icon'>
|
||||||
|
<i className={icon} />
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle = (title) => {
|
||||||
|
return (<div className='hrm-card-title'>{title}</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getLinkName = (linkName, index) => {
|
||||||
|
return (<div style={{width:'100%',height:95}}>
|
||||||
|
<div style={{textAlign:'center',paddingTop:45}}>
|
||||||
|
<a onClick={()=>this.handleClick(index)} style={{color:'#fff',textDecoration: 'underline',fontSize:15}}>{linkName}</a>
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getSubTitle = (subTitle, url) => {
|
||||||
|
return (<div style={{height:35,textAlign:'right',paddingRight:10,backgroundColor:'#6A6A6A',color: '#fff',paddingTop:5}}><a href={addContentPath(url)} target='_blank' className='hrm-import-link'>{subTitle}</a></div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick = (index) => {
|
||||||
|
const {
|
||||||
|
hrmImportResource,
|
||||||
|
hrmImportCommon,
|
||||||
|
} = this.props, {
|
||||||
|
setTempletName,
|
||||||
|
setImportDialogTitle,
|
||||||
|
setImportType,
|
||||||
|
setImportDialogVisible
|
||||||
|
} = hrmImportCommon;
|
||||||
|
|
||||||
|
switch (index) {
|
||||||
|
case 0: //@lvyi
|
||||||
|
hrmImportResource.visible = true;
|
||||||
|
hrmImportResource.title = i18n.button.importOrg();
|
||||||
|
hrmImportResource.importType = 'company';
|
||||||
|
hrmImportResource.getImportForm();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.postSystemImport());
|
||||||
|
setImportType('jobtitle');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
case 2: //@lvyi
|
||||||
|
hrmImportResource.visible = true;
|
||||||
|
hrmImportResource.title = i18n.button.importResource();
|
||||||
|
hrmImportResource.importType = 'resource';
|
||||||
|
hrmImportResource.getImportForm();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.groupInfoImport());
|
||||||
|
setImportType('group');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.personalAndWorkInfoImport());
|
||||||
|
setImportType('resourcedetial');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.areaInfoImport());
|
||||||
|
setImportType('area');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.workingPlaceImport());
|
||||||
|
setImportType('location');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
setTempletName(i18n.label.importTemplate());
|
||||||
|
setImportDialogTitle(i18n.button.majorImport());
|
||||||
|
setImportType('special');
|
||||||
|
setImportDialogVisible(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
hrmBasicDataImport,
|
||||||
|
hrmImportResource,
|
||||||
|
hrmImportCommon,
|
||||||
|
} = this.props, {
|
||||||
|
title,
|
||||||
|
isMouseOver,
|
||||||
|
loading,
|
||||||
|
authorized,
|
||||||
|
} = hrmBasicDataImport;
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
return (
|
||||||
|
<div style={{height: '100%'}}>
|
||||||
|
{loading ? <div className='hrm-loading-center'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@976rc9`} spinning={loading} size='large'></Spin>
|
||||||
|
</div>
|
||||||
|
: <div className="hrm-wea-alert-page">
|
||||||
|
<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@0t0ln7`}>
|
||||||
|
<div style={{ color: '#000' }}>
|
||||||
|
{i18n.message.authFailed()}
|
||||||
|
</div>
|
||||||
|
</WeaAlertPage>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@sp0zb8`}
|
||||||
|
title={title}
|
||||||
|
icon={<i className='icon-coms-hrm'/>}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
showDropIcon={true}
|
||||||
|
>
|
||||||
|
<div className='hrm-import-wrap'>{this.getImportCard()}</div>
|
||||||
|
{hrmImportResource.visible && <ImportResource ecId={`${this && this.props && this.props.ecId || ''}_ImportResource@633i8k`} />}
|
||||||
|
{/*其它导入暂时未实现 {hrmImportCommon.importDialog.visible && <Import ecId={`${this && this.props && this.props.ecId || ''}_Import@6c06u8`} />} */}
|
||||||
|
</WeaTop>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,353 @@
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaUpload,
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSelect,
|
||||||
|
WeaInput
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Button,
|
||||||
|
Spin
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
import React from 'react'
|
||||||
|
import ImportResult from './ImportResult'
|
||||||
|
import ImportHistory from './ImportHistory'
|
||||||
|
import {
|
||||||
|
WeaLocaleProvider
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
import {addContentPath} from '../../util/index.js'
|
||||||
|
import '../../style/common.less'
|
||||||
|
|
||||||
|
@inject('hrmImportResource')
|
||||||
|
@observer
|
||||||
|
export default class ImportResource extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.list = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCircle() {
|
||||||
|
let style = {
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
backgroundColor: '#D8D8D8',
|
||||||
|
webkitBorderRadius: 10,
|
||||||
|
mozBorderRadius: 10,
|
||||||
|
msBorderRadius: 10,
|
||||||
|
oBorderRadius: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
//paddingLeft: 6,
|
||||||
|
textAlign: 'center',
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
condition
|
||||||
|
} = hrmImportResource;
|
||||||
|
let _arr = [];
|
||||||
|
|
||||||
|
condition.map((c, i) => {
|
||||||
|
let arr = [];
|
||||||
|
if (i == 0) { //基本信息
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m9t2kn@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@rc5who@${index}`} span={1} offset={4}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}><div style={{ paddingTop: 2 }}>{index + 1}</div></div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@f1sc6s@${index}`} span={14}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@5gsx6o@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@qrdxst@${index}`} span={field.labelcol} style={{overflow: 'hidden',whiteSpace: 'nowrap',textOverflow: 'ellipsis'}} title={field.label}>{field.label}:</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7jy5um@${index}`} span={field.fieldcol}>
|
||||||
|
{this.getDom(field)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (i == 1) { //导入说明
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}>
|
||||||
|
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||||
|
{this.getIllustration(field.value, field.link, index, field)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||||
|
|
||||||
|
});
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDom(field) {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
templetName,
|
||||||
|
filelist,
|
||||||
|
getTemplateUrl,
|
||||||
|
importParams
|
||||||
|
} = hrmImportResource;
|
||||||
|
let dom;
|
||||||
|
let domkey = field.domkey;
|
||||||
|
if (domkey[0] == 'templet') {
|
||||||
|
dom = <a href={addContentPath(field.value)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
} else if (domkey[0] === 'exportData') {
|
||||||
|
const href = hrmImportResource.operateType === 'add' ? field.otherParams.fileVal[0].add : field.otherParams.fileVal[0].update;
|
||||||
|
if(hrmImportResource.importType === 'matrix'){
|
||||||
|
dom = <a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}</a>
|
||||||
|
}else
|
||||||
|
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
} else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
|
||||||
|
dom = (<div>
|
||||||
|
<div style={{ float: 'left', marginTop: -10 }}>
|
||||||
|
<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@iu8n01`}
|
||||||
|
uploadUrl='/api/doc/upload/uploadFile'
|
||||||
|
category='string'
|
||||||
|
limitType='xls,xlsx'
|
||||||
|
maxFilesNumber={1}
|
||||||
|
datas={filelist}
|
||||||
|
{...field.otherParams}
|
||||||
|
onChange = {
|
||||||
|
(ids, list) => {
|
||||||
|
this.setFileId(ids, list)
|
||||||
|
}
|
||||||
|
} >
|
||||||
|
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@87232v`}>{i18n.button.selectFile()}</Button>
|
||||||
|
</WeaUpload>
|
||||||
|
</div>
|
||||||
|
<div style={{ float: 'left', paddingLeft: 10 }}>
|
||||||
|
{filelist.length == 0 ? <p>{i18n.label.noFileSelected()}</p> : filelist.map(file => <p>{file.filename}</p>)}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
} else if (domkey[0].indexOf('keyField') > -1) {
|
||||||
|
const vals = field.options.filter(v => v.selected == true);
|
||||||
|
let val = '';
|
||||||
|
vals.length>0 && (val = vals[0].key);
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@yzc92h`}
|
||||||
|
style={{width: 200}}
|
||||||
|
options={field.options}
|
||||||
|
value={hrmImportResource.importParams[domkey[0]] || field.value || val}
|
||||||
|
onChange={(v) => { hrmImportResource.setParam(domkey[0], v)}}
|
||||||
|
/>
|
||||||
|
} else if (domkey[0] == 'importType') {
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@holhhb`}
|
||||||
|
style={{width: 200}}
|
||||||
|
options={field.options}
|
||||||
|
value={hrmImportResource.operateType}
|
||||||
|
onChange={(v) => { hrmImportResource.operateType = v }}
|
||||||
|
/>
|
||||||
|
} else {
|
||||||
|
dom = <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@rg6f3p`} hasBorder={true} viewAttr={1} value={field.value}/>
|
||||||
|
}
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIllustration(val, url, index, link) {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
templetName,
|
||||||
|
getTemplateUrl,
|
||||||
|
importParams
|
||||||
|
} = hrmImportResource;
|
||||||
|
let p;
|
||||||
|
if (index == 0) {
|
||||||
|
if (url instanceof Object) {
|
||||||
|
const href = hrmImportResource.operateType === 'add' ? url.add : url.update;
|
||||||
|
let dom;
|
||||||
|
if(hrmImportResource.importType === 'matrix'){
|
||||||
|
dom = <a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}</a>
|
||||||
|
}else
|
||||||
|
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:{dom}</p>);
|
||||||
|
} else if (url != null) {
|
||||||
|
if(hrmImportResource.importType === 'matrix'){
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:<a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType)}}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
}else
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}:<a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFileId(ids, list) {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.excelfile = ids;
|
||||||
|
hrmImportResource.filelist = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUploading(s) {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.status = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.saveImport({}, () => {
|
||||||
|
this.refs.scroll && this.refs.scroll.scrollToLast()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
const {
|
||||||
|
hrmImportResource,
|
||||||
|
onClose
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.visible = false
|
||||||
|
hrmImportResource.init();
|
||||||
|
onClose && onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
importHistoryQuery() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.visibleHistory = true;
|
||||||
|
hrmImportResource.getImportHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
hrmImportResource,
|
||||||
|
mainTitle,
|
||||||
|
importLog,
|
||||||
|
viewLog,
|
||||||
|
viewLogTitle,
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
titleResult,
|
||||||
|
visibleResult,
|
||||||
|
importResultColumns,
|
||||||
|
importProcessLogDatas,
|
||||||
|
failnum,
|
||||||
|
succnum,
|
||||||
|
importResultTip,
|
||||||
|
importResultStore,
|
||||||
|
importStatus,
|
||||||
|
errorInfo,
|
||||||
|
setScrollRef,
|
||||||
|
single,
|
||||||
|
showLoadingSpin,
|
||||||
|
condition
|
||||||
|
} = hrmImportResource;
|
||||||
|
const buttons = condition.length ? [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ip7b32`} type="primary" onClick={() => this.submit()}>{i18n.button.submit()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@itogxo`} type="primary" onClick={() => this.importHistoryQuery()}>{importLog || i18n.button.importHistoryQuery()}</Button>),
|
||||||
|
] : [];
|
||||||
|
|
||||||
|
let dialogHeight = window.innerHeight - 150;
|
||||||
|
if (dialogHeight > 560) dialogHeight = 560;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
single && visible ?
|
||||||
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@mkyv9k`} height={'100%'} ref="scrollBar">
|
||||||
|
{this.getForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
:
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@s55z5q`}
|
||||||
|
title={mainTitle || title}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
onCancel={() => this.cancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: 870, height: dialogHeight }}
|
||||||
|
moreBtn={{datas:condition ? [{
|
||||||
|
key: '1',
|
||||||
|
content: i18n.button.submit(),
|
||||||
|
icon: <i className='icon-coms-Preservation'/>,
|
||||||
|
onClick: () => this.submit(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2',
|
||||||
|
content: importLog || i18n.button.importHistoryQuery(),
|
||||||
|
icon: <i className='icon-coms-Preservation'/>,
|
||||||
|
onClick: () => this.importHistoryQuery(),
|
||||||
|
}
|
||||||
|
]: []}}
|
||||||
|
>
|
||||||
|
{ condition.length ? (
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@1fvd3j`} spinning={showLoadingSpin}>
|
||||||
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} height={dialogHeight} ref="scrollBar">
|
||||||
|
{this.getForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
</Spin>
|
||||||
|
): ''}
|
||||||
|
</WeaDialog>
|
||||||
|
}
|
||||||
|
|
||||||
|
<ImportResult ecId={`${this && this.props && this.props.ecId || ''}_ImportResult@66ry2w`} {...this.props} />
|
||||||
|
<ImportHistory ecId={`${this && this.props && this.props.ecId || ''}_ImportHistory@72i8fh`} {...this.props} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Modal,
|
||||||
|
Table,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx';
|
||||||
|
import ImportLog from './ImportLog'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
@inject('hrmImportResource')
|
||||||
|
@observer
|
||||||
|
class ImportHistory extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(c) {
|
||||||
|
let _this = this;
|
||||||
|
c.forEach(item => {
|
||||||
|
if (item.dataIndex == 'operator') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
return <span><a onClick={() => _this.jumpToHrmCard(record.operator)}>{record.operatorspan}</a></span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.dataIndex == 'allnum') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
return <span><a onClick={() => _this.jumpToImportResult(record.randomFieldId)}>{record.allnumspan}</a></span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
jumpToHrmCard(id) {
|
||||||
|
window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
jumpToImportResult(pId) {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.dialogKey = new Date().getTime();
|
||||||
|
hrmImportResource.visibleResult = true;
|
||||||
|
hrmImportResource.getImportResult({
|
||||||
|
pId,
|
||||||
|
importType: 'resource'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
queryImportLog() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
let params = {};
|
||||||
|
params.importType = 'resource';
|
||||||
|
hrmImportResource.pId = '';
|
||||||
|
hrmImportResource.getImportLogDetail(params);
|
||||||
|
hrmImportResource.getImportLogSearchCondition(params);
|
||||||
|
hrmImportResource.visibleImportLog = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.visibleHistory = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
hrmImportResource,
|
||||||
|
importLog,
|
||||||
|
viewLog,
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
titleHistory,
|
||||||
|
visibleHistory,
|
||||||
|
onCancel,
|
||||||
|
importHistoryStore
|
||||||
|
} = hrmImportResource;
|
||||||
|
const buttons = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@oowgk9`} type="primary" disabled={importHistoryStore.loading} onClick={() => this.queryImportLog()}>{viewLog || i18n.button.queryImportLog()}</Button>),
|
||||||
|
];
|
||||||
|
let dialogHeight = window.innerHeight - 150;
|
||||||
|
if (dialogHeight > 510) dialogHeight = 510;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ImportLog ecId={`${this && this.props && this.props.ecId || ''}_ImportLog@s3uk7x`} {...this.props} />
|
||||||
|
{visibleHistory &&
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@no8hhj`}
|
||||||
|
title={importLog || titleHistory()}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visibleHistory}
|
||||||
|
closable={true}
|
||||||
|
onCancel={() => this.cancel()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: 870, height: dialogHeight }}
|
||||||
|
moreBtn={{datas:[{
|
||||||
|
key: '1',
|
||||||
|
content: viewLog || i18n.button.queryImportLog(),
|
||||||
|
icon: <i className='icon-coms-Preservation'/>,
|
||||||
|
onClick: () => this.queryImportLog(),
|
||||||
|
}
|
||||||
|
]}}
|
||||||
|
>
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@6eke2r`}
|
||||||
|
comsWeaTableStore={importHistoryStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
scroll={{ y: dialogHeight - 80 }}
|
||||||
|
rowKey={(record, index) => index}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
</WeaDialog>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ImportHistory
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaTab,
|
||||||
|
WeaDialog,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaSearchGroup,
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
import * as mobx from 'mobx';
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
import {
|
||||||
|
WeaSwitch
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx';
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
@inject('hrmImportResource')
|
||||||
|
@observer
|
||||||
|
class ImportLog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getSearchs() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
searchCondition
|
||||||
|
} = hrmImportResource;
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFormInit
|
||||||
|
} = form;
|
||||||
|
let group = [];
|
||||||
|
|
||||||
|
const formParams = form.getFormParams();
|
||||||
|
isFormInit && toJS(searchCondition).map((c, i) => {
|
||||||
|
let items = [];
|
||||||
|
c.items.map((fields, index) => {
|
||||||
|
let hide = false;
|
||||||
|
let dom = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@irw1ly@${index}`} fieldConfig={fields} form={form} formParams={formParams}/>;
|
||||||
|
items.push({
|
||||||
|
com: (<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@3cqs16@${index}`}
|
||||||
|
label={`${fields.label}`}
|
||||||
|
labelCol={{span: `${fields.labelcol}`}}
|
||||||
|
wrapperCol={{span: `${fields.fieldcol}`}}>
|
||||||
|
{dom}
|
||||||
|
</WeaFormItem>),
|
||||||
|
colSpan: 1,
|
||||||
|
hide: hide
|
||||||
|
})
|
||||||
|
});
|
||||||
|
group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@8sj3te@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items}/>)
|
||||||
|
});
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
jumpToHrmCard(id) {
|
||||||
|
window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(c) {
|
||||||
|
let _this = this;
|
||||||
|
let status = "";
|
||||||
|
c.forEach(item => {
|
||||||
|
if (item.dataIndex == 'operator') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
return <span><a onClick={ () => _this.jumpToHrmCard(record.operator)}>{record.operatorspan}</a></span>
|
||||||
|
}
|
||||||
|
} else if (item.dataIndex == 'status') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
status = text;
|
||||||
|
return <span style={{ color: text=='1'?"":"#FF0000"}}>{text=='1'?i18n.label.success():i18n.label.fail()}</span>
|
||||||
|
}
|
||||||
|
} else if (item.dataIndex == 'operatedetail') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
return <span style={{ color: "#FF0000" }}>{status=="1"?"":text}</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.visibleImportLog = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
hrmImportResource,
|
||||||
|
viewLogTitle
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
titleImportLog,
|
||||||
|
visibleImportLog,
|
||||||
|
importLogStore,
|
||||||
|
showSearchAd
|
||||||
|
} = hrmImportResource;
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@a9qnqh`} type="primary" onClick={()=>{hrmImportResource.doSearch();hrmImportResource.showSearchAd=false}}>{i18n.button.search()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bi5gen`} type="ghost" onClick={()=>{form.reset();}}>{i18n.button.reset()}</Button>),
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@co57et`} type="ghost" onClick={()=>hrmImportResource.showSearchAd=false}>{i18n.button.cancel()}</Button>)
|
||||||
|
]
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
visibleImportLog &&
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@h4j5ho`}
|
||||||
|
title={viewLogTitle || titleImportLog()}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visibleImportLog}
|
||||||
|
closable={true}
|
||||||
|
onCancel={() => { this.cancel()} }
|
||||||
|
//buttons={buttons}
|
||||||
|
style={{width: 970, height: 510}}
|
||||||
|
>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@98vruz`}
|
||||||
|
searchType={['advanced']}
|
||||||
|
showSearchAd={showSearchAd}
|
||||||
|
searchsAd={<div
|
||||||
|
onKeyDown={(e) =>{
|
||||||
|
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||||
|
hrmImportResource.doSearch();
|
||||||
|
hrmImportResource.showSearchAd=false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>{this.getSearchs()}</div>}
|
||||||
|
setShowSearchAd={bool => {hrmImportResource.showSearchAd = bool}}
|
||||||
|
hideSearchAd={() => hrmImportResource.showSearchAd = false}
|
||||||
|
advanceHeight={200}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={btn}
|
||||||
|
/>
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@8ajuei`}
|
||||||
|
comsWeaTableStore={importLogStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
scroll={{ y: 380 }}
|
||||||
|
rowKey={(record,index) => index}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
</WeaDialog>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ImportLog
|
||||||
|
|
@ -0,0 +1,185 @@
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaDialog,
|
||||||
|
WeaNewScroll,
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Icon,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Table,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
import isEmpty from 'lodash/isEmpty';
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx';
|
||||||
|
import {
|
||||||
|
toJS
|
||||||
|
} from 'mobx';
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
@inject('hrmImportResource')
|
||||||
|
@observer
|
||||||
|
class ImportResult extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.errorInfo = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
getButtons() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
failnum,
|
||||||
|
importStatus
|
||||||
|
} = hrmImportResource;
|
||||||
|
const buttons = [];
|
||||||
|
if (importStatus == 'over') {
|
||||||
|
// if (failnum > 0) {
|
||||||
|
// buttons.push(<Button type="primary" onClick={() => this.submit()}>下载错误数据</Button>);
|
||||||
|
// }
|
||||||
|
// buttons.push(<Button type="primary" onClick={() => this.submit()}>下载全部数据</Button>);
|
||||||
|
buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@w1j5fh`} type="primary" onClick={() => this.getImportLog()}>{i18n.button.getImportLog()}</Button>);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(c) {
|
||||||
|
c.forEach(item => {
|
||||||
|
if (item.dataIndex == 'operatedetail') {
|
||||||
|
item.render = function(text, record) {
|
||||||
|
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
this.dialogKey = new Date().getTime();
|
||||||
|
hrmImportResource.visibleResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getImportLog() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
hrmImportResource.visibleImportLog = true;
|
||||||
|
let params = {};
|
||||||
|
params.importType = 'resource';
|
||||||
|
hrmImportResource.getImportLogSearchCondition(params);
|
||||||
|
hrmImportResource.getImportLogDetail(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
hrmImportResource
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
titleResult,
|
||||||
|
visibleResult,
|
||||||
|
importResultColumns,
|
||||||
|
importProcessLogDatas,
|
||||||
|
failnum,
|
||||||
|
succnum,
|
||||||
|
importResultTip,
|
||||||
|
importResultStore,
|
||||||
|
importStatus,
|
||||||
|
errorInfo,
|
||||||
|
setScrollRef,
|
||||||
|
dialogKey
|
||||||
|
} = hrmImportResource;
|
||||||
|
const buttons = [];
|
||||||
|
if (importStatus == 'over') {
|
||||||
|
buttons.push(
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
content: i18n.button.getImportLog(),
|
||||||
|
icon: <i className='icon-coms-Preservation'/>,
|
||||||
|
onClick: () => this.getImportLog(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
visibleResult &&
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@a3ftyh`}
|
||||||
|
key={dialogKey}
|
||||||
|
title={titleResult()}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visibleResult}
|
||||||
|
closable={true}
|
||||||
|
onCancel={() => this.cancel()}
|
||||||
|
buttons={this.getButtons()}
|
||||||
|
style={{ width: 720, height: 480 }}
|
||||||
|
moreBtn={{datas:buttons}}
|
||||||
|
>
|
||||||
|
<div className="hrm-import-dialog">
|
||||||
|
{
|
||||||
|
importStatus == '' || importStatus == 'importing' || importStatus == 'error'?<div>
|
||||||
|
{
|
||||||
|
importStatus == 'error'?<div className="hrm-import-result-icon" style={{ paddingTop: 15 }}>
|
||||||
|
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor:'#FF0000' }}>
|
||||||
|
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@gxbhrn`} type={'cross'} style={{ color: '#fff' }} />
|
||||||
|
</div><span style={{ paddingLeft: 5}}>{importResultTip}</span>
|
||||||
|
</div>:
|
||||||
|
<div className="hrm-import-process"><Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@u5jll2`} tip={i18n.message.serverImportProcessing()}></Spin></div>
|
||||||
|
}
|
||||||
|
<div className="wea-new-table">
|
||||||
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@iflhfl`} height={340} ref={(scroll)=>{hrmImportResource.setScrollTarget(scroll)}}>
|
||||||
|
<Table ecId={`${this && this.props && this.props.ecId || ''}_Table@quyttr`} dataSource={toJS(importProcessLogDatas)} columns={toJS(importResultColumns)} pagination={false} />
|
||||||
|
</WeaNewScroll>
|
||||||
|
</div>
|
||||||
|
</div> : <div>
|
||||||
|
<div className="hrm-import-result-icon" style={{ paddingTop: failnum == 0 ? 150 : 15 }}>
|
||||||
|
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor: succnum > 0 ? '#54D3A2' : '#FF0000' }}>
|
||||||
|
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@2fblod`} type={succnum > 0 ? 'check' : 'cross'} style={{ color: '#fff' }} />
|
||||||
|
</div><span style={{ paddingLeft: 5 }}>{importResultTip}</span>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
failnum > 0 &&
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@h7l6fo`}
|
||||||
|
comsWeaTableStore={importResultStore}
|
||||||
|
bordered
|
||||||
|
needScroll={true}
|
||||||
|
// pagination={true}
|
||||||
|
scroll={{ y: 330 }}
|
||||||
|
// rowKey={(record, index) => index}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</WeaDialog>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ImportResult
|
||||||
|
|
@ -0,0 +1,682 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-05-26 14:05:59
|
||||||
|
* @LastEditTime: 2022-12-16 16:36:59
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
|
||||||
|
*/
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaTable,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaOrgTree
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
message,
|
||||||
|
Switch,
|
||||||
|
Menu, Dropdown, Icon
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
import NewAndEditDialog from '../NewAndEditDialog';
|
||||||
|
import NewWeaTableDialog from '../NewWeaTableDialog';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
//const WeaTable = WeaTableNew.WeaTable
|
||||||
|
|
||||||
|
|
||||||
|
@inject('job')
|
||||||
|
@observer
|
||||||
|
export default class Job extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
job.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
selectedRowKeys
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
let btns = [];
|
||||||
|
topMenu.map((item, i) => {
|
||||||
|
if (item.menuFun === 'batchDelete') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else if (item.menuFun === 'copy') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(item) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
isPanelShow && job.setPanelStatus(false);
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
job.setNeDialogTitle(i18n.label.newPost());
|
||||||
|
job.setNewVisible(true);
|
||||||
|
job.getJobForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
job.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//联查人员
|
||||||
|
select(id) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
job.setNeDialogTitle("联查人员");
|
||||||
|
job.setVisible(true);
|
||||||
|
job.getHrmTable(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
merge(id) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: this.getCopyForm({isCopy:false}),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
job.merge(id)
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
copy(id) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
selectedRowKeys,
|
||||||
|
} = job;
|
||||||
|
let keys = id == undefined ? toJS(selectedRowKeys).toString() : id;
|
||||||
|
job.setIds(keys);
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: this.getCopyForm({isCopy:true}),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
job.copy()
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getCopyForm(params) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
copyCondition,
|
||||||
|
mergeCondition,
|
||||||
|
form2,
|
||||||
|
} = job;
|
||||||
|
params.isCopy ? form2.initFormFields(copyCondition) : form2.initFormFields(mergeCondition);
|
||||||
|
let formParams = form2.getFormParams();
|
||||||
|
let condition = params.isCopy ? copyCondition : mergeCondition;
|
||||||
|
const {
|
||||||
|
isFormInit
|
||||||
|
} = form2;
|
||||||
|
let arr = [];
|
||||||
|
isFormInit && condition.map(c => {
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push(
|
||||||
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
|
||||||
|
</WeaFormItem>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
selectedRowKeys
|
||||||
|
} = job;
|
||||||
|
let keys = toJS(selectedRowKeys).toString();
|
||||||
|
job.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 {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
job.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
isPanelShow && job.setPanelStatus(false);
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
job.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onSearchChange(val) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
job.setJobName(val);
|
||||||
|
!this.isEmptyObject(form.getFormParams()) && job.updateFields(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reRenderColumns(columns) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
let _this = this;
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex == 'forbiddenTag') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <Switch checked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (c.dataIndex == 'jobTitleName') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <a href='javascript:void(0);' onClick={() => {
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank")
|
||||||
|
}}>{text}</a>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c.dataIndex == 'operate') {
|
||||||
|
c.className = "wea-table-operates"
|
||||||
|
c.width = 80
|
||||||
|
c.render = function (text, record) {
|
||||||
|
const menu = (
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item key="0">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.view(record.id) }}>查看</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="1">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="2">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查人员</a>
|
||||||
|
</Menu.Item>
|
||||||
|
{/* <Menu.Item key="3">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.merge(record.id) }}>合并</a>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item key="4">
|
||||||
|
<a href='javascript:void(0);' onClick={() => { _this.copy(record.id) }}>复制</a>
|
||||||
|
</Menu.Item> */}
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
return <Dropdown overlay={menu}>
|
||||||
|
<i class="icon-coms-more" />
|
||||||
|
</Dropdown>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
job.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
view(id) {
|
||||||
|
window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${id}`, "_blank")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
job.setSaveAndSetting(false);
|
||||||
|
job.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSaveAndSetting() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
job.setSaveAndSetting(true);
|
||||||
|
job.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { job.setCurrent(1); job.setPageSize(10); job.getTableInfo(); job.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={() => job.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form,
|
||||||
|
searchConditionLoading
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
job.getTableInfo();
|
||||||
|
job.setPanelStatus(false)
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//非空判断
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//左侧树
|
||||||
|
getTree = () => {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
companysId,
|
||||||
|
} = job
|
||||||
|
|
||||||
|
let tree = (
|
||||||
|
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
|
||||||
|
ref='WeaOrgTree'
|
||||||
|
dataUrl={"/api/bs/hrmorganization/job/getSearchTree"}
|
||||||
|
// dataUrl={"/api/hrm/base/getHrmSearchTree"}
|
||||||
|
loading
|
||||||
|
needSearch
|
||||||
|
noCache={true}
|
||||||
|
needDropMenu={false}
|
||||||
|
//onSelect={this.selectVirtual} //组织维度回调函数
|
||||||
|
isLoadSubDepartment={true}
|
||||||
|
topPrefix={'hrmSearch'}
|
||||||
|
companysId={companysId}
|
||||||
|
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
|
||||||
|
treeNodeClick={this.treeNodeClick}
|
||||||
|
expandAllChildrenOnSearch={true}
|
||||||
|
renderNode={item => this.renderNode(item)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNode(item) {
|
||||||
|
return <div className='text-elli' title={item.name}>
|
||||||
|
<i className={item.icon} style={{ marginRight: '5px' }}></i>
|
||||||
|
{item.name}
|
||||||
|
{item.canceled && <span style={{ color: 'red' }}>({i18n.label.forbidden()})</span>}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
treeNodeClick = (event, ids, nodeids, nodes) => {
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form,
|
||||||
|
companysId
|
||||||
|
} = job;
|
||||||
|
const type = event.node.props.type || '0';
|
||||||
|
const id = event.node.props.id || '';
|
||||||
|
let params = {};
|
||||||
|
form.resetConditionValue();
|
||||||
|
job.setPanelStatus(false)
|
||||||
|
// job.tabkey = 'default_3';
|
||||||
|
job.nodeType = type;
|
||||||
|
if (type == '0') {
|
||||||
|
params['virtualtype'] = companysId;
|
||||||
|
}
|
||||||
|
if (type == '1') {
|
||||||
|
params['subcompanyid1'] = id;
|
||||||
|
}
|
||||||
|
if (type == '2') {
|
||||||
|
params['departmentid'] = id;
|
||||||
|
}
|
||||||
|
job.doSearch(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 10,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
job
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, jobName, conditionNum, visible, condition, form,
|
||||||
|
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
|
||||||
|
form1, isEdit, newVisible,selectedRowKeys, total, current, pageSize, init,
|
||||||
|
defaultShowLeft,form2,hasRight
|
||||||
|
} = job;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const rowSelection = {
|
||||||
|
selectedRowKeys:selectedRowKeys,
|
||||||
|
onChange(selectedRowKeys, selectedRows) {
|
||||||
|
job.setSelectedRowKeys(selectedRowKeys);
|
||||||
|
},
|
||||||
|
getCheckboxProps: record => ({
|
||||||
|
disabled: record.isUsed === 1, // 配置无法勾选的列
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const pagination = {
|
||||||
|
current: current,
|
||||||
|
pageSize: pageSize,
|
||||||
|
total: total,
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
onShowSizeChange(current, pageSize) {
|
||||||
|
},
|
||||||
|
onChange(current) {
|
||||||
|
},
|
||||||
|
showTotal(total) {
|
||||||
|
return `共 ${total} 条`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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.jobName()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => this.handleMenuClick(e)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@7muhhb`} isNew={true} showLeft={defaultShowLeft} leftCom={this.getTree()}>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||||
|
searchType={['base', 'advanced']}
|
||||||
|
showSearchAd={isPanelShow}
|
||||||
|
searchsBaseValue={this.isEmptyObject(form.getFormParams()) ? jobName : form.getFormParams().jobName}
|
||||||
|
setShowSearchAd={bool => job.setPanelStatus(bool)}
|
||||||
|
hideSearchAd={() => job.setPanelStatus(false)}
|
||||||
|
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||||
|
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
onSearch={() => {
|
||||||
|
job.setCurrent(1);
|
||||||
|
job.setPageSize(10);
|
||||||
|
job.getTableInfo()
|
||||||
|
}}
|
||||||
|
onSearchChange={val => this.onSearchChange(val)}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
init ? <div className='hrm-new-weatable-spin'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={init}></Spin>
|
||||||
|
</div> :
|
||||||
|
<WeaTable rowKey={record => record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
|
||||||
|
loading={loading}
|
||||||
|
dataSource={dataSource} childrenColumnName="children"
|
||||||
|
columns={this.reRenderColumns(columns)}
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
pagination={pagination}
|
||||||
|
onChange={(pagination, filters, sorter) => {
|
||||||
|
job.setSortParams(sorter);
|
||||||
|
job.setCurrent(pagination.current);
|
||||||
|
job.setPageSize(pagination.pageSize);
|
||||||
|
job.getTableInfo();
|
||||||
|
}}
|
||||||
|
indentSize={15}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</WeaTop>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<NewWeaTableDialog ecId={`${this && this.props && this.props.ecId || ''}_NewTableDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={visible}
|
||||||
|
height={400}
|
||||||
|
tableStore={tableStore}
|
||||||
|
onCancel={() => job.setVisible(false)}
|
||||||
|
/>
|
||||||
|
<NewAndEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewAndEditDialog@q4rrwm`}
|
||||||
|
title={nEdialogTitle}
|
||||||
|
visible={newVisible}
|
||||||
|
condition={toJS(condition)}
|
||||||
|
form={form1}
|
||||||
|
isFormInit={form1.isFormInit}
|
||||||
|
loading={dialogLoading}
|
||||||
|
isEdit={isEdit}
|
||||||
|
height={400}
|
||||||
|
conditionLen={2}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => job.setNewVisible(false)}
|
||||||
|
saveAndSetting = {() => this.handleSaveAndSetting()}
|
||||||
|
moduleName={"job"}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,295 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-05-26 14:07:12
|
||||||
|
* @LastEditTime: 2022-07-12 16:25:58
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
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';
|
||||||
|
import AttachToNumberField from "../NewNumberField";
|
||||||
|
|
||||||
|
|
||||||
|
@inject('jobExtend')
|
||||||
|
@inject('job')
|
||||||
|
@observer
|
||||||
|
export default class JobExtend extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
init = () => {
|
||||||
|
const { jobExtend, job } = this.props;
|
||||||
|
let { hash } = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
jobExtend.init();
|
||||||
|
jobExtend.setId(id);
|
||||||
|
jobExtend.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabChildren = () => {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys, detailSelectedKey } = jobExtend;
|
||||||
|
let tabChildren = [];
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
tableInfo && tableInfo.map((t, i) => {
|
||||||
|
if (detailSelectedKey == i) {
|
||||||
|
tabChildren.push(
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
|
||||||
|
ref={(ref) => jobExtend.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 {
|
||||||
|
jobExtend
|
||||||
|
} = this.props, {
|
||||||
|
tableInfo,
|
||||||
|
selectedRows,
|
||||||
|
setSelectedRowKeys,
|
||||||
|
selectedRowKeys
|
||||||
|
} = jobExtend;
|
||||||
|
|
||||||
|
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 { jobExtend } = this.props;
|
||||||
|
let { form, condition, isEditor } = jobExtend;
|
||||||
|
const { isFormInit } = form;
|
||||||
|
let group = [];
|
||||||
|
let tipPosition = 'bottom';
|
||||||
|
window.e9HideFormFieldKeys = [];
|
||||||
|
isFormInit && condition.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}
|
||||||
|
className={j === 1 && "minH5"}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} onChange={this.onChange} />
|
||||||
|
{field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange = (data) => {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
if (data.sequence_id || data.grade_id) {
|
||||||
|
jobExtend.updateConditions(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tableEditChange = (data) => {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
let { detailSelectedKey = '0', tableInfo } = jobExtend;
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
let d = cloneDeep(tableInfo);
|
||||||
|
d[Number(detailSelectedKey)].tabinfo.datas = data;
|
||||||
|
jobExtend.updateTableInfo(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRightMenu = () => {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = jobExtend;
|
||||||
|
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 { jobExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = jobExtend;
|
||||||
|
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 { jobExtend } = this.props;
|
||||||
|
jobExtend.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
saveEditCard = () => {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
jobExtend.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
backCard = () => {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
changeData(key) {
|
||||||
|
const {
|
||||||
|
jobExtend
|
||||||
|
} = this.props;
|
||||||
|
jobExtend.changeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { jobExtend } = this.props;
|
||||||
|
const { loading, tabkey, tabInfo, topTab, selectedKey, date, detailSelectedKey, isEditor } = jobExtend;
|
||||||
|
|
||||||
|
|
||||||
|
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}
|
||||||
|
title={isEditor ? i18n.label.editJobInfo() : i18n.label.jobsInfo()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
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 => {
|
||||||
|
jobExtend.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>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaDialog,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaProgress
|
||||||
|
} 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';
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
export default class LogView extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = ({
|
||||||
|
height: 502,
|
||||||
|
width: 1075,
|
||||||
|
dialogTitle: '日志查看',
|
||||||
|
showSearchAd: false,
|
||||||
|
//**** */
|
||||||
|
detailDialogTitle: "",
|
||||||
|
detailVisible: false,
|
||||||
|
record:{}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.setState({ showSearchAd: false })
|
||||||
|
if (this.props.keys !== nextProps.keys) {
|
||||||
|
nextProps.logViewStore.init(nextProps.logMoudleType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doView(record) {
|
||||||
|
this.setState({
|
||||||
|
record:record,
|
||||||
|
detailVisible: true,
|
||||||
|
detailDialogTitle: record.operate_typespan + " - " + record.operate_module_name + " : "+record.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(columns) {
|
||||||
|
let _this = this;
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex == 'message') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return <a href='javascript:void(0);' className="common" onClick={() => { _this.doView(record) }}>查看</a>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
logViewStore
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form,
|
||||||
|
searchConditionLoading
|
||||||
|
} = logViewStore;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
logViewStore.getTableInfo();
|
||||||
|
this.setState({ showSearchAd: false })
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
logViewStore
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form
|
||||||
|
} = logViewStore;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { logViewStore.getTableInfo(); this.setState({ showSearchAd: 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={() => this.setState({ showSearchAd: false })}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
visible, onCancel, logViewStore
|
||||||
|
} = this.props, {
|
||||||
|
tableStore, conditionNum
|
||||||
|
} = logViewStore, {
|
||||||
|
height, dialogTitle, width, showSearchAd, detailDialogTitle, detailVisible,record
|
||||||
|
} = this.state;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
title={dialogTitle}
|
||||||
|
icon="icon-coms-currency"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={false}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
style={{ height: height, width: width}}
|
||||||
|
initLoadCss
|
||||||
|
className="logWrapper"
|
||||||
|
>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||||
|
searchType={['advanced']}
|
||||||
|
showSearchAd={showSearchAd}
|
||||||
|
setShowSearchAd={bool => { this.setState({ showSearchAd: bool }) }}
|
||||||
|
advanceHeight={161}
|
||||||
|
searchsAd={showSearchAd ? this.getPanelComponents() : <div></div>}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
/>
|
||||||
|
<div style={{"padding":"0 10px 10px 10px"}}>
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
|
||||||
|
comsWeaTableStore={tableStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
title={detailDialogTitle}
|
||||||
|
icon="icon-coms-currency"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={detailVisible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => this.setState({
|
||||||
|
detailVisible: false
|
||||||
|
})}
|
||||||
|
style={{ height: 676, width: 1000 }}
|
||||||
|
>
|
||||||
|
<div className='content' style={{ "padding": "20px","height": "100%" }}>
|
||||||
|
<div style={{ "height": "40%","overflow-x": "auto"}} dangerouslySetInnerHTML={{ __html: record.message }} ></div>
|
||||||
|
{/* <WeaProgress percent={100} strokeColor="#217346" /> */}
|
||||||
|
<div style={{"marginTop":"20px","fontSize":"20px","color":"#217346"}}>原始参数查看</div>
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: record.params_str }} style={{"overflow-x": "auto","height":"50%","marginTop":"20px"}}></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
;(function(window){
|
||||||
|
//符合commonjs规范引入依赖
|
||||||
|
if(typeof module !== 'undefined'){
|
||||||
|
window.saveAs = require('file-saver')
|
||||||
|
window.baidu = require('baidu-template-pro')
|
||||||
|
}
|
||||||
|
function getModelHtml(mhtml,style=''){
|
||||||
|
return`
|
||||||
|
Content-Type: text/html; charset="utf-8"
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
${style}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
${mhtml}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
//主函数
|
||||||
|
let exportWord = ({mhtml,style,filename,data,selector})=>{
|
||||||
|
|
||||||
|
if(selector){
|
||||||
|
let nodes = window.document.querySelectorAll(selector)
|
||||||
|
mhtml = nodes.length>0?Array.from(nodes).reduce((a,b)=>a+b.innerHTML,''):''
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//没有baiduTemplatePro.js依赖时必须传入selector
|
||||||
|
if (!selector && typeof baidu === 'undefined') {
|
||||||
|
console.error("wordExport : missing (selector) for params without depandency (baiduTemplatePro.js)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof saveAs === "undefined") {
|
||||||
|
console.error("wordExport : missing dependency (FileSaver.js)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//没有模板引擎时,将获取节点的html字符串生成模板
|
||||||
|
let html = typeof baidu !== 'undefined'?baidu.template(getModelHtml(mhtml,style),data):getModelHtml(mhtml)
|
||||||
|
|
||||||
|
let blob = new Blob([html],{type:'application/msword;charset=utf-8'})
|
||||||
|
saveAs(blob,filename+'.doc')
|
||||||
|
}
|
||||||
|
//添加exportWord到全局对象
|
||||||
|
window.exportWord = window.exportWord||exportWord
|
||||||
|
|
||||||
|
//如果符合commonjs规范,exports出去
|
||||||
|
if(typeof module==='object'&&typeof module.exports==='object'){
|
||||||
|
module.exports = {exportWord}
|
||||||
|
}
|
||||||
|
|
||||||
|
})(window)
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
toJS
|
||||||
|
} from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaAlertPage,
|
||||||
|
WeaBrowser
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
} from 'antd';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/import.css';
|
||||||
|
import { addContentPath } from '../../util/index.js';
|
||||||
|
import StepDialog from './stepDialog';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@inject("newImport")
|
||||||
|
@observer
|
||||||
|
export default class newImport extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = ({
|
||||||
|
title: '数据导入',
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {newImport} = this.props;
|
||||||
|
newImport.getHasRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getImportCard = () => {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props, {
|
||||||
|
isMouseOver,
|
||||||
|
curIndex,
|
||||||
|
cardConfig,
|
||||||
|
setMouseStatus,
|
||||||
|
} = newImport;
|
||||||
|
|
||||||
|
let arr = [];
|
||||||
|
|
||||||
|
cardConfig.map((c, index) => {
|
||||||
|
arr.push(<div className='hrm-card-out' style={(index == 0 || index == 4) ? { marginLeft: 0 } : {}} onMouseEnter={() => setMouseStatus(index, true)} onMouseLeave={() => setMouseStatus(index, false)}>
|
||||||
|
<div className='hrm-card-inwrap' style={curIndex == index && isMouseOver ? { backgroundColor: '#858585' } : { backgroundColor: c.bgColor }}>
|
||||||
|
{curIndex == index && isMouseOver ? this.getLinkName(c.linkName, index) : this.getIcon(c.icon)}
|
||||||
|
{curIndex == index && isMouseOver ? this.getSubTitle(c.subTitle, c.url) : this.getTitle(c.title)}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
});
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIcon = (icon) => {
|
||||||
|
return (<div className='hrm-card-icon'>
|
||||||
|
<i className={icon} />
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle = (title) => {
|
||||||
|
return (<div className='hrm-card-title'>{title}</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getLinkName = (linkName, index) => {
|
||||||
|
return (<div style={{ width: '100%', height: 95 }}>
|
||||||
|
<div style={{ textAlign: 'center', paddingTop: 45 }}>
|
||||||
|
<a onClick={() => this.handleClick(index)} style={{ color: '#fff', textDecoration: 'underline', fontSize: 15 }}>{linkName}</a>
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
getSubTitle = (subTitle, url) => {
|
||||||
|
return (<div style={{ height: 35, textAlign: 'right', paddingRight: 10, backgroundColor: '#6A6A6A', color: '#fff', paddingTop: 5 }}><a href={addContentPath(url)} target='_blank' className='hrm-import-link'>{subTitle}</a></div>)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick = (index) => {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props, {
|
||||||
|
} = newImport;
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
newImport.importType = 'company';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
newImport.importType = 'department';
|
||||||
|
break;
|
||||||
|
// case 2:
|
||||||
|
// newImport.importType = 'jobtitle';
|
||||||
|
// break;
|
||||||
|
case 2:
|
||||||
|
newImport.importType = 'resource';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
newImport.importType = 'joblevel';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newImport.buttonTitle = i18n.button.nextStep();
|
||||||
|
newImport.current = 0;
|
||||||
|
newImport.visible = true;
|
||||||
|
newImport.getImportField();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
newImport,
|
||||||
|
} = this.props, {
|
||||||
|
visible,
|
||||||
|
hasRight
|
||||||
|
} = newImport, {
|
||||||
|
title,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@sp0zb8`}
|
||||||
|
title={title}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
showDropIcon={true}
|
||||||
|
>
|
||||||
|
<div className='hrm-import-wrap'>{this.getImportCard()}</div>
|
||||||
|
{visible && <StepDialog ecId={`${this && this.props && this.props.ecId || ''}_StepDialog@633i8k`} />}
|
||||||
|
</WeaTop>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,291 @@
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaTransfer,
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSelect,
|
||||||
|
WeaUpload,
|
||||||
|
WeaDialog,
|
||||||
|
WeaInput
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Pagination,
|
||||||
|
Steps,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Progress,
|
||||||
|
Icon
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
import { addContentPath } from '../../util/index.js'
|
||||||
|
import { toJS } from 'mobx';
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
@inject("newImport")
|
||||||
|
@observer
|
||||||
|
export default class StepDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
data: [],
|
||||||
|
selectedKeys: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getCircle() {
|
||||||
|
let style = {
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
backgroundColor: '#D8D8D8',
|
||||||
|
webkitBorderRadius: 10,
|
||||||
|
mozBorderRadius: 10,
|
||||||
|
msBorderRadius: 10,
|
||||||
|
oBorderRadius: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
//paddingLeft: 6,
|
||||||
|
textAlign: 'center',
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
getForm() {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
condition
|
||||||
|
} = newImport;
|
||||||
|
let _arr = [];
|
||||||
|
|
||||||
|
condition.map((c, i) => {
|
||||||
|
let arr = [];
|
||||||
|
if (i == 0) { //基本信息
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m9t2kn@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@rc5who@${index}`} span={1} offset={4}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}><div style={{ paddingTop: 2 }}>{index + 1}</div></div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@f1sc6s@${index}`} span={14}>
|
||||||
|
<div style={{ marginTop: 15 }}>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@5gsx6o@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@qrdxst@${index}`} span={field.labelcol} style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }} title={field.label}>{field.label}:</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7jy5um@${index}`} span={field.fieldcol}>
|
||||||
|
{this.getDom(field)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (i == 1) { //导入说明
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
arr.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||||
|
<div style={this.getCircle()}>
|
||||||
|
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||||
|
{this.getIllustration(field.value, field.link, index, field)}
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||||
|
|
||||||
|
});
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDom(field) {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
filelist
|
||||||
|
} = newImport;
|
||||||
|
let dom;
|
||||||
|
let domkey = field.domkey;
|
||||||
|
if (domkey[0] == 'templet') {
|
||||||
|
dom = <a href={addContentPath(field.value)}>{i18n.label.importTemplate()}</a>;
|
||||||
|
} else if (domkey[0].indexOf('keyField') > -1) {
|
||||||
|
const vals = field.options.filter(v => v.selected == true);
|
||||||
|
let val = '';
|
||||||
|
vals.length > 0 && (val = vals[0].key);
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@yzc92h`}
|
||||||
|
style={{ width: 200 }}
|
||||||
|
options={field.options}
|
||||||
|
value={newImport.importParams[domkey[0]] || field.value || val}
|
||||||
|
onChange={(v) => { newImport.setParam(domkey[0], v) }}
|
||||||
|
/>
|
||||||
|
} else if (domkey[0] == 'importType') {
|
||||||
|
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@holhhb`}
|
||||||
|
style={{ width: 200 }}
|
||||||
|
options={field.options}
|
||||||
|
value={newImport.operateType}
|
||||||
|
onChange={(v) => { newImport.operateType = v }}
|
||||||
|
/>
|
||||||
|
} else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
|
||||||
|
dom = (<div>
|
||||||
|
<div style={{ float: 'left', marginTop: -10 }}>
|
||||||
|
<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@iu8n01`}
|
||||||
|
uploadUrl='/api/doc/upload/uploadFile'
|
||||||
|
category='string'
|
||||||
|
limitType='xls,xlsx'
|
||||||
|
maxFilesNumber={1}
|
||||||
|
viewAttr={3}
|
||||||
|
datas={filelist}
|
||||||
|
{...field.otherParams}
|
||||||
|
onChange={
|
||||||
|
(ids, list) => {
|
||||||
|
this.setFileId(ids, list)
|
||||||
|
}
|
||||||
|
} >
|
||||||
|
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@87232v`}>{i18n.button.selectFile()}</Button>
|
||||||
|
</WeaUpload>
|
||||||
|
</div>
|
||||||
|
<div style={{ float: 'left', paddingLeft: 10 }}>
|
||||||
|
{filelist.length == 0 ? <p style={{marginLeft:10}}>{i18n.label.noFileSelected()}</p> : filelist.map(file => <p>{file.filename}</p>)}
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
}else {
|
||||||
|
dom = <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@rg6f3p`} hasBorder={true} viewAttr={1} value={field.value}/>
|
||||||
|
}
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFileId(ids, list) {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props;
|
||||||
|
newImport.excelfile = ids;
|
||||||
|
newImport.filelist = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIllustration(val, url, index, link) {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
importParams
|
||||||
|
} = newImport;
|
||||||
|
let p;
|
||||||
|
if (index == 0) {
|
||||||
|
p = (<p>{i18n.label.downLoadTemplete()}: <a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||||
|
} else {
|
||||||
|
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
reRenderColumns(c) {
|
||||||
|
c.forEach(item => {
|
||||||
|
if (item.dataIndex == 'operatedetail') {
|
||||||
|
item.render = function (text, record) {
|
||||||
|
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render = () => {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props, {
|
||||||
|
data, selectedKeys, current, pvisable, percent, failnum, succnum, importResultTip, importResultStore, importStatus, loading, date
|
||||||
|
} = newImport;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
current == 0 &&
|
||||||
|
<div>
|
||||||
|
<p style={{"color":"red","fontSize":"15px"}}>注意:右侧列表默认加载的为必填字段!!!</p>
|
||||||
|
<WeaTransfer
|
||||||
|
data={toJS(data)}
|
||||||
|
selectedKeys={toJS(selectedKeys)}
|
||||||
|
onChange={(keys, datas) => {
|
||||||
|
newImport.setSelectedKeys(keys);
|
||||||
|
newImport.setSelectData(datas);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
current == 1 && <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} ref="scrollBar">
|
||||||
|
{this.getForm()}
|
||||||
|
</WeaNewScroll>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
current == 2 && <div>
|
||||||
|
{
|
||||||
|
importStatus == 'over' && <div className="hrm-import-result-icon" style={{ paddingTop: failnum == 0 ? 100 : 15 }}>
|
||||||
|
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor: succnum > 0 ? '#54D3A2' : '#FF0000' }}>
|
||||||
|
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@2fblod`} type={succnum > 0 ? 'check' : 'cross'} style={{ color: '#fff' }} />
|
||||||
|
</div><span style={{ paddingLeft: 5 }}>{importResultTip}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
failnum > 0 &&
|
||||||
|
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@h7l6fo`}
|
||||||
|
comsWeaTableStore={importResultStore}
|
||||||
|
bordered
|
||||||
|
needScroll={true}
|
||||||
|
scroll={{ y: 330 }}
|
||||||
|
getColumns={c => this.reRenderColumns(c)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
<WeaDialog
|
||||||
|
title="导入进度"
|
||||||
|
onCancel={() => newImport.pvisable = false}
|
||||||
|
visible={pvisable}
|
||||||
|
style={{ width: 300, height: 50 }}
|
||||||
|
>
|
||||||
|
<div style={{ "padding": "15px" }}>
|
||||||
|
<Progress percent={percent} strokeWidth={7} />
|
||||||
|
</div>
|
||||||
|
</WeaDialog>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
import {
|
||||||
|
WeaNewScroll,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaDialog
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Pagination,
|
||||||
|
Steps
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
const Step = Steps.Step;
|
||||||
|
import StepContent from './stepContent';
|
||||||
|
import "../../style/common.less";
|
||||||
|
|
||||||
|
@inject("newImport")
|
||||||
|
@observer
|
||||||
|
export default class StepDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
title: '数据导入',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next() {
|
||||||
|
const {newImport} = this.props;
|
||||||
|
let {current,steps} = newImport;
|
||||||
|
current = current + 1;
|
||||||
|
if (current === steps.length) {
|
||||||
|
current = 0;
|
||||||
|
newImport.init();
|
||||||
|
}
|
||||||
|
newImport.current = current;
|
||||||
|
current === 1 && newImport.getImportForm();
|
||||||
|
current === steps.length - 1 && newImport.startImport();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
newImport
|
||||||
|
} = this.props, {
|
||||||
|
current,
|
||||||
|
visible,
|
||||||
|
steps
|
||||||
|
} = newImport,{
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
title
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const buttons = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => this.next()}>{current === steps.length - 1 ? '关闭' : i18n.button.nextStep()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
||||||
|
className="new-edit-wrapper"
|
||||||
|
title={title}
|
||||||
|
icon="icon-coms-upload"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
visible={visible}
|
||||||
|
closable={true}
|
||||||
|
hasScroll={true}
|
||||||
|
onCancel={() => newImport.init()}
|
||||||
|
buttons={buttons}
|
||||||
|
style={{ width: width, height: height }}
|
||||||
|
initLoadCss
|
||||||
|
>
|
||||||
|
<div style={{ marginTop: 24 }}>
|
||||||
|
<Steps current={current}>
|
||||||
|
{steps.map((s, i) => <Step key={i} title={s.title} description={s.description} />)}
|
||||||
|
</Steps>
|
||||||
|
</div>
|
||||||
|
<div style={{ padding: 24 }}>
|
||||||
|
<StepContent ecId={`${this && this.props && this.props.ecId || ''}_StepContent@633i8k`}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</WeaDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,455 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description:
|
||||||
|
* Date: 2022-05-17 16:02:56
|
||||||
|
* LastEditTime: 2022-06-14 14:16:16
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { Button, Modal } from "antd";
|
||||||
|
import {
|
||||||
|
WeaTableEdit,
|
||||||
|
WeaDialog,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaSelect,
|
||||||
|
WeaInput,
|
||||||
|
WeaInputNumber,
|
||||||
|
} from "ecCom";
|
||||||
|
import Preview from "./preview";
|
||||||
|
import { i18n } from "../../../../public/i18n";
|
||||||
|
import _ from "lodash";
|
||||||
|
import "../index.less";
|
||||||
|
|
||||||
|
class NumberComposition extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
visible: false,
|
||||||
|
objectData: {
|
||||||
|
numField: "string",
|
||||||
|
numFieldName: "字符串",
|
||||||
|
},
|
||||||
|
dataSource: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const enums = {
|
||||||
|
STRING: "字符串",
|
||||||
|
NUMBER: "流水号位数",
|
||||||
|
YEAR: "当前年份",
|
||||||
|
MONTH: "当前月份",
|
||||||
|
DAY: "当前日期",
|
||||||
|
SUBCOMPANY: "分部编号",
|
||||||
|
DEPARTMENT: "部门编号",
|
||||||
|
JOBTITLES: "岗位编号",
|
||||||
|
};
|
||||||
|
let num = 0;
|
||||||
|
const { dataSource: details, onChange } = this.props;
|
||||||
|
for (let i in details) {
|
||||||
|
if (details[i].ruletype === "STRING") {
|
||||||
|
details[i].showorder = num;
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const tmpV = _.map(details, (it, index) => {
|
||||||
|
const { ruletype, rulevalue, showorder } = it;
|
||||||
|
return {
|
||||||
|
id: index,
|
||||||
|
value: rulevalue,
|
||||||
|
strLogo: Number(showorder) + 1,
|
||||||
|
numFieldName:
|
||||||
|
ruletype === "STRING"
|
||||||
|
? `${enums[ruletype]}${Number(showorder) + 1}`
|
||||||
|
: enums[ruletype],
|
||||||
|
numField: _.toLower(ruletype),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
dataSource: !_.isEmpty(tmpV)
|
||||||
|
? tmpV
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
value: "",
|
||||||
|
strLogo: 1,
|
||||||
|
numFieldName: "字符串1",
|
||||||
|
numField: "string",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
value: 3,
|
||||||
|
numFieldName: "流水号位数",
|
||||||
|
numField: "number",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
onChange && onChange(this.state.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 = () => {
|
||||||
|
let newDataSource = [];
|
||||||
|
const { objectData, dataSource } = this.state;
|
||||||
|
const { onChange } = this.props;
|
||||||
|
const { numField, numFieldName } = objectData;
|
||||||
|
const stringRow = _.filter(dataSource, (it) => it.numField === "string"); //字符串列表
|
||||||
|
const maxStrLen = !_.isEmpty(stringRow)
|
||||||
|
? _.sortBy(stringRow, function (o) {
|
||||||
|
return -o.strLogo;
|
||||||
|
})[0].strLogo
|
||||||
|
: 0; //字符串列表
|
||||||
|
const maxIdLen = _.sortBy(dataSource, function (o) {
|
||||||
|
return -o.id;
|
||||||
|
})[0].id; //字符串列表
|
||||||
|
|
||||||
|
const index = _.findIndex(dataSource, (item) => item.numField !== "string");
|
||||||
|
const lastStrindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "string"
|
||||||
|
);
|
||||||
|
if (numField === "subcompany" || numField === "department" || numField === "jobtitles") {
|
||||||
|
if (_.findIndex(dataSource, it => it.numField === numField) !== -1) {
|
||||||
|
Modal.warning({
|
||||||
|
title: "信息确认",
|
||||||
|
content: `已经添加过一个${numFieldName},请选择其他编号字段!`,
|
||||||
|
onOk() { },
|
||||||
|
okText: "确认",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.showConfirm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果前n项为空或者当中包含非字符串项,则
|
||||||
|
if (index > lastStrindex) {
|
||||||
|
if (numField === "month") {
|
||||||
|
const tmpVLastYearindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "year"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastYearindex + 1, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${stringRow.length + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
} else if (numField === "day") {
|
||||||
|
const tmpVLastMonthindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "month"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastMonthindex + 1, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${stringRow.length + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const tmpVLastStrindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "string"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastStrindex + 1, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
strLogo: maxStrLen + 1,
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${maxStrLen + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
newDataSource = [...dataSource];
|
||||||
|
} else {
|
||||||
|
if (numField === "month") {
|
||||||
|
const tmpVLastYearindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "year"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastYearindex + 1, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${stringRow.length + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
} else if (numField === "day") {
|
||||||
|
const tmpVLastMonthindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "month"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastMonthindex + 1, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${stringRow.length + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const tmpVLastStrindex = _.findLastIndex(
|
||||||
|
dataSource,
|
||||||
|
(item) => item.numField === "string"
|
||||||
|
);
|
||||||
|
dataSource.splice(tmpVLastStrindex, 0, {
|
||||||
|
id: maxIdLen + 1,
|
||||||
|
value: "",
|
||||||
|
strLogo: maxStrLen + 1,
|
||||||
|
numFieldName:
|
||||||
|
numField === "string"
|
||||||
|
? `${numFieldName}${maxStrLen + 1}`
|
||||||
|
: numFieldName,
|
||||||
|
numField,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
newDataSource = [...dataSource];
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
objectData: { numField: "string", numFieldName: "字符串" },
|
||||||
|
dataSource: newDataSource,
|
||||||
|
});
|
||||||
|
onChange && onChange(newDataSource);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name:年月日字段重复提示
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
showConfirm = () => {
|
||||||
|
const { objectData } = this.state;
|
||||||
|
Modal.warning({
|
||||||
|
title: "信息确认",
|
||||||
|
content: `已经添加过一个${objectData.numFieldName},请选择其他编号字段!`,
|
||||||
|
footer: [],
|
||||||
|
onOk() { },
|
||||||
|
okText: "确认",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeInput = (value, index, record) => {
|
||||||
|
const { dataSource } = this.state;
|
||||||
|
const { onChange } = this.props;
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
dataSource: _.map(dataSource, (it) => {
|
||||||
|
if (it.id === record.id) {
|
||||||
|
return {
|
||||||
|
...it,
|
||||||
|
value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { ...it };
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
onChange && onChange(this.state.dataSource);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDragChange = (dataSource) => {
|
||||||
|
const { onChange } = this.props;
|
||||||
|
this.setState({ dataSource });
|
||||||
|
onChange && onChange(dataSource);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { visible, objectData, dataSource } = this.state;
|
||||||
|
const { options } = this.props;
|
||||||
|
const { numField, numFieldName } = objectData;
|
||||||
|
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" ||
|
||||||
|
numField === "subcompany" ||
|
||||||
|
numField === "department" ||
|
||||||
|
numField === "jobtitles"
|
||||||
|
) {
|
||||||
|
return <span></span>;
|
||||||
|
}
|
||||||
|
if (numField === "number") {
|
||||||
|
return (
|
||||||
|
<WeaInputNumber
|
||||||
|
id="customNumberInput"
|
||||||
|
value={record.value}
|
||||||
|
onChange={(value) =>
|
||||||
|
this.handleChangeInput(value, index, record)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<WeaInput
|
||||||
|
id="custom"
|
||||||
|
value={record.value}
|
||||||
|
onChange={(value) =>
|
||||||
|
this.handleChangeInput(value, index, record)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
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`}
|
||||||
|
/>,
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<WeaTableEdit
|
||||||
|
draggable={true}
|
||||||
|
columns={columns}
|
||||||
|
datas={dataSource}
|
||||||
|
getRowSelection={this.getRowSelection}
|
||||||
|
pushTitleIntoHeader
|
||||||
|
showCopy={false}
|
||||||
|
btnsType="inline"
|
||||||
|
deleteConfirm
|
||||||
|
addType="func"
|
||||||
|
addFunc={() =>
|
||||||
|
this.setState({
|
||||||
|
visible: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onChange={this.handleDragChange}
|
||||||
|
/>
|
||||||
|
{/* 预览 */}
|
||||||
|
<Preview dataSource={dataSource} />
|
||||||
|
{/* 新增弹框 */}
|
||||||
|
<WeaDialog
|
||||||
|
onCancel={() =>
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
title={i18n.label.addNumberField()}
|
||||||
|
visible={visible}
|
||||||
|
hasScroll
|
||||||
|
initLoadCss
|
||||||
|
maxHeight={150}
|
||||||
|
buttons={buttons}>
|
||||||
|
<div style={{ padding: "20px 20%" }}>
|
||||||
|
<WeaFormItem
|
||||||
|
label="编号字段"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<WeaSelect
|
||||||
|
options={options}
|
||||||
|
value={numField}
|
||||||
|
viewAttr={2}
|
||||||
|
onChange={(numField, numFieldName) => {
|
||||||
|
this.setState({ objectData: { numField, numFieldName } });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</WeaDialog>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NumberComposition;
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 编号设置预览
|
||||||
|
* Date: 2022-05-18 10:21:09
|
||||||
|
* LastEditTime: 2022-06-08 16:37:01
|
||||||
|
*/
|
||||||
|
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" ||
|
||||||
|
numField === "subcompany" ||
|
||||||
|
numField === "department" ||
|
||||||
|
numField === "jobtitles"
|
||||||
|
) {
|
||||||
|
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;
|
||||||
|
|
@ -0,0 +1,397 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 预留编号设置
|
||||||
|
* Date: 2022-06-08 09:53:51
|
||||||
|
* LastEditTime: 2022-06-15 11:00:55
|
||||||
|
*/
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { Row, Col, Spin, Modal, Button, Alert, message } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
import { i18n } from "../../../../public/i18n";
|
||||||
|
import {
|
||||||
|
WeaTab,
|
||||||
|
WeaButtonIcon,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaDialog,
|
||||||
|
WeaMoreButton,
|
||||||
|
WeaSearchGroup,
|
||||||
|
} from "ecCom";
|
||||||
|
import { WeaSwitch, WeaTableNew } from "comsMobx";
|
||||||
|
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
@inject("numberSet")
|
||||||
|
@observer
|
||||||
|
class ReservedNumberSetting extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
addVisible: false,
|
||||||
|
showSearchAd: false,
|
||||||
|
reservedcode: "",
|
||||||
|
previewStr: "",
|
||||||
|
date: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { numberSet, onChangeAddVisible } = this.props;
|
||||||
|
const { reservedForm } = numberSet;
|
||||||
|
if (nextProps.addVisible !== this.props.addVisible) {
|
||||||
|
!nextProps.addVisible &&
|
||||||
|
this.setState({ addVisible: false }, () => {
|
||||||
|
reservedForm.reset();
|
||||||
|
onChangeAddVisible && onChangeAddVisible();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* name:渲染搜索栏
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
getPanelComponents = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { searchCondition, form } = numberSet;
|
||||||
|
let colList = [];
|
||||||
|
const { isFormInit } = form;
|
||||||
|
isFormInit &&
|
||||||
|
searchCondition.map((c) => {
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
colList.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}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<Row ecId={`${(this && this.props && this.props.ecId) || ""}_Row@ppeb6z`}>
|
||||||
|
{colList}
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
onSearchChange = (reservedcode) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { form } = numberSet;
|
||||||
|
this.setState({ reservedcode });
|
||||||
|
!_.isEmpty(form.getFormParams()) &&
|
||||||
|
form.updateFields({
|
||||||
|
reservedcode: {
|
||||||
|
value: reservedcode,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 查询
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handelSearch = () => {
|
||||||
|
const { onSearchReservedNumberset } = this.props;
|
||||||
|
onSearchReservedNumberset && onSearchReservedNumberset();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 删除 预留编号
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleDelete = () => {
|
||||||
|
const { numberSet, onDeleteReservedNumber } = this.props;
|
||||||
|
const { tableStore } = numberSet;
|
||||||
|
const selectedKeys = toJS(tableStore.selectedRowKeys);
|
||||||
|
Modal.confirm({
|
||||||
|
title: "信息确认",
|
||||||
|
content: `确定要删除选择的记录吗?`,
|
||||||
|
onOk: () => {
|
||||||
|
onDeleteReservedNumber &&
|
||||||
|
onDeleteReservedNumber(selectedKeys.join(","));
|
||||||
|
},
|
||||||
|
onCancel: () => { },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleAddReservedNumber = () => {
|
||||||
|
const { onAddReservedNumber } = this.props;
|
||||||
|
this.setState({ addVisible: true }, () => {
|
||||||
|
onAddReservedNumber && onAddReservedNumber();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 提交预留编号设置
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleSubmitReservedNumber = () => {
|
||||||
|
const { numberSet, onSubmitReservedNumber } = this.props;
|
||||||
|
const { reservedForm, condition } = numberSet;
|
||||||
|
reservedForm.validateForm().then((f) => {
|
||||||
|
if (f.isValid) {
|
||||||
|
const { desc: reserveddesc, flowcode: reservedcodes } =
|
||||||
|
reservedForm.getFormParams() || {};
|
||||||
|
if (!/(^[1-9]\d*$)/.test(reservedcodes)) {
|
||||||
|
message.warning(`"流水号"格式不正确,请重新输入!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onSubmitReservedNumber &&
|
||||||
|
onSubmitReservedNumber({
|
||||||
|
reserveddesc,
|
||||||
|
reservedcodes: this.state.previewStr,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
message.warning("请完善表单信息");
|
||||||
|
f.showErrors();
|
||||||
|
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 新增预留编号表单渲染
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
getReservedForm = () => {
|
||||||
|
const { condition, reservedForm } = this.props.numberSet;
|
||||||
|
let reservedFormItem = [];
|
||||||
|
const { isFormInit } = reservedForm;
|
||||||
|
isFormInit &&
|
||||||
|
condition.map((c, i) => {
|
||||||
|
let switchItem = [];
|
||||||
|
c.items.map((field, index) => {
|
||||||
|
switchItem.push({
|
||||||
|
com: (
|
||||||
|
<div>
|
||||||
|
{i === condition.length - 1 && index === 0 && (
|
||||||
|
<div style={{ width: 280 }}>
|
||||||
|
<Alert
|
||||||
|
message="填写完上方编号组成后才会显示当前流水号"
|
||||||
|
type="warning"
|
||||||
|
showIcon
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<WeaFormItem
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaFormItem@merei2@${index}`}
|
||||||
|
label={`${field.label}`}
|
||||||
|
labelCol={{ span: `${field.labelcol}` }}
|
||||||
|
tipPosition="bottom"
|
||||||
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||||
|
<WeaSwitch
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaSwitch@5r6c5a@${index}`}
|
||||||
|
fieldConfig={field}
|
||||||
|
form={reservedForm}
|
||||||
|
formParams={reservedForm.getFormParams()}
|
||||||
|
onChange={this.handleFormItemChange}
|
||||||
|
/>
|
||||||
|
{field.domkey[0] === "flowcode" && (
|
||||||
|
<p>格式为:5,6-10,21,66,99</p>
|
||||||
|
)}
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
colSpan: 1,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
reservedFormItem.push(
|
||||||
|
<WeaSearchGroup
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaSearchGroup@qaih5l@${i}`}
|
||||||
|
needTigger={true}
|
||||||
|
title={c.title}
|
||||||
|
showGroup={c.defaultshow}
|
||||||
|
items={switchItem}
|
||||||
|
col={1}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return reservedFormItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 输出指定个数0
|
||||||
|
* param {*} num
|
||||||
|
* param {*} length
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
prefixInteger = (num, length) => {
|
||||||
|
return (Array(length).join("0") + num).slice(-length);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 字符串替换
|
||||||
|
* param {*} str
|
||||||
|
* param {*} index
|
||||||
|
* param {*} char
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
replaceStr2 = (str, index, char) => {
|
||||||
|
return str.substring(0, index) + char;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 预留编号的设置
|
||||||
|
* param {*} formVal
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleFormItemChange = (formVal) => {
|
||||||
|
const { numberSet, onSubmitReservedNumber } = this.props;
|
||||||
|
const { reservedForm, condition } = numberSet;
|
||||||
|
const NumberOfData = reservedForm.getFormParams() || {};
|
||||||
|
let previewStr = "",
|
||||||
|
originStr = "";
|
||||||
|
for (let i in NumberOfData) {
|
||||||
|
if (
|
||||||
|
i.indexOf("STRING") > -1 ||
|
||||||
|
i.indexOf("YEAR") > -1 ||
|
||||||
|
i.indexOf("MONTH") > -1 ||
|
||||||
|
i.indexOf("DAY") > -1
|
||||||
|
) {
|
||||||
|
originStr = originStr + NumberOfData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let integer_0 = this.prefixInteger(0, Number(NumberOfData["NUMBER"]));
|
||||||
|
//预留流水号值输入
|
||||||
|
if (_.hasIn(formVal, "flowcode")) {
|
||||||
|
const inputValue = formVal["flowcode"].value;
|
||||||
|
if (inputValue.length <= Number(NumberOfData["NUMBER"])) {
|
||||||
|
previewStr =
|
||||||
|
originStr +
|
||||||
|
this.replaceStr2(
|
||||||
|
integer_0,
|
||||||
|
integer_0.length - inputValue.length,
|
||||||
|
inputValue
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
previewStr = originStr + previewStr + inputValue;
|
||||||
|
}
|
||||||
|
this.setState({ previewStr: inputValue ? previewStr : "" });
|
||||||
|
} else if (
|
||||||
|
_.hasIn(formVal, "YEAR") ||
|
||||||
|
_.hasIn(formVal, "MONTH") ||
|
||||||
|
_.hasIn(formVal, "DAY")
|
||||||
|
) {
|
||||||
|
const { flowcode } = NumberOfData;
|
||||||
|
if (flowcode.length <= Number(NumberOfData["NUMBER"])) {
|
||||||
|
previewStr =
|
||||||
|
originStr +
|
||||||
|
this.replaceStr2(
|
||||||
|
integer_0,
|
||||||
|
integer_0.length - flowcode.length,
|
||||||
|
flowcode
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
previewStr = originStr + previewStr + flowcode;
|
||||||
|
}
|
||||||
|
this.setState({ previewStr });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
showSearchAd,
|
||||||
|
reservedcodem,
|
||||||
|
addVisible,
|
||||||
|
reservedcode,
|
||||||
|
date,
|
||||||
|
previewStr,
|
||||||
|
} = this.state;
|
||||||
|
const { numberSet, loading } = this.props;
|
||||||
|
const { form, tableStore, reservedForm } = numberSet;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<WeaTab
|
||||||
|
searchType={["base", "advanced"]}
|
||||||
|
showSearchAd={showSearchAd}
|
||||||
|
advanceHeight={200}
|
||||||
|
setShowSearchAd={(bool) => {
|
||||||
|
this.setState({
|
||||||
|
showSearchAd: bool,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
searchsAd={this.getPanelComponents()}
|
||||||
|
searchsBaseValue={
|
||||||
|
_.isEmpty(form.getFormParams())
|
||||||
|
? reservedcode
|
||||||
|
: form.getFormParams().reservedcode
|
||||||
|
}
|
||||||
|
onSearchChange={this.onSearchChange}
|
||||||
|
onSearch={this.handelSearch}
|
||||||
|
onAdReset={() => form.reset()}
|
||||||
|
onAdSearch={this.handelSearch}
|
||||||
|
hasMask={false}
|
||||||
|
buttons={[
|
||||||
|
<WeaButtonIcon
|
||||||
|
buttonType="add"
|
||||||
|
type="primary"
|
||||||
|
onClick={this.handleAddReservedNumber}
|
||||||
|
/>,
|
||||||
|
<WeaButtonIcon
|
||||||
|
buttonType="del"
|
||||||
|
type="primary"
|
||||||
|
onClick={this.handleDelete}
|
||||||
|
disabled={_.isEmpty(toJS(tableStore.selectedRowKeys))}
|
||||||
|
/>,
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<WeaTable
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaTable@b43d3f`}
|
||||||
|
comsWeaTableStore={tableStore}
|
||||||
|
hasOrder={true}
|
||||||
|
needScroll={true}
|
||||||
|
/>
|
||||||
|
{/* 起始/预留编号设置 */}
|
||||||
|
<WeaDialog
|
||||||
|
title={`新建预留编号`}
|
||||||
|
visible={addVisible}
|
||||||
|
onCancel={() => {
|
||||||
|
reservedForm.resetForm();
|
||||||
|
this.setState({ addVisible: false, previewStr: "" });
|
||||||
|
}}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
hasScroll
|
||||||
|
style={{ width: 640, height: 480 }}
|
||||||
|
buttons={[
|
||||||
|
<Button
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_Button@jd6baw`}
|
||||||
|
type="primary"
|
||||||
|
loading={loading}
|
||||||
|
onClick={this.handleSubmitReservedNumber}>
|
||||||
|
{i18n.button.save()}
|
||||||
|
</Button>,
|
||||||
|
<WeaMoreButton
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaMoreButton@e4f4n1`}
|
||||||
|
/>,
|
||||||
|
]}>
|
||||||
|
{this.getReservedForm()}
|
||||||
|
<WeaSearchGroup title="预留编号预览" showGroup>
|
||||||
|
<p style={{ textAlign: "center", color: "#30b7f5" }}>
|
||||||
|
{previewStr}
|
||||||
|
</p>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</WeaDialog>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReservedNumberSetting;
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 起始编号设置
|
||||||
|
* Date: 2022-06-07 15:27:43
|
||||||
|
* LastEditTime: 2022-06-15 10:47:55
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { WeaTableEdit, WeaInputNumber, WeaDatePicker, WeaBrowser, WeaError } from "ecCom";
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const enumStr = {
|
||||||
|
YEAR: '年',
|
||||||
|
MONTH: '月份',
|
||||||
|
DAY: '日期'
|
||||||
|
}
|
||||||
|
const browserProps = {
|
||||||
|
iconBgcolor: '#217346',
|
||||||
|
icon: 'icon-coms-hrm',
|
||||||
|
isSingle: false,
|
||||||
|
inputStyle: { width: 200 },
|
||||||
|
viewAttr: 3
|
||||||
|
}
|
||||||
|
class StartNumberSetting extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
|
subCompanyId: '',
|
||||||
|
jobtitlesId: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleDatePickerChange = (val, type) => {
|
||||||
|
this.setState({
|
||||||
|
[type]: val
|
||||||
|
}, () => {
|
||||||
|
const { startDate, endDate, subCompanyId, jobtitlesId } = this.state;
|
||||||
|
const { onSet } = this.props;
|
||||||
|
onSet('start', { startDate, endDate, subCompanyId, jobtitlesId })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleBrowserChange = (val, type) => {
|
||||||
|
this.setState({
|
||||||
|
[type]: val
|
||||||
|
}, () => {
|
||||||
|
const { onSet } = this.props;
|
||||||
|
onSet('start', { ...this.state, [type]: val })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleChangeTable = (datas) => {
|
||||||
|
const { onChange, startNumberInfo } = this.props;
|
||||||
|
const newColumns = _.map(startNumberInfo.columns, (it) => ({
|
||||||
|
...it,
|
||||||
|
com: [{ type: "INPUTNUMBER", key: it.dataIndex, viewAttr: 3, min: 0 }],
|
||||||
|
}));
|
||||||
|
onChange && onChange(newColumns, datas);
|
||||||
|
};
|
||||||
|
getRowSelection = (rowSelection) => {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { startDate, endDate } = this.state;
|
||||||
|
const { startNumberInfo, companyInfo } = this.props;
|
||||||
|
const { deptSerial = {}, dateSerial = {}, jobtitlesSerial = {} } = companyInfo;
|
||||||
|
const newColumns = _.map(startNumberInfo.columns, (it) => ({
|
||||||
|
...it,
|
||||||
|
com: [{ type: it.dataIndex === 'startnum' ? "INPUTNUMBER" : "TEXT", key: it.dataIndex, viewAttr: 3, min: 0 }],
|
||||||
|
}));
|
||||||
|
const format = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "yyyy-MM-dd";
|
||||||
|
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "yyyy-MM-DD";
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
{dateSerial.enable == '1' && (
|
||||||
|
<div style={{ padding: "20px 30px" }}>
|
||||||
|
<span style={{ width: 100, display: "inline-block" }}>{enumStr[dateSerial.key]}</span>
|
||||||
|
<WeaDatePicker format={format} value={moment(startDate ? startDate : new Date()).format(formatVal)} onChange={val => this.handleDatePickerChange(val, 'startDate')} />
|
||||||
|
<span> — </span>
|
||||||
|
<WeaDatePicker format={format} value={moment(endDate ? endDate : new Date()).format(formatVal)} onChange={val => this.handleDatePickerChange(val, 'endDate')} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{
|
||||||
|
(deptSerial.enable == '1' && (deptSerial.key === "SUBCOMPANY" || deptSerial.key === "DEPARTMENT")) && (
|
||||||
|
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||||
|
<span style={{ display: "inline-block", width: 100 }}>分部名称</span>
|
||||||
|
<WeaError name='dept' tipPosition='bottom' error={'分部名称必填!'}>
|
||||||
|
<WeaBrowser
|
||||||
|
{...browserProps}
|
||||||
|
title={"分部名称"}
|
||||||
|
type={194}
|
||||||
|
onChange={ids => this.handleBrowserChange(ids, 'subCompanyId')}
|
||||||
|
/>
|
||||||
|
</WeaError>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(deptSerial.enable == '1' && deptSerial.key === "DEPARTMENT") && (
|
||||||
|
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||||
|
<span style={{ display: "inline-block", width: 100 }}>部门名称</span>
|
||||||
|
<WeaError name='dept' tipPosition='bottom' error={'部门名称必填!'}>
|
||||||
|
<WeaBrowser
|
||||||
|
{...browserProps}
|
||||||
|
title={"部门名称"}
|
||||||
|
type={57}
|
||||||
|
onChange={ids => this.handleBrowserChange(ids, 'deptId')}
|
||||||
|
/>
|
||||||
|
</WeaError>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(jobtitlesSerial.enable == '1' && jobtitlesSerial.key === "JOBTITLES") && (
|
||||||
|
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||||
|
<span style={{ display: "inline-block", width: 100 }}>岗位名称</span>
|
||||||
|
<WeaError name='dept' tipPosition='bottom' error={'岗位名称必填!'}>
|
||||||
|
<WeaBrowser
|
||||||
|
{...browserProps}
|
||||||
|
title={"岗位名称"}
|
||||||
|
type={278}
|
||||||
|
onChange={ids => this.handleBrowserChange(ids, 'jobtitlesId')}
|
||||||
|
/>
|
||||||
|
</WeaError>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
<WeaTableEdit
|
||||||
|
draggable={false}
|
||||||
|
showAdd={false}
|
||||||
|
showDelete={false}
|
||||||
|
showCopy={false}
|
||||||
|
getRowSelection={this.getRowSelection}
|
||||||
|
columns={newColumns}
|
||||||
|
datas={startNumberInfo.dataSource}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
/>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StartNumberSetting;
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 起始编号及预留编号设置
|
||||||
|
* Date: 2022-05-17 15:51:41
|
||||||
|
* LastEditTime: 2022-06-14 18:29:38
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { Button, Modal } from "antd";
|
||||||
|
import StartNumberSetting from "./startNumberSetting";
|
||||||
|
import ReservedNumberSetting from "./reservedNumberSetting";
|
||||||
|
import { WeaFormItem, WeaDialog, WeaMoreButton } from "ecCom";
|
||||||
|
import { i18n } from "../../../../public/i18n";
|
||||||
|
class StartReservedNumberSet extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
reservedAddVisible: true,
|
||||||
|
dialogProps: {
|
||||||
|
type: "start",
|
||||||
|
visible: false,
|
||||||
|
title: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
handleClickStartNumber = (type) => {
|
||||||
|
const { onSet } = this.props;
|
||||||
|
const { dialogProps } = this.state;
|
||||||
|
onSet && onSet(type);
|
||||||
|
this.setState({
|
||||||
|
dialogProps: {
|
||||||
|
...dialogProps,
|
||||||
|
type,
|
||||||
|
visible: true,
|
||||||
|
title: type === "start" ? "起始编号" : "预留编号",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleChangeTable = (newColumns, datas) => {
|
||||||
|
const { onChange } = this.props;
|
||||||
|
onChange && onChange(newColumns, datas);
|
||||||
|
};
|
||||||
|
handleSave = () => {
|
||||||
|
const { onSaveStartNumber } = this.props;
|
||||||
|
Modal.confirm({
|
||||||
|
title: "信息确认",
|
||||||
|
content: `是否保存数据?`,
|
||||||
|
onOk: () => {
|
||||||
|
onSaveStartNumber && onSaveStartNumber();
|
||||||
|
},
|
||||||
|
onCancel: () => { },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleClose = () => {
|
||||||
|
this.setState({
|
||||||
|
dialogProps: {
|
||||||
|
...this.state.dialogProps,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleCloseReservedModal = () => {
|
||||||
|
this.setState({
|
||||||
|
reservedAddVisible: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { dialogProps, reservedAddVisible } = this.state;
|
||||||
|
const { type } = dialogProps;
|
||||||
|
const {
|
||||||
|
onSet,
|
||||||
|
companyInfo,
|
||||||
|
startNumberInfo,
|
||||||
|
onDeleteReservedNumber,
|
||||||
|
onAddReservedNumber,
|
||||||
|
onSubmitReservedNumber,
|
||||||
|
onSearchReservedNumberset,
|
||||||
|
loading,
|
||||||
|
} = this.props;
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<WeaFormItem
|
||||||
|
label="起始编号"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<i
|
||||||
|
className="icon-coms-Flow-setting"
|
||||||
|
onClick={() => this.handleClickStartNumber("start")}></i>
|
||||||
|
</WeaFormItem>
|
||||||
|
<WeaFormItem
|
||||||
|
label="预留编号"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<i
|
||||||
|
className="icon-coms-Flow-setting"
|
||||||
|
onClick={() => this.handleClickStartNumber("reserved")}></i>
|
||||||
|
</WeaFormItem>
|
||||||
|
{/* 起始/预留编号设置 */}
|
||||||
|
<WeaDialog
|
||||||
|
onCancel={this.handleClose}
|
||||||
|
icon="icon-coms-hrm"
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
{...dialogProps}
|
||||||
|
hasScroll
|
||||||
|
style={{ width: 900, height: 480 }}
|
||||||
|
buttons={
|
||||||
|
type === "start"
|
||||||
|
? [
|
||||||
|
<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`}
|
||||||
|
/>,
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
<WeaMoreButton
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||||
|
}_WeaMoreButton@e4f4n1`}
|
||||||
|
/>,
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
{type === "start" ? (
|
||||||
|
<StartNumberSetting
|
||||||
|
onSet={onSet}
|
||||||
|
companyInfo={companyInfo}
|
||||||
|
startNumberInfo={startNumberInfo}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<ReservedNumberSetting
|
||||||
|
addVisible={reservedAddVisible}
|
||||||
|
onDeleteReservedNumber={onDeleteReservedNumber}
|
||||||
|
onAddReservedNumber={onAddReservedNumber}
|
||||||
|
onSubmitReservedNumber={onSubmitReservedNumber}
|
||||||
|
onSearchReservedNumberset={onSearchReservedNumberset}
|
||||||
|
loading={loading}
|
||||||
|
onChangeAddVisible={() =>
|
||||||
|
this.setState({ reservedAddVisible: true })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</WeaDialog>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StartReservedNumberSet;
|
||||||
|
|
@ -0,0 +1,417 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 分部编号设置
|
||||||
|
* Date: 2022-05-17 14:30:57
|
||||||
|
* LastEditTime: 2022-06-14 18:26:07
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Button, message } from "antd";
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaCheckbox,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaSelect,
|
||||||
|
WeaHelpfulTip,
|
||||||
|
} from "ecCom";
|
||||||
|
import StartReservedNumberSet from "./components/startReservedNumberSet";
|
||||||
|
import { serialFieldOptions } from "../constants";
|
||||||
|
import NumberComposition from "./components/numberComposition";
|
||||||
|
import { i18n } from "../../../public/i18n";
|
||||||
|
import moment from "moment";
|
||||||
|
import "./index.less";
|
||||||
|
|
||||||
|
@inject("numberSet")
|
||||||
|
@observer
|
||||||
|
export default class BranchNumSetting extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
options: [],
|
||||||
|
loading: false,
|
||||||
|
dataSource: [],
|
||||||
|
startNumberInfo: {
|
||||||
|
columns: [],
|
||||||
|
dataSource: [],
|
||||||
|
},
|
||||||
|
subCompanyInfo: {
|
||||||
|
details: [],
|
||||||
|
serialenable: "0",
|
||||||
|
dateSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getCodeSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
getCodeSetting = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet
|
||||||
|
.getCodeSetting({ serialtype: "SUBCOMPANY" })
|
||||||
|
.then(({ api_status, details, serialenable, dateSerial = {} }) => {
|
||||||
|
if (api_status && !_.isEmpty(details)) {
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: { details, serialenable, dateSerial },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmit = () => {
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { dataSource, subCompanyInfo } = this.state;
|
||||||
|
const { serialenable, dateSerial } = subCompanyInfo;
|
||||||
|
const details = _.map(dataSource, (it, showorder) => {
|
||||||
|
const { numField, value: rulevalue } = it;
|
||||||
|
return {
|
||||||
|
ruletype: _.upperCase(numField),
|
||||||
|
rulevalue,
|
||||||
|
showorder,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
serialenable,
|
||||||
|
details,
|
||||||
|
dateSerial,
|
||||||
|
serialtype: "SUBCOMPANY",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
this.setState({ loading: true });
|
||||||
|
numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
resolve(api_status);
|
||||||
|
} else {
|
||||||
|
reject("接口调用失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeCode = (data) => {
|
||||||
|
const tmpV = _.filter(
|
||||||
|
data,
|
||||||
|
(it) =>
|
||||||
|
it.numField === "year" ||
|
||||||
|
it.numField === "month" ||
|
||||||
|
it.numField === "day"
|
||||||
|
);
|
||||||
|
this.setState({
|
||||||
|
dataSource: _.cloneDeep(data),
|
||||||
|
options: _.map(tmpV, (it) => {
|
||||||
|
const { numFieldName: showname, numField: key } = it;
|
||||||
|
return { key: _.upperCase(key), showname };
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSetNumber = (type, data = {}) => {
|
||||||
|
this.handleSubmit().then((res) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { subCompanyInfo } = this.state;
|
||||||
|
const { dateSerial } = subCompanyInfo;
|
||||||
|
if (type === "start") {
|
||||||
|
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 1,
|
||||||
|
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||||
|
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||||
|
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, columns, dataSource }) => {
|
||||||
|
if (api_status) {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: { columns, dataSource },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
numberSet.getAdvanceSearchCondition();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "SUBCOMPANY",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleChangeTable = (newColumns, datas) => {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: {
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
columns: newColumns,
|
||||||
|
dataSource: datas,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmitStartNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
coderuleid: 1,
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
numberSet.saveStartNum(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 删除预留编号
|
||||||
|
* param {*} ids
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
deleteReservedNumber = (ids) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("删除成功");
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "SUBCOMPANY",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name:新增预留编号
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleAddReservedNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { reservedForm } = numberSet;
|
||||||
|
const { options } = this.state;
|
||||||
|
numberSet.getReservedCodeFrom({ serialtype: "SUBCOMPANY" }).then(() => {
|
||||||
|
const type = _.get(_.last(options), ['key']);
|
||||||
|
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 1,
|
||||||
|
type,
|
||||||
|
dateStart: moment().format(format),
|
||||||
|
dateEnd: moment().format(format),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, dataSource }) => {
|
||||||
|
if (api_status && !_.isEmpty(dataSource)) {
|
||||||
|
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||||
|
reservedForm.updateFields({
|
||||||
|
currentnumber: {
|
||||||
|
value: currentnumber,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 保存预留设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleSubmitReservedNumber = (params) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = { ...params, serialtype: "SUBCOMPANY" };
|
||||||
|
this.setState({ loading: true });
|
||||||
|
numberSet.saveReservedCode(payload).then(({ api_status }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleCloseReservedModal();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "SUBCOMPANY",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name:提示文本
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
helpContent = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>开启后,可根据设置的分部编号规则自动生成分部编号,涉及场景如下:</p>
|
||||||
|
<p>1.手动新建和手动编辑分部时可选择重新生成编号和选择预留分部编号;</p>
|
||||||
|
<p>2.组织结构导入-添加新分部且分部编号列为空时,会自动生成分部编号;</p>
|
||||||
|
<p>3.导入人员-添加时,新创建的分部可自动生成分部编号;</p>
|
||||||
|
<p>【注意】开启前请先确认分部编号字段已启用!</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||||
|
const { details, serialenable, dateSerial } = subCompanyInfo;
|
||||||
|
const btns = [
|
||||||
|
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||||
|
保存
|
||||||
|
</Button>,
|
||||||
|
];
|
||||||
|
const dropMenuDatas = [
|
||||||
|
{
|
||||||
|
key: "save",
|
||||||
|
disabled: false,
|
||||||
|
icon: <i className="icon-coms-Preservation" />,
|
||||||
|
content: "保存",
|
||||||
|
onClick: (key) => this.handleSubmit(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
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={serialenable}
|
||||||
|
helpfulTip={this.helpContent}
|
||||||
|
helpfulTipProps={{ placement: "top" }}
|
||||||
|
display="switch"
|
||||||
|
id="num-set-switch"
|
||||||
|
onChange={(checkVal) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
serialenable: checkVal,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
{/* 内容区 */}
|
||||||
|
{serialenable === "1" && (
|
||||||
|
<Fragment>
|
||||||
|
<div className="numberComposition">
|
||||||
|
<WeaSearchGroup title={"编号组成"} showGroup>
|
||||||
|
<NumberComposition
|
||||||
|
onChange={this.handleChangeCode}
|
||||||
|
dataSource={details}
|
||||||
|
options={serialFieldOptions}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
{!_.isEmpty(options) && (
|
||||||
|
<div className="codeNumbering">
|
||||||
|
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="日期单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-date-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{dateSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(options, item => ({ ...item, showname: item.showname.substr(2, 1) }))}
|
||||||
|
value={dateSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="startReservedNumberSet">
|
||||||
|
<WeaSearchGroup
|
||||||
|
title={"起始编号及预留编号设置"}
|
||||||
|
showGroup
|
||||||
|
center>
|
||||||
|
<StartReservedNumberSet
|
||||||
|
ref={(dom) => (this.numberSetRef = dom)}
|
||||||
|
loading={loading}
|
||||||
|
onSet={this.handleSetNumber}
|
||||||
|
companyInfo={subCompanyInfo}
|
||||||
|
startNumberInfo={startNumberInfo}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
onSaveStartNumber={this.handleSubmitStartNumber}
|
||||||
|
onDeleteReservedNumber={this.deleteReservedNumber}
|
||||||
|
onAddReservedNumber={this.handleAddReservedNumber}
|
||||||
|
onSubmitReservedNumber={this.handleSubmitReservedNumber}
|
||||||
|
onSearchReservedNumberset={() =>
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "SUBCOMPANY",
|
||||||
|
checkboxType: "multi",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
.branch-wapper,
|
||||||
|
.dept-number-set {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.branch-content,
|
||||||
|
.dept-content {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden auto;
|
||||||
|
|
||||||
|
.switch-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20px 20% 40px 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.numberComposition .ant-table-thead {
|
||||||
|
background: #f7fbfe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.codeNumbering {
|
||||||
|
.codeNumbering-operateWapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.wea-select {
|
||||||
|
width: inherit !important;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wea-helpful-tip {
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
export const serialFieldOptions = [
|
||||||
|
{
|
||||||
|
key: "string",
|
||||||
|
showname: "字符串",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "year",
|
||||||
|
showname: "当前年份",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "month",
|
||||||
|
showname: "当前月份",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "day",
|
||||||
|
showname: "当前日期",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,481 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 部门编号设置
|
||||||
|
* Date: 2022-06-06 09:37:39
|
||||||
|
* LastEditTime: 2022-06-15 09:52:04
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Button, message } from "antd";
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaCheckbox,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaSelect,
|
||||||
|
WeaHelpfulTip,
|
||||||
|
} from "ecCom";
|
||||||
|
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||||
|
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||||
|
import { serialFieldOptions } from "../constants";
|
||||||
|
import { i18n } from "../../../public/i18n";
|
||||||
|
import moment from "moment";
|
||||||
|
import "../branchNumSetting/index.less";
|
||||||
|
|
||||||
|
const deptSerialFieldOptions = [{ key: 'subcompany', showname: "分部编号" }]
|
||||||
|
|
||||||
|
@inject("numberSet")
|
||||||
|
@observer
|
||||||
|
export default class DeptNumberSet extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
options: [],
|
||||||
|
loading: false,
|
||||||
|
dataSource: [],
|
||||||
|
startNumberInfo: {
|
||||||
|
columns: [],
|
||||||
|
dataSource: [],
|
||||||
|
},
|
||||||
|
subCompanyInfo: {
|
||||||
|
details: [],
|
||||||
|
serialenable: "0",
|
||||||
|
deptSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
dateSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getCodeSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
getCodeSetting = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet
|
||||||
|
.getCodeSetting({ serialtype: "DEPARTMENT" })
|
||||||
|
.then(({ api_status, details, serialenable, dateSerial = {}, deptSerial = {} }) => {
|
||||||
|
if (api_status && !_.isEmpty(details)) {
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: { details, serialenable, dateSerial, deptSerial },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmit = () => {
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { dataSource, subCompanyInfo } = this.state;
|
||||||
|
const { serialenable, dateSerial, deptSerial } = subCompanyInfo;
|
||||||
|
const details = _.map(dataSource, (it, showorder) => {
|
||||||
|
const { numField, value: rulevalue } = it;
|
||||||
|
return {
|
||||||
|
ruletype: _.upperCase(numField),
|
||||||
|
rulevalue,
|
||||||
|
showorder,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
serialenable,
|
||||||
|
details,
|
||||||
|
dateSerial,
|
||||||
|
deptSerial,
|
||||||
|
serialtype: "DEPARTMENT",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
this.setState({ loading: true });
|
||||||
|
numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
resolve(api_status);
|
||||||
|
} else {
|
||||||
|
reject("接口调用失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeCode = (data) => {
|
||||||
|
const tmpV = _.filter(
|
||||||
|
data,
|
||||||
|
(it) =>
|
||||||
|
it.numField === "year" ||
|
||||||
|
it.numField === "month" ||
|
||||||
|
it.numField === "day" ||
|
||||||
|
it.numField === "subcompany" ||
|
||||||
|
it.numField === "department" ||
|
||||||
|
it.numField === "jobtitles"
|
||||||
|
);
|
||||||
|
this.setState({
|
||||||
|
dataSource: _.cloneDeep(data),
|
||||||
|
options: _.map(tmpV, (it) => {
|
||||||
|
const { numFieldName: showname, numField: key } = it;
|
||||||
|
return { key: _.upperCase(key), showname };
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSetNumber = (type, data = {}) => {
|
||||||
|
this.handleSubmit().then((res) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { subCompanyInfo } = this.state;
|
||||||
|
const { dateSerial, deptSerial } = subCompanyInfo;
|
||||||
|
if (type === "start") {
|
||||||
|
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||||
|
let payload = {
|
||||||
|
coderuleid: 2,
|
||||||
|
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||||
|
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||||
|
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||||
|
subCompanyId: data.subCompanyId ? data.subCompanyId : "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
if (deptSerial.enable === '1' && !data.subCompanyId) return
|
||||||
|
if (deptSerial.enable === '1' && data.subCompanyId) {
|
||||||
|
payload = { ...payload, type: payload.type + ',' + deptSerial.key }
|
||||||
|
}
|
||||||
|
numberSet.getStartNumForm(payload).then(({ api_status, columns, dataSource }) => {
|
||||||
|
if (api_status) {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: { columns, dataSource },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
numberSet.getAdvanceSearchCondition();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "DEPARTMENT",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleChangeTable = (newColumns, datas) => {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: {
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
columns: newColumns,
|
||||||
|
dataSource: datas,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmitStartNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
coderuleid: 2,
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
numberSet.saveStartNum(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 删除预留编号
|
||||||
|
* param {*} ids
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
deleteReservedNumber = (ids) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("删除成功");
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "DEPARTMENT",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name:新增预留编号
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleAddReservedNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { reservedForm } = numberSet;
|
||||||
|
const { options } = this.state;
|
||||||
|
numberSet.getReservedCodeFrom({ serialtype: "DEPARTMENT" }).then(() => {
|
||||||
|
const type = _.get(_.last(options), ['key']);
|
||||||
|
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 2,
|
||||||
|
type,
|
||||||
|
dateStart: moment().format(format),
|
||||||
|
dateEnd: moment().format(format),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, dataSource }) => {
|
||||||
|
if (api_status && !_.isEmpty(dataSource)) {
|
||||||
|
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||||
|
reservedForm.updateFields({
|
||||||
|
currentnumber: {
|
||||||
|
value: currentnumber,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 保存预留设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleSubmitReservedNumber = (params) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = { ...params, serialtype: "DEPARTMENT" };
|
||||||
|
numberSet.saveReservedCode(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleCloseReservedModal();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "DEPARTMENT",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name:提示文本
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
helpContent = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>开启后,可根据设置的部门编号规则自动生成部门编号,涉及场景如下:</p>
|
||||||
|
<p>1.手动新建和手动编辑部门时可选择重新生成编号和选择预留部门编号;</p>
|
||||||
|
<p>2.导入人员-添加时,新创建的部门可自动生成部门编号;</p>
|
||||||
|
<p>3.组织结构导入-添加新部门且部门编号列为空时可自动生成部门编号;</p>
|
||||||
|
<p>【注意】开启前请先确认部门编号字段已启用!</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
render() {
|
||||||
|
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { details, serialenable, dateSerial = {}, deptSerial = {} } = subCompanyInfo;
|
||||||
|
const btns = [
|
||||||
|
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||||
|
保存
|
||||||
|
</Button>,
|
||||||
|
];
|
||||||
|
const dropMenuDatas = [
|
||||||
|
{
|
||||||
|
key: "save",
|
||||||
|
disabled: false,
|
||||||
|
icon: <i className="icon-coms-Preservation" />,
|
||||||
|
content: "保存",
|
||||||
|
onClick: (key) => this.handleSubmit(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<div className="dept-number-set">
|
||||||
|
<WeaTop
|
||||||
|
title={i18n.label.deptNumSetting()}
|
||||||
|
icon={<i className="icon-coms-hrm" />}
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
buttons={btns}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={dropMenuDatas}
|
||||||
|
/>
|
||||||
|
<div className="dept-content">
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="部门编号自动生成"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<WeaCheckbox
|
||||||
|
value={serialenable}
|
||||||
|
helpfulTip={this.helpContent}
|
||||||
|
helpfulTipProps={{ placement: "top" }}
|
||||||
|
display="switch"
|
||||||
|
id="num-set-switch"
|
||||||
|
onChange={(checkVal) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
serialenable: checkVal,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
{/* 内容区 */}
|
||||||
|
{serialenable === "1" && (
|
||||||
|
<Fragment>
|
||||||
|
<div className="numberComposition">
|
||||||
|
<WeaSearchGroup title={"编号组成"} showGroup>
|
||||||
|
<NumberComposition
|
||||||
|
onChange={this.handleChangeCode}
|
||||||
|
dataSource={details}
|
||||||
|
options={[...serialFieldOptions, ...deptSerialFieldOptions]}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
{!_.isEmpty(options) && (
|
||||||
|
<div className="codeNumbering">
|
||||||
|
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||||
|
{
|
||||||
|
!_.isEmpty(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||||
|
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) && 0 }}>
|
||||||
|
<WeaFormItem
|
||||||
|
label="日期单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-date-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{dateSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(2, 1) }))}
|
||||||
|
value={dateSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
!_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="机构单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={deptSerial.enable ? deptSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
deptSerial: {
|
||||||
|
...deptSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{deptSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(0, 2) }))}
|
||||||
|
value={deptSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
deptSerial: {
|
||||||
|
...deptSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后,可选择按分部进行单独流水"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="startReservedNumberSet">
|
||||||
|
<WeaSearchGroup
|
||||||
|
title={"起始编号及预留编号设置"}
|
||||||
|
showGroup
|
||||||
|
center>
|
||||||
|
<StartReservedNumberSet
|
||||||
|
ref={(dom) => (this.numberSetRef = dom)}
|
||||||
|
onSet={this.handleSetNumber}
|
||||||
|
companyInfo={subCompanyInfo}
|
||||||
|
loading={loading}
|
||||||
|
startNumberInfo={startNumberInfo}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
onSaveStartNumber={this.handleSubmitStartNumber}
|
||||||
|
onDeleteReservedNumber={this.deleteReservedNumber}
|
||||||
|
onAddReservedNumber={this.handleAddReservedNumber}
|
||||||
|
onSubmitReservedNumber={this.handleSubmitReservedNumber}
|
||||||
|
onSearchReservedNumberset={() =>
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "DEPARTMENT",
|
||||||
|
checkboxType: "multi",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,413 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 岗位编号设置
|
||||||
|
* Date: 2022-06-06 09:37:39
|
||||||
|
* LastEditTime: 2022-06-15 12:47:43
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Button, message } from "antd";
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaCheckbox,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaSelect,
|
||||||
|
WeaHelpfulTip,
|
||||||
|
} from "ecCom";
|
||||||
|
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||||
|
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||||
|
import { serialFieldOptions } from "../constants";
|
||||||
|
import { i18n } from "../../../public/i18n";
|
||||||
|
import moment from "moment";
|
||||||
|
import "../branchNumSetting/index.less";
|
||||||
|
|
||||||
|
@inject("numberSet")
|
||||||
|
@observer
|
||||||
|
export default class PostNumberSet extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
options: [],
|
||||||
|
loading: false,
|
||||||
|
dataSource: [],
|
||||||
|
startNumberInfo: {
|
||||||
|
columns: [],
|
||||||
|
dataSource: [],
|
||||||
|
},
|
||||||
|
subCompanyInfo: {
|
||||||
|
details: [],
|
||||||
|
serialenable: "0",
|
||||||
|
dateSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getCodeSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
getCodeSetting = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet
|
||||||
|
.getCodeSetting({ serialtype: "JOBTITLES" })
|
||||||
|
.then(({ api_status, details, serialenable, dateSerial = {} }) => {
|
||||||
|
if (api_status && !_.isEmpty(details)) {
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: { details, serialenable, dateSerial },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmit = () => {
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { dataSource, subCompanyInfo } = this.state;
|
||||||
|
const { serialenable, dateSerial } = subCompanyInfo;
|
||||||
|
const details = _.map(dataSource, (it, showorder) => {
|
||||||
|
const { numField, value: rulevalue } = it;
|
||||||
|
return {
|
||||||
|
ruletype: _.upperCase(numField),
|
||||||
|
rulevalue,
|
||||||
|
showorder,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
serialenable,
|
||||||
|
details,
|
||||||
|
dateSerial,
|
||||||
|
serialtype: "JOBTITLES",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
this.setState({ loading: true });
|
||||||
|
numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
resolve(api_status);
|
||||||
|
} else {
|
||||||
|
reject("接口调用失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeCode = (data) => {
|
||||||
|
const tmpV = _.filter(
|
||||||
|
data,
|
||||||
|
(it) =>
|
||||||
|
it.numField === "year" ||
|
||||||
|
it.numField === "month" ||
|
||||||
|
it.numField === "day"
|
||||||
|
);
|
||||||
|
this.setState({
|
||||||
|
dataSource: _.cloneDeep(data),
|
||||||
|
options: _.map(tmpV, (it) => {
|
||||||
|
const { numFieldName: showname, numField: key } = it;
|
||||||
|
return { key: _.upperCase(key), showname };
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSetNumber = (type, data = {}) => {
|
||||||
|
this.handleSubmit().then(() => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { subCompanyInfo } = this.state;
|
||||||
|
const { dateSerial } = subCompanyInfo;
|
||||||
|
if (type === "start") {
|
||||||
|
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 4,
|
||||||
|
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||||
|
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||||
|
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, columns, dataSource }) => {
|
||||||
|
if (api_status) {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: { columns, dataSource },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
numberSet.getAdvanceSearchCondition();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "JOBTITLES",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleChangeTable = (newColumns, datas) => {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: {
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
columns: newColumns,
|
||||||
|
dataSource: datas,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmitStartNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
coderuleid: 4,
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
numberSet.saveStartNum(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 删除预留编号
|
||||||
|
* param {*} ids
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
deleteReservedNumber = (ids) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("删除成功");
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "JOBTITLES",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name:新增预留编号
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleAddReservedNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { reservedForm } = numberSet;
|
||||||
|
const { options } = this.state;
|
||||||
|
numberSet.getReservedCodeFrom({ serialtype: "JOBTITLES" }).then(() => {
|
||||||
|
const type = _.get(_.last(options), ['key']);
|
||||||
|
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 4,
|
||||||
|
type,
|
||||||
|
dateStart: moment().format(format),
|
||||||
|
dateEnd: moment().format(format),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, dataSource }) => {
|
||||||
|
if (api_status && !_.isEmpty(dataSource)) {
|
||||||
|
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||||
|
reservedForm.updateFields({
|
||||||
|
currentnumber: {
|
||||||
|
value: currentnumber,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 保存预留设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleSubmitReservedNumber = (params) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = { ...params, serialtype: "JOBTITLES" };
|
||||||
|
numberSet.saveReservedCode(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleCloseReservedModal();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "JOBTITLES",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name:提示文本
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
helpContent = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>开启后,可根据设置的部门编号规则自动生成部门编号,涉及场景如下:</p>
|
||||||
|
<p>1.手动新建和手动编辑部门时可选择重新生成编号和选择预留部门编号;</p>
|
||||||
|
<p>2.导入人员-添加时,新创建的部门可自动生成部门编号;</p>
|
||||||
|
<p>3.组织结构导入-添加新部门且部门编号列为空时可自动生成部门编号;</p>
|
||||||
|
<p>【注意】开启前请先确认部门编号字段已启用!</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
render() {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||||
|
const { details, serialenable, dateSerial } = subCompanyInfo;
|
||||||
|
const btns = [
|
||||||
|
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||||
|
保存
|
||||||
|
</Button>,
|
||||||
|
];
|
||||||
|
const dropMenuDatas = [
|
||||||
|
{
|
||||||
|
key: "save",
|
||||||
|
disabled: false,
|
||||||
|
icon: <i className="icon-coms-Preservation" />,
|
||||||
|
content: "保存",
|
||||||
|
onClick: (key) => this.handleSubmit(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<div className="dept-number-set">
|
||||||
|
<WeaTop
|
||||||
|
title={i18n.label.postNumSetting()}
|
||||||
|
icon={<i className="icon-coms-hrm" />}
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
buttons={btns}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={dropMenuDatas}
|
||||||
|
/>
|
||||||
|
<div className="dept-content">
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="岗位编号自动生成"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<WeaCheckbox
|
||||||
|
value={serialenable}
|
||||||
|
helpfulTip={this.helpContent}
|
||||||
|
helpfulTipProps={{ placement: "top" }}
|
||||||
|
display="switch"
|
||||||
|
id="num-set-switch"
|
||||||
|
onChange={(checkVal) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
serialenable: checkVal,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
{/* 内容区 */}
|
||||||
|
{serialenable === "1" && (
|
||||||
|
<Fragment>
|
||||||
|
<div className="numberComposition">
|
||||||
|
<WeaSearchGroup title={"编号组成"} showGroup>
|
||||||
|
<NumberComposition
|
||||||
|
onChange={this.handleChangeCode}
|
||||||
|
dataSource={details}
|
||||||
|
options={serialFieldOptions}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
{!_.isEmpty(options) && (
|
||||||
|
<div className="codeNumbering">
|
||||||
|
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="日期单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-date-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{dateSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(options, item => ({ ...item, showname: item.showname.substr(2, 1) }))}
|
||||||
|
value={dateSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="startReservedNumberSet">
|
||||||
|
<WeaSearchGroup
|
||||||
|
title={"起始编号及预留编号设置"}
|
||||||
|
showGroup
|
||||||
|
center>
|
||||||
|
<StartReservedNumberSet
|
||||||
|
ref={(dom) => (this.numberSetRef = dom)}
|
||||||
|
onSet={this.handleSetNumber}
|
||||||
|
companyInfo={subCompanyInfo}
|
||||||
|
loading={loading}
|
||||||
|
startNumberInfo={startNumberInfo}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
onSaveStartNumber={this.handleSubmitStartNumber}
|
||||||
|
onDeleteReservedNumber={this.deleteReservedNumber}
|
||||||
|
onAddReservedNumber={this.handleAddReservedNumber}
|
||||||
|
onSubmitReservedNumber={this.handleSubmitReservedNumber}
|
||||||
|
onSearchReservedNumberset={() =>
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "JOBTITLES",
|
||||||
|
checkboxType: "multi",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,529 @@
|
||||||
|
/*
|
||||||
|
* Author: 黎永顺
|
||||||
|
* Description: 岗位编号设置
|
||||||
|
* Date: 2022-06-06 09:37:39
|
||||||
|
* LastEditTime: 2022-06-15 10:36:30
|
||||||
|
*/
|
||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Button, message } from "antd";
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaCheckbox,
|
||||||
|
WeaSearchGroup,
|
||||||
|
WeaSelect,
|
||||||
|
WeaHelpfulTip,
|
||||||
|
} from "ecCom";
|
||||||
|
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||||
|
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||||
|
import { serialFieldOptions } from "../constants";
|
||||||
|
import { i18n } from "../../../public/i18n";
|
||||||
|
import moment from "moment";
|
||||||
|
import "../branchNumSetting/index.less";
|
||||||
|
const resourceSerialFieldOptions = [
|
||||||
|
{ key: 'subcompany', showname: "分部编号" },
|
||||||
|
{ key: 'department', showname: "部门编号" },
|
||||||
|
{ key: 'jobtitles', showname: "岗位编号" }
|
||||||
|
]
|
||||||
|
|
||||||
|
@inject("numberSet")
|
||||||
|
@observer
|
||||||
|
export default class ResourceNumberSet extends Component {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
options: [],
|
||||||
|
loading: false,
|
||||||
|
dataSource: [],
|
||||||
|
startNumberInfo: {
|
||||||
|
columns: [],
|
||||||
|
dataSource: [],
|
||||||
|
},
|
||||||
|
subCompanyInfo: {
|
||||||
|
details: [],
|
||||||
|
serialenable: "0",
|
||||||
|
deptSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
jobtitlesSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
dateSerial: {
|
||||||
|
enable: "0",
|
||||||
|
key: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getCodeSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
getCodeSetting = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet
|
||||||
|
.getCodeSetting({ serialtype: "USER" })
|
||||||
|
.then(({ api_status, details, serialenable, dateSerial = {}, jobtitlesSerial = {}, deptSerial = {} }) => {
|
||||||
|
if (api_status && !_.isEmpty(details)) {
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: { details, serialenable, dateSerial, jobtitlesSerial, deptSerial },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmit = () => {
|
||||||
|
let promise = new Promise((resolve, reject) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { dataSource, subCompanyInfo } = this.state;
|
||||||
|
const { serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
|
||||||
|
const details = _.map(dataSource, (it, showorder) => {
|
||||||
|
const { numField, value: rulevalue } = it;
|
||||||
|
return {
|
||||||
|
ruletype: _.upperCase(numField),
|
||||||
|
rulevalue,
|
||||||
|
showorder,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
serialenable,
|
||||||
|
details,
|
||||||
|
dateSerial,
|
||||||
|
jobtitlesSerial, deptSerial,
|
||||||
|
serialtype: "USER",
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
this.setState({ loading: true });
|
||||||
|
numberSet.saveOrUpdateCodeSetting(payload).then(({ api_status }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
resolve(api_status);
|
||||||
|
} else {
|
||||||
|
reject("接口调用失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeCode = (data) => {
|
||||||
|
const tmpV = _.filter(
|
||||||
|
data,
|
||||||
|
(it) =>
|
||||||
|
it.numField === "year" ||
|
||||||
|
it.numField === "month" ||
|
||||||
|
it.numField === "day" ||
|
||||||
|
it.numField === "subcompany" ||
|
||||||
|
it.numField === "department" ||
|
||||||
|
it.numField === "jobtitles"
|
||||||
|
);
|
||||||
|
this.setState({
|
||||||
|
dataSource: _.cloneDeep(data),
|
||||||
|
options: _.map(tmpV, (it) => {
|
||||||
|
const { numFieldName: showname, numField: key } = it;
|
||||||
|
return { key: _.upperCase(key), showname };
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSetNumber = (type, data = {}) => {
|
||||||
|
this.handleSubmit().then(() => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { subCompanyInfo } = this.state;
|
||||||
|
const { dateSerial, deptSerial, jobtitlesSerial } = subCompanyInfo;
|
||||||
|
if (type === "start") {
|
||||||
|
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||||
|
let payload = {
|
||||||
|
coderuleid: 3,
|
||||||
|
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||||
|
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||||
|
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||||
|
subCompanyId: data.subCompanyId ? data.subCompanyId : "",
|
||||||
|
deptId: data.deptId ? data.deptId : "",
|
||||||
|
jobtitlesId: data.jobtitlesId ? data.jobtitlesId : "",
|
||||||
|
};
|
||||||
|
if (deptSerial.enable === '1' && deptSerial.key === 'SUBCOMPANY' && !data.subCompanyId) return
|
||||||
|
if (deptSerial.enable === '1' && deptSerial.key === 'DEPARTMENT' && !data.deptId) return
|
||||||
|
if (jobtitlesSerial.enable === '1' && !data.jobtitlesId) return
|
||||||
|
if (deptSerial.enable === '1' && data.subCompanyId) {
|
||||||
|
payload = { ...payload, type: payload.type + ',' + deptSerial.key }
|
||||||
|
}
|
||||||
|
if (jobtitlesSerial.enable === '1' && data.jobtitlesId) {
|
||||||
|
payload = { ...payload, type: payload.type + ',' + jobtitlesSerial.key }
|
||||||
|
}
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, columns, dataSource }) => {
|
||||||
|
if (api_status) {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: { columns, dataSource },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
numberSet.getAdvanceSearchCondition();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "USER",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChangeTable = (newColumns, datas) => {
|
||||||
|
this.setState({
|
||||||
|
startNumberInfo: {
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
columns: newColumns,
|
||||||
|
dataSource: datas,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSubmitStartNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = {
|
||||||
|
datas: JSON.stringify({
|
||||||
|
coderuleid: 4,
|
||||||
|
...this.state.startNumberInfo,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
numberSet.saveStartNum(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: 删除预留编号
|
||||||
|
* param {*} ids
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
deleteReservedNumber = (ids) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
numberSet.deleteReservedCodeById({ ids }).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("删除成功");
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "USER",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name:新增预留编号
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleAddReservedNumber = () => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { reservedForm } = numberSet;
|
||||||
|
const { options } = this.state;
|
||||||
|
numberSet.getReservedCodeFrom({ serialtype: "USER" }).then(() => {
|
||||||
|
const type = _.get(_.last(options), ['key']);
|
||||||
|
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||||
|
const payload = {
|
||||||
|
coderuleid: 3,
|
||||||
|
type,
|
||||||
|
dateStart: moment().format(format),
|
||||||
|
dateEnd: moment().format(format),
|
||||||
|
subCompanyId: "",
|
||||||
|
deptId: "",
|
||||||
|
jobtitlesId: "",
|
||||||
|
};
|
||||||
|
numberSet
|
||||||
|
.getStartNumForm(payload)
|
||||||
|
.then(({ api_status, dataSource }) => {
|
||||||
|
if (api_status && !_.isEmpty(dataSource)) {
|
||||||
|
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||||
|
reservedForm.updateFields({
|
||||||
|
currentnumber: {
|
||||||
|
value: currentnumber,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* name: 保存预留设置
|
||||||
|
* param {*} params
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
handleSubmitReservedNumber = (params) => {
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const payload = { ...params, serialtype: "USER" };
|
||||||
|
numberSet.saveReservedCode(payload).then(({ api_status }) => {
|
||||||
|
if (api_status) {
|
||||||
|
message.success("保存成功");
|
||||||
|
this.numberSetRef.handleCloseReservedModal();
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "USER",
|
||||||
|
checkboxType: "multi",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name:提示文本
|
||||||
|
* return {*}
|
||||||
|
*/
|
||||||
|
helpContent = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>开启后,可根据设置的部门编号规则自动生成部门编号,涉及场景如下:</p>
|
||||||
|
<p>1.手动新建和手动编辑部门时可选择重新生成编号和选择预留部门编号;</p>
|
||||||
|
<p>2.导入人员-添加时,新创建的部门可自动生成部门编号;</p>
|
||||||
|
<p>3.组织结构导入-添加新部门且部门编号列为空时可自动生成部门编号;</p>
|
||||||
|
<p>【注意】开启前请先确认部门编号字段已启用!</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
render() {
|
||||||
|
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||||
|
const { numberSet } = this.props;
|
||||||
|
const { details, serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
|
||||||
|
const btns = [
|
||||||
|
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||||
|
保存
|
||||||
|
</Button>,
|
||||||
|
];
|
||||||
|
const dropMenuDatas = [
|
||||||
|
{
|
||||||
|
key: "save",
|
||||||
|
disabled: false,
|
||||||
|
icon: <i className="icon-coms-Preservation" />,
|
||||||
|
content: "保存",
|
||||||
|
onClick: (key) => this.handleSubmit(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<div className="dept-number-set">
|
||||||
|
<WeaTop
|
||||||
|
title={i18n.label.userNumSetting()}
|
||||||
|
icon={<i className="icon-coms-hrm" />}
|
||||||
|
iconBgcolor="#217346"
|
||||||
|
buttons={btns}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={dropMenuDatas}
|
||||||
|
/>
|
||||||
|
<div className="dept-content">
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="人员编号自动生成"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<WeaCheckbox
|
||||||
|
value={serialenable}
|
||||||
|
helpfulTip={this.helpContent}
|
||||||
|
helpfulTipProps={{ placement: "top" }}
|
||||||
|
display="switch"
|
||||||
|
id="num-set-switch"
|
||||||
|
onChange={(checkVal) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
serialenable: checkVal,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
{/* 内容区 */}
|
||||||
|
{serialenable === "1" && (
|
||||||
|
<Fragment>
|
||||||
|
<div className="numberComposition">
|
||||||
|
<WeaSearchGroup title={"编号组成"} showGroup>
|
||||||
|
<NumberComposition
|
||||||
|
onChange={this.handleChangeCode}
|
||||||
|
dataSource={details}
|
||||||
|
options={[...serialFieldOptions, ...resourceSerialFieldOptions]}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
{!_.isEmpty(options) && (
|
||||||
|
<div className="codeNumbering">
|
||||||
|
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||||
|
{
|
||||||
|
!_.isEmpty(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||||
|
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) && 0 }}>
|
||||||
|
<WeaFormItem
|
||||||
|
label="日期单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-date-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{dateSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(2, 1) }))}
|
||||||
|
value={dateSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
dateSerial: {
|
||||||
|
...dateSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
!_.isEmpty(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key))) &&
|
||||||
|
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["JOBTITLES"].includes(item.key))) && 0 }}>
|
||||||
|
<WeaFormItem
|
||||||
|
label="机构单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={deptSerial.enable ? deptSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
deptSerial: {
|
||||||
|
...deptSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{deptSerial.enable == "1" && (
|
||||||
|
<WeaSelect
|
||||||
|
options={_.map(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(0, 2) }))}
|
||||||
|
value={deptSerial.key}
|
||||||
|
detailtype={3}
|
||||||
|
supportCancel
|
||||||
|
onChange={(key) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
deptSerial: {
|
||||||
|
...deptSerial,
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后,可选择按分部进行单独流水"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
!_.isEmpty(_.filter(options, item => ["JOBTITLES"].includes(item.key))) &&
|
||||||
|
<div className="switch-wrapper">
|
||||||
|
<WeaFormItem
|
||||||
|
label="岗位单独流水"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 16 }}>
|
||||||
|
<div className="codeNumbering-operateWapper">
|
||||||
|
<WeaCheckbox
|
||||||
|
value={jobtitlesSerial.enable ? jobtitlesSerial.enable : "0"}
|
||||||
|
display="switch"
|
||||||
|
id="dept-set-switch"
|
||||||
|
onChange={(isSingle) =>
|
||||||
|
this.setState({
|
||||||
|
subCompanyInfo: {
|
||||||
|
...subCompanyInfo,
|
||||||
|
jobtitlesSerial: {
|
||||||
|
...jobtitlesSerial,
|
||||||
|
enable: isSingle,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<WeaHelpfulTip
|
||||||
|
width={200}
|
||||||
|
title="开启后,可选择按岗位进行单独流水"
|
||||||
|
placement="topLeft"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WeaFormItem>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="startReservedNumberSet">
|
||||||
|
<WeaSearchGroup
|
||||||
|
title={"起始编号及预留编号设置"}
|
||||||
|
showGroup
|
||||||
|
center>
|
||||||
|
<StartReservedNumberSet
|
||||||
|
ref={(dom) => (this.numberSetRef = dom)}
|
||||||
|
onSet={this.handleSetNumber}
|
||||||
|
companyInfo={subCompanyInfo}
|
||||||
|
loading={loading}
|
||||||
|
startNumberInfo={startNumberInfo}
|
||||||
|
onChange={this.handleChangeTable}
|
||||||
|
onSaveStartNumber={this.handleSubmitStartNumber}
|
||||||
|
onDeleteReservedNumber={this.deleteReservedNumber}
|
||||||
|
onAddReservedNumber={this.handleAddReservedNumber}
|
||||||
|
onSubmitReservedNumber={this.handleSubmitReservedNumber}
|
||||||
|
onSearchReservedNumberset={() =>
|
||||||
|
numberSet.getSearchReservedCodeList({
|
||||||
|
serialtype: "USER",
|
||||||
|
checkboxType: "multi",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</WeaSearchGroup>
|
||||||
|
</div>
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,371 @@
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { Menu, message, Modal, Tree } 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 "../index.less";
|
||||||
|
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const TreeNode = Tree.TreeNode;
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (
|
||||||
|
nextProps.deleteOfficeClassifyFlag !== this.props.deleteOfficeClassifyFlag
|
||||||
|
) {
|
||||||
|
const { officeManageStore } = this.props;
|
||||||
|
const { officeClassifyId } = officeManageStore;
|
||||||
|
this.handleDelete(officeClassifyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 { officeManageStore } = this.props;
|
||||||
|
const [postId] = node;
|
||||||
|
const officeId = !postId
|
||||||
|
? officeManageStore.officeClassifyId
|
||||||
|
: postId !== "-1" ? postId : "";
|
||||||
|
officeManageStore.setOfficeClassifyId(officeId);
|
||||||
|
officeManageStore.getPostInfoTable(officeId);
|
||||||
|
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 (_.isEmpty(value)) {
|
||||||
|
let { copyTree, copyExpandedKeys, expandedKeys } = this.state;
|
||||||
|
this.setState({
|
||||||
|
treeData: JSON.parse(copyTree),
|
||||||
|
expandedKeys,
|
||||||
|
searchValue: value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let { copyTree } = 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"/>;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onExpand = keys => {
|
||||||
|
const { expandedKeys } = this.state;
|
||||||
|
this.setState({
|
||||||
|
expandedKeys: expandedKeys.includes("-1") ? [] : keys
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSave = () => {
|
||||||
|
const {
|
||||||
|
form1,
|
||||||
|
savePost,
|
||||||
|
updatePost,
|
||||||
|
officeClassifyId,
|
||||||
|
officeVisible
|
||||||
|
} = this.props.officeManageStore;
|
||||||
|
form1.validateForm().then(f => {
|
||||||
|
if (f.isValid) {
|
||||||
|
// 验证通过, balabala业务代码
|
||||||
|
const payload = { ...form1.getFormParams(), id: officeClassifyId };
|
||||||
|
const result =
|
||||||
|
officeClassifyId && officeVisible.type === "editPlan"
|
||||||
|
? updatePost(payload)
|
||||||
|
: savePost(payload);
|
||||||
|
this.setState({ loading: true });
|
||||||
|
result.then(({ code, msg }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (code === 200) {
|
||||||
|
message.success(
|
||||||
|
officeClassifyId && officeVisible.type === "editPlan"
|
||||||
|
? "编辑成功"
|
||||||
|
: "新增成功"
|
||||||
|
);
|
||||||
|
this.getTreeData();
|
||||||
|
this.props.officeManageStore.setOfficeVisible({
|
||||||
|
bool: false,
|
||||||
|
type: officeVisible.type
|
||||||
|
});
|
||||||
|
} 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.props.officeManageStore.setOfficeClassifyId("");
|
||||||
|
this.getTreeData();
|
||||||
|
} else {
|
||||||
|
message.error(msg || "删除失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let { expandedKeys, treeData, searchValue, loading } = this.state;
|
||||||
|
const { officeManageStore } = this.props;
|
||||||
|
const {
|
||||||
|
officeCondition,
|
||||||
|
form1,
|
||||||
|
officeVisible,
|
||||||
|
officeClassifyId
|
||||||
|
} = 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={
|
||||||
|
officeClassifyId && officeVisible.type === "editPlan"
|
||||||
|
? i18n.label.editOfficeClassifyName()
|
||||||
|
: i18n.label.newOfficeClassifyName()
|
||||||
|
}
|
||||||
|
visible={officeVisible.bool}
|
||||||
|
condition={toJS(officeCondition)}
|
||||||
|
form={form1}
|
||||||
|
isFormInit={form1.isFormInit}
|
||||||
|
loading={loading}
|
||||||
|
isEdit={true}
|
||||||
|
height={150}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() =>
|
||||||
|
officeManageStore.setOfficeVisible({
|
||||||
|
bool: false,
|
||||||
|
type: officeVisible.type
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LeftTree;
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// office-wapper
|
||||||
|
.office-wapper {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.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%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,524 @@
|
||||||
|
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 { WeaFormItem, WeaLeftRightLayout, WeaRightMenu, WeaTab, WeaTop } from "ecCom";
|
||||||
|
import { Button, Col, message, Modal, Row, Spin, Switch } from "antd";
|
||||||
|
import { WeaSwitch, WeaTableNew } from "comsMobx";
|
||||||
|
import "./index.less";
|
||||||
|
import { renderNoright } from "../../util";
|
||||||
|
import ImportDialog from '../ImportDialog';
|
||||||
|
|
||||||
|
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
@inject("officeManageStore")
|
||||||
|
@inject('importDialog')
|
||||||
|
@observer
|
||||||
|
export default class OfficeManage extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
date: "",
|
||||||
|
editId: "",
|
||||||
|
loading: false,
|
||||||
|
deleteOfficeClassifyFlag: 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
showlog = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 6,
|
||||||
|
keys: new Date().getTime()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleMenuClick = key => {
|
||||||
|
const { officeManageStore,importDialog } = this.props;
|
||||||
|
const { isPanelShow, tableStore, officeClassifyId } = officeManageStore;
|
||||||
|
isPanelShow && officeManageStore.setPanelStatus(false);
|
||||||
|
switch (key) {
|
||||||
|
case "new":
|
||||||
|
officeManageStore.getPostInfoForm({ planId: officeClassifyId });
|
||||||
|
officeManageStore.setVisible(true);
|
||||||
|
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||||
|
break;
|
||||||
|
case "log":
|
||||||
|
this.showlog();
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
break;
|
||||||
|
case "import":
|
||||||
|
importDialog.importVisible=true;
|
||||||
|
importDialog.importModule='postInfo';
|
||||||
|
importDialog.current = 0;
|
||||||
|
importDialog.getImportForm();
|
||||||
|
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.setState({ editId: "" }, () => {
|
||||||
|
this.props.officeManageStore.setVisible(false);
|
||||||
|
this.props.officeManageStore.getPostInfoTable(this.props.officeManageStore.officeClassifyId);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
message.error(msg || "编辑失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
savePostInfo(payload).then(({ code, msg }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (code === 200) {
|
||||||
|
message.success("新增成功");
|
||||||
|
this.setState({ editId: "" }, () => {
|
||||||
|
this.props.officeManageStore.setVisible(false);
|
||||||
|
this.props.officeManageStore.getPostInfoTable(this.props.officeManageStore.officeClassifyId);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
message.error(msg || "新增失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
f.showErrors();
|
||||||
|
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns = () => {
|
||||||
|
const { officeManageStore,importDialog } = this.props;
|
||||||
|
const { topMenu, tableStore, officeClassifyId } = officeManageStore;
|
||||||
|
let btns = [];
|
||||||
|
topMenu.map((item, i) => {
|
||||||
|
if (item.menuFun !== "batchDelete" && item.menuFun !== "delPlan") {
|
||||||
|
btns.push(
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
disabled={item.menuFun == "editPlan" && !officeClassifyId}
|
||||||
|
onClick={() => {
|
||||||
|
const { officeManageStore } = this.props;
|
||||||
|
if (item.menuFun == "new") {
|
||||||
|
officeManageStore.isPanelShow &&
|
||||||
|
officeManageStore.setPanelStatus(false);
|
||||||
|
officeManageStore.getPostInfoForm({ planId: officeClassifyId });
|
||||||
|
officeManageStore.setVisible(true);
|
||||||
|
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||||
|
} else if (
|
||||||
|
item.menuFun == "addPlan" ||
|
||||||
|
item.menuFun == "editPlan"
|
||||||
|
) {
|
||||||
|
officeManageStore.getPostForm(
|
||||||
|
item.menuFun == "editPlan" ? officeClassifyId : ""
|
||||||
|
);
|
||||||
|
officeManageStore.setOfficeVisible({
|
||||||
|
bool: true,
|
||||||
|
type: item.menuFun
|
||||||
|
});
|
||||||
|
}else if(item.menuFun == "import") {
|
||||||
|
importDialog.importVisible=true;
|
||||||
|
importDialog.importModule='postInfo';
|
||||||
|
importDialog.current = 0;
|
||||||
|
importDialog.getImportForm();
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
{item.menuName}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
} else if (item.menuFun === "delPlan") {
|
||||||
|
btns.push(
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: i18n.confirm.delete(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk: () => {
|
||||||
|
this.setState({
|
||||||
|
deleteOfficeClassifyFlag: !this.state
|
||||||
|
.deleteOfficeClassifyFlag
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
disabled={
|
||||||
|
!officeClassifyId ||
|
||||||
|
(officeClassifyId && !_.isEmpty(toJS(tableStore.datas)))
|
||||||
|
}>
|
||||||
|
{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(officeManageStore.officeClassifyId);
|
||||||
|
} 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(officeManageStore.officeClassifyId, true);
|
||||||
|
} 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({ id: 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}
|
||||||
|
/>
|
||||||
|
</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,importDialog } = this.props;
|
||||||
|
const { date, loading, deleteOfficeClassifyFlag } = this.state;
|
||||||
|
const {
|
||||||
|
isPanelShow,
|
||||||
|
form2,
|
||||||
|
postInfoName,
|
||||||
|
conditionNum,
|
||||||
|
tableStore,
|
||||||
|
nEdialogTitle,
|
||||||
|
visible,
|
||||||
|
condition,
|
||||||
|
form,
|
||||||
|
dialogLoading,
|
||||||
|
hasRight
|
||||||
|
} = officeManageStore;
|
||||||
|
const {importVisible} = importDialog;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <div className="office-wapper">
|
||||||
|
<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)}>
|
||||||
|
</WeaTop>
|
||||||
|
<WeaLeftRightLayout
|
||||||
|
isNew={true}
|
||||||
|
leftCom={
|
||||||
|
<LeftTree deleteOfficeClassifyFlag={deleteOfficeClassifyFlag}/>
|
||||||
|
}>
|
||||||
|
<WeaRightMenu
|
||||||
|
ecId={`${(this && this.props && this.props.ecId) ||
|
||||||
|
""}_WeaRightMenu@cea97d`}
|
||||||
|
datas={this.getDropMenuDatas()}
|
||||||
|
onClick={key => this.handleMenuClick(key)}>
|
||||||
|
<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/>}
|
||||||
|
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)}
|
||||||
|
/>
|
||||||
|
<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={400}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => {
|
||||||
|
officeManageStore.setVisible(false);
|
||||||
|
this.setState({ editId: "" });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</WeaRightMenu>
|
||||||
|
{importVisible && <ImportDialog ecId={`${this && this.props && this.props.ecId || ''}_ImportDialog@633i8k`} />}
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,474 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaLeftTree
|
||||||
|
} 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';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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.getHasRight();
|
||||||
|
jobGrade.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
jobGrade
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = jobGrade;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 checked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
jobGrade
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
jobGrade.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 3,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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, date, hasRight, treeConfig, treeLoading
|
||||||
|
} = jobGrade;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
onSelectedTreeNode,
|
||||||
|
selectedKeys,
|
||||||
|
onExpand,
|
||||||
|
treeExpandKeys
|
||||||
|
} = toJS(treeConfig);
|
||||||
|
const treeCom = (
|
||||||
|
hasRight && <WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
|
||||||
|
datas={data}
|
||||||
|
searchLabel={"等级方案"}
|
||||||
|
onSelect={onSelectedTreeNode}
|
||||||
|
selectedKeys={selectedKeys}
|
||||||
|
onExpand={onExpand}
|
||||||
|
loading={treeLoading}
|
||||||
|
expandedKeys={treeExpandKeys} />
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
|
||||||
|
<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)}
|
||||||
|
/>
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</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={280}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => jobGrade.setVisible(false)}
|
||||||
|
moduleName={"jobGrade"}
|
||||||
|
bindChangeEnvent={val => jobGrade.updateConditions(val)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,467 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaLeftTree
|
||||||
|
} 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';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
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.getHasRight();
|
||||||
|
jobLevel.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 checked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
jobLevel
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
jobLevel.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onOperatesClick(record, rowIndex, operate) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = operate;
|
||||||
|
(index == '0') && this.doEdit(record.randomFieldId);
|
||||||
|
(index == '1') && this.doDel(record.randomFieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
jobLevel
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = jobLevel;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 2,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
jobLevel
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, form2, levelName, conditionNum, tableStore, nEdialogTitle, visible, condition,
|
||||||
|
form, dialogLoading, isEdit, selectedKey, topTab, topTabCount, date, hasRight, treeConfig, treeLoading
|
||||||
|
} = jobLevel;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
onSelectedTreeNode,
|
||||||
|
selectedKeys,
|
||||||
|
onExpand,
|
||||||
|
treeExpandKeys
|
||||||
|
} = toJS(treeConfig);
|
||||||
|
const treeCom = (
|
||||||
|
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
|
||||||
|
datas={data}
|
||||||
|
searchLabel={"等级方案"}
|
||||||
|
onSelect={onSelectedTreeNode}
|
||||||
|
selectedKeys={selectedKeys}
|
||||||
|
onExpand={onExpand}
|
||||||
|
loading={treeLoading}
|
||||||
|
expandedKeys={treeExpandKeys} />
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
|
||||||
|
|
||||||
|
<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)}
|
||||||
|
/>
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</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={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => jobLevel.setVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,441 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaAlertPage
|
||||||
|
} 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';
|
||||||
|
import { renderNoright } from '../../util'; // 从util文件引入公共的方法
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
rankScheme
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = rankScheme;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 checked={record.forbidden_tag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateForbiddenTag(checked, id) {
|
||||||
|
const {
|
||||||
|
rankScheme
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
rankScheme.updateForbiddenTag(checked, id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 1,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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, date, hasRight
|
||||||
|
} = rankScheme;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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={200}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => rankScheme.setVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Timeline
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
export default class AnchorDetect extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
anchorList,
|
||||||
|
activity,
|
||||||
|
onChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const activityStyle = {
|
||||||
|
color:"#4aacf4"
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='right'>
|
||||||
|
<Timeline>
|
||||||
|
{
|
||||||
|
anchorList.map((item,index) => {
|
||||||
|
return(
|
||||||
|
<Timeline.Item color={activity == index ? 'blue' : 'gray'} dot={activity == index ? <i className="icon-coms-position" color='#4aacf4'/> : ''}>
|
||||||
|
<span style={activity == index ? activityStyle : {}} className='title' onClick={() => onChange(item.id,index)}>{item.title}</span>
|
||||||
|
</Timeline.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Timeline>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import {
|
||||||
|
observer
|
||||||
|
} from 'mobx-react';
|
||||||
|
import {
|
||||||
|
WeaTransfer,
|
||||||
|
WeaInputSearch,
|
||||||
|
WeaSelect
|
||||||
|
} from 'ecCom';
|
||||||
|
import {
|
||||||
|
toJS
|
||||||
|
} from 'mobx';
|
||||||
|
import isEmpty from 'lodash/isEmpty'
|
||||||
|
import {
|
||||||
|
Spin
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
@observer
|
||||||
|
export default class Customization extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
rightHeader = () => {
|
||||||
|
|
||||||
|
|
||||||
|
const {
|
||||||
|
store
|
||||||
|
} = this.props, {
|
||||||
|
transfer,
|
||||||
|
inputSearchStyle,
|
||||||
|
search,
|
||||||
|
customTemplates,
|
||||||
|
templates,
|
||||||
|
searchTemplateId,
|
||||||
|
customTemplateId
|
||||||
|
} = store, {
|
||||||
|
transferRightIptVal,
|
||||||
|
} = transfer;
|
||||||
|
return (
|
||||||
|
<div className="trasfer-header">
|
||||||
|
<span>已选</span>
|
||||||
|
<WeaInputSearch
|
||||||
|
style={inputSearchStyle}
|
||||||
|
value={transferRightIptVal}
|
||||||
|
onSearchChange={store.updateTransferRightptVal}
|
||||||
|
/>
|
||||||
|
<WeaSelect
|
||||||
|
style={store.selectStyle}
|
||||||
|
options={search ? templates : customTemplates}
|
||||||
|
value={search ? searchTemplateId : customTemplateId}
|
||||||
|
onChange={v => store.getTemplateSelectKeys(v)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
store
|
||||||
|
} = this.props, {
|
||||||
|
TRANSFER,
|
||||||
|
transfer,
|
||||||
|
leftHeader,
|
||||||
|
rightHeader,
|
||||||
|
searchDialog,
|
||||||
|
search
|
||||||
|
} = store, {
|
||||||
|
transferDatas,
|
||||||
|
transferKeys
|
||||||
|
} = transfer;
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='customization' style={{ padding: 20 }}>
|
||||||
|
{
|
||||||
|
!searchDialog.loading ? <WeaTransfer
|
||||||
|
{...TRANSFER}
|
||||||
|
data={toJS(transferDatas)}
|
||||||
|
selectedKeys={toJS(transferKeys)}
|
||||||
|
leftHeader={leftHeader}
|
||||||
|
rightHeader={rightHeader}
|
||||||
|
/> : <div className='hrm-loading-center-small' style={{ top: '25%' }}>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchDialog.loading}></Spin>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
WeaTab,
|
||||||
|
WeaTableEdit
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
Tooltip
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
import { chunk,isEmpty } from 'lodash';
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
|
||||||
|
|
||||||
|
export default class FormItem extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
tableInfo:[],
|
||||||
|
tabInfo:[],
|
||||||
|
detailSelectedKey: '0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
groupInfo
|
||||||
|
} = this.props;
|
||||||
|
let tableInfo = this.handleTable(groupInfo.tables);
|
||||||
|
let tabInfo = this.getTabInfo(tableInfo);
|
||||||
|
let detailSelectedKey = '0';
|
||||||
|
if (!isEmpty(tabInfo)) detailSelectedKey = tabInfo[0].key;
|
||||||
|
this.setState({
|
||||||
|
tableInfo:tableInfo,
|
||||||
|
tabInfo:tabInfo,
|
||||||
|
detailSelectedKey:detailSelectedKey
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
handleTable = (datas) => {
|
||||||
|
return datas && datas.map(data => {
|
||||||
|
const { tabinfo: { columns } } = data;
|
||||||
|
const length = columns.length;
|
||||||
|
columns.map(c => {
|
||||||
|
c.width = `${95 / length}%`
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabInfo = (tableInfo) => {
|
||||||
|
let tabInfo = [];
|
||||||
|
tableInfo && tableInfo.forEach((c, idx) => {
|
||||||
|
if (!c.hide) {
|
||||||
|
tabInfo.push({
|
||||||
|
key: `${idx}`,
|
||||||
|
title: c.tabname,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return tabInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabChildren = () => {
|
||||||
|
let { tableInfo, tabkey, detailSelectedKey } = this.state;
|
||||||
|
let tabChildren = [];
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
|
||||||
|
tableInfo && tableInfo.map((t, i) => {
|
||||||
|
if (detailSelectedKey == i) {
|
||||||
|
tabChildren.push(
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
|
||||||
|
showTitle={true}
|
||||||
|
columns={toJS(t.tabinfo.columns)}
|
||||||
|
datas={toJS(t.tabinfo.datas)}
|
||||||
|
viewAttr={1}
|
||||||
|
getRowSelection={(rowSelection) => {
|
||||||
|
Object.assign(rowSelection, {
|
||||||
|
getCheckboxProps: record => ({
|
||||||
|
disabled: record.viewAttr === 1, // 配置无法勾选的列
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return rowSelection;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return tabChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
groupInfo
|
||||||
|
} = this.props, {
|
||||||
|
tableInfo,
|
||||||
|
tabInfo,
|
||||||
|
detailSelectedKey
|
||||||
|
} = this.state;
|
||||||
|
const newData = chunk(groupInfo.items, 3);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='form-item' id={groupInfo.id}>
|
||||||
|
<div className='title'>
|
||||||
|
<div></div>
|
||||||
|
<p>{groupInfo.title}</p>
|
||||||
|
</div>
|
||||||
|
<div className='content'>
|
||||||
|
{newData.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<div key={index} className='item'>
|
||||||
|
{item.map((subItem) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<span>{subItem.fieldId}</span>
|
||||||
|
{subItem.fieldValue.length > 10 ? <Tooltip placement="topLeft" title={subItem.fieldValue}>
|
||||||
|
<span>{subItem.fieldValue}</span>
|
||||||
|
</Tooltip> : <span>{subItem.fieldValue}</span>}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
!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 => {
|
||||||
|
this.setState({
|
||||||
|
detailSelectedKey:v
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{this.getTabChildren()}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
|
||||||
|
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, WeaForm } from 'comsMobx';
|
||||||
|
import { inject, observer } from 'mobx-react';
|
||||||
|
import * as mobx from 'mobx';
|
||||||
|
import { i18n } from '../../public/i18n';
|
||||||
|
import * as Api from '../../apis/hrmInfoExtend'; // 引入API接口文件
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default class HrmInfoExtend extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
id: props.location.query.hrmResourceID,
|
||||||
|
isEditor: false,
|
||||||
|
loading: false,
|
||||||
|
form: new WeaForm(),
|
||||||
|
conditions: [],
|
||||||
|
buttons: {},
|
||||||
|
date: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init = () => {
|
||||||
|
this.setState({
|
||||||
|
isEditor: false
|
||||||
|
});
|
||||||
|
this.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
getData = () => {
|
||||||
|
this.state.loading = true;
|
||||||
|
let params = {
|
||||||
|
viewAttr: this.isEditor ? 2 : 1,
|
||||||
|
id: this.state.id,
|
||||||
|
}
|
||||||
|
Api.getResourceExtendForm(params).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.state.form.initFormFields(res.data.conditions);
|
||||||
|
this.setState({
|
||||||
|
conditions: res.data.conditions,
|
||||||
|
buttons: res.data.buttons,
|
||||||
|
loading: false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
message.warning(res.msg);
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
message.warning(error.msg);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopButtons = () => {
|
||||||
|
const { isEditor, buttons } = this.state;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSearchs = () => {
|
||||||
|
let { form, conditions, isEditor } = this.state;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
editCard = () => {
|
||||||
|
this.setState({
|
||||||
|
isEditor: true
|
||||||
|
})
|
||||||
|
this.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo 更新操作暂不处理
|
||||||
|
saveEditCard = () => {
|
||||||
|
const {loading,form} = this.state;
|
||||||
|
this.state.form.validateForm().then(f => {
|
||||||
|
if (f.isValid) {
|
||||||
|
this.state.loading = true;
|
||||||
|
let pDatas = this.form.getFormParams();
|
||||||
|
Api.editResource({
|
||||||
|
...{
|
||||||
|
id: this.id
|
||||||
|
},
|
||||||
|
...pDatas,
|
||||||
|
...this.getTableEditParams()
|
||||||
|
}).then(data => {
|
||||||
|
if (data.code == 200) {
|
||||||
|
message.success(i18n.message.saveSuccess());
|
||||||
|
this.init();
|
||||||
|
this.getData();
|
||||||
|
this.selectedRowKeys = [];
|
||||||
|
} else {
|
||||||
|
message.warning(data.message);
|
||||||
|
}
|
||||||
|
this.loading = false;
|
||||||
|
}, error => {
|
||||||
|
message.warning(error.message);
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
f.showErrors();
|
||||||
|
this.setDate(new Date());
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
backCard = () => {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const { loading } = this.state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='' style={{ height: '100%', position: 'relative' }}>
|
||||||
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
|
||||||
|
buttons={this.getTopButtons()}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
loading ? <div className='hrm-loading-center-small'>
|
||||||
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
||||||
|
</div>
|
||||||
|
: this.getSearchs()
|
||||||
|
}
|
||||||
|
|
||||||
|
</WeaTop>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
import {
|
||||||
|
WeaFormItem,
|
||||||
|
} from 'ecCom'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Spin,
|
||||||
|
Button,
|
||||||
|
} from 'antd'
|
||||||
|
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
import { chunk } from 'lodash';
|
||||||
|
|
||||||
|
export default class IframeItem extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
iframeInfo
|
||||||
|
} = this.props, {
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='iframe-item' id={iframeInfo.id} >
|
||||||
|
<div className='title'>
|
||||||
|
<div></div>
|
||||||
|
<p>{iframeInfo.title}</p>
|
||||||
|
</div>
|
||||||
|
<div className='content' >
|
||||||
|
<iframe
|
||||||
|
id={iframeInfo.id+"-iframe"}
|
||||||
|
src={iframeInfo.url}
|
||||||
|
width="100%"
|
||||||
|
height="500px"
|
||||||
|
frameBorder="0"
|
||||||
|
scrolling="auto"
|
||||||
|
onLoad={() => {
|
||||||
|
// console.log(document.getElementById(iframeInfo.id+"-iframe").scrollHeight)
|
||||||
|
// document.getElementById(iframeInfo.id+"-iframe").height = 500 + "px"
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,441 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaOrgTree
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
message,
|
||||||
|
Switch,
|
||||||
|
Menu, Dropdown, Icon, Select,Progress
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/resume.less';
|
||||||
|
import SearchPanelDialog from '../SearchPanelDialog';
|
||||||
|
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
import { exportWord } from '../mhtmlToWord'
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
|
||||||
|
|
||||||
|
@inject('personnelResume')
|
||||||
|
@observer
|
||||||
|
export default class PersonnelResume extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
let { hash } = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
personnelResume.resourceId = id;;
|
||||||
|
personnelResume.getHasRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelect = (e) => {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props,{
|
||||||
|
form,
|
||||||
|
show
|
||||||
|
} = personnelResume;
|
||||||
|
|
||||||
|
personnelResume.show = ! show;
|
||||||
|
personnelResume.params = {
|
||||||
|
...form.getFormParams()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//左侧树
|
||||||
|
getTree = () => {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
companysId,
|
||||||
|
params
|
||||||
|
} = personnelResume;
|
||||||
|
|
||||||
|
|
||||||
|
let tree = (
|
||||||
|
<WeaOrgTree ecId={`${this && this.props && this.props.ecId || ''}_WeaOrgTree@dhi1ro`}
|
||||||
|
ref='WeaOrgTree'
|
||||||
|
dataUrl={"/api/bs/hrmorganization/personnelresume/getSearchTree"}
|
||||||
|
loading
|
||||||
|
needSearch
|
||||||
|
noCache={true}
|
||||||
|
params={params}
|
||||||
|
onSelect={this.onSelect}
|
||||||
|
needDropMenu={false}
|
||||||
|
isLoadSubDepartment={true}
|
||||||
|
topPrefix={'hrmSearch'}
|
||||||
|
companysId={companysId}
|
||||||
|
inputLeftDom={`<b>${i18n.label.organization()}</b>`}
|
||||||
|
treeNodeClick={this.treeNodeClick}
|
||||||
|
expandAllChildrenOnSearch={true}
|
||||||
|
renderNode={item => this.renderNode(item)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNode(item) {
|
||||||
|
return <div className='text-elli' title={item.name}>
|
||||||
|
<i className={item.icon} style={{ marginRight: '5px' }}></i>
|
||||||
|
{item.name}
|
||||||
|
{item.canceled && <span style={{ color: 'red' }}>({i18n.label.forbidden()})</span>}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
treeNodeClick = (event, ids, nodeids, nodes) => {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
companysId
|
||||||
|
} = personnelResume;
|
||||||
|
const type = event.node.props.type || '0';
|
||||||
|
const id = event.node.props.id || '';
|
||||||
|
personnelResume.nodeType = type;
|
||||||
|
if (type == '4') {
|
||||||
|
personnelResume.resourceId = id;
|
||||||
|
setTimeout(function() {
|
||||||
|
personnelResume.getPersonnelResume();
|
||||||
|
},1000)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
tableStore
|
||||||
|
} = personnelResume;
|
||||||
|
|
||||||
|
let btns = [];
|
||||||
|
|
||||||
|
btns.push(<Select showSearch
|
||||||
|
style={{ width: 115 }}
|
||||||
|
placeholder="请选择模板"
|
||||||
|
defaultValue="人员简历模板"
|
||||||
|
optionFilterProp="children"
|
||||||
|
notFoundContent="无法找到"
|
||||||
|
size="large"
|
||||||
|
onChange={this.handleChange()}
|
||||||
|
>
|
||||||
|
<Option value="1">人员简历模板</Option>
|
||||||
|
<Option value="2">人员晋升模板</Option>
|
||||||
|
</Select>)
|
||||||
|
|
||||||
|
topMenu.map((item, i) => {
|
||||||
|
if (item.menuFun === 'screening') {
|
||||||
|
btns.push(<Button id="top-screening" type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
|
||||||
|
}else {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(item) {
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
//模板修改
|
||||||
|
handleChange(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// log = () => {
|
||||||
|
// window.setLogViewProp({
|
||||||
|
// logMoudleType: 11,
|
||||||
|
// keys: new Date().getTime(),
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = personnelResume;
|
||||||
|
|
||||||
|
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) {
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
//人员筛选
|
||||||
|
screening() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props,{
|
||||||
|
show,form
|
||||||
|
} = personnelResume;
|
||||||
|
form.reset();
|
||||||
|
personnelResume.show = ! show;
|
||||||
|
personnelResume.getSearchCondition();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出当前
|
||||||
|
currentExport() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
resumeList
|
||||||
|
} = personnelResume;
|
||||||
|
exportWord({
|
||||||
|
filename:`人员简历-${resumeList.lastName}`,
|
||||||
|
selector:"#personnel-resume",
|
||||||
|
style:`.title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 900;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.photos{
|
||||||
|
width: 100px;
|
||||||
|
height: 120px;
|
||||||
|
}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//合并导出
|
||||||
|
mergeExport() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
personnelResume.downloadPerResume(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//全部导出
|
||||||
|
allExport() {
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
personnelResume.downloadPerResume(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
personnelResume
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
hasRight, defaultShowLeft, resumeList,percent,show,form,condition,dialogLoading
|
||||||
|
} = personnelResume;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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.personnelResume()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => this.handleMenuClick(e)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@7muhhb`} isNew={true} showLeft={defaultShowLeft} leftCom={this.getTree()}>
|
||||||
|
{
|
||||||
|
!this.isEmptyObject(resumeList) ? <div id='personnel-resume'>
|
||||||
|
<div className='content'>
|
||||||
|
<p className='title'>人员简历信息</p>
|
||||||
|
<table border="1" align="center" width="750" cellspacing='0' className='resume-table'>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td colspan="7">一、基本信息</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100" >姓名</td>
|
||||||
|
<td width="100">{resumeList.lastName}</td>
|
||||||
|
<td width="100">性别</td>
|
||||||
|
<td width="100">{resumeList.sex}</td>
|
||||||
|
<td width="100">出生年月</td>
|
||||||
|
<td width="100">{resumeList.birthday}</td>
|
||||||
|
<td rowspan="3"><img className='photos' src={resumeList.image} /></td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100" >籍贯</td>
|
||||||
|
<td width="100">{resumeList.native}</td>
|
||||||
|
<td width="100">政治面貌</td>
|
||||||
|
<td width="100">{resumeList.politics}</td>
|
||||||
|
<td width="100">部门</td>
|
||||||
|
<td width="100">{resumeList.department}</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100">婚姻状况</td>
|
||||||
|
<td width="100">{resumeList.marriage}</td>
|
||||||
|
<td width="100">岗位</td>
|
||||||
|
<td width="100">{resumeList.jobtitle}</td>
|
||||||
|
<td width="100">入职时间</td>
|
||||||
|
<td width="100">{resumeList.companystartdate}</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100">参加工作时间</td>
|
||||||
|
<td width="100" colspan="2">{resumeList.workstartdate}</td>
|
||||||
|
<td width="100" colspan="2">身份证号</td>
|
||||||
|
<td width="100" colspan="2">{resumeList.idCard}</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100" rowspan="2">家庭地址</td>
|
||||||
|
<td width="100" rowspan="2" colspan="2">{resumeList.address}</td>
|
||||||
|
<td width="100" colspan="2">联系电话</td>
|
||||||
|
<td width="100" colspan="2">{resumeList.telephone}</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td width="100" colspan="2">E-mail</td>
|
||||||
|
<td width="100" colspan="2">{resumeList.email}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{
|
||||||
|
resumeList.tables.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<React.Fragment key={index}>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
<td colspan="7">{item.title}</td>
|
||||||
|
</tr>
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
{
|
||||||
|
item.columns.map(column => {
|
||||||
|
return (
|
||||||
|
<td width="100" rowspan={column.rowspans} colspan={column.colspans}>{column.name}</td>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{
|
||||||
|
item.datas.map(data => {
|
||||||
|
return (
|
||||||
|
<tr align="center" height='50'>
|
||||||
|
{
|
||||||
|
data.map((row, index) => {
|
||||||
|
return (
|
||||||
|
<td width="100" rowspan={row.rowspans} colspan={row.colspans}>{row.value}</td>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</React.Fragment>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
<tr align="center" height='200'>
|
||||||
|
<td width="100">个人自述</td>
|
||||||
|
<td width="100" colspan="6">{resumeList.selfStatement}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: <Progress percent={percent} strokeWidth={10} />}
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</WeaTop>
|
||||||
|
</WeaRightMenu>
|
||||||
|
<SearchPanelDialog ecId={`${this && this.props && this.props.ecId || ''}_SearchPanelDialog@q4rrwm`}
|
||||||
|
title={"人员筛选"}
|
||||||
|
visible={show}
|
||||||
|
condition={toJS(condition)}
|
||||||
|
form={form}
|
||||||
|
isFormInit={form.isFormInit}
|
||||||
|
loading={dialogLoading}
|
||||||
|
height={120}
|
||||||
|
conditionLen={1}
|
||||||
|
search={() => this.onSelect()}
|
||||||
|
onCancel={() => personnelResume.show = ! show}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,528 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer,
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaLeftRightLayout,
|
||||||
|
WeaLeftTree
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
message,
|
||||||
|
Switch,
|
||||||
|
Tag
|
||||||
|
} from 'antd'
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx'
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/common.less';
|
||||||
|
|
||||||
|
import NewAndEditDialog from '../NewAndEditDialog';
|
||||||
|
import { renderNoright } from '../../util';
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
const WeaTable = WeaTableNew.WeaTable;
|
||||||
|
|
||||||
|
|
||||||
|
@inject('resourceBasicInfo')
|
||||||
|
@observer
|
||||||
|
export default class ResourceBasicInfo extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
resourceBasicInfo.getHasRight();
|
||||||
|
resourceBasicInfo.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getTopMenuBtns() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
topMenu,
|
||||||
|
tableStore,
|
||||||
|
selectedTreeNodeInfo
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
let btns = [];
|
||||||
|
topMenu.map((item, i) => {
|
||||||
|
if (item.menuFun === 'batchDelete') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={tableStore.selectedRowKeys.length > 0 ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else if (item.menuFun === 'delItemClass' || item.menuFun === 'editItemClass') {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)} disabled={selectedTreeNodeInfo.domid !== "-1" ? false : true} >{item.menuName}</Button>);
|
||||||
|
} else {
|
||||||
|
btns.push(<Button type='primary' onClick={() => this.handleClick(item)}>{item.menuName}</Button>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(item) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
isPanelShow && resourceBasicInfo.setPanelStatus(false);
|
||||||
|
this[item.menuFun] && this[item.menuFun]();
|
||||||
|
}
|
||||||
|
|
||||||
|
custom = () => {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props, {
|
||||||
|
tableStore,
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
tableStore.setColSetVisible(true);
|
||||||
|
tableStore.tableColSet(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
resourceBasicInfo.setNeDialogTitle(i18n.label.newResourceBasicInfo());
|
||||||
|
resourceBasicInfo.setIsNew(true);
|
||||||
|
resourceBasicInfo.setOperateType("1");
|
||||||
|
resourceBasicInfo.setVisible(true);
|
||||||
|
resourceBasicInfo.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
addItemClass() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
resourceBasicInfo.setNeDialogTitle(i18n.label.newResourceBasicType());
|
||||||
|
resourceBasicInfo.setIsNew(true);
|
||||||
|
resourceBasicInfo.setVisible(true);
|
||||||
|
resourceBasicInfo.setOperateType("2")
|
||||||
|
resourceBasicInfo.getTypeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
editItemClass() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
resourceBasicInfo.setNeDialogTitle(i18n.label.editResourceBasicType());
|
||||||
|
resourceBasicInfo.setIsNew(false);
|
||||||
|
resourceBasicInfo.setVisible(true);
|
||||||
|
resourceBasicInfo.setOperateType("4")
|
||||||
|
resourceBasicInfo.getTypeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
delItemClass() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: "确认删除该类型吗!",
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
resourceBasicInfo.deleteType();
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
batchDelete() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
tableStore
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
let keys = toJS(tableStore.selectedRowKeys).toString();
|
||||||
|
resourceBasicInfo.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 {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
resourceBasicInfo.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getDropMenuDatas() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
rightMenu
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
isPanelShow && resourceBasicInfo.setPanelStatus(false);
|
||||||
|
this[key] && this[key]();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabBtn() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
const btn = [
|
||||||
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { resourceBasicInfo.getTableInfo(); resourceBasicInfo.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={() => resourceBasicInfo.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
|
||||||
|
];
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearchChange(val) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
form2
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
resourceBasicInfo.setFName(val);
|
||||||
|
!this.isEmptyObject(form2.getFormParams()) && resourceBasicInfo.updateFields(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reRenderColumns(columns) {
|
||||||
|
let _this = this;
|
||||||
|
columns.forEach((c, index) => {
|
||||||
|
if (c.dataIndex == 'fdelete') {
|
||||||
|
c.render = function (text, record) {
|
||||||
|
return record.fdelete == '0' ? <Tag color="green" >正常</Tag> : <Tag color="red">停用</Tag>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onOperatesClick(record, rowIndex, operate) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = operate;
|
||||||
|
(index == '0') && this.doEdit(record.randomFieldId);
|
||||||
|
(index == '1') && this.doDel(record.randomFieldId);
|
||||||
|
(index == '2') && this.doRecover(record.randomFieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doEdit(id) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
resourceBasicInfo.setNeDialogTitle(i18n.label.editResourceBasicInfo());
|
||||||
|
resourceBasicInfo.setFId(id);
|
||||||
|
resourceBasicInfo.setIsNew(false);
|
||||||
|
resourceBasicInfo.setOperateType("3")
|
||||||
|
resourceBasicInfo.setVisible(true);
|
||||||
|
resourceBasicInfo.getForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
doDel(id) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
resourceBasicInfo.setIds(id);
|
||||||
|
this.showConfirm('del');
|
||||||
|
}
|
||||||
|
|
||||||
|
doRecover(id) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
this.showRecoverConfirm(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
showRecoverConfirm(id) {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
confirm({
|
||||||
|
title: i18n.confirm.defaultTitle(),
|
||||||
|
content: i18n.confirm.recoverConfirm(),
|
||||||
|
okText: i18n.button.ok(),
|
||||||
|
cancelText: i18n.button.cancel(),
|
||||||
|
onOk() {
|
||||||
|
resourceBasicInfo.recover(id);
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isNew,
|
||||||
|
operateType
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
switch(operateType){
|
||||||
|
case "1":
|
||||||
|
resourceBasicInfo.save();
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
resourceBasicInfo.saveType();
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
resourceBasicInfo.edit();
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
resourceBasicInfo.editType();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getPanelComponents() {
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
searchCondition,
|
||||||
|
form2,
|
||||||
|
searchConditionLoading
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
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") {
|
||||||
|
resourceBasicInfo.getTableInfo();
|
||||||
|
resourceBasicInfo.setPanelStatus(false)
|
||||||
|
}
|
||||||
|
}}>{arr}</Row>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//非空判断
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log = () => {
|
||||||
|
window.setLogViewProp({
|
||||||
|
logMoudleType: 11,
|
||||||
|
keys: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const {
|
||||||
|
resourceBasicInfo
|
||||||
|
} = this.props;
|
||||||
|
const {
|
||||||
|
isPanelShow, form2, fname, conditionNum, tableStore, nEdialogTitle, visible, condition,
|
||||||
|
form, dialogLoading, isEdit, date, hasRight, treeConfig, treeLoading,operateType
|
||||||
|
} = resourceBasicInfo;
|
||||||
|
|
||||||
|
if (hasRight === false) {
|
||||||
|
return renderNoright();
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
onSelectedTreeNode,
|
||||||
|
selectedKeys,
|
||||||
|
onExpand,
|
||||||
|
treeExpandKeys
|
||||||
|
} = toJS(treeConfig);
|
||||||
|
const treeCom = (
|
||||||
|
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
|
||||||
|
datas={data}
|
||||||
|
searchLabel={"类型"}
|
||||||
|
onSelect={onSelectedTreeNode}
|
||||||
|
selectedKeys={selectedKeys}
|
||||||
|
onExpand={onExpand}
|
||||||
|
loading={treeLoading}
|
||||||
|
expandedKeys={treeExpandKeys} />
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
hasRight && <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.resourceBasicInfo()}
|
||||||
|
icon={<i className='icon-coms-hrm' />}
|
||||||
|
iconBgcolor='#217346'
|
||||||
|
loading={true}
|
||||||
|
buttons={this.getTopMenuBtns()}
|
||||||
|
showDropIcon={true}
|
||||||
|
dropMenuDatas={this.getDropMenuDatas()}
|
||||||
|
onDropMenuClick={(e) => this.handleMenuClick(e)}
|
||||||
|
>
|
||||||
|
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
|
||||||
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@9c3zts`}
|
||||||
|
searchType={['base', 'advanced']}
|
||||||
|
showSearchAd={isPanelShow}
|
||||||
|
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? fname : form2.getFormParams().fname}
|
||||||
|
setShowSearchAd={bool => resourceBasicInfo.setPanelStatus(bool)}
|
||||||
|
hideSearchAd={() => resourceBasicInfo.setPanelStatus(false)}
|
||||||
|
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||||
|
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||||
|
hasMask={false}
|
||||||
|
buttonsAd={this.getTabBtn()}
|
||||||
|
onSearch={() => resourceBasicInfo.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)}
|
||||||
|
/>
|
||||||
|
</WeaLeftRightLayout>
|
||||||
|
</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={operateType == 2 ? 180 : 230}
|
||||||
|
conditionLen={1}
|
||||||
|
save={() => this.handleSave()}
|
||||||
|
onCancel={() => resourceBasicInfo.setVisible(false)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,352 @@
|
||||||
|
import React from 'react'
|
||||||
|
import * as mobx from 'mobx'
|
||||||
|
import {
|
||||||
|
inject,
|
||||||
|
observer
|
||||||
|
} from 'mobx-react'
|
||||||
|
import {
|
||||||
|
WeaTop,
|
||||||
|
WeaTab,
|
||||||
|
WeaFormItem,
|
||||||
|
WeaRightMenu,
|
||||||
|
WeaAlertPage,
|
||||||
|
WeaNewScrollPagination,
|
||||||
|
WeaSlideModal
|
||||||
|
} from 'ecCom'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Spin,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
|
message,
|
||||||
|
Switch,
|
||||||
|
Menu, Dropdown, Icon, Anchor
|
||||||
|
} from 'antd';
|
||||||
|
|
||||||
|
import {
|
||||||
|
WeaSwitch,
|
||||||
|
WeaTableNew
|
||||||
|
} from 'comsMobx';
|
||||||
|
import {
|
||||||
|
i18n
|
||||||
|
} from '../../public/i18n';
|
||||||
|
|
||||||
|
import '../../style/card.less';
|
||||||
|
import FormItem from './FormItem';
|
||||||
|
import IframeItem from './IframeItem';
|
||||||
|
import AnchorDetect from './AnchorDetect';
|
||||||
|
import { renderNoright } from '../../util'; // 从util文件引入公共的方法
|
||||||
|
import VersionsSlider from '../VersionsSlider';
|
||||||
|
import isEmpty from 'lodash/isEmpty'
|
||||||
|
|
||||||
|
|
||||||
|
const toJS = mobx.toJS;
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
|
||||||
|
@inject('resourceCard')
|
||||||
|
@observer
|
||||||
|
export default class ResourceCard extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
activity: 0,//激活的锚点
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// componentDidUpdate(prevProps) {
|
||||||
|
// // 判断items是否更新
|
||||||
|
// if (prevProps.items !== this.props.items
|
||||||
|
// && this.isDiff(prevProps.items, this.props.items)) {
|
||||||
|
// // 重新生成受监控元素
|
||||||
|
// this.buildDetectElements(this.props.items);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 判断两数组是否一摸一样
|
||||||
|
// isDiff = (before, after) => {
|
||||||
|
// if (before.length !== after.length) return false;
|
||||||
|
// // 先对数组进行排序
|
||||||
|
// const beforeTemp = [...before].sort(), afterTemp = [...after].sort();
|
||||||
|
// for (let i = 0; i < beforeTemp.length; i++) {
|
||||||
|
// if (beforeTemp[i] !== afterTemp[i]) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// };
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (this.props.location.key !== nextProps.location.key) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const {
|
||||||
|
resourceCard
|
||||||
|
} = this.props;
|
||||||
|
let { hash } = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
resourceCard.userid = id;
|
||||||
|
resourceCard.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
onScrollEnd = () => {
|
||||||
|
// resourceCard.scrollLoading = true;
|
||||||
|
|
||||||
|
// setTimeout(() => {
|
||||||
|
// // resourceCard.data.iframeList.push({
|
||||||
|
// // id: "job",
|
||||||
|
// // title: "岗位管理",
|
||||||
|
// // url: '/spa/organization/static/index.html#/main/organization/companyExtend/7'
|
||||||
|
// // })
|
||||||
|
// resourceCard.scrollLoading = false;
|
||||||
|
// }, 2000);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// buildDetectElements = () => {
|
||||||
|
// const {
|
||||||
|
// resourceCard
|
||||||
|
// } = this.props,{
|
||||||
|
// data
|
||||||
|
// } =resourceCard;
|
||||||
|
|
||||||
|
// !this.isEmptyObject(data) && data.anchorList.map((item, index) => {
|
||||||
|
// item.activity = index;
|
||||||
|
// item.offset = document.getElementById(item.id).offsetTop + document.getElementById(item.id).clientHeight;
|
||||||
|
// })
|
||||||
|
// resourceCard.setDetectElements(data.anchorList);
|
||||||
|
// }
|
||||||
|
|
||||||
|
handleMenuClick = (e) => {
|
||||||
|
window.open(e.item.props.url,"_blank")
|
||||||
|
}
|
||||||
|
|
||||||
|
view = () => {
|
||||||
|
const { resourceCard } = this.props;
|
||||||
|
resourceCard.selectVersions();
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose = () => {
|
||||||
|
const { resourceCard } = this.props;
|
||||||
|
resourceCard.open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onScroll = (event) => {
|
||||||
|
const {
|
||||||
|
resourceCard
|
||||||
|
} = this.props,{
|
||||||
|
detectElements,
|
||||||
|
flag
|
||||||
|
} = resourceCard;
|
||||||
|
const postion = event.target.scrollTop;
|
||||||
|
let getActivityCurrent = this.state.activity;
|
||||||
|
detectElements.map((item, index) => {
|
||||||
|
if (postion >= document.getElementById(item.id).offsetTop && postion <= item.offset) {
|
||||||
|
return getActivityCurrent = item.activity;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if(event.target.scrollHeight == postion + event.target.clientHeight) {
|
||||||
|
getActivityCurrent = detectElements.length - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
activity: getActivityCurrent
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollToAnchor = (anchorName, index) => {
|
||||||
|
const {
|
||||||
|
resourceCard
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let _this = this;
|
||||||
|
if (anchorName) {
|
||||||
|
// 找到锚点
|
||||||
|
let anchorElement = document.getElementById(anchorName);
|
||||||
|
// 如果对应id的锚点存在,就跳转到锚点
|
||||||
|
if (anchorElement) { anchorElement.scrollIntoView({ block: 'start', behavior: 'smooth' }); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyObject(obj) {
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
resourceCard
|
||||||
|
} = this.props, {
|
||||||
|
height,
|
||||||
|
scrollLoading,
|
||||||
|
offset,
|
||||||
|
overtime,
|
||||||
|
intervalTime,
|
||||||
|
data,
|
||||||
|
versionList,
|
||||||
|
open
|
||||||
|
} = resourceCard;
|
||||||
|
const menu = (
|
||||||
|
<Menu onClick={this.handleMenuClick}>
|
||||||
|
{
|
||||||
|
!this.isEmptyObject(data) && data.buttons.slice(3).map((item,index) => {
|
||||||
|
return (
|
||||||
|
<Menu.Item key="1" url={item.url}>{item.name}</Menu.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
!this.isEmptyObject(data) && <WeaNewScrollPagination
|
||||||
|
height='100%'
|
||||||
|
onScrollEnd={this.onScrollEnd}
|
||||||
|
onScroll={this.onScroll}
|
||||||
|
>
|
||||||
|
<div className="gutter-resource-card">
|
||||||
|
<div className="gutter-row">
|
||||||
|
<div className='top'>
|
||||||
|
<img src={data.user.image} />
|
||||||
|
<div className='user'>
|
||||||
|
<div className='name'>{data.user.name}
|
||||||
|
<span>{data.user.sex == 0 ? <i className="icon-coms-men" /> : <i className="icon-coms-women" />}</span>
|
||||||
|
</div>
|
||||||
|
{/* <div className='icon-info'>
|
||||||
|
<i className="icon-coms-Send-message" />
|
||||||
|
<i className="icon-coms-message-o" />
|
||||||
|
<i className="icon-coms-Send-emails" />
|
||||||
|
<i className="icon-coms-New-schedule-o" />
|
||||||
|
</div> */}
|
||||||
|
<div className='content'>
|
||||||
|
<div>
|
||||||
|
<span className='label'><i className="icon-portal-email-o" /></span>
|
||||||
|
<span className='value'>{data.user.email}</span>
|
||||||
|
<span className='label'><i className="icon-coms-contact" /></span>
|
||||||
|
<span className='value'>{data.user.phone}</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ marginTop: '10px' }}>
|
||||||
|
<span className='label'>账号类型:</span>
|
||||||
|
<span className='value'>{data.user.accountType}</span>
|
||||||
|
<span className='label'>状态:</span>
|
||||||
|
<span className='value'>{data.user.status}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='right-button'>
|
||||||
|
<Button className='item' onClick={this.view} >{i18n.button.version()}</Button>
|
||||||
|
{
|
||||||
|
data.buttons.slice(0,3).map((item,index) => {
|
||||||
|
return (
|
||||||
|
<Button className='item' onClick={() => { window.open(item.url.replaceAll("${id}",data.user.id),"_self")}}>{item.name}</Button>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
{
|
||||||
|
data.buttons.length > 3 ? <Dropdown overlay={menu}>
|
||||||
|
<Button style={{ marginLeft: 8 }} className='item'>
|
||||||
|
更多操作 <Icon type="down" />
|
||||||
|
</Button>
|
||||||
|
</Dropdown> : ''
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className='data'>
|
||||||
|
<Row type="flex" justify="space-between" style={{ height: '100%' }}>
|
||||||
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/workflow/static/index.html#/main/workflow/listDoing?resourceid=${data.user.ecId}`)}}>
|
||||||
|
<img src="/hrm/hrm_e9/image/workflow.png" alt="" />
|
||||||
|
<div>
|
||||||
|
<p>流程总数</p>
|
||||||
|
<p>{data.statistical.workflowCount}</p>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/document/static/index.html#/main/document/search?viewcondition=2&doccreaterid=${data.user.ecId}`)}}>
|
||||||
|
<img src="/hrm/hrm_e9/image/doc.png" alt="" />
|
||||||
|
<div >
|
||||||
|
<p>文档总数</p>
|
||||||
|
<p>{data.statistical.docCount}</p>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/crm/static/index.html#/main/crm/customer/hrmView?searchHrmId=${data.user.ecId}`)}}>
|
||||||
|
<img src="/hrm/hrm_e9/image/custom.png" alt="" />
|
||||||
|
<div>
|
||||||
|
<p>我的客户</p>
|
||||||
|
<p>{data.statistical.cusCount}</p>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/cowork/static/index.html#/main/cowork/hrmview?searchHrmid=${data.user.ecId}`) }}>
|
||||||
|
<img src="/hrm/hrm_e9/image/cowork.png" alt="" />
|
||||||
|
<div>
|
||||||
|
<p>我的协作</p>
|
||||||
|
<p>{data.statistical.collaborationCount}</p>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/blog/static/index.html#/user/${data.user.ecId}`) }}>
|
||||||
|
<img src="/hrm/hrm_e9/image/weibo.png" alt="" />
|
||||||
|
<div>
|
||||||
|
<p>微博总数</p>
|
||||||
|
<p>{data.statistical.weiboCount}</p>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
data.formItems.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<FormItem groupInfo={item} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
{
|
||||||
|
data.iframeList.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<IframeItem iframeInfo={item} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div className="gutter-row">
|
||||||
|
<AnchorDetect
|
||||||
|
anchorList={data.anchorList}
|
||||||
|
container={window}
|
||||||
|
activity={this.state.activity}
|
||||||
|
onChange={this.scrollToAnchor}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Spin size="large" tip="" className='scroll-spin' spinning={scrollLoading} />
|
||||||
|
<WeaSlideModal visible={open}
|
||||||
|
// top={6}
|
||||||
|
width={40}
|
||||||
|
height={100}
|
||||||
|
direction={'right'}
|
||||||
|
measure={'%'}
|
||||||
|
content={!isEmpty(versionList) ? <VersionsSlider versionList={versionList} handleChange={val => resourceCard.changeVersion(val)}/> : <div style={{"textAlign":"center","color":"red","fontSize":"20px","marginTop": "50px"}}> 暂无历史版本 </div>}
|
||||||
|
onClose={this.onClose}
|
||||||
|
onAnimationEnd={() => console.log('onAnimationEnd')} />
|
||||||
|
</WeaNewScrollPagination>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,248 @@
|
||||||
|
/**
|
||||||
|
* @Author: 程亮
|
||||||
|
* @Date: 2022-06-20 14:59:21
|
||||||
|
* @LastEditTime: 2022-10-18 11:18:05
|
||||||
|
* @Description:
|
||||||
|
* @FilePath: /trunk/src4js/pc4mobx/organization/components/resource/ResourceExtend.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
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('resourceExtend')
|
||||||
|
@inject('resource')
|
||||||
|
@observer
|
||||||
|
export default class ResourceExtend extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
init = () => {
|
||||||
|
const { resourceExtend,resource } = this.props;
|
||||||
|
let {hash} = window.location;
|
||||||
|
hash = hash.split("?")[0];
|
||||||
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
||||||
|
resourceExtend.init();
|
||||||
|
resourceExtend.setId(id);
|
||||||
|
resourceExtend.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabChildren = () => {
|
||||||
|
const { resourceExtend } = this.props;
|
||||||
|
let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = resourceExtend;
|
||||||
|
let tabChildren = [];
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
tableInfo && tableInfo.map((t, i) => {
|
||||||
|
if (detailSelectedKey == i) {
|
||||||
|
tabChildren.push(
|
||||||
|
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@b813my@${i}`}
|
||||||
|
ref={(ref)=>resourceExtend.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 {
|
||||||
|
resourceExtend
|
||||||
|
} = this.props, {
|
||||||
|
tableInfo,
|
||||||
|
selectedRows,
|
||||||
|
setSelectedRowKeys,
|
||||||
|
selectedRowKeys
|
||||||
|
} = resourceExtend;
|
||||||
|
|
||||||
|
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 { resourceExtend } = this.props;
|
||||||
|
let { form, conditions, isEditor } = resourceExtend;
|
||||||
|
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 { resourceExtend } = this.props;
|
||||||
|
let { detailSelectedKey = '0', tableInfo } = resourceExtend;
|
||||||
|
tableInfo = toJS(tableInfo);
|
||||||
|
let d = cloneDeep(tableInfo);
|
||||||
|
d[Number(detailSelectedKey)].tabinfo.datas = data;
|
||||||
|
resourceExtend.updateTableInfo(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRightMenu = () => {
|
||||||
|
const { resourceExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = resourceExtend;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTopButtons = () => {
|
||||||
|
const { resourceExtend } = this.props;
|
||||||
|
const { isEditor, buttons } = resourceExtend;
|
||||||
|
const save = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@pkes6y`} type="primary" onClick={this.saveEditCard} >{i18n.button.save()}</Button>;
|
||||||
|
const btns = [];
|
||||||
|
btns.push(save);
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
saveEditCard = () => {
|
||||||
|
const { resourceExtend } = this.props;
|
||||||
|
resourceExtend.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
changeData(key) {
|
||||||
|
const {
|
||||||
|
resourceExtend
|
||||||
|
} = this.props;
|
||||||
|
resourceExtend.changeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { resourceExtend } = this.props;
|
||||||
|
const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = resourceExtend;
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
resourceExtend.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>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue