Blame view

antis-ncc-admin/src/views/lqStudyClass/StudentListDialog.vue 6.19 KB
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
1
2
3
4
5
6
  <template>
      <el-dialog title="班级学员列表" :visible.sync="visible" width="1000px" @close="closeDialog">
          <div class="student-list-container">
              <!-- 搜索区域 -->
              <div class="search-section">
                  <el-form :model="query" :inline="true" class="search-form">
384a1e80   李宇   ```
7
8
                      <el-form-item label="学员" prop="employeeId">
                          <userSelect v-model="query.employeeId" placeholder="请选择学员" size="small" />
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
                      </el-form-item>
                      <el-form-item label="HR归属">
                          <el-input v-model="query.hrBelong" placeholder="请输入HR归属" clearable size="small" />
                      </el-form-item>
                      <el-form-item>
                          <el-button type="primary" size="small" @click="search">搜索</el-button>
                          <el-button size="small" @click="reset">重置</el-button>
                      </el-form-item>
                  </el-form>
              </div>
  
              <!-- 学员列表 -->
              <div class="table-section">
                  <el-table :data="studentList" v-loading="loading" border stripe style="width: 100%">
                      <el-table-column prop="employeeName" label="学员姓名" width="120" fixed="left" />
                      <el-table-column prop="employeePhone" label="手机号" width="140" />
384a1e80   李宇   ```
25
26
                      <!-- <el-table-column prop="employeeId" label="员工ID" width="120" /> -->
                      <el-table-column prop="admissionTime" label="入学时间" width="180" :formatter="ncc.tableDateFormat">
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                      </el-table-column>
                      <el-table-column prop="className" label="班级名称" width="150" />
                      <el-table-column prop="hrBelong" label="HR归属" width="120" />
                      <el-table-column label="操作" width="120" fixed="right">
                          <template slot-scope="scope">
                              <el-button type="text" size="small" @click="viewStudyRecords(scope.row)">学习记录</el-button>
                          </template>
                      </el-table-column>
                  </el-table>
  
                  <!-- 分页 -->
                  <div class="pagination-section">
                      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                          :current-page="pagination.pageIndex" :page-sizes="[10, 20, 50, 100]"
                          :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper"
                          :total="pagination.total">
                      </el-pagination>
                  </div>
              </div>
          </div>
  
384a1e80   李宇   ```
48
          <!-- <div slot="footer" class="dialog-footer">
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
49
              <el-button @click="closeDialog">关闭</el-button>
384a1e80   李宇   ```
50
          </div> -->
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
      </el-dialog>
  </template>
  
  <script>
  import { getStudentListByClassId } from '@/api/extend/lqStudyClass'
  
  export default {
      name: 'StudentListDialog',
      data() {
          return {
              visible: false,
              loading: false,
              classId: '',
              className: '',
              studentList: [],
              query: {
                  employeeName: '',
                  employeePhone: '',
                  employeeId: '',
                  hrBelong: '',
                  classId: ''
              },
              pagination: {
                  pageIndex: 1,
                  pageSize: 20,
                  total: 0
              }
          }
      },
      methods: {
          init(classId, className) {
              this.visible = true
              this.classId = classId
              this.className = className
              this.query.classId = classId
              this.getStudentList()
          },
  
          // 获取学员列表
          getStudentList() {
              this.loading = true
              const params = {
                  ...this.query,
                  currentPage: this.pagination.pageIndex,
                  pageSize: this.pagination.pageSize
              }
  
              getStudentListByClassId(params).then(response => {
                  if (response.code === 200) {
                      this.studentList = response.data.list || []
                      this.pagination.total = (response.data.pagination && response.data.pagination.total) || 0
                  } else {
                      this.$message.error(response.msg || '获取学员列表失败')
                  }
                  this.loading = false
              }).catch(() => {
                  this.loading = false
              })
          },
  
          // 搜索
          search() {
              this.pagination.pageIndex = 1
              this.getStudentList()
          },
  
          // 重置
          reset() {
              this.query = {
                  employeeName: '',
                  employeePhone: '',
                  employeeId: '',
                  hrBelong: '',
                  classId: this.classId
              }
              this.pagination.pageIndex = 1
              this.getStudentList()
          },
  
          // 分页大小改变
          handleSizeChange(val) {
              this.pagination.pageSize = val
              this.pagination.pageIndex = 1
              this.getStudentList()
          },
  
          // 当前页改变
          handleCurrentChange(val) {
              this.pagination.pageIndex = val
              this.getStudentList()
          },
  
          // 查看学习记录
          viewStudyRecords(row) {
              this.$emit('viewStudyRecords', row)
          },
  
          // 关闭弹窗
          closeDialog() {
              this.visible = false
              this.studentList = []
              this.query = {
                  employeeName: '',
                  employeePhone: '',
                  employeeId: '',
                  hrBelong: '',
                  classId: ''
              }
              this.pagination = {
                  pageIndex: 1,
                  pageSize: 20,
                  total: 0
              }
          }
      }
  }
  </script>
  
  <style scoped>
  .student-list-container {
384a1e80   李宇   ```
171
      /* padding: 20px; */
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  }
  
  .search-section {
      margin-bottom: 20px;
      padding: 15px;
      background: #f5f7fa;
      border-radius: 4px;
  }
  
  .search-form .el-form-item {
      margin-bottom: 10px;
  }
  
  .table-section {
      margin-bottom: 20px;
  }
  
  .pagination-section {
      text-align: right;
      margin-top: 20px;
  }
  </style>