Sfoglia il codice sorgente

联调交割库管理

KouJin 1 anno fa
parent
commit
6036f02d06

+ 12 - 14
src/layout/components/ToolHeader.vue

@@ -1,17 +1,11 @@
1 1
 <script lang="tsx">
2
-import { defineComponent, computed } from 'vue'
3
-import { Message } from '@/layout/components//Message'
4
-import { Collapse } from '@/layout/components/Collapse'
5
-import { UserInfo } from '@/layout/components/UserInfo'
6
-import { Screenfull } from '@/layout/components/Screenfull'
7
-import { Breadcrumb } from '@/layout/components/Breadcrumb'
8
-import { SizeDropdown } from '@/layout/components/SizeDropdown'
9
-import { LocaleDropdown } from '@/layout/components/LocaleDropdown'
10
-import RouterSearch from '@/components/RouterSearch/index.vue'
11
-import { useAppStore } from '@/store/modules/app'
12
-import { useDesign } from '@/hooks/web/useDesign'
13
-import { ThemeSwitch } from '@/layout/components/ThemeSwitch'
14
-const { getPrefixCls, variables } = useDesign()
2
+import {computed, defineComponent} from 'vue'
3
+import {UserInfo} from '@/layout/components/UserInfo'
4
+import {useAppStore} from '@/store/modules/app'
5
+import {useDesign} from '@/hooks/web/useDesign'
6
+import router from "@/router";
7
+
8
+const {getPrefixCls, variables} = useDesign()
15 9
 
16 10
 const prefixCls = getPrefixCls('tool-header')
17 11
 
@@ -86,7 +80,11 @@ export default defineComponent({
86 80
           ) : undefined}
87 81
           <ThemeSwitch />
88 82
             */}
89
-
83
+          <div class="mr-20px">
84
+            <span class="cursor-pointer" onClick={()=>router.push('/')}>版本</span>
85
+            &nbsp;&nbsp;  |  &nbsp;&nbsp;
86
+            <span class="cursor-pointer" onClick={()=>router.push('/')}>帮助</span>
87
+          </div>
90 88
 
91 89
           <UserInfo></UserInfo>
92 90
         </div>

+ 3 - 2
src/layout/components/useRenderLayout.tsx

@@ -8,6 +8,7 @@ import AppView from './AppView.vue'
8 8
 import ToolHeader from './ToolHeader.vue'
9 9
 import { ElScrollbar } from 'element-plus'
10 10
 import { useDesign } from '@/hooks/web/useDesign'
11
+import router from "@/router";
11 12
 
12 13
 const { getPrefixCls } = useDesign()
13 14
 
@@ -123,10 +124,10 @@ export const useRenderLayout = () => {
123 124
       <>
124 125
         <div class="relative headerBackImg flex items-center bg-[var(--top-header-bg-color)] layout-border__bottom dark:bg-[var(--el-bg-color)]">
125 126
           {/*{logo.value ? <Logo class="custom-hover"></Logo> : undefined}*/}
126
-           <div class="w-333px h-67px ml-20px title-logo">
127
+           <div onClick={()=>router.push('/')} class="cursor-pointer w-333px h-67px ml-20px title-logo">
127 128
                {/*<img  />*/}
128 129
            </div>
129
-          <ToolHeader class="flex-1"></ToolHeader>
130
+          <ToolHeader  class="flex-1"></ToolHeader>
130 131
         </div>
131 132
         <div class="absolute left-0 top-[var(--logo-height)] h-[calc(100%-var(--logo-height))] w-full flex">
132 133
           <Menu class="relative menuBackImg layout-border__right !h-full"></Menu>

+ 68 - 87
src/views/DeliveryWarehouse/DeliveryWarehouseList/index.vue

@@ -1,6 +1,5 @@
1 1
 <script lang="ts" setup>
2
-import {onMounted, onUnmounted, ref, watch} from 'vue'
3
-import {AdministrativeDivisionApi} from '@/api/system/administrativeDivision'
2
+import {onMounted, onUnmounted, ref} from 'vue'
4 3
 import {DeliveryWarehouseListApi} from "@/api/DeliveryWarehouse/DeliveryWarehouseList";
5 4
 import CreateForm from "@/views/DeliveryWarehouse/compontents/CreateForm.vue";
6 5
 import AddFinancialInformationForm
@@ -12,6 +11,7 @@ import {ElMessageBox} from "element-plus";
12 11
 import {DICT_TYPE} from "@/utils/dict";
13 12
 import {useCache} from "@/hooks/web/useCache";
14 13
 import FilesForm from "@/views/DeliveryWarehouse/compontents/FilesForm.vue";
14
+import {handleTree4} from "@/utils/tree";
15 15
 
16 16
 defineOptions({name: 'DeliveryWarehouseList'})
17 17
 
@@ -120,6 +120,11 @@ const handleSelectionChange = (selection: any) => {
120 120
  */
121 121
 const resetQuery = () => {
122 122
   queryParams.value.pageNo = 1
123
+  queryParams.value.areaCode = ''
124
+  queryParams.value.shengCode = ''
125
+  queryParams.value.shiCode = ''
126
+  queryParams.value.xianCode = ''
127
+  queryParams.value.areaLevel = ''
123 128
   refQueryForm.value.resetFields()
124 129
   handleQuery()
125 130
 }
@@ -151,7 +156,8 @@ const handleBack = async () => {
151 156
   try {
152 157
     await ElMessageBox.confirm('确认要退回的所选的库区?', '提示', {
153 158
       confirmButtonText: '确 认',
154
-      cancelButtonText: '取 消'
159
+      cancelButtonText: '取 消',
160
+      type: 'warning'
155 161
     })
156 162
     await DeliveryWarehouseListApi.revertKqxx({kqIds: selectRows.value.map((item) => item.kqId)})
157 163
     await handleQuery()
@@ -185,7 +191,7 @@ const openCreateForm = (type: string) => {
185 191
 const refFilesForm = ref();
186 192
 //打开附件信息的表单
187 193
 const openFilesForm = (row: any) => {
188
-  if(!row.fileIds){
194
+  if (!row.fileIds) {
189 195
     Message.warning('该库区没有附件!')
190 196
     return
191 197
   }
@@ -198,63 +204,66 @@ const openFilesForm = (row: any) => {
198 204
  * @param areaCode - 区域代码
199 205
  * @returns Promise<DivisionItem[]> 行政区划列表
200 206
  */
201
-const getDivision = async (areaCode?: string): Promise<DivisionItem[]> => {
202
-  try {
203
-    return await AdministrativeDivisionApi.getList({areaCode})
204
-  } catch (err) {
205
-    throw err
206
-  }
207
-}
208
-// 监听省份变化
209
-stopWatches.push(
210
-  watch(() => queryParams.value.shengCode, async (newValue) => {
211
-    queryParams.value.shiCode = ''
212
-    queryParams.value.xianCode = ''
213
-    if (newValue) {
214
-      shiList.value = await getDivision(newValue)
215
-    } else {
216
-      shiList.value = []
217
-    }
218
-  })
219
-)
220
-// 监听市区变化
221
-stopWatches.push(
222
-  watch(() => queryParams.value.shiCode, async (newValue) => {
223
-    queryParams.value.xianCode = ''
224
-    if (newValue) {
225
-      xianList.value = await getDivision(newValue)
226
-    } else {
227
-      xianList.value = []
228
-    }
229
-  })
230
-)
207
+
231 208
 const {wsCache} = useCache()
232
-const showSheng = ref(true)
209
+const areaList = ref([]);
210
+let division = []
233 211
 // 生命周期钩子:组件挂载时获取省份数据
234 212
 onMounted(async () => {
235
-  shengList.value = await getDivision();
236
-  const loginForm = wsCache.get('user')
237
-  console.log(loginForm, 'loginForm')
238
-  // const all = await  AdministrativeDivisionApi.getAll()
239
-  // console.log(all,'aaaaa')
240
-  if (loginForm.roles.includes('provincial_trading_center')) {
241
-    if (loginForm.user.areaLevel == 1) {
242
-      queryParams.value.shengCode = loginForm.user.areaCode
243
-      showSheng.value = false
244
-    }
245
-
246
-  }
213
+  const divisionAll = wsCache.get('divisionAll').map((item) => {
214
+    item.label = item.areaName
215
+    item.value = item.areaCode
216
+    return item
217
+  })
218
+  division = divisionAll
219
+  areaList.value = handleTree4(divisionAll);
247 220
   await handleQuery();
221
+  stopWatches.push(
222
+    watch(() => queryParams.value.areaCode, async (newValue, oldValue) => {
223
+      if (newValue && newValue != '') {
224
+        const temp = division.filter(item => item.areaCode == newValue)
225
+        if (temp && temp.length == 1) {
226
+          if (temp[0].areaLevel == 1) {
227
+            queryParams.value.shengCode = temp[0].areaCode
228
+            queryParams.value.areaLevel = temp[0].areaLevel
229
+            queryParams.value.shiCode = null
230
+            queryParams.value.xianCode = null
231
+          } else if (temp[0].areaLevel == 2) {
232
+            queryParams.value.shengCode = division.filter(item=>item.areaCode == temp[0].parentCode)[0].areaCode
233
+            queryParams.value.areaLevel = temp[0].areaLevel
234
+            queryParams.value.shiCode = newValue
235
+            queryParams.value.xianCode = null
236
+          } else if (temp[0].areaLevel == 3) {
237
+            const shi = division.filter(item => item.areaCode == temp[0].parentCode)[0]
238
+            queryParams.value.shengCode = division.filter(item => item.areaCode == shi.parentCode)[0].areaCode
239
+            queryParams.value.shiCode = shi.areaCode
240
+            queryParams.value.xianCode = newValue
241
+            queryParams.value.areaLevel = temp[0].areaLevel
242
+          } else {
243
+            queryParams.value.areaCode = ''
244
+            queryParams.value.shengCode = ''
245
+            queryParams.value.shiCode = ''
246
+            queryParams.value.xianCode = ''
247
+            queryParams.value.areaLevel = ''
248
+          }
249
+        }
250
+        console.log(temp, 'aaa')
251
+      }
252
+      else {
253
+        queryParams.value.areaCode = ''
254
+        queryParams.value.shengCode = ''
255
+        queryParams.value.shiCode = ''
256
+        queryParams.value.xianCode = ''
257
+        queryParams.value.areaLevel = ''
258
+      }
259
+    })
260
+  )
248 261
 })
249 262
 // 组件卸载时清理
250 263
 onUnmounted(() => {
251 264
   // 停止所有监听
252 265
   stopWatches.forEach(stop => stop())
253
-
254 266
   // 清空数据
255
-  shengList.value = []
256
-  shiList.value = []
257
-  xianList.value = []
258 267
   list.value = []
259 268
 })
260 269
 </script>
@@ -268,43 +277,15 @@ onUnmounted(() => {
268 277
       class="-mb-15px"
269 278
       label-width="68px"
270 279
     >
271
-      <el-form-item v-if="showSheng" label="所属省份" prop="shengCode">
272
-        <el-select
273
-
274
-          v-model="queryParams.shengCode"
275
-          class="!w-240px"
276
-          clearable
277
-          placeholder="所属省份">
278
-          <el-option
279
-            v-for="item in shengList" :key="item.id" :label="item.areaName"
280
-            :value="item.areaCode"/>
281
-
282
-        </el-select>
283
-
284
-      </el-form-item>
285
-      <el-form-item label="所属市区" prop="shiCode">
286
-        <el-select
287
-          v-model="queryParams.shiCode"
280
+      <el-form-item label="行政区划" prop="areaCode">
281
+        <el-tree-select
282
+          v-model="queryParams.areaCode"
283
+          :check-strictly="true"
284
+          :data="areaList"
288 285
           class="!w-240px"
289 286
           clearable
290
-          placeholder="所属市区">
291
-          <el-option
292
-            v-for="item in shiList" :key="item.id" :label="item.areaName"
293
-            :value="item.areaCode"/>
294
-
295
-        </el-select>
296
-      </el-form-item>
297
-      <el-form-item label="所属县区" prop="xianCode">
298
-        <el-select
299
-          v-model="queryParams.xianCode"
300
-          class="!w-240px"
301
-          clearable
302
-          placeholder="所属县区">
303
-          <el-option
304
-            v-for="item in xianList" :key="item.id" :label="item.areaName"
305
-            :value="item.areaCode"/>
306
-
307
-        </el-select>
287
+          filterable
288
+          placeholder="行政区划"/>
308 289
       </el-form-item>
309 290
       <el-form-item label="企业名称" prop="dwmc">
310 291
         <el-input
@@ -456,7 +437,7 @@ onUnmounted(() => {
456 437
     />
457 438
     <DeliveryWarehouseSelectFrom ref="refForm" @success="handleQuery"/>
458 439
     <CreateForm ref="refCreateForm" @success="handleQuery"/>
459
-    <FilesForm ref="refFilesForm" />
440
+    <FilesForm ref="refFilesForm"/>
460 441
     <AddFinancialInformationForm ref="refAddFinancialInformationForm" @success="handleQuery"/>
461 442
   </ContentWrap>
462 443
 </template>

+ 65 - 66
src/views/DeliveryWarehouse/DetermineDeliveryWarehouse/index.vue

@@ -7,6 +7,8 @@ import AddFinancialInformationForm
7 7
   from "@/views/DeliveryWarehouse/compontents/AddFinancialInformationForm.vue";
8 8
 import {DeliveryWarehouseListApi} from "@/api/DeliveryWarehouse/DeliveryWarehouseList";
9 9
 import download from "@/utils/download";
10
+import {handleTree4} from "@/utils/tree";
11
+import {useCache} from "@/hooks/web/useCache";
10 12
 
11 13
 // 接口定义
12 14
 interface QueryParams {
@@ -79,6 +81,11 @@ const handleQuery = async () => {
79 81
  */
80 82
 const resetQuery = () => {
81 83
   queryParams.value.pageNo = 1
84
+  queryParams.value.areaCode = ''
85
+  queryParams.value.shengCode = ''
86
+  queryParams.value.shiCode = ''
87
+  queryParams.value.xianCode = ''
88
+  queryParams.value.areaLevel = ''
82 89
   queryFormRef.value?.resetFields()
83 90
   handleQuery()
84 91
 }
@@ -124,16 +131,6 @@ const handleExport = async () => {
124 131
   } finally {
125 132
   }
126 133
 }
127
-/**
128
- * 获取行政区划数据
129
- */
130
-const getDivision = async (areaCode?: string) => {
131
-  try {
132
-    return await AdministrativeDivisionApi.getList({areaCode})
133
-  } catch (err) {
134
-    throw err
135
-  }
136
-}
137 134
 
138 135
 /**
139 136
  * 打开表单
@@ -146,31 +143,60 @@ const refAddFinancialInformationForm = ref()
146 143
 const openCwxxForm = (row: any) => {
147 144
   refAddFinancialInformationForm.value.open('create', row)
148 145
 }
149
-// 监听省份变化
150
-watch(() => queryParams.value.shengCode, async (newValue) => {
151
-  queryParams.value.shiCode = ''
152
-  queryParams.value.xianCode = ''
153
-  if (newValue) {
154
-    shiList.value = await getDivision(newValue)
155
-  } else {
156
-    shiList.value = []
157
-  }
158
-})
159
-
160
-// 监听市区变化
161
-watch(() => queryParams.value.shiCode, async (newValue) => {
162
-  queryParams.value.xianCode = ''
163
-  if (newValue) {
164
-    xianList.value = await getDivision(newValue)
165
-  } else {
166
-    xianList.value = []
167
-  }
168
-})
169 146
 
147
+const {wsCache} = useCache()
148
+const areaList = ref([]);
149
+let division = []
170 150
 // 初始化加载
171 151
 onMounted(async () => {
172
-  shengList.value = await getDivision()
173
-  await handleQuery()
152
+  const divisionAll = wsCache.get('divisionAll').map((item) => {
153
+    item.label = item.areaName
154
+    item.value = item.areaCode
155
+    return item
156
+  })
157
+  division = divisionAll
158
+  areaList.value = handleTree4(divisionAll);
159
+  await handleQuery();
160
+  stopWatches.push(
161
+    watch(() => queryParams.value.areaCode, async (newValue, oldValue) => {
162
+      if (newValue && newValue != '') {
163
+        const temp = division.filter(item => item.areaCode == newValue)
164
+        if (temp && temp.length == 1) {
165
+          if (temp[0].areaLevel == 1) {
166
+            queryParams.value.shengCode = temp[0].areaCode
167
+            queryParams.value.areaLevel = temp[0].areaLevel
168
+            queryParams.value.shiCode = null
169
+            queryParams.value.xianCode = null
170
+          } else if (temp[0].areaLevel == 2) {
171
+            queryParams.value.shengCode = division.filter(item=>item.areaCode == temp[0].parentCode)[0].areaCode
172
+            queryParams.value.areaLevel = temp[0].areaLevel
173
+            queryParams.value.shiCode = newValue
174
+            queryParams.value.xianCode = null
175
+          } else if (temp[0].areaLevel == 3) {
176
+            const shi = division.filter(item => item.areaCode == temp[0].parentCode)[0]
177
+            queryParams.value.shengCode = division.filter(item => item.areaCode == shi.parentCode)[0].areaCode
178
+            queryParams.value.shiCode = shi.areaCode
179
+            queryParams.value.xianCode = newValue
180
+            queryParams.value.areaLevel = temp[0].areaLevel
181
+          } else {
182
+            queryParams.value.areaCode = ''
183
+            queryParams.value.shengCode = ''
184
+            queryParams.value.shiCode = ''
185
+            queryParams.value.xianCode = ''
186
+            queryParams.value.areaLevel = ''
187
+          }
188
+        }
189
+        console.log(temp, 'aaa')
190
+      }
191
+      else {
192
+        queryParams.value.areaCode = ''
193
+        queryParams.value.shengCode = ''
194
+        queryParams.value.shiCode = ''
195
+        queryParams.value.xianCode = ''
196
+        queryParams.value.areaLevel = ''
197
+      }
198
+    })
199
+  )
174 200
 })
175 201
 </script>
176 202
 
@@ -183,42 +209,15 @@ onMounted(async () => {
183 209
       class="-mb-15px"
184 210
       label-width="68px"
185 211
     >
186
-      <el-form-item label="所属省份" prop="shengCode">
187
-        <el-select
188
-          v-model="queryParams.shengCode"
189
-          class="!w-240px"
190
-          clearable
191
-          placeholder="所属省份">
192
-          <el-option
193
-            v-for="item in shengList" :key="item.id" :label="item.areaName"
194
-            :value="item.areaCode"/>
195
-
196
-        </el-select>
197
-
198
-      </el-form-item>
199
-      <el-form-item label="所属市区" prop="shiCode">
200
-        <el-select
201
-          v-model="queryParams.shiCode"
212
+      <el-form-item label="行政区划" prop="areaCode">
213
+        <el-tree-select
214
+          v-model="queryParams.areaCode"
215
+          :check-strictly="true"
216
+          :data="areaList"
202 217
           class="!w-240px"
203 218
           clearable
204
-          placeholder="所属市区">
205
-          <el-option
206
-            v-for="item in shiList" :key="item.id" :label="item.areaName"
207
-            :value="item.areaCode"/>
208
-
209
-        </el-select>
210
-      </el-form-item>
211
-      <el-form-item label="所属县区" prop="xianCode">
212
-        <el-select
213
-          v-model="queryParams.xianCode"
214
-          class="!w-240px"
215
-          clearable
216
-          placeholder="所属县区">
217
-          <el-option
218
-            v-for="item in xianList" :key="item.id" :label="item.areaName"
219
-            :value="item.areaCode"/>
220
-
221
-        </el-select>
219
+          filterable
220
+          placeholder="行政区划"/>
222 221
       </el-form-item>
223 222
       <el-form-item label="企业名称" prop="dwmc">
224 223
         <el-input

+ 82 - 81
src/views/DeliveryWarehouse/ProvinceSelectedPage/index.vue

@@ -12,6 +12,8 @@ import {ElMessageBox} from "element-plus";
12 12
 import {ProvinceSelectedPageApi} from "@/api/DeliveryWarehouse/ProvinceSelectedPage";
13 13
 import {DICT_TYPE} from "@/utils/dict";
14 14
 import FilesForm from "@/views/DeliveryWarehouse/compontents/FilesForm.vue";
15
+import {handleTree4} from "@/utils/tree";
16
+import {useCache} from "@/hooks/web/useCache";
15 17
 
16 18
 defineOptions({name: 'ProvinceSelectedPage'})
17 19
 
@@ -158,6 +160,11 @@ const handleExport = async () => {
158 160
  */
159 161
 const resetQuery = () => {
160 162
   queryParams.value.pageNo = 1
163
+  queryParams.value.areaCode = ''
164
+  queryParams.value.shengCode = ''
165
+  queryParams.value.shiCode = ''
166
+  queryParams.value.xianCode = ''
167
+  queryParams.value.areaLevel = ''
161 168
   refQueryForm.value.resetFields()
162 169
   handleQuery()
163 170
 }
@@ -187,7 +194,7 @@ const openForm = async (row: any, type: number) => {
187 194
 const refFilesForm = ref();
188 195
 //打开附件信息的表单
189 196
 const openFilesForm = (row: any) => {
190
-  if(!row.fileIds){
197
+  if (!row.fileIds) {
191 198
     Message.warning('该库区没有附件!')
192 199
     return
193 200
   }
@@ -206,54 +213,71 @@ const openCreateForm = (type: string) => {
206 213
  * @param areaCode - 区域代码
207 214
  * @returns Promise<DivisionItem[]> 行政区划列表
208 215
  */
209
-const getDivision = async (areaCode?: string): Promise<DivisionItem[]> => {
210
-  try {
211
-    return await AdministrativeDivisionApi.getList({areaCode})
212
-  } catch (err) {
213
-    throw err
214
-  }
215
-}
216 216
 
217
-// 监听省份变化
218
-stopWatches.push(
219
-  watch(() => queryParams.value.shengCode, async (newValue) => {
220
-    queryParams.value.shiCode = ''
221
-    queryParams.value.xianCode = ''
222
-    if (newValue) {
223
-      shiList.value = await getDivision(newValue)
224
-    } else {
225
-      shiList.value = []
226
-    }
227
-  })
228
-)
229
-
230
-// 监听市区变化
231
-stopWatches.push(
232
-  watch(() => queryParams.value.shiCode, async (newValue) => {
233
-    queryParams.value.xianCode = ''
234
-    if (newValue) {
235
-      xianList.value = await getDivision(newValue)
236
-    } else {
237
-      xianList.value = []
238
-    }
239
-  })
240
-)
241 217
 
218
+const {wsCache} = useCache()
219
+const areaList = ref([]);
220
+let division = []
242 221
 // 生命周期钩子:组件挂载时获取省份数据
243 222
 onMounted(async () => {
244
-  shengList.value = await getDivision();
223
+  const divisionAll = wsCache.get('divisionAll').map((item) => {
224
+    item.label = item.areaName
225
+    item.value = item.areaCode
226
+    return item
227
+  })
228
+  division = divisionAll
229
+  areaList.value = handleTree4(divisionAll);
245 230
   await handleQuery();
231
+
232
+  stopWatches.push(
233
+    watch(() => queryParams.value.areaCode, async (newValue, oldValue) => {
234
+      if (newValue && newValue != '') {
235
+        const temp = division.filter(item => item.areaCode == newValue)
236
+        if (temp && temp.length == 1) {
237
+          if (temp[0].areaLevel == 1) {
238
+            queryParams.value.shengCode = temp[0].areaCode
239
+            queryParams.value.areaLevel = temp[0].areaLevel
240
+            queryParams.value.shiCode = null
241
+            queryParams.value.xianCode = null
242
+          } else if (temp[0].areaLevel == 2) {
243
+            queryParams.value.shengCode = division.filter(item=>item.areaCode == temp[0].parentCode)[0].areaCode
244
+            queryParams.value.areaLevel = temp[0].areaLevel
245
+            queryParams.value.shiCode = newValue
246
+            queryParams.value.xianCode = null
247
+          } else if (temp[0].areaLevel == 3) {
248
+            const shi = division.filter(item => item.areaCode == temp[0].parentCode)[0]
249
+            queryParams.value.shengCode = division.filter(item => item.areaCode == shi.parentCode)[0].areaCode
250
+            queryParams.value.shiCode = shi.areaCode
251
+            queryParams.value.xianCode = newValue
252
+            queryParams.value.areaLevel = temp[0].areaLevel
253
+          } else {
254
+            queryParams.value.areaCode = ''
255
+            queryParams.value.shengCode = ''
256
+            queryParams.value.shiCode = ''
257
+            queryParams.value.xianCode = ''
258
+            queryParams.value.areaLevel = ''
259
+          }
260
+        }
261
+        console.log(temp, 'aaa')
262
+      }
263
+      else {
264
+        queryParams.value.areaCode = ''
265
+        queryParams.value.shengCode = ''
266
+        queryParams.value.shiCode = ''
267
+        queryParams.value.xianCode = ''
268
+        queryParams.value.areaLevel = ''
269
+      }
270
+    })
271
+  )
272
+
273
+
246 274
 })
247 275
 
248 276
 // 组件卸载时清理
249 277
 onUnmounted(() => {
250 278
   // 停止所有监听
251 279
   stopWatches.forEach(stop => stop())
252
-
253 280
   // 清空数据
254
-  shengList.value = []
255
-  shiList.value = []
256
-  xianList.value = []
257 281
   list.value = []
258 282
 })
259 283
 </script>
@@ -267,42 +291,15 @@ onUnmounted(() => {
267 291
       class="-mb-15px"
268 292
       label-width="68px"
269 293
     >
270
-      <el-form-item label="所属省份" prop="shengCode">
271
-        <el-select
272
-          v-model="queryParams.shengCode"
294
+      <el-form-item label="行政区划" prop="areaCode">
295
+        <el-tree-select
296
+          v-model="queryParams.areaCode"
297
+          :check-strictly="true"
298
+          :data="areaList"
273 299
           class="!w-240px"
274 300
           clearable
275
-          placeholder="所属省份">
276
-          <el-option
277
-            v-for="item in shengList" :key="item.id" :label="item.areaName"
278
-            :value="item.areaCode"/>
279
-
280
-        </el-select>
281
-
282
-      </el-form-item>
283
-      <el-form-item label="所属市区" prop="shiuCode">
284
-        <el-select
285
-          v-model="queryParams.shiCode"
286
-          class="!w-240px"
287
-          clearable
288
-          placeholder="所属市区">
289
-          <el-option
290
-            v-for="item in shiList" :key="item.id" :label="item.areaName"
291
-            :value="item.areaCode"/>
292
-
293
-        </el-select>
294
-      </el-form-item>
295
-      <el-form-item label="所属县区" prop="xianCode">
296
-        <el-select
297
-          v-model="queryParams.xianCode"
298
-          class="!w-240px"
299
-          clearable
300
-          placeholder="所属县区">
301
-          <el-option
302
-            v-for="item in xianList" :key="item.id" :label="item.areaName"
303
-            :value="item.areaCode"/>
304
-
305
-        </el-select>
301
+          filterable
302
+          placeholder="行政区划"/>
306 303
       </el-form-item>
307 304
       <el-form-item label="企业名称" prop="dwmc">
308 305
         <el-input
@@ -320,11 +317,11 @@ onUnmounted(() => {
320 317
         />
321 318
       </el-form-item>
322 319
       <el-form-item>
323
-        <el-button type="primary"  @click="handleQuery">
320
+        <el-button type="primary" @click="handleQuery">
324 321
           <Icon class="mr-5px" icon="ep:search"/>
325 322
           查询
326 323
         </el-button>
327
-        <el-button type="primary" plain @click="resetQuery">
324
+        <el-button plain type="primary" @click="resetQuery">
328 325
           <Icon class="mr-5px" icon="ep:refresh"/>
329 326
           重置
330 327
         </el-button>
@@ -350,11 +347,11 @@ onUnmounted(() => {
350 347
       v-loading="loading"
351 348
       :border="true"
352 349
       :data="list"
353
-      tooltip-effect="dark"
354
-      show-overflow-tooltip
355 350
       :header-cell-style="{
356 351
             background: 'var(--table-header-bg-color) ', color: 'var(--table-header-text-color)', height: 'var(--table-header-height)'
357 352
            }"
353
+      show-overflow-tooltip
354
+      tooltip-effect="dark"
358 355
       @selection-change="handleSelectionChange"
359 356
     >
360 357
       <el-table-column align="center" fixed="left" min-width="40" type="selection"/>
@@ -366,12 +363,16 @@ onUnmounted(() => {
366 363
       <el-table-column align="center" label="库区名称" min-width="180" prop="kqmc"/>
367 364
       <el-table-column align="center" label="总资产(万元)" min-width="120" prop="syndzzc">
368 365
         <template #default="scope">
369
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openForm(scope.row,1)"> {{ scope.row.syndzzc }}</div>
366
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
367
+               @click="openForm(scope.row,1)"> {{ scope.row.syndzzc }}
368
+          </div>
370 369
         </template>
371 370
       </el-table-column>
372 371
       <el-table-column align="center" label="上一年度净利润(万元)" min-width="180" prop="jlr">
373 372
         <template #default="scope">
374
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openForm(scope.row,1)"> {{ scope.row.jlr }}</div>
373
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
374
+               @click="openForm(scope.row,1)"> {{ scope.row.jlr }}
375
+          </div>
375 376
         </template>
376 377
       </el-table-column>
377 378
       <!--      <el-table-column align="center" label="备选交收仓(个)" min-width="280" prop="yxcfnum">-->
@@ -383,9 +384,9 @@ onUnmounted(() => {
383 384
       <el-table-column align="center" label="联系电话" min-width="120" prop="lxdh"/>
384 385
       <el-table-column align="center" label="核验人员" min-width="120" prop="hyryName"/>
385 386
       <el-table-column align="center" label="查看状态" min-width="120" prop="hyState">
386
-      <template #default="scope">
387
-        <dict-tag :type="DICT_TYPE.HY_STATE" :value="scope.row.hyState"/>
388
-      </template>
387
+        <template #default="scope">
388
+          <dict-tag :type="DICT_TYPE.HY_STATE" :value="scope.row.hyState"/>
389
+        </template>
389 390
       </el-table-column>
390 391
       <el-table-column align="center" label="附件信息" min-width="120" prop="fileNumber">
391 392
         <template #default="scope">
@@ -404,7 +405,7 @@ onUnmounted(() => {
404 405
     />
405 406
     <DeliveryWarehouseSelectFrom ref="refForm" @success="handleQuery"/>
406 407
     <CreateForm ref="refCreateForm" @success="handleQuery"/>
407
-    <FilesForm ref="refFilesForm" />
408
+    <FilesForm ref="refFilesForm"/>
408 409
     <AddFinancialInformationForm ref="refAddFinancialInformationForm" @success="handleQuery"/>
409 410
   </ContentWrap>
410 411
 </template>

+ 81 - 76
src/views/DeliveryWarehouse/SelectDeliveryWarehouse/index.vue

@@ -1,11 +1,12 @@
1 1
 <script lang="ts" setup>
2 2
 import {onMounted, ref, watch} from 'vue'
3
-import {AdministrativeDivisionApi} from '@/api/system/administrativeDivision'
4 3
 import {SelectDeliveryWarehouseApi} from "@/api/DeliveryWarehouse/SelectDeliveryWarehouse";
5 4
 import DeliveryWarehouseSelectFrom from '@/views/DeliveryWarehouse/compontents/Form.vue'
6 5
 import AddFinancialInformationForm
7 6
   from "@/views/DeliveryWarehouse/compontents/AddFinancialInformationForm.vue";
8 7
 import download from "@/utils/download";
8
+import {useCache} from "@/hooks/web/useCache";
9
+import {handleTree4} from "@/utils/tree";
9 10
 
10 11
 // 接口定义
11 12
 interface QueryParams {
@@ -78,6 +79,11 @@ const handleQuery = async () => {
78 79
  */
79 80
 const resetQuery = () => {
80 81
   queryParams.value.pageNo = 1
82
+  queryParams.value.areaCode = ''
83
+  queryParams.value.shengCode = ''
84
+  queryParams.value.shiCode = ''
85
+  queryParams.value.xianCode = ''
86
+  queryParams.value.areaLevel = ''
81 87
   queryFormRef.value?.resetFields()
82 88
   handleQuery()
83 89
 }
@@ -94,16 +100,6 @@ const handleExport = async () => {
94 100
   } finally {
95 101
   }
96 102
 }
97
-/**
98
- * 获取行政区划数据
99
- */
100
-const getDivision = async (areaCode?: string) => {
101
-  try {
102
-    return await AdministrativeDivisionApi.getList({areaCode})
103
-  } catch (err) {
104
-    throw err
105
-  }
106
-}
107 103
 
108 104
 /**
109 105
  * 打开表单
@@ -117,31 +113,59 @@ const refAddFinancialInformationForm = ref()
117 113
 const openCwxxForm = (row: any) => {
118 114
   refAddFinancialInformationForm.value.open('create', row)
119 115
 }
120
-// 监听省份变化
121
-watch(() => queryParams.value.shengCode, async (newValue) => {
122
-  queryParams.value.shiCode = ''
123
-  queryParams.value.xianCode = ''
124
-  if (newValue) {
125
-    shiList.value = await getDivision(newValue)
126
-  } else {
127
-    shiList.value = []
128
-  }
129
-})
130 116
 
131
-// 监听市区变化
132
-watch(() => queryParams.value.shiCode, async (newValue) => {
133
-  queryParams.value.xianCode = ''
134
-  if (newValue) {
135
-    xianList.value = await getDivision(newValue)
136
-  } else {
137
-    xianList.value = []
138
-  }
139
-})
140
-
141
-// 初始化加载
117
+const {wsCache} = useCache()
118
+const areaList = ref([]);
119
+let division = []
120
+// 生命周期钩子:组件挂载时获取省份数据
142 121
 onMounted(async () => {
143
-  shengList.value = await getDivision()
144
-  await handleQuery()
122
+  const divisionAll = wsCache.get('divisionAll').map((item) => {
123
+    item.label = item.areaName
124
+    item.value = item.areaCode
125
+    return item
126
+  })
127
+  division = divisionAll
128
+  areaList.value = handleTree4(divisionAll);
129
+  await handleQuery();
130
+  stopWatches.push(
131
+    watch(() => queryParams.value.areaCode, async (newValue, oldValue) => {
132
+      if (newValue && newValue != '') {
133
+        const temp = division.filter(item => item.areaCode == newValue)
134
+        if (temp && temp.length == 1) {
135
+          if (temp[0].areaLevel == 1) {
136
+            queryParams.value.shengCode = temp[0].areaCode
137
+            queryParams.value.areaLevel = temp[0].areaLevel
138
+            queryParams.value.shiCode = null
139
+            queryParams.value.xianCode = null
140
+          } else if (temp[0].areaLevel == 2) {
141
+            queryParams.value.shengCode = division.filter(item => item.areaCode == temp[0].parentCode)[0].areaCode
142
+            queryParams.value.areaLevel = temp[0].areaLevel
143
+            queryParams.value.shiCode = newValue
144
+            queryParams.value.xianCode = null
145
+          } else if (temp[0].areaLevel == 3) {
146
+            const shi = division.filter(item => item.areaCode == temp[0].parentCode)[0]
147
+            queryParams.value.shengCode = division.filter(item => item.areaCode == shi.parentCode)[0].areaCode
148
+            queryParams.value.shiCode = shi.areaCode
149
+            queryParams.value.xianCode = newValue
150
+            queryParams.value.areaLevel = temp[0].areaLevel
151
+          } else {
152
+            queryParams.value.areaCode = ''
153
+            queryParams.value.shengCode = ''
154
+            queryParams.value.shiCode = ''
155
+            queryParams.value.xianCode = ''
156
+            queryParams.value.areaLevel = ''
157
+          }
158
+        }
159
+        console.log(temp, 'aaa')
160
+      } else {
161
+        queryParams.value.areaCode = ''
162
+        queryParams.value.shengCode = ''
163
+        queryParams.value.shiCode = ''
164
+        queryParams.value.xianCode = ''
165
+        queryParams.value.areaLevel = ''
166
+      }
167
+    })
168
+  )
145 169
 })
146 170
 </script>
147 171
 
@@ -154,42 +178,15 @@ onMounted(async () => {
154 178
       class="-mb-15px"
155 179
       label-width="68px"
156 180
     >
157
-      <el-form-item label="所属省份" prop="shengCode">
158
-        <el-select
159
-          v-model="queryParams.shengCode"
160
-          class="!w-240px"
161
-          clearable
162
-          placeholder="所属省份">
163
-          <el-option
164
-            v-for="item in shengList" :key="item.id" :label="item.areaName"
165
-            :value="item.areaCode"/>
166
-
167
-        </el-select>
168
-
169
-      </el-form-item>
170
-      <el-form-item label="所属市区" prop="shiCode">
171
-        <el-select
172
-          v-model="queryParams.shiCode"
181
+      <el-form-item label="行政区划" prop="areaCode">
182
+        <el-tree-select
183
+          v-model="queryParams.areaCode"
184
+          :check-strictly="true"
185
+          :data="areaList"
173 186
           class="!w-240px"
174 187
           clearable
175
-          placeholder="所属市区">
176
-          <el-option
177
-            v-for="item in shiList" :key="item.id" :label="item.areaName"
178
-            :value="item.areaCode"/>
179
-
180
-        </el-select>
181
-      </el-form-item>
182
-      <el-form-item label="所属县区" prop="xianCode">
183
-        <el-select
184
-          v-model="queryParams.xianCode"
185
-          class="!w-240px"
186
-          clearable
187
-          placeholder="所属县区">
188
-          <el-option
189
-            v-for="item in xianList" :key="item.id" :label="item.areaName"
190
-            :value="item.areaCode"/>
191
-
192
-        </el-select>
188
+          filterable
189
+          placeholder="行政区划"/>
193 190
       </el-form-item>
194 191
       <el-form-item label="企业名称" prop="dwmc">
195 192
         <el-input
@@ -216,10 +213,10 @@ onMounted(async () => {
216 213
       </el-form-item>
217 214
       <el-form-item>
218 215
         <el-button type="primary" @click="handleQuery">
219
-          <Icon  class="mr-5px" icon="ep:search"/>
216
+          <Icon class="mr-5px" icon="ep:search"/>
220 217
           查询
221 218
         </el-button>
222
-        <el-button type="primary" plain @click="resetQuery">
219
+        <el-button plain type="primary" @click="resetQuery">
223 220
           <Icon class="mr-5px" icon="ep:refresh"/>
224 221
           重置
225 222
         </el-button>
@@ -239,11 +236,11 @@ onMounted(async () => {
239 236
       v-loading="loading"
240 237
       :border="true"
241 238
       :data="list"
242
-      tooltip-effect="dark"
243
-      show-overflow-tooltip
244 239
       :header-cell-style="{
245 240
             background: 'var(--table-header-bg-color) ', color: 'var(--table-header-text-color)', height: 'var(--table-header-height)'
246 241
            }"
242
+      show-overflow-tooltip
243
+      tooltip-effect="dark"
247 244
     >
248 245
       <el-table-column align="center" fixed="left" min-width="40" type="selection"/>
249 246
       <el-table-column align="center" fixed="left" label="序号" min-width="60" type="index"/>
@@ -256,14 +253,18 @@ onMounted(async () => {
256 253
         v-hasPermi="['column:SelectDeliveryWarehouse:zzc']" align="center"
257 254
         label="总资产(万元)" min-width="150" prop="zzc">
258 255
         <template #default="scope">
259
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openCwxxForm(scope.row)">{{ scope.row.zzc }}</div>
256
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
257
+               @click="openCwxxForm(scope.row)">{{ scope.row.zzc }}
258
+          </div>
260 259
         </template>
261 260
       </el-table-column>
262 261
       <el-table-column
263 262
         v-hasPermi="['column:SelectDeliveryWarehouse:sndjlr']" align="center"
264 263
         label="上一年度净利润(万元)" min-width="180" prop="sndjlr">
265 264
         <template #default="scope">
266
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openCwxxForm(scope.row)">{{ scope.row.sndjlr }}</div>
265
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
266
+               @click="openCwxxForm(scope.row)">{{ scope.row.sndjlr }}
267
+          </div>
267 268
         </template>
268 269
       </el-table-column>
269 270
       <el-table-column align="center" label="库区联系人" min-width="280" prop="kqfzr"/>
@@ -272,14 +273,18 @@ onMounted(async () => {
272 273
         v-hasPermi="['column:SelectDeliveryWarehouse:yhrdnum']" align="center"
273 274
         label="银行认定仓房数量(个)" min-width="180" prop="yhrdnum">
274 275
         <template #default="scope">
275
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openForm('look', {...scope.row,yxcf:3})">{{ scope.row.yhrdnum }}</div>
276
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
277
+               @click="openForm('look', {...scope.row,yxcf:3})">{{ scope.row.yhrdnum }}
278
+          </div>
276 279
         </template>
277 280
       </el-table-column>
278 281
       <el-table-column
279 282
         v-hasPermi="['column:SelectDeliveryWarehouse:yxcfnum']" align="center"
280 283
         label="选定仓房数量(个)" min-width="180" prop="xdnum">
281 284
         <template #default="scope">
282
-          <div class="w-full color-[var(--el-color-primary)] cursor-pointer" @click="openForm('look', {...scope.row,yxcf:4})">{{ scope.row.xdnum }}</div>
285
+          <div class="w-full color-[var(--el-color-primary)] cursor-pointer"
286
+               @click="openForm('look', {...scope.row,yxcf:4})">{{ scope.row.xdnum }}
287
+          </div>
283 288
         </template>
284 289
       </el-table-column>
285 290
       <el-table-column align="center" label="认定银行" min-width="100" prop="rdyhName"/>