255 lines
8.2 KiB
JavaScript
255 lines
8.2 KiB
JavaScript
|
|
$(function () {
|
|
initPage();
|
|
$(window).resize(function () {
|
|
//如有频繁改变大小的需求,要增加延迟运行的逻辑;
|
|
var height = $(window).height() - 265;
|
|
$("#listGrid").setGridHeight(height);
|
|
});
|
|
$(window).resize();
|
|
});
|
|
|
|
function initPage() {
|
|
setDatePicker(_valueDate);
|
|
new tradeHelper.UnderlyingSelectCtrl('#UnderlyingId').setFlag(tradeHelper.UnderlyingSelectFlag.OtcTrade);
|
|
grid = jQuery('#listGrid').jqGrid({
|
|
url: "/risk/HedgingMonitorQuery",
|
|
datatype: 'json',
|
|
height: '800',
|
|
width: '96%',
|
|
autowidth: false,
|
|
shrinkToFit: false,
|
|
viewrecords: true,
|
|
jsonReader: { repeatitems: false },
|
|
mtype: 'POST',
|
|
postData: getPostData(),
|
|
onSelectRow: rowclick,
|
|
ondblClickRow: rowdblclick,
|
|
colModel: colModel,
|
|
//pager: jQuery('#pagerGrid'),
|
|
//pagerpos: 'left',
|
|
//rowNum: 25,
|
|
//rowList: [25, 50, 100, 200, 10000],
|
|
footerrow: true,
|
|
userDataOnFooter: true,
|
|
loadComplete: gridComplete,
|
|
onPaging: onJqgridPaging
|
|
});
|
|
}
|
|
|
|
function setDatePicker(date) {
|
|
main.setTradeDatePicker("", "#DateSettlementDate", _valueDate);
|
|
$("#DateSettlementDate").val(date);
|
|
}
|
|
|
|
function getPostData() {
|
|
var postData = {
|
|
SettlementDate: $("#DateSettlementDate").val(),
|
|
varietyIds: $("#VarietyId").val(),
|
|
UnderlyingIds: $("#UnderlyingId").val(),
|
|
};
|
|
return postData;
|
|
}
|
|
|
|
var colModel = [
|
|
{
|
|
name: 'TradeCode',
|
|
label: '挂钩标的',
|
|
index: 'TradeCode',
|
|
width: 120,
|
|
align: 'left',
|
|
sortable: false
|
|
}, {
|
|
name: 'PositionNotional',
|
|
label: '持仓数量',
|
|
index: 'PositionNotional',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : amountToNotional(cellvalue, rowObject).toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #AEE3E3'";
|
|
}
|
|
}, {
|
|
name: 'Pv',
|
|
label: '持仓市值',
|
|
index: 'Pv',
|
|
width: 150,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #AEE3E3'";
|
|
}
|
|
}, {
|
|
name: 'TradePrice',
|
|
label: '今日成交总额(净值)',
|
|
index: 'TradePrice',
|
|
width: 150,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #CAF982'";
|
|
}
|
|
}, {
|
|
name: 'BuyTradePrice',
|
|
label: '今日成交总额(买入)',
|
|
index: 'BuyTradePrice',
|
|
width: 150,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #CAF982'";
|
|
}
|
|
}, {
|
|
name: 'SellTradePrice',
|
|
label: '今日成交总额(卖出)',
|
|
index: 'SellTradePrice',
|
|
width: 150,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #CAF982'";
|
|
}
|
|
}, {
|
|
name: 'MarketTradePrice',
|
|
label: '今日市场成交总额',
|
|
index: 'MarketTradePrice',
|
|
width: 180,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #CAF982'";
|
|
}
|
|
}, {
|
|
name: 'NotionalRate',
|
|
label: '成交量占比',
|
|
index: 'NotionalRate',
|
|
width: 90,
|
|
align: 'right',
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #CAF982'";
|
|
}
|
|
}, {
|
|
name: 'BuyNotional',
|
|
label: '今日买入数量',
|
|
index: 'BuyNotional',
|
|
width: 120,
|
|
align: 'right',
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'BuyLowPrice',
|
|
label: '今日买入最低价',
|
|
index: 'BuyLowPrice',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'BuyAvgPrice',
|
|
label: '今日买入均价',
|
|
index: 'BuyAvgPrice',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'SellNotional',
|
|
label: '今日卖出数量',
|
|
index: 'SellNotional',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'SellHighPrice',
|
|
label: '今日卖出最高价',
|
|
index: 'SellHighPrice',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'SellLowPrice',
|
|
label: '今日卖出最低价',
|
|
index: 'SellLowPrice',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}, {
|
|
name: 'SellAvgPrice',
|
|
label: '今日卖出均价',
|
|
index: 'SellAvgPrice',
|
|
width: 120,
|
|
align: 'right',
|
|
sortable: false,
|
|
formatter: function (cellvalue, options, rowObject) {
|
|
return cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
|
|
},
|
|
cellattr: function (cellvalue, options, rowObject) {
|
|
return "style='background-color: #FFFF80'";
|
|
}
|
|
}
|
|
];
|
|
|
|
function amountToNotional(amount,obj) {
|
|
return page.IsUseDisplayNotional ? amount * (obj.CountRatio || 1) : amount;
|
|
}
|
|
|
|
function SearchClick(isSearchclick) {
|
|
var listGrid = $('#listGrid');
|
|
listGrid.appendPostData({ SettlementDate: $("#DateSettlementDate").val() });
|
|
listGrid.appendPostData({ varietyIds: $("#VarietyId").val() });
|
|
listGrid.appendPostData({ UnderlyingIds: $("#UnderlyingId").val() });
|
|
listGrid.trigger('reloadGrid');
|
|
} |