@@ -11,9 +11,6 @@ import PromptRecommend from '../../../assets/recommend.json'
11
11
12
12
interface DataProps {
13
13
_id? : string
14
- renderKey: string
15
- renderValue: string
16
- renderType: string
17
14
title: string
18
15
value: string
19
16
type: ' built-in' | ' user-defined'
@@ -277,12 +274,8 @@ async function downloadPromptTemplate() {
277
274
278
275
// 移动端自适应相关
279
276
function renderTemplate() {
280
- const [keyLimit, valueLimit] = isMobile .value ? [10 , 30 ] : [15 , 50 ]
281
277
return promptList .value .map ((item : UserPrompt ) => {
282
278
return {
283
- renderKey: item .title .length <= keyLimit ? item .title : ` ${item .title .substring (0 , keyLimit )}... ` ,
284
- renderValue: item .value .length <= valueLimit ? item .value : ` ${item .value .substring (0 , valueLimit )}... ` ,
285
- renderType: item .type === ' built-in' ? t (' store.builtIn' ) : t (' store.userDefined' ),
286
279
title: item .title ,
287
280
value: item .value ,
288
281
_id: item ._id ,
@@ -304,15 +297,27 @@ function createColumns(): DataTableColumns<DataProps> {
304
297
return [
305
298
{
306
299
title: ' type' ,
307
- key: ' renderType' ,
300
+ key: ' type' ,
301
+ width: 100 ,
302
+ align: ' center' ,
303
+ render : (row : DataProps ) => row .type === ' built-in' ? t (' store.builtIn' ) : t (' store.userDefined' ),
308
304
},
309
305
{
310
306
title: t (' store.title' ),
311
- key: ' renderKey' ,
307
+ key: ' title' ,
308
+ width: 200 ,
312
309
},
313
310
{
314
311
title: t (' store.description' ),
315
- key: ' renderValue' ,
312
+ key: ' value' ,
313
+ ellipsis: {
314
+ lineClamp: 6 ,
315
+ tooltip: {
316
+ contentClass: ' whitespace-pre-line text-xs max-h-100 max-w-200' ,
317
+ scrollable: true ,
318
+ },
319
+ },
320
+ className: ' whitespace-pre-line' ,
316
321
},
317
322
{
318
323
title: t (' common.action' ),
@@ -371,7 +376,7 @@ const dataSource = computed(() => {
371
376
const value = searchValue .value
372
377
if (value && value !== ' ' ) {
373
378
return data .filter ((item : DataProps ) => {
374
- return item .renderKey .includes (value ) || item .renderValue .includes (value )
379
+ return item .title .includes (value ) || item .value .includes (value )
375
380
})
376
381
}
377
382
return data
@@ -445,9 +450,19 @@ async function handleGetUserPromptList() {
445
450
/>
446
451
<NList v-if =" isMobile" style =" max-height : 400px ; overflow-y : auto ;" >
447
452
<NListItem v-for =" (item, index) of dataSource" :key =" index" >
448
- <NThing :title =" item.renderKey" :description =" item.renderValue" />
453
+ <NThing :title =" item.title" :description =" item.value" description-class =" text-xs" >
454
+ <template #description >
455
+ <NEllipsis
456
+ class =" max-w-240 whitespace-pre-line"
457
+ :tooltip =" { contentClass: 'whitespace-pre-line text-xs max-h-100 max-w-90', scrollable: true }"
458
+ :line-clamp =" 3"
459
+ >
460
+ {{ item.value }}
461
+ </NEllipsis >
462
+ </template >
463
+ </NThing >>
449
464
<template #suffix >
450
- <div class =" flex flex-col items-center gap-2" >
465
+ <div v-if = " item.type !== 'built-in' " class =" flex flex-col items-center gap-2" >
451
466
<NButton tertiary size =" small" type =" info" @click =" changeShowModal('modify', item)" >
452
467
{{ t('common.edit') }}
453
468
</NButton >
0 commit comments