mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
parent
347689efef
commit
0a70ce398f
|
|
@ -225,8 +225,9 @@ export const exportExcel: (
|
|||
params: any,
|
||||
loading?: NProgress | Ref<boolean>
|
||||
) => {
|
||||
return promise(request({ url: url, method: 'get', params, responseType: 'blob' }), loading)
|
||||
.then((res: any) => {
|
||||
return promise(request({ url: url, method: 'get', params, responseType: 'blob' }), loading).then(
|
||||
(res: any) => {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
const blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
|
|
@ -239,8 +240,8 @@ export const exportExcel: (
|
|||
window.URL.revokeObjectURL(link.href)
|
||||
}
|
||||
return true
|
||||
})
|
||||
.catch((e) => {})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export const exportExcelPost: (
|
||||
|
|
@ -265,22 +266,20 @@ export const exportExcelPost: (
|
|||
responseType: 'blob'
|
||||
}),
|
||||
loading
|
||||
)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
const blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const link = document.createElement('a')
|
||||
link.href = window.URL.createObjectURL(blob)
|
||||
link.download = fileName
|
||||
link.click()
|
||||
// 释放内存
|
||||
window.URL.revokeObjectURL(link.href)
|
||||
}
|
||||
return true
|
||||
})
|
||||
.catch((e) => {})
|
||||
).then((res: any) => {
|
||||
if (res) {
|
||||
const blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const link = document.createElement('a')
|
||||
link.href = window.URL.createObjectURL(blob)
|
||||
link.download = fileName
|
||||
link.click()
|
||||
// 释放内存
|
||||
window.URL.revokeObjectURL(link.href)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
export const download: (
|
||||
|
|
|
|||
|
|
@ -187,9 +187,10 @@
|
|||
<template #default="{ row }">
|
||||
<div @click.stop>
|
||||
<el-switch
|
||||
:loading="loading"
|
||||
size="small"
|
||||
v-model="row.is_active"
|
||||
@change="changeState($event, row)"
|
||||
:before-change="() => changeState(row)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -678,18 +679,24 @@ function deleteDocument(row: any) {
|
|||
更新名称或状态
|
||||
*/
|
||||
function updateData(documentId: string, data: any, msg: string) {
|
||||
documentApi.putDocument(id, documentId, data, loading).then((res) => {
|
||||
const index = documentData.value.findIndex((v) => v.id === documentId)
|
||||
documentData.value.splice(index, 1, res.data)
|
||||
MsgSuccess(msg)
|
||||
})
|
||||
documentApi
|
||||
.putDocument(id, documentId, data, loading)
|
||||
.then((res) => {
|
||||
const index = documentData.value.findIndex((v) => v.id === documentId)
|
||||
documentData.value.splice(index, 1, res.data)
|
||||
MsgSuccess(msg)
|
||||
return true
|
||||
})
|
||||
.catch(() => {
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function changeState(bool: Boolean, row: any) {
|
||||
function changeState(row: any) {
|
||||
const obj = {
|
||||
is_active: bool
|
||||
is_active: !row.is_active
|
||||
}
|
||||
const str = bool ? '启用成功' : '禁用成功'
|
||||
const str = !row.is_active ? '启用成功' : '禁用成功'
|
||||
currentMouseId.value && updateData(row.id, obj, str)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,8 +104,9 @@
|
|||
>
|
||||
<div class="active-button" @click.stop>
|
||||
<el-switch
|
||||
:loading="loading"
|
||||
v-model="item.is_active"
|
||||
@change="changeState($event, item)"
|
||||
:before-change="() => changeState(item)"
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -162,7 +163,6 @@
|
|||
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
|
||||
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -258,11 +258,20 @@ function searchHandle() {
|
|||
getParagraphList()
|
||||
}
|
||||
|
||||
function changeState(bool: Boolean, row: any) {
|
||||
function changeState(row: any) {
|
||||
const obj = {
|
||||
is_active: bool
|
||||
is_active: !row.is_active
|
||||
}
|
||||
paragraph.asyncPutParagraph(id, documentId, row.id, obj, changeStateloading).then((res) => {})
|
||||
paragraph
|
||||
.asyncPutParagraph(id, documentId, row.id, obj, changeStateloading)
|
||||
.then((res) => {
|
||||
const index = paragraphDetail.value.findIndex((v) => v.id === row.id)
|
||||
paragraphDetail.value[index].is_active = !paragraphDetail.value[index].is_active
|
||||
return true
|
||||
})
|
||||
.catch(() => {
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function deleteParagraph(row: any) {
|
||||
|
|
@ -328,7 +337,6 @@ function refresh(data: any) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const GenerateRelatedDialogRef = ref()
|
||||
function openGenerateDialog(row?: any) {
|
||||
const arr: string[] = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue