|
|
@@ -0,0 +1,296 @@
|
|
|
+<template>
|
|
|
+ <div class="ele-body">
|
|
|
+ <el-row :gutter="15">
|
|
|
+ <el-col :span="8" style="height: 40%">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>工厂合格率</span>
|
|
|
+ </div>
|
|
|
+ <v-chart
|
|
|
+ ref="pieRef1"
|
|
|
+ style="height: 100%"
|
|
|
+ :option="factoryQualifiedOption"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="height: 40%">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>班组合格率</span>
|
|
|
+ </div>
|
|
|
+ <v-chart
|
|
|
+ ref="pieRef2"
|
|
|
+ style="height: 100%"
|
|
|
+ :option="teamQualifiedOption"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="height: 40%">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>产线合格率</span>
|
|
|
+ </div>
|
|
|
+ <v-chart
|
|
|
+ ref="pieRef3"
|
|
|
+ style="height: 100%"
|
|
|
+ :option="lineQualifiedOption"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <!-- <el-col :span="8" style="height: 40%">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>人员合格率</span>
|
|
|
+ </div>
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="userList"
|
|
|
+ :datasource="datasource"
|
|
|
+ :toolbar="false"
|
|
|
+ :needPage="false"
|
|
|
+ height="100%"
|
|
|
+ >
|
|
|
+
|
|
|
+
|
|
|
+ <template v-slot:qualified="{ row }">
|
|
|
+ <el-progress
|
|
|
+ :text-inside="true"
|
|
|
+ :stroke-width="24"
|
|
|
+ :percentage="80"
|
|
|
+ text-color="#fff"
|
|
|
+ color="#398e4e"
|
|
|
+ ></el-progress>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-card>
|
|
|
+ </el-col> -->
|
|
|
+ <el-col :span="12" style="margin-top: 15px; height: calc(60% - 15px)">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div
|
|
|
+ slot="header"
|
|
|
+ class="clearfix"
|
|
|
+ style="display: flex; align-items: center"
|
|
|
+ >
|
|
|
+ <span>产品合格率</span>
|
|
|
+ <div style="margin-left: 15px">
|
|
|
+ <el-radio-group
|
|
|
+ style="margin-right: 15px"
|
|
|
+ v-model="form.timeType"
|
|
|
+ @change="timeTypeChange"
|
|
|
+ >
|
|
|
+ <el-radio-button label="3">本周</el-radio-button>
|
|
|
+ <el-radio-button label="2">本月</el-radio-button>
|
|
|
+ <el-radio-button label="1">本年</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ 自定义时间:
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 140px"
|
|
|
+ v-model="form.finishTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ ></el-date-picker>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <v-chart ref="lineRef" style="height: 100%" :option="lineOption" />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top: 15px; height: calc(60% - 15px)">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>不良类型占比</span>
|
|
|
+ </div>
|
|
|
+ <v-chart ref="pieRef4" style="height: 100%" :option="preOption" />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ queryHomePage,
|
|
|
+ queryFactory,
|
|
|
+ queryTeam,
|
|
|
+ queryProductionLine
|
|
|
+} from '@/api/main';
|
|
|
+import dictMixins from '@/mixins/dictMixins';
|
|
|
+import {
|
|
|
+ userList,
|
|
|
+ unacceptedProduct,
|
|
|
+ lineOption,
|
|
|
+ preOption,
|
|
|
+ barOption
|
|
|
+} from './data';
|
|
|
+import { use } from 'echarts/core';
|
|
|
+import { CanvasRenderer } from 'echarts/renderers';
|
|
|
+import { BarChart, PieChart, LineChart } from 'echarts/charts';
|
|
|
+import {
|
|
|
+ GridComponent,
|
|
|
+ TooltipComponent,
|
|
|
+ LegendComponent
|
|
|
+} from 'echarts/components';
|
|
|
+import EleChart from 'ele-admin/packages/ele-chart';
|
|
|
+
|
|
|
+import VChart from 'vue-echarts';
|
|
|
+import { echartsMixin } from '@/utils/echarts-mixin';
|
|
|
+// 按需加载 echarts
|
|
|
+use([
|
|
|
+ CanvasRenderer,
|
|
|
+ BarChart,
|
|
|
+ PieChart,
|
|
|
+ GridComponent,
|
|
|
+ TooltipComponent,
|
|
|
+ LegendComponent,
|
|
|
+ LineChart
|
|
|
+]);
|
|
|
+export default {
|
|
|
+ mixins: [
|
|
|
+ dictMixins,
|
|
|
+ echartsMixin(['pieRef1', 'pieRef2', 'pieRef3', 'pieRef4', 'lineRef'])
|
|
|
+ ],
|
|
|
+ components: { VChart },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ teamQualifiedOption: {},
|
|
|
+ factoryQualifiedOption: {},
|
|
|
+ lineQualifiedOption: {},
|
|
|
+ preOption: {},
|
|
|
+ barOption: {},
|
|
|
+ lineOption: {},
|
|
|
+ form: {
|
|
|
+ finishTime: '',
|
|
|
+ timeType: '1'
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ userList: () => userList,
|
|
|
+ unacceptedProduct: () => unacceptedProduct
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ this.preOption = preOption([
|
|
|
+ { value: 40, name: ' 开线' },
|
|
|
+ { value: 30, name: ' 缺口' },
|
|
|
+ { value: 15, name: ' 色差' },
|
|
|
+ { value: 10, name: ' 损坏' },
|
|
|
+ { value: 5, name: ' 污渍' }
|
|
|
+ ]);
|
|
|
+
|
|
|
+ this.queryHomePage();
|
|
|
+ this.queryFactory();
|
|
|
+ this.queryTeam();
|
|
|
+ this.queryProductionLine();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ timeTypeChange() {
|
|
|
+ this.queryHomePage();
|
|
|
+ },
|
|
|
+ async queryFactory() {
|
|
|
+ const data = await queryFactory();
|
|
|
+ this.factoryQualifiedOption = preOption(
|
|
|
+ data.map((item) => {
|
|
|
+ return { value: item.qualificationRate, name: item.factoryName };
|
|
|
+ }),
|
|
|
+ '70%',
|
|
|
+ false,
|
|
|
+ 'inside'
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async queryTeam() {
|
|
|
+ const data = await queryTeam();
|
|
|
+ this.teamQualifiedOption = barOption(
|
|
|
+ data.map((item) => {
|
|
|
+ return { value: item.qualificationRate, name: item.teamName };
|
|
|
+ })
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async queryProductionLine() {
|
|
|
+ const data = await queryProductionLine();
|
|
|
+ (this.lineQualifiedOption = barOption(
|
|
|
+ data.map((item) => {
|
|
|
+ return { value: item.qualificationRate, name: item.productionLineName };
|
|
|
+ }),
|
|
|
+ {
|
|
|
+ normal: {
|
|
|
+ barBorderRadius: 30,
|
|
|
+ color: EleChart.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#00feff'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: '#027eff'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: '#0286ff'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ))
|
|
|
+ },
|
|
|
+ async queryHomePage() {
|
|
|
+ const data = await queryHomePage(this.form);
|
|
|
+ let values = [];
|
|
|
+ for (let key in data) {
|
|
|
+ values.push(data[key]);
|
|
|
+ }
|
|
|
+ this.lineOption = lineOption(
|
|
|
+ values.map((item) => {
|
|
|
+ return {
|
|
|
+ name: item.productName,
|
|
|
+ data: item.listQualificationRate,
|
|
|
+ type: 'line'
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ this.form.timeType
|
|
|
+ );
|
|
|
+ // console.log(values)
|
|
|
+ },
|
|
|
+ datasource({ page, where, limit }) {
|
|
|
+ return getList({
|
|
|
+ ...where,
|
|
|
+ pageNum: page,
|
|
|
+ size: limit
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.clearfix {
|
|
|
+ font-size: 0.7vw;
|
|
|
+
|
|
|
+ > span {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ :deep(.el-radio-button__inner) {
|
|
|
+ font-size: 0.7vw;
|
|
|
+ }
|
|
|
+}
|
|
|
+.ele-body {
|
|
|
+ height: calc(100vh - 126px);
|
|
|
+ > .el-row {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .el-card {
|
|
|
+ height: 100%;
|
|
|
+ :deep(.el-card__body) {
|
|
|
+ padding: 0.3vw;
|
|
|
+ }
|
|
|
+ :deep(.el-card__header) {
|
|
|
+ padding: 0.8vw;
|
|
|
+ }
|
|
|
+ :deep(.el-card__body) {
|
|
|
+ height: calc(100% - 1.6vw - 39px);
|
|
|
+ }
|
|
|
+ :deep(.ele-pro-table) {
|
|
|
+ height: 99%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+
|