|
|
@@ -14,13 +14,17 @@
|
|
|
<div class="title">{{ report_title }}</div>
|
|
|
<div class="save" v-if="save_status == -1"></div>
|
|
|
<div class="save" v-if="save_status == 0">
|
|
|
- 未保存
|
|
|
+ <icon-check-circle class="save_icon" />
|
|
|
+ 上次修改发生在:{{ last_save_time }}
|
|
|
<a-tooltip content="使用Ctrl+S快捷键保存">
|
|
|
<span class="shortcut-hint" @click="saveHtmlFunc">(Ctrl+S)</span>
|
|
|
</a-tooltip>
|
|
|
</div>
|
|
|
<div class="save" v-if="save_status == 1"><a-spin />保存中</div>
|
|
|
- <div class="save" v-if="save_status == 2">已保存{{ save_time }}</div>
|
|
|
+ <div class="save" v-if="save_status == 2">
|
|
|
+ <icon-check-circle class="save_icon" />
|
|
|
+ 已保存
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="tools-right">
|
|
|
<a-tooltip content="复制">
|
|
|
@@ -95,6 +99,8 @@ const is_loading = ref(false);
|
|
|
const save_status = ref(-1);
|
|
|
// 保存时间
|
|
|
const save_time = ref('10:20');
|
|
|
+// 上次保存事件
|
|
|
+const last_save_time = ref('');
|
|
|
// 定时器,定时保存文本内容
|
|
|
let timeout_interval = null;
|
|
|
|
|
|
@@ -113,7 +119,7 @@ const changeSaveStatus = () => {
|
|
|
}
|
|
|
timeout_interval = setTimeout(() => {
|
|
|
saveHtmlFunc();
|
|
|
- }, 1000 * 10);
|
|
|
+ }, 1000 * 30);
|
|
|
};
|
|
|
const itemClick = (item) => {
|
|
|
target_active_item.value = item;
|
|
|
@@ -143,12 +149,18 @@ const toDownload = (item) => {
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
+ <style>
|
|
|
+ body {
|
|
|
+ font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
<title>Document</title>
|
|
|
</head>
|
|
|
<body>
|
|
|
${fullHtml}
|
|
|
</body>
|
|
|
</html>`;
|
|
|
+ console.log(htmlString);
|
|
|
try {
|
|
|
asBlob(htmlString).then((data) => {
|
|
|
// console.log(data);
|
|
|
@@ -174,6 +186,15 @@ const getReportHtml = async (record_id) => {
|
|
|
if (res.data?.title) {
|
|
|
report_title.value = res.data.title;
|
|
|
}
|
|
|
+ if (res.data?.updated_at) {
|
|
|
+ let timeStr = res.data.updated_at;
|
|
|
+ console.log(timeStr);
|
|
|
+ last_save_time.value = timeStr.slice(0, 16);
|
|
|
+ console.log(last_save_time.value);
|
|
|
+ } else {
|
|
|
+ last_save_time.value = getCurrentTime();
|
|
|
+ }
|
|
|
+
|
|
|
// console.log(html_content.value, report_title.value, 99);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
@@ -211,7 +232,7 @@ const saveHtmlFunc = async () => {
|
|
|
id: id.value,
|
|
|
title: report_title.value,
|
|
|
record_id: target_record_id.value,
|
|
|
- html_content: my_editor.value.getHtml()
|
|
|
+ html_content: my_editor.value?.getHtml()
|
|
|
};
|
|
|
try {
|
|
|
const res = await saveHtml(data);
|