55 direction =" rtl"
66 size =" 800px"
77 :before-close =" close"
8+ destroy-on-close
89 >
910 <div class =" flex mb-16" >
1011 <div class =" flex-between complex-search" >
4041 </div >
4142 </div >
4243
43- <app-table-infinite-scroll
44+ <app-table
45+ ref =" multipleTableRef"
46+ class =" mt-16 document-table"
4447 :data =" data"
45- class =" w-full"
48+ :maxTableHeight =" 200"
49+ :pagination-config =" paginationConfig"
50+ @sizeChange =" changeSize"
51+ @changePage =" getList(true)"
4652 v-loading =" loading"
47- @changePage =" changePage"
48- :maxTableHeight =" 150"
49- :paginationConfig =" paginationConfig"
50- :row-class-name =" setRowClass"
53+ :row-key =" (row: any) => row.id"
5154 >
5255 <el-table-column prop =" user_name" :label =" $t('workflow.initiator')" >
5356 <template #default =" { row } " >
105108 effect =" dark"
106109 :content =" $t('chat.executionDetails.cancel')"
107110 placement =" top"
108- v-if =" row.state === 'PADDING'"
111+ v-if =" [ 'PADDING', 'STARTED'].includes(row.state) "
109112 >
110113 <el-button type =" danger" text @click.stop =" cancelExecution(row)" >
111114 <el-icon ><CircleCloseFilled /></el-icon >
114117 </div >
115118 </template >
116119 </el-table-column >
117- </app-table-infinite-scroll >
120+ </app-table >
121+
118122 <ExecutionDetailDrawer
119123 ref="ExecutionDetailDrawerRef"
120124 v-model :currentId =" currentId "
128132</template >
129133<script setup lang="ts">
130134import { loadSharedApi } from ' @/utils/dynamics-api/shared-api'
131- import AppTableInfiniteScroll from ' @/components/app-table-infinite-scroll/index.vue'
132135import ExecutionDetailDrawer from ' ./ExecutionDetailDrawer.vue'
133- import { computed , ref , reactive } from ' vue'
134- import { useRoute , useRouter } from ' vue-router'
136+ import { computed , ref , reactive , onBeforeUnmount } from ' vue'
137+ import { useRoute } from ' vue-router'
135138import { datetimeFormat } from ' @/utils/time'
136139import type { Dict } from ' @/api/type/common'
137140import { MsgError , MsgConfirm } from ' @/utils/message'
@@ -150,7 +153,7 @@ const apiType = computed(() => {
150153})
151154const paginationConfig = reactive ({
152155 current_page: 1 ,
153- page_size: 50 ,
156+ page_size: 10 ,
154157 total: 0 ,
155158})
156159const query = ref <any >({
@@ -192,21 +195,22 @@ const cancelExecution = (row: any) => {
192195const changeFilterHandle = () => {
193196 query .value = { user_name: ' ' , status: ' ' }
194197}
195- const changePage = () => {
196- paginationConfig .current_page + = 1
198+ const changeSize = () => {
199+ paginationConfig .current_page = 1
197200 getList ()
198201}
199202
200- const getList = (clear ? : boolean ) => {
201- if (clear ) {
202- paginationConfig .current_page = 1
203- data .value = []
204- }
203+ const getList = (isLoading ? : boolean ) => {
205204 return loadSharedApi ({ type: ' knowledge' , systemType: apiType .value })
206- .getWorkflowActionPage (active_knowledge_id .value , paginationConfig , query .value , loading )
205+ .getWorkflowActionPage (
206+ active_knowledge_id .value ,
207+ paginationConfig ,
208+ query .value ,
209+ isLoading ? loading : undefined ,
210+ )
207211 .then ((ok : any ) => {
208212 paginationConfig .total = ok .data ?.total
209- data .value = data . value . concat ( ok .data .records )
213+ data .value = ok .data .records
210214 })
211215}
212216
@@ -220,10 +224,7 @@ const next_disable = computed(() => {
220224 return index >= data .value .length && index >= paginationConfig .total - 1
221225})
222226
223- const setRowClass = ({ row }: any ) => {
224- return currentId .value === row ?.id ? ' highlight' : ' '
225- }
226-
227+ const interval = ref <any >()
227228/**
228229 * 下一页
229230 */
@@ -234,7 +235,7 @@ const nextRecord = () => {
234235 return
235236 }
236237 paginationConfig .current_page = paginationConfig .current_page + 1
237- getList ().then (() => {
238+ getList (true ).then (() => {
238239 currentId .value = data .value [index ].id
239240 currentContent .value = data .value [index ]
240241 })
@@ -257,16 +258,27 @@ const preRecord = () => {
257258}
258259
259260const open = (knowledge_id : string ) => {
261+ interval .value = setInterval (() => {
262+ getList (false )
263+ }, 6000 )
260264 active_knowledge_id .value = knowledge_id
261- getList ()
265+ getList (true )
262266 drawer .value = true
263267}
264268const close = () => {
265269 paginationConfig .current_page = 1
266270 paginationConfig .total = 0
267271 data .value = []
268272 drawer .value = false
273+ if (interval .value ) {
274+ clearInterval (interval .value )
275+ }
269276}
277+ onBeforeUnmount (() => {
278+ if (interval .value ) {
279+ clearInterval (interval .value )
280+ }
281+ })
270282defineExpose ({ open , close })
271283 </script >
272284<style lang="scss" scoped></style >
0 commit comments