gongchunyi
2026-06-22 492802e4fc1b371ba21a2a490c8dcd67d7c8b29c
src/views/salesManagement/deliveryLedger/index.vue
@@ -14,6 +14,11 @@
          <el-input v-model="searchForm.expressNumber" placeholder="请输入" clearable prefix-icon="Search" style="width: 200px"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="发货日期:">
          <el-date-picker v-model="shippingDateRange" type="daterange" range-separator="至" start-placeholder="开始日期"
            end-placeholder="结束日期" value-format="YYYY-MM-DD" format="YYYY-MM-DD" clearable style="width: 240px"
            @change="handleShippingDateChange" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery"> 搜索 </el-button>
        </el-form-item>
@@ -193,10 +198,12 @@
        <div class="detail-images" v-if="detailImages.length">
          <div class="detail-images-title">发货图片</div>
          <ImagePreview
            :src="detailImages.map(i => i.url).join(',')"
            width="120px"
            height="120px"
          <el-image
            v-for="img in detailImages"
            :key="img.url"
            :src="img.url"
            :preview-src-list="detailImages.map(i => i.url)"
            fit="cover"
            class="detail-image"
          />
        </div>
@@ -243,30 +250,44 @@
const detailRow = ref(null);
const detailImages = ref([]);
const getFileAccessUrl = (file = {}) => {
  if (file?.link) {
    if (String(file.link).startsWith('http')) return file.link;
    return normalizeFileUrl(file.link);
  }
  return normalizeFileUrl(file?.url || '');
};
const normalizeFileUrl = (rawUrl = '') => {
  let fileUrl = rawUrl || '';
  if (fileUrl && fileUrl.indexOf('\\') > -1) {
    const lowerPath = fileUrl.toLowerCase();
    const uploadPathIndex = lowerPath.indexOf('uploadpath');
    if (uploadPathIndex > -1) {
      fileUrl = fileUrl
        .substring(uploadPathIndex)
        .replace(/\\/g, '/');
    } else {
      fileUrl = fileUrl.replace(/\\/g, '/');
    }
    fileUrl = fileUrl.replace(/\\/g, '/');
  }
  fileUrl = fileUrl.replace(/^\/?uploadPath/, '/profile');
  if (!fileUrl.startsWith('http')) {
  const lowerPath = fileUrl.toLowerCase();
  const uploadPathIndex = lowerPath.indexOf('/uploadpath/');
  if (uploadPathIndex > -1) {
    fileUrl = '/profile' + fileUrl.substring(uploadPathIndex + '/uploadpath'.length);
  }
  const fileRootIndex = fileUrl.toLowerCase().indexOf('/file/');
  if (!fileUrl.startsWith('/profile/') && fileRootIndex > -1) {
    fileUrl = '/profile' + fileUrl.substring(fileRootIndex + '/file'.length);
  }
  if (!fileUrl.startsWith('http') && fileUrl.toLowerCase().startsWith('profile/')) {
    fileUrl = '/' + fileUrl;
  }
  if (fileUrl && !fileUrl.startsWith('http')) {
    if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
    fileUrl = javaApi + fileUrl;
  }
  return fileUrl;
};
// 上传配置
const upload = reactive({
  // 上传的地址
@@ -278,11 +299,14 @@
// 用户信息表单弹框数据
const operationType = ref("");
const dialogFormVisible = ref(false);
const shippingDateRange = ref([]);
const data = reactive({
  searchForm: {
    salesContractNo: "", // 销售订单号
    shippingCarNumber: "", // 车牌号
    expressNumber: "", // 快递单号
    shippingDateStart: "", // 发货日期开始
    shippingDateEnd: "", // 发货日期结束
  },
  form: {
    id: null,
@@ -320,6 +344,18 @@
const handleQuery = () => {
  page.current = 1;
  getList();
};
// 发货日期变更
const handleShippingDateChange = (value) => {
  if (value && value.length === 2) {
    searchForm.value.shippingDateStart = value[0];
    searchForm.value.shippingDateEnd = value[1];
  } else {
    searchForm.value.shippingDateStart = "";
    searchForm.value.shippingDateEnd = "";
  }
  handleQuery();
};
const paginationChange = (obj) => {
@@ -379,7 +415,7 @@
    // 如果有图片,将 commonFileList 转换为文件列表格式
    if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
      deliveryFileList.value = row.commonFileList.map((file, index) => {
        const fileUrl = normalizeFileUrl(file.url || '');
        const fileUrl = getFileAccessUrl(file);
        
        return {
          uid: file.id || Date.now() + index,
@@ -421,7 +457,7 @@
  detailRow.value = row || null;
  const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
  detailImages.value = list
    .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
    .map((f) => ({ url: getFileAccessUrl(f) }))
    .filter((i) => !!i.url);
  detailDialogVisible.value = true;
};
@@ -466,13 +502,20 @@
// 导出
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
  ElMessageBox.confirm("是否确认导出发货台账数据?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download("/shippingInfo/export", {}, "发货台账.xlsx");
      const params = {
        salesContractNo: searchForm.value.salesContractNo,
        shippingCarNumber: searchForm.value.shippingCarNumber,
        expressNumber: searchForm.value.expressNumber,
        shippingDateStart: searchForm.value.shippingDateStart,
        shippingDateEnd: searchForm.value.shippingDateEnd,
      };
      proxy.download("/shippingInfo/export", params, "发货台账.xlsx");
    })
    .catch(() => {
      proxy.$modal.msg("已取消");