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.
304 lines
11 KiB
304 lines
11 KiB
layui.use(['laytpl', 'upload'], function () {
|
|
var form = layui.form
|
|
, laytpl = layui.laytpl
|
|
, upload = layui.upload;
|
|
|
|
var projectId = GetQueryString("project_id");
|
|
var stepCode = GetQueryString("step_code");
|
|
var progressId = GetQueryString("progress_id");
|
|
var canDo = GetQueryString("can_do");
|
|
var backParms = GetQueryString("back");
|
|
var radioId = 0;
|
|
|
|
var currentStepCode = "";
|
|
|
|
// 选中步骤
|
|
$("#" + stepCode.substring(0, 2)).find("#divShadow").addClass('xmjdshadowSelected');
|
|
|
|
|
|
// $("#01").attr('disabled', false);
|
|
|
|
|
|
|
|
// 获取项目信息
|
|
$.ajax({
|
|
type: "GET",
|
|
dataType: "json",
|
|
url: "/dsBase/gtzz/getSubjectInfo",
|
|
data: {
|
|
subject_id: projectId
|
|
},
|
|
success: function (data) {
|
|
var projectInfoTpl = projectInfoScript.innerHTML,
|
|
projectInfoView = document.getElementById('projectInfoView');
|
|
laytpl(projectInfoTpl).render(data, function (html) {
|
|
projectInfoView.innerHTML = html;
|
|
});
|
|
}
|
|
});
|
|
|
|
var tpl = timeLineScript.innerHTML,
|
|
view = document.getElementById('timeLineView');
|
|
|
|
timeLineLoadData();
|
|
|
|
function timeLineLoadData() {
|
|
$.ajax({
|
|
type: "GET",
|
|
dataType: "json",
|
|
async: false,
|
|
url: '/dsBase/gtzz/getTimeLineData',
|
|
data: {
|
|
progress_id: progressId,
|
|
step_code: stepCode,
|
|
can_do: canDo
|
|
},
|
|
success: function (data) {
|
|
laytpl(tpl).render(data, function (html) {
|
|
view.innerHTML = html;
|
|
});
|
|
currentStepCode = data.current_step_code.substring(0, 2);
|
|
|
|
upload.render({
|
|
elem: '#uploadFile_0' //绑定元素
|
|
, accept: "file"
|
|
, url: '/dsBase/gtzz/uploadFile' //上传接口
|
|
, data: {
|
|
type_id: 1, progress_id: progressId, document_type_id: function () {
|
|
return $('#uploadFile_0').attr("type_id");
|
|
}
|
|
}
|
|
, exts: 'doc|docx|xls|xlsx|pdf|jpg|jpeg|png'
|
|
, done: function (res) {
|
|
if (res.success) {
|
|
var _fielName = res.fileName;
|
|
if (_fielName.length > 20) {
|
|
_fielName = res.fileName.substring(0, 20) + "...";
|
|
}
|
|
var progressId = $('#uploadFile_0').attr("progress_id");
|
|
var typeId = $('#uploadFile_0').attr("type_id");
|
|
$("#fileList_" + progressId + "_" + typeId).append('<div class="fileItem" id="' + res.file_id + '"><div class="fileLeft"><div style="width: 50px;"><i class="layui-icon layui-icon-file" style="font-size: 30px;color: #3977D1;margin: 0 10px;"></i></div><div class="fileInfo"><div class="fileName" title="' + res.fileName + '">' + _fielName + '</div><div class="fileSize">' + res.file_size + '</div></div><i class="layui-icon layui-icon-close" style="font-size: 16px;color: #3977D1;cursor:pointer" onclick="removeFile(\'' + res.file_id + '\');"></i></div></div>')
|
|
}
|
|
}
|
|
, error: function (res) {
|
|
//请求异常回调
|
|
console.log(res);
|
|
}
|
|
});
|
|
|
|
upload.render({
|
|
elem: '#uploadFile_1' //绑定元素
|
|
, accept: "file"
|
|
, url: '/dsBase/gtzz/uploadFile' //上传接口
|
|
, data: {
|
|
type_id: 1, progress_id: progressId, document_type_id: function () {
|
|
return $('#uploadFile_1').attr("type_id");
|
|
}
|
|
}
|
|
, exts: 'doc|docx|xls|xlsx|pdf|jpg|jpeg|png'
|
|
, done: function (res) {
|
|
if (res.success) {
|
|
var _fielName = res.fileName;
|
|
if (_fielName.length > 20) {
|
|
_fielName = res.fileName.substring(0, 20) + "...";
|
|
}
|
|
var progressId = $('#uploadFile_1').attr("progress_id");
|
|
var typeId = $('#uploadFile_1').attr("type_id");
|
|
|
|
$("#fileList_" + progressId + "_" + typeId).append('<div class="fileItem" id="' + res.file_id + '"><div class="fileLeft"><div style="width: 50px;"><i class="layui-icon layui-icon-file" style="font-size: 30px;color: #3977D1;margin: 0 10px;"></i></div><div class="fileInfo"><div class="fileName" title="' + res.fileName + '">' + _fielName + '</div><div class="fileSize">' + res.file_size + '</div></div><i class="layui-icon layui-icon-close" style="font-size: 16px;color: #3977D1;cursor:pointer" onclick="removeFile(\'' + res.file_id + '\');"></i></div></div>')
|
|
}
|
|
}
|
|
, error: function (res) {
|
|
//请求异常回调
|
|
console.log(res);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
|
|
if (currentStepCode === '02') {
|
|
$("#03").find("i").css("color", "#AAAAAA");
|
|
$("#03").find(".xmjdText").css("color", "#AAAAAA");
|
|
$("#03").removeClass("xmjd");
|
|
$("#03").addClass("xmjdNone");
|
|
}
|
|
if (currentStepCode === '03') {
|
|
$("#02").find("i").css("color", "#2FC25B");
|
|
}
|
|
if (currentStepCode === '04') {
|
|
$("#02").find("i").css("color", "#2FC25B");
|
|
$("#03").find("i").css("color", "#2FC25B");
|
|
}
|
|
|
|
|
|
getSubmitStatus();
|
|
// 获取提交按钮状态是否显示
|
|
function getSubmitStatus() {
|
|
$.ajax({
|
|
type: "GET",
|
|
dataType: "json",
|
|
url: "/dsBase/gtzz/getStepInfoByProgressId",
|
|
data: {
|
|
progress_id: progressId
|
|
},
|
|
success: function (data) {
|
|
data.can_do = canDo;
|
|
var submitTpl = submitScript.innerHTML,
|
|
submitView = document.getElementById('submitView');
|
|
laytpl(submitTpl).render(data, function (html) {
|
|
submitView.innerHTML = html;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
$(".xmjd").click(function () {
|
|
let _id = $(this).attr("id");
|
|
$(this).siblings().find("#divShadow").removeClass('xmjdshadowSelected');
|
|
$(this).find("#divShadow").addClass('xmjdshadowSelected');
|
|
stepCode = _id;
|
|
timeLineLoadData();
|
|
});
|
|
|
|
// 返回
|
|
$("#back").click(function () {
|
|
var backUrlArr = document.referrer.split("=");
|
|
if (backParms === '00') {
|
|
window.location.href = document.referrer + "?back=00";
|
|
}
|
|
else {
|
|
window.location.href = backUrlArr[0] + "=" + backParms;
|
|
}
|
|
|
|
//
|
|
// window.history.go(-1);
|
|
});
|
|
|
|
// 移除附件元素
|
|
window.removeFile = function (fileId) {
|
|
layer.confirm('是否删除文件?', { icon: 0 }, function (index) {
|
|
deleteFile(fileId);
|
|
layer.close(index);
|
|
});
|
|
};
|
|
|
|
// 删除文件接口
|
|
function deleteFile(fileId) {
|
|
$.ajax({
|
|
type: "POST",
|
|
dataType: "json",
|
|
url: '/dsBase/gtzz/deleteProgressFile',
|
|
data: {
|
|
progress_id: progressId,
|
|
file_id: fileId
|
|
},
|
|
success: function (data) {
|
|
if (data.success) {
|
|
$("#" + fileId).remove();
|
|
}
|
|
else {
|
|
layer.msg("删除失败!" + data.message, { icon: 2, time: 1500, shade: [0.1, '#000', true] });
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
// 提交
|
|
window.submit = function (fileId) {
|
|
$.ajax({
|
|
type: "POST",
|
|
dataType: "json",
|
|
url: '/dsBase/gtzz/submitStep',
|
|
data: {
|
|
progress_id: progressId,
|
|
radio_id: radioId,
|
|
message: $("#inputValue").val()
|
|
},
|
|
success: function (data) {
|
|
if (data.success) {
|
|
layer.msg("提交成功!", { icon: 1, time: 1250, shade: [0.1, '#000', true] }, function () {
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
parent.layer.close(index);
|
|
window.parent.parentTableRender(backParms);
|
|
});
|
|
|
|
} else {
|
|
layer.msg("提交失败!" + data.message, { icon: 2, time: 2000, shade: [0.1, '#000', true] });
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
// 点击radioButton事件
|
|
window.radioChange = function (radioValue, radioText) {
|
|
if (radioText === '通过' || radioText === '退回' || radioText === '不通过') {
|
|
$("#inputValue").val(radioText);
|
|
}
|
|
radioId = radioValue;
|
|
}
|
|
|
|
|
|
// 获取参数值
|
|
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;
|
|
}
|
|
|
|
// 填写验收明细事件
|
|
window.mxDetail = function (stepCode) {
|
|
if (stepCode === '0304') {
|
|
layer.open({
|
|
type: 2,
|
|
title: '<h3 style="font-weight: bolder">维护验收明细</h3>',
|
|
shadeClose: true,
|
|
shade: false,
|
|
maxmin: false, //开启最大化最小化按钮
|
|
area: ['600px', '520px'],
|
|
content: '../xx/xmdb/xmdwys/entryList.html?project_id=' + projectId,
|
|
cancel: function () {
|
|
timeLineLoadData();
|
|
}
|
|
});
|
|
} else {
|
|
layer.open({
|
|
type: 2,
|
|
title: '<h3 style="font-weight: bolder">维护验收明细</h3>',
|
|
shadeClose: true,
|
|
shade: false,
|
|
maxmin: false, //开启最大化最小化按钮
|
|
area: ['600px', '307px'],
|
|
content: '../zj/xmdb/xmsjys/entryList.html?project_id=' + projectId,
|
|
cancel: function () {
|
|
// timeLineLoadData();
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
window.questionDetail = function (subject_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: './questionList.html?subject_id=' + subject_id,
|
|
cancel: function () {
|
|
timeLineLoadData();
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
|