//全局的页面遮盖
let loadingMsg;
var startWorkFiles = {};
var upload;
var id;
var formData;

var yjIds, insMonths, ids;

function setData(yjId, insMonth, id) {
	yjIds = yjId;
	insMonths = insMonth;
	ids = id;
	layui.use(['form', 'layer', 'table', 'laydate'], function() {
		let form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
		form.render();

		$("#closeBt").click(function() {
			var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
			parent.layer.close(index); //再执行关闭
		});
		$("#searchBt").click(function() {
			// 加载提示
			let loadingMsg = layer.msg('数据上传中,请稍候...', {
				icon: 16,
				scrollbar: false,
				time: 0,
				shade: [0.8, '#393D49']
			});
			// form请求地址
			let formUrl = PATH_URL + "/inspectionPlan/updateTotalExamine";
			
			let revokeReason = $("#revokeReason").val();
			$.ajax({
				type: 'POST',
				url: formUrl, // 请求地址
				contentType: "application/json; charset=utf-8",
				data: JSON.stringify({
					"insMonth": insMonths,
					"yjId": yjIds,
					"id": ids,
					"auditStatus": 2,
					"auditReason":revokeReason
				}),
				success: function(data) {
					layer.close(loadingMsg); // 关闭提示层
					if (data.code == 200) {
						parent.layer.msg("审核成功", {
							icon: 1
						});
						var index = parent.layer.getFrameIndex(window
						.name); //先得到当前 iframe层的索引
						parent.layer.close(index); //再执行关闭
						reloading();
					} else {
						layer.alert(data.msg);
					}
				},
				error: function(XMLHttpRequest, textStatus, e) {
					layer.close(loadingMsg);
					layer.msg('数据请求发生异常,请稍后重试', {
						icon: 16,
						scrollbar: false
					});
				}
			});

		});
	});
}



//设置弹窗关闭
function reloading() {
	var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
	parent.layer.close(index); //再执行关闭
	window.parent.location.reload();
}