feat: 优化质量查询页面功能
This commit is contained in:
@@ -1,6 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="width: 99%; height: 100%; background-color: #d7dee6; padding: 5px; border: 2px solid #9e9b9b; display: flex; flex-direction: column;">
|
<div
|
||||||
<el-row :gutter="20" style="margin-bottom: 10px; display: flex; align-items: center; flex-shrink: 0;">
|
style="
|
||||||
|
width: 99%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #d7dee6;
|
||||||
|
padding: 5px;
|
||||||
|
border: 2px solid #9e9b9b;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-row
|
||||||
|
:gutter="20"
|
||||||
|
style="
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
"
|
||||||
|
>
|
||||||
<el-col :span="14">
|
<el-col :span="14">
|
||||||
<el-form :inline="true" size="small">
|
<el-form :inline="true" size="small">
|
||||||
<el-form-item label="日期范围:" style="margin-bottom: 0">
|
<el-form-item label="日期范围:" style="margin-bottom: 0">
|
||||||
@@ -15,7 +33,13 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工件:" style="margin-bottom: 0">
|
<el-form-item label="工件:" style="margin-bottom: 0">
|
||||||
<el-select v-model="workpieceId" filterable placeholder="请选择工件" clearable @change="handleWorkpieceChange">
|
<el-select
|
||||||
|
v-model="workpieceId"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择工件"
|
||||||
|
clearable
|
||||||
|
@change="handleWorkpieceChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in workpieceList"
|
v-for="item in workpieceList"
|
||||||
:key="item.工件编号"
|
:key="item.工件编号"
|
||||||
@@ -31,7 +55,7 @@
|
|||||||
<!-- <el-button type="warning" @click="showPhotoDialog">查看照片</el-button> -->
|
<!-- <el-button type="warning" @click="showPhotoDialog">查看照片</el-button> -->
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="flex: 1; width: 100%; margin-top: 10px; min-height: 0;">
|
<el-row style="flex: 1; width: 100%; margin-top: 10px; min-height: 0">
|
||||||
<el-table
|
<el-table
|
||||||
:data="orderCompletion_table1"
|
:data="orderCompletion_table1"
|
||||||
:header-cell-style="{ background: '#F5F5F5', fontSize: '24px' }"
|
:header-cell-style="{ background: '#F5F5F5', fontSize: '24px' }"
|
||||||
@@ -41,7 +65,7 @@
|
|||||||
style="width: 100%; border: 1px solid #9e9b9b"
|
style="width: 100%; border: 1px solid #9e9b9b"
|
||||||
tooltip-effect="dark"
|
tooltip-effect="dark"
|
||||||
>
|
>
|
||||||
<el-table-column align="right" label="序号" type="index" width="80px"/>
|
<el-table-column align="right" label="序号" type="index" width="80px" />
|
||||||
<!--
|
<!--
|
||||||
工位号,
|
工位号,
|
||||||
订单号,
|
订单号,
|
||||||
@@ -78,34 +102,59 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="是否合格">
|
<el-table-column align="center" label="是否合格">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i v-if="scope.row.是否合格"><span style="font-size: x-large;font-weight: 700;color: #67c23a">OK</span></i>
|
<i v-if="scope.row.是否合格"
|
||||||
<i v-else><span style="font-size: x-large;font-weight: 700;color: #ff0000">NG</span></i>
|
><span
|
||||||
|
style="font-size: x-large; font-weight: 700; color: #67c23a"
|
||||||
|
>OK</span
|
||||||
|
></i
|
||||||
|
>
|
||||||
|
<i v-else
|
||||||
|
><span
|
||||||
|
style="font-size: x-large; font-weight: 700; color: #ff0000"
|
||||||
|
>NG</span
|
||||||
|
></i
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="查看">
|
<el-table-column align="center" label="查看">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" style="font-size: large" type="text" @click="choose(scope.row)">
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
style="font-size: large"
|
||||||
|
type="text"
|
||||||
|
@click="choose(scope.row)"
|
||||||
|
>
|
||||||
质量数据
|
质量数据
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div style="height: 5.4%;display: flex;align-items: center;justify-content: center;background-color: #fff;border-radius: 5px;margin: 5px;">
|
<div
|
||||||
|
style="
|
||||||
|
height: 5.4%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 5px;
|
||||||
|
"
|
||||||
|
>
|
||||||
<el-col :span="6" class="totalInfo">
|
<el-col :span="6" class="totalInfo">
|
||||||
<img :src="require('@/assets/image/passOn.png')" width="20px">
|
<img :src="require('@/assets/image/passOn.png')" width="20px" />
|
||||||
<span>过站数量:{{ passCount }}</span>
|
<span>过站数量:{{ passCount }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" class="totalInfo">
|
<el-col :span="6" class="totalInfo">
|
||||||
<img :src="require('@/assets/image/passOK.png')" width="20px">
|
<img :src="require('@/assets/image/passOK.png')" width="20px" />
|
||||||
<span>OK:{{ ok }}</span>
|
<span>OK:{{ ok }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" class="totalInfo">
|
<el-col :span="6" class="totalInfo">
|
||||||
<img :src="require('@/assets/image/passNG.png')" width="20px">
|
<img :src="require('@/assets/image/passNG.png')" width="20px" />
|
||||||
<span>NG:{{ ng }}</span>
|
<span>NG:{{ ng }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" class="totalInfo">
|
<el-col :span="6" class="totalInfo">
|
||||||
<img :src="require('@/assets/image/passRate.png')" width="20px">
|
<img :src="require('@/assets/image/passRate.png')" width="20px" />
|
||||||
<span>合格率:{{ rate }}%</span>
|
<span>合格率:{{ rate }}%</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</div>
|
</div>
|
||||||
@@ -126,18 +175,21 @@
|
|||||||
border
|
border
|
||||||
max-height="365px"
|
max-height="365px"
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 100%; height: 100%; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
|
style="
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #000;
|
||||||
|
border: 1px solid #9e9b9b;
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<el-table-column align="center" label="测量位置" prop="名称"/>
|
<el-table-column align="center" label="测量位置" prop="名称" />
|
||||||
<el-table-column align="center" label="测量项目" prop="测量项目1"/>
|
<el-table-column align="center" label="测量项目" prop="测量项目1" />
|
||||||
<el-table-column align="center" label="测量值" prop="测量项目2"/>
|
<el-table-column align="center" label="测量值" prop="测量项目2" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 10px">
|
<div style="margin-top: 10px">
|
||||||
<el-button
|
<el-button style="width: 100px; height: 40px" @click="cancel()">
|
||||||
style="width: 100px;height: 40px;"
|
|
||||||
@click="cancel()"
|
|
||||||
>
|
|
||||||
关闭
|
关闭
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -158,7 +210,7 @@
|
|||||||
<li
|
<li
|
||||||
v-for="(photo, index) in photoList"
|
v-for="(photo, index) in photoList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{'active-photo': photo.url === currentPhotoUrl}"
|
:class="{ 'active-photo': photo.url === currentPhotoUrl }"
|
||||||
class="photo-list-item"
|
class="photo-list-item"
|
||||||
@click="selectPhoto(photo)"
|
@click="selectPhoto(photo)"
|
||||||
>
|
>
|
||||||
@@ -167,13 +219,17 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="photo-view-container">
|
<div class="photo-view-container">
|
||||||
<img v-if="currentPhotoUrl" :src="currentPhotoUrl" class="photo-image">
|
<img
|
||||||
|
v-if="currentPhotoUrl"
|
||||||
|
:src="currentPhotoUrl"
|
||||||
|
class="photo-image"
|
||||||
|
/>
|
||||||
<div v-else class="no-photo">请从左侧选择一张照片</div>
|
<div v-else class="no-photo">请从左侧选择一张照片</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center; margin-top: 10px">
|
<div style="text-align: center; margin-top: 10px">
|
||||||
<el-button
|
<el-button
|
||||||
style="width: 100px;height: 40px;"
|
style="width: 100px; height: 40px"
|
||||||
@click="photoDialogVisible = false"
|
@click="photoDialogVisible = false"
|
||||||
>
|
>
|
||||||
关闭
|
关闭
|
||||||
@@ -210,10 +266,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="medium" style="padding: 10px 20px; font-size: 14px;" @click="drawCurve">绘制曲线</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="medium"
|
||||||
|
style="padding: 10px 20px; font-size: 14px"
|
||||||
|
@click="drawCurve"
|
||||||
|
>绘制曲线</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div ref="curveChart" style="width: 100%; height: 500px;"/>
|
<div ref="curveChart" style="width: 100%; height: 500px" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="curveDialogVisible = false">关 闭</el-button>
|
<el-button @click="curveDialogVisible = false">关 闭</el-button>
|
||||||
</span>
|
</span>
|
||||||
@@ -222,39 +284,39 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from "echarts";
|
||||||
|
|
||||||
// import { mapGetters } from 'vuex'
|
// import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dateRange: [], // 日期范围
|
dateRange: [], // 日期范围
|
||||||
workpieceId: '', // 工件编号
|
workpieceId: "", // 工件编号
|
||||||
workpieceList: [], // 工件列表
|
workpieceList: [], // 工件列表
|
||||||
photoDialogVisible: false, // 照片查看弹窗
|
photoDialogVisible: false, // 照片查看弹窗
|
||||||
photoList: [], // 照片列表
|
photoList: [], // 照片列表
|
||||||
currentPhotoUrl: '', // 当前查看的照片URL
|
currentPhotoUrl: "", // 当前查看的照片URL
|
||||||
curveDialogVisible: false,
|
curveDialogVisible: false,
|
||||||
curveDateRange: [],
|
curveDateRange: [],
|
||||||
curveTagList: [],
|
curveTagList: [],
|
||||||
curveTagId: '',
|
curveTagId: "",
|
||||||
chartInstance: null,
|
chartInstance: null,
|
||||||
checked: false,
|
checked: false,
|
||||||
Type: [{ label: '', value: '' }],
|
Type: [{ label: "", value: "" }],
|
||||||
count: true,
|
count: true,
|
||||||
text1: '正常生产订单',
|
text1: "正常生产订单",
|
||||||
text2: '无订单生产',
|
text2: "无订单生产",
|
||||||
intdex: true,
|
intdex: true,
|
||||||
xianshou: '',
|
xianshou: "",
|
||||||
orderCompletion_table1: [],
|
orderCompletion_table1: [],
|
||||||
PersonaSex: [],
|
PersonaSex: [],
|
||||||
jixingName: [],
|
jixingName: [],
|
||||||
Sex: [],
|
Sex: [],
|
||||||
title: '',
|
title: "",
|
||||||
publication: {
|
publication: {
|
||||||
topic: '',
|
topic: "",
|
||||||
qos: 0,
|
qos: 0,
|
||||||
payload: ''
|
payload: "",
|
||||||
},
|
},
|
||||||
// 质量数据列表
|
// 质量数据列表
|
||||||
qualityData: [],
|
qualityData: [],
|
||||||
@@ -262,51 +324,62 @@ export default {
|
|||||||
dataRefreshTimer: null,
|
dataRefreshTimer: null,
|
||||||
dialogFormVisible1: false,
|
dialogFormVisible1: false,
|
||||||
form1: {
|
form1: {
|
||||||
订单号: '',
|
订单号: "",
|
||||||
产品型号: '',
|
产品型号: "",
|
||||||
零件号: '',
|
零件号: "",
|
||||||
计划数量: '',
|
计划数量: "",
|
||||||
完成数量: '',
|
完成数量: "",
|
||||||
计划时间: '',
|
计划时间: "",
|
||||||
状态: ''
|
状态: "",
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
排序: [{ required: true, message: '序号为空', trigger: 'change' }],
|
排序: [{ required: true, message: "序号为空", trigger: "change" }],
|
||||||
订单号: [{ required: true, message: '订单号为空', trigger: 'change' }],
|
订单号: [{ required: true, message: "订单号为空", trigger: "change" }],
|
||||||
产品机型: [{ required: true, message: '产品机型为空', trigger: 'change' }],
|
产品机型: [
|
||||||
零件号: [{ required: true, message: '机型代码为空', trigger: 'change' }],
|
{ required: true, message: "产品机型为空", trigger: "change" },
|
||||||
计划数量: [{ required: true, message: '计划数量为空', trigger: 'change' }],
|
],
|
||||||
完成数量: [{ required: true, message: '完成数量为空', trigger: 'change' }],
|
零件号: [
|
||||||
计划时间: [{ required: true, message: '计划时间为空', trigger: 'change' }],
|
{ required: true, message: "机型代码为空", trigger: "change" },
|
||||||
状态: [{ required: true, message: '状态为空', trigger: 'change' }]
|
],
|
||||||
}
|
计划数量: [
|
||||||
}
|
{ required: true, message: "计划数量为空", trigger: "change" },
|
||||||
|
],
|
||||||
|
完成数量: [
|
||||||
|
{ required: true, message: "完成数量为空", trigger: "change" },
|
||||||
|
],
|
||||||
|
计划时间: [
|
||||||
|
{ required: true, message: "计划时间为空", trigger: "change" },
|
||||||
|
],
|
||||||
|
状态: [{ required: true, message: "状态为空", trigger: "change" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.setDefaultDate()
|
this.setDefaultDate();
|
||||||
this.getWorkpieceList()
|
this.getWorkpieceList();
|
||||||
this.startAutoRefresh()
|
this.startAutoRefresh();
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.clearAutoRefresh()
|
this.clearAutoRefresh();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
passCount() {
|
passCount() {
|
||||||
return this.orderCompletion_table1.length
|
return this.orderCompletion_table1.length;
|
||||||
},
|
},
|
||||||
ok() {
|
ok() {
|
||||||
return this.orderCompletion_table1.filter(item => item.是否合格).length
|
return this.orderCompletion_table1.filter((item) => item.是否合格).length;
|
||||||
},
|
},
|
||||||
ng() {
|
ng() {
|
||||||
return this.orderCompletion_table1.filter(item => !item.是否合格).length
|
return this.orderCompletion_table1.filter((item) => !item.是否合格)
|
||||||
|
.length;
|
||||||
},
|
},
|
||||||
rate() {
|
rate() {
|
||||||
if (this.passCount === 0) {
|
if (this.passCount === 0) {
|
||||||
return '0.00'
|
return "0.00";
|
||||||
}
|
|
||||||
const passRate = (this.ok / this.passCount) * 100
|
|
||||||
return passRate.toFixed(2)
|
|
||||||
}
|
}
|
||||||
|
const passRate = (this.ok / this.passCount) * 100;
|
||||||
|
return passRate.toFixed(2);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// watch: {
|
// watch: {
|
||||||
// orderCompletion_table: {
|
// orderCompletion_table: {
|
||||||
@@ -325,259 +398,279 @@ export default {
|
|||||||
// },
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(date) {
|
formatDate(date) {
|
||||||
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
|
return `${date.getFullYear()}-${(date.getMonth() + 1)
|
||||||
|
.toString()
|
||||||
|
.padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`;
|
||||||
},
|
},
|
||||||
setDefaultDate() {
|
setDefaultDate() {
|
||||||
const end = new Date()
|
const end = new Date();
|
||||||
const start = new Date()
|
const start = new Date();
|
||||||
start.setDate(start.getDate() - 7) // 设置开始日期为七天前
|
start.setDate(start.getDate() - 7); // 设置开始日期为七天前
|
||||||
const startDate = this.formatDate(start)
|
const startDate = this.formatDate(start);
|
||||||
const endDate = this.formatDate(end)
|
const endDate = this.formatDate(end);
|
||||||
this.dateRange = [startDate, endDate]
|
this.dateRange = [startDate, endDate];
|
||||||
},
|
},
|
||||||
startAutoRefresh() {
|
startAutoRefresh() {
|
||||||
this.clearAutoRefresh()
|
this.clearAutoRefresh();
|
||||||
this.dateCheckTimer = setInterval(() => {
|
this.dateCheckTimer = setInterval(() => {
|
||||||
this.checkDateRange()
|
this.checkDateRange();
|
||||||
}, 1000 * 60 * 60)
|
}, 1000 * 60 * 60);
|
||||||
this.dataRefreshTimer = setInterval(() => {
|
this.dataRefreshTimer = setInterval(() => {
|
||||||
this.getWorkpieceList()
|
this.getWorkpieceList();
|
||||||
}, 1000 * 60 * 5)
|
}, 1000 * 60 * 5);
|
||||||
},
|
},
|
||||||
clearAutoRefresh() {
|
clearAutoRefresh() {
|
||||||
if (this.dateCheckTimer) {
|
if (this.dateCheckTimer) {
|
||||||
clearInterval(this.dateCheckTimer)
|
clearInterval(this.dateCheckTimer);
|
||||||
this.dateCheckTimer = null
|
this.dateCheckTimer = null;
|
||||||
}
|
}
|
||||||
if (this.dataRefreshTimer) {
|
if (this.dataRefreshTimer) {
|
||||||
clearInterval(this.dataRefreshTimer)
|
clearInterval(this.dataRefreshTimer);
|
||||||
this.dataRefreshTimer = null
|
this.dataRefreshTimer = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkDateRange() {
|
checkDateRange() {
|
||||||
const today = this.formatDate(new Date())
|
const today = this.formatDate(new Date());
|
||||||
if (!this.dateRange || this.dateRange.length !== 2 || this.dateRange[1] !== today) {
|
if (
|
||||||
this.setDefaultDate()
|
!this.dateRange ||
|
||||||
this.getWorkpieceList()
|
this.dateRange.length !== 2 ||
|
||||||
|
this.dateRange[1] !== today
|
||||||
|
) {
|
||||||
|
this.setDefaultDate();
|
||||||
|
this.getWorkpieceList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getWorkpieceList() {
|
getWorkpieceList() {
|
||||||
if (!this.dateRange || this.dateRange.length !== 2) {
|
if (!this.dateRange || this.dateRange.length !== 2) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const param = []
|
const param = [];
|
||||||
param[0] = ['开始日期', this.dateRange[0]]
|
param[0] = ["开始日期", this.dateRange[0]];
|
||||||
param[1] = ['结束日期', this.dateRange[1]]
|
param[1] = ["结束日期", this.dateRange[1]];
|
||||||
param[2] = ['工位号', this.$store.state.station.stationName]
|
param[2] = ["工位号", this.$store.state.station.stationName];
|
||||||
const Data = this.CreateData('11', '测量数据发动机在线状态_时间段机型_查询', param)
|
const Data = this.CreateData(
|
||||||
this.ExecDatabase(Data).then(response => {
|
"11",
|
||||||
this.workpieceList = response.data
|
"测量数据发动机在线状态_时间段机型_查询",
|
||||||
|
param
|
||||||
|
);
|
||||||
|
this.ExecDatabase(Data).then((response) => {
|
||||||
|
this.workpieceList = response.data;
|
||||||
if (this.workpieceList.length > 0) {
|
if (this.workpieceList.length > 0) {
|
||||||
// this.workpieceId = this.workpieceList[0].工件编号
|
// this.workpieceId = this.workpieceList[0].工件编号
|
||||||
this.handleWorkpieceChange()
|
this.handleWorkpieceChange();
|
||||||
} else {
|
} else {
|
||||||
this.workpieceId = ''
|
this.workpieceId = "";
|
||||||
this.orderCompletion_table1 = []
|
this.orderCompletion_table1 = [];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
handleDateChange() {
|
handleDateChange() {
|
||||||
this.getWorkpieceList()
|
this.getWorkpieceList();
|
||||||
},
|
},
|
||||||
handleWorkpieceChange() {
|
handleWorkpieceChange() {
|
||||||
this.getTable()
|
this.getTable();
|
||||||
},
|
},
|
||||||
showPhotoDialog() {
|
showPhotoDialog() {
|
||||||
if (!this.workpieceId) {
|
if (!this.workpieceId) {
|
||||||
this.$message.warning('请先选择一个工件')
|
this.$message.warning("请先选择一个工件");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
// TODO: 需要用户提供获取图片的存储过程
|
// TODO: 需要用户提供获取图片的存储过程
|
||||||
this.$message.info('正在加载图片列表... ')
|
this.$message.info("正在加载图片列表... ");
|
||||||
// 示例数据
|
// 示例数据
|
||||||
this.photoList = [
|
this.photoList = [
|
||||||
{ name: '视觉图片1.jpg', url: '/CreamImg/视觉图片1.jpg' },
|
{ name: "视觉图片1.jpg", url: "/CreamImg/视觉图片1.jpg" },
|
||||||
{ name: '视觉图片2.jpg', url: '/CreamImg/视觉图片2.jpg' }
|
{ name: "视觉图片2.jpg", url: "/CreamImg/视觉图片2.jpg" },
|
||||||
]
|
];
|
||||||
if (this.photoList.length > 0) {
|
if (this.photoList.length > 0) {
|
||||||
this.selectPhoto(this.photoList[0])
|
this.selectPhoto(this.photoList[0]);
|
||||||
} else {
|
} else {
|
||||||
this.currentPhotoUrl = ''
|
this.currentPhotoUrl = "";
|
||||||
}
|
}
|
||||||
this.photoDialogVisible = true
|
this.photoDialogVisible = true;
|
||||||
},
|
},
|
||||||
showCurveDialog() {
|
showCurveDialog() {
|
||||||
this.curveDialogVisible = true
|
this.curveDialogVisible = true;
|
||||||
this.setDefaultCurveDate()
|
this.setDefaultCurveDate();
|
||||||
this.getCurveTagItems()
|
this.getCurveTagItems();
|
||||||
},
|
},
|
||||||
setDefaultCurveDate() {
|
setDefaultCurveDate() {
|
||||||
const end = new Date()
|
const end = new Date();
|
||||||
const start = new Date()
|
const start = new Date();
|
||||||
start.setDate(start.getDate() - 7)
|
start.setDate(start.getDate() - 7);
|
||||||
const startDate = `${start.getFullYear()}-${(start.getMonth() + 1).toString().padStart(2, '0')}-${start.getDate().toString().padStart(2, '0')}`
|
const startDate = `${start.getFullYear()}-${(start.getMonth() + 1)
|
||||||
const endDate = `${end.getFullYear()}-${(end.getMonth() + 1).toString().padStart(2, '0')}-${end.getDate().toString().padStart(2, '0')}`
|
.toString()
|
||||||
this.curveDateRange = [startDate, endDate]
|
.padStart(2, "0")}-${start.getDate().toString().padStart(2, "0")}`;
|
||||||
|
const endDate = `${end.getFullYear()}-${(end.getMonth() + 1)
|
||||||
|
.toString()
|
||||||
|
.padStart(2, "0")}-${end.getDate().toString().padStart(2, "0")}`;
|
||||||
|
this.curveDateRange = [startDate, endDate];
|
||||||
},
|
},
|
||||||
getCurveTagItems() {
|
getCurveTagItems() {
|
||||||
const param = [['工位号', this.$store.state.station.stationName]]
|
const param = [["工位号", this.$store.state.station.stationName]];
|
||||||
const Data = this.CreateData('11', '工位_曲线数据_数据项_查询', param)
|
const Data = this.CreateData("11", "工位_曲线数据_数据项_查询", param);
|
||||||
this.ExecDatabase(Data).then(response => {
|
this.ExecDatabase(Data).then((response) => {
|
||||||
this.curveTagList = response.data
|
this.curveTagList = response.data;
|
||||||
if (this.curveTagList.length > 0) {
|
if (this.curveTagList.length > 0) {
|
||||||
this.curveTagId = this.curveTagList[0].TagID
|
this.curveTagId = this.curveTagList[0].TagID;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
drawCurve() {
|
drawCurve() {
|
||||||
if (!this.curveTagId) {
|
if (!this.curveTagId) {
|
||||||
this.$message.warning('请选择一个测量项目')
|
this.$message.warning("请选择一个测量项目");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (!this.curveDateRange || this.curveDateRange.length !== 2) {
|
if (!this.curveDateRange || this.curveDateRange.length !== 2) {
|
||||||
this.$message.warning('请选择日期范围')
|
this.$message.warning("请选择日期范围");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const param = []
|
const param = [];
|
||||||
param[0] = ['工位号', this.$store.state.station.stationName]
|
param[0] = ["工位号", this.$store.state.station.stationName];
|
||||||
param[1] = ['TagID', this.curveTagId]
|
param[1] = ["TagID", this.curveTagId];
|
||||||
param[2] = ['开始时间', this.curveDateRange[0]]
|
param[2] = ["开始时间", this.curveDateRange[0]];
|
||||||
param[3] = ['结束时间', this.curveDateRange[1]]
|
param[3] = ["结束时间", this.curveDateRange[1]];
|
||||||
|
|
||||||
const Data = this.CreateData('11', '工位_曲线数据_数据_查询', param)
|
const Data = this.CreateData("11", "工位_曲线数据_数据_查询", param);
|
||||||
this.ExecDatabase(Data).then(response => {
|
this.ExecDatabase(Data).then((response) => {
|
||||||
const chartData = response.data
|
const chartData = response.data;
|
||||||
if (chartData.length === 0) {
|
if (chartData.length === 0) {
|
||||||
this.$message.info('该时间段内无数据')
|
this.$message.info("该时间段内无数据");
|
||||||
if (this.chartInstance) {
|
if (this.chartInstance) {
|
||||||
this.chartInstance.clear()
|
this.chartInstance.clear();
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const xAxisData = chartData.map(item => item.操作时间)
|
const xAxisData = chartData.map((item) => item.操作时间);
|
||||||
const seriesData = chartData.map(item => ({
|
const seriesData = chartData.map((item) => ({
|
||||||
value: item.TagValue,
|
value: item.TagValue,
|
||||||
工件编号: item.工件编号,
|
工件编号: item.工件编号,
|
||||||
操作时间: item.操作时间
|
操作时间: item.操作时间,
|
||||||
}))
|
}));
|
||||||
const upperLimit = chartData.length > 0 ? chartData[0].上限值 : null
|
const upperLimit = chartData.length > 0 ? chartData[0].上限值 : null;
|
||||||
const lowerLimit = chartData.length > 0 ? chartData[0].下限值 : null
|
const lowerLimit = chartData.length > 0 ? chartData[0].下限值 : null;
|
||||||
|
|
||||||
const markLineData = []
|
const markLineData = [];
|
||||||
if (upperLimit !== null) {
|
if (upperLimit !== null) {
|
||||||
markLineData.push({
|
markLineData.push({
|
||||||
yAxis: upperLimit,
|
yAxis: upperLimit,
|
||||||
name: '上限值',
|
name: "上限值",
|
||||||
lineStyle: { color: '#ff0000', type: 'dashed' },
|
lineStyle: { color: "#ff0000", type: "dashed" },
|
||||||
label: { formatter: '上限: {c}' }
|
label: { formatter: "上限: {c}" },
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (lowerLimit !== null) {
|
if (lowerLimit !== null) {
|
||||||
markLineData.push({
|
markLineData.push({
|
||||||
yAxis: lowerLimit,
|
yAxis: lowerLimit,
|
||||||
name: '下限值',
|
name: "下限值",
|
||||||
lineStyle: { color: '#67c23a', type: 'dashed' },
|
lineStyle: { color: "#67c23a", type: "dashed" },
|
||||||
label: { formatter: '下限: {c}' }
|
label: { formatter: "下限: {c}" },
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: "axis",
|
||||||
formatter: (params) => {
|
formatter: (params) => {
|
||||||
const data = params[0].data
|
const data = params[0].data;
|
||||||
return `工件编号: ${data.工件编号}<br/>测量时间: ${data.操作时间}<br/>测量值: ${data.value}`
|
return `工件编号: ${data.工件编号}<br/>测量时间: ${data.操作时间}<br/>测量值: ${data.value}`;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: "category",
|
||||||
data: xAxisData
|
data: xAxisData,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: "value",
|
||||||
scale: true
|
scale: true,
|
||||||
},
|
},
|
||||||
series: [{
|
series: [
|
||||||
|
{
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
type: 'line',
|
type: "line",
|
||||||
smooth: true,
|
smooth: true,
|
||||||
markLine: {
|
markLine: {
|
||||||
silent: true,
|
silent: true,
|
||||||
symbol: 'none',
|
symbol: "none",
|
||||||
data: markLineData
|
data: markLineData,
|
||||||
}
|
},
|
||||||
}]
|
},
|
||||||
}
|
],
|
||||||
|
};
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (!this.chartInstance) {
|
if (!this.chartInstance) {
|
||||||
this.chartInstance = echarts.init(this.$refs.curveChart)
|
this.chartInstance = echarts.init(this.$refs.curveChart);
|
||||||
}
|
}
|
||||||
this.chartInstance.setOption(option, true)
|
this.chartInstance.setOption(option, true);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
onCurveDialogClose() {
|
onCurveDialogClose() {
|
||||||
if (this.chartInstance) {
|
if (this.chartInstance) {
|
||||||
this.chartInstance.dispose()
|
this.chartInstance.dispose();
|
||||||
this.chartInstance = null
|
this.chartInstance = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectPhoto(photo) {
|
selectPhoto(photo) {
|
||||||
this.currentPhotoUrl = photo.url
|
this.currentPhotoUrl = photo.url;
|
||||||
},
|
},
|
||||||
tableRowClassName({ row }) {
|
tableRowClassName({ row }) {
|
||||||
if (row.合格标志 == '1') {
|
if (row.合格标志 == "1") {
|
||||||
return 'green'
|
return "green";
|
||||||
} else {
|
} else {
|
||||||
return 'red'
|
return "red";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getQualityData(row) {
|
getQualityData(row) {
|
||||||
const param = []
|
const param = [];
|
||||||
param[0] = ['工位号', this.$store.state.station.stationName]
|
param[0] = ["工位号", this.$store.state.station.stationName];
|
||||||
param[1] = ['发动机号', row.发动机号]
|
param[1] = ["发动机号", row.发动机号];
|
||||||
const Data = this.CreateData('11', '测量数据合格_查询', param)
|
const Data = this.CreateData("11", "测量数据合格_查询", param);
|
||||||
this.ExecDatabase(Data).then(response => {
|
this.ExecDatabase(Data).then((response) => {
|
||||||
this.qualityData = response.data
|
this.qualityData = response.data;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
changeRadio() {
|
changeRadio() {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
this.intdex = false
|
this.intdex = false;
|
||||||
if (this.xianshou === 1) {
|
if (this.xianshou === 1) {
|
||||||
this.count = true
|
this.count = true;
|
||||||
}
|
}
|
||||||
} else if (!this.checked) {
|
} else if (!this.checked) {
|
||||||
this.intdex = true
|
this.intdex = true;
|
||||||
if (this.xianshou === 1) {
|
if (this.xianshou === 1) {
|
||||||
this.count = false
|
this.count = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.dialogFormVisible1 = false
|
this.dialogFormVisible1 = false;
|
||||||
},
|
},
|
||||||
confirm11(form) {
|
confirm11(form) {
|
||||||
const param = []
|
const param = [];
|
||||||
param[0] = ['工位号', this.$store.state.station.stationName]
|
param[0] = ["工位号", this.$store.state.station.stationName];
|
||||||
param[1] = ['订单号', this.form1.订单号]
|
param[1] = ["订单号", this.form1.订单号];
|
||||||
const Data2 = this.CreateData('12', '测量数据工位_监控系统_订单号_增加', param)
|
const Data2 = this.CreateData(
|
||||||
this.ExecDatabase(Data2).then(response => {
|
"12",
|
||||||
if (response.data[0].result === '1') {
|
"测量数据工位_监控系统_订单号_增加",
|
||||||
|
param
|
||||||
|
);
|
||||||
|
this.ExecDatabase(Data2).then((response) => {
|
||||||
|
if (response.data[0].result === "1") {
|
||||||
this.$notify.success({
|
this.$notify.success({
|
||||||
title: '提示',
|
title: "提示",
|
||||||
message: '订单选择成功!',
|
message: "订单选择成功!",
|
||||||
position: 'bottom-right',
|
position: "bottom-right",
|
||||||
offset: 170
|
offset: 170,
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('订单选择失败')
|
this.$message.error("订单选择失败");
|
||||||
}
|
}
|
||||||
this.getTable()
|
this.getTable();
|
||||||
})
|
});
|
||||||
// this.publication.topic = window.g.mqttPublishTopic
|
// this.publication.topic = window.g.mqttPublishTopic
|
||||||
// this.publication.payload = 'WEB|SetMoby|' + this.$store.state.station.stationName + '|' + '1'
|
// this.publication.payload = 'WEB|SetMoby|' + this.$store.state.station.stationName + '|' + '1'
|
||||||
// const result = window.g.mqttClient.doPublish(this.publication)
|
// const result = window.g.mqttClient.doPublish(this.publication)
|
||||||
@@ -596,28 +689,32 @@ export default {
|
|||||||
// offset: 170
|
// offset: 170
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
this.dialogFormVisible1 = false
|
this.dialogFormVisible1 = false;
|
||||||
},
|
},
|
||||||
getTable() {
|
getTable() {
|
||||||
const param = []
|
const param = [];
|
||||||
param[0] = ['开始日期', this.dateRange[0]]
|
param[0] = ["开始日期", this.dateRange[0]];
|
||||||
param[1] = ['结束日期', this.dateRange[1]]
|
param[1] = ["结束日期", this.dateRange[1]];
|
||||||
param[2] = ['工位号', this.$store.state.station.stationName]
|
param[2] = ["工位号", this.$store.state.station.stationName];
|
||||||
param[3] = ['工件编号', this.workpieceId]
|
param[3] = ["工件编号", this.workpieceId];
|
||||||
const Data = this.CreateData('11', '测量数据发动机在线状态_工位数据_查询', param)
|
const Data = this.CreateData(
|
||||||
this.ExecDatabase(Data).then(response => {
|
"11",
|
||||||
this.orderCompletion_table1 = response.data
|
"测量数据发动机在线状态_工位数据_查询",
|
||||||
})
|
param
|
||||||
|
);
|
||||||
|
this.ExecDatabase(Data).then((response) => {
|
||||||
|
this.orderCompletion_table1 = response.data;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
choose(row) {
|
choose(row) {
|
||||||
if (this.qualityData) {
|
if (this.qualityData) {
|
||||||
this.qualityData = []
|
this.qualityData = [];
|
||||||
}
|
}
|
||||||
this.getQualityData(row)
|
this.getQualityData(row);
|
||||||
this.dialogFormVisible1 = true
|
this.dialogFormVisible1 = true;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user