tijian_tieying/web/dccdc/Views/Registration/ExamItems.cshtml

144 lines
5.8 KiB
Plaintext
Raw Normal View History

2025-02-20 12:14:39 +08:00

@section scripts{
<script type="text/javascript">
$(function () {
var info = "&nbsp&nbsp体检编号@ViewBag.physical_num&nbsp&nbsp姓名@ViewBag.name";
var d = $("#tjxm").ligerGrid({
title: "体检项目" + info,
data: {},
columns: [
{ name: "project_id", display: "项目编号", width: 60, align: "left" },
{ name: "project_name", display: "项目名称", width: 180, align: "left" },
{ name: "exam_group", display: "归属小组", width: 180, align: "left" },
{ name: "standard_value", display: "参考值", width: 180, align: "left" }
],
width: "98%",
height: "100%",
onAfterShowData: function(currow) {
var tjxms = "";
for (var i = 0; i < currow.Rows.length; i++) {
tjxms += currow.Rows[i].project_id + ",";
}
parentdata = currow;
var project = "";
for (var j = 0; j < currow.Rows.length; j++) {
project += currow.Rows[j].id + ",";
}
},
rownumbers: false,
fixedCellHeight: false,
toolbar: {
items: [
{
text: '修改体检项目',
click: sfxmAdd,
icon: 'modify'
}
]
},
usePager: false,
checkbox: false
});
//根据体检项目id获取所有体检项目
liger.get("tjxm").set("parms", { "ids": "@ViewBag.ids" });
liger.get("tjxm").set("url", '@Url.Action("GettjxmByIDs")');
});
//修改体检项目
function sfxmAdd() {
tjxmadd = $.ligerDialog.open({
url: '@Url.Action("TjxmSel", "Dictionaries")?strSex='+"@ViewBag.sex",
width: 1200,
height: 600,
title: "修改体检项目"
});
}
//修改体检项目后调用
function Tjxminit(data) {
//新增项目
var add = [];
//项目id集
var idss = "";
//删除项目
var del = [];
for (var j = 0; j < data.length; j++) {
add.push(data[j]);
idss += data[j].id + ",";
}
var idssArr = idss.split(',');
//原始项目集
var pre = liger.get("tjxm").data.Rows;
//筛选出删除、增加的项目
for (var i = pre.length - 1; i >= 0; i--) {
if (!idssArr.includes(pre[i].id)) {
del.push(pre[i]);
}
add = add.filter(item => item.project_id != pre[i].project_id)
}
if (@ViewBag.physical_num == null) {
//体检人员已导入,未登记
//增删项目只更新职业导入表的check_item_ids即可
$.ajax({
url: '@Url.Action("updateImportItems")',
type: 'Post',
chche: false,
dataType: 'json',
data: { ids: idss,id: @ViewBag.person_id}, //发送服务器数据
success: function (data1) { //成功事件
if (!data1.code) {
alert("更新失败请重新设置!");
liger.get("tjxm").set("parms", { "ids": "@ViewBag.ids" });
liger.get("tjxm").set("url", '@Url.Action("GettjxmByIDs")');
return;
}
}
});
}
else {
//体检人员已登记
//删除项目需要更新登记表的check_item_ids删除process过程表、result结果表的记录
//增加项目需要更新登记表的check_item_ids,增加process过程表、result结果表的记录
$.ajax({
url: '@Url.Action("updateRegItems")',
type: 'Post',
chche: false,
dataType: 'json',
data: { ids: idss, id: @ViewBag.person_id, del: del, add: add, physical_num:@ViewBag.physical_num}, //发送服务器数据
success: function (data1) { //成功事件
if (!data1.code) {
alert("更新失败请重新设置!");
liger.get("tjxm").set("parms", { "ids": "@ViewBag.ids" });
liger.get("tjxm").set("url", '@Url.Action("GettjxmByIDs")');
return;
}
}
});
}
//重新获取体检项目列表
liger.get("tjxm").set("parms", { "ids": idss });
liger.get("tjxm").set("url", '@Url.Action("GettjxmByIDs")');
tjxmadd.close();
parent.reloadpage();
}
</script>
}
<body>
@* <a href="#" onclick="self.location=document.referrer;">
<img src="../../images/Button/BtnExit.jpg">
</a> *@
<div id="tjxm">
</div>
</body>