Anthony

经营渠道 模块化

define(function(){
define(['i18n!channel/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, indexlayout){
return {
resource:resource,
init:function(pltId){
var pannel = getSelectedPanel();//初始化面板
var pannel = indexlayout.getSelectedPanel();//初始化面板
var page = pannel.children(".channel-index-page").show().layout({
fit:true
});
......@@ -11,46 +12,48 @@ define(function(){
return pannel.find(".channel-datagrid").datagrid({
url:'./query/724e4fca-4e91-4888-bc18-1ba639b4460c.json',
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
title: resource.channel.title,
authz:getAuthzUtils('channel'),
title: resource.title,
authz:base.getAuthz('channel'),
buttons:[{
text:resource.btn.select,
text:base.resource.btn.select,
iconCls:'btn-select select-condition',
code:'view',
handler: function(){
showCondObject("724e4fca-4e91-4888-bc18-1ba639b4460c",datagridReload);
base.showCondObject("724e4fca-4e91-4888-bc18-1ba639b4460c",datagridReload);
}
},{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
code:'edit',
handler: addDialog
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
code:'edit',
handler: editDialog
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
code:'edit',
handler: removeChannel
}],
tools:[{
text:resource.btn.refresh,
text:base.resource.btn.refresh,
iconCls:'btn-refresh',
handler:panelRefreshUtils
handler:function() {
indexlayout.getSelectedPanel().panel("refresh");
}
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'CHNAME',title:resource.channel.grid.name, width:120},
{field:'CHDESC',title:resource.channel.grid.desc, width:300},
{field:'BRNAME',title:resource.channel.grid.brand, width:260},
{field:'CHLIMIT',title:resource.channel.grid.brand,hidden:true},
{field:'BRID',title:resource.channel.grid.brand,hidden:true},
{field:'PTVALID',title:resource.channel.grid.valid, width:80,formatter: function(value,row,index){
return value>0?resource.btn.yes:resource.btn.no;
{field:'CHNAME',title:resource.grid.name, width:120},
{field:'CHDESC',title:resource.grid.desc, width:300},
{field:'BRNAME',title:resource.grid.brand, width:260},
{field:'CHLIMIT',title:resource.grid.brand,hidden:true},
{field:'BRID',title:resource.grid.brand,hidden:true},
{field:'PTVALID',title:resource.grid.valid, width:80,formatter: function(value,row,index){
return value>0?base.resource.btn.yes:base.resource.btn.no;
}}
]],
onLoadSuccess:function(data){
......@@ -77,7 +80,7 @@ define(function(){
editChannelBtn();
}
}
},{text:resource.btn.cancel,handler:hideWindow}],
},{text:base.resource.btn.cancel,handler:hideWindow}],
closed:true,
width:'500',
height:'auto'
......@@ -103,7 +106,7 @@ define(function(){
function editDialog(){
var row = getRow();
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
channelDialog.removeClass("add").dialog("open").dialog('setTitle',"编辑").find(".editChannelForm").show().form("load",row);
//var brid = channelDialog.find(".brId").val();
......@@ -139,7 +142,7 @@ define(function(){
}});
channelDialog.find(".desc").textbox({iconAlign:'left',required: false,multiline:true,height:50});
//查找框
readonlyUtils(channelDialog.find(".brName").searchbox({
base.readonly(channelDialog.find(".brName").searchbox({
required:false,
searcher:chooseBrank,
prompt:"不限"
......@@ -184,7 +187,7 @@ define(function(){
list:channelBrank
}
$.JSON("./channel/creatChannel.json",param,function(result){
if(responseUtils(result)){
if($.response(result)){
hideWindow();
grid.datagrid("reload");
}
......@@ -192,7 +195,7 @@ define(function(){
}
function editChannelBtn(){
if(Number(pltId)!=1){
return $.messager.alert(resource.msg_title, resource.channel.check.valid);
return $.messager.alert(base.resource.msg_title, resource.check.valid);
}
if(!channelDialog.find(".editChannelForm").form("validate")){
......@@ -222,7 +225,7 @@ define(function(){
list:channelBrank
}
$.JSON("./channel/editChannel.json",param,function(result){
if(responseUtils(result)){
if($.response(result)){
hideWindow();
channelBrank=[];
channelDialog.find(".brId").val("");
......@@ -234,12 +237,12 @@ define(function(){
function removeChannel(){
var row = getRow();
if(row == null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
$.post("./channel/deleteChannel.json",row,function(result){
if(responseUtils(result)){
if($.response(result)){
grid.datagrid("reload");
}
});
......@@ -250,7 +253,7 @@ define(function(){
//选择适用经营品牌
var channelBrank=[];
function chooseBrank(){
showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, refresh:true,singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],onBeforeLoad:function(params){
base.showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, refresh:true,singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],onBeforeLoad:function(params){
return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1;
}}, function(row){
channelBrank=[];
......@@ -269,7 +272,7 @@ define(function(){
if(params){
grid.datagrid("reload",params);
}else{
grid.datagrid("reload",getCondObjectValue("724e4fca-4e91-4888-bc18-1ba639b4460c"));
grid.datagrid("reload",base.getCondObjectValue("724e4fca-4e91-4888-bc18-1ba639b4460c"));
}
}
}
......