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

129 lines
5.2 KiB
Plaintext

@model CreditTable
@{
ViewBag.Title = "交易权限";
Layout = "~/Views/Shared/_InfoLayout.cshtml";
}
@section JS
{
<script type="text/javascript">
var adata = "@ViewBag.All".split(",");
@*var cfdata = "@ViewBag.AllCommodityFutures".split(",");
var sdata = "@ViewBag.AllStock".split(",");
var odata = "@ViewBag.AllOther".split(",");*@
//function DisabledCheckOptions(checkall) {
// $("#IsAllCommodityFutures").prop('disabled', checkall);
// $("#IsAllStock").prop('disabled', checkall);
// $("#IsAllOther").prop('disabled', checkall);
//}
function OperateOthersCheckOptions(checkall) {
$("#IsAllCommodityFutures").prop('checked', checkall);
$("#IsAllStock").prop('checked', checkall);
$("#IsAllOther").prop('checked', checkall);
}
$(function () {
SetAceDropDown(false);
changeRole();
//$("#IsAll").prop("checked") && $("#VarietyId").trigger("chosen:updated");
//if ($("#IsAll").prop("checked")) {
// OperateOthersCheckOptions(false);
// DisabledCheckOptions(true);
//}
});
function OperateSelected(tar,oper) {
for (var i = 0; i < tar.length; i++) {
$("#VarietyId option[value='" + tar[i] + "']").prop("selected", oper);
}
}
function selallVariety(obj) {
var objId = $(obj).attr('id');
var checkall = $(obj).prop("checked");
switch (objId) {
case "IsAll":
OperateSelected(adata, checkall);
//if (checkall) {
// //OperateOthersCheckOptions(false);
// //DisabledCheckOptions(true);
//}
//else {
// //DisabledCheckOptions(false);
//}
break;
//case "IsAllCommodityFutures":
// OperateSelected(cfdata, checkall);
// break;
//case "IsAllStock":
// OperateSelected(sdata, checkall);
// break;
//case "IsAllOther":
// OperateSelected(odata, checkall);
// break;
default: break;
}
$("#VarietyId").trigger("chosen:updated");
}
function checkSubmitData() {
var pass = $('#creditEditForm').valid();
return pass;
}
function savecredit() {
if (!checkSubmitData()) return false;
//if ($("#IsAllOther").prop('checked') && $("#IsAllStock").prop('checked') && $("#IsAllCommodityFutures").prop('checked')) {
// $("#IsAll").prop('checked',true)
//}
var data = $("#creditEditForm").serialize();
main.post("/credit/creditEditJson", data).done(function (res) { window.location.href = "/credit/creditview?enid=" + res.obj.EncryptId; try { window.parent.reloadcredit(); } catch (e) { } });
}
function changeRole() {
var roleName = $("#RoleId option:selected").text();
$("#RoleName").val(roleName);
}
</script>
}
@using (Html.BeginForm("creditEdit", "credit", FormMethod.Post, new { id = "creditEditForm", autocomplete = "off" }))
{
<div class="yc-panel">
<input type="hidden" value="@Model.id" name="id" id="id" />
@Html.HiddenFor(model => model.EncryptId)
<input type="hidden" value="@CreditTable.RoleType" name="Type" />
@Html.HiddenFor(model => model.RoleName)
@Html.MyDropdownFor(model => model.RoleId, GlobalData.GetAllRole(CurUser,""), new { onchange = "changeRole()" }, "", false)
<div class="form-group col-md-6">
<label class="formlabel" for="VarietyId"></label>
<label>
<input type="checkbox" onclick="selallVariety(this)" name="IsAll" id="IsAll" value="true" @(Model.IsAll == true ? "checked" : "") />
全部品种
</label>
<input name="IsAll" type="hidden" value="false" />
@*<label>
<input type="checkbox" onclick="selallVariety(this)" name="IsAllCommodityFutures" id="IsAllCommodityFutures" value="true" @(ViewBag.IsAllCommodityFutures == true ? "checked" : "") />
商品期货
</label>
<label>
<input type="checkbox" onclick="selallVariety(this)" name="IsAllStock" id="IsAllStock" value="true" @(ViewBag.IsAllStock == true ? "checked" : "") />
权益类
</label>
<label>
<input type="checkbox" onclick="selallVariety(this)" name="IsAllOther" id="IsAllOther" value="true" @(ViewBag.IsAllOther == true ? "checked" : "") />
其他品种
</label>*@
</div>
@Html.MyAceDropdownFor(model => model.VarietyId, varietyController.GetAllvariety(), "", false)
</div>
<div class="clearfix"></div>
<div class="form-buttons">
@MyControls.Btn("保存", "savecredit()")
@MyControls.Btn("关闭", "layer.closeMe()")
</div>
}