4 changed files with 89 additions and 27 deletions
@ -0,0 +1,68 @@ |
|||||
|
<!-- |
||||
|
@ 时间: 2026-01-12 |
||||
|
@ 备注: spacesimpletable 是用于设置智能体的联网查询网址而拓展的组件 |
||||
|
--> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, onMounted } from 'vue' |
||||
|
import {Delete} from '@element-plus/icons-vue' |
||||
|
const props = withDefaults(defineProps<{ |
||||
|
title:string; |
||||
|
urlstr:string; |
||||
|
confirmFunc:(urlstr:string)=>void, //保存数据的回调, data是当前勾选的数据库id |
||||
|
closeFunc:()=>void, //父级只需销毁组件 |
||||
|
}>(),{}) |
||||
|
|
||||
|
const weburls=ref<string[]>([]) |
||||
|
|
||||
|
const addUrl = () => { |
||||
|
weburls.value.push('') |
||||
|
} |
||||
|
|
||||
|
const removeUrl = (index: number) => { |
||||
|
weburls.value.splice(index, 1) |
||||
|
} |
||||
|
|
||||
|
const onSaveChange = () => { |
||||
|
props.confirmFunc(weburls.value.join(',')) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
onMounted(() => { |
||||
|
weburls.value = props.urlstr ? props.urlstr.split(",") : [] |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<el-dialog :model-value="true" :style="{'max-height': '880px','--el-dialog-width': '33%'}" @close="props.closeFunc"> |
||||
|
<template #header> |
||||
|
<span style="font-weight: bold;">{{props.title}}</span> |
||||
|
</template> |
||||
|
<div class="tablelist"> |
||||
|
<div v-for="(url, index) in weburls" :key="index" style="display:flex;align-items:center;margin:8px 0;"> |
||||
|
<el-input v-model="weburls[index]" placeholder="输入网址" style="flex:1;margin-right:8px;"></el-input> |
||||
|
<el-button circle size="small" type="danger" :icon="Delete" @click="removeUrl(index)"></el-button> |
||||
|
</div> |
||||
|
|
||||
|
<el-button type="primary" plain @click="addUrl" style="margin-top:8px;">添加网址</el-button> |
||||
|
</div> |
||||
|
|
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button @click="props.closeFunc()">取消</el-button> |
||||
|
<el-button type="primary" @click="onSaveChange">保存</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
|
||||
|
.tablelist{ |
||||
|
margin-bottom:20px; |
||||
|
display:flex; |
||||
|
flex-direction:column; |
||||
|
width: 90%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
||||
Loading…
Reference in new issue