Commit c9f02bb5 authored by 罗超's avatar 罗超

完成搜索和文件位置打开功能

parent c6067e8b
......@@ -3,7 +3,7 @@
<div class="row q-pa-md items-center" style="padding-bottom: 15px;">
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708239425000_437.png" style="height: 30px;" />
<div class="col text-center">
<SearchDocument></SearchDocument>
<SearchDocument @open-position="openFilePosition"></SearchDocument>
</div>
<div class="user">
<el-avatar :size="30" :src="userInfo.Icon" v-if="userInfo.Icon"/>
......@@ -77,7 +77,7 @@
</div>
<div class="col">
<BrowsingHistory :current-menu="currentMenu" v-if="currentMenu==0"></BrowsingHistory>
<journeyAds :current-menu="currentMenu" v-if="currentMenu==3||currentMenu==4"></journeyAds>
<journeyAds :position="position" :current-menu="currentMenu" v-if="currentMenu==3||currentMenu==4" @destroy-position="()=>position=null"></journeyAds>
</div>
</div>
</div>
......@@ -97,6 +97,7 @@ import { useSellTemplateStore, useScreenStore, useSlidesStore } from '@/store'
const {userInfo} = storeToRefs(userStore())
const currentMenu = ref<number>(0)
const position = ref<{FileId:number,FileType:1|2,Position:{FileId:number,FileName:string}[]}|null>(null)
const searchData = ref({} as any)
searchData.value = inject(injectKeyTemplate)
......@@ -116,8 +117,11 @@ const sellAdd = (type:number) =>{
marketStore.setMarket(true)
}
const openFilePosition = (playload:{FileId:number,FileType:1|2,Position:{FileId:number,FileName:string}[]})=>{
const openFilePosition = (playload:any)=>{
position.value=playload
currentMenu.value = playload.FileType==1?3:4
searchData.value.currentMenu=currentMenu.value
searchData.value.SellTemplateType = playload.FileType
}
const setCurrentMenuHandler=(i:number)=>{
......
......@@ -36,7 +36,7 @@
</template>
<el-menu mode="vertical">
<el-menu-item index="1" @click="editorFileHandler(item)">打开文件</el-menu-item>
<el-menu-item index="2-4-1">打开文件所在位置</el-menu-item>
<el-menu-item index="2-4-1" @click="openFilePositionHandler(item)">打开文件所在位置</el-menu-item>
</el-menu>
</el-popover>
......@@ -56,6 +56,11 @@ import { storeToRefs } from 'pinia';
import {formatDateTimeToRead} from '@/utils/common'
import { useScreenStore, useSellTemplateStore, useSlidesStore } from '@/store';
import { injectKeyTemplate } from '@/types/injectKey';
import { pl } from 'element-plus/es/locale';
const emit = defineEmits<{
(event: 'open-position',playload:any): void
}>()
const {userInfo} = storeToRefs(userStore())
const searchKey = ref<string>('')
......@@ -130,6 +135,26 @@ const changeSearchType = (val:string='')=>{
if(val!='') searchType.value=val
searchHandler()
}
const openFilePositionHandler = (item:any)=>{
let playload = {
FileId:item.FileId,
FileType:item.FileType,
Position:[]
}
if(item.FolderPath && item.FolderPath!='/'){
let fp = item.FolderPath.split('/')
let fn = item.FolderName.split('/')
let posis:any[] = []
fp.forEach((x:string,i:number)=>{
posis.push({
FileId:x,
FileName:fn[i]
})
})
playload.Position=posis
}
emit('open-position',playload)
}
</script>
<style>
.search-area{
......
......@@ -251,7 +251,7 @@ const props = defineProps({
type: Number,
default: 3,
},
Position:{
position:{
type:Object as PropType<{FileId:number,FileType:1|2,Position:{FileId:number,FileName:string}[]}|null>,
default:null
}
......@@ -295,7 +295,9 @@ const folderObj = ref<{
let TemplateType = 0;
if (searchData.value.SellTemplateType)
TemplateType = searchData.value.SellTemplateType;
const emit = defineEmits<{
(event: 'destroy-position'): void
}>()
const queryObj = reactive({
pageIndex: 1,
pageSize: 50,
......@@ -695,6 +697,20 @@ const operaFolder = (id: number, name: string) => {
folderObj.value.name = name;
folderObj.value.type = queryObj.FileType;
};
const checkPositionHandler = (n:any)=>{
if(n){
if(n.Position && n.Position.length>0){
Navigations.value=n.Position
queryObj.FileId = n.Position[n.Position.length-1].FileId
queryObj.FileType = 0
}else{
Navigations.value=[]
queryObj.FileId = 0
queryObj.FileType = n.FileType
}
emit('destroy-position')
}
}
watch(
() => searchData.value.SellTemplateType,
......@@ -712,9 +728,17 @@ watch(() => queryObj.FileId,(n, o) => {
if(!n) Navigations.value = []
}
);
watch(() => props.position,(n,o)=>{
if(n){
checkPositionHandler(n)
refreshHandler()
}
},{
deep:true
})
onMounted(() => {});
checkPositionHandler(props.position)
querySearchHandler();
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment