|
@@ -14,6 +14,31 @@ const isPre = function (data) {
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
|
|
|
+ const fileObj = {
|
|
|
+ generateFilesHtml(data) {
|
|
|
+ const id = data.id, files = data.proof_file;
|
|
|
+ let html = [];
|
|
|
+ if (files !== null && files !== undefined) {
|
|
|
+ for (const [i, f] of files.entries()) {
|
|
|
+ html.push('<tr>');
|
|
|
+ html.push('<td style="width: 200px">', f.filename + f.fileext, '</td>');
|
|
|
+ html.push('<td>', f.username, '</td>');
|
|
|
+ html.push('<td>', f.in_time, '</td>');
|
|
|
+ html.push('<td>');
|
|
|
+ // 下载
|
|
|
+ html.push('<a href="' + window.location.pathname + '/file/download?id=' + id + '&index=' + i + ' title="下载><i class="fa fa-download "></i></a>');
|
|
|
+ // 删除
|
|
|
+ if (!readOnly && uploadPermission && !isPre(data)) {
|
|
|
+ html.push('<a class="delete-att text-danger" href="javascript:void(0);" data-id ="' + id + '"file-index="' + i + '" title="删除"><i class="fa fa-remove "></i></a>');
|
|
|
+ }
|
|
|
+ html.push('</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#file-list').html(html.join(''));
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
let datepicker;
|
|
|
const spreadSetting = {
|
|
|
cols: [
|
|
@@ -27,7 +52,17 @@ $(document).ready(() => {
|
|
|
},
|
|
|
},
|
|
|
{title: '编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 150, formatter: '@', readOnly: isPre, },
|
|
|
- {title: '依据材料证明', colSpan: '1', rowSpan: '1', field: 'proof', hAlign: 0, width: 180, formatter: '@', readOnly: isPre, },
|
|
|
+ {title: '发文单位', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 150, formatter: '@', readOnly: isPre},
|
|
|
+ {
|
|
|
+ title: '依据材料证明', colSpan: '1', rowSpan: '1', field: 'proof_file', hAlign: 1, width: 80, formatter: '@',
|
|
|
+ readOnly: true, cellType: 'imageBtn', normalImg: '#rela-file-icon', hoverImg: '#rela-file-hover',
|
|
|
+ getValue: function (data) {
|
|
|
+ return data.proof_file ? data.proof_file.length : 0;
|
|
|
+ },
|
|
|
+ showImage: function (data) {
|
|
|
+ return data !== undefined && data !== null;
|
|
|
+ },
|
|
|
+ },
|
|
|
{
|
|
|
title: '计量期', colSpan: '1', rowSpan: '1', field: 'sorder', hAlign: 1, width: 100, formatter: '@',
|
|
|
getValue: function (data) {
|
|
@@ -49,38 +84,45 @@ $(document).ready(() => {
|
|
|
const setting = hitinfo.sheet.zh_setting;
|
|
|
if (!setting) return;
|
|
|
const col = setting.cols[hitinfo.col];
|
|
|
- if (!col || col.field !== 'real_time') return;
|
|
|
-
|
|
|
- const pos = SpreadJsObj.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
- if (!datepicker) {
|
|
|
- datepicker = $('.datepicker-here').datepicker({
|
|
|
- language: 'zh',
|
|
|
- dateFormat: 'yyyy-MM-dd',
|
|
|
- autoClose: true,
|
|
|
- onSelect: function (formattedDate, date, inst) {
|
|
|
- if (!inst.visible) return;
|
|
|
- const sels = hitinfo.sheet.getSelections();
|
|
|
- if (!sels || !sels[0]) return;
|
|
|
- const node = SpreadJsObj.getSelectObject(hitinfo.sheet);
|
|
|
- const uData = { update: {id: node.id, real_time: date} };
|
|
|
+ if (!col) return;
|
|
|
|
|
|
- postData(window.location.pathname + '/update', uData, function (result) {
|
|
|
- bonusObj.loadUpdateData(result);
|
|
|
- SpreadJsObj.reLoadRowData(hitinfo.sheet, sels[0].row);
|
|
|
- }, function () {
|
|
|
- SpreadJsObj.reLoadRowData(hitinfo.sheet, sels[0].row);
|
|
|
- });
|
|
|
- }
|
|
|
- }).data('datepicker');
|
|
|
+ if (col.field === 'proof_file') {
|
|
|
+ fileObj.generateFilesHtml(data);
|
|
|
+ $('#file').modal('show');
|
|
|
}
|
|
|
- const value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
|
|
|
- if (value) {
|
|
|
- datepicker.selectDate(value);
|
|
|
- } else {
|
|
|
- datepicker.clear();
|
|
|
+
|
|
|
+ if (col.field === 'real_time') {
|
|
|
+ const pos = SpreadJsObj.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
+ if (!datepicker) {
|
|
|
+ datepicker = $('.datepicker-here').datepicker({
|
|
|
+ language: 'zh',
|
|
|
+ dateFormat: 'yyyy-MM-dd',
|
|
|
+ autoClose: true,
|
|
|
+ onSelect: function (formattedDate, date, inst) {
|
|
|
+ if (!inst.visible) return;
|
|
|
+ const sels = hitinfo.sheet.getSelections();
|
|
|
+ if (!sels || !sels[0]) return;
|
|
|
+ const node = SpreadJsObj.getSelectObject(hitinfo.sheet);
|
|
|
+ const uData = { update: {id: node.id, real_time: date} };
|
|
|
+
|
|
|
+ postData(window.location.pathname + '/update', uData, function (result) {
|
|
|
+ bonusObj.loadUpdateData(result);
|
|
|
+ SpreadJsObj.reLoadRowData(hitinfo.sheet, sels[0].row);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(hitinfo.sheet, sels[0].row);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).data('datepicker');
|
|
|
+ }
|
|
|
+ const value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
|
|
|
+ if (value) {
|
|
|
+ datepicker.selectDate(value);
|
|
|
+ } else {
|
|
|
+ datepicker.clear();
|
|
|
+ }
|
|
|
+ datepicker.show();
|
|
|
+ $('#datepickers-container').css('top', hitinfo.cellRect.y + pos.y).css('left', hitinfo.cellRect.x + pos.x);
|
|
|
}
|
|
|
- datepicker.show();
|
|
|
- $('#datepickers-container').css('top', hitinfo.cellRect.y + pos.y).css('left', hitinfo.cellRect.x + pos.x);
|
|
|
}
|
|
|
};
|
|
|
|