From 1d66f43353524889999bbd9ac0b331c557ff98f7 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Mon, 30 Jun 2025 17:29:22 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/industryTemplate/index.vue | 41 ++++++++++++++++++++++++++++++++---------
1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue b/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue
index e0c9573..b7b8c0f 100644
--- a/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue
+++ b/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue
@@ -21,9 +21,13 @@
</el-select>
</el-form-item>
<el-form-item v-if="isAdmin" label="行业:" >
- <el-select v-model="data.queryParams.companyId" placeholder="请选择" clearable>
- <el-option key="1" label="化工" :value="1"></el-option>
- <el-option key="2" label="安防" :value="2"></el-option>
+ <el-select v-model="data.queryParams.industryId" placeholder="请选择" clearable>
+ <el-option
+ v-for="item in industryList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
</el-select>
</el-form-item>
<el-form-item >
@@ -43,7 +47,7 @@
</el-table-column>
<el-table-column label="模板文件" prop="fileName" align="center">
<template #default="scope">
- <el-button link type="primary" @click="downloadFile(scope.row.filePath)">{{getName(scope.row.industryType) + '模板'}}</el-button>
+ <el-button link type="primary" @click="downloadFile(scope.row)">{{getName(scope.row.industryType) + '模板'}}</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
@@ -78,6 +82,8 @@
getIndustryTemp,
} from "@/api/staffManage/staff";
import useUserStore from "@/store/modules/user";
+import axios from "axios";
+import {getToken} from "@/utils/auth";
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -86,11 +92,13 @@
queryParams: {
pageNum: 1,
pageSize: 10,
- companyId: null
+ companyId: null,
+ industryId: null
},
total: 0,
dataList: [],
companyList: [],
+ industryList: [],
isAdmin: false,
typeList: [
{
@@ -104,11 +112,12 @@
]
});
-const { queryParams, total, dataList,companyList, isAdmin } = toRefs(data);
+const { queryParams, total, dataList,companyList,industryList, isAdmin } = toRefs(data);
const userInfo = ref()
onMounted(async ()=>{
if(userStore.roles.includes('admin')){
data.isAdmin = true
+ data.queryParams.companyId = null
await getCompanyList()
}else{
data.isAdmin = false
@@ -147,8 +156,21 @@
}
}
-const downloadFile = (path)=>{
- window.open(import.meta.env.VITE_APP_BASE_API + '/' + path)
+const downloadFile = (e)=>{
+ axios.get(import.meta.env.VITE_APP_BASE_API + '/' +e.filePath,{headers:{'Content-Type': 'application/json','Authorization': `${getToken()}`},responseType: 'blob'}).then(res=>{
+ if (res) {
+ const link = document.createElement('a')
+ let blob = new Blob([res.data],{type: res.data.type})
+ link.style.display = "none";
+ link.href = URL.createObjectURL(blob); // 创建URL
+ window.open(link.href)
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: '文件读取失败'
+ });
+ }
+ })
}
const getName =(type)=>{
@@ -164,7 +186,8 @@
data.queryParams = {
pageNum: 1,
pageSize: 10,
- companyId: null
+ companyId: null,
+ industryId: null
}
await getCompanyList()
await getList()
--
Gitblit v1.9.2