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

190 lines
7.5 KiB
Plaintext

@model dccdc.Models.JiezhongmianyitiaomaModel
@{
ViewBag.Title = "疫苗接种条码打印";
}
<form id="editform">
<input id="id" type="hidden" name="id" value="0" />
<table class="t1" style="width:600px">
<tr>
<td class="ltd" width="100px">儿童编码:</td>
<td class="rtd"><input id="idbarcode" class="l-text" name="barcode" onkeydown="searchdjxx(event,this)" /></td>
</tr>
<tr>
<td class="ltd" width="100px">姓名:</td>
<td class="rtd"><input id="idusername" class="l-text" name="username" /></td>
</tr>
<tr>
<td class="ltd" width="100px">手机号:</td>
<td class="rtd"><input id="idsjh" class="l-text" name="sjh" /></td>
</tr>
<tr>
<td class="ltd" width="100px">出生日期:</td>
<td class="rtd">@Html.TextBoxFor(m => m.csrq, new { @id = "idcsrq", @class = "l-text" })@Html.ValidationMessageFor(m => m.csrq)</td>
</tr>
<tr>
<td class="ltd" width="100px">进度:</td>
<td class="rtd">@Html.DropDownList("jdid", ViewBag.jdList as SelectList, "----请选择----")</td>
</tr>
<tr>
<td></td>
<td class="rtd" width="100px"><input id="save" class="l-button" value="打印" onclick="saveandprint();"></td>
</tr>
</table>
</form>
<div class="dispReport">
<object classid="clsid:F6A015E2-092A-4006-93DA-4CBDE3AFF4B8" id="window.top.Formium.external.Print" width="300" height="50"></object>
</div>
@section scripts{
<script src="@Url.Content("~/Scripts/public.js")"></script>
<script type="text/javascript">
var idid = "";
var viewno = "";
var flag = false;
function searchdjxx(e, o) {
var keynum
var keychar
var numcheck
if (window.event) // IE
{
keynum = e.keyCode
}
else if (e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}
if (keynum == 13) {
var num = $(o).val();
$.ajax({
type: "post",
url: "@Url.Action("getJZMYTM")?id=" + $("#idbarcode").val(),
dataType: "json"
, success: function (data) {
if (data.obj != "") {
$("#idusername").val(data.obj.username);
$("#idusername").attr('disabled', true);
$("#idsjh").val(data.obj.sjh);
//$("#idsjh").attr('disabled', true);
debugger;
idid = data.obj.id;
var d = formatDate(data.obj.csrq);
$("#idcsrq").val(d);
$("#jdid").val(data.obj.jdid);
flag = true;
} else {
$("#idusername").attr('disabled', false);
flag = false;
}
$("#idusername").focus();
},
error: function (err) {
$.ligerDialog.error(err.responseText);
}
});
}
}
$(function () {
debugger;
$("#idcsrq").ligerDateEditor({ width: 100, format: "yyyy-MM-dd", showTime: true });
viewno = '@ViewBag.viewno';
idid = '@ViewData["id"]';
var barcode = '@ViewData["barcode"]';
var username = '@ViewData["username"]';
var sjh = '@ViewData["sjh"]';
var csrq = '@ViewData["csrq"]';
var jdid = '@ViewData["jdid"]';
$("#save").val('@ViewData["save"]');
if (idid != undefined && idid != null && idid != "") {
$("#idbarcode").val(barcode);
$("#idusername").val(username);
$("#idsjh").val(sjh);
$("#idcsrq").val(formatDate(csrq));
$("#jdid").val(jdid);
$("#idbarcode").attr('disabled', true);
flag = true;
}
});
function saveandprint() {
if ($("#idbarcode").val() == "" || $("#idusername").val() == "") {
$.ligerDialog.error("条码和姓名必须维护!");
return;
}
if ($("#idsjh").val() == "" || $("#idjd").val() == "") {
$.ligerDialog.error("电话和疫苗进度必须维护!");
return;
}
if ($("#idcsrq").val() == "") {
$.ligerDialog.error("出生日期必须维护!");
return;
}
@*if (flag) {
var url = "@(Request.Url.Scheme + "://" + Request.Url.Authority + Url.Content("~/"))";
try {
if (window.top.Formium.external.Print.finit( "ymbarcode.frx")) {
window.top.Formium.external.Print.PrintJZMYTM($("#idbarcode").val(), $("#idusername").val());
}
}
catch (e) {
$.ligerDialog.alert(e.message);
}
} else {*@
$.ajax({
type: "post",
url: "@Url.Action("saveJZMYTM")",
dataType: "json"
, data: { id: idid, barcode: $("#idbarcode").val(), username: $("#idusername").val(), sjh: $("#idsjh").val(), csrq: $("#idcsrq").val(), jdid: $("#jdid").val() }
, success: function (data) {
debugger
var url = "@(Request.Url.Scheme + "://" + Request.Url.Authority + Url.Content("~/"))";
if (data.f.Message == "添加成功!") {
try {
if (window.top.Formium.external.Print.finit( "ymbarcode.frx")) {
window.top.Formium.external.Print.PrintJZMYTM($("#idbarcode").val(), $("#idusername").val());
}
}
catch (e) {
$.ligerDialog.alert(e.message);
}
} else if (data.f.Message == "修改成功!") {
$.ligerMessageBox.confirm("是否补打条码", "接种疫苗条码修改成功!是否需要补打条码?", function (r) {
if (r) {
try {
if (window.top.Formium.external.Print.finit( "ymbarcode.frx")) {
window.top.Formium.external.Print.PrintJZMYTM($("#idbarcode").val(), $("#idusername").val());
}
}
catch (e) {
$.ligerDialog.alert(e.message);
}
}
});
} else {
$.ligerMessageBox.alert({ title: '错误', content: '操作失败!' });
}
if(viewno=="2")
{
window.parent.chooseComplete(idid,1);
}
},
error: function (err) {
$.ligerDialog.error(err.responseText);
}
});
// }
}
</script>
}