This commit is contained in:
bb_pan 2025-03-18 09:10:33 +08:00
parent 8f89140501
commit 0091f5c9e7
13 changed files with 160 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -30,9 +30,11 @@ console.log('permissionsList,permissionsList', permissionsList)
watch(
isType,
(newValue) => {
console.log('🚀 ~ newValue:', newValue)
if (newValue == 1) {
navMenuList.value = [
{ name: '首页', routerName: 'home', permissions: 'home' },
{ name: '数据大屏', routerName: 'big-screen', permissions: 'home' },
{ name: '装备共享大厅', routerName: 'equipList', permissions: 'share' },
{ name: '租赁需求大厅', routerName: 'parity', permissions: 'demand' },
// { name: '', routerName: 'zoneEquipment' },
@ -41,6 +43,7 @@ watch(
} else if (newValue == 2) {
navMenuList.value = [
{ name: '首页', routerName: 'home' },
{ name: '数据大屏', routerName: 'big-screen' },
{ name: '装备共享大厅', routerName: 'equipList' },
{ name: '租赁需求大厅', routerName: 'parity' },
// { name: '', routerName: 'zoneEquipment' },
@ -51,6 +54,7 @@ watch(
} else if (newValue == 3) {
navMenuList.value = [
{ name: '首页', routerName: 'home' },
{ name: '数据大屏', routerName: 'big-screen' },
{ name: '装备共享大厅', routerName: 'equipList' },
// { name: '', routerName: 'zoneEquipment' },
{ name: '租赁需求大厅', routerName: 'parity' },

View File

@ -303,10 +303,10 @@ onMounted(() => {
<el-badge v-else :value="form.msgNum ? Number(form.msgNum) : ''" :max="99" @click="onJumpMessage" style="margin: 0 10px;">消息</el-badge>
<div class="line"></div>
</div>
<div class="header-item" v-if="isShowLogout">
<!-- <div class="header-item" v-if="isShowLogout">
<a @click="onJumpScreen">数据大屏</a>
<div class="line"></div>
</div>
</div> -->
<!-- <div class="header-item">
<a @click="onClickMyUser"> 个人中心 </a>
<div class="line"></div>

View File

@ -45,7 +45,7 @@ export const updateUpDownApi = (data: any) => {
}
// 模版下载
export const downLoadTemplate = () => {
return get('/material-mall/dev/downLoad', {})
return post('/material-mall/dev/downLoadDev', {})
}

View File

@ -492,10 +492,10 @@ onMounted(() => {
<a @click="onJumpUser">个人中心</a>
<div class="line"></div>
</div>
<div class="header-item" v-if="isShowLogout">
<!-- <div class="header-item" v-if="isShowLogout">
<a @click="onJumpScreen">数据大屏</a>
<div class="line"></div>
</div>
</div> -->
<div class="header-item">
<!-- <a v-if="!isShowLogout" class="a-border-none" @click="$router.push('/login')">
登录

View File

@ -226,6 +226,17 @@ const routes: Array<RouteRecordRaw> = [
isLogin: true
},
},
{
path: '/detail-list',
name: 'detail-list',
component: () => import('views/big-screen/index.vue'),
meta: {
title: '数据大屏',
keepAlive: true,
AuthFlag: false,
isLogin: true
},
},
// 消息
{
path: '/message',

79
src/utils/download.js Normal file
View File

@ -0,0 +1,79 @@
import { get, post, put } from '@/http/index.ts';
// 下载blob文件
export const downloadFile = ({ fileData, fileType, fileName }) => {
const blob = new Blob([fileData], {
type: fileType
});
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.style.display = 'none';
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(link.href);
document.body.removeChild(link);
};
// 通用a链接下载
export const downloadFileByUrl = (url) => {
const link = document.createElement('a');
link.href = url; // 设置文件 URL
link.download = ''; // 提供下载提示
document.body.appendChild(link); // 将链接添加到 DOM
link.click(); // 模拟点击下载
document.body.removeChild(link); // 下载后移除链接
};
// pdf、doc、docx等文件下载
export const downloadFileData = ({ fileName, fileUrl }) => {
const link = document.createElement('a');
link.setAttribute('download', '');
link.style.display = 'none';
link.href = fileUrl;
link.download = fileName;
document.body.appendChild(link);
link.click();
// URL.revokeObjectURL(link.href)
document.body.removeChild(link);
};
export function download(url, params, filename, config) {
console.log('🚀 ~ download ~ url:', url)
// downloadLoadingInstance = Loading.service({
// text: '正在下载数据,请稍候',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)',
// });
return post(url, params, {
transformRequest: [
(params) => {
return tansParams(params);
},
],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config,
})
.then(async (data) => {
console.log('🚀 ~ .then ~ data:', data)
const isBlob = blobValidate(data);
console.log('🚀 ~ .then ~ isBlob:', isBlob)
if (isBlob) {
const blob = new Blob([data]);
saveAs(blob, filename);
} else {
// const resText = await data.text();
// const rspObj = JSON.parse(resText);
// const errMsg =
// errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
// Message.error(errMsg);
}
// downloadLoadingInstance.close();
})
.catch((r) => {
console.error(r);
// Message.error('下载文件出现错误,请联系管理员!');
// downloadLoadingInstance.close();
});
}

View File

@ -74,7 +74,7 @@ import CenterModel from './model-components/center-model.vue'
.dashboard {
display: grid;
grid-template-columns: 2fr 5fr 2fr;
grid-template-columns: 2fr 6fr 1.9fr;
grid-template-rows: repeat(3, 1fr);
gap: 0.5rem;
height: calc(100% - 130px);

View File

@ -0,0 +1,35 @@
<template>
<div class="screen-container">
<div class="screen-title">安徽机械化装备共享平台</div>
</div>
</template>
<script setup></script>
<style lang="scss" scoped>
.screen-container {
width: 100vw;
height: 100vh;
background: url('@/assets/img/screen/bg-2.png') no-repeat;
background-size: 100% 100%;
font-size: 16px;
position: relative;
.screen-title {
position: absolute;
top: 2%;
left: 50%;
color: #fff;
font-size: 30px;
// font-weight: bold;
transform: translateX(-50%);
letter-spacing: 3px;
// font-style: italic;
font-family: DS-TITle;
}
.header {
height: 80px;
}
}
</style>

View File

@ -213,7 +213,7 @@ const initEChart = () => {
{
name: '背景',
type: 'bar',
// barWidth: 12,
barWidth: 12,
barGap: '-100%',
data: defaultData,
itemStyle: {

View File

@ -35,6 +35,7 @@ import {
updateUpDownApi, //
downLoadTemplate, //
} from 'http/api/usercenter/goodsmang'
import { downloadFile, download } from '@/utils/download.js'
const batchAddVisible: any = ref(false) //
const batchAddData: any = ref([]) //
@ -1049,8 +1050,27 @@ const onTempDownLoad = () => {
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return downLoadTemplate()
.then(async() => {
const res: any = await downLoadTemplate()
const blob = res.blob()
// downloadFile({
// fileData: res,
// fileType: 'application/octet-stream',
// fileName: `_${new Date().getTime()}.xlsx`,
// })
// downLoadTemplate().then(res => res.blob()).then(blob => {
// console.log('🚀 ~ downLoadTemplate ~ blob:', blob)
// downloadFile({
// blob,
// fileType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
// fileName: `_${new Date().getTime()}.xlsx`,
// })
// })
download(
'/material-mall/dev/downLoadDev',
{},
`模版_${new Date().getTime()}.xlsx`
)
})
.catch(() => {})
}
@ -2484,7 +2504,7 @@ const getUpdateTimeBgColor = (row: any) => {
>
<el-row :gutter="20" style="display: flex; align-items: center">
<el-col :span="1.5" :offset="0">
<el-button type="primary" @click="">下载模版</el-button>
<el-button type="primary" @click="onTempDownLoad">下载模版</el-button>
</el-col>
<el-col :span="1.5" :offset="0">
<el-button type="primary" @click="">上传文件</el-button>
@ -2515,11 +2535,7 @@ const getUpdateTimeBgColor = (row: any) => {
:header-cell-style="{ background: '#00a288', color: '#fff' }"
@selection-change=""
>
<el-table-column
label="序号"
align="center"
width="80px"
>
<el-table-column label="序号" align="center" width="80px">
<template #default="{ row, $index }">
{{ $index + 1 }}
</template>