Commit d3a7267d904faffd25997e4ef71f7264516407f7

Authored by yangfei
1 parent 03c4aa91bd
Exists in master

内容管理模块

Showing 15 changed files with 377 additions and 151 deletions

parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentMessageTemplateMapper.xml View file @ d3a7267
... ... @@ -38,6 +38,7 @@
38 38 <if test="tagId!=null">
39 39 and t.TAGS_IDS LIKE concat("%,",#{tagId},",%")
40 40 </if>
  41 + AND m.IFDEL = 0
41 42 </where>
42 43 GROUP BY m.ID
43 44 </select>
parent/base.common/src/main/java/com/lyms/base/common/dao/content/ContentTagsMapper.xml View file @ d3a7267
... ... @@ -30,6 +30,10 @@
30 30 <if test="name !=null">
31 31 AND `TAG_NAME` LIKE concat('%',#{name},"%")
32 32 </if>
  33 +
  34 + <if test="name == null">
  35 + AND LEVEL = 0
  36 + </if>
33 37 AND IFDEL = 0
34 38 </where>
35 39 </select>
parent/base.common/src/main/java/com/lyms/base/common/entity/content/ContentArticles.java View file @ d3a7267
... ... @@ -170,7 +170,7 @@
170 170 }
171 171 }
172 172  
173   - public String getCategoryName() {
  173 + public String getCategoryName() {
174 174 return categoryName;
175 175 }
176 176  
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentArticlesDTO.java View file @ d3a7267
1 1 package com.lyms.base.common.vo.content;
2 2  
3 3 import com.baomidou.mybatisplus.annotations.TableField;
  4 +import org.springframework.web.util.HtmlUtils;
4 5  
5 6 import java.util.ArrayList;
6 7 import java.util.List;
7 8  
8 9 /**
9   - * @auther HuJiaqi
  10 + * @auther YangFei
10 11 * @createTime 2017年04月25日 17时24分
11 12 * @discription
12 13 */
... ... @@ -108,7 +109,7 @@
108 109 }
109 110  
110 111 public String getContent() {
111   - return content;
  112 + return HtmlUtils.htmlUnescape(content);
112 113 }
113 114  
114 115 public void setContent(String content) {
parent/base.common/src/main/java/com/lyms/base/common/vo/content/ContentTagsDTO.java View file @ d3a7267
... ... @@ -6,6 +6,7 @@
6 6 * @discription
7 7 */
8 8 public class ContentTagsDTO {
  9 + private String id;
9 10 /**
10 11 * 标签名称
11 12 */
... ... @@ -18,6 +19,27 @@
18 19 * 父标签ID
19 20 */
20 21 private String perentId;
  22 +
  23 + /**
  24 + * 标签等级
  25 + */
  26 + private int level;
  27 +
  28 + public String getId() {
  29 + return id;
  30 + }
  31 +
  32 + public void setId(String id) {
  33 + this.id = id;
  34 + }
  35 +
  36 + public int getLevel() {
  37 + return level;
  38 + }
  39 +
  40 + public void setLevel(int level) {
  41 + this.level = level;
  42 + }
21 43  
22 44 public String getTagName() {
23 45 return tagName;
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentArticlesController.java View file @ d3a7267
... ... @@ -4,14 +4,16 @@
4 4 import com.lyms.base.common.entity.content.ContentArticles;
5 5 import com.lyms.base.common.entity.content.ContentArticlesTags;
6 6 import com.lyms.base.common.service.content.ContentArticlesService;
7   -import com.lyms.base.common.vo.content.ContentArticlesDTO;
8 7 import com.lyms.base.common.vo.content.AricleSearchDTO;
  8 +import com.lyms.base.common.vo.content.ContentArticlesDTO;
9 9 import com.lyms.constants.OperationName;
10 10 import com.lyms.util.StrUtils;
11 11 import com.lyms.web.bean.AjaxResult;
12 12 import com.lyms.web.controller.BaseController;
13 13 import org.springframework.beans.factory.annotation.Autowired;
14 14 import org.springframework.stereotype.Controller;
  15 +import org.springframework.ui.Model;
  16 +import org.springframework.web.bind.annotation.PathVariable;
15 17 import org.springframework.web.bind.annotation.RequestMapping;
16 18 import org.springframework.web.bind.annotation.RequestMethod;
17 19 import org.springframework.web.bind.annotation.ResponseBody;
... ... @@ -40,8 +42,12 @@
40 42 *
41 43 * @return
42 44 */
43   - @RequestMapping(value = "/toEdit", method = { RequestMethod.GET })
44   - public String toEdit() {
  45 + @RequestMapping(value = "/{id}/toEdit", method = { RequestMethod.GET })
  46 + public String toEdit(@PathVariable String id, Model model) {
  47 + if(StrUtils.isNotEmpty(id)){
  48 + ContentArticles conArtic = contentArticlesService.selectById(id);
  49 + model.addAttribute("conArtic",conArtic);
  50 + }
45 51 return "/articles/articles_edit";
46 52 }
47 53  
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentMessageTemplateController.java View file @ d3a7267
1 1 package com.lyms.cm.controller.content;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.lyms.base.common.entity.content.ContentMessageTemplate;
5 7 import com.lyms.base.common.entity.content.ContentTemplateMessageTags;
... ... @@ -19,6 +21,7 @@
19 21 import org.springframework.web.bind.annotation.*;
20 22  
21 23 import java.util.Date;
  24 +import java.util.HashMap;
22 25 import java.util.List;
23 26 import java.util.Map;
24 27  
... ... @@ -48,7 +51,24 @@
48 51 public String toList() {
49 52 return "/content/template_list";
50 53 }
51   -
  54 +
  55 +
  56 + @RequestMapping(value = "/{ids}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  57 + @ResponseBody
  58 + public AjaxResult delete(@PathVariable String ids, AjaxResult ajaxResult) {
  59 + Wrapper<ContentMessageTemplate> wrapper = new EntityWrapper<>();
  60 + //wrapper.where("id in ({0})",ids);
  61 + wrapper.in("id",ids);
  62 + List<ContentMessageTemplate> template = messageTemplateService.selectList(wrapper);
  63 + for(ContentMessageTemplate temp : template){
  64 + temp.setIfdel(1);
  65 + temp.setModifyTime(new Date());
  66 + }
  67 + boolean tag = messageTemplateService.updateBatchById(template);
  68 +
  69 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  70 + }
  71 +
52 72 /**
53 73 * 跳转到编辑页面
54 74 *
... ... @@ -62,6 +82,10 @@
62 82 if(StrUtils.isNotEmpty(id)){//查询
63 83 ContentMessageTemplate tempInfo = messageTemplateService.selectById(id);
64 84 model.addAttribute("tempInfo",tempInfo);
  85 + Map<String,Object> colMap = new HashMap<>();
  86 + colMap.put("MESSAGE_TEMPLATE",id);
  87 + List<ContentTemplateMessageTags> tagList = messageTagsService.selectByMap(colMap);
  88 + model.addAttribute("tags", tagList);
65 89 }
66 90 return "/content/template_edit";
67 91 }
... ... @@ -75,6 +99,7 @@
75 99 @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST })
76 100 public Map<String, Object> list(MsgTempSerachDTO msgTemp) {
77 101 Page<ContentMessageTemplateDTO> page = getPage();
  102 + //根据条件查询短信列表
78 103 List<ContentMessageTemplateDTO> cmtdList = messageTemplateService.getContentMessageTemplate(page,msgTemp);
79 104 for(ContentMessageTemplateDTO ct : cmtdList){
80 105 StringBuffer tagsBf = new StringBuffer();
81 106  
... ... @@ -83,9 +108,16 @@
83 108 if(StrUtils.isEmpty(s)){
84 109 continue;
85 110 }
86   - tagsBf.append(ContentTagsServiceImpl.getValue(s)+",");
  111 + String tagName = ContentTagsServiceImpl.getValue(s);
  112 + if(StrUtils.isNotEmpty(tagName)){
  113 + tagsBf.append(tagName+",");
  114 + }
87 115 }
88   - ct.setContentTagIds(tagsBf.substring(0,tagsBf.length()-1).toString());
  116 + if(StrUtils.isNotEmpty(tagsBf.toString())){
  117 + ct.setContentTagIds(tagsBf.substring(0,tagsBf.length()-1).toString());
  118 + }else{
  119 + ct.setContentTagIds("");
  120 + }
89 121 System.out.println("标签名:--------------->"+ct.getContentTagIds());
90 122 }
91 123  
parent/center.manager/src/main/java/com/lyms/cm/controller/content/ContentTagsController.java View file @ d3a7267
1 1 package com.lyms.cm.controller.content;
2 2  
  3 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  4 +import com.baomidou.mybatisplus.mapper.Wrapper;
3 5 import com.baomidou.mybatisplus.plugins.Page;
4 6 import com.lyms.base.common.entity.content.ContentTags;
5 7 import com.lyms.base.common.service.content.ContentTagsService;
6 8  
... ... @@ -11,12 +13,11 @@
11 13 import com.lyms.web.controller.BaseController;
12 14 import org.springframework.beans.factory.annotation.Autowired;
13 15 import org.springframework.stereotype.Controller;
14   -import org.springframework.web.bind.annotation.RequestMapping;
15   -import org.springframework.web.bind.annotation.RequestMethod;
16   -import org.springframework.web.bind.annotation.RequestParam;
17   -import org.springframework.web.bind.annotation.ResponseBody;
  16 +import org.springframework.ui.Model;
  17 +import org.springframework.web.bind.annotation.*;
18 18  
19 19 import java.util.Date;
  20 +import java.util.HashMap;
20 21 import java.util.List;
21 22 import java.util.Map;
22 23  
23 24  
... ... @@ -44,13 +45,35 @@
44 45 return "/tags/tags_list";
45 46 }
46 47  
  48 + @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  49 + @ResponseBody
  50 + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) {
  51 + ContentTags tags = contentTagsService.selectById(id);
  52 + tags.setIfdel(1);
  53 + tags.setModifyTime(new Date());
  54 + Wrapper<ContentTags> wrapper = new EntityWrapper<>();
  55 + wrapper.where("id={0}",id);
  56 + boolean tag = contentTagsService.update(tags,wrapper);
  57 +
  58 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  59 + }
  60 +
47 61 /**
48 62 * 跳转到新增页面
49 63 *
50 64 * @return
51 65 */
52   - @RequestMapping(value = "/toEdit", method = { RequestMethod.GET })
53   - public String toEdit() {
  66 + @RequestMapping(value = "/{id}/toEdit", method = { RequestMethod.GET })
  67 + public String toEdit(@PathVariable String id, String perId, String pertTgName, String level, Model model) {
  68 + model.addAttribute("id", id);
  69 + model.addAttribute("perId", perId);
  70 + model.addAttribute("pertTgName", pertTgName);
  71 + model.addAttribute("level", level);
  72 + if(!StrUtils.isBlank(id)){
  73 + ContentTags contentTags = contentTagsService.selectById(id);
  74 + model.addAttribute("contentTags",contentTags);
  75 + }
  76 +
54 77 return "/tags/tags_edit";
55 78 }
56 79  
57 80  
... ... @@ -68,8 +91,19 @@
68 91 */
69 92 @ResponseBody
70 93 @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST })
71   - public Map<String, Object> list(@RequestParam(value="name",required = false) String name) {
  94 + public Map<String, Object> list(@RequestParam(value="name",required = false) String name,String perId) {
72 95 Page<ContentTags> page = getPage();
  96 + //根据父Id查询下一级的数据
  97 + if(StrUtils.isNotEmpty(perId)){
  98 + Wrapper<ContentTags> wrapper = new EntityWrapper<>();
  99 + wrapper.where("PERENT_ID={0}",perId);
  100 + List<ContentTags> contentTags = contentTagsService.selectList(wrapper);
  101 + Map<String, Object> gridData = new HashMap<String, Object>();
  102 + gridData.put("rows", contentTags);
  103 + return gridData;
  104 + }
  105 +
  106 + //根据标签名模糊查询
73 107 if(StrUtils.isNotEmpty(name)){
74 108 page = contentTagsService.getTags(page,name);
75 109 }else{
76 110  
77 111  
... ... @@ -87,21 +121,30 @@
87 121 @ResponseBody
88 122 @RequestMapping(value = "/create", method = { RequestMethod.POST })
89 123 public AjaxResult create(ContentTagsDTO ctd, AjaxResult ajaxResult) {
90   - ContentTags cts = new ContentTags();
91   - cts.setId(StrUtils.uuid());
92   - cts.setCreateTime(new Date());
93   - cts.setIfdel(0);
94   - cts.setEnable(0);
95   -
  124 + ContentTags cts = null;
  125 + if(StrUtils.isNotEmpty(ctd.getId())){//更新
  126 + cts = contentTagsService.selectById(ctd.getId());
  127 + cts.setModifyTime(new Date());
  128 + }else{//新增
  129 + cts = new ContentTags();
  130 + cts.setId(StrUtils.uuid());
  131 + cts.setCreateTime(new Date());
  132 + cts.setIfdel(0);
  133 + cts.setEnable(0);
  134 + cts.setPerentId(ctd.getPerentId());
  135 + if(StrUtils.isNotEmpty(ctd.getPerentId())){//子栏目等级+1
  136 + cts.setLevel(ctd.getLevel()+1);
  137 + }else{//父栏目
  138 + cts.setLevel(0);
  139 + }
  140 + }
96 141 cts.setTagName(ctd.getTagName());
97 142 cts.setTagDesc(ctd.getTagDesc());
98   - cts.setPerentId(ctd.getPerentId());
99   - boolean tag = contentTagsService.insert(cts);
  143 + boolean tag = contentTagsService.insertOrUpdate(cts);
100 144 if(tag){
101 145 ContentTagsServiceImpl.setValue(cts.getId(),cts.getTagName());
102 146 }
103 147 return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
104 148 }
105   -
106 149 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java View file @ d3a7267
1 1 package com.lyms.cm.controller.sys;
2 2  
3   -import java.util.Map;
4   -
5   -import org.apache.commons.lang3.StringUtils;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.stereotype.Controller;
8   -import org.springframework.ui.Model;
9   -import org.springframework.web.bind.annotation.PathVariable;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RequestMethod;
12   -import org.springframework.web.bind.annotation.ResponseBody;
13   -
14 3 import com.baomidou.mybatisplus.mapper.EntityWrapper;
15 4 import com.baomidou.mybatisplus.plugins.Page;
16 5 import com.lyms.base.common.entity.organ.OrganGroup;
17 6  
... ... @@ -21,7 +10,17 @@
21 10 import com.lyms.util.StrUtils;
22 11 import com.lyms.web.bean.AjaxResult;
23 12 import com.lyms.web.controller.BaseController;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Controller;
  16 +import org.springframework.ui.Model;
  17 +import org.springframework.web.bind.annotation.PathVariable;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestMethod;
  20 +import org.springframework.web.bind.annotation.ResponseBody;
24 21  
  22 +import java.util.Map;
  23 +
25 24 /**
26 25 * <p>
27 26 * 机构组信息
... ... @@ -82,7 +81,6 @@
82 81 if (!StringUtils.isBlank(id)) {
83 82 OrganGroup group = groupService.selectById(id);
84 83 model.addAttribute("group", group);
85   -
86 84 }
87 85 return "/group/group_edit";
88 86 }
parent/center.manager/src/main/webapp/WEB-INF/views/articles/articles_edit.html View file @ d3a7267
... ... @@ -21,7 +21,7 @@
21 21 novalidate="novalidate">
22 22 <div class="form-group">
23 23 <label class="col-sm-2 control-label">*栏目:</label>
24   - <div class="col-sm-5">
  24 + <div class="col-sm-8">
25 25 <select class="form-control" required="" name="categoryId" id="columnList">
26 26  
27 27 </select>
28 28  
29 29  
30 30  
31 31  
32 32  
33 33  
... ... @@ -30,34 +30,34 @@
30 30 <div class="hr-line-dashed"></div>
31 31 <div class="form-group">
32 32 <label class="col-sm-2 control-label">*分类:</label>
33   - <div class="col-sm-5">
  33 + <div class="col-sm-8">
34 34 <select class="form-control" required="" name="type">
35 35 <option value>请选择</option>
36   - <option value="1">孕期</option>
37   - <option value="2">育儿</option>
38   - <option value="3">其它</option>
  36 + <option value="1" #if($!conArtic.type==1) selected #end>孕期</option>
  37 + <option value="2" #if($!conArtic.type==2) selected #end>育儿</option>
  38 + <option value="3" #if($!conArtic.type==3) selected #end>其它</option>
39 39 </select>
40 40 </div>
41 41 </div>
42   - <div class="hr-line-dashed" style="display: none;"></div>
  42 + <!--<div class="hr-line-dashed" style="display: none;"></div>
43 43 <div class="form-group" style="display: none;">
44 44 <label class="col-sm-2 control-label">权重:</label>
45   - <div class="col-sm-5">
  45 + <div class="col-sm-8">
46 46 <input type="number" class="form-control" class="form-control" placeholder="选填" name="weight">
47 47 </div>
48   - </div>
49   -
  48 + </div>-->
  49 +
50 50 <div class="hr-line-dashed"></div>
51 51 <div class="form-group">
52 52 <label class="col-sm-2 control-label">*标签:</label><button type="button" onclick="addTags()" class="glyphicon glyphicon-plus btn glyphicon btn-primary btn-sm"></button>
53   - <div class="col-sm-5" id="seleArrs">
  53 + <div class="col-sm-8" id="seleArrs">
54 54  
55 55 </div>
56 56 </div>
57 57 <div class="hr-line-dashed"></div>
58 58 <div class="form-group">
59 59 <label class="col-sm-2 control-label" for="">*封面:</label>
60   - <div class="col-sm-5">
  60 + <div class="col-sm-8">
61 61 <div class="btn-group m-b col-sm-12 ">
62 62 <label class="btn btn-sm btn-info w-sm col-sm-3"
63 63 onclick="switchContent(1)"> <i
64 64  
65 65  
66 66  
67 67  
68 68  
... ... @@ -74,36 +74,43 @@
74 74 class="btn btn-primary btn-upload m-b-sm">
75 75 <i class="fa fa-cloud-upload text"></i> 点击上传图片
76 76 </div>
  77 +
  78 + #if($conArtic.image)
77 79 <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
78   - src="${ctx}/static/images/p0.jpg" />
  80 + src="$!conArtic.image" />
  81 + #else
  82 + <img class="b wrapper-xs w img-responsive" style="width: 200px" id="pickImage"
  83 + src="${ctx}/static/images/p0.jpg" />
  84 + #end
  85 +
79 86 </div>
80 87 </div>
81 88 </div>
82 89 <div class="hr-line-dashed"></div>
83 90 <div class="form-group">
84 91 <label class="col-sm-2 control-label">*标题:</label>
85   - <div class="col-sm-5">
86   - <input type="text" ng-maxlength="32" name="title"
  92 + <div class="col-sm-8">
  93 + <input type="text" maxlength="32" value="$!conArtic.title" name="title"
87 94 class="form-control w-lg" required="" aria-required="true">
88 95 </div>
89 96 </div>
90 97 <div class="form-group" id="linkContent" style="display:none">
91 98 <label class="col-sm-2 control-label">*链接:</label>
92   - <div class="col-sm-5">
93   - <input type="text" type="url" name="link" id="linkAddr" class="form-control w-lg">
  99 + <div class="col-sm-8">
  100 + <input type="text" type="url" value="$!conArtic.link" name="link" id="linkAddr" class="form-control w-lg">
94 101 </div>
95 102 </div>
96 103 <div class="form-group" id="zaiyaoContent">
97 104 <label class="col-sm-2 control-label">*摘要:</label>
98 105 <div class="col-sm-5">
99   - <input type="text" maxlength="255" required="" id="introdu" name="introduction" class="form-control w-lg">
  106 + <input type="text" maxlength="255" value="$!conArtic.introduction" required="" id="introdu" name="introduction" class="form-control w-lg">
100 107 </div>
101 108 </div>
102 109  
103 110 <div class="form-group" id="zhengwenConent">
104 111 <label class="col-sm-2 control-label">正文:</label>
105   - <div class="col-sm-5">
106   - <script id="editor" name="richText" type="text/plain"></script>
  112 + <div class="col-sm-8">
  113 + <script id="editor" name="richText" type="text/plain">$!conArtic.content</script>
107 114 </div>
108 115 </div>
109 116  
110 117  
... ... @@ -219,11 +226,16 @@
219 226 }
220 227  
221 228 function initCloumnData(){
  229 + var cateGoryId = "$conArtic.categoryId";
222 230 $.getJSON("${ctx}/contentCategories/selelist", function(data) {
223 231 if (data.success) {
224 232 var columnList = "<option value=''>请选择</option>";
225 233 data.data.forEach(function(d, i) {
226   - columnList += "<option value='"+d.id+"'>" + d.name + "</option>";
  234 + columnList += "<option value='"+d.id+"'";
  235 + if(cateGoryId==d.id){
  236 + columnList +=" selected ";
  237 + }
  238 + columnList +=">" + d.name + "</option>";
227 239 });
228 240 $("#columnList").empty();
229 241 $("#columnList").append(columnList);
... ... @@ -250,8 +262,8 @@
250 262 initCloumnData();
251 263 //初始化标签数据
252 264 initTagsData();
253   -
254   - //初始化
  265 +
  266 + //初始化
255 267 var ue = UE.getEditor('editor', {
256 268 initialFrameHeight : 200,
257 269 initialFrameWidth : "100%"
parent/center.manager/src/main/webapp/WEB-INF/views/articles/articles_list.html View file @ d3a7267
... ... @@ -135,35 +135,53 @@
135 135 }
136 136  
137 137 function add(){
138   - fullWindow("添加图文内容", APP.PATH + controllerRequestMappint + "/toEdit");
  138 + popWindow("添加图文内容", APP.PATH + controllerRequestMappint + "0/toEdit",850,800);
139 139  
140 140 }
141 141  
142 142 function del(){
143 143 goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
144 144 }
145   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
146   -var default_dataColumns = [{
147   - field: 'perent',
148   - title: '',
149   - checkbox: true
150   - },{
151   - field: 'title',
152   - title: '标题'
153   - },{
154   - field: 'categoryName',
155   - title: '所属栏目'
156   - },{
157   - field: 'typeName',
158   - title: '分类'
159   - },{
160   - field:"tagsName",
161   - title:"标签"
162   - },{
163   - field:"createName",
164   - title:"添加人"
165   - }];
166   -
  145 +$('#dataTable').bootstrapTable({
  146 + url: '${ctx}/contentArticles/list', //请求后台的URL(*)
  147 + method: 'get', //请求方式(*)
  148 + striped: true, //是否显示行间隔色
  149 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  150 + sortable: false, //是否启用排序
  151 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  152 + pageNumber:1, //初始化加载第一页,默认第一页
  153 + pageSize: 50, //每页的记录行数(*)
  154 + pageList: [200], //可供选择的每页的行数(*)
  155 + strictSearch: true,
  156 + onDblClickRow:function(row,ev){
  157 + popWindow("修改图文信息", APP.PATH + controllerRequestMappint + row.id+"/toEdit?id="+row.id,850,800);
  158 + },
  159 + clickToSelect: true, //是否启用点击选中行
  160 + //height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
  161 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  162 + cardView: false, //是否显示详细视图
  163 + detailView: false, //是否显示父子表
  164 + columns:[{
  165 + field: 'perent',
  166 + title: '',
  167 + checkbox: true
  168 + },{
  169 + field: 'title',
  170 + title: '标题'
  171 + },{
  172 + field: 'categoryName',
  173 + title: '所属栏目'
  174 + },{
  175 + field: 'typeName',
  176 + title: '分类'
  177 + },{
  178 + field:"tagsName",
  179 + title:"标签"
  180 + },{
  181 + field:"createName",
  182 + title:"添加人"
  183 + }]
  184 +});
167 185 </script>
168 186 #end
169 187 #extends("/common/base_list.html")
parent/center.manager/src/main/webapp/WEB-INF/views/content/template_edit.html View file @ d3a7267
... ... @@ -73,14 +73,26 @@
73 73 <script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
74 74 <script type="text/javascript">
75 75 var seleTagNum = 1;
76   - var optionTagHtml = "";
  76 + //var optionTagHtml = "";
  77 + var tagsData;
77 78  
78   - function addSeleTags(){
79   -
80   - var seleHtml = "<select id='select"+seleTagNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>"+optionTagHtml+"</select>";
81   -
  79 + function addSeleTags(seleIds){
  80 + var seleHtml = "<select id='select"+seleTagNum+"' style='width: 100%;height: 36px;' multiple data-selectator-keep-open='true'>";
  81 + tagsData.forEach(function(d, i) {
  82 + seleHtml += "<option";
  83 + if(seleIds!=null) {
  84 + for(t in seleIds){
  85 + if(seleIds[t]!=""){
  86 + if (d.id == seleIds[t]) {
  87 + seleHtml += ' selected ';
  88 + }
  89 + }
  90 + }
  91 + }
  92 + seleHtml += " value='"+d.id+"'>" + d.tagName + "</option>";
  93 + });
  94 + seleHtml+="</select>";
82 95 $("#seleTagArrs").append(seleHtml);
83   -
84 96 $('#select'+seleTagNum).selectator({
85 97 prefix : 'selectator_', // CSS class prefix
86 98 height : '36', // auto or element
... ... @@ -102,11 +114,8 @@
102 114 function initTagsData(){
103 115 $.get("${ctx}/contentTags/seleList", "json", function(data) {
104 116 if (data.success) {
105   - data.data.forEach(function(d, i) {
106   - optionTagHtml += '<option value="'+d.id+'">' + d.tagName + '</option>';
107   - });
108   - //默认一个选择标签
109   - addSeleTags();
  117 + tagsData = data.data;
  118 + initSeleTags();
110 119 }
111 120 });
112 121 }
113 122  
114 123  
... ... @@ -120,12 +129,22 @@
120 129 var ue = UE.getEditor('editor',{initialFrameHeight:200,initialFrameWidth:"100%" });
121 130 });
122 131  
  132 + function initSeleTags(){
  133 + if("$!tags" != ""){
  134 + #foreach($tg in $tags)
  135 + //alert("${tg.tagsIds}".split(","));
  136 + addSeleTags("${tg.tagsIds}".split(","));
  137 + #end
  138 + }else{
  139 + //默认一个选择标签
  140 + addSeleTags();
  141 + }
123 142  
124   - $(function(){
125   - setTimeout(function(){
126   - initTagsData();
127   - },500);
  143 + }
128 144  
  145 +
  146 + $(function(){
  147 + initTagsData();
129 148 if("$!id"!=""&&"$!tempInfo.isRich"==1){
130 149 $("#imageTitle").toggleClass("hidden");
131 150 $("#imageContext").toggleClass("hidden");
... ... @@ -136,7 +155,6 @@
136 155 //设置编辑器的内容
137 156 ue.setContent('$!tempInfo.richText');
138 157 });
139   -
140 158 }
141 159 });
142 160  
parent/center.manager/src/main/webapp/WEB-INF/views/content/template_list.html View file @ d3a7267
... ... @@ -81,18 +81,8 @@
81 81 }
82 82  
83 83 function del(){
84   -
85 84 var seleions = $('#dataTable').bootstrapTable("getSelections","");
86   -// alert(JSON.stringify(seleions));
87   - layer.confirm('确定删除选中的短信吗?', {
88   - btn: ['确定','取消'], //按钮
89   - shade: false //不显示遮罩
90   - }, function(){
91   - layer.msg('删除成功', {icon: 1});
92   - }, function(){
93   - layer.msg('取消删除', {shift: 6});
94   - });
95   -
  85 + goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
96 86 }
97 87  
98 88 function search(){
... ... @@ -166,9 +156,6 @@
166 156 pageList: [200], //可供选择的每页的行数(*)
167 157 strictSearch: true,
168 158 onDblClickRow:function(row,ev){
169   - //alert(JSON.stringify(row));
170   -// var id = row.id;
171   -// alert(id)
172 159 popWindow("修改信息模板", APP.PATH + controllerRequestMappint + version.id+"/toEdit?id="+row.id+"&vName="+version.versionName,850,800);
173 160 },
174 161 queryParams:{
parent/center.manager/src/main/webapp/WEB-INF/views/tags/tags_edit.html View file @ d3a7267
... ... @@ -12,25 +12,27 @@
12 12 novalidate="novalidate">
13 13 <div class="form-group">
14 14 <label class="col-sm-4 control-label">父标签名称:</label>
15   - <div class="col-sm-3">
  15 + <div class="col-sm-5">
16 16 <input type="text" class="form-control" disabled class="form-control"
17   - placeholder="无" name="">
18   - <input type="text" name="perentId"/>
  17 + placeholder="无" value="$!pertTgName">
  18 + <input type="hidden" value="$!perId" name="perentId"/>
  19 + <input type="hidden" value="$!id" name="id"/>
19 20 </div>
20 21 </div>
21 22 <div class="hr-line-dashed"></div>
22 23 <div class="form-group">
23 24 <label class="col-sm-4 control-label">*标签名称:</label>
24   - <div class="col-sm-3">
  25 + <div class="col-sm-5">
25 26 <input type="text" class="form-control" required class="form-control"
26   - placeholder="请填入标签名称" name="tagName">
  27 + placeholder="请填入标签名称" value="$!contentTags.tagName" name="tagName">
  28 + <input type="hidden" value="$!level" name="level"/>
27 29 </div>
28 30 </div>
29 31 <div class="hr-line-dashed"></div>
30 32 <div class="form-group">
31 33 <label class="col-sm-4 control-label">*标签简介:</label>
32   - <div class="col-sm-3">
33   - <textarea class="form-control" rows="4" cols="12" aria-required="true" name="tagDesc" required="true" placeholder="请输入短信内容"></textarea>
  34 + <div class="col-sm-5">
  35 + <textarea class="form-control" rows="4" cols="12" aria-required="true" name="tagDesc" required="true" placeholder="请输入短信内容">$!contentTags.tagDesc</textarea>
34 36 </div>
35 37 </div>
36 38  
parent/center.manager/src/main/webapp/WEB-INF/views/tags/tags_list.html View file @ d3a7267
... ... @@ -19,8 +19,8 @@
19 19 <div class="row">
20 20 <div class="col-sm-12">
21 21 <div id="toolbar">
22   - <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
23   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
  22 + <button class="btn btn-info " type="button" onclick='add("","0","");'><i class="fa fa-plus"></i>新增父栏目</button>
  23 + <!--<button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>-->
24 24 <!--
25 25 <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
26 26 -->
27 27  
28 28  
29 29  
30 30  
... ... @@ -42,42 +42,124 @@
42 42 }
43 43 var controllerRequestMappint = "/contentTags/";
44 44  
45   -function add() {
46   - fullWindow("新增标签", APP.PATH + controllerRequestMappint + "/toEdit");
  45 +//添加子栏目
  46 +function add(id,level,tagName) {
  47 + popWindow("新增标签", APP.PATH + controllerRequestMappint + "0/toEdit?perId="+id+"&pertTgName="+tagName+"&level="+level,800,480);
47 48 }
48 49  
49   -function edit(){
50   - var id = getSingleSelectedValue("dataTable","id");
  50 +function editTag(id){
51 51 if(id){
52   - fullWindow("修改标签", APP.PATH + controllerRequestMappint + id + "/toEdit");
  52 + popWindow("修改标签", APP.PATH + controllerRequestMappint + id + "/toEdit",800,480);
53 53 }
54 54 }
55 55  
56   -function del(){
57   - goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete");
  56 +function delTag(id){
  57 + layer.confirm('确定删除吗?', {
  58 + btn: ['确定','取消'], //按钮
  59 + shade: false //不显示遮罩
  60 + }, function(){
  61 + ajaxPost(APP.PATH + controllerRequestMappint + id + "/delete","",function(r){
  62 + msg(r.message);
  63 + reloadGrid('dataTable');
  64 + });
  65 +
  66 + //layer.msg('删除成功', {icon: 1});
  67 + }, function(){
  68 + layer.msg('取消删除', {shift: 6});
  69 + });
58 70 }
59   -var default_dataUrl = APP.PATH + controllerRequestMappint + "list";
60   -var default_dataColumns = [{
61   - field: 'perent',
62   - title: '',
63   - formatter:function(value,row,index){
64   - if(value == ""){
65   - return '无';
66   - }else {
67   - return '下一级'
68   - }
69   - }
70   - },{
71   - field: 'tagName',
72   - title: '栏目名称'
73   - },{
74   - field: 'tagDesc',
75   - title: '栏目简介'
76   - },{
77   - field: 'level',
78   - title: '栏目等级'
79   - }];
80   -
  71 +
  72 +function buildTable(tab,id){
  73 + tab.bootstrapTable({
  74 + columns: [{
  75 + field: 'tagName',
  76 + title: '标签名称',
  77 + width: '20%',
  78 + },{
  79 + field: 'tagDesc',
  80 + title: '标签简介'
  81 + },{
  82 + field: 'level',
  83 + title: '栏目等级',
  84 + width: '10%',
  85 + },{
  86 + fileld:'id',
  87 + width: '20%',
  88 + formatter:function(value,row,index){
  89 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.tagName+"')>添加子标签</button>" +
  90 + "<button class='btn btn-sm btn-info m-r-xs' onclick=editTag('"+row.id+"')>编辑</button>" +
  91 + "<button class='btn btn-sm btn-danger' onclick=delTag('"+row.id+"')>删除</button>";
  92 + }
  93 + }],
  94 + url: APP.PATH + controllerRequestMappint + "list?perId="+id, //请求后台的URL(*)
  95 + method: 'post',
  96 + showHeader:true,
  97 + striped: true, //是否显示行间隔色
  98 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  99 + sortable: false, //是否启用排序
  100 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  101 + clickToSelect: true, //是否启用点击选中行
  102 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  103 + cardView: false, //是否显示详细视图
  104 + showColumns: false,
  105 + showExport: false,
  106 + showToggle: false,
  107 + detailView: true,
  108 + onExpandRow: function (index, row, detail) {
  109 + buildTable(detail.html('<table></table>').find('table'),row.id);
  110 + }
  111 + });
  112 +}
  113 +
  114 +$(function(){
  115 + $('#dataTable').bootstrapTable({
  116 + columns: [{
  117 + field: 'tagName',
  118 + title: '标签名称',
  119 + width: '20%',
  120 + },{
  121 + field: 'tagDesc',
  122 + title: '标签简介'
  123 + },{
  124 + field: 'level',
  125 + title: '栏目等级',
  126 + width: '10%',
  127 + },{
  128 + fileld:'id',
  129 + width: '20%',
  130 + formatter:function(value,row,index){
  131 + return "<button class='btn btn-sm btn-success m-r-xs' onclick=add('"+row.id+"',"+row.level+",'"+row.tagName+"')>添加子标签</button>" +
  132 + "<button class='btn btn-sm btn-info m-r-xs' onclick=editTag('"+row.id+"')>编辑</button>" +
  133 + "<button class='btn btn-sm btn-danger' onclick=delTag('"+row.id+"')>删除</button>";
  134 + }
  135 + }],
  136 + url: APP.PATH + controllerRequestMappint + "list", //请求后台的URL(*)
  137 + method: 'post',
  138 + contentType:'application/x-www-form-urlencoded',
  139 + toolbar: '#toolbar', //工具按钮用哪个容器
  140 + striped: true, //是否显示行间隔色
  141 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  142 + pagination: true, //是否显示分页(*)
  143 + sortable: false, //是否启用排序
  144 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  145 + pageNumber:1, //初始化加载第一页,默认第一页
  146 + pageSize: 10, //每页的记录行数(*)
  147 + pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  148 + strictSearch: true,
  149 + clickToSelect: true, //是否启用点击选中行
  150 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  151 + cardView: false, //是否显示详细视图
  152 + showRefresh: true,
  153 + showColumns: true,
  154 + showExport: true,
  155 + showToggle: true,
  156 + detailView: true,
  157 + onExpandRow: function (index, row, detail) {
  158 + buildTable(detail.html('<table></table>').find('table'),row.id);
  159 + }
  160 + });
  161 +})
  162 +
81 163 </script>
82 164 #end
83 165 #extends("/common/base_list.html")