|
|
@@ -15,7 +15,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
<v-chart
|
|
|
- ref="pieRef2"
|
|
|
+ ref="option1"
|
|
|
style="height: 100%"
|
|
|
:option="teamQualifiedOption"
|
|
|
/>
|
|
|
@@ -32,14 +32,16 @@
|
|
|
<span>质检次数</span>
|
|
|
<div class="time">
|
|
|
<el-date-picker
|
|
|
- v-model="value2"
|
|
|
+ v-model="value1"
|
|
|
type="month"
|
|
|
placeholder="选择月"
|
|
|
+ value-format="yyyy-MM"
|
|
|
+ @change="handleValue1Change"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <v-chart ref="pieRef4" style="height: 100%" :option="preOptions" />
|
|
|
+ <v-chart ref="pieRef1" style="height: 100%" :option="preOptions1" />
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -52,11 +54,7 @@
|
|
|
>
|
|
|
<span>时率</span>
|
|
|
</div>
|
|
|
- <v-chart
|
|
|
- ref="pieRef2"
|
|
|
- style="height: 100%"
|
|
|
- :option="teamQualifiedOption"
|
|
|
- />
|
|
|
+ <v-chart ref="pieRef2" style="height: 100%" :option="preOptions2" />
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -73,28 +71,36 @@
|
|
|
v-model="value2"
|
|
|
type="year"
|
|
|
placeholder="选择年"
|
|
|
+ value-format="yyyy"
|
|
|
+ @change="handleValue2Change"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <v-chart ref="lineRef" style="height: 100%" :option="lineOption" />
|
|
|
+ <v-chart ref="lineRef1" 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" style="display: flex; align-items: center">
|
|
|
+ <div
|
|
|
+ slot="header"
|
|
|
+ class="clearfix"
|
|
|
+ style="display: flex; align-items: center"
|
|
|
+ >
|
|
|
<span>时率趋势图</span>
|
|
|
<div class="time">
|
|
|
<el-date-picker
|
|
|
- v-model="value2"
|
|
|
+ v-model="value3"
|
|
|
type="year"
|
|
|
placeholder="选择年"
|
|
|
+ value-format="yyyy"
|
|
|
+ @change="handleValue3Change"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <v-chart ref="lineRef" style="height: 100%" :option="lineOption" />
|
|
|
+ <v-chart ref="lineRef2" style="height: 100%" :option="lineOption1" />
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -103,21 +109,14 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- queryHomePage,
|
|
|
- queryFactory,
|
|
|
- queryTeam,
|
|
|
- queryProductionLine,
|
|
|
- queryProportionDefectiveTypes
|
|
|
+ queryFactoryYx,
|
|
|
+ inspectionFrequencyYx,
|
|
|
+ queryPassrateYx,
|
|
|
+ queryFrequencyAnnualYx,
|
|
|
+ queryFrequencyMonthlyYx
|
|
|
} from '@/api/main';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
- import {
|
|
|
- userList,
|
|
|
- unacceptedProduct,
|
|
|
- lineOption,
|
|
|
- preOption,
|
|
|
- barOption,
|
|
|
- preOptions
|
|
|
- } from './data';
|
|
|
+ import { barOption, preOptions, lineOption, preOptions1 } from './data';
|
|
|
import { use } from 'echarts/core';
|
|
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
|
import { BarChart, PieChart, LineChart } from 'echarts/charts';
|
|
|
@@ -126,10 +125,9 @@
|
|
|
TooltipComponent,
|
|
|
LegendComponent
|
|
|
} from 'echarts/components';
|
|
|
- import EleChart from 'ele-admin/packages/ele-chart';
|
|
|
-
|
|
|
import VChart from 'vue-echarts';
|
|
|
import { echartsMixin } from '@/utils/echarts-mixin';
|
|
|
+ import dayjs from 'dayjs';
|
|
|
// 按需加载 echarts
|
|
|
use([
|
|
|
CanvasRenderer,
|
|
|
@@ -143,7 +141,7 @@
|
|
|
export default {
|
|
|
mixins: [
|
|
|
dictMixins,
|
|
|
- echartsMixin(['pieRef1', 'pieRef2', 'pieRef3', 'pieRef4', 'lineRef'])
|
|
|
+ echartsMixin(['option1', 'pieRef2', 'lineRef1', 'lineRef2', 'pieRef1'])
|
|
|
],
|
|
|
components: { VChart },
|
|
|
data() {
|
|
|
@@ -151,15 +149,18 @@
|
|
|
factoryTimeType: '3',
|
|
|
teamTimeType: '3',
|
|
|
lineTimeType: '3',
|
|
|
-
|
|
|
+ value1: dayjs().format('YYYY-MM'),
|
|
|
+ value4: dayjs().format('YYYY-MM'),
|
|
|
+ value2: dayjs().format('YYYY'),
|
|
|
+ value3: dayjs().format('YYYY'),
|
|
|
// 图表配置
|
|
|
+ preOptions1: {},
|
|
|
+ preOptions2: {},
|
|
|
teamQualifiedOption: {},
|
|
|
factoryQualifiedOption: {},
|
|
|
- lineQualifiedOption: {},
|
|
|
- preOption: {},
|
|
|
- barOption: {},
|
|
|
+ factoryQualifiedOption1: {},
|
|
|
lineOption: {},
|
|
|
- preOptions: {},
|
|
|
+ lineOption1: {},
|
|
|
|
|
|
form: {
|
|
|
finishTime: '',
|
|
|
@@ -167,138 +168,99 @@
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- userList: () => userList,
|
|
|
- unacceptedProduct: () => unacceptedProduct
|
|
|
- },
|
|
|
|
|
|
mounted() {
|
|
|
- this.queryHomePage();
|
|
|
this.queryFactory();
|
|
|
- this.queryTeam();
|
|
|
+ this.queryFactory1();
|
|
|
this.queryProductionLine();
|
|
|
this.proportion();
|
|
|
+ this.queryProductionLine1();
|
|
|
|
|
|
setTimeout(() => {
|
|
|
- this.$refs.pieRef1.resize();
|
|
|
+ this.$refs.option1.resize();
|
|
|
this.$refs.pieRef2.resize();
|
|
|
- this.$refs.pieRef3.resize();
|
|
|
- this.$refs.pieRef4.resize();
|
|
|
- this.$refs.lineRef.resize();
|
|
|
+ this.$refs.lineRef1.resize();
|
|
|
+ this.$refs.lineRef2.resize();
|
|
|
+ this.$refs.pieRef1.resize();
|
|
|
}, 300);
|
|
|
},
|
|
|
methods: {
|
|
|
- timeTypeChange() {
|
|
|
- this.queryHomePage();
|
|
|
- },
|
|
|
-
|
|
|
- handleFactoryTimeChange() {
|
|
|
- this.queryFactory();
|
|
|
+ handleValue1Change() {
|
|
|
+ // value1 改变时请求质检次数相关数据
|
|
|
+ this.proportion();
|
|
|
},
|
|
|
|
|
|
- handleTeamTimeChange() {
|
|
|
- this.queryTeam();
|
|
|
+ handleValue2Change() {
|
|
|
+ // value2 改变时请求合格率趋势图
|
|
|
+ this.queryProductionLine();
|
|
|
},
|
|
|
|
|
|
- handleLineTimeChange() {
|
|
|
- this.queryProductionLine();
|
|
|
+ handleValue3Change() {
|
|
|
+ // value3 改变时请求时率趋势图
|
|
|
+ this.queryProductionLine1();
|
|
|
},
|
|
|
|
|
|
async queryFactory() {
|
|
|
- const data = await queryFactory({
|
|
|
- timeType: this.factoryTimeType
|
|
|
- });
|
|
|
- this.factoryQualifiedOption = preOption(
|
|
|
+ const data = await queryFactoryYx();
|
|
|
+ this.teamQualifiedOption = barOption(
|
|
|
data.map((item) => {
|
|
|
return { value: item.qualificationRate, name: item.factoryName };
|
|
|
- }),
|
|
|
- '70%',
|
|
|
- false,
|
|
|
- 'inside'
|
|
|
+ })
|
|
|
);
|
|
|
},
|
|
|
-
|
|
|
- async proportion() {
|
|
|
- const res = await queryProportionDefectiveTypes();
|
|
|
+ async queryFactory1() {
|
|
|
+ const res = await queryFrequencyMonthlyYx({ date: this.value4 });
|
|
|
let list = res.map((el) => {
|
|
|
return {
|
|
|
- value: el.unQualifiedNumber,
|
|
|
- name: el.categoryLevelClassName
|
|
|
+ value: el.data,
|
|
|
+ name: el.name
|
|
|
};
|
|
|
});
|
|
|
- this.preOptions = preOptions(list);
|
|
|
+ this.preOptions2 = preOptions1(list);
|
|
|
},
|
|
|
-
|
|
|
- async queryTeam() {
|
|
|
- console.log(this.teamTimeType);
|
|
|
- const data = await queryTeam({
|
|
|
- timeType: this.teamTimeType
|
|
|
+ async proportion() {
|
|
|
+ const res = await inspectionFrequencyYx({ date: this.value1 });
|
|
|
+ let list = res.map((el) => {
|
|
|
+ return {
|
|
|
+ value: el.value,
|
|
|
+ name: el.name
|
|
|
+ };
|
|
|
});
|
|
|
- this.teamQualifiedOption = barOption(
|
|
|
- data.map((item) => {
|
|
|
- return { value: item.qualificationRate, name: item.teamName };
|
|
|
- })
|
|
|
- );
|
|
|
+ this.preOptions1 = preOptions(list);
|
|
|
},
|
|
|
|
|
|
async queryProductionLine() {
|
|
|
- const data = await queryProductionLine({
|
|
|
- timeType: this.lineTimeType
|
|
|
+ const data = await queryPassrateYx({
|
|
|
+ date: this.value2
|
|
|
});
|
|
|
- this.lineQualifiedOption = barOption(
|
|
|
+ console.log(data, 'data');
|
|
|
+ this.lineOption = lineOption(
|
|
|
data.map((item) => {
|
|
|
return {
|
|
|
- value: item.qualificationRate,
|
|
|
- name: item.productionLineName
|
|
|
+ name: item.name,
|
|
|
+ data: item.data,
|
|
|
+ type: 'line',
|
|
|
+ smooth: true // 开启平滑曲线
|
|
|
};
|
|
|
}),
|
|
|
- {
|
|
|
- normal: {
|
|
|
- barBorderRadius: 30,
|
|
|
- color: EleChart.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
- {
|
|
|
- offset: 0,
|
|
|
- color: '#00feff'
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 0.5,
|
|
|
- color: '#027eff'
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: '#0286ff'
|
|
|
- }
|
|
|
- ])
|
|
|
- }
|
|
|
- }
|
|
|
+ 1
|
|
|
);
|
|
|
},
|
|
|
-
|
|
|
- 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) => {
|
|
|
+ async queryProductionLine1() {
|
|
|
+ const data = await queryFrequencyAnnualYx({
|
|
|
+ date: this.value3
|
|
|
+ });
|
|
|
+ this.lineOption1 = lineOption(
|
|
|
+ data.map((item) => {
|
|
|
return {
|
|
|
- name: item.productName,
|
|
|
- data: item.listQualificationRate,
|
|
|
+ name: item.name,
|
|
|
+ data: item.data,
|
|
|
type: 'line',
|
|
|
smooth: true // 开启平滑曲线
|
|
|
};
|
|
|
}),
|
|
|
- this.form.timeType
|
|
|
+ 1
|
|
|
);
|
|
|
- },
|
|
|
-
|
|
|
- datasource({ page, where, limit }) {
|
|
|
- return getList({
|
|
|
- ...where,
|
|
|
- pageNum: page,
|
|
|
- size: limit
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
};
|