增删改查分页问题

一、分页:
在这里插入图片描述
total是总页数,page-size是每页多少条数,current-page.sync是总共几页。
2、在这里插入图片描述
import {fetchSignKey} from ‘@/api/sign’
pages:{page:1,limit:10},
tableData:[ ],
created(){
this.handleCurrentChange(1)
}
methods{
handleCurrentChange(val) {
this.page.page=val,
fetchSignKey(this.pages).then(=>{
this.tableData=res.data.result.records;
this.totals=res.data.result.total;
})
}
}
二、添加:
在这里插入图片描述
在这里插入图片描述
adds:{id:8,resourceid:’ ‘,signDeptKey:’ '},
dialogZbzFormVisible:false,
methods{
handleDialogByInsert(){
清空内容:this.adds=[ ];
关闭弹出窗口:dialogZbzFormVisible:true;
},
点击确定:handleDialogAdd(){
fetchAddKey(this.adds).then(=>{
const result = res.data.result;
if (result == 1) {
在这里插入图片描述
})
.catch(() => {
this.$notify({
title: “提示”,
message: “添加失败”,
duration: 2500
});
});
this.dialogZbzFormVisible = false;
添加完后刷新页面:this.handleCurrentChange(1);
})
}
},
删除:
在这里插入图片描述

delets{id:0}
methods{
handleDialogByDelete(scope) {
let self = this;
this.deletes.id = scope.id;
this.$confirm(“此操作将永久删除该列, 是否继续?”, “提示”, {
confirmButtonText: “确定”,
cancelButtonText: “取消”,
type: “warning”
})
.then(() => {
fetchDelKey(this.deletes).then(res => {
const result = res.data.result;
if (result == 1) {

     同上:刷新页面:self.handleCurrentChange(1);
     
      .catch(() => {
      this.$message({
        type: "info",
        message: "已取消删除"
      });
    });
},

},
编辑/修改:
clcikEdit(scope) {
先查一遍在修改:
fetchViewInfo({‘zbGuid’:scope.zbGuid}).then(res=>{
this.adds = res.data.result;
});
this.dialogZbzFormVisible = true;
},
点确定按钮调用:
editInfo(this.adds).then(res=>{
const result = res.data.success;
if (result) {
this.$notify({
title: “提示”,
message: “编辑成功”,
type: “success”,
duration: 2500
});
this.handleCurrentChange(1);
this.dialogZbzFormVisible=false;
查:
在这里插入图片描述
v-model绑定page.search查
methods{
handleCondClick(){
this.handleCurrentChange(1);
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值