|
|
@@ -9,7 +9,7 @@
|
|
|
import Common from '../common/Common';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
import { ajaxApiFile } from '../common/utils.js';
|
|
|
-import { DownloadService } from 'pc-component-v3';
|
|
|
+import { DownloadService, Notify } from 'pc-component-v3';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -34,6 +34,7 @@ export default {
|
|
|
data: function () {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ traceConfigDto: {},
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -161,23 +162,23 @@ export default {
|
|
|
const clipboardData = e.originalEvent.clipboardData;
|
|
|
if (!clipboardData) return;
|
|
|
let handled = false;
|
|
|
-
|
|
|
+
|
|
|
// 获取 trumbowyg 实例
|
|
|
const trumbowyg = $('#editor').data('trumbowyg');
|
|
|
-
|
|
|
+
|
|
|
for (let i = 0; i < clipboardData.items.length; i++) {
|
|
|
const item = clipboardData.items[i];
|
|
|
if (item.type.indexOf('image') !== -1) {
|
|
|
const file = item.getAsFile();
|
|
|
if (file) {
|
|
|
handled = true;
|
|
|
-
|
|
|
+
|
|
|
// 插入临时文本作为标记
|
|
|
const tempId = 'img-placeholder-' + Date.now();
|
|
|
if (trumbowyg) {
|
|
|
trumbowyg.execCmd('insertText', `[图片上传中${tempId}]`);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 上传图片
|
|
|
_self.uploadImg(file, function (imagUrl) {
|
|
|
// 上传完成后,替换临时文本为图片
|
|
|
@@ -188,7 +189,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果粘贴的是图片,阻止默认行为
|
|
|
if (handled) {
|
|
|
e.preventDefault();
|
|
|
@@ -213,7 +214,7 @@ export default {
|
|
|
});
|
|
|
|
|
|
// Common.downloadByA();
|
|
|
-
|
|
|
+ this.getTraceConfig();
|
|
|
},
|
|
|
unmounted() {
|
|
|
$('#editor').trumbowyg('destroy');
|
|
|
@@ -261,8 +262,15 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
//附件大小时默认8m
|
|
|
- var size = 8;
|
|
|
-
|
|
|
+ var size = undefined;
|
|
|
+ const { commentAttachmentSize } = _self.traceConfigDto;
|
|
|
+ if (commentAttachmentSize) {
|
|
|
+ size = commentAttachmentSize;
|
|
|
+ }
|
|
|
+ //当系统没有配置附件大小时默认8m
|
|
|
+ if (size == undefined) {
|
|
|
+ size = 8;
|
|
|
+ }
|
|
|
if (selectedFile.size / 1024 <= 1024 * size) {
|
|
|
var formData = new FormData();
|
|
|
formData.append('files', selectedFile);
|
|
|
@@ -297,10 +305,30 @@ export default {
|
|
|
_self.loading = false;
|
|
|
Notify.error(
|
|
|
'提示',
|
|
|
- '文件大小不能超过' + size,
|
|
|
+ '文件大小不能超过' + size + 'M',
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 获取任务管理配置
|
|
|
+ */
|
|
|
+ getTraceConfig: function () {
|
|
|
+ var _self = this;
|
|
|
+ $.ajax({
|
|
|
+ url: Common.getApiURL('TraceConfigResource/queryTraceConfigDto'),
|
|
|
+ type: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ beforeSend: function (request) {
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ if (data) _self.traceConfigDto = data;
|
|
|
+ },
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
+ Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
|