Jelajahi Sumber

实现输入数据分类,图片文件、文本文件预览,以及所有bug修复

twzydn20000928 1 tahun lalu
induk
melakukan
290d461908

+ 15 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/FileController.java

@@ -46,6 +46,18 @@ public class FileController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询输入文件列表
+     */
+    @PreAuthorize("@ss.hasPermi('algoManager:file:listInput')")
+    @GetMapping("/listInput")
+    public TableDataInfo listInput(File file)
+    {
+        startPage();
+        List<File> list = fileService.selectInputFileList(file);
+        return getDataTable(list);
+    }
+
     /**
      * 导出文件列表
      */
@@ -104,4 +116,7 @@ public class FileController extends BaseController
 
     @GetMapping("/getOption")
     public AjaxResult getOption() { return success(fileService.getOption()); }
+
+    @GetMapping("/getInputOption/{subTypeId}")
+    public AjaxResult getInputOption(@PathVariable("subTypeId") Long subTypeId) { return success(fileService.getInputOption(subTypeId)); }
 }

+ 6 - 61
pdaaphm-admin/src/main/java/com/pdaaphm/biz/domain/AlgorithmSubType.java

@@ -1,5 +1,6 @@
 package com.pdaaphm.biz.domain;
 
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.pdaaphm.common.annotation.Excel;
@@ -11,6 +12,8 @@ import com.pdaaphm.common.core.domain.BaseEntity;
  * @author allen
  * @date 2023-07-26
  */
+
+@Data
 public class AlgorithmSubType extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -36,65 +39,7 @@ public class AlgorithmSubType extends BaseEntity
     @Excel(name = "运行类型")
     private String runType;
 
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-    public void setUrl(String url)
-    {
-        this.url = url;
-    }
-
-    public String getUrl()
-    {
-        return url;
-    }
-    public void setRunType(String runType)
-    {
-        this.runType = runType;
-    }
-
-    public String getRunType()
-    {
-        return runType;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("type", getType())
-            .append("name", getName())
-            .append("url", getUrl())
-            .append("runType", getRunType())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
+    /** 输入数据类型 */
+    @Excel(name = "运行类型")
+    private String dataType;
 }

+ 6 - 51
pdaaphm-admin/src/main/java/com/pdaaphm/biz/domain/File.java

@@ -1,5 +1,6 @@
 package com.pdaaphm.biz.domain;
 
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.pdaaphm.common.annotation.Excel;
@@ -11,6 +12,8 @@ import com.pdaaphm.common.core.domain.BaseEntity;
  * @author xlk
  * @date 2023-07-26
  */
+
+@Data
 public class File extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -32,55 +35,7 @@ public class File extends BaseEntity
     @Excel(name = "类型")
     private String type;
 
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-    public void setPath(String path)
-    {
-        this.path = path;
-    }
-
-    public String getPath()
-    {
-        return path;
-    }
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("name", getName())
-            .append("path", getPath())
-            .append("type", getType())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
+    /** 数据类型 */
+    @Excel(name = "数据类型")
+    private String dataType;
 }

+ 10 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/FileMapper.java

@@ -29,6 +29,14 @@ public interface FileMapper
      */
     public List<File> selectFileList(File file);
 
+    /**
+     * 查询输入文件列表
+     *
+     * @param file 文件
+     * @return 文件集合
+     */
+    public List<File> selectInputFileList(File file);
+
     /**
      * 新增文件
      *
@@ -67,4 +75,6 @@ public interface FileMapper
      * 查询输出文件是否已存在
      */
     public Long selectOutputFile(Long id);
+
+    public List<Map> getInputOption(Long subTypeId);
 }

+ 10 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IFileService.java

@@ -29,6 +29,14 @@ public interface IFileService
      */
     public List<File> selectFileList(File file);
 
+    /**
+     * 查询输入文件列表
+     *
+     * @param file 文件
+     * @return 文件集合
+     */
+    public List<File> selectInputFileList(File file);
+
     /**
      * 新增文件
      *
@@ -62,4 +70,6 @@ public interface IFileService
     public int deleteFileById(Long id);
 
     List<Map> getOption();
+
+    List<Map> getInputOption(Long subTypeId);
 }

+ 1 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/AlgorithmServiceImpl.java

@@ -170,7 +170,7 @@ public class AlgorithmServiceImpl implements IAlgorithmService
     @Override
     public List<Map> getOption() { return algorithmMapper.getOption(); }
 
-//    @Async
+    @Async
     @Override
     public void runAlgorithms(Long id) throws IOException {
         algorithmMapper.updateStatusById(id, Algorithm.runningCode);

+ 11 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/FileServiceImpl.java

@@ -48,6 +48,12 @@ public class FileServiceImpl implements IFileService {
         return fileMapper.selectFileList(file);
     }
 
+    @Override
+    public List<File> selectInputFileList(File file) {
+        file.setType(File.inputFlag);
+        return fileMapper.selectInputFileList(file);
+    }
+
     /**
      * 新增文件
      *
@@ -102,4 +108,9 @@ public class FileServiceImpl implements IFileService {
     public List<Map> getOption() {
         return fileMapper.getOption();
     }
+
+    @Override
+    public List<Map> getInputOption(Long subTypeId) {
+        return fileMapper.getInputOption(subTypeId);
+    }
 }

+ 4 - 12
pdaaphm-admin/src/main/resources/mapper/algoManager/AlgorithmMapper.xml

@@ -137,33 +137,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <update id="updateStartTimeById" parameterType="map">
         update t_algorithm
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="startTime != null">start_time = #{startTime},</if>
-        </trim>
+            set start_time = #{startTime}, completed_time = null, cost_second = null
         where id = #{id}
     </update>
 
     <update id="updateCompletedTimeById" parameterType="map">
         update t_algorithm
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="completedTime != null">completed_time = #{completedTime},</if>
-        </trim>
+            set completed_time = #{completedTime}
         where id = #{id}
     </update>
 
     <update id="updateCostSecondById" parameterType="map">
         update t_algorithm
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="costSecond != null">cost_second = #{costSecond},</if>
-        </trim>
+            set cost_second = #{costSecond}
         where id = #{id}
     </update>
 
     <update id="updateStatusById" parameterType="map">
         update t_algorithm
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="statusCode != null">status = #{statusCode},</if>
-        </trim>
+            set status = #{statusCode}
         where id = #{id}
     </update>
 </mapper>

+ 31 - 2
pdaaphm-admin/src/main/resources/mapper/algoManager/FileMapper.xml

@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="name"    column="name"    />
         <result property="path"    column="path"    />
         <result property="type"    column="type"    />
+        <result property="dataType"    column="data_type"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectFileVo">
-        select id, `name`, `path`, `type`, create_by, create_time, update_by, update_time, remark from t_file
+        select id, `name`, `path`, `type`, data_type, create_by, create_time, update_by, update_time, remark from t_file
     </sql>
 
     <select id="selectFileList" parameterType="File" resultMap="FileResult">
@@ -26,6 +27,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null  and name != ''"> and `name` like concat('%', #{name}, '%')</if>
             <if test="path != null  and path != ''"> and `path` = #{path}</if>
             <if test="type != null  and type != ''"> and `type` = #{type}</if>
+            <if test="dataType != null  and dataType != ''"> and `data_type` = #{dataType}</if>
+        </where>
+    </select>
+
+    <select id="selectInputFileList" parameterType="File" resultMap="FileResult">
+        <include refid="selectFileVo"/>
+        <where>
+            <if test="name != null  and name != ''"> and `name` like concat('%', #{name}, '%')</if>
+            <if test="path != null  and path != ''"> and `path` = #{path}</if>
+            <if test="type != null  and type != ''"> and `type` = #{type}</if>
+            <if test="dataType != null  and dataType != ''"> and `data_type` = #{dataType}</if>
         </where>
     </select>
 
@@ -40,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">`name`,</if>
             <if test="path != null">`path`,</if>
             <if test="type != null">`type`,</if>
+            <if test="dataType != null">`data_type`,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -50,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">#{name},</if>
             <if test="path != null">#{path},</if>
             <if test="type != null">#{type},</if>
+            <if test="dataType != null">#{dataType},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -64,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">`name` = #{name},</if>
             <if test="path != null">`path` = #{path},</if>
             <if test="type != null">`type` = #{type},</if>
+            <if test="dataType != null">`type` = #{dataType},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
@@ -85,7 +100,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="getOption" resultType="Map">
-        select id, `name`, `type` from t_file
+        select id, `name`, `type`, data_type from t_file
+    </select>
+
+    <select id="getInputOption" parameterType="Long" resultType="Map">
+        SELECT
+            f.id,
+            f.`name`,
+            f.`type`,
+            f.data_type
+        FROM
+            t_file f
+                JOIN t_algorithm_sub_type ast ON ast.data_type = f.data_type
+        WHERE
+            f.type = 1
+          AND ast.id = #{subTypeId}
     </select>
 
     <select id="selectOutputFile" resultType="Long">

+ 5 - 1
pdaaphm-admin/src/main/resources/mapper/conf/AlgorithmSubTypeMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="name"    column="name"    />
         <result property="url"    column="url"    />
         <result property="runType"    column="run_type"    />
+        <result property="dataType"    column="data_type"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectAlgorithmSubTypeVo">
-        select id, `type`, `name`, url, run_type, create_by, create_time, update_by, update_time, remark from t_algorithm_sub_type
+        select id, `type`, `name`, url, run_type, data_type, create_by, create_time, update_by, update_time, remark from t_algorithm_sub_type
     </sql>
 
     <select id="selectAlgorithmSubTypeList" parameterType="AlgorithmSubType" resultMap="AlgorithmSubTypeResult">
@@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">`name`,</if>
             <if test="url != null">url,</if>
             <if test="runType != null">run_type,</if>
+            <if test="dataType != null">data_type,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -54,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">#{name},</if>
             <if test="url != null">#{url},</if>
             <if test="runType != null">#{runType},</if>
+            <if test="dataType != null">#{dataType},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -69,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">`name` = #{name},</if>
             <if test="url != null">url = #{url},</if>
             <if test="runType != null">run_type = #{runType},</if>
+            <if test="dataType != null">data_type = #{dataType},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 6 - 2
pdaaphm-framework/src/main/java/com/pdaaphm/framework/config/ResourcesConfig.java

@@ -17,7 +17,7 @@ import com.pdaaphm.framework.interceptor.RepeatSubmitInterceptor;
 
 /**
  * 通用配置
- * 
+ *
  * @author Allen
  */
 @Configuration
@@ -33,6 +33,10 @@ public class ResourcesConfig implements WebMvcConfigurer
         registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
                 .addResourceLocations("file:" + PadaphmConfig.getProfile() + "/");
 
+        /** 本地生成文件路径 */
+        registry.addResourceHandler(Constants.RESOURCE_RESULTPREFIX + "/**")
+                .addResourceLocations("file:" + PadaphmConfig.getResultPath() + "/");
+
         /** swagger配置 */
         registry.addResourceHandler("/swagger-ui/**")
                 .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
@@ -70,4 +74,4 @@ public class ResourcesConfig implements WebMvcConfigurer
         // 返回新的CorsFilter
         return new CorsFilter(source);
     }
-}
+}

+ 4 - 4
pdaaphm-framework/src/main/java/com/pdaaphm/framework/config/SecurityConfig.java

@@ -22,7 +22,7 @@ import com.pdaaphm.framework.security.handle.LogoutSuccessHandlerImpl;
 
 /**
  * spring security配置
- * 
+ *
  * @author Allen
  */
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private UserDetailsService userDetailsService;
-    
+
     /**
      * 认证失败处理类
      */
@@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private JwtAuthenticationTokenFilter authenticationTokenFilter;
-    
+
     /**
      * 跨域过滤器
      */
@@ -113,7 +113,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 .antMatchers("/login", "/register", "/captchaImage").permitAll()
                 // 静态资源,可匿名访问
-                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
+                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/resultPath/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

+ 17 - 0
pdaaphm-ui/src/api/algoManager/file.js

@@ -9,6 +9,15 @@ export function listFile(query) {
   })
 }
 
+// 查询输入文件列表
+export function listInputFile(query) {
+  return request({
+    url: '/algoManager/file/listInput',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询文件详细
 export function getFile(id) {
   return request({
@@ -49,4 +58,12 @@ export function getFileList() {
     url: '/algoManager/file/getOption',
     method: 'get',
   })
+}
+
+// 查询输入文件列表
+export function getInputFileList(subTypeId) {
+  return request({
+    url: '/algoManager/file/getInputOption/' + subTypeId,
+    method: 'get',
+  })
 }

+ 81 - 21
pdaaphm-ui/src/views/algoManager/algorithm/index.vue

@@ -119,7 +119,7 @@
           v-hasPermi="['algoManager:algorithm:run']"
         >算法运行</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList()"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="algorithmList" @selection-change="handleSelectionChange">
@@ -221,7 +221,17 @@
         <template v-if="form.subTypeId">
           <el-form-item v-for="item in form.ioSubList" :label="item.name" :key="item.id">
             <!-- <file-upload v-model="form.path"/> -->
+            <image-preview v-if="form.status == 2 && imageList.includes(item.path.split('.').pop())" :src="item.path" :width="50" :height="50"/>
+            <template v-else-if="form.status == 2 && textList.includes(item.path.split('.').pop())">
+              <div>
+                <!-- 显示文件内容 -->
+                <div class="file-content" v-show="fileContent">
+                  {{ fileContent }}
+                </div>
+              </div>
+            </template>
             <el-select
+              v-else
               v-model="item.uploadId"
               placeholder="请选择文件"
               clearable
@@ -229,21 +239,23 @@
               :disabled="form.status == 2 || item.type == 2"
             >
               <el-option
-                v-for="file in fileList"
-                :key="file.id"
-                :label="file.name"
-                :value="file.id"
+                v-for="inputFile in inputFileList"
+                :key="inputFile.id"
+                :label="inputFile.name"
+                :value="inputFile.id"
               >
               </el-option>
             </el-select>
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-download"
-              @click="download(item.path)"
-              v-hasPermi="['data:model:edit']"
-            >{{ "下载文件" }}
-            </el-button>
+            <template v-if="form.status == 2">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-download"
+                @click="download(item.path)"
+                v-hasPermi="['data:model:edit']"
+              >{{ "下载文件" }}
+              </el-button>
+            </template>
           </el-form-item>
         </template>
         <el-form-item label="名称" prop="name">
@@ -265,7 +277,9 @@
 import { listAlgorithm, getAlgorithmDto, delAlgorithm, addOrUpdateDto, runAlgorithms } from "@/api/algoManager/algorithm";
 import { getAlgoSubOption } from "@/api/algoManager/algorithm";
 import { getIoSubList } from "@/api/conf/field";
-import { getFileList } from "@/api/algoManager/file";
+import { getFileList, getInputFileList } from "@/api/algoManager/file";
+import axios from 'axios';
+import { isExternal } from "@/utils/validate";
 
 export default {
   name: "Algorithm",
@@ -292,6 +306,8 @@ export default {
       algoTypeList: [],
       // 已上传文件列表
       fileList: [],
+      // 输入文件表格数据
+      inputFileList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -317,17 +333,18 @@ export default {
         ],
       },
       typeMap: new Map(),
+      imageList: ["jpg", "jpeg", "png", "bmp", "gif"],
+      textList: ["txt", "doc", "hlp", "wps"],
+      fileContent: '',
     };
   },
   created() {
     this.getList();
     this.getAlgoSubOption();
-    this.getFileList();
   },
   activated() {
     this.getList();
     this.getAlgoSubOption();
-    this.getFileList();
   },
   methods: {
     /** 查询算法列表 */
@@ -356,6 +373,14 @@ export default {
       });
     },
 
+    getInputFileList() {
+      getInputFileList(this.form.subTypeId).then((resp) => {
+        this.inputFileList = resp.data;
+        console.info(resp);
+        console.info(this);
+      });
+    },
+
     // 取消按钮
     cancel() {
       this.open = false;
@@ -424,6 +449,7 @@ export default {
         this.open = true;
         this.title = "查看结果";
         this.algoTypeList = this.typeMap.get(this.form.type);
+        this.fetchFileContent(this.form.ioSubList);
       });
       console.info(this);
     },
@@ -435,7 +461,6 @@ export default {
             this.$modal.msgSuccess("成功");
             this.open = false;
             this.getList();
-            this.getFileList();
           });
         }
       });
@@ -495,15 +520,50 @@ export default {
     },
 
     changeFormSubType() {
-      getIoSubList(this.form.subTypeId, this.form.id).then((resp) => {
-        this.form.ioSubList = resp.data;
-        console.info(resp);
-      });
+      if(this.form.subTypeId) {
+        getIoSubList(this.form.subTypeId, this.form.id).then((resp) => {
+          this.form.ioSubList = resp.data;
+          console.info(resp);
+        });
+        this.getInputFileList();
+      }
+      else {
+        this.inputFileList = [];
+      }
     },
 
     download(path) {
       this.$download.resource(path);
     },
+
+    // 拿到文本文件里的内容
+    async fetchFileContent(ioSubList) {
+      try {
+        let filePath;
+        for (let item of ioSubList) {
+          if (this.textList.includes(item.path.split('.').pop())) {
+            filePath = item.path;
+          }
+        }
+        const response = await axios.get(this.realSrc(filePath), { responseType: 'text' });
+        this.fileContent = response.data;
+      } catch (error) {
+        console.error("Error fetching the file:", error);
+        alert('无法加载文件内容');
+      }
+    },
+
+    // 通过path得到绝对路径
+    realSrc(src) {
+      if (!src) {
+        return;
+      }
+      let real_src = src.split(",")[0];
+      if (isExternal(real_src)) {
+        return real_src;
+      }
+      return process.env.VUE_APP_BASE_API + real_src;
+    },
   }
 };
 </script>

+ 43 - 15
pdaaphm-ui/src/views/algoManager/file/index.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="数据类型" prop="type">
+        <el-select v-model="queryParams.dataType" placeholder="请选择数据类型" clearable filterable @keyup.enter.native="handleQuery">
+          <el-option
+            v-for="dict in dict.type.data_type"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="文档名称" prop="name">
         <el-input
           v-model="queryParams.name"
@@ -61,16 +71,10 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="fileList" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="inputFileList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="编号" align="center" prop="id" />
       <el-table-column label="文档名称" align="center" prop="name" />
-      <el-table-column label="文档路径" align="center" prop="path" />
-      <el-table-column label="输入/输出" align="center" prop="type">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.algorithm_io_type" :value="scope.row.type"/>
-        </template>
-      </el-table-column>
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -103,6 +107,16 @@
     <!-- 添加或修改文件对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="数据类型" prop="type">
+          <el-select v-model="form.dataType" placeholder="请选择数据类型" clearable filterable>
+            <el-option
+              v-for="dict in dict.type.data_type"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="文档名称" prop="name">
           <el-input v-model="form.name" placeholder="请输入文档名称" />
         </el-form-item>
@@ -132,11 +146,11 @@
 </template>
 
 <script>
-import { listFile, getFile, delFile, addFile, updateFile } from "@/api/algoManager/file";
+import { listFile, getFile, delFile, addFile, updateFile, listInputFile } from "@/api/algoManager/file";
 
 export default {
   name: "File",
-  dicts: ['algorithm_io_type'],
+  dicts: ['algorithm_io_type', 'data_type'],
   data() {
     return {
       // 遮罩层
@@ -153,6 +167,8 @@ export default {
       total: 0,
       // 文件表格数据
       fileList: [],
+      // 输入文件表格数据
+      inputFileList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -173,10 +189,10 @@ export default {
     };
   },
   created() {
-    this.getList();
+    this.getInputList();
   },
   activated() {
-    this.getList();
+    this.getInputList();
   },
   methods: {
     /** 查询文件列表 */
@@ -188,6 +204,17 @@ export default {
         this.loading = false;
       });
     },
+
+    /** 查询文件列表 */
+    getInputList() {
+      this.loading = true;
+      listInputFile(this.queryParams).then(response => {
+        this.inputFileList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    
     // 取消按钮
     cancel() {
       this.open = false;
@@ -200,6 +227,7 @@ export default {
         name: null,
         path: null,
         type: null,
+        dataType: null,
         createBy: null,
         createTime: null,
         updateBy: null,
@@ -211,7 +239,7 @@ export default {
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
-      this.getList();
+      this.getInputList();
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -252,13 +280,13 @@ export default {
             updateFile(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
-              this.getList();
+              this.getInputList();
             });
           } else {
             addFile(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
-              this.getList();
+              this.getInputList();
             });
           }
         }
@@ -270,7 +298,7 @@ export default {
       this.$modal.confirm('是否确认删除文件编号为"' + ids + '"的数据项?').then(function() {
         return delFile(ids);
       }).then(() => {
-        this.getList();
+        this.getInputList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
     },

+ 12 - 6
pdaaphm-ui/src/views/conf/subType/index.vue

@@ -152,11 +152,16 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <!-- <template v-if="form.runType == 2">
-          <el-form-item label="matlab文件路径" prop="matlabIoPath">
-            <el-input v-model="form.matlabIoPath" placeholder="请输入matlab文件路径" />
-          </el-form-item>
-        </template> -->
+        <el-form-item label="输入数据类型" prop="dataType">
+          <el-select v-model="form.dataType" clearable placeholder="请输入input数据类型">
+            <el-option
+              v-for="dict in dict.type.data_type"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -174,7 +179,7 @@ import { listSubType, getSubType, delSubType, addSubType, updateSubType } from "
 
 export default {
   name: "SubType",
-  dicts: ['algorithm_type','run_type'],
+  dicts: ['algorithm_type', 'run_type', 'data_type'],
   data() {
     return {
       // 遮罩层
@@ -239,6 +244,7 @@ export default {
         name: null,
         url: null,
         runType: null,
+        dataType: null,
         createBy: null,
         createTime: null,
         updateBy: null,