123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- import { Component, OnInit } from '@angular/core';
- import { Router, ActivatedRoute } from '@angular/router';
- import { MainService } from 'src/app/services/main.service';
- import { ToolService } from 'src/app/services/tool.service';
- import { NzMessageService } from 'ng-zorro-antd';
- @Component({
- selector: 'app-form-management-detail',
- templateUrl: './form-management-detail.component.html',
- styleUrls: ['./form-management-detail.component.less']
- })
- export class FormManagementDetailComponent implements OnInit {
- constructor(
- private router: Router,
- private mainService: MainService,
- private route: ActivatedRoute,
- private tool: ToolService,
- private msg: NzMessageService,
- ) { }
- hosId;
- data = [];
- ngOnInit() {
- this.hosId = this.tool.getCurrentHospital().id;
- this.getList();
- }
-
- toList(){
- this.router.navigateByUrl('/main/formManagement');
- }
-
- buildings:any[] = [];
- getList(){
- let maskFlag = this.msg.loading("加载中", { nzDuration: 0 }).messageId;
- this.mainService.listMsgByMain('reserveView', {
- reserveFormId: +this.route.snapshot.paramMap.get('id'),
- taskTypeId: +this.route.snapshot.paramMap.get('taskType'),
- }).subscribe((result: any) => {
- this.msg.remove(maskFlag);
- console.log(result);
- const data = result.data || {};
- console.log(data);
- if(result.state == 200){
- if(Object.keys(data).length > 0){
-
- let buildings = Object.keys(data)
- .map(v => ({
- id: v,
- name: Object.values(Object.values(data[v])[0])[0][0][3],
- departments: (
- Object.values(data[v]).map(vv => Object.keys(vv).map(vvv => ({id: vvv, name: vv[vvv][0][6], orders: vv[vvv], checked: false, isDisabled: vv[vvv].every(vvvv => !(vvvv[12] == 2 || (!vvvv[8] && vvvv[12] != 2 && vvvv[12] != 6 && vvvv[12] != 7 && vvvv[12] != 11)))}))) as any
- ).flat()
- }));
- console.log(buildings)
- this.buildings = buildings;
- }else{
- this.buildings = [];
- }
- }else{
- this.buildings = [];
- }
- })
- }
-
- batchDispatch() {
- console.log(this.buildings);
- let arr = [];
- this.buildings.forEach(v => {
- v.departments.forEach(vv => {
- if(vv.checked){
- arr = arr.concat(vv.orders.filter(vvv => vvv[12] == 2 || (!vvv[8] && vvv[12] != 2 && vvv[12] != 6 && vvv[12] != 7 && vvv[12] != 11)));
- }
- })
- })
- console.log(arr);
- if(arr.length === 0){
- this.msg.info('请勾选科室!');
- return;
- }
- let ids_types = [];
- let stateIds = [];
- arr.forEach((item) => {
- if (item[12] == 2) {
-
- ids_types.push(`${item[9]}_assign`);
- } else if (!item[8] && item[12] != 2 && item[12] != 6 && item[12] != 7 && item[12] != 11) {
- ids_types.push(`${item[9]}_reassign`);
- }
- stateIds.push(item[10]);
- });
- this.router.navigateByUrl(
- `/main/formManagementDetail/${this.route.snapshot.paramMap.get('id')}/${this.route.snapshot.paramMap.get('taskType')}/allotWorker/${ids_types.join("-")}/${stateIds.join("-")}/2/${this.hosId}`
- );
- }
- }
|