From 247aa6397ebdb5249a1213af11aaaf560568b0c3 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期五, 02 八月 2024 15:43:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java | 316 +++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue | 483 +++++++++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue | 326 +++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java | 40 + Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java | 1 Source/plt-web/plt-web-ui/src/api/modeling/version/api.js | 57 + Source/plt-web/plt-web-ui/src/api/modeling/linkType/api.js | 17 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java | 112 +++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java | 6 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 6 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue | 36 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java | 32 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue | 2 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java | 78 ++ Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js | 8 Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js | 49 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java | 18 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue | 311 +++++++++ 18 files changed, 1,792 insertions(+), 106 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java index 926e593..461a6c1 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java @@ -64,7 +64,6 @@ */ private Date ts; - /** * 鍒涘缓浜� */ diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java new file mode 100644 index 0000000..3b628cf --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java @@ -0,0 +1,78 @@ +package com.vci.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import com.vci.starter.web.pagemodel.BaseModelVO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 灞炴�ф睜瀵煎叆瀵硅薄 + * @author ludc + * @date 2024/7/19 11:11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OsRevisionRulePO extends BaseModelVO { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = -2239512786206928201L; + + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 灞炴�ц嫳鏂囧悕绉� + */ + @ExcelColumn(value="鍚嶇О",nullable = false) + private String id; + + /** + * 鏍囩 + */ + @ExcelColumn(value="鏍囩") + private String name; + + /** + * 璺宠穬瀛楃 + */ + @ExcelColumn(value="璺宠穬瀛楃") + private String jumpCharacter; + + /** + * 鍒濆鍊� + */ + @ExcelColumn(value="鍒濆鍊�",nullable = false) + private String initialValue; + + /** + * 姝ラ暱 + */ + @ExcelColumn(value="姝ラ暱",nullable = false) + private String stepLength; + + /** + * 鍓嶇紑 + */ + @ExcelColumn(value="鍓嶇紑") + private String prefixion; + + /** + * 鍚庣紑 + */ + @ExcelColumn(value="鍚庣紑") + private String suffix; + + /** + * 鎻忚堪 + */ + @ExcelColumn(value="鎻忚堪") + private String description; + +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java index c443178..8896d9b 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java @@ -7,7 +7,7 @@ import lombok.NoArgsConstructor; /** - * 灞炴�ф睜瀵煎叆瀵硅薄 + * 鐘舵�佹睜瀵煎叆瀵硅薄 * @author ludc * @date 2024/7/19 11:11 */ @@ -42,8 +42,8 @@ /** * 灞炴�х被鍨� */ - @ExcelColumn(value="鍥剧墖(璺緞)") - private String imagePath; + //@ExcelColumn(value="鍥剧墖(璺緞)") + //private String imagePath; /** * 鎻忚堪 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java index 7e178b4..7b4c389 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java @@ -1,15 +1,29 @@ package com.vci.web.controller; +import com.vci.constant.FrameWorkLangCodeConstant; import com.vci.dto.OsRevisionRuleDTO; import com.vci.pagemodel.OsRevisionRuleVO; import com.vci.starter.web.annotation.controller.VciUnCheckRight; +import com.vci.starter.web.annotation.log.VciBusinessLog; +import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.ControllerUtil; +import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.service.OsRevisionRuleServiceI; +import com.vci.web.util.Func; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.Date; +import java.util.List; /** * 鐗堟湰瑙勫垯鎺у埗鍣� @@ -33,7 +47,6 @@ * @return */ @GetMapping("/getVersionRuleAllList") - @VciUnCheckRight public BaseResult getVersionRuleAllList(){ try { return BaseResult.dataList(revisionRuleServiceI.selectAllRevision()); @@ -51,7 +64,6 @@ * @return */ @GetMapping("/getUsedVersionRuleList") - @VciUnCheckRight public BaseResult getUsedVersionRuleList(String vrName){ try { return BaseResult.dataList(revisionRuleServiceI.getUsedVersionRuleList(vrName)); @@ -69,7 +81,6 @@ * @return */ @PostMapping("/addVersionRule") - @VciUnCheckRight public BaseResult addVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ try { return revisionRuleServiceI.addVersionRule(osRevisionRuleDTO) ? BaseResult.success("鐗堟湰瑙勫垯娣诲姞鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯娣诲姞澶辫触锛�"); @@ -86,17 +97,104 @@ * @param osRevisionRuleDTO 鐗堟湰瑙勫垯鏁版嵁浼犺緭瀵硅薄 * @return */ - @PostMapping("/updateVersionRule") - @VciUnCheckRight + @PutMapping("/updateVersionRule") public BaseResult updateVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ try { - return revisionRuleServiceI.updateVersionRule(osRevisionRuleDTO) ? BaseResult.success("鐗堟湰瑙勫垯娣诲姞鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯娣诲姞澶辫触锛�"); + return revisionRuleServiceI.updateVersionRule(osRevisionRuleDTO) ? BaseResult.success("鐗堟湰瑙勫垯淇敼鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯淇敼澶辫触锛�"); }catch (Exception e) { e.printStackTrace(); - String exceptionMessage = "澧炲姞灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "淇敼鐗堟湰瑙勫垯鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } + /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS 鐗堟湰瑙勫垯鏁版嵁浼犺緭瀵硅薄 + * @return + */ + @DeleteMapping("/deleteVersionRule") + public BaseResult deleteVersionRule(@RequestBody List<OsRevisionRuleDTO> osRevisionRuleDTOS){ + try { + return revisionRuleServiceI.deleteVersionRule(osRevisionRuleDTOS) ? BaseResult.success("鐗堟湰瑙勫垯鍒犻櫎鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯鍒犻櫎澶辫触锛�"); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒犻櫎鐗堟湰瑙勫垯鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑瑙勫垯鑻辨枃鍚嶇О + * @param response + */ + @GetMapping( "/exportVersionRule") + @VciBusinessLog(operateName = "瀵煎嚭鐗堟湰瑙勫垯") + public void exportVersionRule(String exportFileName,String vrNames, HttpServletResponse response){ + try { + String excelPath = revisionRuleServiceI.exportVersionRule(exportFileName,vrNames,false); + ControllerUtil.writeFileToResponse(response,excelPath); + } catch (Exception e) { + String msg = "瀵煎嚭鐗堟湰瑙勫垯鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + try { + //鍑洪敊鏃� + e.printStackTrace(); + ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + } + + /** + * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘 + * @param exportFileName + * @param response + */ + @GetMapping( "/downloadAttributeTemplate") + @VciBusinessLog(operateName = "瀵煎嚭鐗堟湰瑙勫垯") + public void downloadVersionRuleTemplate(String exportFileName, HttpServletResponse response){ + try { + String excelPath = revisionRuleServiceI.downloadVersionRuleTemplate(exportFileName); + ControllerUtil.writeFileToResponse(response,excelPath); + } catch (Exception e) { + String msg = "涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + try { + //鍑洪敊鏃� + e.printStackTrace(); + ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + } + + /** + * 瀵煎叆鐗堟湰瑙勫垯 + * @param file + * @return + */ + @PostMapping("/importVersionRules") + @VciBusinessLog(operateName = "瀵煎叆鐗堟湰瑙勫垯") + public BaseResult importVersionRules(MultipartFile file){ + String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); + File file1 = new File(excelFileName); + try { + file.transferTo(new File(excelFileName)); + if (file != null) { + return revisionRuleServiceI.importVersionRules(file1); + } else { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + }finally { + file1.delete(); + } + } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java index 6c3dfb1..c301a49 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java @@ -4,7 +4,9 @@ import com.vci.corba.omd.vrm.VersionRule; import com.vci.dto.OsRevisionRuleDTO; import com.vci.pagemodel.OsRevisionRuleVO; +import com.vci.starter.web.pagemodel.BaseResult; +import java.io.File; import java.util.Collection; import java.util.List; import java.util.Map; @@ -43,6 +45,13 @@ boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS + * @return + */ + boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException; + + /** * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� * @param versionRules 鏁版嵁瀵硅薄 * @return 鏄剧ず瀵硅薄 @@ -64,10 +73,41 @@ OsRevisionRuleVO getRevisionRuleById(String id); /** + * 浣跨敤澶氫釜缂栧彿鑾峰彇瑙勫垯鐨勫�� + * @param vrIdList 缂栧彿 + * @return 鏄剧ず瀵硅薄 + */ + List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList); + + /** * 鏌ヨ搴旂敤鑼冨洿 * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О * @return */ List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException; + /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑鐗堟湰瑙勫垯鍚嶇О + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� + * @return + */ + String exportVersionRule(String exportFileName,String vrNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException; + + /** + * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘 + * @param exportFileName + * @return + * @throws PLException + */ + String downloadVersionRuleTemplate(String exportFileName) throws Exception; + + /** + * 瀵煎叆鐗堟湰瑙勫垯 + * @param file + * @return + */ + BaseResult importVersionRules(File file) throws Exception; + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java index a4e6359..3af2c48 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java @@ -481,8 +481,7 @@ checkName(osAttributeDTO.getId()); //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰� checkDefValue(osAttributeDTO); - //dto瀵硅薄杞崲涓哄瓨鍌ㄦ墍闇�瀵硅薄 - osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); + //osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO); return platformClientUtil.getAttributeService().addAttributeDef(attributeDef); } @@ -695,7 +694,7 @@ } //妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓� if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){ - throw new PLException("500",new String[]{"灞炴�у悕绉板湪绯荤粺涓凡瀛樺湪!"}); + throw new PLException("500",new String[]{"灞炴�у悕绉般��" + abName + "銆戝湪绯荤粺涓凡瀛樺湪!"}); } } @@ -890,8 +889,8 @@ excelDataList.add(new WriteExcelData(0,index, columns.get(index))); } //鎸夌収灞炴�у悕鏌ヨ灞炴�э紝鐒跺悗澶勭悊灞炴�у鍑� - List<String> enumNameList = Func.toStrList(attrNames); - List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(enumNameList); + List<String> attrameList = Func.toStrList(attrNames); + List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(attrameList); if(Func.isEmpty(osAttributeVOS)){ excelDataList.add(new WriteExcelData(1,1, "鏍规嵁灞炴�у悕绉版湭鏌ヨ鍒板睘鎬т俊鎭紝璇峰埛鏂板悗灏濊瘯閲嶆柊瀵煎嚭锛�")); }else{ @@ -1018,10 +1017,9 @@ List<OsAttributeDTO> dtoList = new ArrayList<>(); //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 poList.stream().forEach(osAttributePO -> { if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖ - throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宔numnameerror"); + throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宎ttrnameerror"); }else if(Func.isBlank(osAttributePO.getAttributeDataType())){ throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror"); }else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲� @@ -1037,7 +1035,7 @@ //灞炴�у悕excel涓垽閲嶅鐞� excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex()); OsAttributeDTO osAttributeDTO = new OsAttributeDTO(); - //鏌ヨ鏋氫妇鏄惁瀛樺湪锛屽~鍐欎簡鏋氫妇浣嗘病濉啓鍙栧�艰寖鍥达紝杩欐椂鍊欑洿鎺ヤ娇鐢ㄦ灇涓鹃」鍊间綔涓洪粯璁ょ殑range + //鏌ヨ灞炴�ф槸鍚﹀瓨鍦紝濉啓浜嗘灇涓句絾娌″~鍐欏彇鍊艰寖鍥达紝杩欐椂鍊欑洿鎺ヤ娇鐢ㄦ灇涓鹃」鍊间綔涓洪粯璁ょ殑range if(Func.isNotBlank(osAttributePO.getEnumId()) && Func.isBlank(osAttributePO.getRange())){ try { OsEnumVO enumVO = enumService.getEnumTypeById(osAttributePO.getEnumId()); @@ -1075,7 +1073,7 @@ checkDefValue(osAttributeDTO); } catch (PLException e) { e.printStackTrace(); - throw new VciBaseException(e.getMessage()); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); } dtoList.add(osAttributeDTO); }); @@ -1098,7 +1096,7 @@ e.printStackTrace(); return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); } - return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + return BaseResult.success("灞炴�у鍏ユ垚鍔燂紒"); } /** diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java index 50292b7..c76ea0b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java @@ -605,7 +605,7 @@ } //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 + //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌虹瓑绛� List<String> finalRepeatEnumId = repeatEnumId; newPOList.stream().forEach(osEnumPO -> { if(Func.isBlank(osEnumPO.getId())){//鏋氫妇鍚� @@ -618,7 +618,7 @@ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕绉板彧鑳戒负鑻辨枃瀛楁瘝"); }else if(excelReapeat.containsKey(osEnumPO.getId())){//鏋氫妇鍚嶈〃鏍间腑鍒ら噸 throw new VciBaseException("绗��"+excelReapeat.get(osEnumPO.getId())+"銆戣鍜岀銆�"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕閲嶅"); - }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2銆佸垽鏂灇涓惧悕鏄惁涓庣郴缁熶腑閲嶅 + }else if (Func.isNotEmpty(finalRepeatEnumId) && finalRepeatEnumId.contains(osEnumPO.getId())){//2銆佸垽鏂灇涓惧悕鏄惁涓庣郴缁熶腑閲嶅 throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛屾灇涓惧悕鍦ㄧ郴缁熶腑宸茬粡瀛樺湪,璇蜂慨鏀�!"); } //鍏堝鏋氫妇鍚峞xcel涓渶瑕佸垽閲嶅鐞� @@ -697,7 +697,7 @@ */ private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){ EnumType enumType = new EnumType(); - enumType.oid = osEnumDTO.getOid(); + //enumType.oid = osEnumDTO.getOid(); //鏋氫妇鍚嶇粺涓�杞垚灏忓啓锛岄伩鍏嶅悗鏈熷嚭鐜板叾浠栭棶棰� enumType.name = osEnumDTO.getId().toLowerCase(Locale.ROOT); enumType.label = osEnumDTO.getName(); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java index 08b20db..904da86 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java @@ -2,24 +2,43 @@ import com.vci.client.mw.ClientSessionUtility; import com.vci.corba.common.PLException; +import com.vci.corba.omd.stm.StatePool; import com.vci.corba.omd.vrm.VersionRule; +import com.vci.dto.OsAttributeDTO; import com.vci.dto.OsRevisionRuleDTO; +import com.vci.dto.OsStatusDTO; +import com.vci.pagemodel.OsAttributeVO; +import com.vci.pagemodel.OsEnumVO; +import com.vci.pagemodel.OsStatusVO; +import com.vci.po.OsAttributePO; +import com.vci.po.OsEnumPO; +import com.vci.po.OsRevisionRulePO; +import com.vci.starter.poi.bo.ReadExcelOption; +import com.vci.starter.poi.bo.WriteExcelData; +import com.vci.starter.poi.bo.WriteExcelOption; +import com.vci.starter.poi.constant.ExcelLangCodeConstant; +import com.vci.starter.poi.util.ExcelUtil; import com.vci.starter.web.annotation.log.VciUnLog; -import com.vci.starter.web.util.VciBaseUtil; -import com.vci.starter.web.util.VciDateUtil; +import com.vci.starter.web.exception.VciBaseException; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.*; import com.vci.pagemodel.OsRevisionRuleVO; -import com.vci.starter.web.util.WebThreadLocalUtil; import com.vci.web.service.OsRevisionRuleServiceI; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.util.HSSFColor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import javax.swing.*; import java.awt.*; +import java.io.File; import java.util.*; import java.util.List; import java.util.stream.Collectors; @@ -44,6 +63,16 @@ @Autowired(required = false) @Lazy private OsRevisionRuleServiceI self; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 蹇呭~鍒� + */ + private List<Integer> ColumnNameisRed = new ArrayList<Integer>(); /** * 鏌ヨ鎵�鏈夌殑鐗堟湰瑙勫垯 @@ -82,7 +111,7 @@ //鐗堟湰瑙勫垯鍚堣妫�楠� this.checkVersionRule(osRevisionRuleDTO); //鏌ラ噸 - VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName()); + VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getId()); //name涓嶄负绌� if(Func.isNotEmpty(vr) && !"".equals(vr.name)){ throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉�!"}); @@ -108,6 +137,50 @@ throw new PLException("500",new String[]{"淇敼鐨勭増鏈鍒欏湪绯荤粺涓笉瀛樺湪!"}); } return platformClientUtil.getVersionService().modifyVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); + } + + /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS + * @return + */ + @Override + public boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException { + VciBaseUtil.alertNotNull(osRevisionRuleDTOS,"寰呭垹闄ょ殑灞炴�у垪琛�"); + //鍒ゆ柇瑕佸垹闄ょ殑鐗堟湰瑙勫垯鏄惁鏈夎寮曠敤 + osRevisionRuleDTOS.stream().forEach(item->{ + String vrName = item.getId(); + try { + String[] btNamesByVerName = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); + if(btNamesByVerName != null && btNamesByVerName.length > 0){ + throw new VciBaseException("璇ョ増鏈凡琚娇鐢ㄤ笉鍏佽鍒犻櫎"); + } + } catch (PLException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + throw new VciBaseException(e.getMessage()); + } + }); + + //骞冲彴鐨刣eleteStatus鏂规硶蹇呬紶涓変釜鍙傛暟锛宱id銆乶ame鍜宼s + List<VersionRule> vrList = new ArrayList<>(); + for(OsRevisionRuleDTO vrDTO : osRevisionRuleDTOS){ + //oid鍜宼s鍒ょ┖ + String oid = vrDTO.getOid(); + //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄� + String id = vrDTO.getId(); + //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠� + Date ts = vrDTO.getTs(); + if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){ + throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"}); + } + VersionRule vr = new VersionRule(); + vr.oid = oid; + vr.name = id; + vr.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); + vrList.add(vr); + } + return platformClientUtil.getVersionService().deleteVersionRules(vrList.toArray(new VersionRule[vrList.size()])); } /** @@ -142,7 +215,7 @@ if(Func.isNotBlank(dto.getPrefixion()) && (dto.getPrefixion().matches(regex3))){ throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘浠ョ┖鏍煎紑澶�"}); } - if (dto.getPrefixion().length() + dto.getPrefixion().length() > 32) { + if (Func.isNotBlank(dto.getPrefixion()) && dto.getPrefixion().length() > 32) { throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘瓒呰繃32涓瓧绗�"}); } //鍚庣紑鐩稿叧鍒ゆ柇 @@ -150,7 +223,7 @@ if(Func.isNotBlank(dto.getSuffix()) && (dto.getSuffix().matches(regex4))){ throw new PLException("500",new String[]{"鍚庣紑涓嶈兘浠ョ┖鏍肩粨灏�"}); } - if (dto.getSuffix().length() + dto.getSuffix().length() > 32) { + if (Func.isNotBlank(dto.getSuffix()) && dto.getSuffix().length() > 32) { throw new PLException("500",new String[]{"鍚庣紑涓嶈兘瓒呰繃32涓瓧绗�"}); } if (dto.getId().length() > 255) { @@ -164,6 +237,7 @@ */ private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){ VersionRule newVR = new VersionRule(); + newVR.oid = osRevisionRuleDTO.getOid(); newVR.name = osRevisionRuleDTO.getId(); newVR.tag = osRevisionRuleDTO.getName(); newVR.description = osRevisionRuleDTO.getDescription(); @@ -172,8 +246,9 @@ newVR.stepLength = osRevisionRuleDTO.getStepLength(); newVR.prefixion = osRevisionRuleDTO.getPrefixion(); newVR.suffix = osRevisionRuleDTO.getSuffix(); - String userName = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); long timeMillis = System.currentTimeMillis(); + newVR.ts = Func.format((Func.isNotEmpty(osRevisionRuleDTO.getTs()) ? osRevisionRuleDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat); newVR.creator = Func.isBlank(osRevisionRuleDTO.getCreator()) ? userName:osRevisionRuleDTO.getCreator(); newVR.createTime = Func.isEmpty(osRevisionRuleDTO.getCreateTime()) ? timeMillis:osRevisionRuleDTO.getCreateTime().getTime(); newVR.modifier = userName; @@ -213,7 +288,7 @@ try { ruleVO.setCreateTime(VciDateUtil.long2Date(versionRule.createTime)); ruleVO.setLastModifyTime(VciDateUtil.long2Date(versionRule.modifyTime)); - ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeFormat)); + ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeMillFormat)); } catch (Exception e) { e.printStackTrace(); } @@ -245,6 +320,27 @@ } /** + * 浣跨敤澶氫釜缂栧彿鑾峰彇瑙勫垯鐨勫�� + * @param vrIdList 缂栧彿 + * @return 鏄剧ず瀵硅薄 + */ + @Override + public List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList) { + if(Func.isEmpty(vrIdList)){ + return null; + } + Map<String, OsRevisionRuleVO> revisionRuleVOMap = self.selectAllRevisionMap(); + List<OsRevisionRuleVO> versionRuleList = new ArrayList<>(); + vrIdList.stream().forEach(vrId->{ + OsRevisionRuleVO versionRuleVO = revisionRuleVOMap.getOrDefault(vrId.toLowerCase(Locale.ROOT),null); + if(versionRuleVO!=null){ + versionRuleList.add(versionRuleVO); + } + }); + return versionRuleList; + } + + /** * 鏌ヨ搴旂敤鑼冨洿 * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О * @return @@ -269,6 +365,210 @@ } /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑鐗堟湰瑙勫垯鍚嶇О + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� + * @return + */ + @Override + public String exportVersionRule(String exportFileName, String vrNames, boolean flag) throws PLException { + if(Func.isBlank(vrNames)){ + throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勭増鏈鍒�!"}); + } + //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� + exportFileName = Func.isBlank(exportFileName) ? "鐗堟湰瑙勫垯瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; + //璁剧疆鍒楀悕 + List<String> columns = this.getCloumns(flag); + + //鍐檈xcel + String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; + try { + new File(excelPath).createNewFile(); + } catch (Throwable e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); + } + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + //璁剧疆鍒楀ご + for (int index = 0; index < columns.size(); index++) { + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + //鎸夌収鐗堟湰瑙勫垯鍚嶆煡璇紝鐒跺悗澶勭悊鐗堟湰瑙勫垯瀵煎嚭 + List<String> vrIdList = Func.toStrList(vrNames); + List<OsRevisionRuleVO> revisionRuleVOList = this.getRevisionRuleByIds(vrIdList); + if(Func.isEmpty(revisionRuleVOList)){ + excelDataList.add(new WriteExcelData(1,1, "鏍规嵁鍚嶇О鏈煡璇㈠埌鐗堟湰瑙勫垯淇℃伅锛岃鍒锋柊鍚庡皾璇曢噸鏂板鍑猴紒")); + }else{ + for (int i = 0; i < revisionRuleVOList.size(); i++) { + OsRevisionRuleVO revisionRuleVO = revisionRuleVOList.get(i); + excelDataList.add(new WriteExcelData(i+1,0, revisionRuleVO.getId())); + excelDataList.add(new WriteExcelData(i+1,1, revisionRuleVO.getName())); + excelDataList.add(new WriteExcelData(i+1,2, revisionRuleVO.getJumpCharacter())); + excelDataList.add(new WriteExcelData(i+1,3, revisionRuleVO.getInitialValue())); + excelDataList.add(new WriteExcelData(i+1,4, revisionRuleVO.getStepLength())); + excelDataList.add(new WriteExcelData(i+1,5, revisionRuleVO.getPrefixion())); + excelDataList.add(new WriteExcelData(i+1,6, revisionRuleVO.getSuffix())); + excelDataList.add(new WriteExcelData(i+1,7, revisionRuleVO.getDescription())); + if(!flag){ + excelDataList.add(new WriteExcelData(i+1,8, Func.format(revisionRuleVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + } + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** + * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘 + * @param exportFileName + * @return + * @throws PLException + */ + @Override + public String downloadVersionRuleTemplate(String exportFileName) throws Exception { + //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� + exportFileName = Func.isBlank(exportFileName) ? "鐗堟湰瑙勫垯瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; + //璁剧疆鍒楀悕 + List<String> columns = this.getCloumns(true); + //璁剧疆蹇呭~鍒� + ColumnNameisRed.clear(); + ColumnNameisRed.add(0); + ColumnNameisRed.add(3); + ColumnNameisRed.add(4); + + //鍐檈xcel + String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; + try { + new File(excelPath).createNewFile(); + } catch (Throwable e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); + } + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + //璁剧疆鍒楀ご + for (int index = 0; index < columns.size(); index++) { + //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹� + if(ColumnNameisRed.contains(index)){ + WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index)); + excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); + excelDataList.add(excelData); + }else{ + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** + * 瀵煎叆鐗堟湰瑙勫垯 + * @param file + * @return + */ + @Override + public BaseResult importVersionRules(File file) throws Exception { + VciBaseUtil.alertNotNull(file,"excel鏂囦欢"); + if(!file.exists()){ + throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()}); + } + try{ + //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞� + ReadExcelOption excelOption = new ReadExcelOption(); + List<OsRevisionRulePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsRevisionRulePO.class,excelOption,(value, po, fieldName)->{}); + //鍘婚櫎閮芥槸绌虹殑鎯呭喌 + if(CollectionUtils.isEmpty(poList)){ + return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); + } + //excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨 + List<OsRevisionRuleDTO> dtoList = new ArrayList<>(); + //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶇増鏈鍒欏悕锛寁alue锛氳鍙凤級 + Map<String, String> excelReapeat = new HashMap<>(); + //鏁版嵁搴撴煡璇㈡槸鍚︽湁宸插瓨鍦ㄧ殑鏋氫妇鍚嶏紝鏂逛究鍚庣画鍋氬垽閲嶅鐞� + List<OsRevisionRuleVO> versionRuleVOList = this.getRevisionRuleByIds(poList.stream().map(OsRevisionRulePO::getId).collect(Collectors.toSet())); + List<String> repeatVrId = new ArrayList<>(); + if(Func.isNotEmpty(versionRuleVOList)){ + repeatVrId = versionRuleVOList.stream().map(OsRevisionRuleVO::getId).collect(Collectors.toList()); + } + //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌哄拰鍏朵粬鏍¢獙 + List<String> finalRepeatVrId = repeatVrId; + poList.stream().forEach(vrPO -> { + if(Func.isBlank(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶅垽绌� + throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛寁ersionrulenameerror"); + }else if(excelReapeat.containsKey(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶈〃鏍间腑鍒ら噸 + throw new VciBaseException("绗��"+excelReapeat.get(vrPO.getId())+"銆戣鍜岀銆�"+vrPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�"); + }else if (Func.isNotEmpty(finalRepeatVrId) && finalRepeatVrId.contains(vrPO.getId())){//鍒ゆ柇鍚嶇О鏄惁涓庣郴缁熶腑閲嶅 + throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛屽悕绉板湪绯荤粺涓凡缁忓瓨鍦�,璇蜂慨鏀�!"); + } + + //鐗堟湰瑙勫垯鍚峞xcel涓垽閲嶅鐞� + excelReapeat.put(vrPO.getId(),vrPO.getRowIndex()); + OsRevisionRuleDTO revisionRuleDTO = new OsRevisionRuleDTO(); + //revisionRuleDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); + revisionRuleDTO.setId(vrPO.getId()); + revisionRuleDTO.setName(vrPO.getName()); + revisionRuleDTO.setJumpCharacter(vrPO.getJumpCharacter()); + revisionRuleDTO.setInitialValue(vrPO.getInitialValue()); + revisionRuleDTO.setStepLength(vrPO.getStepLength()); + revisionRuleDTO.setPrefixion(vrPO.getPrefixion()); + revisionRuleDTO.setSuffix(vrPO.getSuffix()); + revisionRuleDTO.setDescription(vrPO.getDescription()); + try { + //妫�鏌ョ増鏈鍒欐槸鍚﹀悎瑙� + checkVersionRule(revisionRuleDTO); + } catch (PLException e) { + e.printStackTrace(); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); + } + dtoList.add(revisionRuleDTO); + }); + //鎵ц淇濆瓨鎿嶄綔 + dtoList.stream().forEach(dto->{ + try { + boolean b = platformClientUtil.getVersionService().addVersionRule(dto2VersionRule(dto)); + if(!b){ + throw new VciBaseException("save and return false"); + } + } catch (PLException e) { + e.printStackTrace(); + throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒鐗堟湰瑙勫垯瀵硅薄鍚嶄负锛氥��" + dto.getId() + "銆戯紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e)); + } + }); + }catch (Exception e){ + if(logger.isErrorEnabled()){ + logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e)); + } + e.printStackTrace(); + return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); + } + return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + } + + /** + * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕 + * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕 + * @return + */ + private List<String> getCloumns(boolean flag){ + if(flag){ + return new ArrayList<>( + Arrays.asList( + "鍚嶇О", "鏍囩", "璺宠穬瀛楃锛堜互閫楀彿鍒嗛殧锛�", + "鍒濆鍊�", "姝ラ暱", "鍓嶇紑", "鍚庣紑", "鎻忚堪" + ) + ); + } + return new ArrayList<>( + Arrays.asList( + "鍚嶇О", "鏍囩", "璺宠穬瀛楃", "鍒濆鍊�", "姝ラ暱", + "鍓嶇紑", "鍚庣紑", "鎻忚堪", "鍒涘缓鏃堕棿" + ) + ); + } + + /** * 娓呴櫎缂撳瓨 */ @Override diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java index 13dfada..52e0be9 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java @@ -1,11 +1,7 @@ package com.vci.web.service.impl; import com.vci.corba.common.PLException; -import com.vci.corba.omd.atm.AttributeDef; import com.vci.corba.omd.stm.StatePool; -import com.vci.dto.OsAttributeDTO; -import com.vci.pagemodel.OsEnumVO; -import com.vci.po.OsAttributePO; import com.vci.po.OsStatusPO; import com.vci.starter.poi.bo.ReadExcelOption; import com.vci.starter.poi.bo.WriteExcelData; @@ -365,14 +361,11 @@ statePool.name = id; statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); statePoolList.add(statePool); - boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool); - if(!res){ - throw new PLException("500",new String[]{"鍒犻櫎鐘舵�佸悕绉颁负銆�" + id + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"}); - } } + boolean res = platformClientUtil.getStatePoolService().deleteStatePools(statePoolList.toArray(new StatePool[statePoolList.size()])); //clearCache(); self.selectAllStatusMap(); - return true; + return res; } /** @@ -386,7 +379,7 @@ statePool.oid = statusDTO.getOid(); statePool.id = ""; statePool.name = statusDTO.getId(); - statePool.imagePath = statusDTO.getImagePath(); + //statePool.imagePath = statusDTO.getImagePath(); statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription(); String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); long now = VciDateUtil.getNowTime(); @@ -435,7 +428,7 @@ OsStatusVO osStatusVO = this.getObjectByOid(oid); excelDataList.add(new WriteExcelData(i.get(),0, osStatusVO.getId())); excelDataList.add(new WriteExcelData(i.get(),1, osStatusVO.getName())); - excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); + //excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); excelDataList.add(new WriteExcelData(i.get(),3, osStatusVO.getDescription())); i.getAndIncrement(); }); @@ -493,10 +486,10 @@ private List<String> getCloumns(boolean flag){ if(flag){ return new ArrayList<>( - Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)") + Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)"/*,"鍥剧墖(璺緞)"*/, "鎻忚堪(鍙互涓虹┖)") ); } - return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪")); + return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩"/*, "鍥剧墖"*/, "鎻忚堪")); } /** @@ -522,7 +515,6 @@ List<StatePool> statePoolList = new ArrayList<>(); //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 poList.stream().forEach(osStatusPO -> { try { StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId()); @@ -532,14 +524,14 @@ } catch (PLException e) { e.printStackTrace(); logger.error(e.getMessage()); - throw new VciBaseException(e.getMessage()); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); } - if(Func.isBlank(osStatusPO.getId())){//灞炴�у悕鍒ょ┖ - throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宔numnameerror"); + if(Func.isBlank(osStatusPO.getId())){//鐘舵�佸悕鍒ょ┖ + throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宻tatusnameerror"); }else if(!osStatusPO.getId().matches("[a-z A-Z]*")){ // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣� throw new VciBaseException("鍚嶇О鍙兘涓鸿嫳鏂囷紒"); - }else if(excelReapeat.containsKey(osStatusPO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲� + }else if(excelReapeat.containsKey(osStatusPO.getId())){//鐘舵�佸悕琛ㄦ牸涓垽閲� throw new VciBaseException("绗��"+excelReapeat.get(osStatusPO.getId())+"銆戣鍜岀銆�"+osStatusPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�"); } //鐘舵�佸悕excel涓垽閲嶅鐞� @@ -548,7 +540,7 @@ osStatusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); osStatusDTO.setId(osStatusPO.getId()); osStatusDTO.setName(osStatusPO.getName()); - osStatusDTO.setImagePath(osStatusPO.getImagePath()); + //osStatusDTO.setImagePath(osStatusPO.getImagePath()); osStatusDTO.setDescription(osStatusPO.getDescription()); statePoolList.add(statusDTO2DO(osStatusDTO)); @@ -562,7 +554,7 @@ e.printStackTrace(); return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); } - return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + return BaseResult.success("鐘舵�佸鍏ユ垚鍔燂紒"); } /** diff --git a/Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js b/Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js index 3671d5e..f3abf02 100644 --- a/Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js +++ b/Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js @@ -13,7 +13,7 @@ }); } -// 鍒涘缓 +// 淇敼 export function updateAttribute(params) { return request({ url: "/api/attributeController/updateAttribute", @@ -22,7 +22,7 @@ }); } -// 淇敼 +// 鍒涘缓 export function addAttribute(params) { return request({ url: "/api/attributeController/addAttribute", @@ -70,9 +70,9 @@ } // 瀵煎嚭 -export function download (params) { +export function exportAttributes (params) { return request({ - url: '/api/attributeController/importAttributes', + url: '/api/attributeController/exportAttributes', method: 'get', headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}, responseType: 'blob', diff --git a/Source/plt-web/plt-web-ui/src/api/modeling/linkType/api.js b/Source/plt-web/plt-web-ui/src/api/modeling/linkType/api.js index 9ee39f9..bedefe3 100644 --- a/Source/plt-web/plt-web-ui/src/api/modeling/linkType/api.js +++ b/Source/plt-web/plt-web-ui/src/api/modeling/linkType/api.js @@ -16,3 +16,20 @@ params }); } + +// 涓�鑷存�ф鏌� +export function checkLinkType(params) { + return request({ + url: "/api/linkTypeController/checkLinkType", + method: "get", + params + }); +} + +// 鍒涘缓瑙嗗浘 +export function createView() { + return request({ + url: "/api/linkTypeController/createView", + method: "post", + }); +} diff --git a/Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js b/Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js index 1a9a49b..6e8c6f3 100644 --- a/Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js +++ b/Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js @@ -5,5 +5,54 @@ return request({ url: "/api/statusController/gridStatus", method: "get", + params }); } + +// 鍒涘缓 +export function addSave(params) { + return request({ + url: "/api/statusController/addSave", + method: "post", + data:params + }); +} + +// 淇敼 +export function editSave(params) { + return request({ + url: "/api/statusController/editSave", + method: "put", + data:params + }); +} + +// 鍒犻櫎 +export function deleteStatus(params) { + return request({ + url: "/api/statusController/deleteStatus", + method: "delete", + data:params + }); +} + +// 瀵煎嚭 +export function exportStatus (params) { + return request({ + url: '/api/statusController/exportStatus', + method: 'get', + headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}, + responseType: 'blob', + params + }) +} + +// 鏌ョ湅浣跨敤鑼冨洿 +export function listUsed(params) { + return request({ + url: "/api/statusController/listUsed", + method: "get", + params + }); +} + diff --git a/Source/plt-web/plt-web-ui/src/api/modeling/version/api.js b/Source/plt-web/plt-web-ui/src/api/modeling/version/api.js new file mode 100644 index 0000000..eba0448 --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/api/modeling/version/api.js @@ -0,0 +1,57 @@ +import request from '@/router/axios'; + +// 鍒楄〃鏌ヨ +export function getVersionRuleAllList() { + return request({ + url: "/api/revisionRuleController/getVersionRuleAllList", + method: "get", + }); +} + +// 鍒涘缓 +export function addVersionRule(params) { + return request({ + url: "/api/revisionRuleController/addVersionRule", + method: "post", + data: params + }); +} + +// 淇敼 +export function updateVersionRule(params) { + return request({ + url: "/api/revisionRuleController/updateVersionRule", + method: "put", + data: params + }); +} + +// 鍒犻櫎 +export function deleteVersionRule(params) { + return request({ + url: "/api/revisionRuleController/deleteVersionRule", + method: "delete", + data: params + }); +} + +// 鏌ョ湅浣跨敤鑼冨洿 +export function getUsedVersionRuleList(params) { + return request({ + url: "/api/revisionRuleController/getUsedVersionRuleList", + method: "get", + params + }); +} + +// 瀵煎嚭 +export function exportVersionRule (params) { + return request({ + url: '/api/revisionRuleController/exportVersionRule', + method: 'get', + headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}, + responseType: 'blob', + params + }) +} + diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue index c2cb92a..4842e75 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue @@ -306,7 +306,7 @@ </el-form-item> - <el-form-item :label="form.enumSwitch ? '鏋氫妇閫夋嫨锛�' : '娣诲姞鏋氫妇鍊硷細'" prop="enumSwitch"> + <el-form-item :label="form.enumSwitch ? '鏋氫妇閫夋嫨锛�' : '娣诲姞鍊煎煙锛�'" prop="enumSwitch"> <el-select v-if="form.enumSwitch" v-model="form.enumId" placeholder="璇烽�夋嫨鏋氫妇绫诲瀷" @change="enumSelectChange"> <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key" @@ -320,8 +320,8 @@ <el-button size="mini" @click="enumAddHandler"> = </el-button> </div> </el-form-item> - <el-form-item label="褰撳墠鏋氫妇鍊硷細" prop="rangeValue"> - <textarea v-model="form.rangeValue" + <el-form-item :label="form.enumSwitch ? '褰撳墠鏋氫妇鍊硷細' : '褰撳墠鍊煎煙锛�'" prop="rangeValue"> + <textarea v-model="form.rangeValue" :readonly="form.enumSwitch" style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> </textarea> </el-form-item> @@ -336,7 +336,7 @@ </el-form-item> - <el-form-item :label="form.enumSwitch ? '鏋氫妇閫夋嫨锛�' : '娣诲姞鏋氫妇鍊硷細'" prop="enumSwitch"> + <el-form-item :label="form.enumSwitch ? '鏋氫妇閫夋嫨锛�' : '娣诲姞鍊煎煙锛�'" prop="enumSwitch"> <el-select v-if="form.enumSwitch" v-model="form.enumId" placeholder="璇烽�夋嫨鏋氫妇绫诲瀷" @change="enumSelectChange"> <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key" @@ -356,8 +356,8 @@ <el-button size="mini" @click="operationHandler('()')"> () </el-button> </div> </el-form-item> - <el-form-item label="褰撳墠鏋氫妇鍊硷細" prop="rangeValue"> - <textarea v-model="form.rangeValue" + <el-form-item :label="form.enumSwitch ? '褰撳墠鏋氫妇鍊硷細' : '褰撳墠鍊煎煙锛�'" prop="rangeValue"> + <textarea v-model="form.rangeValue" :readonly="form.enumSwitch" style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> </textarea> </el-form-item> @@ -365,7 +365,7 @@ <!-- VTDouble --> <div v-if="form.attributeDataType === 'VTDouble'" class="right"> <h3>鍊煎煙</h3> - <el-form-item label="娣诲姞鏋氫妇鍊硷細" prop="enumAddValue"> + <el-form-item :label="form.enumSwitch ? '鏋氫妇閫夋嫨锛�' : '娣诲姞鍊煎煙锛�'" prop="enumAddValue"> <el-input v-model="form.enumAddValue"> </el-input> </el-form-item> @@ -380,7 +380,7 @@ <el-button size="mini" @click="operationHandler('()')"> () </el-button> </div> </el-form-item> - <el-form-item label="褰撳墠鏋氫妇鍊硷細" prop="rangeValue"> + <el-form-item :label="form.enumSwitch ? '褰撳墠鏋氫妇鍊硷細' : '褰撳墠鍊煎煙锛�'" prop="rangeValue"> <textarea v-model="form.rangeValue" style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> </textarea> @@ -458,7 +458,7 @@ append-to-body="true" class="avue-dialog" title="鏌ョ湅浣跨敤鑼冨洿" - width="70%" + width="60%" > <avue-crud ref="checkViewCrud" @@ -479,7 +479,7 @@ getUsedAttributeList, getEnumMapByType, deleteAttributes, - download, + exportAttributes, downloadAttributeTemplate, getBizTypes, getAllLtName, @@ -682,7 +682,13 @@ this.form.attributeDataType === 'VTFilePath'; }, rangeOptionValue() { - return this.form.rangeValue.split('\n') + let values = this.form.rangeValue.split('\n'); + + // 澶勭悊姣忎釜鍊硷紝鍘婚櫎绛夊彿鍓嶇殑閮ㄥ垎锛屽彧淇濈暀绛夊彿鍚庣殑閮ㄥ垎 + return values.map(value => { + let parts = value.split('='); + return parts.length > 1 ? parts[1].trim() : value.trim(); + }); } }, methods: { @@ -907,16 +913,16 @@ enumSelectChange(val) { const list = this.attributeDataTypePickList.find(item => item.key === val).values; this.form.rangeValue = list.join('\n'); - this.form.defaultValue = list[0]; + this.form.defaultValue = this.rangeOptionValue[0]; }, // 浣跨敤鏋氫妇switch婊戝潡change浜嬩欢 switchEnumChange(status) { if (status) { this.form.enumId = this.attributeDataTypePickList[0].key; - this.form.defaultValue = this.attributeDataTypePickList[0].values[0]; const list = this.attributeDataTypePickList[0].values; this.form.rangeValue = list.join('\n'); + this.form.defaultValue = this.rangeOptionValue[0]; } else { this.form.defaultValue = ""; this.form.rangeValue = ""; @@ -1209,7 +1215,7 @@ } addAttribute(this.form).then(res => { if (res.data.code === 200) { - this.$message.success(res.data.msg); + this.$message.success(res.data.obj); this.getTableList(); this.form = form; this.addVisible = false; @@ -1247,7 +1253,7 @@ } let attrNames = this.selectList.map(item => item.id).join(','); - download({attrNames: attrNames}).then(res => { + exportAttributes({attrNames: attrNames}).then(res => { func.downloadFileByBlobHandler(res); this.$message.success('瀵煎嚭鎴愬姛'); }).catch(err => { diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue index f6d274e..3908720 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue @@ -97,7 +97,7 @@ append-to-body="true" class="avue-dialog" title="鏌ョ湅浣跨敤鑼冨洿" - width="70%" + width="60%" > <avue-crud ref="checkViewCrud" diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue index 80ea9f4..4aee662 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue @@ -1,10 +1,10 @@ <template> - <el-container> + <el-container v-loading="createViewLoading"> <el-aside> <basic-container> <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> <div class="headerCon"> - <el-button icon="el-icon-plus" plain size="small" type="primary">鍒涘缓 + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 </el-button> <el-button icon="el-icon-edit" plain size="small" type="primary">淇敼 </el-button> @@ -17,17 +17,17 @@ <el-button icon="el-icon-upload2" plain size="small" type="primary">瀵煎叆 </el-button> <el-button icon="el-icon-circle-plus-outline" plain size="small" - type="primary">鍒涘缓瑙嗗浘 + type="primary" @click="createViewClickHandler">鍒涘缓瑙嗗浘 </el-button> <el-button icon="el-icon-menu" plain size="small" - type="primary">涓�鑷存�ф鏌� + type="primary" @click="checkClickHandler">涓�鑷存�ф鏌� </el-button> </div> <!-- 宸︿晶鏍� --> <div style="height: calc(100vh - 300px);"> <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> - <span> + <span style="font-size: 15px"> <i class="el-icon-s-promotion"></i> {{ (node || {}).label }} </span> @@ -72,7 +72,7 @@ <i :class="icons.domain"></i> 褰㈢姸 </template> - <el-tag v-if="nodeRow.shape" size="small"> + <el-tag v-if="nodeRow.shape"> {{ nodeRow.shape }} </el-tag> </el-descriptions-item> @@ -94,7 +94,7 @@ From绔被鍨� </template> <span v-for="item in nodeRow.btmItemsFrom" style="margin-left:2px;"> - <el-tag effect="plain" size="small" style="margin-top: 2px;"> + <el-tag effect="plain" style="margin-top: 2px;"> {{ item }} </el-tag> </span> @@ -105,7 +105,7 @@ <i :class="icons.from"></i> Form绔富绫诲瀷 </template> - <el-tag v-if="nodeRow.primitivesFrom" effect="plain" size="small"> + <el-tag v-if="nodeRow.primitivesFrom" effect="plain"> {{ nodeRow.primitivesFrom === '璇烽�夋嫨' ? nodeRow.btmItemsFrom[0] : nodeRow.primitivesFrom }} </el-tag> </el-descriptions-item> @@ -115,7 +115,7 @@ <i :class="icons.from"></i> From绔搴斿叧绯� </template> - <el-tag v-if="nodeRow.relationFrom" effect="plain" size="small">{{ nodeRow.relationFrom }}</el-tag> + <el-tag v-if="nodeRow.relationFrom" effect="plain">{{ nodeRow.relationFrom }}</el-tag> </el-descriptions-item> </el-descriptions> @@ -128,7 +128,7 @@ To绔被鍨� </template> <span v-for="item in nodeRow.btmItemsTo" style="margin-left:2px;"> - <el-tag effect="plain" size="small" style="margin-top: 2px;"> + <el-tag effect="plain" style="margin-top: 2px;"> {{ item }} </el-tag> </span> @@ -139,7 +139,7 @@ <i :class="icons.to"></i> To绔富绫诲瀷 </template> - <el-tag v-if="nodeRow.primitivesTo" effect="plain" size="small"> + <el-tag v-if="nodeRow.primitivesTo" effect="plain"> {{ nodeRow.primitivesTo === '璇烽�夋嫨' ? nodeRow.btmItemsTo[0] : nodeRow.primitivesTo }} </el-tag> </el-descriptions-item> @@ -149,7 +149,7 @@ <i :class="icons.to"></i> To绔搴斿叧绯� </template> - <el-tag v-if="nodeRow.relationTo" effect="plain" size="small">{{ nodeRow.relationTo }}</el-tag> + <el-tag v-if="nodeRow.relationTo" effect="plain">{{ nodeRow.relationTo }}</el-tag> </el-descriptions-item> </el-descriptions> @@ -163,17 +163,224 @@ </div> </basic-container> </el-main> + + <!-- 鍒涘缓 && 缂栬緫 --> + <el-dialog + v-dialogDrag + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + title="鍒涘缓" + width="70%" + > + <el-form ref="form" :model="form" :rules="rules" label-width="90px"> + <div class="dialogForm"> + <div class="leftForm"> + <el-form-item label="鍚嶇О锛�" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + <el-form-item label="鏍囩锛�"> + <el-input v-model="form.tag"></el-input> + </el-form-item> + <el-form-item label="瀹炵幇绫伙細"> + <el-input v-model="form.impClass"></el-input> + </el-form-item> + <el-form-item label="褰㈢姸"> + <el-input v-model="form.shape"></el-input> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input v-model="form.description" :rows="2" type="textarea"></el-input> + </el-form-item> + </div> + + <div class="centerForm"> + <el-form-item label="Form绔被鍨嬶細" label-width="110px"> + <el-input v-model="form.btmItemsFrom"></el-input> + </el-form-item> + <el-form-item label="瀵瑰簲鍏崇郴锛�" label-width="110px"> + <el-select v-model="form.relationFrom"> + <el-option label="N" value="N"></el-option> + <el-option label="1" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="涓荤被鍨嬶細" label-width="110px"> + <el-input v-model="form.primitivesFrom"></el-input> + </el-form-item> + </div> + + <div class="rightForm"> + <el-form-item label="To绔被鍨嬶細" label-width="110px"> + <el-input v-model="form.btmItemsTo"></el-input> + </el-form-item> + <el-form-item label="瀵瑰簲鍏崇郴锛�" label-width="110px"> + <el-select v-model="form.relationTo"> + <el-option label="N" value="N"></el-option> + <el-option label="1" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="涓荤被鍨嬶細" label-width="110px"> + <el-input v-model="form.primitivesTo"></el-input> + </el-form-item> + </div> + </div> + </el-form> + + <div class="bottomForm"> + <h3>灞炴�ф睜鍒楄〃</h3> + <avue-crud + :data="dialogBottomData" + :option="dialogBottomOption" + > + <template slot="menuLeft" slot-scope="scope"> + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="dialogAddClickHandler">澧� 鍔� + </el-button> + </template> + </avue-crud> + </div> + <span slot="footer" class="dialog-footer"> + <el-button>鍙� 娑�</el-button> + <el-button type="primary">纭� 瀹�</el-button> + </span> + + <!-- 灞炴�ф睜鍒楄〃 --> + <el-dialog + v-dialogDrag + :visible.sync="attrPollDialogVisible" + append-to-body="true" + class="avue-dialog" + title="灞炴�ф睜" + width="60%" + @close="dialogAttrClose" + > + <avue-crud + ref="dialogAttrCrud" + :key="dialogAttrReload" + :data="dialogAttrData" + :option="dialogAttrOption" + :table-loading="dialogAttrLoading" + @selection-change="dialogAttrSelectChange" + @row-click="dialogAttrRowClickHandler" + > + </avue-crud> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogAttrClose">鍙� 娑�</el-button> + <el-button type="primary">纭� 瀹�</el-button> + </span> + </el-dialog> + </el-dialog> + + <!-- 涓�鑷存�ф鏌� --> + <el-dialog + v-dialogDrag + :visible.sync="checkVisible" + append-to-body="true" + class="avue-dialog" + title="涓�鑷存�ф鏌�" + width="60%" + > + </el-dialog> </el-container> </template> <script> -import {gridLink} from "@/api/modeling/linkType/api"; +import {gridLink, getByAttributeNames, checkLinkType, createView} from "@/api/modeling/linkType/api"; import basicOption from '@/util/basic-option' +import {gridAttribute} from "@/api/modeling/attributePool/api"; export default { name: "index", data() { return { + dialogAttrReload: Math.random(), + dialogAttrSelectList: [], + dialogAttrLoading: false, + dialogAttrData: [], // 灞炴�ф睜鏂板琛ㄦ牸 + dialogAttrOption: { + ...basicOption, + addBtn: false, + menu: false, + refreshBtn: false, + index:false, + highlightCurrentRow: true, + height:450, + column: [ + { + label: '灞炴�у悕', + prop: 'id', + sortable: true, + }, + { + label: '灞炴�х被鍨�', + prop: 'attributeDataType', + sortable: true, + }, + { + label: '鍒濆鍊�', + prop: 'defaultValue', + sortable: true, + }, + { + label: '璇存槑', + prop: 'description', + sortable: true, + overHidden:true + } + ] + }, + attrPollDialogVisible: false, // 瀵硅瘽妗� 灞炴�ф睜鍒楄〃visible + createViewLoading: false, // 鍒涘缓瑙嗗浘 + checkVisible: false, + rules: { + name: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + ], + }, + form: { + name: '', // 鍚嶇О + tag: '', // 鏍囩 + impClass: '', // 瀹炵幇绫� + shape: '', // 褰㈢姸 + description: '', // 鎻忚堪 + btmItemsFrom: '', // From绔被鍨嬪垪琛� + relationFrom: 'N', // form绔搴斿叧绯� + primitivesFrom: '', // form绔富绫诲瀷 + btmItemsTo: '', // to绔被鍨嬪垪琛� + relationTo: 'N', // to绔搴斿叧绯� + primitivesTo: '', // to绔富绫诲瀷 + }, + dialogBottomOption: { + ...basicOption, + editBtn: false, + refreshBtn: false, + selection: false, + height: 300, + addBtn: false, + delBtn: false, + // index:false, + column: [ + { + label: '灞炴�у悕', + prop: 'id', + sortable: true, + }, + { + label: '灞炴�х被鍨�', + prop: 'attributeDataType', + sortable: true, + }, + { + label: '鍒濆鍊�', + prop: 'defaultValue', + sortable: true, + }, + { + label: '璇存槑', + prop: 'description', + } + ] + }, + dialogBottomData: [], + visible: false, treeOption: { height: 'auto', defaultExpandAll: false, @@ -193,25 +400,27 @@ refreshBtn: false, selection: false, // index:false, + addBtn: false, + menu: false, column: [ { label: '灞炴�у悕', - prop: 'attributeName', + prop: 'id', sortable: true, }, { label: '灞炴�х被鍨�', - prop: 'source', + prop: 'attributeDataType', sortable: true, }, { label: '鍒濆鍊�', - prop: 'source', + prop: 'defaultValue', sortable: true, }, { label: '璇存槑', - prop: 'desc', + prop: 'description', } ] }, @@ -252,8 +461,73 @@ // 鏍戠偣鍑讳簨浠� nodeClick(row) { - console.log(row); this.nodeRow = row; + this.getAttrPollData(row); // 鑾峰彇灞炴�ф睜鍒楄〃 + }, + + // 鑾峰彇灞炴�ф睜鍒楄〃 + getAttrPollData(row) { + let value = row.attributes.join(','); + getByAttributeNames({attrNames: value}).then(res => { + if (res.data.code === 200) { + this.tableData = res.data.data; + } + }) + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.visible = true; + }, + + // 涓�鑷存�ф鏌� + checkClickHandler() { + this.checkVisible = true; + checkLinkType().then(res => { + + }).catch(err => { + this.$message.error(err) + }) + }, + + // 鍒涘缓瑙嗗浘 + createViewClickHandler() { + this.createViewLoading = true; + createView().then(res => { + if (res.data.code === 200) { + this.createViewLoading = false; + this.$message.success(res.data.obj) + } + }) + }, + + // 瀵硅瘽妗� 灞炴�ф睜鍒楄〃澧炲姞鎸夐挳 + dialogAddClickHandler() { + this.dialogAttrLoading = true; + this.attrPollDialogVisible = true; + this.dialogAttrReload = Math.random(); // 寮哄埗鍒锋柊琛ㄦ牸 瑙e喅琛ㄦ牸閿欒 + gridAttribute(1, -1, this.searchParams).then(res => { + const data = res.data.data; + this.dialogAttrData = data; + this.dialogAttrLoading = false; + }).catch(err => { + this.$message.error(err) + }); + }, + + // 娣诲姞灞炴�ф睜琛ㄦ牸閫夋嫨妗� + dialogAttrSelectChange(row) { + this.dialogAttrSelectList = row; + }, + + // 娣诲姞灞炴�ф睜 琛岀偣鍑� + dialogAttrRowClickHandler(row) { + this.$refs.dialogAttrCrud.toggleRowSelection(row); + }, + + // 娣诲姞灞炴�ф睜 鍏抽棴瀵硅瘽妗� + dialogAttrClose(){ + this.attrPollDialogVisible = false; } } } @@ -263,6 +537,10 @@ ::v-deep { .el-scrollbar__wrap { overflow: auto !important; + } + + .el-form-item .el-select { + width: 100%; } } @@ -287,4 +565,16 @@ .headerCon > .el-button:nth-child(7) { margin-left: 0; } + +.dialogForm { + display: flex; + justify-content: space-around; +} + +.dialogForm > div { + width: 28%; + border: 1px solid #eee; + padding: 25px 20px 5px 10px; /* 涓� 鍙� 涓� 宸� */ + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* 娣诲姞闃村奖鏁堟灉 */ +} </style> diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue index e1499f1..424bdb9 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue @@ -5,24 +5,25 @@ <basic-container> <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> <div class="headerCon"> - <el-button icon="el-icon-plus" plain size="small" type="primary">鍒涘缓 + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 </el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary">淇敼 + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼 </el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger">鍒犻櫎 + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 </el-button> - <el-button icon="el-icon-download" plain size="small" type="primary">瀵煎嚭 + <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 </el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary">瀵煎叆 + <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 </el-button> - <el-button icon="el-icon-view" plain size="small" type="primary">鏌ョ湅 + <el-button plain size="small" style="width: 100px;text-align: center" type="primary" + @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 </el-button> </div> <!-- 宸︿晶鏍� --> <div style="height: calc(100vh - 280px);"> <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> - <span> + <span style="font-size: 15px"> <i class="el-icon-s-promotion"></i> {{ (node || {}).label }} </span> @@ -35,21 +36,153 @@ <el-main> <basic-container> - + <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�"> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.id"></i> + 鍚嶇О + </template> + <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.name"></i> + 鏍囩 + </template> + <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.desc"></i> + 鎻忚堪 + </template> + <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag> + </el-descriptions-item> + </el-descriptions> </basic-container> </el-main> + + <!-- 鏂板 淇敼 --> + <el-dialog + v-dialogDrag + :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="40%" + @close="visibleCloseHandler" + > + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-row> + <el-col :span="24"> + <el-form-item label="鍚嶇О锛�" prop="id"> + <el-input v-model="form.id"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鏍囩锛�" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鎻忚堪锛�" prop="description"> + <el-input v-model="form.description" :rows="2" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="visibleCloseHandler">鍙� 娑�</el-button> + <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" + @updata="getTreeList"></upload-file> + + <!-- 鏌ョ湅浣跨敤鑼冨洿 --> + <el-dialog + v-dialogDrag + :visible.sync="checkViewVisible" + append-to-body="true" + class="avue-dialog" + title="鏌ョ湅浣跨敤鑼冨洿" + width="60%" + > + <avue-crud + ref="checkViewCrud" + :data="checkViewData" + :option="checkViewOption" + :table-loading="checkViewLoading" + @search-change="checkHandleSearch" + @search-reset="checkHandleReset" + > + </avue-crud> + </el-dialog> </el-container> </template> <script> -import {gridStatus} from "@/api/modeling/statusPool/api"; +import {gridStatus, addSave, editSave, deleteStatus, exportStatus, listUsed} from "@/api/modeling/statusPool/api"; +import func from "@/util/func"; +import basicOption from "@/util/basic-option"; export default { name: "index", data() { return { + checkViewVisible: false, + checkViewData: [], + checkViewDataSearch: [], + checkViewLoading: false, + checkViewOption: { + ...basicOption, + addBtn: false, + menu: false, + searchMenuSpan: 8, + refreshBtn: false, + selection: false, + column: [ + { + label: '鍚嶇О', + prop: 'TreeId', + sortable: true, + }, + { + label: '鏉ユ簮', + prop: 'name', + sortable: true, + search: true + }, + { + label: '璇存槑', + prop: 'description', + } + ] + }, + tipList: [ + "璇锋敞鎰忓悕绉颁笉鑳戒负绌�", + ], + upFileType: ['xls', 'xlsx'], + fileUrl: 'api/statusController/importStatus', + dialogTitle: '', + form: { + id: "", + name: "", + description: "" + }, + rules: { + id: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + ] + }, + visible: false, treeOption: { height: 'auto', defaultExpandAll: false, @@ -62,25 +195,173 @@ } }, treeData: [], - nodeRow:{} + nodeRow: {}, + descriptionOption: { + labelStyle: 'text-align:center;width:120px', + contentStyle: 'width:240px;text-align:center;word-break;break-all;' + }, + icons: { + id: 'el-icon-finished', + name: 'el-icon-tickets', + desc: 'el-icon-chat-line-square' + }, } }, created() { this.getTreeList(); }, methods: { + // 宸︿晶鏍戣姹� getTreeList() { - gridStatus().then(res => { + gridStatus({page: 1, limit: -1}).then(res => { const data = res.data.data; this.treeData = data; - this.tableLoading = false; }).catch(err => { this.$message.error(err) }); }, + + // 鏍戣妭鐐圭偣鍑讳簨浠� nodeClick(row) { this.nodeRow = row; - } + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.visible = true; + this.dialogTitle = 'add'; + }, + + // 缂栬緫鎸夐挳 + editClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.visible = true; + this.dialogTitle = 'edit'; + this.form = this.nodeRow; + }, + + // 鍒犻櫎 + delClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const list = [this.nodeRow]; + deleteStatus(list).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.nodeRow = {}; + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 鍏抽棴瀵硅瘽妗� + visibleCloseHandler() { + const form = { + id: "", + name: "", + imagePath: "", + description: "" + } + this.form = form; + this.visible = false; + this.$refs.form.clearValidate(); + }, + + // 鍒涘缓鎴栫紪杈戜繚瀛� + addSaveHandler() { + const saveFunction = this.dialogTitle === 'add' ? addSave : editSave; + + saveFunction(this.form).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.visible = false; + } else { + this.$message.error(res.data.obj); + } + }).catch(error => { + this.$message.error(error); + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + + exportStatus({statusOids: this.nodeRow.oid}).then(res => { + func.downloadFileByBlobHandler(res); + this.$message.success('瀵煎嚭鎴愬姛'); + }).catch(err => { + this.$message.error(err); + }) + }, + + // 瀵煎叆 + uploadClickHandler() { + this.$refs.upload.visible = true; + }, + + // 鏌ョ湅浣跨敤鑼冨洿 + checkViewClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + listUsed({oid: this.nodeRow.oid}).then(res => { + if (res.data.code === 200) { + this.checkViewVisible = true; + const data = res.data.data; + data.forEach(item => { + item.name = item.id + `( ${item.name} )`; + item.TreeId = this.nodeRow.id; + }) + this.checkViewData = res.data.data; + this.checkViewDataSearch = res.data.data; + } + }) + }, + // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ + checkHandleSearch(params, done) { + const {name} = params; + + if (!params.name) { + this.checkViewData = this.checkViewDataSearch; + return done(); + } + ; + + this.checkViewData = this.checkViewData.filter(item => { + return item.name && item.name.includes(name); + }); + + done(); + + }, + + // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆 + checkHandleReset() { + this.checkViewData = this.checkViewDataSearch; + }, + } } </script> @@ -113,4 +394,8 @@ .headerCon > .el-button:nth-child(7) { margin-left: 0; } + +.upload-demo { + margin-left: 20px; +} </style> diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue index a042dbb..cecfaa4 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue @@ -1,13 +1,490 @@ <template> - <p>鐗堟湰绠$悊</p> + <el-container> + <el-aside> + <basic-container> + <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> + <div class="headerCon"> + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 + </el-button> + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼 + </el-button> + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 + </el-button> + <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 + </el-button> + <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 + </el-button> + <el-button plain size="small" style="width: 100px;text-align: center" type="primary" + @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 + </el-button> + </div> + <!-- 宸︿晶鏍� --> + <div style="height: calc(100vh - 300px);"> + <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> + <span slot-scope="{ node, data }" class="el-tree-node__label"> + <span style="font-size: 15px"> + <i class="el-icon-s-promotion"></i> + {{ (node || {}).label }} + </span> + </span> + </avue-tree> + </div> + </div> + </basic-container> + </el-aside> + + <el-main> + <basic-container> + <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�"> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.id"></i> + 鍚嶇О + </template> + <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.name"></i> + 鏍囩 + </template> + <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.jump"></i> + 璺宠穬瀛楃 + </template> + <el-tag v-if="nodeRow.jumpCharacter">{{ nodeRow.jumpCharacter }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.init"></i> + 鍒濆鍊� + </template> + <el-tag v-if="nodeRow.initialValue">{{ nodeRow.initialValue }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.length"></i> + 姝ラ暱 + </template> + <el-tag v-if="nodeRow.stepLength">{{ nodeRow.stepLength }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.left"></i> + 鍓嶇紑 + </template> + <el-tag v-if="nodeRow.prefixion">{{ nodeRow.prefixion }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.right"></i> + 鍚庣紑 + </template> + <el-tag v-if="nodeRow.suffix">{{ nodeRow.suffix }}</el-tag> + </el-descriptions-item> + <el-descriptions-item :contentStyle="descriptionOption.contentStyle" + :labelStyle="descriptionOption.labelStyle"> + <template slot="label"> + <i :class="icons.desc"></i> + 鎻忚堪 + </template> + <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag> + </el-descriptions-item> + </el-descriptions> + </basic-container> + </el-main> + + <!-- 鏂板 淇敼 --> + <el-dialog + v-dialogDrag + :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="40%" + @close="visibleCloseHandler" + > + <el-form ref="form" :model="form" :rules="rules" label-width="95px"> + <el-row> + <el-col :span="12"> + <el-form-item label="鍚嶇О锛�" prop="id"> + <el-input v-model="form.id"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍囩锛�" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璺宠穬瀛楃锛�" prop="jumpCharacter"> + <el-input v-model="form.jumpCharacter"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍒濆鍊硷細" prop="initialValue"> + <el-input v-model="form.initialValue"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="姝ラ暱锛�" prop="stepLength"> + <el-input-number v-model="form.stepLength" :max="9" :min="1" label="鎻忚堪鏂囧瓧"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍓嶇紑锛�" prop="prefixion"> + <el-input v-model="form.prefixion"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍚庣紑锛�" prop="suffix"> + <el-input v-model="form.suffix"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鎻忚堪锛�" prop="description"> + <el-input v-model="form.description" :rows="2" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="visibleCloseHandler">鍙� 娑�</el-button> + <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" + @updata="getTreeList"></upload-file> + + <!-- 鏌ョ湅浣跨敤鑼冨洿 --> + <el-dialog + v-dialogDrag + :visible.sync="checkViewVisible" + append-to-body="true" + class="avue-dialog" + title="鏌ョ湅浣跨敤鑼冨洿" + width="60%" + > + <avue-crud + ref="checkViewCrud" + :data="checkViewData" + :option="checkViewOption" + :table-loading="checkViewLoading" + @search-change="checkHandleSearch" + @search-reset="checkHandleReset" + > + </avue-crud> + </el-dialog> + </el-container> </template> <script> +import { + getVersionRuleAllList, + addVersionRule, + updateVersionRule, + deleteVersionRule, + exportVersionRule, + getUsedVersionRuleList +} from "@/api/modeling/version/api"; +import func from "@/util/func"; +import basicOption from "@/util/basic-option"; + export default { - name: "index" + name: "index", + data() { + return { + checkViewVisible: false, + checkViewData: [], + checkViewDataSearch: [], + checkViewLoading: false, + checkViewOption: { + ...basicOption, + addBtn: false, + menu: false, + searchMenuSpan: 8, + refreshBtn: false, + selection: false, + column: [ + { + label: '鍚嶇О', + prop: 'versionRuleName', + sortable: true, + }, + { + label: '鏉ユ簮', + prop: 'source', + sortable: true, + search: true + }, + { + label: '璇存槑', + prop: 'description', + } + ] + }, + tipList: [ + "鍚嶇О涓嶈兘涓虹┖涓斿彧鑳借緭鍏ヨ嫳鏂囧瓧绗�", + "璺宠穬瀛楃鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ヨ嫳鏂囬�楀彿鍒嗛殧", + "鍒濆鍊煎彧鑳借緭鍏ユ暟瀛椼�佸瓧姣嶆垨鑻辨枃绗﹀彿", + "姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬暣鏁�", + ], + upFileType: ['xls', 'xlsx'], + fileUrl: 'api/revisionRuleController/importVersionRules', + rules: { + id: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + {pattern: /^[a-zA-Z]+$/, message: '鍙兘杈撳叆鑻辨枃瀛楃', trigger: 'blur'} + ], + initialValue: [ + {required: true, message: '璇疯緭鍏ュ垵濮嬪��', trigger: 'blur'}, + {pattern: /^[a-zA-Z0-9!@#$%^&*()_+{}\[\]:;"'<>,.?/\\|-]*$/, message: '鍙兘杈撳叆鏁板瓧銆佸瓧姣嶆垨鑻辨枃绗﹀彿', trigger: 'blur'} + ], + jumpCharacter: [ + {required: true, message: '璇疯緭鍏ヨ烦璺冨瓧绗�', trigger: 'blur'}, + {pattern: /^[a-zA-Z0-9]+(?:,[a-zA-Z0-9]+)*$/, message: '鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ラ�楀彿鍒嗛殧', trigger: 'blur'} + ] + }, + form: { + id: '', + name: '', + jumpCharacter: '', + initialValue: '', + stepLength: 1, + prefixion: '', + suffix: '', + description: '' + }, + visible: false, + dialogTitle: '', + nodeRow: {}, + treeData: [], + treeOption: { + height: 'auto', + defaultExpandAll: false, + menu: false, + addBtn: false, + props: { + label: 'id', + value: 'id', + children: 'children' + } + }, + descriptionOption: { + labelStyle: 'text-align:center;width:120px', + contentStyle: 'width:240px;text-align:center;word-break;break-all;' + }, + icons: { + id: 'el-icon-finished', + name: 'el-icon-tickets', + jump: 'el-icon-mouse', + init: 'el-icon-s-promotion', + length: 'el-icon-collection-tag', + left: 'el-icon-caret-left', + right: 'el-icon-caret-right', + desc: 'el-icon-chat-line-square' + }, + } + }, + created() { + this.getTreeList(); + }, + methods: { + //宸︿晶鏍戞煡璇� + getTreeList() { + getVersionRuleAllList().then(res => { + console.log(res); + const data = res.data.data; + this.treeData = data; + }).catch(err => { + this.$message.error(err) + }); + }, + + // 宸︿晶鏍戣鐐瑰嚮 + nodeClick(row) { + this.nodeRow = row; + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.dialogTitle = 'add'; + this.visible = true; + }, + + // 淇敼鎸夐挳 + editClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.visible = true; + this.dialogTitle = 'edit'; + this.form = this.nodeRow; + }, + + // 鏂板淇敼瀵硅瘽妗嗗叧闂� + visibleCloseHandler() { + const form = { + id: '', + name: '', + jumpCharacter: '', + initialValue: '', + stepLength: 1, + prefixion: '', + suffix: '', + description: '' + } + this.form = form; + this.visible = false; + this.$refs.form.clearValidate(); + }, + + // 鏂板 缂栬緫 淇濆瓨 + addSaveHandler() { + const saveFunction = this.dialogTitle === 'add' ? addVersionRule : updateVersionRule; + + saveFunction(this.form).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.visible = false; + } else { + this.$message.error(res.data.obj); + } + }).catch(error => { + this.$message.error(error); + }); + }, + + // 鍒犻櫎鎸夐挳 + delClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const list = [this.nodeRow]; + deleteVersionRule(list).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.nodeRow = {}; + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + + exportVersionRule({vrNames: this.nodeRow.id}).then(res => { + func.downloadFileByBlobHandler(res); + this.$message.success('瀵煎嚭鎴愬姛'); + }).catch(err => { + this.$message.error(err); + }) + }, + + // 瀵煎叆 + uploadClickHandler() { + this.$refs.upload.visible = true; + }, + + // 鏌ョ湅浣跨敤鑼冨洿 + checkViewClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + getUsedVersionRuleList({vrName: this.nodeRow.id}).then(res => { + if (res.data.code === 200) { + this.checkViewVisible = true; + const data = res.data.data; + this.checkViewData = res.data.data; + this.checkViewDataSearch = res.data.data; + } + }) + }, + + // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ + checkHandleSearch(params, done) { + const {source} = params; + + if (!params.source) { + this.checkViewData = this.checkViewDataSearch; + return done(); + } + ; + + this.checkViewData = this.checkViewData.filter(item => { + return item.source && item.source.includes(source); + }); + + done(); + + }, + + // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆 + checkHandleReset() { + this.checkViewData = this.checkViewDataSearch; + }, + } } </script> -<style scoped> +<style lang="scss" scoped> +::v-deep { + .el-scrollbar__wrap { + overflow: auto !important; + } +} + +.headerCon { + display: flex; + flex-wrap: wrap; + margin-bottom: 5px; + + .el-button + .el-button { + margin-left: 5px; + } + + .el-button { + margin-top: 5px; + } +} + +.headerCon > .el-button:nth-child(4) { + margin-left: 0; +} + +.headerCon > .el-button:nth-child(7) { + margin-left: 0; +} </style> -- Gitblit v1.9.3