From 7de2cf77b4ee7b2f36402935cf01ca3d44d6e84c Mon Sep 17 00:00:00 2001
From: 若依 <yzz_ivy@163.com>
Date: 星期一, 26 十月 2020 16:57:58 +0800
Subject: [PATCH] !111 update ruoyi-ui/src/views/system/dept/index.vue. Merge pull request !111 from FlyFive/N/A

---
 ruoyi-ui/src/views/tool/gen/index.vue |   49 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index 0c159a0..824148e 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="琛ㄥ悕绉�" prop="tableName">
         <el-input
           v-model="queryParams.tableName"
@@ -32,7 +32,7 @@
         ></el-date-picker>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
       </el-form-item>
     </el-form>
@@ -76,11 +76,16 @@
           v-hasPermi="['tool:gen:remove']"
         >鍒犻櫎</el-button>
       </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55"></el-table-column>
-      <el-table-column label="搴忓彿" align="center" prop="tableId" width="50px" />
+      <el-table-column label="搴忓彿" type="index" width="50" align="center">
+        <template slot-scope="scope">
+          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
+        </template>
+      </el-table-column>
       <el-table-column
         label="琛ㄥ悕绉�"
         align="center"
@@ -130,6 +135,13 @@
           <el-button
             type="text"
             size="small"
+            icon="el-icon-refresh"
+            @click="handleSynchDb(scope.row)"
+            v-hasPermi="['tool:gen:edit']"
+          >鍚屾</el-button>
+          <el-button
+            type="text"
+            size="small"
             icon="el-icon-download"
             @click="handleGenTable(scope.row)"
             v-hasPermi="['tool:gen:code']"
@@ -145,7 +157,7 @@
       @pagination="getList"
     />
     <!-- 棰勮鐣岄潰 -->
-    <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh">
+    <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
       <el-tabs v-model="preview.activeName">
         <el-tab-pane
           v-for="(value, key) in preview.data"
@@ -162,7 +174,7 @@
 </template>
 
 <script>
-import { listTable, previewTable, delTable } from "@/api/tool/gen";
+import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
 import importTable from "./importTable";
 import { downLoadZip } from "@/utils/zipdownload";
 export default {
@@ -182,6 +194,8 @@
       single: true,
       // 闈炲涓鐢�
       multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
       // 鎬绘潯鏁�
       total: 0,
       // 琛ㄦ暟鎹�
@@ -237,7 +251,26 @@
         this.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁");
         return;
       }
-      downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
+      if(row.genType === "1") {
+        genCode(row.tableName).then(response => {
+          this.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath);
+        });
+      } else {
+        downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
+      }
+    },
+    /** 鍚屾鏁版嵁搴撴搷浣� */
+    handleSynchDb(row) {
+      const tableName = row.tableName;
+      this.$confirm('纭瑕佸己鍒跺悓姝�"' + tableName + '"琛ㄧ粨鏋勫悧锛�', "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(function() {
+          return synchDb(tableName);
+      }).then(() => {
+          this.msgSuccess("鍚屾鎴愬姛");
+      })
     },
     /** 鎵撳紑瀵煎叆琛ㄥ脊绐� */
     openImportTable() {
@@ -266,7 +299,7 @@
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleEditTable(row) {
       const tableId = row.tableId || this.ids[0];
-      this.$router.push({ path: "/gen/edit", query: { tableId: tableId } });
+      this.$router.push("/gen/edit/" + tableId);
     },
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
@@ -280,7 +313,7 @@
       }).then(() => {
           this.getList();
           this.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(function() {});
+      })
     }
   }
 };

--
Gitblit v1.9.3