入驻装备数

This commit is contained in:
bb_pan 2025-07-15 19:40:24 +08:00
parent f4935e158d
commit 1b50de1064
8 changed files with 342 additions and 36 deletions

7
components.d.ts vendored
View File

@ -20,6 +20,8 @@ declare module 'vue' {
ElCascader: typeof import('element-plus/es')['ElCascader']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElCountdown: typeof import('element-plus/es')['ElCountdown']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
@ -27,6 +29,7 @@ declare module 'vue' {
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
@ -34,8 +37,10 @@ declare module 'vue' {
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
@ -43,9 +48,11 @@ declare module 'vue' {
ElSelect: typeof import('element-plus/es')['ElSelect']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']
ElUpload: typeof import('element-plus/es')['ElUpload']
Empty: typeof import('./src/components/Empty/index.vue')['default']
EquipCard: typeof import('./src/components/equipCard.vue')['default']
EquipCardHall: typeof import('./src/components/equipCardHall/index.vue')['default']

View File

@ -2,6 +2,7 @@ import { get, post } from '../../index'
// 登录接口 - 调试使用 - 产线环境需注释
export const loginApi = (data: any) => {
// return false
return post('/auth/login', data)
}

View File

@ -89,3 +89,13 @@ export const getTotalCountApi = (data: any = {}) => {
export const getDemandUnitApi = (data: any = {}) => {
return get('/material-mall/largeScreen/getDemandUnit', data)
}
// 获取公司列表
export const getDevNumListApi = (data: any = {}) => {
return get('/material-mall/largeScreen/getDevNumList', data)
}
// 入驻详情列表
export const getDevNumDetailsListApi = (data: any = {}) => {
return get('/material-mall/largeScreen/getDevNumDetailsList', data)
}

View File

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

View File

@ -1,4 +1,5 @@
import { get, post, put } from '@/http/index.ts'
import { ElLoading, ElMessage } from 'element-plus'
import axios from 'axios'
import { saveAs } from 'file-saver'
@ -50,6 +51,13 @@ const blobValidate = (data) => {
return data.type !== 'application/json'
}
const errorCode = {
401: '认证失败,无法访问系统资源',
403: '当前操作没有权限',
404: '访问资源不存在',
default: '系统未知错误,请反馈给管理员',
}
const tansParams = (params) => {
let result = ''
for (const propName of Object.keys(params)) {
@ -77,42 +85,59 @@ const tansParams = (params) => {
}
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 service
.post(url, params, {
transformRequest: [
(params) => {
return tansParams(params)
},
],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config,
})
const downloadLoadingInstance = ElLoading.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;charset=UTF-8' },
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);
const resText = await data.text()
const rspObj = JSON.parse(resText)
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
ElMessage.error(errMsg)
}
// downloadLoadingInstance.close();
downloadLoadingInstance.close()
})
.catch((r) => {
console.error(r)
// Message.error('下载文件出现错误,请联系管理员!');
// downloadLoadingInstance.close();
ElMessage.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close()
})
}
export const exportWithParams = async (exportUrl, params, fileName) => {
try {
const response = await axios({
method: 'post',
url: baseUrl + exportUrl,
data: params,
responseType: 'blob',
})
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', fileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch (error) {
console.error('导出失败:', error)
}
}

View File

@ -273,8 +273,8 @@ const handleDetail = (type: any) => {
let path = ''
if (type == 1) {
params.title = '入驻装备数'
params.type = 1
path = '/detail-list-new'
// params.type = 1
path = '/details-unit'
} else if (type == 2) {
params.title = '上架装备数'
params.type = 2

View File

@ -50,7 +50,6 @@ import { ref, onMounted } from 'vue'
import PagingComponent from 'components/PagingComponent/index.vue'
import {
getDevNumApi,
getDevUpNumApi,
getDevTypeNumApi,
getDevQcWarningNumApi,
@ -58,11 +57,12 @@ import {
getDevLeasingNumApi,
} from '@/http/api/screen-f/index.ts'
import { getTotalCountApi, getDemandUnitApi } from '@/http/api/screen/index.ts'
import { getTotalCountApi, getDemandUnitApi, getDevNumDetailsListApi } from '@/http/api/screen/index.ts'
const router = useRouter()
const currentType = ref(router.currentRoute.value.query.type)
const title = ref(router.currentRoute.value.query.title)
const ownCo = ref(router.currentRoute.value.query.ownCo)
//
const upTotal = ref(0)
//
@ -77,7 +77,21 @@ const orderCount = ref(0)
const answerRate = ref(0)
const columns = ref([])
if (currentType.value == 1 || currentType.value == 2) {
if (currentType.value == 1) {
columns.value = [
{ label: '装备名称', prop: 'deviceName' },
{ label: '装备类目', prop: 'categoryName' },
{ label: '装备单位', prop: 'unitName' },
{ label: '装备品牌', prop: 'brand' },
{ label: '出厂日期', prop: 'productionDate' },
{ label: '联系人', prop: 'person' },
{ label: '联系电话', prop: 'personPhone' },
{ label: '上架数量', prop: 'deviceCount' },
{ label: '录入人', prop: 'creatorName' },
{ label: '录入时间', prop: 'createTime' },
{ label: '所属公司', prop: 'comName' },
]
} else if (currentType.value == 2) {
columns.value = [
{ label: '机具类型', prop: 'typeName' },
{ label: '机具名称', prop: 'deviceName' },
@ -153,8 +167,9 @@ const getList = async () => {
}
let res = null
if (currentType.value == 1) {
params.ownCo = ownCo.value
//
res = await getDevNumApi(params)
res = await getDevNumDetailsListApi(params)
} else if (currentType.value == 2) {
//
res = await getDevUpNumApi(params)
@ -188,9 +203,16 @@ const getList = async () => {
const back = () => {
console.log('back')
router.push({
path: '/big-screen',
})
if (currentType.value == 1) {
router.push({
path: '/details-unit',
query: { title: '入驻装备数' },
})
} else {
router.push({
path: '/big-screen',
})
}
}
onMounted(() => {

View File

@ -0,0 +1,230 @@
<template>
<div class="screen-container-new">
<div class="screen-title">安徽机械化装备共享平台</div>
<div class="header">
<img class="header-img" src="@/assets/img/screen/返回.png" alt="" @click="back" />
</div>
<div class="content-new">
<div class="title">{{ title }}</div>
<el-table :data="tableData" style="width: 100%">
<el-table-column
label="序号"
type="index"
width="90"
align="center"
:index="indexContinuation"
/>
<el-table-column
v-for="(item, index) in columns"
:key="index"
:label="item.label"
:prop="item.prop"
align="center"
show-overflow-tooltip
>
</el-table-column>
<!-- 操作 -->
<el-table-column label="操作" align="center">
<template v-slot="{ row }">
<el-button type="primary" text size="small" @click="handleDetails(row)"
>查看详情</el-button
>
<el-button
type="warning"
text
size="small"
:icon="Download"
@click="handleExport(row)"
>
导出
</el-button>
</template>
</el-table-column>
</el-table>
<PagingComponent
@getListChange="getList"
v-model:pageSize="queryParams.pageSize"
v-model:currentPage="queryParams.pageNum"
:total="total"
style="margin-top: 20px"
/>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { Download } from '@element-plus/icons-vue'
import PagingComponent from 'components/PagingComponent/index.vue'
import { exportWithParams } from '@/utils/download.js'
import { getDevNumListApi } from '@/http/api/screen/index.ts'
const router = useRouter()
const currentType = ref(router.currentRoute.value.query.type)
const title = ref(router.currentRoute.value.query.title)
const columns = ref([
{ label: '公司名称', prop: 'comName' },
{ label: '入驻数量', prop: 'deviceCount' },
])
const total = ref(0)
const queryParams = ref({
pageNum: 1,
pageSize: 10,
})
const tableData = ref([])
const indexContinuation = (index) => {
return index + (queryParams.value.pageNum - 1) * queryParams.value.pageSize + 1
}
const getList = async () => {
console.log('currentType.value ', currentType.value)
try {
const params = {
pageNum: queryParams.value.pageNum,
pageSize: queryParams.value.pageSize,
}
const res = await getDevNumListApi(params)
if (res.code == 200) {
tableData.value = res.data.rows
total.value = res.data.total
}
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
}
}
//
const handleDetails = (row) => {
router.push({
path: '/detail-list-new',
query: {
type: 1,
title: title.value,
ownCo: row.ownCo,
},
})
}
//
const handleExport = (row) => {
try {
const formatTime = (date) => {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`
}
const currentTime = formatTime(new Date())
let fileName = `详情_${currentTime}.xLsx`
let url = '/material-mall/largeScreen/exportDevNumDetailsList'
const params = { ownCo: row.ownCo }
console.log('🚀 ~ 导出 ~ params:', params)
// download(url, params, fileName)
exportWithParams(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
}
const back = () => {
console.log('back')
router.push({
path: '/big-screen',
})
}
onMounted(() => {
getList()
})
</script>
<style lang="scss" scoped>
.screen-container-new {
width: 100vw;
height: 100vh;
background: url('@/assets/img/screen/bg-2.png') no-repeat;
background-size: 100% 100%;
font-size: 16px;
position: relative;
color: #eee;
.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;
display: flex;
align-items: center;
justify-content: flex-end;
.header-img {
margin-top: 15px;
margin-right: 30px;
width: 40px;
height: 40px;
cursor: pointer;
}
}
.content-new {
margin: 4% 10% 0;
.title {
width: 405px;
height: 36px;
padding-left: 35px;
margin-bottom: 30px;
background: url('@/assets/img/screen/title_bg.png') no-repeat;
background-size: 100% 100%;
line-height: 30px;
}
::v-deep(.el-table) {
background-color: transparent;
}
::v-deep(.el-table__header-wrapper) {
background: url('@/assets/img/screen/table-1.png') no-repeat !important;
background-size: cover;
background-position: center;
}
::v-deep(.el-table__header th) {
color: white;
background-color: transparent; /* 避免被其他背景色覆盖 */
}
::v-deep .el-table tr {
color: #eee;
background-color: transparent;
background: url('@/assets/img/screen/table-2.png') no-repeat;
}
:deep .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: #39816b;
color: #333;
}
::v-deep .el-input__wrapper {
background-color: #61b2a6;
}
}
}
</style>