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

267 lines
12 KiB
Plaintext

@{
ViewBag.Title = "问卷调查列表";
}
@model dccdc.Models.InfectionOpenUserInfoModel
<table class="t1" style="width:100%">
<tr>
<td class="ltd" style="width:10%">姓名:</td>
<td class="rtd" style="width:12%"><input id="QuestionnaireListName" class="l-text" /></td>
<td class="ltd" style="width:10%">身份证号:</td>
<td class="rtd" style="width:12%"><input id="QuestionnaireListIdent" class="l-text" /></td>
<td class="rtd"><div id="search">查询</div></td>
</tr>
</table>
<div id="checkQuestionnaireList" style="width:100%"></div>
<table class="t1" style="width:100%">
<tr>
<td class="ltd" style="width:10%">已做问卷(月):</td>
<td class="rtd" style="width:12%"><input id="monthOne" class="l-text" value="@ViewBag.monthOne" readonly /></td>
<td class="ltd" style="width:10%">未做问卷(月):</td>
<td class="rtd" style="width:12%"><input id="monthTwo" class="l-text" value="@ViewBag.monthTwo" readonly /></td>
<td class="ltd" style="width:10%">已做问卷(总):</td>
<td class="rtd" style="width:12%"><input id="allOne" class="l-text" value="@ViewBag.allOne" readonly /></td>
<td class="ltd" style="width:10%">未做问卷(总):</td>
<td class="rtd" style="width:12%"><input id="allTwo" class="l-text" value="@ViewBag.allTwo" readonly /></td>
</tr>
</table>
<div style="display:none">
<iframe id="down" src="about:blank"></iframe>
</div>
@*<div class="l-clear"></div>
<br>
<div style="width:100%">
<ul>
<li>
<a class="l-button" style="width:85px;float:right; margin-right:10%;" onclick="goBack()">返回</a>
</li>
<li>
<a class="l-button" style="width:85px;float:right; margin-right:0px;" onclick="confirm()">确定</a>
</li>
</ul>
</div>
<br>
<br>
<br>
<div style="display:none;">
</div>*@
@*<div id="checkQuestionnaireModify" style="display:none;">
<form id="editform">
<input id="id" type="hidden" name="id" value="0" />
<table class="t1" style="width:100%">
<tr style="display:none"><td class="rtd"><input id="user_id" class="l-text" name="user_id" style="width:220px" type="text" />user_id</td></tr>
<tr>
<td class="ltd" width="100px"><input id="code" class="l-text" name="code" type="hidden" />测试1:</td>
<td class="rtd"><input id="answer_One" class="l-text" name="answer_One" style="width:220px" type="text" /></td>
</tr>
<tr>
<td class="ltd" width="100px"><input id="code" class="l-text" name="code" type="hidden" />测试2:</td>
<td class="rtd" id="answer_Two">
<input id="radio1" type="radio" value="1" name="gender" />A
<input id="radio2" type="radio" value="2" name="gender" />B
</td>
</tr>
<tr>
<td class="ltd" width="100px"><input id="code" class="l-text" name="code" type="hidden" />测试3:</td>
<td class="rtd" id="answer_Three">
<input id="checkbox1" type="checkbox" name="vehicle" value="1" />A
<input id="checkbox2" type="checkbox" name="vehicle" value="2" />B
<input id="checkbox3" type="checkbox" name="vehicle" value="3" />C
<input id="checkbox4" type="checkbox" name="vehicle" value="4" />D
</td>
</tr>
<tr>
<td class="ltd" width="100px">录音回听:</td>
<td>
<audio id="tape" controls="controls" autoplay="autoplay" preload="metadata">
<source src="" type="audio/mpeg" id="record">
</audio>
</td>
</tr>
</table>
</form>
</div>*@
@section scripts{
<script type="text/javascript">
function init() {
liger.get("checkQuestionnaireList").reload();
$("#checkQuestionnaireList").ligerDateEditor();
openf.close();
}
$(function () {
$("#search").ligerButton({
click: function () {
liger.get("checkQuestionnaireList").set("parms", { name: $("#QuestionnaireListName").val(), ident: $("#QuestionnaireListIdent").val() });
liger.get("checkQuestionnaireList").changePage("first");
liger.get("checkQuestionnaireList").reload();
}
});
var manager = $("#checkQuestionnaireList").ligerGrid({
url: "@Url.Action("getCheckQuestionnaireList")",
title: "问卷调查列表",
parms: {},
columns: [
{ name: "info_id", id: "id", display: "info_id", width: 100, align: "center" },
{ name: "name",id:"name", display: "姓名", width: 100, align: "center" },
{ name: "ident", display: "身份证号码", width: 200, align: "center" },
{ name: "unit", display: "所属单位", width: 200, align: "center" },
{ name: "create_time", display: "问卷时间", width: 100, align: "center" },
{ name: "username", display: "问卷调查者", width: 100, align: "center" }
], width: "98%",
height: "100%",
rownumbers: true,
usePager: true,
heightDiff: -20,
toolbar: {
items: [
{ text: '修改问卷', click: details, icon: 'edit' },
{ text: '导出问卷', click: exportQ, icon: 'down' },
//{ line: true }
]
},
});
manager.toggleCol("info_id", false);
});
//修改问卷
function details() {
var r = liger.get("checkQuestionnaireList").getSelectedRow();
if (!r)
{
$.ligerDialog.warn("请选择用户!");
return;
}
var id = r.id;
openf = $.ligerDialog.open({
url: "@Url.Action("QuestionnaireModify")?info_id=" + r.id,
title: "问卷详情",
width: 1200,
height: 650,
cls: "closeCls"
});
$(".closeCls").on("click", function () {
openf.close();
});
}
function confirm() {
var user_id;
var sheet_id;
var r = liger.get("checkQuestionnaireList").getSelectedRow();
if (!r) {
$.ligerDialog.alert("请选择数据!");
return;
}
user_id = r.user_id;
$("#user_id").val();
$("#answer_One").val();
$("input").removeAttr("checked");
document.getElementById("record").src = "";
document.getElementById("tape").load();
$.ajax({
url: "@Url.Action("QuestionnaireModify")", type: "post", dataType: "json", data: { user_id: user_id, sheet_id: sheet_id },
success: function (item) {
$("#user_id").val(item.user_id);
$("#answer_One").val(item.answer_One);
if (item.answer_Two == "1") {
document.getElementById("radio1").checked = true;
} else if (item.answer_Two == "2"){
document.getElementById("radio2").checked = true;
}
for (var i = 0; i < 4; i++) {
var s = item.answer_Three.substring(i, i + 1);
if (s == 1) {
document.getElementById("checkbox1").checked = true;
} else if (s == 2) {
document.getElementById("checkbox2").checked = true;
} else if (s == 3) {
document.getElementById("checkbox3").checked = true;
} else if (s == 4) {
document.getElementById("checkbox4").checked = true;
}
}
document.getElementById("record").src = "http://" + window.location.host + "/music/" + item.record;
document.getElementById("tape").load();
}
});
$.ligerDialog.open({
title: "问卷调查", target: $("#checkQuestionnaireModify"), width: 415, height: 300, buttons: [{
text: "提交", onclick: function (item, dialg) {
saveData(dialg);
}
}, { text: "返回", onclick: function (item, dialg) { dialg.hidden(); } }]
});
function saveData(dialg) {
var user_id = $("#user_id").val();
var answer_One = $("#answer_One").val();
var answer_Two;
var radio = document.getElementsByName("gender");
for (i = 0; i < radio.length; i++) {
if (radio[i].checked) {
answer_Two = radio[i].value;
}
}
var answer_Three = "";
var checkbox = document.getElementsByName("vehicle");
for (var i = 0; i < checkbox.length; i++) {
if (checkbox[i].checked) {
answer_Three += checkbox[i].value;
}
}
var json = '{"user_id":"' + user_id + '", "answer_One":"' + answer_One + '","answer_Two":"' + answer_Two + '","answer_Three":"' + answer_Three + '"}';
var data = JSON.parse(json);
$.ajax(
{
url: "@Url.Action("saveQuestionnaire")", type: "post", dataType: "json", data: data,
success: function (d) {
$.ligerDialog.closeWaitting();
$.ligerDialog.alert(d.Message, function () {
if (d.State == 1) {
dialg.hidden();
liger.get("checkQuestionnaireList").reload();
}
});
},
beforeSend: function () {
$.ligerDialog.waitting("正在保存请稍后……");
}
});
}
}
//修改问卷
function exportQ() {
var name = $("#QuestionnaireListName").val();
var ident = $("#QuestionnaireListIdent").val();
$.ajax({
url: "@Url.Action("exportQuestion")?name=" + name + "&ident=" + ident,
async: true,
type: "post",
cache: false,
success: function (result) {
if (result.State == "0") {
//exportExcel(result.Path);
$("#down").attr("src", result.Path);
}
else {
$.ligerDialog.alert(result.Message);
}
},
error: function (msg) {
$.ligerDialog.closeWaitting();
$.ligerDialog.error("操作失败,请重新操作");
return false;
},
});
}
</script>
}