You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1110 lines
38 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsOpTaskEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpTaskEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpTaskEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
this.formname = 'MsOpTaskEdit';
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '指派人',
store: this.storeOpCode,
forceSelection: true,
name: 'TASKOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeCUSTNO = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOpBsNo',
proxy: { url: '/MvcShipping/MsOpTaskNew/GetBsListRm' }
});
this.comboxCUSTNO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托编号',
store: this.storeCUSTNO,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CUSTNO',
valueField: 'CUSTNO',
displayField: 'CUSTNO',
listeners: {
'select': function (combo, records, eOpts) {
if (records.length > 0) {
_this.formEdit.getForm().findField('MBLNO').setValue(records[0].data.MBLNO);
_this.formEdit.getForm().findField('BSNO').setValue(records[0].data.BSNO);
_this.formEdit.getForm().findField('PORTLOAD').setValue(records[0].data.PORTLOAD);
_this.formEdit.getForm().findField('PORTDISCHARGE').setValue(records[0].data.PORTDISCHARGE);
_this.formEdit.getForm().findField('SALE').setValue(records[0].data.SALE);
_this.formEdit.getForm().findField('OP').setValue(records[0].data.OP);
}
}
}
});
this.storeTASKTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTASKTYPE.load({ params: { enumTypeId: 99081 } });
this.comboxTASKTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeTASKTYPE,
fieldLabel: '类别',
allowBlank: true,
name: 'TASKTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '涉及部门', //'所属部门',
store: this.storeDept,
forceSelection: true,
name: 'DEPT',
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
this.StoreTASKCLASS = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreTASKCLASS.add({ "ID": 0, "NAME": "低" });
this.StoreTASKCLASS.add({ "ID": 1, "NAME": "中" });
this.StoreTASKCLASS.add({ "ID": 2, "NAME": "高" });
this.comboxTASKCLASS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '优先级',
name: 'TASKCLASS',
forceSelection: true,
store: this.StoreTASKCLASS,
queryMode: 'local',
valueField: 'ID',
displayField: 'NAME'
});
//表参照相关(编辑form)
_this = this;
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'OPTYPE',
name: 'OPTYPE', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '状态',
allowBlank: true,
readOnly: true,
flex: 1,
name: 'TASKSTATUS'
}, {
fieldLabel: '问题标题',
flex: 2,
name: 'TASKTITLE'
}, this.comboxOP, this.comboxTASKTYPE ]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxDept, this.comboxTASKCLASS, {
fieldLabel: '截止日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CLOSEDATE'
}, this.comboxCUSTNO, {
fieldLabel: '主提单号',
name: 'MBLNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '业务卡编号',
name: 'BSNO'
}, {
fieldLabel: '装货港',
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
name: 'PORTDISCHARGE'
}, {
fieldLabel: '揽货人',
name: 'SALE'
}, {
fieldLabel: '操作员',
name: 'OP'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '进行中的天数',
allowBlank: true,
labelWidth: 80,
readOnly: true,
flex: 1,
name: 'WORKDAY'
},{
fieldLabel: '完成时间',
allowBlank: true,
readOnly: true,
flex: 1,
name: 'COMPLETETIME'
},{
fieldLabel: '创建人',
allowBlank: true,
readOnly: true,
flex: 0.5,
name: 'CREATEUSERREF'
}, {
fieldLabel: '创建时间',
allowBlank: true,
readOnly: true,
flex: 1,
name: 'CREATETIME'
},{
fieldLabel: '修改人',
allowBlank: true,
readOnly: true,
flex: 0.5,
name: 'MODIFYUSERREF'
}, {
fieldLabel: '修改时间',
allowBlank: true,
readOnly: true,
flex: 1,
name: 'MODIFYTIME'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
},
{
text: "保存",
iconCls: "btnsave",
id: 'btnsave',
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
id: 'btnsaveandclose',
handler: function (button, event) {
this.Save('1');
},
scope: this
}, '-', {
text: "状态确认",
menu: [
{
text: "完成",
id: 'btnover',
handler: function (button, event) {
_this.onUpTransStatusClick('完成');
}
}, {
text: "进行中",
handler: function (menu, event) {
_this.onUpTransStatusClick('进行中');
}
}],
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 费用信息
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpTaskDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpTaskNew/GetTaskDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdbillcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'PGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'TASKDESCRIP',
header: '问题进展',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 350
},
{
sortable: true,
dataIndex: 'CREATEUSERREF',
align: 'center',
header: '创建人',
width: 120
}, {
sortable: true,
dataIndex: 'CREATETIME',
align: 'center',
header: '创建时间',
width: 120
}];
this.girdbillcolums = this.initgirdbillcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
//var feeStatus = record.get('FEESTATUS');
//return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '增加',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}],
columns: this.girdbillcolums
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
//#endregion
//#region 费用信息
this.storeLogList = Ext.create('Ext.data.Store', {
model: 'MsOpTaskLog',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpTaskNew/GetTaskLogList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridLogListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdLogcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'PGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
align: 'center',
//header: '创建人',
width: 100
},{
sortable: true,
dataIndex: 'DESCRIP',
//header: '问题进展',
width: 120
},
{
sortable: true,
dataIndex: 'CREATETIME',
align: 'center',
//header: '创建时间',
width: 140
}];
this.girdlogcolums = this.initgirdLogcolums;
this.GridLogCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListLog = new Ext.grid.GridPanel({
store: this.storeLogList,
enableHdMenu: false,
hideHeaders: true,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridLogListCellEditing],
selModel: this.GridLogCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
//var feeStatus = record.get('FEESTATUS');
//return Shipping.FeeGetRowClass(feeStatus);
}
},
columns: this.girdlogcolums
});
this.panelLog = new Ext.Panel({
title: '日志',
layout: "border",
region: 'east',
width:400,
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListLog]
});
//#endregion
this.panelBody = new Ext.Panel({
title: '进展信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody, this.panelLog]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [
this.panelBody
]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
//绑定查询窗体
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.storeBodyList.on('beforeload', function (store) {
var acondition = " PGID='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
var btnover = Ext.getCmp('btnover');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modOpTaskNewOver"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnover.disable();
} else {
btnover.enable();
}
} else {
}
},
scope: this
});
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpTaskNew/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().reset();
this.formEdit.getForm().setValues(data);
var acondition = "";
if (this.opStatus == 'edit')
acondition = " PGID='" + this.editRecord.get('GID') + "'";
else
acondition = " PGID='11111'";
this.storeBodyList.load({ params: { condition: acondition } });
this.storeLogList.load({ params: { condition: acondition } });
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
if (this.opStatus == 'add') {
data.GID = NewGuid();
}
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
j = j + 1;
}
//if (j == 0) {
// Ext.Msg.show({ title: '提示', msg: '配件信息不能为空,请先录入配件信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpTaskNew/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this.GetEditStatus();
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpTask', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
var acondition = " PGID='" + this.editRecord.get('GID') + "'";
this.storeLogList.load({ params: { condition: acondition } });
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("PGID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("PGID", this.editRecord.get('GID'));
memberbody.commit();
};
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('GID').setDisabled(false);
}
} 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
});
}
}
});
}, //end save
addDetail: function () {
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var record = Ext.create('MsOpTaskDetail', {
GID: NewGuid(),
PGID: '*',
TASKDESCRIP: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
},
onDeletePriceItemsClick: function () {
var billstatus = this.formEdit.getForm().findField('TASKSTATUS').getValue();
if (billstatus != "新建") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridListBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.PGID == "*" || rec.data.PGID == "") {
this.storeBodyList.remove(selections[i]);
} else {
bodyAddDatas.push(rec);
}
}
if (bodyAddDatas.length == 0) return;
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpTaskNew/DeleteDetail',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " PGID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: acondition } });
this.storeLogList.load({ params: { condition: acondition } });
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onUpTransStatusClick: function (transstatus) {
var billstatus = this.formEdit.getForm().findField('TASKSTATUS').getValue();
if (billstatus == "完成") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要更新记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在更新数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在更新数据...',
url: '/MvcShipping/MsOpTaskNew/UpTransStatus',
scope: this,
params: {
GID: this.editRecord.get('GID'),
transstatus: transstatus
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " PGID='" + this.editRecord.get('GID') + "'";
this.storeLogList.load({ params: { condition: acondition } });
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this.GetEditStatus();
var editp = Ext.create('MsOpTask', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
} 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
});
}
}
});
}
}, this);
},
cellEditingBeforeEdit: function (editor, e) {
//var chfeefeeStatus = e.record.get('FEESTATUS');
var canedit = true;
return canedit;
},
onExportBillClick: function () {
_this = this;
if (this.storeBodyList.getCount() == 0) {
return;
}
var sortstr = '';
var sql = '';
var billno = this.editRecord.get('GID');
sql = " LINKGID='" + billno + "'"
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnTkFitings/GetFitingsBodyListStr',
scope: this,
params: {
condition: sql,
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
sql1 = sql1.replace(/\>/g, "&&&")
sql1 = sql1.replace(/\</g, "%%%")
if (sql1 != '') {
GridExportBySql(sql1, this.formname + 'bill', '代理运价费用明细.xls');
}
} 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
});
}
}
});
},
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var BSSTATUS = this.formEdit.getForm().findField('TASKSTATUS').getValue();
var CREATEUSERREF = this.formEdit.getForm().findField('CREATEUSERREF').getValue();
var TASKOP = this.formEdit.getForm().findField('TASKOP').getValue();
// if (BSSTATUS == '完成' || ((SHOWNAME != CREATEUSERREF) && (SHOWNAME != TASKOP))) {
if (BSSTATUS == '完成' || ((SHOWNAME != CREATEUSERREF) && (SHOWNAME != TASKOP))) {
var canedit = false;
_this.setSaveBtnStatus(canedit);
return;
}
canedit = true;
_this.setSaveBtnStatus(canedit);
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnsave');
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
var btnECopyAndNew = Ext.getCmp('btncopyandsave');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeldetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
// btnECopyAndNew.enable();
btnadddetail.enable();
btndeldetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
// btnECopyAndNew.disable();
btnadddetail.disable();
btndeldetail.disable();
}
},
//#endregion
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var drmodify = this.storeBodyList.getModifiedRecords();
if (drmodify.length != 0)
return '配件详细信息';
if (panelEdit.formEdit.getForm().isDirty() == true)
return '采购信息';
else return '';
} //
});