Browse Source

Merge branch 'dev_lsk_fix_v1' of www/taais-web into develop

Sk18834839360 9 months ago
parent
commit
376fb29e21

+ 4 - 0
src/api/modules/ag/model.ts

@@ -27,6 +27,10 @@ export const addModelApi = (data: ModelForm) => {
   return http.post<any>('/ag/model', data, { loading: false })
 }
 
+export const addAlgorithmTaskConfigurationApi = (data: ModelForm) => {
+  return http.post<any>('/task/taskConfiguration/importModel', data, { loading: false })
+}
+
 /**
  * @name 修改算法模型配置
  * @param data data

+ 17 - 2
src/components/FormDialog/index.vue

@@ -10,7 +10,7 @@
   >
     <ProFrom ref="proFormRef" :items-options="parameter.itemsOptions" :form-options="_options" :model="parameter.model">
       <template #modelAddress="{}">
-        <FileUpload :file-size="4096" :file-type="['pt']" />
+        <FileUpload :file-size="4096" :file-type="['pt']" v-on:update:modelValue="setModelAddr"/>
       </template>
     </ProFrom>
     <template #footer>
@@ -23,11 +23,16 @@
 </template>
 
 <script setup lang="ts" name="FormDialog">
-import { ref, ComputedRef, computed } from 'vue'
+import {ref, ComputedRef, computed, reactive} from 'vue'
 import ProFrom from '@/components/ProForm/index.vue'
 import { ElMessage } from 'element-plus'
 import FileUpload from '@/components/Upload/File.vue'
 
+interface EmitEvent {
+  (e: 'update'): void
+}
+const emits = defineEmits<EmitEvent>()
+
 const videoUploadRef = ref<InstanceType<typeof FileUpload> | null>(null)
 
 export interface FormParameterProps {
@@ -63,11 +68,20 @@ const _options: ComputedRef<ProForm.FormOptions> = computed(() => {
   }
   return Object.assign(form, parameter.value.formOptions)
 })
+
+const modelAddr = ref('')
+const setModelAddr = res => {
+  console.log('modelAddr', res)
+  modelAddr.value = res
+}
+
 const proFormRef = ref<InstanceType<typeof ProFrom> | null>(null)
 // 表单提交校验
 const handleSubmit = () => {
   const formEl = proFormRef.value?.proFormRef
   const formModel = proFormRef.value?.formModel
+  formModel.modelAddress = modelAddr.value
+  console.log('formModel', formModel)
 
   butLoading.value = true
   if (!formEl) return
@@ -77,6 +91,7 @@ const handleSubmit = () => {
         if (res.code == 200) {
           proFormRef.value?.resetForm(formEl)
           ElMessage.success('操作成功')
+          emits('update')
           dialogVisible.value = false
           parameter.value.getTableList && parameter.value.getTableList()
         } else {

+ 3 - 1
src/components/Upload/File.vue

@@ -187,10 +187,12 @@ const uploadSuccess = (response: any | undefined, uploadFile: UploadFile) => {
 // 上传结束处理
 const uploadedSuccessfully = () => {
   if (number.value > 0 && uploadList.value.length === number.value) {
+    console.log(_fileList.value)
     _fileList.value = _fileList.value.filter(f => f.url !== undefined).concat(uploadList.value)
+    console.log(_fileList.value)
     uploadList.value = []
     number.value = 0
-    emit('update:modelValue', listToString(_fileList.value))
+    emit('update:modelValue', _fileList.value.length > 0 ? _fileList.value[0].url : '')
     tryHideFullScreenLoading()
   }
   // 监听表单验证

+ 13 - 39
src/views/demo/components/img-maker.vue

@@ -164,51 +164,15 @@ const loadInit = () => {
   state.canvas.on('mouse:down', mousedown)
   state.canvas.on('mouse:move', mousemove)
   state.canvas.on('mouse:up', mouseup)
-  // // 添加鼠标滚轮缩放功能
-  // state.canvas.on('mouse:wheel', event => {
-  //   const delta = event.delta
-  //   const zoom = state.canvas.getZoom()
-  //   const point = new fabric.Point(event.x, event.y)
-  //
-  //   if (delta > 0) {
-  //     // 放大
-  //     state.canvas.zoomToPoint(point, zoom * 1.1)
-  //     // state.radio *= 1.1
-  //   } else {
-  //     // 缩小
-  //     state.canvas.zoomToPoint(point, zoom * 0.9)
-  //     // state.radio *= 0.9
-  //   }
-  //   state.canvas.renderAll()
-  //   event.e.preventDefault()
-  //   event.e.stopPropagation()
-  // })
-
-  // nice try!
-  // console.log(props.jsonData)
-  // if (props.jsonData && props.jsonData.length > 0) {
-  //   // console.log('load')
-  //   state.canvas.loadFromJSON(props.jsonData, () => {
-  //     let objects = state.canvas.getObjects()
-  //     // console.log(objects)
-  //     objects[0].selectable = false
-  //     for (let i = 1; i < objects.length; i++) {
-  //       objects[i].selectable = true
-  //     }
-  //     state.canvas.renderAll()
-  //   })
-  //   // console.log(state.canvas)
-  //   state.loading = false
-  //   return
-  // }
 
   let imgElement = new Image()
   imgElement.src = props.src
   imgElement.onload = () => {
+    console.log(imgElement.height, imgElement.width)
     // 区域大小/图片原始大小 缩放比例
     state.radio =
       props.cWidth / imgElement.width > props.cHeight / imgElement.height ? props.cHeight / imgElement.height : props.cWidth / imgElement.width
-    // console.log('state.radio', state.radio)
+    console.log('state.radio', state.radio)
 
     // 屏幕分辨率/图片原始大小
     state.realRadioX = props.width / imgElement.width
@@ -228,10 +192,20 @@ const loadInit = () => {
       scaleY: state.radio
     })
     state.canvas.add(imgInstance)
+    console.log('props', props)
+    console.log('state', state)
     if (props.jsonData && props.jsonData.length > 0) {
       for (let i = 0; i < props.jsonData.length; i++) {
         let config = props.jsonData[i]
-        let obj = new fabric.Path(config.pathString, config)
+        let subArr = config.subArr
+        const lW = imgInstance.width * state.radio
+        const lH = imgInstance.height * state.radio
+        let obj = new fabric.Path('M ' + subArr[1] * lW + ' ' + subArr[2] * lH +
+          ' L ' + subArr[3] * lW + ' ' + subArr[4] * lH +
+          ' L ' + subArr[5] * lW + ' '  + subArr[6] * lH +
+          ' L ' + subArr[7] * lW + ' '  + subArr[8] * lH +
+          ' z',
+          config)
         state.canvas.add(obj)
       }
       state.canvas.renderAll()

+ 2 - 1
src/views/demo/data/index.vue

@@ -155,7 +155,7 @@ const markImg = data => {
           .then(res => {
             state.jsonData = []
             console.log(res)
-            let arr = res.split('\r\n')
+            let arr = res.replace('\r', '').split('\n')
             console.log(arr)
             for (let i = 0; i < arr.length; i++) {
               let subArr = arr[i].split(' ')
@@ -170,6 +170,7 @@ const markImg = data => {
                 }
               }
               state.jsonData.push({
+                subArr: subArr,
                 pathString: 'M ' + subArr[1] * 1920 + ' ' + subArr[2] * 1080 +
                   ' L ' + subArr[3] * 1920 + ' ' + subArr[4] * 1080 +
                   ' L ' + subArr[5] * 1920 + ' '  + subArr[6] * 1080 +

+ 19 - 5
src/views/taais/homePage/index.vue

@@ -111,12 +111,26 @@ const createTaskNew = () => {
 const columns = reactive<ColumnProps<User.ResUserList>[]>([
   // { type: 'selection', fixed: 'left', width: 70 },
   { prop: 'name', label: '任务名称' },
+  // {
+  //   prop: 'status',
+  //   label: '任务状态',
+  //   tag: true,
+  //   enum: () => getDictsApi('biz_task_status'),
+  //   fieldNames: { label: 'dictLabel', value: 'dictValue' }
+  // },
   {
-    prop: 'status',
-    label: '任务状态',
-    tag: true,
-    enum: () => getDictsApi('biz_task_status'),
-    fieldNames: { label: 'dictLabel', value: 'dictValue' }
+    prop: 'createTime',
+    label: '创建时间',
+    // search: {
+    //   el: 'input'
+    // }
+  },
+  {
+    prop: 'updateTime',
+    label: '更新时间',
+    // search: {
+    //   el: 'input'
+    // }
   },
   { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
 ])

+ 72 - 26
src/views/taais/homePage/task/index.vue

@@ -119,7 +119,7 @@
       </el-form-item>
     </dv-border-box1>
 
-    <FormDialog ref="formDialogRef" />
+    <FormDialog ref="formDialogRef" v-on:update="handleUpdateModelList" />
 
     <el-dialog
       v-model="expandDataDialogVisible"
@@ -267,7 +267,7 @@
 
 <script setup lang="ts">
 import {reactive, ref, onMounted, computed} from "vue";
-import {addModelApi} from "@/api/modules/ag/model";
+import {addAlgorithmTaskConfigurationApi} from "@/api/modules/ag/model";
 import {createTaskApi, getAlgorithmOptionApi} from "@/api/modules/task/task";
 import FormDialog from "@/components/FormDialog/index.vue";
 import { useRouter } from 'vue-router'
@@ -438,6 +438,14 @@ const canDeselect = computed(() => {
   return tempDeselectedBatchDataList.value.length > 0
 })
 
+const handleUpdateModelList = () => {
+  listTaskConfigurationApi({ pageNum: 1, pageSize: 10000 })
+    .then(res => {
+      // console.log(res)
+      algorithms = reactive(res.data.list)
+    })
+}
+
 onMounted(() => {
   listTaskConfigurationApi({ pageNum: 1, pageSize: 10000 })
     .then(res => {
@@ -526,9 +534,34 @@ const showDataSelectionDialog = (index, isTrainData) => {
   tempSelectedBatchDataList.value = reactive([])
   tempDeselectedBatchDataList.value = reactive([])
   selectDataIndex = index
+  fillCurrentDataDialogList(index, isTrainData)
   dataDialogVisible.value = true
 }
 
+const fillCurrentDataDialogList = (index, isTrainData) => {
+  let list = []
+  try {
+    list = bIsTrainData.value ? formData.data[index]?.split(',') : formData.testData[index]?.split(',')
+  } catch (e) {
+    console.log(e)
+  }
+  let selected = new Set(list)
+  batchDataList.value = []
+  selectedBatchDataList.value = []
+
+  batchListDataApi()
+    .then(res => {
+      // console.log(res)
+      for (let i = 0; i < res.data.length; i++) {
+        if (selected.has(res.data[i].batchNum)) {
+          selectedBatchDataList.value.push(res.data[i])
+        } else {
+          batchDataList.value.push(res.data[i])
+        }
+      }
+    })
+}
+
 let superParameterFormData = reactive({})
 
 const showSuperParameterConfig = (item, index) => {
@@ -561,18 +594,6 @@ const showAddModelDialog = () => {
       width: 580,
       isEdit: true,
       itemsOptions: [
-        {
-          label: '算法',
-          prop: 'algorithmId',
-          rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
-          compOptions: {
-            elTagName: 'select',
-            labelKey: 'name',
-            valueKey: 'id',
-            enum: allAgloData.value,
-            placeholder: '请选择算法'
-          }
-        },
         {
           label: '模型名称',
           prop: 'modelName',
@@ -584,35 +605,60 @@ const showAddModelDialog = () => {
         {
           label: '模型',
           prop: 'modelAddress',
-          rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
+          rules: [],//{ required: true, message: '模型不能为空', trigger: 'blur' }
           compOptions: {
             elTagName: 'slot'
           }
         },
         {
-          label: '训练样本数',
-          prop: 'sampleNumber',
+          label: '训练算法地址',
+          prop: 'trainUrl',
+          rules: [{ required: true, message: '训练算法地址不能为空', trigger: 'blur' }],
           compOptions: {
-            placeholder: '请输入训练样本数'
+            placeholder: '请输入训练算法地址'
           }
         },
         {
-          label: '训练循环次数',
-          prop: 'cycleEpoch',
+          label: '训练超参配置',
+          prop: 'trainParams',
           compOptions: {
-            placeholder: '请输入训练循环次数'
+            placeholder: '请输入训练超参'
           }
         },
         {
-          label: '备注',
-          prop: 'remarks',
+          label: '验证算法地址',
+          prop: 'valUrl',
+          rules: [{ required: true, message: '验证算法地址不能为空', trigger: 'blur' }],
           compOptions: {
-            placeholder: '请输入备注'
+            placeholder: '请输入验证算法地址'
           }
-        }
+        },
+        {
+          label: '验证超参配置',
+          prop: 'valParams',
+          compOptions: {
+            placeholder: '请输入验证超参'
+          }
+        },
+        {
+          label: '测试算法地址',
+          prop: 'testUrl',
+          rules: [{ required: true, message: '测试算法地址不能为空', trigger: 'blur' }],
+          compOptions: {
+            placeholder: '请输入测试算法地址'
+          }
+        },
+        {
+          label: '测试超参配置',
+          prop: 'testParams',
+          compOptions: {
+            placeholder: '请输入测试超参'
+          }
+        },
+
       ],
       model: {},
-      api: addModelApi
+      api: addAlgorithmTaskConfigurationApi
     }
 
     formDialogRef.value?.openDialog(params)

+ 14 - 0
src/views/task/bizProcess/index.vue

@@ -34,6 +34,10 @@
           重新执行
         </el-button>
 
+        <el-button type="primary" link icon="Refresh" @click="exportData(scope.row)">
+          导出结果
+        </el-button>
+
 <!--        <el-button type="primary" link icon="EditPen" v-auth="['identification:identificationSubtaskDetails:edit']" @click="openDialog(2, '算法业务处理编辑', scope.row)">-->
 <!--          编辑-->
 <!--        </el-button>-->
@@ -245,6 +249,16 @@ const reRunTask = row => {
 }
 const typeDefs = ref(reactive([]))
 
+const exportData = row => {
+  http.get<any>('/identification/identificationSubtaskDetails/resultZip', {taskId: row.id}, { loading: false })
+    .then(res => {
+      console.log(res)
+      if (res.code === 200) {
+        window.open(res.msg, '_blank');
+      }
+    })
+}
+
 let imgDataList = ref(reactive([]))
 let titleMsg = ref('')
 let valDialogVisible = ref(false)

+ 22 - 15
src/views/task/subtask/index.vue

@@ -136,29 +136,36 @@ const columns = reactive<ColumnProps<any>[]>([
   { prop: 'id', label: '主键ID' },
   {
     prop: 'name',
-    label: '任务名称',
+    label: '任务类型',
     search: {
       el: 'input'
     }
   },
   {
-    prop: 'status',
-    label: '任务状态',
-    tag: true,
-    enum: () => getDictsApi('biz_task_status'),
+    prop: 'createTime',
+    label: '创建时间',
     search: {
-      el: 'tree-select'
-    },
-    fieldNames: { label: 'dictLabel', value: 'dictValue' }
-  },
-  {
-    prop: 'type',
-    label: '任务类型',
-    tag: true,
-    enum: () => getDictsApi('biz_ag_type'),
-    fieldNames: { label: 'dictLabel', value: 'dictValue' }
+      el: 'input'
+    }
   },
   // {
+  //   prop: 'status',
+  //   label: '任务状态',
+  //   tag: true,
+  //   enum: () => getDictsApi('biz_task_status'),
+  //   search: {
+  //     el: 'tree-select'
+  //   },
+  //   fieldNames: { label: 'dictLabel', value: 'dictValue' }
+  // },
+  // {
+  //   prop: 'type',
+  //   label: '任务类型',
+  //   tag: true,
+  //   enum: () => getDictsApi('biz_ag_type'),
+  //   fieldNames: { label: 'dictLabel', value: 'dictValue' }
+  // },
+  // {
   //   prop: 'parameters',
   //   label: '调用算法时所用的参数'
   // },