| | |
| | | <template> |
| | | <div class="dashboard-container"> |
| | | <!-- ç»è®¡å¡ç --> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="6"> |
| | | <el-card class="statistics-card" shadow="hover"> |
| | | <div class="card-content"> |
| | | <div class="card-title">设å¤å¨çº¿ç</div> |
| | | <div class="card-value">{{ onlineRate }}%</div> |
| | | <div class="card-desc"> |
| | | å½åå¨çº¿è®¾å¤æ°ï¼{{ onlineCount }} / {{ totalDevices }} |
| | | <div class="dashboard"> |
| | | <!-- 顶鍿¨ªå两æ --> |
| | | <div class="dashboard-top"> |
| | | <!-- å·¦ï¼ä¼ä¸ä¿¡æ¯+ä¸å¤§æ°æ®å¡çï¼ä¸ä¸æåï¼ --> |
| | | <div class="top-left"> |
| | | <div class="company-info"> |
| | | <div class="section-title">ç»éä¿¡æ¯</div> |
| | | <div style="display: flex;align-items: center;gap: 20px"> |
| | | <img :src="userStore.avatar" class="avatar" alt=""/> |
| | | <div class="company-card"> |
| | | <div class="company-name">{{userStore.name}}</div> |
| | | <div class="company-meta">{{userStore.roleName}}</div> |
| | | </div> |
| | | <div style="display: flex;align-items: center;gap: 8px"> |
| | | <el-icon color="#5053B5" size="22"><Clock /></el-icon> |
| | | <span>ç»éæ¥æï¼{{userStore.currentLoginTime}}</span> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card class="statistics-card" shadow="hover"> |
| | | <div class="card-content"> |
| | | <div class="card-title">æ
éé¢è¦æ°</div> |
| | | <div class="card-value">{{ warningCount }}</div> |
| | | <div class="card-desc"> |
| | | é«é£é©ï¼{{ highRiskCount }} | ä¸é£é©ï¼{{ mediumRiskCount }} | |
| | | ä½é£é©ï¼{{ lowRiskCount }} |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card class="statistics-card" shadow="hover"> |
| | | <div class="card-content"> |
| | | <div class="card-title">å¾
å¤çç»´ä¿®å</div> |
| | | <div class="card-value">{{ pendingOrders }}</div> |
| | | <div class="card-desc"> |
| | | å¤çä¸ï¼{{ processingOrders }} | 已宿ï¼{{ completedOrders }} |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card class="statistics-card" shadow="hover"> |
| | | <div class="card-content"> |
| | | <div class="card-title">éç¹è®¾å¤è¿è¡ç¶æ</div> |
| | | <div class="card-value">{{ normalDevices }} æ£å¸¸</div> |
| | | <div class="card-desc"> |
| | | å¼å¸¸ï¼{{ abnormalDevices }} | æ
éï¼{{ faultDevices }} |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- å¾è¡¨åºå --> |
| | | <el-row :gutter="20" style="margin-top: 20px"> |
| | | <!-- 设å¤å¥åº·åº¦è¶å¿å¾ --> |
| | | <el-col :span="12"> |
| | | <el-card shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>设å¤å¥åº·åº¦è¶å¿å¾</span> |
| | | </div> |
| | | </template> |
| | | <div ref="healthChartRef" class="chart-container"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <!-- è¿7æ¥æ
éç±»åç»è®¡ --> |
| | | <el-col :span="12"> |
| | | <el-card shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>è¿7æ¥æ
éç±»åç»è®¡</span> |
| | | </div> |
| | | </template> |
| | | <div ref="faultChartRef" class="chart-container"></div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- éç¹è®¾å¤è¿è¡ç¶æå¡ç --> |
| | | <el-card shadow="hover" style="margin-top: 20px"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>éç¹è®¾å¤è¿è¡ç¶æ</span> |
| | | </div> |
| | | </template> |
| | | <el-table :data="keyDevices" stripe style="width: 100%"> |
| | | <el-table-column |
| | | prop="name" |
| | | label="设å¤åç§°" |
| | | width="180" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="model" |
| | | label="åå·" |
| | | width="120" |
| | | ></el-table-column> |
| | | <el-table-column prop="ip" label="IPå°å" width="150"></el-table-column> |
| | | <el-table-column prop="status" label="ç¶æ" width="100"> |
| | | <template #default="scope"> |
| | | <el-tag |
| | | :type=" |
| | | scope.row.status === 'online' |
| | | ? 'success' |
| | | : scope.row.status === 'warning' |
| | | ? 'warning' |
| | | : 'danger' |
| | | " |
| | | > |
| | | {{ |
| | | scope.row.status === "online" |
| | | ? "å¨çº¿" |
| | | : scope.row.status === "warning" |
| | | ? "é¢è¦" |
| | | : "æ
é" |
| | | }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="temperature" |
| | | label="温度(â)" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="pressure" |
| | | label="åå(MPa)" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="speed" |
| | | label="转é(rpm)" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column prop="health" label="å¥åº·åº¦" width="120"> |
| | | <template #default="scope"> |
| | | <el-progress |
| | | :percentage="scope.row.health" |
| | | :stroke-width="10" |
| | | ></el-progress> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-card> |
| | | <!-- <div class="data-cards">--> |
| | | <!-- <div class="data-card sales">--> |
| | | <!-- <div class="data-title">é宿°æ®</div>--> |
| | | <!-- <div class="data-num">--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">æ¬æéå®é¢/å
</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.monthSaleMoney}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">æªå¼ç¥¨éé¢/å
</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.monthSaleHaveMoney}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- --> |
| | | <!-- </div>--> |
| | | <!-- <div class="data-card purchase">--> |
| | | <!-- <div class="data-title">éè´æ°æ®</div>--> |
| | | <!-- <div class="data-num">--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">æ¬æéè´é¢/å
</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.monthPurchaseMoney}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">å¾
仿¬¾éé¢/å
</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.monthPurchaseHaveMoney}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="data-card inventory">--> |
| | | <!-- <div class="data-title">åºåæ°æ®</div>--> |
| | | <!-- <div class="data-num">--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">å½ååºåæ»é/ä»¶</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.inventoryNum}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- <div>--> |
| | | <!-- <div class="data-desc">仿¥å
¥åº/ä»¶</div>--> |
| | | <!-- <div class="data-value">{{businessInfo.todayInventoryNum}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | <!-- å³ï¼å¾
åäºé¡¹ --> |
| | | <!-- <div class="todo-panel">--> |
| | | <!-- <div class="section-title">å¾
åäºé¡¹</div>--> |
| | | <!-- <ul class="todo-list" v-if="todoList.length > 0">--> |
| | | <!-- <li v-for="item in todoList" :key="item.id">--> |
| | | <!-- <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 20px">--> |
| | | <!-- <div style="display: flex;justify-content: space-between;align-items: center;">--> |
| | | <!-- <div class="todo-title">æµç¨ç¼å·ï¼{{item.approveId}}</div>--> |
| | | <!-- <div class="todo-division">ç³è¯·é¨é¨ï¼{{item.approveDeptName}}</div>--> |
| | | <!-- <div class="todo-time">{{item.approveTime}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="todo-division">审æ¹äºç±ï¼{{item.approveReason}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- </li>--> |
| | | <!-- </ul>--> |
| | | <!-- <div v-else style="text-align: center">--> |
| | | <!-- ææ æ°æ®--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- --> |
| | | <!-- <!– ä¸é¨æ¨ªåä¸¤æ –>--> |
| | | <!-- <div class="dashboard-row">--> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div class="section-title">客æ·ååéé¢åæ</div>--> |
| | | <!-- <div class="contract-summary">--> |
| | | <!-- <div class="contract-info">--> |
| | | <!-- <img src="../assets/images/khtitle.png" alt="" style="width: 42px"/>--> |
| | | <!-- <div class="contract-card">--> |
| | | <!-- <div class="contract-name">æ»ååéé¢(å
)</div>--> |
| | | <!-- <div class="contract-meta">--> |
| | | <!-- <div class="main-amount">{{sum}}</div>--> |
| | | <!-- <div>å¨åæ¯: <span class="up">{{yny}}% </span> æ¥ç¯æ¯: <span class="up">{{chain}}% </span></div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 180px;margin-top: 20px">--> |
| | | <!-- <div>--> |
| | | <!-- <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie"--> |
| | | <!-- :series="materialPieSeries"--> |
| | | <!-- :tooltip="pieTooltip"></Echarts>--> |
| | | <!-- </div>--> |
| | | <!-- <ul class="contract-list">--> |
| | | <!-- <li v-for="item in materialPieSeries[0].data" :key="item.name">--> |
| | | <!-- <div style="display: flex;align-items: center;justify-content: space-between;width: 100%">--> |
| | | <!-- <div class="line" :style="{color: item.itemStyle.color}">â{{item.name}}</div>--> |
| | | <!-- <div style="width: 70px">{{item.rate}}%</div>--> |
| | | <!-- <div>ï¿¥{{item.value}}</div>--> |
| | | <!-- </div>--> |
| | | <!-- </li>--> |
| | | <!-- </ul>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div style="display: flex;justify-content: space-between;">--> |
| | | <!-- <div class="section-title">åºæ¶åºä»ç»è®¡</div>--> |
| | | <!--<!– <el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">–>--> |
| | | <!--<!– <el-radio-button label="æå¨" :value="1" />–>--> |
| | | <!--<!– <el-radio-button label="ææ" :value="2" />–>--> |
| | | <!--<!– <el-radio-button label="æå£åº¦" :value="3" />–>--> |
| | | <!--<!– </el-radio-group>–>--> |
| | | <!-- </div>--> |
| | | <!-- <Echarts ref="chart"--> |
| | | <!-- :color="barColors2"--> |
| | | <!-- :chartStyle="chartStyle"--> |
| | | <!-- :grid="grid"--> |
| | | <!-- :series="barSeries"--> |
| | | <!-- :tooltip="tooltip"--> |
| | | <!-- :xAxis="xAxis"--> |
| | | <!-- :yAxis="yAxis"--> |
| | | <!-- style="height: 260px"></Echarts>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <!-- åºé¨æ¨ªå两æ --> |
| | | <!-- <div class="dashboard-row">--> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div class="section-title">è´¨éç»è®¡</div>--> |
| | | <!-- <div class="quality-cards">--> |
| | | <!-- <div class="quality-card one">åææå·²æ£æµæ° <span>{{qualityStatisticsObject.supplierNum}}ä»¶</span></div>--> |
| | | <!-- <div class="quality-card two">è¿ç¨æ£éªæ°é <span>{{qualityStatisticsObject.processNum}}ä»¶</span></div>--> |
| | | <!-- <div class="quality-card three">åºåå·²æ£æ°é <span>{{qualityStatisticsObject.factoryNum}}ä»¶</span></div>--> |
| | | <!-- </div>--> |
| | | <!-- <Echarts ref="chart"--> |
| | | <!-- :chartStyle="chartStyle"--> |
| | | <!-- :grid="grid"--> |
| | | <!-- :legend="barLegend"--> |
| | | <!-- :series="barSeries1"--> |
| | | <!-- :tooltip="tooltip"--> |
| | | <!-- :xAxis="xAxis1"--> |
| | | <!-- :yAxis="yAxis1"--> |
| | | <!-- style="height: 260px"></Echarts>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div class="section-title">忬¾ä¸å¼ç¥¨åæ</div>--> |
| | | <!-- <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries"--> |
| | | <!-- :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;"></Echarts>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, onUnmounted } from "vue"; |
| | | import * as echarts from "echarts"; |
| | | import { ref, onMounted } from 'vue' |
| | | import Echarts from "@/components/Echarts/echarts.vue"; |
| | | import * as echarts from 'echarts'; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { |
| | | analysisCustomerContractAmounts, getAmountHalfYear, |
| | | getBusiness, |
| | | homeTodos, |
| | | qualityStatistics, |
| | | statisticsReceivablePayable |
| | | } from "@/api/viewIndex.js"; |
| | | |
| | | // ç»è®¡æ°æ® |
| | | const onlineRate = ref(85); |
| | | const onlineCount = ref(170); |
| | | const totalDevices = ref(200); |
| | | const warningCount = ref(23); |
| | | const highRiskCount = ref(5); |
| | | const mediumRiskCount = ref(12); |
| | | const lowRiskCount = ref(6); |
| | | const pendingOrders = ref(15); |
| | | const processingOrders = ref(8); |
| | | const completedOrders = ref(45); |
| | | const normalDevices = ref(162); |
| | | const abnormalDevices = ref(18); |
| | | const faultDevices = ref(10); |
| | | const userStore = useUserStore() |
| | | |
| | | // éç¹è®¾å¤å表 |
| | | const keyDevices = ref([ |
| | | const businessInfo = ref({ |
| | | inventoryNum: 0, |
| | | monthPurchaseHaveMoney: 0, |
| | | monthPurchaseMoney: 0, |
| | | monthSaleHaveMoney: 0, |
| | | monthSaleMoney: 0, |
| | | todayInventoryNum: 0, |
| | | }) |
| | | const qualityStatisticsObject = ref({ |
| | | supplierNum: 0, |
| | | processNum: 0, |
| | | factoryNum: 0, |
| | | }) |
| | | const sum = ref(0) |
| | | const yny = ref(0) |
| | | const chain = ref(0) |
| | | |
| | | const pieLegend = reactive({ |
| | | show: false, |
| | | }) |
| | | const barSeries = ref([ |
| | | { |
| | | name: "ç©ºåæºA-001", |
| | | model: "KA-200", |
| | | ip: "192.168.1.101", |
| | | status: "online", |
| | | temperature: 42, |
| | | pressure: 0.8, |
| | | speed: 1450, |
| | | health: 92, |
| | | type: 'bar', |
| | | data: [], |
| | | label: { |
| | | show: true, |
| | | } |
| | | }, |
| | | ]) |
| | | const barSeries1 = ref([ |
| | | { |
| | | name: 'åææä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | barGap: 0, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: "å·å´å¡B-002", |
| | | model: "CT-300", |
| | | ip: "192.168.1.102", |
| | | status: "warning", |
| | | temperature: 58, |
| | | pressure: 0.6, |
| | | speed: 980, |
| | | health: 75, |
| | | name: 'è¿ç¨ä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | { |
| | | name: "æ°´æ³µC-003", |
| | | model: "WP-150", |
| | | ip: "192.168.1.103", |
| | | status: "online", |
| | | temperature: 38, |
| | | pressure: 1.2, |
| | | speed: 1200, |
| | | health: 88, |
| | | name: 'åºåä¸åæ ¼æ°', |
| | | type: 'bar', |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | data: [] |
| | | }, |
| | | ]) |
| | | const chartStyle = { |
| | | width: '100%', |
| | | height: '100%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | } |
| | | const chartStylePie = { |
| | | width: '140%', |
| | | height: '140%' // 设置å¾è¡¨å®¹å¨çé«åº¦ |
| | | } |
| | | const grid = { |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true |
| | | } |
| | | const barLegend = { |
| | | show: true, |
| | | data: ['åææä¸åæ ¼æ°', 'è¿ç¨ä¸åæ ¼æ°', 'åºåä¸åæ ¼æ°'] |
| | | } |
| | | const barLegend1 = { |
| | | show: true, |
| | | data: ['é¢ä»è´¦æ¬¾', 'åºä»è´¦æ¬¾', '颿¶è´¦æ¬¾', 'åºæ¶è´¦æ¬¾'] |
| | | } |
| | | const lineLegend = { |
| | | show: true, |
| | | data: ['å¼ç¥¨', '忬¾'] |
| | | } |
| | | const tooltip = { |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | } |
| | | } |
| | | const xAxis = [{ |
| | | type: 'value', |
| | | }] |
| | | const xAxis1 = ref([{ |
| | | type: 'category', |
| | | axisTick: { show: false }, |
| | | data: [] |
| | | }]) |
| | | const yAxis = [{ |
| | | type: 'category', |
| | | data: [ 'åºä»è´¦æ¬¾', 'åºæ¶è´¦æ¬¾',] |
| | | }] |
| | | const yAxis1 = [{ |
| | | type: 'value' |
| | | }] |
| | | const pieTooltip = reactive({ |
| | | trigger: 'item', |
| | | formatter: function (params) { |
| | | // å¨æçææç¤ºä¿¡æ¯ï¼åºäºæ°æ®é¡¹ç name 屿§ |
| | | const description = params.name === 'æ¬æåæ¬¾éé¢' ? 'æ¬æåæ¬¾éé¢' : 'åºæ¶æ¬¾éé¢'; |
| | | return `${description} ${formatNumber(params.value)}å
${params.percent}%`; |
| | | }, |
| | | position: 'right' |
| | | }) |
| | | const materialPieSeries = ref([ |
| | | { |
| | | name: "åçµæºD-004", |
| | | model: "GE-500", |
| | | ip: "192.168.1.104", |
| | | status: "danger", |
| | | temperature: 75, |
| | | pressure: 0.5, |
| | | speed: 1500, |
| | | health: 60, |
| | | }, |
| | | type: 'pie', |
| | | radius: ['66%', '90%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderColor: '#fff', |
| | | borderWidth: 2 |
| | | }, |
| | | label: { |
| | | show: false |
| | | }, |
| | | data: [] |
| | | } |
| | | ]) |
| | | const lineSeries = ref([ |
| | | { |
| | | name: "ååå¨E-005", |
| | | model: "TR-1000", |
| | | ip: "192.168.1.105", |
| | | status: "online", |
| | | temperature: 45, |
| | | pressure: 0, |
| | | speed: 0, |
| | | health: 95, |
| | | type: 'line', |
| | | data: [], |
| | | label: { |
| | | show: true |
| | | }, |
| | | showSymbol: true, // æ¾ç¤ºåç¹ |
| | | }, |
| | | ]); |
| | | ]) |
| | | const tooltipLine = { |
| | | trigger: 'axis', |
| | | } |
| | | const yAxis2 = ref([ |
| | | { |
| | | type: 'value', |
| | | } |
| | | ]) |
| | | const xAxis2 = ref([ |
| | | { |
| | | type: 'category', |
| | | data: [], |
| | | axisLabel: { |
| | | interval: 0, |
| | | formatter: function(value) { |
| | | return value.replace(/~/g, '\n'); |
| | | }, |
| | | } |
| | | } |
| | | ]) |
| | | |
| | | // å¾
åäºé¡¹ |
| | | const todoList = ref([]) |
| | | const radio1 = ref(1) |
| | | |
| | | // å¾è¡¨å¼ç¨ |
| | | const healthChartRef = ref(null); |
| | | const faultChartRef = ref(null); |
| | | let healthChart = null; |
| | | let faultChart = null; |
| | | const barChart = ref(null) |
| | | const lineChart = ref(null) |
| | | const barColors2 = ['#5181DB', '#D369E0', '#F2CA6D', '#60CCA8'] |
| | | |
| | | // å¥åº·åº¦è¶å¿æ°æ® |
| | | const healthTrendData = { |
| | | dates: ["12-10", "12-11", "12-12", "12-13", "12-14", "12-15", "12-16"], |
| | | values: [88, 90, 85, 87, 92, 91, 93], |
| | | }; |
| | | |
| | | // æ
éç±»åç»è®¡æ°æ® |
| | | const faultTypeData = { |
| | | types: ["温度å¼å¸¸", "ååè¶
æ ", "转éå¼å¸¸", "æ¯å¨è¿å¤§", "å
¶ä»"], |
| | | values: [15, 8, 12, 6, 3], |
| | | }; |
| | | |
| | | // åå§åå¥åº·åº¦è¶å¿å¾ |
| | | const initHealthChart = () => { |
| | | if (healthChartRef.value) { |
| | | healthChart = echarts.init(healthChartRef.value); |
| | | const option = { |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "cross", |
| | | label: { |
| | | backgroundColor: "#6a7985", |
| | | }, |
| | | }, |
| | | }, |
| | | grid: { |
| | | left: "3%", |
| | | right: "4%", |
| | | bottom: "3%", |
| | | containLabel: true, |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | boundaryGap: false, |
| | | data: healthTrendData.dates, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | | min: 70, |
| | | max: 100, |
| | | name: "å¥åº·åº¦(%)", |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "å¥åº·åº¦", |
| | | type: "line", |
| | | stack: "æ»é", |
| | | areaStyle: {}, |
| | | emphasis: { |
| | | focus: "series", |
| | | }, |
| | | data: healthTrendData.values, |
| | | itemStyle: { |
| | | color: "#67c23a", |
| | | }, |
| | | lineStyle: { |
| | | width: 3, |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
| | | healthChart.setOption(option); |
| | | } |
| | | }; |
| | | |
| | | // åå§åæ
éç±»åç»è®¡é¥¼å¾ |
| | | const initFaultChart = () => { |
| | | if (faultChartRef.value) { |
| | | faultChart = echarts.init(faultChartRef.value); |
| | | const option = { |
| | | tooltip: { |
| | | trigger: "item", |
| | | }, |
| | | legend: { |
| | | orient: "vertical", |
| | | left: "left", |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ
éç±»å", |
| | | type: "pie", |
| | | radius: "50%", |
| | | data: faultTypeData.types.map((type, index) => ({ |
| | | name: type, |
| | | value: faultTypeData.values[index], |
| | | })), |
| | | emphasis: { |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowOffsetX: 0, |
| | | shadowColor: "rgba(0, 0, 0, 0.5)", |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
| | | faultChart.setOption(option); |
| | | } |
| | | }; |
| | | |
| | | // çå¬çªå£å¤§å°ååï¼è°æ´å¾è¡¨å¤§å° |
| | | const handleResize = () => { |
| | | healthChart?.resize(); |
| | | faultChart?.resize(); |
| | | }; |
| | | // éæºé¢è²çæå½æ° |
| | | const getRandomColor = () => { |
| | | return '#' + Math.floor(Math.random() * 0xffffff).toString(16).padStart(6, '0'); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | initHealthChart(); |
| | | initFaultChart(); |
| | | window.addEventListener("resize", handleResize); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | window.removeEventListener("resize", handleResize); |
| | | healthChart?.dispose(); |
| | | faultChart?.dispose(); |
| | | }); |
| | | getBusinessData() |
| | | analysisCustomer() |
| | | todoInfoS() |
| | | statisticsReceivable() |
| | | qualityStatisticsInfo() |
| | | getAmountHalfYearNum() |
| | | }) |
| | | // æ°æ®ç»è®¡ |
| | | const getBusinessData = () => { |
| | | getBusiness().then((res) => { |
| | | businessInfo.value = {...res.data} |
| | | }) |
| | | } |
| | | // ååéé¢ |
| | | const analysisCustomer = () => { |
| | | analysisCustomerContractAmounts().then((res) => { |
| | | sum.value = res.data.sum |
| | | yny.value = res.data.yny |
| | | chain.value = res.data.chain |
| | | // 为æ¯ä¸ªæ°æ®é¡¹åé
éæºé¢è² |
| | | materialPieSeries.value[0].data = res.data.item.map(item => ({ |
| | | ...item, |
| | | itemStyle: { color: getRandomColor() } |
| | | })) |
| | | }) |
| | | } |
| | | // å¾
åäºé¡¹ |
| | | const todoInfoS = () => { |
| | | homeTodos().then((res) => { |
| | | todoList.value = res.data |
| | | }) |
| | | } |
| | | // åºä»åºæ¶ç»è®¡ |
| | | const statisticsReceivable = (type) => { |
| | | console.log(type) |
| | | statisticsReceivablePayable({type: radio1.value}).then((res) => { |
| | | barSeries.value[0].data = [ |
| | | // { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } }, |
| | | { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } }, |
| | | // { value: res.data.advanceMoney, itemStyle: { color: barColors2[2] } }, |
| | | { value: res.data.receivableMoney, itemStyle: { color: barColors2[1] } } |
| | | ] |
| | | }) |
| | | } |
| | | // è´¨æ£ç»è®¡ |
| | | const qualityStatisticsInfo = () => { |
| | | qualityStatistics().then((res) => { |
| | | res.data.item.forEach(item => { |
| | | xAxis1.value[0].data.push(item.date) |
| | | barSeries1.value[0].data.push(item.supplierNum) |
| | | barSeries1.value[1].data.push(item.processNum) |
| | | barSeries1.value[2].data.push(item.factoryNum) |
| | | }) |
| | | qualityStatisticsObject.value.supplierNum = res.data.supplierNum |
| | | qualityStatisticsObject.value.processNum = res.data.processNum |
| | | qualityStatisticsObject.value.factoryNum = res.data.factoryNum |
| | | }) |
| | | } |
| | | const getAmountHalfYearNum = async () => { |
| | | const res = await getAmountHalfYear() |
| | | console.log(res) |
| | | const monthName = [] |
| | | const receiptAmount = [] |
| | | const invoiceAmount = [] |
| | | res.data.forEach(item => { |
| | | monthName.push(item.month) |
| | | receiptAmount.push(item.receiptAmount) |
| | | invoiceAmount.push(item.invoiceAmount) |
| | | }) |
| | | // æ£ç¡®ååºå¼èµå¼ï¼å建æ°ç xAxis å series 对象 |
| | | xAxis2.value[0].data = monthName |
| | | xAxis2.value[0].data = monthName.map(item => item.replace(/~/g, '\n~')); |
| | | lineSeries.value = [ |
| | | { |
| | | name: 'å¼ç¥¨', |
| | | type: 'line', |
| | | data: receiptAmount, |
| | | stack: 'Total', |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(131, 207, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(186, 228, 255, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | itemStyle: { |
| | | color: '#2D99FF', |
| | | borderColor: '#2D99FF' |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | showSymbol: true, |
| | | }, |
| | | { |
| | | name: '忬¾', |
| | | type: 'line', |
| | | data: invoiceAmount, |
| | | stack: 'Total', |
| | | lineStyle: { |
| | | width: 0 |
| | | }, |
| | | itemStyle: { |
| | | color: '#83CFFF', |
| | | borderColor: '#83CFFF' |
| | | }, |
| | | showSymbol: true, |
| | | areaStyle: { |
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | { |
| | | offset: 0, |
| | | color: 'rgba(54, 153, 255, 1)' |
| | | }, |
| | | { |
| | | offset: 1, |
| | | color: 'rgba(89, 169, 254, 1)' |
| | | } |
| | | ]) |
| | | }, |
| | | emphasis: { |
| | | focus: 'series' |
| | | }, |
| | | } |
| | | ] |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dashboard-container { |
| | | padding: 20px; |
| | | background-color: #f5f7fa; |
| | | .dashboard { |
| | | background: #f5f7fa; |
| | | min-height: 100vh; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .statistics-card { |
| | | height: 180px; |
| | | .dashboard-top { |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .card-content { |
| | | .company-info { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100%; |
| | | justify-content: center; |
| | | align-items: center; |
| | | gap: 8px; |
| | | padding: 20px; |
| | | min-width: 0; |
| | | background-color: #EFF2FB; /* ä½¿ç¨æå®çèæ¯é¢è² */ |
| | | background-image: url("../assets/images/denglu.png"); |
| | | background-size: 100% 260%; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | border-radius: 12px; |
| | | height: 138px; |
| | | } |
| | | .avatar { |
| | | width: 60px; |
| | | height: 60px; |
| | | border-radius: 50%; |
| | | object-fit: contain; |
| | | background: #fff; |
| | | border: 1px solid #eee; |
| | | } |
| | | .company-card { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | position: relative; |
| | | padding-right: 15px; |
| | | } |
| | | |
| | | .card-title { |
| | | .company-card::after { |
| | | content: ''; |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | bottom: 0; |
| | | width: 1px; |
| | | background-color: #C9C5C5; |
| | | border-radius: 2px; |
| | | } |
| | | .company-name { |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | color: #606266; |
| | | margin-bottom: 10px; |
| | | color: #161A9A; |
| | | } |
| | | |
| | | .card-value { |
| | | font-size: 32px; |
| | | font-weight: bold; |
| | | color: #303133; |
| | | margin-bottom: 8px; |
| | | .company-meta { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #818185; |
| | | } |
| | | |
| | | .card-desc { |
| | | font-size: 14px; |
| | | color: #909399; |
| | | .data-cards { |
| | | display: flex; |
| | | gap: 16px; |
| | | justify-content: flex-start; |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .card-header { |
| | | .data-title { |
| | | font-weight: 700; |
| | | font-size: 26px; |
| | | color: #FFFFFF; |
| | | } |
| | | .data-num { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-top: 20px; |
| | | } |
| | | .data-card { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 14px 10px 10px 10px; |
| | | min-width: 160px; |
| | | box-shadow: 0 2px 8px #eee; |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 32%; |
| | | height: 140px; |
| | | } |
| | | .data-card.sales { |
| | | background-image: url("../assets/images/xioashoushuju.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | .data-card.purchase { |
| | | background-image: url("../assets/images/caigou.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | .data-card.inventory { |
| | | background-image: url("../assets/images/kucun.png"); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | .data-desc { |
| | | font-weight: 500; |
| | | font-size: 13px; |
| | | color: #FFFFFF; |
| | | } |
| | | .data-value { |
| | | font-size: 18px; |
| | | font-weight: 500; |
| | | margin: 10px 0; |
| | | color: #FFFFFF; |
| | | } |
| | | .top-left { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20px; |
| | | width: 50%; |
| | | } |
| | | .todo-panel { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | width: 50%; |
| | | } |
| | | .todo-list { |
| | | list-style: none; |
| | | padding: 0; |
| | | margin: 0; |
| | | font-size: 15px; |
| | | overflow-y: auto; |
| | | height: 260px; |
| | | } |
| | | .todo-list li { |
| | | border-radius: 8px; |
| | | margin-bottom: 12px; |
| | | padding: 8px 20px; |
| | | height: 74px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background: rgba(225,227,250,0.62); |
| | | } |
| | | .todo-title { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | position: relative; |
| | | } |
| | | .todo-title::before { |
| | | content: ''; /* å¿
éï¼è¡¨ç¤ºè¿éæä¸ä¸ªå
容 */ |
| | | position: absolute; |
| | | left: -10px; /* å®ä½å°å·¦ä¾§ */ |
| | | top: 50%; /* åç´å±
ä¸ */ |
| | | transform: translateY(-50%); /* å¾®è°åç´å±
ä¸ */ |
| | | width: 6px; /* åçç´å¾ */ |
| | | height: 6px; /* åçç´å¾ */ |
| | | background: #498CEB; |
| | | border-radius: 50%; /* 让å
¶åæåå½¢ */ |
| | | } |
| | | .todo-division { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | } |
| | | .todo-time { |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: #000000; |
| | | } |
| | | .todo-meta { |
| | | color: #888; |
| | | font-size: 13px; |
| | | } |
| | | .dashboard-row { |
| | | display: flex; |
| | | gap: 20px; |
| | | margin-bottom: 20px; |
| | | } |
| | | .main-panel { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | flex: 1; |
| | | min-width: 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | .section-title { |
| | | position: relative; |
| | | font-size: 18px; |
| | | color: #333; |
| | | padding-left: 10px; |
| | | margin-bottom: 10px; |
| | | font-weight: 700; |
| | | } |
| | | |
| | | .chart-container { |
| | | .section-title::before { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 4px; |
| | | content: ''; |
| | | width: 4px; |
| | | height: 18px; |
| | | background-color: #002FA7; |
| | | border-radius: 2px; |
| | | } |
| | | .contract-info { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 20px; |
| | | height: 90px; |
| | | background: rgba(245,245,245,0.59); |
| | | width: 100%; |
| | | height: 350px; |
| | | border-radius: 10px; |
| | | padding: 10px 30px; |
| | | } |
| | | .contract-summary { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 30px; |
| | | } |
| | | .contract-card { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | } |
| | | .contract-name { |
| | | font-weight: 400; |
| | | font-size: 14px; |
| | | color: #050505; |
| | | } |
| | | .contract-meta { |
| | | display: flex; |
| | | align-items: center; |
| | | width: 100%; |
| | | gap: 80px; |
| | | } |
| | | .main-amount { |
| | | font-size: 24px; |
| | | color: rgba(51,50,50,0.85); |
| | | } |
| | | .up { color: #e57373; } |
| | | .contract-list { |
| | | margin-top: 16px; |
| | | font-size: 14px; |
| | | color: #666; |
| | | list-style: none; |
| | | padding: 0; |
| | | height: 190px; |
| | | overflow-y: auto; |
| | | width: 460px; |
| | | } |
| | | .line { |
| | | position: relative; |
| | | width: 230px; |
| | | } |
| | | .line::after { |
| | | content: ''; |
| | | position: absolute; |
| | | right: 2px; |
| | | top: 0; |
| | | bottom: 0; |
| | | width: 1px; |
| | | background-color: #C9C5C5; |
| | | border-radius: 2px; |
| | | } |
| | | .contract-list li { |
| | | margin-top: 10px; |
| | | } |
| | | .quality-cards { |
| | | display: flex; |
| | | gap: 12px; |
| | | margin-bottom: 12px; |
| | | } |
| | | .quality-card { |
| | | border-radius: 8px; |
| | | padding: 15px 10px 10px 50px; |
| | | font-weight: 400; |
| | | font-size: 12px; |
| | | color: rgba(0,0,0,0.67); |
| | | width: 236px; |
| | | height: 49px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | } |
| | | .quality-card.one { |
| | | background-image: url("../assets/images/yuancailiao.png"); |
| | | } |
| | | .quality-card.two { |
| | | background-image: url("../assets/images/guocheng.png"); |
| | | } |
| | | .quality-card.three { |
| | | background-image: url("../assets/images/chuchang.png"); |
| | | |
| | | } |
| | | .quality-card span { |
| | | color: #4fc3f7; |
| | | font-weight: bold; |
| | | margin-left: 6px; |
| | | } |
| | | .chart { |
| | | width: 100%; |
| | | height: 220px; |
| | | margin-top: 10px; |
| | | } |
| | | </style> |