Commit 8a550e02c6c2c8ecdc8ce3e2ea8ab15ab2c084a8

Authored by mahuandong
1 parent 0d5e0a09

修改add和remove操作

src/main/java/com/huaheng/framework/token/TokenService.java
... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
5 5 import com.fasterxml.jackson.annotation.JsonFormat;
6 6 import com.google.gson.JsonObject;
7 7 import com.huaheng.common.exception.service.ServiceException;
  8 +import com.huaheng.common.support.Convert;
8 9 import com.huaheng.framework.redis.RedisCache;
9 10 import com.huaheng.pc.system.user.domain.User;
10 11 import io.jsonwebtoken.Claims;
... ... @@ -48,18 +49,11 @@ public class TokenService {
48 49 * @return
49 50 */
50 51 public String createToken(User user){
51   - //签发时间
52   - Date iatTime = new Date();
53   - //expire time
54   - Calendar nowTime = Calendar.getInstance();
55   - nowTime.add(Calendar.DATE, EXPIRE_TIME);
56   - Date expireTime = nowTime.getTime();
57   -
58 52 Claims claims = Jwts.claims();
59   - claims.put("user", user);
60   - claims.setIssuedAt(iatTime);
  53 + claims.put("username", user.getLoginName());
61 54 String token = Jwts.builder().setClaims(claims)
62 55 .signWith(SignatureAlgorithm.HS512,signingKey).compact();
  56 +
63 57 if (redisCache.setCacheObject(token, user.toString(), EXPIRE_TIME, TimeUnit.DAYS) == null) {
64 58 throw new ServiceException("redis异常");
65 59 }
... ...
src/main/java/com/huaheng/framework/token/WebAppConfigurer.java
... ... @@ -6,7 +6,9 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
6 6 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
7 7  
8 8 /**
9   - * Created by Enzo Cotter on 2020/6/11.
  9 + * api拦截器
  10 + * @author Enzo Cotter
  11 + * @date 2020/6/11
10 12 */
11 13 @Configuration
12 14 public class WebAppConfigurer implements WebMvcConfigurer {
... ...
src/main/resources/static/huaheng/js/huahengUI.js
... ... @@ -571,37 +571,77 @@ var table = {
571 571 },
572 572 // 表格树封装处理
573 573 treeTable: {
574   - _option: {},
575   - _treeTable: {},
576 574 // 初始化表格
577 575 init: function(options) {
578   - $.table._option = options;
579   - var treeTable = $('#bootstrap-table').bootstrapTreeTable({
580   - code : options.id, // 用于设置父子关系
581   - parentCode : options.parentId, // 用于设置父子关系
582   - type: 'get', // 请求方式(*)
583   - url: options.url, // 请求后台的URL(*)
584   - ajaxParams : {}, // 请求数据的ajax的data属性
585   - expandColumn : '0', // 在哪一列上面显示展开按钮
586   - striped : false, // 是否各行渐变色
587   - bordered : true, // 是否显示边框
588   - expandAll : $.common.visible(options.expandAll), // 是否全部展开
589   - columns: options.columns
590   - });
591   - $.treeTable._treeTable = treeTable;
  576 + var defaults = {
  577 + id: "bootstrap-tree-table",
  578 + type: 1, // 0 代表bootstrapTable 1代表bootstrapTreeTable
  579 + height: 0,
  580 + rootIdValue: null,
  581 + ajaxParams: {},
  582 + toolbar: "toolbar",
  583 + striped: false,
  584 + expandColumn: 1,
  585 + showSearch: true,
  586 + showRefresh: true,
  587 + showColumns: true,
  588 + expandAll: true,
  589 + expandFirst: true
  590 + };
  591 + var options = $.extend(defaults, options);
  592 + table.options = options;
  593 + table.config[options.id] = options;
  594 + $.table.initEvent();
  595 + $.bttTable = $('#' + options.id).bootstrapTreeTable({
  596 + code: options.code, // 用于设置父子关系
  597 + parentCode: options.parentCode, // 用于设置父子关系
  598 + type: 'get', // 请求方式(*)
  599 + url: options.url, // 请求后台的URL(*)
  600 + data: options.data, // 无url时用于渲染的数据
  601 + ajaxParams: options.ajaxParams, // 请求数据的ajax的data属性
  602 + rootIdValue: options.rootIdValue, // 设置指定根节点id值
  603 + height: options.height, // 表格树的高度
  604 + expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮
  605 + striped: options.striped, // 是否显示行间隔色
  606 + bordered: false, // 是否显示边框
  607 + toolbar: '#' + options.toolbar, // 指定工作栏
  608 + showSearch: options.showSearch, // 是否显示检索信息
  609 + showRefresh: options.showRefresh, // 是否显示刷新按钮
  610 + showColumns: options.showColumns, // 是否显示隐藏某列下拉框
  611 + expandAll: options.expandAll, // 是否全部展开
  612 + expandFirst: options.expandFirst, // 是否默认第一级展开--expandAll为false时生效
  613 + columns: options.columns, // 显示列信息(*)
  614 + responseHandler: $.treeTable.responseHandler, // 在加载服务器发送来的数据之前处理函数
  615 + onLoadSuccess: $.table.onLoadSuccess // 当所有数据被加载时触发处理函数
  616 + });
592 617 },
593 618 // 条件查询
594 619 search: function(formId) {
595   - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
596   - var params = {};
597   - $.each($("#" + currentId).serializeArray(), function(i, field) {
598   - params[field.name] = field.value;
599   - });
600   - $.treeTable._treeTable.bootstrapTreeTable('refresh', params);
  620 + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
  621 + var params = $.common.formToJSON(currentId);
  622 + $.bttTable.bootstrapTreeTable('refresh', params);
601 623 },
602   - // 刷新
603 624 refresh: function() {
604   - $.treeTable._treeTable.bootstrapTreeTable('refresh');
  625 + $.bttTable.bootstrapTreeTable('refresh');
  626 + },
  627 + // 查询表格树指定列值
  628 + selectColumns: function(column) {
  629 + var rows = $.map($.bttTable.bootstrapTreeTable('getSelections'), function (row) {
  630 + return $.common.getItemField(row, column);
  631 + });
  632 + return $.common.uniqueFn(rows);
  633 + },
  634 + // 请求获取数据后处理回调函数,校验异常状态提醒
  635 + responseHandler: function(res) {
  636 + if (typeof table.options.responseHandler == "function") {
  637 + table.options.responseHandler(res);
  638 + }
  639 + if (res.code != undefined && res.code != 0) {
  640 + $.modal.alertWarning(res.msg);
  641 + return [];
  642 + } else {
  643 + return res;
  644 + }
605 645 },
606 646 },
607 647 // 表单封装处理
... ...
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... ... @@ -226,6 +226,9 @@
226 226 sidePagination:"server",
227 227 search: false,
228 228 pageSize: 50,
  229 + onDblClickRow: function (row, value, index) {
  230 + detail(row.id, row.code);
  231 + },
229 232 columns: [{
230 233 checkbox: true
231 234 },
... ... @@ -730,8 +733,9 @@
730 733 $.modal.open("未选择入库单" , "404.html");
731 734 }
732 735 else {
  736 + table.set("bootstrap-table1");
733 737 var url = detailPrefix + "/add/" + receiptId + "/" + receiptCode;
734   - $.modal.open("添加" + $.table._option.modalName, url);
  738 + $.modal.open("添加" + table.options.modalName, url);
735 739 }
736 740 }
737 741  
... ...