ModuleBD.vue 6.4 KB

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