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/CommMng/Viewsjs/WorkFlow/GetWorkFlowState.js

188 lines
6.1 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
Ext.define('BSNOWorkFlowmb', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [
{ name: 'NAME', type: 'string' },
{ name: 'STEPNO', type: 'string' },
{ name: 'GROUPID', type: 'string' },
{ name: 'AUDITOR', type: 'string' },
{ name: 'SHOWNAME', type: 'string' },
{ name: 'BILLNO', type: 'string' }
]
});
DsTruck.SaveGridPanel = function (USERID, FORMNAME, gridcolumns, midcolumn, start, havecheckbox) {
var savecolumn = gridcolumns;
var _midcolumn = midcolumn;
var storeGridPanel = Ext.create('Ext.data.Store', {
model: 'GridPanelShowmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/GridPanelShow/GetDataList',
reader: {
id: 'id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
var _i = 0;
var this_start = start;
if (havecheckbox == true) { this_start++ };
Ext.each(savecolumn, function (item) {
//alert(item.dataIndex);
if (_i >= this_start) { //跳过小于start的列
//从第二列开始则传入此处的start=1
var hidden = '0';
var sortable = '0';
if (item.hidden == true) {
hidden = '1';
}
if (item.sortable == true) {
sortable = '1';
}
var this_i = _i;
if (havecheckbox == true) { this_i-- };
//alert(item.editor);
var record = Ext.create('GridPanelShowmb', {
'id': _midcolumn[this_i].id, //item.id,
'USERID': USERID,
'FORMNAME': FORMNAME,
'DATAORDER': this_i,
'dataIndex': item.dataIndex,
'header': item.text,
'text': item.text,
'width': item.width,
'hidden': hidden,
'sortable': sortable
});
storeGridPanel.add(record);
}
_i++;
}); //循环end
var GridPaneldatas = [];
for (var i = 0; i < storeGridPanel.getCount(); i += 1) {
var member = storeGridPanel.getAt(i);
GridPaneldatas.push(member);
}
var GridPanelBody = ConvertRecordsToJsonAll(GridPaneldatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/GridPanelShow/Save',
scope: this,
async: false,
params: {
GridPanelBody: GridPanelBody,
USERID: USERID,
FORMNAME: FORMNAME
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
for (var _i = 0; _i < returnData.length; _i++) {
_midcolumn[_i + start].id = returnData[_i].id;
_midcolumn[_i + start].dataIndex = returnData[_i].dataIndex;
_midcolumn[_i + start].text = returnData[_i].header;
_midcolumn[_i + start].header = returnData[_i].header;
_midcolumn[_i + start].width = parseInt(returnData[_i].width);
if (returnData[_i].hidden == "True") {
_midcolumn[_i + start].hidden = true;
} else {
_midcolumn[_i + start].hidden = false;
}
if (returnData[_i].sortable == "True") {
_midcolumn[_i + start].sortable = true;
} else {
_midcolumn[_i + start].sortable = false;
}
}
} 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');
}
});
return _midcolumn;
};
DsTruck.GetWorkFlowState = function (WORKFLOWID, BSNO) {
var returnData = [];
var temprec = { id: '' };
var column = [
{ xtype: 'textfield',
fieldLabel: '提单号/船名',
name: 'MBLNO',
value: ""
}];
var Steps = column;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/WorkFlow/GetBSNOWorkFlowState',
scope: this,
async: false,
params: { WORKFLOWID: WORKFLOWID, BSNO: BSNO },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
returnData = jsonresult.data;
//Steps.length = returnData.length;
for (var _i = 0; _i < returnData.length; _i++) {
if (_i > 0) {
Steps.push({ xtype: 'textfield',
fieldLabel: '提单号/船名',
name: 'MBLNO',
value: ""
});
}
//Steps[_i].xtype = 'textfield';
Steps[_i].name = 'order' + _i.toString();
Steps[_i].fieldLabel = returnData[_i].NAME;
Steps[_i].value = returnData[_i].SHOWNAME;
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
return Steps;
};