ModuleBD.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 { useInitDevicesBD } from '../hooks/useInit';
  50. const props = defineProps<{
  51. moduleData: ModuleData;
  52. showStyle: ShowStyle;
  53. moduleName: string;
  54. deviceType: string;
  55. visible: boolean;
  56. pageType: string;
  57. }>();
  58. const emit = defineEmits(['close', 'select']);
  59. const { header } = props.moduleData;
  60. const { selectedDeviceID, selectedDevice, options, fetchDevices } = useInitDevicesBD(props.deviceType, props.pageType, props.moduleData);
  61. const style = computed(() => {
  62. const size = props.showStyle.size;
  63. const position = props.showStyle.position;
  64. return size + position;
  65. });
  66. let interval: any = null;
  67. // 根据配置里的定位判断应该使用哪个module组件
  68. const daneClass = computed(() => {
  69. const position = props.showStyle.position;
  70. if (position.includes('left:0')) {
  71. return 'dane-m';
  72. }
  73. if (position.includes('right:0')) {
  74. return 'dane-m';
  75. }
  76. return 'dane-w';
  77. });
  78. //切换时间选项
  79. // function onChange(value, dateString) {
  80. // console.log('Selected Time: ', value);
  81. // console.log('Formatted Selected Time: ', dateString);
  82. // }
  83. // function onOk(val) {
  84. // console.log('onOk: ', val);
  85. // }
  86. //下拉框选项切换
  87. function selectHandler(id) {
  88. selectedDeviceID.value = id;
  89. emit('select', selectedDevice);
  90. }
  91. onMounted(() => {
  92. fetchDevices({ init: true });
  93. interval = setInterval(() => {
  94. fetchDevices();
  95. }, 600000);
  96. });
  97. onUnmounted(() => {
  98. clearInterval(interval);
  99. });
  100. </script>
  101. <style scoped lang="less">
  102. .dane-bd {
  103. position: absolute;
  104. width: 100%;
  105. height: 100%;
  106. background-image: url(/home/zekong/mky-vent-base/src/assets/images/home-container/configurable/firehome/module-title.png);
  107. background-repeat: no-repeat;
  108. background-position: center top;
  109. background-size: 100% auto;
  110. z-index: 2;
  111. .dane-title {
  112. display: flex;
  113. box-sizing: border-box;
  114. align-items: center;
  115. justify-content: space-between;
  116. width: 100%;
  117. height: 34px;
  118. padding: 0 40px 0 50px;
  119. .common-navL {
  120. display: flex;
  121. position: relative;
  122. align-items: center;
  123. color: #fff;
  124. font-size: 14px;
  125. }
  126. .common-navR {
  127. display: flex;
  128. align-items: center;
  129. justify-content: flex-end;
  130. }
  131. // .common-navR-switch {
  132. // display: flex;
  133. // align-items: center;
  134. // justify-content: space-around;
  135. // width: 90%;
  136. // .status-text {
  137. // color: #1fb3f7;
  138. // font-size: 14px;
  139. // }
  140. // .status-text1 {
  141. // color: #a1dff8;
  142. // font-size: 14px;
  143. // }
  144. // }
  145. }
  146. .dane-content {
  147. height: calc(100% - 34px);
  148. // border-image: linear-gradient(#1dabeb, #1dabeb22);
  149. border-image: linear-gradient(#1dabeb 0%, #1dabeb 60%, #000723) 30;
  150. // border-left: 1px;
  151. // border-right: 1px;
  152. border-width: 2px;
  153. border-style: solid;
  154. box-sizing: border-box;
  155. border-top: none;
  156. background-image: linear-gradient(#000723 94%, #1dabeb11);
  157. }
  158. }
  159. .dane-l {
  160. background: url('@/assets/images/home-container/configurable/firehome/common-border.png') no-repeat;
  161. background-size: 100% auto;
  162. }
  163. .dane-m {
  164. // background: url('@/assets/images/home-container/configurable/firehome/common-border1.png') no-repeat;
  165. background-size: 100% auto;
  166. }
  167. .dane-s {
  168. background: url('@/assets/images/home-container/configurable/firehome/common-border2.png') no-repeat;
  169. background-size: 100% auto;
  170. }
  171. .dane-w {
  172. background-image: url(/home/zekong/mky-vent-base/src/assets/images/home-container/configurable/firehome/module-title-long.png);
  173. background-size: 100% 37px;
  174. }
  175. :deep(.zxm-select-selector) {
  176. height: 22px !important;
  177. border: none !important;
  178. // background-color: rgb(15 64 88) !important;
  179. background-color: transparent !important;
  180. color: #8087a1 !important;
  181. }
  182. :deep(.zxm-select-selection-placeholder) {
  183. color: #8087a1 !important;
  184. }
  185. :deep(.zxm-select-arrow) {
  186. color: #8087a1 !important;
  187. }
  188. :deep(.zxm-picker) {
  189. border: none !important;
  190. background-color: rgb(15 64 88) !important;
  191. box-shadow: none;
  192. color: #a1dff8 !important;
  193. }
  194. :deep(.zxm-picker-input > input) {
  195. color: #a1dff8 !important;
  196. text-align: center !important;
  197. }
  198. :deep(.zxm-picker-separator) {
  199. color: #a1dff8 !important;
  200. }
  201. :deep(.zxm-picker-active-bar) {
  202. display: none !important;
  203. }
  204. :deep(.zxm-picker-suffix) {
  205. color: #a1dff8 !important;
  206. }
  207. :deep(.zxm-switch) {
  208. min-width: 48px !important;
  209. }
  210. :deep(.zxm-switch-checked) {
  211. background-color: rgb(15 64 89) !important;
  212. }
  213. :deep(.zxm-switch-handle::before) {
  214. background-color: rgb(33 179 247) !important;
  215. }
  216. :deep(.zxm-select-selection-item) {
  217. color: #fff !important;
  218. }
  219. </style>