ZaiZai 1 год назад
Родитель
Сommit
6ec30b976b

+ 1 - 1
package.json

@@ -18,7 +18,7 @@
         "dayjs": "^1.11.10",
         "echarts": "^5.5.0",
         "element-plus": "2.6.2",
-        "hc-vue3-ui": "^3.7.8",
+        "hc-vue3-ui": "^3.7.9",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.4.7",
         "js-md5": "^0.8.3",

+ 2 - 0
src/components/index.js

@@ -1,4 +1,5 @@
 import { setupDirective } from './directive/index'
+import HcWinSize from './win-size/win-size.vue'
 import HcMenuIcon from './menu-icon/menu-icon.vue'
 import HcIconInput from './icon-input/icon-input.vue'
 import HcDateYear from './date-year/date-year.vue'
@@ -12,6 +13,7 @@ export const setupComponents = (App) => {
     setupDirective(App)
 
     //自定义组件
+    App.component('HcWinSize', HcWinSize)
     App.component('HcMenuIcon', HcMenuIcon)
     App.component('HcIconInput', HcIconInput)
     App.component('HcDateYear', HcDateYear)

+ 48 - 0
src/components/win-size/win-size.vue

@@ -0,0 +1,48 @@
+<template>
+    <div class="is-no" />
+</template>
+
+<script setup>
+import { onMounted, onUnmounted } from 'vue'
+
+//事件
+const emit = defineEmits(['change'])
+
+defineOptions({
+    name: 'HcWinSize',
+})
+
+onMounted(() => {
+    windowResize()
+    setTimeout(() => {
+        onWindowResize()
+    }, 100)
+})
+
+//监听浏览器窗口变化
+const windowResize = () => {
+    window.addEventListener('resize', resizeEvent)
+}
+const resizeEvent = () => {
+    window.requestAnimationFrame(() => {
+        onWindowResize()
+    })
+}
+
+//获取尺寸
+const onWindowResize = () => {
+    const dom = document.documentElement
+    emit('change', { h: dom.offsetHeight, w: dom.offsetWidth })
+}
+
+//被卸载
+onUnmounted(() => {
+    window.removeEventListener('resize', resizeEvent)
+})
+</script>
+
+<style scoped lang="scss">
+.is-no {
+    display: none;
+}
+</style>

+ 1 - 1
src/views/home/datav.vue

@@ -218,7 +218,7 @@
 </template>
 
 <script setup>
-import { nextTick, onMounted, onUnmounted, ref } from 'vue'
+import { onMounted, onUnmounted, ref } from 'vue'
 import router from '~src/router/index'
 import { useAppStore } from '~src/store'
 import { getStore, setStore } from 'hc-vue3-ui'

+ 20 - 0
src/views/project/admin/list.vue

@@ -29,6 +29,20 @@
             <el-button type="warning" class="ml-2" @click="importClick">导入</el-button>
             <el-button v-yes-com:[deriveTableItem] type="primary" class="ml-2" :disabled="tableCheckKeys.length <= 0">批量导出</el-button>
         </template>
+        <template #search>
+            <hc-date-year v-model="searchForm.startYear" v-model:end="searchForm.endYear" />
+            <div class="relative ml-4 w-[500px]">
+                <hc-search-input v-model="searchForm.queryValue" text="搜索" color="#151921" @search="searchClick">
+                    <template #prepend>
+                        <el-select v-model="searchForm.year" placeholder="年份" clearable style="width: 80px">
+                            <el-option label="2023" value="2023" />
+                            <el-option label="2024" value="2024" />
+                        </el-select>
+                    </template>
+                </hc-search-input>
+            </div>
+        </template>
+
         <HcTableList ref="tableRef" is-admin @tap="rowNameClick" @check="tableCheck" />
         <template #action>
             <div>建设规模:共计 xx 公里</div>
@@ -81,6 +95,7 @@
             </div>
         </hc-dialog>
     </hc-card>
+    <HcWinSize @change="onWindowResize" />
 </template>
 
 <script setup>
@@ -184,6 +199,11 @@ const importClick = () => {
 const modalImportClose = () => {
     isImportShow.value = false
 }
+
+//窗口大小改变
+const onWindowResize = ({ h, w }) => {
+    console.log(h, w)
+}
 </script>
 
 <style lang="scss">

+ 4 - 4
yarn.lock

@@ -2000,10 +2000,10 @@ has-flag@^4.0.0:
   resolved "http://39.108.216.210:9000/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
   integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
 
-hc-vue3-ui@^3.7.8:
-  version "3.7.8"
-  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.7.8.tgz#0bd0466175db60cb6a0455598560feab89fb333a"
-  integrity sha512-9aEoJoVxk7aw/zy+lQVt2ZUXKEZ83pl/OfxO8NfTDxA7pSUmL4vpGvDPle/a2LUohpEalR/7HR7gMeX0yDRuIg==
+hc-vue3-ui@^3.7.9:
+  version "3.7.9"
+  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.7.9.tgz#d097ead1481c355d084dc6b508390e89473090f2"
+  integrity sha512-QTmK4EEp0rmdTVIp7EtZPaS+kAN74FdxhmzEO7JDU7zusSPK0iV+d6PMVLxO67KHRl0i7Cs8H+6El/3EsZauVg==
   dependencies:
     axios "^1.6.8"
     dayjs "^1.11.10"