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/MvcShipping/Viewsjs/MsOpTask/MsOpTaskIndex.js

779 lines
26 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpTaskIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpTaskIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpTaskIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
BsNo: "",
stroplb: "",
sqlcontext: '',
initUIComponents: function () {
//定义数据集
// var mainform = window.parent._this;
_this = this;
_this.sqlcontext = "";
_this.sqlcontextall = "";
_this.sqlcontextselect = " isnull(ISCOMPLETE,0)=1 ";
this.formname = "MsOpTaskIndex"; //页面名称
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'COMPOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
Ext.define('ModuleModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'DESCRIPTION', type: 'string' },
{ name: 'MODULEURL', type: 'string' },
{ name: 'SORT', type: 'number' },
{ name: 'PARENTID', type: 'string' },
{ name: 'PARENTNAME', type: 'string' },
{ name: 'TASKCOUNT', type: 'number' },
{ name: 'TYPE', type: 'string' },
{ name: 'leaf', type: 'bool' },
{ name: 'expanded', type: 'bool' }
]
});
this.treestore = new Ext.data.TreeStore({
model: 'ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpTask/GetTaskTreeRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
id: '-1'
}
});
this.tabtree = new Ext.tree.Panel({
region: 'west',
title: '任务信息', //'业务信息',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
useArrows: true,
rootVisible: false,
hideHeaders: true,
animate: false,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '任务信息', //'模块名称',
width: 318,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
'itemclick': function (thisview, record, item, index, e, eOpts) {
if (record.data.TYPE == '1') {
// var sql2 = this.getCondition();
var TASKTYPE = record.data.NAME;
var ISCOMPLETE = record.data.PARENTID;
var sql = "TASKTYPE='" + TASKTYPE + "' AND isnull(ISCOMPLETE,0)=" + ISCOMPLETE;
_this.sqlcontextselect = sql;
// if (sql2 != '') sql = sql + " and " + sql2;
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
} else {
// var sql2 = this.getCondition();
var ISCOMPLETE = record.data.id;
var sql = "isnull(ISCOMPLETE,0)=" + ISCOMPLETE;
_this.sqlcontextselect = sql;
// if (sql2 != '') sql = sql + " and " + sql2;
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
}
}
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpTask',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpTask/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'PTASKNO',
header: 'PTASKNO',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'CORPID',
header: 'CORPID',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'FILENO',
header: 'FILENO',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'MAILNO',
header: 'MAILNO',
hidden: true,
width: 150
},
//{
// sortable: true,
// dataIndex: 'TASKNO',
// header: '任务编号',
// width: 120
//},
{
sortable: true,
dataIndex: 'TASKTYPE',
align: 'center',
header: '任务类型',
width: 120
},
//{
//sortable: true,
//dataIndex: 'TASKSTATUS',
//align: 'center',
//header: '任务状态',
//width: 120
//},
{
sortable: true,
dataIndex: 'TASKSOURCE',
align: 'center',
header: '任务来源',
width: 120
}, {
sortable: true,
dataIndex: 'TASKTITLE',
align: 'left',
header: '任务标题',
width: 120
}, {
sortable: true,
dataIndex: 'TASKDESCRIP',
align: 'center',
header: '任务内容',
width: 120
}, {
sortable: true,
dataIndex: 'OP',
align: 'center',
header: '接收人',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
align: 'center',
header: '委托编号',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
align: 'center',
header: '提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CARRIER',
align: 'center',
header: '船公司',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
align: 'center',
header: '委托单位',
width: 120
}, {
sortable: true,
dataIndex: 'ETD',
align: 'center',
header: '开船日期',
width: 120
}, {
sortable: true,
dataIndex: 'FILEPATH',
align: 'center',
header: '文件路径',
width: 120
}, {
sortable: true,
dataIndex: 'CREATEUSER',
align: 'center',
header: '发起人',
width: 120
}, {
sortable: true,
dataIndex: 'CREATETIME',
align: 'center',
header: '发起时间',
width: 120
}, {
sortable: true,
dataIndex: 'TASKBEGINDATE',
align: 'center',
header: '任务开始时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 120
}, {
sortable: true,
dataIndex: 'COMPLETETIME',
align: 'center',
header: '完成时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 120
}, {
sortable: true,
align: 'center',
dataIndex: 'COMPLETETYPE',
header: '完成方式',
width: 80
}, {
sortable: true,
dataIndex: 'ISCOMPLETE',
align: 'center',
header: '是否完成',
width: 80,
renderer: function (value, cellmeta) {
if (value == '1') {
return "完成";
} else return "未完成";
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 150
}
];
this.girdcolums = this.initgirdcolums;
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (record.data.TASKTYPE == "待派车" || record.data.TASKTYPE == "待派车(重新提交)" || record.data.TASKTYPE == "驳回派车" ||record.data.TASKTYPE == "已发单" || record.data.TASKTYPE == "派车中" || record.data.TASKTYPE == "派车已发单" || record.data.TASKTYPE == "已派车") {
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsOpLetter/TruckView?handle=check&le_id=" + record.data.TASKNO + "&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
} else {
DsOpenEditWin('/MvcShipping/MsOpSeae/TaskView', record.data.BSNO);
}
}, this);
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
//this.storeList.on('beforeload', function (store) {
// var sql = this.getCondition();
// Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
//}, this);
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位', //'委托单位',
store: this.storeCustCode,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
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',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxCustCode,{
fieldLabel: '从任务日期',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 65,
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到任务日期',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 65,
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (sql != '')
sql = _this.sqlcontextselect + " and " + sql;
else sql = _this.sqlcontextselect;
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
xtype: 'button',
text: '刷新', //刷新
iconCls: "btnrefresh",
handler: function (button, event) {
this.Refresh();
},
scope: this
},{
text: "确认并完成",
iconCls: "btnadd",
handler: function (button, event) {
this.onUpTransStatusClick('确认并完成');
},
scope: this
}, '-',
{
text: "PENDING",
// iconCls: "btndelete",
handler: function (button, event) {
this.onUpTransStatusClick('PENDING');
},
scope: this
}, '-',
{
text: "转发邮件",
// iconCls: "btndelete",
handler: function (button, event) {
this.onUpTransStatusClick('转发邮件');
},
scope: this
},
'-',
{
text: "取消任务",
// iconCls: "btnsave",
handler: function (button, event) {
this.onUpTransStatusClick('取消任务');
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(_this.storeList, _this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.panelBtn, this.formSearch]
});
this.panelcenter = new Ext.Panel({
title: '任务列表', //'委托详细信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.panelTop, this.gridList]
});
Ext.apply(this, {
items: [this.tabtree, this.panelcenter]
});
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: 'isnull(ISCOMPLETE,0)=1' },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
// this.onRefreshClick();
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
if (sql != '')
sql = _this.sqlcontextselect + " and " + sql;
else sql = _this.sqlcontextselect;
this.sqlcontext = sql;
// this.tabtree.removeAll();
// this.treestore.reload();
//this.treestore.load({
// params: { PARENTID:'-1', condition: sql },
// waitMsg: "正在查询数据...",
// scope: this
//});
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql=this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
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, " t.MBLNO like '%" + MBLNO + "%'");
var BSDATEBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, BSDATEBgn, "CONVERT(char(10), t.TASKBEGINDATE, 20) >='" + BSDATEBgn + "'");
var BSDATEEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, BSDATEEnd, "CONVERT(char(10), t.TASKBEGINDATE, 20) <='" + BSDATEEnd + " 23:59:59'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "b.CUSTOMERNAME='" + CUSTOMERNAME + "'");
return sql;
},
onUpTransStatusClick: function (transstatus) {
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 bodydatas = [];
for (var i = 0; i < selections.length ; i += 1) {
var member = selections[i];
bodydatas.push(member);
}
if (bodydatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有需要更新的任务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确实要将选中任务的状态更改为<' + transstatus + '>吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsOpTask/UpTransStatusList',
params: {
data: jsonbodyAddDatas,
transstatus: transstatus
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
var sql = '';
// this.tabtree.disableSelection();
// this.treestore.reload();
this.treestore.load({
params: {
PARENTID: '-1', condition:''
},
waitMsg: "正在查询数据...",
scope: this
});
Ext.Msg.hide();
}
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);
},
Refresh: function () {
this.treestore.load({
params: {
PARENTID: '-1', condition: ''
},
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.reload();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});