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

fix: 修复告警管理查询问题,增加选中状态样式

parent 6c632267
Loading
Loading
Loading
Loading
+61 −11
Original line number Diff line number Diff line
@@ -7,23 +7,24 @@
            <el-card class="right-list">
            <template v-slot:header>
              <el-form :model="queryParams" ref="queryRef" :inline="true" >
                <el-form-item label="摄像头" prop="algorithmName">
                  <el-select v-model="queryParams.deptName" placeholder="请选择摄像头" clearable style="width: 200px">
                <el-form-item label="摄像头点位" prop="locationId">
                  <!-- <el-select v-model="queryParams.deptName" placeholder="请选择摄像头" clearable style="width: 200px">
                      <el-option
                        v-for="dict in deviceList"
                        :key="dict.id"
                        :label="dict.deviceName"
                        :value="dict.id"
                      />
                  </el-select>
                  </el-select> -->
                  <el-cascader v-model="myLocation" @change="locationChange" style="width: 300px;" :options="deptOptions" :props="{value:'id',label:'label'}"/>
                </el-form-item>
                <el-form-item label="算法列表" prop="applicationScenarios">
                  <el-select v-model="queryParams.applicationScenarios" placeholder="请选择算法列表" clearable style="width: 200px">
                <el-form-item label="算法列表" prop="algorithmId">
                  <el-select v-model="queryParams.algorithmId" placeholder="请选择算法列表" clearable style="width: 200px">
                            <el-option 
                            v-for="disc in algorithm_scen"
                            :key="disc.value"
                            :label="disc.label"
                             :value="disc.value"
                            v-for="disc in algorithmList"
                            :key="disc.id"
                            :label="disc.algorithmName"
                             :value="disc.id"
                            />
                  </el-select>
                </el-form-item>
@@ -111,6 +112,8 @@
<script setup name="Index">
  import { listAlarm, detailAlarm } from "@/api/alarmControl/index.js";
  import { listDevice, } from "@/api/yunshou/device";
  import { videoTreeListManage } from "@/api/videoControl/videoPreview";
  import { listAlg} from "@/api/algorithmList/index.js";
  const { proxy } = getCurrentInstance();
  const { algorithm_scen, algorithm_case } = proxy.useDict("algorithm_scen", "algorithm_case");
  import alarmDetial from './components/form.vue'
@@ -121,11 +124,15 @@
  const alarmDetialRef = ref(null)
  const nowText=ref('告警管理')
  const ids = ref([]);
  const myLocation = ref([]);
  const total = ref(0);
  const division = ref(6);
  const isActive = ref('12');
  const deviceList = ref([]);
  const algList = ref([]);
  const algorithmList = ref([]);
  const deptOptions = ref([]);
  const dateRange = ref([]);
  const data = reactive({
    form: {},
    queryParams: {
@@ -143,6 +150,46 @@
  });
  const { queryParams, form, rules } = toRefs(data);

  //点位变化事件
  function locationChange(e){
    const nowArray=[...e]
    const loctionId=nowArray.pop().split('-')[1]
    queryParams.value.locationId = loctionId;
  }
 
 /** 算法列表 */
 function getAlgList() {
   listAlg({pageSize: 100,pageNum: 1,}).then(response => {
    algorithmList.value = response.rows;
   });
 }

  function getTreeData() {
    videoTreeListManage().then((res) => {
        deptOptions.value=addDisabledToNoChildren(res.data)
    })
  }

  function addDisabledToNoChildren(data) {  
      return data.map(item => {  
            // 复制当前项以避免直接修改原始数据  
            let copy = { ...item };  
  
            // 检查是否有 children 属性  
            if ((!copy.children || copy.children.length === 0)) {  
                // 如果没有 children 或 children 为空数组,则添加 disabled: true  
                if(copy.id.split("-")[0]=='区域'){
                  copy.disabled = true;
                }
            } else {  
                // 如果有 children,则递归处理每个 child  
                copy.children = addDisabledToNoChildren(copy.children);  
            }  
      
            return copy;  
        });  
  }

  function changeDivision(val,pageSize){
    division.value=val
    queryParams.value.pageSize=pageSize
@@ -158,6 +205,7 @@
 /** 重置按钮操作 */
 function resetQuery() {
   proxy.resetForm("queryRef");
   myLocation.value=[]
   handleQuery();
 }

@@ -169,7 +217,7 @@
  
  /** 查询算法列表 */
  function getList() {
    listAlarm(queryParams.value).then(response => {
    listAlarm(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
      algList.value = response.rows
      total.value = response.total;
    });
@@ -204,6 +252,8 @@
      proxy.$modal.msgSuccess("删除成功");
    }).catch(() => {});
  }
  getTreeData()
  getAlgList();
  getList();
  getDeviceList();
  </script>
+27 −9
Original line number Diff line number Diff line
@@ -14,21 +14,25 @@
      <el-table :data="wrapList">
        <el-table-column type="expand">
          <template #default="scope">
            <div m="4">
            <div style="display: flex;justify-content: flex-start;gap: 20px;">
              <el-tag v-for="item in scope.row.labelList" :key="item.id" :type="'primary'" >{{ item.labelCode + ':' +
                item.labelThreshold }}</el-tag>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="文件名称" align="center" prop="algorithmName" />
        <el-table-column label="文件名称" align="center" prop="algorithmName" >
          <template #default="scope">
            <div>{{getFielName(scope.row.algorithmFile) }}</div>
          </template>
        </el-table-column>
        <el-table-column label="状态" align="center" prop="algorithmStatus" >
        <template #default="scope">
          <el-tag  :type="scope.row.algorithmStatus=='2'?'success':'primary'"  >{{ scope.row.algorithmStatus=='2'?'使用中':'已上传' }}</el-tag>
        </template>
        </el-table-column>
        <el-table-column label="MD5核对结果" align="center" prop="md5Result" />
        <!-- <el-table-column label="MD5核对结果" align="center" prop="md5Result" /> -->
        <el-table-column label="文件大小" align="center" prop="fileSize" />
        <el-table-column label="进度" align="center" prop="postSort" />
        <el-table-column label="上传时间" align="center" prop="createTime" />
        <el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
@@ -64,6 +68,13 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="配置文件" prop="configFile">
              <FileAlgUpload @update:modelValue="getConfigFile" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
@@ -114,6 +125,11 @@ function reset() {
  proxy.resetForm("algRef");
}

function getFielName(str){
  let array =str.split('/')
  let lastElement = array.pop();
  return lastElement
}

/** 获取文件列表*/
function getList() {
@@ -180,12 +196,14 @@ function cancel() {
}

function getFile(url,size) {
  console.log("🚀 ~ getFile ~ url:", url)
  console.log("🚀 ~ getFile ~ size:", size)
  form.value.algorithmFile = url
  form.value.fileSize = size + 'm'
}

function getConfigFile(url,size) {
  form.value.configFile = url
}

defineExpose({ handleAdd, handleUpdate, getList })
</script>

+2 −2
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10" class="mb8">
              <!-- <el-row :gutter="10" class="mb8">
                <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
                      <span>算法详情页banner卡片信息</span>
                  </div>
@@ -241,7 +241,7 @@
                    <el-input v-model="form.algorithmIntroduce" placeholder="请输入算法介绍" />
                  </el-form-item>
                </el-col>
              </el-row>
              </el-row> -->
              <el-row :gutter="10" class="mb8">
                <div class="form-title" style="display: flex;justify-content: flex-start;align-items: center;">
                      <span>算法详情页视频</span>
+7 −1
Original line number Diff line number Diff line
@@ -127,7 +127,12 @@ function reset() {
  proxy.resetForm("algRef");
}


/** 查询算法列表 */
function getLevelList() {
  listAlgLevel({ pageNum: 1, pageSize: 100,}).then(response => {
    levelList.value = response.rows
  });
}

/** 获取文件列表*/
function getList(id) {
@@ -191,6 +196,7 @@ function cancel() {
  open.value = false;
  reset();
}
getLevelList()
defineExpose({ handleAdd , handleUpdate })
</script>

+9 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@
                  <el-button
                     type="primary"
                     plain
                      :class="isActive==''?'active':''"
                     @click="handState('')"
                  >全部</el-button>
               </el-col>
@@ -63,6 +64,7 @@
                  <el-button
                     type="primary"
                     plain
                       :class="isActive=='0'?'active':''"
                    @click="handState('0')"
                  >启用中</el-button>
               </el-col>
@@ -70,6 +72,7 @@
                  <el-button
                     type="primary"
                     plain
                       :class="isActive=='1'?'active':''"
                     @click="handState('1')"
                  >已停用</el-button>
               </el-col>
@@ -156,6 +159,7 @@ import { el } from "element-plus/es/locales.mjs";
  const nowTopTitle=ref('算法管理')
  const listState=ref(false)
  const ids = ref([]);
  const isActive = ref('');
  // const iconComponent = ref('');
  // setTimeout(() => {
  //   iconComponent.value='CirclePlusFilled'
@@ -211,6 +215,7 @@ import { el } from "element-plus/es/locales.mjs";
    router.push("/algorithmList/details/info/" + row.id);
  }
  function handState(state) {
    isActive.value=state
    queryParams.value.algorithmStatus=state
    getMyList()
  }
@@ -291,6 +296,10 @@ import { el } from "element-plus/es/locales.mjs";
  </script>
  
  <style scoped lang="scss">
    .active{
      background-color: #409EFF;
      color: #fff;
    }
    .more-ellipsis {
      text-overflow: ellipsis;
      display: -webkit-box;
Loading