Sfoglia il codice sorgente

Merge branch 'dev-wyf' into 'dev'

fix: 交通修改追加

See merge request product-group-fe/sfy-safety-group/sfy-safety!208
ai0197 7 mesi fa
parent
commit
359ee8cc76

+ 27 - 21
src/views/traffic/accident/components/ManageAccidentItem.vue

@@ -213,29 +213,35 @@
   const disabledDate = (time: Date) => {
     return time.getTime() > Date.now();
   };
-  const disabledHours = () => {
-    const arrs: number[] = [];
-    for (let i = 0; i < 24; i++) {
-      if (new Date().getHours() >= i) continue;
-      arrs.push(i);
-    }
-    return arrs;
+  const disabledHours = (role, comparingDate) => {
+    if (!role) return [];
+    const now = new Date();
+    now.setHours(0, 0, 0, 0);
+    if (comparingDate.valueOf() < now.getTime()) return [];
+    const huors = 23 - new Date().getHours();
+    return Array.from({ length: huors }, (_, i) => 23 - i);
   };
-  const disabledMinutes = () => {
-    const arrs: number[] = [];
-    for (let i = 0; i < 60; i++) {
-      if (new Date().getMinutes() >= i) continue;
-      arrs.push(i);
-    }
-    return arrs;
+  const disabledMinutes = (hour, role, comparingDate) => {
+    if (!role) return [];
+    const now = new Date();
+    const nowHour = now.getHours();
+    if (hour < nowHour) return [];
+    now.setHours(0, 0, 0, 0);
+    if (comparingDate.valueOf() < now.getTime()) return [];
+    const minutes = 59 - new Date().getMinutes();
+    return Array.from({ length: minutes }, (_, i) => 59 - i);
   };
-  const disabledSeconds = () => {
-    const arrs: number[] = [];
-    for (let i = 0; i < 60; i++) {
-      if (new Date().getSeconds() >= i) continue;
-      arrs.push(i);
-    }
-    return arrs;
+  const disabledSeconds = (hour, minute, role, comparingDate) => {
+    if (!role) return [];
+    const now = new Date();
+    const nowHour = now.getHours();
+    const nowMinutes = now.getMinutes();
+    if (hour < nowHour) return [];
+    if (hour === nowHour && minute < nowMinutes) return [];
+    now.setHours(0, 0, 0, 0);
+    if (comparingDate.valueOf() < now.getTime()) return [];
+    const seconds = 59 - new Date().getSeconds();
+    return Array.from({ length: seconds }, (_, i) => 59 - i);
   };
 
   const handleAccidentTimeChange = () => {

+ 2 - 1
src/views/traffic/violation/act/Act.vue

@@ -245,6 +245,7 @@
     searchData.isNotice = undefined;
     searchData.violateType = undefined;
     searchData.searchTime = undefined;
+    handleSearch();
   }
 
   async function handleDownload() {
@@ -265,7 +266,7 @@
   const basicTableRef = ref<InstanceType<typeof BasicTable>>();
 
   const { tableConfig, pagination } = useTableConfig(
-    actManagementPermission ? VIOLATION_ACT_TABLE_COLUMNS : VIOLATION_ACT_TABLE_COLUMNS_CHECKONLY,
+    actManagementPermission.value ? VIOLATION_ACT_TABLE_COLUMNS : VIOLATION_ACT_TABLE_COLUMNS_CHECKONLY,
     TABLE_OPTIONS,
   );
 

+ 1 - 1
src/views/traffic/violation/act/components/ActEdit.vue

@@ -46,7 +46,7 @@
       </template>
       <template #capturePhotos>
         <UploadImages
-          :maxCount="9"
+          :maxCount="5"
           ref="uploadImagesRef"
           :image-list="imageList"
           @upload-success="handleUploadChange"

+ 30 - 0
src/views/traffic/violation/act/configs/form.ts

@@ -36,6 +36,36 @@ export const ACT_FORM_CONFIG: FormConfig[] = [
       timeFormat: 'HH:mm:ss',
       valueFormat: 'YYYY-MM-DD HH:mm:ss',
       disabledDate: (time) => time.getTime() > Date.now(),
+      disabledHours: (role, comparingDate) => {
+        if (!role) return [];
+        const now = new Date();
+        now.setHours(0, 0, 0, 0);
+        if (comparingDate.valueOf() < now.getTime()) return [];
+        const huors = 23 - new Date().getHours();
+        return Array.from({ length: huors }, (_, i) => 23 - i);
+      },
+      disabledMinutes: (hour, role, comparingDate) => {
+        if (!role) return [];
+        const now = new Date();
+        const nowHour = now.getHours();
+        if (hour < nowHour) return [];
+        now.setHours(0, 0, 0, 0);
+        if (comparingDate.valueOf() < now.getTime()) return [];
+        const minutes = 59 - new Date().getMinutes();
+        return Array.from({ length: minutes }, (_, i) => 59 - i);
+      },
+      disabledSeconds: (hour, minute, role, comparingDate) => {
+        if (!role) return [];
+        const now = new Date();
+        const nowHour = now.getHours();
+        const nowMinutes = now.getMinutes();
+        if (hour < nowHour) return [];
+        if (hour === nowHour && minute < nowMinutes) return [];
+        now.setHours(0, 0, 0, 0);
+        if (comparingDate.valueOf() < now.getTime()) return [];
+        const seconds = 59 - new Date().getSeconds();
+        return Array.from({ length: seconds }, (_, i) => 59 - i);
+      },
     },
   },
   {

+ 1 - 0
src/views/traffic/violation/notice/Notice.vue

@@ -185,6 +185,7 @@
     searchData.isNotice = undefined;
     searchData.violateType = undefined;
     searchData.searchTime = undefined;
+    handleSearch();
   }
 
   async function handleDownload() {