Files
shzg_projectManage/src/views/index.vue

1252 lines
34 KiB
Vue
Raw Normal View History

2026-01-20 16:56:01 +08:00
<template>
<div class="dashboard app-container">
<el-row :gutter="24">
2026-02-05 08:30:36 +08:00
<el-col :span="12">
<div class="inOrOutBox" style="background-color: #FDF6E3;">
<div class="inOrOutBox_left">
<div style="font-size: 20px; font-weight:bold; color:#333333; ">月入库统计</div>
<div class="itemBox">
<div>
<p style="font-size: 14px;color:#606266">项目数 </p>
<p style="font-size: 20px; font-weight:500; ">{{ countObj.monthInCount }} </p>
</div>
<div>
<p style="font-size: 14px;color:#606266 ">条目数 </p>
<p style="font-size: 20px;font-weight:500;">{{ countObj.monthInProjectCount }} </p>
</div>
<div>
<p style="font-size: 14px; color:#606266">总金额 </p>
<p style="font-size: 20px; font-weight:500;">{{ countObj.monthInAmount }} </p>
</div>
</div>
2026-01-20 16:56:01 +08:00
</div>
2026-02-05 08:30:36 +08:00
<div class="inOrOutBox_icon">
<img src="../assets/images/inbound.png" alt="">
2026-01-20 16:56:01 +08:00
</div>
</div>
</el-col>
2026-02-05 08:30:36 +08:00
<el-col :span="12">
<div class="inOrOutBox" style="background-color: #EBF5FF;">
<div class="inOrOutBox_left">
<div style="font-size: 20px; font-weight:bold;color:#333333 ">月出库统计</div>
<div class="itemBox">
<div>
<p style="font-size: 14px;color:#606266 ">项目数 </p>
<p style="font-size: 20px;font-weight:500; ">{{ countObj.monthOutCount }} </p>
</div>
<div>
<p style="font-size: 14px; color:#606266">条目数 </p>
<p style="font-size: 20px; font-weight:500;">{{ countObj.monthOutProjectCount }} </p>
</div>
<div>
<p style="font-size: 14px; color:#606266">总金额 </p>
<p style="font-size: 20px; font-weight:500;">{{ countObj.monthOutAmount }} </p>
</div>
</div>
2026-01-20 16:56:01 +08:00
</div>
2026-02-05 08:30:36 +08:00
<div class="inOrOutBox_icon">
<img src="../assets/images/outbound.png" alt="">
2026-01-20 16:56:01 +08:00
</div>
</div>
</el-col>
2026-02-05 08:30:36 +08:00
2026-01-20 16:56:01 +08:00
</el-row>
<el-row :gutter="24" style="margin-top: 20px;">
2026-02-05 08:30:36 +08:00
2026-01-20 16:56:01 +08:00
<el-col :span="8">
<div class="main">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>预警信息</div>
</div>
</div>
<el-row :gutter="24" style="margin-top: 25px;height: 100%;">
<el-col :span="24">
<div style="height: 100%;width: 100%;" id="inventoryAgeEchatrs"></div>
</el-col>
</el-row>
</div>
</el-col>
<el-col :span="8">
<div class="main">
<div class="titleBox">
<div class="line"></div>
<div class="name" style="display: flex;align-items: center;justify-content: space-between;flex: 1;">
<div>库龄统计</div>
2026-02-04 15:28:28 +08:00
<el-icon style="cursor: pointer;" @click="downloadExcel">
<Download />
</el-icon>
2026-01-20 16:56:01 +08:00
</div>
</div>
<el-row :gutter="24" style="margin-top: 25px;height: 100%;">
<el-col :span="24">
<div style="height: 100%;width: 100%;" id="warningEchatrs"></div>
</el-col>
<!-- <el-col :span="12">
<div style="height: 100%;width: 100%;" id="warningEchatrs2"></div>
</el-col> -->
<!-- <el-col :span="6">
<div class="warningBox">
<div>库存预警</div>
<div style="display: flex;align-items: center;justify-content: center;margin-top: 14px;">
<div style="margin-right: 14px;">29</div>
<el-icon color="#F87777" size="48" style=""><WarningFilled /></el-icon>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="warningBox">
<div>库存预警</div>
<div style="display: flex;align-items: center;justify-content: center;margin-top: 14px;">
<div style="margin-right: 14px;">29</div>
<el-icon color="#F87777" size="48" style=""><WarningFilled /></el-icon>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="warningBox">
<div>库存预警</div>
<div style="display: flex;align-items: center;justify-content: center;margin-top: 14px;">
<div style="margin-right: 14px;">29</div>
<el-icon color="#F87777" size="48" style=""><WarningFilled /></el-icon>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="warningBox">
<div>库存预警</div>
<div style="display: flex;align-items: center;justify-content: center;margin-top: 14px;">
<div style="margin-right: 14px;">29</div>
<el-icon color="#F87777" size="48" style=""><WarningFilled /></el-icon>
</div>
</div>
</el-col> -->
</el-row>
</div>
</el-col>
<el-col :span="8">
<div class="main">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>待办事项</div>
</div>
</div>
<div style="display: flex;justify-content: space-between;align-items: center;flex-direction: column;">
<!-- <div class="main_box">
<div style="font-size: 32px; font-family: PingFang SC-Medium;">9999</div>
<div style="margin-top: 16px; font-family: PingFang SC-Regular;">待入库</div>
</div>
<div class="main_box">
<div style="font-size: 32px; font-family: PingFang SC-Medium;">9999</div>
<div style="margin-top: 16px; font-family: PingFang SC-Regular;">待盘点</div>
</div> -->
2026-02-04 15:28:28 +08:00
<el-table :data="waitTableData" :header-row-style="handleCellStyle" style="margin-top: 20px;">
2026-01-20 16:56:01 +08:00
<el-table-column prop="type" label="类型" width="150" align="center">
<template #default="scope">
2026-02-04 15:28:28 +08:00
<span style="color:#ee6666;font-weight: 550;">{{ scope.row.type }}</span>
2026-01-20 16:56:01 +08:00
</template>
</el-table-column>
<!-- <el-table-column prop="situation" label="情况" /> -->
2026-02-04 15:28:28 +08:00
<el-table-column prop="projectCnt" label="项目数" align="center" />
<el-table-column prop="totalAmt" label="总金额" align="center" />
<el-table-column prop="totalQty" label="总数量" align="center" />
2026-01-20 16:56:01 +08:00
</el-table>
</div>
</div>
</el-col>
2026-02-04 15:28:28 +08:00
2026-01-20 16:56:01 +08:00
</el-row>
<el-row :gutter="24" style="height: 400px;margin-top: 20px;">
<el-col :span="12">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>仓库使用率</div>
</div>
</div>
<div class="echartsBox" id="echartsInventoryReview"></div>
</div>
</el-col>
<el-col :span="12">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>当前入库类型统计</div>
</div>
</div>
<div class="echartsBox" id="echartsInStorage"></div>
</div>
</el-col>
</el-row>
<el-row :gutter="24" style="margin-top: 20px;">
<el-col :span="12">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>物资类型统计</div>
</div>
</div>
<div class="echartsBox" id="echartsGoodsType"></div>
</div>
</el-col>
<el-col :span="12" style="height: 400px;">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>通知与公告</div>
<!-- <el-date-picker
v-model="dateDailyInventoryObj"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
format="YYYY-MM-DD"
style="margin: 0 20px;"
/> -->
</div>
</div>
<div class="echartsBox" style="overflow-y: auto;">
2026-02-04 15:28:28 +08:00
<div v-for="(item, index) in noticeList" :key="index">
2026-01-20 16:56:01 +08:00
<div style="display: flex; align-items: center; justify-content: space-between; margin-top: 13px">
2026-02-04 15:28:28 +08:00
<div
style="width: 80%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px;">
{{
item.noticeTitle }}</div>
<div style="color: #0288FF; font-size: 14px; cursor: pointer;" @click="goNotice(item.noticeId)">详情
</div>
2026-01-20 16:56:01 +08:00
</div>
</div>
2026-02-04 15:28:28 +08:00
</div>
2026-01-20 16:56:01 +08:00
</div>
</el-col>
</el-row>
<el-row :gutter="24" style="height: 400px;margin-top: 20px;">
<el-col :span="12">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>入库类型统计</div>
2026-02-05 08:30:36 +08:00
<div>
<el-date-picker v-model="dateInventoryTypeObj" type="daterange" range-separator="至"
start-placeholder="开始时间" end-placeholder="结束时间" value-format="YYYY-MM-DD" style="margin: 0 20px;" />
<el-button type="primary" @click="getInventoryTypeList">搜索</el-button>
</div>
2026-01-20 16:56:01 +08:00
</div>
</div>
<div class="echartsBox" style="margin-top: 20px;" id="echartsInventoryType"></div>
</div>
</el-col>
<el-col :span="12">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>出库类型统计</div>
2026-02-05 08:30:36 +08:00
<div>
<el-date-picker v-model="dateOutInventoryTypeObj" type="daterange" range-separator="至"
start-placeholder="开始时间" end-placeholder="结束时间" value-format="YYYY-MM-DD" style="margin: 0 20px;" />
<el-button type="primary" @click="getOutInventoryTypeList">搜索</el-button>
</div>
2026-01-20 16:56:01 +08:00
</div>
</div>
<div class="echartsBox" style="margin-top: 20px;" id="echartsOutInventoryType"></div>
</div>
</el-col>
</el-row>
<el-dialog title="公告详情" v-model="open" width="780px" append-to-body @close="closeDialog">
2026-02-04 15:28:28 +08:00
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="内容">
<editor v-model="noticeContent" :min-height="192" :readOnly="true" :showToolbar="false" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- <template #footer>
2026-01-20 16:56:01 +08:00
<div class="dialog-footer" >
<el-button type="primary" @click="submitForm" :disabled="isDetail"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template> -->
2026-02-04 15:28:28 +08:00
</el-dialog>
2026-01-20 16:56:01 +08:00
<!-- <el-row :gutter="24" style="margin-top: 20px;">
<el-col :span="24" style="height: 400px;">
<div class="echartsMain" style="padding-bottom: 0;">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>入库指标统计</div>
<el-date-picker
v-model="dateDailyInventoryObj"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
style="margin: 0 20px;"
/>
<el-button type="primary" @click="getDailyInventoryList">搜索</el-button>
</div>
</div>
<div class="echartsBox" style="margin-top: 20px;" id="echartsDailyInventory"></div>
</div>
</el-col>
<el-col :span="24" style="height: 400px;">
<div class="echartsMain" style="padding-top: 0;">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>出库指标统计</div>
</div>
</div>
<div class="echartsBox" style="margin-top: 20px;" id="echartsDailyOutInventory"></div>
</div>
</el-col>
</el-row> -->
<!-- <el-row :gutter="24" style="height: 400px;margin-top: 20px;">
<el-col :span="24">
<div class="echartsMain">
<div class="titleBox">
<div class="line"></div>
<div class="name">
<div>出库指标统计</div>
<el-date-picker
v-model="dateDailyInventoryObj"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
style="margin: 0 20px;"
/>
<el-button type="primary" @click="getDailyInventoryList">搜索</el-button>
</div>
</div>
<div class="echartsBox" style="margin-top: 20px;" id="echartsDailyOutInventory"></div>
</div>
</el-col>
</el-row> -->
2026-02-04 15:28:28 +08:00
2026-01-20 16:56:01 +08:00
</div>
</template>
<script setup>
import * as echarts from 'echarts';
import { onMounted } from "vue";
2026-02-04 15:28:28 +08:00
import { getHomeState, getAgeLong, getWait, getInventoryReview, getOutTypeByTime, getInTypeByTime, getDailyInventory, getNoticeList } from '@/api/index'
import { listNotice, getNotice } from "@/api/system/notice";
2026-01-20 16:56:01 +08:00
import { parseTime } from '@/utils/manage'
const { proxy } = getCurrentInstance();
const a = (scope) => {
console.log(scope)
}
2026-02-04 15:28:28 +08:00
// 顶部月统计数据
let countObj = ref({})
let colorList = ref(['#00968F', '#0077a0', '#61cdbb'])
2026-02-03 11:40:02 +08:00
2026-02-04 15:28:28 +08:00
// 查询时间
2026-02-03 11:40:02 +08:00
let startTime = parseTime(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), '{y}-{m}-{d}') // 14天前
let endTime = parseTime(new Date(), '{y}-{m}-{d}') // 当前时间
2026-02-04 15:28:28 +08:00
// 获取月统计、当前入库类型统计、物资类型统计接口
const getMonthCountList = (params) => {
getHomeState(params).then(res => {
// 月统计
countObj.value = res.data?.kpi
// 当前入库类型统计
getChartInStorage(res.data?.currentInType, "echartsInStorage")
//物资类型统计
getChartGoodsType(res.data?.materialType)
})
}
// 预警 + 库龄统计
2026-02-03 11:40:02 +08:00
const getAgeLongList = () => {
getAgeLong().then(res => {
2026-02-04 15:28:28 +08:00
let data1 = res.data.slice(0, 3)
2026-02-03 11:40:02 +08:00
getChartInventoryAge(data1, "inventoryAgeEchatrs")
2026-02-04 15:28:28 +08:00
let data2 = res.data.slice(3)
2026-02-03 11:40:02 +08:00
getChartInventoryAge(data2, "warningEchatrs")
})
}
2026-01-20 16:56:01 +08:00
// 自定义单元格样式
// const handleCellStyle = ({ row, column, rowIndex, columnIndex }) => {
// // 示例:根据“类型”和“情况”设置颜色
// if (row.type === '应到未到' && row.situation === '部分未到') {
// return { backgroundColor: '#FCE9D2', color: '#C77800' }; // 浅橙色
// }
// if (row.type === '应到未到' && row.situation === '全部未到') {
// return { backgroundColor: '#E9F3FF', color: '#409EFF' }; // 浅蓝色
// }
// if (row.type === '应出未出' && row.situation === '全部未出') {
// return { backgroundColor: '#E8F8F5', color: '#28A745' }; // 浅绿色
// }
// // 其他默认样式
// return { backgroundColor: '#FFFFFF', color: '#333333' };
// };
2026-02-04 15:28:28 +08:00
const handleCellStyle = () => {
2026-01-20 16:56:01 +08:00
return { backgroundColor: '#f5f7fa' }
}
2026-02-04 15:28:28 +08:00
// 待办事项数据
let waitTableData = ref([])
2026-01-20 16:56:01 +08:00
const getWaitList = () => {
2026-02-03 11:40:02 +08:00
getWait().then(res => {
waitTableData.value = res.data
2026-01-20 16:56:01 +08:00
})
}
2026-02-04 15:28:28 +08:00
// 仓库使用率数据
2026-01-20 16:56:01 +08:00
const getInventoryReviewList = () => {
getInventoryReview().then(res => {
getChartInventoryReview(res.data)
})
}
2026-02-04 15:28:28 +08:00
// 入库类型统计-时间搜索
const dateInventoryTypeObj = ref([])
2026-01-20 16:56:01 +08:00
const getInventoryTypeList = () => {
let params = {
2026-02-04 15:28:28 +08:00
startDate: dateInventoryTypeObj.value?.[0],
endDate: dateInventoryTypeObj.value?.[1]
2026-01-20 16:56:01 +08:00
}
2026-02-04 15:28:28 +08:00
getInTypeByTime(params).then(res => {
2026-01-20 16:56:01 +08:00
getChartInventoryType(res.data, "echartsInventoryType")
})
}
2026-02-04 15:28:28 +08:00
// 出库类型统计-时间搜索
const dateOutInventoryTypeObj = ref([[]])
2026-01-20 16:56:01 +08:00
const getOutInventoryTypeList = () => {
let params = {
2026-02-04 15:28:28 +08:00
startDate: dateOutInventoryTypeObj.value?.[0],
endDate: dateOutInventoryTypeObj.value?.[1]
2026-01-20 16:56:01 +08:00
}
2026-02-04 15:28:28 +08:00
getOutTypeByTime(params).then(res => {
2026-01-20 16:56:01 +08:00
getChartInventoryType(res.data, "echartsOutInventoryType")
})
}
2026-02-04 15:28:28 +08:00
// todo 已注释内容 - 出库指标统计/入库指标统计
2026-01-20 16:56:01 +08:00
const getChartDailyInventory = (data, id) => {
let xAxisData = []
let projectData = []
let totalData = []
let priceData = []
data.forEach(item => {
xAxisData.push(item.xj)
projectData.push(item.projectCount)
totalData.push(item.itemCount)
priceData.push(item.amountHt)
})
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
grid: {
// bottom: '8%',
},
legend: {
// data: ['项目数', '条目数', '总金额']
},
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
2026-02-04 15:28:28 +08:00
rotate: 30,
2026-01-20 16:56:01 +08:00
},
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
// min: 0,
// max: 250,
// interval: 50,
axisLabel: {
formatter: '{value} 个'
},
// splitLine: {
// // 调整纵坐标网格线样式,比如设为虚线、浅色
// show: true,
// lineStyle: {
// color: '#eee', // 浅色,降低存在感
// type: 'dashed' // 虚线
// }
// }
},
{
type: 'value',
name: '金额',
// min: 0,
// max: 25,
// interval: 5,
axisLabel: {
formatter: '{value} 元'
},
// splitLine: {
// show: true,
// lineStyle: {
// color: '#eee',
// type: 'dashed'
// }
// }
}
],
series: [
{
name: '项目数',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: projectData
},
{
name: '总条目数',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: totalData
},
{
name: '总金额',
type: 'bar',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' 元';
}
},
data: priceData
}
]
});
}
2026-02-04 15:28:28 +08:00
2026-01-20 16:56:01 +08:00
const dateDailyInventoryObj = ref([startTime, endTime])
const getDailyInventoryList = () => {
let params = {
start: dateDailyInventoryObj.value[0],
end: dateDailyInventoryObj.value[1]
}
getDailyInventory(params).then(res => {
getChartDailyInventory(res.data.in, "echartsDailyInventory")
getChartDailyInventory(res.data.out, "echartsDailyOutInventory")
})
}
2026-02-04 15:28:28 +08:00
//todo 注释内容完成
2026-01-20 16:56:01 +08:00
2026-02-04 15:28:28 +08:00
// 通知公告列表
const noticeList = ref([])
const getNoticeListValue = () => {
getNoticeList().then(res => {
2026-01-20 16:56:01 +08:00
noticeList.value = res.rows;
})
}
//通知公告详情
2026-02-04 15:28:28 +08:00
const open = ref(false);
const noticeContent = ref("")
2026-01-20 16:56:01 +08:00
const goNotice = (noticeId) => {
getNotice(noticeId).then(response => {
noticeContent.value = response.data.noticeContent;
open.value = true;
});
// 张金波注释,不跳转到列表,只弹开详情
// proxy.$router.push({
// path: '/system/notice',
// })
}
onMounted(() => {
2026-02-04 15:28:28 +08:00
// 入库类型统计查询时间
dateInventoryTypeObj.value = [startTime, endTime]
// 出库类型统计查询时间
dateOutInventoryTypeObj.value = [startTime, endTime]
getMonthCountList()// 获取月统计、当前入库类型统计、物资类型统计接口
getAgeLongList()// 预警 + 库龄统计
getWaitList()// 待办事项数据
getInventoryReviewList()// 仓库使用率数据
getInventoryTypeList()// 入库类型统计-时间搜索
getOutInventoryTypeList()// 出库类型统计-时间搜索
getNoticeListValue()// 通知公告列表
2026-01-20 16:56:01 +08:00
});
const downloadExcel = () => {
2026-02-03 11:40:02 +08:00
proxy.download('/stat/stockAge/export30', {}, `库龄统计_${new Date().getTime()}.xlsx`)
2026-01-20 16:56:01 +08:00
}
2026-02-04 15:28:28 +08:00
// 预警 + 库龄统计 图表
2026-01-20 16:56:01 +08:00
const getChartInventoryAge = (data, id) => {
let chartDom = document.getElementById(id);
let myChart = echarts.init(chartDom);
myChart.setOption({
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left'
},
2026-02-04 15:28:28 +08:00
color: colorList.value,
2026-01-20 16:56:01 +08:00
series: [
{
name: '库龄',
type: 'pie',
radius: '50%',
data: data,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
});
}
2026-02-04 15:28:28 +08:00
// 仓库使用率数据图表
2026-01-20 16:56:01 +08:00
const getChartInventoryReview = (data) => {
let xAxisData = []
let totalData = []
let usedData = []
let freeData = []
2026-02-03 11:40:02 +08:00
data.forEach(item => {
xAxisData.push(item.cangkuName)
totalData.push(item.totalSlot)
usedData.push(item.usedSlot)
freeData.push(item.unusedSlot)
2026-01-20 16:56:01 +08:00
})
var chartDom = document.getElementById('echartsInventoryReview');
var myChart = echarts.init(chartDom);
myChart.setOption({
// title: {
// text: 'World Population'
// },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
// bottom: '8%',
},
legend: {},
2026-02-04 15:28:28 +08:00
color: colorList.value,
2026-01-20 16:56:01 +08:00
yAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
xAxis: {
type: 'category',
data: xAxisData,
axisLabel: {
2026-02-04 15:28:28 +08:00
rotate: 30,
2026-01-20 16:56:01 +08:00
},
},
series: [
{
name: '总库位',
type: 'bar',
data: totalData
},
{
name: '已使用',
type: 'bar',
data: usedData
},
{
name: '未使用',
type: 'bar',
data: freeData
}
]
});
}
2026-02-04 15:28:28 +08:00
// 当前入库类型统计图表
2026-01-20 16:56:01 +08:00
const getChartInStorage = (data, id) => {
let xAxisData = []
let projectData = []
let totalData = []
let priceData = []
data.forEach(item => {
xAxisData.push(item.groupName)
2026-02-04 15:28:28 +08:00
xAxisData.push(item.groupName)
projectData.push(item.projectCount) //项目数
totalData.push(item.totalQuantity) //总数量
priceData.push(item.totalAmount)//总金额
2026-01-20 16:56:01 +08:00
})
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
grid: {
// bottom: '8%',
},
legend: {
// data: ['项目数', '条目数', '总金额']
},
2026-02-04 15:28:28 +08:00
color: colorList.value,
2026-01-20 16:56:01 +08:00
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
2026-02-04 15:28:28 +08:00
rotate: 30,
2026-01-20 16:56:01 +08:00
},
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
// min: 0,
// max: 250,
// interval: 50,
axisLabel: {
formatter: '{value} 个'
},
// splitLine: {
// // 调整纵坐标网格线样式,比如设为虚线、浅色
// show: true,
// lineStyle: {
// color: '#eee', // 浅色,降低存在感
// type: 'dashed' // 虚线
// }
// }
},
{
type: 'value',
name: '金额',
// min: 0,
// max: 25,
// interval: 5,
axisLabel: {
formatter: '{value} 元'
},
// splitLine: {
// show: true,
// lineStyle: {
// color: '#eee',
// type: 'dashed'
// }
// }
}
],
series: [
{
name: '项目数',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: projectData
},
{
name: '总数量',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: totalData
},
{
name: '总金额',
type: 'bar',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' 元';
}
},
data: priceData
}
]
});
}
2026-02-04 15:28:28 +08:00
// 物资类型统计图表
2026-01-20 16:56:01 +08:00
const getChartGoodsType = (data) => {
let xAxisData = []
let projectData = []
let totalData = []
let priceData = []
data.forEach(item => {
2026-02-04 15:28:28 +08:00
xAxisData.push(item.groupName)
projectData.push(item.projectCount) //项目数
totalData.push(item.totalQuantity) //总数量
priceData.push(item.totalAmount)//总金额
2026-01-20 16:56:01 +08:00
})
var chartDom = document.getElementById("echartsGoodsType");
var myChart = echarts.init(chartDom);
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
grid: {
// bottom: '8%',
},
legend: {
// data: ['项目数', '条目数', '总金额']
},
2026-02-04 15:28:28 +08:00
color: colorList.value,
2026-01-20 16:56:01 +08:00
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
2026-02-04 15:28:28 +08:00
rotate: 30,
2026-01-20 16:56:01 +08:00
},
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
// min: 0,
// max: 250,
// interval: 50,
axisLabel: {
formatter: '{value} 个'
},
// splitLine: {
// // 调整纵坐标网格线样式,比如设为虚线、浅色
// show: true,
// lineStyle: {
// color: '#eee', // 浅色,降低存在感
// type: 'dashed' // 虚线
// }
// }
},
{
type: 'value',
name: '金额',
// min: 0,
// max: 25,
// interval: 5,
axisLabel: {
formatter: '{value} 元'
},
// splitLine: {
// show: true,
// lineStyle: {
// color: '#eee',
// type: 'dashed'
// }
// }
}
],
series: [
{
name: '项目数',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: projectData
},
2026-02-04 15:28:28 +08:00
// {
// name: '条目数',
// type: 'bar',
// tooltip: {
// valueFormatter: function (value) {
// return value + ' 个';
// }
// },
// data: itemData
// },
2026-01-20 16:56:01 +08:00
{
name: '总数量',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: totalData
},
{
name: '总金额',
type: 'bar',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' 元';
}
},
data: priceData
}
]
});
}
2026-02-04 15:28:28 +08:00
// 入库类型统计/出库类型统计图表
2026-01-20 16:56:01 +08:00
const getChartInventoryType = (data, id) => {
let xAxisData = []
let projectData = []
let totalData = []
let itemData = []
let priceData = []
data.forEach(item => {
2026-02-04 15:28:28 +08:00
xAxisData.push(item.groupName)
projectData.push(item.projectCount) //项目数
totalData.push(item.totalQuantity) //总数量
priceData.push(item.totalAmount)//总金额
2026-01-20 16:56:01 +08:00
})
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
grid: {
// bottom: '8%',
},
2026-02-04 15:28:28 +08:00
color: colorList.value,
2026-01-20 16:56:01 +08:00
legend: {
// data: ['项目数', '条目数', '总金额']
},
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
2026-02-04 15:28:28 +08:00
rotate: 30,
2026-01-20 16:56:01 +08:00
},
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
// min: 0,
// max: 250,
// interval: 50,
axisLabel: {
formatter: '{value} 个'
},
// splitLine: {
// // 调整纵坐标网格线样式,比如设为虚线、浅色
// show: true,
// lineStyle: {
// color: '#eee', // 浅色,降低存在感
// type: 'dashed' // 虚线
// }
// }
},
{
type: 'value',
name: '金额',
// min: 0,
// max: 25,
// interval: 5,
axisLabel: {
formatter: '{value} 元'
},
// splitLine: {
// show: true,
// lineStyle: {
// color: '#eee',
// type: 'dashed'
// }
// }
}
],
series: [
{
name: '项目数',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: projectData
},
{
name: '总数量',
type: 'bar',
tooltip: {
valueFormatter: function (value) {
return value + ' 个';
}
},
data: totalData
},
{
name: '总金额',
type: 'bar',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' 元';
}
},
data: priceData
}
]
});
}
</script>
<style scoped lang="scss">
2026-02-04 15:28:28 +08:00
.dashboard {
2026-01-20 16:56:01 +08:00
// position: absolute;
// top: 0;
// bottom: 0;
// left: 0;
// right: 0;
// display: flex;
// flex-direction: column;
background-color: #F5F5F5;
padding: 32rpx;
2026-02-04 15:28:28 +08:00
2026-02-05 08:30:36 +08:00
.itemBox {
display: flex;
justify-content: space-between;
margin-top: 8px;
}
.inOrOutBox {
padding: 20px;
border-radius: 8px;
display: flex;
justify-content: space-between;
align-items: center;
.inOrOutBox_left {
width: 60%;
}
.inOrOutBox_icon {
img {
width: 80px;
height: 80px;
opacity: 0.3;
}
}
}
2026-02-04 15:28:28 +08:00
.boxNum {
height: 100px;
2026-01-20 16:56:01 +08:00
width: 100%;
border-radius: 8px;
color: #FFFFFF;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 0 20px;
2026-02-04 15:28:28 +08:00
.boxNum_icon {
2026-01-20 16:56:01 +08:00
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-top: 10px;
}
}
2026-02-04 15:28:28 +08:00
.titleBox {
2026-01-20 16:56:01 +08:00
display: flex;
align-items: center;
2026-02-04 15:28:28 +08:00
2026-01-20 16:56:01 +08:00
.line {
width: 6px;
height: 15px;
background: #199793;
border-radius: 12px 12px 12px 12px;
transform: rotateX(360deg);
}
2026-02-04 15:28:28 +08:00
.name {
2026-02-05 08:30:36 +08:00
width: 100%;
2026-01-20 16:56:01 +08:00
margin-left: 8px;
display: flex;
align-items: center;
2026-02-05 08:30:36 +08:00
justify-content: space-between;
2026-01-20 16:56:01 +08:00
height: 28px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 20px;
color: #333333;
line-height: 23px;
text-align: left;
font-style: normal;
text-transform: none;
}
}
2026-02-04 15:28:28 +08:00
.main {
2026-01-20 16:56:01 +08:00
background-color: #FFFFFF;
padding: 20px;
box-shadow: 0px 4px 12px 0px rgba(255, 223, 217, 0.2);
border-radius: 6px;
height: 360px;
2026-02-04 15:28:28 +08:00
.main_progress {
2026-01-20 16:56:01 +08:00
margin-top: 20px;
margin-bottom: 8px;
}
2026-02-04 15:28:28 +08:00
.main_box {
2026-01-20 16:56:01 +08:00
width: 88%;
height: 110px;
cursor: pointer;
margin-top: 25px;
2026-02-04 15:28:28 +08:00
background: #E2F1FE;
2026-01-20 16:56:01 +08:00
border-radius: 4px;
display: flex;
justify-content: center;
text-align: center;
flex-direction: column;
}
2026-02-04 15:28:28 +08:00
.warningBox {
2026-01-20 16:56:01 +08:00
border-radius: 8px;
border: #fecaca 1px solid;
height: 100%;
color: #F87777;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
font-size: 24px;
}
}
2026-02-04 15:28:28 +08:00
.echartsMain {
2026-01-20 16:56:01 +08:00
background-color: #FFFFFF;
height: 100%;
border-radius: 6px;
padding: 20px;
display: flex;
flex-direction: column;
2026-02-04 15:28:28 +08:00
.echartsBox {
2026-01-20 16:56:01 +08:00
flex: 1;
}
}
}
</style>