修改多文件下载
This commit is contained in:
parent
97fe8eb588
commit
12d107efbf
|
|
@ -22,6 +22,7 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.hibernate.validator.internal.util.StringHelper;
|
import org.hibernate.validator.internal.util.StringHelper;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@ -30,7 +31,8 @@ import javax.annotation.Resource;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -119,6 +121,61 @@ public class OptionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${file.visitPath}")
|
||||||
|
private String visitPath;
|
||||||
|
|
||||||
|
@Value("${file.path}")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
@ApiOperation("文件下载")
|
||||||
|
@GetMapping("/download")
|
||||||
|
public void download(HttpServletResponse response,HttpServletRequest request) {
|
||||||
|
String path=request.getParameter("filePath");
|
||||||
|
String filepath = filePath+path.replace(visitPath,"");
|
||||||
|
File file = new File(filepath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
log.error("文件不存在:{}", filepath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String fileName = file.getName();
|
||||||
|
log.info("文件名:{}", fileName);
|
||||||
|
// 设置响应头
|
||||||
|
response.reset();
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
// 只设置一个Content-Type
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
// 正确处理文件名编码
|
||||||
|
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||||
|
// 处理空格编码问题
|
||||||
|
encodedFileName = encodedFileName.replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
// 设置Content-Disposition头
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=\"" + encodedFileName + "\"");
|
||||||
|
|
||||||
|
// 使用缓冲流提高性能
|
||||||
|
try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream())) {
|
||||||
|
|
||||||
|
// 使用缓冲区复制文件,避免一次性读取整个文件到内存
|
||||||
|
byte[] buffer = new byte[4096]; // 4KB缓冲区
|
||||||
|
int bytesRead;
|
||||||
|
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
outputStream.flush();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("文件下载失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/deleteInfo")
|
@PostMapping("/deleteInfo")
|
||||||
@ApiOperation(value = "删除意见")
|
@ApiOperation(value = "删除意见")
|
||||||
@LogAnnotation(title = "意见收集", action = "删除意见")
|
@LogAnnotation(title = "意见收集", action = "删除意见")
|
||||||
|
|
|
||||||
|
|
@ -129,10 +129,20 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
if (now.isAfter(startTime) && now.isBefore(endTime)) {
|
if (now.isAfter(startTime) && now.isBefore(endTime)) {
|
||||||
|
System.err.println("符合");
|
||||||
|
}else if(now.isBefore(startTime) ) {
|
||||||
|
//当前时间比开始时间晚
|
||||||
|
return "任务未开始";
|
||||||
}else{
|
}else{
|
||||||
return "任务已过期";
|
return "任务已过期";
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
if(StringHelper.isNullOrEmptyString(vo.getUserName())){
|
||||||
|
throw new BusinessException("请填写用户名");
|
||||||
|
}
|
||||||
|
if(StringHelper.isNullOrEmptyString(vo.getUserPhone())){
|
||||||
|
throw new BusinessException("请填写手机号码!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String createTimes= DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN);
|
String createTimes= DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN);
|
||||||
|
|
@ -172,6 +182,11 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
return "添加失败";
|
return "添加失败";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> getTaskDetails(TbTask vo) {
|
public Map<String,Object> getTaskDetails(TbTask vo) {
|
||||||
Map<String,Object> map= Maps.newHashMap();
|
Map<String,Object> map= Maps.newHashMap();
|
||||||
|
|
@ -190,8 +205,10 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
if("1".equals(voo.getTaskType())){
|
if("1".equals(voo.getTaskType())){
|
||||||
map.put("msg","请求成功");
|
map.put("msg","请求成功");
|
||||||
map.put("data",voo);
|
map.put("data",voo);
|
||||||
|
map.put("type","1");
|
||||||
map.put("code","200");
|
map.put("code","200");
|
||||||
}else{
|
}else{
|
||||||
|
map.put("type","2");
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
LocalDateTime startTime = LocalDateTime.parse(voo.getStartTime(), formatter);
|
LocalDateTime startTime = LocalDateTime.parse(voo.getStartTime(), formatter);
|
||||||
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
LocalDateTime endTime = LocalDateTime.parse(voo.getEndTime(), formatter);
|
||||||
|
|
@ -200,6 +217,10 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
map.put("msg","请求成功");
|
map.put("msg","请求成功");
|
||||||
map.put("data",voo);
|
map.put("data",voo);
|
||||||
map.put("code","200");
|
map.put("code","200");
|
||||||
|
}else if(now.isBefore(startTime) ) {
|
||||||
|
map.put("msg","任务未开始");
|
||||||
|
map.put("data",voo);
|
||||||
|
map.put("code","204");
|
||||||
}else{
|
}else{
|
||||||
map.put("msg","任务已过期");
|
map.put("msg","任务已过期");
|
||||||
map.put("data","任务已过期");
|
map.put("data","任务已过期");
|
||||||
|
|
@ -209,7 +230,6 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,6 +353,15 @@ public class OptionServiceImpl extends ServiceImpl<OptionMapper, TbTask> implem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime startTime = LocalDateTime.parse("2025-04-04 12:00:00", formatter);
|
||||||
|
LocalDateTime endTime = LocalDateTime.parse("2025-04-05 12:00:00", formatter);
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
System.err.println(now.isBefore(startTime));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.company.project.utils;
|
package com.company.project.utils;
|
||||||
|
|
||||||
public class IDUtils {
|
public class IDUtils {
|
||||||
private static byte[] lock = new byte[0];
|
private static final byte[] lock = new byte[0];
|
||||||
|
|
||||||
// 位数,默认是8位
|
// 位数,默认是8位
|
||||||
private final static long w = 100000000;
|
private final static long w = 100000000;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# 开发环境配置
|
# 生产环境配置
|
||||||
spring:
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: -1
|
||||||
|
max-request-size: -1
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
cache: false
|
cache: false
|
||||||
datasource:
|
datasource:
|
||||||
|
|
@ -7,10 +11,10 @@ spring:
|
||||||
primary: master #设置默认的数据源或者数据源组,默认值即为master
|
primary: master #设置默认的数据源或者数据源组,默认值即为master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
username: mroot
|
username: root
|
||||||
password: bonus@admin123
|
password: Bonus@admin123!
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/company_project?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
|
url: jdbc:mysql://192.168.0.14:4417/company_project?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
|
||||||
oracle:
|
oracle:
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
|
|
@ -23,6 +27,14 @@ spring:
|
||||||
url: jdbc:sqlserver://localhost:1433;databaseName=company_project
|
url: jdbc:sqlserver://localhost:1433;databaseName=company_project
|
||||||
|
|
||||||
file:
|
file:
|
||||||
#文件上传目录 绝对路径 末尾不需要加 /
|
#文件上传目录 绝对路径 末尾请加 /
|
||||||
path: D:/files #windows
|
path: F:/files/ #windows
|
||||||
#path: /data/files #linux
|
#visitPath: http://192.168.0.38:21666/manager/files/
|
||||||
|
visitPath: http://192.168.0.38:21666/manager/files/
|
||||||
|
#path: /home/options/file/
|
||||||
|
#linux
|
||||||
|
knife4j:
|
||||||
|
production: true #生成环境禁用查看文档
|
||||||
|
|
||||||
|
app:
|
||||||
|
url: http://192.168.0.14:1999/option/#key=
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
spring:
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: -1
|
||||||
|
max-request-size: -1
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
cache: false
|
cache: false
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ server:
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: dev
|
||||||
mvc:
|
mvc:
|
||||||
throw-exception-if-no-handler-found: true
|
throw-exception-if-no-handler-found: true
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
select tt.id id, tt.task_type taskType, tt.task_title taskTitle , tt.task_describe taskDescribe,
|
select tt.id id, tt.task_type taskType, tt.task_title taskTitle , tt.task_describe taskDescribe,
|
||||||
tt.start_time startTime, tt.end_time endTime, tt.create_user , DATE_FORMAT(tt.create_time,'%Y-%m-%d') createTime,
|
tt.start_time startTime, tt.end_time endTime, tt.create_user , DATE_FORMAT(tt.create_time,'%Y-%m-%d') createTime,
|
||||||
tt.file_path, tt.task_time taskTime,su.username createUser,
|
tt.file_path, tt.task_time taskTime,su.username createUser,
|
||||||
CASE tt.task_type WHEN 1 THEN '监督类' ELSE '巡查类' END type
|
CASE tt.task_type WHEN 1 THEN '监督类' ELSE '巡察类' END type
|
||||||
from tb_task tt
|
from tb_task tt
|
||||||
left join sys_user su ON su.id=tt.create_user
|
left join sys_user su ON su.id=tt.create_user
|
||||||
<if test='vo.roleType=="3"'>
|
<if test='vo.roleType=="3"'>
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
tt.id id, tt.task_type taskType, tt.task_title taskTitle , tt.task_describe taskDescribe,
|
tt.id id, tt.task_type taskType, tt.task_title taskTitle , tt.task_describe taskDescribe,
|
||||||
tt.start_time startTime, tt.end_time endTime, tt.create_user , DATE_FORMAT(tt.create_time,'%Y-%m-%d') createTime,
|
tt.start_time startTime, tt.end_time endTime, tt.create_user , DATE_FORMAT(tt.create_time,'%Y-%m-%d') createTime,
|
||||||
tt.file_path, tt.task_time taskTime,su.username createUser,
|
tt.file_path, tt.task_time taskTime,su.username createUser,
|
||||||
CASE tt.task_type WHEN 1 THEN '监督类' ELSE '巡查类' END type
|
CASE tt.task_type WHEN 1 THEN '监督类' ELSE '巡察类' END type
|
||||||
from tb_task tt
|
from tb_task tt
|
||||||
left join (SELECT @rownum:=0) r on 1=1
|
left join (SELECT @rownum:=0) r on 1=1
|
||||||
left join sys_user su ON su.id=tt.create_user
|
left join sys_user su ON su.id=tt.create_user
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 332 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 591 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 385 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
|
|
@ -10,12 +10,12 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="role_table_div">
|
<div class="role_table_div">
|
||||||
<div id="searchParam" sa:hasPermission="tb:option:list">
|
<div id="searchParam" sa:hasPermission="tb:option:list">
|
||||||
<form class="layui-form layui-form-pane" action="">
|
<form class="layui-form layui-form-pane" action="" lay-filter="queryParam">
|
||||||
<div class="layui-form-item" style="margin-left: 10px">
|
<div class="layui-form-item" style="margin-left: 10px">
|
||||||
<div class="layui-input-inline" style="width: 300px">
|
<div class="layui-input-inline" style="width: 300px">
|
||||||
<label class="layui-form-label" style="width: 100px">任务类型:</label>
|
<label class="layui-form-label" style="width: 100px">任务类型:</label>
|
||||||
<div class="layui-input-inline" >
|
<div class="layui-input-inline" >
|
||||||
<select name="taskType" id="taskTypeParam" >
|
<select name="taskTypeParam" id="taskTypeParam" >
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="1">监督类</option>
|
<option value="1">监督类</option>
|
||||||
<option value="2">巡察类</option>
|
<option value="2">巡察类</option>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline" style="width: 300px">
|
<div class="layui-input-inline" style="width: 300px">
|
||||||
<label class="layui-form-label" style="width: 100px">任务主题:</label>
|
<label class="layui-form-label" style="width: 100px"> 任务主题:</label>
|
||||||
<input type="text" name="taskTitle" id="taskTitleParam" style="width: 200px" class="layui-input" autocomplete="off" placeholder="请输入任务主题">
|
<input type="text" name="taskTitle" id="taskTitleParam" style="width: 200px" class="layui-input" autocomplete="off" placeholder="请输入任务主题">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline" style="width: 300px">
|
<div class="layui-input-inline" style="width: 300px">
|
||||||
|
|
@ -58,21 +58,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">任务主题</label>
|
<label class="layui-form-label"><span style="color: red">*</span>任务主题</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="taskTitle" id="taskTitle" placeholder="请输入任务主题" lay-verify="required|length" maxlength="200" autocomplete="off"
|
<input type="text" name="taskTitle" id="taskTitle" placeholder="请输入任务主题" lay-verify="required|length" maxlength="200" autocomplete="off"
|
||||||
class="layui-input">
|
class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">主题说明</label>
|
<label class="layui-form-label"><span style="color: red">*</span>主题说明</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea name="taskDescribe" id="taskDescribe" placeholder="请输入主题说明" lay-verify="required|length" maxlength="6000" autocomplete="off" class="layui-textarea">
|
<textarea name="taskDescribe" id="taskDescribe" placeholder="请输入主题说明" lay-verify="required|length" maxlength="6000" autocomplete="off" class="layui-textarea">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item" id="isBlock">
|
<div class="layui-form-item" id="isBlock">
|
||||||
<label class="layui-form-label">任务时效</label>
|
<label class="layui-form-label"><span style="color: red">*</span>任务时效</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="taskTime" id="taskTime" readonly lay-verify="required" placeholder="请选择时间" autocomplete="off"
|
<input type="text" name="taskTime" id="taskTime" readonly lay-verify="required" placeholder="请选择时间" autocomplete="off"
|
||||||
class="layui-input">
|
class="layui-input">
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
|
|
||||||
<div id="look_file_all" hidden>
|
<div id="look_file_all" hidden>
|
||||||
<button style="margin-left: 10px" class="layui-btn btn-secondary close-popup next" onclick="next(1)" ><i class="fa fa-times-circle"></i> 上一张</button>
|
<button style="margin-left: 10px" class="layui-btn btn-secondary close-popup next" onclick="next(1)" ><i class="fa fa-times-circle"></i> 上一张</button>
|
||||||
<img src="http://192.168.0.38:21666/manager/files/20250328/4.png" id="seeFile" style="width: 800px;height: 700px" >
|
<img src="http://192.168.0.38:21666/manager/files/20250328/4.png" id="seeFile" fileUrl="" style="width: 800px;height: 700px" >
|
||||||
<button class="layui-btn btn-secondary close-popup next" onclick="next(2)" ><i class="fa fa-times-circle"></i> 下一张</button>
|
<button class="layui-btn btn-secondary close-popup next" onclick="next(2)" ><i class="fa fa-times-circle"></i> 下一张</button>
|
||||||
<div style="margin-left: 40%"> <button onclick="downloadImage2()" class="layui-btn btn-secondary close-popup" ><i class="fa fa-times-circle"></i> 下载</button> </div>
|
<div style="margin-left: 40%"> <button onclick="downloadImage2()" class="layui-btn btn-secondary close-popup" ><i class="fa fa-times-circle"></i> 下载</button> </div>
|
||||||
|
|
||||||
|
|
@ -264,7 +264,7 @@
|
||||||
$("#taskType").val("1")
|
$("#taskType").val("1")
|
||||||
$("#isBlock").hide();
|
$("#isBlock").hide();
|
||||||
}else {
|
}else {
|
||||||
$("#type").val("巡查类");
|
$("#type").val("巡察类");
|
||||||
$("#taskType").val("2")
|
$("#taskType").val("2")
|
||||||
}
|
}
|
||||||
layer.open({
|
layer.open({
|
||||||
|
|
@ -519,7 +519,7 @@
|
||||||
$("#type").val("监督类")
|
$("#type").val("监督类")
|
||||||
$("#taskType").val("1")
|
$("#taskType").val("1")
|
||||||
}else {
|
}else {
|
||||||
$("#type").val("巡查类");
|
$("#type").val("巡察类");
|
||||||
$("#taskType").val("2")
|
$("#taskType").val("2")
|
||||||
$("#taskTime").val(data.taskTime);
|
$("#taskTime").val(data.taskTime);
|
||||||
}
|
}
|
||||||
|
|
@ -648,6 +648,10 @@
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
form.on('submit(data-search-btn2)', function (data) {
|
form.on('submit(data-search-btn2)', function (data) {
|
||||||
|
form.val('queryParam', { // cityForm是form元素的lay-filter属性值
|
||||||
|
"taskTypeParam": "" // 将城市设置为广州
|
||||||
|
});
|
||||||
|
|
||||||
//执行搜索重载
|
//执行搜索重载
|
||||||
$("#taskTypeParam").val('');
|
$("#taskTypeParam").val('');
|
||||||
$("#createTime").val('');
|
$("#createTime").val('');
|
||||||
|
|
@ -779,6 +783,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
var openImage = function(id){
|
var openImage = function(id){
|
||||||
|
nowIndex=0;
|
||||||
formData={
|
formData={
|
||||||
"id":id,
|
"id":id,
|
||||||
"type":2
|
"type":2
|
||||||
|
|
@ -790,8 +795,21 @@
|
||||||
layer.msg("暂无图片");
|
layer.msg("暂无图片");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
let src= res.data[nowIndex];
|
||||||
document.getElementById('seeFile').src = res.data[nowIndex];
|
let fileExtension = src.split('.').pop().toLowerCase();
|
||||||
|
console.log(fileExtension);
|
||||||
|
if(fileExtension=='docx' || fileExtension=='doc'){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/world.jpg';
|
||||||
|
}else if(fileExtension=='xls' || fileExtension=='xlsx' || fileExtension=='csv' ){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/excel.jpg';
|
||||||
|
}else if(fileExtension=='pdf' || fileExtension=='PDF'){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/pdf.png';
|
||||||
|
}else if(fileExtension=='jpg' || fileExtension=='png' || fileExtension=='jpeg' ){
|
||||||
|
document.getElementById('seeFile').src =src;
|
||||||
|
}else{
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/text.png';
|
||||||
|
}
|
||||||
|
document.getElementById('seeFile').setAttribute("fileUrl",src);
|
||||||
let x_l='800px'
|
let x_l='800px'
|
||||||
console.log(res.data.length)
|
console.log(res.data.length)
|
||||||
if(res.data.length>1){
|
if(res.data.length>1){
|
||||||
|
|
@ -829,7 +847,24 @@
|
||||||
nowIndex=nowIndex+1;
|
nowIndex=nowIndex+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.getElementById('seeFile').src = fileList[nowIndex];
|
|
||||||
|
let src= fileList[nowIndex];
|
||||||
|
let fileExtension = src.split('.').pop().toLowerCase();
|
||||||
|
console.log(fileExtension);
|
||||||
|
if(fileExtension=='docx' || fileExtension=='doc'){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/world.jpg';
|
||||||
|
}else if(fileExtension=='xls' || fileExtension=='xlsx' || fileExtension=='csv' ){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/excel.jpg';
|
||||||
|
}else if(fileExtension=='pdf' || fileExtension=='PDF'){
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/pdf.png';
|
||||||
|
}else if(fileExtension=='jpg' || fileExtension=='png' || fileExtension=='jpeg' ){
|
||||||
|
document.getElementById('seeFile').src =src;
|
||||||
|
}else{
|
||||||
|
document.getElementById('seeFile').src ='/manager/static/image/text.png';
|
||||||
|
}
|
||||||
|
document.getElementById('seeFile').setAttribute("fileUrl",src);
|
||||||
|
|
||||||
|
// document.getElementById('seeFile').src =src;
|
||||||
}
|
}
|
||||||
function looImage(ids){
|
function looImage(ids){
|
||||||
let id=ids.split("@")[0];
|
let id=ids.split("@")[0];
|
||||||
|
|
@ -855,7 +890,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
function downloadImage() {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function downloadImage() {
|
||||||
var imageUrl=document.getElementById('lookFilePath').src;
|
var imageUrl=document.getElementById('lookFilePath').src;
|
||||||
var title=$("#thisFileName").val();
|
var title=$("#thisFileName").val();
|
||||||
var name=title+"-二维码";
|
var name=title+"-二维码";
|
||||||
|
|
@ -883,7 +922,29 @@ function downloadImage() {
|
||||||
};
|
};
|
||||||
image.src = imageUrl;
|
image.src = imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function downloadImage2() {
|
function downloadImage2() {
|
||||||
|
var imageUrl= document.getElementById('seeFile').getAttribute("fileUrl");
|
||||||
|
let url= ctx + "option/download?filePath="+imageUrl;
|
||||||
|
|
||||||
|
window.location.href = url;
|
||||||
|
|
||||||
|
// const xhr = new XMLHttpRequest();
|
||||||
|
// xhr.open('GET', url);
|
||||||
|
// xhr.responseType = 'blob';
|
||||||
|
// xhr.onload = function() {
|
||||||
|
// const blob = xhr.response;
|
||||||
|
// const link = document.createElement('a');
|
||||||
|
// link.href = URL.createObjectURL(blob);
|
||||||
|
// link.download ='意见文件';
|
||||||
|
// link.target = "_blank"; // 可选,如果希望在新窗口中下载文件,请取消注释此行
|
||||||
|
// link.click();
|
||||||
|
// };
|
||||||
|
// xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadImage3() {
|
||||||
var imageUrl=document.getElementById('seeFile').src;
|
var imageUrl=document.getElementById('seeFile').src;
|
||||||
var name="意见图片";
|
var name="意见图片";
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
|
|
|
||||||
|
|
@ -58,23 +58,23 @@
|
||||||
<input type="text" name="username" class="layui-input" autocomplete="off"
|
<input type="text" name="username" class="layui-input" autocomplete="off"
|
||||||
placeholder="请输入账号">
|
placeholder="请输入账号">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" name="nickName" class="layui-input" autocomplete="off"
|
<!-- <input type="text" name="nickName" class="layui-input" autocomplete="off"-->
|
||||||
placeholder="请输用户昵称">
|
<!-- placeholder="请输用户昵称">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" readonly class="layui-input" name="createTimeBegin" id="createTimeBegin" placeholder="开始时间">
|
<!-- <input type="text" readonly class="layui-input" name="createTimeBegin" id="createTimeBegin" placeholder="开始时间">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" readonly class="layui-input" name="createTimeEnd" id="createTimeEnd" placeholder="结束时间">
|
<!-- <input type="text" readonly class="layui-input" name="createTimeEnd" id="createTimeEnd" placeholder="结束时间">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline layui-form">
|
<!-- <div class="layui-input-inline layui-form">-->
|
||||||
<select id="status">
|
<!-- <select id="status">-->
|
||||||
<option value="">请选择账号状态</option>
|
<!-- <option value="">请选择账号状态</option>-->
|
||||||
<option value="1">正常</option>
|
<!-- <option value="1">正常</option>-->
|
||||||
<option value="0">禁用</option>
|
<!-- <option value="0">禁用</option>-->
|
||||||
</select>
|
<!-- </select>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline ">
|
<div class="layui-input-inline ">
|
||||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@
|
||||||
})
|
})
|
||||||
form.on('submit(baseSubmit)', function (data) {
|
form.on('submit(baseSubmit)', function (data) {
|
||||||
CoreUtil.sendPut(ctx + "sys/user/pwd", data.field, function (res) {
|
CoreUtil.sendPut(ctx + "sys/user/pwd", data.field, function (res) {
|
||||||
layer.msg("密码已经变更请重新登录", {time: 2000}, function () {
|
layer.msg("修改成功", {time: 2000}, function () {
|
||||||
top.window.location.href = "/index/login";
|
top.window.location.href = "/manager/index/login";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,23 +58,23 @@
|
||||||
<input type="text" name="username" class="layui-input" autocomplete="off"
|
<input type="text" name="username" class="layui-input" autocomplete="off"
|
||||||
placeholder="请输入账号">
|
placeholder="请输入账号">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" name="nickName" class="layui-input" autocomplete="off"
|
<!-- <input type="text" name="nickName" class="layui-input" autocomplete="off"-->
|
||||||
placeholder="请输用户昵称">
|
<!-- placeholder="请输用户昵称">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" readonly class="layui-input" name="createTimeBegin" id="createTimeBegin" placeholder="开始时间">
|
<!-- <input type="text" readonly class="layui-input" name="createTimeBegin" id="createTimeBegin" placeholder="开始时间">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline">
|
<!-- <div class="layui-input-inline">-->
|
||||||
<input type="text" readonly class="layui-input" name="createTimeEnd" id="createTimeEnd" placeholder="结束时间">
|
<!-- <input type="text" readonly class="layui-input" name="createTimeEnd" id="createTimeEnd" placeholder="结束时间">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline layui-form">
|
<!-- <div class="layui-input-inline layui-form">-->
|
||||||
<select id="status">
|
<!-- <select id="status">-->
|
||||||
<option value="">请选择账号状态</option>
|
<!-- <option value="">请选择账号状态</option>-->
|
||||||
<option value="1">正常</option>
|
<!-- <option value="1">正常</option>-->
|
||||||
<option value="0">禁用</option>
|
<!-- <option value="0">禁用</option>-->
|
||||||
</select>
|
<!-- </select>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="layui-input-inline ">
|
<div class="layui-input-inline ">
|
||||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||||
|
|
||||||
|
|
@ -249,6 +249,10 @@
|
||||||
$(getData).each(function (index, item) {
|
$(getData).each(function (index, item) {
|
||||||
roleIds.push(item.value);
|
roleIds.push(item.value);
|
||||||
});
|
});
|
||||||
|
if(roleIds.length>1){
|
||||||
|
return layer.msg("一个用户只能分配一个角色,请重新选择");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
CoreUtil.sendPut(ctx + "sys/user/roles/" + data.id, roleIds, function (res) {
|
CoreUtil.sendPut(ctx + "sys/user/roles/" + data.id, roleIds, function (res) {
|
||||||
layer.msg(res.msg);
|
layer.msg(res.msg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue