浏览代码

Merge branch 'develop' of www/km-web into master

www 1 年之前
父节点
当前提交
e4530aa99f

+ 4 - 1
src/api/index.ts

@@ -209,7 +209,10 @@ class RequestHttp {
   delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
     return this.service.delete(url, { params, ..._object })
   }
-  download(url: string, params?: object, _object = {}): Promise<BlobPart> {
+  downloadGet(url: string, params?: object, _object = {}): Promise<BlobPart> {
+    return this.service.get(url, { ..._object, responseType: 'blob' })
+  }
+  downloadPost(url: string, params?: object, _object = {}): Promise<BlobPart> {
     return this.service.post(url, params, { ..._object, responseType: 'blob' })
   }
 }

+ 2 - 2
src/api/modules/monitor/logininfor.ts

@@ -50,7 +50,7 @@ export const delLogininforApi = ({ infoId }: { infoId: any }) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/monitor/logininfor/importTemplate', {})
+  return http.downloadPost('/monitor/logininfor/importTemplate', {})
 }
 
 /**
@@ -66,5 +66,5 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/monitor/logininfor/export', data)
+  return http.downloadPost('/monitor/logininfor/export', data)
 }

+ 2 - 2
src/api/modules/monitor/operlog.ts

@@ -50,7 +50,7 @@ export const delOperlogApi = ({ operId }: { operId: any }) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/monitor/operlog/importTemplate', {})
+  return http.downloadPost('/monitor/operlog/importTemplate', {})
 }
 
 /**
@@ -66,5 +66,5 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/monitor/operlog/export', data)
+  return http.downloadPost('/monitor/operlog/export', data)
 }

+ 2 - 2
src/api/modules/system/dept.ts

@@ -50,7 +50,7 @@ export const delDeptApi = (deptId: any) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/dept/importTemplate', {})
+  return http.downloadPost('/system/dept/importTemplate', {})
 }
 
 /**
@@ -66,5 +66,5 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/dept/export', data)
+  return http.downloadPost('/system/dept/export', data)
 }

+ 2 - 2
src/api/modules/system/dict.ts

@@ -50,7 +50,7 @@ export const delDictApi = ({ id }: { id: any }) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/dict/type/importTemplate', {})
+  return http.downloadPost('/system/dict/type/importTemplate', {})
 }
 
 /**
@@ -66,7 +66,7 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/dict/type/export', data)
+  return http.downloadPost('/system/dict/type/export', data)
 }
 
 /**

+ 1 - 1
src/api/modules/system/dictData.ts

@@ -59,5 +59,5 @@ export const delDataApi = ({ id }: { id: any }) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/dict/data/export', data)
+  return http.downloadPost('/system/dict/data/export', data)
 }

+ 2 - 2
src/api/modules/system/menu.ts

@@ -55,7 +55,7 @@ export const delMenuApi = (menuId: any) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/menu/importTemplate', {})
+  return http.downloadPost('/system/menu/importTemplate', {})
 }
 
 /**
@@ -71,7 +71,7 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/menu/export', data)
+  return http.downloadPost('/system/menu/export', data)
 }
 
 /**

+ 2 - 2
src/api/modules/system/post.ts

@@ -50,7 +50,7 @@ export const delPostApi = ({ postId }: { postId: any }) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/post/importTemplate', {})
+  return http.downloadPost('/system/post/importTemplate', {})
 }
 
 /**
@@ -66,5 +66,5 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/post/export', data)
+  return http.downloadPost('/system/post/export', data)
 }

+ 2 - 2
src/api/modules/system/role.ts

@@ -50,7 +50,7 @@ export const delRoleApi = ({ roleId }: { roleId: any }) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/role/importTemplate', {})
+  return http.downloadPost('/system/role/importTemplate', {})
 }
 
 /**
@@ -66,5 +66,5 @@ export const importDataApi = (data: any) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/role/export', data)
+  return http.downloadPost('/system/role/export', data)
 }

+ 2 - 2
src/api/modules/system/user.ts

@@ -66,7 +66,7 @@ export const changeUserStatus = (data: any) => {
  * @returns returns
  */
 export const importTemplateApi = () => {
-  return http.download('/system/user/importTemplate', {})
+  return http.downloadPost('/system/user/importTemplate', {})
 }
 
 /**
@@ -82,5 +82,5 @@ export const importDataApi = (params: FormData) => {
  * @returns returns
  */
 export const exportApi = (data: any) => {
-  return http.download('/system/user/export', data)
+  return http.downloadPost('/system/user/export', data)
 }

+ 1 - 1
src/api/modules/tool/gen.ts

@@ -87,5 +87,5 @@ export const synchDbApi = (tableName: any) => {
  * @returns returns
  */
 export const batchGenCodeApi = (tableId: any) => {
-  return http.get<any>(`/tool/gen/batchGenCode?tables=${tableId}`)
+  return http.downloadGet(`/tool/gen/batchGenCode?tables=${tableId}`)
 }

+ 2 - 13
src/views/tool/gen/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="table-box">
-    <ProTable ref="proTable" :columns="columns" row-key="tableId" :request-api="listTableApi" :data-callback="dataCallback">
+    <ProTable ref="proTable" :columns="columns" row-key="tableId" :request-api="listTableApi">
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
         <el-button
@@ -109,17 +109,6 @@ let preview = ref({
   activeName: 'domain.java'
 })
 
-// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,可以在这里进行处理成这些字段
-const dataCallback = (data: any) => {
-  const page = proTable.value!.pageable
-  return {
-    list: data.data,
-    total: data.total,
-    pageNum: page.pageNum,
-    pageSize: page.pageSize
-  }
-}
-
 // 表格弹框提交
 const submitForm = () => {
   proTable.value?.getTableList()
@@ -157,7 +146,7 @@ const batchAdd = () => {
 const handleGenTable = (_row?: { tableId: string }) => {
   let tableIdArr: any[] | undefined = proTable.value?.selectedList.map(item => item.tableId)
   let tableIds = _row?.tableId || tableIdArr?.join(',')
-  useDownload(batchGenCodeApi, '生成代码', tableIds, false, 'zip', 'phm.zip')
+  useDownload(batchGenCodeApi, '生成代码', tableIds, false, 'zip', 'km.zip')
 }
 
 // 同步表数据