zhangwei
2025-08-29 e1b04baf60478e3de9e41e1fc39e1e4346321817
src/views/system/dept/detail.vue
@@ -22,48 +22,16 @@
});
import EditPen from "~icons/ep/edit-pen";
import IconParkSolidBack from "~icons/icon-park-solid/back";
import { message } from "@/utils/message";
const { openDialog } = useDept(ref({}));
const { openUploadDialog, state, changeDialog } = useDetail();
const { openUploadDialog, state, changeDialog, getDetailList } = useDetail();
defineOptions({
  name: "itemdetail"
});
const convertFujianToObjects = (fujianStr, fujianNameStr) => {
  // 分割字符串为数组并过滤空值
  const srcArray = fujianStr.split(",").filter(Boolean);
  const nameArray = fujianNameStr.split(",").filter(Boolean);
  // 提取文件后缀作为valu
  const getFileExtension = fileName => {
    const lastDotIndex = fileName.lastIndexOf(".");
    // 如果没有后缀或文件名以点结尾,返回空字符串
    if (lastDotIndex === -1 || lastDotIndex === fileName.length - 1) {
      return "";
    }
    return fileName.slice(lastDotIndex + 1).toLowerCase();
  };
  // 映射为目标对象数组
  return srcArray.map((src, index) => {
    // 确保名称数组有对应索引的元素
    const name = nameArray[index]?.trim() || `未知文件${index + 1}`;
    return {
      name: name,
      filePath: src.trim(),
      fileType: getFileExtension(name)
    };
  });
};
onMounted(async () => {
  let res = await getTenderOrderDetail({ id: props.nowID });
  state.nowInfo = res.result;
  if (state.nowInfo.fujian) {
    state.nowInfo.fujianList = convertFujianToObjects(
      state.nowInfo.fujian,
      state.nowInfo.fujianName
    );
  }
  getDetailList(props.nowID);
});
const backListPage = () => {
  emit("backListPage");
@@ -94,6 +62,7 @@
      break;
    default:
      window.location.href = pdfUrl.filePath;
      message("正在下载!");
      break;
  }
};
@@ -217,8 +186,8 @@
                        class="flex items-center cursor-pointer"
                        @click="
                          previewPdf({
                            name: state.nowInfo.zhaobiaowenjian,
                            filePath: state.nowInfo.zhaobiaowenjianName,
                            name: state.nowInfo.zhaobiaowenjianName,
                            filePath: state.nowInfo.zhaobiaowenjian,
                            fileType: 'pdf'
                          })
                        "