增加根据名称搜索功能 支持模糊搜索
This commit is contained in:
parent
292dce1630
commit
2917cac91b
|
@ -106,7 +106,16 @@ export const getFilesInfoByType = data =>{
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
export const getFilesInfoByName = data =>{
|
||||
return axios({
|
||||
headers:{
|
||||
"Authorization": localStorage.getItem("systemToken")
|
||||
},
|
||||
url: '/file/getFilesInfoByName',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 默认全部倒出
|
||||
// 根据需要进行
|
||||
|
@ -120,5 +129,6 @@ export default {
|
|||
getAllType,
|
||||
addType,
|
||||
addFileInfo,
|
||||
getFilesInfoByType
|
||||
getFilesInfoByType,
|
||||
getFilesInfoByName
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="manageList-header-input">
|
||||
<!-- 输入框 双向绑定数据 自带清空 -->
|
||||
<el-input v-model="searchInfo.keyWords" suffix-icon="el-icon-edit" clearable placeholder="输入文件名搜索">
|
||||
<el-button slot="append" icon="el-icon-search"></el-button>
|
||||
<el-button slot="append" icon="el-icon-search" @click="nameSearch"></el-button>
|
||||
</el-input>
|
||||
|
||||
<!-- 下拉选框 -->
|
||||
|
@ -144,7 +144,7 @@
|
|||
import { getList } from '@/api/table'
|
||||
import pageUtils from '@/utils/pageUtils'
|
||||
import { Message } from 'element-ui'
|
||||
import { getFilesInfoByType } from '@/utils/http/interface'
|
||||
import { getFilesInfoByName, getFilesInfoByType } from '@/utils/http/interface'
|
||||
|
||||
export default {
|
||||
name: 'FileList',
|
||||
|
@ -368,6 +368,26 @@ export default {
|
|||
this.getAllFiles()
|
||||
// console.log("默认状态")
|
||||
}
|
||||
},
|
||||
|
||||
//name search
|
||||
nameSearch(){
|
||||
if (this.searchInfo.keyWords != null && this.searchInfo.keyWords != '' && this.searchInfo.keyWords != undefined){
|
||||
//have search content
|
||||
let filesInfo = {
|
||||
name : this.searchInfo.keyWords
|
||||
}
|
||||
this.$api.getFilesInfoByName(filesInfo).then((res)=>{
|
||||
if (res.status == 0) {
|
||||
this.list = res.data
|
||||
}else {
|
||||
Message.warning("服务错误")
|
||||
}
|
||||
})
|
||||
}else {
|
||||
// no content 但不会出现 一般 想重置目前只能刷新页面
|
||||
this.getAllFiles()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue