Prechádzať zdrojové kódy

场所管理搜索功能优化

guoqing 1 rok pred
rodič
commit
ab10fc59a4

+ 80 - 99
src/views/placeManage/placeRegister/placeRegisterList.vue

@@ -16,7 +16,10 @@
     <div class="search">
       <div class="box1">
         <van-dropdown-menu>
-          <van-dropdown-item v-model="value1" :options="option1" />
+          <van-dropdown-item
+            v-model="value1"
+            :options="option1"
+          />
           <van-dropdown-item v-model="value2" :options="option2" />
         </van-dropdown-menu>
       </div>
@@ -34,7 +37,6 @@
       </div>
     </div>
     <van-pull-refresh
-      v-if="show == false"
       v-model="refreshing"
       @refresh="onRefresh"
     >
@@ -73,46 +75,6 @@
         </van-swipe-cell>
       </van-list>
     </van-pull-refresh>
-    <van-pull-refresh
-      v-if="show == true"
-      v-model="refreshing"
-      @refresh="onRefresh"
-    >
-      <van-list
-        v-model:loading="loading"
-        :finished="finished"
-        finished-text="没有更多了"
-        @load="search"
-      >
-        <van-swipe-cell v-for="item in searchList" :key="item">
-          <div class="list-item" @click="gotoplaceRegister(item.id)">
-            <div class="item_top">
-              <div class="item_top_left">
-                {{ item.name }}
-              </div>
-              <div class="item_top_right">
-                <span v-if="item.religiousType == 1">伊斯兰教</span>
-                <span v-if="item.religiousType == 2">基督教</span>
-                <span v-if="item.religiousType == 3">天主教</span>
-                <span v-if="item.religiousType == 4">佛教</span>
-                <span v-if="item.religiousType == 5">道教</span>
-              </div>
-            </div>
-            <div class="item_center">
-              {{ item.place }}
-            </div>
-            <div class="item_down">
-              <div class="item_down_left">
-                {{ item.contact }}
-              </div>
-              <div class="item_down_right">
-                {{ item.contactNumber }}
-              </div>
-            </div>
-          </div>
-        </van-swipe-cell>
-      </van-list>
-    </van-pull-refresh>
   </div>
 </template>
 
@@ -120,9 +82,54 @@
 import { onMounted, ref, toRefs } from "vue";
 import { useRouter } from "vue-router";
 import PlaceRegister from "@/api/placeRegister/placeRegister";
-import placeRegister from '@/api/placeRegister/placeRegister';
+import placeRegister from "@/api/placeRegister/placeRegister";
 export default {
   setup() {
+    const inputForm = ref({
+      id: "",
+      religiousType: "",
+      religiousName: "",
+      name: "",
+      tyshxydm: "",
+      filingNo: "",
+      contact: "",
+      contactNumber: "",
+      placeSelectName: "",
+      placeSelectId: "",
+      placeSelectType3: "",
+      placeSelectType4: "",
+      placeSelectType5: "",
+      placeSelectType6: "",
+      placeSelectLastId: "",
+      place: "",
+      longitude: "",
+      latitude: "",
+      siteType: "",
+      constructionStage: "",
+      nature: "",
+      religiousDeptManaUser: "",
+      securityDeptManaUser: "",
+      scenesImage: "",
+      plan: "",
+      etiquetteSpace: "",
+      mainRoads: "",
+      publicArea: "",
+      website: "",
+      approvalProcedures: "",
+      peopleThreshold: "",
+      state: "1",
+      isEnable: "1",
+      remake: "",
+      approvedEstablishmentTime: "",
+      registrationAuthority: "",
+      registrationDate: "",
+      teachingStaff: "",
+      approveOffice: "",
+      coveredArea: "",
+      floorSpace: "",
+      protectionLevel: "",
+      dynamicFormJson: "",
+    });
     //暂时列表数据
     const list = ref([]);
     // 导航栏颜色
@@ -132,52 +139,29 @@ export default {
       history.back();
     };
     //搜索事件
-    const show = ref(false);
-    const searchList = ref([]);
     const search1 = () => {
-      searchList.value = [];
-      search();
-    }
-    const search = () => {
-      loading.value = true;
-      finished.value = false;
-      if (value2.value == 0) {
-        show.value = true;
-        new PlaceRegister()
-          .searchlist({
-            current: index + 1,
-            size: 11,
-            name: value.value,
-            address: value1.value,
-          })
-          .then(({ records, pages }) => {
-            searchList.value = searchList.value.concat(records);
-            // 加载状态结束
-            loading.value = false;
-            if (index + 1 >= pages) {
-              finished.value = true;
-            }
-            index++;
-          });
+      if (value.value == "") {
+        list.value = [];
+        if(value2.value==0){
+          inputForm.value.religiousType = '';
+        }else{
+          inputForm.value.religiousType = value2.value;
+        }
+        inputForm.value.name = '';
+        loading.value = true;
+        finished.value = false;
+        onLoad();
       } else {
-        show.value = true;
-        new PlaceRegister()
-          .searchlist({
-            current: index + 1,
-            size: 11,
-            name: value.value,
-            address: value1.value,
-            religiousType: value2.value,
-          })
-          .then(({ records, pages }) => {
-            searchList.value = searchList.value.concat(records);
-            // 加载状态结束
-            loading.value = false;
-            if (index + 1 >= pages) {
-              finished.value = true;
-            }
-            index++;
-          });
+        list.value = [];
+        if(value2.value==0){
+          inputForm.value.religiousType = '';
+        }else{
+          inputForm.value.religiousType = value2.value;
+        }
+        inputForm.value.name = value.value;
+        loading.value = true;
+        finished.value = false;
+        onLoad();
       }
     };
     const value = ref("");
@@ -196,15 +180,15 @@ export default {
       getUser();
     });
     const getUser = () => {
-      new placeRegister().address().then((res)=>{
-        res.forEach(item => {
+      new placeRegister().address().then((res) => {
+        res.forEach((item) => {
           option1.value.push({
-            text:item.name,
-            value:item.id
-          })
+            text: item.name,
+            value: item.id,
+          });
         });
-      value1.value = option1.value[0].value
-      })
+        value1.value = option1.value[0].value;
+      });
     };
     //跳转
     let router = useRouter();
@@ -227,13 +211,13 @@ export default {
     const onLoad = () => {
       loading.value = true;
       finished.value = false;
-      let address = localStorage.getItem("address");
       // 异步更新数据
       new PlaceRegister()
         .searchlist({
           current: index + 1,
           size: 11,
-          address: address,
+          address: value1.value,
+          ...inputForm.value,
         })
         .then(({ records, pages }) => {
           list.value = list.value.concat(records);
@@ -269,10 +253,7 @@ export default {
       onLoad,
       onRefresh,
       //搜索
-      search,
       gotoplaceRegister,
-      show,
-      searchList,
       value,
       value1,
       value2,