Bladeren bron

feat:增加搜索筛选功能

coder 2 jaren geleden
bovenliggende
commit
6644a94053
1 gewijzigde bestanden met toevoegingen van 61 en 1 verwijderingen
  1. 61 1
      src/pages/techerFlowManager/retireTeacherRemind/index.vue

+ 61 - 1
src/pages/techerFlowManager/retireTeacherRemind/index.vue

@@ -1,8 +1,20 @@
 <script setup>
+import { userInfo } from '~/store/user'
+
+const { uo_type } = userInfo
+const isBureau = ref(false)// 当前用户是否局端
+isBureau.value = uo_type === '1'
 const list = ref([])
 const loading = ref(false)
 const finished = ref(false)
 let page = 1
+const param = $ref({
+  jjtx_tx_year: '',
+  jjtx_tx_month: '',
+  jjtx_xb: '',
+  jjtx_uo_name: '',
+  keyword: '',
+})
 function onLoad() {
   loading.value = true
   request({
@@ -10,6 +22,7 @@ function onLoad() {
     data: {
       page,
       limit: 20,
+      ...param,
     },
   }).then((res) => {
     const data = res.data
@@ -19,10 +32,57 @@ function onLoad() {
     loading.value = false
   })
 }
+const searchValue = $ref('')
+function onClickSearch() {
+  reGetList()
+}
+const yearOption = $ref([{ text: '年份', value: '' }])
+for (let i = 1970; i <= 2050; i++)
+  yearOption.push({ text: `${i}年`, value: i })
+const monthOption = $ref([{ text: '月份', value: '' }])
+for (let i = 1; i <= 12; i++)
+  monthOption.push({ text: `${i}月`, value: i })
+const xbOption = $ref([{ text: '性别', value: '' }, { text: '男', value: '1' }, { text: '女', value: '2' }, { text: '保密', value: '3' }])
+const itemRef = ref(null)
+function onConfirm() {
+  itemRef.value.toggle()
+  reGetList()
+}
+function dropItemChange() {
+  reGetList()
+}
+function reGetList() {
+  page = 1
+  list.value = []
+  finished.value = false
+  onLoad()
+}
 </script>
 
 <template>
-  <div>
+  <div class="index">
+    <van-search v-model="param.keyword" :clearable="false" show-action placeholder="请输入搜索关键词" @search="onClickSearch">
+      <template #action>
+        <div @click="onClickSearch">
+          搜索
+        </div>
+      </template>
+    </van-search>
+    <van-dropdown-menu>
+      <van-dropdown-item v-model="param.jjtx_tx_year" :options="yearOption" @change="dropItemChange" />
+      <van-dropdown-item v-model="param.jjtx_tx_month" :options="monthOption" @change="dropItemChange" />
+      <van-dropdown-item v-model="param.jjtx_xb" :options="xbOption" @change="dropItemChange" />
+      <van-dropdown-item v-if="!isBureau" ref="itemRef" title="学校">
+        <van-cell-group inset>
+          <van-field v-model="param.jjtx_uo_name" placeholder="请输入学校名称" />
+        </van-cell-group>
+        <div style="padding: 5px 16px;">
+          <van-button type="primary" block round @click="onConfirm">
+            确认
+          </van-button>
+        </div>
+      </van-dropdown-item>
+    </van-dropdown-menu>
     <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
       <van-cell v-for="item in list" :key="item">
         <template #title>