Merge branch 'dev_third_stage'

# Conflicts:
#	jero-web/src/components/PersonnelSelection/index.vue
This commit is contained in:
zer0Black
2022-07-09 11:16:08 +08:00
31 changed files with 1489 additions and 124 deletions
@@ -205,6 +205,11 @@ CREATE TABLE `params_report_export_history` (
ALTER TABLE `laws_weilai`.`params_manifest_history`
ADD COLUMN `source_params_manifest_id` varchar(50) NULL COMMENT '源参数清单id' AFTER `params_template_publish_version`;
-- 上报库表 添加字段 2022-07-08
ALTER TABLE `laws_weilai`.`params_report`
ADD COLUMN `project_name` varchar(200) NULL COMMENT '项目名称' AFTER `params_template_publish_version`,
ADD COLUMN `title` varchar(200) NULL COMMENT '清单标题' AFTER `project_name`;
ALTER TABLE `laws_opinion_gather`
ADD COLUMN `opinion_archive_id` varchar(4000) NULL COMMENT '意见归档文件id' AFTER `prc_num`;
@@ -3,8 +3,11 @@ package com.jero.modules.cert.collect.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.cert.collect.entity.ParamsManifestEO;
import com.jero.modules.cert.collect.vo.ParamsManifestVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 参数清单
* @Author: jero-boot
@@ -18,4 +21,6 @@ public interface ParamsManifestEOMapper extends BaseMapper<ParamsManifestEO> {
@Param("state") String state,
IPage page);
List<ParamsManifestVO> listInfoAll(@Param("idList") List<String> idList);
}
@@ -20,6 +20,7 @@
<resultMap id="ParamsManifestEOResultMapForCopy" type="com.jero.modules.cert.collect.vo.ParamsManifestVO">
<id column="id" property="id" />
<result column="title" property="title" />
<result column="version" property="version" />
<result column="project_id" property="projectId" />
<result column="project_name" property="projectName" />
<result column="state" property="state" />
@@ -72,6 +73,7 @@
select
pm.id as id,
pm.title as title,
pm.version as version,
pm.project_id as project_id,
pm.state as state,
concat(pni.project_name,'-',pyni.year_name) as project_name,
@@ -91,4 +93,23 @@
</if>
order by create_time desc
</select>
<select id="listInfoAll" resultMap="ParamsManifestEOResultMapForCopy">
select tmp_tb.* from(
select
pm.id as id,
pm.version as version,
pm.title as title,
concat(pni.project_name,'-',pyni.year_name) as project_name
from params_manifest pm
left join project_library_base as plb on plb.id = pm.project_id
left join project_name_info as pni on plb.project_name_id = pni.id
left join project_year_name_info as pyni on plb.year_name_id=pyni.id
) tmp_tb
where 1=1 and id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
@@ -34,4 +34,12 @@ public interface IParamsCollectManifestHistoryEOService extends IService<ParamsC
*/
List<Map<String, Object>> getHeader(String paramsManifestId, String flag, String cut);
/**
* 批量删除
*
* @param ids
* @return
*/
boolean deleteByIds(List<String> ids);
}
@@ -1,7 +1,6 @@
package com.jero.modules.cert.collect.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.cert.collect.entity.ParamsConfigDataEO;
import com.jero.modules.cert.collect.entity.ParamsConfigDataHistoryEO;
import java.util.List;
@@ -29,4 +28,7 @@ public interface IParamsConfigDataHistoryEOService extends IService<ParamsConfig
* @return
*/
List<ParamsConfigDataHistoryEO> queryListByConfigIdList(List<String> configIdList);
int deleteByParamsCollectManifestIdList(List<String> paramsCollectManifestIdList);
}
@@ -17,4 +17,6 @@ public interface IParamsManifestHistoryEOService extends IService<ParamsManifest
void addForChangeExtension(String paramsManifestId);
List<ParamsManifestHistoryVO> getHistoryVersionList(String paramsManifestId);
void deleteAllHistoryVersion(List<String> paramsManifestIdList);
}
@@ -455,6 +455,19 @@ public class ParamsCollectManifestHistoryEOServiceImpl extends ServiceImpl<Param
return list;
}
/**
* 批量删除
*
* @param ids
* @return
*/
@Override
public boolean deleteByIds(List<String> ids) {
// 关联删除配置数据
paramsConfigDataHistoryEOService.deleteByParamsCollectManifestIdList(ids);
return removeByIds(ids);
}
/**
* 获取一个类和其父类的所有属性
*
@@ -7,6 +7,7 @@ import com.jero.modules.cert.collect.entity.ParamsConfigDataEO;
import com.jero.modules.cert.collect.entity.ParamsConfigDataHistoryEO;
import com.jero.modules.cert.collect.mapper.ParamsConfigDataHistoryEOMapper;
import com.jero.modules.cert.collect.service.IParamsConfigDataHistoryEOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -20,6 +21,9 @@ import java.util.List;
@Service
public class ParamsConfigDataHistoryEOServiceImpl extends ServiceImpl<ParamsConfigDataHistoryEOMapper, ParamsConfigDataHistoryEO> implements IParamsConfigDataHistoryEOService {
@Autowired
private ParamsConfigDataHistoryEOMapper paramsConfigDataHistoryEOMapper;
/**
* 通过id查询
*
@@ -50,4 +54,12 @@ public class ParamsConfigDataHistoryEOServiceImpl extends ServiceImpl<ParamsConf
}
return null;
}
@Override
public int deleteByParamsCollectManifestIdList(List<String> paramsCollectManifestIdList) {
LambdaQueryWrapper<ParamsConfigDataHistoryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ParamsConfigDataEO::getParamsCollectManifestId, paramsCollectManifestIdList);
return paramsConfigDataHistoryEOMapper.delete(queryWrapper);
}
}
@@ -20,6 +20,7 @@ import com.jero.modules.cert.collect.mapper.ParamsConfigEOMapper;
import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper;
import com.jero.modules.cert.collect.service.*;
import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO;
import com.jero.modules.cert.report.service.IParamsReportEOService;
import com.jero.modules.cert.template.entity.ParamsInfoPublishEO;
import com.jero.modules.cert.template.entity.ParamsTemplateEO;
import com.jero.modules.cert.template.service.IParamsInfoPublishEOService;
@@ -81,6 +82,9 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
@Autowired
private IParamsConfigDataEOService paramsConfigDataEOService;
@Autowired
private IParamsReportEOService paramsReportEOService;
@@ -212,6 +216,14 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
}
// 删除对应的历史版本数据
List<String> idList = new ArrayList<>();
idList.add(id);
paramsManifestHistoryEOService.deleteAllHistoryVersion(idList);
// 添加上报库的项目名称和清单标题
paramsReportEOService.setProjectNameAndTitle(idList);
return removeById(id);
}
@@ -251,6 +263,13 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
paramsCollectManifestEOService.deleteByIds(paramsCollectManifestIdList);
}
// 删除对应的历史版本数据
paramsManifestHistoryEOService.deleteAllHistoryVersion(ids);
// 添加上报库的项目名称和清单标题
paramsReportEOService.setProjectNameAndTitle(ids);
return removeByIds(ids);
}
@@ -1,9 +1,11 @@
package com.jero.modules.cert.collect.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.cert.collect.entity.*;
import com.jero.modules.cert.collect.mapper.ParamsCollectManifestEOMapper;
import com.jero.modules.cert.collect.mapper.ParamsConfigHistoryEOMapper;
import com.jero.modules.cert.collect.mapper.ParamsManifestHistoryEOMapper;
import com.jero.modules.cert.collect.service.*;
import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO;
@@ -133,7 +135,7 @@ public class ParamsManifestHistoryEOServiceImpl extends ServiceImpl<ParamsManife
@Override
public List<ParamsManifestHistoryVO> getHistoryVersionList(String paramsManifestId) {
// 同一项目下标题时唯一的,历史版本和当前版本通过标题进行关联
// 历史版本和当前版本通过id进行关联
LambdaQueryWrapper<ParamsManifestHistoryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParamsManifestHistoryEO::getSourceParamsManifestId, paramsManifestId)
.orderByAsc(ParamsManifestHistoryEO::getVersion);
@@ -149,4 +151,37 @@ public class ParamsManifestHistoryEOServiceImpl extends ServiceImpl<ParamsManife
return historyVersionList;
}
@Autowired
private ParamsConfigHistoryEOMapper paramsConfigHistoryEOMapper;
@Autowired
private ParamsManifestHistoryEOMapper paramsManifestHistoryEOMapper;
@Override
public void deleteAllHistoryVersion(List<String> paramsManifestIdList) {
LambdaQueryWrapper<ParamsManifestHistoryEO> manifestHistoryEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
manifestHistoryEOLambdaQueryWrapper.in(ParamsManifestHistoryEO::getSourceParamsManifestId, paramsManifestIdList);
List<ParamsManifestHistoryEO> list = list(manifestHistoryEOLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
List<String> ids = list.stream().map(ParamsManifestHistoryEO::getId).collect(Collectors.toList());
// 关联删除配置
LambdaQueryWrapper<ParamsConfigHistoryEO> configEOQueryWrapper = new LambdaQueryWrapper<>();
configEOQueryWrapper.in(ParamsConfigHistoryEO::getParamsManifestId, ids);
paramsConfigHistoryEOMapper.delete(configEOQueryWrapper);
// 关联删除收集的参数项(包含配置数据)
LambdaQueryWrapper<ParamsCollectManifestHistoryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ParamsCollectManifestHistoryEO::getParamsManifestId, ids);
List<ParamsCollectManifestHistoryEO> paramsCollectManifestHistoryEOList = paramsCollectManifestHistoryEOService.list(queryWrapper);
if (CollectionUtil.isNotEmpty(paramsCollectManifestHistoryEOList)) {
List<String> paramsCollectManifestIdList = paramsCollectManifestHistoryEOList.stream().map(ParamsCollectManifestHistoryEO::getId).collect(Collectors.toList());
paramsCollectManifestHistoryEOService.deleteByIds(paramsCollectManifestIdList);
}
// 删除清单对应的所有历史版本清单
paramsManifestHistoryEOMapper.delete(manifestHistoryEOLambdaQueryWrapper);
}
}
}
@@ -1,5 +1,6 @@
package com.jero.modules.cert.collect.vo;
import io.swagger.models.auth.In;
import lombok.Data;
/**
@@ -12,6 +13,7 @@ public class ParamsManifestVO {
private String id;
private String title;
private Integer version;
private String projectName;
private String projectId;
private String state;
@@ -1,13 +1,10 @@
package com.jero.modules.cert.report.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO;
import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO;
import com.jero.modules.cert.report.entity.ParamsReportDetailEO;
import com.jero.modules.cert.report.service.IParamsReportDetailEOService;
import com.jero.modules.cert.report.vo.ParamsReportDetailVO;
@@ -15,9 +12,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -89,7 +88,7 @@ public class ParamsReportDetailEOController extends JeroController<ParamsReportD
@ApiOperation(value = "上报库参数项-常规导出")
@GetMapping(value = "/exportNormal")
// @RequiresPermissions("report:detail:export:normal")
public void exportSplitInfoZip(ParamsReportDetailVO paramsReportDetailVO,
public void exportNormal(ParamsReportDetailVO paramsReportDetailVO,
HttpServletResponse response,
HttpServletRequest request) {
paramsReportDetailEOService.exportNormal(paramsReportDetailVO, response, request);
@@ -140,4 +139,13 @@ public class ParamsReportDetailEOController extends JeroController<ParamsReportD
return Result.OK(templateLabelList);
}
@ApiOperation(value = "上报库参数项-自定义导出")
@GetMapping(value = "/exportCustom")
// @RequiresPermissions("report:detail:export:custom")
public void exportCustom(ParamsReportDetailVO paramsReportDetailVO,
HttpServletResponse response,
HttpServletRequest request) {
paramsReportDetailEOService.exportCustom(paramsReportDetailVO, response, request);
}
}
@@ -1,7 +1,6 @@
package com.jero.modules.cert.report.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -70,11 +69,9 @@ public class ParamsReportEO implements Serializable {
@ApiModelProperty(value = "对应参数模板发布版本")
private Integer paramsTemplatePublishVersion;
@TableField(exist = false)
@ApiModelProperty(value = "项目名称")
private String projectName;
@TableField(exist = false)
@ApiModelProperty(value = "清单标题")
private String title;
@@ -13,6 +13,8 @@
<result column="project_name" property="projectName" />
<result column="old_params_manifest_id" property="oldParamsManifestId" />
<result column="params_template_publish_version" property="paramsTemplatePublishVersion" />
<result column="project_name" property="projectName" />
<result column="title" property="title" />
</resultMap>
<sql id="BaseColumnList">
@@ -24,8 +26,8 @@
pr.create_time as create_time,
pr.update_by as update_by,
pr.update_time as update_time,
pm.title as title,
pni.project_name as project_name
if (pm.title is not null, pm.title, pr.title) as title,
if (pni.project_name is not null, concat(pni.project_name,'-', pyni.year_name), pr.project_name) as project_name
</sql>
<sql id="BaseQuerySql">
@@ -48,6 +50,7 @@
left join params_manifest as pm on pm.id = pr.old_params_manifest_id
left join project_library_base as plb on plb.id = pm.project_id
left join project_name_info as pni on plb.project_name_id = pni.id
left join project_year_name_info as pyni on plb.year_name_id=pyni.id
) tmp_tb
<include refid="BaseQuerySql"/>
order by create_time desc
@@ -36,6 +36,12 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
*/
List<Map<String, Object>> getHeader(String paramsManifestId, String flag, String cut);
/**
* 常规导出
* @param paramsReportDetailVO
* @param response
* @param request
*/
void exportNormal(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request);
// 配置-下拉选项
@@ -43,4 +49,7 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
// 导出模板下拉选项
List<Map<String, String>> getTemplateLabelList();
void exportCustom(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request);
}
@@ -67,4 +67,5 @@ public interface IParamsReportEOService extends IService<ParamsReportEO> {
ParamsReportEO queryByOldParamsManifestId(String oldParamsManifestId, Integer version);
boolean setProjectNameAndTitle(List<String> oldParamsManifestIdList);
}
@@ -14,7 +14,8 @@ import com.jero.common.exception.JeroBootException;
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.*;
import com.jero.modules.cert.collect.entity.ParamsConfigDataEO;
import com.jero.modules.cert.collect.entity.ParamsConfigEO;
import com.jero.modules.cert.collect.enums.CollectManifestStateEnum;
import com.jero.modules.cert.collect.enums.ConfigDataTypeEnum;
import com.jero.modules.cert.collect.vo.ParamsConfigDataVO;
@@ -22,34 +23,23 @@ import com.jero.modules.cert.report.entity.*;
import com.jero.modules.cert.report.enums.ExportTypeEnum;
import com.jero.modules.cert.report.mapper.ParamsReportDetailEOMapper;
import com.jero.modules.cert.report.service.*;
import com.jero.modules.cert.report.util.Docx4jUtil;
import com.jero.modules.cert.report.vo.ParamsReportDetailVO;
import com.jero.modules.cert.template.enums.ControlTypeEnum;
import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.ocr.util.LineHumpUtil;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.split.common.ConvertHtml2Excel;
import com.jero.modules.split.common.ReadExcel;
import com.jero.modules.split.dto.FileSpiltValTableExportDto;
import com.jero.modules.split.dto.FileSplitValExportDto;
import com.jero.modules.split.dto.FileSplitValImgExportDto;
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
import com.jero.modules.split.page.SarFileSplitItemsEOPage;
import com.jero.modules.split.page.SarFileSplitItemsValEOPage;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.ISysDictItemService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.apache.poi.common.usermodel.HyperlinkType;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.*;
import org.aspectj.util.FileUtil;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
@@ -97,6 +87,10 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
@Autowired
private IParamsReportExportHistoryEOService paramsReportExportHistoryEOService;
@Autowired
private IParamsExportTemplateEOService paramsExportTemplateEOService;
@Value(value = "${jero.path.upload}")
private String uploadpath;
@@ -527,7 +521,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
List<String> fieldList = Arrays.asList(field.split(",")); // list形式
// 查询导出数据
List<Map<String, Object>> allParamsInfoList = queryForExport(paramsReportDetailVO); // id记得去掉
List<Map<String, Object>> allParamsInfoList = queryForExportNormal(paramsReportDetailVO); // id记得去掉
// 开始处理工作表
List<OSSFile> allRelevFileList = new ArrayList<>();
@@ -641,9 +635,6 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return configLabelList;
}
@Autowired
private IParamsExportTemplateEOService paramsExportTemplateEOService;
@Override
public List<Map<String, String>> getTemplateLabelList() {
// 查询所有导出模板
@@ -664,6 +655,113 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return templateLabelList;
}
@Override
public void exportCustom(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
OutputStream wordOS = null;
String fileOriName = "上报库参数项自定义导出信息";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
fileOriName = "Params report custom data";
}
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
fileOriName = paramsReportDetailVO.getExportName();
}
//创建临时文件夹
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + fileOriName;
File nowFile = new File(fileNowPath);
if (nowFile.exists()){
nowFile.delete();
}
nowFile.mkdirs();
String fileName = fileOriName + ".docx";
// 查询导出数据
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
Map<String, String> params = allParamsInfoList.get(0);
String templateUrl = "";
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFiles)) {
templateUrl = ossFiles.get(0).getUrl();
}
// 替换模板中的占位符
try {
//下载关联文件内容
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(1).get("fileListAll");
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
downLoadFileList(allRelevFileList,fileNowPath + File.separator + "导出文件");
}
// 拿取模板
String repFileName = fileName.replaceAll("/","_");
wordOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
if (CosBootUtil.doesObjectExist(templateUrl)) {
InputStream wordTemplate = CosBootUtil.download(templateUrl);
com.qcloud.cos.utils.IOUtils.copy(wordTemplate, wordOS);
}
// 替换占位符内容
byte[] wordContent = Docx4jUtil.of(fileNowPath + File.separator + repFileName)
.addParams(params)
.get();
ByteArrayInputStream wordis = new ByteArrayInputStream(wordContent);
OutputStream wordFileOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
int len1 = 0;
while ((len1 = wordis.read()) != -1) {
wordFileOS.write(len1);
}
wordOS.flush();
wordOS.close();
wordFileOS.flush();
wordFileOS.close();
// 打包导出压缩包
response.setHeader("Content-Disposition",
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
response.setContentType("application/force-download");
response.flushBuffer();
os = response.getOutputStream();
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
FileInputStream fis = new FileInputStream(fileNowPath+".zip");
int len2 = 0;
while ((len2 = fis.read()) != -1) {
os.write(len2);
}
// 添加导出历史
/*String uploadFileName = fileOriName + ".zip";
MultipartFile mFile = new MockMultipartFile(uploadFileName, uploadFileName, ContentType.APPLICATION_OCTET_STREAM.toString(), fis); // 用于上传
OSSFile ossFile = ossFileService.uploadLocalOfCos(mFile, "/report", "", CutEnum.CN.getValue()); // 上传导出的压缩包
ParamsReportExportHistoryEO paramsReportExportHistoryEO = new ParamsReportExportHistoryEO();
paramsReportExportHistoryEO.setExportType(ExportTypeEnum.NORMAL.getValue());
paramsReportExportHistoryEO.setExportFileId(ossFile.getId());
paramsReportExportHistoryEO.setParamsManifestId(paramsReportDetailVO.getParamsManifestId());
paramsReportExportHistoryEO.setExportTime(new Date());
paramsReportExportHistoryEOService.add(paramsReportExportHistoryEO);*/
os.flush();
os.close(); // 后开先关
fis.close(); // 先开后关
} catch (Docx4JException e) {
log.error(e.getMessage(), e);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new JeroBootException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(wordOS);
File tempZipFile = new File(uploadpath + "/tempZip");
FileUtil.deleteContents(tempZipFile);
}
}
private void downLoadFileList(List<OSSFile> allRelevFileList,String fileNowPath) {
File nowFile = new File(fileNowPath);
if (nowFile.exists()){
@@ -710,7 +808,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
bis.close(); // 先开后关
}
private List<Map<String, Object>> queryForExport(ParamsReportDetailVO paramsReportDetailVO) {
private List<Map<String, Object>> queryForExportNormal(ParamsReportDetailVO paramsReportDetailVO) {
List<String> idList = new ArrayList<>();
if (StringUtils.isNotEmpty(paramsReportDetailVO.getIds())) {
idList = Arrays.asList(paramsReportDetailVO.getIds().split(","));
@@ -803,6 +901,80 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return dataList;
}
private List<Map> queryForExportCustom(ParamsReportDetailVO paramsReportDetailVO) {
List<String> idList = new ArrayList<>();
if (StringUtils.isNotEmpty(paramsReportDetailVO.getIds())) {
idList = Arrays.asList(paramsReportDetailVO.getIds().split(","));
}
List<String> configIdList = Arrays.asList(paramsReportDetailVO.getConfigIds().split(","));
List<Map<String, Object>> dataList = paramsReportDetailEOMapper.listInfoForExport(idList, paramsReportDetailVO);
List<ParamsReportConfigEO> paramsConfigEOList = paramsReportConfigEOService.queryList(paramsReportDetailVO.getParamsManifestId()); // 查询所有配置列
List<Map> resultList = new ArrayList<>();
Map<String, Object> resultMap = new HashMap<>();
List<OSSFile> fileListAll = new ArrayList<>();
// 查询配置列数据
for (Map<String, Object> record1 : dataList) {
String paramsCollectManifestId = (String) record1.get("id");
String nioNumber = (String) record1.get("nio_number");
if (CollectionUtil.isNotEmpty(paramsConfigEOList)) {
List<OSSFile> fileList = new ArrayList<>();
// 合并配置数据
String configData = "";
List<ParamsReportConfigDataEO> paramsReportConfigDataEOS = paramsReportConfigDataEOService.queryByConfigIdListAndCollectManifestId(configIdList, paramsCollectManifestId);
String textDatas = paramsReportConfigDataEOS.stream().filter(e->StringUtils.isNotEmpty(e.getTextData()))
.map(ParamsReportConfigDataEO::getTextData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator()));
String pullDatas = paramsReportConfigDataEOS.stream().filter(e->StringUtils.isNotEmpty(e.getPullData()))
.map(ParamsReportConfigDataEO::getPullData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator()));
List<String> fileNameList = new ArrayList<>();
paramsReportConfigDataEOS.forEach(paramsReportConfigDataEO -> {
if (StringUtils.isNotEmpty(paramsReportConfigDataEO.getFileConnectId())) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsReportConfigDataEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFileList)) {
fileNameList.add(ossFileList.get(0).getFileName());
fileList.addAll(ossFileList);
}
}
});
StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据
if (StringUtils.isNotEmpty(textDatas)) {
configDataBuilder.append(textDatas).append("&");
}
if (StringUtils.isNotEmpty(pullDatas)) {
configDataBuilder.append(pullDatas).append("&");
}
if (CollectionUtil.isNotEmpty(fileNameList)) {
configDataBuilder.append(StringUtils.join(fileNameList, ",")).append("&");
}
configData = configDataBuilder.toString();
if (configData.contains("&")) {
configData = configData.substring(0, configData.lastIndexOf("&"));
}
resultMap.put(nioNumber, configData);
fileListAll.addAll(fileList);
}
}
Map<String, Object> fileMap = new HashMap<>();
fileMap.put("fileListAll", fileListAll);
resultList.add(resultMap);
resultList.add(fileMap);
return resultList;
}
/**
* 获取导出文件的表头
*
@@ -3,13 +3,15 @@ package com.jero.modules.cert.report.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper;
import com.jero.modules.cert.collect.vo.ParamsManifestVO;
import com.jero.modules.cert.report.entity.ParamsReportEO;
import com.jero.modules.cert.report.mapper.ParamsReportEOMapper;
import com.jero.modules.cert.report.service.IParamsReportEOService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -25,6 +27,9 @@ public class ParamsReportEOServiceImpl extends ServiceImpl<ParamsReportEOMapper,
@Autowired
private ParamsReportEOMapper paramsReportEOMapper;
@Autowired
private ParamsManifestEOMapper paramsManifestEOMapper;
/**
* 保存
*
@@ -121,4 +126,26 @@ public class ParamsReportEOServiceImpl extends ServiceImpl<ParamsReportEOMapper,
.eq(ParamsReportEO::getVersion, version);
return getOne(queryWrapper);
}
@Override
public boolean setProjectNameAndTitle(List<String> oldParamsManifestIdList) {
List<ParamsReportEO> updateEOList = new ArrayList<>();
List<ParamsManifestVO> paramsManifestEOList = paramsManifestEOMapper.listInfoAll(oldParamsManifestIdList);
paramsManifestEOList.forEach(paramsManifestVO -> {
LambdaQueryWrapper<ParamsReportEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParamsReportEO::getOldParamsManifestId, paramsManifestVO.getId())
.eq(ParamsReportEO::getVersion, paramsManifestVO.getVersion());
ParamsReportEO paramsReportEO = getOne(queryWrapper);
ParamsReportEO updateEO = new ParamsReportEO();
updateEO.setId(paramsReportEO.getId());
updateEO.setTitle(paramsManifestVO.getTitle());
updateEO.setProjectName(paramsManifestVO.getProjectName());
updateEOList.add(updateEO);
});
return updateBatchById(updateEOList);
}
}
@@ -0,0 +1,481 @@
package com.jero.modules.cert.report.util;
import org.docx4j.XmlUtils;
import org.docx4j.dml.wordprocessingDrawing.Inline;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage;
import org.docx4j.wml.*;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Docx4jUtil {
public static Builder Builder;
public static Builder of(String path) throws FileNotFoundException, Docx4JException {
return new Builder(path);
}
public static class Builder {
private WordprocessingMLPackage template = null;
private Iterator<Text> texts = null;
// 占位符参数map
private Map<String, String> params = new HashMap<>();
private Builder(String path) throws FileNotFoundException, Docx4JException {
if (path != null && !path.isEmpty()) {
this.template = WordprocessingMLPackage.load(new FileInputStream(new File(path)));
this.texts = getAllPlaceholderElementFromObject(template.getMainDocumentPart()).iterator();
}
}
/**
* 增加文本占位符参数(一个)
*
* @param key 键
* @param value 值
* @return Builder对象
*/
public Builder addParam(String key, String value) {
Builder builder = this;
if (key != null && !key.isEmpty()) {
/*while (texts.hasNext()) {
Text text = texts.next();
String temp = text.getValue();
if (temp.equals("${" + key + "}")) {
text.setValue(value);
texts.remove();
return builder;
}
}*/
params.put(key, value);
}
return builder;
}
/**
* 增加参数(多个)
*
* @param params 多个参数的map
* @return Builder对象
*/
public Builder addParams(Map<String, String> params) {
this.params = params;
return this;
}
/**
* 增加一个表格
*
* @param tablePlaceholder 寻找表格的占位符
* @param placeholderRows 模板行所占行数
* @param list 替换模板占位符的数据
* @return Builder对象
* @throws JAXBException JAXBException
* @throws Docx4JException Docx4JException
*/
public Builder addTable(String tablePlaceholder, int placeholderRows, List<Map<String, String>> list)
throws Docx4JException, JAXBException {
List<Object> tables = getAllElementFromObject(template.getMainDocumentPart(), Tbl.class);
Tbl tempTable = getTemplateTable(tables, tablePlaceholder); //
if (tempTable != null && list != null && !list.isEmpty()) {
List<Object> trs = getAllElementFromObject(tempTable, Tr.class);
int rows = trs.size();
if (rows > placeholderRows) {
List<Tr> tempTrs = new ArrayList<>();
for (int i = rows - placeholderRows; i < rows; i++) {
tempTrs.add((Tr) trs.get(i));
}
for (Map<String, String> trData : list) {
for (Tr tempTr : tempTrs) {
addRowToTable(tempTable, tempTr, trData);
}
}
for (Tr tempTr : tempTrs) {
tempTable.getContent().remove(tempTr);
}
}
}
return this;
}
private void loadImg(Tbl tempTable, byte[] decodeBuffer, int maxWidth) {
Inline inline = createInlineImage(template, decodeBuffer, maxWidth);
P paragraph = addInlineImageToParagraph(inline);
List<Object> rows = getAllElementFromObject(tempTable, Tr.class);
Tr tr = (Tr) rows.get(0);
List<Object> cells = getAllElementFromObject(tr, Tc.class);
Tc tc = (Tc) cells.get(0);
tc.getContent().clear();
tc.getContent().add(paragraph);
}
/**
* 通过占位符确定加载图片的位置,图片的位置为表格
*
* @param placeholder 占位符
* @param decodeBuffer 图片的字节流
* @return 当前对象
* @throws Docx4JException Docx4JException
* @throws JAXBException JAXBException
*/
public Builder addImg(String placeholder, byte[] decodeBuffer) throws Docx4JException, JAXBException {
addImg(placeholder, decodeBuffer, 0);
return this;
}
/**
* 通过占位符确定加载图片的位置,图片的位置为表格
*
* @param placeholder 占位符
* @param decodeBuffer 图片的字节流
* @param maxWidth 图片的最多宽度,不传默认写入图片原始宽度
* @return 当前对象
* @throws Docx4JException Docx4JException
* @throws JAXBException JAXBException
*/
public Builder addImg(String placeholder, byte[] decodeBuffer, int maxWidth) throws Docx4JException, JAXBException {
List<Object> tables = getAllElementFromObject(template.getMainDocumentPart(), Tbl.class);
Tbl tempTable = getTemplateTable(tables, placeholder);
loadImg(tempTable, decodeBuffer, maxWidth);
return this;
}
/**
* 通过int的位置数组确定加载图片的位置,图片的位置为表格(以主界面为基准)
*
* @param wz int型数组,长度必须为3 ,第一个值为第几个表格,第二个值为第几行,第三个参数为第几个单元格
* @param decodeBuffer 图片的字节流
* @param maxWidth 图片的最多宽度,不传默认写入图片原始宽度
* @return 当前对象
*/
public Builder addImg(int[] wz, byte[] decodeBuffer, int maxWidth) {
Tc tc = getTcByWz(wz);
Tbl tempTable = (Tbl) getAllElementFromObject(tc, Tbl.class).get(0);
loadImg(tempTable, decodeBuffer, maxWidth);
return this;
}
/**
* 通过int的位置数组确定加载图片的位置,图片的位置为表格(以主界面为基准)
*
* @param wz int型数组,长度必须为3 ,第一个值为第几个表格,第二个值为第几行,第三个参数为第几个单元格
* @param decodeBuffer 图片的字节流
* @return 当前对象
*/
public Builder addImg(int[] wz, byte[] decodeBuffer) {
addImg(wz, decodeBuffer, 0);
return this;
}
/**
* 添加段落
*
* @param list 数据集合
* @param wz 模板段落所在的位置,长度为三(第几个表格,第几行,第几个单元格)
* @return Builder对象
*/
public Builder addParagrash(List<Map<String, String>> list, int[] wz) {
Tc tc = getTcByWz(wz);
List<Object> paraList = getAllElementFromObject(tc, P.class);
tc.getContent().clear();
for (Map<String, String> item : list) {
paraList.forEach((tempPara) -> {
P workingPara = (P) XmlUtils.deepCopy(tempPara);
repaleTexts(workingPara, item);
tc.getContent().add(workingPara);
});
}
return this;
}
/**
* 移除含有占位符的Tr
* @param placeholder 占位符
* @return Builder对象
*/
public Builder removeTrByPlaceholder(String placeholder) {
//这种方式获取是正常的,但是get()方法操作的时候不能正常替换文本了。
//List<Object> trs = template.getMainDocumentPart().getJAXBNodesViaXPath("//w:tr", true);
List<Object> trs = getAllElementFromObject(template.getMainDocumentPart(), Tr.class);
Tr tr = (Tr) getTemplateObj(trs,placeholder,false);
if(tr != null){
Tbl tbl = (Tbl) tr.getParent();
tbl.getContent().remove(tr);
}
return this;
}
/**
* 移除含有占位符的Tr
* @param placeholders 占位符的集合
* @return Builder对象
*/
public Builder removeTrByPlaceholder(List<String> placeholders) {
/* List<Object> trs = template.getMainDocumentPart().getJAXBNodesViaXPath("//w:tr", true);*/
List<Object> trs = getAllElementFromObject(template.getMainDocumentPart(), Tr.class);
List<Object> list = getTemplateObjs(trs,placeholders);
for (Object o:list) {
Tr tr = (Tr) o;
if(tr != null){
Tbl tbl = (Tbl) tr.getParent();
tbl.getContent().remove(tr);
}
}
return this;
}
/**
* 获取文件字节流
*
* @return 文件字节流
* @throws Docx4JException docx异常
*/
public byte[] get() throws Docx4JException {
if (!params.isEmpty()) {
while (texts.hasNext()) {
Text text = texts.next();
String temp = text.getValue();
for (Map.Entry<String, String> param : params.entrySet()) {
if (temp.equals("${" + param.getKey() + "}")) {
text.setValue(param.getValue());
}
}
}
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
template.save(outputStream);
return outputStream.toByteArray();
}
/**
* 获取指定单元格
*
* @param temp 模板段落所在的位置,长度为三(第几个表格,第几行,第几个单元格)
* @return tc
*/
private Tc getTcByWz(int[] temp) {
List<Object> tables = getAllElementFromObject(template.getMainDocumentPart(), Tbl.class);
Tbl wzTable = (Tbl) tables.get(temp[0]);
Tr tr = (Tr) getAllElementFromObject(wzTable, Tr.class).get(temp[1]);
return (Tc) getAllElementFromObject(tr, Tc.class).get(temp[2]);
}
}
/**
* 创建包含图片的一个内联对象
*
* @param wordMLPackage WordprocessingMLPackage
* @param bytes 图片字节流
* @param maxWidth 最大宽度
* @return 图片的内联对象
*/
private static Inline createInlineImage(WordprocessingMLPackage wordMLPackage, byte[] bytes, int maxWidth) {
Inline inline = null;
try {
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
int docPrId = 1;
int cNvPrId = 2;
if (maxWidth > 0) {
inline = imagePart.createImageInline("Filename hint", "Alternative text", docPrId, cNvPrId, false, maxWidth);
} else {
inline = imagePart.createImageInline("Filename hint", "Alternative text", docPrId, cNvPrId, false);
}
} catch (Exception e) {
e.printStackTrace();
}
return inline;
}
/**
* 创建一个对象工厂并用它创建一个段落和一个可运行块R. 然后将可运行块添加到段落中. 接下来创建一个图画并将其添加到可运行块R中. 最后我们将内联
* 对象添加到图画中并返回段落对象.
*
* @param inline 包含图片的内联对象.
* @return 包含图片的段落
*/
private static P addInlineImageToParagraph(Inline inline) {
// 添加内联对象到一个段落中
ObjectFactory factory = new ObjectFactory();
P paragraph = factory.createP();
R run = factory.createR();
paragraph.getContent().add(run);
Drawing drawing = factory.createDrawing();
run.getContent().add(drawing);
drawing.getAnchorOrInline().add(inline);
return paragraph;
}
// 发现docx文档包含占位符的文本节点
private static List<Text> getAllPlaceholderElementFromObject(Object obj) {
List<Text> result = new ArrayList<>();
Class<Text> toSearch = Text.class;
Text textPlaceholder;
if (obj instanceof JAXBElement) {
obj = ((JAXBElement<?>) obj).getValue();
}
if (obj.getClass().equals(toSearch)) {
textPlaceholder = (Text) obj;
if (isPlaceholder(textPlaceholder.getValue())) {
result.add((Text) obj);
}
} else if (obj instanceof ContentAccessor) {
List<?> children = ((ContentAccessor) obj).getContent();
for (Object child : children) {
result.addAll(getAllPlaceholderElementFromObject(child));
}
}
return result;
}
// 发现docx文档中的节点
private static List<Object> getAllElementFromObject(Object obj, Class<?> toSearch) {
List<Object> result = new ArrayList<>();
if (obj instanceof JAXBElement) {
obj = ((JAXBElement<?>) obj).getValue();
}
if (obj.getClass().equals(toSearch)) {
result.add(obj);
} else if (obj instanceof ContentAccessor) {
List<?> children = ((ContentAccessor) obj).getContent();
for (Object child : children) {
result.addAll(getAllElementFromObject(child, toSearch));
}
}
return result;
}
// 这个方法只是查看表格是否含有我们的占位符,如果有则返回表格
private static Tbl getTemplateTable(List<Object> tables, String templateKey) {
return (Tbl) getTemplateObj(tables,templateKey,false);
}
/**
* 这个方法只是查看dom是否含有我们的占位符,如果有则返回dom
*
* @param objects 需要查找的dom元素
* @param placeholder 占位符
* @param f 是否全部查找,为ture时全部查找,返回的是list,为false时一找到元素就返回,只是单个元素
* @return 找到的元素
*/
private static Object getTemplateObj(List<Object> objects, String placeholder, boolean f) {
List<Object> objectList = new ArrayList<>();
for (Object o : objects) {
List<?> textElements = getAllElementFromObject(o, Text.class);
for (Object text : textElements) {
Text textElement = (Text) text;
if (textElement.getValue() != null && textElement.getValue().equals("${" + placeholder + "}")) {
if (!f) {
return o;
} else {
objectList.add(o);
}
}
}
}
return objectList.isEmpty()?null:objectList;
}
/**
* 这个方法只是查看dom是否含有我们的占位符,如果有则返回dom
* @param objects 需要查找的dom元素的集合
* @param placeholders 占位符集合
* @return 找到的元素的集合
*/
private static List<Object> getTemplateObjs(List<Object> objects, List<String> placeholders) {
List<Object> objectList = new ArrayList<>();
for (Object o : objects) {
List<?> textElements = getAllElementFromObject(o, Text.class);
for (Object text : textElements) {
Text textElement = (Text) text;
if (textElement.getValue() != null && placeholders.contains(getPlaceholderStr(textElement.getValue()))) {
objectList.add(o);
}
}
}
return objectList;
}
/**
* 复制模板行
*
* @param reviewtable 表格
* @param templateRow 模板行
* @param replacements 填充模板行的数据
*/
private static void addRowToTable(Tbl reviewtable, Tr templateRow, Map<String, String> replacements) {
Tr workingRow = XmlUtils.deepCopy(templateRow);
repaleTexts(workingRow, replacements);
reviewtable.getContent().add(workingRow);
}
/**
* 把工作对象中的全部占位符都替换掉
*
* @param working 工作对象
* @param replacements map数据对象
*/
private static void repaleTexts(Object working, Map<String, String> replacements) {
List<?> textElements = getAllElementFromObject(working, Text.class);
for (Object object : textElements) {
Text text = (Text) object;
String keyStr = getPlaceholderStr(text.getValue());
if (keyStr != null && !keyStr.isEmpty()) {
String replacementValue = replacements.get(keyStr);
if (replacementValue != null) {
text.setValue(replacementValue);
} else {
text.setValue("--");
}
}
}
}
/**
* 判断字符串是否有${}占位符
*
* @param str 需要判断的字符串
* @return 是否字符串是否有${}占位符
*/
private static boolean isPlaceholder(String str) {
if (str != null && !str.isEmpty()) {
Pattern pattern = Pattern.compile("([$]\\{\\w+\\})");
Matcher m = pattern.matcher(str);
return m.find();
}
return false;
}
/**
* 得到占位符${}中的文本
*
* @param str 需要判断的字符串
* @return 占位符${}中的文本
*/
private static String getPlaceholderStr(String str) {
if (str != null && !str.isEmpty()) {
Pattern p = Pattern.compile("\\$\\{(.*?)\\}");
Matcher m = p.matcher(str);
if (m.find()) {
return m.group(1);//m.group(0)包括这两个字符
}
}
return null;
}
}
@@ -1,13 +1,7 @@
package com.jero.modules.cert.report.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class ParamsReportDetailVO {
@@ -43,12 +37,19 @@ public class ParamsReportDetailVO {
@ApiModelProperty(value = "对应参数模板发布版本")
private Integer paramsTemplatePublishVersion;
// 导出通用
private String cut;
private String exportName;
private String ids; // 勾选导出
private String configIds; // 导出的配置列
// 常规导出专用
private String combineFlag; // 合并标识 1-不合并,2-合并
private String separator; // 分隔符
private String cut;
private String exportName;
// 自定义导出专用
private String exportTemplateId; //导出模板id
}
@@ -5,7 +5,7 @@
:disabled="true"
:title="value"
:placeholder="$t('PleaseSelect')+query.db_field_txt"/>
<a-button type="primary" class="button-box" @click="standardClick">
<a-button type="primary" class="button-box" :disabled="disabled" @click="standardClick">
{{this.$t('PersonnelSelection')}}
</a-button>
<a-button type="primary" v-if='isDelete' class="button-box" @click="standardDelete">
@@ -58,7 +58,7 @@
export default {
name: 'index',
props: ['query', 'value', 'personneQuery', 'isSingleChoice', 'isInput', 'isClass', 'isDelete'],
props: ['query', 'value', 'personneQuery', 'isSingleChoice', 'isInput', 'isClass', 'isDelete', 'disabled'],
data() {
return {
loading: true,
@@ -24,33 +24,69 @@
:data-source="dataSource"
:columns="columns"
>
<span slot="accessoryFile" slot-scope="text,record">
<a @click="seeFileClick(text)" v-if="text">
{{$t('viewFile')}}
</a>
<span v-else>--</span>
</span>
</a-table>
<div class="page" v-if="dataSource && dataSource.length > 0">
<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>
<div>
<span>对外意见归档:</span>
<span class="text">对外意见归档:</span>
<div @click="clickButtonToUpload('opinionArchiveId')"
v-if="formInline.createBy == this.userInfoQuery.username" class="operator-text">
<a-icon type="cloud-upload" />
{{$t('clickUpload')}}
</div>
<div @click="seeFileClick(formInline.opinionArchiveId)" class="operator-text">
<a-icon type="eye" />
{{$t('viewFile')}}
</div>
</div>
<div class="drawer-bootom-button">
<a-button @click="handleCancel">{{$t('cancel')}}</a-button>
</div>
</a-drawer>
<uploadFile ref="uploadFile" :isMultiple="true" @uploadSuccess="uploadSuccess"></uploadFile>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
<viewFileModel ref="viewFileModelRef"/>
</div>
</template>
<script>
import uploadFile from '@/components/uploadFile/file'
import { getAction, postAction, downloadFile } from '@/api/manage'
import viewFileModel from '@/components/viewFileModel/index'
import { getAction, putAction, downloadFile } from '@/api/manage'
import { mapGetters } from 'vuex'
export default {
name: 'evaluationResultsList',
components: {
uploadFile
uploadFile,
viewFileModel
},
data() {
return {
confirmLoading: false,
visible: false,
loading: false,
total: 0,
pageSize: 10,
pageNo: 1,
dataSource: [],
formInline: {},
userInfoQuery:{},
columns: [
{
title: this.$t('relevantSections'),
@@ -77,7 +113,8 @@
align: 'center',
width: 180,
ellipsis: true,
dataIndex: 'accessoryFile'
dataIndex: 'accessoryFile',
scopedSlots: { customRender: 'accessoryFile' }
},
{
title: this.$t('Assessor'),
@@ -97,9 +134,10 @@
}
},
mounted() {
this.userInfoQuery = this.userInfo()
},
methods: {
...mapGetters(['userInfo']),
clickButtonToUpload(item) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
@@ -123,19 +161,67 @@
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
this.edit()
},
edit() {
let query = {
id: this.lawsOpinionGatherId,
opinionArchiveId: this.formInline.opinionArchiveId
}
putAction('/lawsOpinionGather/lawsOpinionGatherEO/edit', query).then((res) => {
if (res.success) {
}
})
},
//导出
handleExport() {
let query = {
dummyInventoryBaseId: this.$route.query.id
lawsOpinionGatherId: this.lawsOpinionGatherId,
actiProcInstId: this.actiProcInstId
}
downloadFile(this.url.exportData, this.$route.query.name + this.$t('VirtualList') + '.zip', query, this.Deselect)
downloadFile('/lawsOpinionGather/lawsOpinionAssessmentResultEO/exportXls',
this.$t('evaluationResults') + '.xls', query)
},
getData(row) {
this.visible = true
this.formInline = JSON.parse(JSON.stringify(row))
this.actiProcInstId = row.actiProcInstId
this.lawsOpinionGatherId = row.id
console.log(row)
this.getList()
},
handleCancel() {
this.visible = false
},
pageOnChange(page) {
this.pageNo = page
this.getList()
},
SizeChange(pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
getList() {
let query = {
lawsOpinionGatherId: this.lawsOpinionGatherId,
actiProcInstId: this.actiProcInstId
}
this.loading = true
getAction('/lawsOpinionGather/lawsOpinionAssessmentResultEO/page', query).then((res) => {
if (res.success) {
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.loading = false
this.dataSource = []
}
})
},
seeFileClick(item) {
this.$refs.viewFileModelRef.clickButtonToUpload(item)
}
}
}
@@ -160,4 +246,16 @@
text-align: right;
margin-bottom: 16px;
}
.page {
text-align: right;
margin-top: 20px;
}
.text {
font-size: 14px;
font-weight: 400;
color: #040B29;
margin-right: 4px;
}
</style>
@@ -22,12 +22,21 @@
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="box-title-text tree-select">
<div class="title-text" :title="$t('technicalField')">
<span>{{$t('technicalField')}}</span>
</div>
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('technicalField')"
v-model="queryParam.technologyTerritory"></j-input>
<a-tree-select
tree-node-filter-prop="title"
v-model="queryParam.technologyTerritory"
:maxTagCount="1"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
:tree-data="CategoryTreeList"
tree-checkable
:placeholder="$t('PleaseSelect')+$t('technicalField')"
/>
</div>
</a-col>
<template v-if="toggleSearchStatus">
@@ -36,8 +45,19 @@
<div class="title-text" :title="$t('collectResults')">
<span>{{$t('collectResults')}}</span>
</div>
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('collectResults')"
v-model="queryParam.gatherResult"></j-input>
<a-select :placeholder="$t('PleaseSelect')+$t('collectResults')"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
v-model="queryParam.gatherResult">
<a-select-option v-for="(item, key) in gatherResultList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.name">
{{ item.name }}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
</template>
@@ -108,17 +128,28 @@
return {
//url传参严格按照当前命名
url: {
deleteBatch: '',
list: '/lawsOpinionGather/lawsOpinionGatherEO/page'
list: '/lawsOpinionGather/lawsOpinionGatherEO/page',
getSysCategoryTree: '/sys/category/getSysCategoryTree',
},
loading: false,
toggleSearchStatus: false,
dataSource: [{}],
dataSource: [],
selectedRowKeys: [],
total: 0,
pageSize: 10,
pageNo: 1,
CategoryTreeList:[],
queryParam: {},
gatherResultList:[
{
value:'Underway',
name:this.$t('inProgress'),
},
{
value:'Completed',
name:this.$t('Finished'),
}
],
columns: [
{
title: this.$t('standard'),
@@ -137,7 +168,7 @@
align: 'center',
width: 170,
ellipsis: true,
dataIndex: 'technologyTerritoryShow'
dataIndex: 'technologyTerritory'
},
{
title: this.$t('collectResults'),
@@ -172,8 +203,18 @@
},
mounted() {
this.getList()
this.getSysCategoryTree()
},
methods: {
getSysCategoryTree() {
getAction(this.url.getSysCategoryTree, {}).then((res) => {
if (res.success) {
this.CategoryTreeList = res.result
} else {
this.CategoryTreeList = []
}
})
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
@@ -196,10 +237,16 @@
this.getList()
},
getList() {
let queryParam = JSON.parse(JSON.stringify(this.queryParam))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam
...queryParam
}
this.loading = true
getAction(this.url.list, query).then((res) => {
@@ -241,6 +288,11 @@
}
}
</script>
<style>
.tree-select .ant-select-tree-dropdown{
height: 298px!important;
}
</style>
<style scoped>
@import '~@assets/less/common.less';
@@ -9,7 +9,8 @@
<span>{{$t('monthSelection')}}</span>
</div>
<a-month-picker class="box-input"
v-model="queryParam.monthSelection"
@change="dateChange({db_field_name:'month'})"
v-model="queryParam.month"
:placeholder="$t('monthSelection')"/>
</div>
</a-col>
@@ -80,6 +81,7 @@
import { getAction, postAction, downloadFile } from '@/api/manage'
import fillTable from './modules/fillTable'
import fillAdd from './modules/fillAdd'
import moment from 'moment'
export default {
name: 'RegulationMonthlyFill',
@@ -153,15 +155,22 @@
}
},
mounted() {
this.queryParam.month = moment(new Date()).format('YYYY-MM')
this.getList()
},
methods: {
dateChange(item) {
this.queryParam[item.db_field_name] = this.queryParam[item.db_field_name] ? moment(this.queryParam[item.db_field_name]).format('YYYY-MM') : ''
this.queryParam = {...this.queryParam}
},
searchQuery() {
this.pageNo = 1
this.getList()
},
searchReset() {
this.queryParam = {}
this.queryParam.month = moment(new Date()).format('YYYY-MM')
this.queryParam = {...this.queryParam}
this.pageNo = 1
this.getList()
},
@@ -0,0 +1,322 @@
<template>
<a-drawer
title="添加"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<div style="margin-bottom: 60px">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParam.serial_number"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParam.title"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('status')">
<span>{{$t('status')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.state"
:placeholder="$t('PleaseSelect')+$t('status')"
:type="'select'"
:triggerChange="false" :dictCode="'state'"/>
</div>
</a-col>
<span style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="12" :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 style="width: 100%">
<a-table
:columns="columns"
rowKey="id"
:scroll="{x: 1200}"
:data-source="dataList"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,columnTitle:' '}"
:loading="loading">
</a-table>
</div>
<div class="page" v-if="dataList.length > 0">
<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="onChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" type="danger" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
export default {
name: 'addModel',
components: {
globalAdvancedQuery
},
props: {
},
data() {
return {
visible: false,
confirmLoading: false,
selectedRowKeys: [],
queryParam: {},
columns: [
{
title: this.$t('standard'),
dataIndex: 'serial_number',
align: 'center',
ellipsis: true
},
{
title: this.$t('title'),
dataIndex: 'title',
align: 'center',
ellipsis: true
},
{
title: this.$t('zoneOfApplication'),
dataIndex: 'region',
align: 'center',
ellipsis: true
},
// {
// title: this.$t('status'),
// dataIndex: 'state',
// align: 'center',
// ellipsis: true
// },
// {
// title: this.$t('technicalField'),
// dataIndex: 'technology_territory',
// align: 'center',
// ellipsis: true
// },
{
title: this.$t('ImplementationDate'),
dataIndex: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
align: 'center',
ellipsis: true
},
{
title: this.$t('vehicleInProductionDate'),
dataIndex: 'implement_time',
align: 'center',
ellipsis: true
}
// {
// title: this.$t('correspondingStandard'),
// dataIndex: 'corresponding_standard',
// align: 'center',
// ellipsis: true
// }
],
dataList: [],
content: [],
loading: false,
pageNo: 1,
pageSize: 10,
total: 0,
fieldList: [],
queryParamQuery: {},
selectedRowKeysRecord:[],
queryConditionVOList: []
}
},
mounted() {
},
methods: {
addModel() {
this.visible = true
this.queryParam = {}
this.selectedRowKeys = []
this.queryConditionVOList = []
this.replacePage()
this.queryConditionInventory()
},
searchQuery() {
this.pageNo = 1
this.replacePage()
},
searchReset() {
this.pageNo = 1
this.queryParam = {}
this.queryConditionVOList = []
this.$refs.globalAdvancedQueryRef.resetLine()
this.$refs.globalAdvancedQueryRef.emitCallback()
},
onChange(page, pageSize) {
this.pageNo = page
this.replacePage()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.replacePage()
},
replacePage() {
let queryConditionVOList = JSON.parse(JSON.stringify(this.queryConditionVOList))
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam,
queryConditionVOList: JSON.stringify(queryConditionVOList)
}
this.loading = true
postAction('/dummy/dummyInventoryInfoEO/queryPageDummy', query).then((res) => {
if (res.success) {
this.dataList = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.dataList = []
this.total = 0
this.loading = false
}
})
},
queryConditionInventory() {
let query = {
flag: 1
}
getAction('/dummy/dummyInventoryInfoEO/queryConditionInventory', query).then((res) => {
if (res.success) {
this.fieldList = res.result || []
} else {
this.fieldList = []
}
})
},
onSelectChange(value, record) {
this.selectedRowKeys = value
if (this.selectedRowKeys.length > 1) {
this.selectedRowKeys.shift()
record.shift()
}
this.selectedRowKeysRecord = record
},
handleCancel() {
this.visible = false
},
handleSubmit() {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.$emit('addModelForm',this.selectedRowKeysRecord[0])
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
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.replacePage()
}
}
}
</script>
<style scoped>
.page {
text-align: right;
margin-top: 20px;
}
.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;
}
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 33px;
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: 100%;
height: 38px;
}
.box-button {
height: 38px;
}
</style>
@@ -9,7 +9,7 @@
</div>
<a-form-model-item class="itemModel" prop="titleCn">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="formInline.titleCn"
:placeholder="$t('PleaseEnter')+$t('title')"/>
</a-form-model-item>
@@ -23,7 +23,7 @@
</div>
<a-form-model-item class="itemModel" prop="titleEn">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="formInline.titleEn"
:placeholder="$t('PleaseEnter')+$t('englishTitle')"/>
</a-form-model-item>
@@ -42,6 +42,7 @@
tree-node-filter-prop="title"
v-model="formInline.technologyTerritory"
:maxTagCount="1"
:disabled="disabled"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
@@ -62,6 +63,7 @@
<j-multi-select-tag class="box-input" v-model="formInline.applyCar"
:placeholder="$t('PleaseSelect')+$t('vehicleType')"
:type="'select'"
:disabled="disabled"
:triggerChange="false" :dictCode="'car_type'"/>
</a-form-model-item>
</div>
@@ -78,6 +80,7 @@
<j-multi-select-tag class="box-input" v-model="formInline.applyScope"
:placeholder="$t('PleaseSelect')+$t('scopeOfApplication')"
:type="'select'"
:disabled="disabled"
:triggerChange="false" :dictCode="'apply_scope'"/>
</a-form-model-item>
</div>
@@ -91,6 +94,7 @@
<a-form-model-item class="itemModel">
<j-dict-select-tag class="box-input" v-model="formInline.state"
@input="handleInput('status')"
:disabled="disabled"
:placeholder="$t('PleaseSelect')+$t('status')"
:type="'select'"
:triggerChange="false" :dictCode="'state'"/>
@@ -110,6 +114,7 @@
@input="handleInput('usage')"
:placeholder="$t('PleaseSelect')+$t('usage')"
:type="'select'"
:disabled="disabled"
:triggerChange="false" :dictCode="'yong4_fa3'"/>
</a-form-model-item>
</div>
@@ -183,6 +188,7 @@
</div>
<a-form-model-item class="itemModel" prop="contentCn">
<a-textarea
:disabled="disabled"
:placeholder="$t('PleaseEnter')+$t('primaryCoverageCn')"
v-model.trim="formInline.contentCn" :rows="4"/>
</a-form-model-item>
@@ -197,6 +203,7 @@
</div>
<a-form-model-item class="itemModel" prop="contentEn">
<a-textarea
:disabled="disabled"
:placeholder="$t('PleaseEnter')+$t('primaryCoverageEn')"
v-model.trim="formInline.contentEn" :rows="4"/>
</a-form-model-item>
@@ -211,6 +218,7 @@
</div>
<a-form-model-item class="itemModel" prop="workProgressCn">
<a-textarea
:disabled="disabled"
:placeholder="$t('PleaseEnter')+$t('workProgressCn')"
v-model.trim="formInline.workProgressCn" :rows="4"/>
</a-form-model-item>
@@ -225,6 +233,7 @@
</div>
<a-form-model-item class="itemModel" prop="workProgressEn">
<a-textarea
:disabled="disabled"
:placeholder="$t('PleaseEnter')+$t('workProgressEn')"
v-model.trim="formInline.workProgressEn" :rows="4"/>
</a-form-model-item>
@@ -239,10 +248,11 @@
</div>
<a-form-model-item class="itemModel">
<PersonnelSelection
:query="{db_field_name:'lawsContact',db_field_txt:$t('regulatoryContact')}"
:query="{db_field_name:'lawsContactName',db_field_txt:$t('regulatoryContact')}"
:personneQuery="formInline"
:disabled="disabled"
@change="PersonnelSelectionChange"
v-model="formInline.lawsContactName"/>
v-model="formInline.lawsContact"/>
</a-form-model-item>
</div>
</a-col>
@@ -255,7 +265,7 @@
</div>
<a-form-model-item class="itemModel" prop="link">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="formInline.link"
:placeholder="$t('PleaseEnter')+$t('link')"/>
</a-form-model-item>
@@ -272,7 +282,7 @@
export default {
name: 'defaultTemplate',
props: ['formInlineQuery'],
props: ['formInlineQuery', 'disabled'],
components: {
PersonnelSelection
},
@@ -358,8 +368,7 @@
]
},
formInline: {},
CategoryTreeList: [],
disabled: false
CategoryTreeList: []
}
},
mounted() {
@@ -367,20 +376,24 @@
this.$nextTick(() => {
if (this.formInlineQuery.id) {
this.formInline = JSON.parse(JSON.stringify(this.formInlineQuery))
if(this.formInline.technologyTerritory){
if (this.formInline.technologyTerritory) {
this.formInline.technologyTerritory = this.formInline.technologyTerritory.split(',')
}
this.formInline = { ...this.formInline }
} else {
this.formInline = {}
this.formInline.lawsContactName = this.userInfo().username
this.formInline.lawsContact = this.userInfo().id
this.formInline.lawsContact = this.userInfo().username
this.formInline.lawsContactName = this.userInfo().id
this.formInline = { ...this.formInline }
}
})
},
methods: {
...mapGetters(['userInfo']),
getStandData(value) {
this.formInline.titleCn = value.serial_number + ' ' + value.title
this.formInline.titleEn = value.serial_number + ' ' + value.title_en
},
getSysCategoryTree() {
getAction('/sys/category/getSysCategoryTree', {}).then((res) => {
if (res.success) {
@@ -15,12 +15,14 @@
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text"
:title="$t('fillInTheMonth')">{{$t('fillInTheMonth')}}</span>
</div>
<a-form-model-item class="itemModel" prop="month">
<a-form-model-item class="itemModel" :prop="!disabled?'month':''">
<a-month-picker class="box-input"
:disabled="disabled"
@change="dateChange({db_field_name:'month'})"
v-model="formInline.month"
:placeholder="$t('fillInTheMonth')"/>
</a-form-model-item>
@@ -28,7 +30,9 @@
</a-col>
<a-col :span="12" style="text-align: right" v-if="formInline.contentTemplate == 1">
<div style="text-align: right">
<a-button class="button-text" type="primary">{{$t('bringInStandardInformation')}}</a-button>
<a-button class="button-text" @click="bringInStandardInformationClick"
:disabled="disabled" type="primary">{{$t('bringInStandardInformation')}}
</a-button>
</div>
</a-col>
</a-row>
@@ -36,15 +40,16 @@
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text"
:title="$t('chapterContents')">{{$t('chapterContents')}}</span>
</div>
<a-form-model-item class="itemModel-multi" prop="memoriesChapter">
<a-form-model-item class="itemModel-multi" :prop="!disabled?'memoriesChapter':''">
<a-tree-select
tree-node-filter-prop="title"
v-model="formInline.memoriesChapter"
:maxTagCount="1"
:disabled="disabled"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
@@ -58,13 +63,13 @@
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="Required" v-if="!templateDisabled">*</span>
<span class="title-text-text"
:title="$t('contentTemplate')">{{$t('contentTemplate')}}</span>
</div>
<a-form-model-item class="itemModel" prop="contentTemplate">
<a-form-model-item class="itemModel" :prop="!templateDisabled?'contentTemplate':''">
<a-select :placeholder="$t('PleaseSelect')+$t('contentTemplate')"
:disabled="disabled"
:disabled="templateDisabled"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
@@ -81,19 +86,21 @@
</div>
</a-col>
</a-row>
<defaultTemplate :formInlineQuery="formInline" ref="defaultTemplateRef"
v-if="formInline.contentTemplate == '1'"/>
<solicitOpinions :formInlineQuery="formInline " ref="solicitOpinionsRef"
v-else-if="formInline.contentTemplate == '2'"/>
<releaseStandard :formInlineQuery="formInline" ref="releaseStandardRef"
v-else-if="formInline.contentTemplate == '3'"/>
<defaultTemplate :formInlineQuery="formInline" ref="defaultTemplateRef" :disabled="disabled"
v-if="formInline.contentTemplate == '1' && isTrue"/>
<solicitOpinions :formInlineQuery="formInline " ref="solicitOpinionsRef" :disabled="disabled"
v-else-if="formInline.contentTemplate == '2' && isTrue"/>
<releaseStandard :formInlineQuery="formInline" ref="releaseStandardRef" :disabled="disabled"
v-else-if="formInline.contentTemplate == '3' && isTrue"/>
</a-form-model>
</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>
<a-button @click="handleSubmit" v-if="!disabled" type="primary" :loading="confirmLoading">{{$t('submit')}}
</a-button>
</div>
</a-drawer>
<addModel ref="addModelRef" @addModelForm="addModelForm"/>
</div>
</template>
@@ -101,14 +108,17 @@
import defaultTemplate from './defaultTemplate'
import solicitOpinions from './solicitOpinions'
import releaseStandard from './releaseStandard'
import addModel from './addModel'
import { getAction, postAction, downloadFile } from '@/api/manage'
import moment from 'moment'
export default {
name: 'fillAdd',
components: {
defaultTemplate,
solicitOpinions,
releaseStandard
releaseStandard,
addModel
},
data() {
return {
@@ -140,7 +150,9 @@
confirmLoading: false,
title: '',
disabled: false,
isTrue: false,
chapterContentsList: [],
templateDisabled: false,
contentTemplateList: [
{
id: '1',
@@ -165,6 +177,12 @@
mounted() {
},
methods: {
bringInStandardInformationClick() {
this.$refs.addModelRef.addModel()
},
addModelForm(value) {
this.$refs.defaultTemplateRef.getStandData(value)
},
getTree() {
getAction('/report/lawsMonthlyReportTitleTemplateEO/list', {}).then((res) => {
if (res.success) {
@@ -174,37 +192,53 @@
}
})
},
dateChange(item) {
this.formInline[item.db_field_name] = this.formInline[item.db_field_name] ? moment(this.formInline[item.db_field_name]).format('YYYY-MM') : ''
this.formInline = { ...this.formInline }
},
add() {
this.isTrue = false
this.templateDisabled = false
this.getTree()
this.title = this.$t('addContent')
this.visible = true
this.disabled = false
this.formInline = {}
this.$nextTick(() => {
this.formInline = {}
this.formInline.contentTemplate = '1'
this.formInline = { ...this.formInline }
this.isTrue = true
this.$refs.ruleForm.clearValidate()
})
},
edit(row) {
this.getTree()
this.isTrue = false
this.title = this.$t('editContent')
this.visible = true
this.disabled = false
this.templateDisabled = true
this.$nextTick(() => {
this.formInline = row
if (this.formInline.memoriesChapter) {
this.formInline.memoriesChapter = this.formInline.memoriesChapter.split(',')
}
this.isTrue = true
this.$refs.ruleForm.clearValidate()
})
},
view(row) {
this.title = this.$t('viewContent')
this.visible = true
this.isTrue = false
this.templateDisabled = true
this.disabled = true
this.$nextTick(() => {
this.formInline = row
if (this.formInline.memoriesChapter) {
this.formInline.memoriesChapter = this.formInline.memoriesChapter.split(',')
}
this.isTrue = true
this.$refs.ruleForm.clearValidate()
})
},
@@ -237,17 +271,16 @@
}
})
let query = Object.assign(val, {
month: JSON.stringify(formInline.month),
month: formInline.month,
memoriesChapter: formInline.memoriesChapter,
contentTemplate: formInline.contentTemplate
})
postAction(url, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.confirmLoading = false
this.$emit('fillTableAddForm')
this.$emit('fillAddForm')
} else {
this.confirmLoading = false
this.$message.warning(this.$t('operationFailed'))
@@ -260,7 +293,15 @@
}
}
</script>
<style>
.ant-select-disabled {
color: rgba(0, 0, 0, 0.65);
}
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
<style scoped>
.box-title-text {
@@ -5,11 +5,11 @@
{{'NO.'+(index+1)}}
<a-icon class="icon-size"
@click="addData"
v-if="(dataList.length-1) == index"
v-if="(dataList.length-1) == index && !disabled"
type="plus-circle"/>
<a-icon class="icon-size"
@click="deleteData"
v-if="dataList.length > 1 && (dataList.length - 1) == index"
v-if="dataList.length > 1 && (dataList.length - 1) == index && !disabled"
type="minus-circle"/>
</div>
<a-row :gutter="24">
@@ -20,8 +20,8 @@
</div>
<a-form-model-item class="itemModel" prop="standardNo">
<a-input class="box-input"
:disabled="false"
v-model="formInline.standardNumber"
:disabled="disabled"
v-model="item.standardNumber"
:placeholder="$t('PleaseEnter')+$t('standardNo')"/>
</a-form-model-item>
</div>
@@ -34,8 +34,8 @@
</div>
<a-form-model-item class="itemModel" prop="standardNameCn">
<a-input class="box-input"
:disabled="false"
v-model="formInline.standardNameCn"
:disabled="disabled"
v-model="item.standardNameCn"
:placeholder="$t('PleaseEnter')+$t('standardNameCn')"/>
</a-form-model-item>
</div>
@@ -49,8 +49,8 @@
</div>
<a-form-model-item class="itemModel">
<a-input class="box-input"
:disabled="false"
v-model="formInline.standardNameEn"
:disabled="disabled"
v-model="item.standardNameEn"
:placeholder="$t('PleaseEnter')+$t('standardNameEn')"/>
</a-form-model-item>
</div>
@@ -66,7 +66,7 @@
@change="dateChange('issueTime',index)"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
v-model="formInline['issueTime']"
v-model="item['issueTime']"
:disabled="disabled"
style="width: 100%"/>
</a-form-model-item>
@@ -85,7 +85,7 @@
@change="dateChange('implementTime',index)"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
v-model="formInline['implementTime']"
v-model="item['implementTime']"
:disabled="disabled"
style="width: 100%"/>
</a-form-model-item>
@@ -101,13 +101,12 @@
export default {
name: 'releaseStandard',
props:['formInlineQuery'],
props:['formInlineQuery','disabled'],
data() {
return {
rules: {},
formInline: {},
CategoryTreeList: [],
disabled: false,
dataList: []
}
},
@@ -116,6 +115,8 @@
if (this.formInlineQuery.id) {
this.formInline = JSON.parse(JSON.stringify(this.formInlineQuery))
this.formInline = { ...this.formInline }
this.dataList = this.formInline.newStandardTemplateEOList
this.dataList = [...this.dataList]
} else {
this.dataList = [
{
@@ -157,7 +158,11 @@
getData(callback) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
callback && callback(this.formInline)
let query = {
id: this.formInline.id,
newStandardTemplateEOList: this.dataList
}
callback && callback(query)
}
})
}
@@ -5,11 +5,11 @@
{{'NO.'+(index+1)}}
<a-icon class="icon-size"
@click="addData"
v-if="(dataList.length-1) == index"
v-if="(dataList.length-1) == index && !disabled"
type="plus-circle"/>
<a-icon class="icon-size"
@click="deleteData"
v-if="dataList.length > 1 && (dataList.length - 1) == index"
v-if="dataList.length > 1 && (dataList.length - 1) == index && !disabled"
type="minus-circle"/>
</div>
<a-row :gutter="24">
@@ -20,7 +20,7 @@
</div>
<a-form-model-item class="itemModel" prop="planNoChinese">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="item.planNumberCn"
:placeholder="$t('PleaseEnter')+$t('planNoChinese')"/>
</a-form-model-item>
@@ -34,7 +34,7 @@
</div>
<a-form-model-item class="itemModel" prop="standardNameCn">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="item.standardNameCn"
:placeholder="$t('PleaseEnter')+$t('standardNameCn')"/>
</a-form-model-item>
@@ -49,7 +49,7 @@
</div>
<a-form-model-item class="itemModel">
<a-input class="box-input"
:disabled="false"
:disabled="disabled"
v-model="item.standardNameEn"
:placeholder="$t('PleaseEnter')+$t('standardNameEn')"/>
</a-form-model-item>
@@ -82,13 +82,12 @@
export default {
name: 'solicitOpinions',
props: ['formInlineQuery'],
props: ['formInlineQuery','disabled'],
data() {
return {
rules: {},
formInline: {},
CategoryTreeList: [],
disabled: false,
dataList: []
}
},
@@ -97,6 +96,8 @@
if (this.formInlineQuery.id) {
this.formInline = JSON.parse(JSON.stringify(this.formInlineQuery))
this.formInline = { ...this.formInline }
this.dataList = this.formInline.newOpinionTemplateEOList
this.dataList = [...this.dataList]
} else {
this.dataList = [
{
@@ -136,7 +137,11 @@
getData(callback) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
callback && callback(this.formInline)
let query = {
id: this.formInline.id,
newOpinionTemplateEOList: this.dataList
}
callback && callback(query)
}
})
}
@@ -49,15 +49,6 @@
// 请求转换流程图
processNum() {
let params = {}
if (this.$route.query.prcType == 5){
params = {
prcId: this.$route.query.prcId
}
}else{
params = {
prcNum: this.$route.query.prcNum
}
}
axios.request({
url: '/jero-boot/workFlow/getImg?_t=' + new Date().getTime(),
responseType: 'blob',
@@ -65,7 +56,9 @@
headers: {
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)
},
params: params
params: {
prcNum: this.$route.query.prcNum
}
}).then(res => {
this.processStep = window.URL.createObjectURL(res.data)
})
@@ -634,6 +634,10 @@
},
roleSwitchingClick() {
this.visibleRoleSwitching = true
this.$nextTick(()=>{
this.formInlineRoleSwitching.roleSwitchingCode = this.currentPersonRole
this.$refs.ruleFormRoleSwitching.clearValidate()
})
},
GetgetLoginUserType() {
this.$refs.CollectionTabel.getLoginUserType()