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.

1155 lines
39 KiB
JavaScript

12 months ago
//业务单据文档管理
Ext.namespace('DsTruck');
DsTruck.ReceiptDocIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.ReceiptDocIndex.superclass.constructor.call(this);
};
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
Ext.extend(DsTruck.ReceiptDocIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.DocType = "单据";
this.BSNO = "";
this.CUSTNO = "";
this.URLHEAD = "ftp://bjes:@101.201.50.235/"; //120.27.53.37 101.201.50.235
this.Loading = false;
this.DocDel = [];
this.PICURL = "";
this.storeList = Ext.create('Ext.data.Store', {
model: 'ImportListmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDataList',
reader: {
idProperty: 'ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "ReceiptDoc";
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
layout: "border",
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('Received');
return DsTruck.ReceivedRowClass(feeStatus);
}
},
columns: [
new Ext.grid.RowNumberer(),
{
sortable: true, hidden: true,
dataIndex: 'ContractNo',
header: 'ContractNo',
width: 80
},
{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'Billno',
header: '提单号',
width: 80
},
{
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
},
{
sortable: true,
dataIndex: 'SealNo',
header: '封号',
width: 80
},
{
sortable: true,
dataIndex: 'ShipCompany_id',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 80
},
{
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 80
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
idProperty: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeHTH = Ext.create('DsExt.ux.RefTableStore', {
model: 'HTHmb',
proxy: { url: '/Import/ImportSync/GetHTH' }
});
var _this = this;
this.storeHTH.load({
callback: function (options, success, response) {
var p = {
HTH: '',
ContractNo: ''
};
_this.storeHTH.insert(0, p);
/*
if (success) {
this.storeHTH.data.unshift({"",""});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
*/
}
});
this.comboxHTH = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '本地合同号', id: "Local_ContractNo",
forceSelection: true,
store: this.storeHTH,
name: 'LocalContractNo',
valueField: 'ContractNo',
displayField: 'HTH'
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.formDocType = Ext.widget('form', {
frame: true,
region: "north",
bodyPadding: 3,
height: 40,
//width: 600,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'button',
text: "单据",
tooltip: "",
handler: function (button, event) {
this.DocType = "单据";
this.onImportClick();
},
scope: this
},
{
xtype: 'button',
text: "税单",
tooltip: "",
handler: function (button, event) {
this.DocType = "税单";
this.onImportClick();
},
scope: this
},
{
xtype: 'button',
text: "报关单",
tooltip: "",
handler: function (button, event) {
this.DocType = "报关单";
this.onImportClick();
},
scope: this
},
{
xtype: 'button',
text: "检疫证",
tooltip: "",
handler: function (button, event) {
this.DocType = "检疫证";
this.onImportClick();
},
scope: this
}]
}]
}
, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}
]//end root items
});
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.storeReceiptid_DOC = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptid_DOC.load({ params: { enumTypeId: 2} });
this.comboxReceiptid_DOC = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeReceiptid_DOC,
name: 'RECEIPTTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'center',
//width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '添加',
tooltip: '添加',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '保存',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
editor: this.comboxReceiptid_DOC,
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 140,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '修改人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 85
}
]
});
var _this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同号/提单号',
name: 'MBLNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '箱号',
name: 'ContainerNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDateBgn',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDateEnd',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'hiddenfield',
flex: 2
}
]
}, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}, {//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
} //end items(fieldset 3)
, {//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
}
]
}
]//end root items
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "获取已公布的业务信息",
id: "helloworld",
handler: function (button, event) {
this.OnClickXML();
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
//选择load
this.gridList.getSelectionModel().on('select', function (model, record, index) {
if (this.Loading == true) {
return;
}
this.BSNO = record.data.ContractNo;
this.CUSTNO = record.data.HTH;
this.onImportClick();
Ext.getCmp('panelPic').body.update('');
}, this);
this.gridDocList.getSelectionModel().on('select', function (model, record, index) {
if (this.Loading == true) {
return;
}
var PICURL = record.data.Driect_URL;
if (record.data.URL != "") {
Ext.getCmp('panelPic').body.update(' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + PICURL + '"> </iframe>');
}
}, this);
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 85,
items: [this.formSearch, this.panelBtn]
});
this.panelPic = new Ext.Panel({
id: "panelPic",
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + this.PICURL + '"> </iframe>'//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg
});
this.panelDoc = new Ext.Panel({
layout: "border",
region: 'south',
margin: '0 0',
height: 350,
width: 450,
split: true,
items: [this.formDocType, this.gridDocList]
});
this.panelList = new Ext.Panel({
layout: "border",
region: 'center',
margin: '0 0',
height: 850,
width: 450,
split: true,
items: [this.gridList]
});
this.panelLeft = new Ext.Panel({
// title: '货物信息和许可证使用',
layout: "border",
region: 'west',
margin: '0 0',
//height: 450,
width: 350,
split: true,
items: [this.panelList, this.panelDoc]
});
this.panelALL = new Ext.Panel({
//
layout: "border",
region: 'center',
margin: '0 0',
//height: 260, //width: 450,
split: true,
items: [this.panelLeft, this.panelPic]
});
//页面布局
Ext.apply(this, {
items: [this.panelTop, this.panelALL]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.storeList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridDocList.on('edit', function (editor, e, eOpts) {
this.DocAfterEdit(editor, e, eOpts);
}, this);
/*
this.storeDocList.on('beforeload', function (store) {
var sql = "BSNO='" + this.BSNO + "'";
Ext.apply(this.storeDocList.proxy.extraParams, { condition: sql });
}, this);*/
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.Loading = true;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "(m.BILLNO like '%" + MBLNO + "%' or m.HTH like '%" + MBLNO + "%')");
var ContainerNo = form.findField('ContainerNo').getValue();
sql = sql + getAndConSql(sql, ContainerNo, "m.ContainerNo like '%" + ContainerNo + "%'");
var ArrivalDateBgn = form.findField('ArrivalDateBgn').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDateBgn, "m.ArrivalDate >= '" + ArrivalDateBgn + "'");
var ArrivalDateEnd = form.findField('ArrivalDateEnd').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDateEnd, "m.ArrivalDate <= '" + ArrivalDateEnd + " 23:59:59'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
onImportClick: function () {
if (this.BSNO == "") {
return;
}
var condition = " BSNO='" + this.BSNO + "' and ReceiptType='" + this.DocType + "' ";
this.Loading = true;
this.storeDocList.load({
params: { condition: condition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
},
//#region <<<单据图片明细>>>
onAddDocClick: function (button, event) {
if (this.BSNO == "") {
return;
}
var record = Ext.create('ReceiptDocmb', {
'GID': NewGuid(),
'RECEIPTTYPE': this.DocType,
'R_GID': '',
'BSNO': '',
'URL': '',
'Driect_URL': '',
'MODIFIEDUSER': USERID,
'MODIFIEDUSERRef': SHOWNAME,
'MODIFIEDTIME': currdate.format('yyyy-MM-dd')
});
this.storeDocList.add(record);
var n = this.storeDocList.getCount();
this.cellEditingDoc.startEditByPosition({ row: n - 1, column: 2 });
},
onDelDocClick: function (button, event) {
var selectedRecords = this.gridDocList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
// alert(rec.ContractNo);
if (rec.BSNO != "" || rec.BSNO != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.DocDel.push(rec);
}
//alert(i);
this.storeDocList.remove(selectedRecords[i]);
}
},
DocAfterEdit: function (editor, e, eOpts) {
e.record.set('MODIFIEDUSER', USERID);
e.record.set('MODIFIEDUSERRef', SHOWNAME);
e.record.set('MODIFIEDTIME', currdate.format('yyyy-MM-dd'));
//this.URLHEAD = "ftp://bjes:@120.27.53.37/";
var _head = this.URLHEAD + this.DocType + "/";
if (this.DocType == '单据') {
_head = _head + this.CUSTNO + "/";
}
e.record.set('Driect_URL', _head + e.record.get('URL'))
}
, SaveDoc: function () {
if (USERID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var Docdatas = [];
for (var i = 0; i < this.storeDocList.getCount(); i += 1) {
var member = this.storeDocList.getAt(i);
Docdatas.push(member);
}
var DocBody = ConvertRecordsToJson(Docdatas);
var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel);
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ReceiptDoc/SaveDoc',
scope: this,
params: {
BSNO: this.BSNO,
DocBody: DocBody,
DocBodyDel: DocBodyDel
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeWMSRATE.commitChanges();
/*
var GID = _this.editRecord.get('GID');
_this.storeWMSRATE.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " BSNO='" + GID + "'" },
waitMsg: "正在查询数据...",
scope: this
});*/
this.storeDocList.commitChanges();
} 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');
}
});
}
//#endregion-------------明细表<<<库存记录>>>的相关方法 over
, onAddFileClick: function (button, event) {
var billno = this.BSNO;
var record = Ext.create('ReceiptDocmb', {
GID: NewGuid(),
RECEIPTTYPE: '',
R_GID: '',
BSNO: '', //ContractNo
URL: '',
Driect_URL: '',
MODIFIEDUSER: SHOWNAME,
MODIFIEDTIME: currdate.format('yyyy-MM-dd hh:mm:ss')
});
this.storeDocList.add(record);
var n = this.storeDocList.getCount();
this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 });
}
, onPostFileClick: function (button, event) {
if (USERID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var billno = this.BSNO;
var bodyDatas = [];
var i;
for (i = 0; i < this.storeDocList.getCount(); i += 1) {
var memberyf = this.storeDocList.getAt(i);
bodyDatas.push(memberyf);
var FILENAME = memberyf.data.FILENAME;
if (FILENAME == '') {
Ext.Msg.show({ title: '警告',
msg: '文件名称不能为空',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var DocBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
//var Docdatas = [];
//var DocBody = ConvertRecordsToJson(Docdatas);
//var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel);
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ReceiptDoc/SaveDoc',
scope: this,
params: {
BSNO: billno,
DocBody: DocBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var condition = _this.BSNO;
var condition2 = " BSNO='" + condition + "' ";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = 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
});
}
//alert('03');
}
});
} //end save
, onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.DocCM.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportTrade/DeleteUploadFile',
params: {
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeDocList.remove(selectedRecords[i]);
}
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
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.BSNO;
var selections = this.gridDocList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要上传的单据类型!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var BSNO = record.data.BSNO;
var HTH = this.CUSTNO;
var RECEIPTTYPE = record.data.RECEIPTTYPE;
if (BSNO == '') {
Ext.Msg.show({ title: '提示', msg: '请先保存,再上传!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GID = record.data.GID;
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadImage',
name: 'LoadImage',
emptyText: '请选择图片',
fieldLabel: '图片',
buttonText: '选择文件',
allowBlank: false,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}, {
xtype: 'textfield',
id: 'fileName_EX',
name: 'fileName_EX',
emptyText: '请填写文件后缀(如_g等)',
fieldLabel: '文件后缀名',
allowBlank: true
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadImage').getValue();
if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/Import/ImportTrade/UploadFile',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
fileGid: GID
, HTH: HTH
, RECEIPTTYPE: RECEIPTTYPE
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = me.BSNO;
var condition2 = " BSNO='" + condition + "' ";
me.Loading = true;
me.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
me.Loading = false;
}
});
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传图片",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
});