|
|
layui.use(['table', 'laydate', 'form', 'dropdown'], function () {
|
|
|
var table = layui.table
|
|
|
, dropdown = layui.dropdown
|
|
|
, laydate = layui.laydate
|
|
|
, laytpl = layui.laytpl
|
|
|
, element = layui.element
|
|
|
, form = layui.form;
|
|
|
|
|
|
|
|
|
laydate.render({
|
|
|
elem: '#cxmDate'
|
|
|
, range: ['#cxmStartDate', '#cxmEndDate']
|
|
|
});
|
|
|
|
|
|
laydate.render({
|
|
|
elem: '#czlDate'
|
|
|
, range: ['#czlStartDate', '#czlEndDate']
|
|
|
});
|
|
|
|
|
|
var ysndArr = [{ sKey: "", sValue: "预算年度" }];
|
|
|
|
|
|
// 生成预算年度数据
|
|
|
var date = new Date();
|
|
|
for (var i = Number(date.getFullYear()) + 1; i > 2015; i--) {
|
|
|
var _obj = { sKey: i.toString(), sValue: i.toString() }
|
|
|
ysndArr.push(_obj)
|
|
|
}
|
|
|
|
|
|
// 查项目 subject_type_ids 项目类型,多个以逗号分隔
|
|
|
var subjectTypeIds = [];
|
|
|
// 查项目 data_type 项目来源,查询全部传-1
|
|
|
var dataType = "-1";
|
|
|
// 查项目 sbnd 申报年度.查询全部传-1
|
|
|
var _sbnd = "-1";
|
|
|
// 查项目 项目步骤
|
|
|
var stepCode = "";
|
|
|
var isCurrent = "";
|
|
|
|
|
|
// 查资料 document_type_id 文档类型,多个以逗号分隔
|
|
|
var czlDocTypeIds = [];
|
|
|
// 查资料 subject_type_ids 项目类型,多个以逗号分隔
|
|
|
var czlSubjectTypeIds = [];
|
|
|
// 查资料 data_type 项目来源,查询全部传-1
|
|
|
var czlDataType = "-1";
|
|
|
// 查资料 sbnd 申报年度.查询全部传-1
|
|
|
var czlSbnd = "-1";
|
|
|
|
|
|
|
|
|
// 查项目 预算年度模板
|
|
|
var cxmYsndTpl = cxmYsndScript.innerHTML,
|
|
|
cxmYsndView = document.getElementById('cxmYsndView');
|
|
|
laytpl(cxmYsndTpl).render(ysndArr, function (html) {
|
|
|
cxmYsndView.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
|
|
|
// 查资料 预算年度模板
|
|
|
var czlYsndTpl = czlYsndScript.innerHTML,
|
|
|
czlYsndView = document.getElementById('czlYsndView');
|
|
|
laytpl(czlYsndTpl).render(ysndArr, function (html) {
|
|
|
czlYsndView.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
|
|
|
|
|
|
// 资料类型数据
|
|
|
var zlTypeData = [
|
|
|
{ id: 0, type_name: "不限", li_class: "active" },
|
|
|
{ id: 1, type_name: "技术方案", li_class: "" },
|
|
|
{ id: 2, type_name: "实施过程证明材料", li_class: "" },
|
|
|
{ id: 3, type_name: "采购合同", li_class: "" },
|
|
|
{ id: 4, type_name: "中标通知书", li_class: "" },
|
|
|
{ id: 5, type_name: "资金请示文件", li_class: "" },
|
|
|
{ id: 6, type_name: "其他文件", li_class: "" }
|
|
|
];
|
|
|
|
|
|
// 查资料 资料类型模板
|
|
|
var zlTypeTpl = zlTypeScript.innerHTML,
|
|
|
zlTypeView = document.getElementById('zlTypeView');
|
|
|
laytpl(zlTypeTpl).render(zlTypeData, function (html) {
|
|
|
zlTypeView.innerHTML = html;
|
|
|
});
|
|
|
|
|
|
|
|
|
cxmTableRender();
|
|
|
|
|
|
function cxmTableRender() {
|
|
|
table.render({
|
|
|
elem: '#cxmProjectListTableView'
|
|
|
, url: "/dsBase/gtzz/querySubject"
|
|
|
, where: {
|
|
|
keyword: $("#cxmKeyWord").val()
|
|
|
, subject_type_ids: subjectTypeIds.join(',')
|
|
|
, begin_date: $("#cxmStartDate").val()
|
|
|
, end_date: $("#cxmEndDate").val()
|
|
|
, data_type: dataType
|
|
|
, sbnd: _sbnd
|
|
|
, step_code: stepCode
|
|
|
, is_current: isCurrent
|
|
|
, org_code: '1'
|
|
|
}
|
|
|
, cols: [
|
|
|
[
|
|
|
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "4%" }
|
|
|
, { field: 'data_type_name', width: "6%", title: '项目来源' }
|
|
|
, { field: 'sbnd', width: "6%", title: '预算年度' }
|
|
|
, { field: 'task_number', width: "9%", title: '项目编号' }
|
|
|
, { field: 'xmmc', title: '项目名称' }
|
|
|
, { field: 'subject_type_name', width: "10%", title: '项目类型' }
|
|
|
, { field: 'lxsj', width: "8%", title: '申报时间' }
|
|
|
, { field: 'yq_count', width: "6%", title: '逾期次数' }
|
|
|
, { field: 'FirstStepName', width: "6%", title: '当前阶段' }
|
|
|
, { field: 'SecondStepName', width: "8%", title: '当前节点' }
|
|
|
, { width: "10%", title: '操作', toolbar: '#cxmTableOperate', align: 'center' }
|
|
|
]
|
|
|
]
|
|
|
, height: "full-280"
|
|
|
, autoSort: false //禁用前端自动排序
|
|
|
// ,skin: 'line' //表格风格
|
|
|
, even: true
|
|
|
, page: {
|
|
|
limit: 11
|
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
|
, prev: "上一页"
|
|
|
, next: "下一页"
|
|
|
}
|
|
|
, parseData: function (res) { //res 即为原始返回的数据
|
|
|
for (var i in res.data) {
|
|
|
if (res.data[i]["data_type"] == "0") {
|
|
|
res.data[i]["data_type_name"] = "新建";
|
|
|
}
|
|
|
else {
|
|
|
res.data[i]["data_type_name"] = "续拨";
|
|
|
}
|
|
|
|
|
|
res.data[i]["lxsj"] = res.data[i]["lixiang_time"].substring(0, 10);
|
|
|
}
|
|
|
return {
|
|
|
"code": res.code,
|
|
|
"msg": res.msg,
|
|
|
"count": res.count,
|
|
|
"data": res.data
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
table.on('tool(cxmTableFilter)', function (obj) {
|
|
|
|
|
|
var subjectId = obj.data.subject_id;
|
|
|
|
|
|
if (obj.event === 'view') { //查看
|
|
|
// window.location.href = "../../../projectOperate/projectOperate.html?project_id=" + obj.data.subject_id + "&step_code=" + obj.data.step_code + "&progress_id=" + obj.data.progress_id + "&can_do=0&back=00";
|
|
|
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '查看',
|
|
|
shadeClose: true,
|
|
|
shade: false,
|
|
|
maxmin: false,
|
|
|
move: false,
|
|
|
area: ['100%', '100%'],
|
|
|
content: "../../../projectOperate/projectOperate.html?project_id=" + obj.data.subject_id + "&step_code=" + obj.data.step_code + "&progress_id=" + obj.data.progress_id + "&can_do=0&back=00"
|
|
|
});
|
|
|
}
|
|
|
else if (obj.event === 'print') {
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '打印',
|
|
|
shadeClose: true,
|
|
|
shade: false,
|
|
|
maxmin: false,
|
|
|
move: false,
|
|
|
area: ['650px', '650px'],
|
|
|
content: "./print.html?subject_id=" + obj.data.subject_id
|
|
|
});
|
|
|
}
|
|
|
else { //更多下拉菜单
|
|
|
dropdown.render({
|
|
|
elem: this
|
|
|
, show: true //外部事件触发即显示
|
|
|
, data: [{
|
|
|
title: '评审单'
|
|
|
, id: 'psd'
|
|
|
}, {
|
|
|
title: '单位验收单'
|
|
|
, id: 'dwysd'
|
|
|
}, {
|
|
|
title: '市级验收单'
|
|
|
, id: 'sjysd'
|
|
|
}]
|
|
|
, click: function (data) {
|
|
|
|
|
|
switch (data.id) {
|
|
|
case 'psd':
|
|
|
if (obj.data.step_code > '0203') {
|
|
|
var newWindow = window.open();
|
|
|
var url = Base64.encode("/dsBase/gtzz/exportPsPdf?subject_id=" + subjectId);
|
|
|
newWindow.location.href = "../../../projectOperate/exportPdf.html?url=" + url + "&titleFlag=2";
|
|
|
|
|
|
} else {
|
|
|
layer.msg("暂无评审单!", { icon: 2, time: 1500, shade: [0.1, '#000', true] });
|
|
|
}
|
|
|
break;
|
|
|
case 'dwysd':
|
|
|
if (obj.data.step_code > '0304') {
|
|
|
var newWindow = window.open();
|
|
|
var url = Base64.encode("/dsBase/gtzz/exportYsPdf?subject_id=" + subjectId + "&step_code=0304");
|
|
|
newWindow.location.href = "../../../projectOperate/exportPdf.html?url=" + url + "&titleFlag=1";
|
|
|
} else {
|
|
|
layer.msg("暂无单位验收单", { icon: 2, time: 1500, shade: [0.1, '#000', true] });
|
|
|
}
|
|
|
break;
|
|
|
case 'sjysd':
|
|
|
if (obj.data.step_code > '0307') {
|
|
|
var newWindow = window.open();
|
|
|
var url = Base64.encode("/dsBase/gtzz/exportYsPdf?subject_id=" + subjectId + "&step_code=0307");
|
|
|
newWindow.location.href = "../../../projectOperate/exportPdf.html?url=" + url + "&titleFlag=1";
|
|
|
} else {
|
|
|
layer.msg("暂无市级验收单", { icon: 2, time: 1500, shade: [0.1, '#000', true] });
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
, align: 'right' //右对齐弹出(v2.6.8 新增)
|
|
|
// , style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
table.on('tool(czlTableFilter)', function (obj) {
|
|
|
if (obj.event === 'fileView') {
|
|
|
var newWindow = window.open();
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
url: "/dsBase/gtzz/previewFile",
|
|
|
data: {
|
|
|
file_id: obj.data.file_id
|
|
|
},
|
|
|
success: function (data) {
|
|
|
newWindow.location.href = data.forPrintUrl;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
download(obj.data.url, obj.data.file_name);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function czlTableRender() {
|
|
|
table.render({
|
|
|
elem: '#czlProjectListTableView'
|
|
|
, url: "/dsBase/gtzz/queryFile"
|
|
|
, where: {
|
|
|
keyword: $("#czlKeyWord").val()
|
|
|
, document_type_ids: czlDocTypeIds.join(',')
|
|
|
, subject_type_ids: czlSubjectTypeIds.join(',')
|
|
|
, begin_date: $("#czlStartDate").val()
|
|
|
, end_date: $("#czlEndDate").val()
|
|
|
, data_type: czlDataType
|
|
|
, sbnd: czlSbnd
|
|
|
, org_code: '1'
|
|
|
}
|
|
|
, cols: [
|
|
|
[
|
|
|
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" }
|
|
|
, { field: 'data_type_name', width: "6%", title: '项目来源' }
|
|
|
, { field: 'docTypeName', width: "8%", title: '文件类型' }
|
|
|
, { field: 'file_name', width: "10%", title: '文件名称' }
|
|
|
, { field: 'year', width: "6%", title: '预算年度' }
|
|
|
, { field: 'task_number', width: "10%", title: '项目编号' }
|
|
|
, { field: 'subject_name', title: '项目名称' }
|
|
|
, { field: 'subject_type_name', width: "8%", title: '项目类型' }
|
|
|
, { field: 'update_ts', width: "8%", title: '提交时间' }
|
|
|
, { width: "8%", title: '操作', toolbar: '#czlTableOperate', align: 'center' }
|
|
|
]
|
|
|
]
|
|
|
, height: "full-325"
|
|
|
, autoSort: false //禁用前端自动排序
|
|
|
// ,skin: 'line' //表格风格
|
|
|
, even: true
|
|
|
, page: {
|
|
|
limit: 10
|
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
|
, prev: "上一页"
|
|
|
, next: "下一页"
|
|
|
}
|
|
|
, parseData: function (res) { //res 即为原始返回的数据
|
|
|
for (var i in res.data) {
|
|
|
if (res.data[i]["data_type"] == "0") {
|
|
|
res.data[i]["data_type_name"] = "新建";
|
|
|
}
|
|
|
else {
|
|
|
res.data[i]["data_type_name"] = "续拨";
|
|
|
}
|
|
|
|
|
|
if (res.data[i]["document_type_id"] === 1) {
|
|
|
res.data[i]["docTypeName"] = "技术方案";
|
|
|
}
|
|
|
else if (res.data[i]["document_type_id"] === 2) {
|
|
|
res.data[i]["docTypeName"] = "技术方案";
|
|
|
}
|
|
|
else if (res.data[i]["document_type_id"] === 3) {
|
|
|
res.data[i]["docTypeName"] = "实施过程证明材料";
|
|
|
}
|
|
|
else if (res.data[i]["document_type_id"] === 4) {
|
|
|
res.data[i]["docTypeName"] = "采购合同";
|
|
|
}
|
|
|
else if (res.data[i]["document_type_id"] === 5) {
|
|
|
res.data[i]["docTypeName"] = "中标通知书";
|
|
|
}
|
|
|
else if (res.data[i]["document_type_id"] === 6) {
|
|
|
res.data[i]["docTypeName"] = "资金请示文件";
|
|
|
} else {
|
|
|
res.data[i]["docTypeName"] = "其他文件";
|
|
|
}
|
|
|
|
|
|
res.data[i]["update_ts"] = res.data[i]["update_ts"].substring(0, 10);
|
|
|
}
|
|
|
return {
|
|
|
"code": res.code,
|
|
|
"msg": res.msg,
|
|
|
"count": res.count,
|
|
|
"data": res.data
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 查项目 查询
|
|
|
$("#cxmSearch").click(function () {
|
|
|
cxmTableRender();
|
|
|
});
|
|
|
|
|
|
// 查资料 查询
|
|
|
$("#czlSearch").click(function () {
|
|
|
czlTableRender();
|
|
|
});
|
|
|
|
|
|
// 查项目 重置
|
|
|
$("#cxmReset").click(function () {
|
|
|
$("#cxmProjectSourceSelect").val("-1");
|
|
|
$("#cxmProjectYearSelect").val("-1");
|
|
|
$("#cxmProjectStageSelect").val("-1");
|
|
|
$("#cxmProjectOrgSelect").val("-1");
|
|
|
$("#cxmStartDate").val("");
|
|
|
$("#cxmEndDate").val("");
|
|
|
$("#cxmKeyWord").val("");
|
|
|
|
|
|
var child = $(".cxm input[type='checkbox']");
|
|
|
child.each(function (index, item) {
|
|
|
item.checked = false;
|
|
|
});
|
|
|
orgCode = "";
|
|
|
|
|
|
subjectTypeIds.splice(0, subjectTypeIds.length);
|
|
|
|
|
|
form.render();
|
|
|
});
|
|
|
|
|
|
// 查资料 重置
|
|
|
$("#czlReset").click(function () {
|
|
|
|
|
|
$(".li").siblings().removeClass('active');
|
|
|
$(".li").eq(0).addClass('active');
|
|
|
var child = $(".czl input[type='checkbox']");
|
|
|
child.each(function (index, item) {
|
|
|
item.checked = false;
|
|
|
});
|
|
|
$("#czlStartDate").val("");
|
|
|
$("#czlEndDate").val("");
|
|
|
$("#czlKeyWord").val("");
|
|
|
|
|
|
$("#czlProjectSourceSelect").val("");
|
|
|
$("#czlProjectYearSelect").val("-1");
|
|
|
$("#czlProjectOrgSelect").val("-1");
|
|
|
czlOrgCode = "";
|
|
|
|
|
|
subjectTypeIds.splice(0, subjectTypeIds.length);
|
|
|
|
|
|
form.render();
|
|
|
});
|
|
|
|
|
|
|
|
|
// 查资料 点击资料类型
|
|
|
$(".li").click(function () {
|
|
|
var _id = $(this).attr("id");
|
|
|
$(this).siblings().removeClass('active');
|
|
|
$(this).addClass('active');
|
|
|
czlDocTypeIds.splice(0, czlDocTypeIds.length);
|
|
|
switch (_id) {
|
|
|
case 0:
|
|
|
czlDocTypeIds.push("")
|
|
|
|
|
|
break;
|
|
|
case "1":
|
|
|
czlDocTypeIds.push("1");
|
|
|
czlDocTypeIds.push("2");
|
|
|
break;
|
|
|
case "2":
|
|
|
czlDocTypeIds.push("3");
|
|
|
break;
|
|
|
case "3":
|
|
|
czlDocTypeIds.push("4");
|
|
|
break;
|
|
|
case "4":
|
|
|
czlDocTypeIds.push("5");
|
|
|
break;
|
|
|
case "5":
|
|
|
czlDocTypeIds.push("6");
|
|
|
break;
|
|
|
case "6":
|
|
|
czlDocTypeIds.push("7");
|
|
|
czlDocTypeIds.push("9");
|
|
|
czlDocTypeIds.push("10");
|
|
|
czlDocTypeIds.push("11");
|
|
|
break;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查项目中的项目类型点击事件
|
|
|
form.on('checkbox(cxmCheckFilter)', function (data) {
|
|
|
if (data.elem.checked) {
|
|
|
subjectTypeIds.push(data.elem.id);
|
|
|
} else {
|
|
|
var _index = subjectTypeIds.indexOf(data.elem.id);
|
|
|
subjectTypeIds.splice(_index, 1);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查项目中的项目类型点击事件
|
|
|
form.on('checkbox(czlCheckFilter)', function (data) {
|
|
|
if (data.elem.checked) {
|
|
|
czlSubjectTypeIds.push(data.elem.id);
|
|
|
} else {
|
|
|
var _index = czlSubjectTypeIds.indexOf(data.elem.id);
|
|
|
czlSubjectTypeIds.splice(_index, 1);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查项目中的项目来源change事件
|
|
|
form.on('select(cxmPsSelectChange)', function (data) {
|
|
|
if (data.value === '') {
|
|
|
dataType = "-1";
|
|
|
} else {
|
|
|
dataType = data.value;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查资料中的项目来源change事件
|
|
|
form.on('select(czlPsSelectChange)', function (data) {
|
|
|
if (data.value === '') {
|
|
|
czlDataType = "-1";
|
|
|
} else {
|
|
|
czlDataType = data.value;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查项目中的预算年度change事件
|
|
|
form.on('select(cxmYsndSelectChange)', function (data) {
|
|
|
if (data.value === '') {
|
|
|
_sbnd = "-1";
|
|
|
} else {
|
|
|
_sbnd = data.value;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查资料中的预算年度change事件
|
|
|
form.on('select(czlYsndSelectChange)', function (data) {
|
|
|
if (data.value === '') {
|
|
|
czlSbnd = "-1";
|
|
|
} else {
|
|
|
czlSbnd = data.value;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 查项目中的项目阶段change事件
|
|
|
form.on('select(cxmPStageSelectChange)', function (data) {
|
|
|
if (data.value === '') {
|
|
|
stepCode = "";
|
|
|
isCurrent = "";
|
|
|
} else {
|
|
|
var _arr = data.value.split("_")
|
|
|
stepCode = _arr[0];
|
|
|
isCurrent = _arr[1];
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// 点击TAB标签
|
|
|
element.on('tab(tabFilter)', function () {
|
|
|
if (this.getAttribute('lay-id') === 'cxm') {
|
|
|
cxmTableRender();
|
|
|
}
|
|
|
else {
|
|
|
czlTableRender();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// 获取参数值
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |