gaoluyang
7 天以前 af0413d1af5f1f1ab57a6806084c943950ea7b9d
1.海川开心-来台账发票信息上传了,没有查看的地方,只能上传
已添加1个文件
已修改1个文件
98 ■■■■■ 文件已修改
src/views/procurementManagement/procurementInvoiceLedger/fileList.vue 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/invoiceLedger/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementInvoiceLedger/fileList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,91 @@
<template>
  <el-dialog v-model="dialogVisible" title="附件" width="50%" :before-close="handleClose">
    <el-table :data="tableData" border height="40vh">
      <el-table-column label="附件名称" prop="name" min-width="400" show-overflow-tooltip />
      <el-table-column fixed="right" label="操作" width="200" align="center">
        <template #default="scope">
          <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">下载</el-button>
          <el-button link type="primary" size="small" @click="lookFile(scope.row)">预览</el-button>
          <el-button link type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
  <filePreview ref="filePreviewRef" />
  <UploadModal ref="uploadModalRef" @uploadSuccess="handleUploadSuccess" />
</template>
<script setup>
import { ref } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import filePreview from '@/components/filePreview/index.vue'
import UploadModal from './Modal/UploadModal.vue'
import { delCommonFileInvoiceLedger} from '@/api/publicApi/commonFile.js'
const dialogVisible = ref(false)
const tableData = ref([])
const currentId = ref('')
const { proxy } = getCurrentInstance();
const filePreviewRef = ref()
const uploadModalRef = ref()
const handleClose = () => {
  dialogVisible.value = false
}
const open = (list, id = '') => {
  dialogVisible.value = true
  tableData.value = list
  currentId.value = id
}
const handleUpload = () => {
  if (!currentId.value) {
    ElMessage.warning('无法获取当前记录ID,请关闭后重新打开附件窗口')
    return
  }
  uploadModalRef.value.handleImport(currentId.value)
}
const handleUploadSuccess = (data) => {
  ElMessage.success('上传成功')
  // è¿™é‡Œå¯ä»¥æ·»åŠ åˆ·æ–°é™„ä»¶åˆ—è¡¨çš„é€»è¾‘
  // æš‚时先关闭上传模态框
}
const downLoadFile = (row) => {
  proxy.$download.name(row.url);
}
const lookFile = (row) => {
  filePreviewRef.value.open(row.url)
}
// åˆ é™¤é™„ä»¶
const handleDelete = (row) => {
  ElMessageBox.confirm(`确认删除附件"${row.name}"吗?`, '删除确认', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning',
  }).then(() => {
        delCommonFileInvoiceLedger([row.id]).then(() => {
      ElMessage.success('删除成功')
      // ä»Žåˆ—表中移除已删除的附件
      const index = tableData.value.findIndex(item => item.id === row.id)
      if (index !== -1) {
        tableData.value.splice(index, 1)
      }
    }).catch(() => {
      ElMessage.error('删除失败')
    })
  }).catch(() => {
    proxy.$modal.msg('已取消删除')
  })
}
defineExpose({
  open
})
</script>
<style></style>
src/views/salesManagement/invoiceLedger/index.vue
@@ -165,8 +165,7 @@
  commitFile,
  registrationProductPage,
  delInvoiceLedgerByRegProductId,
} from "../../../api/salesManagement/invoiceLedger.js";
import { getSalesLedgerWithProducts } from "@/api/salesManagement/salesLedger.js";
} from "@/api/salesManagement/invoiceLedger.js";
import useUserStore from "@/store/modules/user.js";
import useFormData from "@/hooks/useFormData";
import dayjs from "dayjs";
@@ -279,6 +278,10 @@
  invoiceLedgerProductInfo({ id: row.id }).then((res) => {
    form.value = { ...res.data };
    fileList.value = res.data.fileList;
    // ä¿å­˜ticketRegistrationId到表单数据中
    if (row.ticketRegistrationId) {
      form.value.ticketRegistrationId = row.ticketRegistrationId;
    }
    if (!form.value.invoicePerson) {
      form.value.invoicePerson = userStore.nickName;
      // ç§»é™¤å½•入日期默认值设置,只处理范围日期字段