@titaui/pc 1.7.60 → 1.7.61

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.
@@ -1,4 +1,5 @@
1
- $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
1
+ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica,
2
+ sans-serif, PingFang SC, Microsoft YaHei;
2
3
 
3
4
  @mixin node-title {
4
5
  display: inline-block;
@@ -49,7 +50,6 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
49
50
  }
50
51
 
51
52
  .tita-okrdt-tree {
52
-
53
53
  &__o-child-node {
54
54
  position: relative;
55
55
  width: 100%;
@@ -57,15 +57,15 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
57
57
  padding-top: 15px;
58
58
  border-bottom: 1px solid #e9ecf0;
59
59
 
60
-
61
60
  &-right {
62
61
  display: flex;
63
62
  float: right;
64
63
  }
65
-
66
- &-progress {
64
+ &-weight {
65
+ margin-right: 16px;
66
+ width: 60px;
67
67
  }
68
-
68
+
69
69
  &-h1 {
70
70
  .okr-drawer-header__classify {
71
71
  vertical-align: sub;
@@ -84,3 +84,76 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
84
84
  }
85
85
  }
86
86
  }
87
+ .child-okrs-weight {
88
+ &__content {
89
+ padding: 10px 32px 8px;
90
+ min-height: 90px;
91
+ box-sizing: border-box;
92
+ display: flex;
93
+ flex-direction: column;
94
+ justify-content: center;
95
+ }
96
+ &__item {
97
+ margin-bottom: 18px;
98
+ display: flex;
99
+ &:last-child {
100
+ margin-bottom: 0;
101
+ }
102
+
103
+ &-precls {
104
+ height: 24px;
105
+ width: 24px;
106
+ padding: 6px;
107
+ box-sizing: border-box;
108
+ background: rgba(40, 121, 255, 0.1);
109
+ border-radius: 12px;
110
+ display: inline-flex;
111
+ justify-content: center;
112
+ align-items: center;
113
+ margin-right: 8px;
114
+ cursor: pointer;
115
+ position: relative;
116
+ &:before {
117
+ content: "";
118
+ width: 10px;
119
+ height: 8px;
120
+ border-radius: 50%;
121
+ border: 2px solid #2879ff;
122
+ }
123
+ }
124
+
125
+ &-name {
126
+ width: 360px;
127
+ overflow: hidden;
128
+ text-overflow: ellipsis;
129
+ white-space: nowrap;
130
+ color: #3f4755;
131
+ margin-right: 26px;
132
+ }
133
+
134
+ &-weight {
135
+ display: flex;
136
+ flex: 1;
137
+ &-label {
138
+ color: #89919f;
139
+ margin-right: 10px;
140
+ }
141
+ &-content {
142
+ display: flex;
143
+ flex: 1;
144
+ border-bottom: 1px solid #e9ecf0;
145
+ &--error {
146
+ border-color: #f05e5e;
147
+ }
148
+ }
149
+ &-input {
150
+ flex: 1;
151
+ width: 50px;
152
+ border: none;
153
+ }
154
+ &-suffix {
155
+ color: #89919f;
156
+ }
157
+ }
158
+ }
159
+ }
@@ -0,0 +1,59 @@
1
+ import classNames from "classnames";
2
+ import React, { useState } from "react";
3
+ import Tooltip from "../../../../../tooltip";
4
+ import "./index.scss";
5
+
6
+ const precls = "child-okrs-weight";
7
+ interface IProps {
8
+ value: number;
9
+ onChange: Function;
10
+ workId: number;
11
+ }
12
+
13
+ const WeightInput = (props: IProps) => {
14
+ const { value, onChange, workId } = props;
15
+ const [isError, setIsError] = useState(false);
16
+
17
+ const onChangeHandler = (e) => {
18
+ const currentValue = e.currentTarget.value;
19
+ setIsError(!/^(\d{1,2}(\.\d{1})?|100)$/g.test(currentValue));
20
+ onChange({ workId, value: currentValue, isError });
21
+ };
22
+
23
+ const onBlurHandler = (e) => {
24
+ const currentValue = e.currentTarget.value;
25
+ if (currentValue == "") {
26
+ onChange({ workId, value: 0, isError: false });
27
+ setIsError(false);
28
+ }
29
+ };
30
+
31
+ return (
32
+ <div
33
+ className={classNames(`${precls}__item-weight-content`, {
34
+ [`${precls}__item-weight-content--error`]: isError,
35
+ })}
36
+ >
37
+ <Tooltip.Error
38
+ overlay={
39
+ <span style={{ color: "#F05E5E" }}>
40
+ 仅允许输入 0-100 的数字,仅支持一位小数
41
+ </span>
42
+ }
43
+ placement="top"
44
+ visible={isError}
45
+ >
46
+ <input
47
+ className={`${precls}__item-weight-input`}
48
+ type="number"
49
+ value={value}
50
+ onChange={onChangeHandler}
51
+ onBlur={onBlurHandler}
52
+ />
53
+ </Tooltip.Error>
54
+ <span className={`${precls}__item-weight-suffix`}>%</span>
55
+ </div>
56
+ );
57
+ };
58
+
59
+ export default WeightInput;
@@ -130,10 +130,9 @@ export const getFeedById = (feedId, commentCount) => {
130
130
  );
131
131
  };
132
132
 
133
- export const updateParentId = async function(params) {
133
+ export const updateParentId = async function (params) {
134
134
  return rpost("v1")(
135
- `okr/updateParentId?okrId=${params.okrId}&parentId=${
136
- params.parentId
135
+ `okr/updateParentId?okrId=${params.okrId}&parentId=${params.parentId
137
136
  }&parentType=${params.parentId != 0 ? params.parentType : 0}`
138
137
  );
139
138
  };
@@ -405,3 +404,12 @@ export const getRelProgress = (workId: number) => {
405
404
  export const getRelWorks = (okrId: number) => {
406
405
  return rget("v1")(`okr/detail/relWorks?okrId=${okrId}`);
407
406
  };
407
+
408
+ export const updateChildOkrWeight = (data: { OkrId: number, Weight: number }[]) => {
409
+ return rpost('v1')('okr/weight/save', {
410
+ OkrWeights: [...data]
411
+ }, {
412
+ // "headers": { "Content-Type": "application/x-www-form-urlencoded" },
413
+ "transformRequest": qs.stringify,
414
+ })
415
+ }
@@ -8,7 +8,7 @@ import UploadedPreview from './components/uploadedPreview';
8
8
  import { UploadResultObj, UploadFilesObj, _dealAttachmentType } from './type';
9
9
  import { UploadFormContainer } from './style';
10
10
  import ImgViewer from '../img-viewer';
11
- import { getPreviewImgs } from './util';
11
+ import { getPreviewImgs, isImg } from './util';
12
12
 
13
13
  interface Props {
14
14
  action?: string;
@@ -275,6 +275,17 @@ export default class Upload extends PureComponent<Props, State> {
275
275
  });
276
276
  };
277
277
 
278
+ getImgIndex = (index) => {
279
+ let newIndex = 0;
280
+ const { uploadSuccessFiles } = this.state;
281
+ for (let i = 0; i < index; i++) {
282
+ if (isImg(uploadSuccessFiles[i].FileType)) {
283
+ newIndex++;
284
+ }
285
+ }
286
+ return newIndex;
287
+ }
288
+
278
289
  // 预览、删除附件
279
290
  handlerUploadPreviewOptions = (index: number, options: string) => {
280
291
  const { onSubmit, onDelete } = this.props;
@@ -297,7 +308,8 @@ export default class Upload extends PureComponent<Props, State> {
297
308
  uploadSuccessFiles: uploadResultFiles,
298
309
  });
299
310
  } else if (options === 'preview') {
300
- (this.refs.imgViewerRef as any).show(index);
311
+ const imgIndex = this.getImgIndex(index);
312
+ (this.refs.imgViewerRef as any).show(imgIndex);
301
313
  } else if (options === 'reupload') {
302
314
  const reUploadFileInfo = this.state.uploadSuccessFiles[index];
303
315
  const reUploadFile = this.state.selectFiles[reUploadFileInfo.FileName];
package/src/utils/auth.js CHANGED
@@ -137,3 +137,24 @@ export const DynamicManagerAuth = class extends BaseAuth {
137
137
  return !this.isBoss() && !this.isManager() && !this.isDynamicManager && this.isLeader;
138
138
  }
139
139
  };
140
+
141
+ export const ChildAuth = class extends BaseAuth {
142
+ constructor(props) {
143
+ super(props);
144
+ let { principalUser } = props;
145
+ this.userId = this.loginUserInfor.Id;
146
+ this.principalUser = principalUser;
147
+ }
148
+
149
+ isPrincipalUser() {
150
+ return this.userId == this.principalUser.userId;
151
+ }
152
+
153
+ // 超管、助理、目标管理员以及目标负责人可以修改此目标下对齐子目标的权重;
154
+ hasAuth() {
155
+ return (
156
+ this.isManager() ||
157
+ this.isPrincipalUser()
158
+ )
159
+ }
160
+ }