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/MsCodeCtnTk/MsRptCodeCtnTkDateIndex.js

716 lines
23 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsRptCodeCtnTkDateIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCodeCtnTkDateIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCodeCtnTkDateIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
PageSize: 100,
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "MsRptCodeCtnTkDateIndex"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCodeCtnTk',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeCtnTk/GetDatadDateList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
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',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel:'每页记录数',//每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENTPORT',
header: '当前状态',
width: 160
}, {
sortable: true,
dataIndex: 'INSPECTENDDATE',
header: '年检结束日期',
width: 100,
renderer: function (value, meta) {
if (value != '') {
var ENDATE = new Date(value);
ENDATE.setFullYear(ENDATE.getFullYear() + 1);
ENDATE.setDate(ENDATE.getDate() - 1);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
mydatestr = getNewDay(mydatestr, 30);
mydatestr = new Date(mydatestr);
ENDATE = new Date(ENDATE);
if (mydatestr.getTime() > ENDATE.getTime()) {
meta.tdCls = 'feestatus_nopass';
}
}
return value;
}
}, {
sortable: true,
dataIndex: 'INSURANCENO',
header: '保险单号',
width: 100
}, {
sortable: true,
dataIndex: 'INBEGINDATE',
header: '保险开始日期',
width: 100
}, {
sortable: true,
dataIndex: 'INENDDATE',
header: '保险结束日期',
width: 100,
renderer: function (value, meta) {
if (value != '') {
var ENDATE = value;
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
mydatestr = getNewDay(mydatestr, 15);
mydatestr = new Date(mydatestr);
ENDATE = new Date(ENDATE);
if (mydatestr.getTime() > ENDATE.getTime()) {
meta.tdCls = 'feestatus_nopass';
}
}
return value;
}
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'NAMEPLATE',
header: '铭牌信息',
width: 200
}, {
sortable: true,
dataIndex: 'OWNERCTN',
header: '罐东',
width: 200
}, {
sortable: true,
dataIndex: 'MADEDATE',
header: '生产日期',
width: 100
}, {
sortable: true,
dataIndex: 'MADEFACTORY',
header: '生产厂家',
width: 100
}, {
sortable: true,
dataIndex: 'TANKWALLTHICK',
header: '罐壁厚度',
width: 100
}, {
sortable: true,
dataIndex: 'HEADTHICK',
header: '封头厚度',
width: 100
}, {
sortable: true,
dataIndex: 'TANKVOLUMN',
header: '容积',
width: 100
}, {
sortable: true,
dataIndex: 'TAREWEIGHT',
header: '皮重',
width: 100
}, {
sortable: true,
dataIndex: 'MAXWORKINGGPRESSURE',
header: '最大允许压力',
width: 100
}, {
sortable: true,
dataIndex: 'TESTINGGPRESSURE',
header: '试验压力',
width: 200
}, {
sortable: true,
dataIndex: 'DESIGNTEMPERATURE',
header: '设计温度',
width: 200
}, {
sortable: true,
dataIndex: 'TRAILPEDAL',
header: '步道踏板',
width: 100
}, {
sortable: true,
dataIndex: 'AIRVALVE',
header: '空气阀',
width: 100
}, {
sortable: true,
dataIndex: 'SAFETYVALVE',
header: '安全阀',
width: 100
}, {
sortable: true,
dataIndex: 'TOPVALVE',
header: '顶阀',
width: 100
}, {
sortable: true,
dataIndex: 'BOTTOMVALVE',
header: '底阀',
width: 100
}, {
sortable: true,
dataIndex: 'EXSITSIPHONPIPE',
header: '虹吸管',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}, {
sortable: true,
dataIndex: 'EXSITPRESSUREGAUGE',
header: '压力表',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}, {
sortable: true,
dataIndex: 'EXSITTOPOVERFLOWBOX',
header: '顶部溢流盒盖',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}, {
sortable: true,
dataIndex: 'EXSITINTOOVERFLOWBOX',
header: '人孔溢流盒盖',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}, {
sortable: true,
dataIndex: 'EXSITBOTTONVALVEDUSTCOVER',
header: '底部阀门防尘罩',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}, {
sortable: true,
dataIndex: 'STEAMPIPE',
header: '蒸汽管',
width: 100
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var openSet = "height=500, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 600) / 2
var openType = record.data.GID;
var openUrl = "/MvcContainer/MsCodeCtnTk/Edit";
window.open(openUrl, openType, openSet);
// DsOpenEditWin('/MvcContainer/MsCodeCtnTk/Edit', record.data.GID);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.gridList.columns[1] = new Ext.grid.RowNumberer();
//#region formSearch 查询面板
_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: 'CTNNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
// text: "重置条件",
xtype: 'button',
width: 90,
iconCls: "btnexportexcel",
text: '导出Excel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
// '-', {
// xtype: 'button',
// width: 90,
// text:'导出Excel', //导出Excel
//// iconCls: 'btnexportexcel',
// handler: function (button, event) {
// this.onExportClick(button, event);
// },
// scope: this
// }
]
//}, '-', {
// xtype: 'button',
// width: 90,
// text:'导出Excel', //导出Excel
// id: "btnExportExcel",
// iconCls: 'btnexportexcel',
// handler: function (button, event) {
// this.onExportClick(button, event);
// },
// scope: this
// }]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//查询工具条
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 45,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.sqlcontext = '';
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
this.onRefreshClick();
}, //end initUIComponents
InitGrid: function (grid) {
var agirdcolums = grid;
this.gridList.reconfigure(this.storeList, agirdcolums);
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsCodeCtnTk/Delete',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
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);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var CTNNO = form.findField('CTNNO').getValue();
sql = sql + getAndConSql(sql, CTNNO, " c.CTNNO like '%" + CTNNO + "%' ");
return sql;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsCodeCtnTk/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
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 printType = 'MSCODECTNTK';
var sql1 = returnstr;
var sql2 = "select * from code_ctntk where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var printType = 'MSCODECTNTKSELECT';
var sql1 = "select * from code_ctntk WHERE GID IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select * from code_ctntk where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});