469 lines
13 KiB
Vue
469 lines
13 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<!-- <div class="blue-title">生产节拍时序图</div> -->
|
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
|
|
|
<!-- 列表 -->
|
|
<base-table :max-height="tableH" :table-props="tableProps" :page="1" :limit="20" :table-data="list">
|
|
</base-table>
|
|
<!-- </el-row> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getQualityIsraPage,
|
|
// getQualityIsraDayMap,
|
|
// getQualityIsraWeekMap,
|
|
// getQualityIsraMonthMap,
|
|
// getQualityIsraDayList,
|
|
// getQualityIsraWeekList,
|
|
// getQualityIsraMonthList,
|
|
} from '@/api/monitoring/qualityIsra';
|
|
// import Editor from '@/components/Editor';
|
|
import moment from 'moment';
|
|
// import DialogForm from './dialogForm.vue';
|
|
import * as echarts from 'echarts';
|
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
|
// import { getPdList } from '@/api/base/coreProductionLine';
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
import { getPdList, } from '@/api/core/monitoring/auto';
|
|
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
|
export default {
|
|
name: 'QualityIsra',
|
|
// components: {
|
|
// DialogForm,
|
|
// },
|
|
mixins: [tableHeightMixin],
|
|
data() {
|
|
return {
|
|
isFold: false,
|
|
list: [],
|
|
dynamicProps: [],
|
|
activeName: 'day',
|
|
dayMapUrl: '/extend/check-isra-statistics/dayMap',
|
|
weekMapUrl: '/extend/check-isra-statistics/weekMap',
|
|
monthMapUrl: '/extend/check-isra-statistics/monthMap',
|
|
dayListUrl: '/extend/check-isra-statistics/dayList',
|
|
weekListUrl: '/extend/check-isra-statistics/weekList',
|
|
monthListUrl: '/extend/check-isra-statistics/monthList',
|
|
searchBarFormConfig: [
|
|
{
|
|
type: 'select',
|
|
label: '是否报废',
|
|
placeholder: '请选择是否报废',
|
|
param: 'checkDiscard',
|
|
selectOptions: [
|
|
{ name: '否', id: 0 },
|
|
{ name: '是', id: 1 }
|
|
],
|
|
},
|
|
{
|
|
type: 'select',
|
|
label: '缺陷类型',
|
|
placeholder: '请选择缺陷类型',
|
|
param: 'checkType',
|
|
selectOptions: [],
|
|
labelField: 'name',
|
|
valueField: 'name',
|
|
defaultSelect: [],
|
|
filterable: true
|
|
},
|
|
{
|
|
type: 'select',
|
|
label: '产线',
|
|
selectOptions: [],
|
|
labelField: 'name',
|
|
valueField: 'name',
|
|
param: 'lineName',
|
|
filterable: true,
|
|
defaultSelect: []
|
|
},
|
|
{
|
|
type: 'datePicker',
|
|
label: '时间段',
|
|
dateType: 'datetimerange', // datetimerange
|
|
// format: 'yyyy-MM-dd HH:mm:ss',
|
|
format: 'yyyy-MM-dd HH:mm:ss',
|
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
rangeSeparator: '-',
|
|
startPlaceholder: '开始日期',
|
|
endPlaceholder: '结束日期',
|
|
defaultTime: ['00:00:00', '23:59:59'],
|
|
param: 'checkTime',
|
|
// width: 350,
|
|
},
|
|
{
|
|
type:'button',
|
|
btnName: '查询',
|
|
name: 'search',
|
|
color: 'primary',
|
|
},
|
|
],
|
|
// 查询参数
|
|
queryParams: {
|
|
checkDiscard: undefined,
|
|
checkType:undefined,
|
|
lineName: undefined,
|
|
startTime: undefined,
|
|
endTime: undefined,
|
|
// productionLineId: null,
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
// this.getProductLineList();
|
|
// this.isFold = this.searchBarWidth('QualityIsraBox', 1198);
|
|
},
|
|
computed: {
|
|
tableProps() {
|
|
return [
|
|
{
|
|
// width: 128,
|
|
prop: 'checkType',
|
|
label: '缺陷类型',
|
|
},
|
|
{
|
|
// width: 128,
|
|
prop: 'sumNum',
|
|
label: '缺陷总数',
|
|
},
|
|
...this.dynamicProps,
|
|
];
|
|
},
|
|
},
|
|
mounted() {
|
|
if (this.$route.query.lineName) {
|
|
// console.log('打印看看产线', this.$route.query.lineName)
|
|
this.queryParams.lineName = this.$route.query.lineName
|
|
this.searchBarFormConfig[2].defaultSelect = this.$route.query.lineName
|
|
}
|
|
if (this.$route.query.originalGlassOutputTime) {
|
|
console.log('你好', this.$route.query.originalGlassOutputTime)
|
|
this.queryParams.startTime = parseTime(new Date(Number(this.$route.query.originalGlassOutputTime)))
|
|
this.queryParams.endTime = parseTime(new Date(Number(this.$route.query.originalGlassOutputTime)))
|
|
this.searchBarFormConfig[3].defaultSelect = [
|
|
this.queryParams.startTime,
|
|
this.queryParams.endTime,
|
|
];
|
|
}
|
|
this.getList()
|
|
this.getData()
|
|
this.getDict()
|
|
},
|
|
methods: {
|
|
handleClick() {
|
|
this.getData()
|
|
},
|
|
getData() {
|
|
this.$axios({
|
|
url: this.activeName === 'day' ? this.dayMapUrl : this.activeName === 'week' ? this.weekMapUrl : this.monthMapUrl,
|
|
method: 'get',
|
|
params: this.queryParams
|
|
}).then((res) => {
|
|
let mapArr= []
|
|
let mapLegendData = []
|
|
let obj = {
|
|
name: '',
|
|
type: 'line',
|
|
// stack: 'Total',
|
|
data: [],
|
|
mapXAxisData: [],
|
|
}
|
|
// let mapXAxisData = []
|
|
for (let i in res.data) {
|
|
|
|
// console.log(i)
|
|
let dataArr = []
|
|
res.data[i].forEach(ele => {
|
|
dataArr.push(ele.num)
|
|
obj.mapXAxisData.push(ele.checkTime)
|
|
})
|
|
obj.name = i
|
|
obj.data = dataArr
|
|
mapLegendData.push(i)
|
|
mapArr.push(obj)
|
|
}
|
|
console.log(mapArr);
|
|
// console.log(res.data[res]);
|
|
var chartDom = this.activeName === 'day' ? document.getElementById('mapDayMain') : this.activeName === 'week' ? document.getElementById('mapWeekMain') : document.getElementById('mapMonthMain')
|
|
var myChart = echarts.init(chartDom);
|
|
var option;
|
|
option = {
|
|
title: {
|
|
text: '各类型缺陷对比图',
|
|
// top:'5px'
|
|
},
|
|
tooltip: {
|
|
trigger: 'axis'
|
|
},
|
|
legend: {
|
|
data: mapLegendData,
|
|
top: "10%",
|
|
y: 'top',
|
|
x:'left'
|
|
},
|
|
grid: {
|
|
left: '3%',
|
|
right: '4%',
|
|
bottom: '3%',
|
|
top:'20%',
|
|
containLabel: true
|
|
},
|
|
// toolbox: {
|
|
// feature: {
|
|
// saveAsImage: {}
|
|
// }
|
|
// },
|
|
xAxis: {
|
|
type: 'category',
|
|
// boundaryGap: false,
|
|
data: mapArr[0].mapXAxisData
|
|
},
|
|
yAxis: {
|
|
type: 'value'
|
|
},
|
|
series: mapArr
|
|
}
|
|
myChart.clear()
|
|
option && myChart.setOption(option);
|
|
})
|
|
this.$axios({
|
|
url: this.activeName === 'day' ? this.dayListUrl : this.activeName === 'week' ? this.weekListUrl : this.monthListUrl,
|
|
method: 'get',
|
|
params: this.queryParams
|
|
}).then((res) => {
|
|
// console.log(res);
|
|
let listNumArr = []
|
|
let listRatioArr = []
|
|
// let listLegendData = []
|
|
let listXAxisData = []
|
|
// for (let i in res.data) {
|
|
// console.log(i)
|
|
// let dataArr = []
|
|
res.data.forEach(ele => {;
|
|
listNumArr.push(ele.num)
|
|
listRatioArr.push(ele.ratio)
|
|
listXAxisData.push(ele.checkTime)
|
|
})
|
|
console.log(listNumArr);
|
|
// obj.name = i
|
|
// obj.data = dataArr
|
|
// listLegendData.push(i)
|
|
// listArr.push(obj)
|
|
// }
|
|
// console.log(res.data[res]);
|
|
var chartDom = this.activeName === 'day' ? document.getElementById('listDayMain') : this.activeName === 'week' ? document.getElementById('listWeekMain') : document.getElementById('listMonthMain')
|
|
var myChart = echarts.init(chartDom);
|
|
var option;
|
|
option = {
|
|
title: {
|
|
text: '缺陷率趋势图'
|
|
},
|
|
tooltip: {
|
|
trigger: 'axis'
|
|
},
|
|
legend: {
|
|
data: ['缺陷数量', '缺陷率'],
|
|
},
|
|
grid: {
|
|
left: '3%',
|
|
right: '4%',
|
|
bottom: '3%',
|
|
containLabel: true
|
|
},
|
|
// toolbox: {
|
|
// feature: {
|
|
// saveAsImage: {}
|
|
// }
|
|
// },
|
|
xAxis: {
|
|
type: 'category',
|
|
// boundaryGap: false,
|
|
data: listXAxisData
|
|
},
|
|
yAxis: [
|
|
{
|
|
type: 'value',
|
|
name: '缺陷数量',
|
|
// min: 0,
|
|
// max: 250,
|
|
// interval: 50,
|
|
// axisLabel: {
|
|
// formatter: '{value} ml'
|
|
// }
|
|
},
|
|
{
|
|
type: 'value',
|
|
name: '缺陷率',
|
|
// min: 0,
|
|
// max: 25,
|
|
// interval: 5,
|
|
axisLabel: {
|
|
formatter: '{value} %'
|
|
}
|
|
}
|
|
],
|
|
series: [
|
|
{
|
|
name: '缺陷数量',
|
|
type: 'bar',
|
|
barWidth: '3%',
|
|
data: listNumArr,
|
|
// label: {
|
|
// show: true, //开启显示
|
|
// position: 'top', //在上方显示
|
|
// // formatter: '{c}%',//显示百分号
|
|
// textStyle: { //数值样式
|
|
// color: 'black',//字体颜色
|
|
// fontSize: 12//字体大小
|
|
// }
|
|
// }
|
|
},
|
|
{
|
|
name: '缺陷率',
|
|
type: 'line',
|
|
yAxisIndex: 1,
|
|
tooltip: {
|
|
valueFormatter: function (value) {
|
|
return value + '%';
|
|
}
|
|
},
|
|
data: listRatioArr
|
|
}
|
|
]
|
|
}
|
|
myChart.clear()
|
|
option && myChart.setOption(option);
|
|
})
|
|
},
|
|
/** 获取搜索栏的产线列表 */
|
|
async getDict() {
|
|
// const res = await getProductList()
|
|
// const result = await getWorkOrderList()
|
|
const res = await this.$axios({
|
|
url: '/extend/check-isra-standards/page',
|
|
method: 'get',
|
|
params: {
|
|
pageSize: 100,
|
|
pageNo:1
|
|
}
|
|
});
|
|
// console.log(res)
|
|
this.searchBarFormConfig[1].selectOptions = res.data.list
|
|
await getPdList().then((res) => {
|
|
// console.log(res);
|
|
this.searchBarFormConfig[2].selectOptions = res.data;
|
|
})
|
|
// this.searchBarFormConfig[1].selectOptions = res.data.map((item) => {
|
|
// return {
|
|
// name: item.name,
|
|
// id:item.id
|
|
// }
|
|
// })
|
|
// this.searchBarFormConfig[0].selectOptions = result.data.map((item) => {
|
|
// return {
|
|
// name: item.name,
|
|
// id: item.id
|
|
// }
|
|
// })
|
|
},
|
|
// getProductLineList() {
|
|
// this.$axios('/base/production-line/listAll').then((response) => {
|
|
// this.searchBarFormConfig[0].selectOptions = response.data.map(
|
|
// (item) => {
|
|
// return {
|
|
// name: item.name,
|
|
// id: item.id,
|
|
// };
|
|
// }
|
|
// );
|
|
// });
|
|
// },
|
|
getList() {
|
|
this.getDataList()
|
|
},
|
|
/** 查询列表 */
|
|
async getDataList() {
|
|
console.log('查询条件', this.queryParams);
|
|
this.loading = true;
|
|
// 执行查询
|
|
const {
|
|
data: { data, otherList, otherMap, nameData },
|
|
} = await getQualityIsraPage(this.queryParams)
|
|
console.log(this.queryParams);
|
|
this.dynamicProps = this.filterNameData(nameData)
|
|
this.list = this.filterData(data);
|
|
},
|
|
filterNameData(nameData) {
|
|
const ndSet = new Set();
|
|
nameData.forEach((nd) => {
|
|
ndSet.add(nd.name);
|
|
});
|
|
return Array.from(ndSet.values())
|
|
.sort()
|
|
.map((name) => ({
|
|
prop: name,
|
|
label: name,
|
|
}));
|
|
},
|
|
filterData(data) {
|
|
return data.map((item) => {
|
|
const { data: innerData } = item;
|
|
const keyValuePairs = {};
|
|
innerData.map((d) => {
|
|
keyValuePairs[d.dynamicName] = d.dynamicValue;
|
|
});
|
|
return {
|
|
// inspectionContent: item.inspectionContent,
|
|
...keyValuePairs,
|
|
sumNum: item.sumNum,
|
|
// sumInput: item.sumInput,
|
|
// productionName: item.productionName,
|
|
checkType: item.checkType,
|
|
// scrapRatio: item.scrapRatio,
|
|
};
|
|
});
|
|
},
|
|
/** 取消按钮 */
|
|
handleSearchBarBtnClick(val) {
|
|
console.log('11111', val)
|
|
if (val.btnName === 'search') {
|
|
this.queryParams.checkDiscard = (val?.checkDiscard === 0 || val?.checkDiscard === 1) ? val?.checkDiscard : undefined
|
|
this.queryParams.lineName = val.lineName ? val.lineName : undefined
|
|
this.queryParams.checkType = val.checkType ? val.checkType : undefined
|
|
// this.queryParams.productionId = val.productionId ? val.productionId : undefined
|
|
this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined
|
|
this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined
|
|
|
|
this.getList()
|
|
this.getData()
|
|
}
|
|
console.log(val);
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
.blue-title {
|
|
position: relative;
|
|
padding: 4px 0;
|
|
padding-left: 12px;
|
|
font-size: 14px;
|
|
color: #606266;
|
|
font-weight: 700;
|
|
margin-bottom: 12px;
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: 0;
|
|
top: 6px;
|
|
height: 16px;
|
|
width: 4px;
|
|
border-radius: 1px;
|
|
background: #0b58ff;
|
|
}
|
|
}
|
|
</style>
|