feat: 网站日志增加清空功能 (#1134)

This commit is contained in:
zhengkunwang223 2023-05-24 21:40:35 +08:00 committed by GitHub
parent aa3e8783ae
commit b84c983727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,9 @@
>
{{ $t('file.download') }}
</el-button>
<el-button style="margin-left: 20px" @click="cleanLog" icon="Delete" :disabled="data.content === ''">
{{ $t('commons.button.clean') }}
</el-button>
</div>
</div>
<br />
@ -43,6 +46,7 @@ import { oneDark } from '@codemirror/theme-one-dark';
import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
import { OpWebsiteLog } from '@/api/modules/website';
import { dateFormatForName } from '@/utils/util';
import { useDeleteData } from '@/hooks/use-delete-data';
const extensions = [javascript(), oneDark];
const props = defineProps({
@ -124,6 +128,20 @@ const updateEnable = () => {
});
};
const cleanLog = async () => {
const req = {
id: id.value,
operate: 'delete',
logType: logType.value,
};
try {
await useDeleteData(OpWebsiteLog, req, 'commons.msg.delete');
getContent();
} catch (error) {
} finally {
}
};
const onDownload = async () => {
const downloadUrl = window.URL.createObjectURL(new Blob([data.value.content]));
const a = document.createElement('a');