Chinaunix首页 | 论坛 | 博客
  • 博客访问: 603782
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(298)

文章存档

2022年(96)

2021年(201)

2019年(1)

我的朋友

分类: Java

2022-03-24 16:17:41


点击(此处)折叠或打开


  1. 1.html

  2. <table class="table table-hover">
  3.     <thead>
  4.       <tr>
  5.         <th style="width: 50px;" id="cts">
  6.         <div class="checkbox d-inline">
  7.          <input type="checkbox" name="fhcheckbox" id="zcheckbox">
  8.          <label style="max-height: 12px;" for="zcheckbox" class="cr"></label>
  9.          </div>
  10.                 </th>
  11.         <th style="width: 50px;">NO</th>
  12.         <th>名称</th>
  13.         <th>权限标识</th>
  14.         <th>备注</th>
  15.         <th>操作</th>
  16.         </tr>
  17.        </thead>
  18.     <tbody>
  19.         <!-- 开始循环 -->    
  20.         <template v-for="(data,index) in varList">
  21.         <tr>
  22.             <td><div class="checkbox d-inline"><input type="checkbox" v-bind:id="'zcheckbox'+index" name='ids' v-bind:value="data.FHBUTTON_ID"<label style="max-height: 12px;" v-bind:for="'zcheckbox'+index" class="cr"></label></div>
  23.             </td>
  24.             <td scope="row">{{page.showCount*(page.currentPage-1)+index+1}}</td>
  25.             <td>{{data.NAME}}</td>
  26.             <td>{{data.SHIRO_KEY}}</td>
  27.             <td>{{data.BZ}}</td>
  28.             <td>
  29.                 <a v-show="edit" title="修改" v-on:click="goEdit(data.FHBUTTON_ID);" style="cursor:pointer;"><i class="feather icon-edit-2"></i></a>
  30.                 <a v-show="del" title="删除" v-on:click="goDel(data.FHBUTTON_ID);" style="cursor:pointer;"><i class="feather icon-x"></i></a>
  31.             </td>
  32.         </tr>
  33.         </template>
  34.         <tr v-show="varList.length==0">
  35.             <td colspan="10">没有相关数据</td>
  36.         </tr>
  37.     </tbody>
  38.    </table>
  39. 2.js代码

  40. var vm = new Vue({
  41.     el: '#app',
  42.     
  43.     data:{
  44.         varList: [],    //list
  45.         page: [],        //分页类
  46.         pd: []            //map
  47.     },
  48.     
  49.     methods: {
  50.         
  51.         //初始执行
  52.         init() {
  53.             //复选框控制全选,全不选
  54.             $('#zcheckbox').click(function(){
  55.               if($(this).is(':checked')){
  56.                   $("input[name='ids']").click();
  57.               }else{
  58.                   $("input[name='ids']").attr("checked", false);
  59.               }
  60.             });
  61.             this.getList();
  62.         },
  63.         
  64.         //获取列表
  65.         getList: function(){
  66.             this.loading = true;
  67.             $.ajax({
  68.                 xhrFields: {
  69.                     withCredentials: true
  70.                 },
  71.                 type: "POST",
  72.                 url: httpurl+'fhbutton/list?showCount='+this.showCount+'¤tPage='+this.currentPage,
  73.                 data: {KEYWORDS:this.pd.KEYWORDS,tm:new Date().getTime()},
  74.                 dataType:"json",
  75.                 success: function(data){
  76.                  if("success" == data.result){
  77.                      vm.varList = data.varList;
  78.                      vm.page = data.page;
  79.                      vm.pd = data.pd;
  80.                      vm.hasButton();
  81.                      vm.loading = false;
  82.                      $("input[name='ids']").attr("checked", false);
  83.                  }else if ("exception" == data.result){
  84.                      showException("按钮模块",data.exception);//显示异常
  85.                  }
  86.                 }
  87.             }).done().fail(function(){
  88.                 swal("登录失效!", "请求服务器无响应,稍后再试", "warning");
  89.                 setTimeout(function () {
  90.                     window.location.href = "../../login.html";
  91.                 }, 2000);
  92.             });
  93.         }
  94.  
  95.         
  96.     },
  97.     
  98.     mounted(){
  99.         this.init();
  100.     }
  101. })
  102. 3.后台代码

  103. package org.fh.controller.system;

  104. import java.util.HashMap;
  105. import java.util.List;
  106. import java.util.Map;

  107. import org.apache.shiro.authz.annotation.RequiresPermissions;
  108. import org.fh.controller.base.BaseController;
  109. import org.fh.entity.Page;
  110. import org.fh.entity.PageData;
  111. import org.fh.service.system.FHlogService;
  112. import org.fh.service.system.FhButtonService;
  113. import org.fh.util.Jurisdiction;
  114. import org.fh.util.Tools;
  115. import org.springframework.beans.factory.annotation.Autowired;
  116. import org.springframework.stereotype.Controller;
  117. import org.springframework.web.bind.annotation.RequestMapping;
  118. import org.springframework.web.bind.annotation.ResponseBody;

  119. /**
  120.  * 说明:按钮管理处理类
  121.  * 作者:FH Admin
  122.  * from:fhadmin.cn
  123.  */
  124. @Controller
  125. @RequestMapping("/fhbutton")
  126. public class FhbuttonController extends BaseController {
  127.     
  128.     @Autowired
  129.     private FhButtonService fhButtonService;
  130.     @Autowired
  131.     private FHlogService FHLOG;
  132.     
  133.     /**列表
  134.      * @param page
  135.      * @throws Exception
  136.      */
  137.     @RequestMapping(value="/list", produces="application/json;charset=UTF-8")
  138.     @RequiresPermissions("fhbutton:list")
  139.     @ResponseBody
  140.     public Object list(Page page) throws Exception{
  141.         Map<String,Object> map = new HashMap<String,Object>();
  142.         String errInfo = "success";
  143.         PageData pd = new PageData();
  144.         pd = this.getPageData();
  145.         String KEYWORDS = pd.getString("KEYWORDS");                //关键词检索条件
  146.         if(Tools.notEmpty(KEYWORDS)){
  147.             pd.put("KEYWORDS", KEYWORDS.trim());
  148.         }
  149.         page.setPd(pd);
  150.         List<PageData>    varList = fhButtonService.list(page);    //列出Fhbutton列表
  151.         map.put("varList", varList);
  152.         map.put("page", page);
  153.         map.put("pd", pd);
  154.         map.put("result", errInfo);
  155.         return map;
  156.     }

  157. }



阅读(419) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~