ng-yunzai-mobile
Version:
1. 修改wechat.micro.ts
1,681 lines (1,667 loc) • 451 kB
JavaScript
import { __spread, __assign, __awaiter, __generator, __extends } from 'tslib';
import { NgModule, InjectionToken, Injectable, Inject, ɵɵdefineInjectable, ɵɵinject, inject, Directive, ViewContainerRef, TemplateRef, Input, Component, CUSTOM_ELEMENTS_SCHEMA, EventEmitter, Output, Injector, INJECTOR, APP_INITIALIZER } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule, ActivatedRoute, Router } from '@angular/router';
import { NgZorroAntdMobileModule, ModalService, ToastService } from 'ng-zorro-antd-mobile';
import { MatDialogModule } from '@angular/material';
import { PinchZoomModule } from 'ngx-pinch-zoom';
import { ImageCropperModule } from 'ngx-image-cropper';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { BehaviorSubject, from, of, throwError } from 'rxjs';
import { share, map, mergeMap, catchError } from 'rxjs/operators';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { HttpClient, HttpResponseBase, HttpErrorResponse } from '@angular/common/http';
import { DomSanitizer, Title } from '@angular/platform-browser';
import imageCompression from 'browser-image-compression';
/**
* @fileoverview added by tsickle
* Generated from: shared.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var SharedModule = /** @class */ (function () {
function SharedModule() {
}
SharedModule.decorators = [
{ type: NgModule, args: [{
imports: [
CommonModule,
RouterModule,
FormsModule,
NgZorroAntdMobileModule,
MatDialogModule,
PinchZoomModule,
ImageCropperModule,
DragDropModule
],
exports: [
CommonModule,
RouterModule,
FormsModule,
NgZorroAntdMobileModule,
MatDialogModule,
PinchZoomModule,
ImageCropperModule,
DragDropModule
]
},] }
];
return SharedModule;
}());
/**
* @fileoverview added by tsickle
* Generated from: user/user.store.interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var DA_STORE_USER = new InjectionToken('AUTH_STORE_USER');
/**
* @record
*/
function UserStore() { }
if (false) {
/**
* @param {?} key
* @return {?}
*/
UserStore.prototype.get = function (key) { };
/**
* @param {?} key
* @param {?} value
* @return {?}
*/
UserStore.prototype.set = function (key, value) { };
/**
* @param {?} key
* @return {?}
*/
UserStore.prototype.remove = function (key) { };
}
/**
* @fileoverview added by tsickle
* Generated from: client/base.client.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var BASE_CLIENT = new InjectionToken('BASE_CLIENT');
/**
* @record
*/
function BaseClient() { }
if (false) {
/** @type {?|undefined} */
BaseClient.prototype.gateway;
/** @type {?|undefined} */
BaseClient.prototype.ignores;
/** @type {?|undefined} */
BaseClient.prototype.dev;
/** @type {?|undefined} */
BaseClient.prototype.wechat;
/** @type {?|undefined} */
BaseClient.prototype.wechatMicro;
/** @type {?|undefined} */
BaseClient.prototype.android;
/** @type {?|undefined} */
BaseClient.prototype.browser;
/** @type {?|undefined} */
BaseClient.prototype.ios;
/** @type {?|undefined} */
BaseClient.prototype.yunzaiIm;
/** @type {?|undefined} */
BaseClient.prototype.dingtalk;
/** @type {?|undefined} */
BaseClient.prototype.openDev;
/** @type {?|undefined} */
BaseClient.prototype.alwaysBrowser;
/** @type {?} */
BaseClient.prototype.mobileVersion;
}
/**
* @fileoverview added by tsickle
* Generated from: token/istore.interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var DA_STORE_TOKEN = new InjectionToken('AUTH_STORE_TOKEN');
/**
* @record
*/
function IStore() { }
if (false) {
/**
* @param {?} key
* @return {?}
*/
IStore.prototype.get = function (key) { };
/**
* @param {?} key
* @param {?} value
* @return {?}
*/
IStore.prototype.set = function (key, value) { };
/**
* @param {?} key
* @return {?}
*/
IStore.prototype.remove = function (key) { };
}
/**
* @fileoverview added by tsickle
* Generated from: token/token.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var STORE_KEY = 'token';
var TokenService = /** @class */ (function () {
function TokenService(store) {
this.store = store;
this.change$ = new BehaviorSubject(null);
}
/**
* @param {?} data
* @return {?}
*/
TokenService.prototype.set = /**
* @param {?} data
* @return {?}
*/
function (data) {
this.change$.next(data);
return this.store.set(STORE_KEY, data);
};
/**
* @template T
* @param {?=} type
* @return {?}
*/
TokenService.prototype.get = /**
* @template T
* @param {?=} type
* @return {?}
*/
function (type) {
/** @type {?} */
var data = this.store.get(STORE_KEY);
return type ? ((/** @type {?} */ (Object.assign(new type(), data)))) : ((/** @type {?} */ (data)));
};
/**
* @return {?}
*/
TokenService.prototype.clear = /**
* @return {?}
*/
function () {
this.change$.next(null);
this.store.remove(STORE_KEY);
};
/**
* @return {?}
*/
TokenService.prototype.change = /**
* @return {?}
*/
function () {
return this.change$.pipe(share());
};
TokenService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
TokenService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [DA_STORE_TOKEN,] }] }
]; };
/** @nocollapse */ TokenService.ngInjectableDef = ɵɵdefineInjectable({ factory: function TokenService_Factory() { return new TokenService(ɵɵinject(DA_STORE_TOKEN)); }, token: TokenService, providedIn: "root" });
return TokenService;
}());
if (false) {
/**
* @type {?}
* @private
*/
TokenService.prototype.change$;
/**
* @type {?}
* @private
*/
TokenService.prototype.store;
}
/**
* @fileoverview added by tsickle
* Generated from: token/token.interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var DA_SERVICE_TOKEN = new InjectionToken('DA_SERVICE_TOKEN', {
providedIn: 'root',
factory: DA_SERVICE_TOKEN_FACTORY,
});
/**
* @return {?}
*/
function DA_SERVICE_TOKEN_FACTORY() {
return new TokenService(inject(DA_STORE_TOKEN));
}
/**
* @record
*/
function ITokenService() { }
if (false) {
/**
* @param {?} data
* @return {?}
*/
ITokenService.prototype.set = function (data) { };
/**
* @param {?=} type
* @return {?}
*/
ITokenService.prototype.get = function (type) { };
/**
* @template T
* @param {?=} type
* @return {?}
*/
ITokenService.prototype.get = function (type) { };
/**
* @return {?}
*/
ITokenService.prototype.clear = function () { };
/**
* @return {?}
*/
ITokenService.prototype.change = function () { };
}
/**
* @fileoverview added by tsickle
* Generated from: user/user.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var STORE_KEY$1 = 'user';
var UserService = /** @class */ (function () {
function UserService(store, client, tokenService) {
this.store = store;
this.client = client;
this.tokenService = tokenService;
this.change$ = new BehaviorSubject(null);
}
/**
* @param {?} data
* @return {?}
*/
UserService.prototype.set = /**
* @param {?} data
* @return {?}
*/
function (data) {
this.change$.next(data);
return this.store.set(STORE_KEY$1, data);
};
/**
* @template T
* @param {?=} type
* @return {?}
*/
UserService.prototype.get = /**
* @template T
* @param {?=} type
* @return {?}
*/
function (type) {
/** @type {?} */
var data = this.store.get(STORE_KEY$1);
return type ? ((/** @type {?} */ (Object.assign(new type(), data)))) : ((/** @type {?} */ (data)));
};
/**
* @return {?}
*/
UserService.prototype.clear = /**
* @return {?}
*/
function () {
this.change$.next(null);
this.store.remove(STORE_KEY$1);
};
/**
* @return {?}
*/
UserService.prototype.change = /**
* @return {?}
*/
function () {
return this.change$.pipe(share());
};
/**
* @return {?}
*/
UserService.prototype.logout = /**
* @return {?}
*/
function () {
this.tokenService.set(null);
this.tokenService.clear();
window.location.href = this.client.gateway + "/cas-proxy/app/logout";
};
/**
* @return {?}
*/
UserService.prototype.getConfig = /**
* @return {?}
*/
function () {
if (this.get().menu) {
return JSON.parse(this.get().menu[0].attribute);
}
else {
return null;
}
};
/**
* @return {?}
*/
UserService.prototype.getMenus = /**
* @return {?}
*/
function () {
return this.get().menu || [];
};
/**
* @param {?} menus
* @param {?} systemCode
* @return {?}
*/
UserService.prototype.findMenuBySystemCode = /**
* @param {?} menus
* @param {?} systemCode
* @return {?}
*/
function (menus, systemCode) {
/** @type {?} */
var targetMenu = menus.find((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.systemCode === systemCode; }));
if (targetMenu != null) {
return targetMenu;
}
for (var i = 0; i < menus.length; i++) {
/** @type {?} */
var menu = menus[i];
/** @type {?} */
var targetSubMenu = this.findMenuBySystemCode(menu.children || [], systemCode);
if (targetSubMenu != null) {
return targetSubMenu;
}
}
return null;
};
UserService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
UserService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [DA_STORE_USER,] }] },
{ type: undefined, decorators: [{ type: Inject, args: [BASE_CLIENT,] }] },
{ type: TokenService, decorators: [{ type: Inject, args: [DA_SERVICE_TOKEN,] }] }
]; };
/** @nocollapse */ UserService.ngInjectableDef = ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(ɵɵinject(DA_STORE_USER), ɵɵinject(BASE_CLIENT), ɵɵinject(DA_SERVICE_TOKEN)); }, token: UserService, providedIn: "root" });
return UserService;
}());
if (false) {
/**
* @type {?}
* @private
*/
UserService.prototype.change$;
/**
* @type {?}
* @private
*/
UserService.prototype.store;
/**
* @type {?}
* @private
*/
UserService.prototype.client;
/**
* @type {?}
* @private
*/
UserService.prototype.tokenService;
}
/**
* @fileoverview added by tsickle
* Generated from: acl/acl.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var AclDirective = /** @class */ (function () {
function AclDirective(user, viewContainer, templateRef) {
this.user = user;
this.viewContainer = viewContainer;
this.templateRef = templateRef;
}
Object.defineProperty(AclDirective.prototype, "condition", {
set: /**
* @param {?} acl
* @return {?}
*/
function (acl) {
// 系统代码
/** @type {?} */
var systemCode = acl[0];
// 路由
/** @type {?} */
var elementRoute = acl[1];
// 元素key
/** @type {?} */
var elementKey = acl[2];
/** @type {?} */
var tempArray = [];
// tslint:disable-next-line: prefer-const
/** @type {?} */
var hasElement = false;
// 过滤菜单通过 系统代码 路由
this.filterMenuByAcl(this.filterSystemSider(systemCode), tempArray, elementRoute);
tempArray.forEach((/**
* @param {?} menu
* @return {?}
*/
function (menu) {
if (menu.menuAuths.includes(elementKey)) {
hasElement = true;
}
}));
if (hasElement) {
this.viewContainer.createEmbeddedView(this.templateRef);
}
else {
this.viewContainer.clear();
}
},
enumerable: true,
configurable: true
});
/**
* @param {?} systemcode
* @return {?}
*/
AclDirective.prototype.filterSystemSider = /**
* @param {?} systemcode
* @return {?}
*/
function (systemcode) {
return this.user.get().menu.filter((/**
* @param {?} menu
* @return {?}
*/
function (menu) {
return menu.systemCode === systemcode;
}));
};
/**
* @param {?} menus
* @param {?} tempArray
* @param {?} elementRoute
* @return {?}
*/
AclDirective.prototype.filterMenuByAcl = /**
* @param {?} menus
* @param {?} tempArray
* @param {?} elementRoute
* @return {?}
*/
function (menus, tempArray, elementRoute) {
var _this = this;
menus.forEach((/**
* @param {?} menu
* @return {?}
*/
function (menu) {
if (menu.children.length > 0) {
_this.filterMenuByAcl(menu.children, tempArray, elementRoute);
}
else {
if (menu.link === elementRoute) {
tempArray.push(menu);
}
}
}));
};
AclDirective.decorators = [
{ type: Directive, args: [{
// tslint:disable-next-line: directive-selector
selector: '[acl]'
},] }
];
/** @nocollapse */
AclDirective.ctorParameters = function () { return [
{ type: UserService },
{ type: ViewContainerRef },
{ type: TemplateRef }
]; };
AclDirective.propDecorators = {
condition: [{ type: Input, args: ['acl',] }]
};
return AclDirective;
}());
if (false) {
/**
* @type {?}
* @private
*/
AclDirective.prototype.user;
/**
* @type {?}
* @private
*/
AclDirective.prototype.viewContainer;
/**
* @type {?}
* @private
*/
AclDirective.prototype.templateRef;
}
/**
* @fileoverview added by tsickle
* Generated from: acl/acl.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var COMPONENTS = [
AclDirective,
];
var AclModule = /** @class */ (function () {
function AclModule() {
}
AclModule.decorators = [
{ type: NgModule, args: [{
declarations: __spread(COMPONENTS),
imports: [
SharedModule
],
exports: __spread(COMPONENTS)
},] }
];
return AclModule;
}());
/**
* @fileoverview added by tsickle
* Generated from: token/memory.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var MemoryStore = /** @class */ (function () {
function MemoryStore() {
this.cache = {};
}
/**
* @param {?} key
* @return {?}
*/
MemoryStore.prototype.get = /**
* @param {?} key
* @return {?}
*/
function (key) {
return this.cache[key] || (/** @type {?} */ ({}));
};
/**
* @param {?} key
* @param {?} value
* @return {?}
*/
MemoryStore.prototype.set = /**
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) {
this.cache[key] = value;
return true;
};
/**
* @param {?} key
* @return {?}
*/
MemoryStore.prototype.remove = /**
* @param {?} key
* @return {?}
*/
function (key) {
this.cache[key] = null;
};
return MemoryStore;
}());
if (false) {
/**
* @type {?}
* @private
*/
MemoryStore.prototype.cache;
}
/**
* @fileoverview added by tsickle
* Generated from: user/user.memory.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var MemoryUserStore = /** @class */ (function () {
function MemoryUserStore() {
this.cache = {};
}
/**
* @param {?} key
* @return {?}
*/
MemoryUserStore.prototype.get = /**
* @param {?} key
* @return {?}
*/
function (key) {
return this.cache[key] || (/** @type {?} */ ({}));
};
/**
* @param {?} key
* @param {?} value
* @return {?}
*/
MemoryUserStore.prototype.set = /**
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) {
this.cache[key] = value;
return true;
};
/**
* @param {?} key
* @return {?}
*/
MemoryUserStore.prototype.remove = /**
* @param {?} key
* @return {?}
*/
function (key) {
this.cache[key] = null;
};
return MemoryUserStore;
}());
if (false) {
/**
* @type {?}
* @private
*/
MemoryUserStore.prototype.cache;
}
/**
* @fileoverview added by tsickle
* Generated from: select-contacts/yz-select-contacts/dept.interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function DeptInterface() { }
if (false) {
/** @type {?|undefined} */
DeptInterface.prototype.title;
/** @type {?|undefined} */
DeptInterface.prototype.key;
/** @type {?|undefined} */
DeptInterface.prototype.value;
/** @type {?|undefined} */
DeptInterface.prototype.icon;
/** @type {?|undefined} */
DeptInterface.prototype.selected;
/** @type {?|undefined} */
DeptInterface.prototype.expanded;
/** @type {?|undefined} */
DeptInterface.prototype.children;
}
/**
* @record
*/
function BaseUserInterface() { }
if (false) {
/** @type {?|undefined} */
BaseUserInterface.prototype.checked;
/** @type {?|undefined} */
BaseUserInterface.prototype.disabled;
/** @type {?|undefined} */
BaseUserInterface.prototype.userId;
/** @type {?|undefined} */
BaseUserInterface.prototype.account;
/** @type {?|undefined} */
BaseUserInterface.prototype.password;
/** @type {?|undefined} */
BaseUserInterface.prototype.realName;
/** @type {?|undefined} */
BaseUserInterface.prototype.header;
/** @type {?|undefined} */
BaseUserInterface.prototype.userType;
/** @type {?|undefined} */
BaseUserInterface.prototype.userCode;
/** @type {?|undefined} */
BaseUserInterface.prototype.sex;
/** @type {?|undefined} */
BaseUserInterface.prototype.email;
/** @type {?|undefined} */
BaseUserInterface.prototype.mobile;
/** @type {?|undefined} */
BaseUserInterface.prototype.officePhone;
/** @type {?|undefined} */
BaseUserInterface.prototype.readNumber;
/** @type {?|undefined} */
BaseUserInterface.prototype.status;
/** @type {?|undefined} */
BaseUserInterface.prototype.displayIndex;
/** @type {?|undefined} */
BaseUserInterface.prototype.idCard;
/** @type {?|undefined} */
BaseUserInterface.prototype.lastDate;
/** @type {?|undefined} */
BaseUserInterface.prototype.operUser;
/** @type {?|undefined} */
BaseUserInterface.prototype.twoPassword;
/** @type {?|undefined} */
BaseUserInterface.prototype.lastLoginTime;
/** @type {?|undefined} */
BaseUserInterface.prototype.remark;
/** @type {?|undefined} */
BaseUserInterface.prototype.errorCount;
/** @type {?|undefined} */
BaseUserInterface.prototype.question;
/** @type {?|undefined} */
BaseUserInterface.prototype.answer;
/** @type {?|undefined} */
BaseUserInterface.prototype.theme;
/** @type {?|undefined} */
BaseUserInterface.prototype.roles;
/** @type {?|undefined} */
BaseUserInterface.prototype.roleIdList;
/** @type {?} */
BaseUserInterface.prototype.rolesData;
/** @type {?|undefined} */
BaseUserInterface.prototype.dept;
/** @type {?|undefined} */
BaseUserInterface.prototype.deptId;
/** @type {?|undefined} */
BaseUserInterface.prototype.isDelete;
/** @type {?|undefined} */
BaseUserInterface.prototype.avatarId;
/** @type {?|undefined} */
BaseUserInterface.prototype.bgimgId;
/** @type {?|undefined} */
BaseUserInterface.prototype.profile;
/** @type {?|undefined} */
BaseUserInterface.prototype.passwordStrength;
/** @type {?|undefined} */
BaseUserInterface.prototype.lastLoginIp;
}
/**
* @record
*/
function BaseUserDept() { }
if (false) {
/** @type {?|undefined} */
BaseUserDept.prototype.deptId;
/** @type {?|undefined} */
BaseUserDept.prototype.deptName;
/** @type {?|undefined} */
BaseUserDept.prototype.deptType;
/** @type {?|undefined} */
BaseUserDept.prototype.deptComment;
/** @type {?|undefined} */
BaseUserDept.prototype.leaf;
/** @type {?|undefined} */
BaseUserDept.prototype.displayIndex;
/** @type {?|undefined} */
BaseUserDept.prototype.deptCode;
/** @type {?|undefined} */
BaseUserDept.prototype.status;
/** @type {?|undefined} */
BaseUserDept.prototype.children;
/** @type {?|undefined} */
BaseUserDept.prototype.pid;
/** @type {?|undefined} */
BaseUserDept.prototype.expand;
/** @type {?|undefined} */
BaseUserDept.prototype.createdDate;
}
// 组件参数
var
// 组件参数
ComponentOption = /** @class */ (function () {
function ComponentOption() {
this.includeClass = true; // 是否包含班级(普通部门+系部+班级),true:普通部门+系部+班级,false:普通部门+系部,默认为true
// 是否包含班级(普通部门+系部+班级),true:普通部门+系部+班级,false:普通部门+系部,默认为true
this.includeHisClass = true; // 是否包含历史班级,默认为true,只在includeClass=true时起作用
// 是否包含历史班级,默认为true,只在includeClass=true时起作用
this.count = 0; // 最多人数限制,默认不限制
// 最多人数限制,默认不限制
this.defaultContacts = []; // 默认已被选择的人员
// 默认已被选择的人员
this.onlyStudent = false; // 部门树只选学生(系部+班级)
// 部门树只选学生(系部+班级)
this.userTypes = null; // 人员类型,多个类型以逗号隔开。当按部门查询且只选学生(onlyStudent = true)时默认为“2,3”,更改不起作用,其他情况下无默认值可做修改;
}
return ComponentOption;
}());
if (false) {
/** @type {?} */
ComponentOption.prototype.includeClass;
/** @type {?} */
ComponentOption.prototype.includeHisClass;
/** @type {?} */
ComponentOption.prototype.count;
/** @type {?} */
ComponentOption.prototype.defaultContacts;
/** @type {?} */
ComponentOption.prototype.onlyStudent;
/** @type {?} */
ComponentOption.prototype.userTypes;
}
/**
* @fileoverview added by tsickle
* Generated from: select-contacts/yz-select-contacts/yz-select-contacts.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var YzSelectContactsService = /** @class */ (function () {
function YzSelectContactsService(dialog, client, http, tokenService) {
this.dialog = dialog;
this.client = client;
this.http = http;
this.tokenService = tokenService;
}
/**
* 选择人员
* @param option
*/
/**
* 选择人员
* @param {?} option
* @return {?}
*/
YzSelectContactsService.prototype.choosePeople = /**
* 选择人员
* @param {?} option
* @return {?}
*/
function (option) {
if (this.tokenService.get().accessToken) {
/** @type {?} */
var dialogRef = this.dialog.open(YzSelectContactsComponent, {
panelClass: 'yz-select-contacts-panel',
closeOnNavigation: true,
data: {
includeClass: option.includeClass == undefined ? true : option.includeClass,
includeHisClass: option.includeHisClass == undefined ? true : option.includeHisClass,
count: option.count == undefined ? 0 : option.count,
defaultContacts: option.defaultContacts == undefined ? [] : option.defaultContacts,
onlyStudent: option.onlyStudent == undefined ? false : option.onlyStudent,
userTypes: option.userTypes == undefined ? null : option.userTypes
}
});
dialogRef.afterClosed().subscribe((/**
* @param {?} result
* @return {?}
*/
function (result) {
if (option.onOk) {
option.onOk(result ? result : []);
}
}));
}
else {
alert('无法获取Token,请刷新!');
}
};
/**
* 查询部门树
* @param includeClass 是否包含班级
* @param includeHisClass 是否包含历史班级,只在includeClass=true时起作用
*/
/**
* 查询部门树
* @param {?} includeClass 是否包含班级
* @param {?} includeHisClass 是否包含历史班级,只在includeClass=true时起作用
* @return {?}
*/
YzSelectContactsService.prototype.getDeptTree = /**
* 查询部门树
* @param {?} includeClass 是否包含班级
* @param {?} includeHisClass 是否包含历史班级,只在includeClass=true时起作用
* @return {?}
*/
function (includeClass, includeHisClass) {
/** @type {?} */
var url = this.client.gateway + "/auth/baseDepartMent/tree";
if (includeClass) {
if (includeHisClass) {
url = url + "?includeClass=true&includeHisClass=true";
}
else {
url = url + "?includeClass=true&includeHisClass=false";
}
}
else {
url = url + "?includeClass=false";
}
return this.http.get(url).pipe(map((/**
* @param {?} response
* @return {?}
*/
function (response) {
return response.data ? response.data : [];
})));
};
/**
* 查询部门树->只选学生(系部+班级)
* @param gradeId 年级id
*/
/**
* 查询部门树->只选学生(系部+班级)
* @param {?} gradeId 年级id
* @param {?} includeClass
* @param {?} includeHisClass
* @return {?}
*/
YzSelectContactsService.prototype.getDeptTreeOnlyStu = /**
* 查询部门树->只选学生(系部+班级)
* @param {?} gradeId 年级id
* @param {?} includeClass
* @param {?} includeHisClass
* @return {?}
*/
function (gradeId, includeClass, includeHisClass) {
/** @type {?} */
var url;
if (gradeId) {
url = this.client.gateway + "/auth/baseDepartMent/tree?gradeId=" + gradeId + "&deptTypes=2,class";
if (includeClass) {
if (includeHisClass) {
url = url + "&includeClass=true&includeHisClass=true";
}
else {
url = url + "&includeClass=true&includeHisClass=false";
}
}
else {
url = url + "&includeClass=false";
}
}
else {
url = this.client.gateway + "/auth/baseDepartMent/tree?deptTypes=2,class";
if (includeClass) {
if (includeHisClass) {
url = url + "&includeClass=true&includeHisClass=true";
}
else {
url = url + "&includeClass=true&includeHisClass=false";
}
}
else {
url = url + "&includeClass=false";
}
}
return this.http.get(url).pipe(map((/**
* @param {?} response
* @return {?}
*/
function (response) {
return response.data ? response.data : [];
})));
};
/**
* 查询人员列表
* @param pageNum 当前页面
* @param pageSize 每页条数
* @param realName 姓名
* @param deptId 部门id
* @param userTypes 用户类型1,2,3,4逗号拼接:查询普通部门的用户(不包括学生)传“1,4”;查询学生用户传“2,3”;查询所有用户不传
*/
/**
* 查询人员列表
* @param {?} pageNum 当前页面
* @param {?} pageSize 每页条数
* @param {?} realName 姓名
* @param {?} deptId 部门id
* @param {?} userTypes 用户类型1,2,3,4逗号拼接:查询普通部门的用户(不包括学生)传“1,4”;查询学生用户传“2,3”;查询所有用户不传
* @return {?}
*/
YzSelectContactsService.prototype.getBaseUser = /**
* 查询人员列表
* @param {?} pageNum 当前页面
* @param {?} pageSize 每页条数
* @param {?} realName 姓名
* @param {?} deptId 部门id
* @param {?} userTypes 用户类型1,2,3,4逗号拼接:查询普通部门的用户(不包括学生)传“1,4”;查询学生用户传“2,3”;查询所有用户不传
* @return {?}
*/
function (pageNum, pageSize, realName, deptId, userTypes) {
return this.http.post(this.client.gateway + "/auth/baseUser/queryListForPage", {
"pageNum": pageNum,
"pageSize": pageSize,
"pageParam": {
"realName": realName,
"deptId": deptId,
"userTypes": userTypes
}
}).pipe(map((/**
* @param {?} response
* @return {?}
*/
function (response) {
return response ? response : null;
})));
};
/**
* 查询人员信息
* @param userIds[] 用户id数组,["aaa","bbb","ccc"]
*/
/**
* 查询人员信息
* @param {?} userIds
* @return {?}
*/
YzSelectContactsService.prototype.getUserByUserIds = /**
* 查询人员信息
* @param {?} userIds
* @return {?}
*/
function (userIds) {
return this.http.post(this.client.gateway + "/auth/baseUser/users", {
userIds: userIds
}).pipe(map((/**
* @param {?} response
* @return {?}
*/
function (response) {
return response.data ? response.data : [];
})));
};
/**
* 查询年级
*/
/**
* 查询年级
* @return {?}
*/
YzSelectContactsService.prototype.getGrade = /**
* 查询年级
* @return {?}
*/
function () {
return this.http.get(this.client.gateway + "/auth/gradeYear/queryListForPage").pipe(map((/**
* @param {?} response
* @return {?}
*/
function (response) {
return response.data ? response.data : [];
})));
};
YzSelectContactsService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
YzSelectContactsService.ctorParameters = function () { return [
{ type: MatDialog },
{ type: undefined, decorators: [{ type: Inject, args: [BASE_CLIENT,] }] },
{ type: HttpClient },
{ type: TokenService }
]; };
/** @nocollapse */ YzSelectContactsService.ngInjectableDef = ɵɵdefineInjectable({ factory: function YzSelectContactsService_Factory() { return new YzSelectContactsService(ɵɵinject(MatDialog), ɵɵinject(BASE_CLIENT), ɵɵinject(HttpClient), ɵɵinject(TokenService)); }, token: YzSelectContactsService, providedIn: "root" });
return YzSelectContactsService;
}());
if (false) {
/** @type {?} */
YzSelectContactsService.prototype.dialog;
/**
* @type {?}
* @private
*/
YzSelectContactsService.prototype.client;
/**
* @type {?}
* @private
*/
YzSelectContactsService.prototype.http;
/**
* @type {?}
* @private
*/
YzSelectContactsService.prototype.tokenService;
}
/**
* @fileoverview added by tsickle
* Generated from: select-contacts/yz-select-contacts/yz-select-contacts.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var YzSelectContactsComponent = /** @class */ (function () {
function YzSelectContactsComponent(dialogRef, _modal, yzContactsService, data) {
this.dialogRef = dialogRef;
this._modal = _modal;
this.yzContactsService = yzContactsService;
this.data = data;
this.modalRefCpt = [];
this.subscribed = [];
this.dtPullToRefreshStyle = { height: window.innerHeight - 44 - 51 + 'px' };
// 总部门数据
this.deptNodes = [];
// 页面展示的部门数据
this.deptList = [];
// 面包屑
this.deptBarList = [];
// 页面加载中
this.pageLoading = false;
// 人员列表参数
this.baseUserParams = {
total: 0,
pageSize: 20,
pageNum: 1,
deptId: null,
realName: null,
userTypes: null
};
// 人员数据
this.baseUserList = [];
// 是否全选人员
this.allUserCheck = false;
// 已选择的联系人
this.selectedContacts = [];
// 年级数据
this.gradeList = [];
this.gradeParams = [];
}
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
if (this.data.onlyStudent === true) {
this.baseUserParams.userTypes = '2,3';
this.dtPullToRefreshStyle = { height: window.innerHeight - 44 - 51 - 44 + 'px' };
this.initDeptOnlyStu();
this.queryGrade();
}
else {
this.baseUserParams.userTypes = this.data.userTypes;
this.dtPullToRefreshStyle = { height: window.innerHeight - 44 - 51 + 'px' };
this.initDept();
}
};
// 查询部门树
// 查询部门树
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.initDept =
// 查询部门树
/**
* @return {?}
*/
function () {
var _this = this;
this.deptList = [];
this.deptNodes = [];
this.pageLoading = true;
/** @type {?} */
var $temp = this.yzContactsService.getDeptTree(this.data.includeClass, this.data.includeHisClass).subscribe((/**
* @param {?} dept
* @return {?}
*/
function (dept) {
_this.pageLoading = false;
_this.deptNodes = dept;
_this.deptList = JSON.parse(JSON.stringify(_this.deptNodes));
_this.queryDefaultContact();
_this.blDeptTree(_this.deptList);
_this.blDeptTree(_this.deptNodes);
_this.subscribed.push($temp);
}), (/**
* @return {?}
*/
function () {
_this.pageLoading = false;
}));
};
// 查询部门->只选学生
// 查询部门->只选学生
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.initDeptOnlyStu =
// 查询部门->只选学生
/**
* @return {?}
*/
function () {
var _this = this;
this.deptList = [];
this.deptNodes = [];
this.pageLoading = true;
/** @type {?} */
var gradeId = null;
if (this.gradeParams.length > 0) {
gradeId = this.gradeParams[0].value;
}
/** @type {?} */
var $temp = this.yzContactsService.getDeptTreeOnlyStu(gradeId, this.data.includeClass, this.data.includeHisClass).subscribe((/**
* @param {?} dept
* @return {?}
*/
function (dept) {
_this.pageLoading = false;
_this.deptNodes = dept;
_this.deptList = JSON.parse(JSON.stringify(_this.deptNodes));
_this.queryDefaultContact();
_this.blDeptTree(_this.deptList);
_this.blDeptTree(_this.deptNodes);
_this.subscribed.push($temp);
}), (/**
* @return {?}
*/
function () {
_this.pageLoading = false;
}));
};
// 查询年级
// 查询年级
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.queryGrade =
// 查询年级
/**
* @return {?}
*/
function () {
var _this = this;
this.gradeList = [];
this.pageLoading = true;
/** @type {?} */
var $temp = this.yzContactsService.getGrade().subscribe((/**
* @param {?} data
* @return {?}
*/
function (data) {
_this.pageLoading = false;
_this.gradeList = [];
data.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
if (item.enable !== 0 && item.enable !== null) {
_this.gradeList.push({
value: item.openId,
label: item.name
});
}
}));
_this.gradeList.unshift({
value: null,
label: '全部'
});
_this.subscribed.push($temp);
}), (/**
* @return {?}
*/
function () {
_this.pageLoading = false;
_this.gradeList.unshift({
value: null,
label: '全部'
});
}));
};
// 遍历部门树,确定叶子节点
// 遍历部门树,确定叶子节点
/**
* @param {?} tree
* @return {?}
*/
YzSelectContactsComponent.prototype.blDeptTree =
// 遍历部门树,确定叶子节点
/**
* @param {?} tree
* @return {?}
*/
function (tree) {
var _this = this;
if (tree && tree.length && tree.length > 0) {
tree.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
item.expanded = true;
if (item.children === null || item.children.length === 0) {
item['isLeaf'] = true;
}
else {
item['isLeaf'] = false;
}
_this.blDeptTree(item.children);
}));
}
};
// 查询默认已被选择人员的信息
// 查询默认已被选择人员的信息
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.queryDefaultContact =
// 查询默认已被选择人员的信息
/**
* @return {?}
*/
function () {
var _this = this;
if (this.data.defaultContacts && this.data.defaultContacts.length > 0) {
/** @type {?} */
var userIdsArray_1 = [];
this.data.defaultContacts.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
if (item.userId) {
userIdsArray_1.push(item.userId);
}
}));
this.pageLoading = true;
/** @type {?} */
var $temp_1 = this.yzContactsService.getUserByUserIds(userIdsArray_1).subscribe((/**
* @param {?} data
* @return {?}
*/
function (data) {
_this.pageLoading = false;
_this.selectedContacts = data;
_this.queryBaseUser();
_this.subscribed.push($temp_1);
}), (/**
* @return {?}
*/
function () {
_this.pageLoading = false;
}));
}
else {
this.queryBaseUser();
}
};
// 查询人员列表
// 查询人员列表
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.queryBaseUser =
// 查询人员列表
/**
* @return {?}
*/
function () {
var _this = this;
this.pageLoading = true;
/** @type {?} */
var $temp = this.yzContactsService.getBaseUser(this.baseUserParams.pageNum, this.baseUserParams.pageSize, this.baseUserParams.realName, this.baseUserParams.deptId, this.baseUserParams.userTypes).subscribe((/**
* @param {?} data
* @return {?}
*/
function (data) {
var _a;
_this.pageLoading = false;
_this.baseUserParams.total = data.total;
(_a = _this.baseUserList).push.apply(_a, __spread(data.list));
_this.baseUserList.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
item['checked'] = false;
item['disabled'] = false;
if (!item.dept) {
item.dept = { deptName: '暂无部门' };
}
if (!item.realName) {
item.realName = '暂无姓名';
}
if (!item.userCode) {
item.realName = '暂无学/工号';
}
if (!item.roles) {
item.roles = [];
item.rolesData = '暂无角色';
}
else {
/** @type {?} */
var roleArray_1 = [];
item.roles.forEach((/**
* @param {?} value
* @return {?}
*/
function (value) {
roleArray_1.push(value.roleName);
}));
item.rolesData = roleArray_1.toString();
}
_this.selectedContacts.forEach((/**
* @param {?} value
* @return {?}
*/
function (value) {
if (value.userId === item.userId) {
item['checked'] = true;
}
}));
}));
_this.isMaxCount();
_this.subscribed.push($temp);
}), (/**
* @return {?}
*/
function () {
_this.pageLoading = false;
}));
};
// 刷新回调函数
// 刷新回调函数
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.pullToRefresh =
// 刷新回调函数
/**
* @return {?}
*/
function () {
if (this.baseUserList.length < this.baseUserParams.total) {
this.baseUserParams.pageNum++;
this.queryBaseUser();
}
};
// 根据用户姓名即时搜索人员
// 根据用户姓名即时搜索人员
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.queryUserByRealName =
// 根据用户姓名即时搜索人员
/**
* @return {?}
*/
function () {
this.baseUserParams.pageNum = 1;
this.baseUserList = [];
this.queryBaseUser();
};
// 取消——根据用户姓名即时搜索人员
// 取消——根据用户姓名即时搜索人员
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.cancelQueUserByRealName =
// 取消——根据用户姓名即时搜索人员
/**
* @return {?}
*/
function () {
this.baseUserParams.realName = null;
this.baseUserParams.pageNum = 1;
this.baseUserList = [];
this.queryBaseUser();
};
// 查询全部人员
// 查询全部人员
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.viewAllList =
// 查询全部人员
/**
* @return {?}
*/
function () {
this.deptList = JSON.parse(JSON.stringify(this.deptNodes));
this.deptBarList = [];
this.baseUserParams.deptId = '';
this.baseUserParams.pageNum = 1;
this.baseUserList = [];
this.queryBaseUser();
};
// 顶部面包屑查看部门详细
// 顶部面包屑查看部门详细
/**
* @param {?} item
* @param {?} index
* @return {?}
*/
YzSelectContactsComponent.prototype.deptBarviewList =
// 顶部面包屑查看部门详细
/**
* @param {?} item
* @param {?} index
* @return {?}
*/
function (item, index) {
if (index != this.deptBarList.length - 1) {
this.deptList = item.children;
this.deptBarList.length = index + 1;
this.baseUserParams.deptId = item.key;
this.baseUserParams.pageNum = 1;
this.baseUserList = [];
this.queryBaseUser();
}
};
// 查看子部门 -> 查询当前部门人员
// 查看子部门 -> 查询当前部门人员
/**
* @param {?} item
* @return {?}
*/
YzSelectContactsComponent.prototype.viewDeptChildrenList =
// 查看子部门 -> 查询当前部门人员
/**
* @param {?} item
* @return {?}
*/
function (item) {
if (item.isLeaf) { // 是叶子节点,无子部门
this.deptList = [];
}
else {
this.deptList = item.children;
}
this.deptBarList.push(item);
this.baseUserParams.deptId = item.key;
this.baseUserParams.pageNum = 1;
this.baseUserList = [];
this.queryBaseUser();
};
// 人员选择变化的回调
// 人员选择变化的回调
/**
* @param {?} $event
* @return {?}
*/
YzSelectContactsComponent.prototype.userCheckedChange =
// 人员选择变化的回调
/**
* @param {?} $event
* @return {?}
*/
function ($event) {
if ($event.checked) { // 选中
this.allUserCheck = this.baseUserList.every((/**
* @param {?} item
* @return {?}
*/
function (item) {
return item.checked === true;
}));
}
else { // 取消
// 取消
/** @type {?} */
var itemIndex_1 = 0;
this.selectedContacts.forEach((/**
* @param {?} value
* @param {?} index
* @return {?}
*/
function (value, index) {
if (value.userId === $event.value) {
itemIndex_1 = index;
}
}));
this.deleteContact($event.value, itemIndex_1);
}
this.addBaseUser();
};
// 将人员列表中选中项添加至已选择的人员列表中
// 将人员列表中选中项添加至已选择的人员列表中
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.addBaseUser =
// 将人员列表中选中项添加至已选择的人员列表中
/**
* @return {?}
*/
function () {
var _this = this;
this.baseUserList.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
/** @type {?} */
var hasThisMen = _this.selectedContacts.some((/**
* @param {?} value
* @return {?}
*/
function (value) {
return value.userId === item.userId;
}));
if (item.checked && !hasThisMen) {
_this.selectedContacts.push(item);
}
}));
this.isMaxCount();
};
// 人数选择达到最大值
// 人数选择达到最大值
/**
* @return {?}
*/
YzSelectContactsComponent.prototype.isMaxCount =