无人机管理后台前端(已迁走)
张含笑
2025-06-12 81701042c720dbf040d5b3820b363f0a656df46b
src/views/dataCenter/dataCenter.vue
@@ -34,21 +34,21 @@
            <img
              class="quanjing"
              @click="clickpanorama(scope.row)"
              v-if="scope.row?.resultType === 3"
              :src="scope.row.link"
              v-if="scope.row?.resultType === 5"
              :src="scope.row?.link"
              alt=""
            />
            <img
              v-else-if="scope.row?.resultType === 1"
              :src="convertVideoUrlToThumbnail(scope.row.link)"
              :src="convertVideoUrlToThumbnail(scope.row?.link)"
              alt=""
              class="imageBox"
              @click="enterFullScreen(scope.row)"
            />
            <el-image
              v-else
              :src="scope.row.smallUrl"
              :preview-src-list="[scope.row.showUrl]"
              :src="scope.row?.smallUrl"
              :preview-src-list="[scope.row?.showUrl]"
              fit="cover"
              preview-teleported
            />
@@ -68,13 +68,13 @@
        <el-table-column label="操作" width="150" align="center">
          <template #default="scope">
            <span class="look" @click="lookDetail(scope.row)">查看</span>
            <span
              class="delete"
              @click="deleteDetail(scope.row)"
              v-if="scope.row.fileformat !== 'AI识别'"
            <span class="delete" @click="deleteDetail(scope.row)" v-if="scope.row.resultType !== 2"
              >删除</span
            >
            <span class="location" @click="positionDetail()" v-if="scope.row.fileformat !== '视频'"
            <span
              class="location"
              @click="positionDetail(scope.row)"
              v-if="scope.row.resultType !== 1"
              >定位</span
            >
          </template>
@@ -98,29 +98,35 @@
    <el-dialog v-model="dialogVisible" width="60%" append-to-body>
      <template #header="{ titleId, titleClass }">
        <div class="my-header">
          <h4 :id="titleId" :class="titleClass">{{ dialogDetailList?.filename }}</h4>
          <el-button type="success" plain icon="el-icon-download">下载</el-button>
          <h4 :id="titleId" :class="titleClass">{{ dialogDetailList?.nickName }}</h4>
          <el-button
            type="success"
            plain
            icon="el-icon-download"
            @click="detailDownLoad(dialogDetailList)"
            >下载</el-button
          >
        </div>
      </template>
      <div class="detailContainer">
        <div class="leftImg">
          <img
            v-if="dialogDetailList?.resultType === 1"
            :src="convertVideoUrlToThumbnail(dialogDetailList.link)"
            :src="convertVideoUrlToThumbnail(dialogDetailList?.link)"
            alt=""
            class="imageBox"
          />
          <img v-else :src="dialogDetailList.link" alt="" />
          <img v-else :src="getSmallImg(dialogDetailList?.link)" alt="" />
        </div>
        <div class="rightDetail">
          <div class="title">
            <div class="inputEdit">
              文件名称:<span v-if="!dialogDetailList.checkedinput">{{
                dialogDetailList?.filename
                dialogDetailList.nickName
              }}</span>
              <el-input
                v-else
                v-model="dialogDetailList.filename"
                v-model="dialogDetailList.nickName"
                @keyup.enter="saveTitle()"
                class="title-input"
                clearable
@@ -131,15 +137,19 @@
                ><el-icon><Edit /></el-icon
              ></span>
              <div v-else class="suffixBoxEdit">
                <div class="editText" @click="submitEditSuffix(item, index)">✔</div>
                <div class="editText" @click="cancelEditSuffix(item, index)">✖</div>
                <div class="editText" @click="submitEditSuffix(dialogDetailList)">✔</div>
                <div class="editText" @click="cancelEditSuffix(dialogDetailList)">✖</div>
              </div>
            </div>
          </div>
          <div>任务名称:{{ dialogDetailList?.jobName }}</div>
          <div>所属区域:{{ dialogDetailList?.regionName }}</div>
          <div>拍摄机巢:{{ dialogDetailList?.nickName }}</div>
          <div>照片位置:{{ dialogDetailList?.longitude }},{{ dialogDetailList?.latitude }}</div>
          <div>拍摄机巢:{{ dialogDetailList?.nestName }}</div>
          <div>
            照片位置:{{ _.round(dialogDetailList?.longitude, 3) }},{{
              _.round(dialogDetailList?.latitude, 3)
            }}
          </div>
          <div>任务时间:{{ dialogDetailList?.jobTime }}</div>
          <div>拍摄时间:{{ dialogDetailList?.createTime }}</div>
          <div>文件类型:{{ photoTypeMap[dialogDetailList?.photoType] }}</div>
@@ -176,7 +186,13 @@
      </div>
    </el-dialog>
    <!-- 地图弹框 -->
    <dataCenterMap v-model:show="dataCenterMapVisible"></dataCenterMap>
    <dataCenterMap
    ref="mapComponent"
      v-model:show="dataCenterMapVisible"
      :jobId="jobId"
      @lookDetail="lookDetail"
      :mapList="mapList"
    ></dataCenterMap>
  </div>
</template>
@@ -186,11 +202,13 @@
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
import searchData from '@/views/dataCenter/components/searchData.vue';
import fy1 from '@/assets/images/dataCenter/1.jpeg';
import _ from 'lodash';
import {
  getaiImagesPageAPI,
  getAttachInfoAPI,
  deleteFileMultipleApi,
  downloadApi,
  updataTitleApi,
} from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg } from '@/utils/util';
import { onMounted } from 'vue';
@@ -209,7 +227,7 @@
  0: '照片',
  1: '视频',
  2: 'AI识别',
  3: '全景',
  5: '全景',
  4: '正射',
};
const photoTypeMap = {
@@ -232,25 +250,26 @@
// 获取列表数据
const getaiImagesPage = () => {
  getaiImagesPageAPI({
    current: jobListParams.current,
    size: jobListParams.size,
  const params = {
    orderByCreateTime: jobListParams.orderByCreateTime,
    ...jobListParams.searchParams,
  }).then(res => {
    loading.value = true;
    total.value = res.data.data.total;
    tableData.value = res.data.data.records.map(i => ({
      ...i,
      checked: false,
      url: i.link,
      smallUrl: getSmallImg(i.link),
      showUrl: getShowImg(i.link),
      file_name: i.name.split('/').pop(),
    }));
    console.log('res', tableData.value);
    loading.value = false;
  });
  };
  getaiImagesPageAPI(params, { current: jobListParams.current, size: jobListParams.size }).then(
    res => {
      loading.value = true;
      total.value = res.data.data.total;
      tableData.value = res.data.data.records.map(i => ({
        ...i,
        checked: false,
        url: i?.link,
        smallUrl: getSmallImg(i?.link),
        showUrl: getShowImg(i?.link),
        file_name: i.name.split('/').pop(),
      }));
      // console.log('res', tableData.value);
      loading.value = false;
    }
  );
};
// 查询
const searchClick = params => {
@@ -262,13 +281,10 @@
const handleSizeChange = val => {
  jobListParams.size = val;
  getaiImagesPage();
  console.log('jobListParams.size', jobListParams.size);
};
const handleCurrentChange = val => {
  jobListParams.current = val;
  getaiImagesPage();
  console.log('jobListParams.current', jobListParams.current);
};
// 多选
const selectedRows = ref([]);
@@ -328,6 +344,9 @@
const downloadFile = () => {
  fileDownload();
};
const detailDownLoad = val => {
  aLinkDownload(val.link, val.nickName);
};
// 全部下载
const aLLDownloadFile = () => {
  console.log('全部下载');
@@ -335,11 +354,12 @@
// 查看弹框
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
const lookDetail = val => {
console.log('val',val);
const lookDetail = val => {
  getAttachInfoAPI(val.id).then(res => {
    dialogDetailList.value = res.data.data;
    dialogDetailList.value= {...res.data.data,  checkedinput: false,}
    console.log('val111', dialogDetailList.value);
  });
  dialogVisible.value = true;
};
@@ -363,10 +383,60 @@
    })
    .catch(() => {});
};
const fileNameedit = ref('')
// 编辑文件名
const editTitle = val => {
  // console.log('val', val);
  val.checkedinput = !val.checkedinput;
const editTitle = (val) => {
   val.checkedinput = true
   fileNameedit.value = val.nickName
}
const cancelEditSuffix = (item) => {
   item.nickName = fileNameedit.value
   item.checkedinput = false
   console.log('item',item);
}
const submitEditSuffix = (item) => {
   saveTitle(item)
}
// 通用空值检查函数
const validateNickname = (name, fieldName) => {
  if (!name || name.trim() === '') {
    ElMessage.warning(`${fieldName}不能为空`);
    return false;
  }
  if (name.length > 50) {
    ElMessage.warning(`${fieldName}不能超过50个字符`);
    return false;
  }
  return true;
};
// 保存文件名
const saveTitle = (item) => {
  const updateparams = {
    id:Number( item.id),
    nickName: item.nickName,
  };
  // 验证并提示
  if (!validateNickname(updateparams.nickName, '名称')) return;
  item.checkedinput = false;
  updataTitleApi(updateparams)
    .then(res => {
    console.log('updateparams',updateparams);
      if (res.status === 200) {
        ElMessage.success('修改成功');
      } else {
        ElMessage.error(res.data.message || '修改失败');
      }
    })
    .catch(error => {
      ElMessage.error('请求失败,请稍后重试');
      console.error('API error:', error);
    });
};
// 全景预览
const panoramaParamsShow = ref(false);
@@ -386,9 +456,18 @@
  VideoShow.value = true;
};
// 地图弹框
// 创建子组件引用
const mapComponent = ref(null);
const mapList = ref(null);
const dataCenterMapVisible = ref(false);
const positionDetail = () => {
const jobId = ref('');
const positionDetail = val => {
  jobId.value = val.wayLineJobId;
  mapList.value = val;
  dataCenterMapVisible.value = true;
if(mapComponent.value){
    mapComponent.value.labelBoxUpdate();
}
};
onMounted(() => {
  getaiImagesPage();