Compare commits
2 Commits
ca1a095612
...
0c35c181ec
| Author | SHA1 | Date |
|---|---|---|
|
|
0c35c181ec | |
|
|
c092634558 |
|
|
@ -41,6 +41,16 @@ layui.use(['form', 'laydate', 'upload', 'element'], function () {
|
|||
getTeamBySubIdToData($("#subId").val(), data.value);
|
||||
});
|
||||
|
||||
form.on('select(postId)', function(data){
|
||||
var selectedOption = $(data.elem).find('option:selected');
|
||||
var isSpecial = selectedOption.attr('data-is-special')
|
||||
if(isSpecial === '1') {
|
||||
$('#targetDiv').show();
|
||||
} else {
|
||||
$('#targetDiv').hide();
|
||||
}
|
||||
});
|
||||
|
||||
var minListDate = "1990-01-01"; //最小可选时间,例:1990-02-01
|
||||
var maxListDate = "2200-12-31"; //最大可选时间,例:2200-12-31
|
||||
var begin = "#signDate",
|
||||
|
|
@ -178,6 +188,7 @@ layui.use(['form', 'laydate', 'upload', 'element'], function () {
|
|||
uploadTeamExamFIle(1);
|
||||
|
||||
uploadCheckup(1);
|
||||
uploadSpecial(5);
|
||||
|
||||
//监听开关事件(班组、工程选择)
|
||||
form.on("switch(teamAndProChooseSwitch)", function (data) {
|
||||
|
|
@ -2178,3 +2189,72 @@ function uploadCheckup(number){
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function uploadSpecial(number){
|
||||
var uploadup = upload.render({
|
||||
elem: '#special_img',
|
||||
url: fileUrl + '/file/upload', //改成您自己的上传接口
|
||||
multiple: false, //是否允许多文件上传,默认未false
|
||||
dataType: "json",
|
||||
exts: 'pdf|PDF',
|
||||
auto: true, //是否自动上传 ,默认为true
|
||||
number: number, //最大上传数量
|
||||
size: 1024*30, //最大文件大小,单位k
|
||||
bindAction: '#hideUploadCheckup', //绑定的按钮
|
||||
field: 'file', //传到后台的字段名,默认file
|
||||
choose: function (obj) {
|
||||
flag = false;
|
||||
// 清空现有预览和文件信息
|
||||
$('#specialProve').empty();
|
||||
CheckupFiles = {};
|
||||
checkupFilePath = ''; // 确保清除旧的文件路径
|
||||
|
||||
obj.preview(function (index, file, result) {
|
||||
$("#previewSpecialProve").css("display", "");
|
||||
var previewImgSrc = "../../../../img/filetype/pdf.png"; // 预览图片源
|
||||
|
||||
$('#specialProve').append(
|
||||
'<div id="' + index + '" style="display: inline-block;text-align: center;width:150px">' +
|
||||
'<img src="' + previewImgSrc + '" alt="' + file.name + '" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img ">' +
|
||||
'<div><span>' + (file.name.length > 8 ? (file.name.substr(0, 8) + "..") : file.name) + '</span></div>' +
|
||||
'</div>'
|
||||
);
|
||||
});
|
||||
},
|
||||
before: function (obj) {
|
||||
this.data = {
|
||||
photoType: "exam_checkup",
|
||||
};
|
||||
if ($("[name='brand']").val() == '') {
|
||||
return false;
|
||||
} else {
|
||||
var names = '';
|
||||
layui.each(CheckupFiles, function (index, file) {
|
||||
names += file.name + ',';
|
||||
});
|
||||
$("[name='image']").val(names)
|
||||
}
|
||||
return true;
|
||||
},
|
||||
done: function (data) {
|
||||
if(data.code === 200) {
|
||||
layer.msg('上传成功');
|
||||
checkupFilePath = data.data.url;
|
||||
} else {
|
||||
layer.msg('上传失败');
|
||||
$('#specialProve').empty();
|
||||
checkupFilePath = '';
|
||||
}
|
||||
},
|
||||
allDone: function (data) {
|
||||
// parent.layer.msg('新增体检报告成功');
|
||||
},
|
||||
error: function (e) {
|
||||
layer.msg('上传失败');
|
||||
$('#specialProve').empty();
|
||||
checkupFilePath = '';
|
||||
console.log(e)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue