Anthony

crm账套 模块化

...@@ -86,8 +86,8 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun ...@@ -86,8 +86,8 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
86 }); 86 });
87 87
88 //行转换 88 //行转换
89 - function getSelectedRow(){ 89 + function getSelectedRow(inst){
90 - var row = this.grid.datagrid('getSelected'); 90 + var row = inst.grid.datagrid('getSelected');
91 return row?{ 91 return row?{
92 actId:row.ACT_ID, 92 actId:row.ACT_ID,
93 actCode:row.ACT_CODE, 93 actCode:row.ACT_CODE,
...@@ -109,39 +109,39 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun ...@@ -109,39 +109,39 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
109 function addWindow(inst){ 109 function addWindow(inst){
110 //添加账套详情页面 110 //添加账套详情页面
111 index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailAdd"}, true, function(){ 111 index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailAdd"}, true, function(){
112 - this.grid.datagrid("reload"); 112 + inst.grid.datagrid("reload");
113 }); 113 });
114 } 114 }
115 //编辑页面弹出绑定按钮 115 //编辑页面弹出绑定按钮
116 function editWindow(inst){ 116 function editWindow(inst){
117 - var row = getSelectedRow.call(this); 117 + var row = getSelectedRow.call(this,inst);
118 if(row == null){ 118 if(row == null){
119 $.messager.alert(resource.msg_title, resource.msgEditTip); 119 $.messager.alert(resource.msg_title, resource.msgEditTip);
120 }else{ 120 }else{
121 index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+row.actId+"&actCode="+row.actCode}, true, function(){ 121 index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+row.actId+"&actCode="+row.actCode}, true, function(){
122 - this.grid.datagrid("reload"); 122 + inst.grid.datagrid("reload");
123 }); 123 });
124 } 124 }
125 } 125 }
126 //删除 126 //删除
127 function deleteData(inst){ 127 function deleteData(inst){
128 - var accountSet = getSelectedRow.call(this); 128 + var accountSet = getSelectedRow.call(this,inst);
129 if(accountSet == null){ 129 if(accountSet == null){
130 $.messager.alert(resource.msg_title, resource.msgRemoveTip); 130 $.messager.alert(resource.msg_title, resource.msgRemoveTip);
131 }else{ 131 }else{
132 - if(accountSet.actType==resource.accountset.title.sonAccount){ 132 + if(accountSet.actType==resource.title.sonAccount){
133 $.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){ 133 $.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
134 if(r){ 134 if(r){
135 accountSet.enable = ""; 135 accountSet.enable = "";
136 $.JSON("./accountSet/delete.json", accountSet, function(result){ 136 $.JSON("./accountSet/delete.json", accountSet, function(result){
137 - if(responseUtils(result)){ 137 + if($.response(result)){
138 - this.grid.datagrid("reload"); 138 + inst.grid.datagrid("reload");
139 } 139 }
140 }); 140 });
141 } 141 }
142 }); 142 });
143 }else{ 143 }else{
144 - $.messager.alert(resource.msg_title, resource.accountset.title.overActCntdelt); 144 + $.messager.alert(resource.msg_title, resource.title.overActCntdelt);
145 } 145 }
146 } 146 }
147 } 147 }
......
1 -define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, index){ 1 +define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index','lodash'], function (resource, Class, base, indexlayout,_){
2 - return Class({ 2 +
3 - resource: resource, 3 + return {
4 - variable: function () { //全局变量 4 + init : function(actId, actCode,usId){
5 - var panel = index.getSelectedPanel(); 5 + var brandCount = 0; //品牌searchbox渲染次数,第一次渲染的时候,需要刷新
6 - this.page = panel.children('.crm-accountset-detail').layout({fit: true}); 6 + var panel=indexlayout.getSelectedPanel();
7 - this.north = this.page.layout("panel", "north"); 7 + var query="f1fd6213-c928-4e72-87f2-f8bfe8589b19";
8 - this.center = this.page.layout("panel", "center"); 8 + var layout=panel.children('.crm-accountset-detail').layout({ fit:true });
9 - this.grid = $('<div></div>').appendTo(this.center); 9 + //声明整个登录账户选项卡容器
10 - this.queryId = 'f1fd6213-c928-4e72-87f2-f8bfe8589b19'; 10 + var page=panel.children('.crm-accountset-detail');
11 - this.tabs=this.center.children("div").tabs({closable : false, fit:true}); 11 + var north=page.layout("panel","north");
12 - this.netDetail = this.page.find(".netDetail"); 12 + var center=page.layout("panel","center");
13 - 13 + var wxgzh = "";
14 - }, 14 + var index = 0;
15 - initialize: function () {//界面布局 15 + var div = "<div class='easyui-tabs l-btn-left l-btn-icon-left'></div>";
16 - initNetDataGrid(this); 16 + var tabs=center.children("div").tabs({
17 - }, 17 + closable : false,
18 - handler: function(actId, actCode,usId){ //事件绑定 18 + fit:true
19 - var brandCount = 0; //品牌searchbox渲染次数,第一次渲染的时候,需要刷新 19 + });
20 - 20 + tabs.tabs({
21 - var wxgzh = ""; 21 + //toolPosition:'left',
22 - var index = 0; 22 + tools:[{
23 - var div = "<div class='easyui-tabs l-btn-left l-btn-icon-left'></div>"; 23 + iconCls:'icon-add',
24 - var tabs=center.children("div").tabs({ 24 + text: base.resource.btn.add,
25 - closable : false, 25 + handler:addNetTab
26 - fit:true 26 + },{
27 - }); 27 + iconCls:'icon-re',
28 - tabs.tabs({ 28 + text: base.resource.btn.remove,
29 - //toolPosition:'left', 29 + handler:removeNetTab
30 - tools:[{ 30 + }]
31 - iconCls:'icon-add', 31 + })
32 - text: resource.btn.add, 32 + tabs.tabs('update', {
33 - handler:addNetTab 33 + tab: tabs.tabs("getTab",0),
34 - },{ 34 + options: {
35 - iconCls:'icon-re', 35 + title: resource.grid.sites,
36 - text: resource.btn.remove, 36 + content:netDataGrid
37 - handler:removeNetTab 37 + }
38 - }] 38 + });
39 - }) 39 + var accsetDetail=north.find(".accountSet");
40 - tabs.tabs('update', { 40 + var accsetDetailform = accsetDetail.find(".accountSetForm");
41 - tab: tabs.tabs("getTab",0), 41 + var netDetail = page.find(".netDetail");
42 - options: { 42 +
43 - title: resource.accountset.grid.sites, 43 + //经营主体和短信通道联动
44 - content:netDataGrid 44 + var netDataGrid = initNetDataGrid();
45 - } 45 + accsetDetailform.find(".platFormDialog").searchbox({
46 - }); 46 + searcher:searchPlat,
47 - var accsetDetail=north.find(".accountSet"); 47 + prompt:resource.select,
48 - var accsetDetailform = accsetDetail.find(".accountSetForm"); 48 + onChange:platFormChange
49 - 49 + });
50 - 50 + if(0 != actId){
51 - //经营主体和短信通道联动 51 + $.post('./accountSetDetail/queryById.json',{"actId":actId},function(result){
52 - var netDataGrid = initNetDataGrid(); 52 + if($.response(result)){
53 - accsetDetailform.find(".platFormDialog").searchbox({ 53 + accsetDetailform.form("load", result.value);
54 - searcher:searchPlat, 54 + actCode = result.value.actCode;
55 - prompt:resource.accountset.select, 55 + if(result.value.actCode=="C001"){
56 - onChange:platFormChange 56 + accsetDetailform.find('.accSetType').val(resource.title.faAct);
57 - }); 57 + }else{
58 - if(0 != actId){ 58 + accsetDetailform.find('.accSetType').val(resource.title.soAct);
59 - $.post('./accountSetDetail/queryById.json',{"actId":actId},function(result){ 59 + }
60 - if(responseUtils(result)){ 60 + initMsgChannelCombobox();
61 - accsetDetailform.form("load", result.value); 61 + }
62 - actCode = result.value.actCode; 62 + });
63 - if(result.value.actCode=="C001"){ 63 + if('C001' == actCode){
64 - accsetDetailform.find('.accSetType').val(resource.accountset.title.faAct); 64 + accsetDetailform.find("div.msg").hide();
65 - }else{ 65 + accsetDetailform.find("div.margin").hide();
66 - accsetDetailform.find('.accSetType').val(resource.accountset.title.soAct); 66 + accsetDetailform.find("div.brand").hide();
67 - } 67 + accsetDetailform.find("div.outer").hide();
68 - initMsgChannelCombobox(); 68 + accsetDetailform.find("div.desc").hide();
69 - } 69 + tabs.hide();
70 - }); 70 + accsetDetailform.find(".actCode").attr("readonly", true);
71 - if('C001' == actCode){ 71 + accsetDetailform.find(".platFormDialog").searchbox("disable",true);
72 - accsetDetailform.find("div.msg").hide(); 72 + accsetDetailform.find(".enable").combobox({ disabled: true });
73 - accsetDetailform.find("div.margin").hide(); 73 + }else{
74 - accsetDetailform.find("div.brand").hide(); 74 + accsetDetailform.find(".actCode").attr("readonly",true);
75 - accsetDetailform.find("div.outer").hide(); 75 + $.post('./accountSet/querySiteGroup.json',{"actId":actId},function(result){
76 - accsetDetailform.find("div.desc").hide(); 76 + if($.response(result)){
77 - tabs.hide(); 77 + var siteGroup = result.list;
78 - accsetDetailform.find(".actCode").attr("readonly", true); 78 + if(siteGroup.length == 0){
79 - accsetDetailform.find(".platFormDialog").searchbox("disable",true); 79 + var tab ="";
80 - accsetDetailform.find(".enable").combobox({ disabled: true }); 80 + tab = tabs.tabs("getTab",0);
81 - }else{ 81 + tab.append("<input name='grpId' style='display:none' value='0' />");
82 - accsetDetailform.find(".actCode").attr("readonly",true); 82 + return;
83 - $.post('./accountSet/querySiteGroup.json',{"actId":actId},function(result){ 83 + }
84 - if(responseUtils(result)){ 84 + for (var i = 0; i < siteGroup.length; i++) {
85 - var siteGroup = result.list; 85 + var tab ="";
86 - if(siteGroup.length == 0){ 86 + var gridId = siteGroup[i].grpId;
87 - var tab =""; 87 + if(i==0){
88 - tab = tabs.tabs("getTab",0); 88 + tab = tabs.tabs("getTab",i);
89 - tab.append("<input name='grpId' style='display:none' value='0' />"); 89 + tab.append("<input name='grpId' style='display:none' value='"+gridId+"' />");
90 - return; 90 + //netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?c475cd0d-87b1-4ab8-adc2-9097cd7d4cb5="+siteGroup[i].grpId});
91 - } 91 + netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+siteGroup[i].grpId});
92 - for (var i = 0; i < siteGroup.length; i++) { 92 + }else{
93 - var tab =""; 93 + addtab(gridId);
94 - var gridId = siteGroup[i].grpId; 94 + tab = tabs.tabs("getTab",i);
95 - if(i==0){ 95 + }
96 - tab = tabs.tabs("getTab",i); 96 + tab.find(".content").find(".netForm").find(".wxghzName").searchbox({
97 - tab.append("<input name='grpId' style='display:none' value='"+gridId+"' />"); 97 + searcher:searchWxgzh,
98 - //netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?c475cd0d-87b1-4ab8-adc2-9097cd7d4cb5="+siteGroup[i].grpId}); 98 + prompt:resource.select
99 - netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+siteGroup[i].grpId}); 99 + });
100 - }else{ 100 + base.readonly(tab.find(".content").find(".netForm").find(".wxghzName"),function(){
101 - addtab(gridId); 101 + tab.find(".content").find(".netForm").find(".wxghz").val("");
102 - tab = tabs.tabs("getTab",i); 102 + tab.find(".content").find(".netForm").find(".gzhType").val("");
103 - } 103 + });
104 - tab.find(".content").find(".netForm").find(".wxghzName").searchbox({ 104 +
105 - searcher:searchWxgzh, 105 + tab.find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",siteGroup[i].nickName);
106 - prompt:resource.accountset.select 106 + tab.find(".content").find(".netForm").find(".wxghz").val(siteGroup[i].gzhId);
107 - }); 107 + tab.find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(siteGroup[i].gzhType));
108 - readonlyUtils(tab.find(".content").find(".netForm").find(".wxghzName"),function(){ 108 + }
109 - tab.find(".content").find(".netForm").find(".wxghz").val(""); 109 + }
110 - tab.find(".content").find(".netForm").find(".gzhType").val(""); 110 + });
111 - }); 111 + }
112 - 112 +
113 - tab.find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",siteGroup[i].nickName); 113 + }else{
114 - tab.find(".content").find(".netForm").find(".wxghz").val(siteGroup[i].gzhId); 114 + accsetDetailform.find(".actCode").val(actCode);
115 - tab.find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(siteGroup[i].gzhType)); 115 + accsetDetailform.find(".accSetType").val(resource.title.soAct);
116 - } 116 + base.readonly(netDetail.find(".netForm").find(".wxghzName"),function(){
117 - } 117 + netDetail.find(".netForm").find(".wxghz").val("");
118 - }); 118 + netDetail.find(".netForm").find(".gzhType").val("");
119 - } 119 + });
120 - 120 + netDetail.find(".netForm").find(".wxghzName").searchbox({
121 - }else{ 121 + searcher:searchWxgzh,
122 - accsetDetailform.find(".actCode").val(actCode); 122 + prompt:resource.select
123 - accsetDetailform.find(".accSetType").val(resource.accountset.title.soAct); 123 + });
124 - readonlyUtils(netDetail.find(".netForm").find(".wxghzName"),function(){
125 - netDetail.find(".netForm").find(".wxghz").val("");
126 - netDetail.find(".netForm").find(".gzhType").val("");
127 - });
128 - netDetail.find(".netForm").find(".wxghzName").searchbox({
129 - searcher:searchWxgzh,
130 - prompt:resource.accountset.select
131 - });
132 // initMsgChannelCombobox(); 124 // initMsgChannelCombobox();
133 - } 125 + }
134 - 126 +
135 - function searchWxgzh(){ 127 + function searchWxgzh(){
136 - showCondObject({id:'2582a029-3902-4934-a206-d638f96d4b08',showGrid:true,refresh:true},function(row){ 128 + base.showCondObject({id:'2582a029-3902-4934-a206-d638f96d4b08',showGrid:true,refresh:true},function(row){
137 - var tabAll = tabs.tabs("tabs"); 129 + var tabAll = tabs.tabs("tabs");
138 - for (var i = 0; i < tabAll.length; i++) { 130 + for (var i = 0; i < tabAll.length; i++) {
139 - var tab = tabs.tabs("getTab",i); 131 + var tab = tabs.tabs("getTab",i);
140 - if(row.GZH_ID == tab.find(".content").find(".netForm").find(".wxghz").val()){ 132 + if(row.GZH_ID == tab.find(".content").find(".netForm").find(".wxghz").val()){
141 - if(row.NICK_NAME == tab.find(".content").find(".netForm").find(".wxghzName").val()) { 133 + if(row.NICK_NAME == tab.find(".content").find(".netForm").find(".wxghzName").val()) {
142 - return $.messager.alert(resource.msg_title, row.NICK_NAME + resource.accountset.title.plBeSelected); 134 + return $.messager.alert(resource.msg_title, row.NICK_NAME + resource.title.plBeSelected);
143 - } 135 + }
144 - } 136 + }
145 - } 137 + }
146 - 138 +
147 - tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",row.NICK_NAME); 139 + tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",row.NICK_NAME);
148 - tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghz").val(row.GZH_ID); 140 + tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghz").val(row.GZH_ID);
149 - tabs.tabs('getSelected').find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(row.GZH_TYPE)); 141 + tabs.tabs('getSelected').find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(row.GZH_TYPE));
150 - }); 142 + });
151 - } 143 + }
152 - 144 +
153 - /** 145 + /**
154 - * 新增tab,除了第一个tab提前定义好,后面的都是通过此方法新增 146 + * 新增tab,除了第一个tab提前定义好,后面的都是通过此方法新增
155 - */ 147 + */
156 - function addtab(grpId){ 148 + function addtab(grpId){
157 - index++; 149 + index++;
158 - tabs.tabs('add',{ 150 + tabs.tabs('add',{
159 - title: resource.accountset.grid.sites+index, 151 + title: resource.grid.sites+index,
160 - closable: false 152 + closable: false
161 - }); 153 + });
162 - var tabPanel =tabs.tabs('getSelected'); 154 + var tabPanel =tabs.tabs('getSelected');
163 - var addTable = $('<table class="data'+index+'"></table>'); 155 + var addTable = $('<table class="data'+index+'"></table>');
164 - tabPanel.html(addTable); 156 + tabPanel.html(addTable);
165 - tabPanel.append("<input name='grpId' style='display:none' value='"+grpId+"' />"); 157 + tabPanel.append("<input name='grpId' style='display:none' value='"+grpId+"' />");
166 - addTable.datagrid({ 158 + addTable.datagrid({
167 - singleSelect : false, 159 + singleSelect : false,
168 - toolbar:$('<div class="clearfix"></div>').rs_toolbar({ 160 + toolbar:$('<div class="clearfix"></div>').rs_toolbar({
169 - content:addbtml(), 161 + content:addbtml(),
170 - title:resource.accountset.title.suitSite, 162 + title:resource.title.suitSite,
171 - authz:getAuthzUtils('accountSet'), 163 + authz:base.getAuthz('accountSet'),
172 - buttons:[{ 164 + buttons:[{
173 - code:'edit', 165 + code:'edit',
174 - text: resource.btn.add, 166 + text: base.resource.btn.add,
175 - iconCls:'btn-add', 167 + iconCls:'btn-add',
176 - handler: addNet 168 + handler: addNet
177 - },{ 169 + },{
178 - code:'edit', 170 + code:'edit',
179 - text: resource.btn.remove, 171 + text: base.resource.btn.remove,
180 - iconCls:'btn-remove', 172 + iconCls:'btn-remove',
181 - handler:removeNet 173 + handler:removeNet
182 - }] 174 + }]
183 - }), 175 + }),
184 - columns:[[ 176 + columns:[[
185 - {field:'ck',checkbox:true }, 177 + {field:'ck',checkbox:true },
186 - {field:'SICODE',title:resource.accountset.grid.sicode, width:100, align:"center"}, 178 + {field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
187 - {field:'SINAME',title:resource.accountset.grid.siname, width:100, align:"center"}, 179 + {field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
188 - {field:'BENAME',title:resource.accountset.grid.bename, width:100, align:"center"}, 180 + {field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
189 - {field:'BEBNAME',title:resource.accountset.grid.bebname, width:100, align:"center"} 181 + {field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
190 - ]] 182 + ]]
191 - }); 183 + });
192 - addTable.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+grpId}); 184 + addTable.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+grpId});
193 - } 185 + }
194 - accsetDetail.rs_toolbar({ 186 + accsetDetail.rs_toolbar({
195 - content:accsetDetailform, 187 + content:accsetDetailform,
196 - buttons:[{ 188 + buttons:[{
197 - text:resource.btn.save, 189 + text:base.resource.btn.save,
198 - iconCls:'btn-add', 190 + iconCls:'btn-add',
199 - handler:saveAccsetDetail 191 + handler:saveAccsetDetail
200 - }], 192 + }],
201 - tools:[{ 193 + tools:[{
202 - text:resource.btn.refresh, 194 + text:base.resource.btn.refresh,
203 - iconCls:'btn-refresh', 195 + iconCls:'btn-refresh',
204 - handler:panelRefreshUtils 196 + handler:function() {
205 - } 197 + indexlayout.getSelectedPanel().panel("refresh");
206 - ] 198 + }
207 - }); 199 + }
208 - 200 + ]
209 - //主管平台和短信通道联动 201 + });
210 - var platformChangeFlag = false; 202 +
211 - function platFormChange(newValue, oldValue){ 203 + //主管平台和短信通道联动
212 - platformChangeFlag = true; 204 + var platformChangeFlag = false;
213 - } 205 + function platFormChange(newValue, oldValue){
214 - 206 + platformChangeFlag = true;
215 - function searchPlat(){ 207 + }
216 - showCondObject({id:'0089f254-a93b-4f98-b8f7-0312ce06de45',showGrid:true,refresh:true},function(row){ 208 +
217 - accsetDetailform.find(".platFormDialog").searchbox('setValue',row.PLNAME); 209 + function searchPlat(){
218 - accsetDetailform.find(".ptfId").val(row.PLID); 210 + base.showCondObject({id:'0089f254-a93b-4f98-b8f7-0312ce06de45',showGrid:true,refresh:true},function(row){
219 - if(platformChangeFlag){ 211 + accsetDetailform.find(".platFormDialog").searchbox('setValue',row.PLNAME);
220 - initMsgChannelComboboxAfterPlatform(row.PLID) 212 + accsetDetailform.find(".ptfId").val(row.PLID);
221 - platformChangeFlag = false; 213 + if(platformChangeFlag){
222 - } 214 + initMsgChannelComboboxAfterPlatform(row.PLID)
223 - }); 215 + platformChangeFlag = false;
224 - } 216 + }
225 - 217 + });
226 - readonlyUtils(accsetDetailform.find(".platFormDialog"),function(){ 218 + }
227 - accsetDetailform.find(".ptfId").val(""); 219 +
228 - }); 220 + base.readonly(accsetDetailform.find(".platFormDialog"),function(){
229 - 221 + accsetDetailform.find(".ptfId").val("");
230 - accsetDetailform.find(".applyBrandDialog").searchbox({ 222 + });
231 - searcher:searchBrand, 223 +
232 - prompt:resource.accountset.noLimit 224 + accsetDetailform.find(".applyBrandDialog").searchbox({
233 - }); 225 + searcher:searchBrand,
234 - 226 + prompt:resource.noLimit
235 - function initMsgChannelCombobox(){ 227 + });
236 - var plid = accsetDetailform.find("input[name='ptfId']").val(); 228 +
237 - var param={ 229 + function initMsgChannelCombobox(){
238 - plId:plid, 230 + var plid = accsetDetailform.find("input[name='ptfId']").val();
239 - type:1 231 + var param={
240 - }; 232 + plId:plid,
241 - $.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){ 233 + type:1
242 - if(responseUtils(result)){ 234 + };
243 - accsetDetailform.find(".msgChannel").combobox("loadData", result.list); 235 + $.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
244 - var data =accsetDetailform.find(".msgChannel").combobox('getData'); 236 + if($.response(result)){
237 + accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
238 + var data =accsetDetailform.find(".msgChannel").combobox('getData');
245 // accsetDetailform.find(".msgChannel").combobox('select',data[0].id); 239 // accsetDetailform.find(".msgChannel").combobox('select',data[0].id);
246 - } 240 + }
247 - }); 241 + });
248 - } 242 + }
249 - 243 +
250 - function initMsgChannelComboboxAfterPlatform(plid){ 244 + function initMsgChannelComboboxAfterPlatform(plid){
251 - var param={ 245 + var param={
252 - plId:plid, 246 + plId:plid,
253 - type:1 247 + type:1
254 - }; 248 + };
255 - $.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){ 249 + $.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
256 - if(responseUtils(result)){ 250 + if($.response(result)){
257 - accsetDetailform.find(".msgChannel").combobox("loadData", result.list); 251 + accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
258 - var data =accsetDetailform.find(".msgChannel").combobox('getData'); 252 + var data =accsetDetailform.find(".msgChannel").combobox('getData');
259 - accsetDetailform.find(".msgChannel").combobox('clear'); 253 + accsetDetailform.find(".msgChannel").combobox('clear');
260 - } 254 + }
261 - }); 255 + });
262 - } 256 + }
263 - 257 +
264 - function searchBrand(){ 258 + function searchBrand(){
265 - brandCount++; 259 + brandCount++;
266 - var refreshFlag = false; 260 + var refreshFlag = false;
267 - if(brandCount == 1){ 261 + if(brandCount == 1){
268 - var refreshFlag = true; 262 + var refreshFlag = true;
269 - } 263 + }
270 - showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],refresh:refreshFlag,onBeforeLoad:function(params){ 264 + base.showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],refresh:refreshFlag,onBeforeLoad:function(params){
271 - return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1; 265 + return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1;
272 - }}, function(rows){ 266 + }}, function(rows){
273 - var brandIdArray = ""; 267 + var brandIdArray = "";
274 - var brandArray = ""; 268 + var brandArray = "";
275 - for (var i = 0; i < rows.length; i++) { 269 + for (var i = 0; i < rows.length; i++) {
276 - var row = rows[i]; 270 + var row = rows[i];
277 - if(i==rows.length-1){ 271 + if(i==rows.length-1){
278 - brandIdArray += row.BRID; 272 + brandIdArray += row.BRID;
279 - brandArray += row.BRNAME; 273 + brandArray += row.BRNAME;
280 - }else{ 274 + }else{
281 - brandIdArray += row.BRID + ","; 275 + brandIdArray += row.BRID + ",";
282 - brandArray += row.BRNAME + ","; 276 + brandArray += row.BRNAME + ",";
283 - } 277 + }
284 - } 278 + }
285 - accsetDetailform.find(".brId").val(brandIdArray); 279 + accsetDetailform.find(".brId").val(brandIdArray);
286 - accsetDetailform.find(".applyBrandDialog").searchbox("setValue",brandArray); 280 + accsetDetailform.find(".applyBrandDialog").searchbox("setValue",brandArray);
287 - }); 281 + });
288 - } 282 + }
289 - 283 +
290 - readonlyUtils(accsetDetailform.find(".applyBrandDialog"),function(){ 284 + base.readonly(accsetDetailform.find(".applyBrandDialog"),function(){
291 - accsetDetailform.find(".brId").val(""); 285 + accsetDetailform.find(".brId").val("");
292 - }); 286 + });
293 - 287 +
294 - function prepareAccount(){ 288 + function prepareAccount(){
295 - if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){ 289 + if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
296 - $.messager.alert(resource.msg_title, resource.accountset.validateMsgChannel,'warning', function(){accsetDetailform.form("validate");}); 290 + $.messager.alert(resource.msg_title, resource.validateMsgChannel,'warning', function(){accsetDetailform.form("validate");});
297 - return; 291 + return;
298 - } 292 + }
299 - if(!accsetDetailform.form("validate")){ 293 + if(!accsetDetailform.form("validate")){
300 - return; 294 + return;
301 - } 295 + }
302 - if("" == accsetDetailform.find("input[name='actCode']").val() || null == accsetDetailform.find("input[name='actCode']").val()){ 296 + if("" == accsetDetailform.find("input[name='actCode']").val() || null == accsetDetailform.find("input[name='actCode']").val()){
303 - $.messager.alert(resource.msg_title, resource.accountset.validateCode); 297 + $.messager.alert(resource.msg_title, resource.validateCode);
304 - return; 298 + return;
305 - } 299 + }
306 - if("" == accsetDetailform.find("input[name='actName']").val() || null == accsetDetailform.find("input[name='actName']").val()){ 300 + if("" == accsetDetailform.find("input[name='actName']").val() || null == accsetDetailform.find("input[name='actName']").val()){
307 - $.messager.alert(resource.msg_title, resource.accountset.validateName); 301 + $.messager.alert(resource.msg_title, resource.validateName);
308 - return; 302 + return;
309 - } 303 + }
310 - if("" == accsetDetailform.find("input[name='ptfId']").val() || null == accsetDetailform.find("input[name='ptfId']").val()){ 304 + if("" == accsetDetailform.find("input[name='ptfId']").val() || null == accsetDetailform.find("input[name='ptfId']").val()){
311 - $.messager.alert(resource.msg_title, resource.accountset.validatePlatForm); 305 + $.messager.alert(resource.msg_title, resource.validatePlatForm);
312 - return; 306 + return;
313 - } 307 + }
314 - 308 +
315 - if('C001' != accsetDetailform.find("input[name='actCode']").val()){ 309 + if('C001' != accsetDetailform.find("input[name='actCode']").val()){
316 - if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){ 310 + if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
317 - $.messager.alert(resource.msg_title, resource.accountset.validateMsgChannel); 311 + $.messager.alert(resource.msg_title, resource.validateMsgChannel);
318 - return; 312 + return;
319 - } 313 + }
320 - var param={ 314 + var param={
321 - actId:accsetDetailform.find("input[name='actId']").val(), 315 + actId:accsetDetailform.find("input[name='actId']").val(),
322 - actCode:accsetDetailform.find("input[name='actCode']").val(), 316 + actCode:accsetDetailform.find("input[name='actCode']").val(),
323 - actName:accsetDetailform.find("input[name='actName']").val(), 317 + actName:accsetDetailform.find("input[name='actName']").val(),
324 - ptfId:accsetDetailform.find("input[name='ptfId']").val(), 318 + ptfId:accsetDetailform.find("input[name='ptfId']").val(),
325 - msgId:accsetDetailform.find("input[name='msgChannel']").val(), 319 + msgId:accsetDetailform.find("input[name='msgChannel']").val(),
326 - brId:accsetDetailform.find("input[name='brId']").val(), 320 + brId:accsetDetailform.find("input[name='brId']").val(),
327 - enable:accsetDetailform.find("input[name='enable']").val(), 321 + enable:accsetDetailform.find("input[name='enable']").val(),
328 - actDesc:accsetDetailform.find("input[name='actDesc']").val(), 322 + actDesc:accsetDetailform.find("input[name='actDesc']").val(),
329 - }; 323 + };
330 - 324 +
331 - var siteGroup = []; 325 + var siteGroup = [];
332 - var tabAll = tabs.tabs("tabs"); 326 + var tabAll = tabs.tabs("tabs");
333 - for (var i = 0; i < tabAll.length; i++) { 327 + for (var i = 0; i < tabAll.length; i++) {
334 - var tab = tabs.tabs("getTab",i); 328 + var tab = tabs.tabs("getTab",i);
335 - var datagrid = tab.find(".datagrid-f"); 329 + var datagrid = tab.find(".datagrid-f");
336 - var rows = datagrid.datagrid("getData").rows; 330 + var rows = datagrid.datagrid("getData").rows;
337 - if(rows.length==0){ 331 + if(rows.length==0){
338 - $.messager.alert(resource.msg_title,"请选择"+tab.panel('options').title+"!"); 332 + $.messager.alert(resource.msg_title,"请选择"+tab.panel('options').title+"!");
339 - return; 333 + return;
340 - } 334 + }
341 - var site=""; 335 + var site="";
342 - for (var j = 0; j < rows.length; j++) { 336 + for (var j = 0; j < rows.length; j++) {
343 - if(j==rows.length-1){ 337 + if(j==rows.length-1){
344 - site +=rows[j].SIID; 338 + site +=rows[j].SIID;
345 - }else{ 339 + }else{
346 - site +=rows[j].SIID+","; 340 + site +=rows[j].SIID+",";
347 - } 341 + }
348 - } 342 + }
349 - var grpName = tab.panel('options').title; 343 + var grpName = tab.panel('options').title;
350 - var groupId = tab.find("input[name='grpId']").val(); 344 + var groupId = tab.find("input[name='grpId']").val();
351 - var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val(); 345 + var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
352 - siteGroup.push({ 346 + siteGroup.push({
353 - grpName:grpName, 347 + grpName:grpName,
354 - grpId : groupId, 348 + grpId : groupId,
355 - grpIndex:i, 349 + grpIndex:i,
356 - gzhId:gzhId, 350 + gzhId:gzhId,
357 - site:site 351 + site:site
358 - }); 352 + });
359 - } 353 + }
360 - param["siteGroupList"] = siteGroup; 354 + param["siteGroupList"] = siteGroup;
361 - }else{ 355 + }else{
362 - var param={ 356 + var param={
363 - actId:accsetDetailform.find("input[name='actId']").val(), 357 + actId:accsetDetailform.find("input[name='actId']").val(),
364 - actCode:accsetDetailform.find("input[name='actCode']").val(), 358 + actCode:accsetDetailform.find("input[name='actCode']").val(),
365 - actName:accsetDetailform.find("input[name='actName']").val(), 359 + actName:accsetDetailform.find("input[name='actName']").val(),
366 - }; 360 + };
367 - } 361 + }
368 - return param; 362 + return param;
369 - } 363 + }
370 - function saveAccsetDetail(){ 364 + function saveAccsetDetail(){
371 - var param = prepareAccount(); 365 + var param = prepareAccount();
372 - if(param == null){ 366 + if(param == null){
373 - return; 367 + return;
374 - } 368 + }
375 - $.messager.confirm(resource.msg_title,resource.users.saveTitle, function(r){ 369 + $.messager.confirm(resource.msg_title,resource.saveTitle, function(r){
376 - if (r){ 370 + if (r){
377 - $.JSON('./accountSet/add.json', param, function(result){ 371 + $.JSON('./accountSet/add.json', param, function(result){
378 - if(responseUtils(result)){ 372 + if($.response(result)){
379 - closeSelectedPanel(); 373 + indexlayout.closeSelectedPanel();
380 - } 374 + }
381 - }); 375 + });
382 - } 376 + }
383 - }) 377 + })
384 - } 378 + }
385 - 379 +
386 - function saveTabBeforeSecondGroup(){ 380 + function saveTabBeforeSecondGroup(){
387 - var param = prepareAccount(); 381 + var param = prepareAccount();
388 - if(param == null){ 382 + if(param == null){
389 - return; 383 + return;
390 - } 384 + }
391 - $.messager.confirm(resource.msg_title,resource.users.saveTitle, function(r){ 385 + $.messager.confirm(resource.msg_title,resource.saveTitle, function(r){
392 - if (r){ 386 + if (r){
393 - $.JSON('./accountSet/add.json', param, function(result){ 387 + $.JSON('./accountSet/add.json', param, function(result){
394 - if(responseUtils(result)){ 388 + if($.response(result)){
395 - var actId = result.value.actId; 389 + var actId = result.value.actId;
396 - var actCode = result.value.actCode; 390 + var actCode = result.value.actCode;
397 - base.showPanel({text:resource.accountset.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+result.value.actId+"&actCode="+result.value.actCode}, true, function(){ 391 + indexlayout.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+result.value.actId+"&actCode="+result.value.actCode}, true, function(){
398 - panelRefreshUtils(); 392 + indexlayout.getSelectedPanel().panel("refresh");
399 - }); 393 + });
400 - } 394 + }
401 - }); 395 + });
402 - } 396 + }
403 - }) 397 + })
404 - } 398 + }
405 - 399 +
406 - //网点新建datagrid 400 + //网点新建datagrid
407 - function addNet(){ 401 + function addNet(){
408 - showCondObject({id:"37236df9-2c96-11e6-abf4-3c970e1c88a0", showGrid:true,refresh:true, singleSelect:false, 402 + base.showCondObject({id:"37236df9-2c96-11e6-abf4-3c970e1c88a0", showGrid:true,refresh:true, singleSelect:false,
409 - onBeforeLoad:function(params){ 403 + onBeforeLoad:function(params){
410 - var params; 404 + var params;
411 - var brandId = accsetDetailform.find(".brId").val(); 405 + var brandId = accsetDetailform.find(".brId").val();
412 - if(!isNull(brandId)){ 406 + if(!_.isString(brandId)){
413 - params["b8f7769a-2c97-11e6-abf4-3c970e1c88a0"]=","+brandId+","; 407 + params["b8f7769a-2c97-11e6-abf4-3c970e1c88a0"]=","+brandId+",";
414 - } 408 + }
415 - params["b8f709ba-2c97-11e6-abf4-3c970e1c88a0"]= 1; 409 + params["b8f709ba-2c97-11e6-abf4-3c970e1c88a0"]= 1;
416 - params["b8f7bb2f-2c97-11e6-abf4-3c970e1c88a0"]= 1; // 可用 410 + params["b8f7bb2f-2c97-11e6-abf4-3c970e1c88a0"]= 1; // 可用
417 - return params; 411 + return params;
418 - } 412 + }
419 - }, function(rows){ 413 + }, function(rows){
420 - if(rows.length == 0){ 414 + if(rows.length == 0){
421 - return; 415 + return;
422 - } 416 + }
423 - if(0 != actId){ 417 + if(0 != actId){
424 - addSiteOnGroup(rows); 418 + addSiteOnGroup(rows);
425 - }else{ 419 + }else{
426 - var datagrid = tabs.tabs('getSelected').find(".datagrid-f"); 420 + var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
427 - var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData"); 421 + var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
428 - for (var i = 0; i < rows.length; i++) { 422 + for (var i = 0; i < rows.length; i++) {
429 - var flg = true; 423 + var flg = true;
430 - for (var j = 0; j < data.rows.length; j++) { 424 + for (var j = 0; j < data.rows.length; j++) {
431 - if(rows[i].SIID == data.rows[j].SIID){ 425 + if(rows[i].SIID == data.rows[j].SIID){
432 - flg=false; 426 + flg=false;
433 - } 427 + }
434 - } 428 + }
435 - if(flg){ 429 + if(flg){
436 - datagrid.datagrid("appendRow",rows[i]); 430 + datagrid.datagrid("appendRow",rows[i]);
437 - } 431 + }
438 - } 432 + }
439 - } 433 + }
440 - }); 434 + });
441 - } 435 + }
442 - 436 +
443 - function addSiteOnGroup(rows) { 437 + function addSiteOnGroup(rows) {
444 - var datagrid = tabs.tabs('getSelected').find(".datagrid-f"); 438 + var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
445 - var param = { 439 + var param = {
446 - actId : accsetDetailform.find("input[name='actId']").val(), 440 + actId : accsetDetailform.find("input[name='actId']").val(),
447 - actCode : accsetDetailform.find("input[name='actCode']").val(), 441 + actCode : accsetDetailform.find("input[name='actCode']").val(),
448 - actName : accsetDetailform.find("input[name='actName']").val(), 442 + actName : accsetDetailform.find("input[name='actName']").val(),
449 - ptfId : accsetDetailform.find("input[name='ptfId']").val(), 443 + ptfId : accsetDetailform.find("input[name='ptfId']").val(),
450 - msgId : accsetDetailform.find("input[name='msgChannel']").val(), 444 + msgId : accsetDetailform.find("input[name='msgChannel']").val(),
451 - brId : accsetDetailform.find("input[name='brId']").val(), 445 + brId : accsetDetailform.find("input[name='brId']").val(),
452 - enable : accsetDetailform.find("input[name='enable']").val(), 446 + enable : accsetDetailform.find("input[name='enable']").val(),
453 - actDesc : accsetDetailform.find("input[name='actDesc']").val(), 447 + actDesc : accsetDetailform.find("input[name='actDesc']").val(),
454 - }; 448 + };
455 - 449 +
456 - $.messager.confirm(resource.msg_title, resource.users.onAddCannot, function(r) { 450 + $.messager.confirm(resource.msg_title, resource.onAddCannot, function(r) {
457 - if (r) { 451 + if (r) {
458 - var siteGroup = []; 452 + var siteGroup = [];
459 - var site=""; 453 + var site="";
460 - for (var j = 0; j < rows.length; j++) { 454 + for (var j = 0; j < rows.length; j++) {
461 - if (j == rows.length - 1) { 455 + if (j == rows.length - 1) {
462 - site += rows[j].SIID; 456 + site += rows[j].SIID;
463 - } else { 457 + } else {
464 - site += rows[j].SIID + ","; 458 + site += rows[j].SIID + ",";
465 - } 459 + }
466 - } 460 + }
467 - var tab =tabs.tabs('getSelected'); 461 + var tab =tabs.tabs('getSelected');
468 - var grpName = tab.panel('options').title; 462 + var grpName = tab.panel('options').title;
469 - var groupId = tab.find("input[name='grpId']").val(); 463 + var groupId = tab.find("input[name='grpId']").val();
470 - var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val(); 464 + var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
471 - var groupIndex =tabs.tabs("tabs").length+10; 465 + var groupIndex =tabs.tabs("tabs").length+10;
472 - siteGroup.push({ 466 + siteGroup.push({
473 - grpName : grpName, 467 + grpName : grpName,
474 - grpId : groupId, 468 + grpId : groupId,
475 - gzhId : gzhId, 469 + gzhId : gzhId,
476 - site : site, 470 + site : site,
477 - grpIndex : groupIndex, 471 + grpIndex : groupIndex,
478 - }); 472 + });
479 - param["siteGroupList"] = siteGroup; 473 + param["siteGroupList"] = siteGroup;
480 - 474 +
481 - $.JSON('./accountSet/addSiteOnGroup.json', param, function(result) { 475 + $.JSON('./accountSet/addSiteOnGroup.json', param, function(result) {
482 - if (responseUtils(result)) { 476 + if ($.response(result)) {
483 - var groupId = tab.find("input[name='grpId']").val(); 477 + var groupId = tab.find("input[name='grpId']").val();
484 - if(tab.find("input[name='grpId']").val()=="0"){ 478 + if(tab.find("input[name='grpId']").val()=="0"){
485 - tab.find("input[name='grpId']").val(result.value.siteGroupList[0].grpId); 479 + tab.find("input[name='grpId']").val(result.value.siteGroupList[0].grpId);
486 - } 480 + }
487 - var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData"); 481 + var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
488 - for (var i = 0; i < rows.length; i++) { 482 + for (var i = 0; i < rows.length; i++) {
489 - var flg = true; 483 + var flg = true;
490 - for (var j = 0; j < data.rows.length; j++) { 484 + for (var j = 0; j < data.rows.length; j++) {
491 - if(rows[i].SIID == data.rows[j].SIID){ 485 + if(rows[i].SIID == data.rows[j].SIID){
492 - flg=false; 486 + flg=false;
493 - } 487 + }
494 - } 488 + }
495 - if(flg){ 489 + if(flg){
496 - datagrid.datagrid("appendRow",rows[i]); 490 + datagrid.datagrid("appendRow",rows[i]);
497 - } 491 + }
498 - } 492 + }
499 - } 493 + }
500 - }); 494 + });
501 - } 495 + }
502 - }) 496 + })
503 - } 497 + }
504 - 498 +
505 - // 网点移除datagrid 499 + // 网点移除datagrid
506 - function removeNet() { 500 + function removeNet() {
507 - var datagrid = tabs.tabs('getSelected').find(".datagrid-f"); 501 + var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
508 - if (datagrid.datagrid('getSelected') == null) { 502 + if (datagrid.datagrid('getSelected') == null) {
509 - return $.messager.alert(resource.msg_title, resource.msgRemoveTip); 503 + return $.messager.alert(resource.msg_title, resource.msgRemoveTip);
510 - } 504 + }
511 - var param = { 505 + var param = {
512 - actId : accsetDetailform.find("input[name='actId']").val(), 506 + actId : accsetDetailform.find("input[name='actId']").val(),
513 - actCode : accsetDetailform.find("input[name='actCode']").val(), 507 + actCode : accsetDetailform.find("input[name='actCode']").val(),
514 - actName : accsetDetailform.find("input[name='actName']").val(), 508 + actName : accsetDetailform.find("input[name='actName']").val(),
515 - ptfId : accsetDetailform.find("input[name='ptfId']").val(), 509 + ptfId : accsetDetailform.find("input[name='ptfId']").val(),
516 - msgId : accsetDetailform.find("input[name='msgChannel']").val(), 510 + msgId : accsetDetailform.find("input[name='msgChannel']").val(),
517 - brId : accsetDetailform.find("input[name='brId']").val(), 511 + brId : accsetDetailform.find("input[name='brId']").val(),
518 - enable : accsetDetailform.find("input[name='enable']").val(), 512 + enable : accsetDetailform.find("input[name='enable']").val(),
519 - actDesc : accsetDetailform.find("input[name='actDesc']").val(), 513 + actDesc : accsetDetailform.find("input[name='actDesc']").val(),
520 - }; 514 + };
521 - 515 +
522 - $.messager.confirm(resource.msg_title, resource.users.onDeleteCannot, function(r) { 516 + $.messager.confirm(resource.msg_title, resource.onDeleteCannot, function(r) {
523 - if (r) { 517 + if (r) {
524 - var rows = datagrid.datagrid('getSelections'); // 获取选中的行数据 518 + var rows = datagrid.datagrid('getSelections'); // 获取选中的行数据
525 - // 页面上删除选中的行 519 + // 页面上删除选中的行
526 - for (var j = 0; j < rows.length; j++) { 520 + for (var j = 0; j < rows.length; j++) {
527 - var rowIndex = datagrid.datagrid('getRowIndex', rows[j]); 521 + var rowIndex = datagrid.datagrid('getRowIndex', rows[j]);
528 - datagrid.datagrid('deleteRow', rowIndex); 522 + datagrid.datagrid('deleteRow', rowIndex);
529 - } 523 + }
530 - 524 +
531 - var siteGroup = []; 525 + var siteGroup = [];
532 - var site=""; 526 + var site="";
533 - for (var j = 0; j < rows.length; j++) { 527 + for (var j = 0; j < rows.length; j++) {
534 - if (j == rows.length - 1) { 528 + if (j == rows.length - 1) {
535 - site += rows[j].SIID; 529 + site += rows[j].SIID;
536 - } else { 530 + } else {
537 - site += rows[j].SIID + ","; 531 + site += rows[j].SIID + ",";
538 - } 532 + }
539 - } 533 + }
540 - var tab =tabs.tabs('getSelected'); 534 + var tab =tabs.tabs('getSelected');
541 - var grpName = tab.panel('options').title; 535 + var grpName = tab.panel('options').title;
542 - var groupId = tab.find("input[name='grpId']").val(); 536 + var groupId = tab.find("input[name='grpId']").val();
543 - var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val(); 537 + var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
544 - siteGroup.push({ 538 + siteGroup.push({
545 - grpName : grpName, 539 + grpName : grpName,
546 - grpId : groupId, 540 + grpId : groupId,
547 - gzhId : gzhId, 541 + gzhId : gzhId,
548 - site : site 542 + site : site
549 - }); 543 + });
550 - param["siteGroupList"] = siteGroup; 544 + param["siteGroupList"] = siteGroup;
551 - 545 +
552 - $.JSON('./accountSet/deleteSiteOnGroup.json', param, function(result) { 546 + $.JSON('./accountSet/deleteSiteOnGroup.json', param, function(result) {
553 - if (responseUtils(result)) { 547 + if ($.response(result)) {
554 // closeSelectedPanel(); 548 // closeSelectedPanel();
555 - var rows = datagrid.datagrid("getData").rows; 549 + var rows = datagrid.datagrid("getData").rows;
556 - if(rows.length==0){ 550 + if(rows.length==0){
557 - $.messager.alert(resource.msg_title,tab.panel('options').title+"下已无网点"); 551 + $.messager.alert(resource.msg_title,tab.panel('options').title+"下已无网点");
558 - } 552 + }
559 - } 553 + }
560 - }); 554 + });
561 - } 555 + }
562 - }) 556 + })
563 - } 557 + }
564 - 558 +
565 - // 网点移除datagrid 559 + // 网点移除datagrid
566 - function removeGroup() { 560 + function removeGroup() {
567 - var datagrid = tabs.tabs('getSelected').find(".datagrid-f"); 561 + var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
568 - var param = { 562 + var param = {
569 - actId : accsetDetailform.find("input[name='actId']").val(), 563 + actId : accsetDetailform.find("input[name='actId']").val(),
570 - actCode : accsetDetailform.find("input[name='actCode']").val(), 564 + actCode : accsetDetailform.find("input[name='actCode']").val(),
571 - actName : accsetDetailform.find("input[name='actName']").val(), 565 + actName : accsetDetailform.find("input[name='actName']").val(),
572 - ptfId : accsetDetailform.find("input[name='ptfId']").val(), 566 + ptfId : accsetDetailform.find("input[name='ptfId']").val(),
573 - msgId : accsetDetailform.find("input[name='msgChannel']").val(), 567 + msgId : accsetDetailform.find("input[name='msgChannel']").val(),
574 - brId : accsetDetailform.find("input[name='brId']").val(), 568 + brId : accsetDetailform.find("input[name='brId']").val(),
575 - enable : accsetDetailform.find("input[name='enable']").val(), 569 + enable : accsetDetailform.find("input[name='enable']").val(),
576 - actDesc : accsetDetailform.find("input[name='actDesc']").val(), 570 + actDesc : accsetDetailform.find("input[name='actDesc']").val(),
577 - }; 571 + };
578 - 572 +
579 - $.messager.confirm(resource.msg_title, resource.users.onDeleteGroupCannot, function(r) { 573 + $.messager.confirm(resource.msg_title, resource.onDeleteGroupCannot, function(r) {
580 - if (r) { 574 + if (r) {
581 - var siteGroup = []; 575 + var siteGroup = [];
582 - var tab =tabs.tabs('getSelected'); 576 + var tab =tabs.tabs('getSelected');
583 - var grpName = tab.panel('options').title; 577 + var grpName = tab.panel('options').title;
584 - var groupId = tab.find("input[name='grpId']").val(); 578 + var groupId = tab.find("input[name='grpId']").val();
585 - siteGroup.push({ 579 + siteGroup.push({
586 - grpName : grpName, 580 + grpName : grpName,
587 - grpId : groupId, 581 + grpId : groupId,
588 - }); 582 + });
589 - param["siteGroupList"] = siteGroup; 583 + param["siteGroupList"] = siteGroup;
590 - 584 +
591 - $.JSON('./accountSet/deleteGroup.json', param, function(result) { 585 + $.JSON('./accountSet/deleteGroup.json', param, function(result) {
592 - if (responseUtils(result)) { 586 + if ($.response(result)) {
593 - var index = tabs.tabs('getTabIndex', tab); 587 + var index = tabs.tabs('getTabIndex', tab);
594 - tabs.tabs('close', index); 588 + tabs.tabs('close', index);
595 - panelRefreshUtils(); 589 + indexlayout.getSelectedPanel().panel("refresh");
596 - } 590 + }
597 - }); 591 + });
598 - } 592 + }
599 - }) 593 + })
600 - } 594 + }
601 595
602 // function aaatest(data){ 596 // function aaatest(data){
603 // data.total = 2; 597 // data.total = 2;
...@@ -618,154 +612,152 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun ...@@ -618,154 +612,152 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
618 // cc.rows = data.list; 612 // cc.rows = data.list;
619 // return cc; 613 // return cc;
620 // } 614 // }
621 - // 初始化网点组datagrid 615 + // 初始化网点组datagrid
622 - 616 + function initNetDataGrid(){
623 - 617 + return tabs.find(".netwooks").datagrid({
624 - //新增一个tab 618 + singleSelect : false,
625 - function addNetTab(){
626 - if(actId == 0){
627 - $.messager.confirm(resource.msg_title, resource.users.mustSubmitAccountBeforeSecondGroup, function(r) {
628 - if (r) {
629 - saveTabBeforeSecondGroup();
630 - }
631 - })
632 - return;
633 - }
634 - var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
635 - if(data.rows.length==0){
636 - return $.messager.alert(resource.msg_title,resource.accountset.title.editCurtSite);
637 - }
638 -// var tab = tabs.tabs("getTab",0).find(".datagrid").clone(); //好像没用,先删除
639 - index++;
640 - tabs.tabs('add',{
641 - title: resource.accountset.grid.sites+index,
642 - closable: false
643 - });
644 - var currentTabPanel =tabs.tabs('getSelected');
645 - var dynamicTable = $('<table class="data'+index+'"></table>');
646 - currentTabPanel.html(dynamicTable);
647 - currentTabPanel.append("<input name='grpId' style='display:none' value='0' />");
648 - dynamicTable.datagrid({
649 - singleSelect : false,
650 - toolbar:$('<div class="clearfix"></div>').rs_toolbar({
651 - content:addbtml(),
652 - title:resource.accountset.title.suitSite,
653 - authz:getAuthzUtils('accountSet'),
654 - buttons:[{
655 - code:'edit',
656 - text: resource.btn.add,
657 - iconCls:'btn-add',
658 - handler: addNet
659 - },{
660 - code:'edit',
661 - text: resource.btn.remove,
662 - iconCls:'btn-remove',
663 - handler:removeNet
664 - }]
665 - }),
666 - columns:[[
667 - {field:'ck',checkbox:true },
668 - {field:'SICODE',title:resource.accountset.grid.sicode, width:100, align:"center"},
669 - {field:'SINAME',title:resource.accountset.grid.siname, width:100, align:"center"},
670 - {field:'BENAME',title:resource.accountset.grid.bename, width:100, align:"center"},
671 - {field:'BEBNAME',title:resource.accountset.grid.bebname, width:100, align:"center"}
672 - ]]
673 - });
674 - readonlyUtils(currentTabPanel.find(".content").find(".netForm").find(".wxghzName"),function(){
675 - currentTabPanel.find(".content").find(".netForm").find(".wxghz").val("");
676 - currentTabPanel.find(".content").find(".netForm").find(".gzhType").val("");
677 - });
678 - currentTabPanel.find(".content").find(".netForm").find(".wxghzName").searchbox({
679 - searcher:searchWxgzh,
680 - prompt:resource.accountset.select
681 - });
682 - }
683 -
684 - function removeNetTab(){
685 - var tab = tabs.tabs('getSelected');
686 - if (tab){
687 - var index = tabs.tabs('getTabIndex', tab);
688 - if(index!=0){
689 - removeGroup();
690 -// tabs.tabs('close', index);
691 - }
692 - }
693 - }
694 -
695 - function gzhTypeLocale(gzhType){
696 - if(typeof(gzhType) == "undefined"){
697 - return "";
698 - }
699 - if(gzhType==0){
700 - return resource.accountset.title.longmuseum;
701 - }else if(gzhType==1){
702 - return resource.accountset.title.historymuseum;
703 - }else if(gzhType==2){
704 - return resource.accountset.title.serviceNum;
705 - }else if(gzhType==3){
706 - return resource.accountset.title.serviceNum;
707 - }else{
708 - return resource.accountset.title.unknown;
709 - }
710 - }
711 -
712 - function addbtml(){
713 - var html='<div class="netDetail public base-box clearfix absolute" style="background: #ebebeb;"> <form class="netForm clearfix"><div class="base-content">'
714 - +'<div class="base-label clearfix">顾客移动平台</div> <div class="split">:</div><div class="input fl"><input type="text" name="wxghzName" class="wxghzName easyui-searchbox"/><input type="hidden" class="wxghz" name="wxghz"/></div>'
715 - +'</div> <div class="base-content clearfix"> <div class="base-label"><span>类型</span></div><div class="split">:</div> <div class="input fl"><input type="text" class="easyui-validatebox gzhType disable-label" disabled="disabled"/></div> </div> </form> </div>';
716 - return html;
717 - }
718 -
719 -
720 - function datagridReload(params){
721 - if(params){
722 - this.tabs.find(".netwooks").datagrid("reload",params);
723 - }else{
724 - this.tabs.find(".netwooks").datagrid("reload",base.getCondObjectValue(this.queryId));
725 - }
726 - }
727 - }
728 - })
729 - function initNetDataGrid(inst){
730 - return inst.tabs.find(".netwooks").datagrid({
731 - singleSelect : false,
732 // onLoadSuccess : aaatest, 619 // onLoadSuccess : aaatest,
733 // onBeforeLoad : bbbtest, 620 // onBeforeLoad : bbbtest,
734 // loadFilter: ccctest, 621 // loadFilter: ccctest,
735 622
736 - //url:"./query/e0e0f773-34a1-450c-8868-60433a245eb8.json", 623 + //url:"./query/e0e0f773-34a1-450c-8868-60433a245eb8.json",
737 - toolbar:$('<div class="clearfix"></div>').rs_toolbar({ 624 + toolbar:$('<div class="clearfix"></div>').rs_toolbar({
738 - content:inst.netDetail, 625 + content:netDetail,
739 - title:resource.title.suitSite, 626 + title:resource.title.suitSite,
740 - authz:base.getAuthz('accountSet'), 627 + authz:base.getAuthz('accountSet'),
741 - buttons:[ 628 + buttons:[
742 - { 629 + {
743 - text:base.resource.btn.select, 630 + text:base.resource.btn.select,
744 - iconCls:"btn-select select-condition", 631 + iconCls:"btn-select select-condition",
745 - handler: function() { 632 + handler: function(){
746 - base.showCondObject(inst.queryId, function () { 633 + base.showCondObject(query,datagridReload);
747 - datagridReload.call(inst); 634 + }
748 - }); 635 + },
749 - } 636 + {
750 - },{ 637 + code:'edit',
751 - code:'edit', 638 + text: base.resource.btn.add,
752 - text: base.resource.btn.add, 639 + iconCls:'btn-add',
753 - iconCls:'btn-add', 640 + handler: addNet
754 - handler: addNet 641 + },{
755 - },{ 642 + code:'edit',
756 - code:'edit', 643 + text: base.resource.btn.remove,
757 - text: base.resource.btn.remove, 644 + iconCls:'btn-remove',
758 - iconCls:'btn-remove', 645 + handler:removeNet
759 - handler:removeNet 646 + }]
760 - }] 647 + }),
761 - }), 648 + columns:[[
762 - columns:[[ 649 + {field:'ck',checkbox:true },
763 - {field:'ck',checkbox:true }, 650 + {field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
764 - {field:'SICODE',title:resource.grid.sicode, width:100, align:"center"}, 651 + {field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
765 - {field:'SINAME',title:resource.grid.siname, width:100, align:"center"}, 652 + {field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
766 - {field:'BENAME',title:resource.grid.bename, width:100, align:"center"}, 653 + {field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
767 - {field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"} 654 + ]]
768 - ]] 655 + });
769 - }); 656 + }
770 - } 657 +
658 + //新增一个tab
659 + function addNetTab(){
660 + if(actId == 0){
661 + $.messager.confirm(resource.msg_title, resource.mustSubmitAccountBeforeSecondGroup, function(r) {
662 + if (r) {
663 + saveTabBeforeSecondGroup();
664 + }
665 + })
666 + return;
667 + }
668 + var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
669 + if(data.rows.length==0){
670 + return $.messager.alert(resource.msg_title,resource.title.editCurtSite);
671 + }
672 +// var tab = tabs.tabs("getTab",0).find(".datagrid").clone(); //好像没用,先删除
673 + index++;
674 + tabs.tabs('add',{
675 + title: resource.grid.sites+index,
676 + closable: false
677 + });
678 + var currentTabPanel =tabs.tabs('getSelected');
679 + var dynamicTable = $('<table class="data'+index+'"></table>');
680 + currentTabPanel.html(dynamicTable);
681 + currentTabPanel.append("<input name='grpId' style='display:none' value='0' />");
682 + dynamicTable.datagrid({
683 + singleSelect : false,
684 + toolbar:$('<div class="clearfix"></div>').rs_toolbar({
685 + content:addbtml(),
686 + title:resource.title.suitSite,
687 + authz:base.getAuthz('accountSet'),
688 + buttons:[{
689 + code:'edit',
690 + text: base.resource.btn.add,
691 + iconCls:'btn-add',
692 + handler: addNet
693 + },{
694 + code:'edit',
695 + text: base.resource.btn.remove,
696 + iconCls:'btn-remove',
697 + handler:removeNet
698 + }]
699 + }),
700 + columns:[[
701 + {field:'ck',checkbox:true },
702 + {field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
703 + {field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
704 + {field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
705 + {field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
706 + ]]
707 + });
708 + base.readonly(currentTabPanel.find(".content").find(".netForm").find(".wxghzName"),function(){
709 + currentTabPanel.find(".content").find(".netForm").find(".wxghz").val("");
710 + currentTabPanel.find(".content").find(".netForm").find(".gzhType").val("");
711 + });
712 + currentTabPanel.find(".content").find(".netForm").find(".wxghzName").searchbox({
713 + searcher:searchWxgzh,
714 + prompt:resource.select
715 + });
716 + }
717 +
718 + function removeNetTab(){
719 + var tab = tabs.tabs('getSelected');
720 + if (tab){
721 + var index = tabs.tabs('getTabIndex', tab);
722 + if(index!=0){
723 + removeGroup();
724 +// tabs.tabs('close', index);
725 + }
726 + }
727 + }
728 +
729 + function gzhTypeLocale(gzhType){
730 + if(typeof(gzhType) == "undefined"){
731 + return "";
732 + }
733 + if(gzhType==0){
734 + return resource.title.longmuseum;
735 + }else if(gzhType==1){
736 + return resource.title.historymuseum;
737 + }else if(gzhType==2){
738 + return resource.title.serviceNum;
739 + }else if(gzhType==3){
740 + return resource.title.serviceNum;
741 + }else{
742 + return resource.title.unknown;
743 + }
744 + }
745 +
746 + function addbtml(){
747 + var html='<div class="netDetail public base-box clearfix absolute" style="background: #ebebeb;"> <form class="netForm clearfix"><div class="base-content">'
748 + +'<div class="base-label clearfix">顾客移动平台</div> <div class="split">:</div><div class="input fl"><input type="text" name="wxghzName" class="wxghzName easyui-searchbox"/><input type="hidden" class="wxghz" name="wxghz"/></div>'
749 + +'</div> <div class="base-content clearfix"> <div class="base-label"><span>类型</span></div><div class="split">:</div> <div class="input fl"><input type="text" class="easyui-validatebox gzhType disable-label" disabled="disabled"/></div> </div> </form> </div>';
750 + return html;
751 + }
752 +
753 + function tabClose(){
754 + alert("todo zhangweijiang");
755 + }
756 +
757 + function datagridReload(params){
758 + var param =base.getCondObjectValue(query);
759 + tabs.find(".netwooks").datagrid("reload",param);
760 + }
761 + }
762 + }
771 }); 763 });
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -13,6 +13,12 @@ define({ ...@@ -13,6 +13,12 @@ define({
13 deleteRank:'系统默认等级不能删除!', 13 deleteRank:'系统默认等级不能删除!',
14 select:'请选择', 14 select:'请选择',
15 noLimit:'不限', 15 noLimit:'不限',
16 + mustSubmitAccountBeforeSecondGroup:'新增第二个网点组之前,需要保存账套信息,是否保存?',
17 + saveTitle:'确定保存?',
18 + confirmDelete:'你确定要删除这条信息吗?',
19 + onAddCannot:"确认新增当前选择数据?",
20 + onDeleteCannot:"数据删除后无法恢复,确认删除当前选择数据?",
21 + onDeleteGroupCannot:"网点组删除后,其下的网点同时删除,且无法恢复,请确认删除当前网点组?",
16 title:{ 22 title:{
17 name:'CRM账套', 23 name:'CRM账套',
18 detail:'CRM账套详情', 24 detail:'CRM账套详情',
......