Quellcode durchsuchen

组织同步分包商,整改

zhuang vor 1 Jahr
Ursprung
Commit
1ec845cd2f
1 geänderte Dateien mit 28 neuen und 3 gelöschten Zeilen
  1. 28 3
      src/app/routes/sys/rw-org/list/list.component.ts

+ 28 - 3
src/app/routes/sys/rw-org/list/list.component.ts

@@ -6,6 +6,7 @@ import { ALAIN_I18N_TOKEN, ModalHelper } from '@delon/theme';
 import { NzSafeAny } from 'ng-zorro-antd/core/types';
 import { NzNotificationService } from 'ng-zorro-antd/notification';
 import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree';
+import { forkJoin } from 'rxjs';
 
 import { PopupSelectPanelComponent } from '../../../../shared/component/popup-select/popup-select-panel';
 import {icDeepCopy} from "@shared";
@@ -188,15 +189,39 @@ export class SysRwOrgListComponent implements OnInit {
         }
         const data = this.selectedNode.origin;
         const pData = this.selectedNode.parentNode.origin;
+        const reqs = [];
         if (data.orgtype == '10') {
           const updateSql = `update ZHCX_SUBCONTRACTOR_MANAGE_UNIT
                              set WORKSHOP_NAME       = '${pData.fullname}/${data.fullname}',
                                  WORKSHOP_SHORT_NAME = '${data.shortname}'
                              WHERE WORKSHOP_ID = '${data.id}'`;
-          this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateSql }).subscribe(res => {
-            console.log('同步分包商成功...');
-          });
+          const updateRectifyDeptSql = `update ZHCX_PROJECT_RECTIFY_MACHINE
+                             set DEPTNAME = '${data.shortname}'
+                             WHERE DEPTID = '${data.id}'`;
+          const updateRectifyDutyDeptSql = `update ZHCX_PROJECT_RECTIFY_MACHINE
+                             set DUTYDEPTNAME = '${data.shortname}'
+                             WHERE DUTYDEPTID = '${data.id}'`;
+          reqs.push(this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateSql }));
+          reqs.push(this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateRectifyDeptSql }));
+          reqs.push(this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateRectifyDutyDeptSql }));
+          // this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateSql }).subscribe(res => {
+          //   console.log('同步分包商成功...');
+          // });
+        } else if (data.orgtype == '20') {
+          const updateRectifyFirstDeptSql = `update ZHCX_PROJECT_RECTIFY_MACHINE
+                             set FIRSTDEPTNAME = '${data.shortname}'
+                             WHERE FIRSTDEPTID = '${data.id}'`;
+          const updateRectifyFirstDutyDeptSql = `update ZHCX_PROJECT_RECTIFY_MACHINE
+                             set FIRSTDUTYDEPTNAME = '${data.shortname}'
+                             WHERE FIRSTDUTYDEPTID = '${data.id}'`;
+          reqs.push(this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateRectifyFirstDeptSql }));
+          reqs.push(this.http.getPostData(`inControlServer/sys/generalCRUD/getDataBySql`, { querySql: updateRectifyFirstDutyDeptSql }));
         }
+        forkJoin(reqs).subscribe((res: any[]) => {
+          res.forEach((v: NzSafeAny) => {
+            console.log('同步分包商,整改清单成功...');
+          });
+        });
       }
     });
   }