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/SoftMng/Viewsjs/MsSoftUpGrade/MsSoftUpDateIndex.js

395 lines
13 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsSoftUpDateIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsSoftUpDateIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsSoftUpDateIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
PageSize: 100,
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "SoftUpDateIndex"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsSysUpdateSql',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/SoftMng/MsSoftUpGrade/GetUpDateLogList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SQLVER',
header: '脚本版本号',
width: 100
}, {
sortable: true,
dataIndex: 'SORT',
header: '序号',
width: 80
}, {
sortable: true,
dataIndex: 'UPSTATUS',
header: '状态',
width: 100
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '更新内容',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '升级人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '升级时间',
width: 100
}, {
sortable: true,
dataIndex: 'UPFILES',
header: '更新程序',
width: 100,
renderer: function (value, meta, record) {
if (value == true || value == '1')
return '√';
else
return '';
}
}
];
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.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.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#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: '当前版本号',
flex: 1,
readOnly: true,
name: 'SQLVER'
}, {
fieldLabel: '当前版本序号',
flex: 1,
readOnly: true,
name: 'SORT'
}, {
fieldLabel: '最新版本号',
flex: 1,
readOnly: true,
name: 'SVRSQLVER'
}, { xtype: 'hiddenfield',flex: 2 }, {
xtype: 'button',
width: 120,
text: "升级到最新版本",
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition:'' },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
if (_this.storeList.getCount() > 0) {
var memberbody = _this.storeList.getAt(0);
_this.formSearch.getForm().findField('SQLVER').setValue(memberbody.data.SQLVER)
_this.formSearch.getForm().findField('SORT').setValue(memberbody.data.SORT)
_this.SelectedRecord = memberbody;
_this.OprationStatus = 'edit';
var openSet = "height=600, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 600) / 2 + ",Left= " + (screen.width - 700) / 2
var openType = memberbody.data.GID;
var openUrl = "/SoftMng/MsSoftUpGrade/SoftUpdateEdit";
window.open(openUrl, openType, openSet);
}
}
},
scope: this
});
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//查询工具条
// this.panelBtn = new Ext.Panel({
// region: "north",
// tbar: [
// {
// text: "新建",
// iconCls: "btnadd",
// handler: function (button, event) {
// this.OprationStatus = 'add';
// var openSet = "height=600, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 600) / 2 + ",Left= " + (screen.width - 700) / 2
// var openType = "";
// var openUrl = "/SoftMng/MsSoftUpGrade/Edit";
// window.open(openUrl, openType, openSet);
// },
// scope: this
// }, '-',
// {
// text: "删除",
// iconCls: "btndelete",
// handler: function (button, event) {
// this.onDeleteClick(button, event);
// },
// scope: this
// },
// '-',
// {
// text: "执行查询",
// iconCls: "btnrefresh",
// handler: function (button, event) {
// this.onRefreshClick(button, event);
// },
// scope: this
// },
// {
// text: "重置条件",
// iconCls: "btnreset",
// handler: function (button, event) {
// },
// 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.InitGrid(_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: 45,
items: [this.formSearch]
});
this.panelDetail = new Ext.Panel({
layout: "border",
region: "center",
title:"升级日志",
items: [this.gridList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelDetail]
});
this.sqlcontext = '';
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
this.onRefreshClick();
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/SoftMng/MsSoftUpGrade/GetSvrVer',
// 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.formSearch.getForm().findField('SVRSQLVER').setValue(data.SQLVER)
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, //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.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
if (_this.storeList.getCount() > 0) {
var memberbody = _this.storeList.getAt(0);
_this.formSearch.getForm().findField('SQLVER').setValue(memberbody.data.SQLVER)
_this.formSearch.getForm().findField('SORT').setValue(memberbody.data.SORT)
}
}
},
scope: this
});
},
onDsQuery: function () {
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 = '';
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});