Commit ceeba9a6 authored by 胡占生's avatar 胡占生 🇨🇳
Browse files

fix: 修复项目中出现的小问题,比如:删除接口的联调,左侧菜单的点击事件

parent 98ace9f0
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@
                  </el-col>
                  </el-col>
                </el-row>
                </el-row>
          </el-form>
          </el-form>
          <el-row :gutter="10" class="mb8" style="justify-content: space-between;">
          <!-- <el-row :gutter="10" class="mb8" style="justify-content: space-between;">
            <el-col :span="1.5">
            <el-col :span="1.5">
              <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
              <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
                <span>算法维护</span>
                <span>算法维护</span>
@@ -105,7 +105,7 @@
                  </template>
                  </template>
              </el-table-column>
              </el-table-column>
            </el-table>
            </el-table>
            </el-card>
            </el-card> -->
        </div>
        </div>
        <el-form ref="algRef" :model="form" :rules="rules" label-width="80px" v-else>
        <el-form ref="algRef" :model="form" :rules="rules" label-width="80px" v-else>


@@ -139,7 +139,7 @@
                      </el-col>
                      </el-col>
                      <el-col :span="12">
                      <el-col :span="12">
                        <el-form-item label="算法场景" prop="applicationScenarios">
                        <el-form-item label="算法场景" prop="applicationScenarios">
                          <el-select v-model="form.applicationScenarios" placeholder="请选择硬件平台" clearable >
                          <el-select v-model="form.applicationScenarios" placeholder="请选择算法场景" clearable >
                            <el-option 
                            <el-option 
                            v-for="disc in algorithm_scen"
                            v-for="disc in algorithm_scen"
                            :key="disc.value"
                            :key="disc.value"
@@ -162,7 +162,7 @@
                        </el-form-item>
                        </el-form-item>
                      </el-col>
                      </el-col>
                    </el-row>
                    </el-row>
              <el-row :gutter="10" class="mb8" style="justify-content: space-between;">
              <!-- <el-row :gutter="10" class="mb8" style="justify-content: space-between;">
                <el-col :span="1.5">
                <el-col :span="1.5">
                  <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
                  <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
                    <span>算法维护</span>
                    <span>算法维护</span>
@@ -203,7 +203,7 @@
                      </template>
                      </template>
                  </el-table-column>
                  </el-table-column>
                </el-table>
                </el-table>
              </el-card>
              </el-card> -->
            </el-tab-pane>
            </el-tab-pane>
            <el-tab-pane label="算法详情" name="算法详情">
            <el-tab-pane label="算法详情" name="算法详情">
              <el-row :gutter="10" class="mb8">
              <el-row :gutter="10" class="mb8">
+5 −5
Original line number Original line Diff line number Diff line
@@ -89,9 +89,9 @@
          <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
          <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
             <template #default="scope">
             <template #default="scope">
               
               
                <el-tooltip content="导入算法包" placement="top">
                <!-- <el-tooltip content="导入算法包" placement="top">
                   <el-button link type="primary" icon="UploadFilled" @click="handleUpdate(scope.row)" ></el-button>
                   <el-button link type="primary" icon="UploadFilled" @click="handleUpdate(scope.row)" ></el-button>
                </el-tooltip>
                </el-tooltip> -->
                <el-tooltip content="修改" placement="top">
                <el-tooltip content="修改" placement="top">
                   <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" ></el-button>
                   <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" ></el-button>
                </el-tooltip>
                </el-tooltip>
@@ -306,9 +306,9 @@
 
 
 /** 删除按钮操作 */
 /** 删除按钮操作 */
 function handleDelete(row) {
 function handleDelete(row) {
   const jobIds = row.jobId || ids.value;
  const id = row.id || ids.value;
   proxy.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function () {
  proxy.$modal.confirm('是否确认删除算法名称为"' + row.algorithmName + '"的数据项?').then(function() {
     return delJob(jobIds);
     return deleteAlg(id);
   }).then(() => {
   }).then(() => {
     getList();
     getList();
     proxy.$modal.msgSuccess("删除成功");
     proxy.$modal.msgSuccess("删除成功");
+25 −7
Original line number Original line Diff line number Diff line
@@ -42,7 +42,7 @@
                <el-col :xs="4" :sm="4" :md="4" :lg="4">
                <el-col :xs="4" :sm="4" :md="4" :lg="4">
                  图片上传
                  图片上传
                  <div class="upload-box">
                  <div class="upload-box">
                    <ImageUpload :defaultUrl="'/upload-api'" :limit='1' :fileSize="5" :isShowTip="false" @update:modelObj="getImgObj"/>
                    <ImageUpload  :defaultUrl="'/upload-api'" :defaultBaseUrl="'http://192.168.3.71:9081'+ '/prod-api'" :limit='1' :fileSize="5" :isShowTip="false" @update:modelObj="getImgObj"/>
                  </div>
                  </div>
                </el-col>
                </el-col>
                <el-col :xs="10" :sm="10" :md="10" :lg="10">
                <el-col :xs="10" :sm="10" :md="10" :lg="10">
@@ -57,6 +57,7 @@
                <el-col :xs="10" :sm="10" :md="10" :lg="10">
                <el-col :xs="10" :sm="10" :md="10" :lg="10">
                  算法识别结果
                  算法识别结果
                  <div class="img-box" v-if="outFilePath.length==0">
                  <div class="img-box" v-if="outFilePath.length==0">
                    <div>{{ resultStr }}</div>
                    <img src="@/assets/images/default.png" height="100%"/>
                    <img src="@/assets/images/default.png" height="100%"/>
                  </div>
                  </div>
                  <div class="img-box" v-else>
                  <div class="img-box" v-else>
@@ -72,15 +73,31 @@
              <el-row :gutter="10">
              <el-row :gutter="10">
                <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-col :xs="12" :sm="12" :md="12" :lg="12">
                  有效的拍摄方式:
                  有效的拍摄方式:
                  <div class="img-box">
                  <div class="img-box" v-if="effectiveList.length==0">
                    <img src="@/assets/images/default.png" height="100%"/>
                    <img src="@/assets/images/default.png" height="100%"/>
                  </div>
                  </div>
                  <div class="img-box" v-else>
                    <div v-for="item in effectiveList" :key="item.id">
                      <p>
                        {{item.remark}}
                      </p>
                      <ImagePreview style="width: 400px;height: 225px;" :src="item.caseFile"/>
                    </div>
                  </div>
                </el-col>
                </el-col>
                <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-col :xs="12" :sm="12" :md="12" :lg="12">
                  无效的拍摄方式:
                  无效的拍摄方式:
                  <div class="img-box">
                  <div class="img-box" v-if="invalidList.length==0">
                    <img src="@/assets/images/default.png" height="100%"/>
                    <img src="@/assets/images/default.png" height="100%"/>
                  </div>
                  </div>
                  <div class="img-box" v-else>
                    <div v-for="item in invalidList" :key="item.id">
                      <p>
                        {{item.remark}}
                      </p>
                      <ImagePreview style="width: 400px;height: 225px;" :src="item.caseFile"/>
                    </div>
                  </div>
                </el-col>
                </el-col>
              </el-row>
              </el-row>
          </div>
          </div>
@@ -97,7 +114,7 @@ import { detailAlg} from "@/api/algorithmList/index.js";
import { listScene,detailScene } from "@/api/algorithmList/scene.js";
import { listScene,detailScene } from "@/api/algorithmList/scene.js";
import { listBoundary, detailBoundary } from "@/api/algorithmList/boundary.js";
import { listBoundary, detailBoundary } from "@/api/algorithmList/boundary.js";
import { useWebSockets} from './websockt.js'; // 注意文件路径可能需要调整  
import { useWebSockets} from './websockt.js'; // 注意文件路径可能需要调整  
const { handeUpload , outFilePath} = useWebSockets();
const { handeUpload , outFilePath,resultStr} = useWebSockets();
const router = useRouter();
const router = useRouter();
const route = useRoute()
const route = useRoute()
const nowImg=ref('')
const nowImg=ref('')
@@ -105,6 +122,8 @@ const { roleId } =route.params
const { proxy } = getCurrentInstance();
const { proxy } = getCurrentInstance();
const algFormRef = ref(null)
const algFormRef = ref(null)
const applicationList = ref([])
const applicationList = ref([])
const effectiveList = ref([])
const invalidList = ref([])
const nowText=ref('算法详情')
const nowText=ref('算法详情')
const data = reactive({
const data = reactive({
  form: {},
  form: {},
@@ -127,15 +146,14 @@ function getDetials(){
    form.value=res.data
    form.value=res.data
  })
  })
  listScene({ algorithmId: roleId}).then(res => {
  listScene({ algorithmId: roleId}).then(res => {
    console.log("🚀 ~ listScene ~ res:", res)
    applicationList.value = res.rows
    applicationList.value = res.rows
  })
  })
  listBoundary({ algorithmId: roleId}).then(res=>{
  listBoundary({ algorithmId: roleId}).then(res=>{
    console.log("🚀 ~ listBoundary ~ res:", res)
    effectiveList.value = res.rows.filter(item => item.caseType === '0')
    invalidList.value = res.rows.filter(item => item.caseType === '1')
  })
  })
}
}
function getImgObj(obj){
function getImgObj(obj){
    console.log("🚀 ~ getImgObj ~ obj:", obj)
    nowImg.value = obj.url
    nowImg.value = obj.url
    handeUpload(obj)
    handeUpload(obj)
}
}
+11 −8
Original line number Original line Diff line number Diff line
@@ -8,12 +8,12 @@ export function useWebSockets() {
        const uploadData=ref({})//上传成功后返回的数据
        const uploadData=ref({})//上传成功后返回的数据
        const id=ref(null)
        const id=ref(null)
        const client=ref(null)
        const client=ref(null)
        const resultStr=ref('')
        const outFilePath=ref('')//算法处理后的图片
        const outFilePath=ref('')//算法处理后的图片
        const route = useRoute()
        const route = useRoute()
        const { roleId } =route.params
        const { roleId } =route.params
        const { proxy } = getCurrentInstance();
        // 定义点击事件 myFn
        // 定义点击事件 myFn

 
        function handeUpload(e){
        function handeUpload(e){
            uploadData.value = e
            uploadData.value = e
            console.log("🚀 ~ handeUpload ~ uploadData.value:", uploadData.value)
            console.log("🚀 ~ handeUpload ~ uploadData.value:", uploadData.value)
@@ -32,14 +32,17 @@ export function useWebSockets() {
                    fileName:uploadData.value.fileName
                    fileName:uploadData.value.fileName
                })
                })
            } else if (result.type == 2) {
            } else if (result.type == 2) {
                console.log('123', 123)
                const queue = result.data.queue.indexOf('[') == -1 ? result.data.queue : JSON.parse(result.data.queue);
                const queue = result.data.queue.indexOf('[') == -1 ? result.data.queue : JSON.parse(result.data.queue);
                // this.result = queue;
                console.log("🚀 ~ websocketMessage ~ queue:", queue)
                if (!queue.length) {
                if (!queue.length) {
                    console.log('err', err)
                    proxy.$modal.msgWarning("未检测到预警");
                }
                    resultStr.value = '未检测到预警';
                    outFilePath.value=''
                }else {
                    outFilePath.value = 'http://192.168.3.71:9081'+ '/prod-api' + '/profile/endfile' + result.data.outFilePath;
                    outFilePath.value = 'http://192.168.3.71:9081'+ '/prod-api' + '/profile/endfile' + result.data.outFilePath;
                // this.uploading = false;
                    proxy.$modal.msgSuccess("算法处理成功");
                }
            
                client.value.disconnect();
                client.value.disconnect();
            }
            }
        }
        }
@@ -49,5 +52,5 @@ export function useWebSockets() {
        });
        });


        // 外部使用组合API中定义的变量或方法,在模板中可用。
        // 外部使用组合API中定义的变量或方法,在模板中可用。
        return {handeUpload,outFilePath} // 返回的函数与方法的行为相同
        return {handeUpload,outFilePath,resultStr} // 返回的函数与方法的行为相同
}
}
 No newline at end of file
+15 −3
Original line number Original line Diff line number Diff line
@@ -27,10 +27,14 @@
              default-active="2"
              default-active="2"
              class="el-menu-vertical-demo"
              class="el-menu-vertical-demo"
            >
            >
              <el-menu-item  :index="'我的算法'">
              <el-menu-item :index="''" @click="handMenuClick">
                <span>全部</span>
              </el-menu-item>
              <el-menu-item :index="'我的算法'" @click="handMenuClick">
                <span>我的算法</span>
                <span>我的算法</span>
              </el-menu-item>
              </el-menu-item>
              <el-menu-item v-for="item in algorithm_scen" :key="item.value" :index="item.value">
     
              <el-menu-item v-for="item in algorithm_scen" :key="item.value" :index="item.value" @click="handMenuClick"> 
                <span>{{ item.label }}</span>
                <span>{{ item.label }}</span>
              </el-menu-item>
              </el-menu-item>
            </el-menu>  
            </el-menu>  
@@ -41,7 +45,7 @@
            <el-card class="right-list">
            <el-card class="right-list">
            <template v-slot:header>
            <template v-slot:header>
              <div class="cleartitle" style="justify-content: flex-start">
              <div class="cleartitle" style="justify-content: flex-start">
                <img src="@/assets/images/logo_video.png" width="25px" alt=""> <span>我的算法</span>
                <img src="@/assets/images/logo_video.png" width="25px" alt=""> <span>{{nowTopTitle}}</span>
              </div>
              </div>
            </template>
            </template>
            <el-row :gutter="10" class="mb8" style="justify-content: flex-start;">
            <el-row :gutter="10" class="mb8" style="justify-content: flex-start;">
@@ -145,6 +149,7 @@
  const router = useRouter();
  const router = useRouter();
  const algorithmDownRef = ref(null)
  const algorithmDownRef = ref(null)
  const nowText=ref('算法管理')
  const nowText=ref('算法管理')
  const nowTopTitle=ref('算法管理')
  const ids = ref([]);
  const ids = ref([]);
  const algorithmList=reactive([
  const algorithmList=reactive([
    {
    {
@@ -235,6 +240,13 @@
    algorithmDownRef.value.handleUpdate(row)
    algorithmDownRef.value.handleUpdate(row)
  }
  }
  
  
  function handMenuClick(row) {
    queryParams.value.applicationScenarios=row.index
    nowTopTitle.value=row.index
    getList()
    console.log("🚀 ~ handMenuClick ~ row:", row)
  }
  
  /** 删除按钮操作 */
  /** 删除按钮操作 */
  function handleDelete(row) {
  function handleDelete(row) {
    const id = row.id || ids.value;
    const id = row.id || ids.value;