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.
DS7/DSWeb/Areas/MvcContainer/Viewsjs/MsCodeMsds/MsCodeMsdsView.js

839 lines
26 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsCodeMSDSView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeMSDSView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCodeMSDSView, 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.storeDCLASS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeDCLASS.load({ params: { enumTypeId: 97027} });
this.comboxDCLASS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeDCLASS,
fieldLabel: '危险品等级',
name: 'DCLASS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.comboxSDCLASS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeDCLASS,
fieldLabel: '副危险品等级',
name: 'SDCLASS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.StorePACKINGGROUP = Ext.create('Ext.data.Store', {
fields: ['PACKINGGROUP']
});
this.StorePACKINGGROUP.add({ "PACKINGGROUP": "I" });
this.StorePACKINGGROUP.add({ "PACKINGGROUP": "II" });
this.StorePACKINGGROUP.add({ "PACKINGGROUP": "III" });
this.comboxPACKINGGROUP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'PACKING GROUP',
store: this.StorePACKINGGROUP,
labelWidth: 100, forceSelection: true,
name: 'PACKINGGROUP',
valueField: 'PACKINGGROUP',
displayField: 'PACKINGGROUP'
});
this.storeIMDG = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeIMDG.load({ params: { enumTypeId: 97026} });
this.comboxIMDG = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeIMDG,
fieldLabel: 'IMDG',
name: 'IMDG',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//表参照相关(编辑form)
//编辑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: 90,
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: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '品名',
allowBlank: true,
flex: 1,
name: 'GOODNAME'
}, {
fieldLabel: '贸易品名',
name: 'TRADEGOODSNAME'
}, {
fieldLabel: '化学品名',
name: 'CHEMICALGOODSNAME'
}, {
fieldLabel: '化学品名(中文)',
name: 'CHEMICALCGOODSNAME'
}, {
fieldLabel: 'CAS NO',
flex: 1,
name: 'CASNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'UN',
flex: 1,
name: 'UNNO'
},{
fieldLabel: '危险品等级',
flex: 1,
name: 'DCLASS'
} , {
fieldLabel: '副危险品等级',
flex: 1,
name: 'SDCLASS'
},{
fieldLabel: 'PACKING GROUP',
flex: 1,
labelWidth: 100,
name: 'PACKINGGROUP'
}, {
fieldLabel: '是否海洋污染物',
flex: 0.5,
inputValue: true,
xtype: 'checkboxfield',
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: '是否存在危险',
inputValue: true,
flex: 0.5,
xtype: 'checkboxfield',
name: 'ISDANGEROUS'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '熔点',
name: 'MELTINGPOINTB',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
text: '℃~'
// html: "℃~"
}, {
name: 'MELTINGPOINTE',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
flex: 0.28
}, {
xtype: 'label',
text: '℃~'
// html: "℃"
}, {
fieldLabel: '沸点',
name: 'BOILINGPOINTB',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
html: "℃~"
}, {
name: 'BOILINGPOINTE',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
flex: 0.28
}, {
xtype: 'label',
html: "℃"
}, {
fieldLabel: '闪点',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
name: 'FLASHPOINTB',
flex: 0.6
}, {
xtype: 'label',
html: "℃~"
}, {
name: 'FLASHPOINTE',
regex: /^(0|[1-9][0-9]*)$/,
regexText: '请输入正确的数值!',
flex: 0.28
}, {
xtype: 'label',
html: "℃"
}, {
fieldLabel: '密度',
name: 'DENSITY'
}, {
fieldLabel: 'PH',
name: 'PH'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'IMDG',
name: 'IMDG'
}, {
fieldLabel: '稳定性',
name: 'STABILITY',
flex: 2
}, {
fieldLabel: '反应性',
name: 'REACTIVE',
flex: 2
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARKS'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
this.goodsname = getUrlParam('goodsname');
this.storeListFactry = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDSFactry',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetFactryList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'MSDSID',
header: 'MSDSID',
width: 80
},
{
sortable: true,
dataIndex: 'FACTORYNAME',
header: '工厂名称',
width: 150
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 150
},
{
sortable: true,
dataIndex: 'FACTORYADDR',
header: '工厂地址',
width: 150
},
{
sortable: true,
dataIndex: 'CONSIGNEE',
header: '收货人',
width: 150
},
{
sortable: true,
dataIndex: 'CONSIGNEEADDR',
header: '收货人地址',
width: 150
}
];
//定义Grid
this.gridListFactry = new Ext.grid.GridPanel({
store: this.storeListFactry,
enableHdMenu: false,
region: 'west',
width: 300,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListFactry,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
_this = this;
this.gridListFactry.addListener('itemclick', function (dataview, record, item, index, e, b) {
_this.editFactryRecord = record;
_this.FactryStatus = 'edit';
_this.LoadFactryData("edit", "GID='" + record.data.GID + "'");
}, this);
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//编辑form
this.formDetail = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
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: 'MSDSID',
name: 'MSDSID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '工厂名称',
name: 'FACTORYNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, { xtype: 'hiddenfield', flex: 3}]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '工厂地址',
height: 50,
name: 'FACTORYADDR',
anchor: '100%'
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '收货人',
name: 'CONSIGNEE'
}]
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '收货人地址',
height: 50,
name: 'CONSIGNEEADDR',
anchor: '100%'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '备注',
height: 50,
name: 'REMARKS',
anchor: '100%'
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formDetail
this.panelfactry = new Ext.Panel({
title: '工厂详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListFactry, this.formDetail]
});
//#region 互斥
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDSRejection',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetRejectionList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGood = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDS',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGood.load({ params: { condition: ""} });
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGood,
forceSelection: true,
name: 'REJECTID',
valueField: 'GID',
displayField: 'GOODNAME'
});
//明细表表格
this.gridListGoods = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'MSDSID',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'REJECTID',
header: '品名',
width: 320,
editor: this.comboxGoods,
renderer: function (value, p, record) {
return record.data.GOODNAME;
}
}]
});
this.gridListGoods.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.panelRejection = new Ext.Panel({
title: '互斥商品信息',
layout: "border",
region: 'west',
width: 340,
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListGoods]
});
//#endregion
//#region 明细表-单据图片档案管理
_this = this;
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
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',
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
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,
renderer: function (value, p, record) {
return '<a href="' + record.data.Driect_URL + '" style=' + '"text-decoration:none"' + '>' + value + '</a>';
}
},
{
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: 135
}
]
});
this.panelDoc = new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "center",
title: '相关图片', //autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
this.panelDetail = new Ext.Panel({
layout: "border",
region: "center",
title: '图片及互斥',
frame: false,
split: true,
items: [this.panelRejection, this.panelDoc]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.formEdit]
});
this.tabWTpanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
enableTabScroll: true,
items:
[
this.panelfactry,
this.panelDetail
]
});
Ext.apply(this, {
items: [this.panelTop, this.tabWTpanel]
});
//#endregion
//绑定查询窗体
//初始化数据
this.InitData();
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'edit';
this.FactryStatus = 'edit';
var condition = " CHEMICALCGOODSNAME='" + this.goodsname + "' or GOODNAME='" + this.goodsname + "'";
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: '/MvcContainer/MsCodeMSDS/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 = " MSDSID='" +data.GID+ "'";
this.storeListFactry.load({ params: { condition: acondition },
callback: function (r, options, success) {
if (success) {
if (this.storeListFactry.getCount() > 0) {
var member = this.storeListFactry.getAt(0);
this.LoadFactryData("edit", "GID='" + member.data.GID + "'");
} else {
}
}
},
scope: this
});
this.storeBodyList.load({ params: { condition: acondition} });
var xcondition = " BSNO='" + data.GID + "'";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: xcondition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
LoadFactryData: function (opstatus, condition) {
this.serialNo = 0;
this.FactryStatus = opstatus;
if (this.FactryStatus == 'add') {
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsCodeMSDS/GetFactryData',
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;
}
data = result.data;
this.formDetail.getForm().reset();
this.formDetail.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});