zhengnaiwen_citu 1 month ago
parent
commit
bb7fab538a

+ 1 - 1
src/api/dataGovernance.js

@@ -242,7 +242,7 @@ const dataFlow = {
   },
   // 删除数据流
   deleteDataFlow: (id) => {
-    return http.delete(`/dataflow/delete-dataflow/${id}`)
+    return http.del(`/dataflow/delete-dataflow/${id}`)
   },
   // 运行数据流
   runDataFlow: (id, param) => {

+ 38 - 17
src/views/dataGovernance/dataProcess/components/edit.vue

@@ -46,18 +46,8 @@
             </div>
           </v-card>
           <div class="mt-3 d-flex">
-            <v-text-field
-              outlined
-              dense
-              hide-details
-              label="请输入目标表 *"
-              v-model="changeObj.target_table"
-              placeholder="请输入目标表"
-              :rules="[v => !!v || '请输入目标表']">
-            </v-text-field>
 
             <v-text-field
-              class="ml-3"
               outlined
               dense
               hide-details
@@ -66,6 +56,16 @@
               placeholder="请输入来源表"
               :rules="[v => !!v || '请输入来源表']"
             ></v-text-field>
+            <v-text-field
+              class="ml-3"
+              outlined
+              dense
+              hide-details
+              label="请输入目标表 *"
+              v-model="changeObj.target_table"
+              placeholder="请输入目标表"
+              :rules="[v => !!v || '请输入目标表']">
+            </v-text-field>
           </div>
           <div class="mt-3">
             <v-textarea
@@ -201,6 +201,12 @@ import {
 export default {
   name: 'editPage',
   components: { Editor, Toolbar, EditBase },
+  props: {
+    itemData: {
+      type: Object,
+      default: () => ({})
+    }
+  },
   data () {
     return {
       drawer: false,
@@ -246,8 +252,10 @@ export default {
   },
   async created () {
     this.loading = true
+    if (Object.keys(this.itemData).length) {
+      await this.getDetails()
+    }
     await this.getList()
-    await this.getDetails()
     this.loading = false
   },
   beforeDestroy () {
@@ -261,7 +269,14 @@ export default {
     },
     // 详情
     async getDetails () {
-
+      try {
+        const { data } = await api.getDataFlowDetails(this.itemData.id)
+        this.$nextTick(() => {
+          this.$refs.editBaseRefs.setValues(data)
+        })
+      } catch (error) {
+        this.$snackbar.error(error)
+      }
     },
     async getList () {
       try {
@@ -332,12 +347,18 @@ export default {
         this.$snackbar.warning('请先填写目标表')
         return
       }
+      const query = {
+        ...params,
+        ...this.changeObj
+      }
+      const isEdit = Object.keys(this.itemData).length > 0
       try {
-        await api.addDataFlow({
-          ...params,
-          ...this.changeObj
-        })
-        this.$snackbar.success('操作成功')
+        if (isEdit) {
+          await api.updateDataFlow(this.itemData.id, query)
+        } else {
+          await api.addDataFlow(query)
+        }
+        this.$snackbar.success(isEdit ? '更新成功' : '新增成功')
         this.$emit('success')
       } catch (error) {
         this.$snackbar.error(error)

+ 18 - 1
src/views/dataGovernance/dataProcess/components/editBase.vue

@@ -42,7 +42,7 @@ export default {
         // data_sensitivity: '低',
         tag: null,
         describe: null,
-        status: true
+        status: 'active'
       },
       tagItems: [],
       pageInfo: {
@@ -120,6 +120,23 @@ export default {
     // })
   },
   methods: {
+    setValues (item) {
+      this.formValues = {
+        name: item.name_zh,
+        name_en: item.name_en,
+        category: item.category,
+        leader: item.leader,
+        organization: null,
+        script_type: item.script_type,
+        update_mode: item.update_mode,
+        frequency: item.frequency,
+        // data_sensitivity: '低',
+        tag: item.tag,
+        describe: item.describe,
+        status: item.status
+
+      }
+    },
     async init () {
       try {
         this.loading = true

+ 8 - 6
src/views/dataGovernance/dataProcess/index.vue

@@ -53,12 +53,14 @@ export default {
         title: null
       },
       headers: [
-        { text: '中文名称', align: 'start', value: 'name' },
-        { text: '英文名称', align: 'start', value: 'name' },
+        { text: '中文名称', align: 'start', value: 'name_zh' },
+        { text: '英文名称', align: 'start', value: 'name_en' },
         { text: '状态', align: 'center', value: 'status' },
-        { text: '作者', align: 'center', value: 'description' },
-        { text: '描述', align: 'start', value: 'description' },
-        { text: '创建时间', align: 'start', value: 'created_by' },
+        { text: '分类', align: 'center', value: 'category' },
+        { text: '作者', align: 'center', value: 'leader' },
+        { text: '机构', align: 'center', value: 'organization' },
+        { text: '描述', align: 'start', value: 'describe' },
+        { text: '创建时间', align: 'start', value: 'created_at' },
         { text: '更新时间', align: 'start', value: 'updated_at' },
         { text: '操作', align: 'start', value: 'actions' }
       ],
@@ -106,7 +108,7 @@ export default {
       this.itemData = {}
       this.show = true
     },
-    async handleEdit (item) {
+    async onEdit (item) {
       this.itemData = item
       this.show = true
     },