refactor(page): support multiple chat

This commit is contained in:
qianmoQ 2024-11-17 16:13:15 +08:00
parent f7f385b777
commit a47b315737
2 changed files with 25 additions and 21 deletions

View File

@ -9,7 +9,7 @@
<ShadcnSpin v-model="loading" fixed/>
<div v-if="!loading" class="p-2">
<ShadcnToggleGroup v-model="report">
<ShadcnToggleGroup v-model="report" multiple>
<ShadcnRow gutter="8">
<ShadcnCol v-for="item of data" span="4">
<ShadcnToggle :key="item.id" class="px-1 py-1" :value="item.id">
@ -111,7 +111,7 @@ export default defineComponent({
return {
loading: false,
data: [] as ReportModel[],
report: '',
report: [] as any[],
pageIndex: 1,
pageSize: 10,
dataCount: 0
@ -157,8 +157,10 @@ export default defineComponent({
},
onSubmit()
{
const node = this.data.find(item => item.id === toNumber(this.report[0]))
this.$emit('change', node)
const nodes = this.data.filter(item =>
this.report.some((reportId: number) => toNumber(item.id) === toNumber(reportId))
)
this.$emit('change', nodes)
this.onCancel()
},

View File

@ -208,24 +208,26 @@ export default defineComponent({
}
})
},
onChange(node: ReportModel)
onChange(nodes: ReportModel[])
{
const newItem = {
x: 0,
y: 0,
w: 3,
h: 4,
i: 'new-' + Date.now(),
title: node.name,
node: {
id: node.id,
configure: node.configure,
code: node.dataset?.code,
query: node?.query
},
original: node
}
this.layouts.push(newItem)
nodes.forEach((node: ReportModel) => {
const newItem = {
x: 0,
y: 0,
w: 3,
h: 4,
i: 'new-' + Date.now(),
title: node.name,
node: {
id: node.id,
configure: node.configure,
code: node.dataset?.code,
query: node?.query
},
original: node
}
this.layouts.push(newItem)
})
},
onSubmit()
{