Merge branch 'dev_third_stage'

# Conflicts:
#	jero-boot/db/蔚来标准sql/dev_third_record.sql
This commit is contained in:
zer0Black
2022-07-21 21:04:17 +08:00
17 changed files with 1805 additions and 23 deletions
@@ -522,7 +522,14 @@ public class ParamsCollectManifestEOController extends JeroController<ParamsColl
return Result.OK("带入工程接口人成功!");
}
@ApiOperation(value = "参数项收集清单-全部导出")
@GetMapping(value = "/exportAll")
// @RequiresPermissions("report:detail:export:normal")
public void exportAll(ParamsCollectManifestVO paramsCollectManifestVO,
HttpServletResponse response,
HttpServletRequest request) {
paramsCollectManifestEOService.exportAll(paramsCollectManifestVO, response, request);
}
@@ -83,6 +83,7 @@ public class ParamsManifestEOController extends JeroController<ParamsManifestEO,
// 处理 状态 中英文
Map<String, String> stateMap = ManifestStateEnum.toMap(cut);
rows.forEach(manifestEO -> {
manifestEO.setProjectName(paramsManifestEOService.getProjectById(manifestEO.getProjectId()).getProjectName());
manifestEO.setState(stateMap.get(manifestEO.getState()));
});
return Result.OK(cut, pageList);
@@ -100,4 +100,7 @@ public class ParamsManifestEO implements Serializable {
@TableField(exist = false)
private String cut;
@TableField(exist = false)
private String projectName;
}
@@ -6,6 +6,7 @@ import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @Description: 参数收集清单
@@ -17,6 +18,8 @@ public interface ParamsCollectManifestEOMapper extends BaseMapper<ParamsCollectM
List<ParamsCollectManifestEO> listInfo(@Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO);
List<Map<String, Object>> listInfoForExport(@Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO);
// 查询控件类型为 标题的 参数项
List<ParamsCollectManifestEO> listInfoOfTitle(@Param("paramsManifestId") String paramsManifestId);
@@ -80,6 +80,14 @@
order by del_flag desc, add_flag desc, change_flag desc, nio_number asc
</select>
<select id="listInfoForExport" resultType="java.util.LinkedHashMap">
select *
from params_collect_manifest
<include refid="BaseQuerySql"/>
and control_type != '11'
order by del_flag desc, add_flag desc, change_flag desc, nio_number asc
</select>
<select id="listInfoOfTitle" resultMap="ParamsCollectManifestEOResultMap">
select *
from params_collect_manifest
@@ -6,6 +6,7 @@ import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO;
import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -148,4 +149,7 @@ public interface IParamsCollectManifestEOService extends IService<ParamsCollectM
// 带入工程接口人
boolean bringSdtInto(ParamsCollectManifestVO paramsCollectManifestVO);
// 全部导出
void exportAll(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request);
}
@@ -2,6 +2,7 @@ package com.jero.modules.cert.collect.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -12,10 +13,12 @@ import com.jero.common.constant.CommonConstant;
import com.jero.common.constant.WebsocketConst;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.oss.CosBootUtil;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
import com.jero.modules.cert.collect.entity.*;
@@ -46,6 +49,7 @@ import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
import com.jero.modules.split.common.ReadExcel;
import com.jero.modules.system.entity.SysAnnouncement;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
@@ -54,19 +58,31 @@ import com.jero.modules.system.service.ISysAnnouncementService;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.ISysUserRoleService;
import com.jero.modules.system.service.ISysUserService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.*;
import org.apache.shiro.SecurityUtils;
import org.aspectj.util.FileUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -126,6 +142,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
@Resource
private WebSocket webSocket; // 消息专用
@Value(value = "${jero.path.upload}")
private String uploadpath;
@@ -1276,6 +1294,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人
ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(projectId); // 获取项目信息
ParamsManifestEO paramsManifestEO = paramsManifestEOService.queryById(paramsManifestId); // 获取清单信息
paramsManifestEO.setProjectName(projectInfo.getProjectName());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String[] paramsCollectManifestIdStr = paramsCollectManifestIds.split(",");
@@ -1307,8 +1327,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
SysUser sysUser = sysUserService.getUserByName(dre);
String[] thirdIds = new String[1];
thirdIds[0] = sysUser.getThirdId();
String hrefFeishu = backUrl + "/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId;
String href = "<a href='/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId + "'" + " target='_blank'>the link</a>,";
String urlParamsStr = parseUrlParams(paramsManifestEO);
String hrefFeishu = backUrl + "/ParameterItemCollection" + urlParamsStr;
String href = "<a href='/ParameterItemCollection" + urlParamsStr + "'" + " target='_blank'>the link</a>,";
String content = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " and other parameter items, please enter the link to handle it.";
String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " please enter " + href + " to handle it.";
String msgTitle = "You have a homo parameter task to complete";
@@ -1367,6 +1388,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人
ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(projectId); // 获取项目信息
ParamsManifestEO paramsManifestEO = paramsManifestEOService.queryById(paramsManifestId); // 获取清单信息
paramsManifestEO.setProjectName(projectInfo.getProjectName());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String[] paramsCollectManifestIdStr = paramsCollectManifestIds.split(",");
@@ -1378,7 +1401,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
paramsCollectManifestEOList = paramsCollectManifestEOList.stream().sorted(Comparator.comparing(ParamsCollectManifestBaseEO::getNioNumber)).collect(Collectors.toList()); // 按NIO编号升序
for (ParamsCollectManifestEO paramsCollectManifestEO : paramsCollectManifestEOList) {
// 判断参数项状态
if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())) {
if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())
|| CollectManifestStateEnum.SDT_BACK.getValue().equals(paramsCollectManifestEO.getState())
|| CollectManifestStateEnum.CHANGE.getValue().equals(paramsCollectManifestEO.getState())) {
if (StringUtils.isNotBlank(paramsCollectManifestEO.getSdt())) {
ParamsCollectManifestEO updateEO = new ParamsCollectManifestEO();
updateEO.setId(paramsCollectManifestEO.getId());
@@ -1430,8 +1455,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
SysUser sysUser = sysUserService.getUserByName(sdt);
String[] thirdIds = new String[1];
thirdIds[0] = sysUser.getThirdId();
String hrefFeishu = backUrl + "/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId;
String href = "<a href='/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId + "'" + " target='_blank'>the link</a>,";
String urlParamsStr = parseUrlParams(paramsManifestEO);
String hrefFeishu = backUrl + "/ParameterItemCollection" + urlParamsStr;
String href = "<a href='/ParameterItemCollection" + urlParamsStr + "'" + " target='_blank'>the link</a>,";
String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length() - 1) + " and other parameter items, please enter " + href + " and fill in the relevant information.";
String msgTitle = "You have a homo parameter task to complete";
@@ -1489,6 +1515,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人
ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(projectId); // 获取项目信息
ParamsManifestEO paramsManifestEO = paramsManifestEOService.queryById(paramsManifestId); // 获取清单信息
paramsManifestEO.setProjectName(projectInfo.getProjectName());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<ParamsCollectManifestEO> updateEOList = new ArrayList<>();
@@ -1502,7 +1530,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<ParamsCollectManifestEO> paramsCollectManifestEOList = list(queryWrapper);
for (ParamsCollectManifestEO paramsCollectManifestEO : paramsCollectManifestEOList) {
// 判断参数项状态
if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())) {
if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())
|| CollectManifestStateEnum.SDT_BACK.getValue().equals(paramsCollectManifestEO.getState())
|| CollectManifestStateEnum.CHANGE.getValue().equals(paramsCollectManifestEO.getState())) {
if (StringUtils.isNotBlank(paramsCollectManifestEO.getSdt())) {
ParamsCollectManifestEO updateEO = new ParamsCollectManifestEO();
updateEO.setId(paramsCollectManifestEO.getId());
@@ -1554,8 +1584,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
SysUser sysUser = sysUserService.getUserByName(sdt);
String[] thirdIds = new String[1];
thirdIds[0] = sysUser.getThirdId();
String hrefFeishu = backUrl + "/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId;
String href = "<a href='/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId + "'" + " target='_blank'>the link</a>,";
String urlParamsStr = parseUrlParams(paramsManifestEO);
String hrefFeishu = backUrl + "/ParameterItemCollection" + urlParamsStr;
String href = "<a href='/ParameterItemCollection" + urlParamsStr + "'" + " target='_blank'>the link</a>,";
String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length() - 1) + " and other parameter items, please enter " + href + " and fill in the relevant information.";
String msgTitle = "You have a homo parameter task to complete";
@@ -1976,6 +2007,383 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
return updateBatchById(updateCollectManifestEOList);
}
@Override
public void exportAll(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
OutputStream excelOS = null;
XSSFWorkbook workbook = new XSSFWorkbook();
String fileOriName = "参数项清单导出信息";
if (CutEnum.EN.getValue().equals(paramsCollectManifestVO.getCut())) {
fileOriName = "Params info export data";
}
if (StringUtils.isNotEmpty(paramsCollectManifestVO.getExportName())) {
fileOriName = paramsCollectManifestVO.getExportName();
}
//创建临时文件夹
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + fileOriName;
File nowFile = new File(fileNowPath);
if (nowFile.exists()) {
nowFile.delete();
}
nowFile.mkdirs();
try{
String fileName = fileOriName + ".xlsx";
// 设置表格相关属性
String sheetName = "参数项清单信息";
if (CutEnum.EN.getValue().equals(paramsCollectManifestVO.getCut())) {
sheetName = "Params data";
}
XSSFSheet sheetItems = workbook.createSheet(sheetName);
String[] titles = getWorkbookTitleForExport(paramsCollectManifestVO); // 获取表头
String[] headers = titles[1].split(",");
XSSFCellStyle cellStyle =workbook.createCellStyle();
cellStyle.setWrapText(true);
// cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
XSSFCellStyle cellStyle1 =workbook.createCellStyle();
cellStyle1.setAlignment(XSSFCellStyle.ALIGN_CENTER);
XSSFCellStyle cellStyleLink =workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setColor(HSSFColor.LIGHT_BLUE.index);
cellStyleLink.setFont(font);
cellStyleLink.setWrapText(true);
// 查询需要导出的字段
String field = titles[0]; // 字符串形式
List<String> fieldList = Arrays.asList(field.split(",")); // list形式
// 查询导出数据
List<Map<String, Object>> allParamsInfoList = queryForExportAll(paramsCollectManifestVO); // id记得去掉
// 开始处理工作表
List<OSSFile> allRelevFileList = new ArrayList<>();
// 在excel表中添加表头
XSSFRow row = sheetItems.createRow(0);
for (int i = 0; i < headers.length; i++) {
XSSFCell cell = row.createCell(i);
XSSFRichTextString text = new XSSFRichTextString(headers[i]);
cell.setCellValue(text);
cell.setCellStyle(cellStyle1);
sheetItems.setColumnWidth(i, 20 * 256); // 设置单元格宽度
}
Map<String, String> fileNowPathMap = new HashMap<>();
//放文字内容
int allRow = 0;
for(int rowNum = 0;rowNum < allParamsInfoList.size(); rowNum++){
Map<String, Object> exportDto = allParamsInfoList.get(rowNum);
// 处理文件
List<OSSFile> fileList = (List<OSSFile>) exportDto.get("fileList");
if (CollectionUtil.isNotEmpty(fileList)) {
allRelevFileList.addAll(fileList);
fileList.forEach(file -> {
fileNowPathMap.put(file.getId(), fileNowPath + File.separator + exportDto.get("nio_number"));
});
}
allRow++;
XSSFRow row1 = sheetItems.createRow(allRow);
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++){
if (ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
row1.createCell(cellNum).setCellValue(exportDto.get(fieldList.get(cellNum)).toString());
row1.getCell(cellNum).setCellStyle(cellStyle);
}
}
}
//下载关联文件内容
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
downLoadFileList(allRelevFileList,fileNowPathMap);
}
String repFileName = fileName.replaceAll("/","_");
excelOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
response.setHeader("Content-Disposition",
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
response.setContentType("application/force-download");
response.flushBuffer();
os = response.getOutputStream();
workbook.write(excelOS);
excelOS.flush();
excelOS.close();
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
FileInputStream fis = new FileInputStream(fileNowPath+".zip");
int len = 0;
while ((len = fis.read()) != -1) {
os.write(len);
}
// 将导出文件上传到cos上
String uploadFileName = fileOriName + ".zip";
InputStream uploadFileio = new FileInputStream(new File(fileNowPath+".zip"));
MultipartFile mFile = new MockMultipartFile(uploadFileName, uploadFileName, "text/plain", uploadFileio); // 用于上传
OSSFile ossFile = ossFileService.uploadLocalOfCos(mFile, "/manifest", "", CutEnum.CN.getValue()); // 上传导出的压缩包
// 系统向用户发消息
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人
String msgTitle = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕";
String content = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕,请点击下载。";
String href = "<a href='/jero-boot/sys/common/downLoadFile?id=" + ossFile.getId() + "'" + " target='_blank'>下载</a>。";
String contentInfo = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕,请点击" + href;
SysAnnouncement sysAnnouncement = new SysAnnouncement();
sysAnnouncement.setDelFlag("0");
sysAnnouncement.setSendStatus("0");
sysAnnouncement.setSendTime(new Date());
sysAnnouncement.setMsgCategory(MessageTypeEnum.PUSH.getValue()); //消息类型:转发推送
sysAnnouncement.setInitiator(MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); // 发起人:系统
sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户
sysAnnouncement.setTitile(msgTitle);
sysAnnouncement.setMsgContent(content);
sysAnnouncement.setMsgContentInfo(contentInfo);
sysAnnouncement.setUserIds(currentUser.getId()); // 发送给当前导出人
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
JSONObject obj = new JSONObject();
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
obj.put(WebsocketConst.MSG_ID, currentUser.getId());
obj.put(WebsocketConst.MSG_TXT, contentInfo);
webSocket.sendMessage(obj.toJSONString());
uploadFileio.close();
os.flush();
os.close(); // 后开先关
fis.close(); // 先开后关
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new JeroBootException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(excelOS);
File tempZipFile = new File(uploadpath + "/tempZip");
FileUtil.deleteContents(tempZipFile);
}
}
private String[] getWorkbookTitleForExport(ParamsCollectManifestVO paramsCollectManifestVO) {
String cut = paramsCollectManifestVO.getCut();
String paramsManifestId = paramsCollectManifestVO.getParamsManifestId();
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.PARAMS_COLLECT_MANIFEST.getValue());
List<String> dbFieldNameList = new LinkedList<>();
List<String> dbFieldList = new LinkedList<>();
if (fieldList.size() != 0) {
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
}
// 固定列
int indexOfDescription = 1; // 参数名称的位置
for (int i = 0; i < fieldList.size(); i++) {
OnlCgformField onlCgformField = fieldList.get(i);
Map<String, Object> map = new HashMap<>();
String dbFieldName = onlCgformField.getDbFieldName();
if (!"deadline".equals(dbFieldName) && !"cert_category".equals(dbFieldName) && !"description".equals(dbFieldName)) {
dbFieldList.add(dbFieldName);
if(CutEnum.CN.getValue().equals(cut)){
dbFieldNameList.add(onlCgformField.getDbFieldTxt()); // 字段中文名
}else{
dbFieldNameList.add(onlCgformField.getDbFieldEnName()); // 字段英文名
}
if ("params_name".equals(dbFieldName)) {
indexOfDescription = i;
}
}
}
// 认证类别列
List<String> dbFieldNameListCC = new LinkedList<>();
List<String> dbFieldListCC = new LinkedList<>();
// 查询所有认证类别
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByDictCode("cert_category");
if (CutEnum.EN.getValue().equals(cut)) {
sysDictItemList.forEach(sysDictItem -> {
dbFieldListCC.add(sysDictItem.getItemValue());
dbFieldNameListCC.add(sysDictItem.getEnName() + " Number");
});
} else {
sysDictItemList.forEach(sysDictItem -> {
dbFieldListCC.add(sysDictItem.getItemValue());
dbFieldNameListCC.add(sysDictItem.getItemText() + " 编号");
});
}
// 配置列
List<String> dbFieldNameListConfig = new LinkedList<>();
List<String> dbFieldListConfig = new LinkedList<>();
List<ParamsConfigEO> paramsConfigEOList = paramsConfigEOService.queryList(paramsManifestId);
for (ParamsConfigEO paramsConfigEO : paramsConfigEOList) {
dbFieldListConfig.add(paramsConfigEO.getId());
dbFieldNameListConfig.add(paramsConfigEO.getConfigName());
}
// 插入认证类别列
dbFieldList.addAll(indexOfDescription, dbFieldListCC);
dbFieldNameList.addAll(indexOfDescription, dbFieldNameListCC);
// 插入配置列
dbFieldList.addAll(dbFieldListConfig);
dbFieldNameList.addAll(dbFieldNameListConfig);
String[] title = new String[2];
String dbFieldStr = StringUtils.join(dbFieldList, ",");
String dbFieldNameStr = StringUtils.join(dbFieldNameList, ",");
title[0] = dbFieldStr;
title[1] = dbFieldNameStr;
return title;
}
private List<Map<String, Object>> queryForExportAll(ParamsCollectManifestVO paramsCollectManifestVO) {
String paramsManifestId = paramsCollectManifestVO.getParamsManifestId();
String paramsTemplateId = paramsCollectManifestVO.getParamsTemplateId();
Integer paramsTemplatePublishVersion = paramsCollectManifestVO.getParamsTemplatePublishVersion();
String cut = paramsCollectManifestVO.getCut();
ParamsCollectManifestEO queryEO = new ParamsCollectManifestEO();
queryEO.setParamsManifestId(paramsManifestId);
List<Map<String, Object>> dataList = paramsCollectManifestEOMapper.listInfoForExport(queryEO); // 查询导出数据
List<ParamsConfigEO> paramsConfigEOList = paramsConfigEOService.queryList(paramsManifestId); // 查询所有配置列
List<String> paramsConfigIdList = paramsConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
List<ParamsConfigDataEO> paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(paramsConfigIdList); // 查询所有配置数据
List<String> nioNumberList = dataList.stream().map(m->(String)m.get("nio_number")).collect(Collectors.toList());
List<CertCategoryParamsInfoPublishEO> certCategoryParamsInfoPublishEOList = certCategoryParamsInfoPublishEOService.queryListByVersionAndNio(paramsTemplateId, paramsTemplatePublishVersion, nioNumberList); //查询所有认证类别参数项
// 查询责任领域数据字典
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory");
Map<String, String> dutyTerritoryMap = new HashMap<>();
if (CutEnum.EN.getValue().equals(cut)) {
dutyTerritoryMap = sysDictItemList.stream().collect(Collectors.toMap(c -> c.getItemValue(), c -> c.getEnName()));
} else {
dutyTerritoryMap = sysDictItemList.stream().collect(Collectors.toMap(c -> c.getItemValue(), c -> c.getItemText()));
}
// 状态
Map<String,String> stateMap = CollectManifestStateEnum.toMap(cut);
// 插入配置列和认证类别列数据
for (Map<String, Object> record1 : dataList) {
String paramsCollectManifestId = (String) record1.get("id");
String nioNumber = (String) record1.get("nio_number");
String dutyTerritory = (String) record1.get("duty_territory");
String state = (String) record1.get("state");
// 处理负责领域
record1.put("duty_territory", dutyTerritoryMap.get(dutyTerritory));
// 处理负状态
record1.put("state", stateMap.get(state));
// 认证类别列
List<CertCategoryParamsInfoPublishEO> certCategoryParamsInfoPublishEOS = certCategoryParamsInfoPublishEOList.stream().filter(e->nioNumber.equals(e.getNioNumber())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(certCategoryParamsInfoPublishEOS)) {
certCategoryParamsInfoPublishEOS.forEach(certCategoryParamsInfoPublishEO -> {
record1.put(certCategoryParamsInfoPublishEO.getCertCategory(), certCategoryParamsInfoPublishEO.getParamsNumber());
});
}
// 配置列
if (CollectionUtil.isNotEmpty(paramsConfigEOList)) {
List<OSSFile> fileList = new ArrayList<>();
paramsConfigEOList.forEach(paramsConfigEO -> { // 参数配置
String paramsConfigId = paramsConfigEO.getId();
List<ParamsConfigDataEO> paramsConfigDataEOS = paramsConfigDataEOList.stream().filter(e-> paramsConfigId.equals(e.getParamsConfigId()) && paramsCollectManifestId.equals(e.getParamsCollectManifestId())).collect(Collectors.toList()); // 参数配置数据
StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据
if (CollectionUtil.isNotEmpty(paramsConfigDataEOS)) {
ParamsConfigDataEO paramsConfigDataEO = paramsConfigDataEOS.get(0);
if (StringUtils.isNotEmpty(paramsConfigDataEO.getTextData())) {
configDataBuilder.append(paramsConfigDataEO.getTextData()).append("#");
}
if (StringUtils.isNotEmpty(paramsConfigDataEO.getPullData())) {
configDataBuilder.append(paramsConfigDataEO.getPullData()).append("#");
}
if (StringUtils.isNotEmpty(paramsConfigDataEO.getFileConnectId())) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsConfigDataEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFileList)) {
configDataBuilder.append(ossFileList.get(0).getFileName()).append("#");
fileList.addAll(ossFileList);
}
}
}
String configData = configDataBuilder.toString();
if (configData.contains("#")) {
configData = configData.substring(0, configData.lastIndexOf("#"));
}
record1.put(paramsConfigEO.getId(), configData);
});
record1.put("fileList", fileList);
}
}
return dataList;
}
private void downLoadFileList(List<OSSFile> fileTemplateList,Map<String ,String> fileNowPathMap) {
for(OSSFile fileExportDto : fileTemplateList){
String fileNowPath = fileNowPathMap.get(fileExportDto.getId());
File nowFile = new File(fileNowPath);
if (nowFile.exists()){
nowFile.delete();
}
nowFile.mkdirs();
String oldPath = fileExportDto.getUrl();
String newPath = fileNowPath + File.separator + fileExportDto.getFileName();
if (CosBootUtil.doesObjectExist(oldPath)){
try (InputStream in = CosBootUtil.download(oldPath);) {
copyFile(in, newPath);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
}
private void copyFile(InputStream in, String destPath) throws IOException {
BufferedInputStream bis = new BufferedInputStream(in);
BufferedOutputStream bos =
new BufferedOutputStream(Files.newOutputStream(Paths.get(destPath),
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE));
// 打开输入流
// FileInputStream fis = new FileInputStream(srcPath);
// 打开输出流
// FileOutputStream fos = new FileOutputStream(destPath);
// 读取和写入信息
byte[] bytes = new byte[1024 * 1024];
int len;
while ((len = bis.read(bytes)) > 0) {
bos.write(bytes, 0, len);
}
// 关闭流 先开后关 后开先关
bos.close(); // 后开先关
bis.close(); // 先开后关
}
/**
* 获取一个类和其父类的所有属性
*
@@ -2047,6 +2455,59 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
}
/**
* 通过实体类获取 URL Params
*
* @param clazz 实体类
* @return URL Params
*/
private String parseUrlParams(Object clazz) {
// 遍历属性类、属性值
List<Field> list = findAllFieldsOfSelfAndSuperClass(clazz.getClass());
StringBuilder requestURL = new StringBuilder();
try {
boolean flag = true;
String property, value, params;
for (Field field : list) {
// 允许访问私有变量
field.setAccessible(true);
// 过滤静态属性
if (Modifier.isStatic(field.getModifiers())) {
continue;
}
// 属性名
property = field.getName();
// 属性值
if (field.get(clazz) != null) {
if (Date.class.equals(field.getType())) {
Date date = (Date) field.get(clazz);
String pattern = "";
pattern = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat formatter=new SimpleDateFormat(pattern);
String time=formatter.format(date);
value = time;
} else {
value = field.get(clazz).toString();
}
params = property + "=" + value;
} else {
params = property + "=";
}
if (flag) {
requestURL.append("?").append(params);
flag = false;
} else {
requestURL.append("&").append(params);
}
}
} catch (Exception e) {
log.error("通过实体类获取URL出现异常:" + e.getMessage(), e);
}
return requestURL.toString();
}
/**
* 实体对象转成Map
* @param obj 实体对象
@@ -22,7 +22,7 @@ public class ParamsCollectManifestVO {
private String paramsTemplateId; // 参数模板id
@ApiModelProperty(value = "参数模板发布版本")
private String paramsTemplatePublishVersion; // 参数模板发布版本
private Integer paramsTemplatePublishVersion; // 参数模板发布版本
@ApiModelProperty(value = "nio编号")
private String nioNumber; // nio编号
@@ -71,4 +71,7 @@ public class ParamsCollectManifestVO {
private String targetConfigIds; // 引用参数专用
private String cut; // 引用参数专用
private String exportName; // 导出文件名
}
+3
View File
@@ -421,6 +421,7 @@ module.exports = {
MessageNotification: 'Message Notification',
SeeMore: 'See More',
OperationSuccessful: 'Operation Successful',
Intheexport: 'In The Export...',
OperationFailed: 'Operation Failed',
PersonnelSelection: 'Select ',
EmployeeNumber: 'Employee ID',
@@ -1165,4 +1166,6 @@ module.exports = {
exportComparisonReport:'Export Comparison Report',
comparisonDifferenceComment:'Comparison Difference Comment',
fullTextComments:'Full text comments',
fileDeclaration:'file Declaration',
FileForDetails:'File For Details',
}
+3
View File
@@ -426,6 +426,7 @@ module.exports = {
MessageNotification: '消息通知',
SeeMore: '查看更多',
OperationSuccessful: '操作成功',
Intheexport: '导出中...',
operationFailed: '操作失败',
PersonnelSelection: '人员选择',
EmployeeNumber: '员工号',
@@ -1169,4 +1170,6 @@ module.exports = {
exportComparisonReport:'导出对比报告',
comparisonDifferenceComment:'对比差异评论',
fullTextComments:'全文评论',
fileDeclaration:'文件说明',
FileForDetails:'文件详情',
}
@@ -0,0 +1,125 @@
<template>
<div>
<a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
<a-tree
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:tree-data="gData"
@expand="onExpand"
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
<template>
<a-dropdown :trigger="['contextmenu']">
<span>{{ title }}</span>
<template #overlay>
<a-menu @click="({ key: menuKey }) => onContextMenuClick(treeKey, menuKey)">
<a-menu-item key="1">1st menu item</a-menu-item>
<a-menu-item key="2">2nd menu item</a-menu-item>
<a-menu-item key="3">3rd menu item</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</template>
</a-tree>
</div>
</template>
<script>
const x = 3;
const y = 2;
const z = 1;
const gData = [];
const generateData = (_level, _preKey, _tns) => {
const preKey = _preKey || '0';
const tns = _tns || gData;
const children = [];
for (let i = 0; i < x; i++) {
const key = `${preKey}-${i}`;
tns.push({ title: key, key, scopedSlots: { title: 'title' } });
if (i < y) {
children.push(key);
}
}
if (_level < 0) {
return tns;
}
const level = _level - 1;
children.forEach((key, index) => {
tns[index].children = [];
return generateData(level, key, tns[index].children);
});
};
generateData(z);
const dataList = [];
const generateList = data => {
for (let i = 0; i < data.length; i++) {
const node = data[i];
const key = node.key;
dataList.push({ key, title: key });
if (node.children) {
generateList(node.children);
}
}
};
generateList(gData);
const getParentKey = (key, tree) => {
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.children) {
if (node.children.some(item => item.key === key)) {
parentKey = node.key;
} else if (getParentKey(key, node.children)) {
parentKey = getParentKey(key, node.children);
}
}
}
return parentKey;
};
export default {
data() {
return {
searchValue: '',
autoExpandParent: true,
expandedKeys: ['0-0-0', '0-0-1'],
gData,
};
},
methods: {
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
},
onChange(e) {
const value = e.target.value;
const expandedKeys = dataList
.map(item => {
if (item.title.indexOf(value) > -1) {
return getParentKey(item.key, gData);
}
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
Object.assign(this, {
expandedKeys,
searchValue: value,
autoExpandParent: true,
});
},
onContextMenuClick(treeKey, menuKey) {
console.log(`treeKey: ${treeKey}, menuKey: ${menuKey}`);
},
},
};
</script>
@@ -0,0 +1,309 @@
<template>
<a-modal
:title="title"
:maskClosable="false"
:width="800"
placement="right"
:closable="true"
@cancel="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-spin :spinning="confirmLoading">
<a-form>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('parameterTemplate')">{{$t('parameterTemplate')}}</span>
</div>
<a-form-model-item class="itemModel" prop="paramsTemplateName">
<a-input class="box-input"
:disabled="disabled"
v-model.trim="formInline.paramsTemplateName"
:placeholder="$t('PleaseEnter')+$t('parameterTemplate')"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('zoneOfApplication')">{{$t('zoneOfApplication')}}</span>
</div>
<a-form-model-item class="itemModel" prop="region">
<j-dict-select-tag class="box-input" v-model="formInline.region"
:disabled="disabled"
:placeholder="$t('PleaseSelect')+$t('zoneOfApplication')"
:type="'select'"
:triggerChange="false" :dictCode="'region'"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('contentDescription')">{{$t('contentDescription')}}</span>
</div>
<a-form-model-item class="itemModel" prop="description">
<a-input class="box-input add-input"
type="textarea"
:disabled="disabled"
v-model="formInline.description"
:placeholder="$t('PleaseEnter')+$t('contentDescription')"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-form>
</a-spin>
<div class="drawer-bootom-button">
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-modal>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
export default {
name: 'addModel',
components: {
PersonnelSelection
},
props: ['url'],
data() {
return {
formInline: {},
confirmLoading: false,
visible: false,
rules: {
paramsTemplateName:[
{ required: true, message: this.$t('PleaseEnter')+this.$t('parameterTemplate'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
description:[
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
],
state: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('status'), trigger: 'change' },
],
region: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('zoneOfApplication'), trigger: 'change' },
]
},
disabled: false,
projectNameList: [],
title: ''
}
},
mounted() {
this.getNameList()
},
methods: {
getNameList() {
getAction('project/projectNameInfoEO/list', {}).then((res) => {
if (res.success) {
this.projectNameList = res.result || []
} else {
this.projectNameList = []
}
})
},
addModel() {
this.visible = true
this.title = this.$t('UploadFile')
this.formInline = {}
this.$nextTick(() => {
this.$refs['ruleForm'].clearValidate()
})
},
editModel(value) {
this.visible = true
this.title = this.$t('edit')
this.$nextTick(() => {
this.formInline = value
this.$refs['ruleForm'].clearValidate()
})
},
handleCancel() {
this.visible = false
},
handleSubmit() {
if(this.formInline.paramsTemplateName !== undefined) {
this.formInline.paramsTemplateName = this.formInline.paramsTemplateName.trim()
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
if (this.formInline.id) {
url = this.url.edit
Action = putAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
} else {
this.$message.warning(this.$t('operationFailed'))
this.confirmLoading = false
}
})
}
})
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
this.$refs.ruleForm.validateField([value])
})
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
projectNameChange(value){
console.log(value)
},
}
}
</script>
<style>
.formAdd .ant-form-item-label {
width: 130px;
}
.formAdd .ant-form-item-control-wrapper {
display: inline-block;
width: 100%;
}
/*.formAdd .ant-form-item {*/
/* margin-bottom: 20px;*/
/*}*/
.itemModel .ant-form-item-control-wrapper {
width: 100%;
}
.box-input .ant-select-selection--single {
height: 38px;
}
.box-input .ant-select-selection--multiple {
height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
margin-top: 6px;
}
.box-input .ant-calendar-picker {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
height: 38px;
}
.box-input .ant-input-number-input-wrap {
line-height: 38px;
height: 38px;
}
</style>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index:100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
/deep/.add-input{
min-height: 135px!important;
}
</style>
<style>
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
@@ -0,0 +1,286 @@
<template>
<a-modal
:title="title"
:maskClosable="false"
:width="800"
placement="right"
:closable="true"
@cancel="handleCancel"
:visible="visible"
style="height: 80%;overflow: auto;padding-bottom: 53px;">
<!-- <a-spin :spinning="confirmLoading">-->
<a-form>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="12">
<div style='margin-left: 55px;width: 700px'>
<span :title="$t('parameterTemplate')">{{$t('parameterTemplate')}}</span>
<span style='margin-left: 5px' :title="$t('parameterTemplate')">{{$t('parameterTemplate')}}</span>
<a style='margin-left: 533px' @click="download(record)">{{$t('download')}}</a>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text" style='margin-top: 5px'>
<div class="title-text">
<span class="title-text-text"
:title="$t('fileDeclaration')">{{$t('fileDeclaration')}}</span>
</div>
<a-form-model-item class="itemModel" prop="description">
<a-input class="box-input add-input"
:readOnly="true"
type="textarea"
:disabled="disabled"
v-model="formInline.description"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-form>
<!-- </a-spin>-->
<div class="drawer-bootom-button">
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('close')}}</a-button>
<!-- <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('close')}}</a-button>-->
</div>
</a-modal>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
export default {
name: 'addModel',
components: {
PersonnelSelection
},
props: ['url'],
data() {
return {
formInline: {},
confirmLoading: false,
visible: false,
rules: {
paramsTemplateName:[
{ required: true, message: this.$t('PleaseEnter')+this.$t('parameterTemplate'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
description:[
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
],
state: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('status'), trigger: 'change' },
],
region: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('zoneOfApplication'), trigger: 'change' },
]
},
disabled: false,
projectNameList: [],
title: ''
}
},
mounted() {
this.getNameList()
},
methods: {
getNameList() {
getAction('project/projectNameInfoEO/list', {}).then((res) => {
if (res.success) {
this.projectNameList = res.result || []
} else {
this.projectNameList = []
}
})
},
addModel() {
this.visible = true
this.title = this.$t('FileForDetails')
this.formInline = {}
this.$nextTick(() => {
this.$refs['ruleForm'].clearValidate()
})
},
editModel(value) {
this.visible = true
this.title = this.$t('edit')
this.$nextTick(() => {
this.formInline = value
this.$refs['ruleForm'].clearValidate()
})
},
handleCancel() {
this.visible = false
},
handleSubmit() {
if(this.formInline.paramsTemplateName !== undefined) {
this.formInline.paramsTemplateName = this.formInline.paramsTemplateName.trim()
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
if (this.formInline.id) {
url = this.url.edit
Action = putAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
} else {
this.$message.warning(this.$t('operationFailed'))
this.confirmLoading = false
}
})
}
})
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
this.$refs.ruleForm.validateField([value])
})
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
projectNameChange(value){
console.log(value)
},
}
}
</script>
<style>
.formAdd .ant-form-item-label {
width: 130px;
}
.formAdd .ant-form-item-control-wrapper {
display: inline-block;
width: 100%;
}
/*.formAdd .ant-form-item {*/
/* margin-bottom: 20px;*/
/*}*/
.itemModel .ant-form-item-control-wrapper {
width: 100%;
}
.box-input .ant-select-selection--single {
height: 38px;
}
.box-input .ant-select-selection--multiple {
height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
margin-top: 6px;
}
.box-input .ant-calendar-picker {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
height: 38px;
}
.box-input .ant-input-number-input-wrap {
line-height: 38px;
height: 38px;
}
</style>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index:100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
/deep/.add-input{
min-height: 135px!important;
}
</style>
<style>
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
@@ -0,0 +1,523 @@
<template>
<div style='display:flex'>
<a-card :bordered="false">
<div style='width: 300px;background-color: white'>
<exportTree ref="exportRef" />
</div>
</a-card>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('fileName')">
<span>{{ $t('fileName') }}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('fileName')"
v-model="queryParam.fileName"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('uploadedBy')">
<span>{{$t('uploadedBy')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('uploadedBy')"
v-model="queryParam.uploadedBy"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('uploadTime')">
<span>{{ $t('uploadTime') }}</span>
</div>
<a-date-picker class="box-input"
:placeholder="$t('PleaseSelect')+$t('uploadTime')"
@change="onChange" @ok="onOk"
format="YYYY-MM-DD"
:getCalendarContainer="(trigger) => trigger.parentNode"
v-model="queryParam.uploadTime"
:disabled="false"/>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<!-- <globalAdvancedQuery ref="globalAdvancedQueryRef"-->
<!-- @handleSuperQuery="handleSuperQuery"-->
<!-- :fieldList="fieldList"/>-->
<a-button class="box-button" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
<a-button class="box-button" style="margin-left: 8px"
@click="searchReset">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator" style="overflow:hidden;margin-bottom: 20px">
<div style="float: right;margin-bottom: 0px;margin-left: 20px">
<div class="operator-text" @click="handleuploadFile()">
<a-icon type="import"/>
{{ $t('UploadFile') }}
</div>
<div class="operator-text" @click="handleDel()">
<a-icon type="delete"/>
{{ $t('BatchDelete') }}
</div>
</div>
</div>
<div>
<a-table
ref="table"
size="middle"
:loading="loading"
:pagination="false"
:scroll="{x: true}"
rowKey="id"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="projectName" slot-scope="text,record" :title="text">
<a @click="entryNameClick(record)">
{{ text && text.length > 15 ? text.slice(0, 14) + '...' : text }}
</a>
</span>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" @click="handlelist(record)">{{$t('view')}}</a>
<a class="text-operation" @click="download(record)">{{$t('download')}}</a>
<a class="text-operation" @click="handleEdit(record)">{{$t('edit')}}</a>
<a class="text-operation" @click="batchDel(record)">{{$t('delete')}}</a>
</span>
</a-table>
</div>
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
<!-- 上传文件-->
<addModel :url="url" ref="addModelRef" @addModelList="addModelList"/>
<!-- 文件详情-->
<handleModel :url="url" ref="handleModelRef" />
</a-card>
</div>
</template>
<script>
import addModel from './components/addModel'
import handleModel from './components/handle'
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
import exportTree from '@/components/exportTree/index'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
// import eventBUs from '../../../common/event'
import Vue from 'vue'
import moment from 'moment'
export default {
name: 'index',
components: {
addModel,
handleModel,
exportTree,
globalAdvancedQuery
},
data() {
return {
token: Vue.ls.get(ACCESS_TOKEN),
loading: false,
toggleSearchStatus: false,
selectedRowKeys: [],
CategoryTreeList:[],
paramsManifestId:'',
item:{},
selectedRowKeysArray: '',
formInline: {},
rules: {
paramsTemplateName: [
{ required: true, message: this.$t('PleaseEnter') + this.$t('templateName'), trigger: 'change' }
]
},
fieldList: [],
visible: false,
dataSource: [],
confirmLoading: false,
url: {
list: 'project/lawsComplianceBoard/page',
getSysCategoryTree: '/sys/category/getSysCategoryTree',
},
total: 0,
pageSize: 10,
pageNo: 1,
title: '新增',
columns: [
{
title: this.$t('fileName'),
align: 'center',
dataIndex: 'serialNumber',
},
{
title: this.$t('fileDeclaration'),
align: 'center',
dataIndex: 'title',
},
{
title: this.$t('uploadedBy'),
align: 'center',
dataIndex: 'state_dicText',
},
// {
// title: this.$t('category'),
// align: 'center',
// dataIndex: 'category'
// },
{
title: this.$t('uploadTime'),
align: 'center',
dataIndex: 'technologyTerritory_dicText',
width: 250
},
{
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: 250,
scopedSlots: { customRender: 'operation' }
}
],
queryParam: {},
areaVisible: false,
paramsTemplateName: '',
queryConditionVOList: [],
drawerVisible: false,
titleTag: ''
}
},
mounted() {
this.getList()
this.getSysCategoryTree()
this.queryConditionInventory()
},
methods: {
queryConditionInventory() {
let query = {
flag: 1
}
getAction('/project/projectLawsInventoryEO/queryConditionInventory', query).then((res) => {
if (res.success) {
this.fieldList = res.result || []
} else {
this.fieldList = []
}
})
},
handleCancel() {
this.areaVisible = false
},
handleSubmit() {
if (this.formInline.paramsTemplateName !== undefined) {
this.formInline.paramsTemplateName = this.formInline.paramsTemplateName.trim()
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
getAction(this.url.copy + `?id=${this.selectedRowKeys[0]}&paramsTemplateName=${this.formInline.paramsTemplateName}`, {}).then((res) => {
if (res.success) {
this.areaVisible = false
this.$message.success(res.message)
this.selectedRowKeys = []
this.getList()
} else {
this.$message.warning(res.message)
}
})
}
})
},
getSysCategoryTree() {
getAction(this.url.getSysCategoryTree, {}).then((res) => {
if (res.success) {
this.CategoryTreeList = res.result
} else {
this.CategoryTreeList = []
}
})
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
onSelectChange(value) {
this.selectedRowKeysArray = this.selectedRowKeys.join(',')
},
deriveconformanceresults(){
let query = {
...this.queryParam,
exportAll:'yes',
ids: this.selectedRowKeys.join(',')
}
downloadFile('/project/lawsComplianceBoard/exportComplianceResult', this.$t('complianceResults')+'.xls', query, this.Deselect)
},
// 上传文件
handleuploadFile(e) {
this.$refs.addModelRef.addModel()
},
hideModal() {
this.visible = false
},
//虚拟清单名称事件
entryNameClick(item) {
this.$router.push({
path: '/ParameterTemplateList',
query: item
})
},
searchQuery() {
this.pageNo = 1
this.getList()
},
searchReset() {
this.queryParam = {}
this.territory = ''
this.queryConditionVOList = []
this.$refs.globalAdvancedQueryRef.resetLine()
this.$refs.globalAdvancedQueryRef.emitCallback()
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
addModelList() {
this.pageNo = 1
this.getList()
},
PersonnelSelectionChange(value, id) {
this.queryParam[value] = id
this.queryParam = { ...this.queryParam }
},
handleSuperQuery(params, matchType) {
let sqp = {}
if (!params || (params && params.length == 0)) {
this.queryConditionVOList = []
this.$refs.globalAdvancedQueryRef.superQueryFlag = false
} else {
this.$refs.globalAdvancedQueryRef.superQueryFlag = true
this.queryConditionVOList = params
this.queryConditionVOList.forEach(res => {
res.type = matchType
})
}
this.getList()
},
//查看
handlelist(){
this.$refs.handleModelRef.addModel()
},
//编辑
handleEdit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item)))
},
//删除
batchDel(val) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
getAction(_this.url.deleteBatch, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
//批量删除
handleDel() {
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
getAction(_this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
} else {
_this.$message.warning(res.message)
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
getList() {
let territory = ''
if (this.queryParam.technologyTerritory) {
this.territory = this.queryParam.technologyTerritory.join(',')
}
// let queryParam = JSON.parse(JSON.stringify(this.queryParam))
let queryConditionVOList = JSON.parse(JSON.stringify(this.queryConditionVOList))
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
queryConditionVOList: JSON.stringify(queryConditionVOList),
technology_territory: this.territory,
serial_number:this.queryParam.serialNumber,
title:this.queryParam.title,
state:this.queryParam.state
}
this.loading = true
postAction(this.url.list, query).then((res) => {
if (res) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = res.result.current - 1
this.getList()
return
}
console.log(res.result)
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 20%;
min-width: 110px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.add-input {
width: 82%;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.text-operation {
margin-right: 8px;
}
.page {
text-align: right;
margin-top: 20px;
}
.box-title-text-add {
line-height: 1.4;
display: flex;
}
.title-text-add {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
margin-top: 3px;
}
.box-input-add {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
z-index: 100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.add-text-text {
margin-top: -14px;
}
</style>
@@ -3,7 +3,7 @@
<div class="Virtual-detail-header" style="position: fixed;top: 0">
<div class="Virtual-detail-title">
<span>
{{$t('ParameteItemCollectionList')}}(Model - year market)——{{$t(this.paramsManifest.title)}}
{{$t('ParameteItemCollectionList')}}({{$t(this.$route.query.projectName)}})——{{$t(this.paramsManifest.title)}}
</span>
</div>
</div>
@@ -108,10 +108,10 @@
<!-- // R&H Manager manager-->
<!-- // 系统管理员 admin-->
<!-- // 游客 guest-->
<a-popconfirm overlayClassName='popconfirm' placement="bottomRight" v-if='currentPersonRole == "homo"'>
<a-popconfirm overlayClassName='popconfirm' placement="bottomRight" v-if='currentPersonRole == "homo" || currentPersonRole == "sdt"'>
<template slot="title" id="popconfirm">
<!-- 添加-->
<div @click="handleAdd" class="operator-text-title">
<div @click="handleAdd" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="plus"/>
{{$t('addTo')}}
</div>
@@ -120,18 +120,24 @@
<!-- <a-icon type="solution"/>-->
<!-- {{$t('distributionAndCollection')}}-->
<!-- </div>-->
<!-- 导出-->
<div @click="handleExport" class="operator-text-title"
v-if='currentPersonRole == "homo" || currentPersonRole == "sdt"'>
<a-icon type="export"/>
{{$t('export')}}
</div>
<!-- 一键下发收集 -->
<div @click="defOneclickCollection" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="solution"/>
{{$t('OneclickCollection')}}
</div>
<!-- 冻结配置-->
<div @click="freezeConfiguration" class="operator-text-title">
<div @click="freezeConfiguration" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="solution"/>
{{$t('FreezeConfiguration')}}
</div>
<!-- 同步上报库 -->
<div @click="handleSynchronousReportLibraryJurisdiction" class="operator-text-title">
<div @click="handleSynchronousReportLibraryJurisdiction" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="setting"/>
{{$t('SynchronousReportLibrary')}}
</div>
@@ -141,16 +147,16 @@
<!-- {{$t('TaskCutOffTime')}}-->
<!-- </div>-->
<!-- 批量删除-->
<div @click="handleDelJurisdiction" class="operator-text-title">
<div @click="handleDelJurisdiction" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="delete"/>
{{$t('BatchDelete')}}
</div>
<div @click="bringInTheProjectInterfaceClick" class="operator-text-title">
<div @click="bringInTheProjectInterfaceClick" class="operator-text-title" v-if='currentPersonRole == "homo"'>
<a-icon type="profile"/>
{{$t('bringInTheProjectInterface')}}
</div>
</template>
<div class="operator-text" style="position: relative">
<div class="operator-text" style="position: relative " @click='morepop' v-if='currentPersonRole == "homo" || currentPersonRole == "sdt"'>
<span style="position: absolute;left: -13px;top: -4px">...</span>{{ $t('more') }}
</div>
</a-popconfirm>
@@ -192,6 +198,7 @@
<a-icon type="delete"/>
{{$t('CompulsoryWithdrawal')}}
</div>
<!-- 角色切换 -->
<div class="operator-text"
v-if="!this.$route.query.it"
@@ -264,13 +271,13 @@
@areaVisibleAssignedbyflag='areaVisibleAssignedbyflag' @areaVisible='areaVisibleAssignedby = false'/>
</a-modal>
<!-- 下发收集--->
<a-modal v-model="areaVisibleTaskCutOffTime" :title="$t('distributionAndCollection')" width='600px' :footer="null">
<a-modal v-model="areaVisibleTaskCutOffTime" :title="$t('distributionAndCollection')" width='400px' :footer="null">
<task-cut-off-time v-if='areaVisibleTaskCutOffTime' :selectedRowKeysArray='selectedRowKeysArray'
@GetgetTableList='GetgetTableList'
@areaVisibleTaskCutOffTimeflag='areaVisibleTaskCutOffTimeflag'/>
</a-modal>
<!-- 一键下发收集--->
<a-modal v-model="OneclickCollection" :title="$t('OneclickCollection')" width='600px' :footer="null">
<a-modal v-model="OneclickCollection" :title="$t('OneclickCollection')" width='400px' :footer="null">
<task-time v-if='OneclickCollection' :selectedRowKeysArray='selectedRowKeysArray'
@GetgetTableList='GetgetTableList'
@areaVisibleTaskCutOffTimeAll='areaVisibleTaskCutOffTimeAll'/>
@@ -554,7 +561,8 @@
{
type: 'string',
value: 'paramsBatch',
text: this.$t('parameterBatch')
text: this.$t('parameterBatch'),
dictCode: 'params_batch'
},
],
selectedRowKeys: [],
@@ -799,6 +807,29 @@
return flag
}
},
//导出
handleExport(){
this.$message.success(this.$t('Intheexport'))
let long = localStorage.getItem('language')
this.cut = ''
if (long && long === 'zh-cn') {
this.cut = 'cn'
} else if (long && long === 'en-us') {
this.cut = 'en'
}
let query = {
paramsManifestId: this.paramsManifest.id,
paramsTemplateId: this.$route.query.paramsTemplateId,
paramsTemplatePublishVersion:1,
cut: this.cut,
exportName:this.$route.query.projectName + '(' + this.$route.query.title + ')'
}
console.log(query)
getAction('/params/collectManifest/exportAll', query).then((res) => {
this.textLoading = false
})
},
// 高级搜索
handleSuperQuery(params, matchType) {
let sqp = {}
@@ -255,7 +255,9 @@
localStorage.setItem('paramsManifest', JSON.stringify(item))
let newUrl = _this.$router.resolve({
path: '/ParameterItemCollection',
query: item
query: item
// projectName:this.$route.query.projectName
})
window.open(newUrl.href, '_blank')
} else {
@@ -16,6 +16,9 @@
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'MessageDetails',
methods: {
@@ -30,6 +33,13 @@
})
}
}
},
mounted() {
if (this.$route.query.msgContentInfo && this.$route.query.msgContentInfo.includes('downLoadFile')) {
let index = this.$route.query.msgContentInfo.indexOf('target')
this.$route.query.msgContentInfo = this.$route.query.msgContentInfo.slice(0, index - 2) + '&token=' + Vue.ls.get(ACCESS_TOKEN) + '\' '
+ this.$route.query.msgContentInfo.slice(index)
}
}
}
</script>