|
@@ -0,0 +1,153 @@
|
|
|
+import {Component, OnInit} from '@angular/core';
|
|
|
+import {DatePipe} from "@angular/common";
|
|
|
+import {ActivatedRoute, Router} from "@angular/router";
|
|
|
+import {RequsetData} from "../../../../../service/config.service";
|
|
|
+import {UserService} from "../../../../../service/user.service";
|
|
|
+import {ModalController} from "@ionic/angular";
|
|
|
+import {SelectuserComponent} from "../selectuser/selectuser.component";
|
|
|
+import {PartyDuesApi} from "../../../../../api/partyuser/partydues";
|
|
|
+import {DictionaryApi} from "../../../../../api/system/dictionary";
|
|
|
+import {AlertModal} from "../../../../../comm/modal/alert";
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-edit',
|
|
|
+ templateUrl: './edit.component.html',
|
|
|
+ styleUrls: ['./edit.component.scss'],
|
|
|
+})
|
|
|
+export class EditComponent implements OnInit {
|
|
|
+
|
|
|
+ dataModel: any = {
|
|
|
+ 'pageIndex': 1,
|
|
|
+ 'pageSize': 1000, dzzmc: '', dzzdm: '', year: null, month: ''
|
|
|
+ };
|
|
|
+ years: any = [];
|
|
|
+ months: any = [];
|
|
|
+ dataList: any = [];
|
|
|
+
|
|
|
+ constructor(private datePipe: DatePipe, private router: Router, private routeInfo: ActivatedRoute, private userService: UserService,
|
|
|
+ public modalController: ModalController, private partyDuesApi: PartyDuesApi, private dictionaryApi: DictionaryApi, private alertModal: AlertModal) {
|
|
|
+ }
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ this.routeInfo.queryParams.subscribe(params => {
|
|
|
+ this.dataModel.dzzdm = this.userService.GetUser().dataDzzdm.length <= 9 ? this.userService.GetUser().DZZDM : this.userService.GetUser().dataDzzdm;
|
|
|
+ this.dataModel.dzzmc = this.userService.GetUser().dataDzzdm.length <= 9 ? this.userService.GetUser().DZZMC : this.userService.GetUser().dataDzzmc;
|
|
|
+ this.getYearList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ getYearList() {
|
|
|
+ this.dictionaryApi.getDictionaryList('years').subscribe((data: RequsetData) => {
|
|
|
+ if (data.success) {
|
|
|
+ this.years = data.item;
|
|
|
+ for (let i = 1; i <= 12; i++) {
|
|
|
+ this.months.push(i);
|
|
|
+ }
|
|
|
+ this.dataModel.month = new Date().getMonth() + 1;
|
|
|
+ this.dataModel.year = new Date().getFullYear();
|
|
|
+ this.getUserList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ getUserList() {
|
|
|
+ this.dataList = [];
|
|
|
+ this.partyDuesApi.getNotPayUserList(this.dataModel.year, this.dataModel.month).subscribe((data: RequsetData) => {
|
|
|
+ if (data.success) {
|
|
|
+ this.dataList = data.item.list;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ yearChange(e) {
|
|
|
+ this.getUserList();
|
|
|
+ }
|
|
|
+
|
|
|
+ monthChange(e) {
|
|
|
+ this.getUserList();
|
|
|
+ }
|
|
|
+
|
|
|
+ delete(index) {
|
|
|
+ this.dataList.splice(index, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ selectUser() {
|
|
|
+ this.presentModal();
|
|
|
+ }
|
|
|
+
|
|
|
+ save() {
|
|
|
+ if (this.dataList.length <= 0) {
|
|
|
+ this.alertModal.alert('请选择需要缴费的党员');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.dataList.filter(it => it.MONEY == null || it.MONEY === '').length > 0) {
|
|
|
+ this.alertModal.alert('请填写党费');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据处理
|
|
|
+ var userList = [];
|
|
|
+ this.dataList.forEach((val, key) => {
|
|
|
+ userList.push({
|
|
|
+ partyduesid: val.PARTYDUESID,
|
|
|
+ month: this.dataModel.month,
|
|
|
+ money: val.MONEY,
|
|
|
+ specialexpenses: val.SPECIALEXPENSES,
|
|
|
+ partycode: val.PARTYCODE
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ this.alertModal.loading("提交中...").then((loading) => {
|
|
|
+ this.partyDuesApi.saveDuesList(userList).subscribe((fdata: RequsetData) => {
|
|
|
+ loading.dismiss();
|
|
|
+ if (fdata.success) {
|
|
|
+ this.back();
|
|
|
+ }
|
|
|
+ this.alertModal.alert(fdata.msg);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //人员选择控件
|
|
|
+ async presentModal() {
|
|
|
+ const modal = await this.modalController.create({
|
|
|
+ component: SelectuserComponent,
|
|
|
+ componentProps: {
|
|
|
+ 'pageIndex': 1,
|
|
|
+ 'pageSize': 30,
|
|
|
+ 'year': this.dataModel.year,
|
|
|
+ 'month': this.dataModel.month,
|
|
|
+ 'dzzdm': this.dataModel.dzzdm,
|
|
|
+ 'getUserUrl': this.partyDuesApi.getNotPayUserListUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ await modal.present();
|
|
|
+
|
|
|
+ const {data} = await modal.onWillDismiss();
|
|
|
+ if (data.rtnData != null && data.rtnData.length > 0) {
|
|
|
+ var us = data.rtnData;
|
|
|
+
|
|
|
+ data.rtnData.forEach(item => {
|
|
|
+ this.dataList.push({
|
|
|
+ PARTYDUESID: item.PARTYDUESID,
|
|
|
+ USERNAME: item.USERNAME,
|
|
|
+ USERCODE: item.USERCODE,
|
|
|
+ BASENUMBER: item.BASENUMBER,
|
|
|
+ MONEY: item.MONEY,
|
|
|
+ SPECIALEXPENSES: item.SPECIALEXPENSES,
|
|
|
+ PARTYCODE: item.PARTYCODE
|
|
|
+ });
|
|
|
+ }
|
|
|
+ )
|
|
|
+ ;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ back() {
|
|
|
+ this.router.navigate(['../../partyDues'], {relativeTo: this.routeInfo});
|
|
|
+ }
|
|
|
+
|
|
|
+}
|