123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- import {Component, OnInit, ViewChild} from '@angular/core';
- import {AlertController, IonInfiniteScroll, ModalController, NavController} from "@ionic/angular";
- import {ActivatedRoute, Router} from "@angular/router";
- import {ConfigService, RequsetData} from "../../../../service/config.service";
- import {UserService} from "../../../../service/user.service";
- import {SearchComponent} from "../../../../comm/modal/search/search.component";
- import {PartyUserApi} from "../../../../api/partyuser";
- @Component({
- selector: 'app-party-user',
- templateUrl: './party-user.component.html',
- styleUrls: ['./party-user.component.scss'],
- })
- export class PartyUserComponent implements OnInit {
- @ViewChild(IonInfiniteScroll, {static: true}) infiniteScroll: IonInfiniteScroll;
- webServerHost: string = '';
- dataList: any[] = [];
- searchParams: any = {
- pageIndex: 1,
- pageSize: 30,
- dzzdm: '',
- szdzbdm: '',
- userId: this.userService.GetUser().userid,
- xm: '',
- rybmList: '',
- ryztList: '',
- age_begin: '',
- age_end: '',
- partyGroupId: '',
- sqrdrq_begin: '',
- sqrdrq_end: ''
- };
- total: number = 30;
- fieldList: any[] = [
- {label: '姓名', name: 'xm', type: 'text', value: '', placeholder: '输入党员名称'},
- {
- label: '年龄',
- name: '',
- type: 'group-number',
- inputs: [{name: 'age_begin', type: 'number', value: '', placeholder: '输入最小年龄'}, {
- name: 'age_end',
- type: 'number',
- value: '',
- placeholder: '输入最大年龄'
- }]
- },
- {
- label: '政治面貌',
- name: 'ryztList',
- type: 'select',
- dicParams: {
- getUrl: 'getRyztList',
- dicTypeKey: '',
- textField: 'hzmc',
- valueField: 'bm',
- ismulti: true,
- filter: it => it.bm == "2" || it.bm == "3"
- },
- dicList: []
- },
- {
- label: '性别',
- name: 'xb',
- type: 'select',
- dicParams: {
- getUrl: '',
- dicTypeKey: '',
- textField: 'hzmc',
- valueField: 'bm',
- ismulti: false
- },
- dicList: [{hzmc: '男', bm: 1}, {hzmc: '女', bm: 2}]
- },
- {
- label: '学历',
- name: 'xl',
- type: 'select-down',
- value: '',
- dicParams: {
- getUrl: 'getEducationList',
- dicTypeKey: '',
- textField: 'HZMC',
- valueField: 'BM',
- ismulti: false
- },
- dicList: []
- },
- {
- label: '入党时间',
- name: '',
- type: 'group-datetime',
- inputs: [{name: 'sqrdrq_begin', type: 'datetime', value: '', placeholder: '开始时间'}, {
- name: 'sqrdrq_end',
- type: 'datetime',
- value: '',
- placeholder: '结束时间'
- }]
- }
- ];
- constructor(private router: Router, private routeInfo: ActivatedRoute, private configService: ConfigService, private userService: UserService, public alertController: AlertController, public modalController: ModalController, private navCtrl: NavController
- , private partyUserApi: PartyUserApi) {
- }
- ngOnInit() {
- this.configService.GetConfig().subscribe((config) => {
- this.webServerHost = config.webServerHost;
- });
- this.searchParams.dzzdm = this.searchParams.dzzdm || this.userService.GetUser().dataDzzdm;
- this.reload();
- //this.getRyztList();
- }
- getList() {
- this.partyUserApi.getList(this.searchParams).subscribe((data: RequsetData) => {
- if (data.success) {
- this.dataList = this.dataList.concat(data.item.list);
- this.total = data.item.total;
- }
- });
- }
- getRyztList() {
- /*this.configService.HttpGetRomote(this.getRyztUrl).subscribe((data: RequsetData) => {
- if (data.success) {
- this.fieldList[2].dicList = data.item.filter(it => it.bm == "2" || it.bm == "3");
- }
- });*/
- }
- reload() {
- this.dataList = [];
- this.searchParams.pageIndex = 1;
- this.total = 30;
- this.getList();
- }
- scroll(event) {
- setTimeout(() => {
- event.target.complete();
- if (this.total > this.searchParams.pageIndex * this.searchParams.pageSize) {
- this.searchParams.pageIndex += 1;
- this.getList();
- }
- }, 500);
- }
- async search() {
- const modal = await this.modalController.create({
- component: SearchComponent,
- componentProps: {
- 'fieldList': this.fieldList
- },
- cssClass: 'search-modal'
- });
- await modal.present();
- const {data} = await modal.onWillDismiss();
- if (data && data.success) {
- this.searchParams.xm = data.params.xm;
- this.searchParams.age_begin = data.params.age_begin;
- this.searchParams.age_end = data.params.age_end;
- this.searchParams.ryztList = data.params.ryztList;
- this.searchParams.xb = data.params.xb;
- this.searchParams.xl = data.params.xl;
- this.searchParams.sqrdrq_begin = data.params.sqrdrq_begin;
- this.searchParams.sqrdrq_end = data.params.sqrdrq_end;
- if (data.params.age_begin && data.params.age_end) {
- if (data.params.age_end < data.params.age_begin) {
- this.searchParams.age_begin = data.params.age_end;
- this.searchParams.age_end = data.params.age_begin;
- this.fieldList[1].inputs[0].value = data.params.age_end;
- this.fieldList[1].inputs[1].value = data.params.age_begin;
- }
- }
- this.reload();
- }
- }
- searchChange(event) {
- this.fieldList[0].value = event.detail.value;
- this.searchParams.xm = event.detail.value;
- this.reload();
- }
- dzzdmChange() {
- if (this.searchParams.dzzdm) {
- this.reload();
- }
- }
- partyGroupIdChange() {
- if (this.searchParams.partyGroupId) {
- this.reload();
- }
- }
- detail(user) {
- if (user.LEADTYPE == 0 || (user.LEADTYPE == 1 && user.isAdmin)) {
- this.router.navigate(['./detail'], {
- relativeTo: this.routeInfo,
- queryParams: {random: Math.random(), rybm: user.RYBM}
- });
- }
- }
- }
|