@titaui/pc 1.12.3 → 1.12.4-beta.1

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.
@@ -156,8 +156,7 @@ function DropSelector(props) {
156
156
  }
157
157
 
158
158
  var handlePopVisibleChange = (0, _react.useCallback)(function (visible) {
159
- console.log('visible' in props);
160
-
159
+ // console.log('visible' in props)
161
160
  if (!('visible' in props)) {
162
161
  setVisible(visible);
163
162
  }
@@ -41,10 +41,11 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
41
41
 
42
42
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
43
43
 
44
- var hasProject = (0, _bsGlobal.hasWebHead)("project");
44
+ var hasProject = (0, _bsGlobal.hasWebHead)('project');
45
+ var baseAuth = new _auth.BaseAuth();
45
46
 
46
47
  var EKrNode = function EKrNode(props) {
47
- var _okrInfo$authority;
48
+ var _window, _window$BSGlobal, _window$BSGlobal$Work, _window$BSGlobal$Work2, _okrInfo$authority;
48
49
 
49
50
  var index = props.index,
50
51
  title = props.title,
@@ -60,6 +61,9 @@ var EKrNode = function EKrNode(props) {
60
61
  var _useContext2 = (0, _react.useContext)(_context2.EListContext),
61
62
  refreshEList = _useContext2.refreshEList;
62
63
 
64
+ var onlySuperCreateWork = (_window = window) === null || _window === void 0 ? void 0 : (_window$BSGlobal = _window.BSGlobal) === null || _window$BSGlobal === void 0 ? void 0 : (_window$BSGlobal$Work = _window$BSGlobal.WorkAdvancedSetting) === null || _window$BSGlobal$Work === void 0 ? void 0 : (_window$BSGlobal$Work2 = _window$BSGlobal$Work.WorkFunctionSetting) === null || _window$BSGlobal$Work2 === void 0 ? void 0 : _window$BSGlobal$Work2.WorkCreate; //开启后,仅超管、目标管理员、老板/助理可创建项目
65
+
66
+ var canCreateWork = baseAuth.isBoss() || baseAuth.isManager() || baseAuth.isWorkManager() || baseAuth.isAssistant() || !onlySuperCreateWork;
63
67
  var isParticipant = ((_okrInfo$authority = okrInfo.authority) === null || _okrInfo$authority === void 0 ? void 0 : _okrInfo$authority.roleRelation) && okrInfo.authority.roleRelation.roleType === 2;
64
68
  var hasRelativeAuth;
65
69
 
@@ -85,7 +89,7 @@ var EKrNode = function EKrNode(props) {
85
89
  while (1) {
86
90
  switch (_context.prev = _context.next) {
87
91
  case 0:
88
- if (name === "addTask") {
92
+ if (name === 'addTask') {
89
93
  params = {
90
94
  objId: data.workId,
91
95
  objType: 4,
@@ -105,7 +109,7 @@ var EKrNode = function EKrNode(props) {
105
109
  allowObjectOptions: false
106
110
  }
107
111
  }).then(function () {
108
- _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
112
+ _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
109
113
  canClose: false
110
114
  });
111
115
 
@@ -116,7 +120,7 @@ var EKrNode = function EKrNode(props) {
116
120
  okrId: data.workId,
117
121
  krId: data.mileStoneId
118
122
  }).then(function () {
119
- _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
123
+ _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
120
124
  canClose: false
121
125
  });
122
126
 
@@ -137,12 +141,12 @@ var EKrNode = function EKrNode(props) {
137
141
  };
138
142
  }(), []);
139
143
  var openRelatePop = (0, _react.useCallback)(function (name) {
140
- if (name === "relateTask") {
144
+ if (name === 'relateTask') {
141
145
  window.openRelateTaskPop(btnRef.current, {
142
146
  okrId: data.workId,
143
147
  krId: data.mileStoneId
144
148
  }).then(function () {
145
- _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
149
+ _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
146
150
  canClose: false
147
151
  });
148
152
 
@@ -157,7 +161,7 @@ var EKrNode = function EKrNode(props) {
157
161
  okrId: data.workId,
158
162
  krId: data.mileStoneId
159
163
  }).then(function () {
160
- _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
164
+ _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
161
165
  canClose: false
162
166
  });
163
167
 
@@ -180,7 +184,7 @@ var EKrNode = function EKrNode(props) {
180
184
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-kr-node-title")),
181
185
  onClick: function onClick() {
182
186
  if (data.mileStoneId) {
183
- _drawerManager["default"].open("krDetail", {
187
+ _drawerManager["default"].open('krDetail', {
184
188
  krId: data.mileStoneId
185
189
  });
186
190
  }
@@ -199,32 +203,32 @@ var EKrNode = function EKrNode(props) {
199
203
  ref: btnRef
200
204
  }, /*#__PURE__*/_react["default"].createElement("span", {
201
205
  className: "tu-icon-add1"
202
- }), (0, _getLocale.getLocale)("OKR_MyO_E_Butt_Newlybuild"))
206
+ }), (0, _getLocale.getLocale)('OKR_MyO_E_Butt_Newlybuild'))
203
207
  }, /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
204
208
  icon: "tu-icon-Add-renwu",
205
209
  exIconClass: "e-kr-node-layer-icon",
206
210
  name: "addTask"
207
- }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_E_Butt_Addtask"))), hasProject ? /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
211
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)('OKR_MyO_E_Butt_Addtask'))), hasProject && canCreateWork ? /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
208
212
  icon: "tu-icon-Add-xiangmu",
209
213
  exIconClass: "e-kr-node-layer-icon",
210
214
  name: "addProject"
211
- }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_E_Butt_Addproject"))) : /*#__PURE__*/_react["default"].createElement("span", null)), hasRelation && /*#__PURE__*/_react["default"].createElement(_dropSelector["default"], {
215
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)('OKR_MyO_E_Butt_Addproject'))) : /*#__PURE__*/_react["default"].createElement("span", null)), hasRelation && /*#__PURE__*/_react["default"].createElement(_dropSelector["default"], {
212
216
  popupPlacement: "bottomRight",
213
217
  onChange: openRelatePop,
214
218
  trigger: /*#__PURE__*/_react["default"].createElement("span", {
215
219
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-kr-node-actions-connect"))
216
220
  }, /*#__PURE__*/_react["default"].createElement("span", {
217
221
  className: "tu-icon-guanlian e-kr-node__guanlian-icon"
218
- }), (0, _getLocale.getLocale)("Mod_Associate"))
222
+ }), (0, _getLocale.getLocale)('Mod_Associate'))
219
223
  }, /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
220
224
  icon: "tu-icon-GL-renwu",
221
225
  exIconClass: "e-kr-node-layer-icon",
222
226
  name: "relateTask"
223
- }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_E_Butt_Assotask"))), hasProject ? /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
227
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)('OKR_MyO_E_Butt_Assotask'))), hasProject ? /*#__PURE__*/_react["default"].createElement(_dropSelector.IconItem, {
224
228
  icon: "tu-icon-GL-xiangmu",
225
229
  exIconClass: "e-kr-node-layer-icon",
226
230
  name: "relateProject"
227
- }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_E_Butt_AssProjects"))) : /*#__PURE__*/_react["default"].createElement("span", null))) : null);
231
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)('OKR_MyO_E_Butt_AssProjects'))) : /*#__PURE__*/_react["default"].createElement("span", null))) : null);
228
232
  };
229
233
 
230
234
  var _default = EKrNode;
@@ -212,7 +212,7 @@ var UploadedPreview = /*#__PURE__*/function (_PureComponent) {
212
212
  }, /*#__PURE__*/_react["default"].createElement(_style.PreviewFileTitle, {
213
213
  "data-tip": uploadResultItem.FileName,
214
214
  key: uploadResultItem.uid
215
- }, uploadResultItem.FileName, (uploadResultItem.uploadStatus === 2 || uploadResultItem.uploadStatus === 3) && uploadResultItem.percentComplete !== 100 ? /*#__PURE__*/_react["default"].createElement(_style.UploadProgress, null, /*#__PURE__*/_react["default"].createElement("div", {
215
+ }, uploadResultItem.FileName, uploadResultItem.uploadStatus === 2 ? /*#__PURE__*/_react["default"].createElement(_style.UploadProgress, null, /*#__PURE__*/_react["default"].createElement("div", {
216
216
  style: {
217
217
  width: "".concat(uploadResultItem.percentComplete, "%")
218
218
  },
@@ -221,12 +221,32 @@ var Upload = /*#__PURE__*/function (_PureComponent) {
221
221
  return;
222
222
  }
223
223
 
224
- var xhr = uploadStartFile.requestXHR;
224
+ var xhr = uploadStartFile.requestXHR; // xhr.onreadystatechange = () => {
225
+ // if (xhr.readyState == 4 && xhr.status == 200) {
226
+ // const result = { ...JSON.parse(xhr.responseText).Result[0] }; // 上传成功接口返回数据
227
+ // result.percentComplete = 100;
228
+ // result.IsSuccess = !!result.IsSuccess;
229
+ // result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
230
+ // this._dealUploadSuccess({ ...uploadStartFile, ...result });
231
+ // }
232
+ // };
233
+ // // 进度条部分
234
+ // xhr.upload.onprogress = (evt) => {
235
+ // const uploadSuccessFiles = [...this.state.uploadSuccessFiles];
236
+ // if (evt.lengthComputable) {
237
+ // uploadSuccessFiles.forEach((item: UploadResultObj) => {
238
+ // if (this.isSameFile(item, uploadStartFile)) {
239
+ // item.uploadStatus = 2; // 上传中
240
+ // item.percentComplete = Math.round((evt.loaded * 100) / evt.total);
241
+ // }
242
+ // });
243
+ // this.setState({ uploadSuccessFiles });
244
+ // }
245
+ // };
225
246
 
226
247
  xhr.onreadystatechange = function () {
227
248
  if (xhr.readyState == 4 && xhr.status == 200) {
228
- var result = _objectSpread({}, JSON.parse(xhr.responseText).Result[0]); // 上传成功接口返回数据
229
-
249
+ var result = Object.assign({}, _objectSpread({}, JSON.parse(xhr.responseText).Result[0])); // 上传成功接口返回数据
230
250
 
231
251
  result.percentComplete = 100;
232
252
  result.IsSuccess = !!result.IsSuccess;
@@ -234,11 +254,11 @@ var Upload = /*#__PURE__*/function (_PureComponent) {
234
254
 
235
255
  _this._dealUploadSuccess(_objectSpread(_objectSpread({}, uploadStartFile), result));
236
256
  }
237
- }; // 进度条部分
257
+ }; //进度条部分
238
258
 
239
259
 
240
260
  xhr.upload.onprogress = function (evt) {
241
- var uploadSuccessFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
261
+ var uploadSuccessFiles = JSON.parse(JSON.stringify(_this.state.uploadSuccessFiles));
242
262
 
243
263
  if (evt.lengthComputable) {
244
264
  uploadSuccessFiles.forEach(function (item) {
@@ -331,12 +351,20 @@ var Upload = /*#__PURE__*/function (_PureComponent) {
331
351
  });
332
352
  };
333
353
 
354
+ _this.isImg = function (fileType) {
355
+ if (/^(jpg|png|gif|jpeg|image|JPG|PNG|GIF|JPEG)$/.test(fileType)) {
356
+ return true;
357
+ }
358
+
359
+ return false;
360
+ };
361
+
334
362
  _this.getImgIndex = function (index) {
335
363
  var newIndex = 0;
336
364
  var uploadSuccessFiles = _this.state.uploadSuccessFiles;
337
365
 
338
366
  for (var i = 0; i < index; i++) {
339
- if (isImg(uploadSuccessFiles[i].FileType)) {
367
+ if (_this.isImg(uploadSuccessFiles[i].FileType)) {
340
368
  newIndex++;
341
369
  }
342
370
  }
package/lib/utils/auth.js CHANGED
@@ -49,6 +49,18 @@ var BaseAuth = /*#__PURE__*/function () {
49
49
  value: function isManager() {
50
50
  // console.log('ismanager', this.loginUserInfor.IsOkrManager)
51
51
  return this.loginUserInfor.IsOkrManager;
52
+ } // 助理或者说动态管理员
53
+
54
+ }, {
55
+ key: "isAssistant",
56
+ value: function isAssistant() {
57
+ return this.loginUserInfor.Role === 1;
58
+ } // 项目管理员
59
+
60
+ }, {
61
+ key: "isWorkManager",
62
+ value: function isWorkManager() {
63
+ return this.loginUserInfor.IsWorkManager;
52
64
  }
53
65
  }, {
54
66
  key: "isDepartmentLeader",
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cycleType = void 0;
7
+ // annualNum: "2022" 年份
8
+ // cycleType: "-1" 全部周期
9
+ // endDate: ""
10
+ // startDate: ""
11
+ // yqmNum: "0"
12
+ // annualNum: "2022"
13
+ // cycleType: "5" 上半年
14
+ // endDate: "2022/09/30"
15
+ // startDate: "2022/04/01"
16
+ // yqmNum: "1"
17
+ var cycleType = {
18
+ '-1': '全部周期',
19
+ '1': '年度',
20
+ "2": "季度",
21
+ "4": "双月",
22
+ "5": "半年度"
23
+ };
24
+ exports.cycleType = cycleType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.12.3",
3
+ "version": "1.12.4-beta.1",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -144,7 +144,7 @@
144
144
  "react-transition-group": "4.4.2",
145
145
  "resize-observer-polyfill": "1.5.1",
146
146
  "slick-carousel": "1.8.1",
147
- "tita-ui": "1.2.52",
147
+ "tita-ui": "1.2.56",
148
148
  "url-parse": "1.5.1",
149
149
  "uuid": "3.1.0",
150
150
  "viewerjs": "1.10.1",