mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-02 03:57:35 +08:00
refactor(page): support multiple chat
This commit is contained in:
parent
f7f385b777
commit
a47b315737
@ -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()
|
||||
},
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user