Anthony

bizEntity 模块化

define(function() {
define(['i18n!bizEntity/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, indexlayout) {
return {
resource:resource,
init:function(pltId) {
var panel = getSelectedPanel();
var panel = indexlayout.getSelectedPanel();
var params=panel.panel("options").tabParams;
var page = panel.children('.pl-biz-details').layout({
fit:true
......@@ -122,34 +123,33 @@ define(function() {
var distBEPARENT = distributorForm.find(".BEPARENT");
var distPTVALID = distributorForm.find(".PTVALID");
var distINDEX = distributorForm.find(".INDEX");
//验证
initValidateboxForm();
formTextBox();
maxLength();
//限制输入字段长度
function maxLength(){
maxlengthUtils(beCode,50);
maxlengthUtils(beName,120);
maxlengthUtils(beDesc,200);
maxlengthUtils(beChief,20);
maxlengthUtils(ptTphone,20);
maxlengthUtils(ptPhone,30);
maxlengthUtils(ptPost,20);
maxlengthUtils(ptEmail,60);
maxlengthUtils(ptTaxrate,3);
maxlengthUtils(ptAddr,200);
maxlengthUtils(bebCode,30);
maxlengthUtils(bebName,30);
maxlengthUtils(bebDesc,200);
maxlengthUtils(invoBEINAME,120);
maxlengthUtils(invoBEITAXNUM,30);
maxlengthUtils(invoBEITAXRATE,3);
maxlengthUtils(invoPTPHONE,30);
maxlengthUtils(invoPTADDR,100);
maxlengthUtils(accBEASOURCE,120);
maxlengthUtils(accBEANAME,120);
maxlengthUtils(accBEAACCOUNT,30);
maxlengthUtils(accBEARATE,6);
base.maxlength(beCode,50);
base.maxlength(beName,120);
base.maxlength(beDesc,200);
base.maxlength(beChief,20);
base.maxlength(ptTphone,20);
base.maxlength(ptPhone,30);
base.maxlength(ptPost,20);
base.maxlength(ptEmail,60);
base.maxlength(ptTaxrate,3);
base.maxlength(ptAddr,200);
base.maxlength(bebCode,30);
base.maxlength(bebName,30);
base.maxlength(bebDesc,200);
base.maxlength(invoBEINAME,120);
base.maxlength(invoBEITAXNUM,30);
base.maxlength(invoBEITAXRATE,3);
base.maxlength(invoPTPHONE,30);
base.maxlength(invoPTADDR,100);
base.maxlength(accBEASOURCE,120);
base.maxlength(accBEANAME,120);
base.maxlength(accBEAACCOUNT,30);
base.maxlength(accBEARATE,6);
}
function formTextBox(){
......@@ -164,28 +164,28 @@ define(function() {
beDesc.textbox();
beValid.combobox({
data: [{
text: resource.btn.yes,
text: base.resource.btn.yes,
value: 1,
selected:true
},{
text: resource.btn.no,
text: base.resource.btn.no,
value: 0
}]
});
payPTVALID.combobox({
data: [{
"text": resource.btn.yes,
"text": base.resource.btn.yes,
"value": 1,
"selected":true
},{
"text": resource.btn.no,
"text": base.resource.btn.no,
"value": 0
}]
});
beChief.textbox({
});
ptTphone.textbox({
validType:'Mobile'
validType:'chinaMobile'
});
ptPhone.textbox({
validType:'ptphone'
......@@ -204,7 +204,7 @@ define(function() {
ptCurrency.combobox({
required:true,
valueField : 'cuid',
textField : 'cuname',
textField : 'cuname'
});
distCHANNEL.combobox({
required:true,
......@@ -219,12 +219,12 @@ define(function() {
invoCUID.combobox({
required:true,
valueField : 'cuid',
textField : 'cuname',
textField : 'cuname'
});
accCUID.combobox({
required:true,
valueField : 'cuid',
textField : 'cuname',
textField : 'cuname'
});
accBEARATE.textbox({
required:true,
......@@ -332,30 +332,30 @@ define(function() {
});
ptValidBook.combobox({
data: [{
text: resource.btn.yes,
text: base.resource.btn.yes,
value:1
},{
text: resource.btn.no,
text: base.resource.btn.no,
value: 0
}]
});
payBEPINCOME.combobox({
data: [{
text: resource.btn.yes,
text: base.resource.btn.yes,
value:1,
selected:true
},{
text: resource.btn.no,
text: base.resource.btn.no,
value: 0
}]
});
payBEPPOINT.combobox({
data: [{
text: resource.btn.yes,
text: base.resource.btn.yes,
value:1,
selected:true
},{
text: resource.btn.no,
text: base.resource.btn.no,
value: 0
}]
});
......@@ -366,22 +366,22 @@ define(function() {
prompt:"不限"
});
readonlyUtils(distBRNAME.searchbox({
base.readonly(distBRNAME.searchbox({
required:true,
searcher:chooseBrank,
prompt:""
}));
readonlyUtils(distBEPARENT.searchbox({
base.readonly(distBEPARENT.searchbox({
required:true,
searcher:chooseBizEntity
}));
distPTVALID.combobox({
data: [{
text: resource.btn.yes,
text: base.resource.btn.yes,
value:1,
selected:true
},{
text: resource.btn.no,
text: base.resource.btn.no,
value: 0
}]
});
......@@ -401,14 +401,16 @@ define(function() {
var button = panel.find(".toolbar");
button.rs_toolbar({
buttons:[{
text:resource.btn.save,
text:base.resource.btn.save,
iconCls:'btn-save',
handler:saveBtn
}],
tools:[{
text:resource.btn.refresh,
text:base.resource.btn.refresh,
iconCls:'btn-refresh',
handler:panelRefreshUtils
handler:function(){
indexlayout.getSelectedPanel().panel("refresh");
}
}],
content:button.children('div.pointDetail')
});
......@@ -417,7 +419,7 @@ define(function() {
$(document.body).children(".window").children(".pl-role-details-type").parent().remove();
var dialog = page.find(".pl-role-details-type");
dialog.dialog({
title:resource.site.orgTypeDialogTitle,
title:resource.orgTypeDialogTitle,
closed:true,
closable:false,
width:'629',
......@@ -429,7 +431,7 @@ define(function() {
}
if(!params.id){
$.post("./bizEntity/setCode.json",null,function(result){
if(responseUtils(result)){
if($.response(result)){
beCode.textbox("setValue",result.value.code);
}
});
......@@ -448,7 +450,7 @@ define(function() {
}
function loadForm(){
$.post("./bizEntity/findBizENtity.json",{id:params.id},function(result){
if(responseUtils(result)){
if($.response(result)){
formInfo.find(".ID").val(result.value.id);
beCode.textbox("setValue",result.value.code);
beName.textbox("setValue",result.value.name);
......@@ -504,15 +506,15 @@ define(function() {
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
title:"结算账套",
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openSetOfBookDialog
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
handler: editSetOfBookDialog
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler:removeSetOfBookDialog
}],
......@@ -521,18 +523,18 @@ define(function() {
columns:[[
{field:'ck',checkbox:true },
{field:'BEBID', hidden:true},
{field:'BEBCODE',title:resource.bizentity.grid.bebcode, width:150},
{field:'bizInvoiceList',title:resource.bizentity.grid.bizinvoicelist,hidden:true},
{field:'bizAccountList',title:resource.bizentity.grid.bizaccountlist,hidden:true},
{field:'bizPaywayList',title:resource.bizentity.grid.bizpaywaylist,hidden:true},
{field:'BEBNAME',title:resource.bizentity.grid.bebname, width:200},
{field:'BENAME',title:resource.bizentity.grid.bename, width:120},
{field:'BEBDESC',title:resource.bizentity.grid.bebdesc, width:300},
{field:'PTVALID',title:resource.bizentity.grid.ptvalid, width:100,formatter: function(value,row,index){
{field:'BEBCODE',title:resource.grid.bebcode, width:150},
{field:'bizInvoiceList',title:resource.grid.bizinvoicelist,hidden:true},
{field:'bizAccountList',title:resource.grid.bizaccountlist,hidden:true},
{field:'bizPaywayList',title:resource.grid.bizpaywaylist,hidden:true},
{field:'BEBNAME',title:resource.grid.bebname, width:200},
{field:'BENAME',title:resource.grid.bename, width:120},
{field:'BEBDESC',title:resource.grid.bebdesc, width:300},
{field:'PTVALID',title:resource.grid.ptvalid, width:100,formatter: function(value,row,index){
if(parseInt(value)==1){
return resource.btn.yes;
return base.resource.btn.yes;
}else if(parseInt(value)==0){
return resource.btn.no;
return base.resource.btn.no;
}else{return "";}
}
},
......@@ -637,13 +639,13 @@ define(function() {
if(beOrgType.val()==6){
initTab3=$("<div class='details-tab-3'></div>").appendTo(channel).datagrid({
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
title:resource.bizentity.bizChannelgridtitle,
title:resource.bizChannelgridtitle,
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openChannel
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler: removeChannel
}],
......@@ -660,25 +662,25 @@ define(function() {
{field:'CHDESC',title:resource.channel.grid.desc, width:300},
{field:'BRNAME',title:resource.channel.grid.brand, width:260,formatter:formatText},
{field:'PTVALID',title:resource.channel.grid.valid, width:80,formatter: function(value,row,index){
return value>0?resource.btn.yes:resource.btn.no;
return value>0?base.resource.btn.yes:base.resource.btn.no;
}}
]]
});
}else{
initTab3=$("<div class='details-tab-3'></div>").appendTo(channel).datagrid({
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
title:resource.bizentity.bizChannelgridtitle,
title:resource.bizChannelgridtitle,
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openDistributor
},
{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
handler: editDistributor
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler: removeChannel
}],
......@@ -695,9 +697,9 @@ define(function() {
{field:'CHNAME',title:resource.channel.grid.name, width:120},
{field:'CHDESC',title:resource.channel.grid.desc, width:300},
{field:'BRNAME',title:resource.channel.grid.brand, width:260,formatter:formatText},
{field:'BENAME',title:resource.bizentity.bizChannelgrid.beName, width:120},
{field:'BENAME',title:resource.bizChannelgrid.beName, width:120},
{field:'PTVALID',title:resource.channel.grid.valid, width:80,formatter: function(value,row,index){
return value>0?resource.btn.yes:resource.btn.no;
return value>0?base.resource.btn.yes:base.resource.btn.no;
}}
]]
});
......@@ -713,7 +715,7 @@ define(function() {
var channel = page.children(".setOfBook-dialog");
channel.dialog({
buttons:[{text:"确定",handler:addSetOfBook
},{text:resource.btn.cancel,handler:hideWindow}],
},{text:base.resource.btn.cancel,handler:hideWindow}],
closed:true,
width:'85%',
height:'550'
......@@ -724,15 +726,15 @@ define(function() {
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
//title:"开票信息",
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openBizInvoice
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
handler: editBizInvoice
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler: removeBizInvoice
}],
......@@ -740,15 +742,15 @@ define(function() {
fitColumns:true,
columns:[[
{field:'ck',checkbox:true },
{field:'BEINAME',title:resource.bizentity.grid.beiname, width:100},
{field:'BEITAXNUM',title:resource.bizentity.grid.beitaxnum, width:100},
{field:'BEITAXRATE',title:resource.bizentity.grid.beitaxrate, width:100,formatter:function(value,row,index){
{field:'BEINAME',title:resource.grid.beiname, width:100},
{field:'BEITAXNUM',title:resource.grid.beitaxnum, width:100},
{field:'BEITAXRATE',title:resource.grid.beitaxrate, width:100,formatter:function(value,row,index){
return value+"%";
}},
{field:'PTPHONE',title:resource.bizentity.grid.ptphone, width:100},
{field:'PTADDR',title:resource.bizentity.grid.ptaddr, width:100},
{field:'PTPHONE',title:resource.grid.ptphone, width:100},
{field:'PTADDR',title:resource.grid.ptaddr, width:100},
{field:'CUID', width:100,hidden:true},
{field:'CUNAME',title:resource.bizentity.grid.cuname, width:100}
{field:'CUNAME',title:resource.grid.cuname, width:100}
]]
});
......@@ -756,15 +758,15 @@ define(function() {
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
//title:"常用账户",
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openBizAccount
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
handler: editBizAccount
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler: removeBizAccount
}],
......@@ -773,12 +775,12 @@ define(function() {
columns:[[
{field:'ck',checkbox:true},
{field:'UUID',title:"UUID",hidden:true},
{field:'BEASOURCE',title:resource.bizentity.grid.beasource, width:100},
{field:'BEANAME',title:resource.bizentity.grid.beaname, width:100},
{field:'BEAACCOUNT',title:resource.bizentity.grid.beaaccount, width:100},
{field:'BEARATE',title:resource.bizentity.grid.bearate, width:100},
{field:'BEASOURCE',title:resource.grid.beasource, width:100},
{field:'BEANAME',title:resource.grid.beaname, width:100},
{field:'BEAACCOUNT',title:resource.grid.beaaccount, width:100},
{field:'BEARATE',title:resource.grid.bearate, width:100},
{field:'CUID', width:100,hidden:true},
{field:'CUNAME',title:resource.bizentity.grid.cuname, width:100}
{field:'CUNAME',title:resource.grid.cuname, width:100}
]]
});
......@@ -786,15 +788,15 @@ define(function() {
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
//title:"收款方式",
buttons:[{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
handler: openBizPayway
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
handler: editBizPayway
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
handler: removeBizPayway
}],
......@@ -803,25 +805,25 @@ define(function() {
columns:[[
{field:'ck',checkbox:true },
{field:'UUID',title:"UUID", hidden:true},
{field:'PWID',title:resource.bizentity.grid.pwid, hidden:true},
{field:'PWNAME',title:resource.bizentity.grid.pwname, width:100},
{field:'CUNAME',title:resource.bizentity.grid.cunanme, width:100},
{field:'CURATE',title:resource.bizentity.grid.curate, width:100},
{field:'BEPPROCEEDS',title:resource.bizentity.grid.bepproceeds, width:100},
{field:'BEPPAYEE',title:resource.bizentity.grid.beppayee, width:100},
{field:'BEPACCOUNT',title:resource.bizentity.grid.bepaccount, width:100},
{field:'BEPINCOME',title:resource.bizentity.grid.bepincome, width:100,formatter:function(value,row,index){
return value>0?resource.btn.yes:resource.btn.no;
{field:'PWID',title:resource.grid.pwid, hidden:true},
{field:'PWNAME',title:resource.grid.pwname, width:100},
{field:'CUNAME',title:resource.grid.cunanme, width:100},
{field:'CURATE',title:resource.grid.curate, width:100},
{field:'BEPPROCEEDS',title:resource.grid.bepproceeds, width:100},
{field:'BEPPAYEE',title:resource.grid.beppayee, width:100},
{field:'BEPACCOUNT',title:resource.grid.bepaccount, width:100},
{field:'BEPINCOME',title:resource.grid.bepincome, width:100,formatter:function(value,row,index){
return value>0?base.resource.btn.yes:base.resource.btn.no;
}},
{field:'BEPPOINT',title:resource.bizentity.grid.beppoint, width:100,formatter:function(value,row,index){
return value>0?resource.btn.yes:resource.btn.no;
{field:'BEPPOINT',title:resource.grid.beppoint, width:100,formatter:function(value,row,index){
return value>0?base.resource.btn.yes:base.resource.btn.no;
}},
{field:'PIID',title:resource.bizentity.grid.piid, width:100},
{field:'PTVALID',title:resource.bizentity.grid.ptvalid, width:100,formatter:function(value,row,index){
{field:'PIID',title:resource.grid.piid, width:100},
{field:'PTVALID',title:resource.grid.ptvalid, width:100,formatter:function(value,row,index){
if(parseInt(value)==1){
return resource.btn.yes;
return base.resource.btn.yes;
}else if(parseInt(value)==0){
return resource.btn.no;
return base.resource.btn.no;
}else{return "";}
}
}
......@@ -832,8 +834,8 @@ define(function() {
$(document.body).children(".window").children(".bizInvoice-dialog").parent().remove();
var channel = page.children(".bizInvoice-dialog");
channel.dialog({
buttons:[{text:resource.btn.confirm,handler:addBizInvoice
},{text:resource.btn.cancel,handler:function(){
buttons:[{text:base.resource.btn.confirm,handler:addBizInvoice
},{text:base.resource.btn.cancel,handler:function(){
bizInvoiceDialog.dialog("close");
}}],
closed:true,
......@@ -847,8 +849,8 @@ define(function() {
$(document.body).children(".window").children(".bizAccount-dialog").parent().remove();
var channel = page.children(".bizAccount-dialog");
channel.dialog({
buttons:[{text:resource.btn.confirm,handler:addBizAccount
},{text:resource.btn.cancel,handler:function(){
buttons:[{text:base.resource.btn.confirm,handler:addBizAccount
},{text:base.resource.btn.cancel,handler:function(){
bizAccountDialog.dialog("close");
}}],
closed:true,
......@@ -862,8 +864,8 @@ define(function() {
$(document.body).children(".window").children(".bizPayway-dialog").parent().remove();
var channel = page.children(".bizPayway-dialog");
channel.dialog({
buttons:[{text:resource.btn.confirm,handler:addBizPayway
},{text:resource.btn.cancel,handler:function(){
buttons:[{text:base.resource.btn.confirm,handler:addBizPayway
},{text:base.resource.btn.cancel,handler:function(){
bizPaywayDialog.dialog("close");
}}],
closed:true,
......@@ -877,8 +879,8 @@ define(function() {
$(document.body).children(".window").children(".channelDialog").parent().remove();
var channel = page.children(".channelDialog");
channel.dialog({
buttons:[{text:resource.btn.confirm,handler:addChannel
},{text:resource.btn.cancel,handler:hideWindow}],
buttons:[{text:base.resource.btn.confirm,handler:addChannel
},{text:base.resource.btn.cancel,handler:hideWindow}],
closed:true,
width:'500',
height:'auto'
......@@ -890,8 +892,8 @@ define(function() {
$(document.body).children(".window").children(".distributorDialog").parent().remove();
var channel = page.children(".distributorDialog");
channel.dialog({
buttons:[{text:resource.btn.confirm,handler:addDistributor
},{text:resource.btn.cancel,handler:hideWindow}],
buttons:[{text:base.resource.btn.confirm,handler:addDistributor
},{text:base.resource.btn.cancel,handler:hideWindow}],
closed:true,
width:'500',
height:'auto'
......@@ -900,7 +902,7 @@ define(function() {
}
// 打开结算账套dialog
function openSetOfBookDialog() {
setOfBookDialog.show().window("center").dialog("open").dialog('setTitle',resource.bizentity.closeAct).find(".setOfBookForm").form("clear");
setOfBookDialog.show().window("center").dialog("open").dialog('setTitle',resource.closeAct).find(".setOfBookForm").form("clear");
bizInvoice.datagrid('loadData', { total: 0, rows: [] });
bizAccount.datagrid('loadData', { total: 0, rows: [] });
bizPayway.datagrid('loadData', { total: 0, rows: [] });
......@@ -913,14 +915,14 @@ define(function() {
var row = initTab2.datagrid("getSelected");
var rowIndex = initTab2.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
if(row.BEBDEFAULT=='1'){
return $.messager.alert(resource.msg_title, resource.bizentity.check.defaultBookEdit);
return $.messager.alert(base.resource.msg_title, resource.check.defaultBookEdit);
}
if(row.BEBID){
$.JSON("./bizSetOfBook/query.json",{id:row.BEBID},function(result){
if(responseUtils(result)){
if($.response(result)){
bebCode.textbox("setValue",result.value.code);
bebName.textbox("setValue",result.value.name);
beNameBook.text(result.value.bizEntity.name);
......@@ -960,12 +962,12 @@ define(function() {
for(var i=0;i<tab2Rows.length;i++){
if(editBebName==""){
if(bebName.textbox("getValue")==tab2Rows[i].BEBNAME){
return $.messager.alert(resource.msg_title,resource.bizentity.check.bookName);
return $.messager.alert(base.resource.msg_title,resource.check.bookName);
}
}else{
if(bebName.textbox("getValue")!=editBebName){
if(bebName.textbox("getValue")==tab2Rows[i].BEBNAME){
return $.messager.alert(resource.msg_title,resource.bizentity.check.bookName);
return $.messager.alert(base.resource.msg_title,resource.check.bookName);
}
}
}
......@@ -973,14 +975,14 @@ define(function() {
//判断结算账套名称是否重复
if(!params.id){
$.post('./bizSetOfBook/existsName.json',{name:bebName.textbox("getValue")}, function(result) {
if(responseUtils(result)){
if($.response(result)){
setOfBook();
}
});
}else{
if(bebName.textbox("getValue")!=editBebName){
$.post('./bizSetOfBook/existsName.json',{name:bebName.textbox("getValue")}, function(result) {
if(responseUtils(result)){
if($.response(result)){
setOfBook();
}
});
......@@ -1079,11 +1081,11 @@ define(function() {
var row = bizInvoice.datagrid("getSelected");
var rowIndex = bizInvoice.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
if(row.BEIID){
$.JSON("./bizInvoice/query.json",{id:row.BEIID},function(result){
if(responseUtils(result)){
if($.response(result)){
invoBEINAME.textbox("setValue",result.value.name);
invoBEITAXNUM.textbox("setValue",result.value.taxnum);
invoBEITAXRATE.textbox("setValue",Number(result.value.taxrate)*100);
......@@ -1106,9 +1108,9 @@ define(function() {
var row = bizInvoice.datagrid("getSelected");
var rowIndex = bizInvoice.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
bizInvoice.datagrid('deleteRow', rowIndex);
}
......@@ -1121,12 +1123,12 @@ define(function() {
for(var i=0;i<invoiceRows.length;i++){
if(editBeiName==""){
if(invoBEINAME.textbox("getValue")==invoiceRows[i].BEINAME){
return $.messager.alert(resource.msg_title,resource.bizentity.check.beiName);
return $.messager.alert(base.resource.msg_title,resource.check.beiName);
}
}else{
if(invoBEINAME.textbox("getValue")!=editBeiName){
if(invoBEINAME.textbox("getValue")==invoiceRows[i].BEINAME){
return $.messager.alert(resource.msg_title,resource.bizentity.check.beiName);
return $.messager.alert(base.resource.msg_title,resource.check.beiName);
}
}
}
......@@ -1165,11 +1167,11 @@ define(function() {
var row = bizAccount.datagrid("getSelected");
var rowIndex = bizAccount.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
if(row.BEAID){
$.JSON("./bizAccount/query.json",{id:row.BEAID},function(result){
if(responseUtils(result)){
if($.response(result)){
accBEASOURCE.textbox("setValue",result.value.source);
accBEANAME.textbox("setValue",result.value.name);
accBEAACCOUNT.textbox("setValue",result.value.account);
......@@ -1190,18 +1192,18 @@ define(function() {
var row = bizAccount.datagrid("getSelected");
var rowIndex = bizAccount.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
var uuid=row.UUID;
var accRows = bizPayway.datagrid("getRows");
for (var i = 0; i < accRows.length; i++) {
if(accRows[i].UUID==uuid){
$.messager.alert(resource.msg_title, resource.bizentity.check.actCntdelet);
$.messager.alert(base.resource.msg_title, resource.check.actCntdelet);
return;
}
}
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
bizAccount.datagrid('deleteRow', rowIndex);
}
......@@ -1254,7 +1256,7 @@ define(function() {
}
mapaccount=map;
payBEPACCOUNT.combobox("loadData",accounts);
bizPaywayDialog.show().addClass("add").window("center").dialog("open").dialog('setTitle',resource.bizentity.paymentmethod).find(".bizPaywayForm").form("clear");
bizPaywayDialog.show().addClass("add").window("center").dialog("open").dialog('setTitle',resource.paymentmethod).find(".bizPaywayForm").form("clear");
payPTVALID.combobox("setValue",'1');
}
......@@ -1270,11 +1272,11 @@ define(function() {
var row = bizPayway.datagrid("getSelected");
var rowIndex = bizPayway.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
if(row.BEPID){
$.JSON("./bizPayway/query.json",{id:row.BEPID},function(result){
if(responseUtils(result)){
if($.response(result)){
var accRows = bizAccount.datagrid("getRows");
var accounts=[];
......@@ -1338,16 +1340,16 @@ define(function() {
bizPaywayDialog.find(".bizPaywayForm").form("load",row);
}
payINDEX.val(rowIndex);
bizPaywayDialog.show().removeClass("add").window("center").dialog("open").dialog('setTitle',resource.bizentity.paymentmethod).find(".bizPaywayForm");
bizPaywayDialog.show().removeClass("add").window("center").dialog("open").dialog('setTitle',resource.paymentmethod).find(".bizPaywayForm");
}
}
function removeBizPayway(){
var row = bizPayway.datagrid("getSelected");
var rowIndex = bizPayway.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
bizPayway.datagrid('deleteRow', rowIndex);
}
......@@ -1384,12 +1386,12 @@ define(function() {
var row = initTab2.datagrid("getSelected");
var rowIndex = initTab2.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
if(row.BEBDEFAULT=='1'){
return $.messager.alert(resource.msg_title, resource.bizentity.check.defaultBookDelete);
return $.messager.alert(base.resource.msg_title, resource.check.defaultBookDelete);
}
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
if(row.BEBID != undefined){
delbebIds.push(
......@@ -1404,7 +1406,7 @@ define(function() {
// 打开经营渠道dialog (总部)
function openChannel(){
channelDialog.show().window("center").dialog("open").dialog('setTitle',resource.bizentity.channelTitle).find(".channelForm");
channelDialog.show().window("center").dialog("open").dialog('setTitle',resource.channelTitle).find(".channelForm");
distributorForm.find('.CHANNELTEXTEDIT').hide();
distributorForm.find('.CHANNELEDIT').show();
channelDialog.find(".channel").combobox('clear');
......@@ -1414,13 +1416,13 @@ define(function() {
var chId=channelDialog.find(".channel").combobox("getValue");
for(var i=0;i<rows.length;i++){
if(chId==rows[i].CHID){
return $.messager.alert(resource.msg_title, resource.bizentity.check.channelValid);
return $.messager.alert(base.resource.msg_title, resource.check.channelValid);
}
}
var item = channelDialog.find(".channel").combobox("getValue");
$.post("./channel/findDetails.json",{id:item},function(result){
if(responseUtils(result)){
if($.response(result)){
var Invoice ={
CHNAME:result.value.name,
CHDESC:result.value.desc,
......@@ -1438,7 +1440,7 @@ define(function() {
//打开经营渠道dialog (分销商)
function openDistributor(){
distributorDialog.show().window("center").dialog("open").dialog('setTitle',resource.bizentity.channelTitle).find(".distributorForm").form("clear");
distributorDialog.show().window("center").dialog("open").dialog('setTitle',resource.channelTitle).find(".distributorForm").form("clear");
distributorForm.find('.CHANNELTEXTEDIT').hide();
distributorForm.find('.CHANNELEDIT').show();
distINDEX.val("");
......@@ -1451,15 +1453,15 @@ define(function() {
var row = initTab3.datagrid("getSelected");
var rowIndex = initTab3.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgEditTip);
$.messager.alert(base.resource.msg_title, base.resource.msgEditTip);
}else{
if(row.BECID){
$.post("./bizChannel/findByBecId.json",{becId:row.BECID},function(result){
if(responseUtils(result)){
if($.response(result)){
distCHANNEL.combobox('clear');
chidck=result.value.chid;
$.post("./channel/findList.json",{'id':result.value.beparent},function(r){
if(responseUtils(r)){
if($.response(r)){
if(r.list.length>0){
distCHANNEL.combobox('loadData',r.list);
distCHANNEL.combobox("setValue",result.value.chid);
......@@ -1485,7 +1487,7 @@ define(function() {
distCHANNEL.combobox('clear');
$.post("./channel/findList.json",{'id':row.BEPARENT},function(r){
if(responseUtils(r)){
if($.response(r)){
if(r.list.length>0){
distCHANNEL.combobox('loadData',r.list);
distCHANNEL.combobox("setValue",row.CHID);
......@@ -1500,7 +1502,7 @@ define(function() {
}
distINDEX.val(rowIndex);
distributorDialog.show().removeClass("add").window("center").dialog("open").dialog('setTitle',resource.bizentity.channelTitle).find(".distributorForm");
distributorDialog.show().removeClass("add").window("center").dialog("open").dialog('setTitle',resource.channelTitle).find(".distributorForm");
}
}
......@@ -1514,7 +1516,7 @@ define(function() {
var chId=distributorForm.find(".CHANNEL").combobox("getValue");
for(var i=0;i<rows.length;i++){
if(chId==rows[i].CHID){
return $.messager.alert(resource.msg_title, resource.bizentity.check.channelValid);
return $.messager.alert(base.resource.msg_title, resource.check.channelValid);
}
}
}else{
......@@ -1523,7 +1525,7 @@ define(function() {
if(chId!=chidck){
for(var i=0;i<rows.length;i++){
if(chId==rows[i].CHID){
return $.messager.alert(resource.msg_title, resource.bizentity.check.channelValid);
return $.messager.alert(base.resource.msg_title, resource.check.channelValid);
}
}
}
......@@ -1550,9 +1552,9 @@ define(function() {
var row = initTab3.datagrid("getSelected");
var rowIndex = initTab3.datagrid('getRowIndex', row);
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, base.resource.msgRemoveTip);
}else{
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, base.resource.confirmDelete, function(r){
if(r){
initTab3.datagrid('deleteRow', rowIndex);
}
......@@ -1561,7 +1563,7 @@ define(function() {
}
//总部
var channelCombox = $.post("./channel/channelList.json",null,function(r){
if(responseUtils(r)){
if($.response(r)){
channelDialog.find(".channel").combobox(
{data:r.list,
width:300,
......@@ -1571,7 +1573,7 @@ define(function() {
});
/*// 分销商
var distCHANNEL = $.post("./channel/findList.json",{'id':distributorForm.find(".BEID").val()},function(r){
if(responseUtils(r)){
if($.response(r)){
distributorForm.find(".CHANNEL").combobox(
{data:r.list,
width:300,
......@@ -1587,7 +1589,7 @@ define(function() {
// 选择适用经营品牌
function chooseBrank(){
var chid=distributorForm.find(".CHANNEL").combobox("getValue");
showCondObject({id:'5b6e6fc2-71fc-4ca5-90fc-d24abbe6533e',showGrid:true,refresh:true,singleSelect:false,onBeforeLoad:function(params){
base.showCondObject({id:'5b6e6fc2-71fc-4ca5-90fc-d24abbe6533e',showGrid:true,refresh:true,singleSelect:false,onBeforeLoad:function(params){
//params["fb650b21-d3e5-4ab1-b0ad-eee9b0400d98"]=distributorForm.find(".BEID").val();
//params["e3b9bb7b-54a6-11e6-8096-6c626db0ae88"]=chid
params["677cc424-5967-11e6-8096-6c626db0ae88"]=1;
......@@ -1607,7 +1609,7 @@ define(function() {
};
// 选择上级经营主体
function chooseBizEntity(){
showCondObject({id:"6bb37d77-118d-46dd-ab76-af904810c47d", showGrid:true, refresh:true, singleSelect:true,onBeforeLoad:function(params){
base.showCondObject({id:"6bb37d77-118d-46dd-ab76-af904810c47d", showGrid:true, refresh:true, singleSelect:true,onBeforeLoad:function(params){
return params["7b4ce7b5-5b1e-48cd-987d-12ac4b91a4aa"]=1;
}}, function(row){
distributorForm.find(".BEID").val(row.BEID);
......@@ -1615,7 +1617,7 @@ define(function() {
//distCHANNEL.combobox('reload','./channel/findList.json?id='+distributorForm.find(".BEID").val());
distCHANNEL.combobox('clear');
$.post("./channel/findList.json",{'id':distributorForm.find(".BEID").val()},function(r){
if(responseUtils(r)){
if($.response(r)){
distCHANNEL.combobox('loadData',r.list);
}
});
......@@ -1635,20 +1637,20 @@ define(function() {
function saveBtn(){
if(formInfo.find(".ID").val()!=""){
if(Number(pltId)!=1){
return $.messager.alert(resource.msg_title,resource.bizentity.check.editVaild);
return $.messager.alert(base.resource.msg_title,resource.check.editVaild);
}
}
var tab2Rows = initTab2.datagrid("getRows");
var proMsg=resource.users.saveTitle;
var proMsg=resource.saveTitle;
if(tab2Rows.length==0){
//return $.messager.alert(resource.msg_title,resource.bizentity.check.setOfBook);
proMsg=resource.bizentity.check.proMsgSaveTitle;
//return $.messager.alert(base.resource.msg_title,resource.check.setOfBook);
proMsg=resource.check.proMsgSaveTitle;
}
var tab3Rows = initTab3.datagrid("getRows");
if(tab3Rows.length==0){
return $.messager.alert(resource.msg_title,resource.bizentity.check.channel);
return $.messager.alert(base.resource.msg_title,resource.check.channel);
}
tabs.tabs("select",0);
......@@ -1658,7 +1660,7 @@ define(function() {
if(!initTab1.find(".details-tab-form").form("validate")){
return;
}
$.messager.confirm(resource.msg_title,proMsg, function(r){
$.messager.confirm(base.resource.msg_title,proMsg, function(r){
if(r){
var setOfRows = initTab2.datagrid("getRows");
var channleRows = initTab3.datagrid("getRows");
......@@ -1751,8 +1753,8 @@ define(function() {
bizEntity.bizSetOfBookList = bizSetOfBookList;
bizEntity.bizChannelList = bizChannelList;
$.JSON("./bizEntity/insert.json",bizEntity , function(result){
if(responseUtils(result)){
closeSelectedPanel();
if($.response(result)){
indexlayout.closeSelectedPanel();
}
});
}
......
define(function(){
define(['i18n!bizEntity/nls/resource', 'cls', 'base/index', 'index/index'], function (resource, Class, base, indexlayout){
return {
resource:resource,
init:function(pltId){
var body=$(document.body);
var pannel = getSelectedPanel();//初始化面板
var pannel = indexlayout.getSelectedPanel();//初始化面板
var page = pannel.children(".bizEntity-index-page").layout({
fit:true
});//定义面板内div
......@@ -14,44 +15,46 @@ define(function(){
return $('<div></div>').appendTo(center).datagrid({
url:'./query/'+condId+'.json',
toolbar:$('<div class="clearfix"></div>').rs_toolbar({
title: resource.bizentity.title,
authz:getAuthzUtils('bizEntity'),
title: resource.title,
authz:base.getAuthz('bizEntity'),
buttons:[{
text:resource.btn.select,
text:base.resource.btn.select,
iconCls:'btn-select select-condition',
code:'view',
handler: function(){
showCondObject(condId,datagridReload);
base.showCondObject(condId,datagridReload);
}
},{
text:resource.btn.add,
text:base.resource.btn.add,
iconCls:'btn-add',
code:'edit',
handler: addBizEntity
},{
text:resource.btn.edit,
text:base.resource.btn.edit,
iconCls:'btn-edit',
code:'edit',
handler: editBizEntity
},{
text:resource.btn.remove,
text:base.resource.btn.remove,
iconCls:'btn-remove',
code:'edit',
handler: removeBizEntity
}],
tools:[{
text:resource.btn.refresh,
text:base.resource.btn.refresh,
iconCls:'btn-refresh',
handler:panelRefreshUtils
handler:function(){
indexlayout.getSelectedPanel().panel("refresh");
}
}]
}),
columns:[[
{field:'ck',checkbox:true },
{field:'BECODE',title:resource.bizentity.grid.code, width:150},
{field:'BENAME',title:resource.bizentity.grid.name, width:200},
{field:'ORGTYPE',title:resource.bizentity.grid.type, width:120},
{field:'BEDESC',title:resource.bizentity.grid.desc, width:300,formatter:formatText},
{field:'VALID',title:resource.bizentity.grid.valid, width:100}
{field:'BECODE',title:resource.grid.code, width:150},
{field:'BENAME',title:resource.grid.name, width:200},
{field:'ORGTYPE',title:resource.grid.type, width:120},
{field:'BEDESC',title:resource.grid.desc, width:300,formatter:formatText},
{field:'VALID',title:resource.grid.valid, width:100}
]],
onLoadSuccess:function(data){
if(Number(pltId)!=1){
......@@ -70,27 +73,29 @@ define(function(){
}
//新建经营主体
function addBizEntity(){
showTabUtils({text:resource.bizentity.detailTitle,url:'./bizEntity/details'},true,function(){grid.datagrid("reload");});
indexlayout.showPanel({text:resource.detailTitle,url:'./bizEntity/details'},true,function(){grid.datagrid("reload");});
}
//编辑的经营主体
function editBizEntity(){
var row=grid.datagrid('getSelected');
if(row){
showTabUtils({text:resource.bizentity.detailTitle,url:'./bizEntity/details',id:row.BEID},true,function(){grid.datagrid("reload");});
indexlayout.showPanel({text:resource.detailTitle,url:'./bizEntity/details',id:row.BEID},true,function(){grid.datagrid("reload");});
}else{
$.messager.alert(resource.msg_title,resource.msgEditTip);
$.messager.alert(base.resource.msg_title,base.resource.msgEditTip);
}
}
//删除主体
function removeBizEntity(){
var row=grid.datagrid('getSelected');
if(row==null){
$.messager.alert(resource.msg_title, resource.msgRemoveTip);
$.messager.alert(base.resource.msg_title, resource.msgRemoveTip);
}else{
$.messager.confirm(resource.msg_title, resource.confirmDelete, function(r){
$.messager.confirm(base.resource.msg_title, resource.confirmDelete, function(r){
if(r){
$.post("./bizEntity/delete.json",{id:row.BEID},function(result){
if(responseUtils(result)){
console.log(result);
if($.response(result)){
console.log(result);
grid.datagrid("reload");
}
});
......@@ -103,7 +108,7 @@ define(function(){
if(params){
grid.datagrid("reload",params);
}else{
grid.datagrid("reload",getCondObjectValue(condId));
grid.datagrid("reload",base.getCondObjectValue(condId));
}
}
}
......
define({
root:{
title:'经营主体',
detailTitle:'经营主体详情',
channelTitle:'主体经营渠道',
closeAct:'结算账套',
paymentmethod:'收款方式',
saveTitle:'确定保存?',
orgTypeDialogTitle:'选择新建的组织类型',
msgRemoveTip:'请选择要删除的数据!',
confirmDelete:'你确定要删除这条信息吗?',
grid:{
code:'编号',
name:'名称',
desc:'描述 ',
type:'组织类型',
valid:'可用',
bebcode:'编号',
bebname:'名称',
bename:'主体名称',
bebdesc:'描述',
ptvalid:'可用',
beiname:'开票单位名称',
beitaxnum:'税务登记号',
beitaxrate:'税率',
ptphone:'电话',
ptaddr:'地址',
cuname:'币种单位',
bizinvoicelist:'开票信息',
bizaccountlist:'常用账户',
bizpaywaypist:'收款方式',
beasource:'收支渠道/银行',
beaname:'账户名',
beaaccount:'BEAACCOUNT',
bearate:'交易费率',
pwid:'收款方式ID',
pwname:'收款方式名称',
curate:'汇率',
bepproceeds:'收款渠道/银行',
beppayee:'收款人',
bepaccount:'收款账号',
bepincome:'计销售收入',
beppoint:'消费积分',
piid:'调用支付接口'
},
channel:{
title:'经营渠道',
grid:{
name:'名称',
desc:'描述 ',
brand:'经营品牌',
valid:'可用'
},
check:{
valid:'只有系统管理平台才能编辑渠道信息!'
}
},
bizChannelgridtitle:'经营渠道',
bizChannelgrid:{
beName:'上级经营主体'
},
check:{
setOfBook:'每个经营主体必须创建至少一个结算账套',
channel:'每个经营主体必须创建至少一个经营渠道',
bookName:'该结算账套的名称已与当前主体的其它已有结算账套重复',
beiName:'一个结算账套内开票名称禁止重复',
numberLetterValid:'编号只能输入数字、字母或其组合',
ptphone:'请输入正确的号码,格式如:0519-83360776或83360776,3~4位区号加7~8位号码,区号可以省略!',
decimalValid:'只能输入1位整数并且小数位最多4位小数,例如:1.1234',
integer:'税率范围0-100%',
channelValid:'当前选择的经营渠道与列表中的经营渠道有重复,请重新选择!',
editVaild:'只有系统管理平台才能编辑经营主体信息!',
defaultBookEdit:'默认结算账套不能修改!',
defaultBookDelete:'默认结算账套不能删除!',
proMsgSaveTitle:'您当前未设置结算账套,新增时系统会默认帮您生成一个默认的结算账套,确定继续吗?',
orgtypeValid:'请先选择销售类型!',
actCntdelet:'该账户已经被已有收款方式使用,不能删除!'
}
},
"en-US": true,
"en-US-paris": true
});
\ No newline at end of file