| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |