1212 :modelValue =" data.content"
1313 class =" maxkb-md"
1414 />
15+ <el-card shadow =" always" style =" --el-card-padding : 8px 12px ; --el-card-border-radius : 8px " >
16+ <el-switch
17+ :loading =" changeStateloading"
18+ v-model =" data.is_active"
19+ :before-change =" () => changeState(data)"
20+ size =" small"
21+ />
22+
23+ <el-divider direction =" vertical" />
24+ <el-button link >
25+ <el-icon :size =" 16" :title =" $t('views.applicationWorkflow.control.zoomOut')"
26+ ><ZoomOut
27+ /></el-icon >
28+ </el-button >
29+ <el-dropdown trigger =" click" >
30+ <el-button text >
31+ <el-icon ><MoreFilled /></el-icon >
32+ </el-button >
33+ <template #dropdown >
34+ <el-dropdown-menu >
35+ <el-dropdown-item @click =" openGenerateDialog(data)" >
36+ <el-icon ><Connection /></el-icon >
37+ {{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
38+ >
39+ <el-dropdown-item @click =" openSelectDocumentDialog(data)" >
40+ <AppIcon iconName =" app-migrate" ></AppIcon >
41+ {{ $t('views.document.setting.migration') }}</el-dropdown-item
42+ >
43+ <el-dropdown-item icon =" Delete" @click.stop =" deleteParagraph(data)" >{{
44+ $t('common.delete')
45+ }}</el-dropdown-item >
46+ </el-dropdown-menu >
47+ </template >
48+ </el-dropdown >
49+ </el-card >
1550 </el-card >
1651</template >
1752<script setup lang="ts">
1853import { ref , useSlots } from ' vue'
54+ import { useRoute } from ' vue-router'
1955import { t } from ' @/locales'
56+ import useStore from ' @/stores'
57+ import GenerateRelatedDialog from ' @/components/generate-related-dialog/index.vue'
58+ import { MsgSuccess , MsgConfirm } from ' @/utils/message'
59+ const { paragraph } = useStore ()
60+
61+ const route = useRoute ()
62+ const {
63+ params : { id, documentId },
64+ } = route as any
2065const props = defineProps <{
2166 data: any
2267}>()
2368
69+ const SelectDocumentDialogRef = ref ()
70+ const changeStateloading = ref (false )
2471const show = ref (false )
2572// card上面存在dropdown菜单
2673const subHovered = ref (false )
@@ -33,8 +80,52 @@ function cardLeave() {
3380 show .value = subHovered .value
3481}
3582
36- function subHoveredEnter() {
37- subHovered .value = true
83+ function changeState(row : any ) {
84+ const obj = {
85+ is_active: ! row .is_active ,
86+ }
87+ paragraph
88+ .asyncPutParagraph (id , documentId , row .id , obj , changeStateloading )
89+ .then ((res ) => {
90+ // const index = paragraphDetail.value.findIndex((v) => v.id === row.id)
91+ // paragraphDetail.value[index].is_active = !paragraphDetail.value[index].is_active
92+ return true
93+ })
94+ .catch (() => {
95+ return false
96+ })
97+ }
98+
99+ const GenerateRelatedDialogRef = ref <InstanceType <typeof GenerateRelatedDialog >>()
100+ function openGenerateDialog(row : any ) {
101+ if (GenerateRelatedDialogRef .value ) {
102+ GenerateRelatedDialogRef .value .open ([], ' dataset' , row .id )
103+ }
104+ }
105+ function openSelectDocumentDialog(row ? : any ) {
106+ // if (row) {
107+ // multipleSelection.value = [row.id]
108+ // }
109+ // SelectDocumentDialogRef.value.open(multipleSelection.value)
110+ }
111+
112+ function deleteParagraph(row : any ) {
113+ MsgConfirm (
114+ ` ${t (' views.paragraph.delete.confirmTitle' )} ${row .title || ' -' } ? ` ,
115+ t (' views.paragraph.delete.confirmMessage' ),
116+ {
117+ confirmButtonText: t (' common.confirm' ),
118+ confirmButtonClass: ' danger' ,
119+ },
120+ )
121+ .then (() => {
122+ paragraph .asyncDelParagraph (id , documentId , row .id , loading ).then (() => {
123+ // const index = paragraphDetail.value.findIndex((v) => v.id === row.id)
124+ // paragraphDetail.value.splice(index, 1)
125+ MsgSuccess (t (' common.deleteSuccess' ))
126+ })
127+ })
128+ .catch (() => {})
38129}
39130 </script >
40131<style lang="scss" scoped>
0 commit comments