浏览代码

feat: 新增模板库使用保存接口调试;按设备发布优先级改为一级-五级

wangshuang 11 月之前
父节点
当前提交
a443fc0288

+ 6 - 0
.env.development

@@ -1,6 +1,7 @@
 ENV = 'alpha'
 
 VUE_APP_BASE_API = '/dev-api'
+#VUE_APP_BASE_API = 'http://172.31.33.2:20001/prod-api'
 
 VUE_APP_MINIO = '/dev-api/oss-api'
 
@@ -23,6 +24,11 @@ VUE_APP_OFFLINE_MAP_PROXY = '/tiles'
 
 VUE_APP_GATEWAY = '192.168.2.120'
 VUE_APP_KEYCLOAK_OPTIONS_URL = 'http://192.168.2.120:9080/auth'
+
+# 孙村服务器
+#VUE_APP_GATEWAY = '172.31.33.2'
+#VUE_APP_KEYCLOAK_OPTIONS_URL = 'http://172.31.33.2:20005/auth'
+
 #浪潮云
 # VUE_APP_GATEWAY = 'msr.inspur.com:8084'
 # VUE_APP_KEYCLOAK_OPTIONS_URL = 'https://msr.inspur.com:8084/auth'

+ 40 - 0
src/api/program.js

@@ -1,4 +1,5 @@
 import request, { tenantRequest } from '@/utils/request'
+import store from '@/store'
 import {
   add,
   update,
@@ -94,6 +95,45 @@ export function updateProgramDraft ({ id, name, duration, itemJsonStr, keyNameLi
   }).then(({ data }) => data)
 }
 
+// 保存模板
+export function saveTemplate ({ name, duration, resolutionRatio, itemJsonStr, keyNameList, base64, generate }) {
+  console.log('name', name)
+  console.log('duration', duration)
+  console.log('resolutionRatio', resolutionRatio)
+  console.log('itemJsonStr', itemJsonStr)
+  console.log('keyNameList', keyNameList)
+  console.log('base64', base64)
+  console.log('generate', generate)
+  const formData = new FormData()
+  const result = /^data:(.+);base64,(.+)$/.exec(base64)
+  if (result) {
+    const binaryString = atob(result[2])
+    const length = binaryString.length
+    const mine = new Uint8Array(length)
+    for (let i = 0; i < length; i++) {
+      mine[i] = binaryString.charCodeAt(i)
+    }
+    formData.append('file', new Blob([mine], { type: result[1] }))
+  }
+  formData.append('userId', store.getters.userId)
+  formData.append('duration', duration)
+  formData.append('resolutionRatio', resolutionRatio)
+  formData.append('itemJsonStr', itemJsonStr)
+  formData.append('tenant', store.getters.tenant)
+  formData.append('org', store.getters.org)
+  name && formData.append('name', name)
+  generate && formData.append('keyNameList', JSON.stringify(keyNameList))
+  console.log('formdata;;;;:', formData)
+
+  return request({
+    url: '/item/template/2item',
+    method: 'POST',
+    data: formData,
+    timeout: 0,
+    custom: true
+  }).then(({ data }) => data)
+}
+
 export function updateProgramDraftName (data) {
   return update({
     url: '/item/origin/updateItemName',

+ 4 - 0
src/components/dialog/MaterialDialog/index.vue

@@ -56,6 +56,7 @@ export default {
       program: null,
       scheduleId: null,
       assets: null,
+      error: null,
       contentSchema: {
         singlePage: true,
         list: this.getContentAssets,
@@ -115,6 +116,9 @@ export default {
         this.$closeLoading(loading)
       })
     },
+    showMessage (type, message) {
+      this.error = { type, message }
+    },
     showSchedule (id) {
       this.scheduleId = id
       this.dialogVisible = true

+ 12 - 4
src/components/dialog/TemplateAssetChooseDialog/index.vue

@@ -289,7 +289,7 @@ import {
 import { getAssetsByQuery } from '@/api/asset'
 import Draggable from 'vuedraggable'
 import {
-  getTemplateProgram, updateProgramDraft
+  getTemplateProgram, saveTemplate
 } from '@/api/program'
 import { WidgetType } from '@/views/screen/material/program/ast/core/constant'
 import WidgetShortcut from '@/views/screen/material/program/ast/components/WidgetShortcut'
@@ -893,15 +893,23 @@ export default {
       console.log('options', options)
       try {
         const base64 = await this.snap()
-        console.log('base64:', base64)
-        const result = await updateProgramDraft({
-          id: this.program.id,
+        // const result = await updateProgramDraft({
+        //   id: this.program.id,
+        //   duration: getDuration(this.node),
+        //   itemJsonStr: JSON.stringify(toJSON(this.node)),
+        //   keyNameList: getUsedAssets(this.node),
+        //   base64,
+        //   ...options
+        // })
+        const result = await saveTemplate({
+          resolutionRatio: '1920x1080',
           duration: getDuration(this.node),
           itemJsonStr: JSON.stringify(toJSON(this.node)),
           keyNameList: getUsedAssets(this.node),
           base64,
           ...options
         })
+
         if (result) {
           this.$message({
             type: 'success',

+ 24 - 0
src/constant.js

@@ -182,6 +182,30 @@ export const EventPriorityInfo = {
   [EventPriority.EMERGENT]: `${EventPriority.EMERGENT} ${EventPriorityDescription[EventPriority.EMERGENT]}`
 }
 
+export const PlayPriority = {
+  FIRST: 1,
+  SECOND: 2,
+  THIRD: 3,
+  FOURTH: 4,
+  FIFTH: 5
+}
+
+export const PlayPriorityDescription = {
+  [PlayPriority.FIRST]: '一级',
+  [PlayPriority.SECOND]: '二级',
+  [PlayPriority.THIRD]: '三级',
+  [PlayPriority.FOURTH]: '四级',
+  [PlayPriority.FIFTH]: '五级'
+}
+
+export const PlayPriorityInfo = {
+  [PlayPriority.FIRST]: `${PlayPriority.FIRST} ${PlayPriorityDescription[PlayPriority.FIRST]}`,
+  [PlayPriority.SECOND]: `${PlayPriority.SECOND} ${PlayPriorityDescription[PlayPriority.SECOND]}`,
+  [PlayPriority.THIRD]: `${PlayPriority.THIRD} ${PlayPriorityDescription[PlayPriority.THIRD]}`,
+  [PlayPriority.FOURTH]: `${PlayPriority.FOURTH} ${PlayPriorityDescription[PlayPriority.FOURTH]}`,
+  [PlayPriority.FIFTH]: `${PlayPriority.FIFTH} ${PlayPriorityDescription[PlayPriority.FIFTH]}`
+}
+
 export const EventFrequency = {
   ONCE: 'ONCE',
   WEEKLY: 'WEEKLY',

+ 6 - 4
src/views/screen/deploy/device/components/PriorityChecking.vue

@@ -29,8 +29,10 @@
 
 <script>
 import {
-  EventPriority,
-  EventPriorityInfo
+  // EventPriority,
+  // EventPriorityInfo,
+  PlayPriority,
+  PlayPriorityInfo
 } from '@/constant.js'
 import { getPublishConfilctPriorities } from '@/api/platform.js'
 
@@ -69,7 +71,7 @@ export default {
       return maxPriority > this.priority ? 'danger' : 'success'
     },
     tagLabel () {
-      return EventPriorityInfo[this.options.maxPriority] || '未知'
+      return PlayPriorityInfo[this.options.maxPriority] || '未知'
     }
   },
   watch: {
@@ -97,7 +99,7 @@ export default {
       getPublishConfilctPriorities({
         deviceIdList: this.deviceIds,
         conflictCheckTimeList: [this.event],
-        minPriority: EventPriority.SCHEDULING
+        minPriority: PlayPriority.FIRST
       }).then(({ data }) => {
         const conflicts = []
         let maxPriority = -1

+ 22 - 18
src/views/screen/deploy/device/index.vue

@@ -172,9 +172,9 @@ import {
   WorkflowType,
   PublishType,
   PublishTargetType,
-  EventPriority,
-  EventPriorityInfo,
-  EventFrequency
+  EventFrequency,
+  PlayPriority,
+  PlayPriorityInfo
 } from '@/constant.js'
 import {
   toDateStr,
@@ -218,23 +218,27 @@ export default {
         { value: PublishDataType.INTERCUT, label: '资源插播' },
         { value: PublishDataType.DEFAULT_PLAYBACK, label: '默认播放' }
       ],
-      priority: EventPriority.INSERTED,
+      priority: PlayPriority.FIRST,
       priorityOptions: [
         {
-          value: EventPriority.SCHEDULING,
-          label: EventPriorityInfo[EventPriority.SCHEDULING]
+          value: PlayPriority.FIRST,
+          label: PlayPriorityInfo[PlayPriority.FIRST]
         },
         {
-          value: EventPriority.INSERTED,
-          label: EventPriorityInfo[EventPriority.INSERTED]
+          value: PlayPriority.SECOND,
+          label: PlayPriorityInfo[PlayPriority.SECOND]
         },
         {
-          value: EventPriority.EMBEDDED,
-          label: EventPriorityInfo[EventPriority.EMBEDDED]
+          value: PlayPriority.THIRD,
+          label: PlayPriorityInfo[PlayPriority.THIRD]
         },
         {
-          value: EventPriority.EMERGENT,
-          label: EventPriorityInfo[EventPriority.EMERGENT]
+          value: PlayPriority.FOURTH,
+          label: PlayPriorityInfo[PlayPriority.FOURTH]
+        },
+        {
+          value: PlayPriority.FIFTH,
+          label: PlayPriorityInfo[PlayPriority.FIFTH]
         }
       ],
       intercutFinishDate: null,
@@ -278,7 +282,7 @@ export default {
         cols: [
           { prop: 'deviceName', label: '设备名称' },
           { prop: 'name', label: '上播内容' },
-          { prop: 'priority', label: '优先级', render: row => EventPriorityInfo[row.priority], size: 'sm', width: 84, align: 'center' },
+          { prop: 'priority', label: '优先级', render: row => PlayPriorityInfo[row.priority], size: 'sm', width: 84, align: 'center' },
           { prop: 'start', label: '开始时间', width: 140, align: 'center' },
           { prop: 'until', label: '结束时间', width: 140, align: 'center' }
         ]
@@ -292,7 +296,7 @@ export default {
         cols: [
           { prop: 'deviceName', label: '设备名称' },
           { prop: 'name', label: '上播内容' },
-          { prop: 'priority', label: '优先级', render: row => EventPriorityInfo[row.priority], size: 'sm', width: 84, align: 'center' },
+          { prop: 'priority', label: '优先级', render: row => PlayPriorityInfo[row.priority], size: 'sm', width: 84, align: 'center' },
           { prop: 'start', label: '开始时间', width: 140, align: 'center' },
           { prop: 'until', label: '结束时间', width: 140, align: 'center' }
         ]
@@ -521,7 +525,7 @@ export default {
           const targets = targetList.map(JSON.parse)
           const { detail: { priority, target } } = targets[0]
 
-          this.eventType = priority === EventPriority.SHIM
+          this.eventType = priority === PlayPriority.FIRST
             ? PublishDataType.DEFAULT_PLAYBACK
             : PublishDataType.NORMAL
           this.priority = priority
@@ -603,7 +607,7 @@ export default {
               options: {
                 programCalendarName: value,
                 resolutionRatio: resolutionRatio || '自适应',
-                remark: EventPriorityInfo[this.priority]
+                remark: PlayPriorityInfo[this.priority]
               }
             }
             if (data && data.length > 0) {
@@ -675,7 +679,7 @@ export default {
             options: {
               programCalendarName: value,
               resolutionRatio: resolutionRatio || '自适应',
-              remark: EventPriorityInfo[EventPriority.SHIM]
+              remark: PlayPriorityInfo[PlayPriority.FIRST]
             }
           }))
         }
@@ -694,7 +698,7 @@ export default {
         targetList: [{
           type: PublishTargetType.EVENT,
           detail: {
-            priority: EventPriority.SHIM,
+            priority: PlayPriority.FIRST,
             freq: EventFrequency.ONCE,
             start: `${toDateStr(new Date())} 00:00:00`,
             target: eventTarget