提交 8021a2a9 编写于 作者: doc_wei's avatar doc_wei

小程序页面上下移

上级 35b073aa
...@@ -15,4 +15,12 @@ public interface SmProjectPageDao { ...@@ -15,4 +15,12 @@ public interface SmProjectPageDao {
public int insertProPageMationByProId(Map<String, Object> map) throws Exception; public int insertProPageMationByProId(Map<String, Object> map) throws Exception;
public Map<String, Object> querySmProjectPageISTopByThisId(Map<String, Object> map) throws Exception;
public void editSmProjectPageSortTopById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySmProjectPageISLowerByThisId(Map<String, Object> map) throws Exception;
public void editSmProjectPageSortLowerById(Map<String, Object> topBean) throws Exception;
} }
...@@ -9,4 +9,8 @@ public interface SmProjectPageService { ...@@ -9,4 +9,8 @@ public interface SmProjectPageService {
public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception; public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception;
} }
...@@ -103,6 +103,54 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{ ...@@ -103,6 +103,54 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{
map.put("createTime", ToolUtil.getTimeAndToString()); map.put("createTime", ToolUtil.getTimeAndToString());
smProjectPageDao.insertProPageMationByProId(map); smProjectPageDao.insertProPageMationByProId(map);
} }
/**
*
* @Title: editSmProjectPageSortTopById
* @Description: 小程序页面展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = smProjectPageDao.querySmProjectPageISTopByThisId(map);//根据排序获取这条数据的上一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠前页面,无法移动。");
}else{
map.put("sort", topBean.get("sort"));
topBean.put("sort", topBean.get("thisSort"));
smProjectPageDao.editSmProjectPageSortTopById(map);
smProjectPageDao.editSmProjectPageSortTopById(topBean);
}
}
/**
*
* @Title: editSmProjectPageSortLowerById
* @Description: 小程序页面展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = smProjectPageDao.querySmProjectPageISLowerByThisId(map);//根据排序获取这条数据的上一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠后页面,无法移动。");
}else{
map.put("sort", topBean.get("sort"));
topBean.put("sort", topBean.get("thisSort"));
smProjectPageDao.editSmProjectPageSortLowerById(map);
smProjectPageDao.editSmProjectPageSortLowerById(topBean);
}
}
......
...@@ -47,5 +47,37 @@ public class SmProjectPageController { ...@@ -47,5 +47,37 @@ public class SmProjectPageController {
smProjectPageService.insertProPageMationByProId(inputObject, outputObject); smProjectPageService.insertProPageMationByProId(inputObject, outputObject);
} }
/**
*
* @Title: editSmProjectPageSortTopById
* @Description: 小程序页面展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SmProjectPageController/editSmProjectPageSortTopById")
@ResponseBody
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.editSmProjectPageSortTopById(inputObject, outputObject);
}
/**
*
* @Title: editSmProjectPageSortLowerById
* @Description: 小程序页面展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SmProjectPageController/editSmProjectPageSortLowerById")
@ResponseBody
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.editSmProjectPageSortLowerById(inputObject, outputObject);
}
} }
...@@ -54,4 +54,55 @@ ...@@ -54,4 +54,55 @@
(#{id}, #{name}, #{filePath}, #{fileName}, #{defaultFilePath}, #{defaultFileName}, #{defaultFilePathNum}, #{defaultFileNameNum}, #{proId}, #{sort}, #{createId}, #{createTime}) (#{id}, #{name}, #{filePath}, #{fileName}, #{defaultFilePath}, #{defaultFileName}, #{defaultFilePathNum}, #{defaultFileNameNum}, #{proId}, #{sort}, #{createId}, #{createTime})
</insert> </insert>
<select id="querySmProjectPageISTopByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.sort sort,
b.sort thisSort
FROM
sm_project_page a,
sm_project_page b
WHERE
b.sm_project_id = #{proId}
AND b.id = #{id}
AND a.sort > b.sort
ORDER BY
a.sort ASC
LIMIT 1
</select>
<update id="editSmProjectPageSortTopById" parameterType="java.util.Map">
UPDATE sm_project_page
<set>
sort = #{sort},
</set>
WHERE id = #{id}
</update>
<select id="querySmProjectPageISLowerByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.sort sort,
b.sort thisSort
FROM
sm_project_page a,
sm_project_page b
WHERE
b.sm_project_id = #{proId}
AND b.id = #{id}
AND b.sort > a.sort
ORDER BY
a.sort DESC
LIMIT 1
</select>
<update id="editSmProjectPageSortLowerById" parameterType="java.util.Map">
UPDATE sm_project_page
<set>
sort = #{sort},
</set>
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -299,6 +299,14 @@ ...@@ -299,6 +299,14 @@
<property id="filePath" name="filePath" ref="" var="文件将来的导出路径"/> <property id="filePath" name="filePath" ref="" var="文件将来的导出路径"/>
<property id="fileName" name="fileName" ref="" var="文件将来的导出名"/> <property id="fileName" name="fileName" ref="" var="文件将来的导出名"/>
</url> </url>
<url id="rmxcx031" path="/post/SmProjectPageController/editSmProjectPageSortTopById" val="小程序页面展示顺序上移" allUse="1">
<property id="proId" name="proId" ref="required" var="小程序项目id"/>
<property id="rowId" name="id" ref="required" var="页面id"/>
</url>
<url id="rmxcx032" path="/post/SmProjectPageController/editSmProjectPageSortLowerById" val="小程序页面展示顺序下移" allUse="1">
<property id="proId" name="proId" ref="required" var="小程序项目id"/>
<property id="rowId" name="id" ref="required" var="页面id"/>
</url>
<!-- 小程序系列结束 --> <!-- 小程序系列结束 -->
......
...@@ -196,10 +196,10 @@ dataGrid.prototype = { ...@@ -196,10 +196,10 @@ dataGrid.prototype = {
} }
layui.$("#" + this._id + "").empty().html(myTemplate(json)); layui.$("#" + this._id + "").empty().html(myTemplate(json));
this.registermousehover(); this.registermousehover();
this.customClickPage(json);
if(typeof(_op.settings.ajaxSendAfter) == "function") { if(typeof(_op.settings.ajaxSendAfter) == "function") {
_op.settings.ajaxSendAfter(json); _op.settings.ajaxSendAfter(json);
} }
this.customClickPage(json);
}, },
//循环添加行 //循环添加行
createBody: function(pn) { createBody: function(pn) {
...@@ -233,10 +233,10 @@ dataGrid.prototype = { ...@@ -233,10 +233,10 @@ dataGrid.prototype = {
} }
layui.$("#" + _op.settings.id + "showBody").empty().html(myTemplate(json)); layui.$("#" + _op.settings.id + "showBody").empty().html(myTemplate(json));
this.registermousehover(); this.registermousehover();
this.customClickPage(json);
if(typeof(_op.settings.ajaxSendAfter) == "function") { if(typeof(_op.settings.ajaxSendAfter) == "function") {
_op.settings.ajaxSendAfter(json); _op.settings.ajaxSendAfter(json);
} }
this.customClickPage(json);
}, },
//初始化分页 //初始化分页
createFoot: function() { createFoot: function() {
......
...@@ -29,10 +29,30 @@ layui.config({ ...@@ -29,10 +29,30 @@ layui.config({
}, },
'click .toUp':function(index, row){//上移 'click .toUp':function(index, row){//上移
var params = {
proId: proId,
rowId: row.id,
};
AjaxPostUtil.request({url:reqBasePath + "rmxcx031", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
refreshGrid("pageList", {params:{rowId: parent.rowId}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}, },
'click .toDown':function(index, row){//下移 'click .toDown':function(index, row){//下移
var params = {
proId: proId,
rowId: row.id,
};
AjaxPostUtil.request({url:reqBasePath + "rmxcx032", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
refreshGrid("pageList", {params:{rowId: parent.rowId}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}, },
'click .copyPage':function(index, row){//复制 'click .copyPage':function(index, row){//复制
......
{{#each rows}} {{#each rows}}
<li class="page-li"> <li class="page-li">
<div class="weui-flex js_category layui-col-xs6"> <div class="weui-flex layui-col-xs6">
<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 layui-col-xs6 right">
<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-xs 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 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-xs 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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册