完成结果下载页面
This commit is contained in:
parent
47e43fb296
commit
08044640a7
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.dfm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
|
@ -12,11 +11,9 @@ import com.ruoyi.dfm.pojo.*;
|
|||
import com.ruoyi.dfm.service.FileService;
|
||||
import com.ruoyi.dfm.service.ProjectService;
|
||||
import com.ruoyi.dfm.service.UserService;
|
||||
import com.ruoyi.dfm.util.PropertiesUtils;
|
||||
import com.ruoyi.dfm.util.TimeUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -25,11 +22,7 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.MultipartResolver;
|
||||
//import org.springframework.web.multipart.cos.CosMultipartResolver;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -39,10 +32,7 @@ import java.io.FileInputStream;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/project.do")
|
||||
|
|
@ -475,7 +465,7 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
req.setAttribute("oper", user);
|
||||
req.setAttribute("queryParam", "{}");
|
||||
req.setAttribute("loadType", "init");
|
||||
return new ModelAndView("resultDownload");
|
||||
return new ModelAndView("dfm/resultDownload");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -657,23 +647,11 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
queryBean.setState(state);
|
||||
queryBean.setUsername(username);
|
||||
|
||||
// String currentPage = req.getParameter("currentPage");
|
||||
Page page = new Page();
|
||||
PageDomain pageDomain = TableSupport.getPageDomain();
|
||||
page.setCurrentPage(pageDomain.getPageNum());
|
||||
page.setPageSize(pageDomain.getPageSize());
|
||||
|
||||
|
||||
|
||||
// if ((currentPage == null) || ("".equals(currentPage.trim())))
|
||||
// {
|
||||
// page.setCurrentPage(1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// page.setCurrentPage(Integer.parseInt(currentPage));
|
||||
// }
|
||||
|
||||
String[] states = new String[3];
|
||||
List<Project> projects = null;
|
||||
UserInfo user = ShiroUtils.getLoginUser();
|
||||
|
|
@ -686,12 +664,6 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
|
||||
page.setOrderCase(" ORDER BY F_END_TIME DESC ");
|
||||
|
||||
// String taskResultInquire = (String)PropertiesUtils.getProperties().get("task.result.inquire");
|
||||
// if ("user".equals(taskResultInquire))
|
||||
// {
|
||||
// projects = this.projectService.getProjectByStates(states, page, queryBean);
|
||||
// }
|
||||
// else
|
||||
if (UserConstants.USER_LEVEL_ADMIN == user.getGroupId() || UserConstants.USER_LEVEL_SUPER_USER == user.getGroupId())
|
||||
{
|
||||
projects = this.projectService.getProjectByStates(states, page, queryBean);
|
||||
|
|
@ -716,15 +688,19 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
}
|
||||
|
||||
req.setAttribute("projects", projects);
|
||||
req.setAttribute("page", page);
|
||||
req.setAttribute("users", users);
|
||||
// req.setAttribute("page", page);
|
||||
// req.setAttribute("users", users);
|
||||
//FIXME 修正查询条件中的时间 json
|
||||
// req.setAttribute("queryParam", JSONObject.fromObject(queryBean));
|
||||
req.setAttribute("queryParam", JSON.toJSONString(queryBean));
|
||||
req.setAttribute("loadType", "query");
|
||||
// req.setAttribute("queryParam", JSON.toJSONString(queryBean));
|
||||
// req.setAttribute("loadType", "query");
|
||||
//FIXME 修改返回类型
|
||||
// return new ModelAndView("resultDownload");
|
||||
return null;
|
||||
// return null;
|
||||
if(null == projects) {
|
||||
projects = Collections.emptyList();
|
||||
}
|
||||
return getDataTable(projects, page.getTotalCount());
|
||||
}
|
||||
if ("queueManage".equals(queryType))
|
||||
{
|
||||
|
|
@ -803,6 +779,9 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
// req.setAttribute("hasPre", null != pre);
|
||||
// req.setAttribute("hasNext", null != next);
|
||||
// return new ModelAndView("queueManage");
|
||||
if(null == projects) {
|
||||
projects = Collections.emptyList();
|
||||
}
|
||||
return getDataTable(projects, page.getTotalCount());
|
||||
}
|
||||
|
||||
|
|
@ -848,21 +827,24 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
}
|
||||
|
||||
@RequestMapping("/recheck")
|
||||
public void recheck(HttpServletRequest req, HttpServletResponse res)
|
||||
@ResponseBody
|
||||
public AjaxResult recheck(HttpServletRequest req, HttpServletResponse res)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
String pid = req.getParameter("pid");
|
||||
String pid = req.getParameter("ids");
|
||||
String[] pids = pid.split(",");
|
||||
|
||||
String currentPage = req.getParameter("currentPage");
|
||||
// String currentPage = req.getParameter("currentPage");
|
||||
this.projectService.recheck(pids);
|
||||
outputMsg(res, "<script>document.location.href='project.do?method=resultDownload¤tPage=" + currentPage + "';</script>");
|
||||
return toAjax(1);
|
||||
// outputMsg(res, "<script>document.location.href='project.do?method=resultDownload¤tPage=" + currentPage + "';</script>");
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("再查项目失败!", e);
|
||||
outputMsg(res, "<script>alert('再查项目失败,请联系管理员!');window.history.go(-1);</script>");
|
||||
return toAjax(0);
|
||||
// outputMsg(res, "<script>alert('再查项目失败,请联系管理员!');window.history.go(-1);</script>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -912,19 +894,16 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
|
||||
/**
|
||||
* 上传preDFM文件
|
||||
* @param request
|
||||
* @param req
|
||||
* @param res
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/uploadPreDFM")
|
||||
public ModelAndView uploadPreDFM(HttpServletRequest request, HttpServletResponse res)
|
||||
@ResponseBody
|
||||
public AjaxResult uploadPreDFM(HttpServletRequest req, HttpServletResponse res, @RequestParam("preDFMFile") MultipartFile preDFMFile)
|
||||
throws Exception
|
||||
{
|
||||
//FIXME 修改上传文件
|
||||
MultipartResolver cmr = null;//new CosMultipartResolver(request.getSession().getServletContext());
|
||||
|
||||
MultipartHttpServletRequest req = cmr.resolveMultipart(request);
|
||||
try
|
||||
{
|
||||
|
||||
|
|
@ -941,38 +920,44 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
List<FileInfo> fileList = new ArrayList<FileInfo>();
|
||||
//FIXME 修复上传文件错误
|
||||
// this.fileService.savePhysicFile(req, fileList, dir, true, "pre-");
|
||||
|
||||
UserInfo loginUser = ShiroUtils.getLoginUser();
|
||||
MultipartFile[] multipartFiles = new MultipartFile[]{preDFMFile};
|
||||
this.fileService.savePhysicFile(loginUser, multipartFiles, fileList, dir, true , "pre-");
|
||||
|
||||
projectService.updateProjectPreDFMFile(pid, fileList.get(0).getId(), fileList.get(0).getFileName());
|
||||
req.setAttribute("uploadResult", "上传成功");
|
||||
req.setAttribute("uploadType", "preDFM");
|
||||
req.setAttribute("fid", fileList.get(0).getId());
|
||||
req.setAttribute("fname", fileList.get(0).getFileName());
|
||||
req.setAttribute("pid", pid);
|
||||
// req.setAttribute("uploadResult", "上传成功");
|
||||
// req.setAttribute("uploadType", "preDFM");
|
||||
// req.setAttribute("fid", fileList.get(0).getId());
|
||||
// req.setAttribute("fname", fileList.get(0).getFileName());
|
||||
// req.setAttribute("pid", pid);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("fid", fileList.get(0).getId());
|
||||
jsonObject.put("fname", fileList.get(0).getFileName());
|
||||
return AjaxResult.success("上传成功", jsonObject);
|
||||
} catch (Exception e) {
|
||||
logger.error("上传PreDFM报告失败", e);
|
||||
req.setAttribute("uploadResult", "上传失败");
|
||||
req.setAttribute("uploadType", "preDFM");
|
||||
// req.setAttribute("uploadResult", "上传失败");
|
||||
// req.setAttribute("uploadType", "preDFM");
|
||||
return toAjax(false);
|
||||
}
|
||||
return new ModelAndView("upload");
|
||||
// return new ModelAndView("upload");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传preDFM文件
|
||||
* @param request
|
||||
* @param req
|
||||
* @param res
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/uploadPostDFM")
|
||||
public ModelAndView uploadPostDFM(HttpServletRequest request, HttpServletResponse res)
|
||||
@ResponseBody
|
||||
public AjaxResult uploadPostDFM(HttpServletRequest req, HttpServletResponse res, @RequestParam("postDFMFile") MultipartFile postDFMFile)
|
||||
throws Exception
|
||||
{
|
||||
//FIXME 修改上传文件
|
||||
MultipartResolver cmr = null;//new CosMultipartResolver(request.getSession().getServletContext());
|
||||
|
||||
MultipartHttpServletRequest req = cmr.resolveMultipart(request);
|
||||
try
|
||||
{
|
||||
|
||||
//项目ID
|
||||
Integer pid = Integer.parseInt(req.getParameter("pid"));
|
||||
|
||||
|
|
@ -986,20 +971,28 @@ public class ProjectController extends com.ruoyi.common.core.controller.BaseCont
|
|||
List<FileInfo> fileList = new ArrayList<FileInfo>();
|
||||
//FIXME 修复上传文件错误
|
||||
// this.fileService.savePhysicFile(req, fileList, dir, true, "post-");
|
||||
UserInfo loginUser = ShiroUtils.getLoginUser();
|
||||
MultipartFile[] multipartFiles = new MultipartFile[]{postDFMFile};
|
||||
this.fileService.savePhysicFile(loginUser, multipartFiles, fileList, dir, true , "post-");
|
||||
|
||||
projectService.updateProjectPostDFMFile(pid, fileList.get(0).getId(), fileList.get(0).getFileName());
|
||||
|
||||
req.setAttribute("uploadResult", "上传成功");
|
||||
req.setAttribute("uploadType", "postDFM");
|
||||
req.setAttribute("fid", fileList.get(0).getId());
|
||||
req.setAttribute("fname", fileList.get(0).getFileName());
|
||||
req.setAttribute("pid", pid);
|
||||
// req.setAttribute("uploadResult", "上传成功");
|
||||
// req.setAttribute("uploadType", "postDFM");
|
||||
// req.setAttribute("fid", fileList.get(0).getId());
|
||||
// req.setAttribute("fname", fileList.get(0).getFileName());
|
||||
// req.setAttribute("pid", pid);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("fid", fileList.get(0).getId());
|
||||
jsonObject.put("fname", fileList.get(0).getFileName());
|
||||
return AjaxResult.success("上传成功", jsonObject);
|
||||
} catch (Exception e) {
|
||||
logger.error("上传PostDFM报告失败", e);
|
||||
req.setAttribute("uploadResult", "上传失败");
|
||||
req.setAttribute("uploadType", "postDFM");
|
||||
// req.setAttribute("uploadResult", "上传失败");
|
||||
// req.setAttribute("uploadType", "postDFM");
|
||||
return toAjax(false);
|
||||
}
|
||||
return new ModelAndView("upload");
|
||||
// return new ModelAndView("upload");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1044,6 +1044,24 @@ var table = {
|
|||
$.operate.submit(url, "post", "json", data);
|
||||
});
|
||||
},
|
||||
recheckProjects: function(pid) {
|
||||
if(-1 == pid) {
|
||||
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
|
||||
if (rows.length == 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
$.modal.confirm("确认要再查选中的" + rows.length + "条数据吗?", function() {
|
||||
var url = table.options.recheckUrl;
|
||||
var data = { "ids": rows.join() };
|
||||
$.operate.submit(url, "post", "json", data);
|
||||
});
|
||||
} else {
|
||||
table.set();
|
||||
var data = { "ids": pid};
|
||||
$.operate.submit(table.options.recheckUrl, "post", "json", data);
|
||||
}
|
||||
},
|
||||
// 批量删除信息
|
||||
removeAll: function() {
|
||||
table.set();
|
||||
|
|
|
|||
|
|
@ -2,43 +2,39 @@
|
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('队列管理')" />
|
||||
<th:block th:include="include :: select2-css" />
|
||||
<th:block th:include="include :: select2-js" />
|
||||
<th:block th:include="include :: layout-latest-css" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="role-form">
|
||||
<form id="project-queue-manage-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
项目名:<input type="text" name="projectName"/>
|
||||
</li>
|
||||
<li>
|
||||
上传人:
|
||||
<select name="status" class="form-control m-b">
|
||||
<option value="">--请选择--</option>
|
||||
<option th:each="user : ${users}" th:text="${user.username}" th:value="${user.username}"></option>
|
||||
</select>
|
||||
上传人:<select name="username" >
|
||||
<option value="">--请选择--</option>
|
||||
<option th:each="user : ${users}" th:text="${user.username}" th:value="${user.username}"></option>
|
||||
</select>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
状态:
|
||||
<select name="state" class="form-control m-b">
|
||||
<option value="">--请选择--</option>
|
||||
<option value="在查">在查</option>
|
||||
<option value="待查">待查</option>
|
||||
<option value="暂停">暂停</option>
|
||||
</select>
|
||||
状态:<select name="state" >
|
||||
<option value="">--请选择--</option>
|
||||
<option value="在查">在查</option>
|
||||
<option value="待查">待查</option>
|
||||
<option value="暂停">暂停</option>
|
||||
</select>
|
||||
|
||||
</li>
|
||||
<li class="select-time">
|
||||
上传时间:
|
||||
<div>
|
||||
<input type="text" class="time-input" id="startSubmitTime" placeholder="开始时间" name="params[startSubmitTime]" readOnly/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endSubmitTime" placeholder="结束时间" name="params[endSubmitTime]" readOnly/>
|
||||
</div>
|
||||
<label>上传时间: </label>
|
||||
<input type="text" class="time-input" id="startSubmitTime" placeholder="开始时间" name="startSubmitTime" readOnly/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endSubmitTime" placeholder="结束时间" name="endSubmitTime" readOnly/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
|
|
@ -79,10 +75,7 @@
|
|||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/queryProject?queryType=queueManage",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit?uid={id}",
|
||||
removeUrl: prefix + "/delete",
|
||||
exportUrl: prefix + "/export",
|
||||
pauseUrl: prefix + "/pause",
|
||||
restoreUrl: prefix + "/restore",
|
||||
startUrl: prefix + "/start",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,376 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('结果下载')" />
|
||||
<th:block th:include="include :: layout-latest-css" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="project-result-download-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
项目名:<input type="text" name="projectName"/>
|
||||
</li>
|
||||
<li>
|
||||
上传人:<select name="username" >
|
||||
<option value="">--请选择--</option>
|
||||
<option th:each="user : ${users}" th:text="${user.username}" th:value="${user.username}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
状态:<select name="state" >
|
||||
<option value="">--请选择--</option>
|
||||
<option value="在查">在查</option>
|
||||
<option value="待查">待查</option>
|
||||
<option value="暂停">暂停</option>
|
||||
</select>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>上传时间: </label>
|
||||
<input type="text" class="time-input" id="startSubmitTime" placeholder="开始时间" name="startSubmitTime" readOnly/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endSubmitTime" placeholder="结束时间" name="endSubmitTime" readOnly/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" >
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.recheckProjects(-1)" >
|
||||
<i class="fa fa-play"></i> 再查
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "project.do";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/queryProject?queryType=resultDownload",
|
||||
removeUrl: prefix + "/delete",
|
||||
recheckUrl: prefix + "/recheck",
|
||||
sortName: "roleSort",
|
||||
modalName: "用户",
|
||||
columns: [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'realOrder',
|
||||
title: '任务编号',
|
||||
sortable: false,
|
||||
formatter: function (value, row, index) {
|
||||
var currentPage = $("#bootstrap-table").bootstrapTable("getOptions").pageNumber;
|
||||
var pageSize = $("#bootstrap-table").bootstrapTable("getOptions").pageSize;
|
||||
return (pageSize * (currentPage - 1) ) + (index + 1);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'projectName',
|
||||
title: '项目名',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'version',
|
||||
title: '版本',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'submitUserName',
|
||||
title: '上传人',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'pcbFile',
|
||||
title: '文件名',
|
||||
sortable: false,
|
||||
formatter: function (value, row, index) {
|
||||
var html="";
|
||||
html += "<span>PCB文件:</span><A href='javascript:getFile(\""+ row.pcbFile + "\");'>"+ row.pcbFileName +"</A></br>";
|
||||
html += "<span>BOM文件:</span><A href='javascript:getFile(\""+ row.bomFile + "\");'>"+ row.bomFileName +"</A></br>";
|
||||
var fid;
|
||||
if(0 != row.pcbFile) {
|
||||
fid = row.pcbFile;
|
||||
} else if(0 != row.bomFile) {
|
||||
fid = row.bomFile;
|
||||
}
|
||||
var paramFile = row.projectName + "_" + row.version + ".param";
|
||||
html += "<span >参数文件:</span><A href=\"javascript:getParamFile(" + fid +",'" + paramFile +"');\">"+ paramFile +"</A>";
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'submitTime',
|
||||
title: '上传时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '完成时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'state',
|
||||
title: '状态',
|
||||
sortable: true
|
||||
},{
|
||||
field: 'runTime',
|
||||
title: '运行时长(分钟)',
|
||||
sortable: true
|
||||
},{
|
||||
field: 'downloadResult',
|
||||
title: '结果下载/反馈',
|
||||
sortable: false,
|
||||
formatter: function (value, row, index) {
|
||||
return getDownloadResultHtml(row);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(' + row.id + ')"><i class="fa fa-remove"></i>删除</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.recheckProjects(' + row.id + ')"><i class="fa fa-play"></i>再查</a> ');
|
||||
return actions.join('');
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
//下载文件
|
||||
function getFile(fid)
|
||||
{
|
||||
// document.location.href='file.do/download?fid=' + fid;
|
||||
var url = ctx + 'file.do/download?fid=' + fid;
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
//下载参数文件
|
||||
function getParamFile(fid,fname)
|
||||
{
|
||||
// document.location.href='project.do/downloadParamFile&fid=' + fid + '&fname=' + encodeURI(fname);
|
||||
var url = ctx + 'project.do/downloadParamFile?fid=' + fid + '&fname=' + encodeURI(fname);
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
//下载结果文件
|
||||
function getResultFile(fid,fname)
|
||||
{
|
||||
var url = ctx + 'project.do/downloadResultFile?fid=' + fid + '&fname=' + encodeURI(fname);
|
||||
// document.location.href='project.do?method=downloadResultFile&fid=' + fid + '&fname=' + encodeURI(fname);
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成下载结果文件表格内容
|
||||
*/
|
||||
function getDownloadResultHtml(project){
|
||||
var fid;
|
||||
if(0 != project.pcbFile) {
|
||||
fid = project.pcbFile;
|
||||
} else if(0 != project.bomFile) {
|
||||
fid = project.bomFile;
|
||||
}
|
||||
|
||||
var preDFMFileId = project.preDFMFileId;
|
||||
var postDFMFileId = project.postDFMFileId;
|
||||
var preDFMFileName = project.preDFMFileName;
|
||||
var postDFMFileName = project.postDFMFileName;
|
||||
var resultFile = project.resultFile;
|
||||
var id = project.id;
|
||||
|
||||
|
||||
var preDFMFileIdHtml="";
|
||||
if(0!=preDFMFileId){
|
||||
preDFMFileIdHtml+="<A href=\"javascript:getFile("+preDFMFileId+");\">"+preDFMFileName+"</A>";
|
||||
}
|
||||
|
||||
var postDFMFileIdHtml="";
|
||||
if(0!=postDFMFileId){
|
||||
postDFMFileIdHtml+="<A href=\"javascript:getFile("+postDFMFileId+");\">"+postDFMFileName+"</A>";
|
||||
}
|
||||
|
||||
var html = "<table width=\"300\" style=\"table-layout: fixed;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" +
|
||||
" <tr>" +
|
||||
" <td colspan=\"2\" align=\"left\" style=\"text-overflow: ellipsis;overflow: hidden;white-space: nowrap;\">" +
|
||||
" <A href=\"javascript:getResultFile(" + fid +",'"+resultFile+"');\">"+resultFile+"</A>" +
|
||||
" </td>" +
|
||||
" </tr>" +
|
||||
" <tr>" +
|
||||
" <td align=\"left\" width=80% style=\"text-overflow: ellipsis;overflow: hidden;white-space: nowrap;\">" +
|
||||
" <span id=\"downloadPreDFMFile_"+id+"\">" +
|
||||
preDFMFileIdHtml +
|
||||
" </span>" +
|
||||
" </td>" +
|
||||
" <td align=\"right\" width=20%>" +
|
||||
" <input type=\"file\" id=\"preDFMFile_"+ id +"\" name=\"preDFMFile\" style=\"display:none\"/>" +
|
||||
" <input id=\"uploadPreDFM\" type=\"button\" value=\"Pre-DFM\" onclick=\"uploadDFM("+id+",'pre')\" style=\"width:80px;\"/> " +
|
||||
" </td>" +
|
||||
" </tr>" +
|
||||
" <tr>" +
|
||||
" <td width=80% align=\"left\" style=\"text-overflow: ellipsis;overflow: hidden;white-space: nowrap;\">" +
|
||||
" <span id=\"downloadPostDFMFile_"+id+"\">" +
|
||||
postDFMFileIdHtml +
|
||||
" </span>" +
|
||||
" </td>" +
|
||||
" <td align=\"right\" width=20%>" +
|
||||
" <!-- 上传PostDFM -->" +
|
||||
" <input type=\"file\" id=\"postDFMFile_"+ id +"\" name=\"postDFMFile\" style=\"display:none\"/>" +
|
||||
" <input id=\"uploadPostDFM\" type=\"button\" value=\"Post-DFM\" onclick=\"uploadDFM("+id+",'post')\" style=\"width:80px;\"/> " +
|
||||
" </td>" +
|
||||
" </tr>" +
|
||||
" </table>";
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
//异步上传DFM文件
|
||||
function uploadDFM(pid, dfm) {
|
||||
var url = prefix;
|
||||
var fileName;
|
||||
if('pre' == dfm) {
|
||||
url += "/uploadPreDFM";
|
||||
fileName = "preDFMFile";
|
||||
} else if('post' == dfm) {
|
||||
url += "/uploadPostDFM";
|
||||
fileName = "postDFMFile";
|
||||
}
|
||||
|
||||
var fileInput = $("#" + fileName + "_" + pid)[0];
|
||||
|
||||
$(fileInput).on("change", function () {
|
||||
var formData = new FormData();
|
||||
formData.append('pid', pid);
|
||||
formData.append(fileName, fileInput.files[0]);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'post',
|
||||
cache: false,
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: "json",
|
||||
beforeSend: function () {
|
||||
$.modal.loading("正在处理中,请稍后...");
|
||||
$.modal.disable();
|
||||
},
|
||||
success: function(result) {
|
||||
$.modal.closeLoading();
|
||||
if(null != result && 0 == result.code) {
|
||||
var fid = result.data.fid;
|
||||
var fname = result.data.fname;
|
||||
uploadCallback(fileName,"上传成功", fid, fname, pid);
|
||||
} else {
|
||||
$.modal.alertSuccess("上传失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$(fileInput).click();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步上传文件回调
|
||||
**/
|
||||
function uploadCallback(uploadType, uploadResult, fid, fname, pid){
|
||||
$.modal.alertSuccess(uploadResult);
|
||||
if("上传成功" == uploadResult) {
|
||||
var spanId;
|
||||
var downloadLink = "<A href=\"javascript:getFile("+ fid +");\">" + fname + "</A>";
|
||||
if("preDFMFile" == uploadType) {
|
||||
spanId = "#downloadPreDFMFile_" + pid;
|
||||
} else if("postDFMFile" == uploadType) {
|
||||
spanId = "#downloadPostDFMFile_" + pid;
|
||||
}
|
||||
$(spanId).html(downloadLink);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function myBrowser() {
|
||||
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
|
||||
var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
|
||||
var isIE = userAgent.indexOf("compatible") > -1
|
||||
&& userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
|
||||
var isEdge = userAgent.indexOf("Edge") > -1; //判断是否IE的Edge浏览器
|
||||
var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
|
||||
var isSafari = userAgent.indexOf("Safari") > -1
|
||||
&& userAgent.indexOf("Chrome") == -1; //判断是否Safari浏览器
|
||||
var isChrome = userAgent.indexOf("Chrome") > -1
|
||||
&& userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
|
||||
|
||||
if (isIE) {
|
||||
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
|
||||
reIE.test(userAgent);
|
||||
var fIEVersion = parseFloat(RegExp["$1"]);
|
||||
if (fIEVersion == 7) {
|
||||
return "IE7";
|
||||
} else if (fIEVersion == 8) {
|
||||
return "IE8";
|
||||
} else if (fIEVersion == 9) {
|
||||
return "IE9";
|
||||
} else if (fIEVersion == 10) {
|
||||
return "IE10";
|
||||
} else if (fIEVersion == 11) {
|
||||
return "IE11";
|
||||
} else {
|
||||
return "0";
|
||||
}//IE版本过低
|
||||
return "IE";
|
||||
}
|
||||
if (isOpera) {
|
||||
return "Opera";
|
||||
}
|
||||
if (isEdge) {
|
||||
return "Edge";
|
||||
}
|
||||
if (isFF) {
|
||||
return "FF";
|
||||
}
|
||||
if (isSafari) {
|
||||
return "Safari";
|
||||
}
|
||||
if (isChrome) {
|
||||
return "Chrome";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -136,24 +136,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
// {
|
||||
// field: 'roleSort',
|
||||
// title: '操作',
|
||||
// sortable: true
|
||||
// },
|
||||
// {
|
||||
// visible: editFlag == 'hidden' ? false : true,
|
||||
// title: '角色状态',
|
||||
// align: 'center',
|
||||
// formatter: function (value, row, index) {
|
||||
// return statusTools(row);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// field: 'createTime',
|
||||
// title: '创建时间',
|
||||
// sortable: true
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
|
|
|
|||
|
|
@ -202,7 +202,10 @@ public class ProjectDAO extends JdbcBaseDao
|
|||
String submitTime = (map.get("F_SUBMIT_TIME") == null) ? "" : map.get("F_SUBMIT_TIME").toString();
|
||||
//project.setSubmitTime();
|
||||
project.setSubmitTime(TimeUtil.getDateStrByFormat(submitTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
project.setEndTime((map.get("F_END_TIME") == null) ? "" : map.get("F_END_TIME").toString());
|
||||
String endTime = (map.get("F_END_TIME") == null) ? "" : map.get("F_END_TIME").toString();
|
||||
if(!"".equalsIgnoreCase(endTime) ){
|
||||
project.setEndTime(TimeUtil.getDateStrByFormat(endTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
project.setState((map.get("F_STATE") == null) ? "" : map.get("F_STATE").toString());
|
||||
project.setTaskNum((map.get("T_TASK_NUM") == null) ? 0 : Integer.parseInt(map.get("T_TASK_NUM").toString()));
|
||||
project.setPri((map.get("F_PRI") == null) ? 0 : Integer.parseInt(map.get("F_PRI").toString()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue