@titaui/pc 1.9.18 → 1.9.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/lib/components/change-okr-modal/Item.js +24 -27
  2. package/lib/components/create-okr-modal/fields/index.css +1 -1
  3. package/lib/components/dialog-confirm/index.css +8 -3
  4. package/lib/components/dialog-confirm/index.js +17 -15
  5. package/lib/components/drawer/index.css +1 -1
  6. package/lib/components/dynamic/dynamic-item/dynamic-align/index.css +2 -4
  7. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.css +2 -4
  8. package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.css +2 -4
  9. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.css +2 -4
  10. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.css +2 -4
  11. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.css +1 -3
  12. package/lib/components/dynamic/dynamic-item/dynamic-okrs-communication/index.css +2 -4
  13. package/lib/components/dynamic/dynamic-item/dynamic-plan-communication/index.css +2 -4
  14. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.css +2 -4
  15. package/lib/components/dynamic/dynamic-item/dynamic-project/index.css +2 -4
  16. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.css +2 -4
  17. package/lib/components/dynamic/dynamic-item/dynamic-replay/index.css +2 -4
  18. package/lib/components/dynamic/dynamic-item/dynamic-report/index.css +2 -4
  19. package/lib/components/dynamic/dynamic-item/dynamic-reward/index.css +2 -3
  20. package/lib/components/dynamic/dynamic-item/dynamic-share/index.css +2 -4
  21. package/lib/components/dynamic/dynamic-item/dynamic-task/index.css +2 -4
  22. package/lib/components/dynamic/dynamic-topping/index.css +1 -1
  23. package/lib/components/grid-layout/okr-align/index.js +1 -1
  24. package/lib/components/grid-layout/okr-progress/index.js +1 -1
  25. package/lib/components/menus/components/menu-tree/index.css +2 -2
  26. package/lib/components/menus/export-modules/okr-menus/depart-menus/index.css +1 -1
  27. package/lib/components/okr-detail/base-info/base-info.js +14 -13
  28. package/lib/components/okr-detail/base-info/o-desc/index.css +1 -1
  29. package/lib/components/okr-detail/components/header/index.css +4 -0
  30. package/lib/components/okr-detail/components/header/index.js +7 -3
  31. package/lib/components/okr-detail/components/header/o-score.js +163 -0
  32. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +1 -1
  33. package/lib/components/okr-detail/components/okr-tree/tree-node/index.css +1 -1
  34. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.css +1 -1
  35. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/edit-pop.js +5 -2
  36. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/kr-push-score.js +10 -2
  37. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/style.js +6 -6
  38. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-parent-node/index.css +1 -1
  39. package/lib/components/okr-detail/components/okr-tree/tree-node/o-child-node/index.css +1 -1
  40. package/lib/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.css +1 -1
  41. package/lib/components/okr-detail/detail-footer/index.css +1 -1
  42. package/lib/components/okr-detail/e-list/search-form/fields/index.css +1 -0
  43. package/lib/components/okr-detail/okr-list/index.css +2 -2
  44. package/lib/components/okr-detail/request-apis.js +11 -2
  45. package/lib/components/okr-progress-modal/helper.js +2 -2
  46. package/lib/components/okr-progress-modal/index.css +2 -2
  47. package/lib/components/okrcase-library/index.css +1 -1
  48. package/lib/components/pagination/select.css +1 -1
  49. package/lib/components/search-dropdown/index.css +1 -1
  50. package/lib/components/switch/index.css +1 -1
  51. package/lib/components/tabs/index.css +1 -1
  52. package/lib/components/tita-chart/charts/pie.js +3 -1
  53. package/lib/components/tooltip/tooltip-text/index.js +6 -5
  54. package/lib/components/user-selector/export-modules/duties-selector/index.js +69 -10
  55. package/lib/components/user-selector/request-apis.js +11 -2
  56. package/lib/components/version-change-modal/index.css +1 -1
  57. package/lib/components/weekly-report/index.css +1 -1
  58. package/lib/components-v1/confirm/index.js +1 -1
  59. package/lib/components-v1/dropDownSelector/styles/index.js +1 -1
  60. package/lib/pages/appointment-demo/index.css +1 -1
  61. package/lib/pages/group-management/page-view/importGroupStaff/index.css +2 -2
  62. package/lib/pages/okr-map/export-modules/okr-map/header/index.css +1 -1
  63. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +1 -1
  64. package/lib/pages/personal-info/components/base-info/index.js +8 -6
  65. package/lib/pages/personal-info/components/edit-base-info/index.js +26 -22
  66. package/lib/utils/i18n-front-translate.js +18 -0
  67. package/package.json +1 -1
  68. package/src/components/change-okr-modal/Item.tsx +9 -3
  69. package/src/components/create-okr-modal/fields/index.scss +1 -1
  70. package/src/components/dialog-confirm/index.js +95 -58
  71. package/src/components/dialog-confirm/index.scss +16 -12
  72. package/src/components/drawer/index.scss +1 -1
  73. package/src/components/dynamic/dynamic-item/dynamic-align/index.scss +2 -4
  74. package/src/components/dynamic/dynamic-item/dynamic-announcement/index.scss +2 -4
  75. package/src/components/dynamic/dynamic-item/dynamic-assessment/index.scss +2 -4
  76. package/src/components/dynamic/dynamic-item/dynamic-create-o/index.scss +2 -4
  77. package/src/components/dynamic/dynamic-item/dynamic-kr/index.scss +2 -4
  78. package/src/components/dynamic/dynamic-item/dynamic-milestone/index.scss +1 -3
  79. package/src/components/dynamic/dynamic-item/dynamic-okrs-communication/index.scss +2 -4
  80. package/src/components/dynamic/dynamic-item/dynamic-plan-communication/index.scss +2 -4
  81. package/src/components/dynamic/dynamic-item/dynamic-progress/index.scss +2 -4
  82. package/src/components/dynamic/dynamic-item/dynamic-project/index.scss +2 -4
  83. package/src/components/dynamic/dynamic-item/dynamic-relative/index.scss +2 -4
  84. package/src/components/dynamic/dynamic-item/dynamic-replay/index.scss +2 -4
  85. package/src/components/dynamic/dynamic-item/dynamic-report/index.scss +2 -4
  86. package/src/components/dynamic/dynamic-item/dynamic-reward/index.scss +2 -3
  87. package/src/components/dynamic/dynamic-item/dynamic-share/index.scss +2 -4
  88. package/src/components/dynamic/dynamic-item/dynamic-task/index.scss +2 -4
  89. package/src/components/dynamic/dynamic-topping/index.scss +1 -1
  90. package/src/components/form/form-fields/input/index.tsx +1 -1
  91. package/src/components/form/form-fields/textarea/index.tsx +2 -1
  92. package/src/components/grid-layout/okr-align/index.tsx +1 -1
  93. package/src/components/grid-layout/okr-progress/index.tsx +1 -1
  94. package/src/components/menus/components/menu-tree/index.scss +2 -2
  95. package/src/components/menus/export-modules/okr-menus/depart-menus/index.scss +1 -1
  96. package/src/components/okr-detail/base-info/base-info.tsx +39 -27
  97. package/src/components/okr-detail/base-info/o-desc/index.scss +1 -1
  98. package/src/components/okr-detail/components/header/index.js +4 -3
  99. package/src/components/okr-detail/components/header/index.scss +5 -0
  100. package/src/components/okr-detail/components/header/o-score.tsx +115 -0
  101. package/src/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +1 -1
  102. package/src/components/okr-detail/components/okr-tree/tree-node/index.scss +1 -1
  103. package/src/components/okr-detail/components/okr-tree/tree-node/kr-node/index.scss +1 -1
  104. package/src/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/edit-pop.tsx +2 -2
  105. package/src/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/kr-push-score.tsx +3 -3
  106. package/src/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/style.js +2 -6
  107. package/src/components/okr-detail/components/okr-tree/tree-node/kr-parent-node/index.scss +1 -1
  108. package/src/components/okr-detail/components/okr-tree/tree-node/o-child-node/index.scss +1 -1
  109. package/src/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.scss +1 -1
  110. package/src/components/okr-detail/detail-footer/index.scss +1 -1
  111. package/src/components/okr-detail/e-list/search-form/fields/index.scss +1 -0
  112. package/src/components/okr-detail/okr-list/index.scss +1 -1
  113. package/src/components/okr-detail/request-apis.ts +7 -0
  114. package/src/components/okr-progress-modal/helper.js +2 -2
  115. package/src/components/okr-progress-modal/index.scss +2 -2
  116. package/src/components/okrcase-library/index.scss +1 -1
  117. package/src/components/pagination/select.scss +1 -1
  118. package/src/components/search-dropdown/index.scss +1 -1
  119. package/src/components/switch/index.scss +1 -1
  120. package/src/components/tabs/index.scss +1 -1
  121. package/src/components/tita-chart/charts/pie.tsx +2 -1
  122. package/src/components/tooltip/tooltip-text/index.tsx +8 -6
  123. package/src/components/user-selector/export-modules/duties-selector/index.tsx +78 -18
  124. package/src/components/user-selector/request-apis.js +7 -0
  125. package/src/components/version-change-modal/index.scss +1 -1
  126. package/src/components/weekly-report/index.scss +1 -1
  127. package/src/components-v1/confirm/index.tsx +0 -1
  128. package/src/components-v1/dropDownSelector/styles/index.tsx +1 -1
  129. package/src/pages/appointment-demo/index.scss +1 -1
  130. package/src/pages/group-management/page-view/importGroupStaff/index.scss +2 -2
  131. package/src/pages/okr-map/export-modules/okr-map/header/index.scss +1 -1
  132. package/src/pages/okr-map/export-modules/share-okr-page/header/index.scss +1 -1
  133. package/src/pages/personal-info/components/base-info/index.tsx +42 -21
  134. package/src/pages/personal-info/components/edit-base-info/index.tsx +151 -141
  135. package/src/utils/i18n-front-translate.ts +8 -0
@@ -1,15 +1,17 @@
1
- import React, { useState, forwardRef, useImperativeHandle } from 'react';
2
- import classNames from 'classnames';
1
+ import React, { useState, forwardRef, useImperativeHandle, useEffect } from 'react';
3
2
  import ChooseTree from '../../select-tree/choose-tree';
4
3
  import Popup from '../../../popup';
5
4
  import { TreeNodeContext } from '../../context';
6
5
  import { CommonContext } from '../../context';
7
- import { getDuties } from '../../request-apis';
6
+ import Loading from '../../loading';
7
+ import { SinglePersonalLayout } from '../../layout';
8
+ import SelectorInput from '../../../selector-input';
9
+ import { getDuties,searchDuties } from '../../request-apis';
8
10
 
9
11
  import '../../index.scss';
10
12
  import './index.scss';
11
13
 
12
- const preCls = 'perspm-duties-selector';
14
+ // const preCls = 'perspm-duties-selector';
13
15
 
14
16
  interface Props {
15
17
  onSelect?: Function;
@@ -37,6 +39,39 @@ export default forwardRef((props: Props, ref) => {
37
39
  } = props;
38
40
 
39
41
  const [visible, setVisible] = useState(false);
42
+ const [searchKey, setSearchKey] = useState('');
43
+ const [loading, setLoading] = useState(false);
44
+ const [dutiesData,setDutiesData] = useState([])
45
+
46
+ // 获取数据的API
47
+ const searchTreeData = () => {
48
+
49
+ return searchDuties({
50
+ searchKey,
51
+ }).then(res => {
52
+ if(!!res.Code){
53
+ let data = res.Data.map(it => {
54
+ return {
55
+ 'key': `${it.code}`,
56
+ 'id': `${it.id}`,
57
+ 'pid': `-1`,
58
+ 'nodeType': 'duties',
59
+ 'isLeaf': true,
60
+ 'data': { ...it }
61
+ };
62
+ })
63
+ setDutiesData(data)
64
+ }
65
+ }).catch(err=>{
66
+ console.log(err)
67
+ });
68
+ }
69
+
70
+ useEffect(() => {
71
+ if (!searchKey) return;
72
+ setLoading(true);
73
+ searchTreeData().then(() => setLoading(false));
74
+ }, [searchKey]);
40
75
 
41
76
  const onGetTreeData = () => {
42
77
  return getDuties().then(duties => {
@@ -63,20 +98,45 @@ export default forwardRef((props: Props, ref) => {
63
98
  setVisible(false);
64
99
  }
65
100
 
66
- const popup = <div className={classNames(preCls)}>
67
- <div className={classNames(`${preCls}__inner`)}>
68
- <TreeNodeContext.Provider value={{}}>
69
- <ChooseTree
70
- onSelect={onSelectHandler}
71
- asyncData={true}
72
- multiple={false}
73
- getTreeData={onGetTreeData}
74
- itemHeight={itemHeight}
75
- height={height}
76
- virtual={true}
77
- />
78
- </TreeNodeContext.Provider>
79
- </div>
101
+ const onSearchChangeHandler = val => {
102
+ setSearchKey(val);
103
+ };
104
+
105
+
106
+ const popup = <div>
107
+ <SinglePersonalLayout>
108
+ <SelectorInput onChange={onSearchChangeHandler} />
109
+ {!!searchKey ? (
110
+ loading ? (
111
+ <Loading />
112
+ ) : (
113
+ <div>
114
+ <TreeNodeContext.Provider value={{}}>
115
+ <ChooseTree
116
+ multiple={false}
117
+ treeData={dutiesData}
118
+ asyncData={false}
119
+ onSelect={onSelectHandler}
120
+ virtual={true}
121
+ height={height-44}
122
+ />
123
+ </TreeNodeContext.Provider>
124
+ </div>
125
+ )
126
+ ) : (
127
+ <TreeNodeContext.Provider value={{}}>
128
+ <ChooseTree
129
+ onSelect={onSelectHandler}
130
+ asyncData={true}
131
+ multiple={false}
132
+ getTreeData={onGetTreeData}
133
+ itemHeight={itemHeight}
134
+ height={height-44}
135
+ virtual={true}
136
+ />
137
+ </TreeNodeContext.Provider>
138
+ )}
139
+ </SinglePersonalLayout>
80
140
  </div>;
81
141
 
82
142
  return <CommonContext.Provider value={{}}>
@@ -124,4 +124,11 @@ export const getDuties = () => {
124
124
  .then(res => {
125
125
  return res.data;
126
126
  })
127
+ }
128
+
129
+ export const searchDuties = ({searchKey}) => {
130
+ return axios.get(`${requestDomain()}/api/v1/${tenantId}/${userId}/position/search?status=1&pageNum=1&pageSize=100&filter=${searchKey}`)
131
+ .then(res => {
132
+ return res.data;
133
+ })
127
134
  }
@@ -79,7 +79,7 @@
79
79
  align-items: center;
80
80
  justify-content: center;
81
81
  font-size: 18px;
82
- font-weight: 500;
82
+ font-weight: 600;
83
83
  color: #ffffff;
84
84
  margin-bottom: 8px;
85
85
  flex-direction: column;
@@ -96,7 +96,7 @@
96
96
  position: relative;
97
97
  z-index: 1;
98
98
  font-size: 18px;
99
- font-weight: 500;
99
+ font-weight: 600;
100
100
  color: #2879FF;
101
101
  line-height: 26px;
102
102
  margin: 28px 0;
@@ -7,7 +7,6 @@ import { getLocale } from '../../utils/getLocale';
7
7
  const ConfirmWrapper = styled.div`
8
8
  /* TODO padding 可动态调整 */
9
9
  width: 300px;
10
- max-height: 100px;
11
10
  border-radius: 5px;
12
11
  box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.15);
13
12
  padding: 15px 12px;
@@ -1,6 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  export const DropDownContainer = styled.span`
3
- width: 100%;
3
+ flex: 1;
4
4
  /* margin: 0 0 15px; */
5
5
  padding: 5px 3px 0 0;
6
6
  font-size: 12px;
@@ -331,7 +331,7 @@ $baseFontSize: 37.5;//默认基准font-size
331
331
  &-title{
332
332
  margin: px2rem(8) 0;
333
333
  font-size: px2rem(24);
334
- font-weight: 500;
334
+ font-weight: 600;
335
335
  color: #141C28;
336
336
  line-height: px2rem(26);
337
337
  }
@@ -4,7 +4,7 @@
4
4
  &-download{
5
5
  &-template{
6
6
  font-size: 14px;
7
- font-weight: 500;
7
+ font-weight: 600;
8
8
  color: #3F4755;
9
9
  display: flex;
10
10
  justify-content: space-between;
@@ -17,7 +17,7 @@
17
17
  border-radius: 3px;
18
18
  border: 1px solid #2879FF;
19
19
  font-size: 12px;
20
- font-weight: 500;
20
+ font-weight: 600;
21
21
  color: #2879FF;
22
22
  line-height: 26px;
23
23
  &:hover{
@@ -38,7 +38,7 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
38
38
  top: 26px;
39
39
  left: 25px;
40
40
  font-size: 20px;
41
- font-weight: 500;
41
+ font-weight: 600;
42
42
  color: #1f2329;
43
43
  line-height: 28px;
44
44
  }
@@ -19,7 +19,7 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
19
19
  box-sizing: border-box;
20
20
  font-size: 20px;
21
21
  font-family: $font-family;
22
- font-weight: 500;
22
+ font-weight: 600;
23
23
  color: #141c28;
24
24
  line-height: 28px;
25
25
 
@@ -1,58 +1,79 @@
1
1
  import React, { FC, useState, useEffect } from "react";
2
- import { getUserInfoFun } from '../../request-api';
2
+ import { getUserInfoFun } from "../../request-api";
3
3
  import { RectBtn } from "../../../../components/button";
4
- import EditModle from '../edit-base-info';
5
- import {OpenUserName} from '../../../../utils/open-data'
4
+ import EditModle from "../edit-base-info";
5
+ import { OpenUserName } from "../../../../utils/open-data";
6
+ import { getLocale } from "../../../../utils/getLocale";
6
7
  import "./index.scss";
7
8
 
8
9
  const prefix = "titaui-personal-info-base-info";
9
10
 
10
11
  const BaseInfo: FC = () => {
11
- const [userInfo, setUserInfo] = useState({ name: "", email: "", mobile: "", userId: '' });
12
+ const [userInfo, setUserInfo] = useState({
13
+ name: "",
14
+ email: "",
15
+ mobile: "",
16
+ userId: "",
17
+ });
12
18
  const [visible, setVisible] = useState(false);
13
19
 
14
20
  const handleClickEdit = () => {
15
21
  setVisible(true);
16
- }
22
+ };
17
23
 
18
24
  const handleCancelEdit = () => {
19
25
  setVisible(false);
20
- }
26
+ };
21
27
 
22
28
  const handleSuccessEditBaseInfo = (userInfo) => {
23
- setUserInfo({...userInfo});
24
- }
29
+ setUserInfo({ ...userInfo });
30
+ };
25
31
 
26
32
  useEffect(() => {
27
- getUserInfoFun().then((resp) => {
28
- if (resp.Code === 1 && resp.Data) {
29
- setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
30
- }
31
- });
32
- }, []);
33
+ getUserInfoFun().then((resp) => {
34
+ if (resp.Code === 1 && resp.Data) {
35
+ setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
36
+ }
37
+ });
38
+ }, []);
33
39
 
34
40
  return (
35
41
  <div className={prefix}>
36
42
  <div className={`${prefix}__header`}>
37
- <span className={`${prefix}__header-title`}>{getLocale('Per_Ass_New_title_text_BasicIn')}</span>
43
+ <span className={`${prefix}__header-title`}>
44
+ {getLocale("Per_Ass_New_title_text_BasicIn")}
45
+ </span>
38
46
  <RectBtn
39
47
  type={"primary"}
40
- text={getLocale('Mod_Editor')}
48
+ text={getLocale("Mod_Editor")}
41
49
  onClick={handleClickEdit}
42
50
  />
43
- <EditModle visible={visible} onCancel={handleCancelEdit} handleSuccessEditBaseInfo={handleSuccessEditBaseInfo} info={userInfo}/>
51
+ <EditModle
52
+ visible={visible}
53
+ onCancel={handleCancelEdit}
54
+ handleSuccessEditBaseInfo={handleSuccessEditBaseInfo}
55
+ info={userInfo}
56
+ />
44
57
  </div>
45
58
  <div className={`${prefix}__form`}>
46
- <div className={`${prefix}__form-title`}>姓名</div>
47
- <span className={`${prefix}__form-value`}><OpenUserName id={userInfo.userId} name={userInfo.name} /></span>
59
+ <div className={`${prefix}__form-title`}>
60
+ {getLocale("Mod_UserName")}
61
+ </div>
62
+ <span className={`${prefix}__form-value`}>
63
+ <OpenUserName id={userInfo.userId} name={userInfo.name} />
64
+ </span>
48
65
  </div>
49
66
  <div className={`${prefix}__form`}>
50
67
  <div className={`${prefix}__form-title`}>手机号码</div>
51
- <span className={`${prefix}__form-value`}>{userInfo.mobile ? userInfo.mobile : "未设置"}</span>
68
+ <span className={`${prefix}__form-value`}>
69
+ {userInfo.mobile ? userInfo.mobile : getLocale('Data_Notset')}
70
+ </span>
52
71
  </div>
53
72
  <div className={`${prefix}__form`}>
54
73
  <div className={`${prefix}__form-title`}>电子邮箱</div>
55
- <span className={`${prefix}__form-value`}>{userInfo.email ? userInfo.email : "未设置"}</span>
74
+ <span className={`${prefix}__form-value`}>
75
+ {userInfo.email ? userInfo.email : getLocale('Data_Notset')}
76
+ </span>
56
77
  </div>
57
78
  </div>
58
79
  );
@@ -1,172 +1,182 @@
1
- import React, { useState, useRef, useEffect } from 'react';
2
- import Form from '../../../../components/form';
3
- import { getUserInfoFun, saveUserInfo } from '../../request-api';
4
- import Toast from '../../../../components/toast';
5
- import Dialog from '../../../../components/dialog';
6
- import './index.scss';
1
+ import React, { useState, useRef, useEffect } from "react";
2
+ import Form from "../../../../components/form";
3
+ import { getUserInfoFun, saveUserInfo } from "../../request-api";
4
+ import Toast from "../../../../components/toast";
5
+ import Dialog from "../../../../components/dialog";
6
+ import { getLocale } from "../../../../utils/getLocale";
7
+ import { i18nLimitCharacters } from "../../../../utils/i18n-front-translate"
8
+ import "./index.scss";
7
9
 
8
10
  const { Fields } = Form;
9
11
 
10
- const prefix = "titaui-edit-personal-info"
12
+ const prefix = "titaui-edit-personal-info";
11
13
 
12
14
  const EditBaseInfo = (props) => {
13
- const { visible, onCancel, handleSuccessEditBaseInfo, info } = props;
15
+ const { visible, onCancel, handleSuccessEditBaseInfo, info } = props;
14
16
 
15
- const modalRef = useRef<any>();
17
+ const modalRef = useRef<any>();
16
18
  const formContainerRef = useRef<any>();
17
- const formRef = useRef<any>();
19
+ const formRef = useRef<any>();
18
20
 
19
- const [ isDisable, setIsDisable ] = useState(false);
20
- const [ isEdit, setIsEdit ] = useState(false);
21
- const [ userInfo, setUserInfo ] = useState({ name: '', email: '', mobile: '' });
21
+ const [isDisable, setIsDisable] = useState(false);
22
+ const [isEdit, setIsEdit] = useState(false);
23
+ const [userInfo, setUserInfo] = useState({ name: "", email: "", mobile: "" });
22
24
 
23
- const handleNameChange = (value) => {
24
- setUserInfo({
25
- ...userInfo,
26
- name: value || ''
27
- });
28
- if(value.length > 50 || value.length === 0) {
25
+ const handleNameChange = (value) => {
26
+ setUserInfo({
27
+ ...userInfo,
28
+ name: value || "",
29
+ });
30
+ if (value.length > 50 || value.length === 0) {
29
31
  setIsDisable(true);
30
32
  } else {
31
33
  setIsDisable(false);
32
34
  }
33
- setIsEdit(true);
34
- };
35
+ setIsEdit(true);
36
+ };
35
37
 
36
- const handlePhoneChange = (value) => {
37
- setUserInfo({
38
- ...userInfo,
39
- mobile: value || ''
40
- });
41
- if(value.length !== 11 ) {
38
+ const handlePhoneChange = (value) => {
39
+ setUserInfo({
40
+ ...userInfo,
41
+ mobile: value || "",
42
+ });
43
+ if (value.length !== 11) {
42
44
  setIsDisable(true);
43
- }else {
45
+ } else {
44
46
  setIsDisable(false);
45
47
  }
46
- setIsEdit(true);
47
- };
48
+ setIsEdit(true);
49
+ };
48
50
 
49
- const handleEmailChange = (value) => {
50
- setUserInfo({
51
- ...userInfo,
52
- email: value || ''
53
- });
54
- setIsEdit(true);
55
- };
51
+ const handleEmailChange = (value) => {
52
+ setUserInfo({
53
+ ...userInfo,
54
+ email: value || "",
55
+ });
56
+ setIsEdit(true);
57
+ };
56
58
 
57
- const handleSaveUserInfo = () => {
58
- if (!userInfo.mobile || !userInfo.name || userInfo.name.length > 50) {
59
+ const handleSaveUserInfo = () => {
60
+ if (!userInfo.mobile || !userInfo.name || userInfo.name.length > 50) {
59
61
  setIsDisable(true);
60
- return;
61
- } else {
62
- saveUserInfo({ data: userInfo }).then((resp) => {
63
- if (resp.Code === 1) {
64
- Toast.Success('更新成功', { canClose: false });
62
+ return;
63
+ } else {
64
+ saveUserInfo({ data: userInfo }).then((resp) => {
65
+ if (resp.Code === 1) {
66
+ Toast.Success(getLocale('Per_Ma_form_Updatesuc'), { canClose: false });
65
67
  handleSuccessEditBaseInfo(userInfo);
66
68
  onCancel();
67
- } else {
68
- Toast.Error(resp.Message, { canClose: false });
69
- }
70
- });
71
- }
72
- };
69
+ } else {
70
+ Toast.Error(resp.Message, { canClose: false });
71
+ }
72
+ });
73
+ }
74
+ };
73
75
 
74
- useEffect(() => {
75
- getUserInfoFun().then((resp) => {
76
- if (resp.Code === 1 && resp.Data) {
77
- setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
78
- }
79
- });
80
- }, []);
76
+ useEffect(() => {
77
+ getUserInfoFun().then((resp) => {
78
+ if (resp.Code === 1 && resp.Data) {
79
+ setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
80
+ }
81
+ });
82
+ }, []);
81
83
 
82
- return (
83
- <Dialog
84
- visible={visible}
85
- ref={modalRef}
86
- width={480}
87
- mask
88
- centered
89
- title={'基本信息设置'}
90
- noHeadLine
91
- maskClosable={false}
92
- onClose={() => {
93
- onCancel();
94
- setUserInfo({name: info.name, mobile: info.mobile, email:info.email})
84
+ return (
85
+ <Dialog
86
+ visible={visible}
87
+ ref={modalRef}
88
+ width={480}
89
+ mask
90
+ centered
91
+ title={"基本信息设置"}
92
+ noHeadLine
93
+ maskClosable={false}
94
+ onClose={() => {
95
+ onCancel();
96
+ setUserInfo({
97
+ name: info.name,
98
+ mobile: info.mobile,
99
+ email: info.email,
100
+ });
95
101
  }}
96
- onCancel={() => {
102
+ onCancel={() => {
97
103
  onCancel();
98
- setUserInfo({name: info.name, mobile: info.mobile, email:info.email})
104
+ setUserInfo({
105
+ name: info.name,
106
+ mobile: info.mobile,
107
+ email: info.email,
108
+ });
99
109
  }}
100
- okText="确定"
101
- noFooterLine
102
- onOk={handleSaveUserInfo}
103
- disabled={isDisable}
104
- >
110
+ okText={getLocale('Mod_Determiness')}
111
+ noFooterLine
112
+ onOk={handleSaveUserInfo}
113
+ disabled={isDisable}
114
+ >
105
115
  <div className={`${prefix}__form`} ref={formContainerRef}>
106
- <Form ref={formRef} getFormContainer={() => formContainerRef.current}>
107
- <Fields.Input
108
- name="name"
109
- label={'姓名'}
110
- placeholder={'请输入姓名'}
111
- type="text"
112
- require
113
- layout="row"
114
- verifies={[
115
- {
116
- tip: '姓名不能为空',
117
- test: /\S/
118
- },
119
- {
120
- tip: '姓名只能为中文,英文字母和数字及下划线的组合',
121
- test: /^((?!(\uff08|\uff09)).)*$/g
122
- },
123
- {
124
- tip: `姓名不能超过${50}个字`,
125
- test: /^[\s\S]{0,50}$/,
126
- },
127
- ]}
128
- value={userInfo.name}
129
- onChange={handleNameChange}
130
- />
131
- <Fields.Input
132
- name="phone"
133
- type="text"
134
- label={'手机号码'}
135
- placeholder={'请输入手机号'}
136
- require
137
- layout="row"
138
- value={userInfo.mobile}
139
- verifies={[
140
- {
141
- tip: '手机号不能为空',
142
- test: /^[\s\S]+$/
143
- },
144
- {
145
- tip: '格式错误,海外手机格式如:(+852)52345678',
146
- test: /^1[3456789]\d{9}$/
147
- }
148
- ]}
149
- onChange={handlePhoneChange}
150
- />
151
- <Fields.Input
152
- name="email"
153
- type="text"
154
- label={'邮箱'}
155
- value={userInfo.email}
156
- layout="row"
157
- placeholder={'请输入邮箱'}
158
- verifies={[
159
- {
160
- tip: '邮箱格式错误',
161
- test: /^([a-zA-Z0-9_-]|\.)+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
162
- }
163
- ]}
164
- onChange={handleEmailChange}
165
- />
166
- </Form>
167
- </div>
168
- </Dialog>
169
- );
116
+ <Form ref={formRef} getFormContainer={() => formContainerRef.current}>
117
+ <Fields.Input
118
+ name={"name"}
119
+ label={getLocale('Mod_UserName')}
120
+ placeholder={getLocale('Perf_Indica_Pop_text_Name')}
121
+ type="text"
122
+ require
123
+ layout="row"
124
+ verifies={[
125
+ {
126
+ tip: getLocale('OKR_MyO_Ew_Namecant'),
127
+ test: /^[\s\S]+$/,
128
+ },
129
+ {
130
+ tip: "姓名只能为中文,英文字母和数字及下划线的组合",
131
+ test: /^((?!(\uff08|\uff09)).)*$/g,
132
+ },
133
+ {
134
+ tip: i18nLimitCharacters(50),
135
+ test: /^[\s\S]{0,50}$/,
136
+ },
137
+ ]}
138
+ value={userInfo.name}
139
+ onChange={handleNameChange}
140
+ />
141
+ <Fields.Input
142
+ name="phone"
143
+ type="text"
144
+ label={"手机号码"}
145
+ placeholder={getLocale('Pro_page_Ext_Tab_PhoneNumber')}
146
+ require
147
+ layout="row"
148
+ value={userInfo.mobile}
149
+ verifies={[
150
+ {
151
+ tip: "手机号不能为空",
152
+ test: /^[\s\S]+$/,
153
+ },
154
+ {
155
+ tip: "格式错误,海外手机格式如:(+852)52345678",
156
+ test: /^1[3456789]\d{9}$/,
157
+ },
158
+ ]}
159
+ onChange={handlePhoneChange}
160
+ />
161
+ <Fields.Input
162
+ name="email"
163
+ type="text"
164
+ label={getLocale('OKR_MyO_Ew_Mail')}
165
+ value={userInfo.email}
166
+ layout="row"
167
+ placeholder={getLocale('Pro_page_Ext_Tab_Inpuyouremail')}
168
+ verifies={[
169
+ {
170
+ tip: getLocale('OKR_MyO_Ew_Emailfor'),
171
+ test: /^([a-zA-Z0-9_-]|\.)+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
172
+ },
173
+ ]}
174
+ onChange={handleEmailChange}
175
+ />
176
+ </Form>
177
+ </div>
178
+ </Dialog>
179
+ );
170
180
  };
171
181
 
172
182
  export default EditBaseInfo;
@@ -0,0 +1,8 @@
1
+ import { isEn } from "./getLocale";
2
+ export const i18nLimitCharacters = (length) => {
3
+ if (isEn) {
4
+ return `Up to ${length} characters can be entered`;
5
+ } else {
6
+ return `最多可输入${length}个字`;
7
+ }
8
+ };