Преглед изворни кода

表格排序,空数据,指标库添加

cxmo пре 1 година
родитељ
комит
f34d733379

+ 20 - 3
src/views/dataEntry_manage/databaseComponents/addTargetDiaBase.vue

@@ -69,7 +69,7 @@
 
 <script>
 import { dataBaseInterface } from '@/api/api.js'
-import { fromArr, fromCode } from './util';
+import { fromArr, fromCode ,frequencyArr} from './util';
 export default {
 	name: '',
 	props: {
@@ -110,6 +110,13 @@ export default {
 			search_company_txt: ''
 		};
 	},
+	watch:{
+		isAddTarget(newVal){
+			if(newVal){
+				this.getTargetSource()
+			}
+		}
+	},
 	methods: {
 		init() {
 			this.fromType = 'wind'
@@ -169,12 +176,18 @@ export default {
 							unit: res.Data.SearchItem.Unit,
 							frequency: res.Data.SearchItem.Frequency,
 						} : {}
+						let jy_params = Number(this.fromCode.get(this.fromType))>1000?{
+							edb_name:res.Data.SearchItem.EdbName,
+							unit:res.Data.SearchItem.Unit,
+							frequency:frequencyArr.includes(res.Data.SearchItem.Frequency)?res.Data.SearchItem.Frequency:''
+						}:{}
 						this.add_params = {
 							EdbCode: res.Data.SearchItem.EdbCode,
 							EndDate: res.Data.SearchItem.EndDate,
 							StartDate: res.Data.SearchItem.StartDate,
 							Source: Number(this.fromCode.get(this.fromType)),
-							...opther_params
+							...opther_params,
+							...jy_params
 						}
 						this.status = res.Data.Status;
 						let classify_arr = res.Data.ClassifyList || [];
@@ -223,19 +236,23 @@ export default {
 		},
 		getTargetSource(){
 			this.fromArr = []
+			this.fromCode = []
 			dataBaseInterface.getDataSource({IsBase:1}).then(res=>{
 				if(res.Ret!==200) return
 				if(res.Data){
 					this.fromArr = res.Data.map(i=>{
 						return i.SourceName
 					})
+					this.fromCode = new Map(res.Data.map(i=>{
+						return [i.SourceName,i.EdbSourceId]
+					}))
 				}
 			})
 		}
 	},
 	created() { },
 	mounted() {
-		this.getTargetSource()
+		//this.getTargetSource()
 	},
 }
 </script>

+ 2 - 1
src/views/dataEntry_manage/databaseComponents/updateDialog.vue

@@ -71,6 +71,7 @@ export default {
       if (newval) {
         this.getTotal();
         this.getDataList();
+        this.getTargetSource();
         this.$nextTick(() => {
           this.loadMoveHandler();
         })
@@ -405,7 +406,7 @@ export default {
   },
   created() { },
   mounted() {
-      this.getTargetSource()
+      //this.getTargetSource()
   },
 };
 </script>

+ 2 - 0
src/views/dataEntry_manage/databaseComponents/util.js

@@ -153,6 +153,8 @@ export const computedBatchTypes = [
 	}
 ]
 
+//频度
+export const frequencyArr = ['日度','周度','旬度','月度','季度','年度']
 //添加基础指标来源
 export const fromArr = ['wind','同花顺','彭博','彭博财务','路透','手工指标','隆众指标','SMM','Mysteel','郑商所',
 '大商所','上期所','中金所','上期能源','欧洲天然气','中国煤炭市场网','谷歌出行指数','EIA STEO报告','UN','卓创数据(红桃3)',

+ 48 - 18
src/views/dataEntry_manage/thirdBase/DatabankBase.vue

@@ -21,7 +21,8 @@
             style="width:240px;margin-left:30px;"></el-input>
         </div>
         <div class="table-box">
-            <el-table :data="tableData" border>
+            <el-table :data="tableData" border  @sort-change="sortChange" 
+                v-loading="tableLoading" element-loading-text="数据加载中...">
                 <el-table-column v-for="column in tableColumnList" 
                     align="center"
                     :key="column.key"
@@ -29,6 +30,9 @@
                     :prop="column.key"
                     :min-width="column.minWidth"
                     :sortable="column.sortable"></el-table-column>
+                <div class="empty-box" slot="empty">
+                    <tableNoData text="暂无数据"/>
+                </div>
             </el-table>
         </div>
         <div class="page-box">
@@ -50,11 +54,14 @@ import { databankInterface } from "@/api/api.js";
 export default {
     data() {
         return {
-            sourceList:[],
-            choosedSource:'web',
-            frequencyList:[],
-            selectValue:'',
-            inputValue:'',
+            sourceList:[],//数据源列表
+            choosedSource:'',//选择的数据源
+
+            frequencyList:[],//频度列表
+            selectValue:'',//选择的频度
+
+            inputValue:'',//搜索框
+
             tableColumnList:[
                 {
                     key:'Code',
@@ -89,13 +96,22 @@ export default {
                     sortable:true
                 }
             ],
-            tableData:[],
+            tableData:[],//表格数据
             pageNo:1,
-            pageSize:10,
+            pageSize:15,
             total:0,
-
+            SortField:0,
+            SortRule:0,
+            tableLoading:false,
         };
     },
+    watch:{
+        choosedSource(newVal){
+            if(newVal){
+                this.handleCurrentChange(1)
+            }
+        }
+    },
     methods: {
         getFrequencyList(){
             databankInterface.getFrequencyList().then(res=>{
@@ -103,40 +119,54 @@ export default {
                 this.frequencyList = res.Data||[]
             })
         },
-        async getSourceList(){
-            await databankInterface.getSourceList().then(res=>{
+        getSourceList(){
+            databankInterface.getSourceList().then(res=>{
                 if(res.Ret!==200) return
                 this.sourceList = res.Data||[]
                 this.choosedSource = this.sourceList[0].EdbSourceId
             })
         },
         getTableData(){
+            this.tableLoading=true
             databankInterface.getDataList({
                 Source:Number(this.choosedSource),
                 CurrentIndex:this.pageNo,
                 PageSize:this.pageSize,
                 Frequency:this.selectValue,
-                Keyword:this.inputValue
+                Keyword:this.inputValue,
+                SortField:this.SortField,
+                SortRule:this.SortRule
             }).then(res=>{
                 if(res.Ret!==200) return 
                 if(!res.Data) return 
                 this.tableData = res.Data.List
                 this.total = res.Data.Paging.Totals
+                this.tableLoading=false
             })
         },
         handleCurrentChange(page){
             this.pageNo = page
             this.getTableData()
         },
-        async pageInit(){
-            await this.getSourceList()
-            this.getFrequencyList()
-            this.getTableData()
-        },
+        sortChange({prop,order}){
+            const propMap = {
+                'DateFirst':1,
+                'DateLast':2,
+                'TimeLastUpdate':3
+            }
+            const orderMap = {
+                'ascending':1,
+                'descending':2
+            }
+            this.SortRule = orderMap[order]||0
+            this.SortField = propMap[prop]||0
+            this.handleCurrentChange(1)
+        }
 
     },
     mounted(){
-        this.pageInit()
+        this.getSourceList()
+        this.getFrequencyList()
     }
 };
 </script>