|
|
@@ -19,7 +19,6 @@
|
|
|
align-center
|
|
|
>
|
|
|
<el-step title="选择设备" />
|
|
|
- <el-step title="选择类型" />
|
|
|
<el-step title="选择内容" />
|
|
|
</el-steps>
|
|
|
<button
|
|
|
@@ -52,7 +51,7 @@
|
|
|
</div>
|
|
|
<div
|
|
|
v-if="active === 1"
|
|
|
- class="c-list fill has-padding u-overflow-y--auto"
|
|
|
+ class="c-list large has-padding u-overflow-y--auto"
|
|
|
>
|
|
|
<div class="c-list__item">
|
|
|
<div class="o-type">发布类型</div>
|
|
|
@@ -69,35 +68,37 @@
|
|
|
v-if="isEvent"
|
|
|
ref="picker"
|
|
|
class="c-list__item"
|
|
|
- :event="eventOptions.inst"
|
|
|
:priority="3"
|
|
|
+ :ratio="resolutionRatio"
|
|
|
vertical
|
|
|
+ @choosen="onChoosenProgram"
|
|
|
/>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="active > 1"
|
|
|
- class="c-list small has-padding u-overflow-y--auto"
|
|
|
- :class="{ large: isEvent, fill: active === 1 }"
|
|
|
- >
|
|
|
- <div class="c-list__item u-bold">{{ typeMsg }}</div>
|
|
|
<div
|
|
|
- v-for="msg in typeMsgs"
|
|
|
- :key="msg"
|
|
|
- class="c-list__item"
|
|
|
+ v-else
|
|
|
+ class="c-list__item c-grid-form medium col"
|
|
|
>
|
|
|
- {{ msg }}
|
|
|
+ <div class="c-grid-form__label required">播放内容</div>
|
|
|
+ <div class="o-schedule-button u-pointer">
|
|
|
+ <div
|
|
|
+ class="o-schedule-button__label has-padding--h"
|
|
|
+ @click="onChooseSchedule"
|
|
|
+ >
|
|
|
+ <div class="u-ellipsis">{{ msg }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <table-dialog
|
|
|
+ ref="scheduleDialog"
|
|
|
+ title="排期选择"
|
|
|
+ size="medium"
|
|
|
+ :schema="scheduleSchema"
|
|
|
+ @choosen="onChoosenSchedule"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div
|
|
|
- v-if="active >= 2"
|
|
|
+ v-if="active > 0 && eventTarget"
|
|
|
class="c-list fill has-padding u-overflow-y--auto"
|
|
|
>
|
|
|
- <div
|
|
|
- class="o-choose-button"
|
|
|
- @click="showChoose"
|
|
|
- >
|
|
|
- 点击选择内容
|
|
|
- </div>
|
|
|
<schedule
|
|
|
v-if="scheduleId"
|
|
|
:schedule="scheduleId"
|
|
|
@@ -111,18 +112,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <table-dialog
|
|
|
- ref="scheduleDialog"
|
|
|
- title="排期选择"
|
|
|
- size="medium"
|
|
|
- :schema="scheduleSchema"
|
|
|
- @choosen="onChooseSchedule"
|
|
|
- />
|
|
|
- <event-target-dialog
|
|
|
- ref="eventTargetDialog"
|
|
|
- :ratio="resolutionRatio"
|
|
|
- @choosen="onChoosenEventTarget"
|
|
|
- />
|
|
|
</wrapper>
|
|
|
</template>
|
|
|
|
|
|
@@ -132,7 +121,6 @@ import { publish } from '@/api/platform'
|
|
|
import {
|
|
|
State,
|
|
|
ScheduleType,
|
|
|
- EventFreq,
|
|
|
EventTarget,
|
|
|
PublishType
|
|
|
} from '@/constant'
|
|
|
@@ -145,20 +133,6 @@ export default {
|
|
|
{ value: PublishType.CALENDAR, label: '排期' },
|
|
|
{ value: PublishType.EVENT, label: '插播' }
|
|
|
],
|
|
|
- freqOptions: [
|
|
|
- { value: EventFreq.ONCE, label: '单次' },
|
|
|
- { value: EventFreq.WEEKLY, label: '每周重复' }
|
|
|
- ],
|
|
|
- weeks: [
|
|
|
- { value: '0', label: '日' },
|
|
|
- { value: '1', label: '一' },
|
|
|
- { value: '2', label: '二' },
|
|
|
- { value: '3', label: '三' },
|
|
|
- { value: '4', label: '四' },
|
|
|
- { value: '5', label: '五' },
|
|
|
- { value: '6', label: '六' }
|
|
|
- ],
|
|
|
- scheduleOptions: null,
|
|
|
active: 0,
|
|
|
selectedDevices: [],
|
|
|
eventOptions: null,
|
|
|
@@ -166,8 +140,7 @@ export default {
|
|
|
condition: { type: ScheduleType.COMPLEX, status: State.RESOLVED },
|
|
|
list: getSchedules,
|
|
|
cols: [{ prop: 'name', label: '名称', align: 'center' }]
|
|
|
- },
|
|
|
- eventTarget: null
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -175,39 +148,17 @@ export default {
|
|
|
switch (this.active) {
|
|
|
case 0:
|
|
|
return this.selectedDevices.length === 0
|
|
|
- case 2:
|
|
|
+ case 1:
|
|
|
return !this.eventTarget
|
|
|
default:
|
|
|
return false
|
|
|
}
|
|
|
},
|
|
|
- btnMsg () {
|
|
|
- return this.active < 3 ? '下一步' : '发布'
|
|
|
- },
|
|
|
- resolutionRatio () {
|
|
|
- return this.selectedDevices[0]?.resolutionRatio
|
|
|
- },
|
|
|
- typeMsg () {
|
|
|
- return this.typeOptions[this.eventOptions?.type - 1]?.label
|
|
|
- },
|
|
|
- typeMsgs () {
|
|
|
- const msgs = []
|
|
|
- if (this.eventOptions?.type === PublishType.EVENT) {
|
|
|
- const { freq, start, until, byDay, startTime, endTime } = this.eventOptions.inst
|
|
|
- switch (freq) {
|
|
|
- case EventFreq.WEEKLY:
|
|
|
- msgs.push(`自${start.split(' ')[0]}开始`)
|
|
|
- until && msgs.push(`至${until.split(' ')[0]}前`)
|
|
|
- msgs.push(`每周${byDay.split(',').map(val => ['日', '一', '二', '三', '四', '五', '六'][val]).join('、')}`)
|
|
|
- msgs.push(`${startTime} - ${endTime}`)
|
|
|
- break
|
|
|
- default:
|
|
|
- msgs.push(`自${start}开始`)
|
|
|
- until && msgs.push(`${until}结束`)
|
|
|
- break
|
|
|
- }
|
|
|
+ eventTarget () {
|
|
|
+ if (this.isCalendar) {
|
|
|
+ return this.eventOptions.schedule
|
|
|
}
|
|
|
- return msgs
|
|
|
+ return this.eventOptions.program
|
|
|
},
|
|
|
isCalendar () {
|
|
|
return this.eventOptions?.type === PublishType.CALENDAR
|
|
|
@@ -215,46 +166,47 @@ export default {
|
|
|
isEvent () {
|
|
|
return this.eventOptions?.type === PublishType.EVENT
|
|
|
},
|
|
|
+ btnMsg () {
|
|
|
+ return this.active < 1 ? '下一步' : '发布'
|
|
|
+ },
|
|
|
+ resolutionRatio () {
|
|
|
+ return this.selectedDevices[0]?.resolutionRatio
|
|
|
+ },
|
|
|
+ typeMsg () {
|
|
|
+ return this.typeOptions[this.eventOptions?.type - 1]?.label
|
|
|
+ },
|
|
|
scheduleId () {
|
|
|
- return this.eventOptions?.type === PublishType.CALENDAR || this.eventTarget?.type === EventTarget.RECUR ? this.eventTarget?.id : null
|
|
|
+ return this.eventOptions?.type === PublishType.CALENDAR || this.eventTarget?.type === EventTarget.RECUR ? this.eventTarget.id : null
|
|
|
},
|
|
|
programId () {
|
|
|
return this.eventTarget?.type === EventTarget.PROGRAM ? this.eventTarget.id : null
|
|
|
+ },
|
|
|
+ msg () {
|
|
|
+ return this.eventTarget?.name ?? '点击选择内容'
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
onPresent () {
|
|
|
if (this.active > 0) {
|
|
|
- if (this.active === 3) {
|
|
|
- this.active -= 2
|
|
|
- } else {
|
|
|
- this.active -= 1
|
|
|
- }
|
|
|
+ this.active -= 1
|
|
|
}
|
|
|
},
|
|
|
onNext () {
|
|
|
- let pass = false
|
|
|
switch (this.active) {
|
|
|
case 0:
|
|
|
- pass = this.checkDevices()
|
|
|
- break
|
|
|
- case 1:
|
|
|
- pass = this.checkEventOptions()
|
|
|
- if (pass && this.checkEventTarget()) {
|
|
|
+ if (this.checkDevices()) {
|
|
|
this.active += 1
|
|
|
}
|
|
|
break
|
|
|
- case 2:
|
|
|
- pass = this.checkEventTarget()
|
|
|
- break
|
|
|
- case 3:
|
|
|
- this.publish()
|
|
|
+ case 1:
|
|
|
+ this.publish().then(() => {
|
|
|
+ this.active = 0
|
|
|
+ this.$refs.tree.reset()
|
|
|
+ this.eventOptions = null
|
|
|
+ })
|
|
|
break
|
|
|
default:
|
|
|
- return
|
|
|
- }
|
|
|
- if (pass) {
|
|
|
- this.active += 1
|
|
|
+ break
|
|
|
}
|
|
|
},
|
|
|
onError (message) {
|
|
|
@@ -277,67 +229,26 @@ export default {
|
|
|
if (devices.some(device => device.resolutionRatio !== resolutionRatio)) {
|
|
|
return this.onError('选择的设备分辨率不一致')
|
|
|
}
|
|
|
- if (this.eventOptions) {
|
|
|
- if (this.resolutionRatio !== this.eventOptions.ratio) {
|
|
|
- this.eventTarget = null
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.eventOptions = this.createEventOptions()
|
|
|
- }
|
|
|
+ this.eventOptions = this.createEventOptions()
|
|
|
return true
|
|
|
},
|
|
|
createEventOptions () {
|
|
|
return {
|
|
|
ratio: this.resolutionRatio,
|
|
|
type: PublishType.CALENDAR,
|
|
|
- inst: null
|
|
|
+ schedule: null,
|
|
|
+ program: null
|
|
|
}
|
|
|
},
|
|
|
- checkEventOptions () {
|
|
|
- if (this.eventOptions.type === PublishType.EVENT) {
|
|
|
- const event = this.$refs.picker.getValue()
|
|
|
- if (!event) {
|
|
|
- return false
|
|
|
- }
|
|
|
- this.eventOptions.inst = event
|
|
|
- }
|
|
|
- return true
|
|
|
- },
|
|
|
- showChoose () {
|
|
|
- switch (this.eventOptions?.type) {
|
|
|
- case PublishType.CALENDAR:
|
|
|
- this.$refs.scheduleDialog.show({ resolutionRatio: this.resolutionRatio })
|
|
|
- break
|
|
|
- case PublishType.EVENT:
|
|
|
- this.$refs.eventTargetDialog.show()
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
+ onChoosenProgram (val) {
|
|
|
+ this.eventOptions.program = val
|
|
|
},
|
|
|
- onChooseSchedule ({ value: { id, name }, done }) {
|
|
|
- done()
|
|
|
- this.eventTarget = { id, name }
|
|
|
- if (this.active === 2) {
|
|
|
- this.onNext()
|
|
|
- }
|
|
|
+ onChooseSchedule () {
|
|
|
+ this.$refs.scheduleDialog.show({ resolutionRatio: this.resolutionRatio })
|
|
|
},
|
|
|
- onChoosenEventTarget ({ value, done }) {
|
|
|
+ onChoosenSchedule ({ value: { id, name }, done }) {
|
|
|
done()
|
|
|
- this.eventTarget = value
|
|
|
- if (this.active === 2) {
|
|
|
- this.onNext()
|
|
|
- }
|
|
|
- },
|
|
|
- checkEventTarget () {
|
|
|
- if (this.isCalendar && this.eventTarget?.type || this.isEvent && this.eventTarget && !this.eventTarget.type) {
|
|
|
- this.eventTarget = null
|
|
|
- }
|
|
|
- if (!this.eventTarget) {
|
|
|
- this.showChoose()
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
+ this.eventOptions.schedule = { id, name }
|
|
|
},
|
|
|
onViewProgram () {
|
|
|
window.open(this.$router.resolve({
|
|
|
@@ -346,42 +257,36 @@ export default {
|
|
|
}).href, '_blank')
|
|
|
},
|
|
|
getPublishTarget () {
|
|
|
- switch (this.eventOptions.type) {
|
|
|
- case PublishType.CALENDAR:
|
|
|
- return {
|
|
|
- type: PublishType.CALENDAR,
|
|
|
- detail: this.eventTarget.id
|
|
|
- }
|
|
|
- case PublishType.EVENT:
|
|
|
- return {
|
|
|
- type: PublishType.EVENT,
|
|
|
- detail: {
|
|
|
- ...this.eventOptions.inst,
|
|
|
- target: this.eventTarget
|
|
|
- }
|
|
|
- }
|
|
|
- default:
|
|
|
- return null
|
|
|
+ if (this.eventOptions.type === PublishType.CALENDAR) {
|
|
|
+ return Promise.resolve({
|
|
|
+ type: PublishType.CALENDAR,
|
|
|
+ detail: this.eventTarget.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const event = this.$refs.picker.getValue()
|
|
|
+ if (event) {
|
|
|
+ return Promise.resolve({
|
|
|
+ type: PublishType.EVENT,
|
|
|
+ detail: { ...event }
|
|
|
+ })
|
|
|
}
|
|
|
+ return Promise.reject()
|
|
|
},
|
|
|
publish () {
|
|
|
- const devices = this.selectedDevices
|
|
|
- this.$confirm(
|
|
|
- `对设备 ${devices.map(device => device.name)}`,
|
|
|
- `发布 ${this.typeMsg} ${this.eventTarget.name}`,
|
|
|
- { type: 'warning' }
|
|
|
- ).then(() => publish(
|
|
|
- devices.map(device => device.id),
|
|
|
- this.getPublishTarget(),
|
|
|
- {
|
|
|
- programCalendarName: this.eventTarget.name,
|
|
|
- resolutionRatio: this.resolutionRatio
|
|
|
- }
|
|
|
- )).then(() => {
|
|
|
- this.active = 0
|
|
|
- this.$refs.tree.reset()
|
|
|
- this.eventOptions = null
|
|
|
- this.eventTarget = null
|
|
|
+ return this.getPublishTarget().then(eventTarget => {
|
|
|
+ const devices = this.selectedDevices
|
|
|
+ return this.$confirm(
|
|
|
+ `对设备 ${devices.map(device => device.name)}`,
|
|
|
+ `发布 ${this.typeMsg} ${this.eventTarget.name}`,
|
|
|
+ { type: 'warning' }
|
|
|
+ ).then(() => publish(
|
|
|
+ devices.map(device => device.id),
|
|
|
+ eventTarget,
|
|
|
+ {
|
|
|
+ programCalendarName: this.eventTarget.name,
|
|
|
+ resolutionRatio: this.resolutionRatio
|
|
|
+ }
|
|
|
+ ))
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
@@ -398,9 +303,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
.c-list {
|
|
|
- flex: 1 0 200px;
|
|
|
+ flex: 0 0 200px;
|
|
|
min-width: 200px;
|
|
|
- max-width: 300px;
|
|
|
padding-right: $spacing;
|
|
|
color: $black;
|
|
|
|
|
|
@@ -408,18 +312,13 @@ export default {
|
|
|
border-left: 1px solid $gray--light;
|
|
|
}
|
|
|
|
|
|
- &.small {
|
|
|
- min-width: 100px;
|
|
|
- max-width: 200px;
|
|
|
- }
|
|
|
-
|
|
|
&.large {
|
|
|
- min-width: 240px;
|
|
|
- max-width: 320px;
|
|
|
+ min-width: 336px;
|
|
|
+ max-width: 336px;
|
|
|
}
|
|
|
|
|
|
&.fill {
|
|
|
- max-width: initial;
|
|
|
+ flex: 1 0 200px;
|
|
|
}
|
|
|
|
|
|
&__item {
|
|
|
@@ -442,24 +341,27 @@ export default {
|
|
|
line-height: 1;
|
|
|
}
|
|
|
|
|
|
-.o-choose-button {
|
|
|
- padding: 20px 0;
|
|
|
- margin-bottom: $spacing;
|
|
|
- font-size: 20px;
|
|
|
- text-align: center;
|
|
|
- border: 1px solid $gray--light;
|
|
|
- color: $black;
|
|
|
- cursor: pointer;
|
|
|
+.o-schedule-button {
|
|
|
+ position: relative;
|
|
|
+ width: 217px;
|
|
|
+ height: 40px;
|
|
|
+ color: $blue;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1;
|
|
|
+ border-radius: $radius--mini;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
|
|
|
&:hover {
|
|
|
- color: #409eff;
|
|
|
- border-color: #c6e2ff;
|
|
|
- background-color: $blue--light;
|
|
|
+ border-color: #c0c4cc;
|
|
|
}
|
|
|
|
|
|
- &:active {
|
|
|
- color: #3a8ee6;
|
|
|
- border-color: #3a8ee6;
|
|
|
+ &__label {
|
|
|
+ display: inline-flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
}
|
|
|
|