ludc
2024-07-31 fe02c17b263405059837da6e3e5f7a353df58e99
Merge remote-tracking branch 'origin/master'
已修改7个文件
已添加2个文件
1576 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue 1026 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,108 @@
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 yuxc
 * @date 2024/7/30 16:27
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OsLinkTypePO extends BaseModelVO {
    /**
     * ç¦æ­¢ä¿®æ”¹è¿™ä¸ªå€¼
     */
    private static final long serialVersionUID = -2239512786206928201L;
    /**
     * æ‰€åœ¨æ•°æ®è¡Œ
     */
    @ExcelColumn(rowIndexColumn = true,value = "")
    private String rowIndex;
    /**
     * æ ‡ç­¾
     */
    @ExcelColumn(value="标签",nullable = false)
    private String tag;
    /**
     * åç§°
     */
    @ExcelColumn(value="名称",nullable = false)
    private String name;
    /**
     * æè¿°
     */
    @ExcelColumn(value="描述")
    private String description;
    /**
     * å½¢çж
     */
    @ExcelColumn(value="形状")
    private String shape;
    /**
     * to端对应关系
     */
    @ExcelColumn(value="To端对应关系")
    private String relationTo;
    /**
     * From端对应关系
     */
    @ExcelColumn(value="From端对应关系")
    private String relationFrom;
//    /**
//     * å¯¹åº”关系,from端在前,to端在后
//     */
//    @ExcelColumn(value="对应关系,from端在前,to端在后")
//    private String relation;
    /**
     * To端主类型
     */
    @ExcelColumn(value="To端主类型")
    private String primitivesTo;
    /**
     * From端主类型
     */
    @ExcelColumn(value="From端主类型")
    private String primitivesFrom;
    /**
     * å®žçŽ°ç±»
     */
    @ExcelColumn(value="实现类")
    private String implClass;
    /**
     * From端类型列表
     */
    @ExcelColumn(value="From端类型列表")
    private String btmItemsFrom;
    /**
     * To端类型列表
     */
    @ExcelColumn(value="To端类型列表")
    private String btmItemsTo;
    /**
     * å±žæ€§åˆ—表
     */
    @ExcelColumn(value="属性列表")
    private String attributes;
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
@@ -1,14 +1,17 @@
package com.vci.web.controller;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsLinkTypeServiceI;
import org.apache.commons.lang3.StringUtils;
@@ -17,7 +20,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
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.Arrays;
import java.util.HashMap;
@@ -227,4 +233,28 @@
            return objectBaseResult;
        }
    }
    /**
     * å¯¼å‡ºé“¾æŽ¥ç±»åž‹
     * name é“¾æŽ¥ç±»åž‹åç§°
     * @return
     */
    @GetMapping("/expData")
    public void expData(String name,HttpServletResponse response) throws PLException, IOException {
        linkTypeService.expData(name, response);
    }
    /**
     * å¯¼å…¥é“¾æŽ¥ç±»åž‹
     * @param file ä¸Šä¼ çš„æ–‡ä»¶
     * @return
     */
    @PostMapping("/impData")
    @VciUnCheckRight
    public BaseResult impData(MultipartFile file){try {
             return linkTypeService.impData(file);
        }catch (Throwable e) {
            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
        }
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
@@ -8,7 +8,9 @@
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeVO;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
@@ -145,4 +147,16 @@
     * @return åˆ›å»ºç»“æžœ
     */
    BaseResult createView() throws PLException;
    /**
     * å¯¼å‡ºé“¾æŽ¥ç±»åž‹
     * name é“¾æŽ¥ç±»åž‹åç§°
     * @return åˆ›å»ºç»“æžœ
     */
    void expData(String oid, HttpServletResponse response) throws PLException, IOException;
    /**
     * å¯¼å…¥é“¾æŽ¥ç±»åž‹
     * @param file ä¸Šä¼ çš„æ–‡ä»¶
     * @return
     */
    BaseResult impData(MultipartFile file) throws Exception;
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -1,26 +1,40 @@
package com.vci.web.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.corba.omd.ltm.LinkTypeServicePrx;
import com.vci.dto.OsAttributeDTO;
import com.vci.omd.constants.LinkTypeConstants;
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.*;
import com.vci.po.OsAttributePO;
import com.vci.po.OsLinkTypePO;
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.enumpck.VciFieldTypeEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.util.BeanUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
import com.vci.starter.web.util.*;
import com.vci.model.OsLinkTypeDO;
import com.vci.web.service.*;
import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import javafx.scene.shape.HLineTo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,8 +42,10 @@
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.IOException;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -40,6 +56,16 @@
 */
@Service
public class OsLinkTypeServiceImpl implements OsLinkTypeServiceI {
    private static final String OID = "oid";
    private static final String NAME = "name";
    private static final String LABEL = "label";
    private static final String DESCRIPTION = "description";
    private static final String TS = "ts";
    private static final String CREATOR = "creator";
    private static final String CREATETIME = "createTime";
    private static final String MODIFIER = "modifier";
    private static final String MODIFYTIME = "modifyTime";
    /**
     * æ—¥å¿—
@@ -487,6 +513,182 @@
        }
    }
    /**
     * å¯¼å‡ºé“¾æŽ¥ç±»åž‹
     * name é“¾æŽ¥ç±»åž‹åç§°
     * @return åˆ›å»ºç»“æžœ
     */
    @Override
    public void expData(String names, HttpServletResponse response) throws PLException, IOException {
        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
        //写excel
        String excelPath = defaultTempFolder + File.separator + "lt.xls";
        //设置列名
        List<String> columns = new ArrayList<>(
                Arrays.asList("名称", "标签", "实现类", "形状", "From端类型列表", "From端主类型", "From端对应关系",
                        "To端类型列表", "To端主类型", "To端对应关系", "属性列表", "描述")
        );
        try {
            new File(excelPath).createNewFile();
            //设置列
            List<WriteExcelData> excelDataList = new ArrayList<>();
            //设置列头
            for (int index = 0; index < columns.size(); index++) {
                excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
            }
            HashSet<String> attributes = new HashSet<>();
            int i = 0;
            for (String name : names.split(",")) {
                LinkType lt = platformClientUtil.getLinkTypeService().getLinkType(name);
                excelDataList.add(new WriteExcelData(i+1,0, lt.name));
                excelDataList.add(new WriteExcelData(i+1,1, lt.tag));
                excelDataList.add(new WriteExcelData(i+1,2, lt.implClass));
                excelDataList.add(new WriteExcelData(i+1,3, lt.shape));
                excelDataList.add(new WriteExcelData(i+1,4, String.join(",",lt.btmItemsFrom)));
                excelDataList.add(new WriteExcelData(i+1,5, lt.primitivesFrom));
                excelDataList.add(new WriteExcelData(i+1,6, lt.relationFrom));
                excelDataList.add(new WriteExcelData(i+1,7, String.join(",",lt.btmItemsTo)));
                excelDataList.add(new WriteExcelData(i+1,8, lt.primitivesTo));
                excelDataList.add(new WriteExcelData(i+1,9, lt.relationTo));
                excelDataList.add(new WriteExcelData(i+1,10, String.join(",",lt.attributes)));
                excelDataList.add(new WriteExcelData(i+1,11, lt.description));
                attributes.addAll(Arrays.asList(lt.attributes));
                i++;
            }
            WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
            ExcelUtil.writeDataToFile(excelPath, excelOption);
            //导出属性
            String attrPath = attributeService.exportAttributes("attr",
                    String.valueOf(attributes.stream().collect(Collectors.joining(","))));
            //移动属性到链接类型文件夹里面去
            FileUtil.move(new File(attrPath), new File(defaultTempFolder),true);
            FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\")));
            //todo å¯¼å‡ºä¸šåŠ¡ç±»åž‹è¿˜æ²¡æœ‰å®žçŽ°
//            List<BizType> bts = new ArrayList<BizType>();
//            for (String btName : btNameSet) {
//                BizType bt = BtmProvider.getBtmItemByName(btName);
//                bts.add(bt);
//            }
//            boolean btFlag = BtmProvider.expData(rootPath, bts.toArray(new BizType[0]));
        }catch (IOException e) {
            throw new RuntimeException(e);
        }
        File zip = ZipUtil.zip(defaultTempFolder);
        FileUtil.del(defaultTempFolder + File.separator);
        ControllerUtil.writeFileToResponse(response,zip.getAbsoluteFile());
    }
    /**
     * å¯¼å…¥é“¾æŽ¥ç±»åž‹
     * @param file ä¸Šä¼ çš„æ–‡ä»¶
     * @return
     */
    @Override
    public BaseResult impData(MultipartFile file) throws Exception {
        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
        String fileName = defaultTempFolder + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
        file.transferTo(new File(fileName));
        if (file == null) {
            return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
        }
        if (!fileName.endsWith(".zip")) {
            throw new VciBaseException("仅能上传zip压缩文件,请重新上传!");
        }
        File unzip = ZipUtil.unzip(fileName);
        File ltExcel = new File(unzip.getAbsolutePath() + File.separator + "lt.xls");
        File attrExcel = new File(unzip.getAbsolutePath() + File.separator + "attr.xls");
        if (!attrExcel.exists()) {
            //增加解压的路径,看文件还在没有
            attrExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "attr.xls");
            if (!attrExcel.exists()) {
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"没有导入的属性文件。导入终止!"});
            }
        }
        BaseResult baseResult = attributeService.importAttributes(attrExcel);
        if(!baseResult.isSuccess()){
            //删除上传的文件夹
            FileUtil.del(defaultTempFolder + File.separator);
            return baseResult;
        }
        //todo è¿˜éœ€å¯¼å…¥ä¸šåŠ¡ç±»åž‹ï¼Œç­‰å¾…åŠŸèƒ½å®žçŽ°
        if (!ltExcel.exists()) {
            //增加解压的路径,看文件还在没有
            ltExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "lt.xls");
            if (!ltExcel.exists()) {
                //删除上传的文件夹
                FileUtil.del(defaultTempFolder + File.separator);
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"没有导入的链接文件。导入终止!"});
            }
        }
        try{
            //1、读取excel中的数据,组成对象
            ReadExcelOption excelOption = new ReadExcelOption();
            List<OsLinkTypePO> poList = ExcelUtil.readDataObjectFromExcel(ltExcel, OsLinkTypePO.class,excelOption,(value, po, fieldName)->{});
            //去除都是空的情况
            if(CollectionUtils.isEmpty(poList)){
                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
            }
            //当前excel中是否重复用的判重Map:(key:判重属性,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            poList.stream().forEach(osLinkTypePO -> {
                if(Func.isBlank(osLinkTypePO.getName())){//属性名判空
                    throw new VciBaseException("第【"+osLinkTypePO.getRowIndex()+"】行,name");
                }else if(osLinkTypePO.getName().length() > maxLength){
                    throw new VciBaseException("第【"+osLinkTypePO.getRowIndex()+"】行,链接类型名长度不能超过" + maxLength);
                }else if(!osLinkTypePO.getName().matches("^[A-Za-z]+$")){
                    throw new VciBaseException("第【"+osLinkTypePO.getRowIndex()+"】行,链接类型名称只能为英文字母");
                }else if(excelReapeat.containsKey(osLinkTypePO.getName())){//属性名表格中判重
                    throw new VciBaseException("第【"+excelReapeat.get(osLinkTypePO.getName())+"】行和第【"+osLinkTypePO.getRowIndex()+"】行数据,属性名重复");
                }
                try {
                    LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(osLinkTypePO.getName());
                    //已有此数据进行删除覆盖
                    if(historyLink != null && !historyLink.name.equals("")){
                        platformClientUtil.getLinkTypeService().deleteLinkType(historyLink);
                    }
                } catch (PLException e) {
                    throw new RuntimeException(e);
                }
                //属性名excel中判重处理
                excelReapeat.put(osLinkTypePO.getName(),osLinkTypePO.getRowIndex());
                LinkType linkType = new LinkType();
                linkType.name = osLinkTypePO.getName();
                linkType.attributes = osLinkTypePO.getAttributes().split(",");
                linkType.btmItemsFrom = osLinkTypePO.getBtmItemsFrom().split(",");
                linkType.primitivesFrom = osLinkTypePO.getPrimitivesFrom();
                linkType.relationFrom = osLinkTypePO.getRelationFrom();
                linkType.btmItemsTo = osLinkTypePO.getBtmItemsTo().split(",");
                linkType.primitivesTo = osLinkTypePO.getPrimitivesTo();
                linkType.relationTo = osLinkTypePO.getRelationTo();
                linkType.relation = osLinkTypePO.getRelationFrom() + ":" + osLinkTypePO.getRelationTo();
                linkType.description = osLinkTypePO.getDescription();
                linkType.tag = osLinkTypePO.getTag();
                linkType.shape = osLinkTypePO.getShape();
                linkType.implClass = osLinkTypePO.getImplClass();
                linkType.modifier = WebUtil.getCurrentUserId();
                linkType.creator = WebUtil.getCurrentUserId();
                try {
                    platformClientUtil.getLinkTypeService().addLinkType(linkType);
                } catch (PLException e) {
                    throw new RuntimeException(e);
                }
            });
        }catch (Exception e){
            if(logger.isErrorEnabled()){
                logger.error("读取excel内容时或保存用户信息时出现了错误,具体原因:",VciBaseUtil.getExceptionMessage(e));
            }
            e.printStackTrace();
            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
        }
        //删除上传的文件夹
        FileUtil.del(defaultTempFolder + File.separator);
        return BaseResult.success("链接类型导入成功!");
    }
    /**
     * ä¿®å¤é“¾æŽ¥ç±»åž‹çš„xml文件
Source/plt-web/plt-web-ui/src/api/modeling/attributePool/api.js
@@ -13,14 +13,23 @@
  });
}
// // åˆ›å»º
// export function gridAttribute(params) {
//   return request({
//     url: "/api/attributeController/gridAttribute",
//     method: "post",
//     params
//   });
// }
// åˆ›å»º
export function updateAttribute(params) {
  return request({
    url: "/api/attributeController/updateAttribute",
    method: "put",
    data:params
  });
}
// ä¿®æ”¹
export function addAttribute(params) {
  return request({
    url: "/api/attributeController/addAttribute",
    method: "post",
    data:params
  });
}
// åˆ é™¤
export function deleteAttributes(params) {
@@ -48,3 +57,44 @@
    params:params
  });
}
// ä¸‹è½½å¯¼å…¥æ¨¡æ¿
export function downloadAttributeTemplate  (params) {
  return request({
    url: '/api/attributeController/downloadAttributeTemplate',
    method: 'get',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    params
  })
}
// å¯¼å‡º
export function download  (params) {
  return request({
    url: '/api/attributeController/importAttributes',
    method: 'get',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    params
  })
}
// ä¸šåŠ¡ç±»åž‹å‚ç…§
export function getBizTypes(params) {
  return request({
    url: "/api/btmTypeController/getBizTypes",
    method: "get",
    params:params
  });
}
// é“¾æŽ¥ç±»åž‹å‚ç…§
export function getAllLtName(params) {
  return request({
    url: "/api/linkTypeController/getAllLtName",
    method: "get",
    params:params
  });
}
Source/plt-web/plt-web-ui/src/api/modeling/statusPool/api.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
import request from '@/router/axios';
// åˆ—表查询
export function gridStatus(params) {
  return request({
    url: "/api/statusController/gridStatus",
    method: "get",
  });
}
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue
@@ -21,6 +21,10 @@
            <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button>
            <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板
            </el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadHandler">导入</el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downLoadHandler">导出</el-button>
          </template>
          <template slot="menu" slot-scope="scope">
@@ -32,7 +36,7 @@
        </avue-crud>
      </basic-container>
    </el-main>
    <!-- å³ä¾§ä¿¡æ¯   -->
    <el-aside width="30%">
      <basic-container>
        <div style="height: 85vh; overflow-y: auto">
@@ -126,7 +130,7 @@
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                æžšä¸¾ç±»åž‹
                å½“前枚举类型
              </template>
              {{ lastItem.enumId }}
            </el-descriptions-item>
@@ -149,15 +153,15 @@
              <template slot="label">
                ä½¿ç”¨æžšä¸¾
              </template>
              <el-tag :type="lastItem.enumId ? 'success' : 'danger'">
                {{ lastItem.enumId ? '是' : '否' }}
              <el-tag :type="lastItem.enumFlag ? 'success' : 'danger'">
                {{ lastItem.enumFlag ? '是' : '否' }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                æžšä¸¾ç±»åž‹
              </template>
              {{ lastItem.enumId }}
              {{ lastItem.enumFlag }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
@@ -187,7 +191,265 @@
        </div>
      </basic-container>
    </el-aside>
    <!-- æ–°å¢žå¯¹è¯æ¡†    -->
    <el-dialog
      v-dialogDrag
      v-loading="addLoading"
      :title="dialogTitle === 'add' ? '创建' : '编辑'"
      :visible.sync="addVisible"
      append-to-body="true"
      class="avue-dialog"
      width="65%"
      @close="addEscHandler"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <div class="addDialog">
            <div>
              <h3>属性项</h3>
              <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="attributeDataType">
                  <el-select v-model="form.attributeDataType" placeholder="请选择属性类型" @change="attributeDataTypeChange">
                    <el-option v-for="item in typeSelectList" :label="item" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="描述:" prop="description">
                  <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
                </el-form-item>
              </el-col>
            </div>
            <div v-if="!hideType" class="addDialogBottom">
              <div class="left">
                <h3>{{ form.attributeDataType }}</h3>
                <el-form-item
                  v-if="form.attributeDataType !== 'VTInteger' && form.attributeDataType !== 'VTLong'
                  && form.attributeDataType !== 'VTDouble' && form.attributeDataType !== 'VTBoolean'"
                  label="长度:" prop="attrLength">
                  <el-input v-model="form.attrLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTDouble'" label="精度:" prop="precisionLength">
                  <el-input v-model="form.precisionLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTDouble'" label="长度:" prop="scaleLength">
                  <el-input v-model="form.scaleLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType !== 'VTBoolean' && !form.enumSwitch" label="默认值:"
                              prop="defaultValue">
                  <el-input v-model="form.defaultValue"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTBoolean'" label="默认值:" prop="defaultValue">
                  <el-select v-model="form.defaultValue">
                    <el-option label="false" value="false"></el-option>
                    <el-option label="true" value="true"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType !== 'VTBoolean' && form.enumSwitch" label="默认值:"
                              prop="defaultValue">
                  <el-select v-model="form.defaultValue">
                    <el-option v-for="(item,index) in rangeOptionValue" :key="index" :label="item"
                               :value="item"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="允许为空:" prop="nullableFlag">
                  <el-switch v-model="form.nullableFlag"></el-switch>
                </el-form-item>
              </div>
              <el-divider direction="vertical"></el-divider>
              <!--  VTString   -->
              <div v-if="form.attributeDataType === 'VTString'" class="right">
                <h3>值域</h3>
                <el-form-item label="当前值域类型:" prop="attributeSelectType">
                  <el-select v-model="form.attributeSelectType" placeholder="请选择属性类型"
                             @change="attributeSelectTypeChange">
                    <el-option label="业务类型" value="business"></el-option>
                    <el-option label="链接类型" value="link"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item v-if="form.attributeSelectType === 'link'" label="版本次:" prop="version">
                  <el-select v-model="form.version" placeholder="请选择版本次">
                    <el-option :value="1" label="当前版本次"></el-option>
                    <el-option :value="3" label="最新版本次"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="选择参照类型:" prop="referValue">
                  <el-input v-model="form.referValue" @focus="referFormFocusHandler"></el-input>
                </el-form-item>
                <span v-if="!form.referValue">
                <el-form-item label="使用枚举:" prop="enumSwitch">
                  <el-switch v-model="form.enumSwitch" @change="switchEnumChange"></el-switch>
                </el-form-item>
                <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"
                               :value="item.key"></el-option>
                  </el-select>
                  <el-input v-if="!form.enumSwitch" v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item v-if="!form.enumSwitch" label="运算符:">
                  <div>
                    <el-button size="mini" @click="enumAddHandler"> = </el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:" prop="rangeValue">
                  <textarea v-model="form.rangeValue"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
                </span>
              </div>
              <!--  VTInteger VTLong   -->
              <div v-if="form.attributeDataType === 'VTInteger' || form.attributeDataType === 'VTLong' " class="right">
                <h3>值域</h3>
                <el-form-item label="使用枚举:" prop="enumSwitch">
                  <el-switch v-model="form.enumSwitch" @change="switchEnumChange"></el-switch>
                </el-form-item>
                <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"
                               :value="item.key"></el-option>
                  </el-select>
                  <el-input v-if="!form.enumSwitch" v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item v-if="!form.enumSwitch" label="运算符:">
                  <div>
                    <el-button size="mini" @click="operationHandler('>')"> > </el-button>
                    <el-button size="mini" @click="operationHandler('<')"> < </el-button>
                    <el-button size="mini" @click="operationHandler('>=')"> >= </el-button>
                    <el-button size="mini" @click="operationHandler('<=')"> <= </el-button>
                    <el-button size="mini" @click="operationHandler('=')"> = </el-button>
                    <el-button size="mini" @click="operationHandler('!=')"> != </el-button>
                    <el-button size="mini" @click="operationHandler('()')"> () </el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:" prop="rangeValue">
                  <textarea v-model="form.rangeValue"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
              </div>
              <!--   VTDouble    -->
              <div v-if="form.attributeDataType === 'VTDouble'" class="right">
                <h3>值域</h3>
                <el-form-item label="添加枚举值:" prop="enumAddValue">
                  <el-input v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item label="运算符:">
                  <div>
                    <el-button size="mini" @click="operationHandler('>')"> > </el-button>
                    <el-button size="mini" @click="operationHandler('<')"> < </el-button>
                    <el-button size="mini" @click="operationHandler('>=')"> >= </el-button>
                    <el-button size="mini" @click="operationHandler('<=')"> <= </el-button>
                    <el-button size="mini" @click="operationHandler('=')"> = </el-button>
                    <el-button size="mini" @click="operationHandler('!=')"> != </el-button>
                    <el-button size="mini" @click="operationHandler('()')"> () </el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:" prop="rangeValue">
                  <textarea v-model="form.rangeValue"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
              </div>
            </div>
          </div>
        </el-row>
      </el-form>
      <!-- ä¸šåŠ¡ç±»åž‹å¯¹è¯æ¡†      -->
      <el-dialog
        v-dialogDrag
        :visible.sync="businessVisible"
        append-to-body="true"
        class="avue-dialog"
        title="业务类型选择"
        width="70%"
      >
        <avue-crud
          ref="businessCrud"
          :data="businessData"
          :option="businessOption"
          :table-loading="businessLoading"
          @search-change="businessHandleSearch"
          @search-reset="businessHandleReset"
          @row-click="businessRowClick"
        >
        </avue-crud>
        <span slot="footer" class="dialog-footer">
          <el-button @click="businessEmpty">清 ç©º</el-button>
         <el-button @click="businessVisible = false">取 æ¶ˆ</el-button>
         <el-button type="primary" @click="businessSaveHandler">ç¡® å®š</el-button>
        </span>
      </el-dialog>
      <!-- é“¾æŽ¥ç±»åž‹å¯¹è¯æ¡†      -->
      <el-dialog
        v-dialogDrag
        :visible.sync="linkTypeVisible"
        append-to-body="true"
        class="avue-dialog"
        title="链接类型选择"
        width="70%"
      >
        <avue-crud
          ref="linkTypeCrud"
          :data="linkTypeData"
          :option="linkTypeOption"
          :table-loading="linkTypeLoading"
          @search-change="linkHandleSearch"
          @search-reset="linkHandleReset"
          @row-click="linkRowClick"
        >
        </avue-crud>
        <span slot="footer" class="dialog-footer">
          <el-button @click="linkEmpty">清 ç©º</el-button>
         <el-button @click="linkTypeVisible = false">取 æ¶ˆ</el-button>
         <el-button type="primary" @click="linkSaveHandler">ç¡® å®š</el-button>
        </span>
      </el-dialog>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addEscHandler">取 æ¶ˆ</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="getTableList"></upload-file>
    <!-- æŸ¥çœ‹ä½¿ç”¨èŒƒå›´    -->
    <el-dialog
      v-dialogDrag
@@ -208,204 +470,104 @@
      </avue-crud>
    </el-dialog>
    <!-- æ–°å¢žå¯¹è¯æ¡†    -->
    <el-dialog
      v-dialogDrag
      v-loading="addLoading"
      :visible.sync="addVisible"
      append-to-body="true"
      class="avue-dialog"
      title="创建"
      width="65%"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <div class="addDialog">
            <div>
              <h3>属性项</h3>
              <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="标签:">
                  <el-input v-model="form.name"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="属性类型:">
                  <el-select v-model="form.attributeDataType" placeholder="请选择属性类型" @change="attributeDataTypeChange">
                    <el-option v-for="item in typeSelectList" :label="item" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="描述:">
                  <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
                </el-form-item>
              </el-col>
            </div>
            <div v-if="!hideType" class="addDialogBottom">
              <div class="left">
                <h3>{{ form.attributeDataType }}</h3>
                <el-form-item
                  v-if="form.attributeDataType !== 'VTInteger' && form.attributeDataType !== 'VTLong'
                  && form.attributeDataType !== 'VTDouble' && form.attributeDataType !== 'VTBoolean'"
                  label="长度:">
                  <el-input v-model="form.attrLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTDouble'" label="精度:">
                  <el-input v-model="form.precisionLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTDouble'" label="长度:">
                  <el-input v-model="form.scaleLength"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType !== 'VTBoolean'" label="默认值:">
                  <el-input v-model="form.defaultValue"></el-input>
                </el-form-item>
                <el-form-item v-if="form.attributeDataType === 'VTBoolean'" label="默认值:">
                  <el-select>
                    <el-option label="false" value="false"></el-option>
                    <el-option label="true" value="true"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="允许为空:">
                  <el-switch v-model="form.nullableFlag"></el-switch>
                </el-form-item>
              </div>
              <el-divider direction="vertical"></el-divider>
              <!--  VTString   -->
              <div v-if="form.attributeDataType === 'VTString'" class="right">
                <h3>值域</h3>
                <el-form-item label="当前值域类型:">
                  <el-select v-model="form.attributeSelectType" placeholder="请选择属性类型" @change="attributeSelectTypeChange">
                    <el-option label="业务类型" value="business"></el-option>
                    <el-option label="链接类型" value="link"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="选择参照类型:">
                  <el-input v-model="form.attrLength"></el-input>
                </el-form-item>
                <el-form-item label="使用枚举:">
                  <el-switch v-model="form.enumSwitch" @change="switchEnumChange"></el-switch>
                </el-form-item>
                <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加枚举值:'">
                  <el-select v-if="form.enumSwitch" v-model="form.attributeDataTypePick" placeholder="请选择枚举类型"
                             @change="enumSelectChange">
                    <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key"
                               :value="item.key"></el-option>
                  </el-select>
                  <el-input v-if="!form.enumSwitch" v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item v-if="!form.enumSwitch" label="运算符:">
                  <div>
                    <el-button size="mini" @click="enumAddHandler"> =</el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:">
                  <textarea v-model="form.range"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
              </div>
              <!--  VTInteger VTLong   -->
              <div v-if="form.attributeDataType === 'VTInteger' || form.attributeDataType === 'VTLong' " class="right">
                <h3>值域</h3>
                <el-form-item label="使用枚举:">
                  <el-switch v-model="form.enumSwitch" @change="switchEnumChange"></el-switch>
                </el-form-item>
                <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加枚举值:'">
                  <el-select v-if="form.enumSwitch" v-model="form.attributeDataTypePick" placeholder="请选择枚举类型"
                             @change="enumSelectChange">
                    <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key"
                               :value="item.key"></el-option>
                  </el-select>
                  <el-input v-if="!form.enumSwitch" v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item v-if="!form.enumSwitch" label="运算符:">
                  <div>
                    <el-button size="mini"> ></el-button>
                    <el-button size="mini"> <</el-button>
                    <el-button size="mini"> >=</el-button>
                    <el-button size="mini"> <=</el-button>
                    <el-button size="mini"> =</el-button>
                    <el-button size="mini"> !=</el-button>
                    <el-button size="mini"> ( )</el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:">
                  <textarea v-model="form.range"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
              </div>
              <!--   VTDouble    -->
              <div v-if="form.attributeDataType === 'VTDouble'" class="right">
                <h3>值域</h3>
                <el-form-item label="添加枚举值:">
                  <el-input v-model="form.enumAddValue">
                  </el-input>
                </el-form-item>
                <el-form-item label="运算符:">
                  <div>
                    <el-button size="mini"> ></el-button>
                    <el-button size="mini"> <</el-button>
                    <el-button size="mini"> >=</el-button>
                    <el-button size="mini"> <=</el-button>
                    <el-button size="mini"> =</el-button>
                    <el-button size="mini"> !=</el-button>
                    <el-button size="mini"> ( )</el-button>
                  </div>
                </el-form-item>
                <el-form-item label="当前枚举值:">
                  <textarea v-model="form.range"
                            style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;">
                  </textarea>
                </el-form-item>
              </div>
            </div>
          </div>
        </el-row>
      </el-form>
    </el-dialog>
  </el-container>
</template>
<script>
import {gridAttribute, getUsedAttributeList, getEnumMapByType} from "@/api/modeling/attributePool/api";
import {
  gridAttribute,
  getUsedAttributeList,
  getEnumMapByType,
  deleteAttributes,
  download,
  downloadAttributeTemplate,
  getBizTypes,
  getAllLtName,
  addAttribute,
  updateAttribute
} from "@/api/modeling/attributePool/api";
import basicOption from '@/util/basic-option';
import {column} from "./option"
import func from "@/util/func";
export default {
  name: "index",
  data() {
    return {
      rules: {
        id: [
          {required: true, message: '请输入名称', trigger: 'blur'},
          {pattern: /^[a-zA-Z]+$/, message: '只能输入英文字符', trigger: 'blur'}
        ]
      },
      dialogTitle: "",
      businessRow: {},
      linkRow: {},
      linkDataSearch: [],
      businessSearchParams: {},
      linkTypeSearchParams: {},
      businessLoading: false,
      linkTypeLoading: false,
      businessVisible: false,
      linkTypeVisible: false,
      businessData: [],
      linkTypeData: [],
      businessOption: {
        ...basicOption,
        addBtn: false,
        menu: false,
        searchMenuSpan: 8,
        selection: false,
        refreshBtn: false,
        searchLabelWidth: 100,
        highlightCurrentRow: true,
        column: [
          {
            label: '业务类型名',
            prop: 'name',
            sortable: true,
            search: true
          },
          {
            label: '标签',
            prop: 'label',
            sortable: true,
          },
          {
            label: '父类',
            prop: 'fName',
            sortable: true,
          },
          {
            label: '版本规则',
            prop: 'revRuleName',
            sortable: true,
          },
          {
            label: '生命周期',
            prop: 'lifeCycle',
            sortable: true,
          },
        ]
      },
      linkTypeOption: {
        ...basicOption,
        addBtn: false,
        menu: false,
        searchMenuSpan: 8,
        selection: false,
        refreshBtn: false,
        searchLabelWidth: 100,
        highlightCurrentRow: true,
        column: [
          {
            label: '链接类型名',
            prop: 'name',
            sortable: true,
            search: true
          },
        ]
      },
      tableData: [],
      option: {
        ...basicOption,
@@ -463,30 +625,30 @@
        description: "",
        nullableFlag: true,
        attrLength: 50,
        enumId: false,
        enumFlag: false,
        enumId: "",
        enumSwitch: false,
        attributeDataTypePick: "",
        enumAddValue: '',
        range: ''
        enumAddValue: "",
        range: "",
        attributeSelectType: "business",
        version: 1,
        defaultValue: "",
        referValue: "",
        btmTypeId: "",
        linkTypeName: "",
        rangeValue: ""
      },
      defaultForm: {
        id: "",
        name: "",
        attributeDataType: "VTString",
        description: "",
        nullableFlag: true,
        attrLength: 50,
        enumId: false,
        enumSwitch: false,
        attributeDataTypePick: "",
        enumAddValue: '',
        range: '',
        attributeSelectType:'business'
      },
      rules: [],
      typeSelectList: ['VTString', 'VTInteger', 'VTLong', 'VTDouble', 'VTBoolean', 'VTDate', 'VTTime', 'VTDateTime', 'VTNote', 'VTFilePath', 'VTClob'],
      attributeDataTypePickList: [],
      enumAddListChange: []
      enumAddListChange: [],
      tipList: [
        "属性名和属性类型为必填字段,并且属性名不可和系统中已有属性名重复",
        "当属性类型为VTString时属性长度列必填,为其他类型时不必填写",
        "取值范围列填写时请用英文 ; åˆ†éš”,不填写时默认使用当前选中的枚举的所有枚举项的值作为取值范围"
      ],
      upFileType: ['xls', 'xlsx'],
      fileUrl: 'api/attributeController/importAttributes',
    }
  },
  computed: {
@@ -518,6 +680,9 @@
        this.form.attributeDataType === 'VTClob' ||
        this.form.attributeDataType === 'VTDateTime' ||
        this.form.attributeDataType === 'VTFilePath';
    },
    rangeOptionValue() {
      return this.form.rangeValue.split('\n')
    }
  },
  methods: {
@@ -540,13 +705,18 @@
    },
    // æœç´¢
    handleSearch() {
    handleSearch(params, done) {
      this.searchParams = {
        "conditionMap[id]": "*" + params.id + "*"
      };
      this.getTableList()
      done();
    },
    // é‡ç½®æœç´¢æ¡ä»¶
    handleReset() {
      this.searchParams = {};
      this.getTableList();
    },
    // é€‰æ‹©æ¡†
@@ -557,7 +727,6 @@
    // ç‚¹å‡»è¡Œ
    rowClickHandler(row) {
      this.$refs.userCrud.toggleRowSelection(row);
      console.log(row);
    },
    // æ¡æ•°
@@ -573,12 +742,67 @@
    // åˆ›å»ºæ‰“开对话框
    rowSaveHandlerClick() {
      this.addVisible = true;
      this.form = this.defaultForm;
      this.dialogTitle = "add";
      this.getEnumMapByTypeHandler('VTString');
    },
    allDelHandler() {
    // è¡Œåˆ é™¤
    rowDeleteHandler(row) {
      let params = {
        oid: row.oid,
        name: row.id,
        ts: row.ts
      };
      let data = [params];
      this.$confirm('您确定要删除当前的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteAttributes(data).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // å¤šé€‰åˆ é™¤
    allDelHandler() {
      if (this.selectList.length <= 0) {
        this.$message.error('请至少选择一条数据进行删除!')
        return;
      }
      let data = this.selectList.map(item => {
        return {
          oid: item.oid,
          name: item.id,
          ts: item.ts
        }
      })
      this.$confirm('您确定要删除所选择的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteAttributes(data).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // æŸ¥çœ‹ä½¿ç”¨èŒƒå›´
@@ -624,19 +848,38 @@
      this.checkViewData = this.checkViewDataSearch;
    },
    // è¡Œç¼–辑按钮
    editBtnClick(row) {
      this.dialogTitle = "edit";
      this.form = {...row};
    editBtnClick() {
      if (row.enumId) this.form.enumSwitch = true;
      this.form.rangeValue = row.range.replace(/;/g, '\n');
    },
      if (row.btmTypeId) {
        this.form.attributeSelectType = 'business'
        this.form.referValue = row.btmTypeId;
      }
      if (row.linkTypeName) {
        this.form.attributeSelectType = 'link'
        this.form.referValue = row.linkTypeName;
      }
    rowDeleteHandler() {
      this.getEnumMapByTypeHandler(this.form.attributeDataType)
      this.addVisible = true;
    },
    // å±žæ€§ç±»åž‹ä¸‹æ‹‰æ¡†change
    attributeDataTypeChange(val) {
      this.form.rangeValue = null;
      this.getEnumMapByTypeHandler(val);
      this.form.enumSwitch = false;
      if (val === 'VTBoolean') {
        this.form.defaultValue = 'false';
      } else {
        this.form.defaultValue = '';
      }
    },
    // å±žæ€§ç±»åž‹ä¸‹æ‹‰æ¡†æ•°æ®å¤„理
@@ -663,24 +906,28 @@
    // ä½¿ç”¨æžšä¸¾æ—¶ æžšä¸¾é€‰æ‹©ä¸‹æ‹‰æ¡†change事件
    enumSelectChange(val) {
      const list = this.attributeDataTypePickList.find(item => item.key === val).values;
      this.form.range = list.join('\n');
      this.form.rangeValue = list.join('\n');
      this.form.defaultValue = list[0];
    },
    // ä½¿ç”¨æžšä¸¾switch滑块change事件
    switchEnumChange(status) {
      if (status) {
        this.form.attributeDataTypePick = this.attributeDataTypePickList[0].key;
        this.form.enumId = this.attributeDataTypePickList[0].key;
        this.form.defaultValue = this.attributeDataTypePickList[0].values[0];
        const list = this.attributeDataTypePickList[0].values;
        this.form.range = list.join('\n');
        this.form.rangeValue = list.join('\n');
      } else {
        this.form.range = "";
        this.form.defaultValue = "";
        this.form.rangeValue = "";
        this.enumId = "";
      }
    },
    // ä¸ä½¿ç”¨æžšä¸¾ æ‰‹åŠ¨æ·»åŠ æžšä¸¾å€¼
    enumAddHandler() {
      // æ£€æŸ¥å’Œè½¬æ¢ this.form.range ä¸ºæ•°ç»„,同时排除空值
      let currentRangeArray = this.form.range ? this.form.range.split('\n').filter(item => item.trim() !== '') : [];
      let currentRangeArray = this.form.rangeValue ? this.form.rangeValue.split('\n').filter(item => item.trim() !== '') : [];
      let newValue = this.form.enumAddValue.trim();
      if (currentRangeArray.includes(newValue)) {
@@ -690,14 +937,333 @@
      currentRangeArray.push(newValue);
      this.enumAddListChange = currentRangeArray;
      this.form.range = currentRangeArray.join('\n');
      this.form.rangeValue = currentRangeArray.join('\n');
      this.form.enumAddValue = "";
    },
    // ä¸ä½¿ç”¨æžšä¸¾ æ‰‹åŠ¨æ·»åŠ æžšä¸¾å€¼(多个运算符)
    operationHandler(val) {
      // æ£€æŸ¥å’Œè½¬æ¢ this.form.rangeValue ä¸ºæ•°ç»„,同时排除空值
      let currentRangeArray = this.form.rangeValue
        ? this.form.rangeValue.split('\n').filter(item => item.trim() !== '')
        : [];
      // å¤„理 '()' è¿ç®—符的情况
      if (val === '()') {
        // åˆ‡å‰² enumAddValue çš„逗号
        let values = this.form.enumAddValue.split(',').map(item => item.trim());
        // æ£€æŸ¥æ˜¯å¦æœ‰æœ‰æ•ˆçš„值
        if (values.length < 2 || values.some(item => item === '')) {
          this.$message.error('请输入有效的值,并用逗号分隔!');
          return;
        }
        // æ£€æŸ¥å·¦è¾¹å€¼æ˜¯å¦å°äºŽå³è¾¹å€¼
        let leftValue = parseFloat(values[0]);
        let rightValue = parseFloat(values[1]);
        if (isNaN(leftValue) || isNaN(rightValue)) {
          this.$message.error('请输入有效的数字值!');
          return;
        }
        if (leftValue >= rightValue) {
          this.$message.error('左边的值不能大于或等于右边的值!');
          return;
        }
        // æž„建 newValue çš„形式 (值1,值2)
        let newValue = `(${values.join(',')})`;
        // æ£€æŸ¥æ–°çš„值是否已存在
        if (currentRangeArray.includes(newValue)) {
          this.$message.error('该值域规则已经存在!');
          return;
        }
        // æ·»åŠ æ–°å€¼åˆ°æ•°ç»„ä¸­
        currentRangeArray.push(newValue);
        this.enumAddListChange = currentRangeArray;
        this.form.rangeValue = currentRangeArray.join('\n');
        this.form.enumAddValue = "";
        return;
      }
      // å¤„理其他运算符
      const operatorMap = {
        '>': '>',
        '<': '<',
        '>=': '>=',
        '<=': '<=',
        '=': '=',
        '!=': '!='
      };
      // åˆ›å»ºæ–°çš„值
      let newValue = operatorMap[val] + this.form.enumAddValue.trim();
      // æ£€æŸ¥æ–°çš„值是否已存在
      if (currentRangeArray.includes(newValue)) {
        this.$message.error('该值域规则已经存在!');
        return;
      }
      // æ·»åŠ æ–°å€¼åˆ°æ•°ç»„ä¸­
      currentRangeArray.push(newValue);
      this.enumAddListChange = currentRangeArray;
      this.form.rangeValue = currentRangeArray.join('\n');
      this.form.enumAddValue = "";
    },
    // å€¼åŸŸç±»åž‹åˆ‡æ¢
    attributeSelectTypeChange(){
    attributeSelectTypeChange() {
      this.$forceUpdate(); // å¼ºåˆ¶æ›´æ–°form组件
      this.form.referValue = null; // åˆ‡æ¢å€¼åŸŸç±»åž‹ æ¸…空当前参照
    },
    }
    // é€‰æ‹©å‚ç…§
    referFormFocusHandler() {
      this.form.enumSwitch = false;
      this.form.rangeValue = "";
      this.form.enumId = "";
      const handlers = {
        business: () => {
          this.businessVisible = true;
          this.businessLoading = true;
          this.businessGetTable();
        },
        link: () => {
          this.linkTypeVisible = true;
          this.linkTypeLoading = true;
          this.linkGetTable();
        }
      };
      const {attributeSelectType} = this.form;
      const handler = handlers[attributeSelectType];
      if (handler) {
        handler();
      }
      ;
    },
    // ä¸šåŠ¡ç±»åž‹è¡¨æ ¼æ•°æ®è¯·æ±‚
    businessGetTable() {
      getBizTypes(this.businessSearchParams).then(res => {
        const data = res.data.data;
        this.businessData = data;
        this.businessLoading = false;
      })
    },
    // ä¸šåŠ¡ç±»åž‹å‚ç…§æœç´¢
    businessHandleSearch(val, done) {
      this.businessSearchParams = {
        btmName: val.name
      }
      this.businessGetTable();
      done()
    },
    // ä¸šåŠ¡ç±»åž‹å‚ç…§æ¸…ç©ºæœç´¢
    businessHandleReset() {
      this.businessSearchParams = {};
      this.businessGetTable();
    },
    // é“¾æŽ¥ç±»åž‹è¡¨æ ¼æ•°æ®è¯·æ±‚
    linkGetTable() {
      getAllLtName(this.linkTypeSearchParams).then(res => {
        const data = res.data.data.map(item => ({name: item}));
        ;
        this.linkTypeData = data;
        this.linkDataSearch = data;
        this.linkTypeLoading = false;
      })
    },
    // é“¾æŽ¥ç±»åž‹å‚照搜索
    linkHandleSearch(params, done) {
      const {name} = params;
      if (!params.name) {
        this.linkTypeData = this.linkDataSearch;
        return done();
      }
      ;
      this.linkTypeData = this.linkDataSearch.filter(item => {
        console.log(item)
        return item.name && item.name.includes(name);
      });
      done();
    },
    // é“¾æŽ¥ç±»åž‹å‚照清空搜索
    linkHandleReset() {
      this.linkTypeData = this.linkDataSearch;
    },
    // ä¸šåŠ¡ç±»åž‹è¡¨æ ¼è¡Œç‚¹å‡»
    businessRowClick(row) {
      this.businessRow = row;
    },
    // ä¸šåŠ¡ç±»åž‹ç¡®å®šä¿å­˜
    businessSaveHandler() {
      if (func.isEmptyObject(this.businessRow)) {
        this.$message.error('请选择一条数据!')
        return;
      }
      this.form.referValue = this.businessRow.name;
      this.businessVisible = false;
    },
    // ä¸šåŠ¡ç±»åž‹æ¸…ç©º
    businessEmpty() {
      this.form.referValue = null;
      this.businessVisible = false;
    },
    // é“¾æŽ¥ç±»åž‹ç¡®å®šä¿å­˜
    linkRowClick(row) {
      this.linkRow = row;
    },
    // ä¸šåŠ¡ç±»åž‹ç¡®å®šä¿å­˜
    linkSaveHandler() {
      if (func.isEmptyObject(this.linkRow)) {
        this.$message.error('请选择一条数据!')
        return;
      }
      this.form.referValue = this.linkRow.name;
      this.linkTypeVisible = false;
    },
    // é“¾æŽ¥ç±»åž‹æ¸…空
    linkEmpty() {
      this.form.referValue = null;
      this.linkTypeVisible = false;
    },
    // æ–°å¢žå¯¹è¯æ¡† å–消事件
    addEscHandler() {
      this.$refs.form.resetFields(); // å¯¹æ•´ä¸ªè¡¨å•进行重置,将所有字段值重置为初始值并移除校验结果
      this.addVisible = false;
      const form = {
        id: "",
        name: "",
        attributeDataType: "VTString",
        description: "",
        nullableFlag: true,
        attrLength: 50,
        enumFlag: false,
        enumId: "",
        enumSwitch: false,
        enumAddValue: "",
        range: "",
        attributeSelectType: "business",
        version: 1,
        defaultValue: "",
        referValue: "",
        btmTypeId: "",
        linkTypeName: "",
        rangeValue: ""
      };
      this.form = form;
    },
    // æ–°å¢žä¿å­˜
    addSaveHandler() {
      const form = {
        id: "",
        name: "",
        attributeDataType: "VTString",
        description: "",
        nullableFlag: true,
        attrLength: 50,
        enumFlag: false,
        enumId: "",
        enumSwitch: false,
        enumAddValue: "",
        range: "",
        attributeSelectType: "business",
        version: 1,
        defaultValue: "",
        referValue: "",
        btmTypeId: "",
        linkTypeName: "",
        rangeValue: ""
      };
      if (this.dialogTitle === 'add') {
        this.form.range = this.form.rangeValue.replace(/\n/g, ';');
        if (this.form.attributeSelectType === 'business') {
          this.form.btmTypeId = this.form.referValue;
        } else {
          this.form.linkTypeName = this.form.referValue;
        }
        addAttribute(this.form).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.msg);
            this.getTableList();
            this.form = form;
            this.addVisible = false;
          }
        })
      }
      if (this.dialogTitle === 'edit') {
        this.form.range = this.form.rangeValue.replace(/\n/g, ';');
        if (this.form.attributeSelectType === 'business') {
          this.form.btmTypeId = this.form.referValue;
        } else {
          this.form.linkTypeName = this.form.referValue;
        }
        updateAttribute(this.form).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
            this.form = form;
            this.addVisible = false;
          }
        })
      }
    },
    // å¯¼å…¥
    upLoadHandler() {
      this.$refs.upload.visible = true;
    },
    // å¯¼å‡º
    downLoadHandler() {
      if (this.selectList.length <= 0) {
        this.$message.warning('请至少选择一条数据进行导出');
        return;
      }
      let attrNames = this.selectList.map(item => item.id).join(',');
      download({attrNames: attrNames}).then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('导出成功');
      }).catch(err => {
        this.$message.error(err);
      })
    },
    // ä¸‹è½½å¯¼å…¥æ¨¡æ¿
    downloadTemplateHandler() {
      downloadAttributeTemplate().then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('下载成功');
      }).catch(err => {
        this.$message.error(err);
      })
    },
  }
}
</script>
@@ -731,6 +1297,6 @@
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -10%);
  transform: translate(-50%, -20%);
}
</style>
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue
@@ -21,8 +21,8 @@
            <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板
            </el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">导出</el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">导入</el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">导出</el-button>
          </template>
          <template slot="menu" slot-scope="scope">
@@ -462,8 +462,6 @@
          message: '已取消删除'
        });
      });
    },
    // å¯¹è¯æ¡†æžšä¸¾ä¿å­˜
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue
@@ -1,13 +1,116 @@
<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">创建
            </el-button>
            <el-button icon="el-icon-edit" plain size="small" type="primary">修改
            </el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger">删除
            </el-button>
            <el-button icon="el-icon-download" 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-view" plain size="small" type="primary">查看
            </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>
              <i class="el-icon-s-promotion"></i>
                {{ (node || {}).label }}
            </span>
          </span>
            </avue-tree>
          </div>
        </div>
      </basic-container>
    </el-aside>
    <el-main>
      <basic-container>
      </basic-container>
    </el-main>
  </el-container>
</template>
<script>
import {gridStatus} from "@/api/modeling/statusPool/api";
export default {
  name: "index"
  name: "index",
  data() {
    return {
      treeOption: {
        height: 'auto',
        defaultExpandAll: false,
        menu: false,
        addBtn: false,
        props: {
          label: 'id',
          value: 'id',
          children: 'children'
        }
      },
      treeData: [],
      nodeRow:{}
    }
  },
  created() {
    this.getTreeList();
  },
  methods: {
    getTreeList() {
      gridStatus().then(res => {
        const data = res.data.data;
        this.treeData = data;
        this.tableLoading = false;
      }).catch(err => {
        this.$message.error(err)
      });
    },
    nodeClick(row) {
      this.nodeRow = row;
    }
  }
}
</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>