无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
src/views/system/helpCenter.vue
@@ -18,7 +18,9 @@
        <el-table-column prop="createTime" label="上传时间" />
        <el-table-column label="操作" width="150" align="center">
          <template #default="scope">
            <span class="look" @click="clickDetail(scope.row)">查看</span>
            <span class="look" @click="clickDetail(scope.row)" v-if="permission.helpCenterLook"
              >查看</span
            >
            <el-upload
              style="display: inline-block"
              :show-file-list="false"
@@ -58,22 +60,28 @@
  });
};
// 查看
const clickDetail = row => {
  if (!row.filePath) {
// const clickDetail = row => {
//   if (!row.filePath) {
//     ElMessage.warning('没有可预览的文件');
//     return;
//   }
//   fetch(row.filePath)
//     .then(response => response.blob())
//     .then(res => {
//       let blob = new Blob([res], { type: 'application/pdf' });
//       // pdfurl即转化后的结果
//       let pdfurl = window.URL.createObjectURL(blob);
//       // 新标签页打开,即可预览并下载
//       window.open(pdfurl);
//     });
// };
const clickDetail = val => {
  const filePath = val.filePath;
  if (!val.filePath) {
    ElMessage.warning('没有可预览的文件');
    return;
  }
  fetch(row.filePath)
        .then((response) => response.blob())
        .then((res) => {
          let blob = new Blob([res], { type: "application/pdf" });
          // pdfurl即转化后的结果
          let pdfurl = window.URL.createObjectURL(blob);
          // 新标签页打开,即可预览并下载
          window.open(pdfurl);
        });
  window.open(filePath, '_blank');
};
// 文件上传
const onUploadFileBefore = (file, row) => {
@@ -81,6 +89,7 @@
  if (fileFormat !== 'pdf') return ElMessage.error('请上传pdf格式的文件');
  const formData = new FormData();
  formData.append('file', file, file.name);
  uploadFileAPI(formData).then(res => {
    if (res.data.code === 200) {
      const params = {