Browse Source

数据资源:表单type字段传递

Xiao_123 1 week ago
parent
commit
acad717eb7

+ 2 - 0
src/views/dataGovernance/dataResource/components/Database/index.vue

@@ -260,6 +260,7 @@ export default {
                 ...obj
               }
             }),
+            type: 'database',
             name_en: this.select
           })
         } else {
@@ -277,6 +278,7 @@ export default {
                 name_zh: obj.name_zh
               }
             },
+            type: 'database',
             url: '' // 文件上传路径
           })
         }

+ 2 - 0
src/views/dataGovernance/dataResource/components/Structure/index.vue

@@ -317,6 +317,7 @@ export default {
                 ..._obj
               }
             }),
+            type: 'structure',
             name_en: this.result.data_resource.name_en,
             url: data.url // 文件上传路径
           })
@@ -326,6 +327,7 @@ export default {
               head_data: this.headMap.map(e => e.map),
               data_resource: this.result.data_resource
             },
+            type: 'structure',
             url: data.url // 文件上传路径
           })
         }

+ 1 - 0
src/views/dataGovernance/dataResource/components/Unstructured/index.vue

@@ -246,6 +246,7 @@ export default {
             head_data: this.headMap,
             data_resource: this.names
           },
+          type: 'unstructured',
           ...obj
         })
         this.$snackbar.success('提交成功')

+ 12 - 7
src/views/dataGovernance/dataResource/components/editBase.vue

@@ -134,7 +134,7 @@ export default {
           label: '请选择数据源',
           hide: !this.formValues.chooseStorage,
           noAttach: true,
-          itemText: 'name',
+          itemText: 'name_zh',
           itemValue: 'id',
           items: this.dataSourceItems
         },
@@ -172,6 +172,11 @@ export default {
         this.formValues[key] = this.itemData[key]?.id || null
         return
       }
+      if (key === 'data_source') {
+        this.formValues[key] = this.itemData[key] || null
+        this.formValues.chooseStorage = !!this.itemData[key]
+        return
+      }
       if (Object.prototype.hasOwnProperty.call(this.itemData, key)) {
         this.formValues[key] = this.itemData[key]
       }
@@ -219,12 +224,12 @@ export default {
         return
       }
       const { chooseStorage, data_source: dataSource, storage_location: storageLocation, ...obj } = this.formValues
-      // if (chooseStorage) {
-      //   return {
-      //     ...obj,
-      //     data_source: dataSource
-      //   }
-      // }
+      if (chooseStorage) {
+        return {
+          ...obj,
+          data_source: dataSource
+        }
+      }
       return {
         ...obj,
         storage_location: storageLocation

+ 3 - 3
src/views/dataGovernance/dataResource/index.vue

@@ -53,6 +53,7 @@
       <component
         v-if="show"
         :is="path"
+        :type="path"
         ref="edit"
         :item-data="itemData"
         @close="handleClose"
@@ -86,7 +87,6 @@ export default {
   data () {
     return {
       loading: false,
-      showType: false,
       path: null,
       // documentType: null,
       fileItems: [
@@ -173,13 +173,13 @@ export default {
       this.itemData = {}
       this.path = path
       this.show = true
-      this.showType = false
     },
     async handleEdit (item) {
       const { id } = item
       try {
         const { data } = await api.getResourceDetails({ id })
-        this.path = data.url ? data.type : 'database'
+        // this.path = data.url ? data.type : 'database'
+        this.path = data.type
         this.itemData = { ...data, id }
         this.show = true
       } catch (error) {