zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
  <div>
    <template v-if='model.type == 0'>
      <div class='room solid' :style='`width: ${basic_width * 1.5}px; height: ${basic_height* 1.2}px;background-color:${data.bgColor}`' @contextmenu.prevent="onContextmenu($event,data)">
        <div class='room-item flex justify-between flex2'>
          <div :class="{ 'item-left': data.no !=null }">{{data.no}}</div>
          <div class='item-right' v-if='data.position'>{{ data.position }}</div>
        </div>
        <div class='room-item flex justify-center align-center flex3'>
          <div style='white-space: pre-wrap;' v-html='data.name'></div>
 
        </div>
        <div class='room-item flex justify-center align-center flex2' >
          <div>{{findDataBySeat(data.userList,1,'realname')}}</div>
 
        </div>
        <div class='room-item flex justify-center align-center flex2'>
          <div>{{findDataBySeat(data.userList,1,'seatPhone')}}</div>
        </div>
        <div class='flex1'>
          <div></div>
 
        </div>
      </div>
 
    </template>
    <template v-else-if='model.type == 1'>
      <div class='room solid' :style='`width: ${basic_width * 1.2}px; height: ${basic_height* 1.2}px;background-color:${data.bgColor}`'  @contextmenu.prevent="onContextmenu($event,data)">
        <div class='room-item flex justify-between flex2'>
          <div :class="{ 'item-left': data.no !=null }">{{data.no}}</div>
          <div class='item-right' v-if='data.position'>{{ data.position }}</div>
        </div>
        <div class='room-item flex justify-center align-center flex3'>
          <div style='white-space: pre-wrap;' v-html='data.name'></div>
        </div>
        <div class='room-item flex justify-center align-center flex2'>
          <div>{{findDataBySeat(data.userList,1,'realname')}}</div>
        </div>
        <div class='room-item flex justify-center align-center flex2'>
          <div>{{findDataBySeat(data.userList,1,'seatPhone')}}</div>
 
        </div>
        <div class='flex1'>
          <div></div>
 
        </div>
      </div>
 
    </template>
 
    <template v-else-if='model.type == 2'>
      <div class='room flex flex-direction solid' :style='`width: ${basic_width *1.2 }px; height: ${basic_height *1.2}px;background-color:${data.bgColor}`'  @contextmenu.prevent="onContextmenu($event,data)">
 
        <div class='room-item flex justify-between flex2'>
          <div style='font-size: 10px;'>
            <div>{{ findDataBySeat(data.userList,1,'realname') }}</div>
            <div>{{ findDataBySeat(data.userList,1,'seatPhone') }}</div>
          </div>
          <div>{{ data.no }}</div>
          <div>
            <div style='font-size: 10px;'>
              <div>{{ findDataBySeat(data.userList,2,'realname') }}</div>
              <div>{{ findDataBySeat(data.userList,2,'seatPhone') }}</div>
            </div>
 
          </div>
        </div>
        <div class='flex align-center justify-center flex3'>
          <div style='white-space: pre-wrap;' v-html='data.name'></div>
 
        </div>
        <div  class='room-item flex justify-between flex2'>
          <div style='font-size: 10px;'>
            <div>{{ findDataBySeat(data.userList,3,'realname') }}</div>
            <div>{{ findDataBySeat(data.userList,3,'seatPhone') }}</div>
          </div>
          <div style='font-size: 10px;'>
            <div>{{ findDataBySeat(data.userList,4,'realname') }}</div>
            <div>{{ findDataBySeat(data.userList,4,'seatPhone') }}</div>
          </div>
        </div>
 
      </div>
 
    </template>
 
  </div>
</template>
 
<script>
import get from 'lodash.get'
export default {
  name: 'RoomBlock',
  props:{
    model:{
      type:Object,
      required: true
    },
    data:{
      type:Object,
      default() {
        return {}; // 或者 []
      },
      required: false
    }
  },
  data() {
    return {
      basic_width: 100,
      basic_height: 100
    }
  },
  methods:{
    findDataBySeat(userList,seatNo,colmun){
      if(userList){
        const  res = userList.find(item=>item.seatNo == seatNo)
        return res ? res[colmun] : "";
      }
    },
    onContextmenu(event,data) {
      this.$contextmenu({
        items: [
          {
            label: "编辑",
            divided: true,
            icon:"el-icon-edit",
            onClick: () => {
              this.$emit("edit",data)
            }
          },
          { label: "重新加载(R)", icon: "el-icon-refresh" },
 
        ],
        event,
        //x: event.clientX,
        //y: event.clientY,
        customClass: "custom-class",
        zIndex: 3,
        minWidth: 230
      });
      return false;
    }
  }
}
</script>
 
<style lang='less' scoped>
@import "seat";
 
 
</style>