Commit da21280b authored by ms-dev's avatar ms-dev
Browse files

配置文件更新

parent 33bb27de
...@@ -7,15 +7,13 @@ import org.springframework.boot.web.servlet.ServletComponentScan; ...@@ -7,15 +7,13 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication @SpringBootApplication
@ComponentScan(basePackages = {"com.mingsoft","net.mingsoft"}) @ComponentScan(basePackages = {"net.mingsoft"})
@MapperScan(basePackages={"**.dao"}) @MapperScan(basePackages={"**.dao"})
@ServletComponentScan(basePackages = {"com.mingsoft","net.mingsoft"}) @ServletComponentScan(basePackages = {"net.mingsoft"})
public class MSApplication { public class MSApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(MSApplication.class, args); SpringApplication.run(MSApplication.class, args);
} }
} }
\ No newline at end of file
\ No newline at end of file
package net.mingsoft;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import net.mingsoft.basic.action.BaseAction;
@Controller
@RequestMapping("/")
public class Test {
/**
* 加载管理员登录界面
*
* @param request
* 请求对象
* @return 管理员登录界面地址
*/
@SuppressWarnings("resource")
@RequestMapping("/a")
public String login(HttpServletRequest request) {
return "/login";
}
}
package net.mingsoft.config;
import net.sf.ehcache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
@Configuration
@EnableCaching
public class EhCacheConfig {
/**
* EhCache的配置
*/
@Bean
public EhCacheCacheManager cacheManager(CacheManager cacheManager) {
return new EhCacheCacheManager(cacheManager);
}
/**
* EhCache的配置
*/
@Bean
public EhCacheManagerFactoryBean ehcache() {
EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
return ehCacheManagerFactoryBean;
}
}
package net.mingsoft.config;
import java.io.IOException;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.TemplateException;
@Configuration
public class FreemarkerConfig {
@Autowired
protected freemarker.template.Configuration configuration;
@Autowired
protected org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer configurer;
@Autowired
protected org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver resolver;
@Autowired
protected org.springframework.web.servlet.view.InternalResourceViewResolver springResolver;
@PostConstruct
public void init() throws IOException, TemplateException {
configuration.setSharedVariable("shiro", new ShiroTags());
}
}
package net.mingsoft.config;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
import net.mingsoft.basic.configurer.ShiroTagFreeMarkderConfigurer;
import net.mingsoft.basic.security.BaseAuthRealm;
@Configuration
public class ShiroConfig {
@Value("${ms.manager.path}")
private String managerPath;
@Bean
public ShiroTagFreeMarkderConfigurer freemarkerConfig() {
return new ShiroTagFreeMarkderConfigurer();
}
@Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 拦截器.
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
// 配置不会被拦截的链接 顺序判断,因为前端模板采用了thymeleaf,这里不能直接使用 ("/static/**", "anon")来配置匿名访问,必须配置到每个静态目录
filterChainDefinitionMap.put("/static/**", "anon");
filterChainDefinitionMap.put("/html/**", "anon");
filterChainDefinitionMap.put(managerPath+"/checkLogin.do", "anon");
filterChainDefinitionMap.put(managerPath+"/login.do", "anon");
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap.put("/logout", "logout");
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
// <!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问-->
filterChainDefinitionMap.put("/**", "anon");
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
shiroFilterFactoryBean.setLoginUrl("/login");
// 登录成功后要跳转的链接
//shiroFilterFactoryBean.setSuccessUrl("/index");
// 未授权界面;
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
/**
* 凭证匹配器 (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了 )
*
* @return
*/
@Bean
public HashedCredentialsMatcher hashedCredentialsMatcher() {
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
hashedCredentialsMatcher.setHashAlgorithmName("md5");// 散列算法:这里使用MD5算法;
hashedCredentialsMatcher.setHashIterations(2);// 散列的次数,比如散列两次,相当于
// md5(md5(""));
return hashedCredentialsMatcher;
}
@Bean
public BaseAuthRealm myShiroRealm() {
BaseAuthRealm myShiroRealm = new BaseAuthRealm();
myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
return myShiroRealm;
}
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(myShiroRealm());
return securityManager;
}
/**
* 开启shiro aop注解支持. 使用代理方式;所以需要开启代码支持;
*
* @param securityManager
* @return
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean(name = "simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
Properties mappings = new Properties();
mappings.setProperty("DatabaseException", "databaseError");// 数据库异常处理
mappings.setProperty("UnauthorizedException", "/user/403");
r.setExceptionMappings(mappings); // None by default
r.setDefaultErrorView("error"); // No default
r.setExceptionAttribute("exception"); // Default is "exception"
// r.setWarnLogCategory("example.MvcLogger"); // No default
return r;
}
}
\ No newline at end of file
package net.mingsoft.config;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import net.mingsoft.basic.security.BaseAuthRealm;
import org.apache.shiro.mgt.SecurityManager;
@Configuration
public class ShiroConfiguration {
@Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 必须设置 SecurityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// setLoginUrl 如果不设置值,默认会自动寻找Web工程根目录下的"/login.jsp"页面 或 "/login" 映射
shiroFilterFactoryBean.setLoginUrl("/notLogin");
// 设置无权限时跳转的 url;
shiroFilterFactoryBean.setUnauthorizedUrl("/notRole");
// 设置拦截器
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
//游客,开发权限
filterChainDefinitionMap.put("/guest/**", "anon");
//用户,需要角色权限 “user”
filterChainDefinitionMap.put("/user/**", "roles[user]");
//管理员,需要角色权限 “admin”
filterChainDefinitionMap.put("/admin/**", "roles[admin]");
//开放登陆接口
filterChainDefinitionMap.put("/ms/login.do", "anon");
filterChainDefinitionMap.put("/ms/checkLogin.do", "anon");
//其余接口一律拦截
//主要这行代码必须放在所有权限设置的最后,不然会导致所有 url 都被拦截
filterChainDefinitionMap.put("/**", "anon");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
/**
* 注入 securityManager
*/
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
// 设置realm.
securityManager.setRealm(customRealm());
return securityManager;
}
/**
* 自定义身份认证 realm;
* <p>
* 必须写这个类,并加上 @Bean 注解,目的是注入 CustomRealm,
* 否则会影响 CustomRealm类 中其他类的依赖注入
*/
@Bean
public BaseAuthRealm customRealm() {
return new BaseAuthRealm();
}
}
\ No newline at end of file
...@@ -3,4 +3,5 @@ spring: ...@@ -3,4 +3,5 @@ spring:
url: jdbc:mysql://127.0.0.1:3306/db-mcms-4-6-1?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false url: jdbc:mysql://127.0.0.1:3306/db-mcms-4-6-1?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root username: root
password: root password: root
filters: wall,mergeStat filters: wall,mergeStat
\ No newline at end of file type: com.alibaba.druid.pool.DruidDataSource
\ No newline at end of file
...@@ -2,23 +2,6 @@ server: ...@@ -2,23 +2,6 @@ server:
port: 8081 port: 8081
tomcat: tomcat:
max-http-header-size: 10240 #单位:字节 max-http-header-size: 10240 #单位:字节
ms:
manager:
path: ms
view:
path: /WEB-INF/manager
session:
timeout: 1800000 #会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
validation.interval: 120000 #会话清理间隔时间, 单位:毫秒,2m=120000ms
upload:
path: /upload
denied: exe
allowed: jpg
max:
size: 1
memory:
size: 4096
spring: spring:
profiles: profiles:
active: dev active: dev
...@@ -68,5 +51,20 @@ logging: ...@@ -68,5 +51,20 @@ logging:
#分包配置级别,即不同的目录下可以使用不同的级别 #分包配置级别,即不同的目录下可以使用不同的级别
net.mingsoft: trace net.mingsoft: trace
com.mingsoft: trace com.mingsoft: trace
ms:
manager:
path: /ms
view: #已过期
path:
session:
timeout: 1800000 #会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
validation.interval: 120000 #会话清理间隔时间, 单位:毫秒,2m=120000ms
upload:
path: /upload
denied: exe
allowed: jpg
max:
size: 1
memory:
size: 4096
\ No newline at end of file
<@ms.html5>
<@ms.nav title="应用设置">
<@shiro.hasPermission name="app:update"><@ms.saveButton title="" postForm="appForm"/></@shiro.hasPermission>
</@ms.nav>
<@ms.panel>
<@ms.form isvalidation=true name="appForm" action="${managerPath}/app/update.do">
<@ms.hidden name="appId" value="${app.appId?default(0)}" />
<@ms.text name="appName" width="500" label="网站标题" value="${app.appName?default('')}" title="网站标题" placeholder="请输入网站标题" validation={"maxlength":"50","required":"true", "data-bv-notempty-message":"必填项目","data-bv-stringlength-message":"网站标题在50个字符以内!"}/>
<!--网站Logo,暂时不兼容-->
<@ms.formRow label="网站Logo" help="提示:文章缩略图,支持jpg,png格式">
<@ms.uploadImg path="app" inputName="appLogo" size="1" maxSize="1" imgs="${app.appLogo!('')}"/>
</@ms.formRow>
<@ms.checkbox name="appMobileStyle" width="200" list=[{"id":"m","value":"启用"}] listKey="id" listValue="value" valueList=["${app.appMobileStyle!('')}"] label="启用移动端"
help="启用后手机用户访问网站会显示手机版网页,前提是网站必需提供移动端皮肤,相关教程:<a href='http://ms.ming-soft.com/mbbs/13086/detail.do' target='_blank'>铭飞移动端开发教程</a>"/>
<@ms.select name="appStyle" width="300" id="appStyle" label="模板风格" />
<@ms.textarea name="appKeyword" label="关键字" value="${app.appKeyword?default('')}" rows="4" placeholder="请输入关键字"/>
<@ms.textarea name="appDescription" label="描述" value="${app.appDescription?default('')}" rows="4" placeholder="请输入站点描述"/>
<@ms.textarea name="appCopyright" label="版权信息" value="${app.appCopyright?default('')}" rows="4" placeholder="请输入版权信息"/>
</@ms.form>
</@ms.panel>
</@ms.html5>
<script>
$(function(){
<#if app.appId != 0>
ms.get("${managerPath}/template/queryAppTemplateSkin.do",null,function(msg){
if(msg.fileName != null && msg.fileName.length != 0){
//清空默认信息
$("#appStyle").html("");
for(var i=0; i<msg.fileName.length; i++){
if ("${app.appStyle?default('')}"==msg.fileName[i]) {
$("#appStyle").append("<option value="+msg.fileName[i]+" selected>"+msg.fileName[i]+"</option>")
} else {
$("#appStyle").append("<option value="+msg.fileName[i]+">"+msg.fileName[i]+"</option>")
}
}
}else{
$(".appStyle").append("<option>暂无模版</option>");
}
});
</#if>
});
</script>
\ No newline at end of file
<@ms.html5>
<@ms.nav title="基础内容更新">
<@ms.saveButton postForm="basicForm"/>
</@ms.nav>
<@ms.panel>
<#assign basicTitle="">
<#assign basicId="0">
<#assign basicDescription="">
<#assign action="${managerPath}/basic/save.do">
<#if basic?has_content>
<#assign basicTitle="${basic.basicTitle?default('')}">
<#assign basicDescription="${basic.basicDescription?default('')}">
<#assign basicId="${basic.basicId}">
<#assign action="${managerPath}/basic/update.do">
</#if>
<@ms.form action="${action}" name="basicForm" redirect="${managerPath}/basic/${categoryId?default('0')}/list.do">
<@ms.hidden name="basicId" value="${basicId?default('')}"/>
<@ms.hidden name="basicCategoryId" value="${categoryId?default('0')}"/>
<@ms.text label="标题" name="basicTitle" value="${basicTitle?default('')}" size="33" style="width:40%" maxlength="120" />
<@ms.textarea label="描述" name="basicDescription" value="${basicDescription?default('')}" cols="110" rows="5" maxlength="1000" />
</@ms.form>
</@ms.panel>
</@ms.html5>
\ No newline at end of file
<@ms.html5>
<@ms.nav title="基础内容管理"></@ms.nav>
<@ms.panel>
<@ms.searchForm name="basicForm" action="${managerPath}/basic/${categoryId?default(0)}/list.do">
<@ms.text label="关键字" name="keyword" placeholder="输入关键字" value="${keyword?default('')}"/>
<@ms.searchFormButton>
<@ms.queryButton form="basicForm"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panelNav>
<@ms.addButton url="${managerPath}/basic/add.do?categoryId=${categoryId?default(0)}&categoryTitle=${categoryTitle?default(0)}"/>
<@ms.delButton fieldName="basicId" onclick="remove"/>
</@ms.panelNav>
<@ms.table head=['编号,100',"标题"]
filed=["basicId","basicTitle"]
listItem="basicList"
id="basicId"
checkbox="basicId"
editField=["basicTitle"]
editJs="edit"
/>
<#if page?has_content>
<@ms.showPage page=page/>
</#if>
</@ms.panel>
</@ms.html5>
<script>
function edit(id) {
location.href = base+"${baseManager}/basic/"+id+"/edit.do";
}
function remove(ids) {
ms.post("${managerPath}/basic/allDelete.do","basicIds="+ids,function(msg){
if(msg.result){
location.reload();
}
});
}
</script>
<@ms.html5>
<@ms.nav title="省市县镇村数据编辑" back=true>
<@ms.saveButton onclick="save()"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="cityForm" isvalidation=true>
<@ms.hidden name="id" value="${cityEntity.id?default('')}"/>
</@ms.form>
</@ms.panel>
</@ms.html5>
<script>
var url = "${managerPath}/basic/city/save.do";
if($("input[name = 'id']").val() > 0){
url = "${managerPath}/basic/city/update.do";
$(".btn-success").text("更新");
}
//编辑按钮onclick
function save() {
$("#cityForm").data("bootstrapValidator").validate();
var isValid = $("#cityForm").data("bootstrapValidator").isValid();
if(!isValid) {
<@ms.notify msg= "数据提交失败,请检查数据格式!" type= "warning" />
return;
}
var btnWord =$(".btn-success").text();
$(".btn-success").text(btnWord+"中...");
$(".btn-success").prop("disabled",true);
$.ajax({
type:"post",
dataType:"json",
data:$("form[name = 'cityForm']").serialize(),
url:url,
success: function(status) {
if(status.result == true) {
<@ms.notify msg="保存或更新成功" type= "success" />
location.href = "${managerPath}/basic/city/index.do";
}
else{
<@ms.notify msg= "保存或更新失败!" type= "danger" />
location.href= "${managerPath}/basic/city/index.do";
}
}
})
}
</script>
<@ms.html5>
<@ms.nav title="省市县镇村数据管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.text label="省" name="provinceName" value="" width="240px;" placeholder="请输入省/直辖市/自治区级名称" />
<@ms.text label="市" name="cityName" value="" width="240px;" placeholder="请输入市级名称" />
<@ms.text label="县" name="countyName" value="" width="240px;" placeholder="请输入县/区级名称" />
<@ms.text label="镇" name="townName" value="" width="240px;" placeholder="请输入街道/镇级名称" />
<@ms.text label="村" name="villageName" value="" width="240px;" placeholder="请输入村委会名称" />
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="cityList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delCity" title="授权数据删除" >
<@ms.modalBody>删除此授权
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认删除?" id="deleteCityBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@ms.html5>
<script>
$(function(){
$("#cityList").bootstrapTable({
url:"${managerPath}/basic/city/list.do",
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
toolbar: "#toolbar",
columns: [{ checkbox: true},
{
field: 'provinceName',
title: '省/直辖市/自治区级名称',
align: 'center'
},{
field: 'cityName',
title: '市级名称',
align: 'center'
},{
field: 'countyName',
title: '县/区级名称',
align: 'center'
},{
field: 'townName',
title: '街道/镇级名称',
align: 'center'
},{
field: 'villageName',
title: '村委会名称',
align: 'center'
}]
})
})
//增加按钮
$("#addCityBtn").click(function(){
location.href ="${managerPath}/basic/city/form.do";
})
//删除按钮
$("#delCityBtn").click(function(){
//获取checkbox选中的数据
var rows = $("#cityList").bootstrapTable("getSelections");
//没有选中checkbox
if(rows.length <= 0){
<@ms.notify msg="请选择需要删除的记录" type="warning"/>
}else{
$(".delCity").modal();
}
})
$("#deleteCityBtn").click(function(){
var rows = $("#cityList").bootstrapTable("getSelections");
$(this).text("正在删除...");
$(this).attr("disabled","true");
$.ajax({
type: "post",
url: "${managerPath}/basic/city/delete.do",
data: JSON.stringify(rows),
dataType: "json",
contentType: "application/json",
success:function(msg) {
if(msg.result == true) {
<@ms.notify msg= "删除成功" type= "success" />
}else {
<@ms.notify msg= "删除失败" type= "danger" />
}
location.reload();
}
})
});
//查询功能
function search(){
var search = $("form[name='searchForm']").serializeJSON();
var params = $('#cityList').bootstrapTable('getOptions');
params.queryParams = function(params) {
$.extend(params,search);
return params;
}
$("#cityList").bootstrapTable('refresh', {query:$("form[name='searchForm']").serializeJSON()});
}
</script>
\ No newline at end of file
<@ms.html5>
<@ms.nav title="基础文件表编辑" back=true>
<#if fileEntity.id??>
<@ms.updateButton onclick="saveOrUpdate()"/>
<#else>
<@ms.saveButton onclick="saveOrUpdate()"/>
</#if>
</@ms.nav>
<@ms.panel>
<@ms.form name="fileForm" isvalidation=true>
<@ms.hidden name="id" value="${(fileEntity.id)?default('')}"/>
<@ms.text label="文件分类编号" name="categoryId" value="${(fileEntity.categoryId)?default('')}" width="240px;" placeholder="请输入文件分类编号" validation={"data-bv-between":"true","required":"true", "data-bv-between-message":"文件分类编号必须大于0小于9999999999","data-bv-between-min":"0", "data-bv-between-max":"9999999999","data-bv-notempty-message":"必填项目"}/>
<@ms.text label="文件名称" name="fileName" value="${(fileEntity.fileName)?default('')}" width="240px;" placeholder="请输入文件名称" validation={"required":"true","maxlength":"50","data-bv-stringlength-message":"文件名称长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="文件链接" name="fileUrl" value="${(fileEntity.fileUrl)?default('')}" width="240px;" placeholder="请输入文件链接" validation={"required":"true","maxlength":"50","data-bv-stringlength-message":"文件链接长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="文件大小" name="fileSize" value="${(fileEntity.fileSize)?default('')}" width="240px;" placeholder="请输入文件大小" validation={"data-bv-between":"true","required":"true", "data-bv-between-message":"文件大小必须大于0小于9999999999","data-bv-between-min":"0", "data-bv-between-max":"9999999999","data-bv-notempty-message":"必填项目"}/>
<@ms.text label="文件详情Json数据" name="fileJson" value="${(fileEntity.fileJson)?default('')}" width="240px;" placeholder="请输入文件详情Json数据" validation={"required":"true","maxlength":"50","data-bv-stringlength-message":"文件详情Json数据长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="文件类型:图片、音频、视频等" name="fileType" value="${(fileEntity.fileType)?default('')}" width="240px;" placeholder="请输入文件类型:图片、音频、视频等" validation={"required":"true","maxlength":"50","data-bv-stringlength-message":"文件类型:图片、音频、视频等长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="子业务" name="isChild" value="${(fileEntity.isChild)?default('')}" width="240px;" placeholder="请输入子业务" validation={"required":"true","maxlength":"50","data-bv-stringlength-message":"子业务长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
</@ms.form>
</@ms.panel>
</@ms.html5>
<script>
var logoClass = "glyphicon-floppy-saved";
var url = "${managerPath}/basic/file/save.do";
if($("input[name = 'id']").val() > 0){
logoClass = "glyphicon-open";
url = "${managerPath}/basic/file/update.do";
}
//编辑按钮onclick
function saveOrUpdate() {
$("#fileForm").data("bootstrapValidator").validate();
var isValid = $("#fileForm").data("bootstrapValidator").isValid();
if(!isValid) {
<@ms.notify msg= "数据提交失败,请检查数据格式!" type= "warning" />
return;
}
var btnWord =$(".btn-success").text();
$(".btn-success").text(btnWord+"中...");
$(".btn-success").prop("disabled",true);
$.ajax({
type:"post",
dataType:"json",
data:$("form[name = 'fileForm']").serialize(),
url:url,
success: function(data) {
if(data.id > 0) {
<@ms.notify msg="保存或更新成功" type= "success" />
location.href = "${managerPath}/basic/file/index.do";
}
else{
$(".btn-success").html(btnWord+"<span class='glyphicon " + logoClass + "' style='margin-right:5px'></span>");
$(".btn-success").text(btnWord);
$(".btn-success").removeAttr("disabled");
$('.ms-notifications').offset({top:43}).notify({
type:'danger',
message: { text:data.resultMsg }
}).show();
}
}
})
}
</script>
<@ms.html5>
<@ms.nav title="基础文件表管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNavBtnGroup>
<@shiro.hasPermission name="file:save"><@ms.panelNavBtnAdd id="addFileBtn" title=""/></@shiro.hasPermission>
<@shiro.hasPermission name="file:del"><@ms.panelNavBtnDel id="delFileBtn" title=""/></@shiro.hasPermission>
</@ms.panelNavBtnGroup>
</div>
<table id="fileList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delFile" title="基础文件表数据删除" >
<@ms.modalBody>删除此基础文件表
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认" class="btn btn-danger rightDelete" id="deleteFileBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@ms.html5>
<script>
$(function(){
$("#fileList").bootstrapTable({
url:"${managerPath}/basic/file/list.do",
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
toolbar: "#toolbar",
columns: [{ checkbox: true},
{
field: 'id',
title: '文件编号',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'categoryId',
title: '文件分类编号',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'appId',
title: 'APP编号',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'fileName',
title: '文件名称',
width:'200',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'fileUrl',
title: '文件链接',
width:'500',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'fileSize',
title: '文件大小',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'fileJson',
title: '文件详情Json数据',
width:'500',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'fileType',
title: '文件类型:图片、音频、视频等',
width:'50',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'isChild',
title: '子业务',
width:'50',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'updateDate',
title: '更新时间',
width:'0',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'updateBy',
title: '更新者',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'createBy',
title: '创建者',
width:'11',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'createDate',
title: '创建时间',
width:'0',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
},
{
field: 'del',
title: '删除标记',
width:'1',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/file/form.do?id="+row.id;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
}
]
})
})
//增加按钮
$("#addFileBtn").click(function(){
location.href ="${managerPath}/basic/file/form.do";
})
//删除按钮
$("#delFileBtn").click(function(){
//获取checkbox选中的数据
var rows = $("#fileList").bootstrapTable("getSelections");
//没有选中checkbox
if(rows.length <= 0){
<@ms.notify msg="请选择需要删除的记录" type="warning"/>
}else{
$(".delFile").modal();
}
})
$("#deleteFileBtn").click(function(){
var rows = $("#fileList").bootstrapTable("getSelections");
$(this).text("正在删除...");
$(this).attr("disabled","true");
$.ajax({
type: "post",
url: "${managerPath}/basic/file/delete.do",
data: JSON.stringify(rows),
dataType: "json",
contentType: "application/json",
success:function(msg) {
if(msg.result == true) {
<@ms.notify msg= "删除成功" type= "success" />
}else {
<@ms.notify msg= "删除失败" type= "danger" />
}
location.reload();
}
})
});
//查询功能
function search(){
var search = $("form[name='searchForm']").serializeJSON();
var params = $('#fileList').bootstrapTable('getOptions');
params.queryParams = function(params) {
$.extend(params,search);
return params;
}
$("#fileList").bootstrapTable('refresh', {query:$("form[name='searchForm']").serializeJSON()});
}
</script>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<#include "${managerViewPath}/include/meta.ftl"/> <!--调用head内样式信息-->
<script type="text/javascript" src="${base}/jquery/zTree_v3/jquery.ztree.all-3.5.min.js"></script>
<link rel="stylesheet" href="${base}/jquery/zTree_v3/zTreeStyle.css" type="text/css">
</head>
<style>
.container{margin:0;padding:0;width:auto}
hr{margin-top:9px;margin-bottom:9px;padding:0;}
.rowpadding3{padding-bottom: 3px;}
.ms-button-group{padding:0px 0px 8px 0px}
.row {margin-left:0;margin-right:0}
.form-horizontal .form-group{margin-left:0;margin-right:0}
.form-group{overflow: hidden;}
.bs-example>.dropdown>.dropdown-menu {position: static;margin-bottom: 5px;clear: left;}
.bs-example>.dropdown>.dropdown-toggle {float: left;}
.padding-zero{padding:0;}
.link-style a:hover{color:#000;}
.link-style a:visited{color:#000;}
.form-inline .form-group {display: inline-block;margin-bottom: 0;vertical-align: middle;}
#tableArticle .updateArticle {cursor: pointer;}
#menuBtn{margin:0}
#menuContent {
overflow: auto;
max-height: 240px;
display: none;
z-index: 999;
position: absolute;
float: left;
padding: 5px 0;
margin: 2px 0 0;
background-color: #ffffff;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
}
select, option,#menuBtn{
cursor: pointer;
background: white;
}
.selColumn{min-width:173px; height:34px;}
.categoryTree{border-right:1px solid #eeeeee;padding:0;}
</style>
<script>
</script>
<body>
<!----------------------------------- bootstarp 布局容器 开始-------------------------------->
<div class="container-fluid link-style">
<div class="row">
<div class="col-md-2 categoryTree">
<ul id="categoryTree" class="ztree" style="margin-top:0; width:100%;margin-left:-9px">
</div>
<!--右侧内容编辑区域开始-->
<div class="col-md-10" style="margin-top:0;padding:0;margin:0">
<!--------内容 部分 开始-------->
<div class="row" style="margin-top:0; width:100%;;padding:0 0 0 10px;margin:0">
<iframe src="${managerPath}/basic/0/list.do" style="width:100%;maring:0;padding:0;border:none;height:100%" id="listFrame" target="listFrame" ></iframe>
</div>
<!--内容部分结束-->
</div>
<!--右侧内容编辑区域结束-->
</div>
</div>
<!--引用弹出框插件-->
<@warnModal modalName="Model"/>
<!--JQ特效部分-->
<script>
$(function(){
$(".categoryTree").height($(document).height());
$("#listFrame").height($(document).height());
//zTree框架
var setting = {
callback: {
onClick: function(event, treeId, treeNode) {
if(treeNode.id>0) {
$("#listFrame").attr("src","${managerPath}/basic/"+treeNode.id+"/list.do?categoryTitle="+encodeURIComponent(treeNode.name));
}
}
},
view: {
dblClickExpand: dblClickExpand
},
data: {
simpleData: {
enable: true
}
}
};
function dblClickExpand(treeId, treeNode) {
return treeNode.level > 0;
}
$(document).ready(function(){
$.fn.zTree.init($("#categoryTree"), setting, zNodes);
});
//获取栏目节点列表
var listColumn=${listCategory};
var zNodes = new Array();
//遍历节点,添加到数字中
for( var i = 0 ; i < listColumn.length; i++){
zNodes[i] = { id:listColumn[i].categoryId, pId:listColumn[i].categoryCategoryId,name:listColumn[i].categoryTitle, open:false};
}
});
</script>
</body>
</html>
<@ms.html5>
<@ms.nav title="管理员管理"></@ms.nav>
<style>
.select2-container .select2-container--default {
height: 34px;
}
.select2-container .select2-selection--single{
font: inherit;
border: 1px solid #ccc;
display: block;
height: 34px;
padding: 0px 3px;
font-size: 14px;
color: rgb(85, 85, 85);
}
</style>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@shiro.hasPermission name="manager:save"><@ms.panelNavBtnAdd title="" id="addManagerBtn"/></@shiro.hasPermission>
<@shiro.hasPermission name="manager:del"><@ms.panelNavBtnDel title="" id="delManagerBtn"/></@shiro.hasPermission>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="managerList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delManager" title="管理员删除" >
<@ms.modalBody>删除此管理员
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="删除" class="btn btn-danger rightDelete" id="deleteManagerBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
<@ms.modal id="addManager" title="管理员编辑" resetFrom=true>
<@ms.modalBody>
<@ms.form name="managerForm" isvalidation=true action="${managerPath}/basic/manager/save.do" redirect="${managerPath}/basic/manager/index.do">
<@ms.hidden name="managerId" value="0"/>
<@ms.text label="管理员名" name="managerName" value="" width="240px;" placeholder="请输入管理员名" validation={"required":"true","minlength":"3","maxlength":"12","data-bv-stringlength-message":"管理员用户名长度为3~12个字符!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="管理员昵称" name="managerNickName" value="" width="240px;" placeholder="请输入管理员昵称" validation={"required":"true","maxlength":"15","data-bv-stringlength-message":"管理员昵称长度不能超过十五个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="管理员密码" name="managerPassword" value="" width="240px;" placeholder="请输入管理员密码" validation={"minlength":"6","maxlength":"20","data-bv-stringlength-message":"管理员密码长度为6~20个字符!"}/>
<@ms.select id="managerRoleID" name="managerRoleID" label="角色编号"/>
</@ms.form>
</@ms.modalBody>
<@ms.modalButton>
<@ms.saveButton id= "saveOrUpdate"/>
</@ms.modalButton>
</@ms.modal>
</@ms.html5>
<script>
$(function(){
//加载选择角色列表
$("#managerRoleID").request({url:"${managerPath}/basic/role/list.do",type:"json",method:"post",func:function(msg) {
var managerArr = msg.rows;
$("#managerRoleID").val(null).trigger("change");
if(managerArr.length != 0 && ($("#managerRoleID").val() == null)){
for(var i=0; i<managerArr.length; i++){
$("#managerRoleID").append($("<option>").val(managerArr[i].roleId).text(managerArr[i].roleName));
$("#managerRoleID").select2({width: "210px"}).val(managerArr[i].roleId).trigger("change");
}
} else if($("#managerRoleID").val()<0) {
$("#managerRoleID").append("<option>暂无角色</option>");
}
//使用select2插件
$("#managerRoleID").select2({width: "210px"});
}});
$("#managerList").bootstrapTable({
url:"${managerPath}/basic/manager/query.do",
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
toolbar: "#toolbar",
columns: [{ checkbox: true,
formatter: function (value, row, index){
//不能删除自己
if("${Session.manager_session.managerName}" == row.managerName){
return {disabled : true};
}
}
},{
field: 'managerName',
title: '账号',
align: 'center',
formatter:function(value,row,index) {
if(row.managerId == 0){
return value;
}else{
<@shiro.hasPermission name="manager:update">
return "<a onclick='updateSearch("+row.managerId+")' style='cursor:pointer;text-decoration:none;' >" + value + "</a>";
</@shiro.hasPermission>
<@shiro.lacksPermission name="manager:update">
return value;
</@shiro.lacksPermission>
}
}
}, {
field: 'managerNickName',
title: '昵称'
}, {
field: 'managerPassword',
title: '密码'
}, {
field: 'roleName',
title: '角色名称'
}, {
field: 'managerTime',
title: '创建时间',
align: 'center'
} ]
})
})
//增加按钮
$("#addManagerBtn").click(function(){
$('#managerForm').attr("${managerPath}/basic/manager/save.do");
$(".addManager").modal();
})
var url = "${managerPath}/basic/manager/save.do";
if($("input[name = 'managerId']").val() > 0){
url = "${managerPath}/basic/manager/update.do";
$(".btn-success").text("更新");
}
//保存按钮
$("#saveOrUpdate").click(function(){
$("#managerForm").data("bootstrapValidator").validate();
var isValid = $("#managerForm").data("bootstrapValidator").isValid();
if(!isValid) {
<@ms.notify msg= "数据提交失败,请检查数据格式!" type= "warning" />
return;
}
$(this).text("正在保存...");
$(this).attr("disabled","true");
var managerEntity = $('#managerForm').serialize();
var url = $('#managerForm').attr("action");
$.ajax({
type: "post",
url:url,
data: managerEntity,
dataType:"json",
success:function(data){
if(data.managerId > 0){
<@ms.notify msg= "保存或更新成功" type= "success" />
location.reload();
}else {
$('.ms-notifications').offset({top:43}).notify({
type:'warning',
message: { text:data.resultMsg }
}).show();
$("#saveOrUpdate").removeAttr("disabled");
$("#saveOrUpdate").text("保存");
}
}
});
})
//删除按钮
$("#delManagerBtn").click(function(){
//获取checkbox选中的数据
var rows = $("#managerList").bootstrapTable("getSelections");
//没有选中checkbox
if(rows.length <= 0){
<@ms.notify msg="请选择需要删除的记录" type="warning"/>
}else{
$(".delManager").modal();
}
})
$("#deleteManagerBtn").click(function(){
var rows = $("#managerList").bootstrapTable("getSelections");
$(this).text("正在删除...");
$(this).attr("disabled","true");
$.ajax({
type: "post",
url: "${managerPath}/basic/manager/delete.do",
data: JSON.stringify(rows),
dataType: "json",
contentType: "application/json",
success:function(msg) {
if(msg.result == true) {
<@ms.notify msg= "删除成功" type= "success" />
}else {
<@ms.notify msg= "删除失败" type= "danger" />
}
location.reload();
}
})
});
//表单赋值
function updateSearch(managerId){
$(this).request({url:"${managerPath}/basic/manager/get.do?managerId="+managerId,func:function(manager) {
if (manager.managerId > 0) {
$("#managerForm").attr("action","${managerPath}/basic/manager/update.do");
$("#managerForm input[name='managerName']").val(manager.managerName);
$("#managerForm input[name='managerId']").val(manager.managerId);
$("#managerForm input[name='managerNickName']").val(manager.managerNickName);
$("#managerRoleID").select2({width: "210px"}).val(manager.managerRoleID).trigger("change");
$("#managerForm select[name='managerRoleID']").val(manager.managerRoleID);
$("#addManager").modal();
}
}});
}
</script>
\ No newline at end of file
<@ms.html5>
<@ms.nav title="通用用户与信息一对多表编辑" back=true>
<@ms.saveButton onclick="save()"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="peopleForm" isvalidation=true>
<@ms.hidden name="bpId" value="${peopleEntity.bpId?default('')}"/>
<@ms.number label="信息编号" name="bpBasicId" value="${peopleEntity.bpBasicId?default('')}" width="240px;" placeholder="请输入信息编号" validation={"required":"false","maxlength":"50","data-bv-stringlength-message":"信息编号长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.number label="用户编号" name="bpPeopleId" value="${peopleEntity.bpPeopleId?default('')}" width="240px;" placeholder="请输入用户编号" validation={"required":"false","maxlength":"50","data-bv-stringlength-message":"用户编号长度不能超过五十个字符长度!", "data-bv-notempty-message":"必填项目"}/>
<@ms.text label="创建时间" name="bpDatetime" value="${peopleEntity.bpDatetime?string('yyyy-MM-dd')}" width="240px;"/>
</@ms.form>
</@ms.panel>
</@ms.html5>
<script>
var url = "${managerPath}/basic/people/save.do";
if($("input[name = 'bpId']").val() > 0){
url = "${managerPath}/basic/people/update.do";
$(".btn-success").text("更新");
}
//编辑按钮onclick
function save() {
$("#peopleForm").data("bootstrapValidator").validate();
var isValid = $("#peopleForm").data("bootstrapValidator").isValid();
if(!isValid) {
<@ms.notify msg= "数据提交失败,请检查数据格式!" type= "warning" />
return;
}
var btnWord =$(".btn-success").text();
$(".btn-success").text(btnWord+"中...");
$(".btn-success").prop("disabled",true);
$.ajax({
type:"post",
dataType:"json",
data:$("form[name = 'peopleForm']").serialize(),
url:url,
success: function(status) {
if(status.result == true) {
<@ms.notify msg="保存或更新成功" type= "success" />
location.href = "${managerPath}/basic/people/index.do";
}
else{
<@ms.notify msg= "保存或更新失败!" type= "danger" />
location.href= "${managerPath}/basic/people/index.do";
}
}
})
}
</script>
<@ms.html5>
<@ms.nav title="通用用户与信息一对多表管理"></@ms.nav>
<@ms.searchForm name="searchForm" isvalidation=true>
<@ms.searchFormButton>
<@ms.queryButton onclick="search()"/>
</@ms.searchFormButton>
</@ms.searchForm>
<@ms.panel>
<div id="toolbar">
<@ms.panelNav>
<@ms.buttonGroup>
<@ms.addButton id="addPeopleBtn"/>
<@ms.delButton id="delPeopleBtn"/>
</@ms.buttonGroup>
</@ms.panelNav>
</div>
<table id="peopleList"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
<@ms.modal modalName="delPeople" title="授权数据删除" >
<@ms.modalBody>删除此授权
<@ms.modalButton>
<!--模态框按钮组-->
<@ms.button value="确认删除?" id="deletePeopleBtn" />
</@ms.modalButton>
</@ms.modalBody>
</@ms.modal>
</@ms.html5>
<script>
$(function(){
$("#peopleList").bootstrapTable({
url:"${managerPath}/basic/people/list.do",
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
toolbar: "#toolbar",
columns: [{ checkbox: true},
{
field: 'bpId',
title: '',
width:'10',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/people/form.do?bpId="+row.bpId;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
}, {
field: 'bpBasicId',
title: '信息编号',
width:'10',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/people/form.do?bpBasicId="+row.bpBasicId;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
}, {
field: 'bpPeopleId',
title: '用户编号',
width:'10',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/people/form.do?bpPeopleId="+row.bpPeopleId;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
}, {
field: 'bpDatetime',
title: '创建时间',
width:'19',
align: 'center',
formatter:function(value,row,index) {
var url = "${managerPath}/basic/people/form.do?bpDatetime="+row.bpDatetime;
return "<a href=" +url+ " target='_self'>" + value + "</a>";
}
} ]
})
})
//增加按钮
$("#addPeopleBtn").click(function(){
location.href ="${managerPath}/basic/people/form.do";
})
//删除按钮
$("#delPeopleBtn").click(function(){
//获取checkbox选中的数据
var rows = $("#peopleList").bootstrapTable("getSelections");
//没有选中checkbox
if(rows.length <= 0){
<@ms.notify msg="请选择需要删除的记录" type="warning"/>
}else{
$(".delPeople").modal();
}
})
$("#deletePeopleBtn").click(function(){
var rows = $("#peopleList").bootstrapTable("getSelections");
$(this).text("正在删除...");
$(this).attr("disabled","true");
$.ajax({
type: "post",
url: "${managerPath}/basic/people/delete.do",
data: JSON.stringify(rows),
dataType: "json",
contentType: "application/json",
success:function(msg) {
if(msg.result == true) {
<@ms.notify msg= "删除成功" type= "success" />
}else {
<@ms.notify msg= "删除失败" type= "danger" />
}
location.reload();
}
})
});
//查询功能
function search(){
var search = $("form[name='searchForm']").serializeJSON();
var params = $('#peopleList').bootstrapTable('getOptions');
params.queryParams = function(params) {
$.extend(params,search);
return params;
}
$("#peopleList").bootstrapTable('refresh', {query:$("form[name='searchForm']").serializeJSON()});
}
</script>
\ No newline at end of file
<@ms.html5>
<@ms.nav title="角色设置" back=true>
<@ms.saveButton id="save"/>
</@ms.nav>
<@ms.panel>
<@ms.form name="columnForm" isvalidation=true >
<@ms.text name="roleName" label="角色名称:" title="角色名称" value="${roleEntity.roleName?default('')}" width="300" validation={"required":"true","maxlength":"30","data-bv-notempty-message":"请填写角色名称"}/>
<@ms.formRow label="权限管理:">
<div>
<table id="modelList"
data-show-export="true"
data-method="post"
data-side-pagination="server">
</table>
</div>
</@ms.formRow>
</@ms.form>
</@ms.panel>
</@ms.html5>
<script>
$(function(){
//数据初始化
$("#modelList").bootstrapTable({
url:"${managerPath}/model/modelList.do?roleId=${roleEntity.roleId?default('')}",
contentType : "application/x-www-form-urlencoded",
queryParamsType : "undefined",
idField: 'modelId',
treeShowField: 'modelTitle',
parentIdField: 'modelModelId',
columns: [
{
field: 'modelTitle',
title: '模块标题',
width: '200'
},{
field: 'attribute',
title: '功能权限',
formatter:function(value,row,index) {
var attribute = "";
for(var i=0;i<row.modelChildList.length;i++){
var modelId = row.modelChildList[i].modelId;
var str = "<label style=' margin-top: 3px; margin-right: 20px;' class='ms-check'><input type='checkbox' data-ids='"+row.modelChildList[i].modelParentIds+"' value='"+modelId+"' name='attribute'/> "+row.modelChildList[i].modelTitle+"</label>"
if(row.modelChildList[i].chick == 1){
str = "<label style=' margin-top: 3px; margin-right: 20px;' class='ms-check'><input type='checkbox' checked='checked' data-ids='"+row.modelChildList[i].modelParentIds+"' value='"+modelId+"' name='attribute'/> "+ row.modelChildList[i].modelTitle+"</label>";
}
if(attribute == ""){
attribute = str;
}else{
attribute = attribute+str;
}
}
return attribute;
}
}]
})
})
//保存操作
$("#save").click(function(){
$("#columnForm").data("bootstrapValidator").validate();
var isValid = $("#columnForm").data("bootstrapValidator").isValid();
if(!isValid) {
<@ms.notify msg= "数据提交失败,请检查数据格式!" type= "warning" />
return;
}
var roleName = $("input[name=roleName]").val();
var roleId = "${roleEntity.roleId?default('')}";
var oldRoleName = "${roleEntity.roleName?default('')}";
var ids=[];
$("input[name=attribute]").each(function () {
if($(this).is(':checked')){
var modelId = $(this).val();
var modelModelIds = $(this).attr("data-ids");
ids.push(modelId);
if(modelModelIds!="") {
var parentIds = modelModelIds.split(",");
for(var i=0;i<parentIds.length;i++){
if(parentIds[i]!="") {
if($.inArray(parentIds[i], ids) == -1){
ids.push(parentIds[i]);
}
}
}
}
}
});
if(roleName == "" || roleName == null){
<@ms.notify msg= '角色名不能为空' type= "warning" />
}else{
$.ajax({
type:"post",
url:"${managerPath}/basic/role/saveOrUpdateRole.do",
dataType: "json",
data:{ids:ids,roleName:roleName,roleId:roleId,oldRoleName:oldRoleName},
success:function(data){
if(data.result == false) {
$('.ms-notifications').offset({top:43}).notify({
type:'warning',
message: { text:data.resultMsg }
}).show();
}else {
<@ms.notify msg= "操作成功" type= "success" />
location.href= "${managerPath}/basic/role/index.do";
}
}
});
}
})
</script>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment