Ver Fonte

新增后刷新列表数据

韩帛霖 há 1 ano atrás
pai
commit
755792913c
1 ficheiros alterados com 27 adições e 25 exclusões
  1. 27 25
      ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

+ 27 - 25
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -38,7 +38,7 @@
             :underline="false"
             style="font-size: 12px; vertical-align: baseline"
             @click="importTemplate"
-            >下载模板
+          >下载模板
           </el-link>
         </div>
       </el-upload>
@@ -60,7 +60,7 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          >新增
+        >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -71,7 +71,7 @@
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          >修改
+        >修改
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -82,7 +82,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          >删除
+        >删除
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -91,7 +91,7 @@
           icon="el-icon-upload2"
           size="mini"
           @click="upload.open = true"
-          >导入
+        >导入
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -101,7 +101,7 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          >导出
+        >导出
         </el-button>
       </el-col>
       <right-toolbar
@@ -114,7 +114,7 @@
       :data="tableList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column type="selection" width="55" align="center"/>
       <!-- <span v-for="(key, val) in columns" :key="key">
         <el-table-column :label="key" align="center" :prop="val" />
       </span> -->
@@ -136,14 +136,14 @@
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            >修改
+          >修改
           </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            >删除
+          >删除
           </el-button>
         </template>
       </el-table-column>
@@ -187,12 +187,12 @@ import {
   getInfoBySqlKey,
   addTableData,
 } from "@/api/tablelist/commonTable";
-import { getToken } from "@/utils/auth";
+import {getToken} from "@/utils/auth";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
 
 export default {
   name: "listInfo",
-  components: { Queryfrom },
+  components: {Queryfrom},
   data() {
     return {
       // 遮罩层
@@ -229,7 +229,7 @@ export default {
         // 是否更新已经存在的数据
         updateSupport: 0,
         // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
+        headers: {Authorization: "Bearer " + getToken()},
         // 上传的地址
         url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
       },
@@ -304,7 +304,7 @@ export default {
       // 序列化当前查询参数列表
       this.queryParams.queryMap = queryParams.queryMap;
       // 获取当前表单结构信息
-      dragTableInfo({ queryMap: { sqlkey: this.sqlkey } })
+      dragTableInfo({queryMap: {sqlkey: this.sqlkey}})
         .then((res) => {
           // 得到当前模版信息 --- sql columns queryWhere
           this.templateInfo = res.data.resultMap;
@@ -351,9 +351,9 @@ export default {
       this.$refs.mychild.pageList(
         row == undefined
           ? {
-              limit: this.queryParams.pageSize,
-              page: this.queryParams.pageNum,
-            }
+            limit: this.queryParams.pageSize,
+            page: this.queryParams.pageNum,
+          }
           : row
       );
     },
@@ -381,7 +381,7 @@ export default {
     handleAdd(row) {
       // this.reset();
       this.defaultValue = {};
-      getInfoBySqlKey(this.sqlkey).then(({ data }) => {
+      getInfoBySqlKey(this.sqlkey).then(({data}) => {
         const htmlCode = data.dfHtmlTemplate;
         this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
         this.jsonData = JSON.parse(data.dfVueTemplate);
@@ -395,7 +395,7 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      getInfoBySqlKey(this.sqlkey).then(({ data }) => {
+      getInfoBySqlKey(this.sqlkey).then(({data}) => {
         const htmlCode = data.dfHtmlTemplate;
         this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
         Object.assign(this.defaultValue, row);
@@ -474,7 +474,8 @@ export default {
           this.$refs.mychild.pageList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -507,7 +508,7 @@ export default {
     importTemplate() {
       this.download(
         process.env.VUE_APP_BASE_API3 +
-          `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
+        `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
         {},
         `下载模版名称${new Date().getTime()}.xlsx`
       );
@@ -523,10 +524,10 @@ export default {
       this.$refs.upload.clearFiles();
       this.$alert(
         "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-          response.msg +
-          "</div>",
+        response.msg +
+        "</div>",
         "导入结果",
-        { dangerouslyUseHTMLString: true }
+        {dangerouslyUseHTMLString: true}
       );
       this.$refs.mychild.pageList({
         limit: this.queryParams.pageSize,
@@ -555,16 +556,17 @@ export default {
         .then(async (values) => {
           let data = {
             basicMap: {
-              tableName: "test",
+              tableName: this.tableName,
             },
             addListMap: [values],
           };
           if (Object.keys(this.defaultValue).length) {
             this.$modal.msgSuccess("修改成功");
+            this.getList();
           } else {
             let res = await addTableData(data);
             this.$modal.msgSuccess("添加成功");
-            console.log(res);
+            this.getList();
           }
           this.defaultValue = {};
           this.open = false;