update: proSearch添加class

This commit is contained in:
xieyonghong 2023-03-14 16:57:31 +08:00
parent ce9ce6ff4a
commit 67739f0714
7 changed files with 26 additions and 14 deletions

View File

@ -1,8 +1,13 @@
<template> <template>
<ConfigProvider :locale='zhCN'>
<router-view /> <router-view />
</ConfigProvider>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ConfigProvider } from 'jetlinks-ui-components'
import zhCN from 'jetlinks-ui-components/es/locale/zh_CN';
</script> </script>
<style scoped> <style scoped>

View File

@ -5,6 +5,7 @@
:request='saveSearchHistory' :request='saveSearchHistory'
:historyRequest='getSearchHistory' :historyRequest='getSearchHistory'
:columns='columns' :columns='columns'
:class='props.class'
@search='searchSubmit' @search='searchSubmit'
/> />
</template> </template>

View File

@ -5,6 +5,10 @@ import components from './components'
import router from './router' import router from './router'
import './style.less' import './style.less'
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
const app = createApp(App) const app = createApp(App)
app.use(store) app.use(store)

View File

@ -1,12 +1,11 @@
<template> <template>
<div class='dropdown-time-picker'> <div class='dropdown-time-picker'>
<j-time-picker <j-time-picker
v-if='type === "time"' v-if='!_type'
open open
class='manual-time-picker'
v-model:value='myValue' v-model:value='myValue'
class='manual-time-picker'
:format='myFormat' :format='myFormat'
:valueFormat='myFormat'
:getPopupContainer='getPopupContainer' :getPopupContainer='getPopupContainer'
popupClassName='manual-time-picker-popup' popupClassName='manual-time-picker-popup'
@change='change' @change='change'
@ -17,7 +16,6 @@
class='manual-time-picker' class='manual-time-picker'
v-model:value='myValue' v-model:value='myValue'
:format='myFormat' :format='myFormat'
:valueFormat='myFormat'
:getPopupContainer='getPopupContainer' :getPopupContainer='getPopupContainer'
popupClassName='manual-time-picker-popup' popupClassName='manual-time-picker-popup'
@change='change' @change='change'
@ -26,7 +24,7 @@
</template> </template>
<script setup lang='ts' name='DropdownTime'> <script setup lang='ts' name='DropdownTime'>
import dayjs from 'dayjs' import dayjs, { Dayjs } from 'dayjs'
type Emit = { type Emit = {
(e: 'update:value', value: string) : void (e: 'update:value', value: string) : void
@ -44,23 +42,26 @@ const props = defineProps({
}, },
format: { format: {
type: String, type: String,
default: '' default: undefined
} }
}) })
const emit = defineEmits<Emit>() const emit = defineEmits<Emit>()
const myFormat = props.format || ( props.type === 'time' ? 'HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss') const myFormat = props.format || ( props.type === 'time' ? 'HH:mm:ss' : 'YYYY-MM-DD HH:mm:ss')
const myValue = ref(props.value || dayjs(new Date()).format(myFormat)) const myValue = ref<Dayjs>(dayjs(props.value || new Date(), myFormat))
const getPopupContainer = (trigger: HTMLElement) => { const getPopupContainer = (trigger: HTMLElement) => {
return trigger?.parentNode || document.body return trigger?.parentNode || document.body
} }
const change = (e: string) => { const change = (e: Dayjs) => {
myValue.value = e emit('update:value', e.format(myFormat))
emit('update:value', e) emit('change', e.format(myFormat))
emit('change', e)
} }
const _type = computed(() => {
return props.value?.includes('-')
})
</script> </script>
<style lang='less'> <style lang='less'>

View File

@ -28,7 +28,7 @@
@change='timeChange' @change='timeChange'
/> />
<DropdownMenus <DropdownMenus
v-if='["select","enum", "boolean"].includes(item.component)' v-else-if='["select","enum", "boolean"].includes(item.component)'
:options='["metric", "upper"].includes(item.key) ? metricOption : options' :options='["metric", "upper"].includes(item.key) ? metricOption : options'
@click='onSelect' @click='onSelect'
/> />

View File

@ -21,6 +21,7 @@
"layouts/*": ["./src/layouts/*"], "layouts/*": ["./src/layouts/*"],
"store/*": ["./src/store/*"], "store/*": ["./src/store/*"],
"style/*": ["./src/style/*"], "style/*": ["./src/style/*"],
"jetlinks-ui-components/es": ["./node_modules/jetlinks-ui-components/es/*"]
}, },
"types": ["ant-design-vue/typings/global", "vite/client"], "types": ["ant-design-vue/typings/global", "vite/client"],
"suppressImplicitAnyIndexErrors": true "suppressImplicitAnyIndexErrors": true

View File

@ -114,7 +114,7 @@ export default defineConfig(({ mode}) => {
} }
}, },
optimizeDeps: { optimizeDeps: {
include: ['pinia', 'vue-router', 'axios', 'lodash-es', '@vueuse/core', 'echarts'], include: ['pinia', 'vue-router', 'axios', 'lodash-es', '@vueuse/core', 'echarts', 'dayjs'],
} }
} }
}) })