diff --git a/src/views/modules/monitoring/equipmentEfficiency.vue b/src/views/modules/monitoring/equipmentEfficiency.vue
index 87b398b..956cda2 100644
--- a/src/views/modules/monitoring/equipmentEfficiency.vue
+++ b/src/views/modules/monitoring/equipmentEfficiency.vue
@@ -2,13 +2,39 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $t('search') }}
- {{ $t('add') }}
- {{ $t('export') }}
+
@@ -38,6 +64,7 @@ import CKEditor from 'ckeditor4-vue'
import { calcMaxHeight } from '@/utils'
import { timeFilter } from '@/utils/filters'
import Cookies from 'js-cookie'
+import moment from 'moment'
const tableConfigs = [
{
@@ -241,11 +268,21 @@ const addOrUpdateConfigs = {
export default {
data() {
return {
+ /** hfxny part */
+ factoryList: [],
+ productLineList: [],
+ /** */
calcMaxHeight,
tableConfigs,
addOrUpdateConfigs,
+ timeType: 'range',
+ rawTime: null, // [] or datetime
dataForm: {
- key: ''
+ type: 1,
+ ftId: null,
+ productlines: [],
+ startTime: null,
+ entTime: null
},
dataList: [],
pageIndex: 1,
@@ -260,13 +297,80 @@ export default {
AddOrUpdate,
BaseTable
},
- activated() {
- console.log('activated')
- this.getDataList()
- this.getGroupList()
- this.getTypeList()
+ // activated() {
+ // console.log('activated')
+ // this.getDataList()
+ // this.getGroupList()
+ // this.getTypeList()
+ // },
+ created() {
+ this.getFactoryList()
+ this.getProductLineList()
+ },
+ watch: {
+ timeType() {
+ // 防止切换日期类型时报错
+ this.rawTime = null
+ }
},
methods: {
+ // 获取工厂列表
+ getFactoryList() {
+ this.$http({
+ url: this.$http.adornUrl('/monitoring/factory/page'),
+ method: 'get'
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.factoryList = data.data.list
+ /** set default */
+ if (this.factoryList.length) {
+ this.dataForm.ftId = this.factoryList[0].id
+ }
+ } else {
+ this.factoryList = []
+ this.dataForm.ftId = null
+ }
+ })
+ },
+ // 获取产线列表
+ getProductLineList() {
+ this.$http({
+ url: this.$http.adornUrl('/monitoring/productionLine/page'),
+ method: 'get'
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.productLineList = data.data.list
+ /** set default */
+ if (this.productLineList.length) {
+ this.dataForm.productlines = [this.productLineList[0].id]
+ }
+ } else {
+ this.productLineList = []
+ }
+ })
+ },
+ // 时间类型预处理
+ getTimeRange() {
+ let startTime
+ let endTime
+
+ if (this.headFormValue.timeValue instanceof Array) {
+ startTime = this.headFormValue.timeValue[0] ? moment(this.headFormValue.timeValue[0]).format('YYYY-MM-DDTHH:mm:ss') : '' // 强制axios使用北京时间
+ endTime = this.headFormValue.timeValue[1] ? moment(this.headFormValue.timeValue[1]).format('YYYY-MM-DDTHH:mm:ss') : ''
+ } else {
+ if (this.headFormValue.timeValue) {
+ startTime = moment(this.headFormValue.timeValue).format('YYYY-MM-DDTHH:mm:ss')
+ endTime = moment(startTime)
+ .add(1, 'd')
+ .format('YYYY-MM-DDTHH:mm:ss')
+ } else {
+ startTime = ''
+ endTime = ''
+ }
+ }
+
+ return { startTime, endTime }
+ },
// 获取设备类型列表
getTypeList() {
this.$http({