Przeglądaj źródła

Merge branch 'master' of github.com:gcpaas/DataRoom

liu.tao3 1 rok temu
rodzic
commit
dd5ecd54c2

+ 1 - 1
DataRoom/pom.xml

@@ -60,7 +60,7 @@
         <clickhouse.version>0.3.2</clickhouse.version>
         <commons-io.version>2.2</commons-io.version>
         <okhttp3.version>4.9.1</okhttp3.version>
-        <dataset.core.version>1.0.1.2023072501.Alpha</dataset.core.version>
+        <dataset.core.version>1.0.1.2023072601.Alpha</dataset.core.version>
     </properties>
 
     <dependencyManagement>

+ 2 - 1
data-room-ui/example/main.js

@@ -52,8 +52,9 @@ registerConfig(
       '--bs-el-color-primary-active': '64, 158, 255', // 主要激活 => rgba(64, 158, 255, 1) = #409EFF
       '--bs-el-border': 'transparent' // 边框颜色
     },
+    datasetAuth: ['unAdd', 'unEdit', 'unDelete'], // 数据集按钮权限 新增 编辑 删除
     // datasetTypeList: ['original','custom'],
-    customPlots: [],
+    // customPlots: [],
     // 远程组件列表
     remoteComponents,
     customDatasetComponents

+ 0 - 1
data-room-ui/packages/BigScreenDesign/ComponentDialog/index.vue

@@ -165,7 +165,6 @@
               </el-select>
               <el-button
                 size="small"
-                style="margin-right: 20px"
                 type="primary"
                 @click="reSearch"
               >

+ 1 - 0
data-room-ui/packages/DataSetManagement/src/HttpEditForm.vue

@@ -917,6 +917,7 @@ export default {
       } else {
         // 如果是后端代理,则将配置传到后端
         const script = JSON.stringify(this.dataForm.config)
+        console.log(this.dataForm.config)
         const executeParams = {
           script,
           params: this.dataForm.paramsList,

+ 39 - 17
data-room-ui/packages/DataSetManagement/src/OriginalEditForm.vue

@@ -561,7 +561,9 @@ export default {
       isSelectAll: false,
       activeName: 'data',
       currentCount: 0,
-      selectorLoading: false
+      selectorLoading: false,
+      oldStructurePreviewList: [],
+      isInit: false
     }
   },
   watch: {
@@ -630,6 +632,7 @@ export default {
         this.dataForm.repeatStatus = res.config.repeatStatus
         this.dataForm.fieldList = res.config.fieldList
         this.dataForm.fieldDesc = res.config.fieldDesc
+        this.oldStructurePreviewList = _.cloneDeep(res.config.fieldList)
         // 字段信息,转为数组
         this.dataForm.fieldInfo = res.config.fieldInfo ? res.config.fieldInfo.split(',') : []
         if (this.dataForm.typeId) {
@@ -641,6 +644,7 @@ export default {
             }
           })
         }
+        this.isInit = true
         this.queryAllTable()
         this.queryAllField()
       })
@@ -824,7 +828,7 @@ export default {
           }
           return field
         })
-        this.getPreViewData(fieldDescMap)
+        // this.getPreViewData(fieldDescMap)
       }).catch(() => {
         this.fieldList = []
       })
@@ -835,7 +839,6 @@ export default {
      */
     setFields (values) {
       if (values.includes('全选')) {
-        // 说明已经全选了,所以全不选
         if (values.length > this.fieldList.length) {
           this.dataForm.fieldInfo = []
         } else {
@@ -882,21 +885,35 @@ export default {
       datasetExecuteTest(executeParams).then((data) => {
         this.dataPreviewList = data.data.list
         this.structurePreviewList = data.structure
-        this.structurePreviewList.forEach(item => {
-          if (!item.hasOwnProperty('orderNum')) {
-            this.$set(item, 'orderNum', 0)
-          }
-          if (!item.hasOwnProperty('sourceTable')) {
-            this.$set(item, 'sourceTable', this.dataForm.tableName)
-          }
-          if (!item.hasOwnProperty('fieldDesc')) {
-            let fieldDesc = ''
-            if (fieldDescMap && fieldDescMap[item.fieldName]) {
-              fieldDesc = fieldDescMap[item.fieldName]
+        // 如果是初始化
+        if (this.isInit) {
+          this.structurePreviewList = this.dataForm.fieldList
+          this.isInit = false
+        } else {
+          this.structurePreviewList.forEach(item => {
+            if (!item.hasOwnProperty('orderNum')) {
+              this.$set(item, 'orderNum', 0)
             }
-            this.$set(item, 'fieldDesc', fieldDesc)
-          }
-        })
+            if (!item.hasOwnProperty('sourceTable')) {
+              this.$set(item, 'sourceTable', this.dataForm.tableName)
+            }
+            if (!item.hasOwnProperty('fieldDesc')) {
+              let fieldDesc = ''
+              if (fieldDescMap && fieldDescMap[item.fieldName]) {
+                fieldDesc = fieldDescMap[item.fieldName]
+              }
+              this.$set(item, 'fieldDesc', fieldDesc)
+              // this.structurePreviewList 和 this.oldStructurePreviewList 比较,如果旧的数据里fieldDesc有值则重新赋值给新的数据
+              this.structurePreviewList.forEach(item => {
+                const oldItem = this.oldStructurePreviewList.find(oldItem => oldItem.fieldName === item.fieldName)
+                if (oldItem && oldItem.fieldDesc) {
+                  item.fieldDesc = oldItem.fieldDesc
+                }
+              })
+            }
+          })
+        }
+
         this.structurePreviewListCopy = _.cloneDeep(this.structurePreviewList)
         this.totalCount = data.data.totalCount
         this.currentCount = data.data.currentCount
@@ -927,6 +944,11 @@ export default {
     treeFilter (value, data) {
       if (!value) return true
       return data.name.indexOf(value) !== -1
+    },
+    setField () {
+      this.structurePreviewList = _.cloneDeep(this.structurePreviewListCopy)
+      this.oldStructurePreviewList = _.cloneDeep(this.structurePreviewListCopy)
+      this.fieldsetVisible = false
     }
   }
 }

+ 25 - 24
data-room-ui/packages/DataSetSetting/dataSetSetting.vue

@@ -23,9 +23,9 @@
           class="bs-data-set-management"
           :is-border="true"
           :is-dialog="true"
-          :ToAdd='isAdd'
-          :doEdit='doEdit'
-          :isDelete='isDelete'
+          :to-add="isAdd"
+          :do-edit="doEdit"
+          :is-delete="isDelete"
           :ds-id="dataSetId"
           :multiple="multiple"
           :ds-value="DataDsValue"
@@ -42,9 +42,9 @@
       class="bs-data-set-management"
       :is-border="true"
       :is-dialog="true"
-      :ToAdd='isAdd'
-      :doEdit='doEdit'
-      :isDelete='isDelete'
+      :to-add="isAdd"
+      :do-edit="doEdit"
+      :is-delete="isDelete"
       :ds-id="dataSetId"
       :multiple="multiple"
       :ds-value="DataDsValue"
@@ -114,36 +114,36 @@ export default {
         }
       }
     },
-    isAdd(){
-      let a=-1
-      if(window.BS_CONFIG?.datasetAuth) {
-       a=window.BS_CONFIG?.datasetAuth.findIndex(item=>item=='unAdd')
+    isAdd () {
+      let a = -1
+      if (window.BS_CONFIG?.datasetAuth) {
+        a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unAdd')
       }
-      if(a==-1){
+      if (a === -1) {
         return true
-      }else{
+      } else {
         return false
       }
     },
-    doEdit(){
-      let a=-1
-      if(window.BS_CONFIG?.datasetAuth) {
-       a=window.BS_CONFIG?.datasetAuth.findIndex(item=>item=='unEdit')
+    doEdit () {
+      let a = -1
+      if (window.BS_CONFIG?.datasetAuth) {
+        a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unEdit')
       }
-      if(a==-1){
+      if (a === -1) {
         return true
-      }else{
+      } else {
         return false
       }
     },
-    isDelete(){
-      let a=-1
-      if(window.BS_CONFIG?.datasetAuth) {
-       a=window.BS_CONFIG?.datasetAuth.findIndex(item=>item=='unDelete')
+    isDelete () {
+      let a = -1
+      if (window.BS_CONFIG?.datasetAuth) {
+        a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unDelete')
       }
-      if(a==-1){
+      if (a === -1) {
         return true
-      }else{
+      } else {
         return false
       }
     }
@@ -204,6 +204,7 @@ export default {
   ::v-deep .bs-container {
     padding: 0;
     min-height: 550px;
+    background-color: var(--bs-background-2) !important;
 
     .el-table {
       max-height: calc(90vh - 350px);

+ 17 - 4
data-room-ui/packages/js/utils/httpParamsFormatting.js

@@ -1,12 +1,13 @@
 import axios from 'axios'
 import { Loading, Message } from 'element-ui'
 export default function axiosFormatting (customConfig) {
+  //将请求头和请求参数的值转化为对象形式
+  const headers = arrToObject(customConfig.headers)
+  const params = arrToObject(customConfig.params)
   const httpConfig = {
     timeout: 1000 * 30,
     baseURL: '',
-    headers: {
-      ...customConfig.headers
-    }
+    headers
   }
   // let loadingInstance = null // 加载全局的loading
   const instance = axios.create(httpConfig)
@@ -30,6 +31,10 @@ export default function axiosFormatting (customConfig) {
       // 执行响应脚本
       const data = response.data.data
       eval(customConfig.responseScript)
+      Message({
+        message: '执行成功',
+        type: 'success'
+      })
       return Promise.resolve(data)
     } else {
       Message({
@@ -43,7 +48,7 @@ export default function axiosFormatting (customConfig) {
     instance({
       method: customConfig.method,
       url: customConfig.url,
-      params: customConfig.params,
+      params,
       data: customConfig.method === 'post' ? customConfig.body : undefined
     }).then(response => {
       resolve(response)
@@ -52,3 +57,11 @@ export default function axiosFormatting (customConfig) {
     })
   })
 }
+// 数组转化为对象
+function arrToObject(list) {
+  const obj = {}
+  list.forEach(item=>{
+    obj[item.key] = item.value
+  })
+  return obj
+}