Anthony

crm账套 模块化

......@@ -86,8 +86,8 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
});
//行转换
function getSelectedRow(){
var row = this.grid.datagrid('getSelected');
function getSelectedRow(inst){
var row = inst.grid.datagrid('getSelected');
return row?{
actId:row.ACT_ID,
actCode:row.ACT_CODE,
......@@ -109,39 +109,39 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
function addWindow(inst){
//添加账套详情页面
index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailAdd"}, true, function(){
this.grid.datagrid("reload");
inst.grid.datagrid("reload");
});
}
//编辑页面弹出绑定按钮
function editWindow(inst){
var row = getSelectedRow.call(this);
var row = getSelectedRow.call(this,inst);
if(row == null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
}else{
index.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+row.actId+"&actCode="+row.actCode}, true, function(){
this.grid.datagrid("reload");
inst.grid.datagrid("reload");
});
}
}
//删除
function deleteData(inst){
var accountSet = getSelectedRow.call(this);
var accountSet = getSelectedRow.call(this,inst);
if(accountSet == null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
}else{
if(accountSet.actType==resource.accountset.title.sonAccount){
if(accountSet.actType==resource.title.sonAccount){
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
if(r){
accountSet.enable = "";
$.JSON("./accountSet/delete.json", accountSet, function(result){
if(responseUtils(result)){
this.grid.datagrid("reload");
if($.response(result)){
inst.grid.datagrid("reload");
}
});
}
});
}else{
$.messager.alert(resource.msg_title, resource.accountset.title.overActCntdelt);
$.messager.alert(resource.msg_title, resource.title.overActCntdelt);
}
}
}
......
define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, index){
return Class({
resource: resource,
variable: function () { //全局变量
var panel = index.getSelectedPanel();
this.page = panel.children('.crm-accountset-detail').layout({fit: true});
this.north = this.page.layout("panel", "north");
this.center = this.page.layout("panel", "center");
this.grid = $('<div></div>').appendTo(this.center);
this.queryId = 'f1fd6213-c928-4e72-87f2-f8bfe8589b19';
this.tabs=this.center.children("div").tabs({closable : false, fit:true});
this.netDetail = this.page.find(".netDetail");
},
initialize: function () {//界面布局
initNetDataGrid(this);
},
handler: function(actId, actCode,usId){ //事件绑定
var brandCount = 0; //品牌searchbox渲染次数,第一次渲染的时候,需要刷新
var wxgzh = "";
var index = 0;
var div = "<div class='easyui-tabs l-btn-left l-btn-icon-left'></div>";
var tabs=center.children("div").tabs({
closable : false,
fit:true
});
tabs.tabs({
//toolPosition:'left',
tools:[{
iconCls:'icon-add',
text: resource.btn.add,
handler:addNetTab
},{
iconCls:'icon-re',
text: resource.btn.remove,
handler:removeNetTab
}]
})
tabs.tabs('update', {
tab: tabs.tabs("getTab",0),
options: {
title: resource.accountset.grid.sites,
content:netDataGrid
}
});
var accsetDetail=north.find(".accountSet");
var accsetDetailform = accsetDetail.find(".accountSetForm");
//经营主体和短信通道联动
var netDataGrid = initNetDataGrid();
accsetDetailform.find(".platFormDialog").searchbox({
searcher:searchPlat,
prompt:resource.accountset.select,
onChange:platFormChange
});
if(0 != actId){
$.post('./accountSetDetail/queryById.json',{"actId":actId},function(result){
if(responseUtils(result)){
accsetDetailform.form("load", result.value);
actCode = result.value.actCode;
if(result.value.actCode=="C001"){
accsetDetailform.find('.accSetType').val(resource.accountset.title.faAct);
}else{
accsetDetailform.find('.accSetType').val(resource.accountset.title.soAct);
}
initMsgChannelCombobox();
}
});
if('C001' == actCode){
accsetDetailform.find("div.msg").hide();
accsetDetailform.find("div.margin").hide();
accsetDetailform.find("div.brand").hide();
accsetDetailform.find("div.outer").hide();
accsetDetailform.find("div.desc").hide();
tabs.hide();
accsetDetailform.find(".actCode").attr("readonly", true);
accsetDetailform.find(".platFormDialog").searchbox("disable",true);
accsetDetailform.find(".enable").combobox({ disabled: true });
}else{
accsetDetailform.find(".actCode").attr("readonly",true);
$.post('./accountSet/querySiteGroup.json',{"actId":actId},function(result){
if(responseUtils(result)){
var siteGroup = result.list;
if(siteGroup.length == 0){
var tab ="";
tab = tabs.tabs("getTab",0);
tab.append("<input name='grpId' style='display:none' value='0' />");
return;
}
for (var i = 0; i < siteGroup.length; i++) {
var tab ="";
var gridId = siteGroup[i].grpId;
if(i==0){
tab = tabs.tabs("getTab",i);
tab.append("<input name='grpId' style='display:none' value='"+gridId+"' />");
//netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?c475cd0d-87b1-4ab8-adc2-9097cd7d4cb5="+siteGroup[i].grpId});
netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+siteGroup[i].grpId});
}else{
addtab(gridId);
tab = tabs.tabs("getTab",i);
}
tab.find(".content").find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.accountset.select
});
readonlyUtils(tab.find(".content").find(".netForm").find(".wxghzName"),function(){
tab.find(".content").find(".netForm").find(".wxghz").val("");
tab.find(".content").find(".netForm").find(".gzhType").val("");
});
tab.find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",siteGroup[i].nickName);
tab.find(".content").find(".netForm").find(".wxghz").val(siteGroup[i].gzhId);
tab.find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(siteGroup[i].gzhType));
}
}
});
}
}else{
accsetDetailform.find(".actCode").val(actCode);
accsetDetailform.find(".accSetType").val(resource.accountset.title.soAct);
readonlyUtils(netDetail.find(".netForm").find(".wxghzName"),function(){
netDetail.find(".netForm").find(".wxghz").val("");
netDetail.find(".netForm").find(".gzhType").val("");
});
netDetail.find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.accountset.select
});
define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index','lodash'], function (resource, Class, base, indexlayout,_){
return {
init : function(actId, actCode,usId){
var brandCount = 0; //品牌searchbox渲染次数,第一次渲染的时候,需要刷新
var panel=indexlayout.getSelectedPanel();
var query="f1fd6213-c928-4e72-87f2-f8bfe8589b19";
var layout=panel.children('.crm-accountset-detail').layout({ fit:true });
//声明整个登录账户选项卡容器
var page=panel.children('.crm-accountset-detail');
var north=page.layout("panel","north");
var center=page.layout("panel","center");
var wxgzh = "";
var index = 0;
var div = "<div class='easyui-tabs l-btn-left l-btn-icon-left'></div>";
var tabs=center.children("div").tabs({
closable : false,
fit:true
});
tabs.tabs({
//toolPosition:'left',
tools:[{
iconCls:'icon-add',
text: base.resource.btn.add,
handler:addNetTab
},{
iconCls:'icon-re',
text: base.resource.btn.remove,
handler:removeNetTab
}]
})
tabs.tabs('update', {
tab: tabs.tabs("getTab",0),
options: {
title: resource.grid.sites,
content:netDataGrid
}
});
var accsetDetail=north.find(".accountSet");
var accsetDetailform = accsetDetail.find(".accountSetForm");
var netDetail = page.find(".netDetail");
//经营主体和短信通道联动
var netDataGrid = initNetDataGrid();
accsetDetailform.find(".platFormDialog").searchbox({
searcher:searchPlat,
prompt:resource.select,
onChange:platFormChange
});
if(0 != actId){
$.post('./accountSetDetail/queryById.json',{"actId":actId},function(result){
if($.response(result)){
accsetDetailform.form("load", result.value);
actCode = result.value.actCode;
if(result.value.actCode=="C001"){
accsetDetailform.find('.accSetType').val(resource.title.faAct);
}else{
accsetDetailform.find('.accSetType').val(resource.title.soAct);
}
initMsgChannelCombobox();
}
});
if('C001' == actCode){
accsetDetailform.find("div.msg").hide();
accsetDetailform.find("div.margin").hide();
accsetDetailform.find("div.brand").hide();
accsetDetailform.find("div.outer").hide();
accsetDetailform.find("div.desc").hide();
tabs.hide();
accsetDetailform.find(".actCode").attr("readonly", true);
accsetDetailform.find(".platFormDialog").searchbox("disable",true);
accsetDetailform.find(".enable").combobox({ disabled: true });
}else{
accsetDetailform.find(".actCode").attr("readonly",true);
$.post('./accountSet/querySiteGroup.json',{"actId":actId},function(result){
if($.response(result)){
var siteGroup = result.list;
if(siteGroup.length == 0){
var tab ="";
tab = tabs.tabs("getTab",0);
tab.append("<input name='grpId' style='display:none' value='0' />");
return;
}
for (var i = 0; i < siteGroup.length; i++) {
var tab ="";
var gridId = siteGroup[i].grpId;
if(i==0){
tab = tabs.tabs("getTab",i);
tab.append("<input name='grpId' style='display:none' value='"+gridId+"' />");
//netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?c475cd0d-87b1-4ab8-adc2-9097cd7d4cb5="+siteGroup[i].grpId});
netDataGrid.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+siteGroup[i].grpId});
}else{
addtab(gridId);
tab = tabs.tabs("getTab",i);
}
tab.find(".content").find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.select
});
base.readonly(tab.find(".content").find(".netForm").find(".wxghzName"),function(){
tab.find(".content").find(".netForm").find(".wxghz").val("");
tab.find(".content").find(".netForm").find(".gzhType").val("");
});
tab.find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",siteGroup[i].nickName);
tab.find(".content").find(".netForm").find(".wxghz").val(siteGroup[i].gzhId);
tab.find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(siteGroup[i].gzhType));
}
}
});
}
}else{
accsetDetailform.find(".actCode").val(actCode);
accsetDetailform.find(".accSetType").val(resource.title.soAct);
base.readonly(netDetail.find(".netForm").find(".wxghzName"),function(){
netDetail.find(".netForm").find(".wxghz").val("");
netDetail.find(".netForm").find(".gzhType").val("");
});
netDetail.find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.select
});
// initMsgChannelCombobox();
}
function searchWxgzh(){
showCondObject({id:'2582a029-3902-4934-a206-d638f96d4b08',showGrid:true,refresh:true},function(row){
var tabAll = tabs.tabs("tabs");
for (var i = 0; i < tabAll.length; i++) {
var tab = tabs.tabs("getTab",i);
if(row.GZH_ID == tab.find(".content").find(".netForm").find(".wxghz").val()){
if(row.NICK_NAME == tab.find(".content").find(".netForm").find(".wxghzName").val()) {
return $.messager.alert(resource.msg_title, row.NICK_NAME + resource.accountset.title.plBeSelected);
}
}
}
tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",row.NICK_NAME);
tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghz").val(row.GZH_ID);
tabs.tabs('getSelected').find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(row.GZH_TYPE));
});
}
/**
* 新增tab,除了第一个tab提前定义好,后面的都是通过此方法新增
*/
function addtab(grpId){
index++;
tabs.tabs('add',{
title: resource.accountset.grid.sites+index,
closable: false
});
var tabPanel =tabs.tabs('getSelected');
var addTable = $('<table class="data'+index+'"></table>');
tabPanel.html(addTable);
tabPanel.append("<input name='grpId' style='display:none' value='"+grpId+"' />");
addTable.datagrid({
singleSelect : false,
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:addbtml(),
title:resource.accountset.title.suitSite,
authz:getAuthzUtils('accountSet'),
buttons:[{
code:'edit',
text: resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.accountset.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.accountset.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.accountset.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.accountset.grid.bebname, width:100, align:"center"}
]]
});
addTable.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+grpId});
}
accsetDetail.rs_toolbar({
content:accsetDetailform,
buttons:[{
text:resource.btn.save,
iconCls:'btn-add',
handler:saveAccsetDetail
}],
tools:[{
text:resource.btn.refresh,
iconCls:'btn-refresh',
handler:panelRefreshUtils
}
]
});
//主管平台和短信通道联动
var platformChangeFlag = false;
function platFormChange(newValue, oldValue){
platformChangeFlag = true;
}
function searchPlat(){
showCondObject({id:'0089f254-a93b-4f98-b8f7-0312ce06de45',showGrid:true,refresh:true},function(row){
accsetDetailform.find(".platFormDialog").searchbox('setValue',row.PLNAME);
accsetDetailform.find(".ptfId").val(row.PLID);
if(platformChangeFlag){
initMsgChannelComboboxAfterPlatform(row.PLID)
platformChangeFlag = false;
}
});
}
readonlyUtils(accsetDetailform.find(".platFormDialog"),function(){
accsetDetailform.find(".ptfId").val("");
});
accsetDetailform.find(".applyBrandDialog").searchbox({
searcher:searchBrand,
prompt:resource.accountset.noLimit
});
function initMsgChannelCombobox(){
var plid = accsetDetailform.find("input[name='ptfId']").val();
var param={
plId:plid,
type:1
};
$.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
if(responseUtils(result)){
accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
var data =accsetDetailform.find(".msgChannel").combobox('getData');
}
function searchWxgzh(){
base.showCondObject({id:'2582a029-3902-4934-a206-d638f96d4b08',showGrid:true,refresh:true},function(row){
var tabAll = tabs.tabs("tabs");
for (var i = 0; i < tabAll.length; i++) {
var tab = tabs.tabs("getTab",i);
if(row.GZH_ID == tab.find(".content").find(".netForm").find(".wxghz").val()){
if(row.NICK_NAME == tab.find(".content").find(".netForm").find(".wxghzName").val()) {
return $.messager.alert(resource.msg_title, row.NICK_NAME + resource.title.plBeSelected);
}
}
}
tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghzName").searchbox("setValue",row.NICK_NAME);
tabs.tabs('getSelected').find(".content").find(".netForm").find(".wxghz").val(row.GZH_ID);
tabs.tabs('getSelected').find(".content").find(".netForm").find(".gzhType").val(gzhTypeLocale(row.GZH_TYPE));
});
}
/**
* 新增tab,除了第一个tab提前定义好,后面的都是通过此方法新增
*/
function addtab(grpId){
index++;
tabs.tabs('add',{
title: resource.grid.sites+index,
closable: false
});
var tabPanel =tabs.tabs('getSelected');
var addTable = $('<table class="data'+index+'"></table>');
tabPanel.html(addTable);
tabPanel.append("<input name='grpId' style='display:none' value='"+grpId+"' />");
addTable.datagrid({
singleSelect : false,
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:addbtml(),
title:resource.title.suitSite,
authz:base.getAuthz('accountSet'),
buttons:[{
code:'edit',
text: base.resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: base.resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
]]
});
addTable.datagrid({url:"./query/f1fd6213-c928-4e72-87f2-f8bfe8589b19.json?8d7bca20-08d8-48e3-94eb-a913e61f55ee="+grpId});
}
accsetDetail.rs_toolbar({
content:accsetDetailform,
buttons:[{
text:base.resource.btn.save,
iconCls:'btn-add',
handler:saveAccsetDetail
}],
tools:[{
text:base.resource.btn.refresh,
iconCls:'btn-refresh',
handler:function() {
indexlayout.getSelectedPanel().panel("refresh");
}
}
]
});
//主管平台和短信通道联动
var platformChangeFlag = false;
function platFormChange(newValue, oldValue){
platformChangeFlag = true;
}
function searchPlat(){
base.showCondObject({id:'0089f254-a93b-4f98-b8f7-0312ce06de45',showGrid:true,refresh:true},function(row){
accsetDetailform.find(".platFormDialog").searchbox('setValue',row.PLNAME);
accsetDetailform.find(".ptfId").val(row.PLID);
if(platformChangeFlag){
initMsgChannelComboboxAfterPlatform(row.PLID)
platformChangeFlag = false;
}
});
}
base.readonly(accsetDetailform.find(".platFormDialog"),function(){
accsetDetailform.find(".ptfId").val("");
});
accsetDetailform.find(".applyBrandDialog").searchbox({
searcher:searchBrand,
prompt:resource.noLimit
});
function initMsgChannelCombobox(){
var plid = accsetDetailform.find("input[name='ptfId']").val();
var param={
plId:plid,
type:1
};
$.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
if($.response(result)){
accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
var data =accsetDetailform.find(".msgChannel").combobox('getData');
// accsetDetailform.find(".msgChannel").combobox('select',data[0].id);
}
});
}
function initMsgChannelComboboxAfterPlatform(plid){
var param={
plId:plid,
type:1
};
$.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
if(responseUtils(result)){
accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
var data =accsetDetailform.find(".msgChannel").combobox('getData');
accsetDetailform.find(".msgChannel").combobox('clear');
}
});
}
function searchBrand(){
brandCount++;
var refreshFlag = false;
if(brandCount == 1){
var refreshFlag = true;
}
showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],refresh:refreshFlag,onBeforeLoad:function(params){
return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1;
}}, function(rows){
var brandIdArray = "";
var brandArray = "";
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if(i==rows.length-1){
brandIdArray += row.BRID;
brandArray += row.BRNAME;
}else{
brandIdArray += row.BRID + ",";
brandArray += row.BRNAME + ",";
}
}
accsetDetailform.find(".brId").val(brandIdArray);
accsetDetailform.find(".applyBrandDialog").searchbox("setValue",brandArray);
});
}
readonlyUtils(accsetDetailform.find(".applyBrandDialog"),function(){
accsetDetailform.find(".brId").val("");
});
function prepareAccount(){
if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
$.messager.alert(resource.msg_title, resource.accountset.validateMsgChannel,'warning', function(){accsetDetailform.form("validate");});
return;
}
if(!accsetDetailform.form("validate")){
return;
}
if("" == accsetDetailform.find("input[name='actCode']").val() || null == accsetDetailform.find("input[name='actCode']").val()){
$.messager.alert(resource.msg_title, resource.accountset.validateCode);
return;
}
if("" == accsetDetailform.find("input[name='actName']").val() || null == accsetDetailform.find("input[name='actName']").val()){
$.messager.alert(resource.msg_title, resource.accountset.validateName);
return;
}
if("" == accsetDetailform.find("input[name='ptfId']").val() || null == accsetDetailform.find("input[name='ptfId']").val()){
$.messager.alert(resource.msg_title, resource.accountset.validatePlatForm);
return;
}
if('C001' != accsetDetailform.find("input[name='actCode']").val()){
if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
$.messager.alert(resource.msg_title, resource.accountset.validateMsgChannel);
return;
}
var param={
actId:accsetDetailform.find("input[name='actId']").val(),
actCode:accsetDetailform.find("input[name='actCode']").val(),
actName:accsetDetailform.find("input[name='actName']").val(),
ptfId:accsetDetailform.find("input[name='ptfId']").val(),
msgId:accsetDetailform.find("input[name='msgChannel']").val(),
brId:accsetDetailform.find("input[name='brId']").val(),
enable:accsetDetailform.find("input[name='enable']").val(),
actDesc:accsetDetailform.find("input[name='actDesc']").val(),
};
var siteGroup = [];
var tabAll = tabs.tabs("tabs");
for (var i = 0; i < tabAll.length; i++) {
var tab = tabs.tabs("getTab",i);
var datagrid = tab.find(".datagrid-f");
var rows = datagrid.datagrid("getData").rows;
if(rows.length==0){
$.messager.alert(resource.msg_title,"请选择"+tab.panel('options').title+"!");
return;
}
var site="";
for (var j = 0; j < rows.length; j++) {
if(j==rows.length-1){
site +=rows[j].SIID;
}else{
site +=rows[j].SIID+",";
}
}
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
siteGroup.push({
grpName:grpName,
grpId : groupId,
grpIndex:i,
gzhId:gzhId,
site:site
});
}
param["siteGroupList"] = siteGroup;
}else{
var param={
actId:accsetDetailform.find("input[name='actId']").val(),
actCode:accsetDetailform.find("input[name='actCode']").val(),
actName:accsetDetailform.find("input[name='actName']").val(),
};
}
return param;
}
function saveAccsetDetail(){
var param = prepareAccount();
if(param == null){
return;
}
$.messager.confirm(resource.msg_title,resource.users.saveTitle, function(r){
if (r){
$.JSON('./accountSet/add.json', param, function(result){
if(responseUtils(result)){
closeSelectedPanel();
}
});
}
})
}
function saveTabBeforeSecondGroup(){
var param = prepareAccount();
if(param == null){
return;
}
$.messager.confirm(resource.msg_title,resource.users.saveTitle, function(r){
if (r){
$.JSON('./accountSet/add.json', param, function(result){
if(responseUtils(result)){
var actId = result.value.actId;
var actCode = result.value.actCode;
base.showPanel({text:resource.accountset.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+result.value.actId+"&actCode="+result.value.actCode}, true, function(){
panelRefreshUtils();
});
}
});
}
})
}
//网点新建datagrid
function addNet(){
showCondObject({id:"37236df9-2c96-11e6-abf4-3c970e1c88a0", showGrid:true,refresh:true, singleSelect:false,
onBeforeLoad:function(params){
var params;
var brandId = accsetDetailform.find(".brId").val();
if(!isNull(brandId)){
params["b8f7769a-2c97-11e6-abf4-3c970e1c88a0"]=","+brandId+",";
}
params["b8f709ba-2c97-11e6-abf4-3c970e1c88a0"]= 1;
params["b8f7bb2f-2c97-11e6-abf4-3c970e1c88a0"]= 1; // 可用
return params;
}
}, function(rows){
if(rows.length == 0){
return;
}
if(0 != actId){
addSiteOnGroup(rows);
}else{
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
for (var i = 0; i < rows.length; i++) {
var flg = true;
for (var j = 0; j < data.rows.length; j++) {
if(rows[i].SIID == data.rows[j].SIID){
flg=false;
}
}
if(flg){
datagrid.datagrid("appendRow",rows[i]);
}
}
}
});
}
function addSiteOnGroup(rows) {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.users.onAddCannot, function(r) {
if (r) {
var siteGroup = [];
var site="";
for (var j = 0; j < rows.length; j++) {
if (j == rows.length - 1) {
site += rows[j].SIID;
} else {
site += rows[j].SIID + ",";
}
}
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
var groupIndex =tabs.tabs("tabs").length+10;
siteGroup.push({
grpName : grpName,
grpId : groupId,
gzhId : gzhId,
site : site,
grpIndex : groupIndex,
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/addSiteOnGroup.json', param, function(result) {
if (responseUtils(result)) {
var groupId = tab.find("input[name='grpId']").val();
if(tab.find("input[name='grpId']").val()=="0"){
tab.find("input[name='grpId']").val(result.value.siteGroupList[0].grpId);
}
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
for (var i = 0; i < rows.length; i++) {
var flg = true;
for (var j = 0; j < data.rows.length; j++) {
if(rows[i].SIID == data.rows[j].SIID){
flg=false;
}
}
if(flg){
datagrid.datagrid("appendRow",rows[i]);
}
}
}
});
}
})
}
// 网点移除datagrid
function removeNet() {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
if (datagrid.datagrid('getSelected') == null) {
return $.messager.alert(resource.msg_title, resource.msgRemoveTip);
}
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.users.onDeleteCannot, function(r) {
if (r) {
var rows = datagrid.datagrid('getSelections'); // 获取选中的行数据
// 页面上删除选中的行
for (var j = 0; j < rows.length; j++) {
var rowIndex = datagrid.datagrid('getRowIndex', rows[j]);
datagrid.datagrid('deleteRow', rowIndex);
}
var siteGroup = [];
var site="";
for (var j = 0; j < rows.length; j++) {
if (j == rows.length - 1) {
site += rows[j].SIID;
} else {
site += rows[j].SIID + ",";
}
}
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
siteGroup.push({
grpName : grpName,
grpId : groupId,
gzhId : gzhId,
site : site
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/deleteSiteOnGroup.json', param, function(result) {
if (responseUtils(result)) {
}
});
}
function initMsgChannelComboboxAfterPlatform(plid){
var param={
plId:plid,
type:1
};
$.post('./msgChannel/selectAll/beIdOrPlId.json',param,function(result){
if($.response(result)){
accsetDetailform.find(".msgChannel").combobox("loadData", result.list);
var data =accsetDetailform.find(".msgChannel").combobox('getData');
accsetDetailform.find(".msgChannel").combobox('clear');
}
});
}
function searchBrand(){
brandCount++;
var refreshFlag = false;
if(brandCount == 1){
var refreshFlag = true;
}
base.showCondObject({id:"22726b54-5748-4926-82ed-abe076caecfa", showGrid:true, singleSelect:false,condHidden:['b350631c-dc97-4be5-93e5-0d771365a4c7'],refresh:refreshFlag,onBeforeLoad:function(params){
return params["b350631c-dc97-4be5-93e5-0d771365a4c7"]= 1;
}}, function(rows){
var brandIdArray = "";
var brandArray = "";
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if(i==rows.length-1){
brandIdArray += row.BRID;
brandArray += row.BRNAME;
}else{
brandIdArray += row.BRID + ",";
brandArray += row.BRNAME + ",";
}
}
accsetDetailform.find(".brId").val(brandIdArray);
accsetDetailform.find(".applyBrandDialog").searchbox("setValue",brandArray);
});
}
base.readonly(accsetDetailform.find(".applyBrandDialog"),function(){
accsetDetailform.find(".brId").val("");
});
function prepareAccount(){
if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
$.messager.alert(resource.msg_title, resource.validateMsgChannel,'warning', function(){accsetDetailform.form("validate");});
return;
}
if(!accsetDetailform.form("validate")){
return;
}
if("" == accsetDetailform.find("input[name='actCode']").val() || null == accsetDetailform.find("input[name='actCode']").val()){
$.messager.alert(resource.msg_title, resource.validateCode);
return;
}
if("" == accsetDetailform.find("input[name='actName']").val() || null == accsetDetailform.find("input[name='actName']").val()){
$.messager.alert(resource.msg_title, resource.validateName);
return;
}
if("" == accsetDetailform.find("input[name='ptfId']").val() || null == accsetDetailform.find("input[name='ptfId']").val()){
$.messager.alert(resource.msg_title, resource.validatePlatForm);
return;
}
if('C001' != accsetDetailform.find("input[name='actCode']").val()){
if("" == accsetDetailform.find("input[name='msgChannel']").val() || null == accsetDetailform.find("input[name='msgChannel']").val()){
$.messager.alert(resource.msg_title, resource.validateMsgChannel);
return;
}
var param={
actId:accsetDetailform.find("input[name='actId']").val(),
actCode:accsetDetailform.find("input[name='actCode']").val(),
actName:accsetDetailform.find("input[name='actName']").val(),
ptfId:accsetDetailform.find("input[name='ptfId']").val(),
msgId:accsetDetailform.find("input[name='msgChannel']").val(),
brId:accsetDetailform.find("input[name='brId']").val(),
enable:accsetDetailform.find("input[name='enable']").val(),
actDesc:accsetDetailform.find("input[name='actDesc']").val(),
};
var siteGroup = [];
var tabAll = tabs.tabs("tabs");
for (var i = 0; i < tabAll.length; i++) {
var tab = tabs.tabs("getTab",i);
var datagrid = tab.find(".datagrid-f");
var rows = datagrid.datagrid("getData").rows;
if(rows.length==0){
$.messager.alert(resource.msg_title,"请选择"+tab.panel('options').title+"!");
return;
}
var site="";
for (var j = 0; j < rows.length; j++) {
if(j==rows.length-1){
site +=rows[j].SIID;
}else{
site +=rows[j].SIID+",";
}
}
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
siteGroup.push({
grpName:grpName,
grpId : groupId,
grpIndex:i,
gzhId:gzhId,
site:site
});
}
param["siteGroupList"] = siteGroup;
}else{
var param={
actId:accsetDetailform.find("input[name='actId']").val(),
actCode:accsetDetailform.find("input[name='actCode']").val(),
actName:accsetDetailform.find("input[name='actName']").val(),
};
}
return param;
}
function saveAccsetDetail(){
var param = prepareAccount();
if(param == null){
return;
}
$.messager.confirm(resource.msg_title,resource.saveTitle, function(r){
if (r){
$.JSON('./accountSet/add.json', param, function(result){
if($.response(result)){
indexlayout.closeSelectedPanel();
}
});
}
})
}
function saveTabBeforeSecondGroup(){
var param = prepareAccount();
if(param == null){
return;
}
$.messager.confirm(resource.msg_title,resource.saveTitle, function(r){
if (r){
$.JSON('./accountSet/add.json', param, function(result){
if($.response(result)){
var actId = result.value.actId;
var actCode = result.value.actCode;
indexlayout.showPanel({text:resource.title.detail,url:"./accountSetDetail/accountSetDetailEdit?actId="+result.value.actId+"&actCode="+result.value.actCode}, true, function(){
indexlayout.getSelectedPanel().panel("refresh");
});
}
});
}
})
}
//网点新建datagrid
function addNet(){
base.showCondObject({id:"37236df9-2c96-11e6-abf4-3c970e1c88a0", showGrid:true,refresh:true, singleSelect:false,
onBeforeLoad:function(params){
var params;
var brandId = accsetDetailform.find(".brId").val();
if(!_.isString(brandId)){
params["b8f7769a-2c97-11e6-abf4-3c970e1c88a0"]=","+brandId+",";
}
params["b8f709ba-2c97-11e6-abf4-3c970e1c88a0"]= 1;
params["b8f7bb2f-2c97-11e6-abf4-3c970e1c88a0"]= 1; // 可用
return params;
}
}, function(rows){
if(rows.length == 0){
return;
}
if(0 != actId){
addSiteOnGroup(rows);
}else{
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
for (var i = 0; i < rows.length; i++) {
var flg = true;
for (var j = 0; j < data.rows.length; j++) {
if(rows[i].SIID == data.rows[j].SIID){
flg=false;
}
}
if(flg){
datagrid.datagrid("appendRow",rows[i]);
}
}
}
});
}
function addSiteOnGroup(rows) {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.onAddCannot, function(r) {
if (r) {
var siteGroup = [];
var site="";
for (var j = 0; j < rows.length; j++) {
if (j == rows.length - 1) {
site += rows[j].SIID;
} else {
site += rows[j].SIID + ",";
}
}
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
var groupIndex =tabs.tabs("tabs").length+10;
siteGroup.push({
grpName : grpName,
grpId : groupId,
gzhId : gzhId,
site : site,
grpIndex : groupIndex,
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/addSiteOnGroup.json', param, function(result) {
if ($.response(result)) {
var groupId = tab.find("input[name='grpId']").val();
if(tab.find("input[name='grpId']").val()=="0"){
tab.find("input[name='grpId']").val(result.value.siteGroupList[0].grpId);
}
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
for (var i = 0; i < rows.length; i++) {
var flg = true;
for (var j = 0; j < data.rows.length; j++) {
if(rows[i].SIID == data.rows[j].SIID){
flg=false;
}
}
if(flg){
datagrid.datagrid("appendRow",rows[i]);
}
}
}
});
}
})
}
// 网点移除datagrid
function removeNet() {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
if (datagrid.datagrid('getSelected') == null) {
return $.messager.alert(resource.msg_title, resource.msgRemoveTip);
}
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.onDeleteCannot, function(r) {
if (r) {
var rows = datagrid.datagrid('getSelections'); // 获取选中的行数据
// 页面上删除选中的行
for (var j = 0; j < rows.length; j++) {
var rowIndex = datagrid.datagrid('getRowIndex', rows[j]);
datagrid.datagrid('deleteRow', rowIndex);
}
var siteGroup = [];
var site="";
for (var j = 0; j < rows.length; j++) {
if (j == rows.length - 1) {
site += rows[j].SIID;
} else {
site += rows[j].SIID + ",";
}
}
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
var gzhId = tab.find(".content").find(".netForm").find("input[name='wxghz']").val();
siteGroup.push({
grpName : grpName,
grpId : groupId,
gzhId : gzhId,
site : site
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/deleteSiteOnGroup.json', param, function(result) {
if ($.response(result)) {
// closeSelectedPanel();
var rows = datagrid.datagrid("getData").rows;
if(rows.length==0){
$.messager.alert(resource.msg_title,tab.panel('options').title+"下已无网点");
}
}
});
}
})
}
// 网点移除datagrid
function removeGroup() {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.users.onDeleteGroupCannot, function(r) {
if (r) {
var siteGroup = [];
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
siteGroup.push({
grpName : grpName,
grpId : groupId,
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/deleteGroup.json', param, function(result) {
if (responseUtils(result)) {
var index = tabs.tabs('getTabIndex', tab);
tabs.tabs('close', index);
panelRefreshUtils();
}
});
}
})
}
var rows = datagrid.datagrid("getData").rows;
if(rows.length==0){
$.messager.alert(resource.msg_title,tab.panel('options').title+"下已无网点");
}
}
});
}
})
}
// 网点移除datagrid
function removeGroup() {
var datagrid = tabs.tabs('getSelected').find(".datagrid-f");
var param = {
actId : accsetDetailform.find("input[name='actId']").val(),
actCode : accsetDetailform.find("input[name='actCode']").val(),
actName : accsetDetailform.find("input[name='actName']").val(),
ptfId : accsetDetailform.find("input[name='ptfId']").val(),
msgId : accsetDetailform.find("input[name='msgChannel']").val(),
brId : accsetDetailform.find("input[name='brId']").val(),
enable : accsetDetailform.find("input[name='enable']").val(),
actDesc : accsetDetailform.find("input[name='actDesc']").val(),
};
$.messager.confirm(resource.msg_title, resource.onDeleteGroupCannot, function(r) {
if (r) {
var siteGroup = [];
var tab =tabs.tabs('getSelected');
var grpName = tab.panel('options').title;
var groupId = tab.find("input[name='grpId']").val();
siteGroup.push({
grpName : grpName,
grpId : groupId,
});
param["siteGroupList"] = siteGroup;
$.JSON('./accountSet/deleteGroup.json', param, function(result) {
if ($.response(result)) {
var index = tabs.tabs('getTabIndex', tab);
tabs.tabs('close', index);
indexlayout.getSelectedPanel().panel("refresh");
}
});
}
})
}
// function aaatest(data){
// data.total = 2;
......@@ -618,154 +612,152 @@ define(['i18n!accountset/nls/resource', 'cls', 'base/index', 'index/index'], fun
// cc.rows = data.list;
// return cc;
// }
// 初始化网点组datagrid
//新增一个tab
function addNetTab(){
if(actId == 0){
$.messager.confirm(resource.msg_title, resource.users.mustSubmitAccountBeforeSecondGroup, function(r) {
if (r) {
saveTabBeforeSecondGroup();
}
})
return;
}
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
if(data.rows.length==0){
return $.messager.alert(resource.msg_title,resource.accountset.title.editCurtSite);
}
// var tab = tabs.tabs("getTab",0).find(".datagrid").clone(); //好像没用,先删除
index++;
tabs.tabs('add',{
title: resource.accountset.grid.sites+index,
closable: false
});
var currentTabPanel =tabs.tabs('getSelected');
var dynamicTable = $('<table class="data'+index+'"></table>');
currentTabPanel.html(dynamicTable);
currentTabPanel.append("<input name='grpId' style='display:none' value='0' />");
dynamicTable.datagrid({
singleSelect : false,
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:addbtml(),
title:resource.accountset.title.suitSite,
authz:getAuthzUtils('accountSet'),
buttons:[{
code:'edit',
text: resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.accountset.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.accountset.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.accountset.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.accountset.grid.bebname, width:100, align:"center"}
]]
});
readonlyUtils(currentTabPanel.find(".content").find(".netForm").find(".wxghzName"),function(){
currentTabPanel.find(".content").find(".netForm").find(".wxghz").val("");
currentTabPanel.find(".content").find(".netForm").find(".gzhType").val("");
});
currentTabPanel.find(".content").find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.accountset.select
});
}
function removeNetTab(){
var tab = tabs.tabs('getSelected');
if (tab){
var index = tabs.tabs('getTabIndex', tab);
if(index!=0){
removeGroup();
// tabs.tabs('close', index);
}
}
}
function gzhTypeLocale(gzhType){
if(typeof(gzhType) == "undefined"){
return "";
}
if(gzhType==0){
return resource.accountset.title.longmuseum;
}else if(gzhType==1){
return resource.accountset.title.historymuseum;
}else if(gzhType==2){
return resource.accountset.title.serviceNum;
}else if(gzhType==3){
return resource.accountset.title.serviceNum;
}else{
return resource.accountset.title.unknown;
}
}
function addbtml(){
var html='<div class="netDetail public base-box clearfix absolute" style="background: #ebebeb;"> <form class="netForm clearfix"><div class="base-content">'
+'<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>'
+'</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>';
return html;
}
function datagridReload(params){
if(params){
this.tabs.find(".netwooks").datagrid("reload",params);
}else{
this.tabs.find(".netwooks").datagrid("reload",base.getCondObjectValue(this.queryId));
}
}
}
})
function initNetDataGrid(inst){
return inst.tabs.find(".netwooks").datagrid({
singleSelect : false,
// 初始化网点组datagrid
function initNetDataGrid(){
return tabs.find(".netwooks").datagrid({
singleSelect : false,
// onLoadSuccess : aaatest,
// onBeforeLoad : bbbtest,
// loadFilter: ccctest,
//url:"./query/e0e0f773-34a1-450c-8868-60433a245eb8.json",
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:inst.netDetail,
title:resource.title.suitSite,
authz:base.getAuthz('accountSet'),
buttons:[
{
text:base.resource.btn.select,
iconCls:"btn-select select-condition",
handler: function() {
base.showCondObject(inst.queryId, function () {
datagridReload.call(inst);
});
}
},{
code:'edit',
text: base.resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: base.resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
]]
});
}
//url:"./query/e0e0f773-34a1-450c-8868-60433a245eb8.json",
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:netDetail,
title:resource.title.suitSite,
authz:base.getAuthz('accountSet'),
buttons:[
{
text:base.resource.btn.select,
iconCls:"btn-select select-condition",
handler: function(){
base.showCondObject(query,datagridReload);
}
},
{
code:'edit',
text: base.resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: base.resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
]]
});
}
//新增一个tab
function addNetTab(){
if(actId == 0){
$.messager.confirm(resource.msg_title, resource.mustSubmitAccountBeforeSecondGroup, function(r) {
if (r) {
saveTabBeforeSecondGroup();
}
})
return;
}
var data = tabs.tabs('getSelected').find(".datagrid-f").datagrid("getData");
if(data.rows.length==0){
return $.messager.alert(resource.msg_title,resource.title.editCurtSite);
}
// var tab = tabs.tabs("getTab",0).find(".datagrid").clone(); //好像没用,先删除
index++;
tabs.tabs('add',{
title: resource.grid.sites+index,
closable: false
});
var currentTabPanel =tabs.tabs('getSelected');
var dynamicTable = $('<table class="data'+index+'"></table>');
currentTabPanel.html(dynamicTable);
currentTabPanel.append("<input name='grpId' style='display:none' value='0' />");
dynamicTable.datagrid({
singleSelect : false,
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
content:addbtml(),
title:resource.title.suitSite,
authz:base.getAuthz('accountSet'),
buttons:[{
code:'edit',
text: base.resource.btn.add,
iconCls:'btn-add',
handler: addNet
},{
code:'edit',
text: base.resource.btn.remove,
iconCls:'btn-remove',
handler:removeNet
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'SICODE',title:resource.grid.sicode, width:100, align:"center"},
{field:'SINAME',title:resource.grid.siname, width:100, align:"center"},
{field:'BENAME',title:resource.grid.bename, width:100, align:"center"},
{field:'BEBNAME',title:resource.grid.bebname, width:100, align:"center"}
]]
});
base.readonly(currentTabPanel.find(".content").find(".netForm").find(".wxghzName"),function(){
currentTabPanel.find(".content").find(".netForm").find(".wxghz").val("");
currentTabPanel.find(".content").find(".netForm").find(".gzhType").val("");
});
currentTabPanel.find(".content").find(".netForm").find(".wxghzName").searchbox({
searcher:searchWxgzh,
prompt:resource.select
});
}
function removeNetTab(){
var tab = tabs.tabs('getSelected');
if (tab){
var index = tabs.tabs('getTabIndex', tab);
if(index!=0){
removeGroup();
// tabs.tabs('close', index);
}
}
}
function gzhTypeLocale(gzhType){
if(typeof(gzhType) == "undefined"){
return "";
}
if(gzhType==0){
return resource.title.longmuseum;
}else if(gzhType==1){
return resource.title.historymuseum;
}else if(gzhType==2){
return resource.title.serviceNum;
}else if(gzhType==3){
return resource.title.serviceNum;
}else{
return resource.title.unknown;
}
}
function addbtml(){
var html='<div class="netDetail public base-box clearfix absolute" style="background: #ebebeb;"> <form class="netForm clearfix"><div class="base-content">'
+'<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>'
+'</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>';
return html;
}
function tabClose(){
alert("todo zhangweijiang");
}
function datagridReload(params){
var param =base.getCondObjectValue(query);
tabs.find(".netwooks").datagrid("reload",param);
}
}
}
});
\ No newline at end of file
......
......@@ -13,6 +13,12 @@ define({
deleteRank:'系统默认等级不能删除!',
select:'请选择',
noLimit:'不限',
mustSubmitAccountBeforeSecondGroup:'新增第二个网点组之前,需要保存账套信息,是否保存?',
saveTitle:'确定保存?',
confirmDelete:'你确定要删除这条信息吗?',
onAddCannot:"确认新增当前选择数据?",
onDeleteCannot:"数据删除后无法恢复,确认删除当前选择数据?",
onDeleteGroupCannot:"网点组删除后,其下的网点同时删除,且无法恢复,请确认删除当前网点组?",
title:{
name:'CRM账套',
detail:'CRM账套详情',
......