sr 4 роки тому
батько
коміт
82ba4b42c9

+ 4 - 3
ruoyi-ui/src/api/system/table.js

@@ -41,10 +41,11 @@ export function getByTableName(data) {
     data
   })
 }
-export function delMenu(id) {
+export function delMenu(data) {
   return request({
-    url: 'boman-web-core/p/cs/objectDelete',
-    method: 'delete'
+    url: '/boman-web-core/p/cs/objectDelete',
+    method: 'POST',
+    data
   })
 }
 

+ 88 - 61
ruoyi-ui/src/views/system/surface/index.vue

@@ -4,10 +4,12 @@
       <!-- <p>单表</p>
       <el-divider></el-divider> -->
       <div class="table_headerBtun" v-if="queryData.buttonList">
-        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
+        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in queryData.buttonList.split('')"
+          :key="index">{{item | btnConversion}}</el-button>
       </div>
-      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
-        <dynamic-form :ref="item.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="item" v-for="(item,index) in queryData.queryList" :key='index' />
+      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+        <dynamic-form :ref="item.columnName" :config="queryParams" @inputs="changeFn" :formConfig="item" v-for="(item,index) in queryData.queryList"
+          :key='index' />
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -18,15 +20,11 @@
     <div class="table_nav">
       <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in tabData" :key="index"/>
+        <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in tabData"
+          :key="index" />
       </el-table>
-      <pagination
-        v-show="total>0"
-        :total="total"
-        :page.sync="queryParams.pageNo"
-        :limit.sync="queryParams.pageSize"
-        @pagination="getList"
-      />
+      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+        @pagination="getList" />
     </div>
   </div>
 
@@ -38,6 +36,7 @@
     getQueryList,
     addbjectSave,
     getByTableName,
+    delMenu,
     getObject
   } from '@/api/system/table.js'
   export default {
@@ -71,7 +70,7 @@
         queryParams: {
           table: 'obj_test',
           pageNo: 1,
-          isUi:false,
+          isUi: false,
           pageSize: 10,
           orderBy: 'create_time desc',
           fixedData: {
@@ -82,25 +81,25 @@
         }
       };
     },
-    filters:{
+    filters: {
       btnConversion(val) {
-        switch(val){
+        switch (val) {
           case 'A':
-          return '新增';
+            return '新增';
           case 'M':
-          return '修改';
+            return '修改';
           case 'D':
-          return '删除';
+            return '删除';
           case 'Q':
-          return '查询';
+            return '查询';
           case 'S':
-          return '提交';
+            return '提交';
           case 'U':
-          return '反提交';
+            return '反提交';
           case 'I':
-          return '导入';
+            return '导入';
           case 'E':
-          return '导出';
+            return '导出';
         }
       }
     },
@@ -110,40 +109,59 @@
     },
     methods: {
       headerBtn(item) {
-        switch(item) {
-          case 'A': {
-            this.$router.push({
-              path: '/business/table'
-            })
-            return
-          }
-          case 'M': {
-            if(this.single){
-              this.msgInfo('请勾选一条信息')
+        switch (item) {
+          case 'A':
+            {
+              this.$router.push({
+                path: '/business/table'
+              })
               return
             }
+          case 'M':
+            {
+              if (this.single) {
+                this.msgInfo('请勾选一条信息')
+                return
+              }
               const id = this.ids
               this.$router.push({
                 path: '/business/table'
               })
-            return
-          }
-          case 'D': {
-
-            return
-          }
-          case 'Q': {
-            return
-          }
-          case 'S': {
-            return
-          }
-          case 'U': {
-            return
-          }
-          case 'E': {
-            return
-          }
+              return
+            }
+          case 'D':
+            {
+              if (this.multiple) {
+                this.msgInfo('请勾选一条信息')
+                return
+              }
+              delMenu({
+                table: 'obj_test',
+                idList: this.ids
+              }).then(res => {
+                this.msgSuccess('删除成功')
+                this.getList()
+              })
+              return
+            }
+          case 'Q':
+            {
+              this.handleQuery()
+              return
+            }
+          case 'S':
+            {
+              return
+            }
+          case 'U':
+            {
+              return
+            }
+          case 'E':
+            {
+              this.handleExport()
+              return
+            }
         }
       },
       // 取消按钮
@@ -151,14 +169,20 @@
         this.open = false;
         this.reset();
       },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('system/post/export', {
+          ...this.queryParams
+        }, `post_${new Date().getTime()}.xlsx`)
+      },
       // 多选框选中数据
       handleSelectionChange(selection) {
         this.ids = selection.map(item => item.id)
-        this.single = selection.length!=1
+        this.single = selection.length != 1
         this.multiple = !selection.length
       },
       changeFn(obj) {
-        for(let key in obj){
+        for (let key in obj) {
           this.queryParams.fixedData.condition[key] = obj[key]
         }
       },
@@ -176,22 +200,24 @@
         this.resetForm("form");
       },
       resetQuery() {
-
+        this.resetForm("queryForm");
+        this.handleQuery();
       },
       /** 搜索按钮操作 */
       handleQuery() {
-        this.grabFn(this.queryData.queryList,this.queryParams.fixedData.condition)
+        this.queryParams.pageNo = 1;
+        this.grabFn(this.queryData.queryList, this.queryParams.fixedData.condition)
         this.getList();
       },
       // 抓取参数
-      grabFn(arr,parForm) {
-        for(let item of arr){
-          if(item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload'){
-            if(this.$refs[item.columnName][0].config.length){
+      grabFn(arr, parForm) {
+        for (let item of arr) {
+          if (item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload') {
+            if (this.$refs[item.columnName][0].config.length) {
               console.log(this.$refs[item.columnName][0].config)
               parForm[item.columnName] = this.$refs[item.columnName][0].config
             }
-          } else{
+          } else {
             console.log(this.$refs[item.columnName][0].config[item.columnName])
             parForm[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
           }
@@ -203,7 +229,7 @@
           this.tabData = response.data.tableHeadList
           this.postList = response.data.rows;
           this.loading = false;
-          console.log(this.postList,this.tabData,222)
+          console.log(this.postList, this.tabData, 222)
         });
       },
       init() {
@@ -227,7 +253,8 @@
     .el-divider--horizontal {
       margin-top: 16px;
     }
-    .table_headerBtun{
+
+    .table_headerBtun {
       margin-bottom: 20px;
     }
   }