gaoluyang
6 天以前 742643e009dfd72591392f0d7dcf07c2a9a3ec9a
1.海川开心-开票台账发票信息上传了,没有查看的地方,只能上传
已修改3个文件
49 ■■■■■ 文件已修改
src/api/publicApi/commonFile.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/invoiceLedger/fileList.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/invoiceLedger/index.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/publicApi/commonFile.js
@@ -9,3 +9,11 @@
    data: ids
  })
}
// 开票台账文件删除
export function delCommonFileInvoiceLedger(ids) {
  return request({
    url: '/invoiceLedger/delFile',
    method: 'delete',
    data: ids
  })
}
src/views/salesManagement/invoiceLedger/fileList.vue
@@ -18,7 +18,7 @@
import { ref } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import filePreview from '@/components/filePreview/index.vue'
import { delCommonFile } from '@/api/publicApi/commonFile.js'
import { delCommonFileInvoiceLedger} from '@/api/publicApi/commonFile.js'
const dialogVisible = ref(false)
const tableData = ref([])
@@ -45,7 +45,7 @@
    cancelButtonText: '取消',
    type: 'warning',
  }).then(() => {
    delCommonFile([row.id]).then(() => {
        delCommonFileInvoiceLedger([row.id]).then(() => {
      ElMessage.success('删除成功')
      // 从列表中移除已删除的附件
      const index = tableData.value.findIndex(item => item.id === row.id)
src/views/salesManagement/invoiceLedger/index.vue
@@ -108,7 +108,7 @@
            <el-form-item label="附件材料:" prop="remark">
              <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
                :headers="upload.headers" accept=".pdf" :limit="10" :before-upload="handleBeforeUpload"
                :on-error="handleUploadError" :on-success="handleUploadSuccess" :on-remove="handleRemove">
                :on-error="handleUploadError" :on-success="handleUploadSuccess">
                <el-button type="primary">上传</el-button>
                <template #tip>
                  <!--                  文件格式支持 doc,docx,xls,xlsx,ppt,pptx,pdf,txt,xml,jpg,jpeg,png,gif,bmp,rar,zip,7z-->
@@ -321,20 +321,26 @@
  proxy.$modal.closeLoading();
  console.log('handleUploadSuccess');
  if (res.code === 200) {
    // proxy.$refs["fileUpload"].handleRemove(file);
    // fileList.value.push(res.data);
    proxy.$modal.msgSuccess("上传成功");
    // 将上传成功的文件信息添加到fileList中
    const fileInfo = {
      name: file.name,
      url: res.data.url || file.response?.data?.url || file.url,
      response: file.response
    };
    // 检查是否已存在相同文件,避免重复添加
    const existingFileIndex = fileList.value.findIndex(f => f.name === fileInfo.name);
    if (existingFileIndex === -1) {
      fileList.value.push(fileInfo);
    } else {
      fileList.value[existingFileIndex] = fileInfo;
    }
    // 确保表单数据中的fileList也更新
    form.value.fileList = fileList.value;
  } else {
    proxy.$modal.msgError(res.msg);
    proxy.$refs.fileUpload.handleRemove(file);
  }
}
// 移除文件
function handleRemove(file) {
  // let index = fileList.value.findIndex((item) => item.url === file.url);
  // if (index > -1) {
  //   fileList.value.splice(index, 1);
  // }
}
// 提交表单
const submitForm = () => {
@@ -367,13 +373,6 @@
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
// 打开附件上传弹窗
const handleDownload = (val) => {
  fileList.value = [];
  uploadModal.value = true;
  currentId.value = val.id;
};
// 确认文件上传
@@ -443,8 +442,8 @@
const fileListRef = ref(null)
//查看附件
const downLoadFile = (row) => {
  getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
    fileListRef.value.open(res.salesLedgerFiles)
    invoiceLedgerProductInfo({ id: row.id }).then((res) => {
        fileListRef.value.open(res.data.fileList)
  });
}