|
@@ -94,7 +94,7 @@
|
|
|
v-model:loading="loading"
|
|
|
:finished="finished"
|
|
|
finished-text="没有更多了"
|
|
|
- @load="onLoad"
|
|
|
+ @load="search"
|
|
|
>
|
|
|
<van-swipe-cell v-for="item in searchList" :key="item">
|
|
|
<div class="list-item" @click="gotoplaceRegister(item.id)">
|
|
@@ -129,7 +129,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {onMounted, ref } from "vue";
|
|
|
+import { onMounted, ref } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import tools from "@/api/sys/tools";
|
|
|
import placePerson from "@/api/placePerson/placePerson";
|
|
@@ -162,23 +162,47 @@ export default {
|
|
|
const show = ref(false);
|
|
|
const searchList = ref([]);
|
|
|
const search = () => {
|
|
|
- if (searchName.value != "") {
|
|
|
+ loading.value = true;
|
|
|
+ finished.value = false;
|
|
|
+ if (value2.value == 0) {
|
|
|
show.value = true;
|
|
|
new PlaceRegister()
|
|
|
.searchlist({
|
|
|
- current: 1,
|
|
|
- size: 10000,
|
|
|
+ current: index + 1,
|
|
|
+ size: 11,
|
|
|
name: value.value,
|
|
|
+ address: value1.value,
|
|
|
})
|
|
|
- .then(({ records }) => {
|
|
|
- searchList.value = records;
|
|
|
+ .then(({ records, pages }) => {
|
|
|
+ searchList.value = searchList.value.concat(records);
|
|
|
+ // 加载状态结束
|
|
|
+ loading.value = false;
|
|
|
+ if (index + 1 >= pages) {
|
|
|
+ finished.value = true;
|
|
|
+ }
|
|
|
+ index++;
|
|
|
});
|
|
|
} else {
|
|
|
- show.value = false;
|
|
|
- onLoad();
|
|
|
+ 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++;
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
- const value = ref('');
|
|
|
+ const value = ref("");
|
|
|
const value1 = ref("");
|
|
|
const value2 = ref(0);
|
|
|
const option1 = ref([]);
|
|
@@ -189,12 +213,12 @@ export default {
|
|
|
{ text: "天主教", value: 3 },
|
|
|
{ text: "佛教", value: 4 },
|
|
|
{ text: "道教", value: 5 },
|
|
|
- ]
|
|
|
+ ];
|
|
|
onMounted(() => {
|
|
|
getUser();
|
|
|
});
|
|
|
const getUser = () => {
|
|
|
- let addressList = []
|
|
|
+ let addressList = [];
|
|
|
let user = localStorage.getItem("MZ_USER");
|
|
|
new tools().treeData().then((res) => {
|
|
|
addressList.push(res[0]);
|
|
@@ -202,25 +226,26 @@ export default {
|
|
|
addressList.push(item);
|
|
|
});
|
|
|
});
|
|
|
- let userArea = '';
|
|
|
+ let userArea = "";
|
|
|
new placePerson().userList({ loginName: user }).then((res1) => {
|
|
|
let data = res1.records[0];
|
|
|
userArea = data.areaDTO;
|
|
|
- addressList.forEach(item=>{
|
|
|
- if(item.id==userArea.code){
|
|
|
- value1.value = item.code
|
|
|
+ addressList.forEach((item) => {
|
|
|
+ if (item.id == userArea.code) {
|
|
|
+ value1.value = item.code;
|
|
|
+ localStorage.setItem("address", item.code);
|
|
|
option1.value.push({
|
|
|
- text:item.name,
|
|
|
- value:item.code
|
|
|
+ text: item.name,
|
|
|
+ value: item.code,
|
|
|
});
|
|
|
- item.children.forEach(item1 => {
|
|
|
+ item.children.forEach((item1) => {
|
|
|
option1.value.push({
|
|
|
- text:item1.name,
|
|
|
- value:item1.code
|
|
|
- })
|
|
|
- })
|
|
|
+ text: item1.name,
|
|
|
+ value: item1.code,
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
//跳转
|
|
@@ -244,12 +269,13 @@ export default {
|
|
|
const onLoad = () => {
|
|
|
loading.value = true;
|
|
|
finished.value = false;
|
|
|
+ let address = localStorage.getItem("address");
|
|
|
// 异步更新数据
|
|
|
new PlaceRegister()
|
|
|
- .religiousList({
|
|
|
+ .searchlist({
|
|
|
current: index + 1,
|
|
|
size: 11,
|
|
|
- ...searchForm.value,
|
|
|
+ address: address,
|
|
|
})
|
|
|
.then(({ records, pages }) => {
|
|
|
list.value = list.value.concat(records);
|