Anthony

经营渠道 模块化

1 -define(function(){ 1 +define(['i18n!channel/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, indexlayout){
2 return { 2 return {
3 + resource:resource,
3 init:function(pltId){ 4 init:function(pltId){
4 - var pannel = getSelectedPanel();//初始化面板 5 + var pannel = indexlayout.getSelectedPanel();//初始化面板
5 var page = pannel.children(".channel-index-page").show().layout({ 6 var page = pannel.children(".channel-index-page").show().layout({
6 fit:true 7 fit:true
7 }); 8 });
...@@ -11,46 +12,48 @@ define(function(){ ...@@ -11,46 +12,48 @@ define(function(){
11 return pannel.find(".channel-datagrid").datagrid({ 12 return pannel.find(".channel-datagrid").datagrid({
12 url:'./query/724e4fca-4e91-4888-bc18-1ba639b4460c.json', 13 url:'./query/724e4fca-4e91-4888-bc18-1ba639b4460c.json',
13 toolbar:$('<div class="clearfix"></div>').rs_toolbar({ 14 toolbar:$('<div class="clearfix"></div>').rs_toolbar({
14 - title: resource.channel.title, 15 + title: resource.title,
15 - authz:getAuthzUtils('channel'), 16 + authz:base.getAuthz('channel'),
16 buttons:[{ 17 buttons:[{
17 - text:resource.btn.select, 18 + text:base.resource.btn.select,
18 iconCls:'btn-select select-condition', 19 iconCls:'btn-select select-condition',
19 code:'view', 20 code:'view',
20 handler: function(){ 21 handler: function(){
21 - showCondObject("724e4fca-4e91-4888-bc18-1ba639b4460c",datagridReload); 22 + base.showCondObject("724e4fca-4e91-4888-bc18-1ba639b4460c",datagridReload);
22 } 23 }
23 },{ 24 },{
24 - text:resource.btn.add, 25 + text:base.resource.btn.add,
25 iconCls:'btn-add', 26 iconCls:'btn-add',
26 code:'edit', 27 code:'edit',
27 handler: addDialog 28 handler: addDialog
28 },{ 29 },{
29 - text:resource.btn.edit, 30 + text:base.resource.btn.edit,
30 iconCls:'btn-edit', 31 iconCls:'btn-edit',
31 code:'edit', 32 code:'edit',
32 handler: editDialog 33 handler: editDialog
33 },{ 34 },{
34 - text:resource.btn.remove, 35 + text:base.resource.btn.remove,
35 iconCls:'btn-remove', 36 iconCls:'btn-remove',
36 code:'edit', 37 code:'edit',
37 handler: removeChannel 38 handler: removeChannel
38 }], 39 }],
39 tools:[{ 40 tools:[{
40 - text:resource.btn.refresh, 41 + text:base.resource.btn.refresh,
41 iconCls:'btn-refresh', 42 iconCls:'btn-refresh',
42 - handler:panelRefreshUtils 43 + handler:function() {
44 + indexlayout.getSelectedPanel().panel("refresh");
45 + }
43 }] 46 }]
44 }), 47 }),
45 columns:[[ 48 columns:[[
46 {field:'ck',checkbox:true }, 49 {field:'ck',checkbox:true },
47 - {field:'CHNAME',title:resource.channel.grid.name, width:120}, 50 + {field:'CHNAME',title:resource.grid.name, width:120},
48 - {field:'CHDESC',title:resource.channel.grid.desc, width:300}, 51 + {field:'CHDESC',title:resource.grid.desc, width:300},
49 - {field:'BRNAME',title:resource.channel.grid.brand, width:260}, 52 + {field:'BRNAME',title:resource.grid.brand, width:260},
50 - {field:'CHLIMIT',title:resource.channel.grid.brand,hidden:true}, 53 + {field:'CHLIMIT',title:resource.grid.brand,hidden:true},
51 - {field:'BRID',title:resource.channel.grid.brand,hidden:true}, 54 + {field:'BRID',title:resource.grid.brand,hidden:true},
52 - {field:'PTVALID',title:resource.channel.grid.valid, width:80,formatter: function(value,row,index){ 55 + {field:'PTVALID',title:resource.grid.valid, width:80,formatter: function(value,row,index){
53 - return value>0?resource.btn.yes:resource.btn.no; 56 + return value>0?base.resource.btn.yes:base.resource.btn.no;
54 }} 57 }}
55 ]], 58 ]],
56 onLoadSuccess:function(data){ 59 onLoadSuccess:function(data){
...@@ -77,7 +80,7 @@ define(function(){ ...@@ -77,7 +80,7 @@ define(function(){
77 editChannelBtn(); 80 editChannelBtn();
78 } 81 }
79 } 82 }
80 - },{text:resource.btn.cancel,handler:hideWindow}], 83 + },{text:base.resource.btn.cancel,handler:hideWindow}],
81 closed:true, 84 closed:true,
82 width:'500', 85 width:'500',
83 height:'auto' 86 height:'auto'
...@@ -103,7 +106,7 @@ define(function(){ ...@@ -103,7 +106,7 @@ define(function(){
103 function editDialog(){ 106 function editDialog(){
104 var row = getRow(); 107 var row = getRow();
105 if(row==null){ 108 if(row==null){
106 - $.messager.alert(resource.msg_title, resource.msgEditTip); 109 + $.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
107 }else{ 110 }else{
108 channelDialog.removeClass("add").dialog("open").dialog('setTitle',"编辑").find(".editChannelForm").show().form("load",row); 111 channelDialog.removeClass("add").dialog("open").dialog('setTitle',"编辑").find(".editChannelForm").show().form("load",row);
109 //var brid = channelDialog.find(".brId").val(); 112 //var brid = channelDialog.find(".brId").val();
...@@ -139,7 +142,7 @@ define(function(){ ...@@ -139,7 +142,7 @@ define(function(){
139 }}); 142 }});
140 channelDialog.find(".desc").textbox({iconAlign:'left',required: false,multiline:true,height:50}); 143 channelDialog.find(".desc").textbox({iconAlign:'left',required: false,multiline:true,height:50});
141 //查找框 144 //查找框
142 - readonlyUtils(channelDialog.find(".brName").searchbox({ 145 + base.readonly(channelDialog.find(".brName").searchbox({
143 required:false, 146 required:false,
144 searcher:chooseBrank, 147 searcher:chooseBrank,
145 prompt:"不限" 148 prompt:"不限"
...@@ -184,7 +187,7 @@ define(function(){ ...@@ -184,7 +187,7 @@ define(function(){
184 list:channelBrank 187 list:channelBrank
185 } 188 }
186 $.JSON("./channel/creatChannel.json",param,function(result){ 189 $.JSON("./channel/creatChannel.json",param,function(result){
187 - if(responseUtils(result)){ 190 + if($.response(result)){
188 hideWindow(); 191 hideWindow();
189 grid.datagrid("reload"); 192 grid.datagrid("reload");
190 } 193 }
...@@ -192,7 +195,7 @@ define(function(){ ...@@ -192,7 +195,7 @@ define(function(){
192 } 195 }
193 function editChannelBtn(){ 196 function editChannelBtn(){
194 if(Number(pltId)!=1){ 197 if(Number(pltId)!=1){
195 - return $.messager.alert(resource.msg_title, resource.channel.check.valid); 198 + return $.messager.alert(base.resource.msg_title, resource.check.valid);
196 } 199 }
197 200
198 if(!channelDialog.find(".editChannelForm").form("validate")){ 201 if(!channelDialog.find(".editChannelForm").form("validate")){
...@@ -222,7 +225,7 @@ define(function(){ ...@@ -222,7 +225,7 @@ define(function(){
222 list:channelBrank 225 list:channelBrank
223 } 226 }
224 $.JSON("./channel/editChannel.json",param,function(result){ 227 $.JSON("./channel/editChannel.json",param,function(result){
225 - if(responseUtils(result)){ 228 + if($.response(result)){
226 hideWindow(); 229 hideWindow();
227 channelBrank=[]; 230 channelBrank=[];
228 channelDialog.find(".brId").val(""); 231 channelDialog.find(".brId").val("");
...@@ -234,12 +237,12 @@ define(function(){ ...@@ -234,12 +237,12 @@ define(function(){
234 function removeChannel(){ 237 function removeChannel(){
235 var row = getRow(); 238 var row = getRow();
236 if(row == null){ 239 if(row == null){
237 - $.messager.alert(resource.msg_title, resource.msgRemoveTip); 240 + $.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
238 }else{ 241 }else{
239 - $.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){ 242 + $.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
240 if(r){ 243 if(r){
241 $.post("./channel/deleteChannel.json",row,function(result){ 244 $.post("./channel/deleteChannel.json",row,function(result){
242 - if(responseUtils(result)){ 245 + if($.response(result)){
243 grid.datagrid("reload"); 246 grid.datagrid("reload");
244 } 247 }
245 }); 248 });
...@@ -250,7 +253,7 @@ define(function(){ ...@@ -250,7 +253,7 @@ define(function(){
250 //选择适用经营品牌 253 //选择适用经营品牌
251 var channelBrank=[]; 254 var channelBrank=[];
252 function chooseBrank(){ 255 function chooseBrank(){
253 - showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, refresh:true,singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],onBeforeLoad:function(params){ 256 + base.showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, refresh:true,singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],onBeforeLoad:function(params){
254 return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1; 257 return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1;
255 }}, function(row){ 258 }}, function(row){
256 channelBrank=[]; 259 channelBrank=[];
...@@ -269,7 +272,7 @@ define(function(){ ...@@ -269,7 +272,7 @@ define(function(){
269 if(params){ 272 if(params){
270 grid.datagrid("reload",params); 273 grid.datagrid("reload",params);
271 }else{ 274 }else{
272 - grid.datagrid("reload",getCondObjectValue("724e4fca-4e91-4888-bc18-1ba639b4460c")); 275 + grid.datagrid("reload",base.getCondObjectValue("724e4fca-4e91-4888-bc18-1ba639b4460c"));
273 } 276 }
274 } 277 }
275 } 278 }
......