From 0a9b9adee6c940e491aed4a6037af2eac53cda1e Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 30 八月 2024 15:59:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java | 33 +++ /dev/null | 0 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/PortalVIPO.java | 88 +++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue | 148 +++++++++++++++- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java | 9 + Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue | 20 +- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java | 169 ++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/QTDPO.java | 46 +++++ Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js | 14 + Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue | 6 Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java | 1 11 files changed, 505 insertions(+), 29 deletions(-) diff --git a/Bin/jre/lib/security/trusted.libraries b/Bin/jre/lib/security/trusted.libraries deleted file mode 100644 index e69de29..0000000 --- a/Bin/jre/lib/security/trusted.libraries +++ /dev/null diff --git a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java index 2ed445e..a5d5e0e 100644 --- a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java +++ b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java @@ -997,6 +997,7 @@ try { for (int sheetIndex = 0; sheetIndex < workbook.getNumberOfSheets(); sheetIndex++) { Sheet sheet = workbook.getSheetAt(sheetIndex); + String sheetName=sheet.getSheetName(); if(StringUtils.isNotBlank(excelOption.getSheetName())){ if(!sheet.getSheetName().equalsIgnoreCase(excelOption.getSheetName())){ continue; diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/PortalVIPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/PortalVIPO.java new file mode 100644 index 0000000..3e077ef --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/PortalVIPO.java @@ -0,0 +1,88 @@ +package com.vci.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 琛ㄥ崟/琛ㄦ牸瀵煎叆杞崲瀵硅薄 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PortalVIPO implements java.io.Serializable { + + private static final long serialVersionUID = -4958371880356252841L; + + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 涓氬姟绫诲瀷鍚嶇О + */ + @ExcelColumn(value="涓氬姟绫诲瀷鍚嶇О",nullable = false) + private String typeName; + + /** + * 鍚嶇О + */ + @ExcelColumn(value="鍚嶇О",nullable = false) + private String viName; + + /** + *涓氬姟绫诲瀷 + */ + private short typeFlag; + /** + * 涓氬姟绫诲瀷 + */ + @ExcelColumn(value="涓氬姟绫诲瀷",nullable = false) + private String typeFlagText; + + /*** + * 琛ㄥ崟绫诲瀷 + */ + private short viType; + /*** + * 琛ㄥ崟绫诲瀷 + */ + @ExcelColumn(value="琛ㄥ崟绫诲瀷",nullable = false) + private String viTypeText; + /*** + * 閰嶇疆淇℃伅 + */ + private String prm; + /** + * 閰嶇疆鏂囨湰 + */ + @ExcelColumn(value="閰嶇疆鏂囨湰") + private String prmFileName; + /*** + * 灞炴�� + */ + @ExcelColumn(value="灞炴��" ,nullable = false) + private String attributeKey; + /*** + * 鏌ヨ妯℃澘鍚嶇О + */ + @ExcelColumn(value="鏌ヨ妯℃澘鍚嶇О" ) + private String qtName; + + /*** + * 鏌ヨ妯℃澘閰嶇疆鏂囨湰 + */ + @ExcelColumn(value="鏌ヨ妯℃澘閰嶇疆鏂囨湰" ) + private String qtNameFile; + /*** + * 鏌ヨ妯℃澘涓氬姟绫诲瀷 + */ + @ExcelColumn(value="鏌ヨ妯℃澘涓氬姟绫诲瀷" ) + private String qtNameType; + + + +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/QTDPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/QTDPO.java new file mode 100644 index 0000000..5b42103 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/QTDPO.java @@ -0,0 +1,46 @@ +package com.vci.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 琛ㄥ崟/琛ㄦ牸瀵煎叆杞崲瀵硅薄 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class QTDPO implements java.io.Serializable { + + private static final long serialVersionUID = 8774827411052362064L; + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 涓氬姟绫诲瀷鍚嶇О + */ + @ExcelColumn(value="涓氬姟绫诲瀷鍚嶇О") + private String typeName; + /** + * 閾炬帴绫诲瀷鍚嶇О + */ + @ExcelColumn(value="閾炬帴绫诲瀷鍚嶇О") + private String linkType; + + /** + *鏌ヨ妯℃澘瀹氫箟鍚嶇О + */ + @ExcelColumn(value="鏌ヨ妯℃澘瀹氫箟鍚嶇О" ) + private String QtdName; + + /*** + * 灞炴�� + */ + @ExcelColumn(value="灞炴��" ) + private String attributeKey; + +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java index 3d37d4c..c14d6ed 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java @@ -1,13 +1,12 @@ package com.vci.web.controller; +import com.vci.constant.FrameWorkLangCodeConstant; import com.vci.corba.common.PLException; import com.vci.dto.ClonePortalVIDTOList; import com.vci.dto.DeletePortalVIDTOList; -import com.vci.dto.OsBtmTypeDTO; import com.vci.dto.PortalVIDTO; import com.vci.pagemodel.KeyValue; import com.vci.pagemodel.PortalVIVO; -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.BaseQueryObject; @@ -15,19 +14,19 @@ import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.util.ControllerUtil; import com.vci.starter.web.util.LangBaseUtil; +import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.enumpck.ItemDblEnum; import com.vci.web.enumpck.ItemTypeEnum; import com.vci.web.service.OsPortalVIServiceI; -import com.vci.web.service.WebBtmIOServiceI; 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.FileNotFoundException; +import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; @@ -165,6 +164,30 @@ } } } + + /** + * 瀵煎嚭鏁版嵁搴撶殑琛ㄤ俊鎭埌excel + * @param file 涓婁紶鐨勬枃浠� + */ + @PostMapping("/importData") + @VciBusinessLog(operateName = "瀵煎叆琛ㄥ崟/琛ㄦ牸") + public BaseResult importData(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 portalVIServiceI.importData(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/OsPortalVIServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java index 223f0d6..abde37b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsPortalVIServiceI.java @@ -9,7 +9,10 @@ import com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.starter.web.pagemodel.BaseResult; import com.vci.starter.web.pagemodel.DataGrid; +import org.springframework.web.multipart.MultipartFile; +import java.io.File; +import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Map; @@ -82,6 +85,12 @@ String exportToExcel(Collection<String> idList); /** + * 瀵煎叆琛ㄥ崟/琛ㄦ牸鏁版嵁 + * @param file 涓婁紶鐨勬枃浠� + * @return + */ + public BaseResult importData(File file)throws Throwable; + /** *鏌ヨ鎵�鏈夎〃鍗曟垨鑰呰〃鏍� * @return key 鏄敓鍛藉懆鏈熺殑缂栧彿鐨勮嫳鏂囧皬鍐� * @throws VciBaseException 鏌ヨ鐨勬椂鍊欏嚭閿欎細鎶涘嚭寮傚父 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java index b8a46a6..45abd95 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.ZipUtil; import com.vci.bo.ItemSeniorQueryBO; import com.vci.common.utility.ObjectUtility; +import com.vci.constant.FrameWorkLangCodeConstant; import com.vci.corba.common.PLException; import com.vci.corba.omd.qtm.QTD; import com.vci.corba.omd.qtm.QTInfo; @@ -12,6 +13,9 @@ import com.vci.dto.*; import com.vci.model.*; import com.vci.pagemodel.*; +import com.vci.po.PortalVIPO; +import com.vci.po.QTDPO; +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.util.ExcelUtil; @@ -26,6 +30,7 @@ import com.vci.web.enumpck.ItemTypeEnum; import com.vci.web.enumpck.PortalVIType; import com.vci.web.enumpck.PortalVITypeFlag; +import com.vci.web.other.BtmQTExportData; import com.vci.web.service.OsAttributeServiceI; import com.vci.web.service.OsPortalVIServiceI; import com.vci.web.service.OsQuereyTemplateServiceI; @@ -39,6 +44,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; import java.io.*; import java.util.*; @@ -126,7 +132,7 @@ dataGrid.setData(portalVIVOS); dataGrid.setTotal(pagePortalVIArrayByPageInfoResult.total); }else{ - dataGrid = new DataGrid<>("娌掓湁鏌ヨ鍒版暟鎹�"); + dataGrid = new DataGrid<>(); } } catch (PLException e) { e.printStackTrace(); @@ -352,6 +358,21 @@ String prmText=UITools.getPRMText(prmDOO2VIS(portalVIDTO.getPrm(),portalVIDTO.getViType())); String prmTextFileName= ObjectUtility.getNewObjectID36() + ".txt"; String prmTextFileNameAllName = xfileName + "." + prmTextFileName; + if (portalVIDTO.getViType() == PortalVIType.Table.getIntVal()) {//濡傛灉瀵煎叆鐨則able锛屽垯闇�瑕佹牎楠岃〃鏍煎叧鑱旂殑琛ㄥ崟鏄惁瀛樺湪锛屽鏋滀笉瀛樺湪鍒欏湪execl涓槸鍚﹀瓨鍦� + PortalVI[] pvs = platformClientUtil.getPortalService().getPortalVIArrayByTypeName(portalVIDTO.getTypeName()); + PRMDTO prmdto= portalVIDTO.getPrm(); + List<PRMItemDTO> prmItemDTOS= prmdto.getPrmItemList(); + if (!CollectionUtils.isEmpty(Arrays.asList(pvs))) { + Optional.ofNullable(prmItemDTOS).orElseGet(()->new ArrayList<>()).stream().forEach(prmItemDTO -> { + Arrays.stream(pvs).forEach(pv -> { + if (prmItemDTO.getItemInObj().equals(pv.typeName + ":" + pv.viName)) { + prmItemDTO.setItemInObj(pv.id); + } + }); + + }); + } + } writeDataToFile(defaultTempFolder,prmTextFileNameAllName,prmText); rowDataList.add(new WriteExcelData(rowIndex[0], 4,prmTextFileName));//閰嶇疆鏂囨湰 @@ -420,6 +441,152 @@ return zip.getAbsoluteFile().getAbsolutePath(); } + @Override + public BaseResult importData(File file)throws Throwable{ + if (file == null) { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + try { + File unzip = ZipUtil.unzip(file); + String filePath=unzip.getAbsolutePath() + File.separator + "export.xls"; + File btmExcel = new File(filePath); + List<PortalVIPO> portalVIPOList=new ArrayList<>(); + List<QTDPO> QTDPOPOList=new ArrayList<>(); + try { + ReadExcelOption PortalVIPOReadExcelOption=new ReadExcelOption(); + PortalVIPOReadExcelOption.setSheetName("portalvi"); + PortalVIPOReadExcelOption.setSheetIndex(0); + portalVIPOList = ExcelUtil.readDataObjectFromExcel(btmExcel, PortalVIPO.class,PortalVIPOReadExcelOption); + //浠巈xecl鑾峰彇鏌ヨ妯℃澘瀹氫箟. + /* ReadExcelOption QTDPOReadExcelOption=new ReadExcelOption(); + QTDPOReadExcelOption.setSheetName("QTD"); + QTDPOReadExcelOption.setSheetIndex(1); + QTDPOPOList = ExcelUtil.readDataObjectFromExcel(btmExcel, QTDPO.class,QTDPOReadExcelOption);*/ + }catch (VciBaseException e){ + throw new Throwable("璇诲彇execl鏁版嵁鍑洪敊锛�"+e.getMessage()); + } + List<PortalVI> portalVIList=new ArrayList<>(); + if(!CollectionUtils.isEmpty(portalVIPOList)){ + Map<String,String>formNameMap=new HashMap<>(); + StringBuffer checkInObj=new StringBuffer(); + StringBuffer checkPortalVI=new StringBuffer(); + List<String> sjkExitsList=new ArrayList<>(); + portalVIPOList.stream().forEach(portalVIPO -> { + PortalVI portalVI=new PortalVI(); + String ploid = ObjectUtility.getNewObjectID36(); + portalVI.id=ploid; + portalVI.viName=portalVIPO.getViName(); + portalVI.typeName=portalVIPO.getTypeName(); + portalVI.viType=PortalVIType.getByLabel(portalVIPO.getViTypeText()).getIntVal(); + portalVI.typeFlag=PortalVITypeFlag.getByLabel(portalVIPO.getTypeFlagText()).getIntVal(); + String fileName= portalVIPO.getPrmFileName(); + String prmStr = readLines(filePath+"."+fileName); + try { + PortalVI[] pvs = platformClientUtil.getPortalService().getPortalVIArrayByTypeName(portalVI.typeName); + if (portalVI.viType == PortalVIType.Table.getIntVal()) {//濡傛灉瀵煎叆鐨則able锛屽垯闇�瑕佹牎楠岃〃鏍煎叧鑱旂殑琛ㄥ崟鏄惁瀛樺湪锛屽鏋滀笉瀛樺湪鍒欏湪execl涓槸鍚﹀瓨鍦� + formNameMap.put(portalVI.typeName + ":" + portalVI.viName, ploid); + PRMDO prmObj = UITools.getPRM(prmStr); + List<PRMItemDO> prmItemList = prmObj.getPrmItemList(); + + if (!CollectionUtils.isEmpty(prmItemList)) { + prmItemList.stream().forEach(prmItemDO -> { + if (!CollectionUtils.isEmpty(Arrays.asList(pvs))) { + Arrays.stream(pvs).forEach(pv -> { + if (prmItemDO.getItemInObj().equals(portalVI.typeName + ":" + pv.viName)) { + prmItemDO.setItemInObj(pv.id); + } + }); + } else { + if (formNameMap.containsKey(prmItemDO.getItemInObj())) { + prmItemDO.setItemInObj(formNameMap.get(prmItemDO.getItemInObj())); + } else { + if (!checkInObj.toString().contains(prmItemDO.getItemInObj())) { + String[] split = prmItemDO.getItemInObj().split(":"); + checkInObj.append(split[1]).append(","); + } + } + } + + }); + } + prmStr = UITools.getPRMText(prmObj); + } + portalVI.prm = prmStr.trim(); + //鏍¢獙琛ㄥ崟鏄惁瀛樺湪 + if (!CollectionUtils.isEmpty(Arrays.asList(pvs))) { + Arrays.stream(pvs).forEach(pv -> { + if (pv.viName.equals(portalVI.viName)) { + checkPortalVI.append(portalVI.viName).append(","); + } + }); + } + //鏍¢獙灞炴�ф槸鍚︽纭� + List<OsAttributeVO> osAttributeVOList = osAttributeService.getOsAttributeVOSByBtName(portalVI.typeName, portalVI.typeFlag); + if (!CollectionUtils.isEmpty(osAttributeVOList)) { + List<String> filedList = osAttributeVOList.stream().map(OsAttributeVO::getId).collect(Collectors.toList()); + List<String> attributeList = VciBaseUtil.str2List(portalVIPO.getAttributeKey()); + //鏁版嵁搴撲笉瀛樺湪 + List<String> sjkExitsLists = Optional.ofNullable(attributeList).orElseGet(() -> new ArrayList<>()).stream().filter(s -> !attributeList.contains(s)).collect(Collectors.toList()); + sjkExitsList.addAll(sjkExitsLists); + } + }catch (Throwable e){ + e.printStackTrace(); + } + portalVIList.add(portalVI); + if(StringUtils.isNotBlank(portalVIPO.getQtName())&&StringUtils.isNotBlank(portalVIPO.getQtNameFile())) { + QTInfo qt = new QTInfo(); + String qtText = readLines(filePath + "." + portalVIPO.getQtNameFile()); + qt.qtText=qtText; + qt.qtName = portalVIPO.getQtName(); + qt.btmName=portalVIPO.getQtName(); + QTInfo qt2 = null; + try { + qt2 = platformClientUtil.getQTDService().getQT(qt.qtName); + if (qt2 == null) { + platformClientUtil.getQTDService().saveQT(qt); + } + } catch (PLException e) { + e.printStackTrace(); + } + + } + }); + if (checkInObj.length() > 0) { + throw new Throwable( checkInObj.toString() + "琛ㄥ崟涓嶅瓨鍦紒"); + } + if (checkPortalVI.length() > 0) { + throw new Throwable( checkInObj.toString() + "鍚嶇О宸茬粡瀛樺湪锛�"); + } + if(sjkExitsList.size()>0){ + throw new Throwable( checkInObj.toString() + "灞炴�у湪绫诲瀷涓笉瀛樺湪锛�"); + } + for (PortalVI pvi : portalVIList) { + platformClientUtil.getPortalService().savePortalVI(pvi); + } + } + }catch (Throwable e){ + // throw new Throwable("瀵煎叆澶辫触锛�"+e.getMessage()); + return BaseResult.fail("瀵煎叆澶辫触锛�"+e.getMessage()); + } + return BaseResult.success("瀵煎叆鎴愬姛"); + } + private String readLines(String filePath){ + StringBuffer sb=new StringBuffer(); + FileInputStream prmFile=null; + try { + prmFile = new FileInputStream(filePath); + List<String> prm= IOUtils.readLines(prmFile,"UTF-8"); + prm.stream().forEach(s -> { + sb.append(s); + }); + } catch (IOException e) { + IOUtils.closeQuietly(prmFile); + e.printStackTrace(); + }finally { + IOUtils.closeQuietly(prmFile); + } + return sb.toString(); + } /** * 鎷疯礉鏁版嵁鍒皐ord妯℃澘涓� * @param fileName 瑕佸啓鍏ョ殑鏁版嵁 diff --git a/Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js b/Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js new file mode 100644 index 0000000..6b3b930 --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js @@ -0,0 +1,14 @@ +import request from '@/router/axios'; + +// 鍒楄〃鏌ヨ +export function gridPortalVIDatas(page,limit,params) { + return request({ + url: "/api/portalVIController/gridPortalVIDatas", + method: "get", + params:{ + page, + limit, + ...params + } + }); +} diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue index ef8fede..00c4b4b 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue @@ -34,7 +34,7 @@ </div> <!-- 宸︿晶鏍� --> <div style="height: calc(100vh - 330px);"> - <avue-tree ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> + <avue-tree ref="tree" v-loading="treeLoading" :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> @@ -927,6 +927,7 @@ name: 'el-icon-tickets', desc: 'el-icon-chat-line-square' }, + treeLoading:false } }, created() { @@ -937,6 +938,7 @@ methods: { //鏍戣〃鏌ヨ getTreeList() { + this.treeLoading = true; getBizTypes().then(res => { const data = res.data.data.map(item => { this.processChildren(item); // 澶勭悊姣忎釜鑺傜偣 @@ -944,8 +946,8 @@ return item.attributes; // 杩斿洖澶勭悊鍚庣殑 attributes }); this.treeData[0].children = data; - console.log(this.treeData); this.inheritTreeData = data; + this.treeLoading = false; }); }, diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue index d93d6cd..36620ac 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue @@ -24,9 +24,9 @@ </basic-container> </el-aside> - <el-main > + <el-main> <basic-container> - <div style="height: 645px" @drop="drop" @dragover.prevent> + <div style="height: 645px" @drop="drop" @dragover.prevent> <div style="display: flex;justify-content: center"> <span style="display: flex;align-items: center; margin-right: 5px;"> <p class="tableTopLabel">鍚嶇О锛�</p> @@ -53,9 +53,9 @@ <h3>椤甸潰瀹氫箟</h3> <el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-row> - <el-col :span="columnNumber"> - <el-tooltip v-for="(item,index) in formList" :key="index" :content="item.name" placement="top"> - <el-form-item class="hiddenLabel" :label="item.name + '锛�'"> + <el-col v-for="(item,index) in formList" :key="index" :span="columnNumber"> + <el-tooltip :content="item.name" placement="top"> + <el-form-item :label="item.name + '锛�'" class="hiddenLabel"> <el-input v-model="item.value" :splaceholder="item.name" size="mini"></el-input> </el-form-item> </el-tooltip> @@ -338,7 +338,7 @@ name: "formDialog", data() { return { - formList:[], + formList: [], optionRightData: [ { name: 'test', @@ -347,7 +347,7 @@ ], form: {}, rules: {}, - columnNumber: 12, + columnNumber: 3, loading: false, visible: false, treeOption: { @@ -562,9 +562,9 @@ const data = JSON.parse(event.dataTransfer.getData('item')); console.log('data', data); const params = { - name:data.label, - value:'', - type:'' + name: data.label, + value: '', + type: '' } this.formList.push(params) } diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue index 8693e99..5509441 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue @@ -4,13 +4,13 @@ <el-aside> <basic-container> <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> - <!-- 宸︿晶鏍� --> - <div style="height: calc(100vh - 280px);"> + <!-- 宸︿晶鏍� --> + <div style="height: calc(100vh - 220px);"> <div style="margin-bottom: 10px;display: flex;justify-content: center"> - <el-radio v-model="treeRadio" label="0">涓氬姟绫诲瀷鏍�</el-radio> - <el-radio v-model="treeRadio" label="1">閾炬帴绫诲瀷鏍�</el-radio> + <el-radio v-model="treeRadio" label="0" @input="TreeRadioChange">涓氬姟绫诲瀷鏍�</el-radio> + <el-radio v-model="treeRadio" label="1" @input="TreeRadioChange">閾炬帴绫诲瀷鏍�</el-radio> </div> - <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> + <avue-tree v-loading="treeLoading" :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> @@ -26,13 +26,17 @@ <el-main> <basic-container> <avue-crud + v-if="!tableStatus" :data="data" - :option="option"> + :option="option" + :page.sync="page" + @size-change="sizeChange" + @current-change="currentChange"> <template slot="menuLeft"> <div style="display: flex; align-items: center;"> <span style="display: inline-block; margin-right: 10px;"> - <el-radio v-model="tableRadio" label="0">琛ㄥ崟</el-radio> - <el-radio v-model="tableRadio" label="1">琛ㄦ牸<span style="color: red;">锛堝厛瀵煎叆琛ㄥ崟锛屽啀瀵煎叆琛ㄦ牸锛侊級</span></el-radio> + <el-radio v-model="tableRadio" label="0" @input="tableRadioChange">琛ㄥ崟</el-radio> + <el-radio v-model="tableRadio" label="1" @input="tableRadioChange">琛ㄦ牸<span style="color: red;">锛堝厛瀵煎叆琛ㄥ崟锛屽啀瀵煎叆琛ㄦ牸锛侊級</span></el-radio> </span> <span style="display: flex;align-items: center; margin-right: 10px;"> <p style="display: flex; flex-shrink: 0;font-size: 14px">鍚嶇О锛�</p> @@ -53,7 +57,7 @@ </el-button> </template> </avue-crud> - <div style="display: flex;justify-content: center;margin-top: 15px"> + <div v-if="!tableStatus" style="display: flex;justify-content: center;margin-top: 15px"> <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">澧炲姞</el-button> <el-button icon="el-icon-delete" plain size="small" type="danger">鍒犻櫎</el-button> <el-button icon="el-icon-document-add" plain size="small" type="primary">鍏嬮殕</el-button> @@ -71,17 +75,44 @@ import basicOption from "@/util/basic-option"; import FormDialog from "@/views/modelingMenu/ui/formDefine/components/formDialog"; import TableDialog from "@/views/modelingMenu/ui/formDefine/components/tableDialog" +import {gridPortalVIDatas} from "@/api/UI/formDefine/api" +import {getBizTypes} from "@/api/modeling/businessType/api"; +import {gridLink} from "@/api/modeling/linkType/api"; +import func from "@/util/func"; export default { name: "index", components: {FormDialog, TableDialog}, data() { return { + page: { + currentPage: 1, + pageSize: 10, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + nodeRow: {}, + treeLoading: false, option: { ...basicOption, addBtn: false, editBtn: false, - delBtn: false + delBtn: false, + column: [ + { + label: '涓氬姟鍚嶇О', + prop: 'typeName', + }, + { + label: '鍚嶇О', + prop: 'viName', + sortable: true, + }, + { + label: '绫诲瀷', + prop: 'viTypeText', + }, + ] }, data: [], tableRadio: "", @@ -92,7 +123,16 @@ } } }, + created() { + this.getTreeList(); + }, + computed: { + tableStatus() { + return func.isEmptyObject(this.nodeRow) + } + }, methods: { + // 鍙充晶鏂板 addClickHandler() { if (!this.tableRadio) { this.$message.error('璇峰湪琛ㄦ牸涓婃柟閫夋嫨鏂板绫诲瀷'); @@ -100,7 +140,93 @@ } this.tableRadio === "0" ? this.$refs.formDialog.visible = true : this.$refs.tableDialog.visible = true; - } + }, + + // 鍒濆鍖栨爲璇锋眰 + getTreeList() { + this.treeLoading = true; + getBizTypes().then(res => { + const data = res.data.data.map(item => { + item.label = item.attributes.id; + return item; + }); + this.treeData = data; + this.treeLoading = false; + }) + }, + + // 宸︿晶涓氬姟绫诲瀷鍒囨崲 + TreeRadioChange(val) { + this.treeLoading = true; + this.resetTable(); + if (val === "0") { + getBizTypes().then(res => { + const data = res.data.data.map(item => { + item.label = item.attributes.id; + return item; + }); + this.treeData = data; + this.treeLoading = false; + }) + } else { + gridLink().then(res => { + const data = res.data.data.map(item => { + item.label = item.name; + return item; + }); + this.treeData = data; + this.treeLoading = false; + }) + } + }, + + // 宸︿晶鏍戠偣鍑� + nodeClick(row) { + console.log(row); + this.tableRadio = null; + this.nodeRow = row; + this.getRightPortalVIDatas(row); + }, + + // 閲嶇疆琛ㄦ牸灞曠ず淇℃伅 鍜� 琛ㄦ牸琛ㄥ崟閫夐」 + resetTable() { + this.data = []; + this.tableRadio = null; + }, + + // 鍙充晶 琛ㄦ牸 琛ㄥ崟 淇℃伅鏌ヨ + getRightPortalVIDatas() { + const params = { + 'conditionMap[typeName]': this.treeRadio === '0' ? this.nodeRow.attributes.id : this.nodeRow.name, + 'conditionMap[viType]': this.tableRadio === '0' ? 'Form' : this.tableRadio === '1' ? 'Table' : '', + 'conditionMap[viTypeFlag]': this.treeRadio === '0' ? 'BtmType' : this.treeRadio === '1' ? 'LinkType' : '', + } + gridPortalVIDatas(this.page.currentPage, this.page.pageSize, params).then(res => { + console.log(res); + if (res.data.code === 200) { + const data = res.data.data; + this.data = data; + this.page.total = res.data.total; + } + }) + }, + + sizeChange(val) { + this.page.pageSize = val; + this.getRightPortalVIDatas(); + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + this.getRightPortalVIDatas(); + }, + + // 琛ㄦ牸 琛ㄥ崟鍒囨崲 + tableRadioChange() { + this.getRightPortalVIDatas(); + }, + } } </script> -- Gitblit v1.9.3