gongchunyi
7 天以前 1db9b292fa7d458573714864f0541ba6314d3eb9
src/views/basicData/product/ImportExcel/index.vue
@@ -26,36 +26,21 @@
  name: "产品维护导入",
});
const props = defineProps({
  productId: { type: [String, Number], default: "" },
});
const emits = defineEmits(["uploadSuccess"]);
const fileUploadRef = ref();
const upload = reactive({
  // 是否显示弹出层(供应商导入)
  open: false,
  // 弹出层标题(供应商导入)
  title: "",
  title: "产品导入",
  // 是否禁用上传
  isUploading: false,
  // 设置上传的请求头部
  headers: { Authorization: "Bearer " + getToken() },
});
// 上传的地址(携带 productId 参数,传给后端的 importProduct 接口)
const uploadUrl = computed(
  () =>
    import.meta.env.VITE_APP_BASE_API +
    "/basic/product/import" +
    (props.productId ? `?productId=${props.productId}` : "")
);
// 上传的地址
const uploadUrl = computed(() => import.meta.env.VITE_APP_BASE_API + "/basic/product/import");
// 点击导入
const handleImport = () => {
  if (!props.productId) {
    ElMessage({ message: "请先选择产品", type: "warning" });
    return;
  }
  upload.open = true;
  upload.title = "产品导入";
};
const submitFileForm = () => {