Browse Source

添加搜索条件

master
song 3 years ago
parent
commit
73093fb925
  1. 7
      src/components/News/addContentRelation.vue
  2. 1
      src/components/News/addOrEdit.vue
  3. 29
      src/components/News/index.vue
  4. 114
      src/components/News/search.vue

7
src/components/News/addContentRelation.vue

@ -96,6 +96,13 @@ export default {
showPage,
title
};
if(showPage === '0201' || showPage === '0202' || showPage === '0203'){
params.showType = 0
}
if(showPage === '0204'){
params.showPage = '0203'
params.showType = 1
}
POST_QUERY_DETAIL(params).then(res => {
if(res.code === 200){
this.lists = res.data.list

1
src/components/News/addOrEdit.vue

@ -219,7 +219,6 @@
//
handleChange(value) {
console.log('value: ', value);
this.formLabelAlign.showPage = value
},

29
src/components/News/index.vue

@ -1,13 +1,7 @@
<template>
<div>
<el-button
type="primary"
icon="el-icon-plus"
style="margin-bottom: 15px;"
@click="addModal"
>
添加
</el-button>
<search @addModal="addModal" @getList="getList" />
<div class="table">
<el-table
:data="lists"
@ -121,6 +115,7 @@
<script>
const AddOrEdit = () => import('./addOrEdit.vue');
const DetailContent = () => import('./detailContent.vue');
const Search = () => import('./search.vue');
import {
POST_QUERY_DETAIL,
QUERY_DETAIL,
@ -156,14 +151,14 @@
},
components: {
AddOrEdit,DetailContent
AddOrEdit,DetailContent,Search
},
methods: {
/**
* 获取详情列表
*/
getList() {
getList(options) {
const { pageNum, pageSize, showPage } = this;
const params = {
pageNum,
@ -171,17 +166,21 @@
showPage
};
if(showPage === '0201' || showPage === '0202' || showPage === '0203'){
params.pageType = 0
params.showType = 0
}
if(showPage === '0204'){
params.showPage = '0203'
params.pageType = 1
params.showType = 1
}
if(options){
params.title = options.title
params.editor = options.editor
params.publishTimeStart = options.publishTimeStart
params.publishTimeEnd = options.publishTimeEnd
}
POST_QUERY_DETAIL(params).then(res => {
if(res.code === 200){
if(res.data.list && res.data.list.length){
this.lists = res.data.list
}
this.lists = res.data.list
this.pageNum = +res.data.pageNum
this.pageSize = +res.data.pageSize
this.count = +res.data.total

114
src/components/News/search.vue

@ -0,0 +1,114 @@
<template>
<div class="flex flex-wrap mb-4">
<div class="flex flex-row mr-5 mb-4 align-center">
标题
<el-input
placeholder="请输入标题"
class="flex-1"
v-model="title"
@change="changeTitle($event, 'title')">
</el-input>
</div>
<div class="flex flex-row mr-5 mb-4 align-center">
责编
<el-input
placeholder="请输入责编"
class="flex-1"
v-model="editor"
@change="changeTitle($event, 'editor')">
</el-input>
</div>
<div class="flex flex-row mr-5 mb-4 align-center">
发表时间
<el-date-picker
v-model="publishTime"
@change="changeTime"
class="flex-1"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
<div class="flex flex-row mr-5 mb-4 align-center" v-show="show">
页面显示位置
<el-cascader
v-model="showPage"
class="w-230"
:options="tabList"
:props="props"
@change="handleChange">
</el-cascader>
</div>
<el-button
type="primary"
icon="el-icon-search"
class="mr-5 mb-4"
@click="$emit('getList', options)">
搜索
</el-button>
<el-button
type="primary"
icon="el-icon-plus"
class="mb-4"
@click="$emit('addModal')"
>
添加
</el-button>
</div>
</template>
<script>
import {tabList} from '../../filters/code';
export default{
data() {
return {
tabList,
props: {
value: 'code',
label: 'title',
children: 'children'
},
show: false,
title: '',
editor: '',
publishTime: '',
showPage: ['02','0203'],
options: {
title: '',
editor: '',
publishTimeStart: '',
publishTimeEnd: '',
showPage: '0203'
}
}
},
mounted(){
const code = localStorage.getItem('code')
if(code === '0204'){
this.show = true
}
},
methods: {
changeTitle(e, type){
this[type] = e
this.options[type] = e
},
changeTime(e){
this.options.publishTimeStart = this.$moment(e[0]).valueOf()
this.options.publishTimeEnd = this.$moment(e[1]).valueOf()
},
//
handleChange(value) {
this.options.showPage = value[1]
},
}
}
</script>
Loading…
Cancel
Save