|
|
/**
|
|
|
* Created by wangqianjun on 16/3/22.
|
|
|
*/
|
|
|
var $ = require('jquery');
|
|
|
common = require('../../common/common');
|
|
|
|
|
|
var ENUM = {
|
|
|
HotEnum: {
|
|
|
'1': '是',
|
|
|
'0': '否'
|
|
|
},
|
|
|
StatusEnum: {
|
|
|
1: '<b style="color:#5cb85c">开启</b>',
|
|
|
0: '<b style="color:#ff0000">关闭</b>'
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
|
|
size: 10,
|
|
|
parms: function () {
|
|
|
return {
|
|
|
name: common.util.__input('unionTypeName'),
|
|
|
unionType: common.util.__input('unionTypeID')
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
|
|
{display: 'ID', name: "id",
|
|
|
render: function (items) {
|
|
|
return '<a target="_blank" href="JavaScript:;" data-index="'+items.__index+'" class="btn btn-danger btn-xs url-detail">' + items.id + '</a>';
|
|
|
}},
|
|
|
{display: '名称', name: "name"},
|
|
|
{display: '创建人', name: "createId"},
|
|
|
{display: '创建时间', name: "createTimeStr"},
|
|
|
{display: '类型ID', name: "unionType"},
|
|
|
{display: '操作', name: "status", render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-modify">编辑</a>');
|
|
|
return HtmArr.join('');
|
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
g.init('/unionType/getUnionTypeList');
|
|
|
|
|
|
//==================== 按钮点击事件 =====================//
|
|
|
|
|
|
$("#filter-btn").click(function() {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
|
|
|
//添加
|
|
|
$(document).on('click', '#add-btn', function() {
|
|
|
editUnionType("新增", '/unionType/addUnionType', {});
|
|
|
});
|
|
|
|
|
|
//编辑
|
|
|
$(document).on('click', '.info-modify', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
editUnionType("修改", '/unionType/updateUnionType', item);
|
|
|
});
|
|
|
|
|
|
|
|
|
$(document).on('click', '.url-detail', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
var gUrl = new common.grid({
|
|
|
el: '#basicTableForUrl',
|
|
|
size: 10,
|
|
|
parms: function () {
|
|
|
return {
|
|
|
id: item.id
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
|
|
{display: '对外提供的链接', name: "url"},
|
|
|
{display: '适配应用市场推广', name: "applicationExtend"},
|
|
|
{display: '适配微信推广', name: "wechatExtend"},
|
|
|
{display: '适配网页推广', name: "webExtend"},
|
|
|
{display: '适配ios推广', name: "iosExtend"},
|
|
|
{display: '适配android推广', name: "androidExtend"},
|
|
|
{display: '优点', name: "pros"},
|
|
|
{display: '缺点', name: "cons"},
|
|
|
{display: '备注', name: "commont"}
|
|
|
]
|
|
|
});
|
|
|
gUrl.init('/unionType/getUnionTypeUrls');
|
|
|
|
|
|
$("#content-body").hide();
|
|
|
$("#content-head").hide();
|
|
|
$("#url-detail").show();
|
|
|
});
|
|
|
|
|
|
//返回
|
|
|
$(document).on('click', '#return-btn', function() {
|
|
|
$("#content-body").show();
|
|
|
$("#content-head").show();
|
|
|
$("#url-detail").hide();
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function editUnionType(prefix, url, item) {
|
|
|
var a = new common.edit(".unionTypeInfo", {bucket:"articleTags"});
|
|
|
common.dialog.confirm(prefix + '标签', common.util.__template2($("#template").html(), item), function () {
|
|
|
return a.submit(url,function(option){
|
|
|
option.success = function(res){
|
|
|
if(res.code=="200"){
|
|
|
a.$tip("提交成功", function() {
|
|
|
g.reload();
|
|
|
}, 'growl-success');
|
|
|
}else{
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
|
|
|
option.error = function(res){
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
a.init();
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|