Compare commits
No commits in common. "5ebc6c9b8476792a2ea98cf6a83b40604c7d7957" and "93818ca9bfa087246ed2572f883655b55572b550" have entirely different histories.
5ebc6c9b84
...
93818ca9bf
|
@ -6,7 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<script type="module" src="/src/assets/iconfont/iconfont.js"></script>
|
<script type="module" src="/src/assets/iconfont/iconfont.js"></script>
|
||||||
|
|
||||||
<title>保安后台</title>
|
<title>Vite + Vue + TS</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
@ -15,10 +15,14 @@
|
||||||
<SystemMenus/>
|
<SystemMenus/>
|
||||||
</a-layout-sider>
|
</a-layout-sider>
|
||||||
<a-layout>
|
<a-layout>
|
||||||
<a-layout-header class="layout-header">
|
<a-layout-header
|
||||||
|
class="layout-header"
|
||||||
|
>
|
||||||
<layout-header v-model:collapsed="collapsed"/>
|
<layout-header v-model:collapsed="collapsed"/>
|
||||||
</a-layout-header>
|
</a-layout-header>
|
||||||
<a-layout-content class="layout-content" >
|
<a-layout-content
|
||||||
|
class="layout-content"
|
||||||
|
>
|
||||||
<router-view v-slot="{ Component, route }">
|
<router-view v-slot="{ Component, route }">
|
||||||
<transition appear name="fade-transform" mode="out-in">
|
<transition appear name="fade-transform" mode="out-in">
|
||||||
<keep-alive :include="keepAliveNames">
|
<keep-alive :include="keepAliveNames">
|
||||||
|
|
|
@ -159,7 +159,7 @@ const transformData = (val:any,tree:any)=>{
|
||||||
}
|
}
|
||||||
// 可以进行搜索行政区划 2
|
// 可以进行搜索行政区划 2
|
||||||
const filter: ShowSearchType['filter'] = (inputValue, path) => {
|
const filter: ShowSearchType['filter'] = (inputValue, path) => {
|
||||||
return path?.some(option => option.label.toLowerCase().indexOf(inputValue?.toLowerCase()) > -1);
|
return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 搜索完成时回调
|
// 搜索完成时回调
|
||||||
|
|
|
@ -1,24 +1,114 @@
|
||||||
<template>
|
<template>
|
||||||
<AdministrativeDivisionsTree v-model:value="value" :show-search="{ filter }" @change="searchAdministrativeDivisionTree"></AdministrativeDivisionsTree>
|
<div class="search" id="search">
|
||||||
|
<a-input v-model="valueInput" @input="searchInput" placeholder="请进行搜索"></a-input>
|
||||||
|
<div v-if="valueInput">
|
||||||
|
<ul>
|
||||||
|
<li v-for="item in searchResults" :key="item.id">{{item}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-else >
|
||||||
|
没有找到相关结果
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AdministrativeDivisionsTree from "@/components/tree/AdministrativeDivisionsTree.vue";
|
import {onMounted, ref,} from "vue";
|
||||||
import {ref} from "vue";
|
const valueInput = ref('')
|
||||||
import {ShowSearchType} from "ant-design-vue/es/cascader";
|
const list = ref([])
|
||||||
|
const dataList = ref([
|
||||||
const value = ref([ "110000", "110100", "110116", "110116005" ])
|
{
|
||||||
|
id:0,
|
||||||
const filter: ShowSearchType['filter'] = (inputValue, path) => {
|
value:'齐家园'
|
||||||
return path?.some(option => option.label.toLowerCase().indexOf(inputValue?.toLowerCase()) > -1);
|
},
|
||||||
};
|
{
|
||||||
|
id:1,
|
||||||
const searchAdministrativeDivisionTree = (e:Array<string>)=>{
|
value:'刘德华'
|
||||||
value.value = e as any
|
},
|
||||||
|
{
|
||||||
|
id:2,
|
||||||
|
value:'张学友'
|
||||||
|
},{
|
||||||
|
id:3,
|
||||||
|
value:'黎明'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:4,
|
||||||
|
value:'家具城'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:5,
|
||||||
|
value:'左岸春天'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:6,
|
||||||
|
value:'麦德龙商城'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:7,
|
||||||
|
value:'世纪酒店'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:8,
|
||||||
|
value:'四方小学'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:9,
|
||||||
|
value:'海洋半岛'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:10,
|
||||||
|
value:'育英小学'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:11,
|
||||||
|
value:'明德小学'
|
||||||
|
},{
|
||||||
|
id:12,
|
||||||
|
value:'希望小学',
|
||||||
}
|
}
|
||||||
|
])
|
||||||
|
const searchResults = ref([])
|
||||||
|
const searchInput = (e:any)=>{
|
||||||
|
valueInput.value = e.target.value
|
||||||
|
if (!valueInput.value) {
|
||||||
|
searchResults.value = []
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
searchResults.value = list.value.filter(item =>
|
||||||
|
item.toLowerCase().includes(valueInput.value.toLowerCase())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// watch(()=>valueInput.value,(value)=>{
|
||||||
|
// if(!value){
|
||||||
|
// searchResults.value = []
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
dataList.value.map((item)=>{
|
||||||
|
return list.value.push(item.value)
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.search{
|
||||||
|
padding: 0 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #4e71f2;
|
||||||
|
margin: 1px 5px;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: 30%;
|
||||||
|
.ceShi{
|
||||||
|
height: 300px;
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.nut-input{
|
||||||
|
padding: 20rpx 20rpx;
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue