danelBd.vue 8.5 KB

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