|
@@ -3,7 +3,7 @@
|
|
<van-nav-bar title="项目管理" left-text="返回" @click-left="back" :right-text="projectAdd?'新增项目':''" @click-right="openDialog(-1)" fixed left-arrow/>
|
|
<van-nav-bar title="项目管理" left-text="返回" @click-left="back" :right-text="projectAdd?'新增项目':''" @click-right="openDialog(-1)" fixed left-arrow/>
|
|
|
|
|
|
<div class="login_form">
|
|
<div class="login_form">
|
|
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
|
|
|
|
|
+ <!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
|
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" :error.sync="error" error-text="请求失败,点击重新加载" @load="getProject">
|
|
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" :error.sync="error" error-text="请求失败,点击重新加载" @load="getProject">
|
|
<van-swipe-cell v-for="(item,index) in list" :key="index">
|
|
<van-swipe-cell v-for="(item,index) in list" :key="index">
|
|
<van-cell :border="false" :title="item.projectName" :value="item.projectCode"/>
|
|
<van-cell :border="false" :title="item.projectName" :value="item.projectCode"/>
|
|
@@ -13,6 +13,17 @@
|
|
</template>
|
|
</template>
|
|
</van-swipe-cell>
|
|
</van-swipe-cell>
|
|
</van-list>
|
|
</van-list>
|
|
|
|
+ </van-pull-refresh> -->
|
|
|
|
+ <van-pull-refresh v-model="isDownLoading" @refresh="onDownRefresh">
|
|
|
|
+ <van-list v-model="isUpLoading" :finished="upFinished" :immediate-check="false" :offset="10" finished-text="我是有底线的" @load="onLoadList">
|
|
|
|
+ <van-swipe-cell v-for="(item,index) in list" :key="index">
|
|
|
|
+ <van-cell :border="false" :title="item.projectName" :value="item.projectCode"/>
|
|
|
|
+ <template slot="right" v-if="projectManagement || item.creatorId == user.id">
|
|
|
|
+ <van-button square type="info" text="编辑" @click="openDialog(index)"/>
|
|
|
|
+ <van-button square type="danger" text="删除" @click="delPro(index)"/>
|
|
|
|
+ </template>
|
|
|
|
+ </van-swipe-cell>
|
|
|
|
+ </van-list>
|
|
</van-pull-refresh>
|
|
</van-pull-refresh>
|
|
|
|
|
|
<van-dialog v-model="show" :title="title" show-cancel-button :beforeClose="chargeBtn">
|
|
<van-dialog v-model="show" :title="title" show-cancel-button :beforeClose="chargeBtn">
|
|
@@ -79,6 +90,13 @@
|
|
ause: [],
|
|
ause: [],
|
|
projectAdd: false, // 新增项目
|
|
projectAdd: false, // 新增项目
|
|
projectManagement: false, // 管理项目
|
|
projectManagement: false, // 管理项目
|
|
|
|
+ isDownLoading: false, // 下拉刷新
|
|
|
|
+ isUpLoading: false, // 上拉加载
|
|
|
|
+ upFinished: false, // 上拉加载完毕
|
|
|
|
+ offset: 100, // 滚动条与底部距离小于 offset 时触发load事件
|
|
|
|
+ pageSize: 25, // 每页条数
|
|
|
|
+ pageIndex: 1, // 页码
|
|
|
|
+ dpp: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -201,35 +219,91 @@
|
|
|
|
|
|
// 获取项目
|
|
// 获取项目
|
|
getProject() {
|
|
getProject() {
|
|
- if (this.refreshing) {
|
|
|
|
- this.list = [];
|
|
|
|
- this.refreshing = false;
|
|
|
|
- }
|
|
|
|
- if(this.total == this.list.length && this.list.length != 0) {
|
|
|
|
- this.loading = false;
|
|
|
|
- this.finished = true;
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.refreshing) {
|
|
|
|
+ // this.list = [];
|
|
|
|
+ // this.refreshing = false;
|
|
|
|
+ // }
|
|
|
|
+ // if(this.total == this.list.length && this.list.length != 0) {
|
|
|
|
+ // this.loading = false;
|
|
|
|
+ // this.finished = true;
|
|
|
|
+ // return false;
|
|
|
|
+ // }
|
|
|
|
+ // this.$axios.post("/project/getProjectPage", {
|
|
|
|
+ // pageIndex: this.page,
|
|
|
|
+ // pageSize: this.size,
|
|
|
|
+ // })
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // if(res.code == "ok") {
|
|
|
|
+ // this.loading = false;
|
|
|
|
+ // if (this.list.length == 0) {
|
|
|
|
+ // this.finished = true;
|
|
|
|
+ // }
|
|
|
|
+ // this.list = [];
|
|
|
|
+ // for(var i in res.data.records) {
|
|
|
|
+ // this.list.push(res.data.records[i])
|
|
|
|
+ // }
|
|
|
|
+ // this.total = res.data.total;
|
|
|
|
+ // this.page++;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$toast.fail('获取失败:'+res.msg);
|
|
|
|
+ // }
|
|
|
|
+ // }).catch(err=> {toast.clear();});
|
|
|
|
+
|
|
this.$axios.post("/project/getProjectPage", {
|
|
this.$axios.post("/project/getProjectPage", {
|
|
- pageIndex: this.page,
|
|
|
|
- pageSize: this.size,
|
|
|
|
|
|
+ pageIndex: this.pageIndex,
|
|
|
|
+ pageSize: this.pageSize,
|
|
})
|
|
})
|
|
.then(res => {
|
|
.then(res => {
|
|
if(res.code == "ok") {
|
|
if(res.code == "ok") {
|
|
- this.loading = false;
|
|
|
|
- if (this.list.length == 0) {
|
|
|
|
- this.finished = true;
|
|
|
|
- }
|
|
|
|
- this.list = [];
|
|
|
|
- for(var i in res.data.records) {
|
|
|
|
- this.list.push(res.data.records[i])
|
|
|
|
|
|
+ this.isDownLoading = false
|
|
|
|
+ this.isUpLoading = false
|
|
|
|
+ this.total = res.data.total
|
|
|
|
+ var datas = res.data.records
|
|
|
|
+ if(res.data.records.length <= 0) {
|
|
|
|
+ this.total = 0,
|
|
|
|
+ this.list = []
|
|
|
|
+ this.$toast('已全部加载完成');
|
|
|
|
+ return
|
|
|
|
+ } else {
|
|
|
|
+ console.log(this.dpp)
|
|
|
|
+ if(this.dpp) this.list = []
|
|
|
|
+ if(this.list.length == 0) {
|
|
|
|
+ this.list = datas
|
|
|
|
+ } else {
|
|
|
|
+ for(var i in datas) {
|
|
|
|
+ this.list.push(datas[i])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- this.total = res.data.total;
|
|
|
|
- this.page++;
|
|
|
|
} else {
|
|
} else {
|
|
- this.$toast.fail('获取失败:'+res.msg);
|
|
|
|
|
|
+ this.$toast.fail('获取失败');
|
|
|
|
+ this.isDownLoading = false
|
|
|
|
+ this.isUpLoading = false
|
|
}
|
|
}
|
|
- }).catch(err=> {toast.clear();});
|
|
|
|
|
|
+ }).catch(err=> {
|
|
|
|
+ toast.clear();
|
|
|
|
+ this.isDownLoading = false
|
|
|
|
+ this.isUpLoading = false
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ onDownRefresh() {
|
|
|
|
+ console.log(123)
|
|
|
|
+ this.dpp = true
|
|
|
|
+ this.pageIndex = 1
|
|
|
|
+ this.upFinished = false // 不写这句会导致你上拉到底过后在下拉刷新将不能触发下拉加载事件
|
|
|
|
+ this.getProject()
|
|
|
|
+ },
|
|
|
|
+ onLoadList() {
|
|
|
|
+ console.log('出发没')
|
|
|
|
+ if(this.total <= this.list.length) {
|
|
|
|
+ this.$toast('已全部加载完成');
|
|
|
|
+ this.upFinished = false
|
|
|
|
+ this.isUpLoading = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.pageIndex = +this.pageIndex + 1
|
|
|
|
+ this.dpp = false
|
|
|
|
+ this.getProject()
|
|
},
|
|
},
|
|
|
|
|
|
onRefresh() {
|
|
onRefresh() {
|
|
@@ -389,6 +463,7 @@
|
|
mounted() {
|
|
mounted() {
|
|
this.getUsers();
|
|
this.getUsers();
|
|
this.yanjiuzx()
|
|
this.yanjiuzx()
|
|
|
|
+ this.getProject()
|
|
// this.canEdit = (this.user.role==1||this.user.role==2||this.user.role==5);
|
|
// this.canEdit = (this.user.role==1||this.user.role==2||this.user.role==5);
|
|
var list = this.user.functionList
|
|
var list = this.user.functionList
|
|
for(var i in list) {
|
|
for(var i in list) {
|