Parcourir la source

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

Sk18834839360 il y a 9 mois
Parent
commit
34ca9b682c

+ 4 - 0
src/api/modules/task/bizProcessNew.ts

@@ -8,6 +8,10 @@ export const listBizProcessApi = (query: any) => {
   return http.get<any[]>('/identification/identificationSubtaskDetails/list', query, { loading: false })
 }
 
+export const getImgList = (query: any) => {
+  return http.get<any[]>('/identification/identificationSubtaskDetails/getImgList', query, { loading: false })
+}
+
 /**
  * @name 查询算法业务处理详细
  * @param id id

+ 7 - 1
src/views/demo/components/img-maker.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div style="margin-bottom: 10px">
+    <div style="margin-bottom: 10px" v-show="!isPicOnly">
       <el-button plain type="primary" class="shape-border" @click="drawTypeChange('rectangle')" :disabled="!state.dragMode">标注模式</el-button>
       <el-button plain type="primary" class="shape-border" @click="enableDragMode" :disabled="state.dragMode">移动图片</el-button>
 
@@ -58,6 +58,10 @@ const props = defineProps({
   },
   jsonData: {
     type: Array
+  },
+  isPicOnly: {
+    type: Boolean,
+    default: false
   }
 })
 const state = reactive({
@@ -234,6 +238,8 @@ const loadInit = () => {
     }
     state.radio = state.canvas.getZoom()
     state.loading = false
+    console.log(state.canvas.getObjects())
+    console.log(props.isPicOnly)
     // console.log(state.realRadioX)
     // console.log(state.realRadioY)
   }

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

@@ -125,7 +125,7 @@ const deleteData = async (params: any) => {
 
 // 标注图片
 const markImg = data => {
-  // console.log(data)
+  console.log('data is', data)
   state.cacheData = data
   state.jsonData = []
     if (!data.url || data.url.length === 0) {
@@ -150,7 +150,7 @@ const markImg = data => {
       }
 
       if (state.cacheData.labelurl && state.cacheData.labelurl.length > 0) {
-        // console.log('get label jsonData')
+        console.log('get label jsonData',state.cacheData.labelurl)
         http.get<any>(state.cacheData.labelurl)
           .then(res => {
             state.jsonData = []

+ 138 - 2
src/views/task/bizProcess/index.vue

@@ -17,6 +17,8 @@
           批量删除
         </el-button>
         <el-button type="primary" icon="View" @click="showCompareResult"> 对比结果 </el-button>
+<!--        <el-button type="primary" icon="View" @click="showValResult(true)"> 验证结果 </el-button>-->
+        <el-button type="primary" icon="View" @click="showValResult(false)"> 测试结果 </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -181,8 +183,27 @@
           </el-card>
         </el-container>
       </el-container>
+    </el-dialog>
 
+    <el-dialog
+      v-model="valDialogVisible"
+      :title="titleMsg"
+      style="width: 85vw; height: 85vh"
+    >
+      <!--      style="width: 70vw"-->
+      <el-container style="display: flex; flex-direction: row">
+        <el-container v-for="(item, index) in imgDataList" :key="index" style="display: flex; flex-direction: column">
+          <!--          <el-button @click="console.log(item)">test</el-button>-->
 
+          <el-container v-for="(_item, _index) in item" :key="_index">
+            <span v-if="_item.name" style="width: 80px; margin-right: 20px"> {{ _item.name }} </span>
+            <el-image v-if="_item.srcUrl" :src="_item.srcUrl" style="height: 200px; width:200px"></el-image>
+            <span v-if="_item.imgUrl">标签</span>
+            <ImgMaker style="height: 200px; width:200px" ref="imgMaker" v-if="_item.imgUrl" :is-pic-only="true" :src="_item.imgUrl" :area="area" :width="200" :height="200" :c-width="200" :c-height="200" :class-def="typeDefs" :json-data="_item.jsonData"></ImgMaker>
+            <el-image v-if="_item.resUrl" :src="_item.resUrl" style="height: 200px; width:200px"></el-image>
+          </el-container>
+        </el-container>
+      </el-container>
     </el-dialog>
   </div>
 </template>
@@ -196,6 +217,7 @@ import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
+import ImgMaker from '../../demo/components/img-maker'
 import {
   listBizProcessApi,
   delBizProcessApi,
@@ -205,11 +227,12 @@ import {
   getBizProcessApi,
   getTrainResultApi,
   getVerifyResultApi,
-  getTestResultApi
+  getTestResultApi,
+  getImgList
 } from '@/api/modules/task/bizProcessNew'
 // getTrainResultApi,getVerifyResultApi,getTestResultApi
 import { getSubtaskApi } from '@/api/modules/task/subtask'
-import { getDictsApi } from '@/api/modules/system/dictData'
+import {getDictsApi, listDataApi as listDictDataApi} from '@/api/modules/system/dictData'
 import { useRoute } from 'vue-router'
 import ImagePreview from '@/components/ImagePreview/index.vue'
 import http from "@/api";
@@ -220,6 +243,103 @@ let refSelectData = ref(reactive({}))
 const reRunTask = row => {
   http.post<any>('/identification/identificationSubtaskDetails/execute', {taskId: row.id}, { loading: false })
 }
+const typeDefs = ref(reactive([]))
+
+let imgDataList = ref(reactive([]))
+let titleMsg = ref('')
+let valDialogVisible = ref(false)
+const showValResult = async isVal => {
+  let hasInit = false
+  titleMsg.value = isVal ? '验证结果对比' : '测试结果对比'
+  imgDataList.value = reactive([])
+  for (let i = 0; i < listData.value.length; i++) {
+    if (listData.value[i].name.indexOf(isVal ? '验证' : '测试') !== -1) {
+      console.log(listData.value[i])
+      if (!hasInit) {
+        hasInit = true;
+        let res = await getImgList({
+          taskId: listData.value[i].preprocessPath.substring(1).split('/')[0],
+          subPath: 'images'
+        })
+        console.log('res data', res)
+        imgDataList.value.push([])
+        for (let j = 0 ; j < res.data.length; j++) {
+          let jList = res.data[j].split('.')
+          jList[jList.length - 1] = 'txt'
+          let obj = {
+            name: res.data[j],
+            srcUrl: 'api/profile/task' + listData.value[i].preprocessPath + '/' + res.data[j],
+            // imgUrl: 'api/profile/task' + listData.value[i].preprocessPath + '/images/' + res.data[j],
+            // labelUrl: 'api/profile/task' + listData.value[i].preprocessPath + '/labels/' + jList.join('.')
+          }
+
+          imgDataList.value[imgDataList.value.length - 1].push(obj)
+          if (isVal) {
+            obj.imgUrl = 'api/profile/task' + listData.value[i].preprocessPath + '/images/' + res.data[j];
+            obj.labelUrl = '/profile/task' + listData.value[i].preprocessPath + '/labels/' + jList.join('.')
+            console.log( 'url is', obj.labelUrl)
+            setDetail(obj)
+          }
+        }
+      }
+      let res = await getImgList({
+        taskId: listData.value[i].preprocessPath.substring(1).split('/')[0],
+        subPath: 'images'
+      })
+      console.log(res.data)
+      imgDataList.value.push([])
+      for (let j = 0 ; j < res.data.length; j++) {
+        let jList = res.data[j].split('.')
+        jList[jList - 1] = 'txt'
+        imgDataList.value[imgDataList.value.length - 1].push({
+          resUrl: 'api/profile/task' + listData.value[i].resultPath + '/' + res.data[j],
+          name: listData.value[i].name
+        })
+      }
+    }
+  }
+  console.log(imgDataList)
+  valDialogVisible.value = true
+}
+
+const setDetail = obj => {
+  http.get<any>(obj.labelUrl)
+    .then(res => {
+      obj.jsonData = []
+      console.log('result', res)
+      let arr = res.split('\r\n')
+      console.log(arr)
+      for (let i = 0; i < arr.length; i++) {
+        let subArr = arr[i].split(' ')
+        // console.log(subArr)
+        let cssVal = '#000000'
+        let label = '-1'
+        for (let j = 0; j < typeDefs.value.length; j++) {
+          if (typeDefs.value[j].label === subArr[0]) {
+            cssVal = typeDefs.value[j].color
+            label = typeDefs.value[j].label
+            break
+          }
+        }
+        const ww = 200
+        const hh = 200
+        obj.jsonData.push({
+          pathString: 'M ' + subArr[1] * ww + ' ' + subArr[2] * hh +
+            ' L ' + subArr[3] * ww + ' ' + subArr[4] * hh +
+            ' L ' + subArr[5] * ww + ' ' + subArr[6] * hh +
+            ' L ' + subArr[7] * ww + ' ' + subArr[8] * hh +
+            ' z',
+          // left: 0,
+          // top: 0,
+          fill: '',
+          stroke: cssVal,
+          strokeWidth: 5,
+          label: label
+        })
+      }
+    })
+}
+
 let compareDialogVisible = ref(false)
 let listData = ref(reactive([]))
 const showCompareResult = () => {
@@ -262,6 +382,22 @@ const refreshList = () => {
   }, 0)
 }
 onMounted(() => {
+  listDictDataApi({
+    pageNum: 1,
+    pageSize: 10,
+    dictType: 'class_definition'
+  })
+    .then(res => {
+      // console.log(res)
+      for (let i = 0; i < res.data.list.length; i++) {
+        typeDefs.value.push({
+          name: res.data.list[i].dictLabel,
+          color: res.data.list[i].cssClass,
+          label: res.data.list[i].dictValue
+        })
+      }
+    })
+
   getSubtaskApi(subTaskId).then(res => {
     taskType.value = res.data.type
     taskStatus.value = res.data.status