You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
318 lines
10 KiB
318 lines
10 KiB
@{
|
|
ViewBag.Title = "Form";
|
|
Layout = "~/Views/Shared/_Form.cshtml";
|
|
}
|
|
<link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
|
|
<script src="~/Content/js/CommonReport/CommonReport.js"></script>
|
|
<link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
|
|
<script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
|
|
|
|
<script>
|
|
|
|
var _MenuID = $.request("MenuID");
|
|
var _IsCommon = $.request("IsCommon");
|
|
var _Cols = $.request("Cols");
|
|
|
|
|
|
$(function () {
|
|
$('#Select_Roles').selectpicker({ 'deselectAllText': '不选', 'selectAllText': '全选' });
|
|
$('#Select_cols').selectpicker({ 'deselectAllText': '不选', 'selectAllText': '全选' });
|
|
GetRoles();
|
|
|
|
|
|
|
|
if (_IsCommon == "Y") {
|
|
|
|
//通用报表列取列设置中的列
|
|
GetColsFiledName();
|
|
}
|
|
else {
|
|
GetColsByCols();
|
|
}
|
|
gridList();
|
|
$(window).resize(function () {
|
|
|
|
$("#gridList").setGridWidth($(window).width() * 0.99);
|
|
$("#gridList").setGridWidth(document.body.clientWidth * 0.99);
|
|
$("#gridList").setGridHeight($(window).height() - 96);
|
|
$("#gridList").setGridHeight(document.body.clientHeight - 96);
|
|
});
|
|
});
|
|
|
|
function gridList() {
|
|
|
|
var colsList = $("#Select_cols").val(); var cols = "";
|
|
if (colsList != null && colsList.length > 0) {
|
|
for (var i = 0; i < colsList.length; i++) {
|
|
if (cols == "") {
|
|
cols += colsList[i];
|
|
}
|
|
else {
|
|
cols += "," + colsList[i];
|
|
}
|
|
}
|
|
}
|
|
|
|
var RolesList = $("#Select_Roles").val(); var Roles = "";
|
|
if (RolesList != null && RolesList.length > 0) {
|
|
for (var i = 0; i < RolesList.length; i++) {
|
|
if (Roles == "") {
|
|
Roles += RolesList[i];
|
|
}
|
|
else {
|
|
Roles += "," + RolesList[i];
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
document.getElementsByClassName("gridPanel")[0].innerHTML = ' <table id="gridList"></table>';
|
|
|
|
var $gridList = $("#gridList");
|
|
$gridList.dataGrid({
|
|
url: "/SystemManage/CommonReport/GetColsVisible?" + Math.random(),
|
|
postData: { MenuID: _MenuID ,Roles:Roles,Cols:cols},
|
|
height: $(window).height() - 96,
|
|
width: "100%",
|
|
colModel: [
|
|
// MenuId RoleId FieldName VisibleFlag WorkPoint
|
|
{ label: 'ID', name: 'ID', width: 80, align: 'left', hidden: true, },
|
|
{ label: '角色', name: '角色', width: 80, align: 'left', },
|
|
{ label: '列字段', name: '列字段', width: 80, align: 'left', },
|
|
{ label: ' ', name: ' ', width: 20, align: 'left', },
|
|
],
|
|
sortname: '角色,列字段',
|
|
viewrecords: true,
|
|
rownumbers: true,
|
|
multiselect: true,
|
|
rowNum: 1000,
|
|
|
|
|
|
});
|
|
}
|
|
|
|
|
|
function GetRoles() {
|
|
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/GetRoles?" + "&" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
if (data != false && data != null && data.length > 0) {
|
|
$("#Select_Roles").find("option").remove();
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
$("#Select_Roles").append("<option value='" + data[i].RolesID + "'>" + data[i].Roles + "</option>");
|
|
}
|
|
|
|
}
|
|
$('#Select_Roles').selectpicker('refresh');
|
|
$('#Select_Roles').selectpicker('render');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function GetColsFiledName()
|
|
{
|
|
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/GetColsFiledName?MenuID=" + _MenuID + "&" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
if (data != false && data != null && data.length > 0) {
|
|
$("#Select_cols").find("option").remove();
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
$("#Select_cols").append("<option value='" + data[i].FiledName + "'>" + data[i].FiledName + "</option>");
|
|
}
|
|
|
|
}
|
|
$('#Select_cols').selectpicker('refresh');
|
|
$('#Select_cols').selectpicker('render');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function GetColsByCols() {
|
|
if (_Cols != '') {
|
|
var ColsData = _Cols.split(',');
|
|
$("#Select_cols").find("option").remove();
|
|
if (ColsData != null && ColsData.length > 0) {
|
|
|
|
for (var i = 0; i < ColsData.length; i++) {
|
|
$("#Select_cols").append("<option value='" + ColsData[i] + "'>" + ColsData[i] + "</option>");
|
|
}
|
|
|
|
}
|
|
$('#Select_cols').selectpicker('refresh');
|
|
$('#Select_cols').selectpicker('render');
|
|
}
|
|
}
|
|
|
|
//所有栏位 所有角色都可见
|
|
function btn_All()
|
|
{
|
|
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/SetColsVisibleALL?" + Math.random(),
|
|
type: "post",
|
|
data: { Cols: _Cols, IsCommon: _IsCommon, MenuID: _MenuID },
|
|
async: false,
|
|
success: function (data) {
|
|
if (data == "操作成功。") {
|
|
alert(data);
|
|
|
|
}
|
|
else { alert(data); }
|
|
gridList();
|
|
},
|
|
error: function (aa) {
|
|
//alert("异常:" + aa.responseText);
|
|
$.modalAlertNew("WMS00015", aa.responseText);
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
//查询
|
|
function btn_Search()
|
|
{
|
|
gridList();
|
|
}
|
|
|
|
//新增可见
|
|
function btn_ADD() {
|
|
var colsList = $("#Select_cols").val(); var cols = "";
|
|
if (colsList != null && colsList.length > 0) {
|
|
for (var i = 0; i < colsList.length; i++) {
|
|
if (cols == "") {
|
|
cols += colsList[i];
|
|
}
|
|
else {
|
|
cols += "," + colsList[i];
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
alert("请选择列");
|
|
return;
|
|
}
|
|
var RolesList = $("#Select_Roles").val(); var Roles = "";
|
|
if (RolesList != null && RolesList.length > 0) {
|
|
for (var i = 0; i < RolesList.length; i++) {
|
|
if (Roles == "") {
|
|
Roles += RolesList[i];
|
|
}
|
|
else {
|
|
Roles += "," + RolesList[i];
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
alert("请选择角色");
|
|
return;
|
|
}
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/SetColsVisibleAdd?" + Math.random(),
|
|
type: "post",
|
|
data: { Cols: cols, Roles: Roles, MenuID: _MenuID },
|
|
async: false,
|
|
success: function (data) {
|
|
if (data == "操作成功。") {
|
|
alert(data);
|
|
}
|
|
else { alert(data); }
|
|
gridList();
|
|
},
|
|
error: function (aa) {
|
|
//alert("异常:" + aa.responseText);
|
|
$.modalAlertNew("WMS00015", aa.responseText);
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
//删除
|
|
function btn_Del() {
|
|
var IDList = "";
|
|
var A_RowDatas = $("#gridList").jqGrid('getDataIDs');
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length <= 0) {
|
|
$.modalAlertNew("WMS00004");
|
|
return;
|
|
}
|
|
for (var i in ids) {
|
|
var RowData = $("#gridList").jqGrid('getRowData', ids[i]);
|
|
var id = RowData.ID.toString();
|
|
|
|
IDList = IDList + id + ",";
|
|
}
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/SetColsVisibleDel",
|
|
type: "post",
|
|
data: { MenuID: _MenuID, IDList: IDList },
|
|
async: false,
|
|
success: function (data) {
|
|
|
|
if (data == "操作成功。") {
|
|
alert(data);
|
|
gridList();
|
|
}
|
|
else { alert(data); }
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<form id="form1">
|
|
<div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
|
|
<div class="form-group" style="height:40px;margin-bottom:5px">
|
|
<table class="form" style="width:100%">
|
|
|
|
<tr>
|
|
<th class="formTitle">字段: </th>
|
|
<td class="formValue" style="width:160px">
|
|
|
|
<select id="Select_cols" name="Select_cols" title="" class="selectpicker" data-actions-box="true" data-width="140px" style="margin-right:100px" multiple="multiple"></select>
|
|
|
|
</td>
|
|
<th class="formTitle">角色: </th>
|
|
<td class="formValue" style="width:160px">
|
|
|
|
<select id="Select_Roles" name="Select_Roles" title="" class="selectpicker" data-actions-box="true" data-width="140px" style="margin-right:100px" multiple="multiple"></select>
|
|
</td>
|
|
|
|
<td class="formValue" style="width:290px">
|
|
|
|
<a id="Btn_Search" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_Search()"><i class="fa fa-search"></i>查询</a>
|
|
|
|
<a id="Btn_ADD" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_ADD()"><i class="fa fa-plus"></i>新增</a>
|
|
|
|
|
|
<a id="Btn_Del" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_Del()"><i class="fa fa-minus"></i>删除</a>
|
|
|
|
|
|
<a id="Btn_All" authorize="yes" class="btn btn-primary dropdown-text " onclick="btn_All()"><i class="fa fa-save"></i>全可见</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="gridPanel">
|
|
<table id="gridList"></table>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|