You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
3.8 KiB
161 lines
3.8 KiB
<script lang="ts" setup>
|
|
import { computed, onBeforeMount, onMounted, onUnmounted, reactive, ref, unref, watch } from 'vue'
|
|
import { debounce } from 'lodash-es'
|
|
import TaskList from './TaskList.vue'
|
|
import { useTaskStore } from '@/store/modules/task'
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
const CustomFieldModalRef = ref(null)
|
|
const collapse = ref(false)
|
|
const taskStore = useTaskStore()
|
|
const taskListRef = ref<HTMLDivElement | null>(null)
|
|
|
|
function collapseHandler() {
|
|
collapse.value = !collapse.value
|
|
}
|
|
|
|
const asideWidth = computed(() => {
|
|
return collapse.value ? 0 : 308
|
|
})
|
|
|
|
const asideStyle = computed(() => {
|
|
return {
|
|
width: `${asideWidth.value}px`,
|
|
}
|
|
})
|
|
|
|
const collapseIcon = computed(() => {
|
|
return collapse.value ? 'expand-cir' : 'collapse-cir'
|
|
})
|
|
|
|
const asideEnter = ref(false)
|
|
|
|
const showCollapse = computed(() => {
|
|
return collapse.value ? true : asideEnter.value
|
|
})
|
|
|
|
watch(() => taskStore.immersion, () => {
|
|
collapse.value = true
|
|
})
|
|
|
|
function showFilter() {
|
|
const modal = unref(CustomFieldModalRef)! as any
|
|
modal.showModal()
|
|
}
|
|
|
|
const showSearch = ref(false)
|
|
|
|
function setShowSearch(value: boolean) {
|
|
showSearch.value = value
|
|
}
|
|
|
|
const inputHandler = debounce((word) => {
|
|
(taskListRef.value as any).search(word)
|
|
}, 500)
|
|
</script>
|
|
|
|
<template>
|
|
<div class="aside" :style="asideStyle" @mouseenter="asideEnter = true" @mouseleave="asideEnter = false">
|
|
<div v-show="showCollapse" class="aside-collapse">
|
|
<div class="aside-collapse-btn" @click="collapseHandler">
|
|
<SvgIcon :name="collapseIcon" size="40" />
|
|
</div>
|
|
</div>
|
|
<div class="aside-header">
|
|
<div v-show="!showSearch" class="warpper">
|
|
<div class="left">
|
|
<svg-icon name="all-worksheet" size="32" />
|
|
<span style="margin-left: 8px;">所有请求</span>
|
|
</div>
|
|
<div class="right">
|
|
<SvgIcon
|
|
style="cursor: pointer;margin-left: 10px;" size="18" name="magnifying-1"
|
|
@click="setShowSearch(true)"
|
|
/>
|
|
<SvgIcon style="cursor: pointer;margin-left: 10px;" size="18" name="filter" @click="showFilter" />
|
|
</div>
|
|
</div>
|
|
<div v-show="showSearch" class="warpper">
|
|
<n-input style="flex: 1;height: 32px;" placeholder="请输入你需要搜索的内容" @input="inputHandler">
|
|
<template #suffix>
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
</template>
|
|
</n-input>
|
|
<SvgIcon size="16px" style="margin-left: 6px;cursor: pointer;" name="clear" @click="setShowSearch(false)" />
|
|
</div>
|
|
</div>
|
|
<TaskList ref="taskListRef" style="height: calc(100vh - 146px);" class="work-sheet-list" />
|
|
<CustomFieldModal ref="CustomFieldModalRef" />
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
.aside {
|
|
display: flex;
|
|
position: relative;
|
|
flex-direction: column;
|
|
background: #FFF;
|
|
border: 1px solid rgb(239, 239, 245);
|
|
border-radius: 3px;
|
|
box-sizing: border-box;
|
|
|
|
&-header {
|
|
padding: 12px 16px;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
|
|
.warpper {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
&-title {
|
|
margin-left: 8px;
|
|
color: #333333;
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.left {
|
|
display: flex;
|
|
align-items: center;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.right {
|
|
display: flex;
|
|
align-items: center;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
&-divider {
|
|
margin-left: 16px;
|
|
width: 292px;
|
|
height: 1px;
|
|
background-color: #e8e8e8;
|
|
}
|
|
|
|
&-collapse{
|
|
width: 2px;
|
|
height: 100%;
|
|
background: #507afd;
|
|
position: absolute;
|
|
right: -2px;
|
|
top: 0;
|
|
}
|
|
|
|
&-collapse-btn {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
width: 40px;
|
|
height: 40px;
|
|
top: calc(15%);
|
|
right: -20px;
|
|
z-index: 10;
|
|
}
|
|
}
|
|
</style>
|
|
../types
|