You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.3 KiB

2 years ago
layui.use(['table', 'form'], function () {
var table = layui.table
, form = layui.form;
var subjectId = GetQueryString("subject_id");
tableRender();
function tableRender() {
table.render({
elem: '#questionListTableView'
, url: "/QingLong/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: "10%", 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-30"
, 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
};
}
});
};
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;
}
if (obj.event === 'rectify') {
window.location.href = "./questionRectify.html?question_id=" + obj.data.group_question_id;
}
});
// 为弹出页调用
window.parentTableRender = function () {
tableRender();
};
// 获取参数值
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;
}
});