|
@@ -1,301 +0,0 @@
|
|
|
-import {Component, Inject, OnInit} from '@angular/core';
|
|
|
-import {ActivatedRoute, Router} from "@angular/router";
|
|
|
-import {ConfigService, RequsetData} from "../../service/config.service";
|
|
|
-import {UserService} from "../../service/user.service";
|
|
|
-import {AlertController, MenuController, ModalController} from "@ionic/angular";
|
|
|
-import {PartycourseService, IFileParams} from '../../api/partycourse.service';
|
|
|
-import {Observable, Subject} from 'rxjs';
|
|
|
-import {FileshowerComponent} from './fileshower/fileshower.component';
|
|
|
-import {
|
|
|
- debounceTime, distinctUntilChanged, switchMap, map, tap
|
|
|
-} from 'rxjs/operators';
|
|
|
-import {DOCUMENT} from "@angular/common";
|
|
|
-import {ShowpdfComponent} from "../../comm/modal/showpdf/showpdf.component";
|
|
|
-
|
|
|
-@Component({
|
|
|
- selector: 'app-partycourse',
|
|
|
- templateUrl: './partycourse.component.html',
|
|
|
- styleUrls: ['./partycourse.component.scss'],
|
|
|
-})
|
|
|
-export class PartycourseComponent implements OnInit {
|
|
|
-
|
|
|
- private searchFiles = new Subject<any>();
|
|
|
- dataList$: Observable<any[]>;
|
|
|
- dataParams: any = {
|
|
|
- target: null,
|
|
|
- total: 10,
|
|
|
- searchParams: null
|
|
|
- };
|
|
|
- searchParams: IFileParams = {
|
|
|
- pageIndex: 1,
|
|
|
- pageSize: 10,
|
|
|
- fileTypeId: '',
|
|
|
- fileName: ''
|
|
|
- };
|
|
|
-
|
|
|
- dataList: any[] = [];
|
|
|
- typeList: any[] = [];
|
|
|
-
|
|
|
- total: number = 30;
|
|
|
- fileTypeData: any = {
|
|
|
- title: '全部目录',
|
|
|
- allTypeName: '制度查询',
|
|
|
- pSelectedName: '全部目录',
|
|
|
- rootKids: [],
|
|
|
- selectedNode: null,
|
|
|
- selectedParent: null,
|
|
|
- fileTypeName: ''
|
|
|
- };
|
|
|
- sourceType: null;
|
|
|
-
|
|
|
- constructor(private router: Router, private routeInfo: ActivatedRoute, private partycourseService: PartycourseService, private configService: ConfigService, private userService: UserService,
|
|
|
- public alertController: AlertController, private menu: MenuController, private modal: ModalController, @Inject(DOCUMENT) private document: any) {
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- ionViewWillEnter(): void {
|
|
|
- this.searchParams.pageIndex = 1;
|
|
|
- }
|
|
|
-
|
|
|
- ngOnInit() {
|
|
|
-
|
|
|
- this.dataList$ = this.searchFiles.pipe(
|
|
|
- debounceTime(300),
|
|
|
- distinctUntilChanged(null, x => x.searchParams.fileName + x.searchParams.fileTypeId + x.searchParams.pageIndex + x.searchParams.pageSize),
|
|
|
- switchMap((params: any) => {
|
|
|
-
|
|
|
- let sMap = this.partycourseService.GetFileListByType(params.searchParams).pipe(map(x => {
|
|
|
-
|
|
|
- //this.total=x.item.total;
|
|
|
- this.dataParams.total = x.item.total;
|
|
|
-
|
|
|
- if (params.target) {
|
|
|
- this.dataList = this.dataList.concat(x.item.list);
|
|
|
- params.target.complete();
|
|
|
- } else {
|
|
|
- this.dataList = x.item.list;
|
|
|
- }
|
|
|
-
|
|
|
- return this.dataList;
|
|
|
- }));
|
|
|
-
|
|
|
- return sMap;
|
|
|
- })
|
|
|
- );
|
|
|
- this.routeInfo.queryParams.subscribe(params => {
|
|
|
- this.sourceType = params['sourceType'] == undefined ? null : params['sourceType'];
|
|
|
- this.partycourseService.GetfileTypeRoot({sourceType: this.sourceType}).subscribe(next => {
|
|
|
-
|
|
|
- this.fileTypeData.rootKids = next.item;
|
|
|
- if (this.fileTypeData.rootKids.length > 0) {
|
|
|
- if (this.sourceType != null) {
|
|
|
- this.fileTypeData.selectedNode = this.fileTypeData.rootKids[0];
|
|
|
- this.searchParams.fileTypeId = this.fileTypeData.selectedNode.filetypeid.toString();
|
|
|
- this.fileTypeData.fileTypeName = this.fileTypeData.selectedNode.filetypename;
|
|
|
- }
|
|
|
- this.dataParams.searchParams = this.searchParams;
|
|
|
- this.dataParams.target = null;
|
|
|
- this.searchFiles.next(this.dataParams);
|
|
|
- //this.loadFilesbyType();
|
|
|
- }
|
|
|
- this.typeList = this.fileTypeData.rootKids;
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- scroll(event) {
|
|
|
-
|
|
|
- if (this.dataParams.total > this.searchParams.pageIndex * this.searchParams.pageSize) {
|
|
|
- this.searchParams.pageIndex += 1;
|
|
|
- //this.getList();
|
|
|
- this.dataParams.target = event.target;
|
|
|
- //this.dataParams.searchParams=this.searchParams;
|
|
|
- this.searchFiles.next(this.dataParams);
|
|
|
- } else {
|
|
|
- setTimeout(() => {
|
|
|
- event.target.complete();
|
|
|
- }, 500);
|
|
|
- }
|
|
|
- /*
|
|
|
- setTimeout(() => {
|
|
|
- //event.target.complete();
|
|
|
-
|
|
|
- }
|
|
|
- }, 500);*/
|
|
|
- }
|
|
|
-
|
|
|
- back() {
|
|
|
- this.router.navigateByUrl('/main/tabs/tab3');
|
|
|
- //this.navCtrl.back();
|
|
|
- }
|
|
|
-
|
|
|
- searchChange(event) {
|
|
|
- /*
|
|
|
- this.fieldList[0].value = event.detail.value;
|
|
|
- this.searchParams.dzzmc = event.detail.value;
|
|
|
- this.reload();*/
|
|
|
-
|
|
|
- //this.searchFiles.next(event.detail.value);
|
|
|
-
|
|
|
- this.searchParams.fileName = event.detail.value;
|
|
|
- this.searchParams.pageIndex = 1;
|
|
|
- this.dataParams.target = null;
|
|
|
- this.searchFiles.next(this.dataParams);
|
|
|
- /*
|
|
|
- this.searchParams.pageIndex=1;
|
|
|
- this.dataList.length=0;
|
|
|
- this.searchParams.fileTypeId=null;
|
|
|
- this.fileTypeData.fileTypeName="";
|
|
|
- this.loadFilesBySearch();*/
|
|
|
- }
|
|
|
-
|
|
|
- loadFilesBySearch() {
|
|
|
-
|
|
|
- this.partycourseService.GetfileListByKey(this.searchParams).subscribe(next => {
|
|
|
- //next.item
|
|
|
- this.dataList = this.dataList.concat(next.item.list);
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- loadFilesbyType() {
|
|
|
- //this.partycourseService.GetFileListByType(this.searchParams)
|
|
|
-
|
|
|
- this.partycourseService.GetFileListByType(this.searchParams).subscribe(next => {
|
|
|
- //next.item
|
|
|
- //this.dataList=this.dataList.concat(next.item.list);
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- selectFileType() {
|
|
|
- this.menu.enable(true, 'typeRoot').then(a => {
|
|
|
- });
|
|
|
- this.menu.open('typeRoot').then(a => {
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- ClickPFileType(it: any) {
|
|
|
- /*
|
|
|
- this.fileTypeData.pSelectedId=it.filetypeid;
|
|
|
- this.fileTypeData.pSelectedName=it.filetypename;*/
|
|
|
- //this.fileTypeData.selectedId=it.
|
|
|
- this.fileTypeData.selectedNode = it;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- selectedItem(it: any) {
|
|
|
- let result = false;
|
|
|
- if (this.fileTypeData.selectedNode != null) {
|
|
|
- result = this.fileTypeData.selectedNode.filetypeid == it.filetypeid;
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- selectedTitle() {
|
|
|
- let result = false;
|
|
|
-
|
|
|
- if (this.fileTypeData.selectedNode == null) {
|
|
|
- result = true;
|
|
|
- } else {
|
|
|
- if (this.fileTypeData.selectedParent != null) {
|
|
|
- result = this.fileTypeData.selectedNode.filetypeid == this.fileTypeData.selectedParent.filetypeid;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- SelectTitleFileType() {
|
|
|
- this.fileTypeData.selectedNode = this.fileTypeData.selectedParent;
|
|
|
- }
|
|
|
-
|
|
|
- ShowKidsFileType(it: any) {
|
|
|
- //this.ClickPFileType(it);
|
|
|
- this.fileTypeData.selectedNode = it;
|
|
|
-
|
|
|
- if (it.childcount == 0) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- this.fileTypeData.pSelectedName = it.filetypename;
|
|
|
- this.fileTypeData.selectedParent = it;
|
|
|
-
|
|
|
- if (it.kids != null) {
|
|
|
- this.typeList = it.kids;
|
|
|
-
|
|
|
- } else {
|
|
|
- this.partycourseService.GetileTypesByParent(it.filetypeid).subscribe(req => {
|
|
|
- it.kids = req.item;
|
|
|
- it.kids.forEach(kit => {
|
|
|
- kit.parent = it;
|
|
|
- });
|
|
|
- this.typeList = it.kids;
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- BackMenu() {
|
|
|
- if (this.fileTypeData.selectedParent != null) {
|
|
|
- this.fileTypeData.selectedNode = this.fileTypeData.selectedParent;
|
|
|
- this.fileTypeData.selectedParent = this.fileTypeData.selectedParent.parent;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.fileTypeData.selectedParent != null) {
|
|
|
- this.typeList = this.fileTypeData.selectedParent.kids;
|
|
|
- } else {
|
|
|
- this.typeList = this.fileTypeData.rootKids;
|
|
|
- this.fileTypeData.pSelectedName = this.fileTypeData.title;
|
|
|
- this.fileTypeData.selectedNode = null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CloseMenu() {
|
|
|
- this.menu.close('typeRoot').then(a => {
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- chooseFileType() {
|
|
|
- if (this.fileTypeData.selectedNode == null) {
|
|
|
- this.searchParams.fileTypeId = '';
|
|
|
- this.fileTypeData.fileTypeName = this.fileTypeData.title;
|
|
|
- } else {
|
|
|
- this.searchParams.fileTypeId = this.fileTypeData.selectedNode.filetypeid.toString();
|
|
|
- this.fileTypeData.fileTypeName = this.fileTypeData.selectedNode.filetypename;
|
|
|
- }
|
|
|
- this.searchParams.pageIndex = 1;
|
|
|
- this.dataParams.target = null;
|
|
|
- //this.searchParams.fileName="";
|
|
|
- //this.dataList.length=0;
|
|
|
- this.searchFiles.next(this.dataParams);
|
|
|
- //this.loadFilesbyType();
|
|
|
- this.CloseMenu();
|
|
|
- }
|
|
|
-
|
|
|
- ShowPdf(it: any) {
|
|
|
- let pdfModal = this.modal.create({
|
|
|
- component: ShowpdfComponent,
|
|
|
- componentProps: {
|
|
|
- pdfTitle: it.FILENAME,
|
|
|
- // pdfUrl:"/assets/study/pdf/"+it.URL
|
|
|
- pdfUrl: '/appApi/FileMgr/showDoc/' + it.FILEID,
|
|
|
- pointType: 2,
|
|
|
- fileid: it.FILEID,
|
|
|
- duration: it.DURATION
|
|
|
- }
|
|
|
- });
|
|
|
- this.configService.HttpGetRomote('/appApi/onlineCourse/insertCourseRecord', {
|
|
|
- courseId: it.FILEID,
|
|
|
- studentUserId: this.userService.GetUser().userid, pointType: 2, title: it.FILENAME,
|
|
|
- userName: this.userService.GetUser().username
|
|
|
- }).subscribe((data: RequsetData) => {
|
|
|
- if (data.success) {
|
|
|
- }
|
|
|
- });
|
|
|
- pdfModal.then(a => a.present());
|
|
|
- }
|
|
|
-}
|