From 644f9b827ac28d39f32c626712d5c574fe9acbf1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 十二月 2025 17:23:01 +0800
Subject: [PATCH] 1.海川开心-入库管理-成品入库添加一个删除功能
---
src/views/procurementManagement/procurementInvoiceLedger/fileList.vue | 91 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/fileList.vue b/src/views/procurementManagement/procurementInvoiceLedger/fileList.vue
new file mode 100644
index 0000000..88aa8f5
--- /dev/null
+++ b/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>
\ No newline at end of file
--
Gitblit v1.9.3