|
@@ -11,6 +11,7 @@
|
|
:default-col-def="defaultColDef"
|
|
:default-col-def="defaultColDef"
|
|
:animate-rows="true"
|
|
:animate-rows="true"
|
|
:row-selection="rowSelection"
|
|
:row-selection="rowSelection"
|
|
|
|
+ :enable-cell-change-flash="true"
|
|
@filterChanged="filterModifed"
|
|
@filterChanged="filterModifed"
|
|
@sortChanged="gridSortChange"
|
|
@sortChanged="gridSortChange"
|
|
>
|
|
>
|
|
@@ -54,8 +55,9 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="广播模式" prop="broadcast_mode">
|
|
<el-form-item label="广播模式" prop="broadcast_mode">
|
|
<el-radio-group v-model="formmodel.broadcast_mode" @change="broadcastModeChanage">
|
|
<el-radio-group v-model="formmodel.broadcast_mode" @change="broadcastModeChanage">
|
|
- <el-radio :label="1">手动模式</el-radio>
|
|
|
|
- <el-radio :label="2">自动模式</el-radio>
|
|
|
|
|
|
+ <!-- <el-radio :label="1">手动模式</el-radio>-->
|
|
|
|
+ <!-- <el-radio :label="2">自动模式</el-radio>-->
|
|
|
|
+ <el-radio v-for="(item,index) in broadcastMode" :key="index" :label="item.value">{{ item.key }}</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -64,8 +66,9 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="播放模式(自动)" prop="play_mode">
|
|
<el-form-item label="播放模式(自动)" prop="play_mode">
|
|
<el-radio-group v-model="formmodel.play_mode" @change="playModeChange">
|
|
<el-radio-group v-model="formmodel.play_mode" @change="playModeChange">
|
|
- <el-radio :label="1">定时播放</el-radio>
|
|
|
|
- <el-radio :label="2">定次播放</el-radio>
|
|
|
|
|
|
+ <!-- <el-radio :label="1">定时播放</el-radio>-->
|
|
|
|
+ <!-- <el-radio :label="2">定次播放</el-radio>-->
|
|
|
|
+ <el-radio v-for="(item,index) in playMode" :key="index" :disabled="formmodel.broadcast_mode===1" :label="item.value">{{ item.key }}</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -73,7 +76,11 @@
|
|
<el-form-item label="自动播放开始" prop="play_start">
|
|
<el-form-item label="自动播放开始" prop="play_start">
|
|
<el-time-picker
|
|
<el-time-picker
|
|
v-model="formmodel.play_start"
|
|
v-model="formmodel.play_start"
|
|
|
|
+ :disabled="formmodel.broadcast_mode===1"
|
|
|
|
+ arrow-control
|
|
|
|
+ value-format="HH:mm:ss"
|
|
placeholder="任意时间点"
|
|
placeholder="任意时间点"
|
|
|
|
+ @change="playStartChange"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -85,13 +92,20 @@
|
|
<el-form-item label="定时播放结束" prop="play_end">
|
|
<el-form-item label="定时播放结束" prop="play_end">
|
|
<el-time-picker
|
|
<el-time-picker
|
|
v-model="formmodel.play_end"
|
|
v-model="formmodel.play_end"
|
|
|
|
+ :disabled="formmodel.broadcast_mode===1||formmodel.play_mode===2"
|
|
|
|
+ arrow-control
|
|
|
|
+ value-format="HH:mm:ss"
|
|
|
|
+ :picker-options="{
|
|
|
|
+ selectableRange: (this.formmodel.play_start ? this.formmodel.play_start : '00:00:00') + ' - 23:59:59',
|
|
|
|
+ format: 'HH:mm:ss'
|
|
|
|
+ }"
|
|
placeholder="任意时间点"
|
|
placeholder="任意时间点"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="定次播放次数" prop="repeat_times">
|
|
<el-form-item label="定次播放次数" prop="repeat_times">
|
|
- <el-input-number v-model="formmodel.repeat_times" :min="1" :max="100" label="repeat_times" />
|
|
|
|
|
|
+ <el-input-number v-model="formmodel.repeat_times" :min="0" :disabled="formmodel.broadcast_mode===1 || formmodel.play_mode === 1" :max="100" label="repeat_times" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
@@ -106,7 +120,7 @@
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
<el-form-item label="开启日">
|
|
<el-form-item label="开启日">
|
|
- <el-checkbox-group v-model="formmodel.repeat_day">
|
|
|
|
|
|
+ <el-checkbox-group v-model="formmodel.repeat_day" :disabled="formmodel.broadcast_mode===1">
|
|
<el-checkbox label="1">周一</el-checkbox>
|
|
<el-checkbox label="1">周一</el-checkbox>
|
|
<el-checkbox label="2">周二</el-checkbox>
|
|
<el-checkbox label="2">周二</el-checkbox>
|
|
<el-checkbox label="3">周三</el-checkbox>
|
|
<el-checkbox label="3">周三</el-checkbox>
|
|
@@ -118,7 +132,15 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
-
|
|
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="广播区域">
|
|
|
|
+ <el-checkbox-group v-model="formmodel.group_ids">
|
|
|
|
+ <el-checkbox v-for="(item,index) in frameGroups" :key="index" :label="item.id">{{ item.group_name }}</el-checkbox>
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -127,7 +149,11 @@
|
|
<el-button type="primary" @click="handlerFormSubmit('editform')">确 定</el-button>
|
|
<el-button type="primary" @click="handlerFormSubmit('editform')">确 定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
- <!-- 新建广播弹窗结束 -->
|
|
|
|
|
|
+ <!-- <!– 新建广播弹窗结束 –>-->
|
|
|
|
+ <!-- <vue-draggable-resizable :w="400" style="position: absolute;right:0;bottom: 80px">-->
|
|
|
|
+ <!-- <aplayer :audio="music" :lrc-type="0" fixed />-->
|
|
|
|
+ <!-- </vue-draggable-resizable>-->
|
|
|
|
+ <!-- <a-player :music="music[0]" :list="music" float fixed :showLrc="3" listFolded />-->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -137,9 +163,14 @@ import { AG_GRID_LOCALE_CN } from '@/utils/AgGridVueLocaleCn'
|
|
import ButtonCellRender from '../../components/AgGridCellRender/ButtonCellRender'
|
|
import ButtonCellRender from '../../components/AgGridCellRender/ButtonCellRender'
|
|
import * as API_Broadcast from '@/api/calling-broadcast'
|
|
import * as API_Broadcast from '@/api/calling-broadcast'
|
|
import { unix2Date } from '@/utils/Foundation'
|
|
import { unix2Date } from '@/utils/Foundation'
|
|
|
|
+import * as API_FrameGroup from '@/api/ncs_frameGroup'
|
|
|
|
+import ListFilter from '@/components/AgGridCustomFilter/ListFilter'
|
|
|
|
+import RadioFilter from '@/components/AgGridCustomFilter/RadioFilter'
|
|
|
|
+import * as API_BroadcastFiles from '@/api/calling-broadcastFiles'
|
|
|
|
+import { serverUrl, DeviceUrl } from '@/utils/domain'
|
|
export default {
|
|
export default {
|
|
name: 'Index',
|
|
name: 'Index',
|
|
- components: { ButtonCellRender },
|
|
|
|
|
|
+ components: { ButtonCellRender, ListFilter, RadioFilter },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
tableData: [],
|
|
tableData: [],
|
|
@@ -153,8 +184,10 @@ export default {
|
|
formtitle: '新建广播',
|
|
formtitle: '新建广播',
|
|
formshow: false,
|
|
formshow: false,
|
|
formmodel: {
|
|
formmodel: {
|
|
- repeat_times: 1
|
|
|
|
|
|
+ repeat_times: 1,
|
|
|
|
+ group_ids: []
|
|
},
|
|
},
|
|
|
|
+ frameGroups: [],
|
|
rules: {
|
|
rules: {
|
|
title: [
|
|
title: [
|
|
{ required: true, message: '广播名称不能为空', trigger: 'blur' }
|
|
{ required: true, message: '广播名称不能为空', trigger: 'blur' }
|
|
@@ -191,13 +224,28 @@ export default {
|
|
localeText: AG_GRID_LOCALE_CN,
|
|
localeText: AG_GRID_LOCALE_CN,
|
|
filterState: null,
|
|
filterState: null,
|
|
rowSelection: null,
|
|
rowSelection: null,
|
|
- frameworkComponents: null
|
|
|
|
|
|
+ frameworkComponents: null,
|
|
|
|
+ broadcastStatus: [
|
|
|
|
+ { key: '启用', value: true, color: 'green' },
|
|
|
|
+ { key: '关闭', value: false, color: 'red' }
|
|
|
|
+ ],
|
|
|
|
+ broadcastMode: [
|
|
|
|
+ { key: '手动模式', value: 1, color: 'green' },
|
|
|
|
+ { key: '自动模式', value: 2, color: 'red' }
|
|
|
|
+ ],
|
|
|
|
+ playMode: [
|
|
|
|
+ { key: '定时播放', value: 1 },
|
|
|
|
+ { key: '定次播放', value: 2 }
|
|
|
|
+ ],
|
|
|
|
+ websocket: null,
|
|
|
|
+ scheduledIds: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
tableHeight() {
|
|
tableHeight() {
|
|
return this.mainAreaHeight - 130
|
|
return this.mainAreaHeight - 130
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
beforeMount() {
|
|
beforeMount() {
|
|
this.gridOptions = {}
|
|
this.gridOptions = {}
|
|
@@ -217,15 +265,21 @@ export default {
|
|
headerName: '广播名称', field: 'title', sortable: true, filter: 'agTextColumnFilter', width: 150
|
|
headerName: '广播名称', field: 'title', sortable: true, filter: 'agTextColumnFilter', width: 150
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- headerName: '开启状态', field: 'status', sortable: true, filter: 'agListColumnFilter', width: 150, cellRenderer: this.statusFormatter
|
|
|
|
|
|
+ headerName: '开启状态', field: 'status', sortable: true, filterFramework: 'RadioFilter', filterParams: {
|
|
|
|
+ listData: this.broadcastStatus
|
|
|
|
+ }, width: 150, cellRenderer: this.statusFormatter
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- headerName: '广播模式', field: 'broadcast_mode', sortable: true, filter: 'agTextColumnFilter', width: 150,
|
|
|
|
- valueFormatter: this.broadcastFormatter
|
|
|
|
|
|
+ headerName: '广播模式', field: 'broadcast_mode', sortable: true, filterFramework: 'RadioFilter', filterParams: {
|
|
|
|
+ listData: this.broadcastMode
|
|
|
|
+ }, width: 150,
|
|
|
|
+ cellRenderer: (para) => { return this.radioFilterFormatter(para, this.broadcastMode) }
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- headerName: '播放模式', field: 'play_mode', sortable: true, filter: 'agTextColumnFilter', width: 150,
|
|
|
|
- valueFormatter: this.playmodeFormatter
|
|
|
|
|
|
+ headerName: '播放模式', field: 'play_mode', sortable: true, filterFramework: 'RadioFilter', filterParams: {
|
|
|
|
+ listData: this.playMode
|
|
|
|
+ }, width: 150,
|
|
|
|
+ cellRenderer: (para) => { return this.radioFilterFormatter(para, this.playMode) }
|
|
},
|
|
},
|
|
{
|
|
{
|
|
headerName: '开始时间', field: 'play_start', sortable: true, filter: 'agTextColumnFilter', width: 150
|
|
headerName: '开始时间', field: 'play_start', sortable: true, filter: 'agTextColumnFilter', width: 150
|
|
@@ -292,10 +346,28 @@ export default {
|
|
resizable: false,
|
|
resizable: false,
|
|
filter: false,
|
|
filter: false,
|
|
sortable: false
|
|
sortable: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ headerName: '播放', field: 'id',
|
|
|
|
+ cellRendererFramework: 'ButtonCellRender',
|
|
|
|
+ cellRendererParams: param => {
|
|
|
|
+ return {
|
|
|
|
+ onClick: () => { param.data.playing ? this.stopBroadcast(param.data) : this.playBroadcast(param.data) },
|
|
|
|
+ label: param.data.playing ? '停止' : '播放',
|
|
|
|
+ buttonType: param.data.playing ? 'danger' : 'primary',
|
|
|
|
+ buttonSize: 'mini',
|
|
|
|
+ disabled: param.data.broadcast_mode !== 1 || !param.data.status
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ pinned: 'right',
|
|
|
|
+ lockPinned: true,
|
|
|
|
+ width: 100,
|
|
|
|
+ resizable: false,
|
|
|
|
+ filter: false,
|
|
|
|
+ sortable: false
|
|
}
|
|
}
|
|
]
|
|
]
|
|
this.defaultColDef = {
|
|
this.defaultColDef = {
|
|
- filter: 'agTextColumnFilter',
|
|
|
|
sortable: true,
|
|
sortable: true,
|
|
resizable: true,
|
|
resizable: true,
|
|
comparator: this.dateCustomComparator,
|
|
comparator: this.dateCustomComparator,
|
|
@@ -321,7 +393,15 @@ export default {
|
|
}
|
|
}
|
|
]
|
|
]
|
|
})
|
|
})
|
|
- // this.getList()
|
|
|
|
|
|
+ this.getAllFrameGroups()
|
|
|
|
+ this.initWebSocket()
|
|
|
|
+ const _this = this
|
|
|
|
+ // 每分钟检查一次websocket状态,如果掉线,则重连
|
|
|
|
+ setInterval(function() {
|
|
|
|
+ if (_this.websock === null || _this.websock.readyState !== 1) {
|
|
|
|
+ _this.initWebSocket()
|
|
|
|
+ }
|
|
|
|
+ }, 60000)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
windowResize() {
|
|
windowResize() {
|
|
@@ -357,15 +437,41 @@ export default {
|
|
deleteSingle(row) {
|
|
deleteSingle(row) {
|
|
this.handlerDelete(row.id)
|
|
this.handlerDelete(row.id)
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ playBroadcast(row) {
|
|
|
|
+ // API_BroadcastFiles.getAllFileByBroadcastId(row.id).then(res => {
|
|
|
|
+ // if (Array.isArray(res)) {
|
|
|
|
+ // this.music = res.map(p => { return { name: p.file_name, url: serverUrl + '/' + p.file_url, artist: p.file_author } })
|
|
|
|
+ // console.log(this.music)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ this.websock.send(JSON.stringify({ 'command': 'play', 'broadcast_id': row.id }))
|
|
|
|
+ // API_Broadcast.playBroadcast(row.id).then(() => {
|
|
|
|
+ // row.playing = true
|
|
|
|
+ // // this.gridApi.redrawRows()
|
|
|
|
+ // this.gridApi.redrawRows()
|
|
|
|
+ // })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ stopBroadcast(row) {
|
|
|
|
+ this.websock.send(JSON.stringify({ 'command': 'stop', 'broadcast_id': row.id }))
|
|
|
|
+ // API_Broadcast.stopBroadcast(row.id).then(() => {
|
|
|
|
+ // row.playing = false
|
|
|
|
+ // this.gridApi.redrawRows()
|
|
|
|
+ // })
|
|
|
|
+ },
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 创建组织
|
|
|
|
|
|
+ * 创建广播
|
|
*/
|
|
*/
|
|
createBroadcast() {
|
|
createBroadcast() {
|
|
this.formshow = true
|
|
this.formshow = true
|
|
this.formmodel = {
|
|
this.formmodel = {
|
|
title: '',
|
|
title: '',
|
|
repeat_times: 1,
|
|
repeat_times: 1,
|
|
- repeat_day: []
|
|
|
|
|
|
+ status: false,
|
|
|
|
+ repeat_day: [],
|
|
|
|
+ group_ids: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/** 分页大小发生改变 */
|
|
/** 分页大小发生改变 */
|
|
@@ -393,6 +499,7 @@ export default {
|
|
data_total: response.data_total
|
|
data_total: response.data_total
|
|
}
|
|
}
|
|
this.rowData = [...response.data]
|
|
this.rowData = [...response.data]
|
|
|
|
+ this.refreshPlayStatus()
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
this.loading = false
|
|
this.loading = false
|
|
})
|
|
})
|
|
@@ -421,28 +528,26 @@ export default {
|
|
return unix2Date(param.value * 1000)
|
|
return unix2Date(param.value * 1000)
|
|
},
|
|
},
|
|
|
|
|
|
- broadcastFormatter(param) {
|
|
|
|
- if (!param.value) return ''
|
|
|
|
- if (param.value === 1) {
|
|
|
|
- return '手动模式'
|
|
|
|
|
|
+ radioFilterFormatter(params, array) {
|
|
|
|
+ const item = array.filter(p => p.value === params.value)[0]
|
|
|
|
+ if (item) {
|
|
|
|
+ if (item.color) {
|
|
|
|
+ return '<span style="color:' + item.color + '">' + item.key + '</span>'
|
|
|
|
+ } else {
|
|
|
|
+ return item.key
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- return '自动模式'
|
|
|
|
|
|
+ return ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- playmodeFormatter(param) {
|
|
|
|
- if (!param.value) return ''
|
|
|
|
- if (param.value === 1) {
|
|
|
|
- return '定时播放'
|
|
|
|
- } else {
|
|
|
|
- return '定次播放'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- statusFormatter(param) {
|
|
|
|
- if (param.value) {
|
|
|
|
- return '<span style="color: green">开启</span>'
|
|
|
|
|
|
+ statusFormatter(params) {
|
|
|
|
+ console.log('para', params)
|
|
|
|
+ const item = this.broadcastStatus.filter(p => (p.value === (!params.value ? false : params.value)))[0] // params.value === null 时,要返回false的记录
|
|
|
|
+ if (item) {
|
|
|
|
+ return '<span style="color:' + item.color + '">' + item.key + '</span>'
|
|
} else {
|
|
} else {
|
|
- return '<span style="color: red">关闭</span>'
|
|
|
|
|
|
+ return ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
weekdayFormatter(param) {
|
|
weekdayFormatter(param) {
|
|
@@ -496,7 +601,7 @@ export default {
|
|
this.getList()
|
|
this.getList()
|
|
},
|
|
},
|
|
handEdit(row) {
|
|
handEdit(row) {
|
|
- this.$router.push({ name: 'frameGroupEdit', params: { id: row.id, callback: this.getList() }})
|
|
|
|
|
|
+ this.$router.push({ name: 'broadcastEdit', params: { id: row.id, callback: this.getList() }})
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 提交新增表单
|
|
* 提交新增表单
|
|
@@ -508,10 +613,10 @@ export default {
|
|
/** 新增 */
|
|
/** 新增 */
|
|
delete this.formmodel.id
|
|
delete this.formmodel.id
|
|
this.formmodel.part_id = this.$store.getters.partId
|
|
this.formmodel.part_id = this.$store.getters.partId
|
|
- const starttime = new Date(this.timeRange[0]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
- const endtime = new Date(this.timeRange[1]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
- this.formmodel.play_start = starttime
|
|
|
|
- this.formmodel.play_end = endtime
|
|
|
|
|
|
+ // const starttime = new Date(this.timeRange[0]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
+ // const endtime = new Date(this.timeRange[1]).toLocaleTimeString('chinese', { hour12: false })
|
|
|
|
+ // this.formmodel.play_start = starttime
|
|
|
|
+ // this.formmodel.play_end = endtime
|
|
|
|
|
|
API_Broadcast.add(this.formmodel).then(() => {
|
|
API_Broadcast.add(this.formmodel).then(() => {
|
|
this.formshow = false
|
|
this.formshow = false
|
|
@@ -520,6 +625,8 @@ export default {
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
this.$message.error(err)
|
|
this.$message.error(err)
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('表单填写错误,请检查!')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -529,20 +636,85 @@ export default {
|
|
this.rules.repeat_times[0].required = false
|
|
this.rules.repeat_times[0].required = false
|
|
this.rules.play_end[0].required = false
|
|
this.rules.play_end[0].required = false
|
|
this.rules.play_start[0].required = false
|
|
this.rules.play_start[0].required = false
|
|
|
|
+ this.$set(this.formmodel, 'play_mode', null)
|
|
|
|
+ this.$set(this.formmodel, 'play_start', null)
|
|
|
|
+ this.$set(this.formmodel, 'play_end', null)
|
|
|
|
+ this.$set(this.formmodel, 'repeat_times', null)
|
|
} else {
|
|
} else {
|
|
this.rules.play_mode[0].required = true
|
|
this.rules.play_mode[0].required = true
|
|
this.rules.repeat_times[0].required = false
|
|
this.rules.repeat_times[0].required = false
|
|
this.rules.play_end[0].required = false
|
|
this.rules.play_end[0].required = false
|
|
this.rules.play_start[0].required = false
|
|
this.rules.play_start[0].required = false
|
|
|
|
+ if (this.formmodel.play_mode === 1) {
|
|
|
|
+ this.rules.play_start[0].required = true
|
|
|
|
+ this.rules.play_end[0].required = true
|
|
|
|
+ this.rules.repeat_times[0].required = false
|
|
|
|
+ } else {
|
|
|
|
+ this.rules.play_start[0].required = true
|
|
|
|
+ this.rules.play_end[0].required = false
|
|
|
|
+ this.rules.repeat_times[0].required = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
playModeChange(val) {
|
|
playModeChange(val) {
|
|
if (val === 1) {
|
|
if (val === 1) {
|
|
|
|
+ this.rules.play_start[0].required = true
|
|
|
|
+ this.rules.play_end[0].required = true
|
|
|
|
+ this.rules.repeat_times[0].required = false
|
|
|
|
+ } else {
|
|
|
|
+ this.rules.play_start[0].required = true
|
|
|
|
+ this.rules.play_end[0].required = false
|
|
|
|
+ this.rules.repeat_times[0].required = true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ playStartChange(val) {
|
|
|
|
+ console.log('start', val)
|
|
|
|
+ this.$set(this.formmodel, 'play_end', null)
|
|
|
|
+ },
|
|
|
|
+ getAllFrameGroups() {
|
|
|
|
+ API_FrameGroup.getAll(this.$store.getters.partId).then(res => {
|
|
|
|
+ this.frameGroups = [...res]
|
|
|
|
+ console.log('groups', this.frameGroups)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ initWebSocket: function() {
|
|
|
|
+ const stockbase = DeviceUrl.replace('http', 'ws')
|
|
|
|
+ this.websock = new WebSocket(stockbase + '/broadcast/status/' + this.$store.getters.uuid)
|
|
|
|
+ this.websock.onopen = this.websocketonopen
|
|
|
|
+ this.websock.onerror = this.websocketonerror
|
|
|
|
+ this.websock.onmessage = this.websocketonmessage
|
|
|
|
+ this.websock.onclose = this.websocketclose
|
|
|
|
+ },
|
|
|
|
+ websocketonopen: function() {
|
|
|
|
+ console.log('WebSocket连接成功')
|
|
|
|
+ },
|
|
|
|
+ websocketonerror: function(e) {
|
|
|
|
+ console.log('WebSocket连接发生错误')
|
|
|
|
+ },
|
|
|
|
+ websocketonmessage: function(e) {
|
|
|
|
+ this.scheduledIds = JSON.parse(e.data)
|
|
|
|
+ this.refreshPlayStatus()
|
|
|
|
+ },
|
|
|
|
|
|
- }else{
|
|
|
|
|
|
+ websocketclose: function(e) {
|
|
|
|
+ console.log('connection closed (' + e.code + ')')
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+ refreshPlayStatus() {
|
|
|
|
+ if (this.rowData !== null) {
|
|
|
|
+ this.rowData.forEach(item => {
|
|
|
|
+ console.log(this.scheduledIds.indexOf(item.id))
|
|
|
|
+ if (this.scheduledIds.indexOf(item.id) > -1 && item.broadcast_mode === 1) {
|
|
|
|
+ item.playing = true
|
|
|
|
+ } else {
|
|
|
|
+ item.playing = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.gridApi.redrawRows()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|