Эх сурвалжийг харах

feat: 多源信息融合、异源图像匹配定位的配置读取、超参传递

Eagle 4 сар өмнө
parent
commit
a6468390d3

+ 146 - 0
src/api/interface/demo/algorithmConfig.ts

@@ -0,0 +1,146 @@
+import { PageQuery, BaseEntity } from '@/api/interface/index'
+export interface AlgorithmConfigVO extends BaseEntity {
+  /**
+   * $column.columnComment
+   */
+  id: string | number
+
+  /**
+   * $column.columnComment
+   */
+  tool: string
+
+  /**
+   * $column.columnComment
+   */
+  module: string
+
+  /**
+   * $column.columnComment
+   */
+  algorithmName: string
+
+  /**
+   * $column.columnComment
+   */
+  startApi: string
+
+  /**
+   * $column.columnComment
+   */
+  pauseApi: string
+
+  /**
+   * $column.columnComment
+   */
+  terminateApi: string
+
+  /**
+   * $column.columnComment
+   */
+  parameters: string
+
+  /**
+   * $column.columnComment
+   */
+  remarks: string
+}
+
+export interface AlgorithmConfigForm {
+  /**
+   * $column.columnComment
+   */
+  id?: string | number
+
+  /**
+   * $column.columnComment
+   */
+  tool?: string
+
+  /**
+   * $column.columnComment
+   */
+  module?: string
+
+  /**
+   * $column.columnComment
+   */
+  algorithmName?: string
+
+  /**
+   * $column.columnComment
+   */
+  startApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  pauseApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  terminateApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  parameters?: string
+
+  /**
+   * $column.columnComment
+   */
+  remarks?: string
+
+  /**
+   * $column.columnComment
+   */
+  version?: number
+}
+
+export interface AlgorithmConfigQuery extends PageQuery {
+  /**
+   * $column.columnComment
+   */
+  tool?: string
+
+  /**
+   * $column.columnComment
+   */
+  module?: string
+
+  /**
+   * $column.columnComment
+   */
+  algorithmName?: string
+
+  /**
+   * $column.columnComment
+   */
+  startApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  pauseApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  terminateApi?: string
+
+  /**
+   * $column.columnComment
+   */
+  parameters?: string
+
+  /**
+   * $column.columnComment
+   */
+  remarks?: string
+
+  /**
+   * 日期范围参数
+   */
+  params?: any
+}

+ 85 - 0
src/api/modules/demo/algorithmConfig.ts

@@ -0,0 +1,85 @@
+import http from '@/api'
+import { AlgorithmConfigVO, AlgorithmConfigForm, AlgorithmConfigQuery } from '@/api/interface/demo/algorithmConfig'
+/**
+ * @name 查询【请填写功能名称】列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listAlgorithmConfigApi = (query: AlgorithmConfigQuery) => {
+  return http.get<AlgorithmConfigVO[]>('/demo/algorithmConfig/list', query, { loading: true })
+}
+
+export const getJsonParams = data => {
+  let ret = {}
+  data.forEach(item => {
+    if (item.value === 0 || item.value.length === 0 || !item.value) {
+      ret[item.agName] = item.defaultValue
+    } else {
+      ret[item.agName] = item.value
+    }
+  })
+  return ret
+}
+
+export const getOneAlgorithmConfigApi = (query: AlgorithmConfigQuery) => {
+  return http.get<AlgorithmConfigVO[]>('/demo/algorithmConfig/getOne', query, { loading: true })
+}
+/**
+ * @name 查询【请填写功能名称】详细
+ * @param id id
+ * @returns returns
+ */
+export const getAlgorithmConfigApi = (id: string | number) => {
+  return http.get<AlgorithmConfigVO>(`/demo/algorithmConfig/${id}`)
+}
+
+/**
+ * @name 新增【请填写功能名称】
+ * @param data data
+ * @returns returns
+ */
+export const addAlgorithmConfigApi = (data: AlgorithmConfigForm) => {
+  return http.post<any>('/demo/algorithmConfig', data, { loading: false })
+}
+
+/**
+ * @name 修改【请填写功能名称】
+ * @param data data
+ * @returns returns
+ */
+export const updateAlgorithmConfigApi = (data: AlgorithmConfigForm) => {
+  return http.put<any>('/demo/algorithmConfig', data, { loading: false })
+}
+
+/**
+ * @name 删除【请填写功能名称】
+ * @param id id
+ * @returns returns
+ */
+export const delAlgorithmConfigApi = (id: string | number | Array<string | number>) => {
+  return http.delete<any>(`/demo/algorithmConfig/${id}`)
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/demo/algorithmConfig/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importAlgorithmConfigDataApi = (data: any) => {
+  return http.post('/demo/algorithmConfig/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportAlgorithmConfigApi = (data: any) => {
+  return http.downloadPost('/demo/algorithmConfig/export', data)
+}

+ 16 - 2
src/views/demo/match/index.vue

@@ -67,6 +67,15 @@
         <span class="span_class">任务文件</span>
         <file @update:model-value="updateFile" :file-size="2048" :file-type="['zip']"></file>
       </el-container>
+
+      <el-container v-for="(item, index) in jsonParams" :key="index" style=" align-items: center;margin-top: 5px">
+        <span style="min-width: 80px; max-width: 150px">{{ item.name }}</span>
+        <el-tooltip :content="item.prompt" placement="top">
+          <el-icon><InfoFilled /></el-icon>
+        </el-tooltip>
+        <el-input v-model="item.value" :placeholder="item.defaultValue" style="max-width: 300px" />
+      </el-container>
+
       <el-button type="primary" @click="doCreateTask">创建</el-button>
     </el-dialog>
 
@@ -152,6 +161,7 @@ import File from '@/components/Upload/File.vue'
 import { getDictsApi } from '@/api/modules/system/dictData'
 import ResultDialog from '@/components/ResultDialog/ResultDialog.vue'
 import http from '@/api'
+import { getJsonParams, getOneAlgorithmConfigApi } from '@/api/modules/demo/algorithmConfig'
 
 const logVisible = ref(false)
 const logData = ref([])
@@ -219,8 +229,12 @@ const doExecute = function (row) {
   })
 }
 
+const jsonParams = ref([])
 const dialogVisible = ref(false)
-const openCreateDialog = function () {
+const openCreateDialog = async function () {
+  const res = await getOneAlgorithmConfigApi({ algorithmName: '异源图像匹配定位' })
+  // console.log(res)
+  jsonParams.value = JSON.parse(res.data.parameters)
   formData.value = {
     name: '',
     file: null
@@ -232,7 +246,7 @@ const formData = ref({
   file: null
 })
 const doCreateTask = function () {
-  createTask(formData.value).then(res => {
+  createTask({ parameters: JSON.stringify(getJsonParams(jsonParams.value)), ...formData.value }).then(res => {
     if (res.code === 200) {
       dialogVisible.value = false
       ElMessage.success('创建成功')

+ 15 - 3
src/views/demo/traceMerge/index.vue

@@ -45,6 +45,13 @@
           <span style="min-width: 80px">任务文件</span>
           <file @update:model-value="updateFiles" :file-size="20" :file-type="['mat']"></file>
         </el-container>
+        <el-container v-for="(item, index) in jsonParams" :key="index" style=" align-items: center;margin-top: 5px">
+          <span style="min-width: 80px; max-width: 150px">{{ item.name }}</span>
+          <el-tooltip :content="item.prompt" placement="top">
+            <el-icon><InfoFilled /></el-icon>
+          </el-tooltip>
+          <el-input v-model="item.value" :placeholder="item.defaultValue" style="max-width: 300px" />
+        </el-container>
       </el-container>
       <span class="dialog-footer">
         <el-button type="primary" @click="submitCreateTask">确 定</el-button>
@@ -56,7 +63,7 @@
       <el-container direction="vertical">
         <el-header>第 {{ dataIndex + 1 }} 张, 共 {{ resultData.length }} 张</el-header>
         <el-container direction="horizontal" style="margin-top: 20px">
-          <div style=" place-items: center center;width: 100px">帧率</div>
+          <div style="place-items: center center; width: 100px">帧率</div>
           <el-input v-model="frameSpeed" style="max-width: 200px" />
           <el-button @click="onSpeedChange" style="margin-left: 20px">确定</el-button>
         </el-container>
@@ -102,6 +109,7 @@ import File from '@/components/Upload/File.vue'
 import { getDictsApi } from '@/api/modules/system/dictData'
 import http from '@/api'
 import ResultDialog from '@/components/ResultDialog/ResultDialog.vue'
+import { getJsonParams, getOneAlgorithmConfigApi } from '@/api/modules/demo/algorithmConfig'
 
 const ResultDialogRef = ref<InstanceType<typeof ResultDialog> | null>(null)
 const showResult = async function (row) {
@@ -176,7 +184,11 @@ const execute = function (row) {
   })
 }
 
-const createTask = function () {
+const jsonParams = ref([])
+const createTask = async function () {
+  const res = await getOneAlgorithmConfigApi({ algorithmName: '多源信息融合' })
+  // console.log(res)
+  jsonParams.value = JSON.parse(res.data.parameters)
   createTaskDialogVisible.value = true
   params.value = {
     preprocessPath: null,
@@ -192,7 +204,7 @@ const submitCreateTask = function () {
     ElMessage.error('请输入任务名称!')
     return
   }
-  addTraceMergeApi(params.value)
+  addTraceMergeApi({ parameters: JSON.stringify(getJsonParams(jsonParams.value)), ...params.value })
     .then(res => {
       console.log(res)
       if (res.code === 200) {