提交 35b073aa 编写于 作者: doc_wei's avatar doc_wei

添加页面完成

上级 06ff8ca6
...@@ -90,5 +90,13 @@ public class Constants { ...@@ -90,5 +90,13 @@ public class Constants {
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel";//代码生成器模板规范说明key public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel";//代码生成器模板规范说明key
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT = "exexplaintodsformcontent";//动态表单内容项模板规范说明key public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT = "exexplaintodsformcontent";//动态表单内容项模板规范说明key
/**
* 微信小程序页面id的序列号
*/
public static final String REDIS_PROJECT_PAGE_FILE_PATH = "projectpagefilepath";//页面路径的序列号key
public static final String REDIS_PROJECT_PAGE_FILE_NAME = "projectpagefilename";//页面名称的序列号key
public static final String REDIS_PROJECT_PAGE_FILE_PATH_NUM = "1000";//页面路径的序列号默认值
public static final String REDIS_PROJECT_PAGE_FILE_NAME_NUM = "1000";//页面名称的序列号默认值
} }
...@@ -7,4 +7,12 @@ public interface SmProjectPageDao { ...@@ -7,4 +7,12 @@ public interface SmProjectPageDao {
public List<Map<String, Object>> queryProPageMationByProIdList(Map<String, Object> map) throws Exception; public List<Map<String, Object>> queryProPageMationByProIdList(Map<String, Object> map) throws Exception;
public Map<String, Object> queryFilePathNumMaxMation(Map<String, Object> map) throws Exception;
public Map<String, Object> queryFileNameNumMaxMation(Map<String, Object> map) throws Exception;
public Map<String, Object> querySortMaxMationByProjectId(Map<String, Object> map) throws Exception;
public int insertProPageMationByProId(Map<String, Object> map) throws Exception;
} }
...@@ -7,4 +7,6 @@ public interface SmProjectPageService { ...@@ -7,4 +7,6 @@ public interface SmProjectPageService {
public void queryProPageMationByProIdList(InputObject inputObject, OutputObject outputObject) throws Exception; public void queryProPageMationByProIdList(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception;
} }
...@@ -2,12 +2,13 @@ package com.skyeye.smprogram.service.impl; ...@@ -2,12 +2,13 @@ package com.skyeye.smprogram.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.skyeye.common.constans.Constants;
import com.skyeye.common.object.InputObject; import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject; import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.jedis.JedisClient;
import com.skyeye.smprogram.dao.SmProjectPageDao; import com.skyeye.smprogram.dao.SmProjectPageDao;
import com.skyeye.smprogram.service.SmProjectPageService; import com.skyeye.smprogram.service.SmProjectPageService;
...@@ -17,6 +18,9 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{ ...@@ -17,6 +18,9 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{
@Autowired @Autowired
private SmProjectPageDao smProjectPageDao; private SmProjectPageDao smProjectPageDao;
@Autowired
public JedisClient jedisClient;
/** /**
* *
* @Title: queryProPageMationByProIdList * @Title: queryProPageMationByProIdList
...@@ -36,6 +40,69 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{ ...@@ -36,6 +40,69 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{
outputObject.settotal(beans.size()); outputObject.settotal(beans.size());
} }
} }
/**
*
* @Title: insertProPageMationByProId
* @Description: 添加项目内部的页面
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
if(!jedisClient.exists(Constants.REDIS_PROJECT_PAGE_FILE_PATH)){//判断redis中是否存在文件路径--不存在
Map<String, Object> redisFilePathNum = smProjectPageDao.queryFilePathNumMaxMation(map);
if(redisFilePathNum == null){
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_PATH, Constants.REDIS_PROJECT_PAGE_FILE_PATH_NUM);//如果表中没数据,默认插入这条数据
}else{
if(redisFilePathNum.containsKey("redisFilePathNum")){
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_PATH, redisFilePathNum.get("redisFilePathNum").toString());//如果表中有数据,默认插入这条数据的值
}else{
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_PATH, Constants.REDIS_PROJECT_PAGE_FILE_PATH_NUM);//如果表中没数据,默认插入这条数据
}
}
}
if(!jedisClient.exists(Constants.REDIS_PROJECT_PAGE_FILE_NAME)){//判断redis中是否存在文件名称--不存在
Map<String, Object> redisFilePathNum = smProjectPageDao.queryFileNameNumMaxMation(map);
if(redisFilePathNum == null){
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_NAME, Constants.REDIS_PROJECT_PAGE_FILE_NAME_NUM);//如果表中没数据,默认插入这条数据
}else{
if(redisFilePathNum.containsKey("redisFilePathNum")){
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_NAME, redisFilePathNum.get("redisFileNameNum").toString());//如果表中有数据,默认插入这条数据的值
}else{
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_NAME, Constants.REDIS_PROJECT_PAGE_FILE_PATH_NUM);//如果表中没数据,默认插入这条数据
}
}
}
map.put("defaultFilePath", "page" + jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_PATH).toString());//初始化默认文件路径
map.put("defaultFileName", "page" + jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_NAME).toString());//初始化默认文件名称
map.put("defaultFilePathNum", jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_PATH).toString());//初始化默认文件路径序列号
map.put("defaultFileNameNum", jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_NAME).toString());//初始化默认文件名称序列号
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_PATH, String.valueOf(Integer.parseInt(jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_PATH).toString()) + 1));
jedisClient.set(Constants.REDIS_PROJECT_PAGE_FILE_NAME, String.valueOf(Integer.parseInt(jedisClient.get(Constants.REDIS_PROJECT_PAGE_FILE_NAME).toString()) + 1));
//获取当前项目中页面排序序列值最大的一个
Map<String, Object> sortMax = smProjectPageDao.querySortMaxMationByProjectId(map);
if(sortMax == null){
map.put("sort", 1);
}else{
if(sortMax.containsKey("sort")){
map.put("sort", Integer.parseInt(sortMax.get("sort").toString()) + 1);
}else{
map.put("sort", 1);
}
}
map.put("id", ToolUtil.getSurFaceId());
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
smProjectPageDao.insertProPageMationByProId(map);
}
......
...@@ -30,4 +30,22 @@ public class SmProjectPageController { ...@@ -30,4 +30,22 @@ public class SmProjectPageController {
public void queryProPageMationByProIdList(InputObject inputObject, OutputObject outputObject) throws Exception{ public void queryProPageMationByProIdList(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.queryProPageMationByProIdList(inputObject, outputObject); smProjectPageService.queryProPageMationByProIdList(inputObject, outputObject);
} }
/**
*
* @Title: insertProPageMationByProId
* @Description: 添加项目内部的页面
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SmProjectPageController/insertProPageMationByProId")
@ResponseBody
public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.insertProPageMationByProId(inputObject, outputObject);
}
} }
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
<select id="queryProPageMationByProIdList" parameterType="java.util.Map" resultType="java.util.Map"> <select id="queryProPageMationByProIdList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT SELECT
a.id, a.id,
a.`name` a.`name`,
IFNULL(a.file_path, a.default_file_path) filePath,
IFNULL(a.file_name, a.default_file_name) fileName
FROM FROM
sm_project_page a sm_project_page a
WHERE WHERE
...@@ -13,4 +15,43 @@ ...@@ -13,4 +15,43 @@
ORDER BY a.sort DESC ORDER BY a.sort DESC
</select> </select>
<select id="queryFilePathNumMaxMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.default_file_path_num redisFilePathNum
FROM
sm_project_page a
ORDER BY
a.default_file_path_num DESC
LIMIT 1
</select>
<select id="queryFileNameNumMaxMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.default_file_name_num redisFileNameNum
FROM
sm_project_page a
ORDER BY
a.default_file_name_num DESC
LIMIT 1
</select>
<select id="querySortMaxMationByProjectId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.sort sort
FROM
sm_project_page a
WHERE
a.sm_project_id = #{proId}
ORDER BY
a.sort DESC
LIMIT 1
</select>
<insert id="insertProPageMationByProId" parameterType="java.util.Map">
INSERT into sm_project_page
(id, name, file_path, file_name, default_file_path, default_file_name, default_file_path_num, default_file_name_num, sm_project_id, sort, create_id, create_time)
VALUES
(#{id}, #{name}, #{filePath}, #{fileName}, #{defaultFilePath}, #{defaultFileName}, #{defaultFilePathNum}, #{defaultFileNameNum}, #{proId}, #{sort}, #{createId}, #{createTime})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -293,6 +293,13 @@ ...@@ -293,6 +293,13 @@
<url id="rmxcx029" path="/post/SmProjectPageController/queryProPageMationByProIdList" val="根据项目获取项目内部的页面" allUse="1"> <url id="rmxcx029" path="/post/SmProjectPageController/queryProPageMationByProIdList" val="根据项目获取项目内部的页面" allUse="1">
<property id="rowId" name="proId" ref="required" var="小程序项目id"/> <property id="rowId" name="proId" ref="required" var="小程序项目id"/>
</url> </url>
<url id="rmxcx030" path="/post/SmProjectPageController/insertProPageMationByProId" val="添加项目内部的页面" allUse="1">
<property id="rowId" name="proId" ref="required" var="小程序项目id"/>
<property id="name" name="name" ref="required" var="页面名称"/>
<property id="filePath" name="filePath" ref="" var="文件将来的导出路径"/>
<property id="fileName" name="fileName" ref="" var="文件将来的导出名"/>
</url>
<!-- 小程序系列结束 --> <!-- 小程序系列结束 -->
......
...@@ -471,7 +471,7 @@ var refreshGrid = function (id, option){ ...@@ -471,7 +471,7 @@ var refreshGrid = function (id, option){
dataGrid_setting[index].settings.pageindex = 1; dataGrid_setting[index].settings.pageindex = 1;
showGrid.settings = dataGrid_setting[index].settings; showGrid.settings = dataGrid_setting[index].settings;
showGrid.settings.params = layui.$.extend({}, showGrid.settings.params, option.params); showGrid.settings.params = layui.$.extend({}, showGrid.settings.params, option.params);
dataGrid_setting.splice(index, 1); dataGrid_setting.splice(index, 1, showGrid);
return; return;
} }
}); });
......
...@@ -2748,6 +2748,12 @@ body .layer-ext-winconfirm { ...@@ -2748,6 +2748,12 @@ body .layer-ext-winconfirm {
line-height: 25px; line-height: 25px;
background-color: ghostwhite; background-color: ghostwhite;
margin-top: 10px; margin-top: 10px;
background: rgba(0.5,0.3,0.2,0.1) none repeat scroll !important;
}
.page-li:HOVER{
cursor: pointer;
border: 1px #357ebd dashed;
} }
.code-model-li{ .code-model-li{
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form;
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
var params = {
name: $("#pageName").val(),
filePath: $("#filePath").val(),
fileName: $("#fileName").val(),
rowId: parent.proId,
};
AjaxPostUtil.request({url:reqBasePath + "rmxcx030", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var proId = "";
layui.config({ layui.config({
base: basePath, base: basePath,
version: skyeyeVersion version: skyeyeVersion
...@@ -10,6 +12,8 @@ layui.config({ ...@@ -10,6 +12,8 @@ layui.config({
form = layui.form, form = layui.form,
table = layui.table; table = layui.table;
proId = parent.rowId;//项目id
$("#groupMemberTab").hide(); $("#groupMemberTab").hide();
//初始化加载该项目的所有页面 //初始化加载该项目的所有页面
showGrid({ showGrid({
...@@ -195,9 +199,21 @@ layui.config({ ...@@ -195,9 +199,21 @@ layui.config({
$(this).parent().parent().remove(); $(this).parent().parent().remove();
}) })
function loadTable(){ //添加页面按钮
table.reload("messageTable", {where:{proName:$("#proName").val()}}); $('body').on('click', '#addPageBean', function(){
} _openNewWindows({
url: "../../tpl/rmmysmpropage/addpagebeanitem.html",
title: "新增页面",
pageId: "addpagebeanitem",
callBack: function(refreshCode){
if (refreshCode == '0') {
refreshGrid("pageList", {params:{rowId: parent.rowId}});
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
});
exports('mysmpropagelist', {}); exports('mysmpropagelist', {});
}); });
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" /> <link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" /> <link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" /> <link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div style="width:600px;margin:0 auto;padding-top:20px;"> <div style="width:600px;margin:0 auto;padding-top:20px;">
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" /> <link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" /> <link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" /> <link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div style="width:600px;margin:0 auto;padding-top:20px;"> <div style="width:600px;margin:0 auto;padding-top:20px;">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">页面名称<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="pageName" name="pageName" win-verify="required" placeholder="请输入页面名称" class="layui-input" maxlength="50" value="未命名"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文件名</label>
<div class="layui-input-block">
<input type="text" id="fileName" name="fileName" placeholder="请输入文件名" class="layui-input" maxlength="50"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">路径</label>
<div class="layui-input-block">
<input type="text" id="filePath" name="filePath" placeholder="请输入路径" class="layui-input" maxlength="50"/>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle">取消</button>
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/rmmysmpropage/'}).use('addpagebeanitem');
</script>
</body>
</html>
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<body style="overflow: hidden;"> <body style="overflow: hidden;">
<div class="winui-toolbar"> <div class="winui-toolbar">
<div class="winui-tool"> <div class="winui-tool">
<button id="addPageBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增页面</button> <button type="button" id="addPageBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增页面</button>
</div> </div>
</div> </div>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</ul> </ul>
<div class="layui-tab-content tab__item"> <div class="layui-tab-content tab__item">
<div class="layui-tab-item layui-show hei-100-per"> <div class="layui-tab-item layui-show hei-100-per">
<ul style="overflow-y: scroll;height: 100%;" id="pageList"> <ul style="overflow-y: scroll;height: 100%; overflow-x: hidden;" id="pageList">
</ul> </ul>
</div> </div>
<div class="layui-tab-item hei-100-per"> <div class="layui-tab-item hei-100-per">
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<span class="weui-flex__item">{{name}}</span> <span class="weui-flex__item">{{name}}</span>
</div> </div>
<div class="weui-flex js_category layui-col-xs6 right"> <div class="weui-flex js_category layui-col-xs6 right">
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 reName" title="重命名页面"><i class="fa fa-pencil-square-o"></i></button> <button class="layui-btn layui-btn-xs tab-btn-mar-left-3 reName" title="重命名页面"><i class="fa fa-pencil-square-o"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 toUp" title="上移页面"><i class="fa fa-arrow-up"></i></button> <button class="layui-btn layui-btn-xs tab-btn-mar-left-3 toUp" title="上移页面"><i class="fa fa-arrow-up"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 toDown" title="下移页面"><i class="fa fa-arrow-down"></i></button> <button class="layui-btn layui-btn-xs tab-btn-mar-left-3 toDown" title="下移页面"><i class="fa fa-arrow-down"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 copyPage" title="复制页面"><i class="fa fa-files-o"></i></button> <button class="layui-btn layui-btn-xs tab-btn-mar-left-3 copyPage" title="复制页面"><i class="fa fa-files-o"></i></button>
<button class="layui-btn layui-btn-sm tab-btn-mar-left-3 delPage" title="删除页面"><i class="fa fa-trash"></i></button> <button class="layui-btn layui-btn-xs tab-btn-mar-left-3 delPage" title="删除页面"><i class="fa fa-trash"></i></button>
</div> </div>
</li> </li>
{{/each}} {{/each}}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册