Browse Source

项目管理

ZaiZai 1 year ago
parent
commit
e2dddab4de
4 changed files with 5 additions and 193 deletions
  1. 1 1
      package.json
  2. 0 111
      src/components/echarts/echarts.vue
  3. 0 77
      src/components/search-input/search-input.vue
  4. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -21,7 +21,7 @@
         "dayjs": "^1.11.10",
         "echarts": "^5.5.0",
         "element-plus": "2.6.1",
-        "hc-vue3-ui": "^3.4.5",
+        "hc-vue3-ui": "^3.4.7",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.4.6",
         "js-md5": "^0.8.3",

+ 0 - 111
src/components/echarts/echarts.vue

@@ -1,111 +0,0 @@
-<template>
-    <div class="hc-echarts-box">
-        <div ref="echart" class="hc-echarts" :style="`width : ${chart?.clientWidth}px`" />
-    </div>
-</template>
-
-<script setup>
-import * as echarts from 'echarts'
-import { getObjValue } from 'js-fast-way'
-import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
-const props = defineProps({
-    option: {
-        type: Object,
-        default: () => ({}),
-    },
-})
-
-//事件
-const emit = defineEmits(['resize'])
-
-defineOptions({
-    name: 'HcCharts',
-})
-
-//初始变量
-let chart = null, iTime
-const echart = ref(null)
-
-//深度监听
-const options = ref(getObjValue(props.option))
-watch(() => props.option, (option) => {
-    options.value = getObjValue(option)
-    setOptions(options.value)
-}, { deep: true })
-
-//初始化图表
-const initChart = () => {
-    chart = echarts.init(echart.value)
-    setOptions(options.value)
-}
-
-//监听浏览器窗口变化
-const windowResize = () => {
-    window.addEventListener('resize', resizeEvent)
-    nextTick(() => {
-        emit('resize', chart.getWidth())
-    })
-}
-
-const resizeEvent = () => {
-    window.requestAnimationFrame(() => {
-        chart.resize()
-        clearTimeout(iTime)
-        iTime = setTimeout(() => {
-            emit('resize', chart.getWidth())
-        }, 500)
-    })
-}
-
-//设置图表
-const setOptions = (option) => {
-    if (!chart) return
-    nextTick(() => {
-        chart.setOption(option)
-    })
-}
-
-//渲染完成
-onMounted(() => {
-    setTimeout(() => {
-        initChart()
-        windowResize()
-    }, 500)
-})
-
-//被卸载
-onUnmounted(() => {
-    window.removeEventListener('resize', resizeEvent)
-    chart.dispose()
-    chart = null
-})
-
-const onResize = () => {
-    nextTick(() => {
-        chart.resize()
-    })
-}
-
-// 暴露出去
-defineExpose({
-    onResize,
-})
-</script>
-
-<style lang="scss" scoped>
-.hc-echarts-box {
-    display: block;
-    height: 100%;
-    overflow: hidden;
-    position: relative;
-    .hc-echarts {
-        position: absolute;
-        bottom: 0;
-        left: 0;
-        right: 0;
-        z-index: 2;
-        width: 100%;
-        height: 100%;
-    }
-}
-</style>

+ 0 - 77
src/components/search-input/search-input.vue

@@ -1,77 +0,0 @@
-<template>
-    <div class="hc-search-input-box">
-        <el-input v-model="queryValue" :class="ui" clearable :placeholder="placeholder" @keyup="keyUpEvent">
-            <template v-if="isSlotPrepend" #prepend>
-                <slot name="prepend" />
-            </template>
-        </el-input>
-        <el-button type="primary" @click="searchClick">{{ text }}</el-button>
-    </div>
-</template>
-
-<script setup>
-import { useSlots } from 'vue'
-
-defineProps({
-    ui: {
-        type: String,
-        default: '',
-    },
-    placeholder: {
-        type: String,
-        default: '请输入关键词检索',
-    },
-    text: {
-        type: String,
-        default: '查询',
-    },
-})
-
-const emit = defineEmits(['search'])
-
-defineOptions({
-    name: 'HcSearchInput',
-})
-
-//双向绑定
-// eslint-disable-next-line no-undef
-const queryValue = defineModel('modelValue', {
-    default: '',
-})
-
-//判断<slot>是否有传值
-const slots = useSlots()
-const isSlotPrepend = !!slots['prepend']
-
-//回车搜索
-const keyUpEvent = (e) => {
-    if (e.key === 'Enter') {
-        searchClick()
-    }
-}
-
-//搜索
-const searchClick = () => {
-    emit('search', queryValue.value)
-}
-</script>
-
-<style lang="scss">
-.hc-search-input-box {
-    position: relative;
-    width: 100%;
-    display: flex;
-    align-items: center;
-    .el-input-group__prepend {
-        background-color: var(--el-fill-color-blank);
-    }
-    .el-input__wrapper {
-        border-top-right-radius: 0;
-        border-bottom-right-radius: 0;
-    }
-    .el-button {
-        border-top-left-radius: 0;
-        border-bottom-left-radius: 0;
-    }
-}
-</style>

+ 4 - 4
yarn.lock

@@ -1987,10 +1987,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.4.5:
-  version "3.4.5"
-  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.4.5.tgz#899ae5867659ee8ab6b91f8c3abf0b3645321805"
-  integrity sha512-KowF071vyjuOEPcvB9KaaZB6jRneGKRFENeRLubPCh5A0/+o7WHwnPlTeOiBd3DxqBlUd/osWZrbZJYGjhqD9Q==
+hc-vue3-ui@^3.4.7:
+  version "3.4.7"
+  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.4.7.tgz#1955dc75684030a87dd79b7611d1e545ae6a2f99"
+  integrity sha512-lBOkk9tWt1Kw8YxMlAnOIaD10YfdCzjlDdboNUZdwhIxorFxFkyp1XDS1lBl/GaryyZRmUed4lFmnBUYvVxy8Q==
   dependencies:
     axios "^1.6.7"
     dayjs "^1.11.10"