|
@@ -109,34 +109,13 @@ IntegralInfoDlg.validate = function () {
|
|
|
IntegralInfoDlg.initFileTypeColumn = function () {
|
|
|
return [
|
|
|
{field: 'selectItem', checkbox: false, visible: false},
|
|
|
- {title: '名称', field: 'name', visible: true, align: 'left', valign: 'middle', width: "82%", 'class': 'uitd_showTip',
|
|
|
+ {title: '附件列表', field: 'name', visible: true, align: 'left', valign: 'middle', width: "100%", 'class': 'uitd_showTip',
|
|
|
formatter: function (value, row, index) {
|
|
|
- let str = '<div class="word-wrap">';
|
|
|
- if (row.must == 1) {
|
|
|
- str = str + '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
|
|
|
- }
|
|
|
- if (row.must == 2) {
|
|
|
- str = str + '<i class="fa fa-paste"></i>' + value;
|
|
|
- }
|
|
|
- str = str + '<br /><span id="desc_' + row.rel + '">' + row.description + '</span></div>'
|
|
|
- return str;
|
|
|
- }
|
|
|
- },
|
|
|
- {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
|
|
|
- formatter: function (value, row, index) {
|
|
|
- if (value == null || value == '' || value == 'null') {
|
|
|
- return '无';
|
|
|
- }
|
|
|
- return "<button type='button' onclick=\"IntegralInfoDlg.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
|
|
|
- "<i class=\"fa fa-download\"></i>下载" +
|
|
|
- "</button>";
|
|
|
+ return '<span style="color:#ff0000;">申报"' + value + '"积分项目需要上传以下附件(带*号的附件必需上传)</span>';
|
|
|
}
|
|
|
},
|
|
|
- {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
|
|
|
- formatter: function (value, row, index) {
|
|
|
- return IntegralInfoDlg.validUploadButton(1, value, '');
|
|
|
- }
|
|
|
- }
|
|
|
+ {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%"},
|
|
|
+ {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%"}
|
|
|
]
|
|
|
};
|
|
|
IntegralInfoDlg.addItem = function () {
|
|
@@ -226,32 +205,72 @@ IntegralInfoDlg.changeAndLoadFile = function () {
|
|
|
return {classes: ""};
|
|
|
},
|
|
|
onPostBody: function (data) {
|
|
|
- for (var k in data) {
|
|
|
- var files = data[k].files;
|
|
|
- var html = '<ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
|
|
|
- for (var key in files) {
|
|
|
- var btn = "";
|
|
|
- btn = IntegralInfoDlg.validUploadButton(2, data[k].id, files[key].id);
|
|
|
- var sn = files[key].url.lastIndexOf(".");
|
|
|
- var suffix = files[key].ext; //files[key].url.substring(sn + 1, files[key].url.length);
|
|
|
- var imgStr = "";
|
|
|
- if (suffix == "pdf" || suffix == "PDF") {
|
|
|
- imgStr = "<button type='button' onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
|
|
|
- } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
|
|
|
- imgStr = "<button type='button' onclick=\"Feng.showExcel('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
|
|
|
+ for (var i in data) {
|
|
|
+ var fileTypes = data[i].fileTypes;
|
|
|
+ for (var k in fileTypes) {
|
|
|
+ var fileType = fileTypes[k];
|
|
|
+ /**-- 构造附件类型标题栏 --**/
|
|
|
+
|
|
|
+ let name = '<div class="word-wrap">';
|
|
|
+ if (fileType.must == 1) {
|
|
|
+ name = name + '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + fileType.name;
|
|
|
+ }
|
|
|
+ if (fileType.must == 2) {
|
|
|
+ name = name + '<i class="fa fa-paste"></i>' + fileType.name;
|
|
|
+ }
|
|
|
+ name = name + '<br />' + fileType.description + '</div>'
|
|
|
+
|
|
|
+ var template = "";
|
|
|
+ if (fileType.templateUrl == null || fileType.templateUrl == '' || fileType.templateUrl == 'null') {
|
|
|
+ template = '无';
|
|
|
} else {
|
|
|
- imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
|
|
|
+ template = "<button type='button' onclick=\"IntegralInfoDlg.downloadFile('" + fileType.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
|
|
|
+ "<i class=\"fa fa-download\"></i>下载" +
|
|
|
+ "</button>";
|
|
|
}
|
|
|
+ var uploadBtn = IntegralInfoDlg.validUploadButton(1, fileType.id, '', data[i].id);
|
|
|
+
|
|
|
+ var tr = '<tr class="subTitleLine"><td class="uitd_showTip" style="text-align: left; vertical-align: middle; width: 82%; ">'
|
|
|
+ + name +
|
|
|
+ '</td>\n\
|
|
|
+ \n\
|
|
|
+ <td style="text-align: center; vertical-align: middle; width: 8%; ">' + template +
|
|
|
+ '</td>\n\
|
|
|
+ <td style="text-align: center; vertical-align: middle; width: 10%; ">' + uploadBtn +
|
|
|
+ '</td></tr>';
|
|
|
+
|
|
|
+ /**-- --**/
|
|
|
+ var typeId = fileType.id;
|
|
|
+ var files = fileType.files;
|
|
|
+ var html = '<ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
|
|
|
+ for (var key in files) {
|
|
|
+ var btn = "";
|
|
|
+ btn = IntegralInfoDlg.validUploadButton(2, typeId, files[key].id, files[key].relationId);
|
|
|
+ var sn = files[key].url.lastIndexOf(".");
|
|
|
+ var suffix = files[key].ext; //files[key].url.substring(sn + 1, files[key].url.length);
|
|
|
+ var imgStr = "";
|
|
|
+ if (suffix == "pdf" || suffix == "PDF") {
|
|
|
+ imgStr = "<button type='button' onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
|
|
|
+ } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
|
|
|
+ imgStr = "<button type='button' onclick=\"Feng.showExcel('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
|
|
|
+ } else {
|
|
|
+ imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
|
|
|
+ }
|
|
|
|
|
|
- html += '<li data-id="' + files[key].id + '">\n\
|
|
|
- <div>' + (data[k].step != 1 ? '<input type="hidden" name="uploadFiles[]" value="' + files[key].id + '">' : "") + '</div>\n' +
|
|
|
- '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
|
|
|
- '<div style="width: 10%;">' + imgStr + '</div>\n' +
|
|
|
- '<div style="width: 20%;">' + btn + '</div>\n\
|
|
|
+ html += '<li data-id="' + files[key].id + '">\n\
|
|
|
+ <div><input type="hidden" name="uploadFiles[]" value="' + files[key].id + '"></div>\n' +
|
|
|
+ '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
|
|
|
+ '<div style="width: 10%;">' + imgStr + '</div>\n' +
|
|
|
+ '<div style="width: 20%;">' + btn + '</div>\n\
|
|
|
</li>';
|
|
|
+ }
|
|
|
+ html = html + '</ul>';
|
|
|
+ table.find("tr[data-index='" + i + "'] td").eq(0).attr("colspan", 3);
|
|
|
+ table.find("tr[data-index='" + i + "'] td").eq(1).remove();
|
|
|
+ table.find("tr[data-index='" + i + "'] td").eq(2).remove();
|
|
|
+ table.find("tr[data-index='" + i + "']").after(tr);
|
|
|
+ table.find("tr[data-index='" + i + "']").next(".subTitleLine").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
|
|
|
}
|
|
|
- html = html + '</ul>';
|
|
|
- table.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
|
|
|
}
|
|
|
$("td.uitd_showTip").bind("mouseover", function () {
|
|
|
var htm = $(this).html();
|
|
@@ -266,6 +285,7 @@ IntegralInfoDlg.changeAndLoadFile = function () {
|
|
|
queryData["mainId"] = $("#id").val();
|
|
|
queryData['project'] = CONFIG.project_integral_apply;
|
|
|
queryData['type'] = $("#type").val();
|
|
|
+ queryData['pageToken'] = $("input[name=__token__]").val();
|
|
|
queryData["itemId"] = item_id;
|
|
|
queryData['checkState'] = $("#checkState").val();
|
|
|
ajax.set(queryData);
|
|
@@ -413,22 +433,31 @@ IntegralInfoDlg.validId = function () {
|
|
|
var currentTable = null;
|
|
|
var currentTr = null;
|
|
|
//选择附件并显示附件名
|
|
|
-IntegralInfoDlg.checkFile = function (content, fileTypeId, fileId) {
|
|
|
+IntegralInfoDlg.checkFile = function (content, fileTypeId, fileId, itemId) {
|
|
|
currentTable = $(content).parents(".fileTable");
|
|
|
- currentTr = $(content).parents("tr").data("index");
|
|
|
+ var findTr = null;
|
|
|
+ var curTr = $(content).parents("tr");
|
|
|
+ while (!findTr) {
|
|
|
+ if (curTr.prev("tr[data-index]")) {
|
|
|
+ findTr = curTr.prev("tr[data-index]")
|
|
|
+ } else {
|
|
|
+ curTr = curTr.prev();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ currentTr = findTr.data("index");
|
|
|
if (!IntegralInfoDlg.validateIsEdit())
|
|
|
return;
|
|
|
$("#upload_file").unbind("change");
|
|
|
$("#upload_file").change(function () {
|
|
|
if (!Feng.chkFileInvalid(this.files[0], 5, 10))
|
|
|
return;
|
|
|
- IntegralInfoDlg.upload(fileTypeId, fileId);
|
|
|
+ IntegralInfoDlg.upload(fileTypeId, fileId, itemId);
|
|
|
});
|
|
|
$('#upload_file').val("");
|
|
|
$('#upload_file').click();
|
|
|
}
|
|
|
//上传附件
|
|
|
-IntegralInfoDlg.upload = function (fileTypeId, fileId) {
|
|
|
+IntegralInfoDlg.upload = function (fileTypeId, fileId, itemId) {
|
|
|
var id = $("#id").val();
|
|
|
if (!IntegralInfoDlg.validateIsEdit())
|
|
|
return;
|
|
@@ -441,6 +470,8 @@ IntegralInfoDlg.upload = function (fileTypeId, fileId) {
|
|
|
$("#fileTypeId").val(fileTypeId);
|
|
|
var index = layer.load(0, {shade: false, time: 0});
|
|
|
$("#index").val(index);
|
|
|
+ $("#relationId").val(itemId);
|
|
|
+ $("#pageToken").val($("input[name=__token__]").val());
|
|
|
$("#uploadForm").submit();
|
|
|
}
|
|
|
//删除附件
|
|
@@ -549,18 +580,18 @@ IntegralInfoDlg.validateIsEdit = function () {
|
|
|
* @param row
|
|
|
* @returns {string}
|
|
|
*/
|
|
|
-IntegralInfoDlg.validUploadButton = function (type, fileTypeId, fileId) {
|
|
|
+IntegralInfoDlg.validUploadButton = function (type, fileTypeId, fileId, itemId) {
|
|
|
var files = $("#files").val();
|
|
|
files = files.split(",");
|
|
|
var checkState = $("#checkState").val();
|
|
|
var realState = $("#realState").val();
|
|
|
if (Feng.isEmptyStr(checkState) || checkState == 0 || (checkState == 1 && realState == 1) || (realState == 4 && files[0] == 1)) {
|
|
|
if (type == 1) { //上传
|
|
|
- return "<button type='button' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + null + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
|
|
|
+ return "<button type='button' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + null + "," + itemId + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
|
|
|
"<i class=\"fa fa-upload\"></i>上传" +
|
|
|
"</button>";
|
|
|
} else {
|
|
|
- return "<button type=\'button\' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + fileId + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
|
|
|
+ return "<button type=\'button\' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + fileId + "," + itemId + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
|
|
|
"<i class=\"fa fa-paste\"></i>修改" +
|
|
|
"</button>" +
|
|
|
"<button type='button' onclick=\"IntegralInfoDlg.deleteFile(" + fileId + ")\" class=\"btn btn-xs btn-danger\">" +
|
|
@@ -598,10 +629,10 @@ IntegralInfoDlg.callBack = function (data) {
|
|
|
<div style="width: 70%;">' + data.orignName + '</div>\n\
|
|
|
<div style="width: 10%;">' + imgStr + '</div>\n\
|
|
|
<div style="width: 20%;">\n\
|
|
|
-<button type="button" onclick="IntegralInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
|
|
|
+<button type="button" onclick="IntegralInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ',' + data.itemId + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
|
|
|
<button type="button" onclick="IntegralInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
|
|
|
</div></li></ul>';
|
|
|
- $(currentTable).find("tr[data-index='" + currentTr + "']").next("tr.detail-view").find(".imgs").append(html);
|
|
|
+ $(currentTable).find("tr[data-index='" + currentTr + "']").next().next().find(".imgs").append(html);
|
|
|
}
|
|
|
}
|
|
|
}
|