提交 ad29a595 authored 作者: taojinlong's avatar taojinlong

Merge branch 'main' of github.com:dataease/dataease into main

...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import { dateFormat } from '@/utils' import { timeSection } from '@/utils'
export default { export default {
props: { props: {
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
data() { data() {
return { return {
options: null, options: null,
operator: 'eq', operator: 'between',
values: null values: null
} }
}, },
...@@ -50,37 +50,26 @@ export default { ...@@ -50,37 +50,26 @@ export default {
this.inDraw && this.$store.dispatch('conditions/add', param) this.inDraw && this.$store.dispatch('conditions/add', param)
}, },
dateChange(value) { dateChange(value) {
// const nvalue = dateFormat(value, this.getFormat())
// console.log(nvalue)
this.setCondition() this.setCondition()
}, },
formatValues(values) { formatValues(values) {
if (!values || values.length === 0) { if (!values || values.length === 0) {
return [] return []
} }
return values.map(value => dateFormat(value, this.getFormat())) if (this.options.attrs.type === 'daterange') {
}, if (values.length !== 2) {
getFormat() { return null
let format = 'yyyy' }
switch (this.options.attrs.type) { let start = values[0]
case 'year': let end = values[1]
format = 'yyyy' start = timeSection(start, 'date')[0]
break end = timeSection(end, 'date')[1]
case 'month': const results = [start, end]
format = 'yyyy-MM' return results
break } else {
case 'date': const value = values[0]
format = 'yyyy-MM-dd' return timeSection(value, this.options.attrs.type)
break
case 'daterange':
format = 'yyyy-MM-dd'
this.operator = 'in'
break
default:
format = 'yyyy'
break
} }
return format
} }
} }
} }
......
...@@ -29,7 +29,7 @@ router.beforeEach(async(to, from, next) => { ...@@ -29,7 +29,7 @@ router.beforeEach(async(to, from, next) => {
NProgress.done() NProgress.done()
} else { } else {
const hasGetUserInfo = store.getters.name const hasGetUserInfo = store.getters.name
if (hasGetUserInfo) { if (hasGetUserInfo || to.path.indexOf('/preview/') > -1) {
next() next()
store.dispatch('permission/setCurrentPath', to.path) store.dispatch('permission/setCurrentPath', to.path)
} else { } else {
......
/** /**
* Created by PanJiaChen on 16/11/18. * Created by PanJiaChen on 16/11/18.
*/ */
export function timeSection(date, type) {
if (!date) {
return null
}
const timeRanger = new Array(2)
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
date.setMilliseconds(0)
const end = new Date(date)
if (type === 'year') {
date.setDate(1)
date.setMonth(0)
end.setFullYear(date.getFullYear() + 1)
timeRanger[1] = end.getTime() - 1
}
if (type === 'month') {
date.setDate(1)
const currentMonth = date.getMonth()
if (currentMonth === 11) {
end.setFullYear(date.getFullYear() + 1)
end.setMonth(0)
} else {
end.setMonth(date.getMonth() + 1)
}
timeRanger[1] = end.getTime() - 1
}
if (type === 'date') {
end.setHours(23)
end.setMinutes(59)
end.setSeconds(59)
end.setMilliseconds(999)
timeRanger[1] = end.getTime()
}
timeRanger[0] = date.getTime()
return timeRanger
}
export function dateFormat(date, fmt) { export function dateFormat(date, fmt) {
let ret let ret
const opt = { const opt = {
......
...@@ -241,7 +241,7 @@ export default { ...@@ -241,7 +241,7 @@ export default {
showPanel(type) { showPanel(type) {
debugger debugger
if (this.showIndex === -1 || this.showIndex === type) { if (this.showIndex === -1 || this.showIndex === type) {
this.show = !this.show this.$nextTick(() => (this.show = !this.show))
} }
this.showIndex = type this.showIndex = type
}, },
...@@ -254,6 +254,7 @@ export default { ...@@ -254,6 +254,7 @@ export default {
// 点击样式按钮 排除 // 点击样式按钮 排除
const stick = evt.target.closest('.el-icon-magic-stick') const stick = evt.target.closest('.el-icon-magic-stick')
if (!parent && !self && !stick) { if (!parent && !self && !stick) {
debugger
this.show = false this.show = false
window.removeEventListener('click', this.closeSidebar) window.removeEventListener('click', this.closeSidebar)
this.showIndex = -1 this.showIndex = -1
...@@ -371,6 +372,7 @@ export default { ...@@ -371,6 +372,7 @@ export default {
this.openFilterDiolog() this.openFilterDiolog()
}, },
closeLeftPanel() { closeLeftPanel() {
debugger
this.show = false this.show = false
// this.beforeDestroy() // this.beforeDestroy()
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论