代码改造完成,加入多字典查询方式

This commit is contained in:
zhengjie
2019-06-29 12:32:52 +08:00
parent 1b757d6972
commit 9ca7d4b05f
56 changed files with 771 additions and 1467 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<eHeader :query="query"/>
<Search :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="username" label="用户名"/>
@@ -39,9 +39,9 @@
import initData from '@/mixins/initData'
import { parseTime } from '@/utils/index'
import { getErrDetail } from '@/api/log'
import eHeader from './module/header'
import Search from './search'
export default {
components: { eHeader },
components: { Search },
mixins: [initData],
data() {
return {
@@ -59,11 +59,10 @@ export default {
this.url = 'api/logs/error'
const sort = 'id,desc'
const query = this.query
const username = query.username
const logType = query.logType
const type = query.type
const value = query.value
this.params = { page: this.page, size: this.size, sort: sort }
if (username && username) { this.params['username'] = username }
if (logType !== '' && logType !== null) { this.params['logType'] = logType }
if (type && value) { this.params[type] = value }
return true
},
info(id) {

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<eHeader :query="query"/>
<Search :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="username" label="用户名"/>
@@ -35,9 +35,9 @@
<script>
import initData from '@/mixins/initData'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import Search from './search'
export default {
components: { eHeader },
components: { Search },
mixins: [initData],
created() {
this.$nextTick(() => {
@@ -50,9 +50,10 @@ export default {
this.url = 'api/logs'
const sort = 'id,desc'
const query = this.query
const username = query.username
const type = query.type
const value = query.value
this.params = { page: this.page, size: this.size, sort: sort }
if (username && username) { this.params['username'] = username }
if (type && value) { this.params[type] = value }
return true
}
}

View File

@@ -1,28 +0,0 @@
<template>
<div class="head-container">
<el-input v-model="query.username" clearable placeholder="用户名" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
</div>
</template>
<script>
export default {
props: {
query: {
type: Object,
required: true
}
},
data() {
return {
downloadLoading: false
}
},
methods: {
toQuery() {
this.$parent.page = 0
this.$parent.init()
}
}
}
</script>

View File

@@ -0,0 +1,28 @@
<template>
<div class="head-container">
<el-input v-model="query.value" clearable placeholder="请输入搜索内容" style="width: 150px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="$parent.toQuery">搜索</el-button>
</div>
</template>
<script>
export default {
props: {
query: {
type: Object,
required: true
}
},
data() {
return {
queryTypeOptions: [
{ key: 'username', display_name: '用户名' },
{ key: 'description', display_name: '描述' }
]
}
}
}
</script>

View File

@@ -61,7 +61,7 @@ export default {
mixins: [initData],
data() {
return {
delLoading: false, sup_this: this, permissions: [], deleteAllLoading: false
delLoading: false, permissions: [], deleteAllLoading: false
}
},
created() {
@@ -101,10 +101,6 @@ export default {
console.log(err.response.data.message)
})
},
toQuery() {
this.page = 0
this.init()
},
deleteAll() {
this.$confirm('你确定要清空缓存数据吗?', '提示', {
confirmButtonText: '确定',