From 592c1750b148874737cdfba4b22b6229f9805fe6 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 02 七月 2025 14:55:27 +0800 Subject: [PATCH] 新增 --- src/views/build/conpanyFunctionConsult/industryTemplate/index.vue | 46 +++++++++++++++++++++------------------------- 1 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue b/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue index b7b8c0f..632ba9c 100644 --- a/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue +++ b/src/views/build/conpanyFunctionConsult/industryTemplate/index.vue @@ -20,8 +20,8 @@ </el-option> </el-select> </el-form-item> - <el-form-item v-if="isAdmin" label="行业:" > - <el-select v-model="data.queryParams.industryId" placeholder="请选择" clearable> + <el-form-item label="行业:" > + <el-select v-model="data.queryParams.industryType" placeholder="请选择" clearable> <el-option v-for="item in industryList" :key="item.id" @@ -40,14 +40,10 @@ <el-table v-loading="loading" :data="dataList" :border="true"> <el-table-column label="序号" type="index" align="center" width="80"/> <el-table-column label="模板名称" prop="templateName" align="center"/> - <el-table-column label="行业" prop="industryType" align="center"> - <template #default="scope"> - {{getName(scope.row.industryType)}} - </template> - </el-table-column> + <el-table-column label="行业" prop="industryName" align="center" /> <el-table-column label="模板文件" prop="fileName" align="center"> <template #default="scope"> - <el-button link type="primary" @click="downloadFile(scope.row)">{{getName(scope.row.industryType) + '模板'}}</el-button> + <el-link style="" type="primary" @click="downloadFile(scope.row)">{{scope.row.fileName}}</el-link> </template> </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > @@ -84,6 +80,7 @@ import useUserStore from "@/store/modules/user"; import axios from "axios"; import {getToken} from "@/utils/auth"; +import {getIndustry} from "@/api/system/industry"; const userStore = useUserStore() const { proxy } = getCurrentInstance(); const loading = ref(false); @@ -93,23 +90,14 @@ pageNum: 1, pageSize: 10, companyId: null, - industryId: null + industryType: null }, total: 0, dataList: [], companyList: [], industryList: [], isAdmin: false, - typeList: [ - { - value: 1, - name: '化工' - }, - { - value: 2, - name: '安防' - } - ] + typeList: [] }); const { queryParams, total, dataList,companyList,industryList, isAdmin } = toRefs(data); @@ -123,6 +111,7 @@ data.isAdmin = false data.queryParams.companyId = userStore.companyId } + await getIndustryList() await getList() }) @@ -142,6 +131,14 @@ loading.value = false } +const getIndustryList = async () => { + const res = await getIndustry() + if(res.code == 200){ + data.industryList = res.data.data + }else{ + ElMessage.warning(res.message) + } +} const getCompanyList = async ()=>{ const queryParams = { pageNum: 1, @@ -163,7 +160,10 @@ let blob = new Blob([res.data],{type: res.data.type}) link.style.display = "none"; link.href = URL.createObjectURL(blob); // 创建URL - window.open(link.href) + link.setAttribute("download", e.fileName); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } else { ElMessage({ type: 'warning', @@ -171,10 +171,6 @@ }); } }) -} - -const getName =(type)=>{ - return data.typeList.find(i=> i.value == type)?.name } const openDialog = (type, value) => { @@ -187,7 +183,7 @@ pageNum: 1, pageSize: 10, companyId: null, - industryId: null + industryType: null } await getCompanyList() await getList() -- Gitblit v1.9.2