全网整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:400-708-3566

Vue form 表单提交+ajax异步请求+分页效果

废话不多说了,直接给大家贴代码了,具体代码如下所示:

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width,initial-scale=1">
 <meta charset="UTF-8"/>
 <title>异步参数上传</title>
 <link rel="stylesheet" type="text/css" href="${ctx }/css/bootstrap.min.css" rel="external nofollow" >
 <#--<link href="css/fileinput.css" rel="external nofollow" media="all" rel="stylesheet" type="text/css"/>-->
 <link href="${ctx }/css/fileinput.css" rel="external nofollow" media="all" rel="stylesheet" type="text/css"/>
 <link rel="stylesheet" type="text/css" href="${ctx }/css/css.css" rel="external nofollow" />
 <#--<link rel="stylesheet" type="text/css" href="${ctx }/css/style.css" rel="external nofollow" />-->
 <link rel="stylesheet" type="text/css" href="${ctx }/css/subwelcome.css" rel="external nofollow" />
 <script>var $context = {};
 $context.ctx = '${ctx}';
 $context.resources = '${ctx}/resources';
 </script>
</head>
<body>
<div id="app" class="htmleaf-container">
 <div class="container kv-main">
  <br>
  <div style="margin-left: 200px;" class="robot-b-name">
   <a class=".btn btn-primary" href="">返回上传页面</a>
  </div>
  <br>
  <form @submit.prevent="submit" class="well form-inline">
   <input type="text" class="input-big" style="width: 500px" v-model.trim="batchInforRequestVO.appkey"
     placeholder="请输入appkey">
   <input type="text" class="input-group" style="width: 500px" v-model.trim="batchInforRequestVO.batchnum"
     placeholder="请输入批次号">
   <input type="hidden" class="input-group" style="width: 500px"
     v-model.trim="batchInforRequestVO.currentPage">
   <button type="submit" class="btn btn-info">查询</button>
  </form>
  <br>
  <!--提示框公共部分begining-->
  <div class="modal-mask" v-show="show">
   <div class="modal-confirm">
    <h4 class="confirm-header">
     <i class="iconfont icon-questioncircle"></i> {{ title }}
    </h4>
    <div class="confirm-content">
     {{ content }}
    </div>
    <div class="confirm-btns">
    <#--<button class="btn" v-on:click="opt(1)">取 消</button>-->
     <button class="btn btn-primary" v-on:click="opt(2)">确 定</button>
    </div>
   </div>
  </div>
  <br>
  <!--提示框公共部分ending-->
  <div class="modal-mask" v-show="showcontent">
   <div class="modal-confirm">
    <h4 class="confirm-header">
     <i class="iconfont icon-questioncircle"></i> {{ title }}
    </h4>
    <div class="confirm-content">
     {{ content }}
    </div>
    <div class="confirm-btns">
    <#--<button class="btn" v-on:click="opt(1)">取 消</button>-->
     <button class="btn btn-primary" v-on:click="opt(3)">确 定</button>
    </div>
   </div>
  </div>
  <div>查询结果</div>
  <!-- TableBegining -->
  <div>
   <table class="table table-striped table-bordered table-condensed">
    <tr>
     <th>批次号</th>
     <th>处理进度</th>
     <th>文件名称</th>
     <th>上传时间</th>
     <th>请求方法</th>
     <th>操作</th>
    </tr>
    <tr v-for="(batchInforResponseVO, index) in BatchInforResponseVO ">
     <td>{{batchInforResponseVO.batchNum}}</td>
     <td>{{batchInforResponseVO.processPercentage}}</td>
     <td>{{batchInforResponseVO.channelName}}</td>
     <td>{{batchInforResponseVO.inserTime}}</td>
     <td>{{batchInforResponseVO.requestAddre}}</td>
     <td><a id="opreat" v-on:click="defaultExport(index)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >导出 </a><a
       v-on:click="redirectTo(index)" id="opreat" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >自定义导出 </a></td>
    </tr>
   </table>
  </div>
  <!-- TableEnding -->
  <!-- 分页部分Begining -->
  <div class="span6" style="width:25%;margin-right: 10px;float: right;">
   <div style="width: 500px;" id="DataTables_Table_0_length">
    <span> 每页10条记录 当前页{{batchInforRequestVO.currentPage}}</span> &nbsp
    <span>共{{totalPage}}页&nbsp<a id="previousPage" v-on:click="changePage(1)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >←上一页</a>&nbsp &nbsp<a
      id="nextPage" v-on:click="changePage(2)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >下一页 →</a></span>
   </div>
  </div>
  <!-- 分页部分Ending -->
 </div>
</div>
</div>
</body>
<script type="text/javascript">
 window.history.go(1);
</script>
<script src="${ctx }/js/jquery/jquery-2.0.3.min.js"></script>
<script src="${ctx }/js/jquery.form.js"></script>
<script src="${ctx }/js/vue/vue.js"></script>
<script src="${ctx }/js/business/exportconfig.js" type="text/javascript"></script>
</html>
var vue = new Vue({
 el: '#app',
 data: {
  batchInforRequestVO: {
   currentPage: 1,
   appkey: '',
   batchnum: ''
  },
  show: false,
  showcontent: false,
  onCancel: false,
  onOk: false,
  totalPage: 0,
  title: '提示框',
  content: '加载......',
  message: '批量数据处理',
  BatchInforResponseVO: []
 },
 methods: {
  refreshTest: function () {
   location.reload(true)
  },
  //输入框增加方法
  add: function () {
   this.user.names.push({
    text: ""
   })
  },
  //输入框删除方法
  decrease: function (index) {
   if (!index == 0) {
    this.user.names.splice(index, 1)
   }
  },
  changePage: function (type) {
   if (type == '1') {
    debugger
    if (this.batchInforRequestVO.currentPage == '1') {
     vue.showcontent = true;
     vue.content = '已经是首页啦!';
     return
    }
    this.batchInforRequestVO.currentPage--;
    this.submit();
   }
   else if (type == '2') {
    this.batchInforRequestVO.currentPage++;
    debugger
    if (this.batchInforRequestVO.currentPage > this.totalPage) {
     this.batchInforRequestVO.currentPage--;
     vue.showcontent = true;
     vue.content = '已经是尾页啦!';
     return
    }
    this.submit();
   }
  },
  checkparam: function () {
   if (this.batchInforRequestVO.appkey == '' && this.batchInforRequestVO.batchnum == '') {
    vue.showcontent = true;
    vue.content = '查询参数不可以为空!';
    return false
   }
   else {
    return true
   }
  },
  opt(type){
   this.show = false
   if (type == '1') {
    if (this.onCancel) this.onCancel()
   }
   else if (type == '3') {
    this.showcontent = false
    if (this.onOk) this.onOk()
   }
   else {
    if (this.onOk) this.onOk()
    vue.refreshTest();
   }
   this.onCancel = false
   this.onOk = false
   document.body.style.overflow = ''
  },
  submit: function () {
   debugger
   var data = JSON.stringify(this.batchInforRequestVO); // 这里才是你的表单数据
   if (!vue.checkparam()) {
    return
   }
   ;
   //da.append("name", this.name)可以逐次添加多个参数
   $.ajax({
    url: '../interface/queryBatchInfor',
    data: data,
    type: 'POST',
    contentType: 'application/json',
    dataType: 'JSON',
    // cache: false,
    processData: false,// 告诉jQuery不要去处理发送的数据
    // contentType: false,// 告诉jQuery不要去设置Content-Type请求头
    success: function (data) {
     debugger
     if (data.respCode == 'success') {
      vue.BatchInforResponseVO = data.batchInforResponseVOList;
      vue.totalPage = data.totalPage;
     } else {
      vue.show = true;
      vue.content = data.respMsg;
     }
     console.log(data)
    },
    error: function (data) {
     vue.show = true;
     vue.content = '系统内部错误';
    }
   })
  },
  defaultExport: function ($index) {
   debugger
   var index = $index;
   window.location.href = $context.ctx + "../interface/defaultexcport?batchNum=" + this.BatchInforResponseVO[index].batchNum;
  },
  redirectTo: function ($index) {
   vue.showcontent = true;
   vue.content = '进行中......';
   debugger
   var index = $index;
   // window.location.href = $context.ctx + "../interface/to_autoconfig?batchNum="+ this.BatchInforResponseVO[index].batchNum;
  }
 }
})

以上所述是小编给大家介绍的Vue form 表单提交+ajax异步请求+分页效果,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!


# vue  # form  # 表单提交  # ajax异步请求  # ajax  # 分页  # Vue.js实现多条件筛选、搜索、排序及分页的表格功能  # 利用vue + element实现表格分页和前端搜索的方法  # Vue+element-ui 实现表格的分页功能示例  # Vue.js实现分页查询功能  # Vue2.5 结合 Element UI 之 Table 和 Pagination 组件实现分页功能  # vuejs2.0实现一个简单的分页示例  # Vue.js实现无限加载与分页功能开发  # 用Vue写一个分页器的示例代码  # 基于Vue.js的表格分页组件  # vue iview实现分页功能  # 要去  # 给大家  # 请输入  # 上传  # 表单  # 小编  # 输入框  # 逐次  # 多个  # 才是  # 下一页  # 在此  # 上一页  # 说了  # 不可以  # 不多  # 每页  # 尾页  # 数据处理 


相关文章: 网站制作与设计教程,如何制作一个企业网站,建设网站的基本步骤有哪些?  焦点电影公司作品,电影焦点结局是什么?  如何通过PHP快速构建高效问答网站功能?  武汉网站制作费用多少,在武汉武昌,建面100平方左右的房子,想装暖气片,费用大概是多少啊?  c++怎么编写动态链接库dll_c++ __declspec(dllexport)导出与调用【方法】  深圳网站制作费用多少钱,读秀,深圳文献港这样的网站很多只提供网上试读,但有些人只要提供试读的文章就能全篇下载,这个是怎么弄的?  如何选择最佳自助建站系统?快速指南解析优劣  无锡营销型网站制作公司,无锡网选车牌流程?  建站为何优先选择香港服务器?  深圳网站制作培训,深圳哪些招聘网站比较好?  如何通过虚拟主机快速搭建个人网站?  如何通过山东自助建站平台快速注册域名?  网站制作怎么样才能赚钱,用自己的电脑做服务器架设网站有什么利弊,能赚钱吗?  如何通过免费商城建站系统源码自定义网站主题与功能?  如何登录建站主机?访问步骤全解析  建站之星体验版:智能建站系统+响应式设计,多端适配快速建站  如何制作一个表白网站视频,关于勇敢表白的小标题?  如何解决VPS建站LNMP环境配置常见问题?  上海网站制作网页,上海本地的生活网站有哪些?最好包括生活的各个方面的?  如何快速生成高效建站系统源代码?  网站制作免费,什么网站能看正片电影?  建站之星CMS五站合一模板配置与SEO优化指南  网站制作话术技巧,网站推广做的好怎么话术?  已有域名能否直接搭建网站?  如何在七牛云存储上搭建网站并设置自定义域名?  南京网站制作费用,南京远驱官方网站?  建站之星Pro快速搭建教程:模板选择与功能配置指南  已有域名建站全流程解析:网站搭建步骤与建站工具选择  如何通过商城自助建站源码实现零基础高效建站?  如何通过虚拟主机空间快速建站?  香港服务器网站测试全流程:性能评估、SEO加载与移动适配优化  C#怎么创建控制台应用 C# Console App项目创建方法  建站之星五站合一营销型网站搭建攻略,流量入口全覆盖优化指南  Swift中swift中的switch 语句  怎么制作一个起泡网,水泡粪全漏粪育肥舍冬季氨气超过25ppm,可以有哪些措施降低舍内氨气水平?  西安大型网站制作公司,西安招聘网站最好的是哪个?  做企业网站制作流程,企业网站制作基本流程有哪些?  桂林网站制作公司有哪些,桂林马拉松怎么报名?  如何自定义建站之星网站的导航菜单样式?  外汇网站制作流程,如何在工商银行网站上做外汇买卖?  建站主机空间推荐 高性价比配置与快速部署方案解析  建站之星伪静态规则如何设置?  网站制作和推广的区别,想自己建立一个网站做推广,有什么快捷方法马上做好一个网站?  如何确认建站备案号应放置的具体位置?  装修招标网站设计制作流程,装修招标流程?  免费的流程图制作网站有哪些,2025年教师初级职称申报网上流程?  网站制作员失业,怎样查看自己网站的注册者?  专业的网站制作设计是什么,如何制作一个企业网站,建设网站的基本步骤有哪些?  英语简历制作免费网站推荐,如何将简历翻译成英文?  如何快速登录WAP自助建站平台? 

您的项目需求

*请认真填写需求信息,我们会在24小时内与您取得联系。