|
@@ -0,0 +1,214 @@
|
|
|
+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}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|