double.huang 5 роки тому
батько
коміт
d01e4aae59

+ 10 - 0
src/api/modules/sys_optionset.js

@@ -21,6 +21,16 @@ module.exports.del = (data) => {
   })
 }
 
+// batchDel 删除字典
+module.exports.batchDel = (data) => {
+  const url = '/api/sys/optionset/batch_del'
+  return axios({
+    url: url,
+    method: 'delete',
+    data
+  })
+}
+
 // update 更新字典
 module.exports.update = (data) => {
   const url = '/api/sys/optionset/update'

+ 20 - 34
src/views/menu/index.vue

@@ -7,10 +7,10 @@
         </el-aside>
         <el-container>
           <el-header style="margin-bottom: 10px;">
-            <query ref="searchForm" :form-config="query" @onSubmit="search" />
+            <query ref="searchForm" :form-config="query" @onSubmit="search" @onCreate="create" @onDeleteBatch="deleteBatch" />
           </el-header>
           <el-main class="table-main">
-            <sheet ref="qtable" :api="this.$api.sysMenu.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" />
+            <sheet ref="qtable" :api="this.$api.sysMenu.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" :selection-data.sync="selectionData" />
           </el-main>
         </el-container>
       </el-container>
@@ -118,24 +118,10 @@ export default {
       ],
       operates: {
         list: [
-          {
-            label: 'Edit',
-            show: true,
-            type: 'primary',
-            method: row => {
-              this.edit(row)
-            }
-          },
-          {
-            label: 'Delete',
-            show: true,
-            type: 'danger',
-            method: row => {
-              this.deleteData(row)
-            }
-          }
+          { label: 'Edit', show: true, type: 'text', method: (row) => { this.edit(row) } },
+          { label: 'Del', show: true, type: 'text', method: (row) => { this.deleteData(row) } }
         ],
-        width: 160,
+        width: 100,
         fixed: 'right'
       },
       dataQuery: {
@@ -172,6 +158,7 @@ export default {
         value: 'id',
         key: 'id'
       },
+      selectionData: [],
       dataLoading: false,
       dialogStatus: '',
       dialogVisible: false,
@@ -256,22 +243,21 @@ export default {
       })
     },
     deleteBatch() {
-      const ids = []
-      this.$refs.qtable.selectionData.forEach(row => {
-        ids.push({ id: row.id })
-      })
-      this.$confirm('Are you sure to delete selected data in batch ?', 'Prompt', {
-        type: 'warning'
-      }).then(() => {
-        this.$api.sysMenu.batchDel(ids).then(res => {
-          this.$message({
-            message: 'successfully deleted',
-            type: 'success'
+      const ids = this.selectionData.map(row => ({ id: row.id }))
+      if (ids.length > 0) {
+        this.$confirm('Are you sure to delete selected data in batch ?', 'Prompt', {
+          type: 'warning'
+        }).then(() => {
+          this.$api.sysMenu.batchDel(ids).then(res => {
+            this.$message({
+              message: 'successfully deleted',
+              type: 'success'
+            })
+            this.$refs.qtable.getData()
+            this.$store.dispatch('permission/resetRoutes')
           })
-          this.$refs.qtable.getData()
-          this.$store.dispatch('permission/resetRoutes')
-        })
-      })
+        }).catch(() => {})
+      }
     },
     dialogClose() {},
     create() {

+ 19 - 29
src/views/optionset/index.vue

@@ -3,10 +3,10 @@
     <el-main class="page-main">
       <el-container>
         <el-header style="margin-bottom: 10px;">
-          <query ref="searchForm" :form-config="query" @onSubmit="search" />
+          <query ref="searchForm" :form-config="query" @onSubmit="search" @onCreate="create" @onDeleteBatch="deleteBatch" />
         </el-header>
         <el-main>
-          <sheet ref="qtable" :api="this.$api.sysOptionset.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" />
+          <sheet ref="qtable" :api="this.$api.sysOptionset.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" :selection-data.sync="selectionData" />
         </el-main>
       </el-container>
     </el-main>
@@ -91,24 +91,11 @@ export default {
       ],
       operates: {
         list: [
-          {
-            label: 'Edit',
-            show: true,
-            type: 'primary',
-            method: row => {
-              this.edit(row)
-            }
-          },
-          {
-            label: 'Del',
-            show: true,
-            type: 'danger',
-            method: row => {
-              this.deleteData(row)
-            }
-          }
+          { label: 'Edit', show: true, type: 'text', method: (row) => { this.edit(row) } },
+          { label: 'Del', show: true, type: 'text', method: (row) => { this.deleteData(row) } }
         ],
-        width: 150
+        width: 100,
+        fixed: 'right'
       },
       dataQuery: {
         page: 1,
@@ -126,6 +113,7 @@ export default {
         code: '',
         value: ''
       },
+      selectionData: [],
       dataLoading: false,
       dialogStatus: '',
       dialogVisible: false
@@ -185,18 +173,20 @@ export default {
       }).catch(() => {})
     },
     deleteBatch() {
-      const ids = this.$refs.qtable.multipleSelection.map(row => ({ id: row.id }))
-      this.$confirm('Do you confirm bulk deletion of selected data?', 'Tips', {
-        type: 'warning'
-      }).then(() => {
-        this.$api.system.DelOptionset(ids).then(res => {
-          this.$refs.qtable.getData()
-          this.$message({
-            message: 'Removal successful',
-            type: 'success'
+      const ids = this.selectionData.map(row => ({ id: row.id }))
+      if (ids.length > 0) {
+        this.$confirm('Do you confirm bulk deletion of selected data?', 'Tips', {
+          type: 'warning'
+        }).then(() => {
+          this.$api.sysOptionset.batchDel(ids).then(res => {
+            this.$refs.qtable.getData()
+            this.$message({
+              message: 'Removal successful',
+              type: 'success'
+            })
           })
         })
-      })
+      }
     },
     delItem(index) {
       this.maps.splice(index, 1)

+ 3 - 17
src/views/org/index.vue

@@ -119,24 +119,10 @@ export default {
       ],
       operates: {
         list: [
-          {
-            label: i18n.t('Edit'),
-            show: true,
-            type: 'primary',
-            method: row => {
-              this.edit(row)
-            }
-          },
-          {
-            label: i18n.t('Delete'),
-            show: true,
-            type: 'danger',
-            method: row => {
-              this.deleteData(row)
-            }
-          }
+          { label: 'Edit', show: true, type: 'text', method: (row) => { this.edit(row) } },
+          { label: 'Del', show: true, type: 'text', method: (row) => { this.deleteData(row) } }
         ],
-        width: 160,
+        width: 100,
         fixed: 'right'
       },
       dataQuery: {

+ 21 - 36
src/views/role/index.vue

@@ -3,10 +3,10 @@
     <el-main class="page-main">
       <el-container>
         <el-header style="margin-bottom: 10px;">
-          <query ref="searchForm" :form-config="query" @onSubmit="search" />
+          <query ref="searchForm" :form-config="query" @onSubmit="search" @onCreate="create" @onDeleteBatch="deleteBatch" />
         </el-header>
         <el-main>
-          <sheet ref="qtable" :api="this.$api.sysRole.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" />
+          <sheet ref="qtable" :api="this.$api.sysRole.page" :columns="tableColumns" :data-query="dataQuery" :operates="operates" :float-type="'right'" :select-type="'selection'" :selection-data.sync="selectionData" />
         </el-main>
       </el-container>
     </el-main>
@@ -116,24 +116,11 @@ export default {
       ],
       operates: {
         list: [
-          {
-            label: i18n.t('Edit'),
-            show: true,
-            type: 'primary',
-            method: row => {
-              this.edit(row)
-            }
-          },
-          {
-            label: i18n.t('Delete'),
-            show: true,
-            type: 'danger',
-            method: row => {
-              this.deleteData(row)
-            }
-          }
+          { label: 'Edit', show: true, type: 'text', method: (row) => { this.edit(row) } },
+          { label: 'Del', show: true, type: 'text', method: (row) => { this.deleteData(row) } }
         ],
-        width: 150
+        width: 100,
+        fixed: 'right'
       },
       dataQuery: {
         page: 1,
@@ -165,6 +152,7 @@ export default {
         value: 'id',
         key: 'id'
       },
+      selectionData: [],
       dataLoading: false,
       dialogStatus: '',
       dialogVisible: false
@@ -311,26 +299,23 @@ export default {
             type: 'success'
           })
         })
-      })
-        .catch(() => {})
+      }).catch(() => {})
     },
     deleteBatch() {
-      const ids = []
-      this.$refs.qtable.multipleSelection.forEach(row => {
-        ids.push({ id: row.id })
-      })
-      this.$confirm('确认批量删除选中数据吗?', '提示', {
-        type: 'warning'
-      }).then(() => {
-        this.$api.system.DelRole(ids).then(res => {
-          this.$refs.qtable.getData()
-          this.$message({
-            message: '删除成功',
-            type: 'success'
+      const ids = this.selectionData.map(row => ({ id: row.id }))
+      if (ids.length > 0) {
+        this.$confirm('确认批量删除选中数据吗?', '提示', {
+          type: 'warning'
+        }).then(() => {
+          this.$api.sysRole.batchDel(ids).then(res => {
+            this.$refs.qtable.getData()
+            this.$message({
+              message: '删除成功',
+              type: 'success'
+            })
           })
-        })
-      })
-        .catch(() => {})
+        }).catch(() => {})
+      }
     },
     search(obj) {
       this.$refs.qtable.getData(obj)

+ 4 - 17
src/views/scheduling/index.vue

@@ -116,24 +116,11 @@ export default {
       ],
       operates: {
         list: [
-          {
-            label: i18n.t('Edit'),
-            show: true,
-            type: 'primary',
-            method: row => {
-              this.edit(row)
-            }
-          },
-          {
-            label: i18n.t('Delete'),
-            show: true,
-            type: 'danger',
-            method: row => {
-              this.deleteData(row)
-            }
-          }
+          { label: 'Edit', show: true, type: 'text', method: (row) => { this.edit(row) } },
+          { label: 'Del', show: true, type: 'text', method: (row) => { this.deleteData(row) } }
         ],
-        width: 150
+        width: 100,
+        fixed: 'right'
       },
       dataQuery: {
         page: 1,

+ 1 - 1
src/views/tracker/index.vue

@@ -97,7 +97,7 @@ export default {
           {
             label: '详情',
             show: true,
-            type: 'primary',
+            type: 'text',
             method: row => {
               this.detail(row)
             }