From 84451f1c7b6a22ad178ba807750725b6e62cd630 Mon Sep 17 00:00:00 2001 From: shanao Date: Thu, 12 Sep 2024 14:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A8=E9=83=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accident/records/components/list.vue | 21 +++++++++++-------- src/views/accident/records/index.vue | 2 -- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/views/accident/records/components/list.vue b/src/views/accident/records/components/list.vue index 72c4fd7..2fa4053 100644 --- a/src/views/accident/records/components/list.vue +++ b/src/views/accident/records/components/list.vue @@ -11,13 +11,15 @@ + end-placeholder="结束日期" + /> @@ -64,10 +66,11 @@ v-loading="listLoading" ref="multipleTable" :data="varList" - border tooltip-effect="dark" style="width: 100%" - @selection-change="handleSelectionChange"> + border + @selection-change="handleSelectionChange" + > @@ -177,7 +180,7 @@ export default { * 表格行选择器处理 */ handleSelectionChange(val) { - this.multipleSelection.push(val) + this.multipleSelection = val }, /** @@ -264,7 +267,7 @@ export default { // 获取选中的行数据 const selectedRows = this.multipleSelection // 如果没有选中任何行,则提示用户 - if (selectedRows.length === 0) { + if (this.multipleSelection === '' || selectedRows.length === 0) { this.$message.warning('请选择要删除的行') return } @@ -275,15 +278,16 @@ export default { type: 'warning' }).then(() => { // 获取所有选中行的 ID - const ids = selectedRows.map(row => row.id).join(',') - + let ids = '' + selectedRows.forEach(row => { ids += row.id + ',' }) // 发送批量删除请求 const url = '/accident/delete/' + '' + ids requestFN(url).then((response) => { // 删除成功后的处理 this.$message.success('删除成功') + this.searchList() // eslint-disable-next-line handle-callback-err - }).catch((error) => { + }).catch(() => { this.$message.error('删除失败') }) }).catch(() => { @@ -292,7 +296,6 @@ export default { message: '已取消删除' }) }) - this.searchList() }, /** diff --git a/src/views/accident/records/index.vue b/src/views/accident/records/index.vue index 92c63da..33eb176 100644 --- a/src/views/accident/records/index.vue +++ b/src/views/accident/records/index.vue @@ -2,7 +2,6 @@
-
@@ -14,7 +13,6 @@ export default { components: { List: List, Add: Add - // Detail: Detail }, data() { return {