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

View File

@ -208,8 +208,9 @@ export default defineComponent({
} }
}) })
}, },
onChange(node: ReportModel) onChange(nodes: ReportModel[])
{ {
nodes.forEach((node: ReportModel) => {
const newItem = { const newItem = {
x: 0, x: 0,
y: 0, y: 0,
@ -226,6 +227,7 @@ export default defineComponent({
original: node original: node
} }
this.layouts.push(newItem) this.layouts.push(newItem)
})
}, },
onSubmit() onSubmit()
{ {