282 lines
11 KiB
Plaintext
282 lines
11 KiB
Plaintext
|
|
|
|||
|
|
@{
|
|||
|
|
ViewBag.Title = "sqwzcgMessage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@model dccdc.Models.sqwzcgModel
|
|||
|
|
@section scripts{
|
|||
|
|
<script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
$(function () {
|
|||
|
|
$("#layout1").ligerLayout({ leftWidth: 300, topHeight: 130 });
|
|||
|
|
$("#sqsj").ligerDateEditor({ format: "yyyy/MM/dd hh:mm:ss", showTime: true });
|
|||
|
|
//$("#sqsj").ligerGetDateEditorManager().setValue(fun_date(0));
|
|||
|
|
|
|||
|
|
$("#fyly2").change(function () {
|
|||
|
|
if ($("#fyly2").prop("checked") == false && $("#fydh").val()) {
|
|||
|
|
$.ligerDialog.error("存在项目经费申请单,不能取消选择!");
|
|||
|
|
$("#fyly2").prop("checked", true);
|
|||
|
|
message(1);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($("#fyly2").prop("checked") == true) {
|
|||
|
|
message(1);
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
$("#je").blur(function () {
|
|||
|
|
if ($("#je").val() >= 5000) {
|
|||
|
|
message(2)
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
$("#btSelect").click(function () {
|
|||
|
|
liger.get("grid1").set("parms", { key: $("#wzmc").val(), key1: $("#wzlb").val() });
|
|||
|
|
liger.get("grid1").reload();
|
|||
|
|
});
|
|||
|
|
$("#wzmc").keydown(function (e) {
|
|||
|
|
var curKey = e.which;
|
|||
|
|
if (curKey == 13) {
|
|||
|
|
liger.get("grid1").set("parms", { key: $("#wzmc").val(), key1: $("#wzlb").val() });
|
|||
|
|
liger.get("grid1").reload();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#grid1").ligerGrid({
|
|||
|
|
height: "100%",
|
|||
|
|
columns: [
|
|||
|
|
{ display: "物资名称", name: "mc", align: "left", width: 100 },
|
|||
|
|
{ display: "规格型号", name: "ggxh", align: "left", width: 60 },
|
|||
|
|
{ display: "单位", name: "jldw", align: "left", width: 60 },
|
|||
|
|
{ display: "单价", name: "dj", align: "right", width: 60 }
|
|||
|
|
],
|
|||
|
|
url: "@Url.Action("getWzsqMx")",
|
|||
|
|
rownumber: true,
|
|||
|
|
usePager: false,
|
|||
|
|
onDblClickRow: function (rowdata, rowid, rowobj) {
|
|||
|
|
//liger.get("grid1").remove(rowdata);
|
|||
|
|
|
|||
|
|
var rows = liger.get("grid2").getData();
|
|||
|
|
for (var i in rows) {
|
|||
|
|
if (rows[i].id == rowdata.id)
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//添加数量
|
|||
|
|
if (rowdata.sl == undefined || rowdata.sl == 0)
|
|||
|
|
rowdata.sl = 1;
|
|||
|
|
var rd = deepCopy(rowdata);
|
|||
|
|
//rd.sl = "";
|
|||
|
|
liger.get("grid2").add(rd);
|
|||
|
|
//计算
|
|||
|
|
sum();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#grid2").ligerGrid({
|
|||
|
|
height: "100%",
|
|||
|
|
columns: [
|
|||
|
|
{ display: "id", name: "id", align: "left", width: 40 },
|
|||
|
|
{ display: "物资名称", name: "mc", align: "left", width: 200 },
|
|||
|
|
{ display: "规格型号", name: "ggxh", align: "left", width: 60 },
|
|||
|
|
{ display: "单位", name: "jldw", align: "left", width: 60 },
|
|||
|
|
//{ display: "单价", name: "dj", align: "right", width: 60, type: 'float', editor: { type: 'float' } },
|
|||
|
|
{ display: "数量", name: "sl", align: "right", width: 60, type: 'text', editor: { type: 'float' } }
|
|||
|
|
//{ display: "金额", align: "right", width: 100, render: function (r, i, v) { return (r.sl * r.dj).toFixed(2) } }
|
|||
|
|
],
|
|||
|
|
url: "@Url.Action("getWzsqMx")?key=0000000&id=@Request.QueryString["id"]",
|
|||
|
|
rownumber: true,
|
|||
|
|
usePager: false,
|
|||
|
|
enabledEdit: true,
|
|||
|
|
onDblClickRow: function (rowdata, rowid, rowobj) {
|
|||
|
|
liger.get("grid2").remove(rowdata);
|
|||
|
|
//计算
|
|||
|
|
sum();
|
|||
|
|
|
|||
|
|
var rows = liger.get("grid1").getData();
|
|||
|
|
for (var i in rows) {
|
|||
|
|
if (rows[i].id == rowdata.id)
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
liger.get("grid1").add(rowdata);
|
|||
|
|
},
|
|||
|
|
onAfterEdit: function (e) {
|
|||
|
|
//计算
|
|||
|
|
sum();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
function message(type) {
|
|||
|
|
var title = "";
|
|||
|
|
var url = "";
|
|||
|
|
if (type == 1) {
|
|||
|
|
title = "项目经费申请内容";
|
|||
|
|
url = "@Url.Action("sqMessage", "sq2")?type=@Request.QueryString["type"]&del=1&id=" + $("#fydh").val();
|
|||
|
|
}
|
|||
|
|
if (type == 2) {
|
|||
|
|
title = "三重一大申请内容";
|
|||
|
|
url = "@Url.Action("szyd_zjsysqMessage", "sq2")?type=@Request.QueryString["type"]&del=1&id=" + $("#fydh2").val();
|
|||
|
|
}
|
|||
|
|
openf2 = $.ligerDialog.open({
|
|||
|
|
title: title,
|
|||
|
|
url: url,
|
|||
|
|
width: 720,
|
|||
|
|
height: 330
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
//弹出框选中
|
|||
|
|
function selectedData(type, sqdh, rowdatas) {
|
|||
|
|
if (type == "xmjf")
|
|||
|
|
$("#fydh").val(sqdh);
|
|||
|
|
if (type == "szyd")
|
|||
|
|
$("#fydh2").val(sqdh);
|
|||
|
|
|
|||
|
|
openf2.close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function sum() {
|
|||
|
|
var rows = liger.get("grid2").getData();
|
|||
|
|
var result = 0;
|
|||
|
|
for (var i in rows) {
|
|||
|
|
result += rows[i].dj * rows[i].sl;
|
|||
|
|
}
|
|||
|
|
//$("#je").val(result.toFixed(2));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function save() {
|
|||
|
|
liger.get("grid2").endEdit();
|
|||
|
|
var rows = liger.get("grid2").getData();
|
|||
|
|
if (rows.length == 0) {
|
|||
|
|
$.ligerDialog.error("请添加物资项目!")
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var id = $("#id").val();
|
|||
|
|
var je = $("#je").val();
|
|||
|
|
var bz = $("#bz").val();
|
|||
|
|
//var jfly = $("#jflyid option:checked").text();
|
|||
|
|
var fyly1 = $("#fyly1:checked").val();
|
|||
|
|
var fyly2 = $("#fyly2:checked").val();
|
|||
|
|
var fyly = "";
|
|||
|
|
var fydh = $("#fydh").val();
|
|||
|
|
var fydh2 = $("#fydh2").val();
|
|||
|
|
if (!je) {
|
|||
|
|
$.ligerDialog.error("请填写详细信息!")
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (je >= 5000) {
|
|||
|
|
if (fydh2 == "") {
|
|||
|
|
$.ligerDialog.error("金额超过5000与三重一大添加不一致!")
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
if (fydh2 != "") {
|
|||
|
|
$.ligerDialog.error("金额超过5000与三重一大添加不一致!")
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var items = "";
|
|||
|
|
for (var i in rows) {
|
|||
|
|
items += rows[i].id + "|" + rows[i].mc + "|" + rows[i].ggxh + "|" + rows[i].jldw + "|" + rows[i].dj + "|" + rows[i].sl + ",";
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
url: "@Url.Action("savesqwzcg")", type: "post", dataType: "json", data: { id: id, je: je, fyly1: fyly1, fyly2: fyly2, fyly: fyly, fydh: fydh, fydh2: fydh2, bz: bz, items: items },
|
|||
|
|
success: function (d) {
|
|||
|
|
$.ligerDialog.closeWaitting();
|
|||
|
|
if (d.State == "0") {
|
|||
|
|
$.ligerDialog.error("操作失败!");
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
parent.init();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
beforeSend: function () {
|
|||
|
|
$.ligerDialog.waitting("正在进行请稍后……");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
<div class="l-clear"></div>
|
|||
|
|
<div id="layout1">
|
|||
|
|
<div position="left">
|
|||
|
|
<table class="t1" style="width:100%">
|
|||
|
|
<tr>
|
|||
|
|
<td class="ltd" width="70px">物资类别</td>
|
|||
|
|
<td class="rtd">@Html.DropDownList("wzlb", ViewBag.wzlbD as SelectList, "----请选择----", new { @class = "l-text" })</td>
|
|||
|
|
<td class="rtd" rowspan="2"><input type="button" id="btSelect" value="查询" class="l-button" style="height:46px" /></td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td class="ltd" width="70px">物资名称</td>
|
|||
|
|
<td class="rtd">@Html.TextBox("wzmc", "", new { @class = "l-text" })</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
<div id="grid1"></div>
|
|||
|
|
</div>
|
|||
|
|
<div position="center" title="物资(双击增删)">
|
|||
|
|
<div id="grid2"></div>
|
|||
|
|
</div>
|
|||
|
|
<div position="top">
|
|||
|
|
@Html.HiddenFor(m => m.id)
|
|||
|
|
@Html.HiddenFor(m => m.fydh)
|
|||
|
|
@Html.HiddenFor(m => m.fydh2)
|
|||
|
|
<table class="t1" style="width:100%">
|
|||
|
|
<tr>
|
|||
|
|
<td class="ltd" width="70px">申请科室</td>
|
|||
|
|
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.ksmc, new { @class = "l-text", @readonly = "readonly" })</td>
|
|||
|
|
<td class="ltd" width="70px">申请人</td>
|
|||
|
|
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.sqr, new { @class = "l-text", @readonly = "readonly" })</td>
|
|||
|
|
<td class="ltd" width="70px">申请日期</td>
|
|||
|
|
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.sqsj, new { @class = "l-text", @readonly = "readonly" })</td>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td class="ltd" width="70px">费用来源</td>
|
|||
|
|
<td class="rtd" width="150px">
|
|||
|
|
@Html.CheckBoxFor(m => m.fyly1)自有资金 @Html.CheckBoxFor(m => m.fyly2)项目经费
|
|||
|
|
</td>
|
|||
|
|
<td class="ltd" width="70px">申请状态</td>
|
|||
|
|
<td class="rtd" width="150px">@Html.DropDownListFor(m => m.zt, ViewBag.ztD as SelectList, "----请选择----", new { @class = "l-text", @disabled = "disabled" })</td>
|
|||
|
|
<td class="ltd" width="70px">申请金额</td>
|
|||
|
|
<td class="rtd" width="150px">@Html.TextBoxFor(m => m.je, new { @class = "l-text l-text-field-number", @type = "number" })</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<td class="ltd" width="70px">备注说明</td>
|
|||
|
|
<td class="rtd" width="370px" colspan="3">@Html.TextAreaFor(m => m.bz, new { cols="60", rows = "2" })</td>
|
|||
|
|
<td class="ltd" width="70px"></td>
|
|||
|
|
<td class="rtd" width="150px"><input type="@Request.QueryString["type"]" value="申请" style="height:50px" class="l-button" onclick="save()" /></td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div style="display:none;"></div>
|