Ver Fonte

fix: 修复打包出现的问题

R há 1 ano atrás
pai
commit
55d3b5f9ab
1 ficheiros alterados com 34 adições e 7 exclusões
  1. 34 7
      src/views/tool/gen/index.vue

+ 34 - 7
src/views/tool/gen/index.vue

@@ -3,7 +3,13 @@
     <ProTable ref="proTable" :columns="columns" row-key="tableId" :request-api="listTableApi">
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
-        <el-button type="primary" v-auth="['tool:gen:code']" :disabled="!scope.isSelected" :icon="CirclePlus" @click="handleGenTable()">
+        <el-button
+          type="primary"
+          v-auth="['tool:gen:code']"
+          :disabled="!scope.isSelected"
+          :icon="CirclePlus"
+          @click="handleGenTable()"
+        >
           生成
         </el-button>
         <el-button type="primary" v-auth="['tool:gen:import']" :icon="Upload" plain @click="batchAdd"> 导入表 </el-button>
@@ -20,11 +26,19 @@
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link :icon="View" v-auth="['tool:gen:query']" @click="openDialog(1, '代码预览', scope.row)"> 预览 </el-button>
+        <el-button type="primary" link :icon="View" v-auth="['tool:gen:query']" @click="openDialog(1, '代码预览', scope.row)">
+          预览
+        </el-button>
         <el-button type="primary" link :icon="EditPen" v-auth="['tool:gen:edit']" @click="toDetail(scope.row)"> 编辑 </el-button>
-        <el-button type="primary" link :icon="Delete" v-auth="['tool:gen:remove']" @click="deleteRole(scope.row)"> 删除 </el-button>
-        <el-button type="primary" link :icon="Refresh" v-auth="['tool:gen:edit']" @click="handleSyncDb(scope.row)"> 同步 </el-button>
-        <el-button type="primary" link :icon="Download" v-auth="['tool:gen:code']" @click="handleGenTable(scope.row)"> 生成代码 </el-button>
+        <el-button type="primary" link :icon="Delete" v-auth="['tool:gen:remove']" @click="deleteRole(scope.row)">
+          删除
+        </el-button>
+        <el-button type="primary" link :icon="Refresh" v-auth="['tool:gen:edit']" @click="handleSyncDb(scope.row)">
+          同步
+        </el-button>
+        <el-button type="primary" link :icon="Download" v-auth="['tool:gen:code']" @click="handleGenTable(scope.row)">
+          生成代码
+        </el-button>
       </template>
     </ProTable>
     <FormDialog ref="formDialogRef">
@@ -48,7 +62,8 @@
                     : key
                         .toString()
                         .substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
-                        .split('.')[1] || key.toString().substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
+                        .split('.')[1] ||
+                      key.toString().substring(key.toString().lastIndexOf('/') + 1, key.toString().indexOf('.vm'))
                 "
               >
               </preview-code>
@@ -86,6 +101,17 @@ 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()
@@ -121,10 +147,11 @@ const batchAdd = () => {
 }
 
 //  生成代码
+const handleGenTable = (_row?: { tableId: string }) => {
 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', 'km.zip')
+  useDownload(batchGenCodeApi, '生成代码', tableIds, false, 'zip', 'phm.zip')
 }
 
 // 同步表数据