|
@@ -36,6 +36,7 @@
|
|
|
>
|
|
>
|
|
|
<a-button>导入</a-button>
|
|
<a-button>导入</a-button>
|
|
|
</a-upload>
|
|
</a-upload>
|
|
|
|
|
+ <a-button style="margin-left: 10px" @click="downloadImport">下载导入模板</a-button>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
<!-- 表格 -->
|
|
|
<a-table
|
|
<a-table
|
|
@@ -66,7 +67,9 @@
|
|
|
<a-button size="small" @click="onDetail(record)">详情</a-button>
|
|
<a-button size="small" @click="onDetail(record)">详情</a-button>
|
|
|
<!-- <a-button size="small" @click="onEdit(record)">编辑</a-button> -->
|
|
<!-- <a-button size="small" @click="onEdit(record)">编辑</a-button> -->
|
|
|
<!-- <a-button size="small" @click="onSetting(record)">设置</a-button> -->
|
|
<!-- <a-button size="small" @click="onSetting(record)">设置</a-button> -->
|
|
|
- <a-button size="small" danger @click="onDelete(record)">删除</a-button>
|
|
|
|
|
|
|
+ <a-popconfirm title="删除此短信?" @confirm="onDelete(record)">
|
|
|
|
|
+ <a-button size="small" danger>删除</a-button>
|
|
|
|
|
+ </a-popconfirm>
|
|
|
</a-space>
|
|
</a-space>
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
@@ -140,8 +143,8 @@
|
|
|
<th>性别</th>
|
|
<th>性别</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
- <td>{{ detailData.id }}</td>
|
|
|
|
|
- <td>{{ detailData.name }}</td>
|
|
|
|
|
|
|
+ <td>{{ detailData.ACCOUNT }}</td>
|
|
|
|
|
+ <td>{{ detailData.userIdName }}</td>
|
|
|
<td>{{ detailData.phone }}</td>
|
|
<td>{{ detailData.phone }}</td>
|
|
|
<td>{{ detailData.gender }}</td>
|
|
<td>{{ detailData.gender }}</td>
|
|
|
</tr>
|
|
</tr>
|
|
@@ -152,9 +155,9 @@
|
|
|
<th>所在城市</th>
|
|
<th>所在城市</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
- <td>{{ detailData.college }}</td>
|
|
|
|
|
|
|
+ <td>{{ detailData.orgIdName }}</td>
|
|
|
<td>{{ detailData.className }}</td>
|
|
<td>{{ detailData.className }}</td>
|
|
|
- <td>{{ detailData.birthday }}</td>
|
|
|
|
|
|
|
+ <td>{{ detailData.birth }}</td>
|
|
|
<td>{{ detailData.city }}</td>
|
|
<td>{{ detailData.city }}</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
@@ -164,10 +167,10 @@
|
|
|
<th>最后登录</th>
|
|
<th>最后登录</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
<tr>
|
|
<tr>
|
|
|
- <td>{{ detailData.educationStatus }}</td>
|
|
|
|
|
- <td>{{ detailData.onlineStatus }}</td>
|
|
|
|
|
- <td>{{ detailData.registerTime }}</td>
|
|
|
|
|
- <td>{{ detailData.lastLogin }}</td>
|
|
|
|
|
|
|
+ <td>{{ detailData.userStatus }}</td>
|
|
|
|
|
+ <td>{{ detailData.isLoginName }}</td>
|
|
|
|
|
+ <td>{{ detailData.createTime }}</td>
|
|
|
|
|
+ <td>{{ detailData.latestLoginTime }}</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
</table>
|
|
</table>
|
|
|
<div class="modal-btn-bar">
|
|
<div class="modal-btn-bar">
|
|
@@ -188,7 +191,14 @@
|
|
|
import { getStudentDetail } from '@/api/course/courseDetail'
|
|
import { getStudentDetail } from '@/api/course/courseDetail'
|
|
|
import studentSelection from './studentSelection.vue'
|
|
import studentSelection from './studentSelection.vue'
|
|
|
import tool from '@/utils/tool'
|
|
import tool from '@/utils/tool'
|
|
|
-
|
|
|
|
|
|
|
+ const props = defineProps({
|
|
|
|
|
+ //课程id
|
|
|
|
|
+ courseInfoId: {
|
|
|
|
|
+ type: Number,
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ default: null
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
// mock数据
|
|
// mock数据
|
|
|
const allStudents = ref([
|
|
const allStudents = ref([
|
|
|
// 生成20条mock数据
|
|
// 生成20条mock数据
|
|
@@ -240,7 +250,7 @@
|
|
|
const detailVisible = ref(false)
|
|
const detailVisible = ref(false)
|
|
|
const detailData = ref({})
|
|
const detailData = ref({})
|
|
|
const pagedDatas = ref([])
|
|
const pagedDatas = ref([])
|
|
|
- const rowKey = (record) => record.userId
|
|
|
|
|
|
|
+ const rowKey = (record) => record.relateId
|
|
|
|
|
|
|
|
const filteredData = computed(() => {
|
|
const filteredData = computed(() => {
|
|
|
let data = allStudents.value
|
|
let data = allStudents.value
|
|
@@ -280,8 +290,8 @@
|
|
|
addStudentVisible.value = false
|
|
addStudentVisible.value = false
|
|
|
searchForm.StudentIds = StudentIds.join(',')
|
|
searchForm.StudentIds = StudentIds.join(',')
|
|
|
let params = {
|
|
let params = {
|
|
|
- userIds: searchForm.StudentIds
|
|
|
|
|
- // courseId: pageSize.value
|
|
|
|
|
|
|
+ userIds: searchForm.StudentIds,
|
|
|
|
|
+ courseId: props.courseInfoId
|
|
|
}
|
|
}
|
|
|
studentDetailsApi
|
|
studentDetailsApi
|
|
|
.add(params)
|
|
.add(params)
|
|
@@ -344,14 +354,11 @@
|
|
|
const { file, onSuccess, onError } = options
|
|
const { file, onSuccess, onError } = options
|
|
|
importLoading.value = true
|
|
importLoading.value = true
|
|
|
try {
|
|
try {
|
|
|
- // const formData = new FormData()
|
|
|
|
|
- // formData.append('file', file)
|
|
|
|
|
- let params = {
|
|
|
|
|
- courseId: courseId.value,
|
|
|
|
|
- file
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const formData = new FormData()
|
|
|
|
|
+ formData.append('file', file)
|
|
|
|
|
+ formData.append('courseId', props.courseInfoId)
|
|
|
// 调用API接口
|
|
// 调用API接口
|
|
|
- const res = await studentDetailsApi.importStudents(params)
|
|
|
|
|
|
|
+ const res = await studentDetailsApi.importStudents(formData)
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
message.success(`成功导入 ${res.data.count} 条数据`)
|
|
message.success(`成功导入 ${res.data.count} 条数据`)
|
|
|
onSuccess(res, file)
|
|
onSuccess(res, file)
|
|
@@ -382,10 +389,10 @@
|
|
|
}
|
|
}
|
|
|
function onSelectAll() {
|
|
function onSelectAll() {
|
|
|
console.log(pagedDatas.value)
|
|
console.log(pagedDatas.value)
|
|
|
- selectedRowKeys.value = pagedDatas.value.map((item) => item.userId)
|
|
|
|
|
|
|
+ selectedRowKeys.value = pagedDatas.value.map((item) => item.relateId)
|
|
|
}
|
|
}
|
|
|
function onInvertSelect() {
|
|
function onInvertSelect() {
|
|
|
- const currentIds = pagedDatas.value.map((item) => item.userId)
|
|
|
|
|
|
|
+ const currentIds = pagedDatas.value.map((item) => item.relateId)
|
|
|
selectedRowKeys.value = currentIds.filter((id) => !selectedRowKeys.value.includes(id))
|
|
selectedRowKeys.value = currentIds.filter((id) => !selectedRowKeys.value.includes(id))
|
|
|
}
|
|
}
|
|
|
function onAddStudent() {
|
|
function onAddStudent() {
|
|
@@ -393,6 +400,36 @@
|
|
|
// 默认展开所有部门
|
|
// 默认展开所有部门
|
|
|
// expandedDeptIds.value = departments.value.map((d) => d.id)
|
|
// expandedDeptIds.value = departments.value.map((d) => d.id)
|
|
|
}
|
|
}
|
|
|
|
|
+ function downloadImport() {
|
|
|
|
|
+ studentDetailsApi
|
|
|
|
|
+ .downloadImportlate()
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ console.log(res.data, 'messagemessagemessage')
|
|
|
|
|
+ // 创建 blob 对象
|
|
|
|
|
+ const blob = new Blob([res.data], {
|
|
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
|
|
+ })
|
|
|
|
|
+ // 创建下载链接
|
|
|
|
|
+ const downloadUrl = window.URL.createObjectURL(blob)
|
|
|
|
|
+ const link = document.createElement('a')
|
|
|
|
|
+ link.href = downloadUrl
|
|
|
|
|
+
|
|
|
|
|
+ // 设置下载文件名(可以从响应头获取或固定)
|
|
|
|
|
+ link.download = '学生导入模板.xlsx'
|
|
|
|
|
+
|
|
|
|
|
+ // 触发下载
|
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
|
+ link.click()
|
|
|
|
|
+
|
|
|
|
|
+ // 清理
|
|
|
|
|
+ window.URL.revokeObjectURL(downloadUrl)
|
|
|
|
|
+ document.body.removeChild(link)
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ message.error('模板下载失败: ' + (err || err))
|
|
|
|
|
+ console.error(err)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
function handleAddStudentCancel() {
|
|
function handleAddStudentCancel() {
|
|
|
addStudentVisible.value = false
|
|
addStudentVisible.value = false
|
|
|
}
|
|
}
|
|
@@ -462,13 +499,13 @@
|
|
|
function onDetail(record) {
|
|
function onDetail(record) {
|
|
|
detailVisible.value = true
|
|
detailVisible.value = true
|
|
|
let params = {
|
|
let params = {
|
|
|
- id: record.userId
|
|
|
|
|
|
|
+ id: record.relateId
|
|
|
}
|
|
}
|
|
|
studentDetailsApi
|
|
studentDetailsApi
|
|
|
.detail(params)
|
|
.detail(params)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
console.log(res, '学员详情')
|
|
console.log(res, '学员详情')
|
|
|
- detailData.value = res.data.records
|
|
|
|
|
|
|
+ detailData.value = res.data
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
console.log(err)
|
|
console.log(err)
|
|
@@ -481,7 +518,20 @@
|
|
|
// TODO: 设置弹窗
|
|
// TODO: 设置弹窗
|
|
|
}
|
|
}
|
|
|
function onDelete(record) {
|
|
function onDelete(record) {
|
|
|
- // TODO: 删除确认
|
|
|
|
|
|
|
+ let params = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: record.relateId
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ studentDetailsApi
|
|
|
|
|
+ .delete(params)
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ console.log(res, '删除学员')
|
|
|
|
|
+ getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ console.log(err)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|