系统相关配置

This commit is contained in:
sjl
2026-02-27 08:49:57 +08:00
parent bfa061fb03
commit b25515b5db
21 changed files with 1403 additions and 142 deletions

View File

@@ -3,7 +3,7 @@
<TableHeader ref="TableHeaderRef">
<template v-slot:select>
<el-form-item label="模板类型">
<el-select v-model="tableStore.table.params.type" placeholder="Select" size="large">
<el-select v-model="tableStore.table.params.type" placeholder="Select" size="large" @change="handleTypeChange">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
@@ -16,12 +16,12 @@
<Table ref="tableRef" />
<Administration
:type="tableStore.table.params.type"
:type="Number(tableStore.table.params.type)"
:tree-data="treeDataForChild"
v-if="showDictionary"
@close="closeReportDictionary"
/>
<el-dialog
:title="title"
v-model="dialogVisible"
@@ -32,14 +32,14 @@
<el-col :span="11">
<div class="grid-content">
<el-tree
:data="data"
show-checkbox
node-key="id"
:props="defaultProps"
:default-checked-keys="treeCheckedData"
:default-expanded-keys="treeExpandData"
@check-change="handleCheckChange"
ref="tree"
:data="data"
show-checkbox
node-key="id"
:props="defaultProps"
:default-checked-keys="treeCheckedData"
:default-expanded-keys="treeExpandData"
@check-change="handleCheckChange"
ref="tree"
>
</el-tree>
</div
@@ -78,7 +78,7 @@ import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { addData,updateData,deleteData,getList,getDictTree } from '@/api/system-boot/MonitoringPoint'
import { addData,updateData,deleteData,getDictTree } from '@/api/system-boot/MonitoringPoint'
import { ElMessage } from 'element-plus'
import Administration from '@/views/system/ReportConfiguration/components/Administration.vue'
@@ -102,8 +102,10 @@ const form = ref({
name: '',
code: '',
type: 0,
ids: []
})
// 表单验证规则
const rules = {
name: [
@@ -118,8 +120,9 @@ const rules = {
const data = ref([]) // 树形数据源
const defaultProps = {
children: 'children',
label: 'label'
label: 'reportDescribe'
}
const treeCheckedData = ref([]) // 默认选中的节点
const treeExpandData = ref([]) // 默认展开的节点
@@ -128,10 +131,16 @@ const options = ([
{ value: '1', label: '区域报告' },
])
const openReportDictionary = () => {
console.log('点击了报告字典管理按钮')
showDictionary.value = true
console.log('showDictionary 当前值:', showDictionary.value)
const treeDataForChild = ref([]) // 用于存储传递给子组件的树数据
const openReportDictionary = async () => {
try {
const res = await getDictTree({ type: Number(tableStore.table.params.type) })
treeDataForChild.value = res.data // 将数据存储到响应式变量中
showDictionary.value = true // 打开子组件
} catch (error) {
ElMessage.error('获取字典数据失败')
}
}
const closeReportDictionary = () => {
@@ -150,7 +159,6 @@ const tableStore: any = new TableStore({
width: '220',
render: 'buttons',
buttons: [
{
name: 'edit',
title: '编辑',
@@ -166,8 +174,16 @@ const tableStore: any = new TableStore({
id: row.id,
name: row.name,
code: row.code,
type: row.type
type: row.type,
ids: row.rdIds
}
// 获取树数据
formData.type = row.type
getDictTree(formData).then(res => {
data.value = res.data
treeCheckedData.value= row.rdIds
setDefaultExpandedKeys(res.data)
})
}
},
@@ -201,9 +217,21 @@ tableStore.table.params = {}
tableStore.table.params.type = '0'
provide('tableStore', tableStore)
// 模板类型变更
const handleTypeChange = (value: string) => {
tableStore.table.params.type = value
tableStore.index()
}
const formData= reactive({
pageNum: 1,
pageSize: 20,
type: 0,
})
const add = () => {
isEdit.value = true
isEdit.value = false
title.value = '新增模板'
dialogVisible.value = true
// 初始化表单数据
@@ -211,9 +239,26 @@ const add = () => {
id: '',
name: '',
code: '',
type: tableStore.table.params.type
type: tableStore.table.params.type,
ids: []
}
formData.type = tableStore.table.params.type
treeCheckedData.value = []
getDictTree(formData).then(res => {
data.value = res.data
setDefaultExpandedKeys(res.data)
})
}
const setDefaultExpandedKeys = (treeData: any[]) => {
const firstLevelIds = treeData.map(item => item.id)
treeExpandData.value = firstLevelIds
}
const handleCheckChange = (data: any, checked: boolean, indeterminate: boolean) => {
// 获取当前选中的节点 key 值
const checkedKeys = tree.value?.getCheckedKeys() || []
form.value.ids = checkedKeys // 将选中的节点 ID 更新到表单数据中
}
const addDetermine = () => {