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.

150 lines
5.0 KiB

layui.use(['table', 'laydate', 'element', 'form'], function () {
var table = layui.table
, laydate = layui.laydate
, element = layui.element
, form = layui.form;
laydate.render({
elem: '#sbsj'
, range: ['#startDate', '#endDate']
});
var flag = GetQueryString("flag");
// 定位tab
element.tabChange('tabFilter', flag);
// 初始化
tableRender(flag);
function tableRender(flag) {
table.render({
elem: '#projectListTableView'
, url: "/FengHuang/jianli/getJlSubjectList"
, where: {
is_current: flag
, begin_date: $("#startDate").val()
, end_date: $("#endDate").val()
, keyword: $("#keyWord").val()
}
, cols: [
[
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" }
, { field: 'task_number', width: "10%", title: '项目编号' }
, { field: 'subject_name', title: '项目名称' }
, { field: 'qdsj', width: "10%", title: '实施启动时间' }
, { field: 'org_name', width: "10%", title: '项目单位' }
// , {
// width: "10%", title: '整改通过 / 累计问题', templet: function (d) {
// return d.finish_count + ' / ' + d.question_count
// }
// }
, { width: "10%", title: '操作', toolbar: '#tableOperate', align: 'center' }
]
]
, height: "full-125"
, 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]["qdsj"] = res.data[i]["qd_time"].substring(0, 10);
res.data[i]["flag"] = flag;
}
return {
"code": res.code,
"msg": res.msg,
"count": res.count,
"data": res.data
};
}
});
};
table.on('tool(tableFilter)', function (obj) {
if (obj.event === 'jdzd') {
layer.open({
type: 2,
title: "【" + obj.data.year + "】" + " " + obj.data.subject_name,
shadeClose: true,
shade: false,
maxmin: false,
move: false,
area: ['100%', '100%'],
content: "./questionList.html?subject_id=" + obj.data.subject_id + "&flag=" + flag,
cancel: function () {
tableRender(flag);
}
});
}
if (obj.event === 'jljs') {
layer.confirm('是否结束当前项目监理?', { icon: 0 }, function (index) {
layer.close(index);
$.ajax({
type: "POST",
dataType: "json",
url: '/FengHuang/gtzz/submitStep',
data: {
progress_id: obj.data.progress_id,
radio_id: 17
},
success: function (data) {
if (data.success) {
layer.msg("监理结束!", { icon: 1, time: 1250, shade: [0.1, '#000', true] }, function () {
tableRender(flag);
});
} else {
layer.msg("失败!" + data.message, { icon: 2, time: 2000, shade: [0.1, '#000', true] });
}
}
});
});
}
});
// 点击TAB标签
element.on('tab(tabFilter)', function () {
flag = this.getAttribute('lay-id');
tableRender(flag);
});
$("#search").click(function () {
tableRender(flag);
});
$("#reset").click(function () {
$("#startDate").val("");
$("#endDate").val("");
$("#keyWord").val("");
form.render();
tableRender(flag);
});
$("#titleXq").click(function () {
console.log('11112345');
});
// 获取参数值
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;
}
});