123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- import { Component, OnInit, OnDestroy } from "@angular/core";
- import { ActivatedRoute, Router } from "@angular/router";
- import { MainService } from "../../services/main.service";
- import { ToolService } from "../../services/tool.service";
- import { Subject } from "rxjs";
- import { debounceTime } from "rxjs/operators";
- import { NzMessageService } from 'ng-zorro-antd/message';
- import { format, addDays, addHours } from 'date-fns';
- import { FormGroup, Validators, FormBuilder } from '@angular/forms';
- import cloneDeep from 'lodash-es/cloneDeep'
- @Component({
- selector: "app-incident-management",
- templateUrl: "./incident-management.component.html",
- styleUrls: ["./incident-management.component.less"],
- })
- export class IncidentManagementComponent implements OnInit, OnDestroy {
- constructor(
- public route: ActivatedRoute,
- private router: Router,
- private mainService: MainService,
- private tool: ToolService,
- private message: NzMessageService,
- private fb: FormBuilder,
- ) {}
- loginUser: any = localStorage.getItem("user")
- ? JSON.parse(localStorage.getItem("user")).user
- : null;
- listOfData: any[] = [];
- coopId: string;
- hospital: string;
- alldepart: any = [];
- worker: number;
- handleUserList: any = [];
- acceptUserList: any = [];
- gdState: number;
- gdStates: any;
- overdueStates: any;
- sourceList: any;
- pageIndex: number = 1;
- listLength: number = 10;
- pageSize: number = 10;
- promptContent: string;
- ifSuccess: boolean;
- promptInfo: string;
- promptModalShow: boolean;
- btnLoading: boolean = false;
- tabs:any[] = [
-
- {key: 'todo', value: '待我接单', num: 0, isRed: true},
- {key: 'doing', value: '待我处理', num: 0, isRed: true},
-
-
- {key: 'resolve', value: '由我解决', num: 0, isRed: false},
- {key: 'owns', value: '与我关联', num: 0, isRed: false},
- {key: 'storage', value: '暂存', num: 0, isRed: false},
-
- ]
- searchDTO: any = {};
- searchTimerSubject = new Subject();
- debounceSubject = new Subject();
- maintainDept:any = [];
- maintainGroup:any = [];
- hosIds:any;
-
- coopBtns: any = {};
-
- queryTask:string = 'todo';
- changeTab(key){
- this.queryTask = key;
- let itemDept = this.maintainDept.find(i=>i.id == this.hosIds)
- if(itemDept){
- this.searchDTO.maintainDepartment = itemDept.id
- if(this.queryTask!='todo' && this.queryTask!='doing' && this.queryTask!='storage'){
- let arr = this.tool.getUserInfoPermission().dutyGroupList.filter(i=>i.hospital.id == itemDept.id)
- if(arr){
- this.maintainGroup = arr
- }else{
- this.maintainGroup = this.tool.getUserInfoPermission().dutyGroupList
- }
- }else{
- this.maintainGroup = this.tool.getUserInfoPermission().dutyGroupList
- }
- }
- this.getDeparts();
- this.getUsers('', 'handle');
- this.loading1 = true;
- this.debounceSubject.next(true);
- }
- ngOnInit() {
- this.maintainDept = this.tool.getUserInfoPermission().dutyList
- this.hosIds = this.tool.getCurrentHospital().id
- if(this.coopBtns.strideLook){
- this.defaDept()
- }
- this.initSearchForm();
- this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
- let fun = v[0];
- fun.call(this, v[1], v[2]);
- });
- this.debounceSubject.pipe(debounceTime(500)).subscribe((v:boolean) => {
- this.getList(v);
- });
- this.coopBtns = this.tool.initCoopBtns(this.route);
- this.initTabs();
- this.getGdStates();
- this.getOverdueStates();
- this.getSourceList();
- this.getIncidentCategoryList();
- this.loading1 = true;
- this.debounceSubject.next(true);
- this.autoRefresh();
- }
- ngOnDestroy(){
- this.cancelRefresh();
- }
-
- timer = null;
- autoRefresh(){
- this.cancelRefresh();
- this.timer = setInterval(() => {
- this.getList();
- }, 60000)
- }
-
- cancelRefresh(){
- clearInterval(this.timer);
- }
-
- initTabs(){
- if (this.coopBtns.all) {
- this.tabs.splice(0, 0 , {key: 'all', value: '全部故障', num: 0, isRed: false});
- }
- if (this.coopBtns.callback) {
- let index = this.tabs.findIndex(v => v.key == 'resolve');
- this.tabs.splice(index, 0 , {key: 'callback', value: '待我回访', num: 0, isRed: false});
- }
- if (this.coopBtns.reassign) {
- let index = this.tabs.findIndex(v => v.key == 'doing');
- this.tabs.splice(index + 1, 0 , {key: 'reassign', value: '重新指派', num: 0, isRed: false});
- }
-
-
-
- }
- defaDept(){
- let itemDept = this.maintainDept.find(i=>i.id == this.hosIds)
- if(itemDept){
- this.searchDTO.maintainDepartment = itemDept.id
- }
- this.getDeparts();
- this.getUsers('', 'handle');
- this.getUsers('', 'acceptUser');
- }
-
- deptChange(e){
- this.searchDTO.maintainGroup = null
- let arr = this.tool.getUserInfoPermission().dutyGroupList.filter(i=>i.hospital.id == e)
- if(arr){
- this.maintainGroup = arr
- }else{
- this.maintainGroup = this.tool.getUserInfoPermission().dutyGroupList
- }
- this.searchDTO.department = null
- this.searchDTO.todoingUser = null
- this.getDeparts();
- this.getUsers('', 'handle');
- }
-
- search() {
- this.loading1 = true;
- this.debounceSubject.next(true);
- }
-
- reset() {
- this.searchDTO = {};
- if(this.coopBtns.strideLook){
- this.defaDept()
- }
- this.initSearchForm();
- this.loading1 = true;
- this.debounceSubject.next(true);
- }
-
- incidentCategoryList:any[] = [];
- getIncidentCategoryList(){
- let { hospital, type } = this.tool.getHospitalOrDuty();
- if(type === 'hospital' || type === 'department'){
- this.incidentCategoryList = [];
- return;
- };
- let postData = {
- hasThird: 'true',
- category: {
- dutyIds: type === 'duty' ? hospital.id.toString() : undefined,
- },
- };
- this.mainService.incidentPost("listIncidentCategory", postData).subscribe(res => {
- let incidentCategoryList = res.data || [];
- incidentCategoryList = incidentCategoryList.map(v => ({...v, parentId: v.parent ? v.parent.id : undefined, title: v.category, key: v.id}));
- this.incidentCategoryList = this.tool.tranListToTreeDataLeaf(incidentCategoryList, undefined, "parentId");
- console.log(this.incidentCategoryList);
- })
- }
-
- getUsers(e?, type?) {
- let that = this;
- let postData = {
- user: {
- name: e || "",
- hospital: { id: this.searchDTO.maintainDepartment?this.searchDTO.maintainDepartment:that.tool.getCurrentHospital().id },
- engineer: 1,
- simpleQuery: true,
- },
- idx: 0,
- sum: 20,
- };
- that.isLoading = true;
- that.mainService
- .getFetchDataList("data", "user", postData)
- .subscribe((data) => {
- that.isLoading = false;
- if(type === 'handle'){
- that.handleUserList = data.list;
- }else if(type === 'acceptUser'){
- that.acceptUserList = data.list;
- }
- });
- }
- onCalendarChangeDate(dateArr){
- console.log(dateArr)
- if(dateArr.length == 2){
- let dateStart = new Date(dateArr[0]);
- let dateEnd = new Date(dateArr[1]);
- dateStart.setHours(0,0,0);
- dateEnd.setHours(23,59,59);
- this.searchDTO.dateRange = [dateStart,dateEnd];
- }
- }
-
- priorityColor(priorityId) {
-
- if(priorityId == 1 || priorityId == 2){
- return '';
- } else if(priorityId == 3){
- return 'yellow';
- } else if(priorityId == 4 || priorityId == 5){
- return 'red';
- }
- }
-
- transferSynergetic(incidentData){
- let str = incidentData.groupORHandlerUser || "";
- if(incidentData.synergetic && incidentData.synergetic.length){
- str += ',' + incidentData.synergetic.map(v => v.name).join(',');
- }
- return str;
- }
-
- transferHandlerLog = function (currentLog) {
- if(!currentLog){
- return '无';
- }
- currentLog = cloneDeep(currentLog);
- if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
- if(currentLog.extra2==0.5){
- currentLog.extra2 = 4;
- return currentLog.extra1DTO.name+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "MM月dd日")+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "HH时mm分前完成");
- }else{
- return currentLog.extra1DTO.name+"<br>"+ format(addDays(currentLog.startTime, +currentLog.extra2), "MM月dd日前完成");
- }
- }else{
- return '无';
- }
- }
-
- isInGroup(data){
- return this.tool.getCurrentGroupList().some(v => data.currentLog && v.id == data.currentLog.groupId);
- }
-
- computedReceive(data){
- let inUser = data.currentLog && data.currentLog.workerId == this.tool.getCurrentUserId();
- let inGroup = false;
- let groupList = this.tool.getCurrentGroupList();
- groupList.forEach(item => {
- if(data.currentLog){
- if (item.id == data.currentLog.groupId) {
- inGroup = true;
- }
- }
- })
- return data.state.value === 'pending' && (inUser || inGroup) && this.coopBtns.receive && data.deleteFlag !== 1;
- }
-
- computedHandle(data){
- return this.coopBtns.handle && data.state.value === 'handler' && data.handlingPersonnelUser && data.handlingPersonnelUser.id == this.tool.getCurrentUserId() && data.deleteFlag !== 1;
- }
-
- computedSubstitution(data){
- return (data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && this.coopBtns.assign)) && data.deleteFlag !== 1;
- }
-
- computedPostpone(data){
- return data.state.value == 'handler' && data.handlingPersonnelUser && data.handlingPersonnelUser.id == this.tool.getCurrentUserId() && data.deleteFlag !== 1;
- }
-
- computedSetDuty(data){
- return this.coopBtns.settings && (data.state.value == 'resolved' || data.state.value == 'close') && data.deleteFlag !== 1;
- }
-
- computedVisit(data){
- return this.coopBtns.visit && data.state.value == 'close' && data.deleteFlag !== 1;
- }
-
- computedEdit(data){
- return (data.state.value === 'pending' || data.state.value === 'reassign' || data.state.value === 'handler' || data.state.value === 'close') && this.coopBtns.edit && data.deleteFlag !== 1;
- }
-
- loading1 = false;
- getList(isInit = false) {
- let postData: any = {
- idx: isInit ? 0 : (this.pageIndex - 1),
- sum: this.pageSize,
- incident: {
- assignee: this.tool.getCurrentUserId(),
- acceptDate: (this.searchDTO.dateRange && this.searchDTO.dateRange[0]) ? format(this.searchDTO.dateRange[0], 'yyyy-MM-dd HH:mm:ss') : undefined,
- acceptDateEnd: (this.searchDTO.dateRange && this.searchDTO.dateRange[1]) ? format(this.searchDTO.dateRange[1], 'yyyy-MM-dd HH:mm:ss') : undefined,
- incidentsign: this.searchDTO.incidentsign,
- department: this.searchDTO.department ? { id: this.searchDTO.department } : undefined,
- statusId: this.searchDTO.statusId || undefined,
- todoingUser: this.searchDTO.todoingUser ? { id: this.searchDTO.todoingUser } : undefined,
- levelCategory: this.validateSearchForm.value.levelCategory ? { id: this.validateSearchForm.value.levelCategory } : undefined,
- acceptUser: this.validateSearchForm.value.acceptUser ? { id: this.validateSearchForm.value.acceptUser } : undefined,
- selectType: this.validateSearchForm.value.selectType || undefined,
- source: this.validateSearchForm.value.sourceValue ? { value: this.validateSearchForm.value.sourceValue } : undefined,
- deleteFlag: this.validateSearchForm.value.deleteFlag,
- candidateGroupId: null,
- },
- };
- if(this.queryTask === 'all' || this.queryTask === 'callback' || this.queryTask === 'badEvaluate'){
- let { hospital, type } = this.tool.getHospitalOrDuty();
- if(type === 'duty'){
-
- postData.incident.duty = hospital;
- }else{
-
- postData.incident.hosId = hospital.id;
- }
- }else{
- delete postData.incident.duty;
- delete postData.incident.hosId;
- }
- if(this.queryTask!='todo' && this.queryTask!='doing' && this.queryTask!='storage'){
- if(this.searchDTO.maintainDepartment){
- let itemDept = this.maintainDept.find(i=>i.id == this.searchDTO.maintainDepartment)
- postData.incident.duty = itemDept;
- delete postData.incident.hosId;
- }
- }
- if(this.queryTask!='todo' && this.queryTask!='owns' && this.queryTask!='storage' && this.queryTask!='doing' && this.queryTask!='reassign'){
- postData.incident.candidateGroupId = this.searchDTO.maintainGroup
- }else{
- delete postData.incident.candidateGroupId;
- }
- postData.incident.queryTask = this.queryTask;
- if(this.queryTask === 'todo' || this.queryTask === 'owns'){
- postData.incident.candidateGroups = this.tool.getCurrentGroupList().map(v => v.id).toString();
- }else{
- delete postData.incident.candidateGroups;
- }
- this.loading1 = true;
- this.mainService
- .getFetchDataList("simple/data", "incident", postData)
- .subscribe((result) => {
- this.loading1 = false;
- let list = result.list || [];
- list.forEach((item) => {
- item.endDeptsName = item.endDepts ? item.endDepts.map(v => v.dept).toString() : '';
- item.computedEditFlag = this.computedEdit(item);
- item.computedVisitFlag = this.computedVisit(item);
- item.computedReceiveFlag = this.computedReceive(item);
- item.computedHandleFlag = this.computedHandle(item);
- item.computedSubstitutionFlag = this.computedSubstitution(item);
- item.computedPostponeFlag = this.computedPostpone(item);
- item.computedSetDutyFlag = this.computedSetDuty(item);
- });
- this.listOfData = list;
- this.listLength = result.totalNum;
- });
-
- this.getCount(postData.incident);
- }
-
- getCount = function (incident = {}){
- let postData = {
- incidentList: [],
- }
- this.tabs.forEach(v => {
- postData.incidentList.push({...incident, ...{queryTask: v.key}});
- })
- postData.incidentList.forEach(incident => {
-
- if(!incident){
- incident = {};
- }
- if(incident.queryTask === 'all' || incident.queryTask === 'callback' || incident.queryTask === 'badEvaluate'){
- let { hospital, type } = this.tool.getHospitalOrDuty();
- if(type === 'duty'){
-
- incident.duty = hospital;
- }else{
-
- incident.hosId = hospital.id;
- }
- }else{
- delete incident.duty;
- delete incident.hosId;
- }
- if(incident.queryTask!='todo' && incident.queryTask!='doing' && incident.queryTask!='storage'){
- if(this.searchDTO.maintainDepartment){
- let itemDept = this.maintainDept.find(i=>i.id == this.searchDTO.maintainDepartment)
- incident.duty = itemDept;
- delete incident.hosId;
- }
- }
- incident.assignee = this.tool.getCurrentUserId();
- if(incident.queryTask === 'todo' || incident.queryTask === 'owns'){
- incident.candidateGroups = this.tool.getCurrentGroupList().map(v => v.id).toString();
- }else{
- delete incident.candidateGroups;
- }
- if(incident.queryTask!='todo' && incident.queryTask!='owns' && incident.queryTask!='storage' && incident.queryTask!='doing' && incident.queryTask!='reassign'){
- incident.candidateGroupId = this.searchDTO.maintainGroup
- }else{
- delete incident.candidateGroupId;
- }
- })
- this.mainService
- .getCount(postData)
- .subscribe((result) => {
- let myData = result.data || {};
- this.tabs.forEach(v => {
- v.num = myData[v.key];
- })
- });
- }
-
- getDeparts(dept?) {
- let data = {
- department: {
- searchType: 1,
- cascadeHosId: this.searchDTO.maintainDepartment?this.searchDTO.maintainDepartment:this.tool.getCurrentHospital().id,
- dept: dept,
- },
- idx: 0,
- sum: 20,
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("data", "department", data)
- .subscribe((data) => {
- this.alldepart = data.list;
- this.isLoading = false;
- });
- }
-
- getGdStates() {
- this.mainService.getDictionary("list", "incident_status").subscribe((data) => {
- this.gdStates = data || [];
- });
- }
-
- getOverdueStates() {
- this.mainService.getDictionary("list", "overdue_state").subscribe((data) => {
- this.overdueStates = data || [];
- });
- }
-
- getSourceList() {
- this.mainService.getDictionary("list", "incident_source").subscribe((data) => {
- this.sourceList = data || [];
- });
- }
-
- showPromptModal(con, success, promptInfo?) {
- this.promptModalShow = false;
- this.promptContent = con;
- this.ifSuccess = success;
- this.promptInfo = promptInfo;
- setTimeout(() => {
- this.promptModalShow = true;
- }, 100);
- this.loading1 = true;
- this.debounceSubject.next(false);
- }
-
- setdutyModalShow = false;
- setDuty(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.setdutyModalShow = true;
- }
-
- closeSetdutyModelOrder(e) {
- this.setdutyModalShow = JSON.parse(e).show;
- }
-
- confirmSetdutyModelOrder(e){
- console.log(e);
- this.setdutyModalShow = false;
- this.getList(true);
- }
-
- editModalShow = false;
- edit(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.editModalShow = true;
- }
-
- closeEditModelOrder(e) {
- this.editModalShow = JSON.parse(e).show;
- }
-
- confirmEditModelOrder(e){
- console.log(e);
- this.editModalShow = false;
- this.getList(true);
- }
-
- visitModalShow = false;
- visit(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.visitModalShow = true;
- }
-
- closeVisitModelOrder(e) {
- this.visitModalShow = JSON.parse(e).show;
- }
-
- confirmVisitModelOrder(e){
- console.log(e);
- this.visitModalShow = false;
- this.getList(true);
- }
-
- detailModalShow = false;
- detail(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.detailModalShow = true;
- }
-
- closeDetailModelOrder(e) {
- this.detailModalShow = JSON.parse(e).show;
- }
-
- confirmDetailModelOrder(e){
- console.log(e);
- this.detailModalShow = false;
- this.getList(true);
- }
-
- viewInspectionDetail(e, id) {
- e.stopPropagation();
- this.router.navigateByUrl("/main/incidentManagement/inspectionExecuteDetail/" + id);
- }
-
- postponeModalShow = false;
- postpone(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.postponeModalShow = true;
- }
-
- closePostponeModelOrder(e) {
- this.postponeModalShow = JSON.parse(e).show;
- }
-
- confirmPostponeModelOrder(e){
- console.log(e);
- this.postponeModalShow = false;
- this.getList(true);
- }
- delModal: boolean = false;
- tipsMsg1: string;
- tipsMsg2: string;
- confirmDelType: string;
- showDelModal(
- e,
- data,
- tipsMsg1: string,
- tipsMsg2: string,
- type: string,
- ) {
- e.stopPropagation();
- this.confirmDelType = type;
- this.delModal = true;
- this.coopData = data;
- this.tipsMsg1 = tipsMsg1;
- this.tipsMsg2 = tipsMsg2;
- }
-
- hideDelModal() {
- this.delModal = false;
- }
-
- confirmDel() {
- this.btnLoading = true;
- if (this.confirmDelType === "del") {
-
- this.mainService
- .simplePost("rmvData", "incident", [this.coopData.id])
- .subscribe((data) => {
- this.btnLoading = false;
- this.delModal = false;
- if (data.status == 200) {
- this.showPromptModal(this.tipsMsg2, true, "");
- } else {
- this.showPromptModal(this.tipsMsg2, false, data.msg);
- }
- });
- }else if (this.confirmDelType === "receive") {
-
- this.mainService
- .flowPost("incident/task/receive", { incident: this.coopData })
- .subscribe((data) => {
- this.btnLoading = false;
- this.delModal = false;
- if (data.state == 200) {
- this.showPromptModal(this.tipsMsg2, true, "");
- } else {
- this.showPromptModal(this.tipsMsg2, false, data.msg);
- }
- });
- }
- }
-
- loading2 = false;
- export() {
- let postData: any = {
- idx: 0,
- sum: 99999,
- incident: {
- assignee: this.tool.getCurrentUserId(),
- acceptDate: (this.searchDTO.dateRange && this.searchDTO.dateRange[0]) ? format(this.searchDTO.dateRange[0], 'yyyy-MM-dd HH:mm:ss') : undefined,
- acceptDateEnd: (this.searchDTO.dateRange && this.searchDTO.dateRange[1]) ? format(this.searchDTO.dateRange[1], 'yyyy-MM-dd HH:mm:ss') : undefined,
- incidentsign: this.searchDTO.incidentsign,
- department: this.searchDTO.department ? { id: this.searchDTO.department } : undefined,
- statusId: this.searchDTO.statusId || undefined,
- todoingUser: this.searchDTO.todoingUser ? { id: this.searchDTO.todoingUser } : undefined,
- levelCategory: this.validateSearchForm.value.levelCategory ? { id: this.validateSearchForm.value.levelCategory } : undefined,
- acceptUser: this.validateSearchForm.value.acceptUser ? { id: this.validateSearchForm.value.acceptUser } : undefined,
- selectType: this.validateSearchForm.value.selectType || undefined,
- source: this.validateSearchForm.value.sourceValue ? { value: this.validateSearchForm.value.sourceValue } : undefined,
- deleteFlag: this.validateSearchForm.value.deleteFlag,
- candidateGroupId: undefined
- },
- };
- if(this.queryTask === 'all' || this.queryTask === 'callback' || this.queryTask === 'badEvaluate'){
- let { hospital, type } = this.tool.getHospitalOrDuty();
- if(type === 'duty'){
-
- postData.incident.duty = hospital;
- }else{
-
- postData.incident.hosId = hospital.id;
- }
- }else{
- delete postData.incident.duty;
- delete postData.incident.hosId;
- }
- if(this.queryTask!='todo' && this.queryTask!='doing' && this.queryTask!='storage'){
- if(this.searchDTO.maintainDepartment){
- let itemDept = this.maintainDept.find(i=>i.id == this.searchDTO.maintainDepartment)
- postData.incident.duty = itemDept;
- delete postData.incident.hosId;
- }
- }
- if(this.queryTask!='todo' && this.queryTask!='owns' && this.queryTask!='storage'){
- postData.incident.candidateGroupId = this.searchDTO.maintainGroup
- }else{
- delete postData.incident.candidateGroupId;
- }
- postData.incident.queryTask = this.queryTask;
- if(this.queryTask === 'todo' || this.queryTask === 'owns'){
- postData.incident.candidateGroups = this.tool.getCurrentGroupList().map(v => v.id).toString();
- }else{
- delete postData.incident.candidateGroups;
- }
- this.loading2 = true;
- this.mainService.downDataModel(postData).subscribe(
- (data) => {
- this.loading2 = false;
- this.showPromptModal("导出", true, "");
- var file = new Blob([data], {
- type: "application/vnd.ms-excel",
- });
-
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement("a");
- a.href = fileURL;
- a.target = "_blank";
- a.download = "故障工单.xls";
- document.body.appendChild(a);
- a.click();
- },
- (err) => {
- this.loading2 = false;
- this.showPromptModal("导出", false, "");
- }
- );
- }
-
- isLoading = false;
- changeInp(e) {
- this.searchTimer(this.getDeparts, e);
- }
-
- changeUser(e, type) {
- this.searchTimer(this.getUsers, e, type);
- }
-
- searchTimer(fun, e, type?) {
- this.isLoading = true;
- this.searchTimerSubject.next([fun, e, type]);
- }
-
- searchModal: boolean = false;
- modelName = "";
- validateSearchForm: FormGroup;
- coopData: any = {};
-
- showSearchModal() {
- this.modelName = "详细搜索";
- this.searchModal = true;
- }
-
- hideSearchModal() {
- this.searchModal = false;
- }
-
- submitSearchModal(){
- this.searchModal = false;
- this.getList(true);
- }
-
- initSearchForm() {
- this.validateSearchForm = this.fb.group({
- levelCategory: [null],
- acceptUser: [null],
- selectType: [null],
- deleteFlag: [0],
- sourceValue: [null],
- });
- }
-
- submitForm(): void {
- for (const i in this.validateSearchForm.controls) {
- this.validateSearchForm.controls[i].markAsDirty();
- this.validateSearchForm.controls[i].updateValueAndValidity();
- }
- if (this.validateSearchForm.invalid) {
- return;
- }
- console.log(this.validateSearchForm.value)
- this.loading1 = true;
- this.debounceSubject.next(true);
- }
-
- handleModalShow = false;
- handle(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.handleModalShow = true;
- }
-
- closeHandleModelOrder(e) {
- this.handleModalShow = JSON.parse(e).show;
- }
-
- confirmHandleModelOrder(e){
- console.log(e);
- this.handleModalShow = false;
- this.getList(true);
- }
-
- substitutionModalShow = false;
- substitution(e, data) {
- e.stopPropagation();
- this.coopData = data;
- this.substitutionModalShow = true;
- }
-
- closeSubstitutionModelOrder(e) {
- this.substitutionModalShow = JSON.parse(e).show;
- }
-
- confirmSubstitutionModelOrder(e){
- console.log(e);
- this.substitutionModalShow = false;
- this.getList(true);
- }
- }
|