projects/mesxc-zjl #196
3
.env.dev
3
.env.dev
@ -1,7 +1,7 @@
|
||||
###
|
||||
# @Author: Do not edit
|
||||
# @Date: 2023-08-29 09:40:39
|
||||
# @LastEditTime: 2024-01-11 10:20:21
|
||||
# @LastEditTime: 2024-01-30 16:17:03
|
||||
# @LastEditors: zhp
|
||||
# @Description:
|
||||
###
|
||||
@ -21,7 +21,6 @@ VUE_APP_BASE_API = 'http://192.168.0.33:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.104:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.0.33:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.62:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.78:48082'
|
||||
|
||||
|
91
src/api/base/qualityInspectionBoxPermissions.js
Normal file
91
src/api/base/qualityInspectionBoxPermissions.js
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2023-12-04 14:10:37
|
||||
* @LastEditTime: 2024-01-30 18:06:48
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建安灯按钮16键对应
|
||||
export function createQualityInspectionBoxBtn(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/updateBatch',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新安灯按钮16键对应
|
||||
export function updateQualityInspectionBoxBtn(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn-auth/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除安灯按钮16键对应
|
||||
export function deleteQualityInspectionBoxBtn(id) {
|
||||
return request({
|
||||
url: 'base/quality-inspection-box-btn-auth/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得安灯按钮16键对应
|
||||
export function getQualityInspectionBoxBtn(id) {
|
||||
return request({
|
||||
url: 'base/quality-inspection-box-btn-auth/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得安灯按钮16键对应分页
|
||||
export function getQualityInspectionBoxBtnPage(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/listGroupByLineSection',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出安灯按钮16键对应 Excel
|
||||
export function exportQualityInspectionBoxBtnExcel(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function getAllDetByTypeList(query) {
|
||||
return request({
|
||||
url: '/base/quality-scrap-det/scrapMap',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
export function getListByLineSection(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/detListByLineSection',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserList(query) {
|
||||
return request({
|
||||
url: 'base/quality-inspection-box-btn-auth/getUserList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
export function getPage(query) {
|
||||
return request({
|
||||
url: 'base/quality-inspection-box-btn-auth/page',
|
||||
method: 'post',
|
||||
data:query
|
||||
})
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-29 16:50:26
|
||||
* @LastEditTime: 2024-01-29 17:06:50
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-07-19 15:18:30
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-01-25 14:18:42
|
||||
* @LastEditTime: 2024-01-29 17:05:37
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -49,10 +56,11 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="8">
|
||||
<base-container :title="'ISRA 缺陷数据'" :size="'small'" :title-icon="'scrap'">
|
||||
<base-container :no-content-padding="true" :title="'ISRA 缺陷数据'" :size="'small'" :title-icon="'scrap'">
|
||||
<!-- <base-table1 :page="1" :limit="999" :show-index="false" :table-config="ISRATableProps"
|
||||
:table-data="ISRAList" /> -->
|
||||
<dv-scroll-board :config="ISRAConfig" style="width:100%;height:350px" ref='ISRAScrollBoard' />
|
||||
<ISRAChart ref="ISRAChart" />
|
||||
<!-- <dv-scroll-board :config="ISRAConfig" style="width:100%;height:350px" ref='ISRAScrollBoard' /> -->
|
||||
</base-container>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -82,27 +90,26 @@
|
||||
</base-container>
|
||||
</el-col>
|
||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="14">
|
||||
<base-container :height="318 + 338 + 16" :size="'eqStatus'"
|
||||
:title="'设备状态监控'" :title-icon="'eqMonitoring'">
|
||||
<base-container :height="318 + 338 + 16" :size="'eqStatus'" :title="'设备状态监控'" :title-icon="'eqMonitoring'">
|
||||
<!-- <div style="width: 45%;position: absolute; top: 3em; right: 3em;">
|
||||
<top-radio-group />
|
||||
</div> -->
|
||||
<!-- 像下面这样表格里的limit值,也许可以用js动态计算出来 -->
|
||||
<el-col :span="6" style="">
|
||||
<div style="font-size:20px;margin: 5px 0 10px 0">融化风机</div>
|
||||
<el-col :span="8" style="">
|
||||
<div style="font-size:20px;margin: 5px 0 10px 0">熔化风机</div>
|
||||
<!-- <base-table1 :page="1" :limit="999" :show-index="false" :table-config="EqMonitoringPropsFun"
|
||||
:table-data="funList" /> -->
|
||||
<dv-scroll-board :config="funConfig" style="width:100%;height:310px" ref='funScrollBoard' />
|
||||
</el-col>
|
||||
<span class="eqLine"></span>
|
||||
<el-col :span="6">
|
||||
<el-col :span="8">
|
||||
<div style="font-size:20px;margin: 5px 0 10px 0;">退火风机</div>
|
||||
<!-- <base-table1 :page="1" :limit="999" :show-index="false" :table-config="EqMonitoringPropsFun"
|
||||
:table-data="annealFunList" /> -->
|
||||
<dv-scroll-board :config="annealFunConfig" style="width:100%;height:310px" ref='annealFunScrollBoard' />
|
||||
</el-col>
|
||||
<span class="eqLineTwo"></span>
|
||||
<el-col :span="12" style="float: right;">
|
||||
<el-col :span="8" style="float: right;">
|
||||
<div style="font-size:20px;margin: 5px 0 10px 0;">产线设备</div>
|
||||
<!-- <base-table1 :page="1" :limit="999" :show-index="false" :table-config="EqMonitoringProps"
|
||||
:table-data="realEqList" /> -->
|
||||
@ -137,25 +144,18 @@ import baseTable1 from './components/baseTable'
|
||||
// import baseTable2 from './components/baseTable'
|
||||
// import baseTable3 from './components/baseTable'
|
||||
import TopRadioGroup from './components/topRadioGroup'
|
||||
// import pieChart1 from './components/PieChart'
|
||||
// import pieChart2 from './components/PieChart'
|
||||
// import pieChart3 from './components/PieChart'
|
||||
// import { mapGetters } from 'vuex'
|
||||
import screenfull from 'screenfull'
|
||||
// import BaseVideo from './components/baseVideo.vue'
|
||||
import alarmLevel from './components/alarmLevel'
|
||||
import pileBarChart from './components/pileBarChart'
|
||||
import colorDiv from './components/colorDiv'
|
||||
import moment from "moment";
|
||||
|
||||
// import axios from '@/utils/request'
|
||||
import doubleYChart from './components/coldDoubleYChart'
|
||||
// import elementResizeDetectorMaker from 'element-resize-detector';
|
||||
// var erd = elementResizeDetectorMaker(); //创建实例
|
||||
// let resizeFun = null
|
||||
import { parseTime } from '../core/mixins/code-filter';
|
||||
import { formatDate } from '@/utils'
|
||||
|
||||
|
||||
import ISRAChart from './components/ISRAChart.vue';
|
||||
import { getDcsMsg, closeDcsMsg } from "./wsInterface"
|
||||
import LinearBarChart from './components/linearBarChart'
|
||||
const qualityYearTableProps= []
|
||||
const EqMonitoringPropsFun = [
|
||||
@ -260,6 +260,7 @@ export default {
|
||||
TopRadioGroup,
|
||||
doubleYChart,
|
||||
LinearBarChart,
|
||||
ISRAChart
|
||||
// baseContainer1
|
||||
// pieChart1,
|
||||
// pieChart2
|
||||
@ -294,18 +295,18 @@ export default {
|
||||
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
||||
columnWidth: [60, 90, 90],
|
||||
columnWidth: [60, 180, 90],
|
||||
align: ['center'],
|
||||
data: [],
|
||||
// index:true,
|
||||
rowNum: 10
|
||||
},
|
||||
realEqConfig: {
|
||||
header: ['序号', '产线', '设备名称', '设备编码', '运行状态','故障状态'],
|
||||
header: ['序号','设备名称','运行状态'],
|
||||
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
||||
columnWidth: [60, 80, 90,90,90,90],
|
||||
columnWidth: [60, 180, 90],
|
||||
align: ['center'],
|
||||
data: [],
|
||||
// index:true,
|
||||
@ -316,7 +317,7 @@ export default {
|
||||
headerBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
oddRowBGC: 'rgba(32, 55, 96, 0.8)',
|
||||
evenRowBGC: 'rgba(14, 32, 62, 0.8)',
|
||||
columnWidth: [60, 90, 90],
|
||||
columnWidth: [60, 180, 90],
|
||||
align: ['center'],
|
||||
data: [],
|
||||
// index:true,
|
||||
@ -350,6 +351,7 @@ export default {
|
||||
SJGWsData: {},
|
||||
// orderProcessList: [],
|
||||
dateType: '0',
|
||||
wsIsOpen:false,
|
||||
funList:[],
|
||||
annealFunList: [],
|
||||
queryParams: {
|
||||
@ -393,9 +395,29 @@ export default {
|
||||
// this.fetchList('line-chart-data')
|
||||
this.init()
|
||||
},
|
||||
mounted() {
|
||||
destroyed() {
|
||||
this.funInitWebSocket()
|
||||
this.CutInitWebSocket()
|
||||
this.SJGWebsocketClose()
|
||||
if (this.wsIsOpen) {
|
||||
closeDcsMsg()
|
||||
this.wsIsOpen = false
|
||||
console.log('关闭============')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(moment(this.logoutTime - 28800000).format('HH:mm:ss'));
|
||||
this.funInitWebSocket()
|
||||
// if (num > 0) {
|
||||
if (!this.wsIsOpen) {
|
||||
getDcsMsg()
|
||||
this.wsIsOpen = true
|
||||
console.log('开启websocket==========')
|
||||
}
|
||||
// } else {
|
||||
|
||||
// }
|
||||
this.CutInitWebSocket()
|
||||
this.SJGInitWebSocket()
|
||||
// this.getList()
|
||||
this.getTimes()
|
||||
@ -444,6 +466,15 @@ export default {
|
||||
// removeEventListener('resize', resizeFun)
|
||||
// },
|
||||
methods: {
|
||||
CutWebsocketClose(e) {
|
||||
console.log('WebSocket 断开连接', e)
|
||||
},
|
||||
SJGWebsocketClose(e) {
|
||||
console.log('WebSocket 断开连接', e)
|
||||
},
|
||||
funInitWebSocket(e) {
|
||||
console.log('WebSocket 断开连接', e)
|
||||
},
|
||||
formatTime(time, option) {
|
||||
// if (('' + time).length === 10) {
|
||||
// time = parseInt(time) * 1000
|
||||
@ -738,6 +769,7 @@ export default {
|
||||
// let obj = JSON.parse(data.data)
|
||||
this.SJGWsData = e?.data ? JSON.parse(e?.data) : {}
|
||||
if (this.SJGWsData.type === 'isra') {
|
||||
console.log('222222', this.SJGWsData.detData);
|
||||
// this.ISRAList = this.SJGWsData.detData.map((ele, index) => {
|
||||
// // if (ele.progressRate != 1) {
|
||||
// return {
|
||||
@ -751,34 +783,39 @@ export default {
|
||||
// // }
|
||||
// });
|
||||
console.log(this.SJGWsData.detData);
|
||||
let ISRAArr = this.SJGWsData.detData.map((item, index) => [
|
||||
// console.log(item)
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
<span style="color:rgba(255,255,255,0.5)" >${item.linename || ''}
|
||||
</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.time || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.type || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.num || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${(item.percent * 100).toFixed(2) || ''}</span>`,
|
||||
])
|
||||
this.ISRAConfig.data = ISRAArr
|
||||
this.$refs['ISRAScrollBoard'].updateRows(ISRAArr)
|
||||
let chartData = this.SJGWsData.detData.map((item, index) => {
|
||||
return {
|
||||
name: item.type,
|
||||
num:item.num
|
||||
}
|
||||
})
|
||||
// let ISRAArr = this.SJGWsData.detData.map((item, index) => [
|
||||
// // console.log(item)
|
||||
// `<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
// </span>`,
|
||||
// // formatDate(item.planStartTime) || '',
|
||||
// `
|
||||
// <span style="color:rgba(255,255,255,0.5)" >${item.linename || ''}
|
||||
// </span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${item.time || ''}</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${item.type || ''}</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${item.num || ''}</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${(item.percent * 100).toFixed(2) || ''}</span>`,
|
||||
// ])
|
||||
// this.ISRAConfig.data = ISRAArr
|
||||
this.$refs['ISRAChart'].updateChart(chartData)
|
||||
} else if (this.SJGWsData.type === 'equipment') {
|
||||
this.realEqList = this.SJGWsData.detData.map((ele, index) =>[
|
||||
// console.log(item)
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
<span style="color:rgba(255,255,255,0.5)" >${item.line || ''}
|
||||
</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)" >${item.line || ''}
|
||||
// </span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.name || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.run || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
||||
// `<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
||||
]);
|
||||
}
|
||||
this.realEqConfig.data = this.realEqList
|
||||
@ -931,7 +968,7 @@ export default {
|
||||
height: 290px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
left: 33.8%;
|
||||
top: 12%;
|
||||
background: linear-gradient(to bottom,rgba(60,
|
||||
231,
|
||||
@ -943,7 +980,7 @@ background: linear-gradient(to bottom,rgba(60,
|
||||
height: 290px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
left: 66.2%;
|
||||
top: 12%;
|
||||
background: linear-gradient(to bottom, rgba(60,
|
||||
231,
|
||||
|
159
src/views/OperationalOverview/components/ISRAChart.vue
Normal file
159
src/views/OperationalOverview/components/ISRAChart.vue
Normal file
@ -0,0 +1,159 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-29 13:45:56
|
||||
* @LastEditTime: 2024-01-29 14:56:38
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<!-- <NotMsg v-show="notMsg"/> -->
|
||||
<div id="israChart" class="isra-chart" style="height:390px;"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
// import resize from './../mixins/resize'
|
||||
// import NotMsg from './../components/NotMsg'
|
||||
|
||||
export default {
|
||||
name: 'ISRAChart',
|
||||
// mixins: [resize],
|
||||
// components:{ NotMsg },
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
// notMsg:true,
|
||||
colors:['#2760ff', '#518eec', '#0ee8e4', '#ddb523'],
|
||||
chartData: []
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
},
|
||||
computed: {
|
||||
israChartMsg() {
|
||||
return this.$store.state.websocket.israKiln
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
israChartMsg: {
|
||||
handler(newVal, oldVal) {
|
||||
this.chartData = newVal || []
|
||||
this.updateChart()
|
||||
this.$emit('emitFun')
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateChart() {
|
||||
console.log('update')
|
||||
let num = 0
|
||||
this.chartData && this.chartData.length > 0 && this.chartData.map(i => {
|
||||
num+=i.num
|
||||
})
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose()
|
||||
}
|
||||
// if (this.chartData && this.chartData.length > 0) {
|
||||
// this.notMsg = false
|
||||
// } else {
|
||||
// this.notMsg = true
|
||||
// return
|
||||
// }
|
||||
this.chart = echarts.init(document.getElementById('israChart'));
|
||||
var option = {
|
||||
color:this.colors,
|
||||
title:{
|
||||
text: num,
|
||||
subtext: '总数',
|
||||
top: '32%',
|
||||
left: '49%',
|
||||
textAlign: 'center',
|
||||
textStyle: {
|
||||
fontSize: 32,
|
||||
color: '#fff',
|
||||
},
|
||||
subtextStyle: {
|
||||
fontSize: 20,
|
||||
color: '#fff00',
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
bottom: '2%',
|
||||
left: 'center',
|
||||
itemWidth: 18,
|
||||
itemHeight:18,
|
||||
icon: 'circle',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
data:this.chartData && this.chartData.length > 0 && this.chartData.map((item,index)=>({
|
||||
name:item.name,
|
||||
itemStyle:{
|
||||
color: this.colors[index%4]
|
||||
}
|
||||
}))
|
||||
},
|
||||
series:[{
|
||||
name: 'ISRA缺陷检测',
|
||||
type: 'pie',
|
||||
center: ['50%', '40%'],
|
||||
radius: ['45%', '70%'],
|
||||
avoidLabelOverlap: true,
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
labelLine: {
|
||||
show: true,
|
||||
},
|
||||
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
|
||||
name:item.name,
|
||||
value: item.num,
|
||||
itemStyle:{
|
||||
color:{
|
||||
type: 'linear',
|
||||
x: 1,
|
||||
y: 1,
|
||||
x2: 0,
|
||||
y2: 0,
|
||||
global: false,
|
||||
colorStops:[
|
||||
{offset: 0,color: this.colors[index%4]},
|
||||
{offset: 1,color: this.colors[index%4]+'33'}
|
||||
]
|
||||
}
|
||||
}
|
||||
}))}],
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
className: "isra-chart-tooltip"
|
||||
},
|
||||
}
|
||||
this.chart.setOption(option);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.isra-chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.isra-chart-tooltip {
|
||||
background: #0a2b4f77 !important;
|
||||
border: none !important;
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
.isra-chart-tooltip * {
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
@ -1,8 +1,8 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2022-01-21 14:43:06
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2022-01-24 09:12:18
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-01-25 17:41:44
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -143,9 +143,9 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
})
|
||||
// this.$nextTick(() => {
|
||||
// // this.initChart()
|
||||
// })
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: gtz
|
||||
* @Date: 2022-01-19 15:58:17
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-01-24 17:01:21
|
||||
* @LastEditTime: 2024-01-29 15:35:37
|
||||
* @Description: file content
|
||||
* @FilePath: \mt-bus-fe\src\views\OperationalOverview\components\baseContainer\index.vue
|
||||
-->
|
||||
@ -27,9 +27,12 @@
|
||||
<svg-icon :icon-class="titleIcon" style="font-size: 1em; position: relative; top: .08em" />
|
||||
{{ title }}
|
||||
</span>
|
||||
<!-- <span style="font-size: 20px;color:#52FFF8;margin-left: 10px;margin-top: 2px;">
|
||||
{{ time +'-'+ time2 }}
|
||||
<!-- <span v-if="showTime" style="font-size: 20px;color:#52FFF8;margin-left: 10px;margin-top: 2px;">
|
||||
{{ time2 +'-'+ time }}
|
||||
</span> -->
|
||||
<span style="font-size: 20px;color:#52FFF8;margin-left: 10px;margin-top: 2px;">
|
||||
{{ startTime + '-' + endTime }}
|
||||
</span>
|
||||
</div>
|
||||
<!-- <div v-if="true" class="bar-title">
|
||||
<span>
|
||||
@ -45,6 +48,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from "moment";
|
||||
export default {
|
||||
name: 'BaseContainer',
|
||||
props: {
|
||||
@ -56,6 +60,14 @@ export default {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showTime: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showYesTime: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
back: {
|
||||
type: String,
|
||||
default: ''
|
||||
@ -93,38 +105,52 @@ export default {
|
||||
return {
|
||||
curIndex: 0,
|
||||
time: null,
|
||||
time2:null
|
||||
time2: null,
|
||||
startTime: undefined,
|
||||
endTime: undefined
|
||||
// imgUrl: require(`../../../../assets/img/${this.back}.png`),
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted () {
|
||||
this.time = this.format(new Date().setHours(7,0,0));
|
||||
// console.log(time);
|
||||
//前一天时间
|
||||
this.time2 = this.format(new Date().setHours(7, 0, 0) - 86400000 * 1);
|
||||
console.log(new Date().setHours(7, 0, 0) - 86400000 * 1);
|
||||
// this.time = this.format(new Date().setHours(7,0,0));
|
||||
// // console.log(time);
|
||||
// //前一天时间
|
||||
let nowTime = new Date
|
||||
let hour = nowTime.getHours()
|
||||
if (hour > 6) {
|
||||
this.startTime = moment(nowTime).format('yyyy.MM.DD') + ' 7点'
|
||||
this.endTime = moment(moment(nowTime) + 86400000).format('yyyy.MM.DD') + ' 7点'
|
||||
} else {
|
||||
this.endTime = moment(nowTime).format('yyyy.MM.DD') + ' 7点'
|
||||
this.startTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 7点'
|
||||
}
|
||||
// this.yesStartTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 0点'
|
||||
// this.yesEndTime = moment(moment(nowTime) - 86400000).format('yyyy.MM.DD') + ' 24点'
|
||||
|
||||
// this.time2 = this.format(new Date().setHours(7, 0, 0) - 86400000 * 1);
|
||||
// console.log(new Date().setHours(7, 0, 0) - 86400000 * 1);
|
||||
},
|
||||
methods: {
|
||||
add0(m) {
|
||||
return m < 10 ? '0' + m : m
|
||||
},
|
||||
format(shijianchuo) {
|
||||
//shijianchuo是整数,否则要parseInt转换
|
||||
var time = new Date(shijianchuo);
|
||||
var y = time.getFullYear();
|
||||
var m = time.getMonth() + 1;
|
||||
var d = time.getDate();
|
||||
var h = time.getHours();
|
||||
var mm = time.getMinutes();
|
||||
var s = time.getSeconds();
|
||||
return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + h + '时'
|
||||
},
|
||||
changeTab(num) {
|
||||
this.curIndex = num
|
||||
this.$emit('tabSelect', num)
|
||||
},
|
||||
// add0(m) {
|
||||
// return m < 10 ? '0' + m : m
|
||||
// },
|
||||
// format(shijianchuo) {
|
||||
// //shijianchuo是整数,否则要parseInt转换
|
||||
// var time = new Date(shijianchuo);
|
||||
// var y = time.getFullYear();
|
||||
// var m = time.getMonth() + 1;
|
||||
// var d = time.getDate();
|
||||
// var h = time.getHours();
|
||||
// var mm = time.getMinutes();
|
||||
// var s = time.getSeconds();
|
||||
// return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + h + '时'
|
||||
// },
|
||||
// changeTab(num) {
|
||||
// this.curIndex = num
|
||||
// this.$emit('tabSelect', num)
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-09-21 09:06:28
|
||||
* @LastEditTime: 2024-01-17 15:26:04
|
||||
* @LastEditTime: 2024-01-29 15:39:59
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -159,7 +159,7 @@ export default {
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
top: '1%',
|
||||
right: '20px',
|
||||
// right: '20px',
|
||||
data: ['产线产量', '产线良品率'],
|
||||
textStyle: {
|
||||
fontSize: 12 * this.beilv,
|
||||
@ -287,6 +287,6 @@ export default {
|
||||
</script>
|
||||
<style>
|
||||
.productChart{
|
||||
top: -40px;
|
||||
top: -10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-09-21 09:06:28
|
||||
* @LastEditTime: 2024-01-17 13:56:46
|
||||
* @LastEditTime: 2024-01-29 15:14:40
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -149,8 +149,8 @@ export default {
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "5%",
|
||||
left: "6%",
|
||||
right: "6%",
|
||||
bottom: "3%",
|
||||
containLabel: true
|
||||
},
|
||||
@ -190,12 +190,12 @@ export default {
|
||||
// },
|
||||
yAxis: [
|
||||
{
|
||||
min: function() { // 取最小值向下取整为最小刻度
|
||||
return 0
|
||||
},
|
||||
max: function(value) { // 取最大值向上取整为最大刻度
|
||||
return Math.ceil(value.max)
|
||||
},
|
||||
// min: function() { // 取最小值向下取整为最小刻度
|
||||
// return 0
|
||||
// },
|
||||
// max: function(value) { // 取最大值向上取整为最大刻度
|
||||
// return Math.ceil(value.max)
|
||||
// },
|
||||
scale: true,
|
||||
type: 'value',
|
||||
name: '良品率/%',
|
||||
@ -233,12 +233,12 @@ export default {
|
||||
// },
|
||||
},
|
||||
{
|
||||
min: function() { // 取最小值向下取整为最小刻度
|
||||
return 0
|
||||
},
|
||||
max: function(value) { // 取最大值向上取整为最大刻度
|
||||
return Math.ceil(value.max)
|
||||
},
|
||||
// min: function() { // 取最小值向下取整为最小刻度
|
||||
// return 0
|
||||
// },
|
||||
// max: function(value) { // 取最大值向上取整为最大刻度
|
||||
// return Math.ceil(value.max)
|
||||
// },
|
||||
scale: true,
|
||||
type: 'value',
|
||||
name: '产量/㎡', // y轴上方的单位
|
||||
@ -247,7 +247,7 @@ export default {
|
||||
// fontSize: 10,
|
||||
align: "right",
|
||||
},
|
||||
position: 'left',
|
||||
// position: 'left',
|
||||
alignTicks: true,
|
||||
axisLine: {
|
||||
show: true,
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-07-19 15:18:30
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-01-25 10:13:51
|
||||
* @LastEditTime: 2024-01-30 17:19:32
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
<el-row :style="{ padding: '0 ' + 9 + 'px' }" :gutter="12" type="flex" class="flex-1">
|
||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
|
||||
<base-container :no-content-padding="true" :height="256" :size="'middle'" :title="'能源监控'"
|
||||
<base-container :show-yes-time="true" :no-content-padding="true" :height="256" :size="'middle'" :title="'能源监控'"
|
||||
:title-icon="'energyMonitoring'">
|
||||
<!-- <div style="width: 45%;position: absolute; top: 3em; right: 3em;">
|
||||
<top-radio-group />
|
||||
@ -103,8 +103,8 @@
|
||||
</base-container>
|
||||
</el-col>
|
||||
<el-col :style="{ margin: 8 + 'px' + ' 0' }" :span="12">
|
||||
<base-container :no-content-padding="true" :height="318 + 338 + 16" :size="'middle'" :title="'产线产量及良品率'"
|
||||
:title-icon="'productLine'">
|
||||
<base-container :show-time="true" :no-content-padding="true" :height="318 + 338 + 16" :size="'middle'"
|
||||
:title="'产线产量及良品率'" :title-icon="'productLine'">
|
||||
<!-- <div style="width: 45%;position: absolute; top: 3em; right: 3em;">
|
||||
<top-radio-group />
|
||||
</div> -->
|
||||
@ -611,7 +611,24 @@ export default {
|
||||
// this.fetchList('line-chart-data')
|
||||
this.init()
|
||||
},
|
||||
destroyed () {
|
||||
this.websocketClose()
|
||||
this.SJGWebsocketClose()
|
||||
},
|
||||
mounted() {
|
||||
let eqArr = this.qualityYearList.map((item, index) => [
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
||||
</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
||||
])
|
||||
this.eqConfig.data = eqArr
|
||||
this.$refs['eqScrollBoard'].updateRows(eqArr)
|
||||
this.getList()
|
||||
this.initWebSocket()
|
||||
this.SJGInitWebSocket()
|
||||
@ -665,23 +682,22 @@ export default {
|
||||
'get',
|
||||
).then((res) => {
|
||||
// console.log('11111', res);
|
||||
if (res.data.length !==0) {
|
||||
let processArr = res.data.map((item, index) => [
|
||||
// console.log(item)
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
let processArr = qualityMonthList.map((item, index) => [
|
||||
// console.log(item)
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
<span style="color:rgba(255,255,255,0.5)" >${item.productionLineName || ''}
|
||||
</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.sectionName || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.inspectionTypeName || ''}</span>`,
|
||||
])
|
||||
this.processConfig.data = processArr
|
||||
this.$refs['processScrollBoard'].updateRows(processArr)
|
||||
} else {
|
||||
let processArr = qualityMonthList.map((item, index) => [
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.sectionName || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.count || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.inspectionTypeName || ''}</span>`,
|
||||
])
|
||||
this.processConfig.data = processArr
|
||||
this.$refs['processScrollBoard'].updateRows(processArr)
|
||||
if (res.data.length !==0) {
|
||||
let processArr = res.data.map((item, index) => [
|
||||
// console.log(item)
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
@ -828,9 +844,10 @@ export default {
|
||||
this.SJGWsData.detData.forEach((ele) => {
|
||||
if (item.id == ele.productionLineId) {
|
||||
if (item.name.substr(0, 1) == "D") {
|
||||
console.log(ele)
|
||||
nameList.push(item.name)
|
||||
outputNumList.push(ele.outputNum)
|
||||
passRateList.push(ele.passRate * 100)
|
||||
passRateList.push(ele.passRate)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -845,22 +862,6 @@ export default {
|
||||
// console.log(this.EnergyMonitoringList)
|
||||
// this.$nextTick(() => {
|
||||
this.$refs.productLineChart.initChart(Array.from(new Set(nameList)), passRateList, outputNumList)
|
||||
} else {
|
||||
console.log(this.qualityYearList);
|
||||
|
||||
let eqArr = this.qualityYearList.map((item,index) => [
|
||||
`<span style="color:rgba(255,255,255,0.5)" >${index + 1 || ''}
|
||||
</span>`,
|
||||
// formatDate(item.planStartTime) || '',
|
||||
`
|
||||
<span style="color:rgba(255,255,255,0.5)" >${item.name || ''}
|
||||
</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.code || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.status || ''}</span>`,
|
||||
`<span style="color:rgba(255,255,255,0.5)">${item.error || ''}</span>`,
|
||||
])
|
||||
this.eqConfig.data = eqArr
|
||||
this.$refs['eqScrollBoard'].updateRows(eqArr)
|
||||
}
|
||||
},
|
||||
// 数据发送
|
||||
@ -868,9 +869,9 @@ export default {
|
||||
// this.websocket.send('11111')
|
||||
// },
|
||||
// // 关闭
|
||||
// SJGWebsocketClose(e) {
|
||||
// console.log('WebSocket 断开连接', e)
|
||||
// },
|
||||
SJGWebsocketClose(e) {
|
||||
console.log('WebSocket 断开连接', e)
|
||||
},
|
||||
// // 连接建立之后执行send方法发送数据
|
||||
websocketOnOpen() {
|
||||
console.log('socket连接成功')
|
||||
|
183
src/views/OperationalOverview/websocket.js
Normal file
183
src/views/OperationalOverview/websocket.js
Normal file
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-29 17:05:25
|
||||
* @LastEditTime: 2024-01-29 17:05:25
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
/**
|
||||
* 发起websocket请求函数
|
||||
* @param {string} url ws连接地址
|
||||
* @param {Object} agentData 传给后台的参数
|
||||
* @param {function} successCallback 接收到ws数据,对数据进行处理的回调函数
|
||||
* @param {function} errCallback ws连接错误的回调函数
|
||||
*/
|
||||
export function WsConnect(url, agentData, successCallback, errCallback) {
|
||||
this.wsUrl = url;
|
||||
this.wsObj = null;
|
||||
// 是否执行重连 true/不执行 ; false/执行
|
||||
this.lockReconnect = false;
|
||||
// 重连定时器
|
||||
this.wsCreateHandler = null;
|
||||
// 连接成功,执行回调函数
|
||||
this.messageCallback = successCallback;
|
||||
// 连接失败,执行回调函数
|
||||
this.errorCallback = errCallback;
|
||||
// 发送给后台的数据
|
||||
this.sendDatas = agentData;
|
||||
// 创建ws函数
|
||||
this.createWebSoket = () => {
|
||||
if (typeof WebSocket === "undefined") {
|
||||
writeToScreen("您的浏览器不支持WebSocket,无法获取数据");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
this.wsObj = new WebSocket(url);
|
||||
initWsEventHandle();
|
||||
} catch (e) {
|
||||
writeToScreen("连接异常,开始重连");
|
||||
reconnect();
|
||||
}
|
||||
};
|
||||
// 手动关闭websocket (这里手动关闭会执行onclose事件)
|
||||
this.closeWebsocket = () => {
|
||||
if (this.wsObj) {
|
||||
writeToScreen("手动关闭websocket");
|
||||
this.wsObj.close(); // 关闭websocket
|
||||
// this.wsObj.onclose() // 关闭websocket(如果上面的关闭不生效就加上这一条)
|
||||
// 关闭重连
|
||||
this.lockReconnect = true;
|
||||
this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
|
||||
// 关闭心跳检查
|
||||
// heartCheck.stop();
|
||||
}
|
||||
};
|
||||
const initWsEventHandle = () => {
|
||||
try {
|
||||
// 连接成功
|
||||
this.wsObj.onopen = (event) => {
|
||||
onWsOpen(event);
|
||||
// heartCheck.start();
|
||||
};
|
||||
|
||||
// 监听服务器端返回的信息
|
||||
this.wsObj.onmessage = (event) => {
|
||||
onWsMessage(event);
|
||||
// heartCheck.start();
|
||||
};
|
||||
|
||||
this.wsObj.onclose = (event) => {
|
||||
writeToScreen("onclose执行关闭事件");
|
||||
onWsClose(event);
|
||||
};
|
||||
|
||||
this.wsObj.onerror = (event) => {
|
||||
writeToScreen("onerror执行error事件,开始重连");
|
||||
onWsError(event);
|
||||
reconnect();
|
||||
};
|
||||
} catch (err) {
|
||||
writeToScreen("绑定事件没有成功,开始重连");
|
||||
reconnect();
|
||||
}
|
||||
};
|
||||
|
||||
const onWsOpen = (event) => {
|
||||
writeToScreen("CONNECT");
|
||||
// // 客户端与服务器端通信
|
||||
// wsObj.send('我发送消息给服务端');
|
||||
// 添加状态判断,当为OPEN时,发送消息
|
||||
if (this.wsObj.readyState === this.wsObj.OPEN) {
|
||||
// wsObj.OPEN = 1
|
||||
// 发给后端的数据需要字符串化
|
||||
this.wsObj.send(JSON.stringify(this.sendDatas));
|
||||
}
|
||||
if (this.wsObj.readyState === this.wsObj.CLOSED) {
|
||||
// wsObj.CLOSED = 3
|
||||
writeToScreen("wsObj.readyState=3, ws连接异常,开始重连");
|
||||
reconnect();
|
||||
this.errorCallback(event);
|
||||
}
|
||||
};
|
||||
const onWsMessage = (event) => {
|
||||
const jsonStr = event.data;
|
||||
// writeToScreen("onWsMessage接收到服务器的数据: ", jsonStr);
|
||||
this.messageCallback(jsonStr);
|
||||
};
|
||||
const onWsClose = (event) => {
|
||||
writeToScreen("DISCONNECT");
|
||||
// e.code === 1000 表示正常关闭。 无论为何目的而创建, 该链接都已成功完成任务。
|
||||
// e.code !== 1000 表示非正常关闭。
|
||||
console.log("onclose event: ", event);
|
||||
if (event && event.code !== 1000) {
|
||||
writeToScreen("非正常关闭");
|
||||
this.errorCallback(event);
|
||||
// 如果不是手动关闭,这里的重连会执行;如果调用了手动关闭函数,这里重连不会执行
|
||||
reconnect();
|
||||
}
|
||||
};
|
||||
const onWsError = (event) => {
|
||||
writeToScreen("onWsError: ", event.data);
|
||||
this.errorCallback(event);
|
||||
};
|
||||
|
||||
const writeToScreen = (massage) => {
|
||||
console.log(massage);
|
||||
};
|
||||
|
||||
// 重连函数
|
||||
const reconnect = () => {
|
||||
if (this.lockReconnect) {
|
||||
return;
|
||||
}
|
||||
writeToScreen("3秒后重连");
|
||||
this.lockReconnect = true;
|
||||
// 没连接上会一直重连,设置延迟避免请求过多
|
||||
this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
|
||||
this.wsCreateHandler = setTimeout(() => {
|
||||
writeToScreen("重连..." + this.wsUrl);
|
||||
this.createWebSoket();
|
||||
this.lockReconnect = false;
|
||||
writeToScreen("重连完成");
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
// 心跳检查(看看websocket是否还在正常连接中)
|
||||
// let heartCheck = {
|
||||
// timeout: 15000,
|
||||
// timeoutObj: null,
|
||||
// serverTimeoutObj: null,
|
||||
// // 重启
|
||||
// reset() {
|
||||
// clearTimeout(this.timeoutObj);
|
||||
// clearTimeout(this.serverTimeoutObj);
|
||||
// this.start();
|
||||
// },
|
||||
// // 停止
|
||||
// stop() {
|
||||
// clearTimeout(this.timeoutObj);
|
||||
// clearTimeout(this.serverTimeoutObj);
|
||||
// },
|
||||
// // 开启定时器
|
||||
// start() {
|
||||
// this.timeoutObj && clearTimeout(this.timeoutObj);
|
||||
// this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
|
||||
// // 15s之内如果没有收到后台的消息,则认为是连接断开了,需要重连
|
||||
// this.timeoutObj = setTimeout(() => {
|
||||
// writeToScreen("心跳检查,发送ping到后台");
|
||||
// try {
|
||||
// const datas = { ping: true };
|
||||
// this.wsObj.send(JSON.stringify(datas));
|
||||
// } catch (err) {
|
||||
// writeToScreen("发送ping异常");
|
||||
// }
|
||||
// console.log("内嵌定时器this.serverTimeoutObj: ", this.serverTimeoutObj);
|
||||
// // 内嵌定时器
|
||||
// this.serverTimeoutObj = setTimeout(() => {
|
||||
// writeToScreen("没有收到后台的数据,重新连接");
|
||||
// reconnect();
|
||||
// }, this.timeout);
|
||||
// }, this.timeout);
|
||||
// },
|
||||
// };
|
||||
}
|
51
src/views/OperationalOverview/wsInterface.js
Normal file
51
src/views/OperationalOverview/wsInterface.js
Normal file
@ -0,0 +1,51 @@
|
||||
import { WsConnect } from './websocket'
|
||||
import store from "@/store";
|
||||
|
||||
// 创建websocket链接
|
||||
|
||||
const timestr = new Date().getTime()
|
||||
// ISRA
|
||||
const mesIsra = new WsConnect(
|
||||
process.env.VUE_APP_Socket_API + '/websocket/message?userId=KILN'+timestr,
|
||||
'',
|
||||
(data) => {
|
||||
// console.log('mes ISRA成功的回调函数, 接收到的data数据: ', data)
|
||||
let msgData = JSON.parse(data)
|
||||
// console.log(msgData)
|
||||
if (msgData == null) return;
|
||||
switch (msgData?.type) {
|
||||
case "israKiln": {
|
||||
store.dispatch({type: "websocket/setIsraKiln", payload:msgData.detData.dayStatistic})
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log('失败的回调函数', err)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
export const getDcsMsg = () => {
|
||||
// dcsConn.createWebSoket()
|
||||
mesIsra.createWebSoket()
|
||||
// mesMA.createWebSoket()
|
||||
// mesEN.createWebSoket()
|
||||
// mesGAS.createWebSoket()
|
||||
// mesIS.createWebSoket()
|
||||
// mesSJG.createWebSoket()
|
||||
// mesOV.createWebSoket()
|
||||
// mesCUTTING.createWebSoket()
|
||||
}
|
||||
export const closeDcsMsg = () => {
|
||||
// dcsConn.closeWebsocket()
|
||||
mesIsra.closeWebsocket()
|
||||
// mesMA.closeWebsocket()
|
||||
// mesEN.closeWebsocket()
|
||||
// mesGAS.closeWebsocket()
|
||||
// mesIS.closeWebsocket()
|
||||
// mesSJG.closeWebsocket()
|
||||
// mesOV.closeWebsocket()
|
||||
// mesCUTTING.closeWebsocket()
|
||||
}
|
@ -120,8 +120,12 @@ export default {
|
||||
lineData['proLineName'] = item[0].lineName
|
||||
let works = [], specs = []
|
||||
item.forEach(it => {
|
||||
works.push(it.workOrderName)
|
||||
specs.push(it.specifications)
|
||||
if (it.workOrderName) {
|
||||
works.push(it.workOrderName)
|
||||
}
|
||||
if (it.specifications) {
|
||||
specs.push(it.specifications)
|
||||
}
|
||||
lineData[it.recordTime + '_up'] = it.inputNum
|
||||
lineData[it.recordTime + '_down'] = it.outputNum
|
||||
lineData[it.recordTime + '_area'] = it.area
|
||||
@ -140,8 +144,8 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
lineData['workOrderName'] = works.join(',')
|
||||
lineData['spec'] = specs.join(',')
|
||||
lineData['workOrderName'] = Array.from(new Set(works)).join(',')
|
||||
lineData['spec'] = Array.from(new Set(specs)).join(',')
|
||||
this.tableData.push(lineData)
|
||||
})
|
||||
console.log('打印', this.tableData)
|
||||
|
@ -1,8 +1,8 @@
|
||||
<!--
|
||||
<!--
|
||||
filename: BomSelection.vue
|
||||
author: liubin
|
||||
date: 2023-11-20 13:23:36
|
||||
description:
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
@ -50,7 +50,8 @@ export default {
|
||||
watch: {
|
||||
list: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
if (val) {
|
||||
console.log(val);
|
||||
this.list__inner = val.map((item) => ({ ...item, disabled: false }));
|
||||
}
|
||||
},
|
||||
@ -74,7 +75,8 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleChange(bomItem, selected) {
|
||||
handleChange(bomItem, selected) {
|
||||
console.log(selected);
|
||||
this.list__inner = this.list__inner.map((item) => ({
|
||||
...item,
|
||||
disabled: selected ? item.id !== bomItem.id : false,
|
||||
|
@ -281,11 +281,11 @@ export default {
|
||||
async handleSearchBarBtnClick({ btnName, timeVal }) {
|
||||
if (timeVal && timeVal.length > 0) {
|
||||
console.log('nihc ', timeVal)
|
||||
if (new Date(timeVal[1]).getTime() - new Date(timeVal[0]).getTime() <= 10 * 60 * 1000) {
|
||||
if (new Date(timeVal[1]).getTime() - new Date(timeVal[0]).getTime() <= 30 * 60 * 1000) {
|
||||
this.queryParams.recordTime = timeVal;
|
||||
await this.handleQuery();
|
||||
} else {
|
||||
this.$message.warning('时间范围最大一小时限制!')
|
||||
this.$message.warning('时间范围最大30分钟限制!')
|
||||
}
|
||||
} else {
|
||||
this.queryParams.recordTime = [];
|
||||
|
@ -0,0 +1,119 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-30 10:54:51
|
||||
* @LastEditTime: 2024-01-30 16:53:35
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<div class="bom-selection" v-for="item in list__inner" :key="item.id + randomKey">
|
||||
<el-checkbox :label="item.name" :checked="item.id === selected" @change="(e) => handleChange(item, e)"
|
||||
class="sl__body-item"></el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BomSelection',
|
||||
components: {},
|
||||
// model: {
|
||||
// prop: 'selected',
|
||||
// event: 'update',
|
||||
// },
|
||||
props: {
|
||||
currentSelect: {
|
||||
type: String | Number,
|
||||
default: null,
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
equipmentId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list__inner: [],
|
||||
selected: null,
|
||||
randomKey: Math.random(),
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
list: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.list__inner = val.map((item) => ({ ...item, disabled: false }));
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
currentSelect: {
|
||||
handler(val) {
|
||||
// val: string
|
||||
this.selected = val;
|
||||
this.randomKey = Math.random();
|
||||
// 更新选中状态
|
||||
if (val) {
|
||||
this.list__inner.forEach((item) => {
|
||||
if (item.id == val) item.disabled = false;
|
||||
else item.disabled = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleChange(bomItem, selected) {
|
||||
this.list__inner = this.list__inner.map((item) => ({
|
||||
...item,
|
||||
disabled: selected ? item.id !== bomItem.id : false,
|
||||
}));
|
||||
|
||||
if (selected) this.selected = null;
|
||||
|
||||
|
||||
this.$emit('change', this.equipmentId, bomItem.id, selected);
|
||||
this.$nextTick(() => {
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
clearSelected() {
|
||||
console.log('clearSelected');
|
||||
this.selected = null;
|
||||
this.randomKey = Math.random();
|
||||
// this.$emit('update', null);
|
||||
// this.$nextTick(() => {
|
||||
// this.$forceUpdate();
|
||||
// });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bom-selection {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.sl__body-item {
|
||||
margin: 0;
|
||||
padding: 3px 6px;
|
||||
border-radius: 4px;
|
||||
transition: background 0.3s ease-in-out;
|
||||
|
||||
&:hover {
|
||||
background: #0001;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,266 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-30 10:53:32
|
||||
* @LastEditTime: 2024-01-30 17:51:13
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="bom-selector">
|
||||
<el-row v-if="filteredBomList.length" style="border: 1px solid #ccc; display: flex">
|
||||
<el-col :span="12">
|
||||
<div class="select-list">
|
||||
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
|
||||
<span style="">选择产线</span>
|
||||
<span>
|
||||
{{ selectedEquipments.length }}/{{ filteredBomList.length }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="sl__body">
|
||||
<div class="sl__body-item" v-for="eq in filteredBomList" :key="eq.id + refreshKey">
|
||||
<el-checkbox :key="refreshKey" :checked="selectedEquipments.includes(eq.id)"
|
||||
@change="(e) => handleEquipmentChange(eq, e)" class=""></el-checkbox>
|
||||
<span :key="'label' + refreshKey" @click.stop="() => handleLoadDom(eq)">
|
||||
{{ eq.name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" style="border-left: 1px solid #ccc">
|
||||
<div class="select-list">
|
||||
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
|
||||
<span style="">选择工序</span>
|
||||
</div>
|
||||
|
||||
<BomSelection ref="materialsBomList" :key="materialsBomList.equipmentId + 'materialsBomList'"
|
||||
:list="materialsBomList" :equipment-id="materialsBomList.equipmentId"
|
||||
:current-select="currentSelectedMaterialBomId" @change="handleMaterialBomChange" />
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8" style="border-left: 1px solid #ccc">
|
||||
<div class="select-list">
|
||||
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
|
||||
<span style="">参数BOM</span>
|
||||
</div>
|
||||
|
||||
<BomSelection
|
||||
ref="valuesBomList"
|
||||
:key="valuesBomList.equipmentId + 'valuesBomList'"
|
||||
:list="valuesBomList"
|
||||
:equipment-id="valuesBomList.equipmentId"
|
||||
:current-select="currentSelectedValueBomId"
|
||||
@change="handleValueBomChange" />
|
||||
</div>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<div class="no-data-bg" v-else></div>
|
||||
</div>
|
||||
</template>
|
||||
;
|
||||
<script>
|
||||
|
||||
import { thisTypeAnnotation } from '@babel/types';
|
||||
import BomSelection from './BomSelection.vue';
|
||||
export default {
|
||||
name: 'BomSelector',
|
||||
components: { BomSelection },
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'update',
|
||||
},
|
||||
props: {
|
||||
bomList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchText: '',
|
||||
selectedEquipments: [],
|
||||
selected: [],
|
||||
bomArr:[],
|
||||
materialsBomList: [],
|
||||
valuesBomList: [],
|
||||
|
||||
refreshKey: Math.random(),
|
||||
currentSelectedMaterialBomId: null,
|
||||
currentSelectedValueBomId: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
console.log('value', val);
|
||||
if (val) {
|
||||
this.selectedEquipments = val.map((item) => item.equipmentId);
|
||||
this.selected = val;
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
filteredBomList() {
|
||||
return this.bomList.filter((item) => {
|
||||
return item.name.includes(this.searchText);
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
commit() {
|
||||
this.$emit('update', this.selected);
|
||||
},
|
||||
|
||||
handleLoadDom(eq) {
|
||||
// 只显示 dom 列表
|
||||
this.currentEquipment = eq.id;
|
||||
this.materialsBomList = eq.materialsBom;
|
||||
this.valuesBomList = eq.valuesBom;
|
||||
// 回复选中的bom信息
|
||||
if (this.selectedEquipments.includes(eq.id)) {
|
||||
const selectedItem = this.selected.find(
|
||||
(item) => item.equipmentId == eq.id
|
||||
);
|
||||
this.currentSelectedMaterialBomId =
|
||||
selectedItem.equMaterialBomId ?? null;
|
||||
this.currentSelectedValueBomId = selectedItem.equValueBomId ?? null;
|
||||
}
|
||||
},
|
||||
|
||||
handleEquipmentChange(eq, selected) {
|
||||
this.currentEquipment = eq.id;
|
||||
this.materialsBomList = eq.materialsBom;
|
||||
this.valuesBomList = eq.valuesBom;
|
||||
if (selected) {
|
||||
console.log(selected)
|
||||
this.selectedEquipments.push(eq.id);
|
||||
this.selected.push({
|
||||
equipmentId: eq.id,
|
||||
// equValueBomId: null,
|
||||
children: [],
|
||||
});
|
||||
// this.$emit('update', this.selected);
|
||||
} else {
|
||||
// 清空选择状态
|
||||
this.selectedEquipments = this.selectedEquipments.filter(
|
||||
(id) => id !== eq.id
|
||||
);
|
||||
// this.$refs.materialsBomList.clearSelected();
|
||||
// this.$refs.valuesBomList.clearSelected();
|
||||
this.currentSelectedMaterialBomId = null;
|
||||
this.currentSelectedValueBomId = null;
|
||||
this.selected = this.selected.filter(
|
||||
(item) => item.equipmentId !== eq.id
|
||||
);
|
||||
// this.$emit('update', this.selected);
|
||||
}
|
||||
},
|
||||
|
||||
handleMaterialBomChange(equipmentId, bomId, selected) {
|
||||
const selectedItem = this.selected.find(
|
||||
(item) => item.equipmentId == equipmentId
|
||||
);
|
||||
this.bomArr.push(bomId)
|
||||
// console.log(this.selected);
|
||||
// arr.push(bomId)
|
||||
// console.log(arr);
|
||||
// console.log(selectedItem)
|
||||
if (selected) {
|
||||
// 如果没找到这个
|
||||
this.selectedEquipments.push(equipmentId);
|
||||
console.log(this.selected.indexOf(equipmentId))
|
||||
this.selected.forEach((ele,index) => {
|
||||
if (ele.equipmentId === equipmentId) {
|
||||
this.selected[index].children.push({ id: bomId })
|
||||
}
|
||||
})
|
||||
// this.selected.push({
|
||||
// equipmentId,
|
||||
// // equValueBomId: null,
|
||||
// equMaterialBomId: bomId,
|
||||
// });
|
||||
// 强制更新'设备'一栏
|
||||
this.refreshKey = Math.random();
|
||||
// this.$emit('update', this.selected);
|
||||
return;
|
||||
} else {
|
||||
this.selected.forEach((ele, index) => {
|
||||
ele.children.forEach((e, i) => {
|
||||
if (ele.equipmentId === equipmentId && e.id == bomId) {
|
||||
this.selected[index].children.splice(i,1)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// this.$emit('getData', this.dataForm)
|
||||
selectedItem && (selectedItem.equMaterialBomId = selected ? bomId : null);
|
||||
this.currentSelectedMaterialBomId = selected ? bomId : null;
|
||||
console.log(this.selected)
|
||||
},
|
||||
|
||||
// handleValueBomChange(equipmentId, bomId, selected) {
|
||||
// const selectedItem = this.selected.find(
|
||||
// (item) => item.equipmentId == equipmentId
|
||||
// );
|
||||
// if (selected && !selectedItem) {
|
||||
// // 如果没找到这个
|
||||
// this.selectedEquipments.push(equipmentId);
|
||||
// this.selected.push({
|
||||
// equipmentId,
|
||||
// equValueBomId: bomId,
|
||||
// equMaterialBomId: null,
|
||||
// });
|
||||
// this.refreshKey = Math.random();
|
||||
// // this.$emit('update', this.selected);
|
||||
// return;
|
||||
// }
|
||||
// selectedItem && (selectedItem.equValueBomId = selected ? bomId : null);
|
||||
// this.currentSelectedValueBomId = selected ? bomId : null;
|
||||
// // this.$emit('update', this.selected);
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bom-selector {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.sl__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.sl__body-item {
|
||||
margin: 0;
|
||||
padding: 3px 6px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease-in-out;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
> span {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #0001;
|
||||
}
|
||||
}
|
||||
.sl__header {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,386 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-30 10:52:01
|
||||
* @LastEditTime: 2024-01-30 18:03:08
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<section class="process-bom">
|
||||
<!-- <SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
|
||||
|
||||
<div
|
||||
class="btns"
|
||||
style="
|
||||
text-align: right;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="currentDet == null"
|
||||
class="btn-create"
|
||||
@click="handleAddEquipment"
|
||||
icon="el-icon-plus">
|
||||
分配设备
|
||||
</el-button>
|
||||
<el-input
|
||||
icon="el-icon-search"
|
||||
placeholder="搜索"
|
||||
v-model="searchText"
|
||||
:disabled="currentDet == null"
|
||||
@change="handleSearchTextChange"
|
||||
clearable
|
||||
style="margin-left: 20px">
|
||||
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
||||
</el-input>
|
||||
</div> -->
|
||||
|
||||
<!-- 列表 -->
|
||||
<!-- <base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:width="120"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table> -->
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<!-- <pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" /> -->
|
||||
|
||||
<base-dialog dialogTitle="选择产线工序" :dialogVisible="open" width="45%" @close="cancel" @cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<el-row>
|
||||
<el-form ref="dataForm" :model="dataForm" label-width="120px" :inline="true" class="demo-form-inline">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名" prop="userId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="dataForm.userId" placeholder="用户名" filterable @change="handleProductlineChange">
|
||||
<el-option v-for="opt in userList" :key="opt.id" :label="opt.name" :value="opt.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户昵称" prop="nickname" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="dataForm.nickname">
|
||||
<!-- <el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<BomSelector ref="bomSelector" v-if="open" :bom-list="bomList" :value="selectedBoms"
|
||||
@update="selectedBoms = $event" />
|
||||
|
||||
<el-row slot="footer">
|
||||
<el-button size="small" @click="cancel">取消</el-button>
|
||||
<el-button type="primary" size="small" @click="submitForm" :loading="btnLoading">
|
||||
确定
|
||||
</el-button>
|
||||
</el-row>
|
||||
</base-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BomSelector from './BomSelector.vue';
|
||||
import {
|
||||
getUserList
|
||||
} from '@/api/base/qualityInspectionBoxPermissions';
|
||||
export default {
|
||||
name: 'ProcessBom',
|
||||
components: { BomSelector },
|
||||
props: {
|
||||
currentDet: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
btnLoading: false,
|
||||
open: false,
|
||||
eqList: [],
|
||||
bomList: [],
|
||||
finalList: [],
|
||||
choosedEquipments: [],
|
||||
searchBarFormConfig: [{ label: '工序下设备' }],
|
||||
tableProps: [
|
||||
{ prop: 'equName', label: '设备名称' },
|
||||
{ prop: 'materialName', label: '物料BOM' },
|
||||
{ prop: 'valueName', label: '参数BOM' },
|
||||
],
|
||||
list: [],
|
||||
total: 0,
|
||||
tableBtn: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
equipmentName: '',
|
||||
},
|
||||
dataForm: {
|
||||
userId: null,
|
||||
nickname: null,
|
||||
list: [],
|
||||
},
|
||||
userList: [],
|
||||
data:{},
|
||||
searchText: '',
|
||||
selectedBoms: {},
|
||||
timer: null,
|
||||
};
|
||||
},
|
||||
// watch: {
|
||||
// currentDet: {
|
||||
// handler(val) {
|
||||
// console.log('currentDet', val);
|
||||
// if (val != null) {
|
||||
// this.getList(val);
|
||||
// } else {
|
||||
// this.clearList();
|
||||
// }
|
||||
// },
|
||||
// immediate: true,
|
||||
// deep: true,
|
||||
// },
|
||||
// },
|
||||
mounted () {
|
||||
this.getData()
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getDict() {
|
||||
getUserList({
|
||||
pageNo: 1,
|
||||
pageSize: 999
|
||||
}).then((res) => {
|
||||
this.userList = res.data.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.username,
|
||||
nickname: item.nickname
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
async handleProductlineChange(id) {
|
||||
this.userList.forEach((ele) => {
|
||||
if (ele.id === id) {
|
||||
this.dataForm.nickname = ele.nickname
|
||||
}
|
||||
})
|
||||
},
|
||||
handleEmitFun() { },
|
||||
getData() {
|
||||
this.selectedBoms = [];
|
||||
// 获取设备及bom列表
|
||||
this.http('base/quality-inspection-box-btn-auth/getQualityAuthTree', 'get',
|
||||
// {
|
||||
// sectionId,
|
||||
// flowDetId: detId,
|
||||
// }
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
console.log(data)
|
||||
if (code == 0) {
|
||||
this.bomList = data.map((eq) => {
|
||||
eq.materialsBom = eq.children || [];
|
||||
// eq.valuesBom = eq.valuesBom || [];
|
||||
// 设置选中状态
|
||||
eq.materialsBom.chosen = eq.materialsBomChoseId ?? null;
|
||||
// eq.valuesBom.chosen = eq.valuesBomChoseId ?? null;
|
||||
if (
|
||||
eq.equChose ||
|
||||
eq.materialsBom.chosen
|
||||
// eq.valuesBom.chosen
|
||||
) {
|
||||
this.selectedBoms.push({
|
||||
equipmentId: eq.id,
|
||||
equMaterialBomId: eq.materialsBom.chosen,
|
||||
// equValueBomId: eq.valuesBom.chosen,
|
||||
});
|
||||
}
|
||||
// 设置设备id
|
||||
eq.materialsBom.equipmentId = eq.id;
|
||||
// eq.valuesBom.equipmentId = eq.id;
|
||||
return eq;
|
||||
});
|
||||
} else {
|
||||
this.bomList.splice(0);
|
||||
this.selectedBoms = [];
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.bomList.splice(0);
|
||||
this.selectedBoms = [];
|
||||
});
|
||||
},
|
||||
handleTableBtnClick() {},
|
||||
|
||||
handleSearchTextChange(val) {
|
||||
if (this.timer) clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
console.log('geting list.......');
|
||||
this.queryParams.equipmentName = val;
|
||||
this.$nextTick(() => {
|
||||
this.getList(this.currentDet);
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
|
||||
put(payload) {
|
||||
return this.http(this.updateUrl, 'put', payload);
|
||||
},
|
||||
post(payload) {
|
||||
return this.http(this.addUrl, 'post', payload);
|
||||
},
|
||||
recv(payload) {
|
||||
return this.http(this.pageUrl, 'get', payload);
|
||||
},
|
||||
info(payload) {
|
||||
return this.http(this.infoUrl, 'get', payload);
|
||||
},
|
||||
http(url, method, payload) {
|
||||
return this.$axios({
|
||||
url,
|
||||
method,
|
||||
params: method === 'get' ? payload : null,
|
||||
data: method !== 'get' ? payload : null,
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.btnLoading = true;
|
||||
// 现将子组件的修改提交更新至本组件
|
||||
this.$refs.bomSelector.commit();
|
||||
// 再提交至后端
|
||||
this.$nextTick(async () => {
|
||||
console.log('selectedBoms', this.selectedBoms);
|
||||
// console.log('selectedBoms', this.data);
|
||||
this.dataForm.list = this.selectedBoms.map((ele) => {
|
||||
return {
|
||||
id: ele.equipmentId,
|
||||
children: ele.children
|
||||
}
|
||||
})
|
||||
console.log(this.dataForm);
|
||||
if (this.selectedBoms.length) {
|
||||
const { code, data } = await this.http(
|
||||
'base/quality-inspection-box-btn-auth/create',
|
||||
'post',
|
||||
this.dataForm
|
||||
);
|
||||
if (code == 0) {
|
||||
this.$message.success('操作成功');
|
||||
// this.getList(this.currentDet);
|
||||
this.btnLoading = false;
|
||||
this.$emit('getList')
|
||||
this.cancel();
|
||||
} else {
|
||||
this.btnLoading = false;
|
||||
this.$message.error('操作失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// async getList({
|
||||
// detId,
|
||||
// detName,
|
||||
// detDesc,
|
||||
// flowId,
|
||||
// sectionName,
|
||||
// sectionId,
|
||||
// } = {}) {
|
||||
// console.log('get list', detId, detName, flowId);
|
||||
// const { data, code } = await this.http(
|
||||
// '/extend/process-flow-det-equipment/page',
|
||||
// 'get',
|
||||
// { flowDetId: detId, ...this.queryParams }
|
||||
// );
|
||||
// if (code == 0) {
|
||||
// this.list = data.list;
|
||||
// this.total = data.total;
|
||||
// } else {
|
||||
// this.list.splice(0);
|
||||
// this.total = 0;
|
||||
// }
|
||||
|
||||
// // this.selectedBoms = [];
|
||||
// // // 获取设备及bom列表
|
||||
// // this.http('base/quality-inspection-box-btn-auth/getQualityAuthTree', 'get',
|
||||
// // // {
|
||||
// // // sectionId,
|
||||
// // // flowDetId: detId,
|
||||
// // // }
|
||||
// // )
|
||||
// // .then(({ code, data }) => {
|
||||
// // console.log(data)
|
||||
// // if (code == 0) {
|
||||
// // this.bomList = data.map((eq) => {
|
||||
// // eq.materialsBom = eq.materialsBom || [];
|
||||
// // eq.valuesBom = eq.valuesBom || [];
|
||||
// // // 设置选中状态
|
||||
// // eq.materialsBom.chosen = eq.materialsBomChoseId ?? null;
|
||||
// // eq.valuesBom.chosen = eq.valuesBomChoseId ?? null;
|
||||
// // if (
|
||||
// // eq.equChose ||
|
||||
// // eq.materialsBom.chosen ||
|
||||
// // eq.valuesBom.chosen
|
||||
// // ) {
|
||||
// // this.selectedBoms.push({
|
||||
// // equipmentId: eq.id,
|
||||
// // equMaterialBomId: eq.materialsBom.chosen,
|
||||
// // equValueBomId: eq.valuesBom.chosen,
|
||||
// // });
|
||||
// // }
|
||||
// // // 设置设备id
|
||||
// // eq.materialsBom.equipmentId = eq.id;
|
||||
// // eq.valuesBom.equipmentId = eq.id;
|
||||
// // return eq;
|
||||
// // });
|
||||
// // } else {
|
||||
// // this.bomList.splice(0);
|
||||
// // this.selectedBoms = [];
|
||||
// // }
|
||||
// // })
|
||||
// // .catch((err) => {
|
||||
// // this.bomList.splice(0);
|
||||
// // this.selectedBoms = [];
|
||||
// // });
|
||||
// },
|
||||
async handleAddEquipment() {
|
||||
this.open = true;
|
||||
},
|
||||
cancel() {
|
||||
this.open = false;
|
||||
},
|
||||
clearList() {
|
||||
this.list = [];
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.process-bom {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
padding: 12px 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2024-01-30 18:05:04
|
||||
* @LastEditTime: 2024-01-30 18:06:16
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
/*
|
||||
* @Author: zwq
|
||||
* @Date: 2022-08-24 11:19:43
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2024-01-30 18:00:53
|
||||
* @Description:
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
/* eslint-disable */
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: '',
|
||||
deleteURL: '',
|
||||
statusUrl: '',
|
||||
exportURL: ''
|
||||
},
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
},
|
||||
exportLoading: false,
|
||||
dataListLoading: false,
|
||||
addOrEditTitle: '',
|
||||
addOrUpdateVisible: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(response => {
|
||||
this.tableData = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.listQuery.pageSize = val;
|
||||
this.listQuery.pageNo = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.listQuery.pageNo = val;
|
||||
this.getDataList();
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle() {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init();
|
||||
});
|
||||
},
|
||||
cancel(id) {
|
||||
this.$refs["popover-" + id].showPopper = false;
|
||||
},
|
||||
//改变状态
|
||||
changeStatus(id) {
|
||||
this.$http
|
||||
.post(this.urlOptions.statusUrl, { id })
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
}
|
||||
this.$refs["popover-" + id].showPopper = false;
|
||||
this.$message({
|
||||
message: this.$t("prompt.success"),
|
||||
type: "success",
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
//tableBtn点击
|
||||
handleClick(val) {
|
||||
if (val.type === "edit") {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.handleAddEquipment(val.data.userId);
|
||||
});
|
||||
} else if (val.type === "delete") {
|
||||
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
|
||||
} else if (val.type === "change") {
|
||||
this.changeStatus(val.data.id)
|
||||
} else {
|
||||
this.otherMethods(val)
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id, name, index) {
|
||||
this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.urlOptions.deleteURL(id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
//search-bar点击
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case "search":
|
||||
this.listQuery.xm1 = val.xm1;
|
||||
this.listQuery.xm2 = val.xm2;
|
||||
this.listQuery.pageNo = 1;
|
||||
this.getDataList();
|
||||
break;
|
||||
case "add":
|
||||
this.addOrEditTitle = '新增'
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrUpdateHandle()
|
||||
break;
|
||||
default:
|
||||
console.log(val)
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.addOrUpdate.formClear()
|
||||
this.addOrUpdateVisible = false
|
||||
this.addOrEditTitle = ''
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.addOrUpdate.dataFormSubmit()
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel()
|
||||
this.getDataList()
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.queryParams };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return this.urlOptions.exportURL(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '工厂.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,434 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-09-11 15:55:13
|
||||
description: DialogForm for equipmentBindSection only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form ref="dataForm" :model="dataForm" label-width="120px" v-loading="formLoading" label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名" prop="userId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-select v-model="dataForm.userId" placeholder="用户名" filterable @change="handleProductlineChange">
|
||||
<el-option v-for="opt in userList" :key="opt.id" :label="opt.name" :value="opt.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户昵称" prop="nickname" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="dataForm.nickname">
|
||||
<!-- <el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="检测内容" prop="inspectionDetIdList"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
|
||||
<div class="itemDet" v-for="item in treeData" :key="item.typeId" style="padding: 0 20px;">
|
||||
<div>{{ item.name}} </div>
|
||||
<!-- <div>{{ item.data }} </div> -->
|
||||
<div class="content">
|
||||
<el-checkbox-group v-model="dataForm.inspectionDetIdList" @change="handleCheckedCitiesChange">
|
||||
<el-checkbox v-for="i in item.children" :key="i.id" :label="i.id">{{ i.bane }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">
|
||||
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入整数',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number.isInteger(Number(val)) && Number(val),
|
||||
},
|
||||
]">
|
||||
<el-input v-model="dataForm.buttonId" @change="$emit('update', dataForm)" placeholder="请输入整数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="按钮值" prop="keyValue" :rules="[
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入100以内的整数',
|
||||
trigger: 'blur',
|
||||
transform: (val) =>
|
||||
Number.isInteger(+val) &&
|
||||
Number(val) >= 0 &&
|
||||
Number(val) <= 100 &&
|
||||
Number(val),
|
||||
},
|
||||
]">
|
||||
<el-input v-model="dataForm.keyValue" type="number" min="0" max="100" @change="$emit('update', dataForm)"
|
||||
placeholder="请输入按钮盒模式" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="检测内容" prop="inspectionDetContent"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
|
||||
<el-select v-model="dataForm.inspectionDetContent" placeholder="请选择检测内容" filterable
|
||||
@change="$emit('update', dataForm)">
|
||||
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { children } from '@antv/x6-common/lib/dom/elem';
|
||||
import basicAdd from '../../mixins/basic-add';
|
||||
import {
|
||||
createQualityInspectionBoxBtn,
|
||||
updateQualityInspectionBoxBtn,
|
||||
getQualityInspectionBoxBtn,
|
||||
getListByLineSection,
|
||||
getUserList
|
||||
} from '@/api/base/qualityInspectionBoxPermissions';
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
// isGetCode: false,
|
||||
// codeURL: getCode,
|
||||
createURL: createQualityInspectionBoxBtn,
|
||||
updateURL: updateQualityInspectionBoxBtn,
|
||||
infoURL: getQualityInspectionBoxBtn,
|
||||
},
|
||||
dataForm: {
|
||||
// id: null,
|
||||
userId: null,
|
||||
nickname:null,
|
||||
// productionLineId: null,
|
||||
list: [
|
||||
// children:[],
|
||||
],
|
||||
},
|
||||
treeData: [],
|
||||
props: {
|
||||
label: "name",
|
||||
children: "children"
|
||||
},
|
||||
defaultProps: [],
|
||||
userList:[],
|
||||
formLoading: true,
|
||||
productionLineList: [],
|
||||
inspectionDetList:[],
|
||||
workshopSectionList: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getProductionLineList()
|
||||
this.getQualityInspectionDetList()
|
||||
this.getData()
|
||||
this.getDict()
|
||||
|
||||
// this.getList()
|
||||
// this.getWorksectionList();
|
||||
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
|
||||
// this.formLoading = false;
|
||||
// this.$emit('update', {
|
||||
// ...this.dataForm,
|
||||
// code,
|
||||
// });
|
||||
// });
|
||||
},
|
||||
watch: {
|
||||
'dataForm.productionId': {
|
||||
handler(id) {
|
||||
if (id != null) this.getWorksectionList(id)
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo() {
|
||||
const getC = this.$refs.tree.getCheckedNodes();
|
||||
const getHC = this.$refs.tree.getHalfCheckedNodes();
|
||||
let selected_nodes = getHC.concat(getC);
|
||||
let selected_ids = new Set(); // 记录选中的节点tree_id
|
||||
let used_ids = new Set(); // 记录已经查询过的节点
|
||||
// 遍历初始化selected_ids
|
||||
for (let node of selected_nodes) {
|
||||
selected_ids.add(node.$treeNodeId);
|
||||
}
|
||||
// 最终的结果数据用一个根节点存储, 为了对齐递归的数据结构
|
||||
let root_node = {
|
||||
treeNodeId: -1,
|
||||
children: [],
|
||||
};
|
||||
// 添加给parent_node节点一个新节点 node
|
||||
// 注意:node 的类型是原始的 tree 节点
|
||||
// 而parent_node 的类型是真正的结果节点
|
||||
function AddNode(node, parent_node) {
|
||||
if (
|
||||
!selected_ids.has(node.$treeNodeId) ||
|
||||
used_ids.has(node.$treeNodeId)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
used_ids.add(node.$treeNodeId); // 加过的要存入 used_ids 做标记
|
||||
let real_node = {
|
||||
treeNodeId: node.$treeNodeId,
|
||||
children: [],
|
||||
label: node.name,
|
||||
desc: node.desc,
|
||||
grade: node.grade,
|
||||
// 存储一下节点的数据
|
||||
};
|
||||
// // 添加子节点
|
||||
if (node.children) {
|
||||
for (let child_node of node.children) {
|
||||
AddNode(child_node, real_node);
|
||||
}
|
||||
}
|
||||
if (real_node.children.length === 0) {
|
||||
delete real_node.children;
|
||||
}
|
||||
if (!real_node.grade) {
|
||||
delete real_node.grade;
|
||||
}
|
||||
if (!real_node.desc) {
|
||||
delete real_node.desc;
|
||||
}
|
||||
parent_node.children.push(real_node);
|
||||
}
|
||||
for (let node of selected_nodes) {
|
||||
AddNode(node, root_node);
|
||||
}
|
||||
let result = root_node.children;
|
||||
console.log(result);
|
||||
},
|
||||
handleCheck(checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys) {
|
||||
// console.log(checkedNodes, checkedKeys)
|
||||
// checkedKeys.checkedNodes.forEach((ele) => {
|
||||
// this.dataForm.list.push()
|
||||
// })
|
||||
// checkedKeys.checkedNodes.forEach((item) => {
|
||||
// // if(this.dataForm.list)
|
||||
// // this.dataForm.list.push(item)
|
||||
// })
|
||||
// console.log(this.dataForm.list);
|
||||
},
|
||||
handleCheckChange(data, checked, indeterminate) {
|
||||
var checkedNodes = this.$refs.tree.getCheckedNodes(true)
|
||||
var menuIds = []
|
||||
checkedNodes.forEach(nodes => {
|
||||
menuIds.push(nodes.id, nodes.id)
|
||||
})
|
||||
// 利用set没有重复的值这一特性, 实现数组去重。Array.form方法可以将 Set 结构转为数组。
|
||||
// this.roleForm.menuIds = Array.from(new Set(menuIds))
|
||||
console.log(menuIds);
|
||||
let arr = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
|
||||
console.log(arr)
|
||||
// console.log(data, checked, indeterminate)
|
||||
|
||||
// if (checked === true && this.dataForm.list.indexOf(data.productionLineId) === -1) {
|
||||
// } else {
|
||||
// this.dataForm.list[this.dataForm.list.indexOf(data.productionLineId)].children.push(data.id)
|
||||
// }
|
||||
},
|
||||
getDict() {
|
||||
getUserList({
|
||||
pageNo: 1,
|
||||
pageSize: 999
|
||||
}).then((res) => {
|
||||
this.userList = res.data.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.username,
|
||||
nickname: item.nickname
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
http(url, method, payload) {
|
||||
return this.$axios({
|
||||
url,
|
||||
method,
|
||||
params: method === 'get' ? payload : null,
|
||||
data: method !== 'get' ? payload : null,
|
||||
});
|
||||
},
|
||||
init(obj) {
|
||||
// console.log(productionLineId);
|
||||
console.log(obj);
|
||||
this.visible = true
|
||||
// if(obj.id)
|
||||
if (obj) {
|
||||
this.dataForm.id = obj.id || null;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs["dataForm"].resetFields()
|
||||
if (obj) {
|
||||
getListByLineSection({
|
||||
productionLineId: obj.productionLineId,
|
||||
sectionId: obj.sectionId,
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.dataForm.inspectionDetIdList = res.data
|
||||
this.dataForm.productionLineId = obj.productionLineId
|
||||
this.getWorksectionList(obj.productionLineId)
|
||||
this.dataForm.sectionId = obj.sectionId
|
||||
})
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
console.log(1111);
|
||||
this.urlOptions.infoURL(obj.id).then(response => {
|
||||
this.dataForm.id = response.data.id
|
||||
|
||||
// if (this.setData) {
|
||||
// this.setDataForm()
|
||||
// }
|
||||
});
|
||||
} else {
|
||||
// if (this.urlOptions.isGetCode) {
|
||||
// this.getCode()
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
this.http('base/quality-inspection-box-btn-auth/getQualityAuthTree', 'get',
|
||||
// {
|
||||
// sectionId,
|
||||
// flowDetId: detId,
|
||||
// }
|
||||
)
|
||||
.then(({ code, data }) => {
|
||||
console.log(data)
|
||||
if (code == 0) {
|
||||
this.treeData = data
|
||||
} else {
|
||||
// this.bomList.splice(0);
|
||||
// this.selectedBoms = [];
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 模拟透传 ref */
|
||||
handleCheckedCitiesChange(value) {
|
||||
;console.log(value);
|
||||
// let checkedCount = value.length;
|
||||
// this.checkAll = checkedCount === this.cities.length;
|
||||
// this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
|
||||
},
|
||||
// getList() {
|
||||
// console.log(this.dataForm.sectionId);
|
||||
|
||||
// },
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
async getProductionLineList() {
|
||||
this.formLoading = true;
|
||||
const res = await this.$axios({
|
||||
url: '/base/core-production-line/listAll',
|
||||
method: 'get',
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.productionLineList = res.data.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
async getQualityInspectionDetList() {
|
||||
this.formLoading = true;
|
||||
const res = await this.$axios({
|
||||
url: '/base/quality-inspection-det/inspectionMap',
|
||||
method: 'get',
|
||||
});
|
||||
if (res.code == 0) {
|
||||
console.log(res)
|
||||
let arr = []
|
||||
for (let i in res.data) {
|
||||
let obj = {
|
||||
typeName: res.data[i].length !== 0 ? res.data[i][0].typeName : '',
|
||||
typeId: res.data[i].length !== 0 ? res.data[i][0].typeId : '',
|
||||
data:[]
|
||||
}
|
||||
let detArr = []
|
||||
res.data[i].forEach(ele => {
|
||||
detArr.push({
|
||||
detId: ele.id,
|
||||
content: ele.content
|
||||
})
|
||||
})
|
||||
obj.data = detArr
|
||||
arr.push(obj)
|
||||
}
|
||||
this.inspectionDetList = arr
|
||||
console.log(this.inspectionDetList);
|
||||
// this.inspectionDetList = res.data.map((item) => ({
|
||||
// label: item.content,
|
||||
// value: item.content,
|
||||
// }));
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
async getWorksectionList(id) {
|
||||
this.formLoading = true;
|
||||
const res = await this.$axios({
|
||||
url: '/base/core-workshop-section/listByParentId',
|
||||
method: 'get',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.workshopSectionList = res.data.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
// getDict() {
|
||||
// getUserList({
|
||||
// pageNo: 1,
|
||||
// pageSize: 999
|
||||
// }).then((res) => {
|
||||
// this.userList = res.data.map((item) => {
|
||||
// return {
|
||||
// id: item.id,
|
||||
// name: item.username,
|
||||
// nickname: item.nickname
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
async handleProductlineChange(id) {
|
||||
this.userList.forEach((ele) => {
|
||||
if (ele.id === id) {
|
||||
this.dataForm.nickname = ele.nickname
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// async getCode(url) {
|
||||
// const response = await this.$axios(url);
|
||||
// return response.data;
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-date-editor,
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
||||
@pagination="getDataList" /> -->
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<!-- <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" width="50%" @cancel="handleCancel"
|
||||
@confirm="handleConfirm" :before-close="handleCancel">
|
||||
<add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog> -->
|
||||
<ProcessBomList ref="addOrUpdate" style="margin-top: 16px" @getList="getDataList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createQualityInspectionBoxBtn,
|
||||
updateQualityInspectionBoxBtn,
|
||||
deleteQualityInspectionBoxBtn,
|
||||
getQualityInspectionBoxBtn,
|
||||
getPage,
|
||||
exportQualityInspectionBoxBtnExcel,
|
||||
getUserList
|
||||
} from '@/api/base/qualityInspectionBoxPermissions';
|
||||
import basicPage from './basic-page';
|
||||
import moment from 'moment';
|
||||
import addOrUpdate from './dialogForm.vue';
|
||||
import ProcessBomList from './ProcessBomList.vue';
|
||||
export default {
|
||||
name: 'QualityInspectionBoxBtn',
|
||||
mixins: [basicPage],
|
||||
components: { addOrUpdate, ProcessBomList },
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getPage,
|
||||
deleteURL: deleteQualityInspectionBoxBtn,
|
||||
// exportURL: exportFactoryExcel,
|
||||
},
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '用户名称',
|
||||
selectOptions: [],
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: 'userName',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:quality-inspection-box-permissions:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
color: 'success',
|
||||
},
|
||||
],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:quality-inspection-box-permissions:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:quality-inspection-box-permissions:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableData: [],
|
||||
|
||||
tableProps: [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: '添加时间',
|
||||
// fixed: true,
|
||||
// width: 180,
|
||||
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
// },
|
||||
{
|
||||
prop: 'userName',
|
||||
label: '用户名',
|
||||
},
|
||||
{
|
||||
prop: 'nickName',
|
||||
label: '用户昵称',
|
||||
},
|
||||
{
|
||||
prop: 'datas',
|
||||
label: '产线及工段',
|
||||
}
|
||||
],
|
||||
// 查询参数
|
||||
listQuery: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userName: null,
|
||||
nickName:null
|
||||
},
|
||||
addOrUpdateVisible: false,
|
||||
addOrEditTitle:'',
|
||||
// 搜索框需要的 keys, 与上面 listQuery 的除 pageNo, pageSize 之外的 key 一一对应
|
||||
searchBarKeys: ['inspectionDetContent'],
|
||||
form: {
|
||||
id: null,
|
||||
buttonId: null,
|
||||
inspectionDetContent: [],
|
||||
productionLineId: null,
|
||||
sectionId: null,
|
||||
model: null,
|
||||
keyValue: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getDict() {
|
||||
getUserList({
|
||||
pageNo: 1,
|
||||
pageSize:999
|
||||
}).then((res) => {
|
||||
this.searchBarFormConfig[0].selectOptions = res.data.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name:item.username
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(res => {
|
||||
this.tableData = res.data.list.map((item) => {
|
||||
return {
|
||||
// datas: item.strList.toString(),
|
||||
nickName: item.nickName,
|
||||
userName: item.userName,
|
||||
// sectionId: item.sectionId,
|
||||
// sectionName: item.sectionName
|
||||
}
|
||||
})
|
||||
console.log(this.tableData);
|
||||
this.listQuery.total = res.data.total;
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
buttonId: null,
|
||||
inspectionDetContent: null,
|
||||
productionId: null,
|
||||
sectionId: null,
|
||||
model: null,
|
||||
keyValue: null,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
deleteHandle(id, name, index, data) {
|
||||
// console.log(data)
|
||||
this.$confirm(`确认要删除产线名为${data.userName}的数据项?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.urlOptions.deleteURL(data.userId).then(({ data }) => {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.inspectionDetContent = val.inspectionDetContent ? val.inspectionDetContent : undefined;
|
||||
// this.listQuery.teamId = val.teamId ? val.teamId : undefined;
|
||||
this.getDataList()
|
||||
break;
|
||||
case 'add':
|
||||
// this.addOrEditTitle = '新增';
|
||||
// this.addOrUpdateVisible = true;
|
||||
// this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.handleAddEquipment();
|
||||
});
|
||||
break;
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2022-08-24 11:19:43
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-12-14 09:36:05
|
||||
* @LastEditTime: 2024-01-30 18:00:53
|
||||
* @Description:
|
||||
*/
|
||||
export default {
|
||||
@ -92,7 +92,7 @@ export default {
|
||||
this.$refs.addOrUpdate.init(val.data);
|
||||
});
|
||||
} else if (val.type === "delete") {
|
||||
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
|
||||
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
|
||||
} else if (val.type === "change") {
|
||||
this.changeStatus(val.data.id)
|
||||
} else {
|
||||
|
@ -118,7 +118,7 @@ export default {
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间段',
|
||||
dateType: 'daterange', // datetimerange
|
||||
dateType: 'datetimerange', // datetimerange
|
||||
// format: 'yyyy-MM-dd HH:mm:ss',
|
||||
format: 'yyyy-MM-dd HH:mm:ss',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
|
Loading…
Reference in New Issue
Block a user