Explorar el Código

表格编辑,菜单调整

lph hace 1 año
padre
commit
0f31e587cb
Se han modificado 2 ficheros con 48 adiciones y 15 borrados
  1. 1 0
      ruoyi-ui/package.json
  2. 47 15
      ruoyi-ui/src/views/tableMange/index.vue

+ 1 - 0
ruoyi-ui/package.json

@@ -59,6 +59,7 @@
     "quill": "1.3.7",
     "screenfull": "5.0.2",
     "sortablejs": "1.10.2",
+    "uuid": "^9.0.0",
     "vcolorpicker": "^2.0.12",
     "vue": "2.6.12",
     "vue-codemirror-lite": "^1.0.4",

+ 47 - 15
ruoyi-ui/src/views/tableMange/index.vue

@@ -179,13 +179,13 @@
           </template>
         </el-table-column> -->
           </el-table>
-          <pagination
+          <!-- <pagination
             v-show="total > 0"
             :total="total"
             :page.sync="queryParams.pageNum"
             :limit.sync="queryParams.pageSize"
             @pagination="pageList"
-          />
+          /> -->
         </el-card>
       </el-col>
       <el-col :span="6">
@@ -262,24 +262,24 @@
       </el-col>
     </el-row>
     <el-dialog title="效果预览" :visible.sync="isShowPreview" width="50%">
-      <el-form label-width="80px" size="normal" :inline="true">
-        <el-form-item label="超级查询">
+      <el-row :gutter="10" class="mb8">
+        <el-col span="18">
           <el-input placeholder="请输入" clearable />
-        </el-form-item>
+        </el-col>
 
-        <el-form-item>
+        <el-col span="6">
           <el-button
             type="primary"
             icon="el-icon-search"
-            size="mini"
+            size="small"
             @click="() => {}"
             >搜索</el-button
           >
-          <el-button icon="el-icon-refresh" size="mini" @click="() => {}"
+          <el-button icon="el-icon-refresh" size="small" @click="() => {}"
             >重置</el-button
           >
-        </el-form-item>
-      </el-form>
+        </el-col>
+      </el-row>
 
       <el-row :gutter="10" class="mb8">
         <el-col :span="1.5">
@@ -329,10 +329,10 @@
             >导出
           </el-button>
         </el-col>
-        <right-toolbar
+        <!-- <right-toolbar
           showSearch.sync="true"
           @queryTable="() => {}"
-        ></right-toolbar>
+        ></right-toolbar> -->
       </el-row>
       <el-table :data="tableDataList" @selection-change="() => {}">
         <el-table-column
@@ -406,12 +406,14 @@ import {
   dragTablePreview,
 } from "@/api/dragform/form.js";
 import { addDragTable } from "@/api/tablelist/commonTable.js";
+import { addMenu } from "@/api/system/menu.js";
 import { getMenuList } from "@/api/menu.js";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
 import { mapState } from "vuex";
 import Sortable from "sortablejs";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { v4 as uuidv4 } from "uuid";
 export default {
   name: "tableMange",
   dicts: ["sys_time_format"],
@@ -797,6 +799,8 @@ export default {
     // 预览结果回调
     async previewHandle() {
       this.$refs.formData.validate(async (valid) => {
+        // 至少包含一个查询项
+
         if (valid) {
           if (!this.tableName) {
             this.$message.error("请选择数据表");
@@ -828,10 +832,12 @@ export default {
     async createHandle() {
       this.$refs.formData.validate(async (valid) => {
         if (valid) {
+          let uuid = uuidv4();
           let data = {
             dtName: this.formData.menuName,
             tableKey: this.formData.routePath, //  暂定
             dtTableName: this.tableName,
+            sqlKey: uuid,
             dtColumnName: [], //列字段标题名称(存储显示字段信息
             timeFormat: this.formData.timeFormate,
             searchFieldList: [], //搜索字段数组
@@ -858,10 +864,36 @@ export default {
               data.tableExportField[item.fieldName] = item.fieldDescription;
             }
           });
-          console.log(data);
+          if (!data.searchFieldList.length) {
+            this.$message.warning("请至少选择一个包含查询字段");
+            return false;
+          }
           let res = await addDragTable(data);
-          this.$message.success("创建成功");
-          console.log(res);
+          if (res.code == 200) {
+            let sqlKeyObj = {
+              sqlkey: uuid,
+            };
+            let payLoad = {
+              component: "tablelist/commonTable/listInfo",
+              icon: "",
+              isCache: "0",
+              isFrame: "1",
+              menuName: this.formData.menuName,
+              menuType: "C",
+              orderNum: "0",
+              parentId: this.formData.routePath,
+              path: "testtblae",
+              query: JSON.stringify(sqlKeyObj),
+              status: "0",
+              visible: "0",
+            };
+            let result = await addMenu(payLoad);
+            if (result.code == 200) {
+              this.$message.success("创建成功");
+              return;
+            }
+          }
+          this.$message.warning("创建失败");
         } else {
           this.$message.warning("请完善表单");
           return false;