修改报表绑定指标

This commit is contained in:
guanj
2025-11-25 15:15:38 +08:00
parent f916721b6a
commit 0c71b2ac32
10 changed files with 785 additions and 572 deletions

View File

@@ -2,22 +2,29 @@
<div class="default-main">
<TableHeader :showSearch="false">
<template v-slot:operation>
<el-button type="primary" @click="add" icon="el-icon-Plus">新增</el-button>
<el-button type="primary" @click="addTree" icon="el-icon-Plus">新增</el-button>
<el-button type="primary" @click="add" icon="el-icon-Plus">新增组件</el-button>
</template>
</TableHeader>
<Table ref="tableRef" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" />
<Add ref="addRef" v-if="addFlag" @onSubmit="tableStore.index()" />
<Table
ref="tableRef"
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }"
/>
<Add ref="addRef" v-if="addFlag" @cancel="cancel" @submit="tableStore.index()" />
<!-- 新增树 -->
<Tree ref="treeRef" v-if="addFlag" @cancel="cancel" @submit="tableStore.index()" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide,nextTick } from 'vue'
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage } from 'element-plus'
import TableHeader from '@/components/table/header/index.vue'
import Add from './add.vue'
import Tree from './addTree.vue'
import { deleteSubassembly } from '@/api/user-boot/dept'
defineOptions({
name: 'component'
@@ -25,6 +32,7 @@ defineOptions({
const addRef = ref()
const addFlag = ref(false)
const tableRef = ref()
const treeRef = ref()
const treeData: any = ref([])
const tableStore = new TableStore({
url: '/user-boot/component/componentTree',
@@ -39,7 +47,7 @@ const tableStore = new TableStore({
width: '80',
render: 'icon'
},
{ field: 'code', title: '组件标识', minWidth: '100', },
{ field: 'code', title: '组件标识', minWidth: '100' },
{ field: 'path', title: '组件路径' },
{ field: 'image', title: '组件展示', render: 'image' },
{
@@ -53,13 +61,18 @@ const tableStore = new TableStore({
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
disabled: row => {
return row.path == '' || row.path == null
},
click: row => {
addFlag.value = true
setTimeout(() => {
addRef.value.open('修改组件', row)
if (row.path == '' || row.path == null) {
// 修改树
treeRef.value.open('修改树', row)
} else {
// 组件修改
addRef.value.open('修改组件', row)
}
}, 100)
}
},
@@ -69,9 +82,7 @@ const tableStore = new TableStore({
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
disabled: row => {
return row.path == '' || row.path == null
},
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
@@ -79,10 +90,13 @@ const tableStore = new TableStore({
title: '确定删除?'
},
click: row => {
deleteSubassembly({ id: row.id }).then(() => {
ElMessage.success('删除成功!')
tableStore.index()
})
if (row.path == '' || row.path == null) {
} else {
deleteSubassembly({ id: row.id }).then(() => {
ElMessage.success('删除成功!')
tableStore.index()
})
}
}
}
]
@@ -127,6 +141,16 @@ const add = () => {
addRef.value.open('新增组件')
}, 100)
}
// 新增数
const addTree = () => {
addFlag.value = true
setTimeout(() => {
treeRef.value.open('新增树')
}, 100)
}
const cancel = () => {
addFlag.value = false
}
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()