Explorar o código

feat: playlist export

Casper Dai %!s(int64=2) %!d(string=hai) anos
pai
achega
6ee3e6c03f

+ 3 - 3
.env.development

@@ -16,6 +16,6 @@ VUE_APP_GATEWAY = 'isoc.artaplay.com:8443'
 # 浪潮云
 # VUE_APP_GATEWAY = 'msr.inspur.com:8084'
 # VUE_APP_KEYCLOAK_OPTIONS_URL = 'https://msr.inspur.com:8084/auth'
-# 唐山
-# VUE_APP_GATEWAY = '103.89.225.99:9500'
-# VUE_APP_KEYCLOAK_OPTIONS_URL = 'http://103.89.225.99:9500/auth'
+# 屏管家
+# VUE_APP_GATEWAY = '172.31.4.238'
+# VUE_APP_KEYCLOAK_OPTIONS_URL = 'http://172.31.4.238/auth'

+ 42 - 7
src/views/realm/org/index.vue

@@ -19,7 +19,9 @@
             class="l-flex__none c-sibling-item el-icon-circle-plus-outline u-font-size--lg u-color--blue u-bold has-active"
             @click.stop="onAddRoot"
           />
-          <div class="l-flex__auto c-sibling-item near u-font-size--md u-ellipsis">部门</div>
+          <div class="l-flex__auto c-sibling-item near u-font-size--md u-ellipsis">
+            部门
+          </div>
         </div>
         <div class="l-flex__fill c-sibling-item--v u-overflow--auto">
           <el-tree
@@ -51,19 +53,25 @@
             class="l-flex--row c-contentmenu__item has-active"
             @click="onEditNode"
           >
-            <i class="c-sibling-item el-icon-edit" /><span class="c-sibling-item">重命名</span>
+            <i class="c-sibling-item el-icon-edit" /><span class="c-sibling-item">
+              重命名
+            </span>
           </div>
           <div
             class="l-flex--row c-contentmenu__item has-active"
             @click="onAddChildNode"
           >
-            <i class="c-sibling-item el-icon-circle-plus-outline" /><span class="c-sibling-item">新增子部门</span>
+            <i class="c-sibling-item el-icon-circle-plus-outline" /><span class="c-sibling-item">
+              新增子部门
+            </span>
           </div>
           <div
             class="l-flex--row c-contentmenu__item has-active"
             @click="onDeleteNode"
           >
-            <i class="c-sibling-item el-icon-remove-outline" /><span class="c-sibling-item">删除</span>
+            <i class="c-sibling-item el-icon-remove-outline" /><span class="c-sibling-item">
+              删除
+            </span>
           </div>
         </el-card>
         <confirm-dialog
@@ -72,7 +80,9 @@
           @confirm="onSubmitNode"
         >
           <div class="c-grid-form u-align-self--center">
-            <span class="c-grid-form__label u-required">名称</span>
+            <span class="c-grid-form__label u-required">
+              名称
+            </span>
             <el-input
               v-model.trim="node.name"
               placeholder="最多30个字符"
@@ -80,7 +90,9 @@
               clearable
             />
             <template v-if="!node.id">
-              <span class="c-grid-form__label u-required">缩写标识</span>
+              <span class="c-grid-form__label u-required">
+                缩写标识
+              </span>
               <div
                 class="has-info"
                 data-info="仅可包含数字、字母"
@@ -93,6 +105,21 @@
                 />
               </div>
             </template>
+            <span class="c-grid-form__label u-required">
+              优先级
+            </span>
+            <el-select
+              v-model.trim="node.priority"
+              popper-class="o-select-option"
+              placeholder="请选择优先级"
+            >
+              <el-option
+                v-for="item in priorityOptions"
+                :key="item"
+                :label="item"
+                :value="item"
+              />
+            </el-select>
           </div>
         </confirm-dialog>
       </template>
@@ -120,6 +147,7 @@ export default {
         label: 'name',
         children: 'children'
       },
+      priorityOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
       node: {}
     }
   },
@@ -186,7 +214,7 @@ export default {
       this.closeContentMenu()
     },
     onEditNode () {
-      this.node = { id: this.$selectedNode.id, name: this.$selectedNode.name }
+      this.node = { id: this.$selectedNode.id, name: this.$selectedNode.name, priority: this.$selectedNode.priority }
       this.$refs.nodeDialog.show()
       this.closeContentMenu()
     },
@@ -198,6 +226,13 @@ export default {
         })
         return
       }
+      if (!this.node.priority) {
+        this.$message({
+          type: 'warning',
+          message: '请选择优先级'
+        })
+        return
+      }
       if (this.node.id) {
         updateDepartmentName(this.node).then(() => {
           done()

+ 17 - 7
src/views/realm/report/api.js

@@ -1,9 +1,9 @@
 import { parseTime } from '@/utils'
-import { downloadRequest } from '@/utils/request'
+import { downloadRequest } from '@/utils/request.js'
 import {
   send,
   addTenant
-} from '@/api/base'
+} from '@/api/base.js'
 
 function download ({ data, headers }, fileName) {
   const blob = new Blob([data], { type: headers['content-type'] })
@@ -68,13 +68,23 @@ export function getAuditExcel (params, fileName = '') {
   })
 }
 
-export function getProgramGuideExcel (params, fileName = '') {
+export function getProgramGuideExcel (data) {
   return send({
-    url: '/ad/tenant/scheduling/export',
-    method: 'GET',
-    params
+    url: '/orchestration/jmdExportBatch',
+    method: 'POST',
+    data
+  }, downloadRequest).then(response => {
+    download(response, `节目单${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.zip`)
+  })
+}
+
+export function getProgramPlaysExcel (data) {
+  return send({
+    url: '/orchestration/timeSplit/export',
+    method: 'POST',
+    data
   }, downloadRequest).then(response => {
-    download(response, `节目单${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}_${fileName}.xlsx`)
+    download(response, `播放清单${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xls`)
   })
 }
 

+ 20 - 26
src/views/realm/report/components/ProgramGuideDialog.vue

@@ -9,19 +9,21 @@
       <div class="l-flex__fill l-flex">
         <device-tree
           class="c-sibling-item c-sidebar u-width--xl"
-          highlight
-          @node-click="onDeviceChange"
+          checkbox
+          @change="onChange"
         />
         <div class="c-sibling-item far">
-          <div class="c-sibling-item--v u-required">日期</div>
+          <div class="c-sibling-item--v u-required">
+            日期
+          </div>
           <el-date-picker
             v-model="date"
             class="c-sibling-item--v"
-            type="date"
+            type="daterange"
             value-format="yyyy-MM-dd"
-            :picker-options="pickerOptions"
-            :editable="false"
-            :clearable="false"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
           />
         </div>
       </div>
@@ -31,36 +33,27 @@
 
 <script>
 import { parseTime } from '@/utils'
-import { getProgramGuideExcel } from '../api'
+import { getProgramGuideExcel } from '../api.js'
 
 export default {
   name: 'ProgramGuideDialog',
   data () {
     return {
-      date: null
-    }
-  },
-  computed: {
-    pickerOptions () {
-      return {
-        disabledDate: this.isDisableDate
-      }
+      date: null,
+      devices: []
     }
   },
   methods: {
     show () {
-      this.$device = null
+      this.devices = null
       this.date = parseTime(new Date(), '{y}-{m}-{d}')
       this.$refs.dialog.show()
     },
-    onDeviceChange (device) {
-      this.$device = device
-    },
-    isDisableDate (date) {
-      return date > Date.now()
+    onChange (devices) {
+      this.devices = devices.map(device => device.id)
     },
     onConfirm (done) {
-      if (!this.$device) {
+      if (!this.devices || !this.devices.length) {
         this.$message({
           type: 'warning',
           message: '请选择设备'
@@ -68,9 +61,10 @@ export default {
         return
       }
       getProgramGuideExcel({
-        deviceId: this.$device.id,
-        startDate: this.date
-      }, `${this.$device.name}_${this.date}`).then(done)
+        deviceIdList: this.devices,
+        startDate: this.date[0],
+        endDate: this.date[1]
+      }).then(done)
     }
   }
 }

+ 79 - 0
src/views/realm/report/components/ProgramPlaysDialog.vue

@@ -0,0 +1,79 @@
+<template>
+  <confirm-dialog
+    ref="dialog"
+    size="lg fixed"
+    title="设备播放单"
+    @confirm="onConfirm"
+  >
+    <template #default>
+      <div class="l-flex__fill l-flex">
+        <device-tree
+          class="c-sibling-item c-sidebar u-width--xl"
+          checkbox
+          @change="onChange"
+        />
+        <div class="c-sibling-item far">
+          <div class="c-sibling-item--v u-required">
+            日期
+          </div>
+          <el-date-picker
+            v-model="date"
+            class="c-sibling-item--v"
+            type="datetimerange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            :default-time="['00:00:00', '23:59:59']"
+          />
+        </div>
+      </div>
+    </template>
+  </confirm-dialog>
+</template>
+
+<script>
+import { parseTime } from '@/utils'
+import { getProgramPlaysExcel } from '../api.js'
+
+export default {
+  name: 'ProgramPlaysDialog',
+  data () {
+    return {
+      date: null,
+      devices: []
+    }
+  },
+  methods: {
+    show () {
+      this.devices = null
+      const currentDate = new Date()
+      const startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), 0, 0, 0)
+      const endDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), 23, 59, 59)
+      const formattedStartDate = parseTime(startDate, '{y}-{m}-{d} {h}:{i}:{s}')
+      const formattedEndDate = parseTime(endDate, '{y}-{m}-{d} {h}:{i}:{s}')
+      this.date = [formattedStartDate, formattedEndDate]
+      this.$refs.dialog.show()
+    },
+    onChange (devices) {
+      this.devices = devices.map(device => device.id)
+    },
+    isDisableDate (date) {
+      return date > Date.now()
+    },
+    onConfirm (done) {
+      if (!this.devices || !this.devices.length) {
+        this.$message({
+          type: 'warning',
+          message: '请选择设备'
+        })
+        return
+      }
+      getProgramPlaysExcel({
+        deviceIdList: this.devices,
+        start: new Date(this.date[0]).getTime(),
+        util: new Date(this.date[1]).getTime()
+      }).then(done)
+    }
+  }
+}
+</script>

+ 23 - 5
src/views/realm/report/index.vue

@@ -7,7 +7,9 @@
   >
     <template v-if="isGroupAdmin">
       <template v-if="isTopGroup">
-        <div class="c-sibling-item--v u-font-size--sm u-bold">平台数据</div>
+        <div class="c-sibling-item--v u-font-size--sm u-bold">
+          平台数据
+        </div>
         <div class="c-sibling-item--v near l-grid--info mini">
           <button
             class="o-button"
@@ -29,7 +31,9 @@
           </button>
         </div>
       </template>
-      <div class="c-sibling-item--v u-font-size--sm u-bold">部门数据</div>
+      <div class="c-sibling-item--v u-font-size--sm u-bold">
+        部门数据
+      </div>
       <div class="c-sibling-item--v near l-grid--info mini">
         <button
           class="o-button"
@@ -57,7 +61,9 @@
         </button>
       </div>
     </template>
-    <div class="c-sibling-item--v u-font-size--sm u-bold">设备数据</div>
+    <div class="c-sibling-item--v u-font-size--sm u-bold">
+      设备数据
+    </div>
     <div class="c-sibling-item--v near l-grid--info mini">
       <button
         class="o-button"
@@ -71,6 +77,12 @@
       >
         广告播放
       </button>
+      <button
+        class="o-button"
+        @click="getProgramPlaysExcel"
+      >
+        播放清单
+      </button>
     </div>
     <material-config-dialog ref="materialConfigDialog" />
     <account-dialog ref="accountDialog" />
@@ -78,6 +90,7 @@
     <content-dialog ref="contentDialog" />
     <program-guide-dialog ref="programGuideDialog" />
     <device-ad-dialog ref="deviceAdDialog" />
+    <program-plays-dialog ref="programPlaysDialog" />
     <online-duration-dialog ref="onlineDurationDialog" />
   </wrapper>
 </template>
@@ -87,13 +100,14 @@ import { mapGetters } from 'vuex'
 import {
   getDeviceExcel,
   getOnlineDurationExcel
-} from './api'
+} from './api.js'
 import MaterialConfigDialog from './components/MaterialConfigDialog.vue'
 import AccountDialog from './components/AccountDialog.vue'
 import AuditDialog from './components/AuditDialog.vue'
 import ContentDialog from './components/ContentDialog.vue'
 import ProgramGuideDialog from './components/ProgramGuideDialog.vue'
 import DeviceAdDialog from './components/DeviceAdDialog.vue'
+import ProgramPlaysDialog from './components/ProgramPlaysDialog.vue'
 import OnlineDurationDialog from './components/OnlineDurationDialog.vue'
 
 export default {
@@ -105,7 +119,8 @@ export default {
     ContentDialog,
     ProgramGuideDialog,
     DeviceAdDialog,
-    OnlineDurationDialog
+    OnlineDurationDialog,
+    ProgramPlaysDialog
   },
   computed: {
     ...mapGetters(['isGroupAdmin', 'isTopGroup'])
@@ -137,6 +152,9 @@ export default {
     getDeviceAdExcel () {
       this.$refs.deviceAdDialog.show()
     },
+    getProgramPlaysExcel () {
+      this.$refs.programPlaysDialog.show()
+    },
     getOnlineDurationExcel () {
       getOnlineDurationExcel({ type: 'DEVICE_ONLINE_TOTAL' })
     },