tijian_tieying/web/dccdc/Views/sq2/sqysbx.cshtml
2025-02-20 12:14:39 +08:00

284 lines
15 KiB
Plaintext

@{
ViewBag.Title = "sqyscx";
}
<div id="layout1">
<div>
<table class="t1" style="width:100%">
<tr>
<td class="ltd" style="width:80px">开始时间:</td>
<td class="rtd" style="width:150px"><input id="start" class="l-text" /></td>
<td class="ltd" style="width:70px">结束时间:</td>
<td class="rtd" style="width:150px"><input id="end" class="l-text" /></td>
<td class="ltd" style="width:70px">申请人:</td>
<td class="rtd" style="width:150px">@Html.TextBox("sqr", "", new { @class = "l-text" })</td>
</tr>
</table>
</div>
<div position="left">
<table class="t1" style="width:100%">
<tr>
<td class="ltd" width="70px">申请科室</td>
<td class="rtd">@Html.DropDownList("ksid", ViewBag.ksD as SelectList, "所有科室", new { @class = "l-text" })</td>
<td class="rtd" rowspan="2"><input type="button" id="search" value="查询" class="l-button" style="height:46px" /></td>
</tr>
<tr>
<td class="ltd" width="70px">预算年份</td>
<td class="rtd">@Html.TextBox("year", "", new { @class = "l-text" })</td>
</tr>
</table>
<div id="maingrid"></div>
</div>
<div position="center" title="明细(双击增删)">
<div id="maingrid2"></div>
</div>
</div>
@using Newtonsoft.Json;
@section scripts{
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
<script type="text/javascript">
//js对象深度克隆
var deepCopy = function (source) {
var result = {};
for (var key in source) {
result[key] = typeof source[key] === 'object' ? deepCopy(source[key]) : source[key];
}
return result;
}
function fun_date(days) {
var date1 = new Date(),
time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();//time1表示当前时间
var date2 = new Date(date1);
date2.setDate(date1.getDate() + days);
var y = date2.getFullYear();
var m = date2.getMonth() + 1;
m = m < 10 ? '0' + m : m;
var d = date2.getDate();
d = d < 10 ? ('0' + d) : d;
var time2 = y + "-" + m + "-" + d;
return time2;
}
$(function () {
$("#layout1").ligerLayout({ leftWidth: 390, topHeight: 130 });
$("#start").ligerDateEditor();
$("#end").ligerDateEditor();
//$("#start").ligerGetDateEditorManager().setValue(fun_date(-10));
//$("#end").ligerGetDateEditorManager().setValue(fun_date(0));
$("#search").click(function () {
liger.get("maingrid").set("parms", { start: $("#start").val(), end: $("#end").val(), sqr: $("#sqr").val(), ksid: $("#ksid").val(), year: $("#year").val() });
liger.get("maingrid").changePage("first");
liger.get("maingrid").reload();
})
function save() {
liger.get("maingrid2").endEdit();
var rows = liger.get("maingrid2").getData();
var items = "";
for (var i in rows) {
if (rows[i].syje > 0) {
items += +rows[i].id + "|" + rows[i].syje + ",";
}
}
if (items == "") {
$.ligerDialog.error("请维护使用金额!");
return;
}
if (window.parent.selectedYSBX) {
window.parent.selectedYSBX(items);
}
}
$("#maingrid").ligerGrid({
height: '100%',
columns: [
//{ display: '编号', name: 'id', align: 'left', width: 60 },
//{ display: "经费类别", name: "jflbmc", align: "left", width: 100 },
{ display: "经费名称", name: "jfmc", align: "left", width: 100 },
{ display: "科目名称", name: "kmmc", align: "left", width: 100 },
{
display: "预算金额", name: "dj", align: "right", width: 80, totalSummary: {
render: function (suminf, column) {
return "<span style='color:red'>合计:" + suminf.sum + "</span>";
}
}
},
{
display: "已用金额", name: "yyje", align: "right", width: 80, totalSummary: {
render: function (suminf, column) {
return "<span style='color:red'>合计:" + suminf.sum + "</span>";
}
}
},
{
display: "剩余金额", name: "syje2", align: "right", width: 80, totalSummary: {
render: function (suminf, column) {
return "<span style='color:red'>合计:" + suminf.sum + "</span>";
}
}
},
//{ display: "使用金额", name: "syje", align: "right", width: 70, type: 'float', editor: { type: 'float' } },
//{ display: '申请单号', name: 'sqdh', align: 'left', width: 90 },
//{ display: '申请科室', name: 'ksmc', align: 'left', width: 80 },
//{ display: '申请人', name: 'sqr', align: 'left', width: 80 },
{ display: '预算年份', name: 'year', align: 'left', width: 80 },
{ display: '测算依据', name: 'csyj', align: 'left', width: 160 },
{ display: '项目内容', name: 'xmnr', align: 'left', width: 160 },
{ display: '项目目标', name: 'xmmb', align: 'left', width: 160 }
//{ display: '预算金额', name: 'je', align: 'right', width: 60 },
//{ display: '申请时间', name: 'sqsj', width: 150 },
//{ display: '备注', name: 'bz', align: 'left', width: 200 },
//{
// display: '状态', name: 'zt', width: 110, render: function (r, i, v) {
// switch (v) {
// case 1: return "等待科室领导审批";
// case 2: return "等待分管领导审批";
// case 3: return "等待内审领导审批";
// case 4: return "等待所有会签审批";
// case 5: return "等待备案领导审批";
// case 6: return "等待财务领导审批";
// case 7: return "等待中心领导审批";
// case 8: return "审核完成";
// case -1: return "科室领导驳回";
// case -2: return "分管领导驳回";
// case -3: return "内审领导驳回";
// case -4: return "会签驳回";
// case -5: return "备案领导驳回";
// case -6: return "财务领导驳回";
// case -7: return "中心领导驳回";
// }
// }
//}
],
url: "@Url.Action("getSqysbxPage")?have=true",
pageSize: 10,
rownumbers: true,
usePager: false,
enabledEdit: true,
heightDiff: -20,
onAfterEdit: function (e) {
if (e.value > (e.record.dj - e.record.yyje)) {
$.ligerDialog.error("超出剩余金额!");
liger.get("maingrid").updateCell("syje", (e.record.dj - e.record.yyje), e.rowindex);
}
},
onDblClickRow: function (rowdata, rowid, rowobj) {
liger.get("maingrid").remove(rowdata);
var rows = liger.get("maingrid2").getData();
for (var i in rows) {
if (rows[i].id == rowdata.id)
return;
}
var rd = deepCopy(rowdata);
liger.get("maingrid2").add(rd);
}
});
$("#maingrid2").ligerGrid({
height: '100%',
columns: [
//{ display: '编号', name: 'id', align: 'left', width: 60 },
//{ display: "经费类别", name: "jflbmc", align: "left", width: 100 },
{ display: "经费名称", name: "jfmc", align: "left", width: 100 },
{ display: "科目名称", name: "kmmc", align: "left", width: 100 },
//{
// display: "预算金额", name: "dj", align: "right", width: 80, totalSummary: {
// render: function (suminf, column) {
// return "<span style='color:red'>合计:" + suminf.sum + "</span>";
// }
// }
//},
//{
// display: "已用金额", name: "yyje", align: "right", width: 80, totalSummary: {
// render: function (suminf, column) {
// return "<span style='color:red'>合计:" + suminf.sum + "</span>";
// }
// }
//},
{
display: "剩余金额", name: "syje2", align: "right", width: 80, totalSummary: {
render: function (suminf, column) {
return "<span style='color:red'>合计:" + suminf.sum + "</span>";
}
}
},
{
display: "使用金额", name: "syje", align: "right", width: 70, type: 'float', editor: { type: 'float', initSelect: true }, totalSummary: {
render: function (suminf, column) {
return "<span style='color:red'>合计:" + suminf.sum + "</span>";
}
}
},
//{ display: '申请单号', name: 'sqdh', align: 'left', width: 90 },
//{ display: '申请科室', name: 'ksmc', align: 'left', width: 80 },
//{ display: '申请人', name: 'sqr', align: 'left', width: 80 },
//{ display: '预算年份', name: 'year', align: 'left', width: 80 }
//{ display: '预算金额', name: 'je', align: 'right', width: 60 },
//{ display: '申请时间', name: 'sqsj', width: 150 },
//{ display: '备注', name: 'bz', align: 'left', width: 200 },
//{
// display: '状态', name: 'zt', width: 110, render: function (r, i, v) {
// switch (v) {
// case 1: return "等待科室领导审批";
// case 2: return "等待分管领导审批";
// case 3: return "等待内审领导审批";
// case 4: return "等待所有会签审批";
// case 5: return "等待备案领导审批";
// case 6: return "等待财务领导审批";
// case 7: return "等待中心领导审批";
// case 8: return "审核完成";
// case -1: return "科室领导驳回";
// case -2: return "分管领导驳回";
// case -3: return "内审领导驳回";
// case -4: return "会签驳回";
// case -5: return "备案领导驳回";
// case -6: return "财务领导驳回";
// case -7: return "中心领导驳回";
// }
// }
//}
],
//url: "@Url.Action("getSqysbxPage")?have=true",
pageSize: 10,
rownumbers: true,
usePager: false,
enabledEdit: true,
heightDiff: -20,
toolbar: {
items: [
{ text: '保存', click: save, icon: 'save' }
]
},
onAfterEdit: function (e) {
if (e.value > (e.record.dj - e.record.yyje)) {
$.ligerDialog.error("超出剩余金额!");
liger.get("maingrid2").updateCell("syje", (e.record.dj - e.record.yyje), e.rowindex);
}
},
onDblClickRow: function (rowdata, rowid, rowobj) {
liger.get("maingrid2").remove(rowdata);
var rows = liger.get("maingrid").getData();
for (var i in rows) {
if (rows[i].id == rowdata.id)
return;
}
var rd = deepCopy(rowdata);
liger.get("maingrid").add(rd);
}
});
});
</script>
}