瀏覽代碼

Merge branches 'ETA_1.4.5' and 'edb-newtest-bugFix'

hbchen 1 年之前
父節點
當前提交
4cfeaabb1d

+ 3 - 3
src/api/modules/thirdBaseApi.js

@@ -192,7 +192,7 @@ const smmDataInterface = {
    * 列表
 	*/
 	getYsDataList:params=>{
-		return http.get('datamanage/smm/api/list',params)
+		return http.post('datamanage/smm/api/list',params)
 	},
 	/**
    * 分类列表
@@ -204,13 +204,13 @@ const smmDataInterface = {
    * 检验有色指标是否存在
 	*/
 	getYsEdbCodeCheck:params=>{
-		return http.get('datamanage/edb_info/smm/exist/check',params)
+		return http.post('datamanage/edb_info/smm/exist/check',params)
 	},
 	/**
    * 查询有色指标
 	*/
 	getYsEdbCodeSearch:params=>{
-		return http.get('datamanage/edb_info/smm/search',params)
+		return http.post('datamanage/edb_info/smm/search',params)
 	},
 	/**
    * 批量添加有色指标

+ 3 - 1
src/utils/buttonConfig.js

@@ -214,7 +214,9 @@ export const dataSourcePermission = {
     smmData_classifyOpt_add:'smmData:classifyOpt:add',//添加目录和子项
     smmData_classifyOpt_edit:'smmData:classifyOpt:edit',//编辑
     smmData_classifyOpt_delete:'smmData:classifyOpt:delete',//删除
-
+    /*--------有色原始数据库---- */
+    ysTarget_view:'ysTarget:view',
+    ysTarget_addBatch:'ysTarget:addBatch',
     /*--------百川盈孚---- */
     bcyfData_edit:'bcyfData:edit',//编辑指标按钮
     bcyfData_export:'bcyfData:export',

+ 1 - 1
src/views/dataEntry_manage/databaseComponents/updateNewestDia.vue

@@ -165,7 +165,7 @@ export default {
       const res = await dataBaseInterface.insertData({
         EdbInfoId: edbId,
         Date: date,
-        value: Number(value)
+        value: value
       })
 
       if(res.Ret !== 200) return

+ 159 - 103
src/views/dataEntry_manage/thirdBase/ysTargetBase.vue

@@ -1,32 +1,37 @@
 <template>
   <div id="YS-data-container" v-loading="dataLoading" element-loading-text="指标数据加载中,请勿切换到其他页面">
-    <div class="search-zone">
+    <div class="search-zone" v-loading="listLoading" element-loading-text="列表加载中,请稍后">
       <div class="search-row">
-        <el-cascader @change="searchList" :options="classifyList" v-model="typesList" clearable
-          placeholder="请选择分类" class="search-item"
-          :props="{
-            value:'Type',
-            label:'Type',
-            children:'Child'
-          }"></el-cascader>
-        <el-select v-model="searchParams.Frequency" class="search-item" placeholder="请选择频度" clearable @change="searchList">
-          <el-option :label="item" :value="item" v-for="item in frequencyList" :key="item"></el-option>  
+        <el-cascader @change="searchList" :options="classifyList" v-model="typeChecks" 
+        clearable placeholder="请选择分类" class="search-item" collapse-tags	
+        :props="{
+          value:'Type',
+          label:'Type',
+          children:'Child',
+          multiple:true
+        }"></el-cascader>
+        <el-select v-model="frequencyChecks" class="search-item" placeholder="请选择频度" 
+        multiple collapse-tags clearable @change="searchListDelay">
+          <el-option :label="item" :value="item" v-for="item in frequencyList" :key="item" ></el-option>  
         </el-select>
-        <el-select v-model="searchParams.DataState" class="search-item" placeholder="请选择指标数据状态" clearable @change="searchList">
+        <el-select v-model="dataStateChecks" class="search-item" placeholder="请选择指标数据状态" 
+        multiple collapse-tags clearable @change="searchListDelay">
           <el-option :label="item.label" :value="item.value" v-for="item in dataStatusList" :key="item.value"></el-option>  
         </el-select>
-        <el-select v-model="edbCheckList" multiple filterable remote clearable collapse-tags class="search-item edb-filter"
+        <el-input v-model="searchParams.Keyword" placeholder="请输入指标ID/指标名称" class="search-item" clearable 
+        @blur="searchListDelay(!keyWordChanged)" @keyup.enter.native="searchListDelay(!keyWordChanged)" @clear="searchList"></el-input>
+        <!-- <el-select v-model="edbCheckList" multiple filterable remote clearable collapse-tags class="search-item edb-filter"
           reserve-keyword placeholder="指标ID/指标名称" :remote-method="remoteMethod" 
           v-loadMore="searchLoad" @clear="searchList" @remove-tag="removeEdbFilterTag" ref="edbFilterRef" >
           <el-option v-for="item in edbFilterDataList" :key="item.IndexCode"
             :label="item.IndexName" :value="item.IndexCode">
           </el-option>
-        </el-select>
+        </el-select> -->
         <el-checkbox label="列表全选" v-model="isCheckAll" :indeterminate="isCheckIndeterminate" style="margin: 0 20px 10px 0;"
         @change="listCheckAllChange"></el-checkbox>
       </div>
       <el-button type="primary" style="margin: 0 0 10px 0;padding:12px 18px ;" @click="addToEdbBase" 
-      :disabled="addBaseDisable">添加到指标库</el-button>
+      :disabled="addBaseDisable"  v-permission="permissionBtn.dataSourcePermission.ysTarget_addBatch">添加到指标库</el-button>
     </div>
     <div class="table-zone">
       <el-table :data="tableData" border @sort-change="sortChange"  @selection-change="selectionChange"
@@ -191,16 +196,20 @@ import { frequencyArr} from '../databaseComponents/util';
     data() {
       return {
         searchParams:{
-          Types:'',
+          Types:[],
           Frequency:'',
           DataState:'',
           CurrentIndex:1,
           PageSize:10,
           SortParam:'',
           SortType:'',
-          IndexCodes:''
+          Keyword:'',
+          // IndexCodes:''
         },
-        typesList:[],
+        keyWordChanged:false,
+        typeChecks:[],
+        frequencyChecks:[],
+        dataStateChecks:[],
         options:[],
         isCheckAll:false,
         isCheckIndeterminate:false,
@@ -210,17 +219,17 @@ import { frequencyArr} from '../databaseComponents/util';
         frequencyList: ["日度", "周度", "月度", "季度", "半年", "年度"],
         edbFrequencyList:frequencyArr,
         dataStatusList:[{value:'normal',label:'正常更新'},{value:'ceased',label:'已停更'},{value:'irregular',label:'更新依赖外部会有不定期延迟'}],
-        forSearchParams:{
-          Keyword:'',
-          CurrentIndex:1,
-          PageSize:20,
-        },
-        searchHaveMore: false,
-        edbFilterDataList:[],
+        // forSearchParams:{
+        //   Keyword:'',
+        //   CurrentIndex:1,
+        //   PageSize:20,
+        // },
+        // searchHaveMore: false,
+        // edbFilterDataList:[],
         // 选择的指标名称筛选项
-        edbCheckList:[],
+        // edbCheckList:[],
         // edb的过滤选项是否有变化,用于失焦是判断是否需要请求
-        hasEdbFilterChange:false,
+        // hasEdbFilterChange:false,
         selectionReactCancel:false, // 是否不触发 selection的逻辑
         tableData:[],
         tableDataIds:[],
@@ -249,24 +258,42 @@ import { frequencyArr} from '../databaseComponents/util';
         BatchList:[],
         addToEbdDiaShow:false,
         highLightIndex:[],
-        saveLoading:false
+        saveLoading:false,
+        listLoading:false
       }
     },
     computed:{
       addBaseDisable(){
         return !(this.isCheckAll || this.isCheckIndeterminate ) || (!(this.tableData && this.tableData.length>0))
+      },
+      isCanView(){
+        return this.permissionBtn.isShowBtn('dataSourcePermission','ysTarget_view')
       }
     },
     watch:{
-      edbCheckList(value){
-        this.hasEdbFilterChange=true
+      // edbCheckList(value){
+      //   this.hasEdbFilterChange=true
+      // },
+      typeChecks(value){
+        // console.log(value);
+        this.searchParams.Types = value.map(item => item.join(','))
       },
-      typesList(value){
+      frequencyChecks(value){
         if(value && value.length>0){
-          this.searchParams.Types = value.join(',')
+          this.searchParams.Frequency = value.join(',')
         }else{
-          this.searchParams.Types=''
+          this.searchParams.Frequency=''
         }
+      },
+      dataStateChecks(value){
+        if(value && value.length>0){
+          this.searchParams.DataState = value.join(',')
+        }else{
+          this.searchParams.DataState=''
+        }
+      },
+      'searchParams.Keyword'(value){
+        this.keyWordChanged=true
       }
     },
     created() {
@@ -275,21 +302,28 @@ import { frequencyArr} from '../databaseComponents/util';
     },
     mounted(){
       // el-select 的@blur绑定事件不生效代替方法
-      this.$refs.edbFilterRef.$refs.input.blur=()=>{
-        if(this.hasEdbFilterChange){
-          this.searchList()
-          this.hasEdbFilterChange=false
-        }
-      }
+      // this.$refs.edbFilterRef.$refs.input.blur=()=>{
+      //   if(this.hasEdbFilterChange){
+      //     this.searchList()
+      //     this.hasEdbFilterChange=false
+      //   }
+      // }
     },
     methods: {
       //获取有色数据库数据列表
       getList(type){
-        if(this.edbCheckList && this.edbCheckList.length>0){
-          this.searchParams.IndexCodes = this.edbCheckList.join(',')
-        }else{
-          this.searchParams.IndexCodes = ''
-        }
+        // return 
+        // 无权限查看
+        if(!this.isCanView) return 
+        // if(this.edbCheckList && this.edbCheckList.length>0){
+        //   this.searchParams.IndexCodes = this.edbCheckList.join(',')
+        // }else{
+        //   this.searchParams.IndexCodes = ''
+        // }
+        this.searchParams.Keyword = this.searchParams.Keyword.trim()
+        this.listLoading=true
+
+        // return 
         smmDataInterface.getYsDataList(this.searchParams).then(res=>{
           if(res.Ret == 200){
             this.tableData=res.Data.List || []
@@ -302,7 +336,7 @@ import { frequencyArr} from '../databaseComponents/util';
             if(type == 'adjustSelection'){
               this.adjustSelection()
             }else{
-              if(this.searchParams.Types || this.searchParams.Frequency || this.searchParams.DataState || this.searchParams.IndexCodes){
+              if((this.searchParams.Types && this.searchParams.Types.length>0) || this.searchParams.Frequency || this.searchParams.DataState || this.searchParams.Keyword){
                 this.isCheckAll=true
                 this.checkAllStatus=true
                 this.isCheckIndeterminate=false
@@ -313,11 +347,17 @@ import { frequencyArr} from '../databaseComponents/util';
               }
               this.listCheckAllChange(this.isCheckAll)
             }
+            this.keyWordChanged=false
           }
         })
+        .finally(()=>{
+          this.listLoading=false
+        })
       },
       // 获取有色数据库分类列表
       getYsClassifyList(){
+        // 无权限查看
+        if(!this.isCanView) return 
         smmDataInterface.getYsTypeDataList().then(res=>{
           if(res.Ret == 200){
             this.classifyList=res.Data || []
@@ -325,34 +365,43 @@ import { frequencyArr} from '../databaseComponents/util';
         })
 
       },
-      // 指标名称的远程搜索方法
-      remoteMethod(text){
-        this.forSearchParams.Keyword = text.trim()
-        this.forSearchParams.CurrentIndex = 1;
-        if(this.forSearchParams.Keyword){
-          this.searchApi()
-        }else{
-          this.edbFilterDataList = [];
-        }
-      },
-      searchApi(){
-        smmDataInterface.getYsDataList(this.forSearchParams).then(res=>{
-          if(res.Ret == 200){
-            let arr=res.Data.List || []
-            let {Paging}=res.Data
-            this.searchHaveMore = this.forSearchParams.CurrentIndex < Paging.Pages;
-            this.edbFilterDataList = this.forSearchParams.CurrentIndex === 1 ? arr : this.edbFilterDataList.concat(arr);
-          }
-        })
-      },
-      searchLoad(){
-        if(!this.searchHaveMore) return;
-        this.forSearchParams.CurrentIndex++
-			  this.searchApi();
+      // // 指标名称的远程搜索方法
+      // remoteMethod(text){
+      //   this.forSearchParams.Keyword = text.trim()
+      //   this.forSearchParams.CurrentIndex = 1;
+      //   if(this.forSearchParams.Keyword){
+      //     this.searchApi()
+      //   }else{
+      //     this.edbFilterDataList = [];
+      //   }
+      // },
+      // searchApi(){
+      //   // 无权限查看
+      //   if(!this.isCanView) return 
+      //   smmDataInterface.getYsDataList(this.forSearchParams).then(res=>{
+      //     if(res.Ret == 200){
+      //       let arr=res.Data.List || []
+      //       let {Paging}=res.Data
+      //       this.searchHaveMore = this.forSearchParams.CurrentIndex < Paging.Pages;
+      //       this.edbFilterDataList = this.forSearchParams.CurrentIndex === 1 ? arr : this.edbFilterDataList.concat(arr);
+      //     }
+      //   })
+      // },
+      // searchLoad(){
+      //   if(!this.searchHaveMore) return;
+      //   this.forSearchParams.CurrentIndex++
+			//   this.searchApi();
+      // },
+	    // removeEdbFilterTag: _.throttle(function() {
+      //   this.searchList()
+		  // },1000),
+      // watch回调是异步的 延迟执行搜索 
+      searchListDelay(cancel){
+        if(cancel+'' == 'true') return 
+        setTimeout(()=>{
+          this.searchList()
+        },0)
       },
-	    removeEdbFilterTag: _.throttle(function() {
-        this.searchList()
-		  },1000),
       searchList(type){
         this.searchParams.CurrentIndex=1
         this.getList(type)
@@ -477,38 +526,40 @@ import { frequencyArr} from '../databaseComponents/util';
         },50)
       },
       // 添加指标库
-      addToEdbBase:_.throttle(function() {
-        if(this.dataLoading || this.addBaseDisable) return 
-        let params={
-          Types:this.searchParams.Types,
-          Frequency:this.searchParams.Frequency,
-          DataState:this.searchParams.DataState,
-          SelectAll:this.checkAllStatus,
-          SelectCode:this.searchParams.IndexCodes,
-          EdbCode:this.tableDataCheckedList.join(',')
-        }
-        // return 
-        smmDataInterface.getYsEdbCodeCheck(params).then(res=>{
-          if(res.Ret == 200){
-            // console.log(res,'res');
-            if(res.Data.IndexExist){
-              // 有重复
-              this.existIndexList=[]
-              let existEdbInfo=res.Data.ExistEdbInfo || []
-              let text=''
-              existEdbInfo.map(item =>{
-                text=`${item.EdbName}(${item.EdbCode})`
-                this.existIndexList.push({text,code:item.UniqueCode,id:item.EdbInfoId,Types:item.ClassifyId,edbCode:item.EdbCode})
-              })
-              this.checkFailShow=true
-              this.indexAllExist=res.Data.ExistAll+'' =='false' ? false :res.Data.ExistAll || true
-            }else{
-              // 没有重复
-              this.getTargetData()
-            }
+      addToEdbBase() {
+        setTimeout(()=>{
+          if(this.dataLoading || this.addBaseDisable) return 
+          let params={
+            Types:this.searchParams.Types,
+            Frequency:this.searchParams.Frequency,
+            DataState:this.searchParams.DataState,
+            SelectAll:this.checkAllStatus,
+            Keyword:this.searchParams.Keyword,
+            EdbCode:this.tableDataCheckedList.join(',')
           }
-        })
-      },300),
+          // return 
+          smmDataInterface.getYsEdbCodeCheck(params).then(res=>{
+            if(res.Ret == 200){
+              // console.log(res,'res');
+              if(res.Data.IndexExist){
+                // 有重复
+                this.existIndexList=[]
+                let existEdbInfo=res.Data.ExistEdbInfo || []
+                let text=''
+                existEdbInfo.map(item =>{
+                  text=`${item.EdbName}(${item.EdbCode})`
+                  this.existIndexList.push({text,code:item.UniqueCode,id:item.EdbInfoId,classifyId:item.ClassifyId,edbCode:item.EdbCode})
+                })
+                this.checkFailShow=true
+                this.indexAllExist=res.Data.ExistAll+'' =='false' ? false :res.Data.ExistAll || true
+              }else{
+                // 没有重复
+                this.getTargetData()
+              }
+            }
+          })
+        },50)
+      },
       edbCheckFinished(){
         if(!this.indexAllExist){
           this.getTargetData()
@@ -533,7 +584,7 @@ import { frequencyArr} from '../databaseComponents/util';
           Frequency:this.searchParams.Frequency,
           DataState:this.searchParams.DataState,
           SelectAll:this.checkAllStatus,
-          SelectCode:this.searchParams.IndexCodes,
+          Keyword:this.searchParams.Keyword,
           EdbCode:afterFilterList.join(',')
         }
         smmDataInterface.getYsEdbCodeSearch(params).then(res => {
@@ -693,6 +744,11 @@ import { frequencyArr} from '../databaseComponents/util';
     }
     .edb-table-box{
       padding: 0 40px;
+      .sticky {
+        position: sticky;
+        border-right: 1px solid #dcdfe6;
+        z-index: 10;
+      }
       .edb-table-preview {
         overflow: auto;
         height: calc(100% - 124px);