|
|
@@ -9,10 +9,9 @@
|
|
|
<div class="l-flex__none l-flex--row c-step__header">
|
|
|
<button
|
|
|
class="l-flex__none c-sibling-item o-button"
|
|
|
- :class="{ hidden: active === 0 }"
|
|
|
@click="onPresent"
|
|
|
>
|
|
|
- 上一步
|
|
|
+ {{ presentBtnMsg }}
|
|
|
</button>
|
|
|
<el-steps
|
|
|
:active="active"
|
|
|
@@ -60,7 +59,6 @@
|
|
|
<el-select
|
|
|
v-model="eventOptions.type"
|
|
|
class="c-sibling-item--v nearer u-width--sm"
|
|
|
- @change="onChangeType"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="option in typeOptions"
|
|
|
@@ -106,6 +104,13 @@
|
|
|
/>
|
|
|
</template>
|
|
|
</div>
|
|
|
+ <radio-table-dialog
|
|
|
+ ref="workflowTableDialog"
|
|
|
+ title="历史编单"
|
|
|
+ :schema="workflowSchema"
|
|
|
+ @confirm="onChooseWorkflow"
|
|
|
+ />
|
|
|
+ <workflow-dialog ref="workflowDialog" />
|
|
|
<event-frequency-config-dialog
|
|
|
ref="eventFrequencyConfigDialog"
|
|
|
@confirm="onConfirmEventFrequency"
|
|
|
@@ -131,8 +136,8 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
+ State,
|
|
|
EventTarget,
|
|
|
- EventTargetInfo,
|
|
|
PublishType,
|
|
|
PublishTargetType,
|
|
|
EventPriority,
|
|
|
@@ -145,6 +150,11 @@ import {
|
|
|
getEventDescription
|
|
|
} from '@/utils/event'
|
|
|
import { publish } from '@/api/platform'
|
|
|
+import {
|
|
|
+ getWorkflowsByUser,
|
|
|
+ getWorkflowDetail
|
|
|
+} from '@/api/workflow'
|
|
|
+import WorkflowDialog from '../workflow/components/WorkflowDialog.vue'
|
|
|
import EventFrequencyConfigDialog from '../components/EventFrequencyConfigDialog.vue'
|
|
|
|
|
|
const DEFAULT_PLAYBACK = 'DEFAULT_PLAYBACK'
|
|
|
@@ -152,6 +162,7 @@ const DEFAULT_PLAYBACK = 'DEFAULT_PLAYBACK'
|
|
|
export default {
|
|
|
name: 'DeployDevice',
|
|
|
components: {
|
|
|
+ WorkflowDialog,
|
|
|
EventFrequencyConfigDialog
|
|
|
},
|
|
|
data () {
|
|
|
@@ -166,7 +177,7 @@ export default {
|
|
|
{ value: EventPriority.EMBEDDED, label: EventPriorityInfo[EventPriority.EMBEDDED] },
|
|
|
{ value: EventPriority.EMERGENT, label: EventPriorityInfo[EventPriority.EMERGENT] }
|
|
|
],
|
|
|
- eventOptions: null,
|
|
|
+ eventOptions: { type: PublishTargetType.EVENT },
|
|
|
typeOptions: [
|
|
|
{ value: PublishTargetType.EVENT, label: '事件' },
|
|
|
{ value: DEFAULT_PLAYBACK, label: '默认播放' }
|
|
|
@@ -186,7 +197,31 @@ export default {
|
|
|
},
|
|
|
events: [],
|
|
|
eventTarget: this.createEventTarget(),
|
|
|
- conflicts: []
|
|
|
+ conflicts: [],
|
|
|
+ workflowSchema: {
|
|
|
+ list: getWorkflowsByUser,
|
|
|
+ filters: [
|
|
|
+ { key: 'status', type: 'select', placeholder: '流程状态', options: [
|
|
|
+ { value: State.SUBMITTED, label: '待审核' },
|
|
|
+ { value: State.RESOLVED, label: '通过' },
|
|
|
+ { value: State.REJECTED, label: '驳回' }
|
|
|
+ ] }
|
|
|
+ ],
|
|
|
+ cols: [
|
|
|
+ { prop: 'flowDesc', label: '优先级', width: 100, align: 'center' },
|
|
|
+ { prop: 'flowName', label: '上播内容' },
|
|
|
+ { label: '状态', type: 'tag', render: ({ status }) => {
|
|
|
+ return {
|
|
|
+ type: ['', 'primary', 'success', 'danger'][status],
|
|
|
+ label: ['', '待审核', '通过', '驳回'][status]
|
|
|
+ }
|
|
|
+ } },
|
|
|
+ { prop: 'createTime', label: '提交时间', width: 160, align: 'center' },
|
|
|
+ { type: 'invoke', render: [
|
|
|
+ { label: '详情', on: this.onViewWorkflow }
|
|
|
+ ] }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -199,15 +234,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
isDefaultPlayback () {
|
|
|
- return this.eventOptions?.type === DEFAULT_PLAYBACK
|
|
|
+ return this.eventOptions.type === DEFAULT_PLAYBACK
|
|
|
+ },
|
|
|
+ presentBtnMsg () {
|
|
|
+ return this.active === 0 ? '导入历史编单' : '上一步'
|
|
|
},
|
|
|
btnMsg () {
|
|
|
return this.active < 1 ? '下一步' : '发布'
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ createEventTarget (options) {
|
|
|
+ return { type: EventTarget.ASSETS, ...options }
|
|
|
+ },
|
|
|
onPresent () {
|
|
|
- if (this.active > 0) {
|
|
|
+ if (this.active === 0) {
|
|
|
+ this.$refs.workflowTableDialog.show()
|
|
|
+ } else {
|
|
|
this.active = 0
|
|
|
}
|
|
|
},
|
|
|
@@ -223,9 +266,6 @@ export default {
|
|
|
this.publish().then(() => {
|
|
|
this.active = 0
|
|
|
this.$refs.tree.reset()
|
|
|
- this.eventOptions = null
|
|
|
- this.priority = EventPriority.INSERTED
|
|
|
- this.events = []
|
|
|
this.eventTarget = this.createEventTarget()
|
|
|
})
|
|
|
break
|
|
|
@@ -236,12 +276,6 @@ export default {
|
|
|
onChange (devices) {
|
|
|
this.selectedDevices = devices
|
|
|
},
|
|
|
- createEventOptions (type) {
|
|
|
- return {
|
|
|
- type,
|
|
|
- target: null
|
|
|
- }
|
|
|
- },
|
|
|
checkDevices () {
|
|
|
const devices = this.selectedDevices
|
|
|
const length = devices.length
|
|
|
@@ -260,25 +294,17 @@ export default {
|
|
|
// '选择的设备分辨率不一致',
|
|
|
// { type: 'warning' }
|
|
|
// ).then(() => {
|
|
|
- // this.eventOptions = this.createEventOptions(PublishTargetType.EVENT)
|
|
|
// this.active += 1
|
|
|
// })
|
|
|
// return false
|
|
|
} else {
|
|
|
this.ratio = ratio
|
|
|
}
|
|
|
- this.eventOptions = this.createEventOptions(PublishTargetType.EVENT)
|
|
|
return true
|
|
|
},
|
|
|
- onChangeType (type) {
|
|
|
- this.eventOptions = this.createEventOptions(type)
|
|
|
- },
|
|
|
onView ({ id }) {
|
|
|
this.$refs.materialDialog.showSchedule(id)
|
|
|
},
|
|
|
- createEventTarget () {
|
|
|
- return { type: EventTarget.ASSETS }
|
|
|
- },
|
|
|
getEvents () {
|
|
|
return Promise.resolve(({ data: this.events }))
|
|
|
},
|
|
|
@@ -379,7 +405,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}),
|
|
|
- name: detail?.name || EventTargetInfo[eventTarget.type],
|
|
|
+ name: detail?.name || '',
|
|
|
resolutionRatio: detail?.resolutionRatio
|
|
|
})
|
|
|
},
|
|
|
@@ -411,6 +437,47 @@ export default {
|
|
|
)
|
|
|
)
|
|
|
)
|
|
|
+ },
|
|
|
+ onViewWorkflow ({ id }) {
|
|
|
+ this.$refs.workflowDialog.show(id)
|
|
|
+ },
|
|
|
+ onChooseWorkflow ({ value: { id }, done }) {
|
|
|
+ getWorkflowDetail(id, { loading: true }).then(({ data }) => {
|
|
|
+ const { programCalendarName, calendarReleaseDeviceList, targetList } = data
|
|
|
+ const targets = targetList.map(JSON.parse)
|
|
|
+ this.events = targets.map(({ detail: { priority, target, ...event } }) => {
|
|
|
+ return {
|
|
|
+ key: `${Date.now()}_${Math.random().toString(16).slice(2)}`,
|
|
|
+ origin: event,
|
|
|
+ time: getEventDescription(event)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const { detail: { priority, target } } = targets[0]
|
|
|
+ this.priority = priority
|
|
|
+ this.eventOptions.type = priority === DEFAULT_PLAYBACK ? DEFAULT_PLAYBACK : PublishTargetType.EVENT
|
|
|
+ this.eventTarget = target.type === EventTarget.ASSETS
|
|
|
+ ? {
|
|
|
+ name: programCalendarName,
|
|
|
+ ...this.createEventTarget(target)
|
|
|
+ }
|
|
|
+ : this.createEventTarget(target)
|
|
|
+ const deviceCount = calendarReleaseDeviceList.length
|
|
|
+ const validDevices = calendarReleaseDeviceList.filter(({ deviceName }) => !!deviceName)
|
|
|
+ const validDeviceCount = validDevices.length
|
|
|
+ const diffDeviceCount = this.$refs.tree.reset(validDevices.map(({ deviceId }) => deviceId))
|
|
|
+ console.log('deploy import', diffDeviceCount, validDeviceCount, deviceCount)
|
|
|
+ if (diffDeviceCount > 0 || validDeviceCount !== deviceCount) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '部分设备无操作权限或已移除,请确认设备'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.onNext()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ done()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|