|
|
layui.use(['table', 'laydate', 'form', 'dropdown'], function () {
|
|
|
var table = layui.table
|
|
|
, dropdown = layui.dropdown
|
|
|
, laydate = layui.laydate
|
|
|
, laytpl = layui.laytpl
|
|
|
, form = layui.form;
|
|
|
|
|
|
|
|
|
laydate.render({
|
|
|
elem: '#jlsj'
|
|
|
, range: ['#startDate', '#endDate']
|
|
|
});
|
|
|
|
|
|
var subjectId = GetQueryString("subject_id");
|
|
|
var flag = GetQueryString("flag");
|
|
|
|
|
|
var w = "110";
|
|
|
|
|
|
if (flag === '0') { $('#newQuestion').hide(); w = "75" };
|
|
|
|
|
|
// 问题状态
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
url: "/FengHuang/jianli/getJlQuestionState",
|
|
|
success: function (data) {
|
|
|
var qStatusTpl = qStatusScript.innerHTML,
|
|
|
qStatusView = document.getElementById('qStatusView');
|
|
|
laytpl(qStatusTpl).render(data, function (html) {
|
|
|
qStatusView.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 问题类型
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
url: "/FengHuang/jianli/getQuestionType",
|
|
|
success: function (data) {
|
|
|
var qTypeTpl = qTypeScript.innerHTML,
|
|
|
qTypeView = document.getElementById('qTypeView');
|
|
|
laytpl(qTypeTpl).render(data, function (html) {
|
|
|
qTypeView.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 问题级别
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
url: "/FengHuang/jianli/getQuestionLevel",
|
|
|
success: function (data) {
|
|
|
var qLevelTpl = qLevelScript.innerHTML,
|
|
|
qLevelView = document.getElementById('qLevelView');
|
|
|
laytpl(qLevelTpl).render(data, function (html) {
|
|
|
qLevelView.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
tableRender();
|
|
|
|
|
|
function tableRender() {
|
|
|
table.render({
|
|
|
elem: '#questionListTableView'
|
|
|
, url: "/FengHuang/jianli/getSubjectQuestion"
|
|
|
, where: {
|
|
|
subject_id: subjectId
|
|
|
, state_id: $("#qStatusSelect").val()
|
|
|
, question_type_id: $("#qTypeSelect").val()
|
|
|
, question_level_id: $("#qLevelSelect").val()
|
|
|
, begin_date: $("#startDate").val()
|
|
|
, end_date: $("#endDate").val()
|
|
|
, keyword: $("#keyWord").val()
|
|
|
}
|
|
|
, cols: [
|
|
|
[
|
|
|
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%", align: 'center' }
|
|
|
, { field: 'question_type_name', width: "8%", title: '问题类型', align: 'center' }
|
|
|
, { field: 'question_level_name', width: "8%", title: '问题等级', align: 'center' }
|
|
|
, { field: 'question_content', title: '问题描述' }
|
|
|
, { field: 'jlsj', width: "10%", title: '记录时间', align: 'center' }
|
|
|
, { field: 'state_name', width: "8%", title: '状态', align: 'center' }
|
|
|
, { width: "8%", title: '操作', toolbar: '#tableOperate', align: 'center' }
|
|
|
]
|
|
|
]
|
|
|
, height: "full-" + w
|
|
|
, autoSort: false //禁用前端自动排序
|
|
|
// ,skin: 'line' //表格风格
|
|
|
, even: true
|
|
|
, page: {
|
|
|
limit: 16
|
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
|
, prev: "上一页"
|
|
|
, next: "下一页"
|
|
|
}
|
|
|
, parseData: function (res) { //res 即为原始返回的数据
|
|
|
for (var i in res.data) {
|
|
|
res.data[i]["jlsj"] = res.data[i]["create_time"].substring(0, 10);
|
|
|
}
|
|
|
return {
|
|
|
"code": res.code,
|
|
|
"msg": res.msg,
|
|
|
"count": res.count,
|
|
|
"data": res.data
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 为弹出页调用
|
|
|
window.parentTableRender = function () {
|
|
|
tableRender();
|
|
|
};
|
|
|
|
|
|
|
|
|
$("#search").click(function () {
|
|
|
tableRender();
|
|
|
});
|
|
|
|
|
|
$("#reset").click(function () {
|
|
|
$("#qStatusSelect").val("");
|
|
|
$("#qTypeSelect").val("");
|
|
|
$("#qLevelSelect").val("");
|
|
|
$("#startDate").val("");
|
|
|
$("#endDate").val("");
|
|
|
$("#keyWord").val("");
|
|
|
form.render();
|
|
|
tableRender();
|
|
|
});
|
|
|
|
|
|
table.on('tool(tableFilter)', function (obj) { //注:sort 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
|
|
if (obj.event === 'view') {
|
|
|
// window.location.href = "./questionView.html?question_id=" + obj.data.group_question_id;
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '<h3 style="font-weight: bolder">查看详情</h3>',
|
|
|
shadeClose: true,
|
|
|
shade: false,
|
|
|
maxmin: false, //开启最大化最小化按钮
|
|
|
move: false,
|
|
|
area: ['1200px', '600px'],
|
|
|
offset: ['20px'],
|
|
|
content: './questionView.html?question_id=' + obj.data.group_question_id
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (obj.event === 'review') {
|
|
|
// window.location.href = "./questionReview.html?question_id=" + obj.data.group_question_id;
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '<h3 style="font-weight: bolder">整改复查</h3>',
|
|
|
shadeClose: true,
|
|
|
shade: false,
|
|
|
maxmin: false, //开启最大化最小化按钮
|
|
|
move: false,
|
|
|
area: ['1200px', '600px'],
|
|
|
offset: ['20px'],
|
|
|
content: './questionReview.html?question_id=' + obj.data.group_question_id
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#titleXq").click(function () {
|
|
|
console.log('11112345');
|
|
|
});
|
|
|
|
|
|
window.addQuestion = function () {
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '<h3 style="font-weight: bolder">新建问题</h3>',
|
|
|
shadeClose: true,
|
|
|
shade: false,
|
|
|
maxmin: false, //开启最大化最小化按钮
|
|
|
area: ['550px', '550px'],
|
|
|
content: './questionAdd.html?subject_id=' + subjectId
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
// 获取参数值
|
|
|
function GetQueryString(name, istop) {
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
|
|
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |