|
var temp=null;
|
$(function () {
|
|
$('#applyjqGrid').jqGrid('clearGridData');
|
$("#applyjqGrid").jqGrid({
|
url: restServerBaseURL + 'sys/systeminfoapply/list?appid=' + GetQueryString("appid") + "&auditresult=" + GetQueryString("auditresult"),
|
datatype: "json",
|
colModel: [
|
{label: '系统编号', name: 'userid', index: 'USERID', width: 20, key: true, hidden: true},
|
{label: '姓名', name: 'chinesename', index: 'chinesename', width: 40, align: 'center'},
|
{label: '单位', name: 'unitname', index: 'unitname', width: 50, align: 'center'},
|
{
|
label: (GetQueryString("auditresult") == 0 ? '操作' : '审核结果'),
|
width: 30,
|
sortable: false,
|
align: 'center',
|
formatter: function (value, grid, rows, state) {
|
var id = rows.id;
|
temp=rows;
|
var html = "";
|
if (GetQueryString("auditresult") == 0 && rows.auditresult == 0) {
|
html = '<input type="button" id="applyaudit" data-toggle="modal" data-target="#resultModal" class="btn btn-primary" value="审核" style="margin-right:5px;padding:3px 6px;" onclick="ShowAuditResult(' +
|
id + ')">';
|
}
|
if (GetQueryString("auditresult") != 0) {
|
var opition = rows.auditopinion==null?'':rows.auditopinion;
|
html = "<a data-toggle=\"modal\" data-target=\"#opinionModal\" onclick='ShowOpinion(\"" + opition + "\")' style='color: black;cursor: pointer;text-decoration:underline;'>" + (rows.auditresult == 1 ? "通过" : "不通过") + "</a>";
|
|
html +=' <a class="delete" onclick="delRecord()" style="color: black;cursor: pointer;text-decoration:underline;">'+"删除记录"+"</a>";
|
}
|
return html;
|
}
|
}
|
],
|
height: "auto",
|
viewrecords: true,
|
rowNum: 10,
|
rownumbers: true,
|
rownumWidth: 50,
|
autowidth: true,
|
multiselect: false,
|
pager: "#applyjqGridPager",
|
jsonReader: {
|
root: "page.list",
|
page: "page.currPage",
|
total: "page.totalPage",
|
records: "page.totalCount"
|
},
|
prmNames: {
|
page: "page",
|
rows: "limit",
|
order: "order"
|
},
|
gridComplete: function () {
|
//隐藏grid底部滚动条
|
$("#applyjqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
|
},
|
onSortCol: function (index, colindex, sortorder) {
|
jQuery("#applyjqGrid").jqGrid('setGridParam', {
|
page: $(".ui-pg-input").val()
|
});
|
}
|
}).trigger('reloadGrid');
|
jQuery("#applyjqGrid").jqGrid('setLabel', 'rn', '序号', {
|
'text-align': 'center',
|
'vertical-align': 'middle',
|
"width": "50"
|
});
|
$("#applyjqGrid").setGridWidth(545);
|
});
|
|
/*
|
*删除记录
|
*/
|
function delRecord(){
|
debugger
|
console.log(temp);
|
var obj=temp;
|
$.ajax({
|
type: "GET",
|
url: restServerBaseURL + "sys/systeminfoapply/delRecord?applyid=" +obj.id + "&auditresult=3" ,
|
contentType: "application/json;charset=utf-8",
|
success: function (result) {
|
|
layer.msg(result.msg);
|
parent.$("#applyModal").modal("hide");
|
parent.vm.query();
|
|
},
|
fail: function(result){
|
|
layer.msg("发生错误,请联系管理员!");
|
parent.$("#applyModal").modal("hide");
|
|
}
|
});
|
}
|
function GetQueryString(name) {
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
var r = window.location.search.substr(1).match(reg);
|
if (r != null) return unescape(r[2]);
|
return null;
|
}
|
|
function ShowAuditResult(id) {
|
$("#applyid").val(id);
|
}
|
|
function SaveAuditResult() {
|
var isSelect = false;
|
var status = 0;
|
$("[type=radio]").each(function () {
|
if ($(this).prop("checked") == true) {
|
status = $(this).val();
|
isSelect = true;
|
}
|
})
|
if (!isSelect) {
|
alert("请选择结果!");
|
return false;
|
}
|
$.ajax({
|
url: restServerBaseURL + 'sys/systeminfoapply/saveresult',
|
type: 'post',
|
dataType: "json",
|
data: {'applyid': $("#applyid").val(), 'auditresult': status, 'auditopinion': $("#auditopinion").val()},
|
success: function (data) {
|
if (data.result == '1') {
|
alert("批复成功!");
|
CloseModal();
|
parent.$("#applyModal").modal("hide");
|
parent.vm.query();
|
} else {
|
alert("批复失败!");
|
CloseModal();
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
|
function CloseModal() {
|
$("#resultModal").modal("hide");
|
}
|
|
function ShowOpinion(opinion) {
|
$("#opinionDiv").html(opinion);
|
}
|