ModuleBD.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="dane-bd" :style="style" :class="daneClass">
  3. <div v-if="moduleName" class="dane-title">
  4. <div class="common-navL">{{ moduleName }}</div>
  5. <div class="common-navR">
  6. <!-- 下拉框 -->
  7. <div class="common-navR-select" v-if="header.show && header.showSelector">
  8. <a-select
  9. style="width: 140px"
  10. size="small"
  11. placeholder="请选择"
  12. v-model:value="selectedDeviceID"
  13. allowClear
  14. :options="options"
  15. @change="selectHandler"
  16. />
  17. </div>
  18. <!-- 日期组件 -->
  19. <!-- <div class="common-navR-date" v-if="header.show && header.showSlot">
  20. <a-range-picker
  21. size="small"
  22. style="width: 140px"
  23. :show-time="{ format: 'HH:mm' }"
  24. format="YYYY-MM-DD HH:mm"
  25. :placeholder="['开始时间', '结束时间']"
  26. @change="onChange"
  27. @ok="onOk"
  28. />
  29. </div> -->
  30. <!-- 开关组件 -->
  31. <!-- <div class="common-navR-switch" v-if="commonTitle == 'switchs'">
  32. <div :class="checked ? 'status-text1' : 'status-text'">风险来源</div>
  33. <a-switch v-model:checked="checked" />
  34. <div :class="checked ? 'status-text' : 'status-text1'">危险位置</div>
  35. </div> -->
  36. </div>
  37. </div>
  38. <div class="dane-content">
  39. <slot>
  40. <Content style="height: 100%" :moduleData="moduleData" :data="selectedDevice" />
  41. </slot>
  42. </div>
  43. </div>
  44. </template>
  45. <script setup lang="ts">
  46. import Content from './content.vue';
  47. import { defineProps, defineEmits, computed, onMounted, onUnmounted } from 'vue';
  48. import { ModuleData, ShowStyle } from '../../../deviceManager/configurationTable/types';
  49. import { useInitDevices } from '../hooks/useInit';
  50. const props = defineProps<{
  51. moduleData: ModuleData;
  52. showStyle: ShowStyle;
  53. moduleName: string;
  54. deviceType: string;
  55. visible: boolean;
  56. }>();
  57. const emit = defineEmits(['close', 'select']);
  58. const { header } = props.moduleData;
  59. const { selectedDeviceID, selectedDevice, options, fetchDevicesBD } = useInitDevices(props.deviceType, props.moduleData);
  60. const style = computed(() => {
  61. const size = props.showStyle.size;
  62. const position = props.showStyle.position;
  63. return size + position;
  64. });
  65. let interval: any = null;
  66. // 根据配置里的定位判断应该使用哪个module组件
  67. const daneClass = computed(() => {
  68. const position = props.showStyle.position;
  69. if (position.includes('left:0')) {
  70. return 'dane-m';
  71. }
  72. if (position.includes('right:0')) {
  73. return 'dane-m';
  74. }
  75. return 'dane-w';
  76. });
  77. //切换时间选项
  78. // function onChange(value, dateString) {
  79. // console.log('Selected Time: ', value);
  80. // console.log('Formatted Selected Time: ', dateString);
  81. // }
  82. // function onOk(val) {
  83. // console.log('onOk: ', val);
  84. // }
  85. //下拉框选项切换
  86. function selectHandler(id) {
  87. selectedDeviceID.value = id;
  88. emit('select', selectedDevice);
  89. }
  90. onMounted(() => {
  91. fetchDevicesBD({ init: true });
  92. interval = setInterval(() => {
  93. fetchDevicesBD();
  94. }, 600000);
  95. });
  96. onUnmounted(() => {
  97. clearInterval(interval);
  98. });
  99. </script>
  100. <style scoped lang="less">
  101. .dane-bd {
  102. position: absolute;
  103. width: 100%;
  104. height: 100%;
  105. background-image: url(/home/zekong/mky-vent-base/src/assets/images/home-container/configurable/firehome/module-title.png);
  106. background-repeat: no-repeat;
  107. background-position: center top;
  108. background-size: 100% auto;
  109. z-index: 2;
  110. .dane-title {
  111. display: flex;
  112. box-sizing: border-box;
  113. align-items: center;
  114. justify-content: space-between;
  115. width: 100%;
  116. height: 34px;
  117. padding: 0 40px 0 50px;
  118. .common-navL {
  119. display: flex;
  120. position: relative;
  121. align-items: center;
  122. color: #fff;
  123. font-size: 14px;
  124. }
  125. .common-navR {
  126. display: flex;
  127. align-items: center;
  128. justify-content: flex-end;
  129. }
  130. // .common-navR-switch {
  131. // display: flex;
  132. // align-items: center;
  133. // justify-content: space-around;
  134. // width: 90%;
  135. // .status-text {
  136. // color: #1fb3f7;
  137. // font-size: 14px;
  138. // }
  139. // .status-text1 {
  140. // color: #a1dff8;
  141. // font-size: 14px;
  142. // }
  143. // }
  144. }
  145. .dane-content {
  146. height: calc(100% - 34px);
  147. // border-image: linear-gradient(#1dabeb, #1dabeb22);
  148. border-image: linear-gradient(#1dabeb 0%, #1dabeb 60%, #000723) 30;
  149. // border-left: 1px;
  150. // border-right: 1px;
  151. border-width: 2px;
  152. border-style: solid;
  153. box-sizing: border-box;
  154. border-top: none;
  155. background-image: linear-gradient(#000723 94%, #1dabeb11);
  156. }
  157. }
  158. .dane-l {
  159. background: url('@/assets/images/home-container/configurable/firehome/common-border.png') no-repeat;
  160. background-size: 100% auto;
  161. }
  162. .dane-m {
  163. // background: url('@/assets/images/home-container/configurable/firehome/common-border1.png') no-repeat;
  164. background-size: 100% auto;
  165. }
  166. .dane-s {
  167. background: url('@/assets/images/home-container/configurable/firehome/common-border2.png') no-repeat;
  168. background-size: 100% auto;
  169. }
  170. .dane-w {
  171. background-image: url(/home/zekong/mky-vent-base/src/assets/images/home-container/configurable/firehome/module-title-long.png);
  172. background-size: 100% 37px;
  173. }
  174. :deep(.zxm-select-selector) {
  175. height: 22px !important;
  176. border: none !important;
  177. // background-color: rgb(15 64 88) !important;
  178. background-color: transparent !important;
  179. color: #8087a1 !important;
  180. }
  181. :deep(.zxm-select-selection-placeholder) {
  182. color: #8087a1 !important;
  183. }
  184. :deep(.zxm-select-arrow) {
  185. color: #8087a1 !important;
  186. }
  187. :deep(.zxm-picker) {
  188. border: none !important;
  189. background-color: rgb(15 64 88) !important;
  190. box-shadow: none;
  191. color: #a1dff8 !important;
  192. }
  193. :deep(.zxm-picker-input > input) {
  194. color: #a1dff8 !important;
  195. text-align: center !important;
  196. }
  197. :deep(.zxm-picker-separator) {
  198. color: #a1dff8 !important;
  199. }
  200. :deep(.zxm-picker-active-bar) {
  201. display: none !important;
  202. }
  203. :deep(.zxm-picker-suffix) {
  204. color: #a1dff8 !important;
  205. }
  206. :deep(.zxm-switch) {
  207. min-width: 48px !important;
  208. }
  209. :deep(.zxm-switch-checked) {
  210. background-color: rgb(15 64 89) !important;
  211. }
  212. :deep(.zxm-switch-handle::before) {
  213. background-color: rgb(33 179 247) !important;
  214. }
  215. :deep(.zxm-select-selection-item) {
  216. color: #fff !important;
  217. }
  218. </style>