liu.tao3 1 год назад
Родитель
Сommit
233afab63f
1 измененных файлов с 29 добавлено и 10 удалено
  1. 29 10
      data-room-ui/packages/DataSetManagement/src/index.vue

+ 29 - 10
data-room-ui/packages/DataSetManagement/src/index.vue

@@ -253,6 +253,10 @@ export default {
       type: [Array, Object],
       default: null
     },
+    dataSetList:{
+      type:[Array, Object],
+      default:()=>[]
+    },
     appCode: {
       type: String,
       default: ''
@@ -299,6 +303,11 @@ export default {
       }
     }
   },
+  computed:{
+    allType(){
+      return this.datasetTypeList.map(item=>item.datasetType).filter(item=>item!='')
+    }
+  },
   watch: {
     datasetType (value) {
       if (value === null) {
@@ -455,21 +464,30 @@ export default {
         }
       }
       this.current = 1
-      this.getDataList()
-      this.datasetTypeList = [
-        { name: '全部', datasetType: '' },
-        { name: '原始数据集', datasetType: 'original', componentName: 'OriginalEditForm' },
-        { name: '自助数据集', datasetType: 'custom', componentName: 'CustomEditForm' },
-        { name: '存储过程数据集', datasetType: 'storedProcedure', componentName: 'StoredProcedureEditForm' },
-        { name: 'JSON数据集', datasetType: 'json', componentName: 'JsonEditForm' },
-        { name: '脚本数据集', datasetType: 'script', componentName: 'ScriptEditForm' }
-      ]
+      const list=[
+          { name: '全部', datasetType: '' },
+          { name: '原始数据集', datasetType: 'original', componentName: 'OriginalEditForm' },
+          { name: '自助数据集', datasetType: 'custom', componentName: 'CustomEditForm' },
+          { name: '存储过程数据集', datasetType: 'storedProcedure', componentName: 'StoredProcedureEditForm' },
+          { name: 'JSON数据集', datasetType: 'json', componentName: 'JsonEditForm' },
+          { name: '脚本数据集', datasetType: 'script', componentName: 'ScriptEditForm' },
+          { name: 'JS数据集', datasetType: 'js', componentName: 'JsDataSet' }
+        ]
+      if(this.dataSetList.length!=0){
+        this.datasetTypeList=[{ name: '全部', datasetType: '' },...list.filter(item=>this.dataSetList.findIndex(x=>x===item.datasetType)!==-1)]
+      }else{
+        this.datasetTypeList = [
+          ...list
+        ]
+      }
+
       if (window.BS_CONFIG?.customDatasetComponents && window.BS_CONFIG?.customDatasetComponents.length > 0) {
         // 将获得到的远程数据集进行组装
         window.BS_CONFIG?.customDatasetComponents.forEach((item) => {
           this.datasetTypeList.push({ name: item.config.name, datasetType: item.config.datasetType, componentName: item.config.componentName })
         })
       }
+      this.getDataList()
     },
     // 新增数据集
     addDataset () {
@@ -487,7 +505,8 @@ export default {
         current: this.current,
         size: this.size,
         moduleCode: this.appCode,
-        ...this.queryForm
+        ...this.queryForm,
+        datasetType:this.queryForm.datasetType===''?[...this.allType]:[this.queryForm.datasetType]
       }).then((data) => {
         this.tableData = data.list
         if (this.isDialog) {