Pārlūkot izejas kodu

对接删除学员

wolyshaw 4 gadi atpakaļ
vecāks
revīzija
a8a4e3b8bf

+ 8 - 0
src/views/teamBuild/api.js

@@ -7,3 +7,11 @@ export const addMusicGroupRegs = data => request2({
   method: 'post',
   requestType: 'json'
 })
+
+// 删除学员
+export const delStudentRegistration = data => request2({
+  url: '/api-web/studentRegistration/del',
+  data,
+  method: 'post',
+  requestType: 'json'
+})

+ 18 - 2
src/views/teamBuild/components/merged-students.vue

@@ -7,14 +7,19 @@
       <el-form-item>
         <el-button type="primary" native-type="submit">搜索</el-button>
         <el-button type="danger" native-type="reset">重置</el-button>
+        <el-button type="primary" @click="removeStuden" :disabled="!passed.length">删除学员</el-button>
       </el-form-item>
     </el-form>
     <el-table
       style="width: 100%"
       max-height="300px"
+      @selection-change="handleSelectionChange"
       :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
       :data="filterlist"
     >
+      <el-table-column type="selection"
+        width="50">
+      </el-table-column>
       <el-table-column prop="realName" align="center" label="学员姓名">
         <template slot-scope="scope">
           <copy-text>{{ scope.row.realName }}</copy-text>
@@ -35,6 +40,7 @@
 </template>
 <script>
 import { getTeamStudentList } from '@/api/buildTeam'
+import { delStudentRegistration } from '../api'
 export default {
   data() {
     return {
@@ -82,10 +88,20 @@ export default {
     handleSelectionChange(arr) {
       const passed = [];
       for (let i in arr) {
-        passed.push(arr[i].id);
+        passed.push(arr[i].userId);
       }
       this.passed = passed;
-      this.$emit('selected', this.passed, this.id)
+      // this.$emit('selected', this.passed, this.id)
+    },
+    async removeStuden() {
+      try {
+        await this.$confirm('是否确认删除已选择学员?', '提示', {
+          type: 'warning'
+        })
+        await delStudentRegistration(this.passed)
+        this.$message.success('删除成功')
+        this.FetchDetail()
+      } catch (error) {}
     },
     async FetchDetail() {
       try {