|
|
@@ -31,21 +31,12 @@
|
|
|
>
|
|
|
<div class="l-flex__none l-flex--row has-bottom-padding">
|
|
|
<div class="l-flex__auto c-sibling-item" />
|
|
|
- <el-select
|
|
|
+ <schema-select
|
|
|
v-model="deviceOptions.params.productId"
|
|
|
class="c-sibling-item"
|
|
|
- placeholder="请选择产品"
|
|
|
- :loading="fetching"
|
|
|
- @visible-change="getProducts"
|
|
|
- @change="search"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in productOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ placeholder="全部产品"
|
|
|
+ :schema="productSelectSchema"
|
|
|
+ />
|
|
|
<el-date-picker
|
|
|
v-model="current"
|
|
|
class="l-flex__none c-sibling-item u-pointer"
|
|
|
@@ -200,6 +191,10 @@ import {
|
|
|
getDevices,
|
|
|
getTimeline
|
|
|
} from '@/api/device'
|
|
|
+import {
|
|
|
+ EventFreq,
|
|
|
+ ScheduleType
|
|
|
+} from '@/constant'
|
|
|
import { createListOptions } from '@/utils'
|
|
|
import {
|
|
|
toDate,
|
|
|
@@ -213,21 +208,17 @@ import {
|
|
|
pickMax
|
|
|
} from '@/utils/event'
|
|
|
import { EventCache } from '@/utils/cache'
|
|
|
-import {
|
|
|
- EventFreq,
|
|
|
- ScheduleType
|
|
|
-} from '@/constant'
|
|
|
|
|
|
export default {
|
|
|
name: 'ScheduleTimeline',
|
|
|
data () {
|
|
|
return {
|
|
|
- productOptions: [
|
|
|
- { value: '', label: '全部设备' }
|
|
|
- ],
|
|
|
- loaded: false,
|
|
|
- fetching: false,
|
|
|
- firstLoadSize: 999,
|
|
|
+ productSelectSchema: {
|
|
|
+ remote: getProducts,
|
|
|
+ pagination: true,
|
|
|
+ value: 'id',
|
|
|
+ label: 'name'
|
|
|
+ },
|
|
|
deviceOptions: createListOptions({
|
|
|
productId: '',
|
|
|
name: '',
|
|
|
@@ -278,28 +269,6 @@ export default {
|
|
|
clearInterval(this.$timer)
|
|
|
},
|
|
|
methods: {
|
|
|
- _getProducts () {
|
|
|
- this.fetching = true
|
|
|
- getProducts({ pageNum: 1, pageSize: this.firstLoadSize }).then(({ data, totalCount }) => {
|
|
|
- if (totalCount > this.firstLoadSize) {
|
|
|
- this.firstLoadSize = totalCount
|
|
|
- this._getProducts()
|
|
|
- } else {
|
|
|
- this.productOptions = this.productOptions.concat(data.map(({ id, name }) => {
|
|
|
- return { value: id, label: name }
|
|
|
- }))
|
|
|
- this.fetching = false
|
|
|
- this.loaded = true
|
|
|
- }
|
|
|
- }, () => {
|
|
|
- this.fetching = false
|
|
|
- })
|
|
|
- },
|
|
|
- getProducts (visible) {
|
|
|
- if (visible && !this.fetching && !this.loaded) {
|
|
|
- this._getProducts()
|
|
|
- }
|
|
|
- },
|
|
|
getDevices () {
|
|
|
this.device = null
|
|
|
if (this.programProxy) {
|
|
|
@@ -469,7 +438,6 @@ export default {
|
|
|
for (let i = 0; i < events.length; i++) {
|
|
|
const event = events[i]
|
|
|
const { startDateTime, endDateTime } = event
|
|
|
- i += 1
|
|
|
if (endDateTime && endDateTime <= this.$startDateTime || startDateTime >= this.$endDateTime) {
|
|
|
continue
|
|
|
}
|