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.
559 lines
17 KiB
JavaScript
559 lines
17 KiB
JavaScript
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
Ext.namespace('DsTruck');
|
|
|
|
var C_cargoinfo_id = "";
|
|
var HTHCount = 0;
|
|
|
|
DsTruck.MsWl_LK_LineEdit = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.DsTruck.MsWl_LK_LineEdit.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.MsWl_LK_LineEdit, Ext.Panel, {
|
|
parentWin: null,
|
|
OpStatus: 'add',
|
|
StoreList: null,
|
|
editRecord: null,
|
|
// parentfunction: null,
|
|
_First: true,
|
|
initUIComponents: function () {
|
|
|
|
this.StepDel = [];
|
|
|
|
|
|
//数据集
|
|
Ext.define('DeductibleMd', {
|
|
extend: 'Ext.data.Model',
|
|
fields: [
|
|
{ name: 'ISLAST', type: 'string' },
|
|
{ name: 'ISLAST_REF', type: 'string' }
|
|
]
|
|
});
|
|
var IsOpenData = [{ "ISLAST": "False", "ISLAST_REF": "否" },
|
|
{ "ISLAST": "True", "ISLAST_REF": "是"}];
|
|
this.storeIsOpenType = Ext.create('Ext.data.Store', {
|
|
model: 'DeductibleMd',
|
|
data: IsOpenData
|
|
});
|
|
this.comboxIsLast = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
//fieldLabel: '是否最终审核',
|
|
forceSelection: true,
|
|
store: this.storeIsOpenType,
|
|
name: 'ISLAST',
|
|
valueField: 'ISLAST',
|
|
displayField: 'ISLAST_REF'
|
|
});
|
|
|
|
|
|
//#region 目前不属于该路线的节点
|
|
|
|
this.storePoint = Ext.create('Ext.data.Store', {
|
|
model: 'MsWl_LK_Pointmb',
|
|
remoteSort: false,
|
|
pruneModifiedRecords: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/TruckMng/MsWl_LK_Line/GetPointList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.PointCB = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
this.GridPoint = new Ext.grid.GridPanel({
|
|
store: this.storePoint,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
trackResetOnLoad: true,
|
|
//title: '步骤信息',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
//plugins: [this.cellEditingUserState],
|
|
selModel: this.PointCB,
|
|
selType: 'cellmodel',
|
|
tbar: [{
|
|
text: '加入此路线',
|
|
tooltip: '将选中节点加入此路线范围内',
|
|
iconCls: "btnchangepwd",
|
|
handler: function (button, event) {
|
|
this.onAddPointClick(button, event);
|
|
},
|
|
scope: this
|
|
}],
|
|
columns: [
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'GID', hidden: true,
|
|
header: 'GID',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'NAME',
|
|
header: '站点名称',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'POINTTYPE',
|
|
header: '站点种类(干线、分拨)',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'DESCRIPTION',
|
|
header: '站点全称',
|
|
width: 120
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'ADDRESS',
|
|
header: '站点地址',
|
|
width: 160
|
|
}
|
|
]
|
|
});
|
|
//#endregion
|
|
|
|
//#region 处于该线路内的节点表格
|
|
|
|
this.storeLineDetail = Ext.create('Ext.data.Store', {
|
|
model: 'MsWl_LK_LineDetailmb',
|
|
remoteSort: false,
|
|
pruneModifiedRecords: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/TruckMng/MsWl_LK_Line/GetLineDetailList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.DetailCB = Ext.create('Ext.selection.CheckboxModel');
|
|
this.cellEditingDetail = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
|
|
this.GridLineDetail = new Ext.grid.GridPanel({
|
|
store: this.storeLineDetail,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
trackResetOnLoad: true,
|
|
//title: '步骤信息',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.cellEditingDetail],
|
|
selModel: this.DetailCB,
|
|
selType: 'cellmodel',
|
|
tbar: [{
|
|
text: '排除出路线范围',
|
|
tooltip: '从当前路线中将选中节点排除掉',
|
|
iconCls: "btnchangepwd",
|
|
handler: function (button, event) {
|
|
this.onDelLineDetailClick(button, event);
|
|
},
|
|
scope: this
|
|
}],
|
|
columns: [
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'GID', hidden: true,
|
|
header: 'GID',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'SEQUENCE',
|
|
header: '顺序号',
|
|
width: 45,
|
|
editor: {
|
|
xtype: 'numberfield',
|
|
allowBlank: false,
|
|
selectOnFocus: true
|
|
}
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'NAME',
|
|
header: '站点名称',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'POINTTYPE',
|
|
header: '站点种类(干线、分拨)',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'DESCRIPTION',
|
|
header: '站点全称',
|
|
width: 120
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'ADDRESS',
|
|
header: '站点地址',
|
|
width: 160
|
|
}
|
|
]
|
|
});
|
|
//#endregion
|
|
|
|
//公共按钮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) {
|
|
window.close();
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
// id: "saveandclose",
|
|
//text: "打印",
|
|
//handler: function (button, event) {
|
|
// this.Print();
|
|
//},
|
|
//scope: this
|
|
}
|
|
]
|
|
}); //end 按钮Toolbar
|
|
|
|
//#region 布局
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 30,
|
|
items: [this.panelBtn, this.formEdit]
|
|
});
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.MainTab]
|
|
});
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.panelFee, this.panelPayBody]
|
|
});
|
|
|
|
this.PanelUP1 = new Ext.Panel({
|
|
title: "全部同类节点(待选择)",
|
|
layout: "border",
|
|
region: 'west',
|
|
margin: '0 0',
|
|
width: 330,
|
|
split: true,
|
|
items: [this.GridPoint]
|
|
});
|
|
this.PanelUP2 = new Ext.Panel({
|
|
title: "路线内节点(当前)",
|
|
layout: "border",
|
|
region: 'center',
|
|
margin: '0 0',
|
|
width: 330,
|
|
split: true,
|
|
items: [this.GridLineDetail]
|
|
});
|
|
|
|
this.page_1 = new Ext.Panel({
|
|
//title: "管理范围(提交至此流程的人员列表)",
|
|
layout: "border",
|
|
region: "center",
|
|
height: 500,
|
|
items: [this.PanelUP1, this.PanelUP2]
|
|
});
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
items: [
|
|
this.page_1
|
|
//, this.page_2
|
|
//, this.page_3
|
|
//, this.page_4
|
|
]
|
|
})
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.page_1]
|
|
});
|
|
//#endregion
|
|
parentWin = window.parent.opener;
|
|
this.InitData();
|
|
|
|
//集中绑定编辑后事件
|
|
/*
|
|
this.cellEditingStep.on('beforeedit', function (editor, e) {
|
|
return this.StepBeforeEdit(editor, e);
|
|
}, this);
|
|
|
|
this.cellEditingStep.on('edit', function (editor, e, eOpts) {
|
|
this.StepAfterEdit(editor, e, eOpts);
|
|
}, this);*/
|
|
}, //end initUIComponents
|
|
|
|
//#region 增加workflow_step
|
|
|
|
onAddPointClick: function (button, event) {
|
|
var selectedRecords = this.GridPoint.selModel.getSelection();
|
|
|
|
var PointList = "";
|
|
|
|
var LINEGID = this.editRecord.get('GID');
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
var rec = selectedRecords[i].data;
|
|
|
|
if (PointList == "") {
|
|
PointList = "'" + rec.GID + "'";
|
|
} else {
|
|
PointList = PointList + ",'" + rec.GID + "'";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({//
|
|
waitMsg: '正在查询待审核的业务...',
|
|
url: '/TruckMng/MsWl_LK_Line/AddLineDetail',
|
|
async: false,
|
|
params: {
|
|
LINE_GID: LINEGID,
|
|
POINTGIDList: PointList
|
|
},
|
|
callback: function (options, success, response) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
alert("添加成功");
|
|
this.InitData();
|
|
} else {
|
|
alert("添加失败" + jsonresult.Message);
|
|
}
|
|
},
|
|
scope: this
|
|
}); //request over
|
|
|
|
|
|
//aftereditform();
|
|
},
|
|
onDelLineDetailClick: function (button, event) {
|
|
var selectedRecords = this.GridLineDetail.selModel.getSelection();
|
|
|
|
var LineDetailList = "";
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
var rec = selectedRecords[i].data;
|
|
|
|
if (LineDetailList == "") {
|
|
LineDetailList = "'" + rec.GID + "'";
|
|
} else {
|
|
LineDetailList = LineDetailList + ",'" + rec.GID + "'";
|
|
}
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({//
|
|
waitMsg: '正在查询待审核的业务...',
|
|
url: '/TruckMng/MsWl_LK_Line/DelLineDetail',
|
|
async: false,
|
|
params: { LineDetailList: LineDetailList
|
|
},
|
|
callback: function (options, success, response) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
alert("删除成功");
|
|
|
|
this.InitData();
|
|
} else {
|
|
alert("删除失败" + jsonresult.Message);
|
|
}
|
|
},
|
|
scope: this
|
|
}); //request over
|
|
|
|
|
|
//aftereditform();
|
|
},
|
|
|
|
/////////////明细表<<<>>>的相关方法
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
// alert(this.First);
|
|
ret1[3]();
|
|
},
|
|
|
|
InitData: function () {
|
|
|
|
this.opStatus = 'add';
|
|
var condition = '';
|
|
|
|
|
|
if (parentWin) {
|
|
var ret = parentWin.OprationSwap();
|
|
this.opStatus = ret[0];
|
|
this.StoreList = ret[1];
|
|
this.editRecord = ret[2];
|
|
// this.parentfunction = ret[3];
|
|
}
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
condition = " gid not in (select point_gid from tmswl_lk_linedetail where LINE_GID='" + this.editRecord.get('GID') + "') and pointtype= '"
|
|
+ this.editRecord.get('LINETYPE') + "' and AREA=(select AREA from tmswl_LK_Line where GID='" + this.editRecord.get('GID') + "')";
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
}, //end InitData
|
|
|
|
//载入数据
|
|
LoadData: function (opstatus, condition) {
|
|
|
|
this.opStatus = opstatus;
|
|
|
|
this.storePoint.load({ params: {start:0,limit:9999, condition: condition} });
|
|
this.storeLineDetail.load({ params: { LINE_GID: this.editRecord.get('GID')} });
|
|
//this.storeUserPath.load({ params: { WorkFlowID: this.editRecord.get('GID')} });
|
|
|
|
}, // end LoadDate
|
|
checkedit: function () {
|
|
|
|
},
|
|
Save: function (type) {
|
|
|
|
var Stepdatas = [];
|
|
for (var i = 0; i < this.storeLineDetail.getCount(); i += 1) {
|
|
var member = this.storeLineDetail.getAt(i);
|
|
Stepdatas.push(member);
|
|
}
|
|
|
|
//商品明细
|
|
var LineDetailBody = ConvertRecordsToJson(Stepdatas);
|
|
var LineDetailDelBody = "";
|
|
|
|
var _this = this;
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在保存数据...',
|
|
url: '/TruckMng/MsWl_LK_Line/SaveLineDetail',
|
|
scope: this,
|
|
params: {
|
|
Body: LineDetailBody,
|
|
DelBody: LineDetailDelBody
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
Ext.MessageBox.hide();
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeLineDetail.commitChanges();
|
|
|
|
|
|
if (type == '0') {
|
|
this.opStatus = 'edit';
|
|
|
|
//this.storeStep.load({ params: { WorkFlowID: this.editRecord.get('GID')} });
|
|
|
|
} 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');
|
|
}
|
|
});
|
|
}
|
|
, //end save
|
|
Print: function () {
|
|
var basicForm = this.formEdit.getForm();
|
|
var ContractNo = this.editRecord.get('ContractNo')
|
|
if (ContractNo == '*' || ContractNo == '') {
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
var printType = 'XXH_CW_YS';
|
|
//
|
|
var sql1 = "SET LANGUAGE 'us_english' SELECT price,weight,6.1667 as exchange FROM import_cargo WHERE contractno = '" + ContractNo + "' ";
|
|
var sql2 = ""; ;
|
|
var sql3 = "";
|
|
var sql4 = "";
|
|
var sql5 = "";
|
|
var sql6 = "";
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
}
|
|
});
|
|
|