Browse Source

搜索组件

dev
wangmingyong@163.com 2 months ago
parent
commit
6489b8511e
  1. 171
      zdxt-web-client/zdxt-efcode-enterprise-app/src/components/common/SearchFilterBar.vue
  2. 4
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluate.vue
  3. 139
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue
  4. 43
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/law/lawServiceList.vue
  5. 43
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/nos/message/nosTaskList.vue

171
zdxt-web-client/zdxt-efcode-enterprise-app/src/components/common/SearchFilterBar.vue

@ -0,0 +1,171 @@
<template>
<div class="search-filter-bar">
<van-search v-model="searchText" show-action :placeholder="placeholder" clearable clear-trigger="always"
@clear="onClear" @search="onSearch">
<template #action>
<div @click="onSearch">搜索</div>
</template>
</van-search>
<div class="search-button-list" v-if="showDateFilter">
<van-button plain hairline :class="dateType === null ? 'search-btn active' : 'search-btn'"
@click="searchDateType(null)" round type="primary" size="mini">全部</van-button>
<van-button plain hairline :class="dateType === 1 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(1)" round type="primary" size="mini">本月</van-button>
<van-button plain hairline :class="dateType === 2 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(2)" round type="primary" size="mini">本季</van-button>
<van-button plain hairline :class="dateType === 3 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(3)" round type="primary" size="mini">本年</van-button>
<van-button plain hairline :class="dateType === 9 ? 'search-btn active' : 'search-btn'"
@click="openDatePicker" round type="primary" size="mini">筛选</van-button>
</div>
<div class="search-date-display" v-if="showDateFilter && dateShow">
<span class="date-label" @click="openDatePicker">{{ dateSearchDisplay }}</span>
</div>
<van-popup v-model:show="showDatePicker" position="bottom" v-if="showDateFilter">
<van-date-picker title="选择月度" v-model="currentDate" :min-date="minDate" :max-date="maxDate"
:columns-type="['year', 'month']" @confirm="onDateConfirm" @cancel="showDatePicker = false" />
</van-popup>
</div>
</template>
<script setup name="SearchFilterBar">
defineProps({
placeholder: {
type: String,
default: '请输入关键字查询'
},
minDate: {
type: Date,
default: () => new Date(2020, 0, 1)
},
maxDate: {
type: Date,
default: () => new Date(2030, 11, 31)
},
showDateFilter: {
type: Boolean,
default: true
}
});
const emit = defineEmits(['search', 'dateTypeChange', 'dateConfirm']);
const searchText = ref('');
const dateType = ref(null);
const dateSearch = ref(null);
const dateSearchDisplay = ref('');
const dateShow = ref(false);
const showDatePicker = ref(false);
const now = new Date();
const currentDate = ref([String(now.getFullYear()), String(now.getMonth() + 1).padStart(2, '0')]);
const onSearch = () => {
emit('search', {
searchText: searchText.value,
dateType: dateType.value,
dateSearch: dateSearch.value
});
};
const onClear = () => {
searchText.value = '';
onSearch();
};
const searchDateType = (val) => {
dateType.value = val;
dateSearch.value = null;
dateShow.value = false;
emit('dateTypeChange', val);
onSearch();
};
const openDatePicker = () => {
dateType.value = 9;
showDatePicker.value = true;
};
const onDateConfirm = (value) => {
const year = value.selectedValues[0];
const month = value.selectedValues[1];
dateSearchDisplay.value = year + '/' + month;
dateSearch.value = year + '-' + month;
dateType.value = 9;
dateShow.value = true;
showDatePicker.value = false;
emit('dateConfirm', {
dateSearch: dateSearch.value,
dateSearchDisplay: dateSearchDisplay.value,
dateType: dateType.value
});
onSearch();
};
const resetDateType = (val) => {
dateType.value = val;
};
defineExpose({
searchText,
dateType,
dateSearch,
onSearch,
resetDateType
});
</script>
<style lang="less" scoped>
.search-filter-bar {
.search-button-list {
display: flex;
flex-direction: row;
padding: 0.2rem 0.27rem 0;
gap: 0.15rem;
margin-bottom: 8px;
.search-btn {
flex: 1;
height: 0.7rem;
background: #ebebeb;
border-color: #ebebeb;
color: #999;
font-size: 0.3rem;
}
.search-btn.active {
background-color: #d9e6fd;
border-color: #75a5fb;
color: #1367fe;
}
}
.search-date-display {
padding: 0.15rem 0.27rem 0;
.date-label {
color: #c1bfbf;
font-size: 0.4rem;
}
}
}
:deep(.van-search__content) {
height: 0.9rem;
border: 1px solid #ececec;
border-radius: 0.15rem 0 0 0.15rem;
}
:deep(.van-search__action) {
margin: 0 3% 0 0;
width: 10%;
height: 0.9rem;
background: #1367fe;
border: 0.01rem solid #1367fe;
border-radius: 0 0.15rem 0.15rem 0;
color: #fff;
text-align: center;
line-height: 0.9rem;
}
</style>

4
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluate.vue

@ -1,8 +1,8 @@
<template>
<div class="evaluate-page">
<!-- 顶部导航栏 -->
<van-nav-bar title="执法反馈" left-text="关闭" left-arrow @click-left="onClickLeft">
</van-nav-bar>
<!-- <van-nav-bar title="执法反馈" left-text="关闭" left-arrow @click-left="onClickLeft">
</van-nav-bar> -->
<!-- 内容区域 -->
<div class="content-area">

139
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue

@ -1,37 +1,6 @@
<template>
<div class="registration-list-page">
<!-- 搜索栏 -->
<van-search v-model="searchText" show-action placeholder="请输入关键字查询" clearable clear-trigger="always"
@clear="onClear" @search="onSearch">
<template #action>
<div @click="onSearch">搜索</div>
</template>
</van-search>
<!-- 日期快捷筛选按钮 -->
<div class="search-button-list">
<van-button plain hairline :class="dateType === null ? 'search-btn active' : 'search-btn'"
@click="searchDateType(null)" round type="primary" size="mini">全部</van-button>
<van-button plain hairline :class="dateType === 1 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(1)" round type="primary" size="mini">本月</van-button>
<van-button plain hairline :class="dateType === 2 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(2)" round type="primary" size="mini">本季</van-button>
<van-button plain hairline :class="dateType === 3 ? 'search-btn active' : 'search-btn'"
@click="searchDateType(3)" round type="primary" size="mini">本年</van-button>
<van-button plain hairline :class="dateType === 9 ? 'search-btn active' : 'search-btn'"
@click="openDatePicker" round type="primary" size="mini">筛选</van-button>
</div>
<!-- 指定月份显示 -->
<div class="search-date-display" v-show="dateShow">
<span class="date-label" @click="openDatePicker">{{ dateSearchDisplay }}</span>
</div>
<!-- 月份选择器弹出层 -->
<van-popup v-model:show="showDatePicker" position="bottom">
<van-date-picker title="选择月度" v-model="currentDate" :min-date="minDate" :max-date="maxDate"
:columns-type="['year', 'month']" @confirm="onDateConfirm" @cancel="showDatePicker = false" />
</van-popup>
<SearchFilterBar ref="searchFilterBarRef" @search="onSearchFilter" />
<!-- 可滚动列表区域 -->
<div class="list-container">
@ -82,30 +51,27 @@
import { queryEnforcementRegistrationPageList } from '@/api/enterprise';
import { showToast } from 'vant';
import 'vant/es/toast/style';
import SearchFilterBar from '@/components/common/SearchFilterBar.vue';
const { useCommon } = $globalStore;
const router = useRouter();
const searchFilterBarRef = ref(null);
// ========== ==========
const list = ref([]);
const loading = ref(false);
const finished = ref(false);
const refreshing = ref(false);
const searchText = ref('');
// ========== ==========
const pageNum = ref(1);
const pageSize = ref(10);
// ========== ==========
// ========== ==========
const searchText = ref('');
const dateType = ref(null);
const dateSearch = ref(null);
const dateSearchDisplay = ref('');
const dateShow = ref(false);
const showDatePicker = ref(false);
const currentDate = ref(['2026', '01']);
const minDate = new Date(2020, 0, 1);
const maxDate = new Date(2030, 11, 31);
// ========== ==========
const formatDate = (dateStr) => {
@ -135,15 +101,12 @@ const fetchList = () => {
pageSize: pageSize.value,
// enterpriseNumber: useCommon.enterpriseNumber,
};
//
if (searchText.value) {
params.searchValue = searchText.value;
}
//
if (dateType.value != null && dateType.value !== 9) {
params.dateType = dateType.value;
}
//
if (dateSearch.value) {
params.dateSearch = dateSearch.value;
}
@ -210,8 +173,11 @@ const onRefresh = () => {
fetchList();
};
// ========== ==========
const onSearch = () => {
// ========== ==========
const onSearchFilter = ({ searchText: st, dateType: dt, dateSearch: ds }) => {
searchText.value = st;
dateType.value = dt;
dateSearch.value = ds;
pageNum.value = 1;
list.value = [];
finished.value = false;
@ -219,38 +185,6 @@ const onSearch = () => {
fetchList();
};
// ========== ==========
const onClear = () => {
searchText.value = '';
onSearch();
};
// ========== ==========
const searchDateType = (val) => {
dateType.value = val;
dateSearch.value = null;
dateShow.value = false;
onSearch();
};
// ========== ==========
const openDatePicker = () => {
dateType.value = 9;
showDatePicker.value = true;
};
// ========== ==========
const onDateConfirm = (value) => {
const year = value.selectedValues[0];
const month = value.selectedValues[1];
dateSearchDisplay.value = year + '/' + month;
dateSearch.value = year + '-' + month;
dateType.value = 9;
dateShow.value = true;
showDatePicker.value = false;
onSearch();
};
// ========== ==========
const toDetailView = (item) => {
router.push({
@ -286,39 +220,6 @@ const toEvaluate = (id, checkItem) => {
}
}
/* ===== 搜索按钮行 ===== */
.search-button-list {
display: flex;
flex-direction: row;
padding: 0.2rem 0.27rem 0;
gap: 0.15rem;
margin-bottom: 8px;
.search-btn {
flex: 1;
height: 0.7rem;
background: #ebebeb;
border-color: #ebebeb;
color: #999;
font-size: 0.3rem;
}
.search-btn.active {
background-color: #d9e6fd;
border-color: #75a5fb;
color: #1367fe;
}
}
/* ===== 日期显示 ===== */
.search-date-display {
padding: 0.15rem 0.27rem 0;
.date-label {
color: #c1bfbf;
font-size: 0.4rem;
}
}
/* ===== 卡片样式 ===== */
.card-item {
background: #fff;
@ -416,22 +317,4 @@ const toEvaluate = (id, checkItem) => {
}
}
/* ===== Vant 搜索框样式覆盖 ===== */
:deep(.van-search__content) {
height: 0.9rem;
border: 1px solid #ececec;
border-radius: 0.15rem 0 0 0.15rem;
}
:deep(.van-search__action) {
margin: 0 3% 0 0;
width: 10%;
height: 0.9rem;
background: #1367fe;
border: 0.01rem solid #1367fe;
border-radius: 0 0.15rem 0.15rem 0;
color: #fff;
text-align: center;
line-height: 0.9rem;
}
</style>

43
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/law/lawServiceList.vue

@ -1,13 +1,6 @@
<template>
<div class="law-service-page">
<!-- 顶部导航栏 -->
<van-nav-bar
title="普法服务"
left-text="关闭"
left-arrow
@click-left="onClickLeft"
>
</van-nav-bar>
<SearchFilterBar placeholder="搜索普法服务" @search="onSearchFilter" />
<!-- 列表区域 -->
<div class="list-container">
@ -60,6 +53,7 @@
import { getEducationServicesList } from '@/api/enterprise';
import { showToast } from 'vant';
import 'vant/es/toast/style';
import SearchFilterBar from '@/components/common/SearchFilterBar.vue';
const router = useRouter();
@ -71,6 +65,11 @@ const refreshing = ref(false);
const pageNum = ref(1);
const pageSize = ref(10);
// ========== ==========
const searchText = ref('');
const dateType = ref(null);
const dateSearch = ref(null);
// ========== ==========
const formatTime = (val) => {
if (!val) return '';
@ -100,6 +99,15 @@ const fetchList = () => {
pageNum: pageNum.value,
pageSize: pageSize.value,
};
if (searchText.value) {
params.searchValue = searchText.value;
}
if (dateType.value != null && dateType.value !== 9) {
params.dateType = dateType.value;
}
if (dateSearch.value) {
params.dateSearch = dateSearch.value;
}
getEducationServicesList(params, (res) => {
if (res.code === 200) {
const rows = res.rows || res.data?.rows || [];
@ -151,14 +159,16 @@ const onClickLeft = () => {
router.back();
};
// ========== ==========
const onFilterClick = () => {
showToast('筛选功能开发中');
};
// ========== ==========
const onSearchClick = () => {
showToast('搜索功能开发中');
// ========== ==========
const onSearchFilter = ({ searchText: st, dateType: dt, dateSearch: ds }) => {
searchText.value = st;
dateType.value = dt;
dateSearch.value = ds;
pageNum.value = 1;
list.value = [];
finished.value = false;
loading.value = true;
fetchList();
};
// ========== ==========
@ -183,6 +193,7 @@ const toDetail = (item) => {
flex: 1;
overflow-y: auto;
padding: 0.27rem;
padding-top: 0px;
}
}

43
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/nos/message/nosTaskList.vue

@ -1,11 +1,13 @@
<template>
<div class="plan-notice-page app_content">
<van-nav-bar
<!-- <van-nav-bar
title="任务通知"
left-text="返回"
left-arrow
@click-left="onClickLeft"
/>
/> -->
<SearchFilterBar placeholder="搜索任务通知" @search="onSearchFilter" />
<div class="list-container">
<van-pull-refresh v-model="state.refreshing" @refresh="onRefresh">
@ -70,13 +72,14 @@
</template>
<script setup name="nosNoticeList">
import { reactive } from 'vue';
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { showFailToast } from 'vant';
import 'vant/es/toast/style';
import { nosTaskListNoticeAPi, nosTaskMarkReadAPi } from '@/api/nos/index';
import { formattedTimeWithoutSecond } from '@/util/util';
import { messageUnread, setMessageUnread } from '@/store/messageState';
import SearchFilterBar from '@/components/common/SearchFilterBar.vue';
const router = useRouter();
@ -88,6 +91,9 @@ const state = reactive({
finished: false,
refreshing: false,
error: false,
searchText: '',
dateType: null,
dateSearch: null,
});
const formatTime = (time) => {
@ -118,11 +124,20 @@ const formatPlanTitleSegments = (title) => {
};
const fetchList = () => {
nosTaskListNoticeAPi(
{
pageNum: state.pageNum,
pageSize: state.pageSize,
},
const params = {
pageNum: state.pageNum,
pageSize: state.pageSize,
};
if (state.searchText) {
params.searchValue = state.searchText;
}
if (state.dateType != null && state.dateType !== 9) {
params.dateType = state.dateType;
}
if (state.dateSearch) {
params.dateSearch = state.dateSearch;
}
nosTaskListNoticeAPi(params,
(res) => {
if (res.code !== 200) {
state.finished = true;
@ -202,6 +217,18 @@ const onRefresh = () => {
fetchList();
};
const onSearchFilter = ({ searchText: st, dateType: dt, dateSearch: ds }) => {
state.searchText = st;
state.dateType = dt;
state.dateSearch = ds;
state.pageNum = 1;
state.list = [];
state.finished = false;
state.error = false;
state.loading = true;
fetchList();
};
const onClickLeft = () => {
router.back();
};

Loading…
Cancel
Save