/**
|
* APP版本管理初始化
|
*/
|
var MallAppVersion = {
|
id: "MallAppVersionTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
isIos: $( "#isIos").val() == 1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
MallAppVersion.initColumn = function () {
|
return [
|
{field: 'selectItem', checkbox: true},
|
{title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '版本号', field: 'versionNo', visible: true, align: 'center', valign: 'middle'},
|
{title: '版本id', field: 'versionId', visible: true, align: 'center', valign: 'middle', show: !MallAppVersion.isIos},
|
{title: '版本描述', field: 'remark', visible: true, align: 'center', valign: 'middle'},
|
{title: '苹果官网下载地址', field: 'appUrl', visible: true, align: 'center', valign: 'middle', show: MallAppVersion.isIos},
|
{title: '是否强制更新', field: 'isForceUpdate', visible: true, align: 'center', valign: 'middle', formatter: Feng.getIsObjFormat},
|
{title: '操作', field: 'opts', visible: true, align: 'left', valign: 'middle',
|
formatter: function (value, row) {
|
var opts = Feng.Opts();
|
if ($("#updateAuth").val() == 'true') {
|
opts.add("MallAppVersion.openMallAppVersionUpdate('"+row.id+"');", "编辑");
|
}
|
if ($("#deleteAuth").val() == 'true') {
|
opts.addDanger("MallAppVersion.delete('"+row.id+"');", "删除");
|
}
|
return opts.getOpts();
|
}
|
}
|
].filter( function( val) {
|
return ( typeof val.show == "undefined") || val.show;
|
});
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
MallAppVersion.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
MallAppVersion.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加APP版本
|
*/
|
MallAppVersion.openMallAppVersionAdd = function () {
|
var url = '/mallAppVersion/mallAppVersion_add';
|
if ( this.isIos) { url = '/mallAppVersion/mallAppVersionAddForIos'}
|
var index = layer.open({
|
type: 2,
|
title: '添加APP版本',
|
area: ['95%', '95%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + url
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 点击编辑APP版本
|
*/
|
MallAppVersion.openMallAppVersionUpdate = function (id) {
|
var url = '/mallAppVersion/mallAppVersion_update/';
|
if ( this.isIos) { url = '/mallAppVersion/mallAppVersion_updateIos/'}
|
var index = layer.open({
|
type: 2,
|
title: '编辑APP版本',
|
area: ['95%', '95%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + url + id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看APP版本详情
|
*/
|
MallAppVersion.openMallAppVersionDetail = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: 'APP版本详情',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/mallAppVersion/detail/' + id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 删除/批量删除APP版本
|
*/
|
MallAppVersion.delete = function(id){
|
var ids = id;
|
if ( id == 0) { ids = Feng.checkBoxIds( this.id); }
|
if ( ids.length <= 0) { return ; }
|
Feng.confirm( "是否确定".concat("删除").concat("所选中的数据?"), function () {
|
Feng.base_ajax( "/mallAppVersion/delete", { ids: ids}, function ( data) {
|
Feng.success( "删除成功");
|
MallAppVersion.search();
|
});
|
});
|
};
|
|
/**
|
* 编辑APP版本状态
|
*/
|
MallAppVersion.updateState = function (id, state) {
|
var ajax = new $ax(Feng.ctxPath + "/mallAppVersion/updateState", function (data) {
|
if(data.code == 200){
|
Feng.success("操作成功!");
|
MallAppVersion.table.refresh();
|
} else {
|
Feng.error("操作失败!" + data.message);
|
}
|
}, function () {
|
Feng.error("操作失败!");
|
});
|
ajax.set("mallAppVersionId", id);
|
ajax.set("state", state);
|
ajax.start();
|
};
|
|
/**
|
* 查询APP版本列表
|
*/
|
function extracted() {
|
var queryData = {
|
enumAppVersionType: MallAppVersion.isIos ? "IOS" : "ANDROID"
|
};
|
queryData['versionNo'] = $("#versionNo").val();
|
queryData['isForceUpdate'] = $("#isForceUpdate").val();
|
return queryData;
|
}
|
MallAppVersion.search = function () {
|
MallAppVersion.table.refresh({query: extracted()});
|
};
|
/**
|
* 重置查询条件
|
*/
|
MallAppVersion.resetSearch = function () {
|
$("#isForceUpdate").val("");
|
$("#versionNo").val("");
|
MallAppVersion.search();
|
};
|
$(function () {
|
var defaultColunms = MallAppVersion.initColumn();
|
var table = new BSTable(MallAppVersion.id, "/mallAppVersion/list", defaultColunms);
|
// 设置物理分页server(逻辑分页client)
|
table.setPaginationType("server");
|
// 表单提交参数
|
table.setQueryParams( extracted());
|
MallAppVersion.table = table.init();
|
|
// 初始化开始时间、结束时间
|
laydate.render({
|
elem: '#beginTime'
|
});
|
laydate.render({
|
elem: '#endTime'
|
});
|
});
|