Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangzhijiang
2022-03-08 18:33:17 +08:00
45 changed files with 1368 additions and 635 deletions
@@ -0,0 +1,37 @@
package com.jero.common.constant.enums;
/**
* 中英文切换标识
* @description
* @date 2022/1/21 15:22
* @auth zhn
*/
public enum IsMustEnum {
YES("是","0"),
NO("否","1");
String name;
String value;
private IsMustEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -646,5 +646,26 @@ public class DateUtils extends PropertyEditorSupport {
calendar.setTime(getDate()); calendar.setTime(getDate());
return calendar.get(Calendar.YEAR); return calendar.get(Calendar.YEAR);
} }
/***
* @Description: 判断多个日期是否都符合日期格式
* @Author: yangxuenan
* @Date: 2020/12/31 11:31
* @Param: [str]
* @Return: boolean
*/
public static boolean isValidDate(String str){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String[] strArr = str.split(",");
for (String dateStr : strArr) {
String replace = dateStr.replace("/", "-");
try {
simpleDateFormat.setLenient(false);
simpleDateFormat.parse(replace);
} catch (Exception e){
return false;
}
}
return true;
}
} }
@@ -71,6 +71,7 @@ public class ShiroConfig {
} }
// 配置不会被拦截的链接 顺序判断 // 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录 filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/ocr/OcrRestful/ocrHandleResult", "anon"); //ocr回调接口
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除 filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除 filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/getRSAPublicKey", "anon"); //获取RSA公钥接口排除 filterChainDefinitionMap.put("/sys/getRSAPublicKey", "anon"); //获取RSA公钥接口排除
@@ -1,6 +1,8 @@
package com.jero.modules.system.vo; package com.jero.modules.system.vo;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
@@ -9,6 +11,7 @@ import java.io.Serializable;
* <b>日期:</b> 2019-03-25 <br> * <b>日期:</b> 2019-03-25 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br> * <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/ */
@Data
public class OcrVO implements Serializable{ public class OcrVO implements Serializable{
private String restHandleFileUrl; private String restHandleFileUrl;
private String OcrUserId; private String OcrUserId;
@@ -18,68 +21,5 @@ public class OcrVO implements Serializable{
private String fileContent; private String fileContent;
private String taskId; private String taskId;
private String RestCallBackUrl; private String RestCallBackUrl;
private Boolean isThird; //调用方:单纯获取识别的返回结果
public String getRestHandleFileUrl() {
return restHandleFileUrl;
}
public void setRestHandleFileUrl(String restHandleFileUrl) {
this.restHandleFileUrl = restHandleFileUrl;
}
public String getOcrUserId() {
return OcrUserId;
}
public void setOcrUserId(String ocrUserId) {
OcrUserId = ocrUserId;
}
public String getAuthCode() {
return authCode;
}
public void setAuthCode(String authCode) {
this.authCode = authCode;
}
public String getConvertType() {
return convertType;
}
public void setConvertType(String convertType) {
this.convertType = convertType;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileContent() {
return fileContent;
}
public void setFileContent(String fileContent) {
this.fileContent = fileContent;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getRestCallBackUrl() {
return RestCallBackUrl;
}
public void setRestCallBackUrl(String restCallBackUrl) {
RestCallBackUrl = restCallBackUrl;
}
} }
@@ -413,16 +413,8 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
@ApiOperation(value = "导入.zip") @ApiOperation(value = "导入.zip")
@PostMapping(value = "/importZip") @PostMapping(value = "/importZip")
public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception { public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
//验证文件名是否合格 String result = bussDocumentLibraryEOService.importZip(file);
//截取后缀名 return Result.OK(result);
int pos = file.getOriginalFilename().lastIndexOf(".");
String str = file.getOriginalFilename().substring(pos+1).toLowerCase();
String filenameorg = file.getOriginalFilename().substring(0,pos);
//判断上传文件必须是zip
if (!str.equals("zip")) {
return Result.error("请上传zip文件");
}
return Result.OK("导入成功");
} }
@ApiOperation(value = "推送") @ApiOperation(value = "推送")
@@ -78,4 +78,7 @@ public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibr
List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard); List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard);
List<Map<String,Object>> getListBySerialNumber(@Param("serialNumbers") String serialNumbers);
} }
@@ -70,5 +70,16 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<!--根据编码列表查询-->
<select id="getListBySerialNumber" resultType="java.util.LinkedHashMap">
select * from buss_document_library
where 1=1
<if test="serialNumbers != null" >
and serial_number in
<foreach collection="serialNumbers.split(',')" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>
@@ -3,7 +3,7 @@ package com.jero.modules.document.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.entity.BussDocumentLibraryEO;
import org.apache.poi.ss.usermodel.Workbook; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -13,164 +13,180 @@ import java.util.Map;
/** /**
* @Description: 文档库信息表 * @Description: 文档库信息表
* @Author: jero-boot * @Author: jero-boot
* @Date: 2022-01-21 * @Date: 2022-01-21
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> { public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> {
/** /**
* 通过id删除 * 通过id删除
* *
* @param id * @param id
* @return * @return
*/ */
void deleteById(String id); void deleteById(String id);
/** /**
* 批量删除 * 批量删除
* *
* @param ids * @param ids
* @return * @return
*/ */
void deleteByIds(List<String> ids); void deleteByIds(List<String> ids);
/** /**
* 通过id查询 * 通过id查询
* *
* @param id * @param id
* @return * @return
*/ */
BussDocumentLibraryEO queryById(String id); BussDocumentLibraryEO queryById(String id);
/** /**
* 列表查询 * 列表查询
* *
* @return * @return
*/ */
List<BussDocumentLibraryEO> queryList(); List<BussDocumentLibraryEO> queryList();
/** /**
* 查询条件 * 查询条件
* *
* @return * @return
*/ */
List<Map<String,Object>> queryCondition(String flag,String cut); List<Map<String, Object>> queryCondition(String flag, String cut);
/** /**
* 列表表头 * 列表表头
* *
* @return * @return
*/ */
List<Map<String,Object>> getHeader(String flag,String cut); List<Map<String, Object>> getHeader(String flag, String cut);
/** /**
* 新增表单 * 新增表单
* *
* @return * @return
*/ */
List<Map<String,Object>> getAddForm(String flag,String cut,String type); List<Map<String, Object>> getAddForm(String flag, String cut, String type);
/** /**
* 编辑数据查询 * 编辑数据查询
* @param id *
* @return * @param id
*/ * @return
List<Map<String,Object>> getDocumentInfoById(String id,String cut); */
List<Map<String, Object>> getDocumentInfoById(String id, String cut);
/** /**
* 详情数据查询 * 详情数据查询
* @param id *
* @return * @param id
*/ * @return
List<Map<String,Object>> getInfoById(String id,String cut); */
List<Map<String, Object>> getInfoById(String id, String cut);
/** /**
* 新增数据 * 新增数据
* @param map *
*/ * @param map
void addInfo(Map<String,Object> map); */
void addInfo(Map<String, Object> map);
/** /**
* 编辑数据 * 编辑数据
* @param map *
*/ * @param map
void updateInfo(Map<String,Object> map); */
void updateInfo(Map<String, Object> map);
/** /**
* 分页 * 分页
* @param parameter *
* @return * @param parameter
*/ * @return
IPage getInfoPage(Map<String,Object> parameter); */
IPage getInfoPage(Map<String, Object> parameter);
/** /**
* 代替标准分页 * 代替标准分页
* @param parameter *
* @return * @param parameter
*/ * @return
IPage replacePageInfo(Map<String,Object> parameter); */
IPage replacePageInfo(Map<String, Object> parameter);
/** /**
* ocr识别调取已入库文件分页 * ocr识别调取已入库文件分页
* @param parameter *
* @return * @param parameter
*/ * @return
IPage ocrPageInfo(Map<String,Object> parameter); */
IPage ocrPageInfo(Map<String, Object> parameter);
/** /**
* 添加收藏 * 添加收藏
* @param id *
*/ * @param id
void addCollect(String id); */
void addCollect(String id);
/** /**
* 取消收藏 * 取消收藏
* @param id *
*/ * @param id
void cancelCollect(String id); */
void cancelCollect(String id);
/** /**
* 添加订阅 * 添加订阅
* @param id *
*/ * @param id
void addSubscribe(String id); */
void addSubscribe(String id);
/** /**
* 取消订阅 * 取消订阅
* @param id *
*/ * @param id
void cancelSubscribe(String id); */
void cancelSubscribe(String id);
/** /**
* 导出excel * 导出excel
* @param map *
* @param response * @param map
* @param request * @param response
*/ * @param request
void exportExcel(Map<String,Object> map, */
HttpServletResponse response, void exportExcel(Map<String, Object> map,
HttpServletRequest request); HttpServletResponse response,
HttpServletRequest request);
void exportZip(Map<String,Object> map, void exportZip(Map<String, Object> map,
HttpServletResponse response, HttpServletResponse response,
HttpServletRequest request); HttpServletRequest request);
/** /**
* 模板下载 * 模板下载
* @param response *
* @param request * @param response
*/ * @param request
void exportTemplate(Map<String,Object> map,HttpServletResponse response, HttpServletRequest request); */
void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request);
/** /**
* ocr识别调取已入库文件-中英文切换 * ocr识别调取已入库文件-中英文切换
* @param flag *
* @param cut * @param flag
* @return * @param cut
*/ * @return
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut); */
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut);
String pullMessage(String departIds,String ids,String documentIds); String pullMessage(String departIds, String ids, String documentIds);
String importZip(MultipartFile file);
} }
@@ -7,11 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService; import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.ocr.entity.OcrRecordEO; import com.jero.modules.ocr.entity.OcrRecordEO;
import com.jero.modules.ocr.enums.FileSourceEnum;
import com.jero.modules.ocr.enums.FileSyncStateEnum; import com.jero.modules.ocr.enums.FileSyncStateEnum;
import com.jero.modules.ocr.enums.FileTypeEnum;
import com.jero.modules.ocr.page.OcrRecordEOPage; import com.jero.modules.ocr.page.OcrRecordEOPage;
import com.jero.modules.ocr.service.IOcrRecordEOService; import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.entity.OSSFile;
@@ -28,7 +27,9 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
@@ -72,6 +73,11 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
IPage<OcrRecordEO> pageList = ocrRecordService.page(page, queryWrapper); IPage<OcrRecordEO> pageList = ocrRecordService.page(page, queryWrapper);
List<OcrRecordEO> rows = pageList.getRecords(); List<OcrRecordEO> rows = pageList.getRecords();
for (OcrRecordEO row : rows){ for (OcrRecordEO row : rows){
if(StringUtils.isNotEmpty(row.getConnectId())) {
row.setFileSource(FileSourceEnum.IMPORT.getValue());
}else{
row.setFileSource(FileSourceEnum.UPLOAD.getValue());
}
if(StringUtils.isNotEmpty(row.getDocRealName())) { if(StringUtils.isNotEmpty(row.getDocRealName())) {
row.setDocRealFile(ocrDownPath + row.getDocRealName()); row.setDocRealFile(ocrDownPath + row.getDocRealName());
} }
@@ -86,97 +92,29 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@ApiOperation(value="OCR识别转换记录表-同步至文档库", notes="OCR识别转换记录表-同步至文档库") @ApiOperation(value="OCR识别转换记录表-同步至文档库", notes="OCR识别转换记录表-同步至文档库")
@PostMapping(value = "/syncToDocument") @PostMapping(value = "/syncToDocument")
public Result<?> syncToDocument(@RequestBody OcrRecordEO ocrRecordEO) { public Result<?> syncToDocument(@RequestBody OcrRecordEO ocrRecordEO) {
if(StringUtils.isBlank(ocrRecordEO.getAttId())){ if(StringUtils.isBlank(ocrRecordEO.getConnectId())){
return Result.error("没有可同步的文档"); return Result.error("同步失败");
} }
if (StringUtils.isBlank(ocrRecordEO.getStandName()) //查询doc文件的id
|| StringUtils.isBlank(ocrRecordEO.getStandNumber())){ LambdaQueryWrapper<OSSFile> ossFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
return Result.error("参数不能为空"); ossFileLambdaQueryWrapper.eq(OSSFile::getUrl, ocrRecordEO.getDocName());
List<OSSFile> ossFiles = ossFileService.list(ossFileLambdaQueryWrapper);
if (CollectionUtil.isEmpty(ossFiles)) {
return Result.error("没有可同步的文件");
} }
if (StringUtils.isBlank(ocrRecordEO.getFileType())) { OSSFile ossFile = new OSSFile();
return Result.error("文本状态不能为空"); String docFileId = ossFiles.get(0).getId();
} ossFile.setId(docFileId);
//通过编号和标题查询对应文档 ossFile.setConnectId(ocrRecordEO.getConnectId());
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>(); ossFileService.updateById(ossFile);
queryWrapper.eq(BussDocumentLibraryEO::getTitle, ocrRecordEO.getStandName())
.eq(BussDocumentLibraryEO::getSerialNumber, ocrRecordEO.getStandNumber());
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(queryWrapper);
if(CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)){
//查询doc文件的id
LambdaQueryWrapper<OSSFile> ossFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
ossFileLambdaQueryWrapper.eq(OSSFile::getUrl, ocrRecordEO.getDocName());
List<OSSFile> ossFiles = ossFileService.list(ossFileLambdaQueryWrapper);
if (CollectionUtil.isEmpty(ossFiles)) {
return Result.error("没有可同步的文件");
}
//开始同步
int countSuccess = 0;
for(BussDocumentLibraryEO documentLibraryEO : bussDocumentLibraryEOList) {
OSSFile ossFile = new OSSFile();
String docFileId = ossFiles.get(0).getId();
ossFile.setId(docFileId);
//设置doc文件的关联id
if (FileTypeEnum.RELEASE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getReleaseDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setReleaseDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
} else if (FileTypeEnum.SUPPLEMENT.getValue().equals(ocrRecordEO.getFileType())) { //修改记录表的同步情况
String connectId = documentLibraryEO.getSupplement(); OcrRecordEO updateOcrRecordEO = new OcrRecordEO();
if (StringUtils.isBlank(connectId)) { updateOcrRecordEO.setId(ocrRecordEO.getId());
connectId = UUID.randomUUID().toString().replace("-", ""); updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue());
//修改文档库相关字段 ocrRecordService.editById(updateOcrRecordEO);
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setSupplement(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
} else if (FileTypeEnum.APPROVAL_DRAFT.getValue().equals(ocrRecordEO.getFileType())) { return Result.OK("同步成功", ossFile);
String connectId = documentLibraryEO.getApprovalDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setApprovalDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
} else if (FileTypeEnum.EXPOSURE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getExposureDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setExposureDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
}
ossFileService.updateById(ossFile);
//修改记录表的同步情况
OcrRecordEO updateOcrRecordEO = new OcrRecordEO();
updateOcrRecordEO.setId(ocrRecordEO.getId());
updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue());
ocrRecordService.editById(updateOcrRecordEO);
countSuccess++;
}
return Result.OK("同步成功", countSuccess);
}else{
return Result.error("没有可同步的文档");
}
} }
/** /**
@@ -1,11 +1,10 @@
package com.jero.modules.ocr.controller; package com.jero.modules.ocr.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.modules.ocr.entity.OcrCallBackResultEO; import com.jero.common.exception.JeroBootException;
import com.jero.modules.ocr.entity.OcrRecordEO; import com.jero.modules.ocr.entity.OcrRecordEO;
import com.jero.modules.ocr.enums.ResultContentEnum;
import com.jero.modules.ocr.service.IOcrRecordEOService; import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.ocr.service.IOcrRestfulService; import com.jero.modules.ocr.service.IOcrRestfulService;
import com.jero.modules.ocr.util.MD5Util; import com.jero.modules.ocr.util.MD5Util;
@@ -14,6 +13,7 @@ import com.jero.modules.oss.service.IOSSFileService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -22,11 +22,11 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream; import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @program: OcrDemo * @program: OcrDemo
@@ -56,9 +56,37 @@ public class OcrRestfulController{
@Value("${OCR.ocrDownPath}") @Value("${OCR.ocrDownPath}")
private String ocrDownPath; private String ocrDownPath;
@Value("${OCR.ocrPath}")
private String ocrPath;
@Value("${jero.path.upload}") @Value("${jero.path.upload}")
private String filePath;//文件存储路径 private String filePath;//文件存储路径
@ApiOperation(value = "下载word文件")
@GetMapping("/downFile")
public void downFile(String fileName, HttpServletResponse response, HttpServletRequest request) throws Exception {
InputStream is = null;
OutputStream os = null;
response.reset();
try {
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/octet-stream");
String fullPath = ocrPath + fileName;
is = new FileInputStream(fullPath);
os = response.getOutputStream();
IOUtils.copy(is, os);
os.flush();
} catch (FileNotFoundException var4) {
throw new JeroBootException("文件[" + ocrPath + fileName + "]不存在");
} catch (IOException e) {
log.error(e.getMessage(), e);
} finally {
is.close();
os.close();
}
}
/** /**
* 测试OCR * 测试OCR
* @param file * @param file
@@ -77,34 +105,38 @@ public class OcrRestfulController{
* OCR回调 * OCR回调
* @param wordFile * @param wordFile
* @param jsonFile * @param jsonFile
* @param ocrCallBackResultEo * @param taskId
* @param result
* @param key
* @return * @return
*/ */
@ApiOperation(value = "OCR回调") @ApiOperation(value = "OCR回调")
@PostMapping("/OcrHandleResult") @PostMapping("/ocrHandleResult")
public String OcrHandleResult(@RequestParam("wordFile") MultipartFile wordFile,@RequestParam("jsonFile") MultipartFile jsonFile, OcrCallBackResultEO ocrCallBackResultEo) { public String ocrHandleResult(@RequestParam("wordFile") MultipartFile wordFile,
@RequestParam("jsonFile") MultipartFile jsonFile,
@RequestParam("taskId") String taskId,
@RequestParam("result") String result,
@RequestParam("key") String key) {
try{ try{
log.info("调取到我了"); log.info("调取到我了");
log.info("接口回调结果:"+ JSON.toJSONString(ocrCallBackResultEo));
log.info("接口回调时所传文件---wordFile:"+ wordFile.toString() +"; jsonFile:"+jsonFile.toString()); log.info("接口回调时所传文件---wordFile:"+ wordFile.toString() +"; jsonFile:"+jsonFile.toString());
if("error".equals(ocrCallBackResultEo.getResult())){ if("error".equals(result)){
log.info("客户接口处理文件失败"); log.info("客户接口处理文件失败");
ocrRestfulService.updateDb(ocrCallBackResultEo.getTaskID(),"客户接口处理文件失败"); ocrRestfulService.updateDb(taskId,"客户接口处理文件失败");
return "{\"result\":\"error\"}"; return "{\"result\":\"error\"}";
} }
//1.验证 key 是否符合,不符合打回,符合继续 //1.验证 key 是否符合,不符合打回,符合继续
//2.向后传递文件 //2.向后传递文件
String key = ocrCallBackResultEo.getKey(); String sign = taskId + OcrPublicKey;
String sign = ocrCallBackResultEo.getTaskID() + OcrPublicKey;
String signMD5 = MD5Util.string2MD5(sign); String signMD5 = MD5Util.string2MD5(sign);
// String encpySign =MD5Util.convertMD5(signMD5); // String encpySign =MD5Util.convertMD5(signMD5);
if(!signMD5.equals(key)){ if(!signMD5.equals(key)){
//不同,则认证失败 //不同,则认证失败
log.info("认证失败"); log.info("认证失败");
ocrRestfulService.updateDb(ocrCallBackResultEo.getTaskID(),"回调接口认证失败"); ocrRestfulService.updateDb(taskId, ResultContentEnum.OCR_CONVERT_FAIL.getValue());
return "{\"result\":\"Authentication failed\"}"; return "{\"result\":\"Authentication failed\"}";
} }
return ocrRestfulService.OcrHandleResult(wordFile,jsonFile,ocrCallBackResultEo.getTaskID()); return ocrRestfulService.ocrHandleResult(wordFile,jsonFile,taskId);
}catch (Exception e){ }catch (Exception e){
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
return "{\"result\":\"runTimeException\"}"; return "{\"result\":\"runTimeException\"}";
@@ -1,22 +1,20 @@
package com.jero.modules.ocr.entity; package com.jero.modules.ocr.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/** /**
@@ -128,9 +126,15 @@ public class OcrRecordEO implements Serializable {
@Excel(name = "同步状态", width = 15) @Excel(name = "同步状态", width = 15)
@ApiModelProperty(value = "同步状态") @ApiModelProperty(value = "同步状态")
private String syncState; private String syncState;
/**文档库关联文件id*/
@ApiModelProperty(value = "文档库关联文件id")
private String connectId;
@TableField(exist = false) @TableField(exist = false)
private String docRealFile; private String docRealFile;
@TableField(exist = false) @TableField(exist = false)
private String jsonRealFile; private String jsonRealFile;
@TableField(exist = false)
private String fileSource; //文件来源:0-上传 1-导入
} }
@@ -0,0 +1,36 @@
package com.jero.modules.ocr.enums;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 16:04 2022/3/8
*/
public enum FileSourceEnum {
UPLOAD("上传","0"),
IMPORT("导入","1");
String name;
String value;
FileSourceEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -21,5 +21,6 @@
<result column="json_file_code" property="jsonFileCode" /> <result column="json_file_code" property="jsonFileCode" />
<result column="att_id" property="attId" /> <result column="att_id" property="attId" />
<result column="sync_state" property="syncState" /> <result column="sync_state" property="syncState" />
<result column="connect_id" property="connectId" />
</resultMap> </resultMap>
</mapper> </mapper>
@@ -1,6 +1,5 @@
package com.jero.modules.ocr.service; package com.jero.modules.ocr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.modules.ocr.entity.OcrRecordEO; import com.jero.modules.ocr.entity.OcrRecordEO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -13,7 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
public interface IOcrRestfulService{ public interface IOcrRestfulService{
Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception; Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception;
String OcrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception; String ocrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception;
OcrRecordEO getOcrResult(String taskId, int i) throws Exception; OcrRecordEO getOcrResult(String taskId, int i) throws Exception;
@@ -10,6 +10,9 @@ import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.ocr.service.IOcrRestfulService; import com.jero.modules.ocr.service.IOcrRestfulService;
import com.jero.modules.ocr.util.Base64Util; import com.jero.modules.ocr.util.Base64Util;
import com.jero.modules.ocr.util.RsaUtil; import com.jero.modules.ocr.util.RsaUtil;
import com.jero.modules.ocr.util.UUIDUtils;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.vo.OcrVO; import com.jero.modules.system.vo.OcrVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@@ -52,6 +55,8 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
@Autowired @Autowired
private IOcrRecordEOService ocrRecordEOService; private IOcrRecordEOService ocrRecordEOService;
@Autowired
private IOSSFileService ossFileService;
//请求处理文件url //请求处理文件url
@@ -86,7 +91,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
public Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception { public Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception {
String taskId = ""; String taskId = "";
if ("add".equals(type)) { if ("add".equals(type)) {
taskId = UUID.randomUUID().toString().replace("-", ""); taskId = UUIDUtils.randomUUID20();
} else { } else {
taskId = getOcrEO.getId(); taskId = getOcrEO.getId();
} }
@@ -126,6 +131,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrVO.setFileContent(fileContent); ocrVO.setFileContent(fileContent);
ocrVO.setTaskId(taskId); ocrVO.setTaskId(taskId);
ocrVO.setRestCallBackUrl(RestCallBackUrl); ocrVO.setRestCallBackUrl(RestCallBackUrl);
ocrVO.setIsThird(true);
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO); ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO);
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
@@ -145,6 +151,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setStandNumber(getOcrEO.getStandNumber()); ocrRecordEO.setStandNumber(getOcrEO.getStandNumber());
ocrRecordEO.setStandName(getOcrEO.getStandName()); ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType()); ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// ocrRecordEO.setCreateBy(sysUser.getId()); // ocrRecordEO.setCreateBy(sysUser.getId());
// ocrRecordEO.setCreateTime(new Date()); // ocrRecordEO.setCreateTime(new Date());
@@ -160,6 +167,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setStandName(getOcrEO.getStandName()); ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType()); ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setCreateTime(new Date()); ocrRecordEO.setCreateTime(new Date());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
ocrRecordEOService.editById(ocrRecordEO); //TODO ?? ocrRecordEOService.editById(ocrRecordEO); //TODO ??
return Result.OK( "加入转换成功", taskId); return Result.OK( "加入转换成功", taskId);
} }
@@ -173,19 +181,19 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
} }
} }
public String OcrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception { public String ocrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception {
//首先将文件保存至本地 //首先将文件保存至本地
String saveWordFilePath=null; String saveWordFilePath=null;
String saveWordFileName=null; String saveWordFileName=null;
if(wordFile!=null && !wordFile.isEmpty()){ if(wordFile!=null && !wordFile.isEmpty()){
saveWordFileName= UUID.randomUUID().toString().replace("-", "") + "_"+wordFile.getOriginalFilename(); saveWordFileName= UUIDUtils.randomUUID20() + "_"+wordFile.getOriginalFilename();
saveWordFilePath=ocrFilePath+saveWordFileName; saveWordFilePath=ocrFilePath+saveWordFileName;
FileUtils.copyInputStreamToFile(wordFile.getInputStream(),new File(saveWordFilePath)); FileUtils.copyInputStreamToFile(wordFile.getInputStream(),new File(saveWordFilePath));
} }
String saveJsonFilePath=null; String saveJsonFilePath=null;
String saveJsonFileName=null; String saveJsonFileName=null;
if(jsonFile!=null && !jsonFile.isEmpty()){ if(jsonFile!=null && !jsonFile.isEmpty()){
saveJsonFileName=UUID.randomUUID().toString().replace("-", "") + "_"+jsonFile.getOriginalFilename(); saveJsonFileName=UUIDUtils.randomUUID20() + "_"+jsonFile.getOriginalFilename();
saveJsonFilePath=ocrFilePath+saveJsonFileName; saveJsonFilePath=ocrFilePath+saveJsonFileName;
FileUtils.copyInputStreamToFile(jsonFile.getInputStream(),new File(saveJsonFilePath)); FileUtils.copyInputStreamToFile(jsonFile.getInputStream(),new File(saveJsonFilePath));
} }
@@ -201,7 +209,15 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setJsonFileCode(null); ocrRecordEO.setJsonFileCode(null);
ocrRecordEO.setUpdateTime(new Date()); ocrRecordEO.setUpdateTime(new Date());
ocrRecordEO.setResultContent("转换成功"); ocrRecordEO.setResultContent("转换成功");
ocrRecordEOService.editById(ocrRecordEO); ocrRecordEOService.updateById(ocrRecordEO);
//记录doc文件信息
OSSFile docFile = new OSSFile();
docFile.setId(UUID.randomUUID().toString().replace("-", ""));
docFile.setUrl(saveWordFilePath);
docFile.setFileName(saveWordFilePath.substring(saveWordFilePath.lastIndexOf("_")+1));
ossFileService.save(docFile);
return "{\"result\":\"success\"}"; return "{\"result\":\"success\"}";
}else{ }else{
updateDb(taskId,"error:File does not exist"); updateDb(taskId,"error:File does not exist");
@@ -236,7 +252,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setId(taskId); ocrRecordEO.setId(taskId);
ocrRecordEO.setUpdateTime(new Date()); ocrRecordEO.setUpdateTime(new Date());
ocrRecordEO.setResultContent(result); ocrRecordEO.setResultContent(result);
ocrRecordEOService.editById(ocrRecordEO); ocrRecordEOService.updateById(ocrRecordEO);
} }
public boolean checkFileName(String fileName){ public boolean checkFileName(String fileName){
@@ -0,0 +1,57 @@
package com.jero.modules.ocr.util;
import java.awt.*;
import java.util.Random;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 0:09 2022/3/8
*/
public class RandomUtils extends org.apache.commons.lang3.RandomUtils {
private static final char[] codeSeq = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9'};
private static final char[] numberArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
private static Random random = new Random();
public RandomUtils() {
}
public static final String randomString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(codeSeq[random.nextInt(codeSeq.length)]));
}
return sb.toString();
}
public static final String randomNumberString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(numberArray[random.nextInt(numberArray.length)]));
}
return sb.toString();
}
public static Color randomColor(int fc, int bc) {
int f = fc;
int b = bc;
Random random = new Random();
if (fc > 255) {
f = 255;
}
if (bc > 255) {
b = 255;
}
return new Color(f + random.nextInt(b - f), f + random.nextInt(b - f), f + random.nextInt(b - f));
}
public static int nextInt(int bound) {
return random.nextInt(bound);
}
}
@@ -0,0 +1,38 @@
package com.jero.modules.ocr.util;
import java.util.Random;
public class UUIDUtils {
public static String randomUUID10() {
return RandomUtils.randomString(10);
}
public static String randomUUID20() {
return RandomUtils.randomString(20);
}
public static String randomUUID(int length) {
return RandomUtils.randomString(length);
}
public static String getUUIDPath(String uuid){
StringBuilder builder=new StringBuilder();
builder.append("/");
builder.append((uuid.substring(0, 3).hashCode())%100+"").append("/");
builder.append((uuid.substring(7,10).hashCode())%100+"").append("/");
builder.append((uuid.substring(11,14).hashCode())%100+"").append("/");
return builder.toString();
}
public static String getAttTable(){
Random rand = new Random();
int nextInt = rand.nextInt(10)+1;
StringBuilder builder=new StringBuilder();
builder.append("ATT_FILE_").append(String.format("%02d", nextInt));
return builder.toString();
}
}
@@ -113,21 +113,51 @@ public class FileUnZip {
* @param filename * @param filename
*/ */
public static List<File> readFileByFilename(String path,String filename) { public static List<File> readFileByFilename(String path,String filename) {
if(filename.contains("/")){
filename = filename.split("/")[1];
}
List<File> resultlist = new ArrayList<>(); List<File> resultlist = new ArrayList<>();
if (StringUtil.isNotEmpty(path)){ if (StringUtil.isNotEmpty(path)){
File file = new File(path); File file = new File(path);
if (file.isDirectory()) { if (file.isDirectory()) {
File[] files = file.listFiles(); File[] files = file.listFiles();
for (File fi : files) { for (File fi : files) {
// 对文件进行过滤 if(fi.isDirectory()){
if (fi.getName().equals(filename)) { File[] filesTemp = fi.listFiles();
resultlist.add(fi); for (File fileTemp : filesTemp) {
// 对文件进行过滤
if (fileTemp.getName().equals(filename)) {
resultlist.add(fileTemp);
}
}
}else{
// 对文件进行过滤
if (fi.getName().equals(filename)) {
resultlist.add(fi);
}
} }
} }
} }
} }
return resultlist; return resultlist;
} }
// public static List<File> readFileByFilename(String path,String filename) {
// List<File> resultlist = new ArrayList<>();
// if (StringUtil.isNotEmpty(path)){
// File file = new File(path);
// if (file.isDirectory()) {
// File[] files = file.listFiles();
// for (File fi : files) {
// // 对文件进行过滤
// if (fi.getName().equals(filename)) {
// resultlist.add(fi);
// }
// }
// }
// }
// return resultlist;
// }
/** /**
*@Description: 删除某个文件 *@Description: 删除某个文件
@@ -152,4 +182,21 @@ public class FileUnZip {
} }
} }
public static List<File> readImpExcelFile(String path) {
File file = new File(path);
List<File> resultlist = new ArrayList<>();
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File fi : files) {
// 对文件进行过滤,只读取Excel文件
String name = fi.getName();
// "导入模板".equals(fi.getName()) || "导入模板.xlsx".equals(fi.getName())
if (name != null &&( fi.getName().contains(".xls") || fi.getName().contains(".xlsx") )){
resultlist.add(fi);
}
}
}
return resultlist;
}
} }
@@ -299,11 +299,11 @@ justauth:
# 云端OCR识别集成配置参数 # 云端OCR识别集成配置参数
OCR: OCR:
#请求OCR转换接口 #请求OCR转换接口
handleFileUrl: https://sws.trans-cosmos.com.cn/WebService.asmx/FileConversion # handleFileUrl: https://sws.trans-cosmos.com.cn/WebService.asmx/FileConversion
#handleFileUrl = https://61.136.1.103:8091/WebService.asmx/FileConversion handleFileUrl: http://61.136.1.103:8091/WebService.asmx/FileConversion
# OCR回调接口地址 配置客户本地的IP及端口号 # OCR回调接口地址 配置客户本地的IP及端口号
# callBackUrl: http://139.9.235.66:9110/api/ocr/OCRRestful/OcrHandleResult # callBackUrl: http://139.9.235.66:9110//api/ocr/OCRRestful/OcrHandleResult
callBackUrl: http://127.0.0.1:8080/api/ocr/OCRRestful/OcrHandleResult callBackUrl: http://139.9.235.66:9022/local-tool/ocr/ocrHandleResult
# OCR认证用户 # OCR认证用户
userId: dayuzhou1234 userId: dayuzhou1234
# OCR认证编码 # OCR认证编码
@@ -320,11 +320,6 @@ OCR:
times: 20 times: 20
# OCR转换类型 # OCR转换类型
convertType: BOTH convertType: BOTH
## 这个IFeignService是加了@FeignClient注解的类
local-tool:
ribbon:
## 服务提供者的地址,不是服务注册中心的地址
listOfServers: http://139.9.235.66:9022
## 这个要有,如果不加,只加了上面也没用 ## 这个要有,如果不加,只加了上面也没用
ribbon: ribbon:
+6
View File
@@ -500,4 +500,10 @@ module.exports = {
ProcessStatus:'Process status', ProcessStatus:'Process status',
CompletionTime:'Completion time', CompletionTime:'Completion time',
draft:'draft', draft:'draft',
CannotExceed100characters:'cannot exceed 100 characters',
cantExeed:'cannot exceed ',
characters:' characters',
Processing:'Processing',
See:'See',
} }
+6 -1
View File
@@ -424,7 +424,7 @@ module.exports = {
LabeItemName:'标签项名称', LabeItemName:'标签项名称',
PleaseEnterLabelName:'请输入标签名称', PleaseEnterLabelName:'请输入标签名称',
DisplayArea:'展示区域', DisplayArea:'展示区域',
ChineseName:'中文名称', ChineseName:'属性名称',
AttributeType:'属性类型', AttributeType:'属性类型',
FieldLength:'字段长度', FieldLength:'字段长度',
DisplayOrder:'展示顺序', DisplayOrder:'展示顺序',
@@ -504,4 +504,9 @@ module.exports = {
ProcessStatus:'流程状态', ProcessStatus:'流程状态',
CompletionTime:'完成时间', CompletionTime:'完成时间',
draft:'草稿', draft:'草稿',
CannotExceed100characters:'不能超过100字符',
cantExeed:'不能超过',
characters:'字符',
Processing:'办理',
See:'查看',
} }
@@ -322,12 +322,12 @@
}) })
}, },
dateChange(item) { dateChange(item) {
this.formInline[item.db_field_name] = moment(this.formInline[item.db_field_name]).format('YYYY-MM-DD') this.formInline[item.db_field_name] = this.formInline[item.db_field_name] ? moment(this.formInline[item.db_field_name]).format('YYYY-MM-DD') : ''
}, },
onChange(item) { onChange(item) {
let dateOne = moment(this.formInline[item][0]).format('YYYY-MM-DD') let dateOne = moment(this.formInline[item][0]).format('YYYY-MM-DD')
let dateTwo = moment(this.formInline[item][1]).format('YYYY-MM-DD') let dateTwo = moment(this.formInline[item][1]).format('YYYY-MM-DD')
this.formInline[item] = [dateOne, dateTwo] this.formInline[item] =dateOne ? [dateOne, dateTwo] : []
}, },
clickButtonToUpload(current) { clickButtonToUpload(current) {
+4 -4
View File
@@ -271,7 +271,7 @@
}, },
methods: { methods: {
sumber() { sumber() {
console.log('vilidate',this.$refs.ruleForm1) console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => { this.$refs.ruleForm1.validate(valid => {
console.log('va',valid) console.log('va',valid)
if (valid) { if (valid) {
@@ -283,11 +283,11 @@
} }
postAction(url, this.formInline).then((res) => { postAction(url, this.formInline).then((res) => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset') eventBUs.$emit('searchReset')
this.$emit('addFormClick') this.$emit('addFormClick')
} else { } else {
this.$message.warning(res.message) this.$message.warning(this.$t('operationFailed'))
} }
}) })
} else { } else {
@@ -310,6 +310,7 @@
/** 赋值给当前对应的表单文件 */ /** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',') this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
console.log('form',this.formInline)
} }
}, },
handleInput(value) { handleInput(value) {
@@ -371,7 +372,6 @@
this.$set(this, 'rules', rules) this.$set(this, 'rules', rules)
this.isFormInline = true this.isFormInline = true
this.confirmLoading = false this.confirmLoading = false
console.log('rules',rules,this)
}, },
getForm() { getForm() {
this.confirmLoading = true this.confirmLoading = true
@@ -16,7 +16,7 @@
<a class="text" v-for="(ol,index) in OperationList" <a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)"> @click="OperationClick(ol,record)">
<span v-if="ol.text==$t('SyncLibrary')"> <span v-if="ol.text==$t('SyncLibrary')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}} {{record.resultContent=='转换成功'&&record.syncState=='未同步'&&record.fileSource=='1'?ol.text:''}}
</span> </span>
<span v-if="ol.text==$t('check')"> <span v-if="ol.text==$t('check')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}} {{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
@@ -112,6 +112,7 @@
}) })
eventBUs.$on('searchReset', target => { eventBUs.$on('searchReset', target => {
this.searchParmes = {} this.searchParmes = {}
this.selectedRowKeys=[]
this.getData() this.getData()
this.getTableList() this.getTableList()
}) })
+1 -1
View File
@@ -16,7 +16,7 @@
<a class="text" v-for="(ol,index) in OperationList" <a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)"> @click="OperationClick(ol,record)">
<span v-if="ol.text==$t('SyncLibrary')"> <span v-if="ol.text==$t('SyncLibrary')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}} {{record.resultContent=='转换成功'&&record.syncState=='未同步'&&record.fileSource=='1'?ol.text:''}}
</span> </span>
<span v-if="ol.text==$t('check')"> <span v-if="ol.text==$t('check')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}} {{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
+8 -1
View File
@@ -27,7 +27,9 @@
</a> </a>
</span> </span>
<span slot="detailClick" slot-scope="text,record"> <span slot="detailClick" slot-scope="text,record">
<a class="text" :title="text" @click="detailClick(record)">{{text}}</a> <a class="text" :title="text" @click="detailClick(record)">
{{text && text.length > 18?text.slice(0,17)+'...':text}}
</a>
</span> </span>
<span slot="detailText" slot-scope="text,record"> <span slot="detailText" slot-scope="text,record">
<span class="text" :title="text"> <span class="text" :title="text">
@@ -187,6 +189,11 @@
this.loading = true this.loading = true
postAction(this.url.tableList, params).then((res) => { postAction(this.url.tableList, params).then((res) => {
if (res.success) { if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0){
this.pageNo = res.result.current - 1
this.getTableList()
return
}
this.dataSource = res.result.records this.dataSource = res.result.records
this.total = res.result.total this.total = res.result.total
this.loading = false this.loading = false
+87 -85
View File
@@ -1,68 +1,71 @@
<template> <template>
<div> <div>
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title"> <a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-upload-dragger <a-upload-dragger
accept='*.*' accept='*.*'
:disabled="disabled" :disabled="disabled"
class="ant-upload-list" class="ant-upload-list"
name="file" name="file"
:file-list="myfileList" :file-list="myfileList"
:multiple="true" :multiple="true"
:action = 'uploadAction' :action='uploadAction'
:headers="headers" :headers="headers"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:remove='remove' :remove='remove'
@change="handleChange"> @change="handleChange">
<p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p> <p>
<p class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{this.$t('clickUpload')}}</p> <a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload"/>
</a-upload-dragger> </p>
</a-modal> <p class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{this.$t('clickUpload')}}</p>
</div> </a-upload-dragger>
</a-modal>
</div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
export default { export default {
name: 'file', name: 'file',
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType'], props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType'],
data(){ data() {
return{ return {
visible:false, visible: false,
title:this.$t('clickUpload'), title: this.$t('clickUpload'),
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload", uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
myuploadAction:window._CONFIG['domianURL']+this.thisFileUploadUrl, myuploadAction: window._CONFIG['domianURL'] + this.thisFileUploadUrl,
upDataList:[], upDataList: [],
downLoadFileUrl:window._CONFIG['domianURL']+'/sys/common/static', downLoadFileUrl: window._CONFIG['domianURL'] + '/sys/common/static',
fileList:[], fileList: [],
myfileList:[], myfileList: [],
isLoding:false, isLoding: false
} }
}, },
created(){ created() {
const token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = {"X-Access-Token":token}; this.headers = { 'X-Access-Token': token }
this.containerId = 'container-ty-'+new Date().getTime(); this.containerId = 'container-ty-' + new Date().getTime()
}, },
mounted(){ mounted() {
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl); // console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
}, },
methods:{ methods: {
perentHandleFunc(data){ perentHandleFunc(data) {
this.myfileList = data this.myfileList = data
if (data && data.length > 0){ if (data && data.length > 0) {
this.myfileList.forEach((res)=>{ this.myfileList.forEach((res) => {
res.name = res.fileName res.name = res.fileName
res.uid = res.id res.uid = res.id
}) })
}else { } else {
this.myfileList = [] this.myfileList = []
} }
}, },
beforeUpload(file) { beforeUpload(file) {
console.log(file) console.log(file)
// let thisFileType = this.thisFileType.replace(/\s+/g, ""); // let thisFileType = this.thisFileType.replace(/\s+/g, "");
this.fileTypeSatus = true; this.fileTypeSatus = true
//TODO 客户要求不拦截文件 //TODO 客户要求不拦截文件
// if(file.type){ // if(file.type){
// if (thisFileType.indexOf(file.type) != -1) { // if (thisFileType.indexOf(file.type) != -1) {
@@ -81,60 +84,60 @@
// } // }
this.$message.destroy() this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量! // 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!"; this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
}, },
remove(){ remove() {
this.fileTypeSatus = true; this.fileTypeSatus = true
}, },
mydownload(item){ mydownload(item) {
var fileName = item.fileName; var fileName = item.fileName
downFile(this.downLoadFileUrl+'/'+item.ext1,{}).then((data)=>{ downFile(this.downLoadFileUrl + '/' + item.ext1, {}).then((data) => {
if (!data) { if (!data) {
this.$message.destroy() this.$message.destroy()
this.$message.warning("文件下载失败") this.$message.warning('文件下载失败')
return return
} }
if (typeof window.navigator.msSaveBlob !== 'undefined') { if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName) window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName)
}else{ } else {
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a') let link = document.createElement('a')
link.style.display = 'none' link.style.display = 'none'
link.href = url link.href = url
link.setAttribute('download', fileName) link.setAttribute('download', fileName)
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link); //下载完成移除元素 document.body.removeChild(link) //下载完成移除元素
window.URL.revokeObjectURL(url); //释放掉blob对象 window.URL.revokeObjectURL(url) //释放掉blob对象
} }
}) })
}, },
mypreview(item){ mypreview(item) {
console.log(item); console.log(item)
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl+'/'+item.ext1) let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + item.ext1)
window.open(url, '_blank') window.open(url, '_blank')
}, },
handleChange(info) { handleChange(info) {
let { file } = info; let { file } = info
const status = info.file.status; const status = info.file.status
info.fileList.forEach((val,index)=>{ info.fileList.forEach((val, index) => {
if(val.response && !val.response.result){ if (val.response && !val.response.result) {
this.$message.error(val.response.message); this.$message.error(val.response.message)
info.fileList.splice(index,1) info.fileList.splice(index, 1)
} }
}) })
if (this.fileTypeSatus) { if (this.fileTypeSatus) {
if (file.size > 100000000) { if (file.size > 100000000) {
this.$message.error(this.errorMessage) this.$message.error(this.errorMessage)
return return
}else { } else {
if (status === 'error') { if (status === 'error') {
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.error(`${info.file.name} 文件上传失败。`); this.$message.error(`${info.file.name} 文件上传失败。`)
} else if (status === 'removed') { } else if (status === 'removed') {
this.myfileList = info.fileList; this.myfileList = info.fileList
this.fileList = [] this.fileList = []
this.myfileList.forEach((res) => { this.myfileList.forEach((res) => {
if (res.response) { if (res.response) {
@@ -144,16 +147,16 @@
} }
}) })
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){ if (this.myfileList.length > 0) {
this.$message.destroy() this.$message.destroy()
this.$message.success(`${info.file.name} 删除成功。`); this.$message.success(`${info.file.name} 删除成功。`)
} }
} else if (status === 'done') { } else if (status === 'done') {
this.fileList = [] this.fileList = []
this.myfileList = info.fileList; this.myfileList = info.fileList
if (info.fileList.length > 20) { if (info.fileList.length > 20) {
info.fileList.splice(20) info.fileList.splice(20)
this.myfileList = info.fileList; this.myfileList = info.fileList
this.myfileList.forEach((res) => { this.myfileList.forEach((res) => {
if (res.response) { if (res.response) {
this.fileList.push(res.response.result) this.fileList.push(res.response.result)
@@ -163,7 +166,7 @@
}) })
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.error('最多只能上传二十个'); this.$message.error('最多只能上传二十个')
return return
} }
this.myfileList.forEach((res) => { this.myfileList.forEach((res) => {
@@ -174,30 +177,29 @@
} }
}) })
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){ if (this.myfileList.length > 0) {
this.$message.destroy() this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`); this.$message.success(`${info.file.name} 文件上传成功。`)
} }
} else if (status === 'uploading') { } else if (status === 'uploading') {
this.myfileList = info.fileList; this.myfileList = info.fileList
this.$emit('uploadSuccess')
// this.$message.success(`${info.file.name} 文件上传成功。`); // this.$message.success(`${info.file.name} 文件上传成功。`);
} }
} }
}else{ } else {
this.$message.warning('不支持上传该类型的文件!') this.$message.warning('不支持上传该类型的文件!')
} }
}, },
resetFileList(){ resetFileList() {
this.myfileList = []; this.myfileList = []
this.fileList = []; this.fileList = []
}, }
}, }
} }
</script> </script>
<style> <style>
.ant-upload-list-item-name{ .ant-upload-list-item-name {
color: rgba(0, 0, 0, 0.65) !important; color: rgba(0, 0, 0, 0.65) !important;
} }
</style> </style>
@@ -164,7 +164,9 @@
confirmLoading: false, confirmLoading: false,
selectedIds:'', //选择行id selectedIds:'', //选择行id
record:{}, record:{},
accept:'application/pdf' accept:'application/pdf',
today:'',
timer:''
} }
}, },
props:{ props:{
@@ -173,9 +175,26 @@
mounted() { mounted() {
// this.loadData() // this.loadData()
}, },
created() {
const date = new Date(),
year = date.getFullYear(),
month = date.getMonth()+1,
myDate = date.getDate()
this.today = `${year}/${month < 10 ? '0'+month : month}/${myDate < 10 ? '0'+myDate : myDate}`
if(this.timer){
clearInterval(this.timer)
}else{
eventBUs.$emit('searchReset')
this.initSetTimeout(this.today)//调用每隔10秒刷新数据
}
},
methods:{ methods:{
//上传 //上传
handleUpload(){ handleUpload(){
// if(this.timer){
// clearInterval(this.timer)
// }
this.fileVisible=true this.fileVisible=true
}, },
//调取已入库文件 //调取已入库文件
@@ -229,8 +248,9 @@
//下载 //下载
actionDown(val){ actionDown(val){
// downloadFile('/sys/common/download', val.docRealName, { id: val.attId }) // downloadFile('/sys/common/download', val.docRealName, { id: val.attId })
downloadFile('ocr/OcrRestful/downFile', val.docRealName, { fileName: val.docRealName })
// downloadFile(val.docRealFile) // downloadFile(val.docRealFile)
window.open(val.docRealFile) // window.open(val.docRealFile)
}, },
//删除 //删除
actionDelete(record){ actionDelete(record){
@@ -264,6 +284,7 @@
}, },
//上传确定按钮 //上传确定按钮
modalOk(){ modalOk(){
this.$refs.fileForm.sumber() this.$refs.fileForm.sumber()
}, },
handleCancel(){ handleCancel(){
@@ -325,8 +346,17 @@
}, },
addFormClick() { addFormClick() {
this.fileVisible = false this.fileVisible = false
} },
} //10秒刷新页面
initSetTimeout(today) {//每隔10秒刷新数据,也就是每隔10秒向后台请求一次数据
this.timer=setInterval( () => {
eventBUs.$emit('searchReset')
}, 10000)
},
},
beforeDestroy(){
clearInterval(this.timer)
},
} }
</script> </script>
@@ -190,7 +190,8 @@
let params = { let params = {
attId: this.rows.id, attId: this.rows.id,
standName: this.rows.title, standName: this.rows.title,
standNumber: this.rows.serial_number standNumber: this.rows.serial_number,
connectId:this.rows.connect_id
} }
if(this.rows.text_info=='发布稿(必读)'){ if(this.rows.text_info=='发布稿(必读)'){
params.fileType='1' params.fileType='1'
@@ -76,8 +76,8 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item :label="$t('DisplayArea')" prop="areaId"> <a-form-model-item :label="$t('DisplayArea')" prop="showArea">
<a-select :placeholder="$t('SelectDisplayArea')" v-model="form.areaId" @change="handleChange"> <a-select :placeholder="$t('SelectDisplayArea')" v-model="form.showArea" @change="handleChange">
<a-select-option v-for="(item,index) in areaOptions" :key="item.id" :value="item.id"> <a-select-option v-for="(item,index) in areaOptions" :key="item.id" :value="item.id">
{{item.showArea}} {{item.showArea}}
</a-select-option> </a-select-option>
@@ -176,9 +176,14 @@
], ],
dbFieldTxt: [ dbFieldTxt: [
{ required: true, message: this.$t('PleaseEnterPropertyName'),trigger: 'blur'}, { required: true, message: this.$t('PleaseEnterPropertyName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
], ],
dbFieldName: [ dbFieldName: [
{ required: true, message: this.$t('PleaseEnterYourEnglishName'),trigger: 'blur'}, { required: true, message: this.$t('PleaseEnterYourEnglishName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldEnName:[
{ max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
], ],
fieldShowType: [ fieldShowType: [
{ required: true, message: this.$t('PleaseSelectAttributeType'),trigger: 'change'}, { required: true, message: this.$t('PleaseSelectAttributeType'),trigger: 'change'},
@@ -198,7 +203,7 @@
isShowForm: [ isShowForm: [
{ required: true, message: this.$t('SelectWhetherDisplayList'),trigger: 'change'}, { required: true, message: this.$t('SelectWhetherDisplayList'),trigger: 'change'},
], ],
areaId: [ showArea: [
{ required: true, message: this.$t('SelectDisplayArea'),trigger: 'change'}, { required: true, message: this.$t('SelectDisplayArea'),trigger: 'change'},
], ],
isQuery: [ isQuery: [
@@ -351,6 +356,7 @@
httpurl+=this.url.add; httpurl+=this.url.add;
method = 'post'; method = 'post';
this.form.id='' this.form.id=''
this.form.isReadOnly=0
}else if(this.submitEdit=='edit'){ }else if(this.submitEdit=='edit'){
httpurl+=this.url.edit; httpurl+=this.url.edit;
method = 'put'; method = 'put';
@@ -111,8 +111,8 @@
columns: [ columns: [
{ {
title: this.$t('DisplayArea'), title: this.$t('DisplayArea'),
dataIndex: 'show_area', dataIndex: 'showArea',
key: 'show_rea', key: 'showArea',
align: "center", align: "center",
width: 100, width: 100,
}, },
@@ -120,13 +120,13 @@
title: this.$t('enName'), title: this.$t('enName'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'en_name', dataIndex: 'enName',
}, },
{ {
title: this.$t('Module'), title: this.$t('Module'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'item_text', dataIndex: 'isModel_dictText',
}, },
{ {
title: this.$t('SortNumber'), title: this.$t('SortNumber'),
@@ -162,6 +162,10 @@
{ required: true, message: this.$t('PleaseSelectModule'), trigger: 'change' }, { required: true, message: this.$t('PleaseSelectModule'), trigger: 'change' },
], ],
enName:[
{ max: 100, message: this.$t('CannotExceed100characters'), trigger: 'blur' },
],
showArea:[ showArea:[
{ required: true, message: this.$t('enterDisplayArea'), trigger: 'blur' }, { required: true, message: this.$t('enterDisplayArea'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('charactersLength'), trigger: 'blur' }, { min:1, max: 50, message: this.$t('charactersLength'), trigger: 'blur' },
@@ -184,9 +188,9 @@
let params={ let params={
...this.queryParams ...this.queryParams
} }
getAction(`tag/onlCgformArea/page`,params).then(res=>{ postAction(`tag/onlCgformArea/page`,params).then(res=>{
if(res.success){ if(res.success){
this.areaTable=res.result this.areaTable=[...res.result.records]
this.total=res.result.total this.total=res.result.total
} }
}) })
@@ -36,7 +36,10 @@
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol"
> >
<a-form-model-item :label="$t('name')" prop="name"> <a-form-model-item :label="$t('name')" prop="itemText" v-if="dictVal=='list'">
<a-input v-model="form.itemText" :placeholder="$t('enterName')" />
</a-form-model-item>
<a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'">
<a-input v-model="form.name" :placeholder="$t('enterName')" /> <a-input v-model="form.name" :placeholder="$t('enterName')" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item :label="$t('DataValue')" prop="itemValue"> <a-form-model-item :label="$t('DataValue')" prop="itemValue">
@@ -102,6 +105,10 @@
newVisible:false, newVisible:false,
rules:{ rules:{
name:[ name:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
],
itemText:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' }, { required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' }, { min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
], ],
@@ -127,17 +134,36 @@
total:0, total:0,
isEdit:false, isEdit:false,
selectedIds:[], //树形选中的id selectedIds:[], //树形选中的id
parentData:[] parentData:[],
editPId:'',
tabletreeDataSource:[]
} }
}, },
watch: { watch: {
parentName(value) { parentName(value) {
console.log(value); console.log(value);
}, },
editPId(){
this.parentData=this.getParents
},
}, },
mounted() { mounted() {
this.loadData() this.loadData()
}, },
computed:{
//获取父级名称
getParents(){
let parents=[]
if(this.tabletreeDataSource&&this.tabletreeDataSource.length>0){
this.tabletreeDataSource.forEach((item)=>{
if(item.pid=='0'&&item.id!=this.editPId){
parents.push(item)
}
})
}
return parents
},
},
methods:{ methods:{
//获取列表数据 //获取列表数据
loadData(){ loadData(){
@@ -164,25 +190,16 @@
isTagDict:1 isTagDict:1
}).then(res=>{ }).then(res=>{
let parentNode=[] let parentNode=[]
let tabletreeData=[...res.result] this.tabletreeDataSource=[...res.result]
let data = this.toTree(tabletreeData) let data = this.toTree(this.tabletreeDataSource)
this.tabletreeData=data this.tabletreeData=data
this.parentData=this.getParents(tabletreeData) this.parentData=this.getParents
this.dataFlag=true this.dataFlag=true
}) })
} }
}, },
//获取父级名称
getParents(data){
let parents=[]
data.forEach((item)=>{
if(item.pid=='0'){
parents.push(item)
}
})
return parents
},
//将数据拼成树形结构 //将数据拼成树形结构
toTree(config) { toTree(config) {
config.forEach(function(item) { config.forEach(function(item) {
@@ -313,6 +330,8 @@
//树状编辑 //树状编辑
editTreeDict(val,form){ editTreeDict(val,form){
this.title=this.$t('edit') this.title=this.$t('edit')
this.editPId=form.id
// console.log('dictId',form)
this.isEdit=true this.isEdit=true
this.form={...form} this.form={...form}
if(form.pid=='0'){ if(form.pid=='0'){
@@ -128,6 +128,7 @@
} }
.page{ .page{
margin-top: 20px; margin-top: 20px;
text-align: right;
} }
} }
</style> </style>
@@ -133,7 +133,7 @@
deleteAction(`sys/category/delete`, { id: val.id }).then((res) => { deleteAction(`sys/category/delete`, { id: val.id }).then((res) => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')); this.$message.success(this.$t('OperationSuccessful'));
this.$emit('ok') this.$emit('ok',this.queryParams)
}else{ }else{
this.$message.warning(this.$t('operationFailed')); this.$message.warning(this.$t('operationFailed'));
} }
@@ -293,6 +293,7 @@
.tree-table{ .tree-table{
.page{ .page{
margin-top: 20px; margin-top: 20px;
text-align: right;
} }
} }
@@ -11,9 +11,9 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"> @change="handleTableChange">
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="editVisible(record.id)" v-if="!record.is_read_only">{{$t('edit')}}</a> <a @click="editVisible(record.id)" v-if="record.isReadOnly==0">{{$t('edit')}}</a>
<a-divider type="vertical" v-if="!record.is_read_only" /> <a-divider type="vertical" v-if="record.isReadOnly==0" />
<a class="table-del" @click="deleteVisible(record.id)">{{$t('delete')}}</a> <a class="table-del" v-if="record.isReadOnly==2||record.isReadOnly==0" @click="deleteVisible(record.id)">{{$t('delete')}}</a>
</span> </span>
</a-table> </a-table>
<div class="page" v-if="tableData.length > 0"> <div class="page" v-if="tableData.length > 0">
@@ -50,10 +50,14 @@
props:{ props:{
tableData:Array, tableData:Array,
columns:Array, columns:Array,
total:Number total:Number,
parm:Object
}, },
mounted() { mounted() {
this.queryParams.pageNo=this.parm.pageNo
this.queryParams.pageSize=this.parm.pageSize
// console.log('colum',this.tableData,this.columns) // console.log('colum',this.tableData,this.columns)
console.log('query',this.queryParams)
}, },
methods:{ methods:{
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
@@ -90,6 +94,7 @@
} }
.page{ .page{
margin-top: 20px; margin-top: 20px;
text-align: right;
} }
} }
</style> </style>
@@ -111,8 +111,8 @@
columns: [ columns: [
{ {
title: this.$t('LabelName'), title: this.$t('LabelName'),
dataIndex: 'dict_name', dataIndex: 'dictName',
key: 'dict_name', key: 'dictName',
align: "center", align: "center",
width: 100, width: 100,
}, },
@@ -120,7 +120,7 @@
title: this.$t('LabelType'), title: this.$t('LabelType'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'attribute_type_name', dataIndex: 'attributeType_dictText',
}, },
{ {
title: this.$t('describe'), title: this.$t('describe'),
@@ -170,7 +170,7 @@
getAction(`sys/dict/page`,params).then(res=>{ getAction(`sys/dict/page`,params).then(res=>{
if(res.success){ if(res.success){
this.total=res.result.total this.total=res.result.total
this.tableData=[...res.result] this.tableData=[...res.result.records]
} }
}) })
}, },
@@ -328,7 +328,7 @@
} }
.page{ .page{
margin-top: 20px; margin-top: 20px;
text-align: right;
} }
} }
.type-popover{ .type-popover{
@@ -44,7 +44,7 @@
<a-spin :spinning="spinning" tip="Loading..."> <a-spin :spinning="spinning" tip="Loading...">
<a-tabs default-active-key="1" @change="callbackTab"> <a-tabs default-active-key="1" @change="callbackTab">
<a-tab-pane key="1" :tab="$t('DocumentLibrary')"> <a-tab-pane key="1" :tab="$t('DocumentLibrary')">
<tabTable :tableData="tableData" :columns="taglabColumns" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable> <tabTable v-if="spinning==false" :tableData="tableData" :columns="taglabColumns" :parm="queryParam" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>
</a-tab-pane> </a-tab-pane>
<!-- <a-tab-pane key="2" :tab="$t('DocumentSplitting')" force-render>--> <!-- <a-tab-pane key="2" :tab="$t('DocumentSplitting')" force-render>-->
<!-- <tabTable :tableData="tableData" :columns="taglabColumns" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>--> <!-- <tabTable :tableData="tableData" :columns="taglabColumns" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>-->
@@ -88,37 +88,37 @@
title: this.$t('ChineseName'), title: this.$t('ChineseName'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'db_field_txt', dataIndex: 'dbFieldTxt_dictText',
}, },
{ {
title: this.$t('enName'), title: this.$t('enName'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'db_field_en_name', dataIndex: 'dbFieldEnName_dictText',
}, },
{ {
title: this.$t('AttributeType'), title: this.$t('AttributeType'),
align: "center", align: "center",
width: 100, width: 100,
dataIndex: 'item_text', dataIndex: 'fieldShowType_dictText',
}, },
{ {
title: this.$t('FieldLength'), title: this.$t('FieldLength'),
align: "center", align: "center",
width: 80, width: 80,
dataIndex: 'db_length' dataIndex: 'dbLength_dictText'
}, },
{ {
title: this.$t('DisplayOrder'), title: this.$t('DisplayOrder'),
align: "center", align: "center",
width: 80, width: 80,
dataIndex: 'order_num' dataIndex: 'orderNum_dictText'
}, },
{ {
title: this.$t('DisplayArea'), title: this.$t('DisplayArea'),
align: "center", align: "center",
width: 80, width: 80,
dataIndex: 'show_area' dataIndex: 'showAreaName'
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
@@ -212,7 +212,10 @@
postAction(`tag/onlCgformTag/page`,params).then(res=>{ postAction(`tag/onlCgformTag/page`,params).then(res=>{
if(res.success){ if(res.success){
this.total=res.result.total this.total=res.result.total
this.tableData= [ ...res.result] this.tableData= [ ...res.result.records]
this.spinning=false
}else{
this.$message.warning(res.message)
this.spinning=false this.spinning=false
} }
}) })
@@ -279,6 +282,7 @@
if (res.success) { if (res.success) {
if (this.key == 1) { if (this.key == 1) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.queryParam.pageNo=1
this.loadData(1) this.loadData(1)
} else if (this.key == 2) { } else if (this.key == 2) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
@@ -11,6 +11,9 @@
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
> >
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table> </a-table>
<div class="page" v-if="dataSource.length > 0"> <div class="page" v-if="dataSource.length > 0">
<a-pagination <a-pagination
@@ -11,6 +11,9 @@
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
> >
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table> </a-table>
<div class="page" v-if="dataSource.length > 0"> <div class="page" v-if="dataSource.length > 0">
<a-pagination <a-pagination
@@ -11,6 +11,9 @@
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
> >
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table> </a-table>
<div class="page" v-if="dataSource.length > 0"> <div class="page" v-if="dataSource.length > 0">
<a-pagination <a-pagination
@@ -11,6 +11,9 @@
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
> >
<span slot="operation" slot-scope="record">
<a @click="dealWith(record)" style="margin-right:8px">{{$t('Processing')}}</a>
</span>
</a-table> </a-table>
<div class="page" v-if="dataSource.length > 0"> <div class="page" v-if="dataSource.length > 0">
<a-pagination <a-pagination
@@ -11,6 +11,10 @@
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
> >
<span slot="operation" slot-scope="record">
<a @click="dealWith(record)" style="margin-right:8px">{{$t('Processing')}}</a>
<a @click="classDel(record)" style="margin-right:8px">{{$t('deleteLib')}}</a>
</span>
</a-table> </a-table>
<div class="page" v-if="dataSource.length > 0"> <div class="page" v-if="dataSource.length > 0">
<a-pagination <a-pagination
@@ -30,6 +34,7 @@
import { mapMutations, mapActions, mapGetters } from 'vuex' import { mapMutations, mapActions, mapGetters } from 'vuex'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage' import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import moment from 'moment' import moment from 'moment'
import eventBUs from '../../../../../common/event'
export default { export default {
name: 'ProcessCenter', name: 'ProcessCenter',
@@ -117,40 +122,23 @@
...mapGetters(['userInfo']), ...mapGetters(['userInfo']),
onSelectChange() { onSelectChange() {
},
handleCommand(command) {
switch (command[1]) {
case '查看':
this.classAdd(command[0])
break
case '办理':
this.dealWith(command[0])
break
case '删除':
this.classDel(command[0])
break
}
}, },
// 删除 // 删除
classDel(row) { classDel(row) {
this.$confirm('确认删除信息?', '提示', { let _this = this
confirmButtonText: '确定', this.$confirm({
cancelButtonText: '取消', content: _this.$t('ConfirmDelete'),
type: 'warning', onOk() {
confirmButtonClass: 'common-button-primary', deleteAction('task/deleteDraft', { id: row.id }).then((res) => {
roundButton: true if (res.success) {
}).then(() => { _this.$message.success(_this.$t('OperationSuccessful'));
this.$http.get('lawss/activiti/deleteDraft', { id: row.id }, { this.pageNo = 1
_this: this, _this.queryProcess()
loading: 'loading' } else {
}, res => { _this.$message.warning(_this.$t('operationFailed'))
if (res.success) { }
this.$message.success('删除成功') })
this.pageNo = 1 }
this.queryProcess()
} else {
}
})
}) })
}, },
// 查询待办流程 // 查询待办流程
+2 -2
View File
@@ -9,8 +9,8 @@
{{$t('NotificationTime')}}: {{this.$route.query.sendTime}} {{$t('NotificationTime')}}: {{this.$route.query.sendTime}}
</span> </span>
</div> </div>
<div class="box-content"> <div class="box-content" v-html="this.$route.query.msgContentInfo">
{{this.$route.query.msgContentInfo}} <!-- {{this.$route.query.msgContentInfo}}-->
</div> </div>
</div> </div>
</template> </template>
@@ -65,8 +65,8 @@
:loading="loading" :loading="loading"
@change="handleTableChange"> @change="handleTableChange">
<span slot="msgContent" slot-scope="text,scope"> <span slot="msgContent" slot-scope="text,scope">
<a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" @click="msgContentClick(scope)"> <a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" :title="text" @click="msgContentClick(scope)">
{{text}} {{text && text.length > 25?text.slice(0,24)+'...':text}}
</a> </a>
</span> </span>
<span slot="msgCategory" slot-scope="text,scope"> <span slot="msgCategory" slot-scope="text,scope">