CN-71 feat:用户,角色,i18n,操作记录列表页面 添加搜索框

This commit is contained in:
晶晶 张
2021-07-27 09:19:44 +08:00
parent df61269616
commit 6f5016872d
6 changed files with 24 additions and 15 deletions

View File

@@ -9,9 +9,14 @@
<slot name="top-tool-left"></slot> <slot name="top-tool-left"></slot>
</div> </div>
<div class="top-tool-right"> <div class="top-tool-right">
<el-input v-model="keyWord" value="keyWord"></el-input> <div style="margin-right: 10px;display: flex">
<el-button @click="onSearch" icon="el-icon-search" type="info" size="mini" style="margin-right: 10px"></el-button> <input type="text" v-model="keyWord"/>
<div v-if="showLayout.indexOf('searchInput') > -1" class="top-tool-search margin-r-20"></div> <button><i class="el-icon-search" @click="onsearch" ></i></button>
</div>
<!-- <el-input v-model="keyWord" value="keyWord"></el-input>
<el-button @click="onsearch" icon="el-icon-search" type="info" size="mini" style="margin-right: 10px"></el-button>-->
<div v-if="showLayout.indexOf('searchInput') > -1" class="top-tool-search margin-r-20">
</div>
<slot name="top-tool-right"></slot> <slot name="top-tool-right"></slot>
<button v-if="showLayout.indexOf('elementSet') > -1" class="top-tool-btn" <button v-if="showLayout.indexOf('elementSet') > -1" class="top-tool-btn"
type="button" @click="tools.showCustomTableTitle = true"> type="button" @click="tools.showCustomTableTitle = true">
@@ -45,7 +50,6 @@
<script> <script>
import columnCustomize from '@/components/table/ColumnCustomize' import columnCustomize from '@/components/table/ColumnCustomize'
import { fromRoute } from '@/utils/constants' import { fromRoute } from '@/utils/constants'
import { get } from '@/utils/http'
export default { export default {
name: 'cnDataList', name: 'cnDataList',
@@ -78,20 +82,15 @@ export default {
tools: { tools: {
showCustomTableTitle: false // 自定义列弹框是否显示 showCustomTableTitle: false // 自定义列弹框是否显示
}, },
showLayout: [], showLayout: []
Search:[],
} }
}, },
methods: { methods: {
updateCustomTableTitle (custom) { updateCustomTableTitle (custom) {
this.$emit('update:customTableTitle', custom) this.$emit('update:customTableTitle', custom)
}, },
onSearch () { onsearch () {
get('sys/log?pageNo=1&pageSize=30').then(res => { this.$emit('search', this.keyWord)
if(res.code === 200){
this.Search = res.data.list
}
})
} }
}, },
watch: { watch: {
@@ -106,4 +105,7 @@ export default {
} }
</script> </script>
<style> <style>
input:focus{
outline: none;
}
</style> </style>

View File

@@ -17,7 +17,7 @@ export default {
pageObj: { // 分页对象 pageObj: { // 分页对象
pageNo: 1, pageNo: 1,
pageSize: defaultPageSize, pageSize: defaultPageSize,
total: 0 total: ''
}, },
/* 工具参数 */ /* 工具参数 */
tools: { tools: {
@@ -76,6 +76,7 @@ export default {
} }
this.tableData = response.data.list this.tableData = response.data.list
this.pageObj.total = response.data.total this.pageObj.total = response.data.total
this.pageObj.total = ''
// TODO 回到顶部 // TODO 回到顶部
} }
}) })
@@ -143,6 +144,10 @@ export default {
tableDataSort (orderBy) { tableDataSort (orderBy) {
this.$set(this.searchLabel, 'orderBy', orderBy) this.$set(this.searchLabel, 'orderBy', orderBy)
this.getTableData() this.getTableData()
},
search (params) {
this.pageObj.pageNo = 1
this.getTableData({ q: params })
} }
}, },
watch: { watch: {

View File

@@ -7,6 +7,7 @@
:api="url" :api="url"
:from="fromRoute.user" :from="fromRoute.user"
:layout="['columnCustomize','elementSet']" :layout="['columnCustomize','elementSet']"
@search="search"
> >
<template #top-tool-right> <template #top-tool-right>
<button <button
@@ -81,7 +82,6 @@ export default {
} }
}, },
methods: { methods: {
} }
} }
</script> </script>

View File

@@ -23,6 +23,7 @@
@reload="getTableData" @reload="getTableData"
@selectionChange="selectionChange" @selectionChange="selectionChange"
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></operation-log-table> @showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></operation-log-table>
@search="search"
</template> </template>
<!-- 分页组件 --> <!-- 分页组件 -->
<template #pagination> <template #pagination>

View File

@@ -7,6 +7,7 @@
:api="url" :api="url"
:from="fromRoute.roles" :from="fromRoute.roles"
:layout="['columnCustomize','elementSet']" :layout="['columnCustomize','elementSet']"
@search="search"
> >
<template v-slot:top-tool-right> <template v-slot:top-tool-right>
<button id="roles-add" v-has="'role_add'" :title="$t('overall.createRole')" class="top-tool-btn margin-r-10" <button id="roles-add" v-has="'role_add'" :title="$t('overall.createRole')" class="top-tool-btn margin-r-10"

View File

@@ -7,6 +7,7 @@
:api="url" :api="url"
:from="fromRoute.user" :from="fromRoute.user"
:layout="['columnCustomize','elementSet']" :layout="['columnCustomize','elementSet']"
@search="search"
> >
<template #top-tool-right> <template #top-tool-right>
<button <button
@@ -85,7 +86,6 @@ export default {
} }
}, },
methods: { methods: {
} }
} }
</script> </script>