|
|
Ext.namespace('DsTruck');
|
|
|
var C_cargoinfo_id = "";
|
|
|
var HTHCount = 0;
|
|
|
DsTruck.CargoNameEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.DsTruck.CargoNameEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
function getSaved() {
|
|
|
return DsTruck.GetDirty(panelEdit.storeFactoryNo, panelEdit.storeCargoName);
|
|
|
}
|
|
|
Ext.extend(DsTruck.CargoNameEdit, Ext.Panel, {
|
|
|
parentWin: window.parent.opener,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
|
|
|
BXSTATUS: 1,
|
|
|
_First: true,
|
|
|
VISIBLERANGE: 0,
|
|
|
OPERATERANGE: 0,
|
|
|
WorkFlowName: "",
|
|
|
WorkFlowID: "",
|
|
|
PageSize: 500,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.feeSerialNo = 0;
|
|
|
this.FactoryNoDel = [];
|
|
|
this.CargoNameDel = [];
|
|
|
this.PicUploadType = "FactoryCargoname_TAGPIC";
|
|
|
this.currBody = null;
|
|
|
this.inedit = false;
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'ConutryRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
|
|
|
});
|
|
|
this.storeCountry.load({ params: { condition: ""} });
|
|
|
this.comboxCountry = Ext.create('DsExt.ux.DCombox', {
|
|
|
fieldLabel: '国家',
|
|
|
store: this.storeCountry,
|
|
|
name: 'COUNTRYID', id: "COUNTRYID",
|
|
|
valueField: 'countryid',
|
|
|
displayField: 'country_idandname',
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
autoScroll: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
items: [ {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'GID',
|
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: '厂号',
|
|
|
allowBlank: false,
|
|
|
name: 'FACTORYNO',
|
|
|
flex: 1
|
|
|
}, this.comboxCountry
|
|
|
, {
|
|
|
fieldLabel: '备注',
|
|
|
name: 'REMARK',
|
|
|
flex: 2
|
|
|
}//, {xtype:'hiddenfield',flex:2}
|
|
|
]
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}); //end this.formEdit
|
|
|
//商品名称
|
|
|
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargoRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
|
|
|
});
|
|
|
this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
this.comboxCargoinfo = Ext.create('DsExt.ux.DCombox', {
|
|
|
store: this.storeCargoinfo,
|
|
|
forceSelection: true,
|
|
|
name: 'HS_ID',
|
|
|
matchFieldWidth: false,
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname'
|
|
|
//HS代码
|
|
|
});
|
|
|
|
|
|
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargociqRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
|
|
|
});
|
|
|
this.storeCargociq.load({ params: { condition: ""} });
|
|
|
this.comboxCargociq = Ext.create('DsExt.ux.DCombox', {
|
|
|
store: this.storeCargociq,
|
|
|
forceSelection: true,
|
|
|
name: 'CIQ_ID',
|
|
|
matchFieldWidth: false,
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname',
|
|
|
async: false
|
|
|
//ciq代码
|
|
|
});
|
|
|
|
|
|
//this.comboxCARGOTYPE = getEnumcombox({ NAME: 'CARGOTYPE', enumTypeId: 30 });
|
|
|
|
|
|
this.storeCargoType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeCargoType.load({ params: { enumTypeId: 30 } });
|
|
|
this.comboxCargoType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeCargoType,
|
|
|
forceSelection: true,
|
|
|
name: 'CARGOTYPE',
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 附件上传
|
|
|
this.storeChfeeFile = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeFileModel',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_payapplication/GetFileList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: this.parentWin.OprationSwap()[0] === "edit" ? this.parentWin.OprationSwap()[2].get('GID') : ""
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
this.FeeFileColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID', readOnly: true,
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'File_OriginalName', readOnly: true,
|
|
|
header: Zi.LAN.FileName, //文件名称
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'UpdateTime', readOnly: true,
|
|
|
header: Zi.LAN.FileDate, //上传日期
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'Operator', readOnly: true,
|
|
|
header: Zi.LAN.FilePerson, //上传者
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Name', readOnly: true,
|
|
|
header: Zi.LAN.FileWName, //文件物理名称
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Path',
|
|
|
header: 'File_Path',
|
|
|
width: 80
|
|
|
}, {
|
|
|
xtype: 'actioncolumn',
|
|
|
width: 50,
|
|
|
text: Zi.LAN.Operating, //操作
|
|
|
items: [{
|
|
|
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
|
|
|
tooltip: '预览',
|
|
|
handler: function (grid, rowIndex, colIndex) {
|
|
|
var rec = grid.getStore().getAt(rowIndex);
|
|
|
var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name') + '?a=' + Math.random();
|
|
|
var imgView = new Shipping.FileView({ filePath: filePath });
|
|
|
imgView.show();
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
];
|
|
|
var selCertModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.fileGrid = new Ext.grid.GridPanel({
|
|
|
store: this.storeChfeeFile,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: selCertModel,
|
|
|
singleSelect: true,
|
|
|
selType: 'rowmodel',
|
|
|
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.filetp, //上传图片
|
|
|
tooltip: Zi.LAN.filetp,
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
var gid = this.parentWin.OprationSwap()[0] === "edit" ? this.parentWin.OprationSwap()[2].get('GID'):"";
|
|
|
this.onAddFileClick(gid);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: Zi.LAN.delete1, //删除
|
|
|
tooltip: Zi.LAN.delete1, //删除图片
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelFileClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.FeeFileColumns
|
|
|
});
|
|
|
this.file = new Ext.Panel({//附件上传
|
|
|
id: "page_file",
|
|
|
title: "公章上传",
|
|
|
autoScroll: true,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
//closable:true,
|
|
|
items: [this.fileGrid]
|
|
|
});
|
|
|
//#endregion 附件上传
|
|
|
|
|
|
//数据集
|
|
|
this.storeCargoName = Ext.create('Ext.data.Store', {
|
|
|
model: 'CargoNamemb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/FactoryCargoName/GetCargoNameList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
_this = this;
|
|
|
this.cellEditing_S = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.CheckBoxModel_S = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.formCargoName = new Ext.grid.GridPanel({
|
|
|
layout: 'border',
|
|
|
store: this.storeCargoName,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
//split:true,
|
|
|
//height: 160,
|
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditing_S],
|
|
|
selModel: this.CheckBoxModel_S,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细', id: "add2",
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCargoNameClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细', id: "del2",
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelCargoNameClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ENNAME',
|
|
|
header: '英文名称',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}, renderer: function (value) {
|
|
|
return '<span data-qtip="' + value + '">' + value + '</span>';
|
|
|
},
|
|
|
width: 220
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CNNAME',
|
|
|
header: '中文名称',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}, renderer: function (value) {
|
|
|
return '<span data-qtip="' + value + '">' + value + '</span>';
|
|
|
},
|
|
|
width: 130
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'HS_ID',
|
|
|
header: 'HS代码',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return '<span data-qtip="' + record.data.HSREF + '">' + record.data.HSREF+'</span>';
|
|
|
},
|
|
|
editor: this.comboxCargoinfo,
|
|
|
width: 220
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'CIQ_ID',
|
|
|
header: 'CIQ代码',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.CIQREF;
|
|
|
},
|
|
|
editor: this.comboxCargociq,
|
|
|
width: 160
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDUSER',
|
|
|
header: 'MODIFIEDUSER',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDTIME',
|
|
|
header: 'MODIFIEDTIME',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'HSREF',
|
|
|
header: 'HSREF',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CIQREF',
|
|
|
header: 'CIQREF',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SBYS',
|
|
|
header: '申报要素',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}, renderer: function (value) {
|
|
|
return '<span data-qtip="' + value + '">' + value + '</span>';
|
|
|
},
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARGOTYPE',
|
|
|
header: '商品类型',
|
|
|
editor: this.comboxCargoType,
|
|
|
width: 60
|
|
|
}, {
|
|
|
dataIndex: 'TAGPICURL',
|
|
|
header: '标签图片',
|
|
|
width: 60,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == '' || typeof (value) == "undefined") {
|
|
|
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
|
|
|
return '';
|
|
|
} else
|
|
|
return '<a href="' + value + '" style=' + '"text-decoration:none" target="_blank"' + ' > 下载 </a>';
|
|
|
}
|
|
|
}, {
|
|
|
xtype: 'actioncolumn',
|
|
|
width: 50,
|
|
|
text: "图片预览",
|
|
|
items: [{
|
|
|
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
|
|
|
tooltip: '图片预览',
|
|
|
handler: function (grid, rowIndex, colIndex) {
|
|
|
var rec = grid.getStore().getAt(rowIndex);
|
|
|
var filePath = rec.get('TAGPICURL');
|
|
|
if (filePath == "" || filePath == null) return;
|
|
|
if (/.(gif|jpg|jpeg|png|ico)$/.test(filePath)) {
|
|
|
ImgWindow(filePath);
|
|
|
|
|
|
} else if (/.(pdf|txt)$/.test(filePath)) {
|
|
|
ImgWindow(filePath, "_blank");
|
|
|
|
|
|
} else {
|
|
|
var a = document.createElement("a");
|
|
|
// 利用URL.createObjectURL()方法为a元素生成blob URL
|
|
|
a.href = filePath;
|
|
|
a.target = "_blank";
|
|
|
// 设置文件名,目前只有Chrome和FireFox支持此属性
|
|
|
try {
|
|
|
a.download = filePath;
|
|
|
} catch (e) {
|
|
|
alert("浏览器不兼容!");
|
|
|
} finally {
|
|
|
a.click();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
text: '上传标签',
|
|
|
xtype: 'gridcolumn',
|
|
|
width: 60,
|
|
|
align: 'center',
|
|
|
renderer: function (value, metaData, record) {
|
|
|
var id = record.data.GID;
|
|
|
btn=Ext.getCmp(id);
|
|
|
var parentid = record.data.FACTORYNOGID;
|
|
|
if (_this.inedit==false) {
|
|
|
Ext.defer(function () {
|
|
|
id = record.data.GID;
|
|
|
metaData.tdAttr = 'data-qtip="上传该厂号-品名的标签文件"';
|
|
|
Ext.widget('button', {
|
|
|
renderTo: id,
|
|
|
id: id,
|
|
|
height: 17,
|
|
|
width: 50,
|
|
|
// style:"margin-left:5px;background:blue;",
|
|
|
text: '上传',
|
|
|
handler: function () {
|
|
|
//相应事件方法
|
|
|
|
|
|
|
|
|
if (parentid == "") {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存新增的记录,然后才可以上传相应图片!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
URLINFO = { KeyValue: id };
|
|
|
UrlType = _this.PicUploadType;
|
|
|
|
|
|
//_this.onUpLoadFileClick(URLINFO, UrlType);
|
|
|
_this.currBody = record;
|
|
|
|
|
|
UpLoadFile(URLINFO, UrlType, _this.rewrite, _this);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}, 50);
|
|
|
return Ext.String.format('<div id="{0}"></div>', id);
|
|
|
} else {
|
|
|
return Ext.String.format('<div id="{0}"></div>', id);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
//支付情况(贷方明细)
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "复制新建",
|
|
|
handler: function (button, event) {
|
|
|
this.formEdit.getForm().findField('FACTORYNO').setValue('');
|
|
|
this.formEdit.getForm().findField('REMRK').setValue('复制新建');
|
|
|
this.OpStatus = 'copynew';
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
|
|
|
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
//布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 80,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
this.panelCargoName = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
title: '商品名称',
|
|
|
split: true,
|
|
|
height: 300,
|
|
|
margin: '1 1',
|
|
|
items: [this.formCargoName]
|
|
|
});
|
|
|
//Tab
|
|
|
this.panelCargoandApp = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
split: true,
|
|
|
height: 500,
|
|
|
margin: '1 1',
|
|
|
items: [this.panelCargoName, this.file]
|
|
|
});
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.panelCargoandApp]
|
|
|
});
|
|
|
this.InitData();
|
|
|
//集中绑定事件
|
|
|
this.formCargoName.on('edit', function (editor, e, eOpts) {
|
|
|
this.CargoNameAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
this.cellEditing_S.on('beforeedit', function (editor, e) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
return this.CargoNameBeforeEdit(editor, e);
|
|
|
}, this);
|
|
|
}, //end initUIComponents
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
onAddCargoNameClick: function (button, event, type) {
|
|
|
|
|
|
var store = null;
|
|
|
|
|
|
store = this.storeCargoName;
|
|
|
|
|
|
var record = null;
|
|
|
|
|
|
record = Ext.create('CargoNamemb', {
|
|
|
GID: NewGuid(),
|
|
|
FACTORYNOGID: "",
|
|
|
ENNAME: "",
|
|
|
CNNAME: "",
|
|
|
HS_ID: "",
|
|
|
CIQ_ID: "",
|
|
|
MODIFIEDUSER: "",
|
|
|
MODIFIEDTIME: "",
|
|
|
SBYS: "部位: 瘦肉率: % 带肉率: %"
|
|
|
});
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
cellediting = this.cellEditing_S;
|
|
|
|
|
|
var n = store.getCount();
|
|
|
cellediting.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
},
|
|
|
onDelCargoNameClick: function (button, event) {
|
|
|
var selectedRecords = this.formCargoName.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.FACTORYNOGID != "" || rec.FACTORYNOGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.CargoNameDel.push(rec);
|
|
|
}
|
|
|
this.storeCargoName.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
CargoNameAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
|
|
|
|
|
|
if (COMPANYID == "" || USERID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
returen;
|
|
|
}
|
|
|
if (e.field == 'HS_ID') {
|
|
|
|
|
|
//SetComboxValue(this.comboxCargoinfo, e,'codeandname');
|
|
|
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCargoinfo, 'id', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
e.record.set('HSREF', Cargoinfodata.codeandname);
|
|
|
if (e.value != e.originalValue) {
|
|
|
e.record.set('CIQ_ID', '');
|
|
|
e.record.set('CIQREF', '');
|
|
|
}
|
|
|
} else {
|
|
|
e.record.set('HSREF', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'CIQ_ID') {
|
|
|
|
|
|
//SetComboxValue(this.comboxCargoinfo, e, 'codeandname');
|
|
|
|
|
|
var Cargociqrecords = DsStoreQueryBy(this.storeCargociq, 'id', e.value);
|
|
|
if (Cargociqrecords.getCount() > 0) {
|
|
|
var Cargociqdata = Cargociqrecords.getAt(0).data;
|
|
|
e.record.set('CIQREF', Cargociqdata.codeandname);
|
|
|
} else {
|
|
|
e.record.set('CIQREF', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.inedit = false;
|
|
|
},
|
|
|
CargoNameBeforeEdit: function (editor, e) {
|
|
|
this.inedit = true;
|
|
|
var canedit = false;
|
|
|
var HS_ID = e.record.get('HS_ID');
|
|
|
if (e.field != "CIQ_ID") { canedit = true; }
|
|
|
else
|
|
|
if (HS_ID == "") {
|
|
|
alert("请先选择HS代码");
|
|
|
} else {
|
|
|
canedit = true;
|
|
|
var cargoinfoid = e.record.get('HS_ID');
|
|
|
var s = " cargoinfoid=" + cargoinfoid;
|
|
|
this.storeCargociq.load({ params: { condition: s} });
|
|
|
}
|
|
|
return canedit;
|
|
|
},
|
|
|
InitData: function () {
|
|
|
|
|
|
this.OpStatus = 'edit';
|
|
|
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' || this.OpStatus == 'copynew') {
|
|
|
|
|
|
condition = " GID='" + this.editRecord.get('GID') + "'";
|
|
|
this.LoadData(this.OpStatus, condition);
|
|
|
}
|
|
|
|
|
|
}, //end InitData
|
|
|
//载入数据
|
|
|
LoadData: function (opStatus, condition) {
|
|
|
if (COMPANYID == "" || USERID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.OpStatus = opStatus;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Import/FactoryCargoName/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);
|
|
|
if (this.OpStatus == 'copynew') {
|
|
|
this.formEdit.getForm().findField('FACTORYNO').setValue('');
|
|
|
this.formEdit.getForm().findField('REMARK').setValue('复制新建');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
|
|
|
this.LoadBody();
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
LoadBody: function () {
|
|
|
if (COMPANYID == "" || USERID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this.OpStatus == 'edit' || this.OpStatus == 'copynew') {
|
|
|
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(false);
|
|
|
|
|
|
var GID = this.editRecord.get('GID');
|
|
|
|
|
|
condition = "FACTORYNOGID='" + GID + "'";
|
|
|
|
|
|
this.storeCargoName.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: condition },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}, // end LoadDate
|
|
|
Save: function (type) {
|
|
|
|
|
|
if (COMPANYID == "" || USERID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
|
|
|
var _this = this;
|
|
|
this.storeFactoryNo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.GeneralValue', proxy: { url: '/CommMng/BasicDataRef/GeneralSelect' }
|
|
|
});
|
|
|
this.storeFactoryNo.load({
|
|
|
async: false,
|
|
|
params: { condition: "select Count(*) GVALUE,'' as GID from Import_Factoryno where FACTORYNO='" + data.FACTORYNO + "' and COUNTRYID='" + data.COUNTRYID+"' and GID<>'" + data.GID + "' " }
|
|
|
, callback: function (options, response, success) {
|
|
|
if (success) {
|
|
|
var Searchdata = options[0].data;
|
|
|
|
|
|
if (parseFloat(Searchdata.GVALUE) > 0) {
|
|
|
alert("不能使用重复的厂号和国家");
|
|
|
return false;
|
|
|
} else {
|
|
|
var CargoNameDatas = [];
|
|
|
for (var i = 0; i < _this.storeCargoName.getCount(); i += 1) {
|
|
|
var member = _this.storeCargoName.getAt(i);
|
|
|
if (_this.OpStatus == 'copynew') {
|
|
|
member.set("GID", NewGuid());
|
|
|
member.set("FACTORYNOGID", null);
|
|
|
|
|
|
}
|
|
|
CargoNameDatas.push(member);
|
|
|
}
|
|
|
|
|
|
|
|
|
if (_this.OpStatus == 'copynew')
|
|
|
_this.OpStatus = 'add';
|
|
|
|
|
|
var CargoNameBody = ConvertRecordsToJson(CargoNameDatas);
|
|
|
var CargoNameDelBody = ConvertRecordsToJsonAll(_this.CargoNameDel);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Import/FactoryCargoName/Save',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
opstatus: _this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoNameBody: CargoNameBody,
|
|
|
CargoNameDelbody: CargoNameDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//Ext.Msg.show({ title: '保存成功', msg: jsonresult.Message, icon: Ext.Msg.OK, buttons: Ext.Msg.OK });
|
|
|
var returnData = jsonresult.Data;
|
|
|
_this.formEdit.getForm().setValues(returnData);
|
|
|
//this.storeFactoryNo.commitChanges();
|
|
|
//_this.storeCargoName.commitChanges();
|
|
|
_this.LoadBody();
|
|
|
|
|
|
if (type == '0') {
|
|
|
_this.OpStatus = 'edit'
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
window.close();
|
|
|
}
|
|
|
} 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');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//////////////////////
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
//end save
|
|
|
onExportClick: function (button, event) {
|
|
|
|
|
|
GridExportExcelPage(this.formFeeBody);
|
|
|
|
|
|
},
|
|
|
onAddFileClick: function (gid) {
|
|
|
var winAccess = new Shipping.FileUpload({});
|
|
|
winAccess.BillNo = gid;
|
|
|
winAccess.Obj = this;
|
|
|
winAccess.CallBackFun = function (obj) {
|
|
|
obj.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: gid
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
winAccess.show();
|
|
|
},
|
|
|
onDelFileClick: function () {
|
|
|
var selections = this.fileGrid.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0) {//提示', msg: '请先选择要删除的数据!
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.selectdelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
var record = new Array();
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
record.push(selections[i].data);
|
|
|
} //提示', '确定删除该记录吗?'
|
|
|
Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait(Zi.LAN.nowdelete); //正在删除数据
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: Zi.LAN.nowdelete,
|
|
|
url: '/Account/Chfee_payapplication/CertDel',
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(record)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: this.parentWin.OprationSwap()[0] === "edit" ? this.parentWin.OprationSwap()[2].get('GID'):""
|
|
|
}
|
|
|
});
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
} //提示
|
|
|
else {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试'
|
|
|
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) {
|
|
|
},
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
|
|
|
, rewrite: function (newurl, _this) {
|
|
|
if (typeof (newurl) == "undefined" || newurl == "") { return; }
|
|
|
_this.storeCargoName.each(function (record) {
|
|
|
if (record.get('GID') == _this.currBody.data.GID) {
|
|
|
var result = Ext.JSON.decode(newurl.response.responseText);
|
|
|
record.set('TAGPICURL', result.data);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|