Этот коммит содержится в:
g7hoo 2022-10-17 16:59:11 +08:00
родитель ca7fda73e3 762861a922
Коммит 8447b8f7ab
3 изменённых файлов: 63 добавлений и 52 удалений

Просмотреть файл

@ -48,7 +48,8 @@
<transition mode="out-in" name="slide-to-left">
<equipment-efficiency-graph v-if="showGraph" key="graph" ref="eegraph" @close-graph="showGraph = false" />
<base-table v-else :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" />
<base-table v-else :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)"
@operate-event="handleOperations" @refreshDataList="getDataList" />
<!-- v-loading="dataIsLoading " -->
</transition>
<!-- <el-pagination
@ -66,11 +67,11 @@
<script>
import i18n from '@/i18n'
import BaseTable from '@/components/base-table'
import TableOperateComponent from '@/components/base-table/components/operationComponent'
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
import TableTextComponent from '@/components/base-table/components/detailComponent'
import EquipmentEfficiencyGraph from './equipmentEfficiencyGraph.vue'
import { calcMaxHeight } from '@/utils'
import { timeFilter } from '@/utils/filters'
// import { timeFilter } from '@/utils/filters'
import moment from 'moment'
const tableConfigs = [
@ -171,9 +172,10 @@ export default {
EquipmentEfficiencyGraph
},
created() {
this.getFactoryList()
this.getProductLineList()
activated() {
this.getFactoryList().then(() => {
this.getProductLineList()
})
},
watch: {
timeType() {
@ -184,12 +186,12 @@ export default {
methods: {
//
getFactoryList() {
this.$http({
url: this.$http.adornUrl('/monitoring/factory/page'),
return this.$http({
url: this.$http.adornUrl('/monitoring/factory/list'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.factoryList = data.data.list
}).then(({ data: res }) => {
if (res && res.code === 0) {
this.factoryList = res.data
/** set default */
if (this.factoryList.length) {
this.dataForm.ftId = this.factoryList[0].id
@ -200,20 +202,31 @@ export default {
}
})
},
//
handleFactoryChange(val) {
this.getProductLineList()
},
// 线
getProductLineList() {
this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/page'),
const query = {
url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.productLineList = data.data.list
}
if (this.dataForm.ftId) {
query.params = this.$http.adornParams({
factoryId: this.dataForm.ftId
});
}
this.$http(query).then(({ data: res }) => {
if (res && res.code === 0 && res.data.length) {
this.productLineList = res.data
/** set default */
if (this.productLineList.length) {
this.dataForm.productlines = [this.productLineList[0].id]
}
this.dataForm.productlines = [this.productLineList[0].id]
} else {
this.productLineList = []
this.dataForm.productlines = []
}
})
},

Просмотреть файл

@ -96,7 +96,7 @@ export default {
BaseTable
},
created() {
activated() {
// this.getFactoryList()
this.getProductLineList()
},
@ -123,17 +123,18 @@ export default {
// 线
getProductLineList() {
this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/page'),
url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.productLineList = data.data.list
}).then(({ data: res }) => {
if (res && res.code === 0) {
this.productLineList = res.data
/** set default */
if (this.productLineList.length) {
this.dataForm.productlines = [this.productLineList[0].id]
}
} else {
this.productLineList = []
this.dataForm.productlines = []
}
})
},

Просмотреть файл

@ -5,7 +5,8 @@
<!-- 产线 -->
<el-form-item>
<el-select v-model="dataForm.productlines" :placeholder="'产线'" @change="handleProductLineChange" clearable>
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id" :label="productLine.name" />
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id"
:label="productLine.name" />
</el-select>
</el-form-item>
<!-- 工序 -->
@ -30,14 +31,8 @@
</el-form>
<div class="time-chart" style="margin-top: 10px;">
<div
v-show="equipmentCount > 0"
id="time-chart__inner"
ref="time-chart__inner"
class="time-chart__inner"
style="min-height: 50vh;"
:style="{ height: autoHeight + 'px', width: '100%' }"
/>
<div v-show="equipmentCount > 0" id="time-chart__inner" ref="time-chart__inner" class="time-chart__inner"
style="min-height: 50vh;" :style="{ height: autoHeight + 'px', width: '100%' }" />
<div v-show="equipmentCount === 0">请先查询数据</div>
<!-- <div v-show="equipmentCount === 0">{{ $t('module.basicData.visual.hints.searchFirst') }}</div> -->
</div>
@ -107,7 +102,7 @@ class ChartOption {
}
}
this.tooltip = {
formatter: function(params) {
formatter: function (params) {
return moment(params.value[1]).format('YYYY-MM-DD HH:mm:ss') + ' - ' + moment(params.value[2]).format('YYYY-MM-DD HH:mm:ss') + ' : ' + params.name
}
}
@ -132,7 +127,7 @@ class ChartOption {
show: true
},
axisLabel: {
formatter: function(val) {
formatter: function (val) {
const time = new Date(val)
const hour = time.getHours()
const minute = time.getMinutes()
@ -223,17 +218,14 @@ export default {
BaseTable
},
computed: {
autoHeight: function() {
autoHeight: function () {
return Object.keys(this.equipments).length * 100 || 500
},
equipmentCount: function() {
equipmentCount: function () {
return Object.keys(this.equipments).length
}
},
created() {
this.getProductLineList().then(() => {
this.getWorksetionList()
})
this.getEqList()
},
mounted() {
@ -241,6 +233,11 @@ export default {
this.initChart()
})
},
activated() {
this.getProductLineList().then(() => {
this.getWorksetionList()
})
},
updated() {
if (this.chart) this.chart.resize()
},
@ -259,11 +256,11 @@ export default {
// 线
getProductLineList() {
return this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/page'),
url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.productLineList = data.data.list
}).then(({ data: res }) => {
if (res && res.code === 0) {
this.productLineList = res.data
/** set default */
if (this.productLineList.length) {
this.dataForm.productlines = this.productLineList[0].id
@ -354,13 +351,13 @@ export default {
getDataList() {
let startTime = this.rawTime
? moment(this.rawTime)
.set({ hour: 0, minute: 0, second: 0, millisecond: 0 })
.format('YYYY-MM-DDTHH:mm:ss')
.set({ hour: 0, minute: 0, second: 0, millisecond: 0 })
.format('YYYY-MM-DDTHH:mm:ss')
: ''
let endTime = startTime
? moment(startTime)
.add(1, 'd')
.format('YYYY-MM-DDTHH:mm:ss')
.add(1, 'd')
.format('YYYY-MM-DDTHH:mm:ss')
: ''
// this.dataListLoading = true
@ -471,13 +468,13 @@ export default {
dialogConfirm() {
let startTime = this.rawTime
? moment(this.rawTime)
.set({ hour: 0, minute: 0, second: 0, millisecond: 0 })
.format('YYYY-MM-DDTHH:mm:ss')
.set({ hour: 0, minute: 0, second: 0, millisecond: 0 })
.format('YYYY-MM-DDTHH:mm:ss')
: ''
let endTime = startTime
? moment(startTime)
.add(1, 'd')
.format('YYYY-MM-DDTHH:mm:ss')
.add(1, 'd')
.format('YYYY-MM-DDTHH:mm:ss')
: ''
const condition = {