2023.6.25
1. 答辩完成
This commit is contained in:
parent
c28867e3e4
commit
60040d341c
@ -57,6 +57,13 @@ public class ExperimentFactory {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("解析实验申请用户失败");
|
log.error("解析实验申请用户失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
experiment.setAnnex(jsonObject.getString("annex"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("解析实验申请附件失败");
|
||||||
|
}
|
||||||
return experiment;
|
return experiment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import java.util.UUID;
|
|||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class FileController {
|
public class FileController {
|
||||||
private final Path fileStorageLocation = Paths.get("/Users/springforest/Downloads/软件实训/");
|
private final Path fileStorageLocation = Paths.get("/Users/springforest/Downloads/软件实训/uploads/");
|
||||||
|
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public ResVo uploadFile(@RequestParam("file") MultipartFile file) {
|
public ResVo uploadFile(@RequestParam("file") MultipartFile file) {
|
||||||
@ -51,7 +51,6 @@ public class FileController {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return ResVo.error("文件上传失败");
|
return ResVo.error("文件上传失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/download/{fileName}")
|
@GetMapping("/download/{fileName}")
|
||||||
|
@ -3,6 +3,7 @@ package com.sdut.labex.controller;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.sdut.labex.Factory.UserFactory;
|
import com.sdut.labex.Factory.UserFactory;
|
||||||
import com.sdut.labex.entity.User;
|
import com.sdut.labex.entity.User;
|
||||||
|
import com.sdut.labex.service.LogService;
|
||||||
import com.sdut.labex.service.UserService;
|
import com.sdut.labex.service.UserService;
|
||||||
import com.sdut.labex.utils.ResVo;
|
import com.sdut.labex.utils.ResVo;
|
||||||
import com.sdut.labex.utils.UserHolder;
|
import com.sdut.labex.utils.UserHolder;
|
||||||
@ -22,6 +23,8 @@ import javax.annotation.Resource;
|
|||||||
public class UserController {
|
public class UserController {
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Resource
|
||||||
|
private LogService logService;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public ResVo login(@RequestBody JSONObject jsonObject) {
|
public ResVo login(@RequestBody JSONObject jsonObject) {
|
||||||
@ -63,4 +66,9 @@ public class UserController {
|
|||||||
User user = UserFactory.createUser(jsonObject);
|
User user = UserFactory.createUser(jsonObject);
|
||||||
return userService.add(user);
|
return userService.add(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/log/{pageNum}/{pageSize}")
|
||||||
|
public ResVo getLog(@PathVariable("pageNum") int pageNum, @PathVariable("pageSize") int pageSize) {
|
||||||
|
return logService.getLog(pageNum, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class TimeTable {
|
|||||||
|
|
||||||
public int startWeek;
|
public int startWeek;
|
||||||
public int endWeek;
|
public int endWeek;
|
||||||
public String name;
|
public String applyUser;
|
||||||
public String[] time;
|
public String[] time;
|
||||||
public String reason;
|
public String reason;
|
||||||
|
|
||||||
@ -61,6 +61,6 @@ public class TimeTable {
|
|||||||
this.startWeek = Integer.parseInt(startWeekTemp);
|
this.startWeek = Integer.parseInt(startWeekTemp);
|
||||||
this.endWeek = Integer.parseInt(endWeekTemp);
|
this.endWeek = Integer.parseInt(endWeekTemp);
|
||||||
|
|
||||||
this.name = temp[2];
|
this.applyUser = temp[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,6 +48,10 @@ public class Experiment implements Serializable {
|
|||||||
* 申请人
|
* 申请人
|
||||||
*/
|
*/
|
||||||
private String applyUser;
|
private String applyUser;
|
||||||
|
/*
|
||||||
|
* 附件
|
||||||
|
* */
|
||||||
|
private String annex;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -20,7 +20,7 @@ import java.util.Map;
|
|||||||
public interface BorrowInfoMapper extends BaseMapper<BorrowInfo> {
|
public interface BorrowInfoMapper extends BaseMapper<BorrowInfo> {
|
||||||
public Page<BorrowInfo> queryBorrowInfoByOptions(Page<BorrowInfo> page, BorrowInfo borrowInfo);
|
public Page<BorrowInfo> queryBorrowInfoByOptions(Page<BorrowInfo> page, BorrowInfo borrowInfo);
|
||||||
|
|
||||||
public void addTimeTable(Map<String, String> map);
|
public void addTimeTable(Map<String, Object> map);
|
||||||
|
|
||||||
public List<Room> notBorrowedYet(@Param("timeList") List<String> timeList, @Param("date") String date);
|
public List<Room> notBorrowedYet(@Param("timeList") List<String> timeList, @Param("date") String date);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface LogMapper extends BaseMapper<LogEntity> {
|
public interface LogMapper extends BaseMapper<LogEntity> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.sdut.labex.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sdut.labex.entity.LogEntity;
|
import com.sdut.labex.entity.LogEntity;
|
||||||
|
import com.sdut.labex.utils.ResVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author springforest
|
* @author springforest
|
||||||
@ -10,6 +11,6 @@ import com.sdut.labex.entity.LogEntity;
|
|||||||
*/
|
*/
|
||||||
public interface LogService extends IService<LogEntity> {
|
public interface LogService extends IService<LogEntity> {
|
||||||
|
|
||||||
public void insertLog(LogEntity log);
|
public ResVo getLog(int pageNum, int pageSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -138,14 +138,15 @@ public class ExperimentsServiceImpl extends ServiceImpl<ExperimentsMapper, Exper
|
|||||||
queryWrapper.eq("class_name", className);
|
queryWrapper.eq("class_name", className);
|
||||||
users = usersMapper.selectList(queryWrapper);
|
users = usersMapper.selectList(queryWrapper);
|
||||||
for (User user : users) {
|
for (User user : users) {
|
||||||
|
|
||||||
SubmitRecord submitRecord = new SubmitRecord();
|
SubmitRecord submitRecord = new SubmitRecord();
|
||||||
submitRecord.setExperimentId(experiment.getId());
|
submitRecord.setExperimentId(experiment.getId());
|
||||||
submitRecord.setStudentId(user.getId());
|
submitRecord.setStudentId(user.getId());
|
||||||
submitRecordList.add(submitRecord);
|
submitRecordList.add(submitRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(submitRecordList);
|
if (submitRecordList.size() == 0) {
|
||||||
|
return ResVo.error("该实验没有班级");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
submitRecordsMapper.insertBatch(submitRecordList);
|
submitRecordsMapper.insertBatch(submitRecordList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package com.sdut.labex.service.impl;
|
package com.sdut.labex.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.sdut.labex.entity.LogEntity;
|
import com.sdut.labex.entity.LogEntity;
|
||||||
import com.sdut.labex.mapper.LogMapper;
|
import com.sdut.labex.mapper.LogMapper;
|
||||||
import com.sdut.labex.service.LogService;
|
import com.sdut.labex.service.LogService;
|
||||||
|
import com.sdut.labex.utils.ResVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author springforest
|
* @author springforest
|
||||||
@ -21,12 +25,14 @@ public class LogServiceImpl extends ServiceImpl<LogMapper, LogEntity>
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertLog(LogEntity log) {
|
public ResVo getLog(int pageNum, int pageSize) {
|
||||||
try {
|
Page<LogEntity> page = new Page<>(pageNum, pageSize);
|
||||||
logMapper.insert(log);
|
logMapper.selectPage(page, null);
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
Map<String, Object> map = new HashMap<>();
|
||||||
}
|
map.put("total", page.getTotal());
|
||||||
|
map.put("list", page.getRecords());
|
||||||
|
return ResVo.ok(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class TableServiceImpl implements TableService {
|
|||||||
|
|
||||||
// 解析文件,将单元格内容解析为List
|
// 解析文件,将单元格内容解析为List
|
||||||
// 处理list
|
// 处理list
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
Date today = new Date();
|
Date today = new Date();
|
||||||
@ -131,11 +131,11 @@ public class TableServiceImpl implements TableService {
|
|||||||
String[] ttmp = temp.split("/");
|
String[] ttmp = temp.split("/");
|
||||||
if (ttmp.length <= 10) {
|
if (ttmp.length <= 10) {
|
||||||
TimeTable timeTable = new TimeTable(temp);
|
TimeTable timeTable = new TimeTable(temp);
|
||||||
map.put("name", timeTable.getName());
|
map.put("applyUser", timeTable.getApplyUser());
|
||||||
map.put("reason", timeTable.getReason());
|
|
||||||
map.put("roomName", roomName);
|
map.put("roomName", roomName);
|
||||||
map.put("applyDate", dateFormat.format(today));
|
map.put("date", dateFormat.format(today));
|
||||||
map.put("isAdmit", "1");
|
map.put("isAdmit", "1");
|
||||||
|
map.put("applyDate", new Date());
|
||||||
calendar.add(Calendar.DATE, 7 * (timeTable.getStartWeek() - 1)); // 设置开始周
|
calendar.add(Calendar.DATE, 7 * (timeTable.getStartWeek() - 1)); // 设置开始周
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -39,8 +39,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
return ResVo.error("用户不存在");
|
return ResVo.error("用户不存在");
|
||||||
}
|
}
|
||||||
//仅测试用
|
|
||||||
//todo:上线后删除||判断
|
|
||||||
if (password.equals(user.getPassword()) || DigestUtils.md5DigestAsHex(password.getBytes()).equals(user.getPassword())) {
|
if (password.equals(user.getPassword()) || DigestUtils.md5DigestAsHex(password.getBytes()).equals(user.getPassword())) {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("id", user.getId());
|
map.put("id", user.getId());
|
||||||
@ -177,7 +176,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|||||||
if (excel.readCell(i, 4) == null) {
|
if (excel.readCell(i, 4) == null) {
|
||||||
return ResVo.error("Excel格式错误:第" + (i + 1) + "行第5列");
|
return ResVo.error("Excel格式错误:第" + (i + 1) + "行第5列");
|
||||||
}
|
}
|
||||||
user.setRole(excel.readCell(i, 3));
|
user.setRole(excel.readCell(i, 4));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return ResVo.error("Excel格式错误:第" + (i + 1) + "行第5列");
|
return ResVo.error("Excel格式错误:第" + (i + 1) + "行第5列");
|
||||||
@ -204,4 +203,5 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|||||||
map.put("list", page.getRecords());
|
map.put("list", page.getRecords());
|
||||||
return ResVo.ok(map);
|
return ResVo.ok(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8085
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 10MB # 设置上传文件的最大大小为10MB
|
||||||
|
max-request-size: 100MB # 设置上传数据的最大总大小为100MB
|
||||||
# Redis
|
# Redis
|
||||||
redis:
|
redis:
|
||||||
host: 8.219.96.16
|
host: 8.219.96.16
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
and room_name = #{borrowInfo.roomName}
|
and room_name = #{borrowInfo.roomName}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by apply_date desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<result property="className" column="class_name" jdbcType="VARCHAR"/>
|
<result property="className" column="class_name" jdbcType="VARCHAR"/>
|
||||||
<result property="applyTime" column="apply_time" jdbcType="VARCHAR"/>
|
<result property="applyTime" column="apply_time" jdbcType="VARCHAR"/>
|
||||||
<result property="applyUser" column="apply_user" jdbcType="VARCHAR"/>
|
<result property="applyUser" column="apply_user" jdbcType="VARCHAR"/>
|
||||||
|
<result property="annex" column="annex" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
@ -103,8 +103,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
url = '/getUsedTable';
|
url = '/getUsedTable';
|
||||||
}
|
}
|
||||||
url = '/getUsedTable';
|
|
||||||
|
|
||||||
this.$http({
|
this.$http({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -12,7 +12,7 @@ app.use(store).use(router).mount('#app')
|
|||||||
|
|
||||||
app.config.globalProperties.$http = axios;
|
app.config.globalProperties.$http = axios;
|
||||||
//接口请求的基准路径
|
//接口请求的基准路径
|
||||||
axios.defaults.baseURL = 'http://10.0.0.157:8080/';
|
axios.defaults.baseURL = 'http://localhost:8085/';
|
||||||
// axios.defaults.baseURL = 'http://211.64.28.110:8080/';
|
// axios.defaults.baseURL = 'http://211.64.28.110:8080/';
|
||||||
|
|
||||||
// 添加请求拦截器
|
// 添加请求拦截器
|
||||||
|
@ -34,9 +34,9 @@ const routes = [
|
|||||||
component: () => import('../views/Admin/UserManage.vue')
|
component: () => import('../views/Admin/UserManage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/RoomTimeAndReasonManage',
|
path: '/System',
|
||||||
name: 'RoomTimeAndReasonManage',
|
name: 'System',
|
||||||
component: () => import('../views/Admin/RoomAndTimeManage.vue')
|
component: () => import('../views/Admin/System.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/Personal',
|
path: '/Personal',
|
||||||
@ -57,6 +57,10 @@ const routes = [
|
|||||||
path: '/Sub',
|
path: '/Sub',
|
||||||
name: 'Sub',
|
name: 'Sub',
|
||||||
component: () => import('../views/Student/Sub.vue')
|
component: () => import('../views/Student/Sub.vue')
|
||||||
|
}, {
|
||||||
|
path: '/Log',
|
||||||
|
name: 'Log',
|
||||||
|
component: () => import('../views/Admin/Log.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -39,7 +39,7 @@ export default {
|
|||||||
getAllAdmit() {
|
getAllAdmit() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$http({
|
this.$http({
|
||||||
url: '/experiments/1/10',
|
url: '/experiments/1/30',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
status: 0
|
status: 0
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
if (data.code !== 200) {
|
if (data.code !== 200) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '操作失败',
|
message: data.msg,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -82,7 +82,7 @@ export default {
|
|||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
if (data.code !== 200) {
|
if (data.code !== 200) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '操作失败',
|
message: data.msg,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
67
web/src/views/Admin/Log.vue
Normal file
67
web/src/views/Admin/Log.vue
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<el-page-header content="系统日志" style="margin-bottom: 30px" @back="this.$router.push('/Login')"/>
|
||||||
|
<el-card style="max-width: 1200px;margin:0 auto;background-color: #f9fafb">
|
||||||
|
<!--表格展示-->
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<el-table :data="list" border stripe v-loading="loading">
|
||||||
|
<el-table-column align="center" prop="id" label="ID"/>
|
||||||
|
<el-table-column align="center" prop="content" label="请求方法"/>
|
||||||
|
<el-table-column align="center" prop="date" label="时间"/>
|
||||||
|
<el-table-column align="center" prop="cost" label="耗时"/>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="getLog"
|
||||||
|
@current-change="getLog"
|
||||||
|
v-model:current-page="pageNum"
|
||||||
|
|
||||||
|
v-model:page-size="pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total">
|
||||||
|
</el-pagination>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
let formData = new FormData;
|
||||||
|
export default {
|
||||||
|
name: "Log",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
isEdit: false,
|
||||||
|
|
||||||
|
pageSize: 30,
|
||||||
|
pageNum: 1,
|
||||||
|
total: 0,
|
||||||
|
|
||||||
|
list: [],
|
||||||
|
dialogVisibleForAdd: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getLog();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getLog() {
|
||||||
|
this.loading = true;
|
||||||
|
this.list = [];
|
||||||
|
this.$http({
|
||||||
|
method: 'get',
|
||||||
|
url: '/log/' + this.pageNum + '/' + this.pageSize,
|
||||||
|
}).then(({data}) => {
|
||||||
|
this.list = data.list;
|
||||||
|
this.total = data.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -204,6 +204,7 @@ export default {
|
|||||||
message: res.data.msg,
|
message: res.data.msg,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
});
|
});
|
||||||
|
this.getUser()
|
||||||
} else {
|
} else {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '文件解析失败',
|
title: '文件解析失败',
|
||||||
|
@ -9,6 +9,15 @@
|
|||||||
<el-input v-model="form.className" type="text" id="name" required/>
|
<el-input v-model="form.className" type="text" id="name" required/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="btn-Ex">
|
<el-form-item class="btn-Ex">
|
||||||
|
<el-upload :on-change="fileChange"
|
||||||
|
:show-file-list="false"
|
||||||
|
:auto-upload="false"
|
||||||
|
v-if="form.annex === null">
|
||||||
|
<el-button type="primary">上传附件</el-button>
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
<el-button type="primary" @click="submit">确认</el-button>
|
<el-button type="primary" @click="submit">确认</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</form>
|
</form>
|
||||||
@ -45,6 +54,7 @@
|
|||||||
import {computed, ref} from 'vue'
|
import {computed, ref} from 'vue'
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
|
let formData = new FormData;
|
||||||
const size = ref('')
|
const size = ref('')
|
||||||
computed(() => {
|
computed(() => {
|
||||||
const marginMap = {
|
const marginMap = {
|
||||||
@ -66,7 +76,8 @@ export default {
|
|||||||
className: '',
|
className: '',
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0
|
total: 0,
|
||||||
|
annex: null
|
||||||
},
|
},
|
||||||
size: '',
|
size: '',
|
||||||
}
|
}
|
||||||
@ -130,6 +141,37 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
fileChange(files, fileList) {
|
||||||
|
formData.append('file', files.raw)
|
||||||
|
files = null;
|
||||||
|
this.loading = true;
|
||||||
|
this.$http({
|
||||||
|
method: 'post',
|
||||||
|
url: '/upload',
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
this.$notify({
|
||||||
|
title: '上传成功',
|
||||||
|
message: res.data.msg,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
this.form.annex = res.data.fileName;
|
||||||
|
} else {
|
||||||
|
this.$notify({
|
||||||
|
title: '文件解析失败',
|
||||||
|
message: res.data.msg,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
formData = null;
|
||||||
|
formData = new FormData();
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
<el-page-header content="实验批阅" style="margin-bottom: 30px" @back="this.$router.push('/Login')"/>
|
<el-page-header content="实验批阅" style="margin-bottom: 30px" @back="this.$router.push('/Login')"/>
|
||||||
<el-card style="max-width: 1200px;margin:0 auto;background-color: #f9fafb">
|
<el-card style="max-width: 1200px;margin:0 auto;background-color: #f9fafb">
|
||||||
|
<el-space style="margin-bottom: 10px">
|
||||||
|
<el-input placeholder="请输入学生ID" v-model="form.studentId"/>
|
||||||
|
<el-button @click="getList">搜索</el-button>
|
||||||
|
</el-space>
|
||||||
<!--表格展示-->
|
<!--表格展示-->
|
||||||
<div style="margin-top: 20px">
|
<div style="margin-top: 20px">
|
||||||
<el-table :data="list" border stripe v-loading="loading">
|
<el-table :data="list" border stripe v-loading="loading">
|
||||||
@ -67,7 +71,7 @@
|
|||||||
|
|
||||||
let formData = new FormData;
|
let formData = new FormData;
|
||||||
export default {
|
export default {
|
||||||
naname: "ExperimentReview",
|
name: "ExperimentReview",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
@ -81,7 +85,7 @@ export default {
|
|||||||
},
|
},
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
total: 0
|
total: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
</el-space>
|
</el-space>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-button type="primary" @click="preBorrow(item.name)" v-if="item.status === 1" style="width: 100%">
|
<el-button type="primary" @click="preBorrow(item.name)" v-if="item.status === 1" style="width: 100%">
|
||||||
借用该教室
|
借用该教室
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -43,9 +43,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="导入课表" v-show="userInfo.role === 'admin'">
|
<el-form-item label="导入课表" v-show="userInfo.role === 'admin'">
|
||||||
<a href="/static/template.xls" download="课表模板.xlsx">
|
<el-button type="primary" @click="download('tableTemplate.xls')">下载模版
|
||||||
<el-button type="primary" style="margin-right: 10px;" :loading="loading">下载模板</el-button>
|
</el-button>
|
||||||
</a>
|
|
||||||
<el-breadcrumb :separator-icon="ArrowRight" style="margin-right: 20px;">
|
<el-breadcrumb :separator-icon="ArrowRight" style="margin-right: 20px;">
|
||||||
<el-date-picker v-model="this.startDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
<el-date-picker v-model="this.startDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||||
placeholder="学期开始日期"/>
|
placeholder="学期开始日期"/>
|
||||||
@ -64,17 +63,17 @@
|
|||||||
<el-table-column align="center" prop="roomName" label="教室名称"/>
|
<el-table-column align="center" prop="roomName" label="教室名称"/>
|
||||||
<el-table-column align="center" prop="applyUser" label="借用人"/>
|
<el-table-column align="center" prop="applyUser" label="借用人"/>
|
||||||
<el-table-column align="center" prop="applyDate" label="申请时间"/>
|
<el-table-column align="center" prop="applyDate" label="申请时间"/>
|
||||||
<el-table-column align="center" width="100" label="状态">
|
<!-- <el-table-column align="center" width="100" label="状态">-->
|
||||||
<template #default="scope">
|
<!-- <template #default="scope">-->
|
||||||
<el-tag v-show="scope.row.isAdmit === 0" type="warning">待审核</el-tag>
|
<!-- <el-tag v-show="scope.row.isAdmit === 0" type="warning">待审核</el-tag>-->
|
||||||
<el-tag v-show="scope.row.isAdmit === 2" type="danger">拒绝</el-tag>
|
<!-- <el-tag v-show="scope.row.isAdmit === 2" type="danger">拒绝</el-tag>-->
|
||||||
<el-tag v-show="scope.row.isAdmit === 1" type="success">通过</el-tag>
|
<!-- <el-tag v-show="scope.row.isAdmit === 1" type="success">通过</el-tag>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
<el-table-column align="center" label="操作">
|
<el-table-column align="center" label="操作">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="danger" @click="cancel(scope.row.id)"
|
<el-button type="danger" @click="cancel(scope.row.id)"
|
||||||
v-show="userInfo.role === 'admin' || userInfo.username === scope.row.name">撤销
|
v-if="userInfo.role === 'admin' || userInfo.username === scope.row.applyUser">撤销
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -132,10 +131,13 @@ export default {
|
|||||||
startDate: null,
|
startDate: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.userInfo.role = window.sessionStorage.getItem("role");
|
this.userInfo.role = window.sessionStorage.getItem("role");
|
||||||
this.userInfo.userId = window.sessionStorage.getItem("userId");
|
this.userInfo.userId = window.sessionStorage.getItem("userId");
|
||||||
this.userInfo.username = window.sessionStorage.getItem("username");
|
this.userInfo.username = window.sessionStorage.getItem("username");
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
this.getBorrowInfo();
|
this.getBorrowInfo();
|
||||||
this.getAllRooms();
|
this.getAllRooms();
|
||||||
this.getAllTimeOptions();
|
this.getAllTimeOptions();
|
||||||
@ -221,12 +223,12 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.append("startDate", this.startDate);
|
formData.append("date", this.startDate);
|
||||||
formData.append("roomName", this.subForm.roomName);
|
formData.append("room", this.subForm.roomName);
|
||||||
|
|
||||||
this.$http({
|
this.$http({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: '/file/importTimeTable',
|
url: '/uploadTable',
|
||||||
data: formData,
|
data: formData,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data'
|
'Content-Type': 'multipart/form-data'
|
||||||
@ -251,6 +253,27 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
download(fileName) {
|
||||||
|
this.$http({
|
||||||
|
url: '/download/' + fileName,
|
||||||
|
method: 'GET',
|
||||||
|
responseType: 'blob',
|
||||||
|
}).then((response) => {
|
||||||
|
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute('download', fileName);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
}).catch((error) => {
|
||||||
|
if (error.response && error.response.status === 404) {
|
||||||
|
this.$message.error('文件不存在!');
|
||||||
|
} else {
|
||||||
|
// 对于其他错误,可以选择不同的处理方式
|
||||||
|
this.$message.error('下载文件时发生错误!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,18 +15,19 @@
|
|||||||
alt="">
|
alt="">
|
||||||
</div>
|
</div>
|
||||||
<el-menu-item index="/ApplyExperiment" v-if="userInfo.role!=='student'">实验项目申请</el-menu-item>
|
<el-menu-item index="/ApplyExperiment" v-if="userInfo.role!=='student'">实验项目申请</el-menu-item>
|
||||||
<el-menu-item index="/Admit" v-if="userInfo.role!=='student'">实验项目审核</el-menu-item>
|
<el-menu-item index="/Admit" v-if="userInfo.role==='admin'">实验项目审核</el-menu-item>
|
||||||
<el-menu-item index="/ExperimentCheck" v-if="userInfo.role!=='student'">实验项目批阅</el-menu-item>
|
<el-menu-item index="/ExperimentCheck" v-if="userInfo.role!=='student'">实验项目批阅</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/BorrowRoom" v-if="userInfo.role!=='student'">教室申请</el-menu-item>
|
<el-menu-item index="/BorrowRoom" v-if="userInfo.role!=='student'">教室申请</el-menu-item>
|
||||||
<el-menu-item index="/BorrowRoom" v-if="userInfo.role==='student'">课表查看</el-menu-item>
|
<el-menu-item index="/BorrowRoom" v-if="userInfo.role==='student'">课表查看</el-menu-item>
|
||||||
<el-menu-item index="/RecordList" v-if="userInfo.role!=='student'">教室申请记录查询</el-menu-item>
|
<el-menu-item index="/RecordList" v-if="userInfo.role!=='student'">教室申请记录</el-menu-item>
|
||||||
<el-menu-item index="/Sub">我的实验</el-menu-item>
|
<el-menu-item index="/Sub" v-if="userInfo.role==='student'">我的实验</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/UserManage" v-if="userInfo.role!=='student'">用户管理</el-menu-item>
|
<el-menu-item index="/UserManage" v-if="userInfo.role==='admin'">用户管理</el-menu-item>
|
||||||
<el-menu-item index="/Personal">个人信息</el-menu-item>
|
<el-menu-item index="/Personal">个人信息</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/RoomTimeAndReasonManage" v-if="userInfo.role!=='student'">系统管理</el-menu-item>
|
<el-menu-item index="/System" v-if="userInfo.role!=='student'">系统管理</el-menu-item>
|
||||||
|
<el-menu-item index="/Log" v-if="userInfo.role==='admin'">系统日志</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</div>
|
</div>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
@ -18,11 +18,12 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作">
|
<el-table-column fixed="right" label="操作">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-upload :on-change="fileChange" v-if="scope.row.filePath === ''" :show-file-list="false"
|
<el-upload :on-change="fileChange" v-if="scope.row.filePath === null ||scope.row.filePath === '' "
|
||||||
|
:show-file-list="false"
|
||||||
:auto-upload="false">
|
:auto-upload="false">
|
||||||
<el-button link type="primary" size="small" @click="change(scope.row)">上传</el-button>
|
<el-button link type="primary" size="small" @click="change(scope.row)">上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-button link type="primary" size="small" v-if="scope.row.filePath !== ''"
|
<el-button link type="primary" size="small" v-if="scope.row.filePath !== null && scope.row.filePath !== ''"
|
||||||
@click="download(scope.row.filePath)">下载
|
@click="download(scope.row.filePath)">下载
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user