wyj0522 hai 2 meses
pai
achega
86819eb9d9
Modificáronse 18 ficheiros con 791 adicións e 284 borrados
  1. 2 2
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/controller/FaultPhysicalModelController.java
  2. 3 2
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/controller/ModelDataGenController.java
  3. 4 17
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/FaultPhysicalModel.java
  4. 1 9
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/ModelDataGen.java
  5. 53 0
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/ParamsConfig.java
  6. 9 0
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/mapper/ParamsConfigMapper.java
  7. 1 1
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/IFaultPhysicalModelService.java
  8. 3 1
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/IModelDataGenService.java
  9. 48 6
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/impl/FaultPhysicalModelServiceImpl.java
  10. 50 59
      fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/impl/ModelDataGenServiceImpl.java
  11. 1 1
      fdapfe-admin/src/main/java/com/cn/fdapfe/web/controller/common/CommonController.java
  12. 1 6
      fdapfe-admin/src/main/resources/mapper/model/FaultPhysicalModelMapper.xml
  13. 116 0
      fdapfe-common/src/main/java/com/cn/fdapfe/common/utils/http/HttpClientUtils.java
  14. 2 2
      fdapfe-ui/src/components/FileUpload/index.vue
  15. 372 0
      fdapfe-ui/src/views/dataGen/DynamicParameterForm.vue
  16. 31 89
      fdapfe-ui/src/views/dataGen/form.vue
  17. 93 75
      fdapfe-ui/src/views/model/faultPhysical/form.vue
  18. 1 14
      fdapfe-ui/src/views/model/faultPhysical/index.vue

+ 2 - 2
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/controller/FaultPhysicalModelController.java

@@ -100,9 +100,9 @@ public class FaultPhysicalModelController extends BaseController
     @PreAuthorize("@ss.hasPermi('model:faultPhysical:remove')")
     @Log(title = "故障物理模型管理", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable String[] ids)
+    public void remove(@PathVariable String[] ids)
     {
-        return toAjax(faultPhysicalModelService.deleteFaultPhysicalModelByIds(ids));
+        faultPhysicalModelService.deleteFaultPhysicalModelByIds(ids);
     }
 
     /**

+ 3 - 2
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/controller/ModelDataGenController.java

@@ -1,11 +1,13 @@
 package com.cn.fdapfe.biz.controller;
 
+import java.io.IOException;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
 import com.cn.fdapfe.biz.domain.ModelDataGen;
 import com.cn.fdapfe.biz.service.IModelDataGenService;
 import com.cn.fdapfe.common.utils.poi.ExcelUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -76,8 +78,7 @@ public class ModelDataGenController extends BaseController
     @PreAuthorize("@ss.hasPermi('dataGen:add')")
     @Log(title = "物理模型数据生成管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody ModelDataGen modelDataGen)
-    {
+    public AjaxResult add(@RequestBody ModelDataGen modelDataGen) throws IOException {
         return toAjax(service.add(modelDataGen));
     }
 

+ 4 - 17
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/FaultPhysicalModel.java

@@ -9,6 +9,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.cn.fdapfe.common.annotation.Excel;
 import com.cn.fdapfe.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 模型管理对象 biz_fault_physical_model
  * 
@@ -42,25 +44,10 @@ public class FaultPhysicalModel extends BasePO
     @TableField(value ="model_path")
     private String modelPath;
 
-    /** 故障模型参数参数 */
-    @Excel(name = "故障模型参数参数")
-    @TableField(value ="model_data_params")
-    private String modelDataParams;
-
     @Excel(name = "故障归属")
     @TableField(value ="model_attribution")
     private String modelAttribution;
 
-    @Excel(name = "模型文件输入地址")
-    @TableField(value ="model_input_path")
-    private String modelInputPath;
-
-    @Excel(name = "模型文件输出地址")
-    @TableField(value ="model_output_path")
-    private String modelOutputPath;
-
-    @Excel(name = "模型工程文件地址")
-    @TableField(value ="exe_local_path")
-    private String exeLocalPath;
-
+    @TableField(exist = false)
+    private List<ParamsConfig> configData;
 }

+ 1 - 9
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/ModelDataGen.java

@@ -75,14 +75,6 @@ public class ModelDataGen extends BasePO
     private Date endTime;
 
     @TableField(exist = false)
-    private String modelName;
-    @TableField(exist = false)
-    private String modelPath;
-    @TableField(exist = false)
-    private String modelType;
-    @TableField(exist = false)
-    private String outputPath;
-    @TableField(exist = false)
-    private String newFileName;
+    private String postApiData;
 
 }

+ 53 - 0
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/domain/ParamsConfig.java

@@ -0,0 +1,53 @@
+package com.cn.fdapfe.biz.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.cn.fdapfe.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+@TableName("model_params_config")
+public class ParamsConfig extends BasePO{
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    @TableId(value = "param_id")
+    @Excel(name = "主键ID")
+    private String paramId;
+    /**
+     * 所属模型id
+     */
+    @Excel(name = "所属模型id")
+    @TableField(value ="model_id")
+    private String modelId;
+    /** 字段名称 */
+    @Excel(name = "字段名称")
+    @TableField(value ="param_name")
+    private String paramName;
+    /** 中文名称 */
+    @Excel(name = "中文名称")
+    @TableField(value ="param_chinese_name")
+    private String paramChineseName;
+    /** 参数类型 */
+    @Excel(name = "参数类型")
+    @TableField(value ="param_type")
+    private String paramType;
+    /** 排序号 */
+    @Excel(name = "排序号")
+    @TableField(value ="param_sort")
+    private String paramSort;
+    /** 默认值 */
+    @Excel(name = "默认值")
+    @TableField(value ="param_default_value")
+    private String paramDefaultValue;
+    /** 参数说明 */
+    @Excel(name = "参数说明")
+    @TableField(value ="param_description")
+    private String paramDescription;
+    /** 是否必填 */
+    @Excel(name = "是否必填")
+    @TableField(value ="is_required")
+    private Boolean isRequired;
+}

+ 9 - 0
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/mapper/ParamsConfigMapper.java

@@ -0,0 +1,9 @@
+package com.cn.fdapfe.biz.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cn.fdapfe.biz.domain.ParamsConfig;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ParamsConfigMapper extends BaseMapper<ParamsConfig> {
+}

+ 1 - 1
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/IFaultPhysicalModelService.java

@@ -51,7 +51,7 @@ public interface IFaultPhysicalModelService
      * @param ids 需要删除的故障物理模型管理主键集合
      * @return 结果
      */
-     int deleteFaultPhysicalModelByIds(String[] ids);
+    void deleteFaultPhysicalModelByIds(String[] ids);
 
 
     List<Map<String,Object>> getOptions(String typs);

+ 3 - 1
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/IModelDataGenService.java

@@ -1,8 +1,10 @@
 package com.cn.fdapfe.biz.service;
 
+import java.io.IOException;
 import java.util.List;
 
 import com.cn.fdapfe.biz.domain.ModelDataGen;
+import com.fasterxml.jackson.core.JsonProcessingException;
 
 /**
  * 物理模型数据生成管理Service接口
@@ -23,7 +25,7 @@ public interface IModelDataGenService
     /**
      * 新增物理模型数据生成管理
      */
-    int add(ModelDataGen modelDataGen);
+    int add(ModelDataGen modelDataGen) throws IOException;
     /**
      * 修改物理模型数据生成管理
      */

+ 48 - 6
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/impl/FaultPhysicalModelServiceImpl.java

@@ -6,7 +6,9 @@ import java.util.Map;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.cn.fdapfe.biz.domain.ParamsConfig;
 import com.cn.fdapfe.biz.mapper.FormulasMapper;
+import com.cn.fdapfe.biz.mapper.ParamsConfigMapper;
 import com.cn.fdapfe.common.utils.DateUtils;
 import com.cn.fdapfe.common.utils.SecurityUtils;
 import com.cn.fdapfe.common.utils.uuid.UUID;
@@ -28,6 +30,8 @@ public class FaultPhysicalModelServiceImpl implements IFaultPhysicalModelService
 {
     @Resource
     private FaultPhysicalModelMapper faultPhysicalModelMapper;
+    @Resource
+    private ParamsConfigMapper paramsConfigMapper;
 
 
     /**
@@ -39,7 +43,13 @@ public class FaultPhysicalModelServiceImpl implements IFaultPhysicalModelService
     @Override
     public FaultPhysicalModel selectFaultPhysicalModelById(String id)
     {
-        return faultPhysicalModelMapper.selectById(id);
+
+        FaultPhysicalModel dataInfo = faultPhysicalModelMapper.selectById(id);
+        QueryWrapper<ParamsConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(StringUtils.isNotEmpty(id),ParamsConfig::getModelId,id)
+                        .orderByAsc(ParamsConfig::getParamSort);
+        dataInfo.setConfigData(paramsConfigMapper.selectList(queryWrapper));
+        return dataInfo;
     }
 
     /**
@@ -69,9 +79,23 @@ public class FaultPhysicalModelServiceImpl implements IFaultPhysicalModelService
     @Override
     public int insertFaultPhysicalModel(FaultPhysicalModel po)
     {
+        String uuid = UUID.randomUUID().toString();
         po.setCreateTime(DateUtils.getNowDate());
         po.setCreateBy(SecurityUtils.getUsername());
-        po.setModelId(UUID.randomUUID().toString());
+        po.setModelId(uuid);
+        QueryWrapper<ParamsConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(StringUtils.isNotEmpty(uuid),ParamsConfig::getModelId,uuid);
+        ParamsConfig config = paramsConfigMapper.selectOne(queryWrapper);
+        if(config!=null){
+            paramsConfigMapper.delete(queryWrapper);
+        }
+        List<ParamsConfig> configData = po.getConfigData();
+        if (configData != null && !configData.isEmpty()) {
+            for (ParamsConfig paramsConfig : configData) {
+                paramsConfig.setModelId(uuid);
+                paramsConfigMapper.insert(paramsConfig);
+            }
+        }
         return faultPhysicalModelMapper.insert(po);
     }
 
@@ -87,8 +111,18 @@ public class FaultPhysicalModelServiceImpl implements IFaultPhysicalModelService
         po.setUpdateTime(DateUtils.getNowDate());
         po.setUpdateBy(SecurityUtils.getUsername());
         FaultPhysicalModel byId = faultPhysicalModelMapper.selectById(po.getModelId());
-
-        return byId==null ?insertFaultPhysicalModel(po): faultPhysicalModelMapper.updateById(po);
+        if(byId!=null){
+            QueryWrapper<ParamsConfig> queryWrapper = new QueryWrapper<>();
+            queryWrapper.lambda().eq(StringUtils.isNotEmpty(po.getModelId()),ParamsConfig::getModelId,po.getModelId());
+            paramsConfigMapper.delete(queryWrapper);
+            for (ParamsConfig configDatum : po.getConfigData()) {
+                configDatum.setModelId(po.getModelId());
+                paramsConfigMapper.insert(configDatum);
+            }
+        }else{
+            insertFaultPhysicalModel(po);
+        }
+        return faultPhysicalModelMapper.updateById(po);
     }
 
     /**
@@ -98,9 +132,17 @@ public class FaultPhysicalModelServiceImpl implements IFaultPhysicalModelService
      * @return 结果
      */
     @Override
-    public int deleteFaultPhysicalModelByIds(String[] ids)
+    public void deleteFaultPhysicalModelByIds(String[] ids)
     {
-        return ids!=null && ids.length == 1 ? faultPhysicalModelMapper.deleteById(ids[0]) : faultPhysicalModelMapper.deleteBatchIds(Arrays.asList(ids));
+
+            List<String> list = Arrays.asList(ids);
+            for (String id : list){
+                faultPhysicalModelMapper.deleteById(id);
+                QueryWrapper<ParamsConfig> queryWrapper = new QueryWrapper<>();
+                queryWrapper.lambda().eq(StringUtils.isNotEmpty(id),ParamsConfig::getModelId,id);
+                paramsConfigMapper.delete(queryWrapper);
+                faultPhysicalModelMapper.deleteById(id);
+            }
     }
 
     @Override

+ 50 - 59
fdapfe-admin/src/main/java/com/cn/fdapfe/biz/service/impl/ModelDataGenServiceImpl.java

@@ -2,8 +2,12 @@ package com.cn.fdapfe.biz.service.impl;
 
 import com.alibaba.fastjson2.JSON;
 import com.cn.fdapfe.biz.domain.Data;
+import com.cn.fdapfe.biz.domain.FaultPhysicalModel;
+import com.cn.fdapfe.biz.mapper.FaultPhysicalModelMapper;
 import com.cn.fdapfe.biz.service.IDataService;
+import com.cn.fdapfe.common.utils.http.HttpClientUtils;
 import com.cn.fdapfe.web.controller.common.CommonController;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.slf4j.Logger;
@@ -25,10 +29,8 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.regex.Pattern;
 
 /**
  * 物理模型数据生成管理Service业务层处理
@@ -44,9 +46,18 @@ public class ModelDataGenServiceImpl implements IModelDataGenService {
     private ModelDataGenMapper mapper;
     @Resource
     private IDataService dataService;
+    @Resource
+    private FaultPhysicalModelMapper faultPhysicalModelMapper;
+
 
     @Resource
     private CommonController commonController;
+    private static final Pattern FILE_PATH_PATTERN = Pattern.compile(
+            // Windows路径(支持斜杠或反斜杠)
+            "^([a-zA-Z]:(?:[/\\\\](?:[^/\\\\:*?\"<>|\r\n]+))*[/\\\\]?[^/\\\\:*?\"<>|\r\n]*)$|" +
+                    // Unix/Linux路径
+                    "^(/(?:[^/]+/)*[^/]+)$"
+    );
 
     @Override
     public List<ModelDataGen> selectList(ModelDataGen po) {
@@ -93,64 +104,44 @@ public class ModelDataGenServiceImpl implements IModelDataGenService {
 
 
     @Override
-    public int add(ModelDataGen po) {
-            Data data = new Data();
-            data.setType("0");
-            data.setFileSuffix("csv");
-        if(Objects.equals(po.getModelType(), "2")){
-            try {
-                // 远程启动大模型生成数据
-                String path = new File(po.getModelPath()).getParent();
-                writeToTxt(path + File.separator + "input" + File.separator + "input.txt", po.getBizParams());
-                startExe(po.getModelPath());
-                //处理模型生成文件
-                String sourceDirectory = path + File.separator + "output";
-                String sourceFileName = "output.csv";
-                String targetDirectory = po.getOutputPath();
-                String newFileName = po.getNewFileName();
-                //生成文件处理后的新文件路径
-                String newFilePath = copyRenameAndMoveFile(sourceDirectory, sourceFileName, targetDirectory, newFileName);
-                data.setName(newFileName);
-                data.setFileName(newFileName);
-                data.setFilePath(newFilePath);
-                dataService.insertData(data);
-            } catch (Exception e) {
-                logger.error("启动大模型或写入参数时出错", e);
-                return 0;
-            }
-        }else{
-            ObjectMapper objectMapper = new ObjectMapper();
-            try {
-                List<Map<String, Object>> objectList = objectMapper.readValue(po.getBizParams(),
-                        new TypeReference<List<Map<String, Object>>>() {});
-                for (Map<String, Object> jsonMap : objectList) {
-                    String apiPath = extractLastPart(po.getModelPath(),"/");
-                    String jsonString = JSON.toJSONString(jsonMap);
-                    if (Objects.equals(apiPath, "zssc")) {
-                        String filePath = (String) jsonMap.get("noise_data_file");
-                        data.setFilePath(filePath);
-                        data.setFileName(extractLastPart(filePath,"\\"));
-                        data.setName(extractLastPart(filePath,"\\"));
-                    }else if(Objects.equals(apiPath, "cssc")) {
-                        String filePath = (String) jsonMap.get("test_data_file");
-                        data.setFilePath(filePath);
-                        data.setFileName(extractLastPart(filePath,"\\"));
-                        data.setName(extractLastPart(filePath,"\\"));
-                    }
-                    boolean request = sendPostRequest(po.getModelPath(), jsonString);
-                    if(request){
-                        dataService.insertData(data);
-                    }
+    public int add(ModelDataGen po) throws IOException {
+        FaultPhysicalModel model = faultPhysicalModelMapper.selectById(po.getModelId());
+        ObjectMapper mapper = new ObjectMapper();
+        LinkedHashMap[] array = mapper.readValue(po.getPostApiData(), LinkedHashMap[].class);
+        for (LinkedHashMap item : array) {
+            Map map = processMap(item);
+            Map returnMap = HttpClientUtils.sendPostRequest(model.getModelPath(), map);
+        }
+        return 1;
+    }
+
+    private Map processMap(LinkedHashMap<String, Object> map) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
+            // 检查值是否为字符串且符合文件路径格式
+            if (value instanceof String) {
+                String filePath = (String) value;
+                boolean validFilePath = isValidFilePath(filePath);
+                if (validFilePath) {
+                    // 转换为File对象并更新map
+                    File file = new File(filePath);
+                    map.put(key, file);
+                    System.out.println("字段 '" + key + "' 已转换为File对象: " + file);
                 }
-            } catch (IOException e) {
-                e.printStackTrace();
             }
-//
         }
-        ModelDataGen one = selectOne(po.getDataGenId());
-        po.setCreateTime(DateUtils.getNowDate());
-        po.setCreateBy(SecurityUtils.getUsername());
-        return one != null ? update(po) : mapper.insert(po);
+        return map;
+    }
+
+    /**
+     * 判断字符串是否为有效的文件路径
+     */
+    private boolean isValidFilePath(String path) {
+        if (path != null || !path.trim().isEmpty()) {
+            return FILE_PATH_PATTERN.matcher(path).matches();
+        }
+        return false;
     }
 
     public static String extractLastPart(String url,String dom) {

+ 1 - 1
fdapfe-admin/src/main/java/com/cn/fdapfe/web/controller/common/CommonController.java

@@ -93,7 +93,7 @@ public class CommonController
             ServerConfig serverConfig = new ServerConfig();
             String url = serverConfig.getUrl() +"/"+ infoPath;
             AjaxResult ajax = AjaxResult.success();
-            ajax.put("url", url);
+            ajax.put("url", infoPath);
             ajax.put("filelocalPath", filelocalPath);
             ajax.put("fileSize", fileSize);
             ajax.put("fileSizeBytes", fileSizeBytes);

+ 1 - 6
fdapfe-admin/src/main/resources/mapper/model/FaultPhysicalModelMapper.xml

@@ -10,20 +10,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="modelType"    column="model_type"    />
         <result property="modelPath"    column="model_path"    />
         <result property="modelAttribution"    column="model_attribution"    />
-        <result property="modelDataParams"    column="model_data_params"    />
         <result property="remark"    column="remark"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
-        <result property="modelInputPath"    column="model_input_path"    />
-        <result property="modelOutputPath"    column="model_output_path"    />
-        <result property="exeLocalPath"    column="exe_local_path"    />
-
     </resultMap>
 
     <sql id="selectFaultPhysicalModelVo">
-        select model_id, model_name, model_type, model_path, model_data_params, remark, create_by, create_time, update_by, update_time,model_attribution,model_input_path,model_output_path, exe_local_path from biz_fault_physical_model
+        select model_id, model_name, model_type, model_path, remark, create_by, create_time, update_by, update_time,model_attribution from biz_fault_physical_model
     </sql>
 
 

+ 116 - 0
fdapfe-common/src/main/java/com/cn/fdapfe/common/utils/http/HttpClientUtils.java

@@ -0,0 +1,116 @@
+package com.cn.fdapfe.common.utils.http;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+public class HttpClientUtils {
+    private static final String BOUNDARY = "---------------------------" + System.currentTimeMillis();
+    private static final String LINE_FEED = "\r\n";
+    private static final ObjectMapper objectMapper = new ObjectMapper();
+
+    /**
+     * 发送包含文件和表单数据的POST请求,返回JSON响应
+     * @param apiUrl 请求URL
+     * @param params 包含普通字段和File对象的参数映射
+     * @return 包含响应结果的Map对象
+     * @throws IOException 网络或IO异常
+     */
+    public static Map<String, Object> sendPostRequest(String apiUrl, Map<String, Object> params) throws IOException {
+        URL url = new URL(apiUrl);
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestMethod("POST");
+        connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
+        connection.setDoOutput(true);
+        connection.setDoInput(true);
+
+        try (OutputStream outputStream = connection.getOutputStream();
+             PrintWriter writer = new PrintWriter(
+                     new OutputStreamWriter(outputStream, StandardCharsets.UTF_8),
+                     true
+             )) {
+
+            // 处理所有参数
+            for (Map.Entry<String, Object> entry : params.entrySet()) {
+                String fieldName = entry.getKey();
+                Object value = entry.getValue();
+
+                if (value instanceof File) {
+                    // 处理文件参数
+                    File file = (File) value;
+                    String fileName = file.getName();
+
+                    writer.append("--" + BOUNDARY).append(LINE_FEED);
+                    writer.append("Content-Disposition: form-data; name=\"" + fieldName +
+                            "\"; filename=\"" + fileName + "\"").append(LINE_FEED);
+                    writer.append("Content-Type: application/octet-stream").append(LINE_FEED);
+                    writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
+                    writer.append(LINE_FEED);
+                    writer.flush();
+
+                    try (FileInputStream fileInputStream = new FileInputStream(file)) {
+                        byte[] buffer = new byte[4096];
+                        int bytesRead;
+                        while ((bytesRead = fileInputStream.read(buffer)) != -1) {
+                            outputStream.write(buffer, 0, bytesRead);
+                        }
+                    }
+                    outputStream.flush();
+                    writer.append(LINE_FEED);
+                    writer.flush();
+                } else {
+                    // 处理普通字段
+                    writer.append("--" + BOUNDARY).append(LINE_FEED);
+                    writer.append("Content-Disposition: form-data; name=\"" + fieldName + "\"").append(LINE_FEED);
+                    writer.append("Content-Type: text/plain; charset=UTF-8").append(LINE_FEED);
+                    writer.append(LINE_FEED);
+                    writer.append(value.toString()).append(LINE_FEED);
+                    writer.flush();
+                }
+            }
+
+            // 结束请求
+            writer.append("--" + BOUNDARY + "--").append(LINE_FEED);
+            writer.flush();
+        }
+
+        int responseCode = connection.getResponseCode();
+        String responseBody = readResponseBody(connection, responseCode);
+        // 解析JSON响应
+        try {
+            return objectMapper.readValue(responseBody, Map.class);
+        } catch (Exception e) {
+            // 返回包含错误信息的Map
+            Map<String, Object> errorResult = new HashMap<>();
+            errorResult.put("success", false);
+            errorResult.put("statusCode", responseCode);
+            errorResult.put("error", "Failed to parse JSON response");
+            errorResult.put("rawResponse", responseBody);
+            return errorResult;
+        }
+    }
+
+    /**
+     * 读取HTTP响应体
+     */
+    private static String readResponseBody(HttpURLConnection connection, int responseCode) throws IOException {
+        try (BufferedReader reader = new BufferedReader(
+                new InputStreamReader(
+                        responseCode >= 200 && responseCode < 300 ?
+                                connection.getInputStream() : connection.getErrorStream(),
+                        StandardCharsets.UTF_8
+                )
+        )) {
+            StringBuilder response = new StringBuilder();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                response.append(line);
+            }
+            return response.toString();
+        }
+    }
+}

+ 2 - 2
fdapfe-ui/src/components/FileUpload/index.vue

@@ -60,7 +60,7 @@ export default {
     // 文件类型, 例如['png', 'jpg', 'jpeg']
     fileType: {
       type: Array,
-      default: () => ["doc", "xls", "ppt", "txt", "pdf"],
+      default: () => ["csv","mat","doc", "xls", "ppt", "txt", "pdf"],
     },
     // 是否显示提示
     isShowTip: {
@@ -175,7 +175,7 @@ export default {
         this.uploadList = [];
         this.number = 0;
         this.$emit('child-event', res)
-        this.$emit("input", this.listToString(this.fileList));
+        this.$emit("input", res.url);
         this.$modal.closeLoading();
       }
     },

+ 372 - 0
fdapfe-ui/src/views/dataGen/DynamicParameterForm.vue

@@ -0,0 +1,372 @@
+<template>
+  <div class="parameter-form">
+    <!-- 新增参数组按钮 -->
+    <div class="body-toolbar">
+      <el-button
+        circle
+        icon="el-icon-plus"
+        @click="addParamGroup"
+        class="add-btn"
+      />
+    </div>
+
+    <!-- 动态参数组折叠面板 -->
+    <el-collapse :gutter="20">
+      <el-collapse-item
+        v-for="(group, groupIndex) in paramGroups"
+        :key="groupIndex"
+        :title="'参数组 ' + (groupIndex + 1)"
+        :name="groupIndex"
+      >
+        <el-form
+          :model="group.formData"
+          :rules="group.rules"
+          ref="groupFormRef"
+          label-width="120px"
+        >
+          <!-- 循环生成参数输入项 -->
+          <el-form-item
+            v-for="param in group.configData"
+            :key="param.paramId"
+            :label="param.paramChineseName || param.paramName"
+            :prop="param.paramName"
+          >
+            <!-- 文件类型处理 -->
+            <!-- 文件类型处理 -->
+            <template v-if="param.paramType === 'file'">
+              <file-upload  v-model="group.formData[param.paramName]" :limit="1"></file-upload>
+<!--              <input-->
+<!--                type="file"-->
+<!--                :id="`file-input-${param.paramName}-${groupIndex}`"-->
+<!--                style="display: none"-->
+<!--                @change="handleFileChange($event, param.paramName, groupIndex)"-->
+<!--              />-->
+<!--              <div class="file-container">-->
+<!--                <el-button-->
+<!--                  size="small"-->
+<!--                  type="primary"-->
+<!--                  @click="triggerFileSelect(`file-input-${param.paramName}-${groupIndex}`)"-->
+<!--                >-->
+<!--                  {{ group.formData[param.paramName] && group.formData[param.paramName].name || '选择文件' }}-->
+<!--                </el-button>-->
+<!--                &lt;!&ndash; 文件列表 &ndash;&gt;-->
+<!--                <div class="file-list" v-if="group.formData[param.paramName]">-->
+<!--                  <div class="file-item">-->
+<!--                    <span>{{ group.formData[param.paramName].name }}</span>-->
+<!--                    <el-button-->
+<!--                      size="mini"-->
+<!--                      type="danger"-->
+<!--                      @click="removeFile(param.paramName, groupIndex)"-->
+<!--                    >-->
+<!--                      移除-->
+<!--                    </el-button>-->
+<!--                  </div>-->
+<!--                </div>-->
+<!--              </div>-->
+            </template>
+
+            <!-- 字符串类型 -->
+            <template v-else-if="param.paramType === 'string' || !param.paramType">
+              <el-input
+                size="small"
+                v-model="group.formData[param.paramName]"
+                :placeholder="param.paramDescription"
+              />
+            </template>
+
+            <!-- 数字类型 -->
+            <template v-else-if="param.paramType === 'number'">
+              <el-input-number
+                :precision="param.precision || 2"
+                size="small"
+                v-model="group.formData[param.paramName]"
+                :min="param.min || 0"
+                :max="param.max || Infinity"
+                :placeholder="param.paramDescription"
+              />
+            </template>
+
+            <!-- 布尔类型 -->
+            <template v-else-if="param.paramType === 'boolean'">
+              <el-switch
+                v-model="group.formData[param.paramName]"
+                active-text="开启"
+                inactive-text="关闭"
+              />
+            </template>
+
+            <!-- 下拉选择类型 -->
+            <template v-else-if="param.paramType === 'select'">
+              <el-select
+                size="small"
+                v-model="group.formData[param.paramName]"
+                :placeholder="param.paramDescription"
+                clearable
+              >
+                <el-option
+                  v-for="option in parseOptions(param.paramOptions)"
+                  :key="option.value"
+                  :label="option.label"
+                  :value="option.value"
+                />
+              </el-select>
+            </template>
+
+            <!-- 日期类型 -->
+            <template v-else-if="param.paramType === 'date'">
+              <el-date-picker
+                size="small"
+                v-model="group.formData[param.paramName]"
+                type="date"
+                placeholder="选择日期"
+              />
+            </template>
+
+            <!-- 其他类型默认处理 -->
+            <template v-else>
+              <el-input
+                size="small"
+                v-model="group.formData[param.paramName]"
+                :placeholder="param.paramDescription"
+              />
+            </template>
+          </el-form-item>
+        </el-form>
+      </el-collapse-item>
+    </el-collapse>
+
+    <!-- 操作按钮 -->
+    <el-form-item class="button-group">
+      <el-button
+        type="primary"
+        @click="submitAllForms"
+        :loading="isSubmitting"
+      >
+        提交参数
+      </el-button>
+      <el-button
+        @click="resetAllForms"
+        style="margin-left: 10px"
+      >
+        重置表单
+      </el-button>
+    </el-form-item>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'DynamicParamForm',
+  props: {
+    // 基础参数配置(必填)
+    configData: {
+      type: Array,
+      required: true,
+      default: () => []
+    },
+    // 初始参数组数据(可选)
+    initialGroups: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      paramGroups: [], // 存储所有参数组
+      isSubmitting: false // 提交加载状态
+    };
+  },
+  mounted() {
+    this.initParamGroups();
+  },
+  methods: {
+    // 初始化参数组
+    initParamGroups() {
+      this.paramGroups = this.initialGroups.map(initialGroup => ({
+        configData: this.configData,
+        formData: {
+          ...initialGroup.formData,
+          // 初始化文件类型参数为空数组
+          ...this.configData.reduce((acc, param) => {
+            if (param.paramType === 'file') acc[param.paramName] = [];
+            return acc;
+          }, {})
+        },
+        rules: this.generateRules(this.configData)
+      }));
+    },
+
+    // 生成校验规则
+    generateRules(params) {
+      const rules = {};
+      params.forEach(param => {
+        if (param.isRequired) {
+          rules[param.paramName] = [{
+            required: true,
+            message: `请填写${param.paramChineseName || param.paramName}`,
+            trigger: 'blur'
+          }];
+        }
+      });
+      return rules;
+    },
+
+    // 新增参数组
+    addParamGroup() {
+      this.paramGroups.push({
+        configData: this.configData,
+        formData: this.configData.reduce((acc, param) => {
+          // 优先使用 paramDefaultValue,若不存在则用空值(根据类型处理)
+          if (param.paramType === 'file') {
+            acc[param.paramName] = []; // 文件类型仍保持空数组(非文件类型走下面逻辑)
+          } else {
+            // 非文件类型:使用 paramDefaultValue 或默认空值(字符串/数字等)
+            acc[param.paramName] = param.paramDefaultValue !== undefined
+              ? param.paramDefaultValue // 存在 paramDefaultValue 时使用
+              : param.defaultValue || ''; // 不存在时使用原逻辑(defaultValue 或空字符串)
+          }
+          return acc;
+        }, {}),
+        rules: this.generateRules(this.configData)
+      });
+    },
+
+    // 触发文件选择
+    triggerFileSelect(inputId) {
+      document.getElementById(inputId).click();
+    },
+
+    // 处理文件选择
+    handleFileChange(event, paramName,groupIndex) {
+      const file = event.target.files[0];
+      this.paramGroups[groupIndex].formData[paramName] = file;
+    },
+
+    // 移除文件
+    removeFile(paramName, groupIndex, fileIndex) {
+      this.paramGroups[groupIndex].formData[paramName].splice(fileIndex, 1);
+    },
+
+    // 解析下拉选项
+    parseOptions(optionsStr) {
+      if (!optionsStr) return [];
+      try {
+        return JSON.parse(optionsStr);
+      } catch (e) {
+        return optionsStr.split(',').map(item => {
+          const [value, label] = item.split(':');
+          return { value: value.trim(), label: label?.trim() || value.trim() };
+        });
+      }
+    },
+
+    // 提交所有表单
+    submitAllForms() {
+      this.isSubmitting = true;
+      const allValid = this.paramGroups.every((group, groupIndex) => {
+        const formRef = this.$refs.groupFormRef[group.name];
+        return formRef ? formRef.validate() : true;
+      });
+
+      if (allValid) {
+        // 整理数据格式:[{paramName: value}, {paramName: value}]
+        const result = this.paramGroups.map(group => {
+          return this.configData.reduce((acc, param) => {
+            acc[param.paramName] = group.formData[param.paramName];
+            return acc;
+          }, {});
+        });
+
+        this.$emit('submit', result);
+        this.isSubmitting = false;
+      } else {
+        this.isSubmitting = false;
+      }
+    },
+    // 重置表单
+    resetAllForms() {
+      this.paramGroups = this.initialGroups.length
+        ? this.initialGroups.map(group => ({
+          ...group,
+          formData: { ...group.formData },
+          rules: this.generateRules(this.configData)
+        }))
+        : [this.getDefaultGroup()];
+    },
+
+    // 获取默认参数组
+    getDefaultGroup() {
+      return {
+        configData: this.configData,
+        formData: this.configData.reduce((acc, param) => {
+          if (param.paramType === 'file') acc[param.paramName] = [];
+          else acc[param.paramName] = param.defaultValue || '';
+          return acc;
+        }, {}),
+        rules: this.generateRules(this.configData)
+      };
+    }
+  }
+};
+</script>
+
+<style scoped>
+.el-collapse,
+.el-collapse /deep/ .el-collapse-item__header,
+.el-collapse /deep/ .el-collapse-item__content {
+  background-color: #0b333f;
+  color: white;
+}
+.parameter-form {
+  padding: 20px;
+  background-color: #0b333f;
+  color: white;
+}
+
+.body-toolbar {
+  display: flex;
+  justify-content: flex-end;
+  margin-bottom: 20px;
+}
+
+.add-btn {
+  background-color: #0b333f;
+  color: white;
+  width: 40px;
+  height: 40px;
+  padding: 0;
+}
+
+.el-collapse-item {
+  margin-bottom: 15px;
+  background-color: #0b333f;
+  color: white;
+  border-radius: 8px;
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
+}
+
+.file-container {
+  display: flex;
+  align-items: center;
+}
+
+.file-list {
+  margin-left: 15px;
+  flex-grow: 1;
+}
+
+.file-item {
+  display: inline-block;
+  margin-right: 10px;
+  margin-top: 5px;
+  padding: 4px 8px;
+  border-radius: 4px;
+  background-color: #0b333f;
+  color: white;
+}
+
+.button-group {
+  margin-top: 30px;
+  text-align: right;
+}
+</style>

+ 31 - 89
fdapfe-ui/src/views/dataGen/form.vue

@@ -31,58 +31,10 @@
           </el-select>
         </el-form-item>
       </el-row>
-
-      <el-row>
-        <el-form-item v-if="formData.modelType === '2'" label="模型参数">
-          <el-input
-            v-model="formData.bizParams"
-            type="textarea"
-            placeholder="请输入模型参数(JSON格式)"
-          />
+        <el-form-item v-if="formData.modelId" label="模型参数">
+            <dynamic-parameter-form  :config-data="initialData" @submit="handleSubmitDataList" />
         </el-form-item>
-
-        <el-form-item v-if="formData.modelType === '1'" label="模型参数">
-          <el-row :gutter="10">
-            <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="1" :offset="22">
-              <el-button
-                icon="el-icon-plus"
-                @click="addModelDataParams"
-                size="mini"
-                circle
-                title="添加参数组"
-              />
-            </el-col>
-          </el-row>
-
-          <el-collapse :gutter="20" v-for="(paramGroup, groupIndex) in modelDataParams" :key="groupIndex">
-            <el-collapse-item :title="'参数组' + (groupIndex + 1)" :name="groupIndex">
-              <el-row :xl="4" v-for="(value, key) in paramGroup" :key="key" :gutter="20">
-                <el-col >
-                  <el-form-item :label="key" :prop="`modelDataParams.${groupIndex}.${key}`">
-                    <el-input
-                      v-model="paramGroup[key]"
-                      :placeholder="'请输入' + key + '的值'"
-                      style="width: 200px;"
-                    />
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-collapse-item>
-          </el-collapse>
-        </el-form-item>
-      </el-row>
-
       <el-row>
-<!--        <el-form-item v-if="formData.modelType !== '2'" label="基础数据" prop="dataId">-->
-<!--          <el-select v-model="formData.newFileName" placeholder="请选择基础数据">-->
-<!--            <el-option-->
-<!--              v-for="item in dataOptions"-->
-<!--              :key="item.id"-->
-<!--              :label="item.name"-->
-<!--              :value="item.id"-->
-<!--            />-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
         <el-form-item v-if="formData.modelType === '2'" label="数据生成名称" prop="dataGenName">
           <el-input v-model="formData.newFileName" placeholder="请输入数据生成名称" />
         </el-form-item>
@@ -140,8 +92,12 @@
 import { addPhyModel, updatePhyModel } from "@/api/dataGen/phyModel";
 import { getDataOptions } from "@/api/data/data";
 import { getFaultPhysicalOptions } from "@/api/model/faultPhysical";
-
+import {getFaultPhysical} from "@/api/model/faultPhysical";
+import DynamicParameterForm from '@/views/dataGen/DynamicParameterForm.vue'
 export default {
+  components:{
+    DynamicParameterForm
+  },
   props: {
     value: {
       type: Boolean,
@@ -154,6 +110,7 @@ export default {
   },
   data() {
     return {
+      initialData:[],
       modelDataParams: [], // 视图层显示的参数组数组
       dataOptions: [],
       faultPhysicalOptions: [],
@@ -167,9 +124,9 @@ export default {
         startTime: null,
         endTime: null,
         remark: null,
-        modelDataParams: [], // 提交用的参数组数组
         modelPath: null,
-        modelName:null
+        modelName:null,
+        postApiData:[]
       },
       rules: {
         dataGenName: [{ required: true, message: "请输入数据生成名称", trigger: "blur" }],
@@ -196,7 +153,9 @@ export default {
     }
   },
   methods: {
-
+    //新增参数组
+    openDialog(){},
+    //初始化数据
     initData() {
       this.loadOptions();
       if (this.dataInfo) {
@@ -226,35 +185,18 @@ export default {
       this.modelDataParams = [...this.formData.modelDataParams]; // 同步到视图数组
     },
 
-    onModelChange() {
-      const selectedModel = this.faultPhysicalOptions.find(
-        item => item.modelId === this.formData.modelId
-      );
-      if (!selectedModel) return;
-      console.log('selectedModel',selectedModel)
-      this.formData.modelType = selectedModel.modelType;
-      this.formData.modelPath = selectedModel.modelPath;
-
-      if (selectedModel.modelType === "2") {
-        // 文本模式直接赋值
-        this.formData.bizParams = selectedModel.modelDataParams || "";
-        this.modelDataParams = []; // 清空数组模式
-      } else {
-        // 数组模式初始化参数组
-        const exampleParams = this.parseParams(selectedModel.modelDataParams || "[]");
-        this.modelDataParams = exampleParams.length ? exampleParams : [{}]; // 至少一个空参数组
-        this.formData.modelDataParams = [...this.modelDataParams]; // 同步到提交数据
-      }
+    onModelChange(modelId) {
+      //获取模型参数详情
+      getFaultPhysical(modelId).then(rest => {
+        this.initialData  = rest.data.configData;
+        this.formData.modelId = rest.data.modelId;
+        console.log('modelDataParams',this.initialData)
+      });
     },
 
-    addModelDataParams() {
-      // 创建新参数组,结构与最后一个参数组一致
-      const lastGroup = this.modelDataParams[this.modelDataParams.length - 1] || {};
-      const newGroup = Object.fromEntries(
-        Object.keys(lastGroup).map(key => [key, ""])
-      );
-      this.modelDataParams.push(newGroup);
-      this.formData.modelDataParams = [...this.modelDataParams]; // 同步到提交数据
+    handleSubmitDataList(data) {
+      this.formData.postApiData = JSON.stringify(data);
+      console.log('submit', this.formData)
     },
 
     parseParams(params) {
@@ -271,13 +213,6 @@ export default {
     handleSubmit() {
       this.$refs.form.validate(valid => {
         if (!valid) return;
-
-        // 处理参数组数据(如果是数组模式则序列化为JSON)
-        if (this.formData.modelType !== "2") {
-          this.formData.modelDataParams = JSON.stringify(this.modelDataParams);
-          this.formData.bizParams = JSON.stringify(this.modelDataParams);
-        }
-
         const api = this.formData.id ? updatePhyModel : addPhyModel;
         api(this.formData).then(() => {
           this.$message.success(this.formData.id ? "修改成功" : "新增成功");
@@ -296,7 +231,6 @@ export default {
         startTime: null,
         endTime: null,
         remark: null,
-        modelDataParams: [],
         modelPath: null
       };
       this.modelDataParams = [];
@@ -305,3 +239,11 @@ export default {
   }
 };
 </script>
+<style scoped>
+.body-toolbar {
+  height: 40px;
+  line-height: 40px;
+  text-align: right;
+  padding-right: 10px;;
+}
+</style>

+ 93 - 75
fdapfe-ui/src/views/model/faultPhysical/form.vue

@@ -2,33 +2,18 @@
   <el-dialog
     :title="title"
     :visible.sync="dialogOpen"
-    width="700px"
+    width="1000px"
     append-to-body
     @opened="initData"
     @close="handleCancel"
   >
-
-    <el-descriptions v-if="options === 'info'" :column="1" border>
-      <el-descriptions-item label="故障模型名称" label-class-name="my-label" content-class-name="my-content">{{formData.formulaName}}</el-descriptions-item>
-      <el-descriptions-item label="故障模型类型">
-        <dict-tag
-          :options="dict.type.biz_model_type"
-          :value="formData.modelType"
-        />
-      </el-descriptions-item>
-      <el-descriptions-item label="故障模型接口地址">{{formData.modelPath}}</el-descriptions-item>
-      <el-descriptions-item label="故障模型参数参数">{{formData.modelDataParams}}</el-descriptions-item>
-      <el-descriptions-item label="说明">{{formData.remark}}</el-descriptions-item>
-    </el-descriptions>
-
-    <el-form v-else ref="formData" :model="formData" :rules="rules" label-width="130px">
+    <el-form ref="formData" :model="formData" :rules="rules" label-width="130px">
       <el-form-item label="故障模型名称" prop="modelName">
         <el-input v-model="formData.modelName" placeholder="请输入故障模型名称"/>
       </el-form-item>
-      <el-form-item v-if="modelAtrtibution==='0'"  label="故障模型类型" prop="modelType">
+      <el-form-item label="模型类型" prop="type">
         <el-select
-          @change="handinputShow"
-            v-model="formData.modelType"
+          v-model="formData.modelType"
           placeholder="请选择故障模型类型"
           clearable
         >
@@ -40,36 +25,9 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item v-if="apiShow" label="模型接口地址" prop="modelPath">
+      <el-form-item  label="模型接口地址" prop="modelPath">
         <el-input v-model="formData.modelPath" placeholder="请输入故障模型接口地址"/>
       </el-form-item>
-      <el-form-item v-if="apiShow" label="故障模型参数" prop="modelDataParams">
-        <el-input
-          v-model="formData.modelDataParams"
-          type="textarea"
-          placeholder="请输入内容"
-        />
-      </el-form-item>
-      <el-form-item v-if="fileShow" label="故障模型参数" prop="modelDataParams">
-        <el-input
-          v-model="formData.modelDataParams"
-          type="textarea"
-          placeholder="请输入内容"
-        />
-      </el-form-item>
-      <el-form-item v-if="localhostFileShow && modelAtrtibution==='0'" label="模型工程地址" prop="exeLocalPath">
-        <el-input v-model="formData.exeLocalPath" placeholder="请输入模型工程地址"/>
-      </el-form-item>
-      <el-form-item v-if="localhostFileShow && modelAtrtibution==='1'" label="模型接口地址" prop="modelPath">
-        <el-input v-model="formData.modelPath" placeholder="请输入模型接口地址"/>
-      </el-form-item>
-      <el-form-item v-if="localhostFileShow" label="文件输入地址" prop="modelInputPath">
-        <el-input v-model="formData.modelInputPath" placeholder="请输入文件输入地址"/>
-      </el-form-item>
-      <el-form-item v-if="localhostFileShow" label="文件输出地址" prop="modelOutputPath">
-        <el-input v-model="formData.modelOutputPath" placeholder="请输入文件输出地址"/>
-      </el-form-item>
-
       <el-form-item label="备注" prop="remark">
         <el-input
           v-model="formData.remark"
@@ -77,7 +35,63 @@
           placeholder="请输入内容"
         />
       </el-form-item>
+      <el-form-item label="参数配置" prop="remark">
+        <div class="body-toolbar">
+          <el-button circle icon="el-icon-plus"
+                     @click="openDialog">
+          </el-button>
+        </div>
+        <el-table :data="formData.configData">
+          <el-table-column prop="paramName" label="字段名称" min-width="60" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.paramName" placeholder="字段名称"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="paramChineseName" label="中文名称" min-width="60" align="center">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.paramChineseName" placeholder="中文名称"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="paramType" label="参数类型" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-select v-model="scope.row.paramType" placeholder="参数类型" >
+                <el-option
+                  v-for="dict in dict.type.param_type"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column prop="paramDefaultValue" label="默认值" min-width="60" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.paramDefaultValue" placeholder="默认值"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="isRequired" label="是否必填" min-width="50" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-switch
+                v-model="scope.row.isRequired"
+                active-color="#13ce66"
+                inactive-color="#ff4949">
+              </el-switch>
+            </template>
+          </el-table-column>
+          <el-table-column prop="paramSort" label="排序号" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-input-number size="mini" v-model="scope.row.paramSort" :min="1" :max="10" label="排序号"></el-input-number>
+            </template>
+          </el-table-column>
+          <el-table-column prop="paramDescription" label="字段说明" header-align="center" align="center">
+            <template slot-scope="scope">
+              <el-input type="textarea"  autosize v-model="scope.row.paramDescription" placeholder="字段说明"></el-input>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form-item>
     </el-form>
+
     <div slot="footer" class="dialog-footer">
       <el-button type="primary" @click="handleSubmit">确 定</el-button>
       <el-button @click="handleCancel">取 消</el-button>
@@ -87,13 +101,10 @@
 
 <script>
 import {
-  listFaultPhysical,
-  getFaultPhysical,
-  delFaultPhysical,
   addFaultPhysical,
   updateFaultPhysical,
+  getFaultPhysical
 } from "@/api/model/faultPhysical";
-
 export default {
   props: {
     value: {
@@ -109,7 +120,7 @@ export default {
       default: 'add'
     },
   },
-  dicts: ["biz_model_type"],
+  dicts: ["biz_model_type","param_type"],
   data() {
     return {
       formData: {
@@ -126,7 +137,8 @@ export default {
         updateTime: '',
         modelAttribution:'',
         modelInputPath:'',
-        modelOutputPath:''
+        modelOutputPath:'',
+        configData:[]
       },
       rules: {
         localhostFileShow:[
@@ -184,33 +196,31 @@ export default {
     }
   },
   methods: {
+    openDialog(){
+      this.formData.configData.push(
+        {
+          modelId:'',
+          paramName:'',
+          paramChineseName:'',
+          paramType:'',
+          paramSort:'',
+          paramDefaultValue:'',
+          paramDescription:'',
+          isRequired:false
+        }
+      )
+    },
     initData() {
       this.formData.modelAttribution= this.modelAtrtibution;
-      if(this.modelAtrtibution==='1'){
-        this.formData.modelType=2;
-        this.handinputShow('2');
-      }
-      console.log(this.dataInfo)
       if (this.options!== 'add') {
-        this.formData = { ...this.dataInfo };
-        this.handinputShow(this.dataInfo.modelType)
+        this.selectInfo(this.dataInfo.modelId);
       }
     },
-    handinputShow(res){
-      console.log('handinputShow',res);
-      if(res ==='1'){
-        this.apiShow = true;
-        this.localhostFileShow = false;
-        this.fileShow=false;
-      }else if(res ==='2'){
-        this.localhostFileShow = true;
-        this.apiShow = false;
-        this.fileShow=false;
-      }else if(res ==='3'){
-        this.localhostFileShow = true;
-        this.apiShow = false;
-        this.fileShow=true;
-      }
+    selectInfo(id){
+      getFaultPhysical(id).then(res =>{
+        console.log('返回详情信息',res.data)
+        this.formData = res.data;
+      })
     },
     handleSubmit() {
       this.$refs["formData"].validate((valid) => {
@@ -237,3 +247,11 @@ export default {
   }
 };
 </script>
+<style>
+.body-toolbar {
+  height: 40px;
+  line-height: 40px;
+  text-align: right;
+  padding-right: 10px;;
+}
+</style>

+ 1 - 14
fdapfe-ui/src/views/model/faultPhysical/index.vue

@@ -102,20 +102,7 @@
     >
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="模型名称" align="center" prop="modelName"/>
-      <el-table-column label="模型类型" align="center" prop="modelType">
-        <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.biz_model_type"
-            :value="scope.row.modelType"
-          />
-        </template>
-      </el-table-column>
-      <el-table-column v-if="modelAtrtibution==='1'" label="模型接口地址" align="center" prop="modelPath"/>
-      <el-table-column v-if="modelAtrtibution==='0'"  label="模型参数" align="center" prop="modelDataParams"/>
-
-      <el-table-column v-if="modelAtrtibution==='0'" label="模型工程地址" align="center" prop="exeLocalPath"/>
-      <el-table-column label="文件输入地址" align="center" prop="modelInputPath"/>
-      <el-table-column label="文件输出地址" align="center" prop="modelOutputPath"/>
+      <el-table-column  label="模型接口地址" align="center" prop="modelPath"/>
       <el-table-column label="备注" align="center" prop="remark"/>
       <el-table-column label="操作"  align="center" class-name="small-padding fixed-width" >
         <template slot-scope="scope">