htui-yllkbz 1.5.39 → 1.5.41

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.
@@ -418,4 +418,49 @@ export const getAllBaseData = () => {
418
418
 
419
419
  return baseDataItem
420
420
  }
421
+ export function getCurrentTime() {
422
+ const date = moment().format("YYYY-MM-DD HH:mm:ss")
423
+ return date
424
+ //
425
+ }
426
+ export function getCurrentDate() {
427
+ const date = moment().format("YYYY-MM-DD")
428
+ return date
429
+ //
430
+ }
431
+ /** 获取当前用户
432
+ * @isObj 是否返回整个对象
433
+ */
434
+ export function getCurrentUser(isObj = false): { id?: string; signature?: string; name?: string } {
435
+ let userInfo: any = window.localStorage.getItem("userInfo");
436
+ if (userInfo) {
437
+ userInfo = JSON.parse(userInfo);
438
+ if (isObj) {
439
+ return userInfo
440
+ }
441
+ const name = userInfo.surname + userInfo.name
442
+ return {
443
+ id: userInfo.id,
444
+ signature: userInfo.signature || name,
445
+ name: name
446
+ }
447
+ }
448
+
449
+ return {
450
+ id: undefined,
451
+ signature: undefined,
452
+ name: ''
453
+ }
454
+ }
455
+ /** 获取当前部门 */
456
+ export function getCurrentOrg() {
457
+ let userOrg: any = window.localStorage.getItem("userInOrganiza");
458
+ if (userOrg) {
459
+ userOrg = JSON.parse(userOrg);
460
+ return userOrg.length ? userOrg[0] : { id: undefined }
461
+ }
462
+ return {
463
+ id: undefined
464
+ }
465
+ }
421
466