Authored by chaogeng

Merge branch 'dev_grass_20190108' of http://git.yoho.cn/platform/platform-cms in…

…to dev_grass_20190108
... ... @@ -23,24 +23,22 @@
<dependencies>
<dependency>
<groupId>com.yohobuy.platform</groupId>
<artifactId>platform-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.service.platform.model</groupId>
<artifactId>platform-service-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.core</groupId>
<artifactId>yoho-core-rest-server</artifactId>
</dependency>
<dependency>
<groupId>com.yohobuy.platform</groupId>
<artifactId>platform-common</artifactId>
</dependency>
</dependencies>
</project>
... ...
package com.yohobuy.platform.grass.restapi;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.grass.service.IGrassArticleService;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -12,9 +17,17 @@ public class GrassArticleController {
private static final Logger logger = LoggerFactory.getLogger(GrassArticleController.class);
@RequestMapping("/publishArticle")
public ApiResponse publishArticle(){
@Autowired
IGrassArticleService grassArticleService;
@RequestMapping("/publishArticle")
public ApiResponse publishArticle(@RequestBody GrassArticleReq req){
logger.info("grassArticle publishArticle begin, req is {}", req);
try {
grassArticleService.publishArticle(req);
} catch (PlatformException e) {
return new ApiResponse.ApiResponseBuilder().code(e.getCode()).message(e.getMessage()).build();
}
return new ApiResponse.ApiResponseBuilder().build();
}
... ...
package com.yohobuy.platform.grass.restapi;
import com.yohobuy.platform.grass.service.IlabelGroupService;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
import com.yohobuy.platform.model.grass.response.LabelGroupBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by meiling.ge on 2019/1/8.
*/
@Controller
@RequestMapping("/labelGroupManage")
public class LabelGroupController {
private static Logger logger = LoggerFactory.getLogger(LabelGroupController.class);
@Autowired
private IlabelGroupService labelGroupService;
@RequestMapping("/getLabelGroupList")
@ResponseBody
public ApiResponse getLabelGroupList(LabelGroupReq req){
logger.info("enter getRedpacketList,req={}",req);
PageResponseVO<LabelGroupBo> result = labelGroupService.getLabelGroupList(req);
return new ApiResponse.ApiResponseBuilder().data(result).build();
}
@RequestMapping("/addUpLabelGroup")
@ResponseBody
public ApiResponse addUpLabelGroup(LabelGroupReq req){
logger.info("enter getRedpacketList,req={}",req);
labelGroupService.addUpLabelGroup(req);
return new ApiResponse.ApiResponseBuilder().build();
}
@RequestMapping("/deleteLabelGroup")
@ResponseBody
public ApiResponse deleteLabelGroup(LabelGroupReq req){
logger.info("enter updatePacketStatus,req = {}", req);
labelGroupService.deleteLabelGroup(req);
return new ApiResponse.ApiResponseBuilder().build();
}
}
... ...
package com.yohobuy.platform.grass.service;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
/**
*/
public interface IGrassArticleService {
void publishArticle(GrassArticleReq req) throws PlatformException;
}
... ...
package com.yohobuy.platform.grass.service;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
import com.yohobuy.platform.model.grass.response.LabelGroupBo;
/**
* Created by meiling.ge on 2019/1/8.
*/
public interface IlabelGroupService {
PageResponseVO<LabelGroupBo> getLabelGroupList(LabelGroupReq req);
void addUpLabelGroup(LabelGroupReq req);
void deleteLabelGroup(LabelGroupReq req);
}
... ...
package com.yohobuy.platform.grass.service.impl;
import com.google.common.collect.Lists;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.dal.grass.IGrassArticleDao;
import com.yohobuy.platform.dal.grass.IGrassArticleImageDao;
import com.yohobuy.platform.dal.grass.IGrassArticleSknDao;
import com.yohobuy.platform.dal.grass.model.GrassArticle;
import com.yohobuy.platform.dal.grass.model.GrassArticleImage;
import com.yohobuy.platform.dal.grass.model.GrassArticleSkn;
import com.yohobuy.platform.grass.service.IGrassArticleService;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
*/
@Component
public class GrassArticleServiceImpl implements IGrassArticleService{
private static final Logger logger = LoggerFactory.getLogger(GrassArticleServiceImpl.class);
@Resource
private IGrassArticleDao grassArticleDao;
@Resource
private IGrassArticleImageDao grassArticleImageDao;
@Resource
private IGrassArticleSknDao grassArticleSknDao;
@Override
public void publishArticle(GrassArticleReq req) throws PlatformException {
logger.info("enter publishArticle, req is {}", req);
publishCheck(req);
GrassArticle article = new GrassArticle();
article.setAuthorUid(req.getArticleUid());
article.setArticleContent(req.getContent());
article.setPublishTime(DateUtil.getCurrentTimeSeconds());
article.setTopicId(req.getTopicId());
try{
grassArticleDao.insertArticleSeletive(article);
logger.info("insert grass article success, uid is {}, ariticle id is {}", article.getAuthorUid(), article.getId());
}catch (Exception e){
logger.warn("insert grass article fail, uid is {}, e is {}",req.getArticleUid(), e );
throw new PlatformException("publish article failed", 402);
}
try{
List<GrassArticleImage> imageList = Lists.newArrayList();
String[] urls = req.getArticleImages().split(",");
for (String img: urls) {
GrassArticleImage image = new GrassArticleImage();
image.setArticleId(article.getId());
image.setImgSrc(img);
image.setCreateTime(DateUtil.getCurrentTimeSeconds());
imageList.add(image);
}
grassArticleImageDao.insertArticleImgs(imageList);
logger.info("insert grass article images success, ariticle id is {}, imageList size is {}", article.getId(), imageList.size());
}catch (Exception e){
logger.warn("insert article images fail,ariticle id is {}, e is {}",article.getId(), e );
}
try{
List<GrassArticleSkn> sknList = Lists.newArrayList();
String[] skns = req.getArticleSkns().split(",");
for (String skn: skns) {
GrassArticleSkn grassArticleSkn = new GrassArticleSkn();
grassArticleSkn.setArticleId(article.getId());
grassArticleSkn.setProductSkn(Integer.valueOf(skn));
grassArticleSkn.setCreateTime(DateUtil.getCurrentTimeSeconds());
sknList.add(grassArticleSkn);
}
grassArticleSknDao.insertArticleSkns(sknList);
logger.info("insert grass article skns success, ariticle id is {}, sknList size is {}", article.getId(), sknList.size());
}catch (Exception e){
logger.warn("insert article skns fail,ariticle id is {}, e is {}",article.getId(), e );
}
}
private void publishCheck(GrassArticleReq req) throws PlatformException {
if(req.getArticleUid() ==null){
logger.info("publishCheck uid is null");
throw new PlatformException("publish uid is null", 403);
}
if(StringUtils.isEmpty(req.getArticleImages())){
logger.info("publishCheck images is null");
throw new PlatformException("publish images is null", 403);
}
if(StringUtils.isEmpty(req.getArticleSkns())){
logger.info("publishCheck skn is null");
throw new PlatformException("publish skn is null", 403);
}
}
}
... ...
package com.yohobuy.platform.grass.service.impl;
import com.yohobuy.platform.common.util.BeanTool;
import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO;
import com.yohobuy.platform.dal.grass.model.LabelGroup;
import com.yohobuy.platform.grass.service.IlabelGroupService;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
import com.yohobuy.platform.model.grass.response.LabelGroupBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Created by meiling.ge on 2019/1/8.
*/
@Service
public class LabelGroupServiceImpl implements IlabelGroupService {
private static final Logger logger = LoggerFactory.getLogger(LabelGroupServiceImpl.class);
@Autowired
private IGrassLabelGroupDAO grassLabelGroupDAO;
@Override
public PageResponseVO<LabelGroupBo> getLabelGroupList(LabelGroupReq req) {
logger.info("getLabelGroupList req={}",req);
String groupName = req.getGroupName();
int total = grassLabelGroupDAO.CountByCondition(groupName);
List<LabelGroup> list = new ArrayList();
if(total > 0){
list = grassLabelGroupDAO.selectByPageCondition(groupName, req.getStart(), req.getSize());
}
List<LabelGroupBo> respList = BeanTool.copyList(list, LabelGroupBo.class);
PageResponseVO<LabelGroupBo> result = new PageResponseVO<>();
result.setList(respList);
result.setTotal(total);
result.setSize(req.getSize());
result.setPage(req.getPage());
logger.info("getLabelGroupList success! req={},total={},respList.size={}",req, total, respList.size());
return result;
}
@Override
public void addUpLabelGroup(LabelGroupReq req) {
logger.info("enter addUpLabelGroup req={}", req);
Integer id = req.getId();
LabelGroup record = new LabelGroup();
record.setId(id);
record.setGroupName(req.getGroupName());
record.setStatus(req.getStatus());
if(id != null && id > 0 ){//修改
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
grassLabelGroupDAO.updateByPrimaryKeySelective(record);
logger.info("addUpLabelGroup update success! req={}, record={}", req, record);
}else{//新增
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
record.setLabelAmount(0);
grassLabelGroupDAO.insert(record);
logger.info("addUpLabelGroup insert success! req={}, record={}", req, record);
}
}
@Override
public void deleteLabelGroup(LabelGroupReq req) {
logger.info("enter deleteLabelGroup id={}", req.getId());
grassLabelGroupDAO.deleteByPrimaryKey(req.getId());
logger.info("deleteLabelGroup success! id={}", req.getId());
}
}
... ...
... ... @@ -24,7 +24,7 @@
<dependency>
<groupId>com.yoho.service.platform.model</groupId>
<artifactId>platform-service-model</artifactId>
<version>1.2.3-6.8.4-SNAPSHOT</version>
<version>1.2.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhplatform</groupId>
... ...
... ... @@ -29,6 +29,10 @@
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhplatform</groupId>
<artifactId>platform-cms-grass</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhplatform</groupId>
<artifactId>platform-cms-suggest</artifactId>
</dependency>
<dependency>
... ...
... ... @@ -326,6 +326,10 @@ datasources:
- com.yohobuy.platform.dal.guang.IPlustarCategoryDAO
- com.yohobuy.platform.dal.guang.IRelationshipImageDAO
- com.yohobuy.platform.dal.guang.ResourceTabMapper
- com.yohobuy.platform.dal.grass.IGrassArticleDao
- com.yohobuy.platform.dal.grass.IGrassArticleImageDao
- com.yohobuy.platform.dal.grass.IGrassArticleSknDao
- com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
yhb_promotion:
servers:
... ...
... ... @@ -325,6 +325,10 @@ datasources:
- com.yohobuy.platform.dal.guang.IPlustarCategoryDAO
- com.yohobuy.platform.dal.guang.IRelationshipImageDAO
- com.yohobuy.platform.dal.guang.ResourceTabMapper
- com.yohobuy.platform.dal.grass.IGrassArticleDao
- com.yohobuy.platform.dal.grass.IGrassArticleImageDao
- com.yohobuy.platform.dal.grass.IGrassArticleSknDao
- com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
yhb_promotion:
servers:
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<style>
.btn-long {
width: 120px;
height: 37px;
line-height: 37px;
font-size: 15px;
color: white;
border-radius: 5px;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-long:hover {
opacity: 0.9;
}
</style>
</head>
<body class="easyui-layout" >
<div region="north" style="height: 100px;">
<script>
document.write(addHead('运营管理', '种草内容发布'));
</script>
</div>
<div region="center" id="labelGroupList" style="margin-left: 20px">
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="publishArticleForm" id="publishArticleForm" method="post" >
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>选择用户</label> <br>
<input id="articleUid" name="articleUid" class="easyui-textbox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>文字内容</label> <br>
<input id="content" name="content" class="easyui-textbox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>选择话题</label> <br>
<input id="topic" name="topicId" class="easyui-combobox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 20px">
<td >
<span style="color:red">*</span><label>选择图片</label>
<a id="addImage" class="btn-default" >选择图片+</a>
<input id="imgs" name="articleImages" hidden="hidden"/>
</td>
</tr>
<tr style="height: 60px">
<td id="imgTd">
<div id="imageUpload">
</div>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>关联商品</label> <br>
<a id="addSkn" class="btn-default" >新增商品+</a>
<input id="skns" name="articleSkns" hidden="hidden"/>
</td>
<td>
<img id="good1" src="" hidden>
<img id="good2" src="" hidden>
</td>
</tr>
<tr>
<td height="50" valign="bottom">
<input class="btn-primary" type="button" onclick="submit()" value="保存"/>
</td>
</tr>
</table>
</div>
</form>
</div>
</div>
</body>
<script>
var count = 1;
$(function () {
$("#articleUid").textbox({
required: true,
missingMessage: "发布用户不能为空",
prompt: "请输入发布用户"
});
$("#content").textbox({
required: true,
missingMessage: "发布内容不能为空",
prompt: "请输入发布内容"
});
$("#topic").combobox({
prompt: "请选择话题"
});
$("#imageUpload").imageUpload({
width: 171,
height: 120,
realInputName: "url",
url: contextPath + '/fileupload/uploadFile',
queryParams: {
bucket: "activity"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data.url;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
$("#imageUpload").after('<div id="imageUpload1">\n' +
' </div>');
oo(1);
return false;
}
});
function oo(num){
if(count >8){
return
}
$("#imageUpload"+num).imageUpload({
width: 171,
height: 120,
realInputName: "url",
url: contextPath + '/fileupload/uploadFile',
queryParams: {
bucket: "activity"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data.url;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
var nnum = num+1;
$("#imageUpload"+num).after('<div id="imageUpload'+nnum+'"> </div>');
count = count+1;
oo(nnum);
return false;
}
});
}
});
function submit(){
$("#publishArticleForm").form("submit",{
url : "http://localhost:8088/platform/grassArticle/publishArticle",
onSubmit : function(param) {
if (!$("#publishArticleForm").form("validate")) {
return false;
}
var imgs = '';
$("input[name='url']").each(function(j,item){
var url = item.val();
if(imgs == ''){
imgs = url;
}else{
imgs = imgs + ","+url;
}
});
$("#imgs").val(imgs);
return true;
},
success : function(data) {
if (data) {
data = $.parseJSON(data);
if (data.code == 200) {
$.messager.alert("保存成功");
} else {
$.messager.alert("保存失败", data.message, "error");
}
} else {
$.messager.alert("保存失败", data.message, "error");
}
}
});
}
function submit1(){
debugger
var imgs = '';
$("input[name='url']").each(function(j,item){
var url = item.value;
if(imgs == ''){
imgs = url;
}else{
imgs = imgs + ","+url;
}
});
$("#imgs").val(imgs);
$("#publishArticleForm").action="http://localhost:8088/platform/grassArticle/publishArticle";
$("#publishArticleForm").submit();
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="activityAddForm" id="activityAddForm" method="post" enctype="multipart/form-data">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>分组名称</label> <br>
<input id="groupName" name="groupName" class="easyui-textbox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>标签状态</label> <br>
<input type="radio" value="1" checked name="status" style="width:30px">开启</input>
<input type="radio" value="0" name="status" style="width:30px">关闭</input>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
$("#groupName").textbox({
required: true,
missingMessage: "分组名称不能为空",
prompt: "请输入分组名称"
});
var data = paramObject.mkData;
if (data){
$("#groupName").textbox("setValue", data.groupName);
if(data.status == 0){
$(":radio[name='status'][value='0']").prop("checked",true);
}else if(data.status == 1){
$(":radio[name='status'][value='1']").prop("checked",true);
}
}
});
</script>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<style>
.btn-long {
width: 120px;
height: 37px;
line-height: 37px;
font-size: 15px;
color: white;
border-radius: 5px;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-long:hover {
opacity: 0.9;
}
</style>
</head>
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<script>
document.write(addHead('运营管理', '标签分组管理'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
<input class="easyui-textbox" id="groupNameSearch" style="width: 140px">
</input>
<a id="searchBtn" class="btn-info">查询</a>
<!--<a id="addActivityBtn" class="btn-success">新增</a>-->
<a id="allBtn" class="btn-info">全部</a>
</div>
<div style="margin-left: 20px;margin-top: 10px">
<a id="addBtn" class="btn-long" style="background-color: #5CB85C;">+新建标签分组</a>
</div>
</div>
<div region="center" id="labelGroupList" style="margin-left: 20px">
<table id="labelGroupListTable"></table>
</div>
</body>
<script>
$(function() {
//用于页面刷新后的数据行定位
var index ="";
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#labelGroupListTable").datagrid("load", {});
}
});
$("#groupNameSearch").textbox({
required:false,
prompt: "请输入标签分组名称"
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#labelGroupListTable").datagrid("load", {
groupName: $("#groupNameSearch").textbox("getValue")
});
}
});
$("#addBtn").click(function () {
getEditDialog(null);
});
// 检索按钮
$("#labelGroupListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
/*queryParams: {
rewardName: $("#rewardName1").textbox("getValue"),
status: $("#rewardstatus1").combobox("getValue"),
type: $("#rewardtype1").combobox("getValue")
},*/
url: contextPath + "/labelGroupManage/getLabelGroupList",
method: 'POST',
loadFilter: function (data) {
var tmp = defaultLoadFilter(data);
tmp.rows = tmp.list;
return tmp;
},
columns: [[
{
title: "ID",
field: "id",
width: 15,
align: "center"
},
{
title: "标签分组名称",
field: "groupName",
width: 30,
align: "left"
},
{
title: "所属标签数",
field: "labelAmount",
width: 20,
align: "labelAmount"
}, {
title: "状态",
field: "status",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
if(value == '0'){
return "关闭";
}
if(value == '1'){
return "开启";
}
}
},
{
title: "操作",
field: "ddg",
width: 40,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str = "<a role='edit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #31b0d5' index='"+ rowIndex +"'>编辑</a>";
str += "<a role='close' style='margin-left:10px;background-color: #ffa951' dataId='"+ rowData.id +"' index='"+ rowIndex +"'>删除</a>";
return str;
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
if(index != ""){
$(this).datagrid("scrollTo",index);
index = "";
}
$(this).datagrid("getPanel").find("a[role='close']").linkbutton({
iconCls: "icon-redo",
onClick: function () {
var close_id = $(this).attr("dataId");
index = $(this).attr("index");
$.messager.confirm("确认", "确认删除该分组吗?", function (flag) {
if(flag){
$.post(contextPath + "/labelGroupManage/deleteLabelGroup", {
id : close_id,
}, function(data) {
if (data.code == CODE_SUCCESS) {
$("#labelGroupListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "删除成功!"
});
} else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
}
});
}
});
// 编辑
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls : "icon-edit",
onClick : function() {
index = $(this).attr("index");
var row = $("#labelGroupListTable").datagrid('getData').rows[index];
getEditDialog(row);
}
});
}
});
// 编辑分组
function getEditDialog(data){
var labelGroupList = $("<div id='labelGroupList'>").appendTo($(document.body));
var title = data == null ? "新建标签分组":"修改标签分组";
var textVar = data == null ? "保存":"保存";
var msgVar = data == null ? "确认新增分组吗?":"确认保存分组吗?";
window.self.paramObject.mkData = data;
$(labelGroupList).myDialog({
title: title,
width: "70%",
height: "80%",
resizable:false,
buttons:[{
id : "saveBtn",
text:textVar,
iconCls : "icon-save",
handler:function(){
$("#activityAddForm").form("submit", {
url: contextPath + "/labelGroupManage/addUpLabelGroup",
onSubmit: function (param) {
if(data != null){
param.id = data.id;
}
// param.status = $("input[name='statusRadio'][checked]").val();
if (!$("#activityAddForm").form("validate")) {
return false;
}
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后..."
});
return true;
},
success: function (data) {
$.messager.progress("close");
data = JSON.parse(data);
if (data.code == 200) {
$(labelGroupList).dialog("close");
$("#labelGroupListTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: title + "成功!",
height: 120
});
} else {
$.messager.alert("失败", data.message, "error");
}
}
});
}
}, {
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
if(flag){
$(labelGroupList).dialog("close");
}
});
}
}],
modal: true,
href: contextPath + "/html/grass/labelGroupManage/labelGroupEdit.html",
});
}
});
</script>
</html>
\ No newline at end of file
... ...
//todo 分解成多个接口,或接受参数的方式,实现加载可配置化,而不是笼统的暴力加载方式,太low
var contextPath = "/platform";
var contextPath = "/pfcms";
document.write("<meta charset='UTF-8'>");
//首先加载样式,保证样式先显示
... ...
var contextPath = "/platform";
var contextPath = "/pfcms";
document.write("<meta charset='UTF-8'>");
document.write("<script src='"+ contextPath +"/js/jquery/jquery-3.1.0.min.js'></script>");
... ...