Merge remote-tracking branch 'origin/master'
| | |
| | | */ |
| | | private Date ts; |
| | | |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 屿§æ± 导å
¥å¯¹è±¡ |
| | | * ç¶ææ± å¯¼å
¥å¯¹è±¡ |
| | | * @author ludc |
| | | * @date 2024/7/19 11:11 |
| | | */ |
| | |
| | | /** |
| | | * 屿§ç±»å |
| | | */ |
| | | @ExcelColumn(value="å¾ç(è·¯å¾)") |
| | | private String imagePath; |
| | | //@ExcelColumn(value="å¾ç(è·¯å¾)") |
| | | //private String imagePath; |
| | | |
| | | /** |
| | | * æè¿° |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * çæ¬è§åæ§å¶å¨ |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVersionRuleAllList") |
| | | @VciUnCheckRight |
| | | public BaseResult getVersionRuleAllList(){ |
| | | try { |
| | | return BaseResult.dataList(revisionRuleServiceI.selectAllRevision()); |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUsedVersionRuleList") |
| | | @VciUnCheckRight |
| | | public BaseResult getUsedVersionRuleList(String vrName){ |
| | | try { |
| | | return BaseResult.dataList(revisionRuleServiceI.getUsedVersionRuleList(vrName)); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addVersionRule") |
| | | @VciUnCheckRight |
| | | public BaseResult addVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ |
| | | try { |
| | | return revisionRuleServiceI.addVersionRule(osRevisionRuleDTO) ? BaseResult.success("çæ¬è§åæ·»å æåï¼"):BaseResult.fail("çæ¬è§åæ·»å 失败ï¼"); |
| | |
| | | * @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(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; |
| | | |
| | | /** |
| | | * å é¤çæ¬è§å |
| | | * @param osRevisionRuleDTOS |
| | | * @return |
| | | */ |
| | | boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException; |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param versionRules æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | //æ£æ¥å±æ§åæ¯å¦å·²åå¨ä¸ç³»ç»ä¸ |
| | | if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){ |
| | | throw new PLException("500",new String[]{"屿§åç§°å¨ç³»ç»ä¸å·²åå¨!"}); |
| | | throw new PLException("500",new String[]{"屿§åç§°ã" + abName + "ãå¨ç³»ç»ä¸å·²åå¨!"}); |
| | | } |
| | | } |
| | | |
| | |
| | | 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{ |
| | |
| | | List<OsAttributeDTO> dtoList = new ArrayList<>(); |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | poList.stream().forEach(osAttributePO -> { |
| | | if(Func.isBlank(osAttributePO.getId())){//屿§åå¤ç©º |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼enumnameerror"); |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼attrnameerror"); |
| | | }else if(Func.isBlank(osAttributePO.getAttributeDataType())){ |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼typeerror"); |
| | | }else if(excelReapeat.containsKey(osAttributePO.getId())){//屿§åè¡¨æ ¼ä¸å¤é |
| | |
| | | //屿§å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()); |
| | |
| | | checkDefValue(osAttributeDTO); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(e.getMessage()); |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | dtoList.add(osAttributeDTO); |
| | | }); |
| | |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("æä¸¾å¯¼å
¥æåï¼"); |
| | | return BaseResult.success("屿§å¯¼å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºçç |
| | | List<String> finalRepeatEnumId = repeatEnumId; |
| | | newPOList.stream().forEach(osEnumPO -> { |
| | | if(Func.isBlank(osEnumPO.getId())){//æä¸¾å |
| | |
| | | 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()+"ãè¡ï¼æä¸¾åå¨ç³»ç»ä¸å·²ç»åå¨,请修æ¹!"); |
| | | } |
| | | //å
对æä¸¾åexcelä¸éè¦å¤éå¤ç |
| | |
| | | */ |
| | | 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(); |
| | |
| | | |
| | | 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; |
| | |
| | | @Autowired(required = false) |
| | | @Lazy |
| | | private OsRevisionRuleServiceI self; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * å¿
å¡«å |
| | | */ |
| | | private List<Integer> ColumnNameisRed = new ArrayList<Integer>(); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææççæ¬è§å |
| | |
| | | //çæ¬è§ååè§æ£éª |
| | | 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[]{"åç§°éå¤è¯·æ´æ¢åç§°!"}); |
| | |
| | | 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()); |
| | | } |
| | | }); |
| | | |
| | | //å¹³å°çdeleteStatusæ¹æ³å¿
ä¼ ä¸ä¸ªåæ°ï¼oidãnameåts |
| | | List<VersionRule> vrList = new ArrayList<>(); |
| | | for(OsRevisionRuleDTO vrDTO : osRevisionRuleDTOS){ |
| | | //oidåtså¤ç©º |
| | | 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[]{"å¾
å é¤çç¶æå表ä¸ä¸»é®ãoidããè°æ´æ¶é´ãtsããç¶æåç§°ãnameãä¸è½ä¸ºç©ºï¼"}); |
| | | } |
| | | 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()])); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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个å符"}); |
| | | } |
| | | //åç¼ç¸å
³å¤æ |
| | |
| | | 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) { |
| | |
| | | */ |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨å¤ä¸ªç¼å·è·åè§åçå¼ |
| | | * @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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导åºéä¸ççæ¬è§å |
| | | * @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); |
| | | |
| | | //åexcel |
| | | 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å¹´MMæddæ¥ 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); |
| | | |
| | | //åexcel |
| | | 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("导å
¥çexcelæä»¶ä¸åå¨,{0}",new String[]{file.getPath()}); |
| | | } |
| | | try{ |
| | | //1ã读åexcelä¸çæ°æ®ï¼ç»æå¯¹è±¡ |
| | | 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䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤éçæ¬è§ååï¼valueï¼è¡å·ï¼ |
| | | 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()+"ãè¡ï¼versionrulenameerror"); |
| | | }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()+"ãè¡ï¼åç§°å¨ç³»ç»ä¸å·²ç»åå¨,请修æ¹!"); |
| | | } |
| | | |
| | | //çæ¬è§ååexcelä¸å¤éå¤ç |
| | | 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 |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | | }); |
| | |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList("åç§°(ä¸è½ä¸ºç©º)", "æ ç¾(对åç§°çè§£é)","å¾ç(è·¯å¾)", "æè¿°(å¯ä»¥ä¸ºç©º)") |
| | | Arrays.asList("åç§°(ä¸è½ä¸ºç©º)", "æ ç¾(对åç§°çè§£é)"/*,"å¾ç(è·¯å¾)"*/, "æè¿°(å¯ä»¥ä¸ºç©º)") |
| | | ); |
| | | } |
| | | return new ArrayList<>(Arrays.asList("åç§°", "æ ç¾", "å¾ç", "æè¿°")); |
| | | return new ArrayList<>(Arrays.asList("åç§°", "æ ç¾"/*, "å¾ç"*/, "æè¿°")); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<StatePool> statePoolList = new ArrayList<>(); |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | poList.stream().forEach(osStatusPO -> { |
| | | try { |
| | | StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId()); |
| | |
| | | } 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()+"ãè¡ï¼enumnameerror"); |
| | | if(Func.isBlank(osStatusPO.getId())){//ç¶æåå¤ç©º |
| | | throw new VciBaseException("第ã"+osStatusPO.getRowIndex()+"ãè¡ï¼statusnameerror"); |
| | | }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ä¸å¤éå¤ç |
| | |
| | | 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)); |
| | | |
| | |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("æä¸¾å¯¼å
¥æåï¼"); |
| | | return BaseResult.success("ç¶æå¯¼å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | } |
| | | |
| | | // å建 |
| | | // ä¿®æ¹ |
| | | export function updateAttribute(params) { |
| | | return request({ |
| | | url: "/api/attributeController/updateAttribute", |
| | |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹ |
| | | // å建 |
| | | export function addAttribute(params) { |
| | | return request({ |
| | | url: "/api/attributeController/addAttribute", |
| | |
| | | } |
| | | |
| | | // å¯¼åº |
| | | 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', |
| | |
| | | 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", |
| | | }); |
| | | } |
| | |
| | | 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 |
| | | }); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | }) |
| | | } |
| | | |
| | |
| | | </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" |
| | |
| | | <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> |
| | |
| | | </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" |
| | |
| | | <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> |
| | |
| | | <!-- 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> |
| | |
| | | <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> |
| | |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="æ¥ç使ç¨èå´" |
| | | width="70%" |
| | | width="60%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | |
| | | getUsedAttributeList, |
| | | getEnumMapByType, |
| | | deleteAttributes, |
| | | download, |
| | | exportAttributes, |
| | | downloadAttributeTemplate, |
| | | getBizTypes, |
| | | getAllLtName, |
| | |
| | | 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: { |
| | |
| | | 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 = ""; |
| | |
| | | } |
| | | 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; |
| | |
| | | } |
| | | |
| | | 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 => { |
| | |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="æ¥ç使ç¨èå´" |
| | | width="70%" |
| | | width="60%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | </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, |
| | |
| | | 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', |
| | | } |
| | | ] |
| | | }, |
| | |
| | | |
| | | // æ ç¹å»äºä»¶ |
| | | 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(); // 强å¶å·æ°è¡¨æ ¼ è§£å³è¡¨æ ¼éè¡ |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | ::v-deep { |
| | | .el-scrollbar__wrap { |
| | | overflow: auto !important; |
| | | } |
| | | |
| | | .el-form-item .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | |
| | | .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> |
| | |
| | | <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> |
| | |
| | | |
| | | <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, |
| | |
| | | } |
| | | }, |
| | | 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> |
| | |
| | | .headerCon > .el-button:nth-child(7) { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .upload-demo { |
| | | margin-left: 20px; |
| | | } |
| | | </style> |
| | |
| | | <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> |