Quellcode durchsuchen

适配新的法律法规和管理制度

wangqi vor 2 Wochen
Ursprung
Commit
5bb84271c8
3 geänderte Dateien mit 150 neuen und 90 gelöschten Zeilen
  1. 4
    1
      src/view/Home2.vue
  2. 49
    16
      src/view/institution/institutionRegime.vue
  3. 97
    73
      src/view/institution/law.vue

+ 4
- 1
src/view/Home2.vue Datei anzeigen

@@ -239,7 +239,10 @@ const handleClick = () => {
239 239
 const getRecentlyUsed = (jumpPath) => {
240 240
   const url = '/sgsafe/MenuRecentlyUsed/updateMenuRecentlyUsedStatus'
241 241
   const param = {
242
-    jumpPath
242
+    json: JSON.stringify({
243
+      jumpPath,
244
+      applicationId: 'c77da6a732d34400b24374e2cea811ee',
245
+    })
243 246
   }
244 247
   proxy.$axios.post(url,param).then(res => {
245 248
     if (res.data.code !== 0) {

+ 49
- 16
src/view/institution/institutionRegime.vue Datei anzeigen

@@ -1,10 +1,6 @@
1 1
 <script setup>
2
-import { getCurrentInstance, onMounted, ref } from 'vue';
3
-import { useRouter } from 'vue-router';
4
-
5
-const {
6
-  proxy
7
-} = getCurrentInstance()
2
+import { getCurrentInstance, ref } from 'vue';
3
+const { proxy } = getCurrentInstance()
8 4
 
9 5
 /* 通用方法: 重置list数据 */
10 6
 const basicReset = () => {
@@ -14,11 +10,9 @@ const basicReset = () => {
14 10
   list.value = []
15 11
 }
16 12
 
17
-/* 返回上一级页面 */
18
-const router = useRouter()
19
-
20 13
 /* 在线预览实现 */
21 14
 import {Base64} from "js-base64";
15
+import { showFailToast } from 'vant';
22 16
 const linShiFid=ref({
23 17
   fileId:''
24 18
 })
@@ -68,7 +62,8 @@ const total = ref(0)
68 62
 const resultData = ref([])
69 63
 const fetchData = ref({
70 64
   regimeName:'',
71
-  regimeScope: ''
65
+  regimeScope: '',
66
+  regimeType: 'safe'
72 67
 })
73 68
 
74 69
 const onSearch = async () => {
@@ -78,13 +73,18 @@ const onSearch = async () => {
78 73
 
79 74
 const resetCondition = async () => {
80 75
   basicReset()
81
-  fetchData.value = {
82
-    regimeName:'',
83
-    regimeScope: ''
84
-  }
76
+  fetchData.value.regimeName = ''
77
+  fetchData.value.regimeScope = ''
85 78
   await onLoad()
86 79
 }
87 80
 
81
+const currentTab = ref('safe');
82
+const handleClick = (tab) => {
83
+  currentTab.value = tab;
84
+  fetchData.value.regimeType = tab;
85
+  onRefresh();
86
+};
87
+
88 88
 /* 查询请求 */
89 89
 const queryFetch = async () => {
90 90
   fetchData.value.regimeScope = postBackRegimeScope.value
@@ -157,7 +157,6 @@ const showBottom = ref(false)
157 157
 const postBackRegimeScope = ref()
158 158
 const currentDeptName = ref('')
159 159
 import OrganizationalWithLeaf from '@/components/OrganizationalWithLeaf.vue';
160
-import { showFailToast } from 'vant';
161 160
 const showPickerHandle = () => {
162 161
   showBottom.value = true
163 162
 }
@@ -184,7 +183,18 @@ const getDeptInfo = (currentDeptInfo) => {
184 183
 <template>
185 184
   <div class="page-container">
186 185
     <van-sticky>
187
-      <van-nav-bar title="安全制度管理" />
186
+      <van-nav-bar
187
+        title="安全制度管理"
188
+        @click-left="handleClick('safe')"
189
+        @click-right="handleClick('env')"
190
+      >
191
+        <template #left>
192
+          <div class="custom-tab" :class="{ 'custom-tab--active': currentTab === 'safe' }">安全</div>
193
+        </template>
194
+        <template #right>
195
+          <div class="custom-tab" :class="{ 'custom-tab--active': currentTab === 'env' }">环保</div>
196
+        </template>
197
+      </van-nav-bar>
188 198
 
189 199
       <van-search
190 200
         v-model="fetchData.regimeName"
@@ -280,4 +290,27 @@ const getDeptInfo = (currentDeptInfo) => {
280 290
   color: #333;
281 291
 }
282 292
 
293
+.custom-tab {
294
+  padding: 8px 0;
295
+  font-size: 14px;
296
+  color: var(--van-gray-7, #646566);
297
+  position: relative;
298
+  cursor: pointer;
299
+}
300
+
301
+.custom-tab--active {
302
+  color: var(--van-primary-color, #1989fa);
303
+}
304
+
305
+.custom-tab--active::after {
306
+  content: '';
307
+  position: absolute;
308
+  bottom: 0;
309
+  left: 0;
310
+  width: 100%;
311
+  height: 3px;
312
+  background-color: var(--van-primary-color, #1989fa);
313
+  border-radius: 2px;
314
+}
315
+
283 316
 </style>

+ 97
- 73
src/view/institution/law.vue Datei anzeigen

@@ -1,65 +1,62 @@
1 1
 <script setup>
2
-import { getCurrentInstance, onActivated, onMounted, ref } from 'vue';
3
-import { onBeforeRouteUpdate, useRouter } from 'vue-router';
4
-import { useEmergencyStore } from '@/stores/emergencyManager.js';
5
-
6
-const emergencyInfo =  useEmergencyStore()
7
-const {
8
-  proxy
9
-} = getCurrentInstance()
2
+import { getCurrentInstance, ref } from 'vue';
3
+const { proxy } = getCurrentInstance();
10 4
 
11 5
 /* 通用方法: 重置list数据 */
12 6
 const basicReset = () => {
13 7
   finished.value = false;
14 8
   loading.value = true;
15
-  pageNum.value = 1
16
-  list.value = []
17
-}
18
-
19
-/* 返回上一级页面 */
20
-const router = useRouter()
9
+  pageNum.value = 1;
10
+  list.value = [];
11
+};
21 12
 
22 13
 /* 查询数据 */
23
-const pageNum = ref(1)
24
-const pageSize = ref(10)
25
-const total = ref(0)
26
-const resultData = ref([])
14
+const pageNum = ref(1);
15
+const pageSize = ref(10);
16
+const total = ref(0);
17
+const resultData = ref([]);
27 18
 const fetchData = ref({
28
-  lawName:''
29
-})
19
+  lawName: '',
20
+  lawType: 'safe'
21
+});
30 22
 
31 23
 const onSearch = () => {
32
-  basicReset()
33
-  onLoad()
34
-}
24
+  basicReset();
25
+  onLoad();
26
+};
35 27
 
36 28
 const resetCondition = () => {
37
-  basicReset()
38
-  fetchData.value = {
39
-    lawName:''
40
-  }
41
-  onLoad()
42
-}
29
+  basicReset();
30
+  fetchData.value.lawName = '';
31
+  onLoad();
32
+};
33
+
34
+const currentTab = ref('safe');
35
+const handleClick = (tab) => {
36
+  currentTab.value = tab;
37
+  fetchData.value.lawType = tab;
38
+  onRefresh();
39
+};
43 40
 
44 41
 /* 查询请求 */
45 42
 const queryFetch = async () => {
46
-  if (sessionStorage.getItem("lawName")) {
47
-    fetchData.value.lawName = sessionStorage.getItem("lawName")
48
-    sessionStorage.removeItem("lawName")
43
+  if (sessionStorage.getItem('lawName')) {
44
+    fetchData.value.lawName = sessionStorage.getItem('lawName');
45
+    sessionStorage.removeItem('lawName');
49 46
   }
50
-  const url = '/sgsafe/InstitutionLaw/query'
47
+  const url = '/sgsafe/InstitutionLaw/query';
51 48
   const param = {
52 49
     page: pageNum.value,
53 50
     rows: pageSize.value,
54 51
     params: JSON.stringify(fetchData.value)
55
-  }
52
+  };
56 53
   try {
57
-    const res = await proxy.$axios.post(url,param);
54
+    const res = await proxy.$axios.post(url, param);
58 55
     if (res.data.code === 0) {
59
-      total.value = res.data.data.total
60
-      resultData.value = res.data.data.records
56
+      total.value = res.data.data.total;
57
+      resultData.value = res.data.data.records;
61 58
     } else {
62
-      console.log('操作失败!' + res.data.msg)
59
+      console.log('操作失败!' + res.data.msg);
63 60
     }
64 61
   } catch (error) {
65 62
     console.error('请求出错:', error);
@@ -68,12 +65,12 @@ const queryFetch = async () => {
68 65
 
69 66
 /* 列表加载与下拉刷新 */
70 67
 const list = ref([]);
71
-const refreshing = ref(false)
72
-const loading = ref(false)
73
-const finished = ref(false)
68
+const refreshing = ref(false);
69
+const loading = ref(false);
70
+const finished = ref(false);
74 71
 
75 72
 const onRefresh = () => {
76
-  basicReset()
73
+  basicReset();
77 74
   onLoad();
78 75
 };
79 76
 
@@ -86,10 +83,10 @@ const onLoad = async () => {
86 83
   try {
87 84
     await queryFetch();
88 85
     if (pageSize.value * pageNum.value < total.value) {
89
-      list.value = [...list.value,...resultData.value ]
86
+      list.value = [...list.value, ...resultData.value];
90 87
       pageNum.value++;
91 88
     } else {
92
-      list.value = [...list.value,...resultData.value ]
89
+      list.value = [...list.value, ...resultData.value];
93 90
       finished.value = true;
94 91
     }
95 92
   } catch (error) {
@@ -101,27 +98,25 @@ const onLoad = async () => {
101 98
 };
102 99
 
103 100
 /* 在线预览实现 */
104
-import {Base64} from "js-base64";
101
+import { Base64 } from 'js-base64';
105 102
 import { showFailToast } from 'vant';
106
-const linShiFid=ref({
107
-  fileId:''
108
-})
103
+const linShiFid = ref({ fileId: '' });
109 104
 const handlePreview = (fileId) => {
110 105
   if (fetchData.value.lawName) {
111
-    sessionStorage.setItem("lawName", fetchData.value.lawName)
106
+    sessionStorage.setItem('lawName', fetchData.value.lawName);
112 107
   }
113
-  linShiFid.value.fileId= fileId
114
-  getTableDataQueryFile()
115
-}
116
-const bucket = ref(import.meta.env.VITE_BUCKET)
108
+  linShiFid.value.fileId = fileId;
109
+  getTableDataQueryFile();
110
+};
111
+const bucket = ref(import.meta.env.VITE_BUCKET);
117 112
 const getTableDataQueryFile = () => {
118
-  var url = 'framework/Common/queryFileWithValues'
119
-  var param = {
120
-    fId: linShiFid.value.fileId,
121
-  }
113
+  const url = 'framework/Common/queryFileWithValues';
114
+  let param = {
115
+    fId: linShiFid.value.fileId
116
+  };
122 117
   proxy.$axios.get(url, param).then(response => {
123
-    if (response.data.code == 0) {
124
-      const downloadPath = import.meta.env.VITE_BASE_API + '/framework/Common/downloadFileS3?bucket='+ bucket.value + '&id='
118
+    if (response.data.code === 0) {
119
+      const downloadPath = import.meta.env.VITE_BASE_API + '/framework/Common/downloadFileS3?bucket=' + bucket.value + '&id=';
125 120
       const fileListWithUrls = response.data.data.map(file => ({
126 121
         ...file,
127 122
         url: `${downloadPath}${file.id}`, // 添加完整的下载路径
@@ -131,23 +126,35 @@ const getTableDataQueryFile = () => {
131 126
         id: file.id
132 127
       }));
133 128
 
134
-      var originUrl = import.meta.env.VITE_PREVIEW_BASE_API + 'framework/Common/downloadFileS3?bucket=' + bucket.value +'&id=' + fileListWithUrls[0].id
135
-      var previewUrl = originUrl + '&fullfilename=' + Date.now() + fileListWithUrls[0].name
136
-      var url = import.meta.env.VITE_PREVIEW_API + 'onlinePreview?url=' + encodeURIComponent(Base64.encode(
137
-        previewUrl)) + '&officePreviewType=pdf'
129
+      let originUrl = import.meta.env.VITE_PREVIEW_BASE_API + 'framework/Common/downloadFileS3?bucket=' + bucket.value + '&id=' + fileListWithUrls[0].id;
130
+      let previewUrl = originUrl + '&fullfilename=' + Date.now() + fileListWithUrls[0].name;
131
+      let url = import.meta.env.VITE_PREVIEW_API + 'onlinePreview?url=' + encodeURIComponent(Base64.encode(
132
+        previewUrl)) + '&officePreviewType=pdf';
138 133
       window.open(url);
139 134
     } else {
140
-      showFailToast('失败!' + response.data.msg)
135
+      showFailToast('失败!' + response.data.msg);
141 136
     }
142
-  })
143
-}
137
+  });
138
+};
144 139
 
145 140
 </script>
146 141
 
147 142
 <template>
148 143
   <div class="page-container">
149 144
     <van-sticky>
150
-      <van-nav-bar title="法律法规" />
145
+      <van-nav-bar
146
+        title="法律法规"
147
+        @click-left="handleClick('safe')"
148
+        @click-right="handleClick('env')"
149
+      >
150
+        <template #left>
151
+          <div class="custom-tab" :class="{ 'custom-tab--active': currentTab === 'safe' }">安全</div>
152
+        </template>
153
+        <template #right>
154
+          <div class="custom-tab" :class="{ 'custom-tab--active': currentTab === 'env' }">环保</div>
155
+        </template>
156
+      </van-nav-bar>
157
+
151 158
       <van-search
152 159
         v-model="fetchData.lawName"
153 160
         @search="onSearch"
@@ -208,15 +215,32 @@ const getTableDataQueryFile = () => {
208 215
   background-color: #fff;
209 216
 }
210 217
 
211
-.label-content {
212
-  display: flex;
213
-  flex-direction: column;
214
-  gap: 4px;
215
-}
216
-
217 218
 .bold-title {
218 219
   font-weight: bold;
219 220
   color: #333;
220 221
 }
221 222
 
223
+.custom-tab {
224
+  padding: 8px 0;
225
+  font-size: 14px;
226
+  color: var(--van-gray-7, #646566);
227
+  position: relative;
228
+  cursor: pointer;
229
+}
230
+
231
+.custom-tab--active {
232
+  color: var(--van-primary-color, #1989fa);
233
+}
234
+
235
+.custom-tab--active::after {
236
+  content: '';
237
+  position: absolute;
238
+  bottom: 0;
239
+  left: 0;
240
+  width: 100%;
241
+  height: 3px;
242
+  background-color: var(--van-primary-color, #1989fa);
243
+  border-radius: 2px;
244
+}
245
+
222 246
 </style>

Laden…
Abbrechen
Speichern