462 lines
19 KiB
Plaintext
462 lines
19 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">
|
||
var openf2;
|
||
var wzD;
|
||
$(function () {
|
||
$("#layout1").ligerLayout({ topHeight: 120 });
|
||
$("#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 (!$("#ymcg:checked").val()) {
|
||
if ($("#je").val() >= 10000 && !$("#fydh2").val()) {
|
||
message(2)
|
||
}
|
||
}
|
||
})
|
||
$("#je").dblclick(function () {
|
||
if (!$("#ymcg:checked").val()) {
|
||
if ($("#je").val() >= 10000) {
|
||
message(2)
|
||
}
|
||
}
|
||
})
|
||
|
||
wzD = @Html.Raw(ViewBag.wzD);
|
||
var wz2D = [];
|
||
$("#grid2").ligerGrid({
|
||
height: "100%",
|
||
columns: [
|
||
{
|
||
display: "", name: "", align: "left", width: 35,
|
||
render: function () {
|
||
return "<div onclick='add(1)' style='text-align:center'><img src='@Url.Content("~/Content/jingfei/b_jia.png")'><div>";
|
||
}
|
||
},
|
||
{
|
||
display: "名称搜索", name: "", align: "left", width: 80, type: 'string',
|
||
editor: {
|
||
type: 'select', data: null, valueField: 'id', textField: 'mc',
|
||
autocomplete: true,
|
||
keySupport: true,
|
||
selectBoxWidth: 300,
|
||
autocomplete: function (e) {
|
||
wz2D = [];
|
||
if (e.key != "") {
|
||
for (var i in wzD) {
|
||
if (wzD[i].mc.indexOf(e.key) != -1) {
|
||
wz2D.push(deepCopy(wzD[i]));
|
||
}
|
||
}
|
||
|
||
if (wz2D.length == 0) {
|
||
if (confirm("确定打开物资添加窗口") == true) {
|
||
wz();
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
for (var i in wz2D) {
|
||
wz2D[i].mc = wz2D[i].mc + " 【" + (Object.prototype.toString.call(wz2D[i].ggxh) === '[object Object]' ? '' : wz2D[i].ggxh) + " " + (Object.prototype.toString.call(wz2D[i].dj) === '[object Object]' ? '' : '$' + wz2D[i].dj) + "】";
|
||
}
|
||
console.log(wz2D);
|
||
this.setData(wz2D);
|
||
|
||
e.show();
|
||
},
|
||
onSelected: function (value, text) {
|
||
for (var i in wzD) {
|
||
if (wzD[i].id == value) {
|
||
var rowindex = liger.get("grid2").getSelected();
|
||
liger.get("grid2").updateCell("id", wzD[i].id, rowindex)
|
||
liger.get("grid2").updateCell("mc", wzD[i].mc, rowindex)
|
||
liger.get("grid2").updateCell("ggxh", wzD[i].ggxh, rowindex)
|
||
liger.get("grid2").updateCell("jldw", wzD[i].jldw, rowindex)
|
||
liger.get("grid2").updateCell("sl", 1, rowindex)
|
||
liger.get("grid2").updateCell("dj", wzD[i].dj, rowindex)
|
||
liger.get("grid2").endEdit();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{ display: "编码", name: "id", align: "left", width: 80 },
|
||
{ display: "物资名称", name: "mc", align: "left", width: 236 },
|
||
{ display: "规格型号", name: "ggxh", align: "left", width: 80 },
|
||
{ display: "计量单位", name: "jldw", align: "left", width: 80 },
|
||
{ display: "单价", name: "dj", align: "right", width: 60, type: 'float', id: 'dj' }, //要进行隐藏的列,注意必须为该列设置id
|
||
{ display: "数量", name: "sl", align: "right", width: 60, type: 'text', editor: { type: 'float', initSelect: true } },
|
||
//{ display: "金额", align: "right", width: 100, render: function (r, i, v) { return (r.sl * r.dj).toFixed(2) } }
|
||
{
|
||
display: "", name: "", align: "left", width: 35,
|
||
render: function () {
|
||
return "<div onclick='sub(this)' style='text-align:center'><img src='@Url.Content("~/Content/jingfei/b_jian.png")'><div>";
|
||
}
|
||
}
|
||
],
|
||
url: "@Url.Action("getWzsqMx")?key=0000000&id=@Request.QueryString["id"]",
|
||
rownumber: true,
|
||
usePager: false,
|
||
enabledEdit: true,
|
||
heightDiff: -27,
|
||
//toolbar: {
|
||
// items: [
|
||
// { text: '增加', click: function () { add(1) }, icon: 'add' },
|
||
// { line: true },
|
||
// { text: '维护项目经费', click: function () { message(1) }, icon: 'modify' },
|
||
// { line: true },
|
||
// { text: '维护三重一大', click: function () { message(2) }, icon: 'modify' }
|
||
// ]
|
||
//},
|
||
//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();
|
||
}
|
||
});
|
||
liger.get("grid2").toggleCol('dj', false);//隐藏id=dj的列
|
||
|
||
//添加时补齐6行 要等grid加载完 add才有效 延迟一会
|
||
//liger grid 就onloaded事件好用 但是这个事件 弹出加载中 不会消失
|
||
if (!GetQueryString("id")) {
|
||
setTimeout(function () { add(6) }, 500);
|
||
}
|
||
})
|
||
|
||
function add(count) {
|
||
if (count <= 0) {
|
||
return;
|
||
}
|
||
var rowdata = {};
|
||
rowdata.id = "";
|
||
rowdata.mc = "";
|
||
rowdata.ggxh = "";
|
||
rowdata.jldw = "";
|
||
rowdata.dj = 0;
|
||
rowdata.sl = 0;
|
||
|
||
liger.get("grid2").add(rowdata);
|
||
add(--count)
|
||
}
|
||
function sub(e) {
|
||
var rowindex = e.parentNode.parentNode.parentNode.rowIndex;
|
||
if (rowindex >= 6) {
|
||
var r = liger.get("grid2").getRow(rowindex);
|
||
liger.get("grid2").remove(r);
|
||
}
|
||
else {
|
||
liger.get("grid2").updateCell("id", "", rowindex)
|
||
liger.get("grid2").updateCell("mc", "", rowindex)
|
||
liger.get("grid2").updateCell("ggxh", "", rowindex)
|
||
liger.get("grid2").updateCell("jldw", "", rowindex)
|
||
liger.get("grid2").updateCell("sl", 0, rowindex)
|
||
liger.get("grid2").updateCell("dj", 0, rowindex)
|
||
}
|
||
|
||
//计算
|
||
sum();
|
||
}
|
||
function message(type) {
|
||
var title = "";
|
||
var url = "";
|
||
if (type == 1) {
|
||
title = "项目经费申请内容";
|
||
url = "@Url.Action("sqMessageNew", "sq2")?type=@Request.QueryString["type"]&del=1&id=" + $("#fydh").val();
|
||
}
|
||
if (type == 2) {
|
||
title = "三重一大申请内容";
|
||
url = "@Url.Action("szyd_zjsysqMessageNew", "sq2")?type=@Request.QueryString["type"]&del=1&id=" + $("#fydh2").val() + "&je=" + $("#je").val();
|
||
}
|
||
openf2 = $.ligerDialog.open({
|
||
title: title,
|
||
url: url,
|
||
width: 760,
|
||
height: 450
|
||
});
|
||
//window.open(url);
|
||
}
|
||
//弹出框选中
|
||
function selectedData(type, sqdh, rowdatas) {
|
||
if (type == "xmjf")
|
||
$("#fydh").val(sqdh);
|
||
if (type == "szyd")
|
||
$("#fydh2").val(sqdh);
|
||
|
||
if (openf2)
|
||
openf2.close();
|
||
}
|
||
function message2(type) {
|
||
openf2 = $.ligerDialog.open({
|
||
title: "选择已有项目经费",
|
||
url: "@Url.Action("sqjfcx2", "sq2")?type=@Request.QueryString["type"]&fydhs=" + $("#fydhs").val(),
|
||
width: 760,
|
||
height: 450
|
||
});
|
||
//window.open(url);
|
||
}
|
||
//弹出框选中
|
||
function selectedXZYYXMJF(fydhs) {
|
||
$("#fydhs").val(fydhs);
|
||
|
||
if (openf2)
|
||
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));
|
||
|
||
if (!$("#ymcg:checked").val()) {
|
||
if ($("#je").val() >= 20000 && !$("#fydh2").val()) {
|
||
message(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 ymcg = $("#ymcg:checked").val();
|
||
var fyly1 = $("#fyly1:checked").val();
|
||
var fyly2 = $("#fyly2:checked").val();
|
||
var fyly = "";
|
||
var fydh = $("#fydh").val();
|
||
var fydhs = $("#fydhs").val();
|
||
var fydh2 = $("#fydh2").val();
|
||
if (!je) {
|
||
$.ligerDialog.error("金额必填!!")
|
||
return;
|
||
}
|
||
|
||
//疫苗采购 不验证 三重一大
|
||
if (!$("#ymcg:checked").val()) {
|
||
if (je >= 20000) {
|
||
if (fydh2 == "") {
|
||
$.ligerDialog.error("金额超过20000与三重一大添加不一致!")
|
||
return;
|
||
}
|
||
}
|
||
else {
|
||
if (fydh2 != "") {
|
||
$.ligerDialog.error("金额超过20000与三重一大添加不一致!")
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (fyly2) {
|
||
if (fydh == "") {
|
||
$.ligerDialog.error("勾选项目经费必须维护项目经费申请单!")
|
||
return;
|
||
}
|
||
}
|
||
else {
|
||
if (fydh != "") {
|
||
$.ligerDialog.error("维护项目经费申请单必须勾选项目经费!")
|
||
return;
|
||
}
|
||
}
|
||
|
||
var items = "";
|
||
for (var i in rows) {
|
||
if (rows[i].id != "" && rows[i].sl > 0)
|
||
items += rows[i].id + "|" + rows[i].mc + "|" + rows[i].ggxh + "|" + rows[i].jldw + "|" + rows[i].dj + "|" + rows[i].sl + ",";
|
||
}
|
||
if (!items) {
|
||
$.ligerDialog.error("至少维护一条明细!")
|
||
return;
|
||
}
|
||
$.ajax({
|
||
url: "@Url.Action("savesqwzcg")", type: "post", dataType: "json", data: { id: id, je: je, ymcg: ymcg, fyly1: fyly1, fyly2: fyly2, fyly: fyly, fydh: fydh, fydhs: fydhs, fydh2: fydh2, bz: bz, items: items },
|
||
success: function (d) {
|
||
$.ligerDialog.closeWaitting();
|
||
if (d.State == "0") {
|
||
$.ligerDialog.error("操作失败!");
|
||
}
|
||
else {
|
||
$.ligerDialog.success("操作成功!");
|
||
parent.init();
|
||
//window.opener.init();
|
||
//window.opener = null;
|
||
//window.close();
|
||
}
|
||
},
|
||
beforeSend: function () {
|
||
$.ligerDialog.waitting("正在进行请稍后……");
|
||
}
|
||
});
|
||
}
|
||
|
||
function wz() {
|
||
var id = "";
|
||
openf3 = $.ligerDialog.open({
|
||
url: "@Url.Action("wzMessage","wz")?id=" + id,
|
||
title: "增加物资",
|
||
width: 380,
|
||
height: 400
|
||
});
|
||
}
|
||
function init() {
|
||
$.ajax({
|
||
url: "@Url.Action("getwz")", type: "post", dataType: "json",
|
||
data: {},
|
||
success: function (d) {
|
||
$.ligerDialog.closeWaitting();
|
||
wzD = d;
|
||
},
|
||
beforeSend: function () {
|
||
$.ligerDialog.waitting("正在进行请稍后……");
|
||
}
|
||
});
|
||
//openf3.close();
|
||
}
|
||
|
||
//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>
|
||
|
||
<style type="text/css">
|
||
.ltd {
|
||
background-color: white;
|
||
}
|
||
|
||
.t3 .ltd {
|
||
text-align: center;
|
||
}
|
||
|
||
.t2 tr td {
|
||
padding: 5px 0px 5px 10px;
|
||
line-height: 22px;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.t3 tr td {
|
||
border: 1px solid #bebeff;
|
||
padding: 5px 0px 5px 10px;
|
||
line-height: 22px;
|
||
word-break: break-all;
|
||
}
|
||
</style>
|
||
}
|
||
|
||
<div class="l-clear"></div>
|
||
<div style="width:700px; margin:0 auto">
|
||
<div position="top">
|
||
@Html.HiddenFor(m => m.id)
|
||
@Html.HiddenFor(m => m.fydh)
|
||
@Html.HiddenFor(m => m.fydhs)
|
||
@Html.HiddenFor(m => m.fydh2)
|
||
<h3 style="text-align:center;margin:10px 0 10px 0">德城区疾控中心物资采购申请单</h3>
|
||
<table class="t2" style="width:100%" border="0">
|
||
<tr style="display:none">
|
||
<td class="ltd" width="70px">申 请 人:</td>
|
||
<td class="rtd" width="150px">@Html.DisplayFor(m => m.sqr)</td>
|
||
<td class="ltd" width="70px">申请状态:</td>
|
||
<td class="rtd" width="150px">@Html.DropDownListFor(m => m.zt, ViewData["ztD"] as SelectList, "----请选择----", new { @class = "l-text", @disabled = "disabled" })</td>
|
||
<td class="ltd" width="70px">申请日期:</td>
|
||
<td class="rtd" width="150px">@Html.DisplayFor(m => m.sqsj)</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd" width="70px">申 请 人:</td>
|
||
<td class="rtd" width="150px">@Html.DisplayFor(m => m.sqr)</td>
|
||
<td class="ltd" width="70px">疫苗药品:</td>
|
||
<td class="rtd" width="150px" style="color:red">@Html.CheckBoxFor(m => m.ymcg) 跳过三重一大</td>
|
||
<td class="ltd" width="70px"><input type="@Request.QueryString["type"]" readonly="readonly" value="增加物资" class="l-button" onclick="wz()" /></td>
|
||
<td class="rtd" width="150px" style="text-align:right"><input type="@Request.QueryString["type"]" style="width:140px" readonly="readonly" value="选择已有项目经费" class="l-button" onclick="message2()" /></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd" width="70px">申请科室:</td>
|
||
<td class="rtd" width="150px">@Html.DisplayFor(m => m.ksmc)</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", @readonly = "readonly" })*</td>
|
||
<td class="ltd" width="70px">费用来源:</td>
|
||
<td class="rtd" width="150px">@Html.CheckBoxFor(m => m.fyly1)自有资金 @Html.CheckBoxFor(m => m.fyly2)项目经费</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="ltd" width="70px">备注说明:</td>
|
||
<td class="rtd" colspan="5">@Html.TextAreaFor(m => m.bz, new { @rows = "2", @style = "width:100%" })</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div id="layout1">
|
||
<div position="center" title="">
|
||
<div id="grid2"></div>
|
||
</div>
|
||
<div position="bottom">
|
||
<div style="text-align:center;margin-top:10px"><input type="@Request.QueryString["type"]" readonly="readonly" value="申请" class="l-button" onclick="save()" /></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="display:none;"></div>
|