소스 검색

联调中-暂存

hbchen 1 년 전
부모
커밋
d28c55b06d
2개의 변경된 파일103개의 추가작업 그리고 27개의 파일을 삭제
  1. 7 0
      src/api/modules/chartApi.js
  2. 96 27
      src/views/dataEntry_manage/databaseComponents/addTargetDiaBase.vue

+ 7 - 0
src/api/modules/chartApi.js

@@ -396,6 +396,13 @@ const dataBaseInterface = {
 		return http.get('/datamanage/edb_source/list/python')
 	},
 
+	/**
+	 * 新增指标 检验指标是否存在接口
+	 * @param {*} params Source SubSource EdbCode StockCode
+	 */
+	edbExistCheck: params => {
+		return http.get('/datamanage/edb_info/exist/check',params)
+	},
 
 	//========================================chart
 	// /**

+ 96 - 27
src/views/dataEntry_manage/databaseComponents/addTargetDiaBase.vue

@@ -26,12 +26,12 @@
 						<i slot="prefix" class="el-input__icon el-icon-search"></i>
 					</el-input>
 
-					<el-input placeholder="指标ID" v-model="search_txt" style="maxWidth:300px" v-if="!(this.fromType=='wind' && this.fromDatabase==2)"
+					<el-input placeholder="指标ID" v-model="search_txt" style="maxWidth:300px" v-if="!(this.fromType=='wind' && this.fromDatabase=='1')"
 						@keyup.enter.native="searchHandle" :disabled="haveResult" clearable>
 						<i slot="prefix" class="el-input__icon el-icon-search"></i>
 					</el-input>
 				</div>
-				<template v-if="this.fromType=='wind' && this.fromDatabase==2">
+				<template v-if="this.fromType=='wind' && this.fromDatabase=='1'">
 					<div class="wsd-index-box">
 						<el-input placeholder="请输入证券代码" v-model.trim="securityCodeText" class="wsd-index-input" @blur="codeInputBlur('security')"></el-input>
 						<div class="wsd-code-row">
@@ -45,7 +45,7 @@
 							<div class="index-code-hint">Wind金融终端输入“CG”会弹出代码生成器,可在代码生成器上获取其他指标的代码</div>
 						</div>
 						<el-checkbox-group v-model="indexCodeSelected">
-							<el-checkbox :label="item.value" v-for="item in indexCodeArr" :key="item.value">{{ item.lable }}</el-checkbox>
+							<el-checkbox :label="item.value" v-for="item in indexCodeArr" :key="item.value">{{ item.label }}</el-checkbox>
 						</el-checkbox-group>
 						<div class="wsd-code-row" style="margin-top: -10px;">
 							<div class="wsd-code-item" v-for="item in indexCode" :key="item">
@@ -160,6 +160,21 @@
 				</div>
 			</template>
 		</el-dialog>
+
+		<el-dialog :visible.sync="checkFailShow" :close-on-click-modal="false" :modal-append-to-body='false' 
+			width="600px" title="操作提示">
+			<div class="check-fail-box">
+				<div>
+					<div style="margin-bottom: 20px;">指标库中已存在以下指标,请勿重新输入!</div>
+					<div v-for="(item,index) in existIndexList">
+						{{ index+1+'、'+item }}
+					</div>
+				</div>
+				<div class="check-fail-button">
+					<el-button type="primary" @click="checkFailShow=false" style="width: 120px;">知道了</el-button>
+				</div>
+			</div>
+		</el-dialog>
 	</div>
 </template>
 
@@ -182,27 +197,27 @@ export default {
 		return {
 			search_txt: '',//搜素关键词 M001625518 M0001427
 			fromType: 'wind',
-			fromDatabase:2,
+			fromDatabase:'1',
 			fromArr,
 			indexCodeSelected:[],
 			indexCodeArr:[
-				{value:1,lable:"前收盘价"},
-				{value:2,lable:"开盘价"},
-				{value:3,lable:"最高价"},
-				{value:4,lable:"最低价"},
-				{value:5,lable:"收盘价"},
-				{value:6,lable:"结算价"},
-				{value:7,lable:"成交量"},
-				{value:8,lable:"成交额"},
-				{value:9,lable:"涨跌幅"},
-				{value:10,lable:"振幅"},
-				{value:11,lable:"换手率"},
-				{value:12,lable:"持仓量"},
-				{value:13,lable:"持仓额"},
+				{value:1,label:"前收盘价"},
+				{value:'open',label:"开盘价"},
+				{value:3,label:"最高价"},
+				{value:4,label:"最低价"},
+				{value:'close',label:"收盘价"},
+				{value:6,label:"结算价"},
+				{value:7,label:"成交量"},
+				{value:8,label:"成交额"},
+				{value:9,label:"涨跌幅"},
+				{value:10,label:"振幅"},
+				{value:11,label:"换手率"},
+				{value:12,label:"持仓量"},
+				{value:13,label:"持仓额"},
 			], // 常用的指标代码
 			databaseType:[
-				{value:1,label:'经济数据库'},
-				{value:2,label:'日期序列'}
+				{value:'0',label:'经济数据库'},
+				{value:'1',label:'日期序列'}
 			],
 			wsdAddStep:1,
 			fromCode,
@@ -279,7 +294,9 @@ export default {
 			]),
 			options:[],
 			unitList:[],
-			frequencyArr
+			frequencyArr,
+			checkFailShow:false,
+			existIndexList:[]
 		};
 	},
 	watch:{
@@ -294,7 +311,7 @@ export default {
 	methods: {
 		init() {
 			this.fromType = 'wind'
-			this.fromDatabase=1
+			this.fromDatabase='0'
 			this.wsdAddStep=1
 			this.status = ''
 			this.tableData = []
@@ -406,8 +423,8 @@ export default {
 			} else {
 				this.isCompanyCode = false;
 			}
-			if(this.fromDatabase==2){
-				this.changeDatabase(1)
+			if(this.fromDatabase=='1'){
+				this.changeDatabase('0')
 			}
 			this.search_txt = '';
 			this.search_company_txt = '';
@@ -439,8 +456,16 @@ export default {
 		codeInputBlur(type){
 			if(type == 'security'){
 				if(!this.securityCodeText) return  
-				this.securityCode=Array.from(new Set([...this.securityCode,...this.securityCodeText.split(',')]))
-
+				if(!(this.securityCode.length<5)){
+					this.$message.warning('证券代码一次最多输入5个')
+					this.securityCodeText=''
+					return
+				}
+				this.securityCode=Array.from(new Set([...this.securityCode,...this.securityCodeText.split(',')])).filter(Boolean)
+				if(this.securityCode.length>5){
+					this.securityCode = this.securityCode.slice(0,5)
+					this.$message.warning('证券代码一次最多输入5个')
+				}
 				this.securityCodeText=''
 			}else if(type == 'index'){
 				if(!this.indexCodeText) return  
@@ -493,9 +518,44 @@ export default {
 		wsdNextHandle(){
 			this.getMenu()
 			setTimeout(()=>{
-				console.log(this.securityCode,this.indexCode,this.indexCodeSelected,'wsdNextHandle');
+				console.log(this.securityCode,this.indexCode,this.indexCodeSelected,'wsdNextHandle',
+				[...this.securityCode,...this.indexCodeSelected].join(','));
+				// return
 				if(this.isCodeComplete){
-					this.wsdAddStep=2
+					let params={
+						Source:Number(this.fromCode.get(this.fromType)),
+						SubSource:this.fromDatabase,
+						EdbCode:this.indexCode.join(','),
+						StockCode:this.securityCode.join(',')
+					}
+					console.log(params,'params');
+					dataBaseInterface.edbExistCheck(params).then(res=>{
+						console.log(res);
+						if(res.Ret == 200){
+							if(res.Data.IndexExist){
+								console.log('重复');
+								this.existIndexList=[]
+								let ExistEdbCodeArr=['close','open']
+								let ExistStockCodeArr=['CU2403.SHF','FD78ES.FF']
+								let text=''
+								ExistStockCodeArr.map(item =>{
+									ExistEdbCodeArr.map(item1 =>{
+										let isCommon = this.indexCodeArr.find(it => it.value == item1)
+										if(isCommon){
+											text=`${item}${isCommon.label}(wsd${item}${isCommon.value})`
+										}else{
+											text=`${item}${item1}(wsd${item}${item1})`
+										}
+										this.existIndexList.push(text)
+									})
+								})
+								this.checkFailShow=true
+							}else{
+								// this.wsdAddStep=2
+								console.log('没有重复');
+							}
+						}
+					})
 				}
 			},50)
 		},
@@ -684,6 +744,15 @@ export default {
       border-left: 1px solid #dcdfe6;
     }
 	}
+	.check-fail-box{
+		padding: 0 0 15px 40px;	
+		color: #333333;
+		.check-fail-button{
+			margin-top: 80px;
+			display: flex;
+			justify-content: flex-end;
+		}
+	}
 }