Browse Source

Merge branch 'newDp' of http://192.168.2.241:3000/chenlong/xx_sw_dp into newDp

chc 1 week ago
parent
commit
4bfe6a1d91

+ 47 - 3
src/components/Dialog/index.vue

@@ -7,8 +7,17 @@
         @mousedown="domRefMousedown">
         <span class="title">{{ title }}
           <!-- 天气预报下拉框 -->
-          <span v-if="isSelectAll" ref="domRef2">
-            <a-dropdown :getPopupContainer="()=>$refs.domRef2">
+          <span v-if="isSelectAll" ref="domRef2" class="tab-item">
+                城市切换<DownOutlined />
+                <div>
+                  <ul>
+                    <li @click="tabWeather(value, key)" v-for="(value, key) in selectAll" :key="key"
+                    >
+                    {{ key }}
+                  </li>
+                  </ul>
+                </div>
+            <!-- <a-dropdown :getPopupContainer="()=>$refs.domRef2">
               <a class="ant-dropdown-link" @click.prevent>
                 城市切换
                 <DownOutlined />
@@ -20,7 +29,7 @@
                   </a-menu-item>
                 </a-menu>
               </template>
-            </a-dropdown>
+            </a-dropdown> -->
           </span>
         </span>
 
@@ -505,4 +514,39 @@ export default defineComponent({
   margin-left: 20px;
   color: #21a3e5 !important;
 }
+.tab-item{
+  position: relative;
+  color: #a5cfff;
+  display: inline-block;
+  font-size: 18px;
+  cursor: pointer;
+  font-weight: bold;
+  z-index: 9999;
+  div{
+    position: absolute;
+    left: 30px;
+    top: 28px;
+    background-color: #333;
+    display: none;
+    ul{
+      padding: 0;
+      margin: 0;
+      li{
+        min-width: 130px;
+        text-align: center;
+        padding: 5px 20px;
+        font-size: 16px;
+        font-weight: 400;
+      }
+      li:hover{
+        background-color: rgba(33, 33, 33, .8);
+      }
+    }
+  }
+}
+.tab-item:hover {
+  div{
+    display: block;
+  }
+}
 </style>

+ 1 - 1
src/components/Dialog/mapDialog.vue

@@ -169,7 +169,7 @@
               </div>
               <img v-if="Object.keys(detailInfo.big_section).length === 0" style="width: 300px; margin: 0 auto;"
                 lass="none-data" src="../../assets/images/weatheHome/none-data.png" />
-              <div class="section-echarts" id="sec-charts">
+              <div class="section-echarts" id="sec-charts" v-if="Object.keys(detailInfo.big_section).length != 0">
               </div>
             </div>
           </div>

+ 10 - 5
src/views/weatherHome/components/importantWeather.vue

@@ -74,15 +74,20 @@ const historyAlarmInfoFn = () => {
 const showAlarmDialog = async () => {
     dialogvisable.value = true
     // 获取重要天气列表
-    timeList.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')]
+    timeList.value = []
     postSignificantWeatherFn()
 
 }
 const postSignificantWeatherFn = async () => {
-    let res = await postSignificantWeather({
-        start_time: timeList.value[0],
-        end_time: timeList.value[1]
-    })
+    let obj = {}
+    if(timeList.value.length>0){
+        obj.start_time = timeList.value[0]
+        obj.end_time = timeList.value[1]
+    }else{
+        obj.start_time = ''
+        obj.end_time = ''
+    }
+    let res = await postSignificantWeather(obj)
     detailsList.value = res.data
 }
 onMounted(async () => {

+ 10 - 5
src/views/weatherHome/components/importantWeather2.vue

@@ -73,15 +73,20 @@ const historyAlarmInfoFn = () => {
 const showAlarmDialog = async () => {
     dialogvisable.value = true
     // 获取重要天气列表
-    timeList.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')]
+    timeList.value = []
     postEmergencyFn()
 
 }
 const postEmergencyFn = async () => {
-    let res = await postEmergency({
-        start_time: timeList.value[0],
-        end_time: timeList.value[1]
-    })
+    let obj = {}
+    if(timeList.value.length>0){
+        obj.start_time = timeList.value[0]
+        obj.end_time = timeList.value[1]
+    }else{
+        obj.start_time = ''
+        obj.end_time = ''
+    }
+    let res = await postEmergency(obj)
     detailsList.value = res.data
 }
 onMounted(async () => {