|
|
@@ -142,14 +142,14 @@
|
|
|
<el-button
|
|
|
type="text"
|
|
|
size="small"
|
|
|
- @click="handleDownload(scope.row)"
|
|
|
+ @click="handleArchivePreview(scope.row)"
|
|
|
>
|
|
|
档案详情
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="text"
|
|
|
size="small"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
+ @click="handleDownload(scope.row)"
|
|
|
>
|
|
|
下载
|
|
|
</el-button>
|
|
|
@@ -171,12 +171,30 @@
|
|
|
</div>
|
|
|
<!-- 任务详情弹窗 -->
|
|
|
<taskDetail ref="taskDetail" />
|
|
|
+
|
|
|
+ <!-- 档案详情预览弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="previewDialogVisible"
|
|
|
+ width="65%"
|
|
|
+ title="档案详情预览"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <div class="preview-container">
|
|
|
+ <iframe
|
|
|
+ v-if="previewUrl"
|
|
|
+ :src="previewUrl"
|
|
|
+ frameborder="0"
|
|
|
+ class="preview-iframe"
|
|
|
+ ></iframe>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import taskDetail from '@/components/task/taskDetail.vue'
|
|
|
import { getArchiveList } from '@/api/audit/archive'
|
|
|
+ import { getSysPropertiesAlias } from '@/api/properties'
|
|
|
import { regionMixin } from '@/mixins/useDict'
|
|
|
export default {
|
|
|
name: 'ArchiveList',
|
|
|
@@ -200,10 +218,16 @@
|
|
|
total: 0,
|
|
|
},
|
|
|
activeTab: 'list',
|
|
|
+ // 系统属性值
|
|
|
+ sysKkUrl: '',
|
|
|
+ // 预览对话框
|
|
|
+ previewDialogVisible: false,
|
|
|
+ previewUrl: '',
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.fetchData()
|
|
|
+ this.getSysKkUrl()
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取数据
|
|
|
@@ -271,20 +295,63 @@
|
|
|
this.fetchData()
|
|
|
},
|
|
|
handleDetail(row) {
|
|
|
- // 可以在这里处理详情点击
|
|
|
- console.log('详情:', row)
|
|
|
+ // 打开任务详情弹窗
|
|
|
+ this.$refs.taskDetail.open(row, 'chengben')
|
|
|
+ },
|
|
|
+ // 获取系统属性值 sys.kk.url
|
|
|
+ async getSysKkUrl() {
|
|
|
+ try {
|
|
|
+ const response = await getSysPropertiesAlias('sys_kk_url')
|
|
|
+ alert(response.value)
|
|
|
+ if (response && response.value) {
|
|
|
+ this.sysKkUrl = response.value
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取系统属性值失败:', error)
|
|
|
+ }
|
|
|
},
|
|
|
handleView(row) {
|
|
|
// 打开任务详情弹窗
|
|
|
this.$refs.taskDetail.open(row, 'chengben')
|
|
|
},
|
|
|
handleDownload(row) {
|
|
|
- // 回归档操作
|
|
|
- this.$message.info('回归档功能待实现')
|
|
|
- },
|
|
|
- handleDelete(row) {
|
|
|
// 下载操作
|
|
|
- this.$message.info('下载功能待实现')
|
|
|
+ if (!row.archiveUrl) {
|
|
|
+ this.$message.error('文件下载地址不存在')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // 创建a标签进行下载
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = row.archiveUrl
|
|
|
+ // 从URL中提取文件名或使用默认文件名
|
|
|
+ const fileName =
|
|
|
+ row.archiveUrl.split('/').pop() || `archive_${new Date().getTime()}`
|
|
|
+ link.download = fileName
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ // 移除a标签
|
|
|
+ document.body.removeChild(link)
|
|
|
+ this.$message.success('文件下载成功')
|
|
|
+ } catch (error) {
|
|
|
+ console.error('下载失败:', error)
|
|
|
+ this.$message.error('文件下载失败')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 档案详情预览
|
|
|
+ handleArchivePreview(row) {
|
|
|
+ if (!row.archiveUrl) {
|
|
|
+ this.$message.error('文件预览地址不存在')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ alert(this.sysKkUrl)
|
|
|
+ // 拼接预览URL
|
|
|
+ this.previewUrl =
|
|
|
+ this.sysKkUrl +
|
|
|
+ `onlinePreview?url=${encodeURIComponent(row.archiveUrl)}`
|
|
|
+ // 打开预览弹窗
|
|
|
+ this.previewDialogVisible = true
|
|
|
},
|
|
|
backToList() {
|
|
|
this.activeTab = 'list'
|
|
|
@@ -326,4 +393,14 @@
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .preview-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 600px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .preview-iframe {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
</style>
|