commit
ee4aedd2a6
@ -0,0 +1,296 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.jlwl</groupId>
|
||||
<artifactId>kuaidizhan</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>5.0.0.RELEASE</spring.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<druid.version>1.1.0</druid.version>
|
||||
<fastjson.version>1.2.8</fastjson.version>
|
||||
<mybaitsplus.version>2.3</mybaitsplus.version>
|
||||
<mysql.version>5.1.38</mysql.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<slf4j.version>1.7.19</slf4j.version>
|
||||
<aspectjweaver.version>1.8.8</aspectjweaver.version>
|
||||
<fileupload.version>1.3.1</fileupload.version>
|
||||
<jstl.version>1.2</jstl.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- JUnit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring MVC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- AOP -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>${aspectjweaver.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- FileUpload -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>${fileupload.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>${jstl.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mybatis-Plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>${mybaitsplus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- FastJson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Log -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.0.12</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.29</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.13</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 百度人工智能 -->
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-jasper</artifactId>
|
||||
<version>9.0.27</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>5.2.4.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 导入导出excel -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>3.11-beta2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.11-beta2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.11-beta2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-excelant</artifactId>
|
||||
<version>3.11-beta2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<!-- 项目访问名称 -->
|
||||
<finalName>kuaidizhan</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
package com.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface APPLoginUser {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 忽略Token验证
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface IgnoreAuth {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface LoginUser {
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
|
||||
|
||||
/**
|
||||
* 自定义填充处理器
|
||||
*/
|
||||
public class MyMetaObjectHandler extends MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("ctime", new Date(), metaObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openUpdateFill() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
// 关闭更新填充、这里不执行
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
|
||||
package com.entity;
|
||||
|
||||
/**
|
||||
* 自定义异常
|
||||
*/
|
||||
public class EIException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msg;
|
||||
private int code = 500;
|
||||
|
||||
public EIException(String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public EIException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public EIException(String msg, int code) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public EIException(String msg, int code, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
|
||||
/**
|
||||
* token表
|
||||
*/
|
||||
@TableName("token")
|
||||
public class TokenEntity implements Serializable {
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userid;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tablename;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expiratedtime;
|
||||
|
||||
/**
|
||||
* 新增时间
|
||||
*/
|
||||
private Date addtime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(Integer userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public String getTablename() {
|
||||
return tablename;
|
||||
}
|
||||
|
||||
public void setTablename(String tablename) {
|
||||
this.tablename = tablename;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Date getExpiratedtime() {
|
||||
return expiratedtime;
|
||||
}
|
||||
|
||||
public void setExpiratedtime(Date expiratedtime) {
|
||||
this.expiratedtime = expiratedtime;
|
||||
}
|
||||
|
||||
public Date getAddtime() {
|
||||
return addtime;
|
||||
}
|
||||
|
||||
public void setAddtime(Date addtime) {
|
||||
this.addtime = addtime;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public TokenEntity(Integer userid, String username, String tablename,String role, String token, Date expiratedtime) {
|
||||
super();
|
||||
this.userid = userid;
|
||||
this.username = username;
|
||||
this.tablename = tablename;
|
||||
this.role = role;
|
||||
this.token = token;
|
||||
this.expiratedtime = expiratedtime;
|
||||
}
|
||||
|
||||
public TokenEntity() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
@TableName("users")
|
||||
public class UserEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String role;
|
||||
|
||||
private Date addtime;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Date getAddtime() {
|
||||
return addtime;
|
||||
}
|
||||
|
||||
public void setAddtime(Date addtime) {
|
||||
this.addtime = addtime;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.interceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import com.annotation.IgnoreAuth;
|
||||
import com.entity.EIException;
|
||||
import com.entity.TokenEntity;
|
||||
import com.service.TokenService;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 权限(Token)验证
|
||||
*/
|
||||
@Component
|
||||
public class AuthorizationInterceptor implements HandlerInterceptor {
|
||||
|
||||
public static final String LOGIN_TOKEN_KEY = "Token";
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
//支持跨域请求
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
|
||||
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
|
||||
|
||||
IgnoreAuth annotation;
|
||||
if (handler instanceof HandlerMethod) {
|
||||
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
//从header中获取token
|
||||
String token = request.getHeader(LOGIN_TOKEN_KEY);
|
||||
|
||||
/**
|
||||
* 不需要验证权限的方法直接放过
|
||||
*/
|
||||
if(annotation!=null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TokenEntity tokenEntity = null;
|
||||
if(StringUtils.isNotBlank(token)) {
|
||||
tokenEntity = tokenService.getTokenEntity(token);
|
||||
}
|
||||
|
||||
if(tokenEntity != null) {
|
||||
request.getSession().setAttribute("userId", tokenEntity.getUserid());
|
||||
request.getSession().setAttribute("role", tokenEntity.getRole());
|
||||
request.getSession().setAttribute("tableName", tokenEntity.getTablename());
|
||||
request.getSession().setAttribute("username", tokenEntity.getUsername());
|
||||
return true;
|
||||
}
|
||||
|
||||
PrintWriter writer = null;
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
|
||||
} finally {
|
||||
if(writer != null){
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
// throw new EIException("请先登录", 401);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>入口页</title>
|
||||
|
||||
<link href="${pageContext.request.contextPath}/resources/xznstatic/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="${pageContext.request.contextPath}/resources/xznstatic/css/jquery.toast.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="${pageContext.request.contextPath}/resources/xznstatic/css/style.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="preloader-it">
|
||||
<div class="la-anim-1"></div>
|
||||
</div>
|
||||
<div class="wrapper theme-1-active pimary-color-blue">
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="mobile-only-brand pull-left">
|
||||
<div class="nav-header pull-left">
|
||||
<div class="logo-wrap">
|
||||
<a href="#"><span class="brand-text" id="pName"></span></a>
|
||||
</div>
|
||||
</div><a id="toggle_nav_btn" class="toggle-left-nav-btn inline-block ml-20 pull-left"
|
||||
href="javascript:void(0);"><i class="zmdi zmdi-menu"></i></a><a id="toggle_mobile_search"
|
||||
data-toggle="collapse" data-target="#search_form" class="mobile-only-view"
|
||||
href="javascript:void(0);"><i class="zmdi zmdi-search"></i></a><a id="toggle_mobile_nav"
|
||||
class="mobile-only-view" href="javascript:void(0);"><i class="zmdi zmdi-more"></i></a>
|
||||
</div>
|
||||
<div id="mobile_only_nav" class="mobile-only-nav pull-right">
|
||||
<ul class="nav navbar-right top-nav pull-right">
|
||||
<li class="dropdown auth-drp"><a href="#" class="dropdown-toggle pr-0" data-toggle="dropdown"><img
|
||||
src="${pageContext.request.contextPath}/resources/xznstatic/img/user1.png" alt="user_auth" class="user-auth-img img-circle" /><span
|
||||
class="user-online-status"></span></a>
|
||||
<ul class="dropdown-menu user-auth-dropdown" data-dropdown-in="flipInX"
|
||||
data-dropdown-out="flipOutX">
|
||||
<li><a href="#" onclick="logout()"><i class="zmdi zmdi-power"></i><span>退出</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="fixed-sidebar-left">
|
||||
<ul class="nav navbar-nav side-nav nicescroll-bar" id="side-menu">
|
||||
<li>
|
||||
<a href="${pageContext.request.contextPath}/jsp/modules/home/home.jsp" onclick="navClick(this);return false;">
|
||||
<div class="pull-left">
|
||||
<i class="zmdi zmdi-flag mr-20"></i>
|
||||
<span class="right-nav-text">主页</span>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page-wrapper">
|
||||
<div class="container-fluid pt-30">
|
||||
<iframe id="mainIframe" src="${pageContext.request.contextPath}/jsp/modules/home/home.jsp" width="100%" frameborder="0" scrolling="auto" ></iframe>
|
||||
</div>
|
||||
<footer class="footer container-fluid pl-30 pr-30">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<p id="copyright" style="text-align: center;"></p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/bootstrap.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.dataTables.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.slimscroll.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.waypoints.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.counterup.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/dropdown-bootstrap-extended.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.sparkline.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/owl.carousel.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/switchery.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/echarts-en.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/echarts-liquidfill.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.toast.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/init.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/dashboard-data.js"></script>
|
||||
|
||||
<script>
|
||||
<%@ include file = "jsp/utils/menu.jsp" %>
|
||||
<%@ include file = "jsp/static/setMenu.js" %>
|
||||
<%@ include file = "jsp/utils/baseUrl.jsp" %>
|
||||
// 用户登出
|
||||
<%@ include file = "jsp/static/logout.jsp" %>
|
||||
|
||||
$(document).ready(function () {
|
||||
//我的后台,session信息转移
|
||||
if (window.localStorage.getItem("Token") != null && window.localStorage.getItem("Token") != 'null') {
|
||||
if (window.sessionStorage.getItem("token") == null || window.sessionStorage.getItem("token") ==
|
||||
'null') {
|
||||
window.sessionStorage.setItem("token", window.localStorage.getItem("Token"));
|
||||
window.sessionStorage.setItem("role", window.localStorage.getItem("role"));
|
||||
window.sessionStorage.setItem("accountTableName", window.localStorage.getItem("sessionTable"));
|
||||
window.sessionStorage.setItem("username", window.localStorage.getItem("adminName"));
|
||||
}
|
||||
}
|
||||
|
||||
$('.dropdown-toggle .hidden-xs').html(window.sessionStorage.getItem('username'));
|
||||
$('#pName').text(projectName);
|
||||
$('#copyright').text('欢迎使用' + projectName)
|
||||
var token = window.sessionStorage.getItem("token");
|
||||
if (token == "null" || token == null) {
|
||||
alert("请登录后再操作");
|
||||
window.location.href = ("jsp/login.jsp");
|
||||
}
|
||||
setMenu();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,107 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>校园快递一站式服务系统</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/xznstatic/css/bootstrap4.2.1.min.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/xznstatic/css/style.default.css" id="theme-stylesheet">
|
||||
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/assets2/js/jquery.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="page login-page">
|
||||
<div class="container d-flex align-items-center">
|
||||
<div class="form-holder has-shadow">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="info d-flex align-items-center">
|
||||
<div class="content">
|
||||
<div class="logo">
|
||||
<h1>欢迎登录</h1>
|
||||
</div>
|
||||
<p>校园快递一站式服务系统</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 bg-white">
|
||||
<div class="form d-flex align-items-center">
|
||||
<div class="content">
|
||||
<form id="loginForm" action="" method="post" class="form-validate">
|
||||
<input type="text" required placeholder="用户名" id="username" name="username" class="input-material">
|
||||
<input type="password" name="password" required placeholder="密码" class="input-material">
|
||||
<div style="margin: 10px 0;" id="submitBtn"></div>
|
||||
<button type="submit" class="btn btn-primary" onclick="login()">登录</button>
|
||||
</br>
|
||||
<a href="modules/register/register.jsp">注册</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/bootstrap4.2.1.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/jquery.validate.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/xznstatic/js/front.js"></script>
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<%@ include file="utils/menu.jsp"%>
|
||||
|
||||
<%@ include file="utils/baseUrl.jsp"%>
|
||||
|
||||
var role = "";
|
||||
var accountTableName = "";
|
||||
//渲染角色选择
|
||||
function setRoleOption() {
|
||||
for (var i = 0; i < menus.length; i++) {
|
||||
var divRoot = '<div class="custom-control custom-checkbox "><input type="radio" name="chk" class="custom-control-input" id="check' + i + '" value="' + menus[i].roleName + '" onclick="checkRole(\'' + menus[i].roleName + '\', \'' + menus[i].tableName + '\')"><label class="custom-control-label" for="check' + i + '">' + menus[i].roleName + '</label></div>';
|
||||
$('#submitBtn').append(divRoot);
|
||||
}
|
||||
}
|
||||
function checkRole(roleName, tableName) {
|
||||
role = roleName;
|
||||
$('#loginForm').attr('action', baseUrl + tableName + '/login?role='+role);
|
||||
accountTableName = tableName;
|
||||
}
|
||||
function login() {
|
||||
$("#loginForm").ajaxForm(function(res) {
|
||||
if (role == "" || role == null) {
|
||||
alert("请选择角色后再登录");
|
||||
} else {
|
||||
if (res.code == 0) {
|
||||
alert("登录成功");
|
||||
var username = $('#username').val();
|
||||
window.sessionStorage.setItem('accountTableName',accountTableName)
|
||||
window.sessionStorage.setItem('username',username);
|
||||
window.sessionStorage.setItem('token', res.token);
|
||||
window.sessionStorage.setItem('role', role);
|
||||
window.location.href = "../index.jsp";
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function register(){
|
||||
window.location.href = "modules/register/register.jsp"
|
||||
}
|
||||
|
||||
|
||||
function ready() {
|
||||
setRoleOption();
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", ready);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,257 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp"%>
|
||||
<link
|
||||
href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp"%>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul id="navUl" class="navbar-nav mr-auto">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑个人信息</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a
|
||||
href="${pageContext.request.contextPath}/index.jsp"> <span
|
||||
class="ti-home"></span>
|
||||
</a></li>
|
||||
<li class="breadcrumb-item">个人信息管理</li>
|
||||
<li class="breadcrumb-item active">编辑个人信息</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">个人信息信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>用户名</label> <input id="username" name="username"
|
||||
class="form-control" placeholder="用户名">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6 mb-3">
|
||||
<button id="submitBtn" type="button"
|
||||
class="btn btn-primary btn-lg" style="margin-top: 30px;">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top"> <span
|
||||
class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp"%>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.fileupload.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/jquery.validate.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/messages_zh.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/card.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
var tableName = "";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
var accountTableName = ''
|
||||
|
||||
var ruleForm = {};
|
||||
|
||||
// 表单提交
|
||||
function submit() {
|
||||
if (validform() == true) {
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : baseUrl + accountTableName + "/update",
|
||||
contentType : "application/json",
|
||||
data : JSON.stringify({id: updateId,username: $('#username').val()}),
|
||||
beforeSend : function(xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage
|
||||
.getItem('token'));
|
||||
},
|
||||
success : function(res) {
|
||||
if (res.code == 0) {
|
||||
alert("修改成功");
|
||||
window.sessionStorage.setItem('username',$('#username').val())
|
||||
window.location.reload();
|
||||
} else if (res.code == 401) {
|
||||
<%@ include file="../../static/toLogin.jsp"%>
|
||||
} else {
|
||||
alert(res.msg)
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
alert("表单未填完整或有错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 表单校验
|
||||
function validform() {
|
||||
return $("#addOrUpdateForm").validate({
|
||||
rules : {
|
||||
username: {
|
||||
required : true,
|
||||
},
|
||||
},
|
||||
messages : {
|
||||
username: {
|
||||
required : "用户名不能为空",
|
||||
},
|
||||
}
|
||||
}).form();
|
||||
}
|
||||
// 添加表单校验方法
|
||||
function addValidation() {
|
||||
jQuery.validator
|
||||
.addMethod(
|
||||
"isPhone",
|
||||
function(value, element) {
|
||||
var length = value.length;
|
||||
var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
|
||||
return this.optional(element)
|
||||
|| (length == 11 && mobile.test(value));
|
||||
}, "请填写正确的手机号码");
|
||||
jQuery.validator.addMethod("isIdCardNo", function(value, element) {
|
||||
return this.optional(element)
|
||||
|| idCardNoUtil.checkIdCardNo(value);
|
||||
}, "请正确输入您的身份证号码");
|
||||
}
|
||||
|
||||
function getId() {
|
||||
var userName = window.sessionStorage.getItem('username')
|
||||
accountTableName = window.sessionStorage.getItem('accountTableName')
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : baseUrl + accountTableName + "/page",
|
||||
data : {
|
||||
username : userName
|
||||
},
|
||||
beforeSend : function(xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage
|
||||
.getItem('token'));
|
||||
},
|
||||
success : function(res) {
|
||||
if (res.code == 0) {
|
||||
updateId = res.data.list[0].id
|
||||
$('#username').val(res.data.list[0].username)
|
||||
} else if (res.code == 401) {
|
||||
<%@ include file="../../static/toLogin.jsp"%>
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
//设置导航栏菜单
|
||||
setMenu();
|
||||
|
||||
//添加表单校验信息文本
|
||||
addValidation();
|
||||
getId();
|
||||
$('#submitBtn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
//console.log("点击了...提交按钮");
|
||||
submit();
|
||||
});
|
||||
});
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,246 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp"%>
|
||||
<link
|
||||
href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp"%>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul id="navUl" class="navbar-nav mr-auto">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑修改密码</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a
|
||||
href="${pageContext.request.contextPath}/index.jsp"> <span
|
||||
class="ti-home"></span>
|
||||
</a></li>
|
||||
<li class="breadcrumb-item">修改密码管理</li>
|
||||
<li class="breadcrumb-item active">编辑修改密码</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">修改密码信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>原密码</label> <input id="oldPassword" name="oldPassword"
|
||||
class="form-control" placeholder="原密码">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>新密码</label> <input id="newPassword" name="newPassword"
|
||||
class="form-control" placeholder="新密码">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>确认密码</label> <input id="confirmPassword"
|
||||
name="confirmPassword" class="form-control"
|
||||
placeholder="确认密码">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6 mb-3">
|
||||
<button id="submitBtn" type="button"
|
||||
class="btn btn-primary btn-lg" style="margin-top: 30px;">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top"> <span
|
||||
class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp"%>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.fileupload.js"></script>
|
||||
<script
|
||||
src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/jquery.validate.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/messages_zh.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/card.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
var tableName = "xiugaimima";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
var password = '';
|
||||
var accountTableName = ''
|
||||
|
||||
var ruleForm = {};
|
||||
|
||||
|
||||
// 表单提交
|
||||
function submit() {
|
||||
if (validform() == true) {
|
||||
if(password == $('#oldPassword').val()){
|
||||
httpJson(accountTableName + "/update","POST",{
|
||||
id:updateId,
|
||||
mima: $('#newPassword').val(),
|
||||
password: $('#newPassword').val()
|
||||
},(res)=>{
|
||||
if(res.code == 0){
|
||||
window.location.href = '../../login.jsp';
|
||||
alert('修改成功,请重新登陆');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert('原密码输入错误')
|
||||
}
|
||||
} else {
|
||||
alert("表单未填完整或有错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 表单校验
|
||||
function validform() {
|
||||
return $("#addOrUpdateForm").validate({
|
||||
rules : {
|
||||
oldPassword : {
|
||||
required : true,
|
||||
},
|
||||
newPassword : {
|
||||
required : true,
|
||||
},
|
||||
confirmPassword : {
|
||||
required : true,
|
||||
equalTo: "#newPassword",
|
||||
},
|
||||
},
|
||||
messages : {
|
||||
oldPassword : {
|
||||
required : "原密码不能为空",
|
||||
},
|
||||
newPassword : {
|
||||
required : "新密码不能为空",
|
||||
},
|
||||
confirmPassword : {
|
||||
required : "确认密码不能为空",
|
||||
equalTo: "两次密码输入不一致",
|
||||
},
|
||||
}
|
||||
}).form();
|
||||
}
|
||||
|
||||
function getId() {
|
||||
var userName = window.sessionStorage.getItem('username')
|
||||
accountTableName = window.sessionStorage.getItem('accountTableName')
|
||||
http(accountTableName+'/session','GET',{},(res)=>{
|
||||
if(res.code == 0){
|
||||
updateId = res.data.id;
|
||||
if(res.data != null && res.data.mima != null && res.data.mima != ''){
|
||||
password = res.data.mima;
|
||||
} else if(res.data != null && res.data.password != null && res.data.password != ''){
|
||||
password = res.data.password;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function() {
|
||||
//设置导航栏菜单
|
||||
setMenu();
|
||||
getId();
|
||||
$('#submitBtn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
//console.log("点击了...提交按钮");
|
||||
submit();
|
||||
});
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
});
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,683 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap-select.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul id="navUl" class="navbar-nav mr-auto">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑待取件表</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">待取件表管理</li>
|
||||
<li class="breadcrumb-item active">编辑待取件表</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">待取件表信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表的字段 -->
|
||||
<div class="form-group col-md-6">
|
||||
<label></label>
|
||||
<div>
|
||||
<select id="yonghuSelect" name="yonghuSelect"
|
||||
class="selectpicker form-control" data-live-search="true"
|
||||
title="请选择" data-header="请选择" data-size="5">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>学号</label>
|
||||
<input id="studentnumber" name="studentnumber" class="form-control"
|
||||
placeholder="学号" readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>用户名称</label>
|
||||
<input id="name" name="name" class="form-control"
|
||||
placeholder="用户名称" readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>性别</label>
|
||||
<input id="sexValue" name="sexValue" class="form-control"
|
||||
placeholder="性别" readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>头像</label>
|
||||
<img id="imgPhotoImg" src="" width="100" height="100">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递站点</label>
|
||||
<div>
|
||||
<select id="zhandianSelect" name="zhandianSelect"
|
||||
class="selectpicker form-control" data-live-search="true"
|
||||
title="请选择" data-header="请选择" data-size="5">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>站点地址</label>
|
||||
<input id="address" name="address" class="form-control"
|
||||
placeholder="站点地址" readonly>
|
||||
</div>
|
||||
<!-- 当前表的字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递名称</label>
|
||||
<input id="dqname" name="dqname" class="form-control"
|
||||
placeholder="快递名称">
|
||||
</div>
|
||||
<input id="zhandianId" name="zhandianId" type="hidden">
|
||||
<input id="yonghuId" name="yonghuId" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递大小</label>
|
||||
<select id="kddxTypesSelect" name="kddxTypes" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>手机号</label>
|
||||
<input id="dqphone" name="dqphone" class="form-control"
|
||||
onchange="dqphoneChickValue(this)" placeholder="手机号">
|
||||
</div>
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="submitBtn" type="button" class="btn btn-primary btn-lg">提交</button>
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.fileupload.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/jquery.validate.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/messages_zh.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/card.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap.min.js">
|
||||
</script><script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap-select.js"></script>
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "daiqu";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
var crossTableId = -1;
|
||||
var crossTableName = '';
|
||||
var ruleForm = {};
|
||||
var crossRuleForm = {};
|
||||
|
||||
|
||||
// 下拉框数组
|
||||
<!-- 当前表的下拉框数组 -->
|
||||
var kddxTypesOptions = [];
|
||||
var kdztTypesOptions = [];
|
||||
<!-- 级联表的下拉框数组 -->
|
||||
var yonghuOptions = [];
|
||||
var zhandianOptions = [];
|
||||
|
||||
var ruleForm = {};
|
||||
|
||||
|
||||
// 文件上传
|
||||
function upload() {
|
||||
|
||||
<!-- 当前表的文件上传 -->
|
||||
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
function submit() {
|
||||
if (validform() == true && compare() == true) {
|
||||
let data = {};
|
||||
getContent();
|
||||
if($("#zhandianId") !=null){
|
||||
var zhandianId = $("#zhandianId").val();
|
||||
if(zhandianId == null || zhandianId =='' || zhandianId == 'null'){
|
||||
alert("站点不能为空");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if($("#yonghuId") !=null){
|
||||
var yonghuId = $("#yonghuId").val();
|
||||
if(yonghuId == null || yonghuId =='' || yonghuId == 'null'){
|
||||
alert("用户不能为空");
|
||||
return;
|
||||
}
|
||||
}
|
||||
let value = $('#addOrUpdateForm').serializeArray();
|
||||
$.each(value, function (index, item) {
|
||||
data[item.name] = item.value;
|
||||
});
|
||||
let json = JSON.stringify(data);
|
||||
var urlParam;
|
||||
var successMes = '';
|
||||
if (updateId != null && updateId != "null" && updateId != '') {
|
||||
urlParam = 'update';
|
||||
successMes = '修改成功';
|
||||
} else {
|
||||
urlParam = 'save';
|
||||
successMes = '添加成功';
|
||||
}
|
||||
httpJson("daiqu/" + urlParam, "POST", data, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
window.sessionStorage.removeItem('adddaiqu');
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
let flag = true;
|
||||
if (flag) {
|
||||
alert(successMes);
|
||||
}
|
||||
if (window.sessionStorage.getItem('onlyme') != null && window.sessionStorage.getItem('onlyme') == "true") {
|
||||
window.sessionStorage.removeItem('onlyme');
|
||||
window.sessionStorage.setItem("reload","reload");
|
||||
window.parent.location.href = "${pageContext.request.contextPath}/index.jsp";
|
||||
} else {
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("表单未填完整或有错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
<!-- 查询当前表的所有列表 -->
|
||||
function kddxTypesSelect() {
|
||||
//填充下拉框选项
|
||||
http("dictionary/page?page=1&limit=100&sort=&order=&dicCode=kddx_types", "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
kddxTypesOptions = res.data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
function kdztTypesSelect() {
|
||||
//填充下拉框选项
|
||||
http("dictionary/page?page=1&limit=100&sort=&order=&dicCode=kdzt_types", "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
kdztTypesOptions = res.data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
<!-- 查询级联表的所有列表 -->
|
||||
function yonghuSelect() {
|
||||
//填充下拉框选项
|
||||
http("yonghu/page?page=1&limit=100&sort=&order=", "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
yonghuOptions = res.data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function yonghuSelectOne(id) {
|
||||
http("yonghu/info/"+id, "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
ruleForm = res.data;
|
||||
yonghuShowImg();
|
||||
yonghuDataBind();
|
||||
}
|
||||
});
|
||||
}
|
||||
function zhandianSelect() {
|
||||
//填充下拉框选项
|
||||
http("zhandian/page?page=1&limit=100&sort=&order=", "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
zhandianOptions = res.data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function zhandianSelectOne(id) {
|
||||
http("zhandian/info/"+id, "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
ruleForm = res.data;
|
||||
zhandianShowImg();
|
||||
zhandianDataBind();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
function initializationKddxtypesSelect(){
|
||||
var kddxTypesSelect = document.getElementById('kddxTypesSelect');
|
||||
if(kddxTypesSelect != null && kddxTypesOptions != null && kddxTypesOptions.length > 0 ){
|
||||
for (var i = 0; i < kddxTypesOptions.length; i++) {
|
||||
kddxTypesSelect.add(new Option(kddxTypesOptions[i].indexName,kddxTypesOptions[i].codeIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
function initializationKdzttypesSelect(){
|
||||
var kdztTypesSelect = document.getElementById('kdztTypesSelect');
|
||||
if(kdztTypesSelect != null && kdztTypesOptions != null && kdztTypesOptions.length > 0 ){
|
||||
for (var i = 0; i < kdztTypesOptions.length; i++) {
|
||||
kdztTypesSelect.add(new Option(kdztTypesOptions[i].indexName,kdztTypesOptions[i].codeIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
function initializationyonghuSelect() {
|
||||
var yonghuSelect = document.getElementById('yonghuSelect');
|
||||
if(yonghuSelect != null && yonghuOptions != null && yonghuOptions.length > 0 ) {
|
||||
for (var i = 0; i < yonghuOptions.length; i++) {
|
||||
yonghuSelect.add(new Option(yonghuOptions[i].name, yonghuOptions[i].id));
|
||||
}
|
||||
|
||||
$("#yonghuSelect").change(function(e) {
|
||||
yonghuSelectOne(e.target.value);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initializationzhandianSelect() {
|
||||
var zhandianSelect = document.getElementById('zhandianSelect');
|
||||
if(zhandianSelect != null && zhandianOptions != null && zhandianOptions.length > 0 ) {
|
||||
for (var i = 0; i < zhandianOptions.length; i++) {
|
||||
zhandianSelect.add(new Option(zhandianOptions[i].zdname, zhandianOptions[i].id));
|
||||
}
|
||||
|
||||
$("#zhandianSelect").change(function(e) {
|
||||
zhandianSelectOne(e.target.value);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 下拉框选项回显
|
||||
function setSelectOption() {
|
||||
|
||||
<!-- 当前表的下拉框回显 -->
|
||||
|
||||
var kddxTypesSelect = document.getElementById("kddxTypesSelect");
|
||||
if(kddxTypesSelect != null && kddxTypesOptions != null && kddxTypesOptions.length > 0 ) {
|
||||
for (var i = 0; i < kddxTypesOptions.length; i++) {
|
||||
if (kddxTypesOptions[i].codeIndex == ruleForm.kddxTypes) {//下拉框value对比,如果一致就赋值汉字
|
||||
kddxTypesSelect.options[i].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var kdztTypesSelect = document.getElementById("kdztTypesSelect");
|
||||
if(kdztTypesSelect != null && kdztTypesOptions != null && kdztTypesOptions.length > 0 ) {
|
||||
for (var i = 0; i < kdztTypesOptions.length; i++) {
|
||||
if (kdztTypesOptions[i].codeIndex == ruleForm.kdztTypes) {//下拉框value对比,如果一致就赋值汉字
|
||||
kdztTypesSelect.options[i].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
<!-- 级联表的下拉框回显 -->
|
||||
var yonghuSelect = document.getElementById("yonghuSelect");
|
||||
if(yonghuSelect != null && yonghuOptions != null && yonghuOptions.length > 0 ) {
|
||||
for (var i = 0; i < yonghuOptions.length; i++) {
|
||||
if (yonghuOptions[i].id == ruleForm.yonghuId) {//下拉框value对比,如果一致就赋值汉字
|
||||
yonghuSelect.options[i+1].selected = true;
|
||||
$("#yonghuSelect" ).selectpicker('refresh');
|
||||
}
|
||||
}
|
||||
}
|
||||
var zhandianSelect = document.getElementById("zhandianSelect");
|
||||
if(zhandianSelect != null && zhandianOptions != null && zhandianOptions.length > 0 ) {
|
||||
for (var i = 0; i < zhandianOptions.length; i++) {
|
||||
if (zhandianOptions[i].id == ruleForm.zhandianId) {//下拉框value对比,如果一致就赋值汉字
|
||||
zhandianSelect.options[i+1].selected = true;
|
||||
$("#zhandianSelect" ).selectpicker('refresh');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
<!-- 当前表的填充富文本框 -->
|
||||
}
|
||||
// 获取富文本框内容
|
||||
function getContent() {
|
||||
|
||||
<!-- 获取当前表的富文本框内容 -->
|
||||
}
|
||||
//数字检查
|
||||
<!-- 当前表的数字检查 -->
|
||||
function dqphoneChickValue(e){
|
||||
var this_val = e.value || 0;
|
||||
/*if(this_val == 0){
|
||||
e.value = "";
|
||||
alert("0不允许输入");
|
||||
return false;
|
||||
}*/
|
||||
var reg=/^[0-9]*$/;
|
||||
if(!reg.test(this_val)){
|
||||
e.value = "";
|
||||
alert("输入不合法");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddaiqu');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
// 表单校验
|
||||
function validform() {
|
||||
return $("#addOrUpdateForm").validate({
|
||||
rules: {
|
||||
dqname: "required",
|
||||
zhandianId: "required",
|
||||
yonghuId: "required",
|
||||
kddxTypes: "required",
|
||||
dqphone: "required",
|
||||
takecode: "required",
|
||||
kdztTypes: "required",
|
||||
pickupTime: "required",
|
||||
},
|
||||
messages: {
|
||||
dqname: "快递名称不能为空",
|
||||
zhandianId: "站点不能为空",
|
||||
yonghuId: "用户不能为空",
|
||||
kddxTypes: "快递大小不能为空",
|
||||
dqphone: "手机号不能为空",
|
||||
takecode: "取件码不能为空",
|
||||
kdztTypes: "快递状态不能为空",
|
||||
pickupTime: "取件时间不能为空",
|
||||
}
|
||||
}).form();
|
||||
}
|
||||
|
||||
// 获取当前详情
|
||||
function getDetails() {
|
||||
var adddaiqu = window.sessionStorage.getItem("adddaiqu");
|
||||
if (adddaiqu != null && adddaiqu != "" && adddaiqu != "null") {
|
||||
window.sessionStorage.removeItem('adddaiqu');
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
$('#submitBtn').text('新增');
|
||||
|
||||
} else {
|
||||
$('#submitBtn').text('修改');
|
||||
var userId = window.sessionStorage.getItem('userId');
|
||||
updateId = userId;//先赋值登录用户id
|
||||
var uId = window.sessionStorage.getItem('updateId');//获取修改传过来的id
|
||||
if (uId != null && uId != "" && uId != "null") {
|
||||
//如果修改id不为空就赋值修改id
|
||||
updateId = uId;
|
||||
}
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
http("daiqu/info/" + updateId, "GET", {}, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
ruleForm = res.data
|
||||
// 是/否下拉框回显
|
||||
setSelectOption();
|
||||
// 设置图片src
|
||||
showImg();
|
||||
// 数据填充
|
||||
dataBind();
|
||||
// 富文本框回显
|
||||
setContent();
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 清除可能会重复渲染的selection
|
||||
function clear(className) {
|
||||
var elements = document.getElementsByClassName(className);
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
elements[i].parentNode.removeChild(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function dateTimePick() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function dataBind() {
|
||||
|
||||
|
||||
<!-- 级联表的数据回显 -->
|
||||
yonghuDataBind();
|
||||
zhandianDataBind();
|
||||
|
||||
|
||||
<!-- 当前表的数据回显 -->
|
||||
$("#updateId").val(ruleForm.id);
|
||||
$("#dqname").val(ruleForm.dqname);
|
||||
$("#zhandianId").val(ruleForm.zhandianId);
|
||||
$("#yonghuId").val(ruleForm.yonghuId);
|
||||
$("#dqphone").val(ruleForm.dqphone);
|
||||
$("#takecode").val(ruleForm.takecode);
|
||||
$("#pickupTime-input").val(ruleForm.pickupTime);
|
||||
|
||||
}
|
||||
<!-- 级联表的数据回显 -->
|
||||
function yonghuDataBind(){
|
||||
|
||||
<!-- 把id赋值给当前表的id-->
|
||||
$("#yonghuId").val(ruleForm.id);
|
||||
|
||||
$("#studentnumber").val(ruleForm.studentnumber);
|
||||
$("#name").val(ruleForm.name);
|
||||
$("#username").val(ruleForm.username);
|
||||
$("#password").val(ruleForm.password);
|
||||
$("#sexValue").val(ruleForm.sexValue);
|
||||
$("#dqphone").val(ruleForm.phone);
|
||||
$("#zhuSuLou").val(ruleForm.zhuSuLou);
|
||||
$("#dormitory").val(ruleForm.dormitory);
|
||||
$("#role").val(ruleForm.role);
|
||||
}
|
||||
|
||||
function zhandianDataBind(){
|
||||
|
||||
<!-- 把id赋值给当前表的id-->
|
||||
$("#zhandianId").val(ruleForm.id);
|
||||
|
||||
$("#zdname").val(ruleForm.zdname);
|
||||
$("#address").val(ruleForm.address);
|
||||
}
|
||||
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
<!-- 当前表的图片 -->
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
yonghuShowImg();
|
||||
zhandianShowImg();
|
||||
}
|
||||
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
|
||||
function yonghuShowImg() {
|
||||
debugger
|
||||
$("#imgPhotoImg").attr("src",ruleForm.imgPhoto);
|
||||
}
|
||||
|
||||
|
||||
function zhandianShowImg() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
//设置导航栏菜单
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
//初始化时间插件
|
||||
dateTimePick();
|
||||
//查询所有下拉框
|
||||
<!-- 当前表的下拉框 -->
|
||||
kddxTypesSelect();
|
||||
kdztTypesSelect();
|
||||
<!-- 查询级联表的下拉框(用id做option,用名字及其他参数做名字级联修改) -->
|
||||
yonghuSelect();
|
||||
zhandianSelect();
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
initializationKddxtypesSelect();
|
||||
initializationKdzttypesSelect();
|
||||
<!-- 初始化级联表的下拉框 -->
|
||||
initializationyonghuSelect();
|
||||
initializationzhandianSelect();
|
||||
|
||||
$(".selectpicker" ).selectpicker('refresh');
|
||||
getDetails();
|
||||
//初始化上传按钮
|
||||
upload();
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
$('#submitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//console.log("点击了...提交按钮");
|
||||
submit();
|
||||
});
|
||||
readonly();
|
||||
});
|
||||
|
||||
function readonly() {
|
||||
if (window.sessionStorage.getItem('role') != '管理员') {
|
||||
$('#jifen').attr('readonly', 'readonly');
|
||||
//$('#money').attr('readonly', 'readonly');
|
||||
}
|
||||
}
|
||||
|
||||
//比较大小
|
||||
function compare() {
|
||||
var largerVal = null;
|
||||
var smallerVal = null;
|
||||
if (largerVal != null && smallerVal != null) {
|
||||
if (largerVal <= smallerVal) {
|
||||
alert(smallerName + '不能大于等于' + largerName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,327 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto" id="navUl">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑待取件表</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">待取件表管理</li>
|
||||
<li class="breadcrumb-item active">待取件表登记</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">待取件表信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表所有字段 -->
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>学号</label>
|
||||
<input id="studentnumber" name="studentnumber" class="form-control"
|
||||
v-model="ruleForm.studentnumber" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>用户名称</label>
|
||||
<input id="name" name="name" class="form-control"
|
||||
v-model="ruleForm.name" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>账号</label>
|
||||
<input id="username" name="username" class="form-control"
|
||||
v-model="ruleForm.username" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>性别</label>
|
||||
<input id="sexValue" name="sexValue" class="form-control"
|
||||
v-model="ruleForm.sexValue" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>头像</label>
|
||||
<img id="imgPhotoImg" width="100" height="100">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>联系电话</label>
|
||||
<input id="phone" name="phone" class="form-control"
|
||||
v-model="ruleForm.phone" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>住宿楼栋</label>
|
||||
<input id="zhuSuLou" name="zhuSuLou" class="form-control"
|
||||
v-model="ruleForm.zhuSuLou" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>寝室号</label>
|
||||
<input id="dormitory" name="dormitory" class="form-control"
|
||||
v-model="ruleForm.dormitory" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>身份</label>
|
||||
<input id="role" name="role" class="form-control"
|
||||
v-model="ruleForm.role" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>站点名称</label>
|
||||
<input id="zdname" name="zdname" class="form-control"
|
||||
v-model="ruleForm.zdname" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>站点地址</label>
|
||||
<input id="address" name="address" class="form-control"
|
||||
v-model="ruleForm.address" readonly>
|
||||
</div>
|
||||
|
||||
<!-- 本表所有字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递名称</label>
|
||||
<input id="dqname" name="dqname" class="form-control"
|
||||
v-model="ruleForm.dqname" readonly>
|
||||
</div>
|
||||
|
||||
<input id="zhandianId" name="zhandianId" v-model="ruleForm.zhandianId" readonly type="hidden">
|
||||
<input id="yonghuId" name="yonghuId" v-model="ruleForm.yonghuId" readonly type="hidden">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递大小</label>
|
||||
<input id="kddxValue" name="kddxValue" class="form-control"
|
||||
v-model="ruleForm.kddxValue" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>手机号</label>
|
||||
<input id="dqphone" name="dqphone" class="form-control"
|
||||
v-model="ruleForm.dqphone" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>取件码</label>
|
||||
<input id="takecode" name="takecode" class="form-control"
|
||||
v-model="ruleForm.takecode" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>快递状态</label>
|
||||
<input id="kdztValue" name="kdztValue" class="form-control"
|
||||
v-model="ruleForm.kdztValue" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>取件时间</label>
|
||||
<input id="pickupTime" name="pickupTime" class="form-control"
|
||||
v-model="ruleForm.pickupTime" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "daiqu";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
|
||||
var kddxTypesOptions = [];
|
||||
var kdztTypesOptions = [];
|
||||
|
||||
var ruleForm = {};
|
||||
var vm = new Vue({
|
||||
el: '#addOrUpdateForm',
|
||||
data: {
|
||||
ruleForm: {},
|
||||
},
|
||||
beforeCreate: function () {
|
||||
var id = window.sessionStorage.getItem("updateId");
|
||||
if (id != null && id != "" && id != "null") {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseUrl + "daiqu/info/" + id,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage.getItem('token'));
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
vm.ruleForm = res.data;
|
||||
ruleForm = res.data;
|
||||
showImg();
|
||||
setContent();
|
||||
} else if (res.code == 401) {
|
||||
<%@ include file="../../static/toLogin.jsp"%>
|
||||
} else {
|
||||
alert(res.msg)
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
});
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
$("#imgPhotoImg").attr("src", ruleForm.imgPhoto);
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddaiqu');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
|
||||
// 下载
|
||||
function download(fileName) {
|
||||
var url = baseUrl+'file/download?fileName='+fileName;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
//设置下载
|
||||
function setDownloadBtn() {
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
|
||||
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
});
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,487 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap-select.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul id="navUl" class="navbar-nav mr-auto">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">管理</li>
|
||||
<li class="breadcrumb-item active">编辑</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表的字段 -->
|
||||
<!-- 当前表的字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>用户名称</label>
|
||||
<input id="name" name="name" class="form-control"
|
||||
placeholder="用户名称">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>账号</label>
|
||||
<input id="username" name="username" class="form-control"
|
||||
placeholder="账号">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>性别</label>
|
||||
<select id="sexTypesSelect" name="sexTypes" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>头像</label>
|
||||
<img id="imgPhotoImg" src="" width="100" height="100">
|
||||
<input name="file" type="file" id="imgPhotoupload"
|
||||
class="form-control-file">
|
||||
<input name="imgPhoto" id="imgPhoto-input" type="hidden">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>联系电话</label>
|
||||
<input id="phone" name="phone" class="form-control"
|
||||
onchange="phoneChickValue(this)" placeholder="联系电话">
|
||||
</div>
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="submitBtn" type="button" class="btn btn-primary btn-lg">提交</button>
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.fileupload.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/jquery.validate.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/messages_zh.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/card.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap.min.js">
|
||||
</script><script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap-select.js"></script>
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "daiquren";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
var crossTableId = -1;
|
||||
var crossTableName = '';
|
||||
var ruleForm = {};
|
||||
var crossRuleForm = {};
|
||||
|
||||
|
||||
// 下拉框数组
|
||||
<!-- 当前表的下拉框数组 -->
|
||||
var sexTypesOptions = [];
|
||||
<!-- 级联表的下拉框数组 -->
|
||||
|
||||
var ruleForm = {};
|
||||
|
||||
|
||||
// 文件上传
|
||||
function upload() {
|
||||
|
||||
<!-- 当前表的文件上传 -->
|
||||
|
||||
$('#imgPhotoupload').fileupload({
|
||||
url: baseUrl + 'file/upload',
|
||||
headers: {token: window.sessionStorage.getItem("token")},
|
||||
dataType: 'json',
|
||||
done: function (e, data) {
|
||||
var photoUrl= baseUrl + 'file/download?fileName=' + data.result.file;
|
||||
document.getElementById('imgPhotoImg').setAttribute('src',photoUrl);
|
||||
document.getElementById('imgPhoto-input').setAttribute('value',photoUrl);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
function submit() {
|
||||
if (validform() == true && compare() == true) {
|
||||
let data = {};
|
||||
getContent();
|
||||
let value = $('#addOrUpdateForm').serializeArray();
|
||||
$.each(value, function (index, item) {
|
||||
data[item.name] = item.value;
|
||||
});
|
||||
let json = JSON.stringify(data);
|
||||
var urlParam;
|
||||
var successMes = '';
|
||||
if (updateId != null && updateId != "null" && updateId != '') {
|
||||
urlParam = 'update';
|
||||
successMes = '修改成功';
|
||||
} else {
|
||||
urlParam = 'save';
|
||||
successMes = '添加成功';
|
||||
}
|
||||
httpJson("daiquren/" + urlParam, "POST", data, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
window.sessionStorage.removeItem('adddaiquren');
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
let flag = true;
|
||||
if (flag) {
|
||||
alert(successMes);
|
||||
}
|
||||
if (window.sessionStorage.getItem('onlyme') != null && window.sessionStorage.getItem('onlyme') == "true") {
|
||||
window.sessionStorage.removeItem('onlyme');
|
||||
window.sessionStorage.setItem("reload","reload");
|
||||
window.parent.location.href = "${pageContext.request.contextPath}/index.jsp";
|
||||
} else {
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("表单未填完整或有错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
<!-- 查询当前表的所有列表 -->
|
||||
function sexTypesSelect() {
|
||||
//填充下拉框选项
|
||||
http("dictionary/page?page=1&limit=100&sort=&order=&dicCode=sex_types", "GET", {}, (res) => {
|
||||
if(res.code == 0){
|
||||
sexTypesOptions = res.data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
<!-- 查询级联表的所有列表 -->
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
function initializationSextypesSelect(){
|
||||
var sexTypesSelect = document.getElementById('sexTypesSelect');
|
||||
if(sexTypesSelect != null && sexTypesOptions != null && sexTypesOptions.length > 0 ){
|
||||
for (var i = 0; i < sexTypesOptions.length; i++) {
|
||||
sexTypesSelect.add(new Option(sexTypesOptions[i].indexName,sexTypesOptions[i].codeIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
|
||||
|
||||
// 下拉框选项回显
|
||||
function setSelectOption() {
|
||||
|
||||
<!-- 当前表的下拉框回显 -->
|
||||
|
||||
var sexTypesSelect = document.getElementById("sexTypesSelect");
|
||||
if(sexTypesSelect != null && sexTypesOptions != null && sexTypesOptions.length > 0 ) {
|
||||
for (var i = 0; i < sexTypesOptions.length; i++) {
|
||||
if (sexTypesOptions[i].codeIndex == ruleForm.sexTypes) {//下拉框value对比,如果一致就赋值汉字
|
||||
sexTypesSelect.options[i].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
<!-- 级联表的下拉框回显 -->
|
||||
}
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
<!-- 当前表的填充富文本框 -->
|
||||
}
|
||||
// 获取富文本框内容
|
||||
function getContent() {
|
||||
|
||||
<!-- 获取当前表的富文本框内容 -->
|
||||
}
|
||||
//数字检查
|
||||
<!-- 当前表的数字检查 -->
|
||||
function phoneChickValue(e){
|
||||
var this_val = e.value || 0;
|
||||
var reg=/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
||||
if(!reg.test(this_val)){
|
||||
e.value = "";
|
||||
alert("手机号不正确");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddaiquren');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
// 表单校验
|
||||
function validform() {
|
||||
return $("#addOrUpdateForm").validate({
|
||||
rules: {
|
||||
name: "required",
|
||||
username: "required",
|
||||
password: "required",
|
||||
sexTypes: "required",
|
||||
imgPhoto: "required",
|
||||
phone: "required",
|
||||
role: "required",
|
||||
},
|
||||
messages: {
|
||||
name: "用户名称不能为空",
|
||||
username: "账号不能为空",
|
||||
password: "密码不能为空",
|
||||
sexTypes: "性别不能为空",
|
||||
imgPhoto: "头像不能为空",
|
||||
phone: "联系电话不能为空",
|
||||
role: "身份不能为空",
|
||||
}
|
||||
}).form();
|
||||
}
|
||||
|
||||
// 获取当前详情
|
||||
function getDetails() {
|
||||
var adddaiquren = window.sessionStorage.getItem("adddaiquren");
|
||||
if (adddaiquren != null && adddaiquren != "" && adddaiquren != "null") {
|
||||
window.sessionStorage.removeItem('adddaiquren');
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
$('#submitBtn').text('新增');
|
||||
|
||||
} else {
|
||||
$('#submitBtn').text('修改');
|
||||
var userId = window.sessionStorage.getItem('userId');
|
||||
updateId = userId;//先赋值登录用户id
|
||||
var uId = window.sessionStorage.getItem('updateId');//获取修改传过来的id
|
||||
if (uId != null && uId != "" && uId != "null") {
|
||||
//如果修改id不为空就赋值修改id
|
||||
updateId = uId;
|
||||
}
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
http("daiquren/info/" + updateId, "GET", {}, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
ruleForm = res.data
|
||||
// 是/否下拉框回显
|
||||
setSelectOption();
|
||||
// 设置图片src
|
||||
showImg();
|
||||
// 数据填充
|
||||
dataBind();
|
||||
// 富文本框回显
|
||||
setContent();
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 清除可能会重复渲染的selection
|
||||
function clear(className) {
|
||||
var elements = document.getElementsByClassName(className);
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
elements[i].parentNode.removeChild(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function dateTimePick() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function dataBind() {
|
||||
|
||||
|
||||
<!-- 级联表的数据回显 -->
|
||||
|
||||
|
||||
<!-- 当前表的数据回显 -->
|
||||
$("#updateId").val(ruleForm.id);
|
||||
$("#name").val(ruleForm.name);
|
||||
$("#username").val(ruleForm.username);
|
||||
$("#password").val(ruleForm.password);
|
||||
$("#phone").val(ruleForm.phone);
|
||||
$("#role").val(ruleForm.role);
|
||||
|
||||
}
|
||||
<!-- 级联表的数据回显 -->
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
<!-- 当前表的图片 -->
|
||||
$("#imgPhotoImg").attr("src",ruleForm.imgPhoto);
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
}
|
||||
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
//设置导航栏菜单
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
//初始化时间插件
|
||||
dateTimePick();
|
||||
//查询所有下拉框
|
||||
<!-- 当前表的下拉框 -->
|
||||
sexTypesSelect();
|
||||
<!-- 查询级联表的下拉框(用id做option,用名字及其他参数做名字级联修改) -->
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
initializationSextypesSelect();
|
||||
<!-- 初始化级联表的下拉框 -->
|
||||
|
||||
$(".selectpicker" ).selectpicker('refresh');
|
||||
getDetails();
|
||||
//初始化上传按钮
|
||||
upload();
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
$('#submitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//console.log("点击了...提交按钮");
|
||||
submit();
|
||||
});
|
||||
readonly();
|
||||
});
|
||||
|
||||
function readonly() {
|
||||
if (window.sessionStorage.getItem('role') != '管理员') {
|
||||
$('#jifen').attr('readonly', 'readonly');
|
||||
//$('#money').attr('readonly', 'readonly');
|
||||
}
|
||||
}
|
||||
|
||||
//比较大小
|
||||
function compare() {
|
||||
var largerVal = null;
|
||||
var smallerVal = null;
|
||||
if (largerVal != null && smallerVal != null) {
|
||||
if (largerVal <= smallerVal) {
|
||||
alert(smallerName + '不能大于等于' + largerName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,245 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto" id="navUl">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">管理</li>
|
||||
<li class="breadcrumb-item active">登记</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表所有字段 -->
|
||||
<!-- 本表所有字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>用户名称</label>
|
||||
<input id="name" name="name" class="form-control"
|
||||
v-model="ruleForm.name" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>账号</label>
|
||||
<input id="username" name="username" class="form-control"
|
||||
v-model="ruleForm.username" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>性别</label>
|
||||
<input id="sexValue" name="sexValue" class="form-control"
|
||||
v-model="ruleForm.sexValue" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>头像</label>
|
||||
<img id="imgPhotoImg" width="100" height="100">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>联系电话</label>
|
||||
<input id="phone" name="phone" class="form-control"
|
||||
v-model="ruleForm.phone" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>身份</label>
|
||||
<input id="role" name="role" class="form-control"
|
||||
v-model="ruleForm.role" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "daiquren";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
|
||||
var sexTypesOptions = [];
|
||||
|
||||
var ruleForm = {};
|
||||
var vm = new Vue({
|
||||
el: '#addOrUpdateForm',
|
||||
data: {
|
||||
ruleForm: {},
|
||||
},
|
||||
beforeCreate: function () {
|
||||
var id = window.sessionStorage.getItem("updateId");
|
||||
if (id != null && id != "" && id != "null") {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseUrl + "daiquren/info/" + id,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage.getItem('token'));
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
vm.ruleForm = res.data;
|
||||
ruleForm = res.data;
|
||||
showImg();
|
||||
setContent();
|
||||
} else if (res.code == 401) {
|
||||
<%@ include file="../../static/toLogin.jsp"%>
|
||||
} else {
|
||||
alert(res.msg)
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
});
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
$("#imgPhotoImg").attr("src", ruleForm.imgPhoto);
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddaiquren');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
|
||||
// 下载
|
||||
function download(fileName) {
|
||||
var url = baseUrl+'file/download?fileName='+fileName;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
//设置下载
|
||||
function setDownloadBtn() {
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
|
||||
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
});
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,449 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap-select.css" rel="stylesheet">
|
||||
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul id="navUl" class="navbar-nav mr-auto">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑字典表</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">字典表管理</li>
|
||||
<li class="breadcrumb-item active">编辑字典表</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">字典表信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表的字段 -->
|
||||
<!-- 当前表的字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
<div class="form-group col-md-6">
|
||||
<label>字段</label>
|
||||
<input id="dicCode" name="dicCode" class="form-control"
|
||||
placeholder="字段">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>字段名</label>
|
||||
<input id="dicName" name="dicName" class="form-control"
|
||||
placeholder="字段名">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>编码</label>
|
||||
<input id="codeIndex" name="codeIndex" class="form-control"
|
||||
onchange="codeIndexChickValue(this)" placeholder="编码">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>编码名字</label>
|
||||
<input id="indexName" name="indexName" class="form-control"
|
||||
placeholder="编码名字">
|
||||
</div>
|
||||
<input id="superId" name="superId" type="hidden">
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="submitBtn" type="button" class="btn btn-primary btn-lg">提交</button>
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.fileupload.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/jquery.validate.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/messages_zh.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/validate/card.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap.min.js">
|
||||
</script><script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/js/bootstrap-select.js"></script>
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "dictionary";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
var crossTableId = -1;
|
||||
var crossTableName = '';
|
||||
var ruleForm = {};
|
||||
var crossRuleForm = {};
|
||||
|
||||
|
||||
// 下拉框数组
|
||||
<!-- 当前表的下拉框数组 -->
|
||||
<!-- 级联表的下拉框数组 -->
|
||||
|
||||
var ruleForm = {};
|
||||
|
||||
|
||||
// 文件上传
|
||||
function upload() {
|
||||
|
||||
<!-- 当前表的文件上传 -->
|
||||
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
function submit() {
|
||||
if (validform() == true && compare() == true) {
|
||||
let data = {};
|
||||
getContent();
|
||||
if($("#superId") !=null){
|
||||
var superId = $("#superId").val();
|
||||
if(superId == null || superId =='' || superId == 'null'){
|
||||
alert("父字段id不能为空");
|
||||
return;
|
||||
}
|
||||
}
|
||||
let value = $('#addOrUpdateForm').serializeArray();
|
||||
$.each(value, function (index, item) {
|
||||
data[item.name] = item.value;
|
||||
});
|
||||
let json = JSON.stringify(data);
|
||||
var urlParam;
|
||||
var successMes = '';
|
||||
if (updateId != null && updateId != "null" && updateId != '') {
|
||||
urlParam = 'update';
|
||||
successMes = '修改成功';
|
||||
} else {
|
||||
urlParam = 'save';
|
||||
successMes = '添加成功';
|
||||
}
|
||||
httpJson("dictionary/" + urlParam, "POST", data, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
window.sessionStorage.removeItem('adddictionary');
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
let flag = true;
|
||||
if (flag) {
|
||||
alert(successMes);
|
||||
}
|
||||
if (window.sessionStorage.getItem('onlyme') != null && window.sessionStorage.getItem('onlyme') == "true") {
|
||||
window.sessionStorage.removeItem('onlyme');
|
||||
window.sessionStorage.setItem("reload","reload");
|
||||
window.parent.location.href = "${pageContext.request.contextPath}/index.jsp";
|
||||
} else {
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("表单未填完整或有错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
<!-- 查询当前表的所有列表 -->
|
||||
<!-- 查询级联表的所有列表 -->
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
<!-- 初始化级联表的下拉框(要根据内容修改) -->
|
||||
|
||||
|
||||
// 下拉框选项回显
|
||||
function setSelectOption() {
|
||||
|
||||
<!-- 当前表的下拉框回显 -->
|
||||
<!-- 级联表的下拉框回显 -->
|
||||
}
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
<!-- 当前表的填充富文本框 -->
|
||||
}
|
||||
// 获取富文本框内容
|
||||
function getContent() {
|
||||
|
||||
<!-- 获取当前表的富文本框内容 -->
|
||||
}
|
||||
//数字检查
|
||||
<!-- 当前表的数字检查 -->
|
||||
function codeIndexChickValue(e){
|
||||
var this_val = e.value || 0;
|
||||
/*if(this_val == 0){
|
||||
e.value = "";
|
||||
alert("0不允许输入");
|
||||
return false;
|
||||
}*/
|
||||
var reg=/^[0-9]*$/;
|
||||
if(!reg.test(this_val)){
|
||||
e.value = "";
|
||||
alert("输入不合法");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddictionary');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
// 表单校验
|
||||
function validform() {
|
||||
return $("#addOrUpdateForm").validate({
|
||||
rules: {
|
||||
dicCode: "required",
|
||||
dicName: "required",
|
||||
codeIndex: "required",
|
||||
indexName: "required",
|
||||
superId: "required",
|
||||
},
|
||||
messages: {
|
||||
dicCode: "字段不能为空",
|
||||
dicName: "字段名不能为空",
|
||||
codeIndex: "编码不能为空",
|
||||
indexName: "编码名字不能为空",
|
||||
superId: "父字段id不能为空",
|
||||
}
|
||||
}).form();
|
||||
}
|
||||
|
||||
// 获取当前详情
|
||||
function getDetails() {
|
||||
var adddictionary = window.sessionStorage.getItem("adddictionary");
|
||||
if (adddictionary != null && adddictionary != "" && adddictionary != "null") {
|
||||
window.sessionStorage.removeItem('adddictionary');
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
$('#submitBtn').text('新增');
|
||||
|
||||
} else {
|
||||
$('#submitBtn').text('修改');
|
||||
var userId = window.sessionStorage.getItem('userId');
|
||||
updateId = userId;//先赋值登录用户id
|
||||
var uId = window.sessionStorage.getItem('updateId');//获取修改传过来的id
|
||||
if (uId != null && uId != "" && uId != "null") {
|
||||
//如果修改id不为空就赋值修改id
|
||||
updateId = uId;
|
||||
}
|
||||
window.sessionStorage.removeItem('updateId');
|
||||
http("dictionary/info/" + updateId, "GET", {}, (res) => {
|
||||
if(res.code == 0)
|
||||
{
|
||||
ruleForm = res.data
|
||||
// 是/否下拉框回显
|
||||
setSelectOption();
|
||||
// 设置图片src
|
||||
showImg();
|
||||
// 数据填充
|
||||
dataBind();
|
||||
// 富文本框回显
|
||||
setContent();
|
||||
//注册表单验证
|
||||
$(validform());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 清除可能会重复渲染的selection
|
||||
function clear(className) {
|
||||
var elements = document.getElementsByClassName(className);
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
elements[i].parentNode.removeChild(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function dateTimePick() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function dataBind() {
|
||||
|
||||
|
||||
<!-- 级联表的数据回显 -->
|
||||
|
||||
|
||||
<!-- 当前表的数据回显 -->
|
||||
$("#updateId").val(ruleForm.id);
|
||||
$("#dicCode").val(ruleForm.dicCode);
|
||||
$("#dicName").val(ruleForm.dicName);
|
||||
$("#codeIndex").val(ruleForm.codeIndex);
|
||||
$("#indexName").val(ruleForm.indexName);
|
||||
$("#superId").val(ruleForm.superId);
|
||||
|
||||
}
|
||||
<!-- 级联表的数据回显 -->
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
<!-- 当前表的图片 -->
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
}
|
||||
|
||||
|
||||
<!-- 级联表的图片 -->
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
//设置导航栏菜单
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
//初始化时间插件
|
||||
dateTimePick();
|
||||
//查询所有下拉框
|
||||
<!-- 当前表的下拉框 -->
|
||||
<!-- 查询级联表的下拉框(用id做option,用名字及其他参数做名字级联修改) -->
|
||||
|
||||
|
||||
|
||||
// 初始化下拉框
|
||||
<!-- 初始化当前表的下拉框 -->
|
||||
<!-- 初始化级联表的下拉框 -->
|
||||
|
||||
$(".selectpicker" ).selectpicker('refresh');
|
||||
getDetails();
|
||||
//初始化上传按钮
|
||||
upload();
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
$('#submitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//console.log("点击了...提交按钮");
|
||||
submit();
|
||||
});
|
||||
readonly();
|
||||
});
|
||||
|
||||
function readonly() {
|
||||
if (window.sessionStorage.getItem('role') != '管理员') {
|
||||
$('#jifen').attr('readonly', 'readonly');
|
||||
//$('#money').attr('readonly', 'readonly');
|
||||
}
|
||||
}
|
||||
|
||||
//比较大小
|
||||
function compare() {
|
||||
var largerVal = null;
|
||||
var smallerVal = null;
|
||||
if (largerVal != null && smallerVal != null) {
|
||||
if (largerVal <= smallerVal) {
|
||||
alert(smallerName + '不能大于等于' + largerName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,233 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<%@ include file="../../static/head.jsp" %>
|
||||
<link href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
|
||||
rel="stylesheet">
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.UEDITOR_HOME_URL = "${pageContext.request.contextPath}/resources/ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变
|
||||
</script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/ueditor.all.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8"
|
||||
src="${pageContext.request.contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<!-- Pre Loader -->
|
||||
<div class="loading">
|
||||
<div class="spinner">
|
||||
<div class="double-bounce1"></div>
|
||||
<div class="double-bounce2"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/Pre Loader -->
|
||||
<div class="wrapper">
|
||||
<!-- Page Content -->
|
||||
<div id="content">
|
||||
<!-- Top Navigation -->
|
||||
<%@ include file="../../static/topNav.jsp" %>
|
||||
<!-- Menu -->
|
||||
<div class="container menu-nav">
|
||||
<nav class="navbar navbar-expand-lg lochana-bg text-white">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="ti-menu text-white"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto" id="navUl">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
<!-- Breadcrumb -->
|
||||
<!-- Page Title -->
|
||||
<div class="container mt-0">
|
||||
<div class="row breadcrumb-bar">
|
||||
<div class="col-md-6">
|
||||
<h3 class="block-title">编辑字典表</h3>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="${pageContext.request.contextPath}/index.jsp">
|
||||
<span class="ti-home"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">字典表管理</li>
|
||||
<li class="breadcrumb-item active">字典表登记</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Page Title -->
|
||||
|
||||
<!-- /Breadcrumb -->
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Widget Item -->
|
||||
<div class="col-md-12">
|
||||
<div class="widget-area-2 lochana-box-shadow">
|
||||
<h3 class="widget-title">字典表信息</h3>
|
||||
<form id="addOrUpdateForm">
|
||||
<div class="form-row">
|
||||
<!-- 级联表所有字段 -->
|
||||
<!-- 本表所有字段 -->
|
||||
<input id="updateId" name="id" type="hidden">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>字段</label>
|
||||
<input id="dicCode" name="dicCode" class="form-control"
|
||||
v-model="ruleForm.dicCode" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>字段名</label>
|
||||
<input id="dicName" name="dicName" class="form-control"
|
||||
v-model="ruleForm.dicName" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>编码</label>
|
||||
<input id="codeIndex" name="codeIndex" class="form-control"
|
||||
v-model="ruleForm.codeIndex" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label>编码名字</label>
|
||||
<input id="indexName" name="indexName" class="form-control"
|
||||
v-model="ruleForm.indexName" readonly>
|
||||
</div>
|
||||
|
||||
<input id="superId" name="superId" v-model="ruleForm.superId" readonly type="hidden">
|
||||
<div class="form-group col-md-12 mb-3">
|
||||
<button id="exitBtn" type="button" class="btn btn-primary btn-lg">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Widget Item -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main Content -->
|
||||
</div>
|
||||
<!-- /Page Content -->
|
||||
</div>
|
||||
<!-- Back to Top -->
|
||||
<a id="back-to-top" href="#" class="back-to-top">
|
||||
<span class="ti-angle-up"></span>
|
||||
</a>
|
||||
<!-- /Back to Top -->
|
||||
<%@ include file="../../static/foot.jsp" %>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/vue.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.ui.widget.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery.form.js"></script>
|
||||
|
||||
<script>
|
||||
<%@ include file="../../utils/menu.jsp"%>
|
||||
<%@ include file="../../static/setMenu.js"%>
|
||||
<%@ include file="../../utils/baseUrl.jsp"%>
|
||||
|
||||
var tableName = "dictionary";
|
||||
var pageType = "add-or-update";
|
||||
var updateId = "";
|
||||
|
||||
|
||||
var ruleForm = {};
|
||||
var vm = new Vue({
|
||||
el: '#addOrUpdateForm',
|
||||
data: {
|
||||
ruleForm: {},
|
||||
},
|
||||
beforeCreate: function () {
|
||||
var id = window.sessionStorage.getItem("updateId");
|
||||
if (id != null && id != "" && id != "null") {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseUrl + "dictionary/info/" + id,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage.getItem('token'));
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
vm.ruleForm = res.data;
|
||||
ruleForm = res.data;
|
||||
showImg();
|
||||
setContent();
|
||||
} else if (res.code == 401) {
|
||||
<%@ include file="../../static/toLogin.jsp"%>
|
||||
} else {
|
||||
alert(res.msg)
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
});
|
||||
|
||||
|
||||
// 填充富文本框
|
||||
function setContent() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//图片显示
|
||||
function showImg() {
|
||||
}
|
||||
|
||||
function exit() {
|
||||
window.sessionStorage.removeItem("updateId");
|
||||
window.sessionStorage.removeItem('adddictionary');
|
||||
window.location.href = "list.jsp";
|
||||
}
|
||||
|
||||
// 下载
|
||||
function download(fileName) {
|
||||
var url = baseUrl+'file/download?fileName='+fileName;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
//设置下载
|
||||
function setDownloadBtn() {
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
//设置右上角用户名
|
||||
$('.dropdown-menu h5').html(window.sessionStorage.getItem('username'))
|
||||
//设置项目名
|
||||
$('.sidebar-header h3 a').html(projectName)
|
||||
setMenu();
|
||||
$('#exitBtn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
exit();
|
||||
});
|
||||
|
||||
|
||||
<%@ include file="../../static/myInfo.js"%>
|
||||
});
|
||||
// 用户登出
|
||||
<%@ include file="../../static/logout.jsp"%>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,26 @@
|
||||
function crossBtnControl(btnName){
|
||||
var role = window.sessionStorage.getItem('role');
|
||||
|
||||
for(var i=0;i<menus.length;i++){
|
||||
// 找到当前登录角色的菜单
|
||||
if(menus[i].roleName == role){
|
||||
var menu = menus[i].backMenu;
|
||||
for(var j=0;j<menu.length;j++){
|
||||
// 一级菜单
|
||||
var menuChild = menu[j].child;
|
||||
var secondMenuName = "";
|
||||
for(var k=0;k<menuChild.length;k++){
|
||||
//定位到当前list页
|
||||
if(menuChild[k].tableName == tableName && k == 0){
|
||||
var allButtons = menuChild[k].buttons;
|
||||
if(allButtons.includes(btnName)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!-- Jquery Library-->
|
||||
<script src="${pageContext.request.contextPath}/resources/js/jquery-3.2.1.min.js"></script>
|
||||
<!-- Popper Library-->
|
||||
<script src="${pageContext.request.contextPath}/resources/js/popper.min.js"></script>
|
||||
<!-- Bootstrap Library-->
|
||||
<script src="${pageContext.request.contextPath}/resources/js/bootstrap.min.js"></script>
|
||||
<!-- Datatable -->
|
||||
<script src="${pageContext.request.contextPath}/resources/datatable/jquery.dataTables.min.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/resources/datatable/dataTables.bootstrap4.min.js"></script>
|
||||
<!-- Custom Script-->
|
||||
<script src="${pageContext.request.contextPath}/resources/js/custom.js"></script>
|
@ -0,0 +1,25 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>校园快递一站式服务系统</title>
|
||||
<!-- Fav Icon Link -->
|
||||
<link rel="shortcut icon" type="image/png" href="${pageContext.request.contextPath}/resources/images/fav.png">
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css">
|
||||
<!-- themify icons CSS -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/themify-icons.css">
|
||||
<!-- Animations CSS -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/animate.css">
|
||||
<!-- Main CSS -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/styles.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/green.css" id="style_theme">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/responsive.css">
|
||||
<!-- morris charts -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/charts/css/morris.css">
|
||||
<!-- jvectormap -->
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/jquery-jvectormap.css">
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/datatable/dataTables.bootstrap4.min.css">
|
||||
|
||||
<script src="${pageContext.request.contextPath}/resources/js/modernizr.min.js"></script>
|
@ -0,0 +1,22 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
function logout() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseUrl + "users/logout",
|
||||
beforeSend: function(xhr) {
|
||||
xhr.setRequestHeader("token", window.sessionStorage.getItem('token'));
|
||||
},
|
||||
success: function(res){
|
||||
if(res.code == 0 || res.code == 401){
|
||||
window.sessionStorage.clear();
|
||||
window.location.href="${pageContext.request.contextPath}/jsp/login.jsp"
|
||||
}else{
|
||||
alert(res.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
function toFront() {
|
||||
window.location.assign(baseUrl+'front');
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!-- token过期或未登录时强制跳转到登录页 -->
|
||||
alert('token过期或未登录!')
|
||||
window.location.href="${pageContext.request.contextPath}/jsp/login.jsp"
|
@ -0,0 +1,69 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
var baseUrl = "http://localhost:8080/kuaidizhan/";
|
||||
var projectName = "校园快递一站式服务系统"
|
||||
|
||||
/**
|
||||
* 网络请求
|
||||
* @param {Object} url 地址
|
||||
* @param {Object} method get/post
|
||||
* @param {Object} param 参数
|
||||
* @param {Object} callback 回调函数
|
||||
*/
|
||||
function http(url, type, data, callback) {
|
||||
url = baseUrl + url;
|
||||
$.ajax({
|
||||
url: url,
|
||||
beforeSend: function(request) {
|
||||
request.setRequestHeader("token", window.sessionStorage.getItem("token"));
|
||||
},
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
type: type,
|
||||
async: false,
|
||||
success: function(result, status, xhr) {
|
||||
if (result.code == 0) {
|
||||
callback(result);
|
||||
} else if (result.code == 401) {
|
||||
window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp';
|
||||
} else {
|
||||
alert(result.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(xhr, status, error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function httpJson(url, type, data, callback) {
|
||||
url = baseUrl + url;
|
||||
var params = null;
|
||||
if (data) {
|
||||
var params = JSON.stringify(data);
|
||||
}
|
||||
$.ajax({
|
||||
url: url,
|
||||
beforeSend: function(request) {
|
||||
request.setRequestHeader("token", window.sessionStorage.getItem("token"));
|
||||
},
|
||||
contentType: 'application/json',
|
||||
data: params,
|
||||
dataType: 'json',
|
||||
type: type,
|
||||
async: false,
|
||||
success: function(result, status, xhr) {
|
||||
if (result.code == 0) {
|
||||
callback(result);
|
||||
} else if (result.code == 401) {
|
||||
window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp';
|
||||
} else {
|
||||
alert(result.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(xhr, status, error)
|
||||
}
|
||||
});
|
||||
}
|
@ -0,0 +1,219 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
var menus = [
|
||||
{
|
||||
"backMenu":[
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
"新增",
|
||||
"修改",
|
||||
"删除",
|
||||
],
|
||||
"menu":"用户管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"yonghu"
|
||||
}
|
||||
],
|
||||
"menu":"用户管理"
|
||||
}
|
||||
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
"新增",
|
||||
"修改",
|
||||
"删除",
|
||||
],
|
||||
"menu":"代取人管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"daiquren"
|
||||
}
|
||||
],
|
||||
"menu":"代取人管理"
|
||||
},
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
"新增",
|
||||
"修改",
|
||||
"删除",
|
||||
],
|
||||
"menu":"快递站点管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"zhandian"
|
||||
}
|
||||
],
|
||||
"menu":"快递站点管理"
|
||||
},
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"新增",
|
||||
"修改",
|
||||
"删除",
|
||||
],
|
||||
"menu":"待取件表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"daiqu"
|
||||
}
|
||||
],
|
||||
"menu":"待取件表管理"
|
||||
}
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"新增",
|
||||
"删除",
|
||||
],
|
||||
"menu":"快递接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"jiedan"
|
||||
}
|
||||
],
|
||||
"menu":"快递接单表管理"
|
||||
}
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
"删除",
|
||||
],
|
||||
"menu":"已接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"yijiedan"
|
||||
}
|
||||
],
|
||||
"menu":"已接单表管理"
|
||||
}
|
||||
],
|
||||
"frontMenu":[
|
||||
|
||||
],
|
||||
"roleName":"管理员",
|
||||
"tableName":"users"
|
||||
},
|
||||
{
|
||||
"backMenu":[
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
],
|
||||
"menu":"快递站点管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"zhandian"
|
||||
}
|
||||
],
|
||||
"menu":"快递站点管理"
|
||||
},
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"接单",
|
||||
],
|
||||
"menu":"快递接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"jiedan"
|
||||
}
|
||||
],
|
||||
"menu":"快递接单表管理"
|
||||
}
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
],
|
||||
"menu":"已接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"yijiedan"
|
||||
}
|
||||
],
|
||||
"menu":"已接单表管理"
|
||||
}
|
||||
],
|
||||
"frontMenu":[
|
||||
|
||||
],
|
||||
"roleName":"代取人",
|
||||
"tableName":"daiquren"
|
||||
},
|
||||
{
|
||||
"backMenu":[
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
|
||||
],
|
||||
"menu":"快递站点管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"zhandian"
|
||||
}
|
||||
],
|
||||
"menu":"快递站点管理"
|
||||
},
|
||||
{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"取件",
|
||||
"发布订单",
|
||||
],
|
||||
"menu":"待取件表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"daiqu"
|
||||
}
|
||||
],
|
||||
"menu":"待取件表管理"
|
||||
}
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"寄件",
|
||||
],
|
||||
"menu":"快递接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"jiedan"
|
||||
}
|
||||
],
|
||||
"menu":"快递接单表管理"
|
||||
}
|
||||
,{
|
||||
"child":[
|
||||
{
|
||||
"buttons":[
|
||||
"查看",
|
||||
"完成",
|
||||
],
|
||||
"menu":"已接单表管理",
|
||||
"menuJump":"列表",
|
||||
"tableName":"yijiedan"
|
||||
}
|
||||
],
|
||||
"menu":"已接单表管理"
|
||||
}
|
||||
],
|
||||
"frontMenu":[
|
||||
|
||||
],
|
||||
"roleName":"用户",
|
||||
"tableName":"yonghu"
|
||||
}
|
||||
];
|
||||
|
||||
var hasMessage = '';
|
Loading…
Reference in new issue