瀏覽代碼

fix: 修复bug

wyf 7 月之前
父節點
當前提交
0676fa91f3

+ 6 - 4
src/views/traffic/regulation/Regulation.vue

@@ -18,15 +18,13 @@
 </template>
 
 <script setup lang="ts">
-  import { ref, computed, defineAsyncComponent } from 'vue';
+  import { ref, computed, defineAsyncComponent, onUnmounted } from 'vue';
   import { TRAFFIC_REGULATION_SUBPAGES } from './constants';
   import { useRoute } from 'vue-router';
 
   const route = useRoute();
 
-  const subpage = route.query.subpage as string;
-
-  const activeName = ref(subpage || TRAFFIC_REGULATION_SUBPAGES[0].value);
+  const activeName = ref(sessionStorage.getItem('traffic-regulation-active') || TRAFFIC_REGULATION_SUBPAGES[0].value);
 
   const dynamicComponent = computed(() => {
     switch (activeName.value) {
@@ -36,6 +34,10 @@
         return defineAsyncComponent(() => import('./components/NoticeTable.vue'));
     }
   });
+
+  onUnmounted(() => {
+    sessionStorage.setItem('traffic-regulation-active', activeName.value);
+  });
 </script>
 
 <style scoped lang="scss">

+ 12 - 2
src/views/traffic/regulation/components/NoticeTable.vue

@@ -2,7 +2,13 @@
   <div class="search-table-container">
     <header>
       <!-- 按钮 -->
-      <el-button type="primary" class="search-table-container--button" :icon="Plus" @click="handleCreateNotice">
+      <el-button
+        v-if="trafficManagementPermission"
+        type="primary"
+        class="search-table-container--button"
+        :icon="Plus"
+        @click="handleCreateNotice"
+      >
         新建管理通知
       </el-button>
 
@@ -83,7 +89,10 @@
           <ActionButton
             v-if="trafficManagementPermission && scope.row.effectState === 1"
             text="撤回"
-            @click="
+            :popconfirm="{
+              title: '确定要撤回吗?',
+            }"
+            @confirm="
               handleChangeNoticeState({
                 id: scope.row.id,
                 managementType: 2,
@@ -106,6 +115,7 @@
         </div>
       </template>
     </BasicTable>
+    <PreviewOnline ref="previewOnlineRef" />
   </div>
 </template>
 

+ 12 - 3
src/views/traffic/regulation/components/RegulationTable.vue

@@ -2,7 +2,13 @@
   <div class="search-table-container">
     <header>
       <!-- 按钮 -->
-      <el-button type="primary" class="search-table-container--button" :icon="Plus" @click="handleCreateRegulation">
+      <el-button
+        v-if="trafficManagementPermission"
+        type="primary"
+        class="search-table-container--button"
+        :icon="Plus"
+        @click="handleCreateRegulation"
+      >
         新建管理规定
       </el-button>
 
@@ -77,7 +83,10 @@
           <ActionButton
             v-if="scope.row.effectState === 1"
             text="撤回"
-            @click="
+            :popconfirm="{
+              title: '确定要撤回吗?',
+            }"
+            @confirm="
               handleChangeRegulationState({
                 id: scope.row.id,
                 managementType: 1,
@@ -143,7 +152,7 @@
 
   // 表格
   const { tableConfig, pagination } = useTableConfig(
-    trafficManagementPermission ? REGULATION_TABLE_COLUMNS : REGULATION_TABLE_COLUMNS_CHECKONLY,
+    trafficManagementPermission.value ? REGULATION_TABLE_COLUMNS : REGULATION_TABLE_COLUMNS_CHECKONLY,
     TABLE_OPTIONS,
   );
 

+ 4 - 6
src/views/traffic/regulation/configs/form.ts

@@ -27,8 +27,7 @@ export const REGULATION_FORM_CONFIG: FormConfig[] = [
     component: 'ElInput',
     componentProps: {
       type: 'textarea',
-      rows: 5,
-      maxlength: 1000,
+      autosize: { minRows: 3 },
       showWordLimit: true,
     },
   },
@@ -52,7 +51,7 @@ export const REGULATION_FORM_DATA = {
 
 export const REGULATION_FORM_RULES = {
   name: [{ required: true, message: '请输入管理规定的标题', trigger: 'blur' }],
-  regulationFiles: [{ required: true, message: '请上传规定文件', trigger: 'change' }],
+  attachment: [{ required: true, message: '请上传规定文件', trigger: 'change' }],
   isPush: [{ required: true, message: '请选择是否推送', trigger: 'change' }],
 };
 
@@ -73,7 +72,7 @@ export const NOTICE_FORM_CONFIG: FormConfig[] = [
     component: 'ElInput',
     componentProps: {
       type: 'textarea',
-      rows: 5,
+      autosize: { minRows: 3 },
       maxlength: 1000,
       showWordLimit: true,
     },
@@ -94,8 +93,7 @@ export const NOTICE_FORM_CONFIG: FormConfig[] = [
     component: 'ElInput',
     componentProps: {
       type: 'textarea',
-      rows: 5,
-      maxlength: 1000,
+      autosize: { minRows: 3 },
       showWordLimit: true,
     },
   },