|
|
@ -1,25 +1,19 @@ |
|
|
|
<script setup> |
|
|
|
<script setup> |
|
|
|
import { Search, Edit, Delete, CircleClose } from '@element-plus/icons-vue' |
|
|
|
import { Search, Edit, Delete } from '@element-plus/icons-vue' |
|
|
|
import { ref, onMounted } from 'vue' |
|
|
|
import { ref, onMounted } from 'vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
// stuListService, |
|
|
|
stuListService, |
|
|
|
stuPageService, |
|
|
|
stuPageService, |
|
|
|
delStuListService, |
|
|
|
delStuListService, |
|
|
|
reStuPassService, |
|
|
|
reStuPassService, |
|
|
|
changeStaService, |
|
|
|
changeStaService, |
|
|
|
stuNumberService, |
|
|
|
|
|
|
|
} from '@/api/user/stud' |
|
|
|
} from '@/api/user/stud' |
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
import useUserStore from '@/store/modules/user' |
|
|
|
import useUserStore from '@/store/modules/user' |
|
|
|
import { tryOnMounted } from '@vueuse/core' |
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
|
const userStore = useUserStore() |
|
|
|
// console.log(userStore.data.id, 'icon') //用户信息 |
|
|
|
// console.log(userStore.data.id, 'icon') //用户信息 |
|
|
|
const formLabelWidth = '60px' |
|
|
|
const formLabelWidth = '60px' |
|
|
|
const tableData = ref([]) |
|
|
|
const tableData = ref([]) |
|
|
|
const total = ref() |
|
|
|
|
|
|
|
const show = ref(false) |
|
|
|
|
|
|
|
const show1 = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否是第一次加载 |
|
|
|
//是否是第一次加载 |
|
|
|
const isFirstLoad = ref(true) |
|
|
|
const isFirstLoad = ref(true) |
|
|
|
const params = ref({ |
|
|
|
const params = ref({ |
|
|
@ -35,14 +29,22 @@ const getData = async () => { |
|
|
|
loading.value = true |
|
|
|
loading.value = true |
|
|
|
await stuPageService(params.value).then((res) => { |
|
|
|
await stuPageService(params.value).then((res) => { |
|
|
|
tableData.value = res.data.Records |
|
|
|
tableData.value = res.data.Records |
|
|
|
total.value = res.data.totalCount |
|
|
|
// console.log(tableData.value, 'params') |
|
|
|
console.log(tableData.value, 'params') |
|
|
|
|
|
|
|
loading.value = false |
|
|
|
loading.value = false |
|
|
|
// console.log(res.data.totalCount, 'res.data') |
|
|
|
console.log(res.data, 'res.data') |
|
|
|
isFirstLoad.value = false |
|
|
|
isFirstLoad.value = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//学生 |
|
|
|
|
|
|
|
// const getData = async () => { |
|
|
|
|
|
|
|
// // id.value = userStore.data.id |
|
|
|
|
|
|
|
// // console.log(id.value, 'id.value') |
|
|
|
|
|
|
|
// stuListService(2).then((res) => { |
|
|
|
|
|
|
|
// tableData.value = res.data |
|
|
|
|
|
|
|
// console.log(res.data, 'res.data') |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
// } |
|
|
|
// 页面条数变化 |
|
|
|
// 页面条数变化 |
|
|
|
const onSizeChange = (size) => { |
|
|
|
const onSizeChange = (size) => { |
|
|
|
//页面条数变化了,原本正在访问的页面变化,重新从第一页渲染即可 |
|
|
|
//页面条数变化了,原本正在访问的页面变化,重新从第一页渲染即可 |
|
|
@ -58,12 +60,16 @@ const onCurrentChange = (page) => { |
|
|
|
params.value.page = page |
|
|
|
params.value.page = page |
|
|
|
getData() |
|
|
|
getData() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//重置 |
|
|
|
|
|
|
|
const onReset = () => { |
|
|
|
|
|
|
|
params.value.page = 1 |
|
|
|
|
|
|
|
getData() |
|
|
|
|
|
|
|
} |
|
|
|
//搜索 |
|
|
|
//搜索 |
|
|
|
// const onSearch = () => { |
|
|
|
const onSearch = () => { |
|
|
|
// params.value.pagenum = 1 |
|
|
|
params.value.pagenum = 1 |
|
|
|
// // getArticleService() |
|
|
|
// getArticleService() |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
|
const loading = ref(false) |
|
|
|
//编辑 |
|
|
|
//编辑 |
|
|
@ -75,7 +81,7 @@ const editTable = (row) => { |
|
|
|
} |
|
|
|
} |
|
|
|
//删除行 |
|
|
|
//删除行 |
|
|
|
const delTable = async (row) => { |
|
|
|
const delTable = async (row) => { |
|
|
|
// console.log(row.userId, 'delrow') |
|
|
|
console.log(row.userId, 'delrow') |
|
|
|
await ElMessageBox.confirm('您确定删除这条学生信息吗', '温馨提示', { |
|
|
|
await ElMessageBox.confirm('您确定删除这条学生信息吗', '温馨提示', { |
|
|
|
confirmButtonText: '确认', |
|
|
|
confirmButtonText: '确认', |
|
|
|
cancelButtonText: '取消', |
|
|
|
cancelButtonText: '取消', |
|
|
@ -93,11 +99,10 @@ const delTable = async (row) => { |
|
|
|
const selectedIds = ref([]) |
|
|
|
const selectedIds = ref([]) |
|
|
|
function handleSelectionChange(selection) { |
|
|
|
function handleSelectionChange(selection) { |
|
|
|
selectedIds.value = selection.map((row) => row.userId) |
|
|
|
selectedIds.value = selection.map((row) => row.userId) |
|
|
|
// console.log(selectedIds.value, 'selectedIds.value') |
|
|
|
console.log(selectedIds.value, 'selectedIds.value') |
|
|
|
} |
|
|
|
} |
|
|
|
const onDel = async () => { |
|
|
|
const onDel = async () => { |
|
|
|
if (selectedIds.value.length !== 0) { |
|
|
|
await ElMessageBox.confirm('您确定删除这些学生信息吗', '温馨提示', { |
|
|
|
await ElMessageBox.confirm('确定删除学生信息吗', '温馨提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确认', |
|
|
|
confirmButtonText: '确认', |
|
|
|
cancelButtonText: '取消', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
@ -108,17 +113,12 @@ const onDel = async () => { |
|
|
|
type: 'success', |
|
|
|
type: 'success', |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
getData() |
|
|
|
getData() |
|
|
|
} else { |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请选择要删除的学生', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//重置学生密码 |
|
|
|
//重置学生密码 |
|
|
|
const onResetPass = async () => { |
|
|
|
const onResetPass = async () => { |
|
|
|
if (selectedIds.value.length !== 0) { |
|
|
|
await ElMessageBox.confirm('您确定重置这些学生密码吗', '温馨提示', { |
|
|
|
await ElMessageBox.confirm('确定重置密码吗', '温馨提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确认', |
|
|
|
confirmButtonText: '确认', |
|
|
|
cancelButtonText: '取消', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
@ -130,113 +130,51 @@ const onResetPass = async () => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
getData() |
|
|
|
getData() |
|
|
|
} else { |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请选择要重置密码的学生', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//状态 |
|
|
|
//状态 |
|
|
|
const status = ref() |
|
|
|
const status = ref() |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
|
|
|
|
item.status = item.status === 1 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
async function handleStatusChange(row) { |
|
|
|
async function handleStatusChange(row) { |
|
|
|
status.value = row.status |
|
|
|
status.value = row.status |
|
|
|
console.log(status.value, 'status') |
|
|
|
// console.log(status.value, 'status') |
|
|
|
console.log(`状态更改: ${row.status}`) |
|
|
|
// console.log(`状态更改: ${row.status}`) |
|
|
|
if (!isFirstLoad.value) { |
|
|
|
// if (!isFirstLoad.value) { |
|
|
|
await changeStaService(status.value, row.userId).then(() => { |
|
|
|
// await changeStaService(status.value, row.userId).then(() => { |
|
|
|
ElMessage({ |
|
|
|
// ElMessage({ |
|
|
|
message: '状态更改成功', |
|
|
|
// message: '状态更改成功', |
|
|
|
type: 'success', |
|
|
|
// type: 'success', |
|
|
|
}) |
|
|
|
// }) |
|
|
|
}) |
|
|
|
// }) |
|
|
|
} |
|
|
|
// } |
|
|
|
getData() |
|
|
|
// getData() |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//姓名查询 |
|
|
|
|
|
|
|
const studentName = ref() |
|
|
|
|
|
|
|
function onFocus1() { |
|
|
|
|
|
|
|
show1.value = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// function onBlur1() { |
|
|
|
|
|
|
|
// show1.value = true |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
const closeName = () => { |
|
|
|
|
|
|
|
show1.value = false |
|
|
|
|
|
|
|
studentName.value = '' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const searchInfo = async () => { |
|
|
|
|
|
|
|
params.value.name = studentName.value |
|
|
|
|
|
|
|
// console.log(params.value.name, 'params.value.number') |
|
|
|
|
|
|
|
if (studentName.value.trim() !== '') { |
|
|
|
|
|
|
|
// show.value = true |
|
|
|
|
|
|
|
// console.log(params.value.name, 'params') |
|
|
|
|
|
|
|
await stuPageService({ |
|
|
|
|
|
|
|
page: 1, |
|
|
|
|
|
|
|
pagesize: 3, |
|
|
|
|
|
|
|
id: userStore.data.id, |
|
|
|
|
|
|
|
name: studentName.value, |
|
|
|
|
|
|
|
number: '', |
|
|
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
|
|
params.value.page = 1 |
|
|
|
|
|
|
|
console.log(res, 'change') |
|
|
|
|
|
|
|
getData() |
|
|
|
|
|
|
|
// studentName.value = '' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//学号查询 |
|
|
|
//学号查询 |
|
|
|
const studentId = ref() |
|
|
|
const studentId = ref() |
|
|
|
function onFocus() { |
|
|
|
|
|
|
|
show.value = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function onblur1() { |
|
|
|
|
|
|
|
show.value = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// closeName |
|
|
|
|
|
|
|
const clearIdinput = () => { |
|
|
|
|
|
|
|
show.value = false |
|
|
|
|
|
|
|
studentId.value = '' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const searchNumber = async () => { |
|
|
|
const searchNumber = async () => { |
|
|
|
// console.log(studentId.value, 'params.value.number') |
|
|
|
|
|
|
|
// console.log(studentId.value > 0, 'params') |
|
|
|
|
|
|
|
params.value.number = studentId.value |
|
|
|
params.value.number = studentId.value |
|
|
|
if (studentId.value > 0) { |
|
|
|
console.log(params.value.number, 'params.value.number') |
|
|
|
await stuPageService({ |
|
|
|
await stuPageService(params.value).then((res) => { |
|
|
|
page: 1, |
|
|
|
|
|
|
|
pagesize: 3, |
|
|
|
|
|
|
|
id: userStore.data.id, |
|
|
|
|
|
|
|
name: '', |
|
|
|
|
|
|
|
number: studentId.value, |
|
|
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
|
|
params.value.page = 1 |
|
|
|
params.value.page = 1 |
|
|
|
getData() |
|
|
|
console.log(res, 'change') |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
// getData() |
|
|
|
|
|
|
|
|
|
|
|
// console.log(res, 'change') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//重置 |
|
|
|
//查询 |
|
|
|
const onReset = () => { |
|
|
|
const studentName = ref() |
|
|
|
|
|
|
|
const searchInfo = async () => { |
|
|
|
|
|
|
|
params.value.name = studentName.value |
|
|
|
|
|
|
|
console.log(params.value.name, 'params.value.number') |
|
|
|
|
|
|
|
await stuPageService(params.value).then((res) => { |
|
|
|
params.value.page = 1 |
|
|
|
params.value.page = 1 |
|
|
|
params.value.name = '' |
|
|
|
console.log(res, 'change') |
|
|
|
params.value.number = '' |
|
|
|
}) |
|
|
|
getData() |
|
|
|
// getData() |
|
|
|
} |
|
|
|
} |
|
|
|
function clearInput() { |
|
|
|
function clearInput() { |
|
|
|
studentId.value = '' |
|
|
|
studentId.value = '' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function clearInput1() { |
|
|
|
function clearInput1() { |
|
|
|
studentName.value = '' |
|
|
|
studentName.value = '' |
|
|
|
} |
|
|
|
} |
|
|
|
const value1 = ref(true) |
|
|
|
|
|
|
|
console.log(typeof value1.value, 'value2') |
|
|
|
|
|
|
|
const changeStatus = async (row) => {} |
|
|
|
const changeStatus = async (row) => {} |
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
getData() |
|
|
|
getData() |
|
|
@ -249,7 +187,6 @@ onMounted(() => { |
|
|
|
<div class="card-header"> |
|
|
|
<div class="card-header"> |
|
|
|
<span>学生信息</span> |
|
|
|
<span>学生信息</span> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-switch v-model="value1" /> |
|
|
|
|
|
|
|
<el-button type="primary" @click="onResetPass">重置密码</el-button> |
|
|
|
<el-button type="primary" @click="onResetPass">重置密码</el-button> |
|
|
|
<el-button type="danger" @click="onDel">批量删除</el-button> |
|
|
|
<el-button type="danger" @click="onDel">批量删除</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -258,41 +195,24 @@ onMounted(() => { |
|
|
|
<div class="content"> |
|
|
|
<div class="content"> |
|
|
|
<el-form style="display: flex"> |
|
|
|
<el-form style="display: flex"> |
|
|
|
<el-form-item style="width: 250px"> |
|
|
|
<el-form-item style="width: 250px"> |
|
|
|
|
|
|
|
<!-- <p>学号</p> --> |
|
|
|
<el-input |
|
|
|
<el-input |
|
|
|
class="input_search" |
|
|
|
class="input_search" |
|
|
|
v-model="studentId" |
|
|
|
v-model="studentId" |
|
|
|
@focus="onFocus" |
|
|
|
@blur="clearInput" |
|
|
|
placeholder="输入学号进行搜索" |
|
|
|
|
|
|
|
></el-input> |
|
|
|
></el-input> |
|
|
|
<el-icon |
|
|
|
|
|
|
|
color="gray" |
|
|
|
|
|
|
|
:size="12" |
|
|
|
|
|
|
|
style="margin-right: 20px" |
|
|
|
|
|
|
|
@click="clearIdinput" |
|
|
|
|
|
|
|
v-if="show" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<CircleClose /> |
|
|
|
|
|
|
|
</el-icon> |
|
|
|
|
|
|
|
<el-icon><Search /></el-icon> |
|
|
|
<el-icon><Search /></el-icon> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-button class="btn_search" @click="searchNumber">搜索</el-button> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button class="btn_search" @click="searchNumber"> |
|
|
|
|
|
|
|
学号搜索 |
|
|
|
|
|
|
|
</el-button> |
|
|
|
<el-form-item style="width: 250px; margin-left: 30px"> |
|
|
|
<el-form-item style="width: 250px; margin-left: 30px"> |
|
|
|
<el-input |
|
|
|
<el-input |
|
|
|
class="input_search" |
|
|
|
class="input_search" |
|
|
|
|
|
|
|
@blur="clearInput1" |
|
|
|
v-model="studentName" |
|
|
|
v-model="studentName" |
|
|
|
@focus="onFocus1" |
|
|
|
|
|
|
|
placeholder="输入姓名进行搜索" |
|
|
|
|
|
|
|
></el-input> |
|
|
|
></el-input> |
|
|
|
<el-icon |
|
|
|
|
|
|
|
color="gray" |
|
|
|
|
|
|
|
:size="12" |
|
|
|
|
|
|
|
style="margin-right: 20px" |
|
|
|
|
|
|
|
v-if="show1" |
|
|
|
|
|
|
|
@click="closeName" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<CircleClose /> |
|
|
|
|
|
|
|
</el-icon> |
|
|
|
|
|
|
|
<el-icon><Search /></el-icon> |
|
|
|
<el-icon><Search /></el-icon> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-button class="btn_search" @click="searchInfo">搜索</el-button> |
|
|
|
<el-button class="btn_search" @click="searchInfo">搜索</el-button> |
|
|
@ -345,6 +265,7 @@ onMounted(() => { |
|
|
|
<el-table-column prop="phone" label="手机号" width="120" /> |
|
|
|
<el-table-column prop="phone" label="手机号" width="120" /> |
|
|
|
<el-table-column prop="major" label="专业" /> |
|
|
|
<el-table-column prop="major" label="专业" /> |
|
|
|
<el-table-column prop="yearAge" label="年级" /> |
|
|
|
<el-table-column prop="yearAge" label="年级" /> |
|
|
|
|
|
|
|
<!-- <el-table-column prop="className" label="班级" /> --> |
|
|
|
<el-table-column prop="createTime" label="创建时间" width="200" /> |
|
|
|
<el-table-column prop="createTime" label="创建时间" width="200" /> |
|
|
|
<el-table-column prop="status" label="状态"> |
|
|
|
<el-table-column prop="status" label="状态"> |
|
|
|
<template v-slot="scope"> |
|
|
|
<template v-slot="scope"> |
|
|
@ -389,7 +310,7 @@ onMounted(() => { |
|
|
|
:disabled="disabled" |
|
|
|
:disabled="disabled" |
|
|
|
:background="true" |
|
|
|
:background="true" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
:total="total" |
|
|
|
:total="10" |
|
|
|
@size-change="onSizeChange" |
|
|
|
@size-change="onSizeChange" |
|
|
|
@current-change="onCurrentChange" |
|
|
|
@current-change="onCurrentChange" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -467,8 +388,6 @@ onMounted(() => { |
|
|
|
background: #ffffff; |
|
|
|
background: #ffffff; |
|
|
|
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1); |
|
|
|
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1); |
|
|
|
flex: 1; |
|
|
|
flex: 1; |
|
|
|
font-family: Inter, 'Helvetica Neue', Helvetica, 'PingFang SC', |
|
|
|
|
|
|
|
'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.card-header { |
|
|
|
.card-header { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
@ -476,7 +395,7 @@ onMounted(() => { |
|
|
|
justify-content: space-between; |
|
|
|
justify-content: space-between; |
|
|
|
} |
|
|
|
} |
|
|
|
.content { |
|
|
|
.content { |
|
|
|
min-height: 660px; |
|
|
|
min-height: 440px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.input_search { |
|
|
|
.input_search { |
|
|
@ -488,13 +407,9 @@ onMounted(() => { |
|
|
|
right: 10px; |
|
|
|
right: 10px; |
|
|
|
top: 50%; |
|
|
|
top: 50%; |
|
|
|
transform: translateY(-50%); |
|
|
|
transform: translateY(-50%); |
|
|
|
.close { |
|
|
|
|
|
|
|
margin-right: 10px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.btn_search { |
|
|
|
.btn_search { |
|
|
|
margin: 0px 15px; |
|
|
|
margin-left: 15px; |
|
|
|
// margin-top: 12px; |
|
|
|
|
|
|
|
border-radius: 8px; |
|
|
|
border-radius: 8px; |
|
|
|
font-size: 13px; |
|
|
|
font-size: 13px; |
|
|
|
background-color: #377be5; |
|
|
|
background-color: #377be5; |
|
|
@ -531,9 +446,6 @@ onMounted(() => { |
|
|
|
justify-content: end; |
|
|
|
justify-content: end; |
|
|
|
font-size: 12px; |
|
|
|
font-size: 12px; |
|
|
|
} |
|
|
|
} |
|
|
|
h5 { |
|
|
|
|
|
|
|
margin-top: 22px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.avatar-uploader { |
|
|
|
.avatar-uploader { |
|
|
|
:deep() { |
|
|
|
:deep() { |
|
|
|
.avatar { |
|
|
|
.avatar { |
|
|
|