|
|
|
|
///<reference path="../../../../Views/../TruckMng/Scripts/ext-all-debug.js" />
|
|
|
|
|
Ext.namespace('BaseProject');
|
|
|
|
|
|
|
|
|
|
var BillNoCount=0;
|
|
|
|
|
|
|
|
|
|
Shipping.DBTableConnEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.DBTableConnEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getSaved(){
|
|
|
|
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.extend(Shipping.DBTableConnEdit, Ext.Panel, {
|
|
|
|
|
parentWin: null,
|
|
|
|
|
OpStatus: 'edit',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
editRecord: null,
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
|
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
|
|
|
|
this.formname = "modDBTableConnEdit";
|
|
|
|
|
|
|
|
|
|
//#region 编辑form:formEdit
|
|
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
|
|
// layout: "border",
|
|
|
|
|
region: 'north',
|
|
|
|
|
height:180,
|
|
|
|
|
//collapsed: false,
|
|
|
|
|
//collapsible: true,
|
|
|
|
|
frame: true,
|
|
|
|
|
bodyPadding: 3,
|
|
|
|
|
trackResetOnLoad: true,
|
|
|
|
|
fieldDefaults: {
|
|
|
|
|
margins: '4 0 0 0',
|
|
|
|
|
labelAlign: 'right',
|
|
|
|
|
flex: 1,
|
|
|
|
|
labelWidth: 60,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
//,split:true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{//fieldset 1
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
layout: 'anchor',
|
|
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
},
|
|
|
|
|
items: [{//container_1
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: 'ID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
name: 'ID'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '名称',flex:3,
|
|
|
|
|
name: 'NAME'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '同步方式', flex: 3, tooltip: '时间标签/实际同步时间/单号/日期/空,分别代表\ln\ln按时间标签判断是否更新/按来源时间标签晚于同步开始时间/只同步指定单号的数据/只比对时间晚于条件内日期的数据/(即完全同步)',
|
|
|
|
|
name: 'SYNCTYPE'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '开始时间', flex: 2,
|
|
|
|
|
name: 'SYNCSTARTTIME', readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '完成时间', flex: 2,
|
|
|
|
|
name: 'SYNCTIME', readOnly: true
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '状态', flex: 2, tooltip: '此值为正在进行时最好不要强制执行',
|
|
|
|
|
name: 'SYNCSTATES',readOnly:true
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '同步频率', flex: 1,tooltip:'自动同步设置,暂时无用',
|
|
|
|
|
name: 'SYNCFREQ',
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
|
|
allowDecimals: false, //允许输入小数
|
|
|
|
|
decimalPrecision: 0, //允许保留的小数位数,并四舍五入
|
|
|
|
|
nanText: '请输入有效数值', hidden: true,
|
|
|
|
|
hideTrigger: false //是否隐藏上下调节按钮
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '时间戳',
|
|
|
|
|
name: 'TIMEMARK', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {//container_2
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
fieldLabel: '来源库', flex: 1,
|
|
|
|
|
name: 'FROMDB'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '来源表', flex: 1,
|
|
|
|
|
name: 'FROMTABLE'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '来源主键', flex: 1,
|
|
|
|
|
name: 'FROMPKEY'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '时间标签', flex: 1,tooltip:'来源时间标签字段名',
|
|
|
|
|
name: 'FROMTIMEMARK'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {//container_3
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
fieldLabel: '目标库', flex: 1,
|
|
|
|
|
name: 'TODB'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '目标表', flex: 1,
|
|
|
|
|
name: 'TOTABLE'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '目标主键', flex: 1,
|
|
|
|
|
name: 'TOPKEY'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '时间标签', flex: 1, tooltip: '目标时间标签字段名',
|
|
|
|
|
name: 'TOTIMEMARK'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {//container_4
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
fieldLabel: '说明', flex: 1,
|
|
|
|
|
name: 'DESCRPTION'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {//container_4
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
fieldLabel: '条件', flex: 1,
|
|
|
|
|
name: 'CONDITION'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
}]
|
|
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//数据集
|
|
|
|
|
this.storeBody = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'SYS_TABLECONN_FIELDmb',
|
|
|
|
|
pageSize: 9999,
|
|
|
|
|
remoteSort: false,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/SysMng/DBTableConn/GetBodyList',
|
|
|
|
|
reader: {
|
|
|
|
|
id: 'ID',
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.Bodycolumns = [
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'ID',
|
|
|
|
|
header: 'ID',
|
|
|
|
|
width: 80,
|
|
|
|
|
hidden: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'CONNID',
|
|
|
|
|
header: 'CONNID',
|
|
|
|
|
width: 80,
|
|
|
|
|
hidden: true
|
|
|
|
|
},{
|
|
|
|
|
dataIndex: 'NAME',
|
|
|
|
|
header: '名称',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},{
|
|
|
|
|
dataIndex: 'FROMFIELDNAME',
|
|
|
|
|
header: '来源字段',
|
|
|
|
|
width: 120,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
dataIndex: 'TOFIELDNAME',
|
|
|
|
|
header: '目标字段',
|
|
|
|
|
width: 120,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
dataIndex: 'CALCULATE',
|
|
|
|
|
header: '计算',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
//表格
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.cellEditingBody = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
this.Body_CBModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
|
|
|
|
this.gridBody = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeBody,
|
|
|
|
|
layout: "border",
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
//height: 160,
|
|
|
|
|
title: '字段信息',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.cellEditingBody],
|
|
|
|
|
selModel: this.Body_CBModel,
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加明细',
|
|
|
|
|
tooltip: '增加明细',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onAddBodyClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除明细',
|
|
|
|
|
tooltip: '删除明细',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onDelBodyClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
text: "保存列表样式",
|
|
|
|
|
id: "btnsavelist",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
var tempcolumns = this.gridBody.columns;
|
|
|
|
|
DsTruck.SaveGridPanel(USERID, _this.formname, tempcolumns,1);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: this.Bodycolumns
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.Bodycolumns = DsTruck.GetGridPanel(USERID, this.formname, this.Bodycolumns);
|
|
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
|
|
this.gridBody.reconfigure(this.storeBody, this.Bodycolumns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion 明细<<<< 字段表 >>>>结束
|
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
|
|
region: "north",
|
|
|
|
|
tbar: [
|
|
|
|
|
{
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "保存",
|
|
|
|
|
//disabled: true,
|
|
|
|
|
id: "SAVE1",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('0');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, {
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "保存并关闭",
|
|
|
|
|
//disabled: true,
|
|
|
|
|
id: "SAVE2",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('1');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},'-',
|
|
|
|
|
{
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
window.close();
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-',
|
|
|
|
|
{
|
|
|
|
|
// id: "saveandclose",
|
|
|
|
|
text: "同步数据",
|
|
|
|
|
//disabled: true,
|
|
|
|
|
id: "DoSync",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.DoSync();
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
|
/* 3 */
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "north",
|
|
|
|
|
height: 32,
|
|
|
|
|
items: [this.panelBtn]//, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.panelBody = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
margin: '0 0',
|
|
|
|
|
height: 320,
|
|
|
|
|
split: true,
|
|
|
|
|
items: [this.gridBody]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
|
|
title: "班级信息",
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
split: true,
|
|
|
|
|
items: [this.formEdit, this.panelBody]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "center",
|
|
|
|
|
items: [this.page_1
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop, this.formEdit, this.panelBody]
|
|
|
|
|
});
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridBody.on('edit', function (editor, e, eOpts) {
|
|
|
|
|
this.BodyAfterEdit(editor, e, eOpts);
|
|
|
|
|
}, this);
|
|
|
|
|
this.cellEditingBody.on('beforeedit', function (editor, e) {
|
|
|
|
|
return this.BodyBeforeEdit(editor, e);
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region Body相关方法
|
|
|
|
|
onAddBodyClick: function (button, event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var _r=this.reLine();
|
|
|
|
|
var record = Ext.create('SYS_TABLECONN_FIELDmb', {
|
|
|
|
|
'ID': NewGuid()
|
|
|
|
|
});
|
|
|
|
|
this.storeBody.add(record);
|
|
|
|
|
|
|
|
|
|
var n = this.storeBody.getCount();
|
|
|
|
|
this.cellEditingBody.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onDelBodyClick: function (button, event) {
|
|
|
|
|
|
|
|
|
|
var selectedRecords = this.gridBody.selModel.getSelection();
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
|
|
if (btn == 'yes') {
|
|
|
|
|
var _Used=0;
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
var ID=rec.data.ID;
|
|
|
|
|
if (ID == "" || ID == null) {
|
|
|
|
|
//continue;
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在查询数据...',
|
|
|
|
|
url: '/CommMng/BasicDataRef/GeneralSelect',
|
|
|
|
|
scope: this,
|
|
|
|
|
async:false,
|
|
|
|
|
params: {condition: "select Count(*) GVALUE,'' as GID from Import_appstate where isnull(cancellation,0)=0 and cargo_id="+cargo_id+" "} ,
|
|
|
|
|
waitMsg: "正在查询数据...",
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
|
|
_Used=parseFloat(result.data[0].GVALUE);
|
|
|
|
|
}
|
|
|
|
|
});*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (parseFloat( _Used)>0){
|
|
|
|
|
// alert("此商品已配证,不能删除");
|
|
|
|
|
//}else{
|
|
|
|
|
|
|
|
|
|
if (rec.ID != "" || rec.ID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
|
|
{
|
|
|
|
|
this.bodyDel.push(rec);
|
|
|
|
|
}
|
|
|
|
|
this.storeBody.remove(selectedRecords[i]);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
BodyAfterEdit: function(editor, e, eOpts) {
|
|
|
|
|
|
|
|
|
|
//alert(e.field);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
BodyBeforeEdit: function (editor, e) {
|
|
|
|
|
var ID = e.record.get('ID');
|
|
|
|
|
|
|
|
|
|
var canedit=true;
|
|
|
|
|
|
|
|
|
|
//alert(e.field);
|
|
|
|
|
|
|
|
|
|
return canedit;
|
|
|
|
|
},
|
|
|
|
|
//#endregion 明细表<<<商品>>>的相关方法
|
|
|
|
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
|
|
this.opStatus = ret[0];
|
|
|
|
|
this.StoreList = ret[1];
|
|
|
|
|
this.editRecord = ret[2];
|
|
|
|
|
// this.parentfunction = ret[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
|
|
condition = " ID='" + this.editRecord.get('ID') + "'";
|
|
|
|
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
|
|
|
|
//载入数据
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
|
|
|
|
|
|
|
//三个获得当前时间的函数 已于master页面中实现
|
|
|
|
|
//alert(currdate);
|
|
|
|
|
//alert(currdateStr);
|
|
|
|
|
//alert(currdateTime);
|
|
|
|
|
|
|
|
|
|
if (opstatus == "edit") {
|
|
|
|
|
this.formEdit.getForm().setValues(this.editRecord.data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
|
|
url: '/SysMng/DBTableConn/GetData',
|
|
|
|
|
params: {
|
|
|
|
|
handle: opstatus,
|
|
|
|
|
condition: condition
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (!result.Success) {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title: '提示',
|
|
|
|
|
msg: result.Message,
|
|
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
|
|
buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = result.data;
|
|
|
|
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
|
|
|
|
function setsave(){ saved = true; }
|
|
|
|
|
var task = new Ext.util.DelayedTask(setsave);
|
|
|
|
|
task.delay(500);//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//完成载入后,将状态设为已存储
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
});//request over
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
|
|
|
|
var s = " CONNID='" + this.editRecord.get('ID') + "'";
|
|
|
|
|
//alert(s);
|
|
|
|
|
this.storeBody.load({ params: { condition: s } });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
checkedit: function () {
|
|
|
|
|
|
|
|
|
|
if (this.storeBody.getCount() == 0) { return true; }
|
|
|
|
|
else {
|
|
|
|
|
for (var i = 0; i < this.storeBody.getCount() ; i += 1) {
|
|
|
|
|
var member = this.storeBody.getAt(i).data;
|
|
|
|
|
if (member.NAME == "" || member.FROMFIELDNAME == "" || member.TOFIELDNAME == "") {
|
|
|
|
|
alert("请填写名称和双方向字段名");
|
|
|
|
|
return false;
|
|
|
|
|
} else { return true; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
if (!this.checkedit()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!validateEditorGridPanel(this.gridBody)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
|
|
|
|
|
|
|
var Bodydatas = [];
|
|
|
|
|
for (var i = 0; i < this.storeBody.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeBody.getAt(i);
|
|
|
|
|
Bodydatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//学生明细
|
|
|
|
|
var SaveBody = ConvertRecordsToJson(Bodydatas);
|
|
|
|
|
var SaveDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/SysMng/DBTableConn/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
Body: SaveBody,
|
|
|
|
|
DelBody: SaveDelBody
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
|
|
|
|
|
//this.storeXS.commitChanges();
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
billno="";
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
|
var editp = Ext.create('SYS_TABLECONNmb', returnData);
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
|
|
if (field.persist) {
|
|
|
|
|
name = field.name;
|
|
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
|
|
//if (name != 'id')
|
|
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//重新载入子列表
|
|
|
|
|
this.storeBody.load({ params: { condition: " CONNID='" + this.editRecord.get('ID') + "'" } });
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
|
|
msg: '服务器响应出错',
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//alert('03');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} //end save
|
|
|
|
|
,
|
|
|
|
|
DoSync: function () {
|
|
|
|
|
if (!this.checkedit()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!validateEditorGridPanel(this.gridBody)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
|
|
|
|
|
|
|
//var Bodydatas = [];
|
|
|
|
|
//for (var i = 0; i < this.storeBody.getCount() ; i += 1) {
|
|
|
|
|
// var member = this.storeBody.getAt(i);
|
|
|
|
|
// Bodydatas.push(member);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//var SaveBody = ConvertRecordsToJson(Bodydatas);
|
|
|
|
|
//var SaveDelBody = ConvertRecordsToJsonAll(this.bodyDel);
|
|
|
|
|
|
|
|
|
|
//Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
//waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/SysMng/DBTableConn/DoSync',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
data: Ext.JSON.encode(data)
|
|
|
|
|
},
|
|
|
|
|
//callback: function (options, success, response) {
|
|
|
|
|
// if (success) {
|
|
|
|
|
// Ext.MessageBox.hide();
|
|
|
|
|
// var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
// if (jsonresult.Success) {
|
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// Ext.Msg.show({
|
|
|
|
|
// title: '请重试',
|
|
|
|
|
// msg: '服务器响应出错',
|
|
|
|
|
// icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//},
|
|
|
|
|
failure:function(res){
|
|
|
|
|
//////
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} //end save
|
|
|
|
|
});
|
|
|
|
|
|