Browse Source

protable增加批量删除接口

tongshangming 2 years ago
parent
commit
249de12c75
3 changed files with 22 additions and 3 deletions
  1. 1 0
      .gitignore
  2. 17 0
      .vscode/settings.json
  3. 4 3
      src/components/ProTable.vue

+ 1 - 0
.gitignore

@@ -20,6 +20,7 @@ coverage
 # Editor directories and files
 .vscode/*
 !.vscode/extensions.json
+!.vscode/settings.json
 .idea
 *.suo
 *.ntvs*

+ 17 - 0
.vscode/settings.json

@@ -0,0 +1,17 @@
+{
+  "editor.tabSize": 2,
+  "[javascript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[html]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[vue]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "editor.formatOnSave": true,
+  "files.eol": "\n"
+}

+ 4 - 3
src/components/ProTable.vue

@@ -9,6 +9,7 @@ interface CRUD {
   create: Function
   update: Function
   delete: Function
+  deleteBatch: Function
   getList: Function
   getRecord: Function
 }
@@ -139,11 +140,11 @@ const handleDelete = (id: string | number) => {
     })
   })
 }
-const handlePatchDelete = () => {
+const handleBatchDelete = () => {
   ElMessageBox.confirm('您确定要删除吗', '提示', {
     type: 'warning'
   }).then(async () => {
-    await props.crud?.delete({
+    await props.crud?.deleteBatch({
       ids: multipleSelection.value.map(item => item.id).join(',')
     })
     ElMessage({
@@ -184,7 +185,7 @@ defineExpose({
         <div class="flex justify-between mb-20px">
           <div>
             <el-button type="primary" @click="handleCreate">新增</el-button>
-            <el-button type="danger" @click="handlePatchDelete" :disabled="!multipleSelection.length" v-if="selection">
+            <el-button type="danger" @click="handleBatchDelete" :disabled="!multipleSelection.length" v-if="selection">
               删除
             </el-button>
           </div>