|
@@ -47,7 +47,6 @@
|
|
|
v-if="checkPrivilege('button', 'delete')"
|
|
|
type="danger"
|
|
|
icon="el-icon-delete"
|
|
|
- :disabled="!filterHasQuery"
|
|
|
@click="toBatchDelete"
|
|
|
>批量删除</el-button
|
|
|
>
|
|
@@ -86,7 +85,16 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part-box part-box-pad">
|
|
|
- <el-table ref="TableList" :data="dataList">
|
|
|
+ <el-table
|
|
|
+ ref="TableList"
|
|
|
+ :data="dataList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column
|
|
|
type="index"
|
|
|
label="序号"
|
|
@@ -174,12 +182,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- studentListQuery,
|
|
|
- deleteStudent,
|
|
|
- deleteFilterStudent,
|
|
|
- exportStudent,
|
|
|
-} from "../api";
|
|
|
+import { studentListQuery, deleteStudent, exportStudent } from "../api";
|
|
|
import ModifyStudent from "../components/ModifyStudent";
|
|
|
import ImportFile from "../../../components/ImportFile.vue";
|
|
|
import { downloadByApi } from "@/plugins/download";
|
|
@@ -202,6 +205,7 @@ export default {
|
|
|
size: this.GLOBAL.pageSize,
|
|
|
total: 0,
|
|
|
dataList: [],
|
|
|
+ multipleSelection: [],
|
|
|
curRow: {},
|
|
|
loading: false,
|
|
|
// import
|
|
@@ -237,6 +241,9 @@ export default {
|
|
|
this.current = page;
|
|
|
this.getList();
|
|
|
},
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val.map((item) => item.id);
|
|
|
+ },
|
|
|
toAdd() {
|
|
|
this.curRow = {};
|
|
|
this.$refs.ModifyStudent.open();
|
|
@@ -245,16 +252,24 @@ export default {
|
|
|
this.curRow = row;
|
|
|
this.$refs.ModifyStudent.open();
|
|
|
},
|
|
|
- toBatchDelete() {
|
|
|
- this.$confirm(`确定要根据设置的筛选条件删除所有数据吗?`, "提示", {
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- await deleteFilterStudent(this.filter);
|
|
|
- this.$message.success("删除成功!");
|
|
|
- this.toPage(1);
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ async toBatchDelete() {
|
|
|
+ if (!this.multipleSelection.length) {
|
|
|
+ this.$message.error("请选择要删除的学生");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const confirm = await this.$confirm(
|
|
|
+ `确定要删除当前选择的所有学生吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+
|
|
|
+ await deleteStudent(this.multipleSelection);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
},
|
|
|
toDelete(row) {
|
|
|
this.$confirm(`确定要删除学生【${row.studentName}】吗?`, "提示", {
|