|
@@ -31,38 +31,26 @@
|
|
|
|
|
|
<script>
|
|
|
import {mapState} from 'vuex'
|
|
|
- import PubSub from 'pubsub-js'
|
|
|
import {getStaticFile} from "../../utils/tools"
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- count: 0, // 音量计数器
|
|
|
- count2: 0, // 预案管理模块计数器
|
|
|
- count3: 0, // 管理控制按钮计数器
|
|
|
- count4: 0, // 3个视频按钮计数器
|
|
|
- count5: 0, // 安卓分布式按钮
|
|
|
buttonJson: [], // 所有按钮
|
|
|
slideJson: [], // 所有滑条
|
|
|
- staticUrl:this.$store.state.staticUrl, // 资源路径
|
|
|
+ staticUrl:this.$store.state.staticUrl, // 静态资源路径
|
|
|
+ preBtns:[], // 上一次点击的按钮数组
|
|
|
}
|
|
|
},
|
|
|
|
|
|
async mounted() {
|
|
|
this.buttonJson = await getStaticFile('EnityButton.Data')
|
|
|
- // 获取分屏按钮数组
|
|
|
- this.arr = this.buttonJson.filter(item => (item.WindowID === '9a0dff23-8633-4e7f-89bf-cc4f68ec88e1' || item.WindowID === '08208721-41cc-4f1e-937b-3a1627389049' || item.WindowID === 'ab842585-0c91-4e65-bfed-a219bcaaeb43'))
|
|
|
- // 获取功能按钮
|
|
|
- this.funcBtnArr = this.buttonJson.filter(item => (item.WindowID === 'd80a8b6e-9f88-41ff-b3a7-1ff8d6ee37a5' || item.WindowID === 'cb2687fd-931a-4b38-a76d-9c3ea171b8d8' || item.WindowID === '027ab76d-6b9c-46ac-abe6-75b8059f786b' || item.WindowID === 'a12b287f-f68c-4efa-b652-d6e5b0a09d0d' || item.WindowID === 'd9868551-b579-4258-9bc7-7c1f733773f5'))
|
|
|
- // 获取电源管理和电脑控制按钮
|
|
|
- this.powerAndCompBtns = this.buttonJson.filter(item => (item.WindowID === 'd80a8b6e-9f88-41ff-b3a7-1ff8d6ee37a5' || item.WindowID === 'd9868551-b579-4258-9bc7-7c1f733773f5') && item.ID !== '19554440-98bc-4644-83a0-d9cefd69153e')
|
|
|
-
|
|
|
- /*this.labelJson = await getStaticFile('EnityLable.Data')
|
|
|
- this.funcLabArr = this.labelJson.filter(item => (item.WindowID === 'd80a8b6e-9f88-41ff-b3a7-1ff8d6ee37a5' || item.WindowID === 'cb2687fd-931a-4b38-a76d-9c3ea171b8d8' || item.WindowID === '027ab76d-6b9c-46ac-abe6-75b8059f786b' || item.WindowID === 'a12b287f-f68c-4efa-b652-d6e5b0a09d0d' || item.WindowID === 'd9868551-b579-4258-9bc7-7c1f733773f5'))
|
|
|
- */
|
|
|
-
|
|
|
this.slideJson = await getStaticFile('EnitySlider.Data')
|
|
|
- this.funSliderArr = await getStaticFile('EnitySlider.Data')
|
|
|
+
|
|
|
+ // 默认按下的按钮
|
|
|
+ let preBtns = this.buttonJson.filter(item => (item.IsPressDown && item.IsVisibility))
|
|
|
+ console.log(preBtns)
|
|
|
+ this.preBtns = preBtns
|
|
|
|
|
|
// 设置按钮背景图片
|
|
|
const keyArr = Object.keys(this.$refs)
|
|
@@ -72,7 +60,7 @@
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
- ...mapState(['bigScale','labelJson','imageJson','bigshowJson']),
|
|
|
+ ...mapState(['bigScale','labelJson']),
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -81,60 +69,65 @@
|
|
|
console.log(e)
|
|
|
|
|
|
// 控制按钮数组
|
|
|
- const controlBtns = this.buttonJson.filter(item => item.ButtonType === 1 && item.WindowID === e.WindowID)
|
|
|
+ const controlBtns = this.buttonJson.filter(item => item.ButtonType === 1 && item.GroupNumber === e.GroupNumber)
|
|
|
if(controlBtns.some(item => item === e)){
|
|
|
// 1.当前按下的按钮处于激活状态
|
|
|
this.$refs[e.ID][0].style.backgroundImage = 'url(' + require(`../../../static/Data/${e.ActionIcon}`) + ')'
|
|
|
|
|
|
- // 2.切换界面
|
|
|
- // 2.1 按钮
|
|
|
- this.buttonJson.forEach(item => {
|
|
|
- for(const btn of e.MouseDownActionList){
|
|
|
- if(btn.SourceID === item.WindowID){
|
|
|
- item.IsVisibility = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- // 2.2 label
|
|
|
- this.$store.state.labelJson.forEach(item => {
|
|
|
- for(const btn of e.MouseDownActionList){
|
|
|
- if(btn.SourceID === item.WindowID){
|
|
|
- item.IsVisibility = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- // 2.3 image
|
|
|
- this.$store.state.imageJson.forEach(item => {
|
|
|
- for(const btn of e.MouseDownActionList){
|
|
|
- if(btn.SourceID === item.WindowID){
|
|
|
- item.IsVisibility = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- // 2.4 大屏
|
|
|
- // this.$store.state.bigshowJson.forEach(item => {
|
|
|
- // if(flag){
|
|
|
- // for(const btn of this.preBtnSourceList){
|
|
|
- // if(btn.SourceID === item.WindowID){
|
|
|
- // item.IsVisibility = false
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // for(const btn of e.MouseDownActionList){
|
|
|
- // if(btn.SourceID === item.WindowID){
|
|
|
- // item.IsVisibility = true
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // 发布消息,更新当前要显示的大屏
|
|
|
- // PubSub.publish('updateCurrentBigScreen',this.$store.state.bigshowJson.filter(item => item.IsVisibility))
|
|
|
-
|
|
|
- // 3.其他按钮处于未激活状态
|
|
|
+ // 2.同一组的其他按钮处于未激活状态
|
|
|
const otherBtns = controlBtns.filter(item => item !== e)
|
|
|
otherBtns.forEach(item => {
|
|
|
this.$refs[item.ID][0].style.backgroundImage = 'url(' + require(`../../../static/Data/${item.BackIcon}`) + ')'
|
|
|
})
|
|
|
+
|
|
|
+ // 3.切换界面
|
|
|
+ // 上一次点击的按钮
|
|
|
+ const preBtn = this.preBtns.filter(a => a.ButtonType === 1 && a.GroupNumber === e.GroupNumber)
|
|
|
+
|
|
|
+ if(preBtn.length){
|
|
|
+ // 3.1 切换按钮
|
|
|
+ this.buttonJson.forEach(item => {
|
|
|
+ // 先隐藏
|
|
|
+ if(preBtn[0].MouseDownActionList.length){
|
|
|
+ for(const btn of preBtn[0].MouseDownActionList){
|
|
|
+ if(btn.SourceID === item.WindowID){
|
|
|
+ item.IsVisibility = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 后显示
|
|
|
+ if(e.MouseDownActionList.length){
|
|
|
+ for(const btn of e.MouseDownActionList){
|
|
|
+ if(btn.SourceID === item.WindowID){
|
|
|
+ item.IsVisibility = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 3.2 切换label
|
|
|
+ this.$store.state.labelJson.forEach(item => {
|
|
|
+ if(preBtn[0].MouseDownActionList.length){
|
|
|
+ for(const btn of preBtn[0].MouseDownActionList){
|
|
|
+ if(btn.SourceID === item.WindowID){
|
|
|
+ item.IsVisibility = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(e.MouseDownActionList.length){
|
|
|
+ for(const btn of e.MouseDownActionList){
|
|
|
+ if(btn.SourceID === item.WindowID){
|
|
|
+ item.IsVisibility = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 替换上一次点击的按钮
|
|
|
+ const btnArr = this.preBtns.filter(b => b.ID !== preBtn[0].ID)
|
|
|
+ this.preBtns = [...btnArr,e]
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 音频菜单控制
|