Files
zszq-trs/YLErpWeb/Views/servicerepresentativeconfig/servicerepresentativeconfigList.cshtml
T
2024-05-09 14:06:26 +08:00

350 lines
12 KiB
Plaintext

@{
ViewBag.Title = "服务商配置";
Layout = "~/Views/Shared/_MainLayout.cshtml";
}
@section JS{
<script type="text/javascript">
var g_grid = {};
$(function() {
var PostData = {};
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
showOtherMonths: true,
selectOtherMonths: true
});
var grid = jQuery('#listGrid').jqGrid({
url: '/servicerepresentativeconfig/servicerepresentativeconfigQuery',
datatype: 'json',
height: 'auto',
width: '96%',
autowidth: false,
shrinkToFit: false,
viewrecords: true,
jsonReader: { repeatitems: false },
caption: '',
mtype: 'POST',
postData: PostData,
afterInsertRow: AfterInsertRow,
onSelectRow: rowclick,
ondblClickRow: rowdblclick,
colModel: colModelGrid,
pager: jQuery('#pagerGrid'),
pagerpos: 'left',
rowNum: 20,
rowList: [20, 30, 50, 200, 10000],
footerrow: false,
loadComplete: gridComplete,
onPaging: onJqgridPaging,
grouping: true,
cellEdit: true,
cellsubmit: "remote",
cellurl: "/servicerepresentativeconfig/servicerepresentativeconfigEditJson",
beforeSubmitCell: function(rowid, celname, value, iRow, iCol) {
console.log("beforeSubmitCell");
var rowData = jQuery('#listGrid').jqGrid("getRowData", rowid);
return {
EncryptId: rowData.EncryptId,
PremiumRateVariation: rowData.PremiumRateVariation,
DefaultTradeInstruction: rowData.DefaultTradeInstruction,
//ContractVersion: rowData.ContractVersion,
StockBuyContractVersion: rowData.StockBuyContractVersion,
StockSellContractVersion: rowData.StockSellContractVersion,
FutureBuyContractVersion: rowData.FutureBuyContractVersion,
FutureSellContractVersion: rowData.FutureSellContractVersion,
DefaultPremiumRate: rowData.DefaultPremiumRate,
SellerRightDeliveryDayType: rowData.SellerRightDeliveryDayType,
ContractNoLength: rowData.ContractNoLength,
ContractSubNoStyle: rowData.ContractSubNoStyle
};
},
afterSubmitCell: function (serverresponse, rowid, celname, value, iRow, iCol) {
if (serverresponse.status === 200) {
if (serverresponse.responseText) {
var result=JSON.parse(serverresponse.responseText);
if (result.success) {
main.message("修改成功");
return [true, "修改成功"];
} else {
return [false, result.msg];
}
} else {
return [false, "没有返回信息"];
}
}
console.log(serverresponse);
return [false, "请求出错"];
}
});
g_grid = jQuery('#listGrid');
function keyEnter(event) {
try {
var e = event ? event : (window.event ? window.event : null);
if (e.keyCode == 13) {
SearchClick(true);
}
} catch (e) {
}
}
document.onkeydown = keyEnter;
try {
SetAceDropDown();
} catch (e) {
}
function AfterInsertRow(rowid, aData) {
}
});
var colModelGrid = [
{
name: 'id',
label: 'id',
index: 'id',
width: 1,
align: 'left',
hidden: true
}, {
name: 'EncryptId',
label: 'EncryptId',
index: 'EncryptId',
width: 0,
align: 'left',
hidden: true
}, {
name: 'ServiceName',
label: '服务商名称',
index: 'ServiceName',
width: 150,
align: 'left'
}, {
name: 'ServiceId',
label: '服务商编号',
index: 'ServiceId',
width: 150,
align: 'left'
}, {
name: 'Alias',
label: '服务商别名',
index: 'Alias',
width: 150,
align: 'left',
editable: true
}, {
name: 'PremiumRateVariation',
label: '加成费率(万分之)',
index: 'PremiumRateVariation',
width: 150,
align: 'left',
//formatter: 'number',
editable: true,
editrules: { number: true }
}, {
name: 'StockBuyContractVersion',
label: '个股买方协议版本号',
index: 'StockBuyContractVersion',
width: 150,
align: 'left',
editable: true
}, {
name: 'StockSellContractVersion',
label: '个股卖方协议版本号',
index: 'StockSellContractVersion',
width: 150,
align: 'left',
editable: true
}, {
name: 'FutureBuyContractVersion',
label: '商品期货买方协议版本号',
index: 'FutureBuyContractVersion',
width: 150,
align: 'left',
editable: true
}, {
name: 'FutureSellContractVersion',
label: '商品期货卖方协议版本号',
index: 'FutureSellContractVersion',
width: 150,
align: 'left',
editable: true
}, {
name: 'DefaultTradeInstruction',
label: '默认交易/行权指令',
index: 'DefaultTradeInstruction',
width: 150,
align: 'left',
editable: true
//}, {
// name: 'DefaultPremiumRate',
// label: '默认期权费率(%)',
// index: 'DefaultPremiumRate',
// width: 150,
// align: 'left',
// editable: true,
// editrules: { number: true }
}, {
name: 'SellerRightDeliveryDayType',
label: '卖方权利金交割日类型',
index: 'SellerRightDeliveryDayType',
width: 150,
align: 'left',
//formatter: 'number',
editable: true,
edittype: 'select',
editoptions: { value: "0:行权日; 1:交易开始日" },
//editrules: { number: true }
formatter: showName
}, {
name: 'ContractNoLength',
label: '交易确认书编码长度',
index: 'ContractNoLength',
width: 150,
align: 'left',
//formatter: 'number',
editable: true,
editrules: { number: true }
}, {
name: 'ContractSubNoStyle',
label: '交易确认书子编码样式',
index: 'ContractSubNoStyle',
width: 150,
align: 'left',
//formatter: 'number',
editable: true
}, {
name: 'ExerciseRule',
label: '行权规则',
index: 'ExerciseRule',
width: 150,
align: 'left',
formatter: exerciseRuleFormat
}, {
name: 'ValidState',
label: '是否有效',
index: 'ValidState',
width: 100,
align: 'left',
formatter: formatValidState
}, {
name: '',
label: '操作',
index: '',
width: 150,
align: 'left',
formatter: showToolName
}
];
function gridComplete() {
}
function exerciseRuleFormat(cellValue, options, rowObject) {
return "T + " + (cellValue == null || cellValue == "" ? "0" : cellValue);
}
function customButton(cellValue, options, rowObject) {
var imageHtml =
"<input type=\"button\" value=\"删除\" class=\"btn-warning\" onclick=\"deleteservicerepresentativeconfig('" +
rowObject.EncryptId +
"');\" />";
return imageHtml;
}
function showName(cellValue, options, rowObject) {
var nameText = null;
if (cellValue ==@Convert.ToInt32(SellerRightDeliveryDayTypeEnum.行权日)) {
nameText = "行权日";
}
else if (cellValue ==@Convert.ToInt32(SellerRightDeliveryDayTypeEnum.交易开始日)) {
nameText = "交易开始日";
}
return nameText;
}
function deleteservicerepresentativeconfig(encryptId) {
if (confirm("确定删除吗?")) {
$.ajax({
type: "Post",
url: "/servicerepresentativeconfig/Deleteservicerepresentativeconfig",
data: { id: encryptId, d: new Date() },
success: function (data) {
showmiddlemessage(data.msg);
if (data.success == true) {
$('#listGrid').trigger('reloadGrid');
}
},
error: function(msg) {
alert("error:" + msg);
}
});
}
}
function showToolName(cellValue, options, rowObject) {
var html =
"<input type=\"button\" class=\"wentiEdit\" title='查看服务商配置' onclick=\"startservicerepresentativeconfigView('{0}')\" value=\"{1}\" />"
.template(rowObject.EncryptId, "查看");
html +=
"<input type=\"button\" class=\"wentiEdit\" title='删除服务商配置' onclick=\"deleteservicerepresentativeconfig('{0}')\" value=\"{1}\" />"
.template(rowObject.EncryptId, "删除");
return html;
}
function rowclick(id) {
}
function startAddservicerepresentativeconfig() {
var addurl = "/servicerepresentativeconfig/servicerepresentativeconfigEdit/0";
main.open("新增服务商配置", addurl);
}
function startservicerepresentativeconfigView(id) {
var srcurl = "/servicerepresentativeconfig/servicerepresentativeconfigView/?enid=" + id;
main.open("查看服务商配置", srcurl);
}
function reloadservicerepresentativeconfig() {
//重新加载
SearchClick();
}
function SearchClick(isSearchclick) {
var listGrid = $('#listGrid');
listGrid.appendPostData({ ServiceId: $("#ServiceId").val() });
if (typeof (isSearchclick) != "undefined" && isSearchclick) {
//点击搜索时默认第一页
listGrid.jqGrid('setGridParam',
{
page: 1
});
}
listGrid.trigger('reloadGrid');
}
</script>
}
<div class="searchdiv">
@Html.MyAceDropdownInput2("ServiceId", "服务商", servicerepresentativeconfigController.GetAllServiceNames())
@MyControls.SearchBtn()
@MyControls.Btn("新增", "startAddservicerepresentativeconfig()")
</div>
@Html.Raw(JqGridSimple.OutTable())