danelBd.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div class="danelBd">
  3. <div v-if="moduleNames" class="dane-title"
  4. :style="{ 'margin-bottom': contentStyle.contentH == '0px' ? '0px' : '5px' }">
  5. <div :class="commonTitle == 'selected' ? 'common-navL' : 'common-navL1'">
  6. <img src="@/assets/images/fire/firehome/title-2.png" alt="" />
  7. <span>{{ moduleNames }}</span>
  8. <CaretDownOutlined v-if="moduleIndex && commonTitle == 'datePikers'" :size="18" @click="toggleModule" />
  9. <CaretUpOutlined v-if="!moduleIndex && commonTitle == 'datePikers'" :size="18" @click="toggleModule" />
  10. <div class="module-select" v-if="moduleIndex">
  11. <div class="select-box" v-for="(item, index) in moduleSelects" :key="index" @click="toggleModuleName(item)">{{
  12. item.label }}</div>
  13. </div>
  14. </div>
  15. <div :class="commonTitle == 'selected' ? 'common-navR' : 'common-navR1'">
  16. <!-- 下拉框 -->
  17. <div class="common-navR-select" v-if="commonTitle == 'selected'">
  18. <Select style="width: 140px" :options="selectLists" size="small" placeholder="请选择" v-model:value="selectVal"
  19. allowClear />
  20. </div>
  21. <!-- 日期组件 -->
  22. <div class="common-navR-date" v-if="commonTitle == 'datePikers'">
  23. <RangePicker size="small" style="width: 100%" :show-time="{ format: 'HH:mm' }" format="YYYY-MM-DD HH:mm"
  24. :placeholder="['开始时间', '结束时间']" @change="onChange" @ok="onOk" />
  25. </div>
  26. <!-- 开关组件 -->
  27. <div class="common-navR-switch" v-if="commonTitle == 'switchs'">
  28. <div :class="checked ? 'status-text1' : 'status-text'">风险来源</div>
  29. <Switch v-model:checked="checked" />
  30. <div :class="checked ? 'status-text' : 'status-text1'">危险位置</div>
  31. </div>
  32. </div>
  33. </div>
  34. <div v-if="contentStyle.contentH != '0px'" class="dane-content" :style="{ height: contentStyle.contentH }">
  35. <div class="t-line"></div>
  36. <slot></slot>
  37. </div>
  38. </div>
  39. </template>
  40. <script setup lang="ts">
  41. import { ref, reactive, defineProps, watch } from 'vue';
  42. import { Select, RangePicker, Switch } from 'ant-design-vue';
  43. import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons-vue';
  44. let props = defineProps({
  45. //标题
  46. moduleName: {
  47. type: String,
  48. default: '',
  49. },
  50. //样式
  51. contentStyle: {
  52. type: Object,
  53. default: () => {
  54. return {
  55. contentH: '0px',
  56. };
  57. },
  58. },
  59. commonTitle: {
  60. type: String,
  61. default: '',
  62. },
  63. //下拉列表数据
  64. selectList: {
  65. type: Array,
  66. default: () => {
  67. return []
  68. }
  69. },
  70. moduleSelect:{
  71. type:Array,
  72. default:()=>{
  73. return []
  74. }
  75. }
  76. });
  77. let moduleNames = ref('')
  78. let selectVal = ref('全部');
  79. let selectLists = ref<any[]>([])
  80. let checked = ref(false);
  81. let moduleIndex = ref(false)
  82. let moduleSelects=ref<any[]>([])
  83. //模块选项弹窗状态切换
  84. function toggleModule() {
  85. moduleIndex.value = !moduleIndex.value
  86. }
  87. //切换模块选项名称
  88. function toggleModuleName(item) {
  89. moduleNames.value = item.label
  90. moduleIndex.value = false
  91. }
  92. //切换时间选项
  93. function onChange(value, dateString) {
  94. console.log('Selected Time: ', value);
  95. console.log('Formatted Selected Time: ', dateString);
  96. }
  97. function onOk(val) {
  98. console.log('onOk: ', val);
  99. }
  100. watch(() => props.selectList, (newV, oldV) => {
  101. console.log(newV, '下拉列表------')
  102. selectLists.value = newV
  103. }, { immediate: true, deep: true })
  104. watch(() => props.moduleName, (newM, oldM) => {
  105. moduleNames.value = newM
  106. }, { immediate: true })
  107. watch(()=>props.moduleSelect,(newS,oldS)=>{
  108. console.log(newS,'newS--------')
  109. moduleSelects.value=newS
  110. },{immediate:true,deep:true})
  111. </script>
  112. <style scoped lang="less">
  113. .danelBd {
  114. position: relative;
  115. width: 100%;
  116. height: 100%;
  117. .dane-title {
  118. display: flex;
  119. box-sizing: border-box;
  120. align-items: center;
  121. justify-content: space-between;
  122. width: 100%;
  123. height: 43px;
  124. padding: 0 10px;
  125. background: url('@/assets/images/fire/firehome/title-1.png') no-repeat center;
  126. background-size: 100% 100%;
  127. .common-navL {
  128. display: flex;
  129. position: relative;
  130. align-items: center;
  131. width: 70%;
  132. img {
  133. width: 18px;
  134. height: 18px;
  135. }
  136. span {
  137. margin-left: 10px;
  138. color: #a1dff8;
  139. font-size: 18px;
  140. }
  141. }
  142. .common-navL1 {
  143. display: flex;
  144. position: relative;
  145. align-items: center;
  146. width: 50%;
  147. img {
  148. width: 18px;
  149. height: 18px;
  150. }
  151. span {
  152. margin-left: 10px;
  153. color: #a1dff8;
  154. font-size: 18px;
  155. }
  156. }
  157. .module-select {
  158. display: flex;
  159. position: absolute;
  160. z-index: 9999;
  161. top: 33px;
  162. left: 16px;
  163. box-sizing: border-box;
  164. flex-direction: column;
  165. justify-content: flex-start;
  166. width: 214px;
  167. height: 136px;
  168. padding: 10px;
  169. overflow-y: auto;
  170. border: 1px solid rgb(15 63 88);
  171. border-radius: 10px;
  172. background-color: #fff;
  173. .select-box {
  174. width: 100%;
  175. height: 28px;
  176. color: #000;
  177. line-height: 28px;
  178. text-align: center;
  179. cursor: pointer;
  180. &:hover {
  181. background-color: rgb(161 223 248 / 20%);
  182. }
  183. }
  184. }
  185. .common-navR {
  186. display: flex;
  187. align-items: center;
  188. justify-content: flex-end;
  189. width: 30%;
  190. }
  191. .common-navR1 {
  192. display: flex;
  193. align-items: center;
  194. justify-content: flex-end;
  195. width: 50%;
  196. }
  197. .common-navR-switch {
  198. display: flex;
  199. align-items: center;
  200. justify-content: space-around;
  201. width: 70%;
  202. .status-text {
  203. color: #1fb3f7;
  204. }
  205. .status-text1 {
  206. color: #a1dff8;
  207. }
  208. }
  209. }
  210. .dane-content {
  211. position: relative;
  212. box-sizing: border-box;
  213. width: 100%;
  214. padding: 10px 15px;
  215. background: url('@/assets/images/fire/firehome/title-3.png') no-repeat center;
  216. background-size: 100% 100%;
  217. .t-line {
  218. position: absolute;
  219. top: 0;
  220. left: 0;
  221. width: 100%;
  222. height: 20px;
  223. background: url('@/assets/images/fire/firehome/title-4.png') no-repeat center;
  224. background-size: 100% 100%;
  225. }
  226. }
  227. }
  228. :deep(.vMonitor-select-selector) {
  229. border: none !important;
  230. background-color: rgb(15 64 88) !important;
  231. color: #a1dff8 !important;
  232. }
  233. :deep(.vMonitor-select-selection-placeholder) {
  234. color: #a1dff8 !important;
  235. }
  236. :deep(.vMonitor-select-arrow) {
  237. color: #a1dff8 !important;
  238. }
  239. :deep(.vMonitor-picker) {
  240. border: none !important;
  241. background-color: rgb(15 64 88) !important;
  242. box-shadow: none;
  243. color: #a1dff8 !important;
  244. }
  245. :deep(.vMonitor-picker-input >input) {
  246. color: #a1dff8 !important;
  247. text-align: center !important;
  248. }
  249. :deep(.vMonitor-picker-separator) {
  250. color: #a1dff8 !important;
  251. }
  252. :deep(.vMonitor-picker-active-bar) {
  253. display: none !important;
  254. }
  255. :deep(.vMonitor-picker-suffix) {
  256. color: #a1dff8 !important;
  257. }
  258. :deep(.vMonitor-switch){
  259. min-width: 55px !important;
  260. }
  261. :deep(.vMonitor-switch-checked) {
  262. background-color: rgb(15 64 89) !important;
  263. }
  264. :deep(.vMonitor-switch-handle::before) {
  265. background-color: rgb(33 179 247) !important;
  266. }
  267. </style>