From f94b96403234f5927e74f72fc0cbc65d7b426019 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期三, 10 十二月 2025 14:52:50 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/digitalFileDep/manageType/appFile/index.vue | 48 +++++++++++++++++++++++++++++++-----------------
1 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/digitalFileDep/manageType/appFile/index.vue b/src/views/build/conpanyFunctionConsult/digitalFileDep/manageType/appFile/index.vue
index d918268..9417419 100644
--- a/src/views/build/conpanyFunctionConsult/digitalFileDep/manageType/appFile/index.vue
+++ b/src/views/build/conpanyFunctionConsult/digitalFileDep/manageType/appFile/index.vue
@@ -8,9 +8,10 @@
plain
icon="Plus"
@click="openDialog('add',{})"
+ v-hasPermi="['qualityManage3:list:add']"
>新增</el-button>
</el-form-item>
- <el-form-item v-if="isAdmin" label="企业:" >
+ <el-form-item v-if="isAdmin" label="单位:" >
<el-select v-model="data.queryParams.companyId" placeholder="请选择" clearable>
<el-option
v-for="item in companyList"
@@ -37,9 +38,9 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
<template #default="scope">
- <el-button link type="primary" @click="downloadFile(scope.row.filePath)">下载</el-button>
- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
+ <el-button link type="primary" @click="downloadFile(scope.row.filePath)" v-hasPermi="['qualityManage3:list:edit']">下载</el-button>
+ <el-button link type="primary" @click="openDialog('edit',scope.row)" v-hasPermi="['qualityManage3:list:edit']">编辑</el-button>
+ <el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['qualityManage3:list:del']">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -65,6 +66,8 @@
import useUserStore from "@/store/modules/user";
import {getStandardTemp,delStandardTemp} from "@/api/standardSys/standardSys";
import {renderAsync} from "docx-preview";
+import {removeToken} from "@/utils/auth";
+import {isRelogin} from "@/utils/request";
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -99,13 +102,24 @@
})
const openFile = async(path)=>{
- try {
- // 1. 获取文件
- const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
- const arrayBuffer = await response.arrayBuffer();
- // 2. 创建新窗口
- const win = window.open('', '_blank');
- win.document.write(`
+ const ext = path.split('.').pop().toLowerCase();
+ if (ext === 'doc') {
+ ElMessageBox.confirm('暂不支持线上预览.doc、.xls、.xlsx文件,是否下载查看?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
+ window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
+ }).catch(() => {
+ console.log('取消预览')
+ });
+ return
+ }else if(ext == 'pdf' || ext == 'jpg' ){
+ window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
+ }else{
+ try {
+ // 1. 获取文件
+ const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
+ const arrayBuffer = await response.arrayBuffer();
+ // 2. 创建新窗口
+ const win = window.open('', '_blank');
+ win.document.write(`
<!DOCTYPE html>
<html>
<head>
@@ -120,19 +134,19 @@
</body>
</html>
`);
- // 3. 渲染 DOCX
- await renderAsync(arrayBuffer, win.document.getElementById('container'));
+ // 3. 渲染 DOCX
+ await renderAsync(arrayBuffer, win.document.getElementById('container'));
- } catch (error) {
- console.error('预览失败:', error);
- alert(`预览失败: ${error.message}`);
+ } catch (error) {
+ console.error('预览失败:', error);
+ alert(`预览失败: ${error.message}`);
+ }
}
}
const getList = async () => {
loading.value = true
const res = await getStandardTemp(data.queryParams)
if(res.code == 200){
- console.log(res.data,'data')
data.dataList = res.data.list || []
data.total = res.data.total
}else{
--
Gitblit v1.9.2