f86c9c69
“wangming”
添加库存管理和学习班级管理功能
|
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
<el-table-column label="操作" align="center" width="200" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="viewStudents(scope.row)">查看学员</el-button>
<el-button type="text" @click="addStudentsToClass(scope.row)">添加学员</el-button>
<el-button type="text" @click="viewStudyRecords(scope.row)">学习记录</el-button>
</template>
</el-table-column>
</NCC-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="query.currentPage"
:limit.sync="query.pageSize" @pagination="getList" />
</div>
</div>
<!-- 创建班级弹窗 -->
<CreateClassForm v-if="createClassVisible" ref="CreateClassForm" @refreshDataList="getList" />
<!-- 添加学员弹窗 -->
<AddStudentForm v-if="addStudentVisible" ref="AddStudentForm" @refreshDataList="getList" />
<!-- 学员列表弹窗 -->
<StudentListDialog v-if="studentListVisible" ref="StudentListDialog"
@viewStudyRecords="handleViewStudyRecords" />
<!-- 学习记录弹窗 -->
<StudyRecordDialog v-if="studyRecordVisible" ref="StudyRecordDialog" />
</div>
</template>
<script>
import { getClassList } from '@/api/extend/lqStudyClass'
import CreateClassForm from './CreateClassForm'
import AddStudentForm from './AddStudentForm'
import StudentListDialog from './StudentListDialog'
import StudyRecordDialog from './StudyRecordDialog'
import Pagination from '@/components/Pagination'
export default {
name: 'LqStudyClass',
components: {
CreateClassForm,
AddStudentForm,
StudentListDialog,
StudyRecordDialog,
Pagination
},
data() {
return {
query: {
className: '',
teacherId: '',
startTime: '',
endTime: '',
currentPage: 1,
pageSize: 20
},
list: [],
total: 0,
listLoading: true,
createClassVisible: false,
addStudentVisible: false,
studentListVisible: false,
studyRecordVisible: false,
selectedIds: []
}
},
created() {
this.getList()
},
methods: {
// 获取班级列表
getList() {
this.listLoading = true
getClassList(this.query).then(response => {
if (response.code === 200) {
this.list = response.data.list || []
this.total = (response.data.pagination && response.data.pagination.total) || 0
} else {
this.$message.error(response.msg || '获取班级列表失败')
}
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
// 搜索
search() {
this.query.currentPage = 1
this.getList()
},
// 重置
reset() {
this.query = {
className: '',
teacherId: '',
startTime: '',
endTime: '',
currentPage: 1,
pageSize: 20
}
this.getList()
},
// 创建班级
addClassHandle() {
this.createClassVisible = true
this.$nextTick(() => {
this.$refs.CreateClassForm.init()
})
},
// 添加学员
addStudentHandle() {
if (this.selectedIds.length === 0) {
this.$message.warning('请先选择一个班级')
return
}
if (this.selectedIds.length > 1) {
this.$message.warning('请只选择一个班级')
return
}
// 找到选中的班级信息
const selectedClass = this.list.find(item => item.id === this.selectedIds[0])
if (selectedClass) {
this.addStudentVisible = true
this.$nextTick(() => {
this.$refs.AddStudentForm.init(selectedClass.id, selectedClass.className)
})
}
},
// 向班级添加学员
addStudentsToClass(row) {
this.addStudentVisible = true
this.$nextTick(() => {
this.$refs.AddStudentForm.init(row.id, row.className)
})
},
// 查看学员
viewStudents(row) {
this.studentListVisible = true
this.$nextTick(() => {
this.$refs.StudentListDialog.init(row.id, row.className)
})
},
// 查看学习记录
viewStudyRecords(row) {
this.studyRecordVisible = true
this.$nextTick(() => {
this.$refs.StudyRecordDialog.init(row.id, row.className)
})
},
// 多选
handleSelectionChange(selection) {
this.selectedIds = selection.map(item => item.id)
},
// 处理学员列表中的学习记录查看
handleViewStudyRecords(row) {
|