Parcourir la source

feat: #0000 单个删除+批量删除

luoyali il y a 1 an
Parent
commit
1b552d914a
1 fichiers modifiés avec 9 ajouts et 7 suppressions
  1. 9 7
      src/views/setting/user/index.vue

+ 9 - 7
src/views/setting/user/index.vue

@@ -32,6 +32,7 @@
 				ref="tableRef"
 				v-model:searchParams="tableOpts.searchParams"
 				v-bind="tableOpts"
+				v-model:curRow="tableOpts.curRow"
 				v-model:checked-options="checkedColumns"
 				:columns="activeColumns"
 			>
@@ -41,13 +42,13 @@
 							<Plus />
 						</el-icon>
 					</el-button>
-					<el-button type="danger">
+					<el-button type="danger" @click="batch_del">
 						<el-icon class="btn-icon">
 							<Delete />
 						</el-icon>
 					</el-button>
-					<el-button plain> 分配角色 </el-button>
-					<el-button plain> 密码重置 </el-button>
+					<el-button plain :disabled="checkedColumns.length === 0"> 分配角色 </el-button>
+					<el-button plain :disabled="checkedColumns.length === 0"> 密码重置 </el-button>
 				</template>
 
 				<template #filterAvatarSlot="scope">
@@ -324,8 +325,7 @@ const { searchData, tableOpts, checkedColumns, activeColumns } = useTablePage(
 		fetchImmediate: false
 	}
 )
-// // 列接口请求后 进行赋值
-// checkedColumns.value = columns
+
 // 删除
 const deleteItem = async ids => {
 	try {
@@ -343,8 +343,10 @@ const table_del = row => {
 
 //批量删除
 const batch_del = () => {
-	const id = checkedColumns.value.map(item => item.id)
-	deleteItem(id)
+	console.log(tableOpts.curRow);
+	debugger
+	const id = tableOpts.curRow.map(item => item.id)
+	// deleteItem(id)
 }
 
 // 弹窗事件