|
|
@ -14,12 +14,18 @@ let saveResult = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel','jquery'], function () { |
|
|
|
layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel','jquery'], function () { |
|
|
|
let form = layui.form, |
|
|
|
let form = layui.form, |
|
|
|
laydate = layui.laydate; |
|
|
|
laydate = layui.laydate, |
|
|
|
|
|
|
|
datalabel = layui.datalabel; |
|
|
|
let param = layui.url().search || {}; |
|
|
|
let param = layui.url().search || {}; |
|
|
|
var $ = layui.jquery; |
|
|
|
var $ = layui.jquery; |
|
|
|
|
|
|
|
//默认展示的数据类型
|
|
|
|
let lastDataType = 'drill_base'; |
|
|
|
let lastDataType = 'drill_base'; |
|
|
|
|
|
|
|
//是否关闭窗口
|
|
|
|
|
|
|
|
var isClose = false; |
|
|
|
|
|
|
|
//移除数据时判断下文件后缀
|
|
|
|
|
|
|
|
var suffix = ""; |
|
|
|
bindDatetimePlugins(); |
|
|
|
bindDatetimePlugins(); |
|
|
|
layui.dict.setData('dict-dataType','drill_base') |
|
|
|
layui.dict.setData('dict-dataType',lastDataType) |
|
|
|
let uploader = layui.uploader.render({ |
|
|
|
let uploader = layui.uploader.render({ |
|
|
|
url: `${ctx}/sys/file/upload/chunk`,//上传文件服务器地址,必填
|
|
|
|
url: `${ctx}/sys/file/upload/chunk`,//上传文件服务器地址,必填
|
|
|
|
fileCheckUrl: `${ctx}/sys/file/upload/check`,//文件校验地址
|
|
|
|
fileCheckUrl: `${ctx}/sys/file/upload/check`,//文件校验地址
|
|
|
@ -28,6 +34,16 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
multiple: true, |
|
|
|
multiple: true, |
|
|
|
dirUpload: param.dirUpload, |
|
|
|
dirUpload: param.dirUpload, |
|
|
|
getFormData: getFormVal, |
|
|
|
getFormData: getFormVal, |
|
|
|
|
|
|
|
filesQueued: function(files){ |
|
|
|
|
|
|
|
//上传数据时默认其使用上一次的属性和置标
|
|
|
|
|
|
|
|
getDataByExt(files[0].ext); |
|
|
|
|
|
|
|
suffix = files[0].ext; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
fileDequeued: function(file){ |
|
|
|
|
|
|
|
if(file.ext == suffix) { |
|
|
|
|
|
|
|
clearForm(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
uploadFinished: function (ok) { |
|
|
|
uploadFinished: function (ok) { |
|
|
|
if (ok) { |
|
|
|
if (ok) { |
|
|
|
saveResult.done = true; |
|
|
|
saveResult.done = true; |
|
|
@ -35,16 +51,171 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
//let index = parent.layer.getFrameIndex(window.name);
|
|
|
|
//let index = parent.layer.getFrameIndex(window.name);
|
|
|
|
parent.layer.msg('上传成功'); |
|
|
|
parent.layer.msg('上传成功'); |
|
|
|
layerOkCallback && layerOkCallback(saveResult); |
|
|
|
layerOkCallback && layerOkCallback(saveResult); |
|
|
|
closeWindow() |
|
|
|
if(isClose){ |
|
|
|
|
|
|
|
//关闭窗口
|
|
|
|
|
|
|
|
closeWindow(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//清空表单
|
|
|
|
|
|
|
|
clearForm(); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
layerCancelCallback && layerCancelCallback(saveResult); |
|
|
|
layerCancelCallback && layerCancelCallback(saveResult); |
|
|
|
showErrorMsg("上传失败"); |
|
|
|
showErrorMsg("上传失败"); |
|
|
|
$('#fileUploadAction').removeClass('layui-disabled').removeAttr('disabled') |
|
|
|
$('#fileUploadAndClose').removeClass('layui-disabled').removeAttr('disabled') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getDataByExt(ext){ |
|
|
|
|
|
|
|
if(!!ext){ |
|
|
|
|
|
|
|
$.get(`${ctx}/sys/file/upload/file/ext`,{ext: ext}, (res) => { |
|
|
|
|
|
|
|
if(res.flag) { |
|
|
|
|
|
|
|
initForm(res.data) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
//初始化表单
|
|
|
|
|
|
|
|
function initForm(sysFile){ |
|
|
|
|
|
|
|
if(sysFile == null){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
layui.dict.setData('dict-dataType',sysFile.dataType); |
|
|
|
|
|
|
|
if(lastDataType != sysFile.dataType){ |
|
|
|
|
|
|
|
$(".item-"+lastDataType).addClass("layui-hide"); |
|
|
|
|
|
|
|
lastDataType = sysFile.dataType; |
|
|
|
|
|
|
|
$(".item-"+sysFile.dataType).removeClass("layui-hide"); |
|
|
|
|
|
|
|
form.render() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//回填信息
|
|
|
|
|
|
|
|
//录入人员
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-entryStaff")){ |
|
|
|
|
|
|
|
$(".item-"+lastDataType+"-entryStaff").find("input[name='entryStaff']").val(sysFile.entryStaff); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//文件密级
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-secretLevel").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'secretLevel', sysFile.secretLevel + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//演训数据
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-exerciseData").length > 0) { |
|
|
|
|
|
|
|
console.log(sysFile.exerciseData) |
|
|
|
|
|
|
|
$(".item-"+lastDataType+"-exerciseData").find("input[name='exerciseData'][value='" + sysFile.exerciseData + "']").attr("checked", "true"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//文件来源
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-source").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'source', sysFile.source + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//目标/靶标类型
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-targetNumber").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'targetNumber', sysFile.targetNumber + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//任务代号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-taskCode").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'taskCode', sysFile.taskCode + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//任务性质
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-taskNature").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'taskNature', sysFile.taskNature + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//部队代号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-troopCode").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'troopCode', sysFile.troopCode + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//装备型号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-equipmentModel").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'equipmentModel', sysFile.equipmentModel + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//导弹编号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-missileNumber").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'missileNumber', sysFile.missileNumber + ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//主题任务
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-themeTask").length > 0) { |
|
|
|
|
|
|
|
$(".item-"+lastDataType+"-themeTask").find("input[name='themeTask']").val(sysFile.themeTask) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//文件描述
|
|
|
|
|
|
|
|
if($(".item-" + lastDataType + "-remark").length > 0) { |
|
|
|
|
|
|
|
$(".item-" + lastDataType + "-remark").find("textarea[name='remark']").val(sysFile.remark) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//标签
|
|
|
|
|
|
|
|
datalabel.clear(); |
|
|
|
|
|
|
|
datalabel.setData(sysFile.labels); |
|
|
|
|
|
|
|
//提示
|
|
|
|
|
|
|
|
layer.msg("请按实际情况修改属性和置标!", Object.assign({icon: 1, time: 2000})) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//清空表单
|
|
|
|
|
|
|
|
function clearForm(){ |
|
|
|
|
|
|
|
//文件密级
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-secretLevel").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'secretLevel', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//演训数据
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-exerciseData").length > 0) { |
|
|
|
|
|
|
|
$(".item-"+lastDataType+"-exerciseData").find("input[name='exerciseData']").removeAttr("checked", "true"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//文件来源
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-source").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'source', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//目标/靶标类型
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-targetNumber").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'targetNumber', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//任务代号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-taskCode").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'taskCode', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//任务性质
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-taskNature").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'taskNature', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//部队代号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-troopCode").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'troopCode', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//装备型号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-equipmentModel").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'equipmentModel', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//导弹编号
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-missileNumber").length > 0) { |
|
|
|
|
|
|
|
layui.dict.setData('dict-' + lastDataType + 'missileNumber', "@"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//主题任务
|
|
|
|
|
|
|
|
if($(".item-"+lastDataType+"-themeTask").length > 0) { |
|
|
|
|
|
|
|
$(".item-"+lastDataType+"-themeTask").find("input[name='themeTask']").val("") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//文件描述
|
|
|
|
|
|
|
|
if($(".item-" + lastDataType + "-remark").length > 0) { |
|
|
|
|
|
|
|
$(".item-" + lastDataType + "-remark").find("textarea[name='remark']").val("") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//标签
|
|
|
|
|
|
|
|
datalabel.clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存并关闭
|
|
|
|
|
|
|
|
$('#fileUploadAndClose').on('click', function () { |
|
|
|
|
|
|
|
if(!validForm()){ |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
isClose = true; |
|
|
|
|
|
|
|
$('#fileUploadAndClose').addClass('layui-disabled').attr('disabled', 'true'); |
|
|
|
|
|
|
|
uploader.uploadToServer(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存并继续上传
|
|
|
|
$('#fileUploadAction').on('click', function () { |
|
|
|
$('#fileUploadAction').on('click', function () { |
|
|
|
|
|
|
|
if(!validForm()){ |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
isClose = false; |
|
|
|
|
|
|
|
$('#fileUploadAction').addClass('layui-disabled').attr('disabled', 'true'); |
|
|
|
|
|
|
|
uploader.uploadToServer(); |
|
|
|
|
|
|
|
$('#fileUploadAction').removeClass('layui-disabled').removeAttr('disabled') |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验表单
|
|
|
|
|
|
|
|
function validForm(){ |
|
|
|
let json = getFormVal(); |
|
|
|
let json = getFormVal(); |
|
|
|
if (!json['secretLevel']) { |
|
|
|
if (!json['secretLevel']) { |
|
|
|
showErrorMsg("请选择文件密级"); |
|
|
|
showErrorMsg("请选择文件密级"); |
|
|
@ -88,9 +259,8 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$('#fileUploadAction').addClass('layui-disabled').attr('disabled', 'true'); |
|
|
|
return true; |
|
|
|
uploader.uploadToServer(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window.layerCancelCallback) { |
|
|
|
if (window.layerCancelCallback) { |
|
|
|
$('#cancelBtn').show().on('click', closeWindow); |
|
|
|
$('#cancelBtn').show().on('click', closeWindow); |
|
|
@ -104,6 +274,19 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
$(".item-"+data.value).removeClass("layui-hide"); |
|
|
|
$(".item-"+data.value).removeClass("layui-hide"); |
|
|
|
form.render() |
|
|
|
form.render() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
clearForm(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成编码
|
|
|
|
|
|
|
|
$('#createCode').on('click', function () { |
|
|
|
|
|
|
|
let json = getFormVal(); |
|
|
|
|
|
|
|
$.post(`${ctx}/sys/file/upload/file/code`, json, function (res) { |
|
|
|
|
|
|
|
if(res.flag){ |
|
|
|
|
|
|
|
$('#fileCode').val(res.data); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
showErrorMsg("编码失败!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function closeWindow() { |
|
|
|
function closeWindow() { |
|
|
@ -118,7 +301,6 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
$('.star-mark').hide(); |
|
|
|
$('.star-mark').hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
form.on('radio(exerciseData)', renderRequiredItem); |
|
|
|
form.on('radio(exerciseData)', renderRequiredItem); |
|
|
|
setTimeout(renderRequiredItem, 50); |
|
|
|
setTimeout(renderRequiredItem, 50); |
|
|
|
|
|
|
|
|
|
|
@ -165,6 +347,18 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel |
|
|
|
formVal.inputDate = formVal.inputDate ? formVal.inputDate + '.000' : ''; |
|
|
|
formVal.inputDate = formVal.inputDate ? formVal.inputDate + '.000' : ''; |
|
|
|
// 置标标签数据
|
|
|
|
// 置标标签数据
|
|
|
|
formVal.labelStr = JSON.stringify(layui.datalabel.getData(formVal.id, 'file')); |
|
|
|
formVal.labelStr = JSON.stringify(layui.datalabel.getData(formVal.id, 'file')); |
|
|
|
|
|
|
|
//取文件的发文编号
|
|
|
|
|
|
|
|
var fileNums = []; |
|
|
|
|
|
|
|
//文件名称
|
|
|
|
|
|
|
|
var eleNames = $("td[data-field='fileName']"); |
|
|
|
|
|
|
|
//文件对应发文编号
|
|
|
|
|
|
|
|
var eleNums = $(".layui-table tbody").find("input[name='fileNumber']"); |
|
|
|
|
|
|
|
for(var i=0; i<eleNames.length;i++){ |
|
|
|
|
|
|
|
if(!!eleNums[i].value){ |
|
|
|
|
|
|
|
fileNums.push({name: eleNames[i].innerText, number: eleNums[i].value}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
formVal.fileNumbers = JSON.stringify(fileNums); |
|
|
|
console.log(formVal) |
|
|
|
console.log(formVal) |
|
|
|
//数据只能编码
|
|
|
|
//数据只能编码
|
|
|
|
return formVal; |
|
|
|
return formVal; |
|
|
|