合并分支 'feature_dev_20221010_extend' 到 'dev_2nd_period_test'
Feature dev 20221010 extend 查看合并请求 laws-nio/laws-weilai!230
This commit is contained in:
@@ -22,3 +22,8 @@ ADD COLUMN `explanation` varchar(2000) NULL COMMENT '说明' AFTER `project_vers
|
||||
ALTER TABLE `laws_weilai`.`project_library_base`
|
||||
MODIFY COLUMN `software_version` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本' AFTER `explanation`;
|
||||
|
||||
-- 认证参数历史列表添加字段--------2022-11-02 未同步生产环境
|
||||
ALTER TABLE `laws_weilai`.`params_manifest_history`
|
||||
ADD COLUMN `project_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '相关项目版本' AFTER `params_template_name`,
|
||||
ADD COLUMN `explanation` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明' AFTER `project_version`;
|
||||
|
||||
|
||||
+182
-36
@@ -41,7 +41,6 @@ import com.jero.modules.cert.template.service.ICertCategoryParamsInfoPublishEOSe
|
||||
import com.jero.modules.cert.template.service.IParamsInfoPublishEOService;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
|
||||
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||
import com.jero.modules.message.websocket.WebSocket;
|
||||
import com.jero.modules.ocr.service.WebSocketServer;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
@@ -1892,13 +1891,20 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
stringBuilder.append("NIO编号为").append("<span style='color: red'>").append(nioNumber).append("</span>").append("工程接口人没有填写,请填写完工程接口人再进行下发收集。");
|
||||
}
|
||||
|
||||
} else {
|
||||
} else if ("2".equals(type)) {
|
||||
if (CutEnum.EN.getValue().equals(cut)) {
|
||||
stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("<span style='color: red'>").append(stateName).append("</span>").append(",no operation permission for this button.");
|
||||
} else {
|
||||
stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("<span style='color: red'>").append(stateName).append("</span>").append(",没有此按钮的操作权限。");
|
||||
}
|
||||
|
||||
} else if ("3".equals(type)) {
|
||||
if (CutEnum.EN.getValue().equals(cut)) {
|
||||
stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("<span style='color: red'>").append(stateName).append("</span>").append(", fail to import.");
|
||||
} else {
|
||||
stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("<span style='color: red'>").append(stateName).append("</span>").append(",导入失败。");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
msgList.add(stringBuilder.toString());
|
||||
@@ -2447,6 +2453,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
@Override
|
||||
public void exportDre(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request) {
|
||||
OutputStream os = null;
|
||||
FileInputStream fis = null;
|
||||
OutputStream excelOS = null;
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
String fileOriName = "参数项清单导出待填写数据";
|
||||
@@ -2456,6 +2463,13 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
if (StringUtils.isNotEmpty(paramsCollectManifestVO.getExportName())) {
|
||||
fileOriName = paramsCollectManifestVO.getExportName();
|
||||
}
|
||||
//创建临时文件夹
|
||||
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + fileOriName;
|
||||
File nowFile = new File(fileNowPath);
|
||||
if (nowFile.exists()) {
|
||||
nowFile.delete();
|
||||
}
|
||||
nowFile.mkdirs();
|
||||
|
||||
try{
|
||||
String fileName = fileOriName + ".xlsx";
|
||||
@@ -2535,11 +2549,24 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
sheetItems.setColumnWidth(i, 20 * 256); // 设置单元格宽度
|
||||
}
|
||||
|
||||
List<OSSFile> allRelevFileList = new ArrayList<>();
|
||||
Map<String, String> fileNowPathMap = new HashMap<>();
|
||||
|
||||
//放文字内容
|
||||
int allRow = 2;
|
||||
for(int rowNum = 0;rowNum < allParamsInfoList.size(); rowNum++){
|
||||
Map<String, Object> exportDto = allParamsInfoList.get(rowNum);
|
||||
|
||||
// 处理文件
|
||||
List<OSSFile> fileList = (List<OSSFile>) exportDto.get("fileList");
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
allRelevFileList.addAll(fileList);
|
||||
fileList.forEach(file -> {
|
||||
fileNowPathMap.put(file.getId(), fileNowPath + File.separator + exportDto.get("nio_number"));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
allRow++;
|
||||
XSSFRow row1 = sheetItems.createRow(allRow);
|
||||
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++){
|
||||
@@ -2552,13 +2579,29 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
}
|
||||
|
||||
//下载关联文件内容
|
||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
||||
downLoadFileList(allRelevFileList,fileNowPathMap);
|
||||
}
|
||||
|
||||
String repFileName = fileName.replaceAll("/","_");
|
||||
excelOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""+ ReadExcel.encodeFileName(repFileName+".xlsx", request) +"\"");
|
||||
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
|
||||
response.setContentType("application/force-download");
|
||||
response.flushBuffer();
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
workbook.write(excelOS);
|
||||
excelOS.flush();
|
||||
excelOS.close();
|
||||
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
|
||||
fis = new FileInputStream(fileNowPath+".zip");
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e instanceof JeroBootException){
|
||||
throw new JeroBootException(e.getMessage());
|
||||
@@ -2573,6 +2616,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
IOUtils.closeQuietly(fis);
|
||||
try {
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
@@ -2605,8 +2649,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
if(!saveDirectory.isDirectory()){
|
||||
saveDirectory.mkdir();
|
||||
}
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path +File.separator+ file.getOriginalFilename()));
|
||||
try{
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path +File.separator+ file.getOriginalFilename()));
|
||||
//解压缩
|
||||
String zipEntryName = FileUnZip.unZipFiles2(path +File.separator+ file.getOriginalFilename(), path);
|
||||
// 数据相关处理,
|
||||
@@ -2654,27 +2698,36 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
List<Map<String, Object>> datas = result;
|
||||
if(datas!=null &&!datas.isEmpty()){
|
||||
try {
|
||||
int i = 0 ;
|
||||
List<Map<String, Object>> datasUpdate = new ArrayList<>();
|
||||
// int i = 0 ;
|
||||
// List<Map<String, Object>> datasUpdate = new ArrayList<>();
|
||||
//处理空行数据,当读取exceL出现空行过多时,空行数为20以上时中断读取,将数据清洗为新的list
|
||||
for(Map<String, Object> importDto :datas){
|
||||
if(i>20){
|
||||
break;
|
||||
}
|
||||
//判断此行数据是否全部为空
|
||||
if(checkObjAllFieldsIsNull(importDto)){
|
||||
i++;
|
||||
//是则不读取
|
||||
continue;
|
||||
}
|
||||
i = 0;
|
||||
datasUpdate.add(importDto);
|
||||
}
|
||||
// for(Map<String, Object> importDto :datas){
|
||||
// if(i>20){
|
||||
// break;
|
||||
// }
|
||||
// //判断此行数据是否全部为空
|
||||
// if(checkObjAllFieldsIsNull(importDto)){
|
||||
// i++;
|
||||
// //是则不读取
|
||||
// continue;
|
||||
// }
|
||||
// i = 0;
|
||||
// datasUpdate.add(importDto);
|
||||
// }
|
||||
String unzipfilepath = zipEntryName;
|
||||
Result<?> message = importData(datasUpdate,unzipfilepath,cut,paramsManifestId);
|
||||
Result<?> message = importData(datas,unzipfilepath,cut,paramsManifestId);
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return message;
|
||||
} catch (NullPointerException e) {
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
resultMsg = "读取失败,请严格按照模板文件导入数据";
|
||||
}else{
|
||||
resultMsg = "The data fails to be read. Import data strictly according to the template file";
|
||||
}
|
||||
return Result.error(1, resultMsg);
|
||||
} catch (Exception e) {
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
@@ -2738,6 +2791,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
}
|
||||
//将导入数据循环合并整理后 新增至相应表
|
||||
List<ParamsConfigDataEO> configDataList = (List<ParamsConfigDataEO>) map.get("configDataList");
|
||||
List<Map<String, String>> notImportNioNumberList = (List<Map<String, String>>) map.get("notImportNioNumberList");
|
||||
|
||||
for (ParamsConfigDataEO importDto : configDataList) {
|
||||
//判断此行数据是否全部为空,是则不读取
|
||||
@@ -2776,13 +2830,19 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
String msg = "";
|
||||
if (isSuccess) {
|
||||
int countSuccess = configDataList.size();
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
msg = "成功导入" + countSuccess + "条";
|
||||
if (CollectionUtil.isNotEmpty(notImportNioNumberList)) {
|
||||
List<String> msgList = getMsgOfIssueCollection(notImportNioNumberList, cut, "3");
|
||||
return Result.OK(null, msgList);
|
||||
|
||||
} else {
|
||||
msg = "import " + countSuccess + " datas successfully";
|
||||
int countSuccess = configDataList.size();
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
msg = "成功导入" + countSuccess + "条";
|
||||
} else {
|
||||
msg = "import " + countSuccess + " datas successfully";
|
||||
}
|
||||
return Result.OK(msg, null);
|
||||
}
|
||||
return Result.OK(msg, null);
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
msg = "导入失败";
|
||||
@@ -3172,6 +3232,11 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
}
|
||||
}
|
||||
|
||||
List<ParamsConfigEO> paramsConfigEOList = paramsConfigEOService.queryList(paramsManifestId); // 查询所有配置列
|
||||
|
||||
List<String> paramsConfigIdList = paramsConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
|
||||
List<ParamsConfigDataEO> paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(paramsConfigIdList); // 查询所有配置数据
|
||||
|
||||
Map<String,String> isMustMap = ParamsIsMustEnum.toMapForExport(cut);
|
||||
Map<String,String> controlVerifyMap = ControlVerifyEnum.toMapForExport(cut);
|
||||
Map<String,String> controlTypeMap = ControlTypeEnum.toMapForExport(cut);
|
||||
@@ -3182,11 +3247,53 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
String controlType = (String) record1.get("control_type");
|
||||
String controlVerify = (String) record1.get("control_verify");
|
||||
String isMust = (String) record1.get("is_must");
|
||||
String paramsCollectManifestId = (String) record1.get("id");
|
||||
String nioNumber = (String) record1.get("nio_number");
|
||||
|
||||
record1.put("is_must", isMustMap.get(isMust));
|
||||
record1.put("control_type", controlTypeMap.get(controlType));
|
||||
record1.put("control_verify", controlVerifyMap.get(controlVerify));
|
||||
|
||||
// 配置列
|
||||
if (CollectionUtil.isNotEmpty(paramsConfigEOList)) {
|
||||
List<OSSFile> fileList = new ArrayList<>();
|
||||
|
||||
paramsConfigEOList.forEach(paramsConfigEO -> { // 参数配置
|
||||
|
||||
String paramsConfigId = paramsConfigEO.getId();
|
||||
List<ParamsConfigDataEO> paramsConfigDataEOS = paramsConfigDataEOList.stream().filter(e-> paramsConfigId.equals(e.getParamsConfigId()) && paramsCollectManifestId.equals(e.getParamsCollectManifestId())).collect(Collectors.toList()); // 参数配置数据
|
||||
StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据
|
||||
if (CollectionUtil.isNotEmpty(paramsConfigDataEOS)) {
|
||||
ParamsConfigDataEO paramsConfigDataEO = paramsConfigDataEOS.get(0);
|
||||
if (StringUtils.isNotEmpty(paramsConfigDataEO.getTextData())) {
|
||||
configDataBuilder.append(paramsConfigDataEO.getTextData()).append("#");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(paramsConfigDataEO.getPullData())) {
|
||||
configDataBuilder.append(paramsConfigDataEO.getPullData().replaceAll(",", "!")).append("#");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(paramsConfigDataEO.getFileConnectId())) {
|
||||
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsConfigDataEO.getFileConnectId());
|
||||
if (CollectionUtil.isNotEmpty(ossFileList)) {
|
||||
configDataBuilder.append(nioNumber).append("/").append(ossFileList.get(0).getFileName()).append("#");
|
||||
|
||||
fileList.addAll(ossFileList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String configData = configDataBuilder.toString();
|
||||
if (configData.contains("#")) {
|
||||
configData = configData.substring(0, configData.lastIndexOf("#"));
|
||||
}
|
||||
|
||||
record1.put(paramsConfigEO.getId(), configData);
|
||||
});
|
||||
|
||||
record1.put("fileList", fileList);
|
||||
}
|
||||
|
||||
|
||||
result.add(record1);
|
||||
}
|
||||
return result;
|
||||
@@ -3574,9 +3681,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
}
|
||||
}
|
||||
// 当前行所有单元格均不为空时
|
||||
if (a != cellLength && row != null) {
|
||||
// if (a != cellLength && row != null) {
|
||||
list.add(map);
|
||||
}
|
||||
// }
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -3597,12 +3704,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
List<String> configIdList = paramsConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList());
|
||||
List<ParamsConfigDataEO> paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(configIdList);
|
||||
|
||||
Map<String, String> controlTypeMap = ControlTypeEnum.toMapForImport(cut);
|
||||
Map<String, String> controlVerifyMap = ControlVerifyEnum.toMapForImport(cut);
|
||||
Map<String, String> paramsIsMustMap = ParamsIsMustEnum.toMapForImport(cut);
|
||||
|
||||
//存放数据验证结果信息
|
||||
List<ParamsConfigDataEO> configDataList = new ArrayList<>();
|
||||
List<String> verifyNioNumber = new ArrayList<>();
|
||||
List<Map<String, String>> notImportNioNumberList = new ArrayList<>();
|
||||
List<String> stringMessage = new ArrayList<>();
|
||||
int i = 3; //记录行号
|
||||
//循环验证数据
|
||||
@@ -3618,10 +3723,50 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
String nioNumber = (String) dto.get("nio_number");
|
||||
String controlType = controlTypeMap.get((String) dto.get("control_type"));
|
||||
String controlVerify = controlVerifyMap.get((String) dto.get("control_verify"));
|
||||
String controlValues = (String) dto.get("control_values");
|
||||
String isMust = paramsIsMustMap.get((String) dto.get("is_must"));
|
||||
if (StringUtils.isBlank(nioNumber)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<ParamsCollectManifestEO> listPCM = paramsCollectManifestEOList.stream().filter(e-> nioNumber.equals(e.getNioNumber())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(listPCM)) {
|
||||
if (CutEnum.EN.getValue().equals(cut)) {
|
||||
errorMsg += "NIO Number can not find; ";
|
||||
} else{
|
||||
errorMsg += "NIO编号不存在;";
|
||||
}
|
||||
countError++;
|
||||
stringMessage.add(errorMsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!verifyNioNumber.contains(nioNumber)) {
|
||||
verifyNioNumber.add(nioNumber);
|
||||
} else{
|
||||
if (CutEnum.EN.getValue().equals(cut)) {
|
||||
errorMsg += "NIO Number is repeat; ";
|
||||
} else{
|
||||
errorMsg += "NIO编号重复;";
|
||||
}
|
||||
countError ++;
|
||||
stringMessage.add(errorMsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
ParamsCollectManifestEO paramsCollectManifestEO = listPCM.get(0);
|
||||
String state = paramsCollectManifestEO.getState();
|
||||
if (!CollectManifestStateEnum.WAIT_FILL.getValue().equals(state) && !CollectManifestStateEnum.CERT_BACK.getValue().equals(state)) {
|
||||
Map<String, String> msgMap = new HashMap<>();
|
||||
msgMap.put("nioNumber", nioNumber);
|
||||
msgMap.put("state", state);
|
||||
msgMap.put("type", "3");
|
||||
notImportNioNumberList.add(msgMap);
|
||||
continue;
|
||||
}
|
||||
|
||||
String controlType = paramsCollectManifestEO.getControlType();
|
||||
String controlVerify = paramsCollectManifestEO.getControlVerify();
|
||||
String controlValues = paramsCollectManifestEO.getControlValues();
|
||||
String isMust = paramsCollectManifestEO.getIsMust();
|
||||
for (Map.Entry<String, Object> entry : dto.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = (String) entry.getValue();
|
||||
@@ -3855,6 +4000,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
if (stringMessage.isEmpty()) {
|
||||
map.put("result", true);
|
||||
map.put("configDataList", configDataList);
|
||||
map.put("notImportNioNumberList", notImportNioNumberList);
|
||||
map.put("message", "");
|
||||
} else {
|
||||
map.put("result", false);
|
||||
|
||||
@@ -1359,5 +1359,6 @@ module.exports = {
|
||||
Topping:'Topping',
|
||||
cancelTopping:'Cancel Topping',
|
||||
relatedProjectVersion:'Related project version',
|
||||
Importfailure:'Import failure',
|
||||
CuiBan:'CuiBan',
|
||||
}
|
||||
@@ -1460,5 +1460,6 @@ module.exports = {
|
||||
Topping:'置顶',
|
||||
cancelTopping:'取消置顶',
|
||||
relatedProjectVersion:'相关项目版本',
|
||||
Importfailure:'导入失败',
|
||||
CuiBan:'催办',
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-upload name="file" :showUploadList="false"
|
||||
class="upload-text"
|
||||
:multiple="false" :headers="tokenHeader"
|
||||
:action="importUrl"
|
||||
@change="handleImport"
|
||||
:accept="accept">
|
||||
<a-icon type="import" :rotate="270"/>
|
||||
{{$t('import')}}
|
||||
</a-upload>
|
||||
<div class="loading-box" v-if="spinning">
|
||||
<div class="loading-content">
|
||||
<a-icon class="loading" type="loading"/>
|
||||
<div class="loading-tips">
|
||||
{{this.$t('Importing')}}...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 错误数据提示-->
|
||||
<a-modal
|
||||
:title="$t('Importfailure')"
|
||||
:width="860"
|
||||
v-model="visibleoperationFailed"
|
||||
:maskClosable="false"
|
||||
:footer="null"
|
||||
>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<div>
|
||||
<span style='font-size: 16px;margin-bottom: 20px;' v-for='(item,key) in operationFailedValue'>
|
||||
<span v-html="item"></span>
|
||||
</span>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<div class="imports-footer">
|
||||
<div class="imports-footer-wrap">
|
||||
<a-button class="imports-btn" type="primary" @click="cancleoperationFailed">{{$t('cancel')}}</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import {ACCESS_TOKEN} from '@/store/mutation-types'
|
||||
import eventBUs from '../../common/event'
|
||||
import {Modal} from 'ant-design-vue'
|
||||
import store from '@/store'
|
||||
export default {
|
||||
name: 'index',
|
||||
props: {
|
||||
url: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
//判断当前文档库还是其余的页面
|
||||
isTrue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
accept: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
projectId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
dummyInventoryBaseId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
paramsTemplateId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
paramsManifestId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
projectLibraryId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
|
||||
spinning: false,
|
||||
operationFailedValue:[],
|
||||
visibleoperationFailed: false, // 数据失败的弹框
|
||||
cut: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importUrl() {
|
||||
if (this.projectId) {
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut + '&projectId=' + this.projectId
|
||||
} else if (this.dummyInventoryBaseId) {
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut + '&dummyInventoryBaseId=' + this.dummyInventoryBaseId
|
||||
} else if (this.paramsTemplateId) {
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut + '¶msTemplateId=' + this.paramsTemplateId
|
||||
} else if (this.projectLibraryId) {
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut + '&projectLibraryId=' + this.projectLibraryId
|
||||
} else if (this.paramsManifestId) {
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut + '¶msManifestId=' + this.paramsManifestId
|
||||
}
|
||||
return window._CONFIG['domianURL'] + '/' + this.url.importZipUrl + '?cut=' + this.cut
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let long = localStorage.getItem('language')
|
||||
this.cut = ''
|
||||
if (long && long == 'zh-cn') {
|
||||
this.cut = 'cn'
|
||||
} else if (long && long == 'en-us') {
|
||||
this.cut = 'en'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleImport(info) {
|
||||
this.spinning = true
|
||||
if (info.file.status !== 'uploading') {
|
||||
this.$emit('getList')
|
||||
}
|
||||
|
||||
if (info.file.status === 'done') {
|
||||
if (info.file.response.success) {
|
||||
if (info.file.response.code === 201) {
|
||||
let {message} = info.file.response
|
||||
let {name} = info.file
|
||||
let content = []
|
||||
if (message) {
|
||||
message = message.split('</br>')
|
||||
message.forEach(res => {
|
||||
if (res) {
|
||||
content.push( < div > {res} < /div>)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$warning({
|
||||
title: name,
|
||||
content: (
|
||||
< div >
|
||||
{content}
|
||||
< /div>
|
||||
)
|
||||
})
|
||||
} else {
|
||||
if (this.isTrue) {
|
||||
this.$emit('getList')
|
||||
} else {
|
||||
eventBUs.$emit('searchReset')
|
||||
}
|
||||
console.log(info.file.response.message)
|
||||
if(info.file.response.message == null){
|
||||
console.log(111)
|
||||
this.operationFailedValue = info.file.response.result
|
||||
this.visibleoperationFailed = true
|
||||
}else{
|
||||
this.$message.success(info.file.response.message || `${info.file.name} 文件导入成功`)
|
||||
}
|
||||
}
|
||||
this.spinning = false
|
||||
} else {
|
||||
let data = info.file.response
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
|
||||
this.spinning = false
|
||||
Modal.error({
|
||||
title: '登录已过期',
|
||||
content: '很抱歉,登录已过期,请重新登录',
|
||||
okText: '重新登录',
|
||||
mask: false,
|
||||
onOk: () => {
|
||||
store.dispatch('Logout').then(() => {
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
let {message} = info.file.response
|
||||
let {name} = info.file
|
||||
let content = []
|
||||
if (message) {
|
||||
message = message.split('</br>')
|
||||
message.forEach(res => {
|
||||
if (res) {
|
||||
content.push( < div > {res} < /div>)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$warning({
|
||||
title: name,
|
||||
content: (
|
||||
< div >
|
||||
{content}
|
||||
< /div>
|
||||
)
|
||||
})
|
||||
this.spinning = false
|
||||
}
|
||||
} else if (info.file.status === 'error') {
|
||||
if (info.file.response.status === 500) {
|
||||
let data = info.file.response
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
|
||||
Modal.error({
|
||||
title: '登录已过期',
|
||||
content: '很抱歉,登录已过期,请重新登录',
|
||||
okText: '重新登录',
|
||||
mask: false,
|
||||
onOk: () => {
|
||||
store.dispatch('Logout').then(() => {
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.spinning = false
|
||||
} else {
|
||||
this.$message.error(`文件导入失败: ${info.file.msg} `)
|
||||
this.spinning = false
|
||||
}
|
||||
}
|
||||
},
|
||||
// 错误数据的弹框
|
||||
cancleoperationFailed() {
|
||||
this.operationFailedValue = []
|
||||
this.visibleoperationFailed = false
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.upload-text .ant-upload {
|
||||
font-size: 14px !important;
|
||||
font-weight: 400 !important;
|
||||
color: #040B29 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
.loading-box {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9999900;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
border-radius: 8px;
|
||||
user-select: none;
|
||||
|
||||
.loading-content {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
color: #21c9cc;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
|
||||
.loading {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.spin-loading {
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
|
||||
.loading-tips {
|
||||
margin-top: 5px;
|
||||
font-size: 16px;
|
||||
color: #21c9cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -463,7 +463,7 @@
|
||||
import AdjustareaSofrespon from '@/components/AdjustareaSofrespon/index'
|
||||
import ReferenceParameter from '@/components/ReferenceParameter/index'
|
||||
import AssignedBy from '@/components/AssignedBy/index'
|
||||
import ImportFileOnlyList from '@/components/ImportFileOnlyList/index'
|
||||
import ImportFileOnlyList from '@/components/ImportFileOnlyListtag/index'
|
||||
import axios from 'axios'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import Vue from 'vue'
|
||||
@@ -935,7 +935,7 @@
|
||||
ids: this.selectedRowKeys.join(','),
|
||||
exportName:this.$route.query.projectName + '(' + this.$route.query.title + ')'
|
||||
}
|
||||
let name = this.$route.query.projectName + '(' + this.$route.query.title + ')' + '.xlsx'
|
||||
let name = this.$route.query.projectName + '(' + this.$route.query.title + ')' + '.zip'
|
||||
downloadFile('/params/collectManifest/exportDre', name , query , this.selectClear)
|
||||
},
|
||||
getList(){
|
||||
|
||||
Reference in New Issue
Block a user