Browse Source

feat: performance

Signed-off-by: Carlos <568187512@qq.com>
Carlos 6 days ago
parent
commit
e78042621d

+ 2 - 2
src/app/pages/manager/hazard/inspection-plan/detail/basic-info/basic-info.component.html

@@ -39,8 +39,8 @@
         </span>
       </div>
       <div class="field">
-        <label class="label">排查总人:</label>
-        <span class="value">3255人</span>
+        <label class="label">排查总人:</label>
+        <span class="value">{{ data.planTotalPeopleTimes ? data.planTotalPeopleTimes + '人次' : ' - ' }}</span>
       </div>
       <div class="field">
         <label class="label">本次排查主要工作目标:</label>

+ 2 - 3
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/detail-info.component.ts

@@ -60,9 +60,7 @@ export class DetailInfoComponent {
     private message: NzMessageService
   ) {}
 
-  ngOnInit() {
-    this.setTurn();
-  }
+  ngOnInit() {}
   ngOnChanges(changes: SimpleChanges) {
     if (changes['data']) {
       this.departmentOptions = this.basic.departments
@@ -74,6 +72,7 @@ export class DetailInfoComponent {
       ) {
         this.currentDepartment = this.departmentOptions[0]?.value || -1;
       }
+      this.setTurn();
       this.setRounds();
       this.setFillable();
     }

+ 5 - 4
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/round-edit-form/round-edit-form.component.html

@@ -23,15 +23,15 @@
         />
         <span class="action-cell">
           @if (!item.isEditing) {
-            <span class="text-gray-400 opacity-80 cursor-pointer hover:text-primary" (click)="item.isEditing = true">
+            <span class="text-primary opacity-80 cursor-pointer hover:opacity-100" (click)="item.isEditing = true">
               <!-- <i nz-icon nzType="edit" nzTheme="outline"></i> -->
               编辑
             </span>
-            <span class="text-gray-400 opacity-80 cursor-pointer hover:text-primary ml-4" (click)="onCopy(item)">
+            <span class="text-primary opacity-80 cursor-pointer hover:opacity-100 ml-4" (click)="onCopy(item)">
               <!-- <i nz-icon nzType="copy" nzTheme="outline"></i> -->
               复制
             </span>
-            <span class="text-gray-400 opacity-80 cursor-pointer hover:text-red-400 ml-4" (click)="onDelete(item)">
+            <span class="text-red-400 opacity-80 cursor-pointer hover:opacity-100 ml-4" (click)="onDelete(item)">
               <!-- <i nz-icon nzType="delete" nzTheme="outline"></i> -->
               删除
             </span>
@@ -39,7 +39,8 @@
             @if (item.isNew) {
               <span class="text-emerald-400 cursor-pointer hover:text-emerald-500" (click)="onAdd(index)">
                 <!-- <i nz-icon nzType="plus" nzTheme="outline"></i> -->
-                新增
+                <!-- 新增 -->
+                确认
               </span>
             } @else {
               <span class="text-emerald-400 cursor-pointer hover:text-emerald-500" (click)="onSave(index)">

+ 1 - 3
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/round-edit-form/task-form/task-form.component.html

@@ -34,9 +34,7 @@
       >
       </risk-item-picker>
       <div class="text-sm text-gray-500 px-4 pt-2">
-        @for (item of riskItemList; track item.id) {
-          <risk-item-visual class="mb-1" [data]="item"></risk-item-visual>
-        }
+        <risk-items-visual-classify [data]="riskItemList"></risk-items-visual-classify>
 
         @if (riskItemList.length === 0) {
           <div class="text-blue-500">未选择</div>

+ 2 - 2
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/round-edit-form/task-form/task-form.component.ts

@@ -14,12 +14,12 @@ import { KnowledgeService } from './../../../../../../../../services/knowledge.s
 import { SettingService } from './../../../../../../../../services/setting.service';
 import { ComposePositionPickModalComponent } from './../../../../../../../../shared/compose-position-pick-modal/compose-position-pick-modal.component';
 import { RiskItemPickerComponent } from './../../../../../../../../shared/risk-item-picker/risk-item-picker.component';
-import { RiskItemVisualComponent } from './../../../../../../../../shared/risk-item-picker/risk-item-visual/risk-item-visual.component';
+import { RiskItemsVisualClassifyComponent } from './../../../../../../../../shared/risk-item-picker/risk-items-visual-classify/risk-items-visual-classify.component';
 
 @Component({
   selector: 'task-form',
   standalone: true,
-  imports: [CommonNzModule, RiskItemPickerComponent, RiskItemVisualComponent],
+  imports: [CommonNzModule, RiskItemPickerComponent, RiskItemsVisualClassifyComponent],
   templateUrl: './task-form.component.html',
   styleUrl: './task-form.component.less',
 })

+ 3 - 3
src/app/shared/compose-position-pick-modal/compose-position-pick-modal.component.less

@@ -92,10 +92,10 @@
       }
     }
     &.active {
-      background: rgba(255, 255, 255, 0.05) rgba(85, 147, 255, 0.1);
-      box-shadow: inset 0px 0px 12px 0px rgba(25, 108, 251, 0.8);
+      // background: rgba(255, 255, 255, 0.05) rgba(85, 147, 255, 0.1);
+      // box-shadow: inset 0px 0px 12px 0px rgba(25, 108, 251, 0.8);
       border-radius: 0px 0px 0px 0px;
-      border: 1px solid rgba(85, 147, 255, 1);
+      // border: 1px solid rgba(85, 147, 255, 1);
       &:first-child {
         border-radius: 4px 0px 0px 4px;
       }

+ 5 - 3
src/app/shared/risk-item-picker/modal/modal.component.html

@@ -12,9 +12,10 @@
           [(ngModel)]="type"
           nzAllowClear
           nzPlaceHolder="过滤风险类别"
+          [nzOptions]="typeOptions"
           (ngModelChange)="onTypeChange($event)"
         >
-          <nz-option *ngFor="let type of types" [nzValue]="type.id" [nzLabel]="type.value"> </nz-option>
+          <!-- <nz-option *ngFor="let type of types" [nzValue]="type.id"  [nzLabel]="type.value"> </nz-option> -->
         </nz-select>
       </div>
       <div class="flex flex-1 items-center pl-2">
@@ -25,10 +26,11 @@
           [(ngModel)]="category"
           nzPlaceHolder="过滤风险项"
           nzAllowClear
+          [nzOptions]="filteredCategories"
           (ngModelChange)="onCategoryChange($event)"
         >
-          <nz-option *ngFor="let category of filteredCategories" [nzValue]="category.id" [nzLabel]="category.value">
-          </nz-option>
+          <!-- <nz-option *ngFor="let category of filteredCategories" [nzValue]="category.id" [nzLabel]="category.value">
+          </nz-option> -->
         </nz-select>
       </div>
       <div class="flex-1 pl-2">

+ 25 - 3
src/app/shared/risk-item-picker/modal/modal.component.ts

@@ -1,5 +1,6 @@
 import { Component, inject } from '@angular/core';
 import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal';
+import { NzSelectOptionInterface } from 'ng-zorro-antd/select';
 import { horizontalInOut } from '../../../common.animation';
 import { KnowledgeService } from '../../../services/knowledge.service';
 import { CommonNzModule } from './../../../common.nz.module';
@@ -27,13 +28,23 @@ export class RiskItemPickerModalComponent {
   readonly nzModalData: RiskItemPickerModalData = inject(NZ_MODAL_DATA);
   category?: number;
   type?: number;
-  filteredCategories: Knowledge.RiskCategoryDto[] = [];
+  filteredCategories: NzSelectOptionInterface[] = [];
   filteredItems: Knowledge.RiskItem[] = [];
   selectedItems: Knowledge.RiskItem[] = [];
   searchText = '';
   constructor(private knowledge: KnowledgeService) {}
 
   ngOnInit() {
+    this.typeOptions = this.types.map(t => ({
+      label: t.value,
+      value: t.id,
+      disabled: !this.items.some(p => p.type === t.id),
+    }));
+    this.categoryOptions = this.categories.map(c => ({
+      label: c.value,
+      value: c.id,
+      disabled: !this.items.some(p => p.category === c.id),
+    }));
     if (this.nzModalData.checkItemIds.length > 0) {
       this.selectedItems = this.items.filter(p => this.nzModalData.checkItemIds.includes(p.id));
     }
@@ -53,7 +64,11 @@ export class RiskItemPickerModalComponent {
       this.setFilteredItems();
       return;
     }
-    this.filteredCategories = typeDto.categories;
+    this.filteredCategories = typeDto.categories.map(c => ({
+      label: c.value,
+      value: c.id,
+      disabled: !this.items.some(p => p.category === c.id),
+    }));
     this.setFilteredItems();
   }
   onCategoryChange(value: number) {
@@ -92,7 +107,7 @@ export class RiskItemPickerModalComponent {
     if (this.filteredItems.length === 0) {
       return true;
     }
-    if (!this.category && !this.type && !this.searchText) {
+    if (this.isTotalSelecting && !this.category && !this.type && !this.searchText) {
       return true;
     }
     return false;
@@ -157,12 +172,19 @@ export class RiskItemPickerModalComponent {
   get types() {
     return this.nzModalData.types;
   }
+  typeOptions: NzSelectOptionInterface[] = [];
+  categoryOptions: NzSelectOptionInterface[] = [];
+
   get categories() {
     return this.nzModalData.categories;
   }
   get currentCategory() {
     return this.categories.find(c => c.id === this.category);
   }
+  get isTotalSelecting() {
+    // 列出系统中所有风险条目时  (不允许全选)
+    return this.filteredItems.length === this.knowledge.riskItems().length;
+  }
   // get categoryTypeIsStation() {
   //   return this.currentCategory?.name === '车站';
   // }

+ 1 - 0
src/types/hazard.d.ts

@@ -237,6 +237,7 @@ declare namespace Hazard {
   }
 
   interface InspectionPlanDetail extends InspectionPlan {
+    planTotalPeopleTimes?: number;
     plans: InspectionPlanRound[];
   }