gaoluyang
3 天以前 7118f393605f8ef28457430d43a2608aa02f1696
src/views/salesManagement/deliveryLedger/index.vue
@@ -163,6 +163,7 @@
  addOrUpdateDeliveryLedger,
  delDeliveryLedger,
} from "@/api/salesManagement/deliveryLedger.js";
import { delLedgerFile } from "@/api/salesManagement/salesLedger.js";
 
const { proxy } = getCurrentInstance();
@@ -176,6 +177,7 @@
});
const total = ref(0);
const deliveryFileList = ref([]);
const javaApi = proxy.javaApi;
// 上传配置
const upload = reactive({
@@ -310,9 +312,7 @@
            fileUrl = '/' + fileUrl;
          }
          // 拼接 baseUrl
          const baseUrl = import.meta.env.VITE_APP_ENV;
          console.log('baseUrl:', baseUrl);
          fileUrl = baseUrl + fileUrl;
          fileUrl = javaApi + fileUrl;
          console.log('最终拼接的 URL:', fileUrl);
        }
        
@@ -491,10 +491,27 @@
}
// 移除发货图片
function handleDeliveryRemove(file) {
  // 从文件列表中移除
  const index = deliveryFileList.value.findIndex(item => item.uid === file.uid);
  if (index > -1) {
    deliveryFileList.value.splice(index, 1);
  console.log('file--', file)
  // 如果是编辑模式且文件有 id,需要调用接口删除
  if (operationType.value === "edit") {
    let ids = [];
    ids.push(file.uid);
    delLedgerFile(ids).then((res) => {
      proxy.$modal.msgSuccess("删除成功");
      // 从文件列表中移除
      const index = deliveryFileList.value.findIndex(item => item.uid === file.uid);
      if (index > -1) {
        deliveryFileList.value.splice(index, 1);
      }
    }).catch(() => {
      proxy.$modal.msgError("删除失败");
    });
  } else {
    // 新增模式或没有 id 的文件,直接从列表中移除
    const index = deliveryFileList.value.findIndex(item => item.uid === file.uid);
    if (index > -1) {
      deliveryFileList.value.splice(index, 1);
    }
  }
}
@@ -523,5 +540,12 @@
  justify-content: space-between;
  margin-bottom: 10px;
}
// 隐藏图片上传组件的预览按钮(放大镜)
:deep(.el-upload-list--picture-card .el-upload-list__item-actions) {
  .el-upload-list__item-preview {
    display: none;
  }
}
</style>