Karsa vor 11 Monaten
Ursprung
Commit
f9fcc0be21

+ 53 - 1
src/api/modules/dataSource.js

@@ -66,8 +66,60 @@ const apiDataSource={
 
     
 
+}
+
+//自有数据
+const selfDataInterface = {
+    /**
+     * 来源列表
+     * @param {*} params 
+     * @returns 
+     */
+    getSourceList: params => {
+        return http.get('/datamanage/business_data/source/list')
+    },
+
+    /**
+     * 指标数据
+     * @param {*} params 
+     * PageSize CurrentIndex Frequency Keywords Source
+     * @returns 
+     */
+    getEdbList: params => {
+        return http.get('/datamanage/business_data/list',params)
+    },
+    
+    /**
+     * 校验指标是否存在
+     * @param {*} params 
+     * PageSize CurrentIndex Frequency Keywords Source ListAll IndexCodes
+     * @returns 
+     */
+    checkEdb: params => {
+        return http.post('/datamanage/business_data/add_check',params)
+    },
+
+    /**
+     * 校验指标名称
+     * @param {*} parmas 
+     * @returns 
+     */
+    checkName: parmas => {
+        return http.post('/datamanage/business_data/name_check',parmas)
+    },
+
+    /**
+     * 添加入指标库
+     * @param {*} parmas 
+     * [{Source EdbCode EdbName Frequency Unit ClassifyId}]
+     * @returns 
+     */
+    batchSaveEdb: parmas => {
+        return http.post('/datamanage/business_data/batch_add',parmas)
+    }
 }
 
 export {
-    apiDataSource
+    apiDataSource,
+    selfDataInterface
 }

+ 2 - 0
src/utils/buttonConfig.js

@@ -264,6 +264,8 @@ export const dataSourcePermission = {
     coalWordData_export:'coalWord:export', // 导出
     /*--------彭博数据源--- */
     Bloomberg_add2edb:'Bloomberg:add2edb',//添加指标库
+    /* 自有数据 */
+    selfData_addEdb:'selfData:addEdb',//添加到指标库
 }
 
 /*

+ 4 - 4
src/views/dataEntry_manage/thirdBase/components/addToBaseDia.vue

@@ -17,18 +17,18 @@
           border 
           height="500px"
         >
-          <el-table-column label="指标ID" align="center" prop="EdbCode"/>
-          <el-table-column label="指标名称" align="center">
+          <el-table-column :label="$t('Edb.Detail.e_id')" align="center" prop="EdbCode"/>
+          <el-table-column :label="$t('Edb.Detail.e_name')" align="center">
               <template slot-scope="scope">
                   <el-input v-model="scope.row.name" placeholder="请填写指标名称" style="width:100%"/>
               </template>
           </el-table-column>
-          <el-table-column label="单位" align="center" width="200px">
+          <el-table-column :label="$t('Edb.Detail.e_unit')" align="center" width="200px">
               <template slot-scope="scope">
                   <selectUnit v-model="scope.row.unit"/>
               </template>
           </el-table-column>
-          <el-table-column label="频度" align="center" width="200px">
+          <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" width="200px">
             <template slot-scope="scope">
               <el-select
                 v-model="scope.row.frequency"

+ 187 - 51
src/views/dataEntry_manage/thirdBase/selfDataBase.vue

@@ -8,7 +8,12 @@
           :placeholder="$t('SelftDataPage.ph_channel')"
           clearable
         >
-          <el-option v-for="item in sourceOptions" :key="item" :label="$t('SystemManage.OperateAuth.set_assets_tab')" :value="1"/>
+          <el-option 
+            v-for="item in sourceOptions" 
+            :key="item.EdbBusinessSourceId" 
+            :label="item.SourceName" 
+            :value="item.EdbBusinessSourceId"
+          />
         </el-select>
 
         <el-select
@@ -17,7 +22,7 @@
           :placeholder="$t('Edb.InputHolderAll.input_fre')"
           clearable
         >
-          <el-option v-for="item in frequencyOptions" :key="item" :label="$t('SystemManage.OperateAuth.set_assets_tab')" :value="1"/>
+          <el-option v-for="item in frequencyOptions" :key="item.val" :label="item.label" :value="item.val"/>
         </el-select>
 
         <el-input 
@@ -39,7 +44,11 @@
           ><!-- 列表全选 -->{{$t('SystemManage.OperateAuth.all_select')}}</el-checkbox>
       </div>
 
-      <el-button type="primary" @click="addToBaseHandle"><!-- 添加到指标库 -->{{$t('YsDataPage.add_base_btn')}}</el-button>
+      <el-button 
+        v-permission="permissionBtn.dataSourcePermission.selfData_addEdb"
+        type="primary" 
+        @click="handleCheckEdb('multiple')"
+      ><!-- 添加到指标库 -->{{$t('YsDataPage.add_base_btn')}}</el-button>
     </div>
 
     <div class="main">
@@ -79,8 +88,9 @@
                 </span>
 
                 <span 
-                  class="editsty" 
-                  @click="addToBaseHandle('single')"
+                  class="editsty"
+                  v-if="!row.EdbExist" 
+                  @click="handleCheckEdb('single')"
                 >
                   <!-- 添加到指标库 -->{{$t('YsDataPage.add_base_btn')}}
                 </span>
@@ -115,53 +125,71 @@
       :isShow.sync="isAddToBaseDia"
       :list="addToBaseList"
     />
+
+    <!-- 操作提示弹窗 -->
+    <el-dialog 
+      :title="$t('BloombergPage.operation_prompt')"
+      :visible.sync="isHintDialogShow"
+      :close-on-click-modal="false"
+      :modal-append-to-body="false"
+      @close="isHintDialogShow=false"
+      width="578px"
+      v-dialogDrag
+      center>
+      <div class="hint-dialog-wrap">
+          <p style="margin-bottom: 20px;">{{ hintText }}</p>
+          <ul>
+              <li v-for="(item,index) in existEdbList" :key="index" class="hint-item" @click="gotoEdbDetail(item)">
+                  {{ index+1 }}、{{ item.IndexName }}({{ item.IndexCode }})
+              </li>
+          </ul>
+      </div>
+      <div style="text-align: center;margin-bottom: 30px;">
+          <el-button type="primary" @click="handleCloseDialog">{{$t('Dialog.known')}}</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
+import { dataBaseInterface } from '@/api/api.js'
+import { selfDataInterface } from '@/api/modules/dataSource';
 import mPage from '@/components/mPage.vue';
 import lookEdbDataDia from './components/lookEdbDataDia.vue';
 import addToBaseDia from './components/addToBaseDia.vue';
 export default {
   components: { mPage,lookEdbDataDia,addToBaseDia },
   computed: {
-     tableColums() {
+    tableColums() {
         return [
           {
             label: this.$t('Edb.Detail.e_id'),
-            key: 'EdbCode',
-            widthsty: '120px',
+            key: 'IndexCode',
           },
          {
             label: this.$t('Edb.Detail.e_name'),
-            key: 'EdbName',
-            minwidthsty: '150px',
+            key: 'IndexName',
           },
           {
             label: this.$t('Edb.Detail.e_fre'),
             key: 'Frequency',
-            minwidthsty: '60px',
           },
           {
             label: this.$t('Edb.Detail.e_unit'),
             key: 'Unit',
-            minwidthsty: '50px',
           },
           {
             label: /* '渠道' */this.$t('SelftDataPage.col_channel'),
-            key: 'Source',
-            minwidthsty: '50px',
+            key: 'SourceName',
           },
           {
             label: /* '指标开始时间' */this.$t('SelftDataPage.col_start_time'),
             key: 'StartDate',
             sortable:true,
-            minwidthsty: '100px',
           },
           {
             label: /* '指标最新时间' */this.$t('SelftDataPage.col_newest_time'),
-            key: 'LatestDate',
+            key: 'DataUpdateTime',
             sortable:true,
-            minwidthsty: '90px',
           },
           {
             label: /* '入库时间' */this.$t('SelftDataPage.col_create'),
@@ -175,9 +203,33 @@ export default {
 
         ]
     },
+
+    frequencyOptions(){
+      return [
+        { label:'日度',val: '日度' },
+        { label:'周度',val: '周度' },
+        { label:'旬度',val: '旬度' },
+        { label:'月度',val: '月度' },
+        { label:'季度',val: '季度' },
+        { label:'半年度',val: '半年度' },
+        { label:'年度',val: '年度' },
+      ]
+    },
+
+    hintText(){
+        let msg = ''
+        // if(this.afterAddList.length) key++
+        // if(!this.beforeAddList.length) key++
+        // return {
+        //     0:'',
+        //     1:this.$t('YsDataPage.haved_all_msg'),//本次添加的指标均已在指标库中,请勿重复添加!
+        //     2:this.$t('YsDataPage.haved_some_msg'),//指标库中已存在以下指标,会自动过滤!
+        // }[key]
+    }
   },
   data() {
     return {
+      edbMenuList: [],
       tableLoading: false,
       total: 0,
       
@@ -189,7 +241,6 @@ export default {
       ],
 
       sourceOptions: [],
-      frequencyOptions: [],
 
       isSelectAll: false, //真正意义上的全选或不全选
       checkedList: [], //不全选勾选中的 或 全选取消勾的
@@ -203,7 +254,7 @@ export default {
         keyWord: '',
         sortParam:'',
         sortType:'',
-        checkAll: true, //控制全选显示状态
+        checkAll: false, //控制全选显示状态
         checkSome: false
       },
 
@@ -213,42 +264,74 @@ export default {
       /* 加入指标库弹窗 */
       isAddToBaseDia: false,
       addToType: 'multiple',
-      addToBaseList: []
+      addToBaseList: [],//可加入的指标
+      existEdbList: [],//已存在的指标
+
+      /* 提示弹窗 */
+      isHintDialogShow: false,
 
     }
   },
   mounted(){
+    this.getSource();
+    this.getEdbMenuList();
+    this.getTableData();
   },
   methods:{
 
-    getTableData() {
+    getEdbMenuList() {
+      dataBaseInterface.menuListV3().then(res => {
+        if(res.Ret === 200) {
+            this.edbMenuList = res.Data.AllNodes || [];
+            this.filterNodes(this.edbMenuList);
+        }
+      })
+    },
+    // 递归改变目录结构
+    filterNodes(arr) {
+        arr.length && arr.forEach(item => {
+        item.Children.length && this.filterNodes(item.Children)
+        if(!item.Children.length) {
+            item.Children=null
+        }
+        })
+    },
+
+    getSource() {
+      selfDataInterface.getSourceList().then(res => {
+        if(res.Ret!==200 ) return
+
+        this.sourceOptions = res.Data || [];
+      })
+    },
+
+    getTableData(type='filter') {
       this.tableLoading = true;
-      // let params = {
-      //   Source: this.default_tab,
-      //   UserId: this.searchForm.user || 0,
-      //   CurrentIndex: this.page_no,
-      //   PageSize: this.pageSize,
-      //   Keyword: this.searchForm.key_word,
-      //   Classify,
-      //   SubSource: this.default_tab === 6 ? Number(this.default_sub_tab) : 0
-      // }
-			// operateAuthInterface.list(params).then(res => {
-      //   this.tableLoading = false;
-      //   if( res.Ret!==200 )return
-
-      //   const { Data } = res;
-
-      //   this.tableData = Data.List || [];
-      //   this.total = Data.Paging.Totals;
+
+      let params = {
+        Frequency: this.filterObj.frequency,
+        CurrentIndex: this.filterObj.page_no,
+        PageSize: this.filterObj.pageSize,
+        Keywords: this.filterObj.keyWord,
+        Source: this.filterObj.source
+      }
+			selfDataInterface.getEdbList(params).then(res => {
+        this.tableLoading = false;
+        if( res.Ret!==200 )return
+
+        const { Data } = res;
+
+        this.tableData = Data.List || [];
+        this.total = Data.Paging.Totals;
         
-      //   if(type==='pageChange'){
-      //     //页码变化 选中项不做清空
-      //     this.checkedSomeSelection()
-      //   }else {
-      //     this.listCheckAllChange(true)
-
-      //   }
-			// });
+        if(type==='pageChange'){
+          //页码变化 选中项不做清空
+          this.checkedSomeSelection()
+        }else {
+          this.listCheckAllChange(true)
+
+        }
+			});
     },
 
     /* 设置当页数据勾选状态 */
@@ -378,12 +461,54 @@ export default {
       this.isLookDataDia =  true
     },
 
-    /* 添加到指标库 */
-    addToBaseHandle(type='multiple') {
+    handleCheckEdb(type='multiple',data={}){
+
       if(type==='multiple' && !this.checkedList.length && !this.isSelectAll) return this.$message.warning('请选择指标')
-      
-      this.addToType = type;
-      this.isAddToBaseDia = true
+
+      const {frequence,keyWord,sortParam,sortType} = this.filterObj
+
+      selfDataInterface.checkEdb({
+          Frequency:frequence,
+          Keywords:keyWord,
+          SortField:sortParam||0,
+          SortRule:sortType||0,
+          ListAll:type==='single'?false:this.isSelectAll,
+          IndexCodes:type==='single'?[data.IndexCode]:this.checkedList
+      }).then(res=>{
+          if(res.Ret!==200) return 
+
+          const edbList = res.Data||[]
+          this.existEdbList = edbList.filter(i=>i.EdbExist===1)
+          this.addToBaseList = edbList.filter(i=>i.EdbExist===0)
+
+          this.existEdbList.length&&(this.isHintDialogShow=true)
+          !this.existEdbList.length&&this.handleCloseHintDia()
+      })
+    },
+
+
+    //操作提示弹窗关闭
+    handleCloseHintDia(){
+        this.isHintDialogShow = false
+        //判断是否要展示下一个弹窗
+        if(this.addToBaseList.length) return
+
+        this.addForm.list = this.addToBaseList
+        this.isAddToBaseDia = true
+    },
+
+    //跳转至指标详情
+    gotoEdbBase(data){
+        const {EdbClassifyId,EdbInfoId,EdbUniqueCode} = data||{}
+        const href = this.$router.resolve({
+            path:'/database',
+            query:{
+                code:EdbUniqueCode,
+                id:EdbInfoId,
+                classifyId:EdbClassifyId,
+            }
+        })
+        window.open(href,"_blank")
     }
 
   },
@@ -411,4 +536,15 @@ export default {
       }
     }
 }
+.hint-dialog-wrap{
+    padding-bottom:30px;
+    .hint-item{
+        cursor: pointer;
+        margin-bottom: 10px;
+        &:hover{
+            color:#409EFF;
+            text-decoration: underline;
+        }
+    }
+}
 </style>