This commit is contained in:
那些花儿
2025-09-06 16:42:59 +08:00
parent c973ded5c5
commit 0256ec50a9
3 changed files with 30 additions and 37 deletions
@@ -7,7 +7,7 @@
v-model="tableLoading" v-model="tableLoading"
:finished="tableFinished" :finished="tableFinished"
finished-text="" finished-text=""
@load="pageData"> @load="onLoad">
<div class="table-list-container"> <div class="table-list-container">
<div v-for="(row, index) in tableData" :key="index" class="table-list-item"> <div v-for="(row, index) in tableData" :key="index" class="table-list-item">
<slot name="header" :index="index" :row="row"> <slot name="header" :index="index" :row="row">
@@ -59,11 +59,12 @@ module.exports = {
}, },
watch: { watch: {
page_form: { page_form: {
handler(val) { handler(newVal, oldVal) {
this.localPageForm = {...val} debugger
this.localPageForm = {...newVal}
}, },
deep: true, deep: true,
immediate: false immediate: true
} }
}, },
data() { data() {
@@ -76,9 +77,16 @@ module.exports = {
} }
}, },
methods: { methods: {
onLoad(){
if (this.tableFinished) return
this.localPageForm.pageNumber++
this.$emit('update:page_form', {...this.localPageForm});
this.pageData()
},
pageData() { pageData() {
this.tableLoading = true this.tableLoading = true
// this.localPageForm = {...this.page_form}
const loading = createListLoading() const loading = createListLoading()
this.$axios.post(this.api, this.json ? ({pageForm: JSON.stringify(this.localPageForm)}) : this.localPageForm).then((res) => { this.$axios.post(this.api, this.json ? ({pageForm: JSON.stringify(this.localPageForm)}) : this.localPageForm).then((res) => {
if (res.code === 0) { if (res.code === 0) {
@@ -87,20 +95,21 @@ module.exports = {
if (this.tableData.length >= this.localPageForm.totalCount) { if (this.tableData.length >= this.localPageForm.totalCount) {
this.tableFinished = true this.tableFinished = true
} }
this.localPageForm.pageNumber++
// 触发事件更新父组件的pageForm
this.$emit('update:page_form', {...this.localPageForm});
} }
}).finally(() => { }).finally(() => {
loading.close() loading.close()
console.log(this.tableLoading)
this.tableLoading = false this.tableLoading = false
console.log(this.tableLoading)
this.tableRefreshing = false this.tableRefreshing = false
}) })
}, },
doSearch() { doSearch() {
this.tableFinished = false; this.tableFinished = false
this.tableData = []; this.tableData = []
this.pageData(); this.localPageForm.pageNumber = 1
this.$emit('update:page_form', {...this.localPageForm});
this.pageData()
}, },
onRefresh() { onRefresh() {
this.localPageForm.pageNumber = 1 this.localPageForm.pageNumber = 1
@@ -18,7 +18,7 @@ layout("/layouts/platform_h5.html"){
</van-dropdown-menu> </van-dropdown-menu>
</van-sticky> </van-sticky>
<table-list api="/platform/proposal/mine/pageData" :page_form.sync="pageForm" @ready="onReady" ref="tableListRef"> <table-list api="/platform/proposal/mine/pageData" :page_form.sync="pageForm" @ready="onReady" ref="tableListRef" title="name">
<template v-slot="{index,row}"> <template v-slot="{index,row}">
<table-column label="提案类型">{{row.typeName}}</table-column> <table-column label="提案类型">{{row.typeName}}</table-column>
</template> </template>
@@ -78,7 +78,7 @@ layout("/layouts/platform_h5.html"){
.concat([{text: "全部届次", value: null}]) .concat([{text: "全部届次", value: null}])
if (this.sessionOptions.length > 0) { if (this.sessionOptions.length > 0) {
this.pageForm.sessionId = this.sessionOptions[0].value this.pageForm.sessionId = this.sessionOptions[0].value
this.pageData() this.doSearch()
} }
} }
}) })
@@ -96,27 +96,10 @@ layout("/layouts/platform_h5.html"){
pageData() { pageData() {
this.$refs.tableListRef.pageData() this.$refs.tableListRef.pageData()
// this.tableLoading = true
// const loading = createListLoading()
// this.$axios
// .post("/platform/proposal/mine/pageData", this.pageForm)
// .then((res) => {
// if (res.code === 0) {
// this.tableData = this.tableData.concat(res.data.list)
// this.pageForm.totalCount = res.data.totalCount
// if (this.tableData.length >= this.pageForm.totalCount) {
// this.tableFinished = true
// }
// this.pageForm.pageNumber++
// }
// })
// .finally(() => {
// loading.close()
// this.tableLoading = false
// this.tableRefreshing = false
// })
}, },
doSearch() { doSearch() {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch() this.$refs.tableListRef.doSearch()
}, },
openRevoke(row) { openRevoke(row) {
@@ -148,10 +131,9 @@ layout("/layouts/platform_h5.html"){
}) })
}, },
onReady() { onReady() {
debugger
this.listSession() this.listSession()
} }
},
created() {
} }
}) })
</script> </script>
@@ -137,9 +137,11 @@ layout("/layouts/platform_h5.html"){
}) })
}, },
doSearch() { doSearch() {
this.pageForm.pageNumber = 1 this.$nextTick(() => {
this.pageForm.totalCount = 0 this.pageForm.pageNumber = 1
this.$refs.tableListRef.doSearch() this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
}, },
onReady() { onReady() {
this.listRole() this.listRole()