From 1220f5ca98b10b735a47c37a81fbfc554b01e2fe Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期一, 20 一月 2025 14:41:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/data/ind/item/AtomIndDefineForm.vue |   42 +++++++++++++++++++++++++++---------------
 1 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/src/views/data/ind/item/AtomIndDefineForm.vue b/src/views/data/ind/item/AtomIndDefineForm.vue
index daea1b6..225d5c1 100644
--- a/src/views/data/ind/item/AtomIndDefineForm.vue
+++ b/src/views/data/ind/item/AtomIndDefineForm.vue
@@ -20,19 +20,19 @@
       <el-row>
         <el-col :span="12">
           <el-form-item label="指标分类" prop="itemCategory">
-            <el-select v-model="formData.itemCategory" clearable placeholder="请选择指标分类">
-              <el-option
-                v-for="item in dataCategoryList"
-                :key="item.id"
-                :label="item.label"
-                :value="item.id + ''"
-              />
-            </el-select>
+            <el-tree-select
+              v-model="formData.itemCategory"
+              :data="dataCategoryList"
+              :default-expanded-keys="[0]"
+              :props="defaultProps"
+              check-strictly
+              node-key="id"
+            />
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="时间粒度" prop="timeGranularity">
-            <el-select v-model="formData.timeGranularity" placeholder="请选择">
+            <el-select v-model="formData.timeGranularity" clearable placeholder="请选择">
               <el-option
                 v-for="dict in getStrDictOptions(DICT_TYPE.TIME_GRANULARITY)"
                 :key="dict.value"
@@ -63,7 +63,8 @@
       <el-row>
         <el-col :span="12">
           <el-form-item label="数据集" prop="atomItem.dataSet">
-            <el-select v-model="formData.atomItem.dataSet" clearable placeholder="请选择数据集" @change="handleDataSetChange($event)">
+            <el-select v-model="formData.atomItem.dataSet" filterable
+                       allow-create clearable placeholder="请选择数据集" @change="handleDataSetChange($event)">
               <el-option
                 v-for="item in dataSetList"
                 :key="item.id"
@@ -75,7 +76,8 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="使用字段" prop="atomItem.usingField">
-            <el-select v-model="formData.atomItem.usingField" clearable placeholder="请选择字段">
+            <el-select v-model="formData.atomItem.usingField" filterable
+                       allow-create clearable placeholder="请选择字段">
               <el-option
                 v-for="item in dataSetFieldList"
                 :key="item.id"
@@ -87,7 +89,8 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="统计方式" prop="statFunc">
-            <el-select v-model="formData.atomItem.statFunc" clearable placeholder="请选择">
+            <el-select v-model="formData.atomItem.statFunc" filterable
+                       allow-create clearable placeholder="请选择">
               <el-option
                 v-for="dict in getStrDictOptions(DICT_TYPE.DATA_STAT_FUNC)"
                 :key="dict.value"
@@ -118,7 +121,7 @@
   import * as DataSetApi from '@/api/data/ind/data/data.set'
   import * as DataSetFieldApi from '@/api/data/ind/data/data.field'
   import * as CategoryApi from '@/api/data/ind/category/index'
-
+  import {handleTree} from "@/utils/tree";
 
   defineOptions({name: 'IndDataSetForm'})
 
@@ -167,7 +170,16 @@
   const formRef = ref() // 表单 Ref
   const dataSetList = ref([] as DataSetApi.DataSetVO[])
   const dataSetFieldList = ref([] as DataSetFieldApi.DataSetFieldVO[])
-  const dataCategoryList = ref([])
+
+  const dataCategoryList = ref<Tree[]>([])
+
+  const getCategoryTree = async () => {
+    dataCategoryList.value = []
+    const res = await CategoryApi.getCategoryListAllSimple()
+    let category: Tree = {id: 0, label: '主类目', children: []}
+    category.children = handleTree(res, 'id', 'pid')
+    dataCategoryList.value.push(category)
+  }
   /** 打开弹窗 */
   const open = async (type: string, id?: string) => {
     dialogVisible.value = true
@@ -176,7 +188,7 @@
     resetForm()
     // 加载数据源列表
     dataSetList.value = await DataSetApi.getDataSetList()
-    dataCategoryList.value = await CategoryApi.getCategoryListAllSimple()
+    await getCategoryTree()
     // 修改时,设置数据
     if (id) {
       formLoading.value = true

--
Gitblit v1.9.3