| | |
| | | </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 > |
| | |
| | | </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" > |
| | |
| | | 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); |
| | |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: null |
| | | companyId: null, |
| | | industryId: null |
| | | }, |
| | | total: 0, |
| | | dataList: [], |
| | | companyList: [], |
| | | industryList: [], |
| | | isAdmin: false, |
| | | typeList: [ |
| | | { |
| | |
| | | ] |
| | | }); |
| | | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | 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)=>{ |
| | |
| | | data.queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | companyId: null |
| | | companyId: null, |
| | | industryId: null |
| | | } |
| | | await getCompanyList() |
| | | await getList() |