Ver Fonte

Merge branch 'fix' into custom

Karsa há 6 meses atrás
pai
commit
41a6658459

+ 26 - 8
src/views/dataEntry_manage/databaseComponents/jointTargetDia.vue

@@ -54,6 +54,7 @@
 						:remote-method="query=>{searchHandle(query)}"
 						@click.native="inputFocusHandle"
 						@blur="search_have_more = false"
+						@change="chooseTarget(formData.pre_edb,'pre_edb')"
 					>
 						<i slot="prefix" class="el-input__icon el-icon-search"></i>
 						<el-option
@@ -75,7 +76,7 @@
 							</div>
 						</el-option>
 					</el-select>
-					<span v-if="formData.pre_edb">({{$t('Edb.Detail.e_start_time')}}:{{ searchOptions.find(item => item.EdbInfoId === formData.pre_edb) ? searchOptions.find(item => item.EdbInfoId === formData.pre_edb).StartDate : ''}})</span>
+					<span v-if="formData.pre_date">({{$t('Edb.Detail.e_start_time')}}:{{ formData.pre_date}})</span>
 				</el-form-item>
 				<el-form-item :label="$t('EtaBasePage.label_concat_date_after')" prop="after_edb">
 					<el-select
@@ -90,7 +91,7 @@
 							:remote-method="query=>{searchHandle(query)}"
 							@click.native="inputFocusHandle"
 							@blur="search_have_more = false"
-							@change="chooseTarget(formData.after_edb,'searchOptions')"
+							@change="chooseTarget(formData.after_edb,'after_edb')"
 						>
 							<i slot="prefix" class="el-input__icon el-icon-search"></i>
 							<el-option
@@ -112,7 +113,7 @@
 								</div>
 							</el-option>
 						</el-select>
-						<span v-if="formData.after_edb">({{$t('Edb.Detail.e_latest_date')}}:{{ searchOptions.find(item => item.EdbInfoId === formData.after_edb) ? searchOptions.find(item => item.EdbInfoId === formData.after_edb).EndDate : ''}})</span>
+						<span v-if="formData.after_date">({{$t('Edb.Detail.e_latest_date')}}:{{ formData.after_date }})</span>
 				</el-form-item>
 			</template>
 			<template v-else>
@@ -129,7 +130,7 @@
 						:remote-method="query=>{searchHandle(query,'month')}"
 						@click.native="e => {inputFocusHandle(e,'month')} "
 						@blur="search_have_more = false"
-						@change="chooseTarget(formData.old_stay_edb,'searchMonthOptions')"
+						@change="chooseTarget(formData.old_stay_edb,'old_stay_edb')"
 						>
 							<i slot="prefix" class="el-input__icon el-icon-search"></i>
 							<el-option
@@ -151,7 +152,7 @@
 								</div>
 							</el-option>
 						</el-select>
-					<span v-if="formData.old_stay_edb">({{$t('EtaBasePage.label_end_date')}}:{{searchMonthOptions.find(item => item.EdbInfoId === formData.old_stay_edb) ? searchMonthOptions.find(item => item.EdbInfoId === formData.old_stay_edb).EndDate : ''}})</span>
+					<span v-if="formData.old_stay_date">({{$t('EtaBasePage.label_end_date')}}:{{ formData.old_stay_date }})</span>
 				</el-form-item>
 				<el-form-item :label="$t('EtaBasePage.label_onyear_date')" prop="concat_edb">
 					<el-select
@@ -272,7 +273,7 @@ export default {
 
 				// this.searchHandle();
 				const backData = _.cloneDeep(this.params);
-				this.default_type = backData.source === 23||backData.source === 47 ? 1 : 2;
+				this.default_type = [23,47].includes(backData.source) ? 1 : 2;
 
 				this.formData = {
 					date: backData.date,
@@ -287,13 +288,16 @@ export default {
 				}
 
 				//options 回显
-				if(backData.source === 23||backData.source === 47) {
+				if([23,47].includes(backData.source)) {
 					this.searchOptions = backData.from_arr.map(item => ({
 						EdbInfoId: item.FromEdbInfoId,
 						EdbName: item.FromEdbName,
 						StartDate: item.StartDate,
 						EndDate: item.EndDate,
 					}))
+
+					this.formData.pre_date = backData.from_arr[0].StartDate
+					this.formData.after_date = backData.from_arr[0].EndDate
 				}else {
 					this.searchMonthOptions = backData.from_arr.filter(obj => obj.FromTag === 'A').map(item => ({
 						EdbInfoId: item.FromEdbInfoId,
@@ -301,6 +305,8 @@ export default {
 						StartDate: item.StartDate,
 						EndDate: item.EndDate,
 					}));
+					
+					this.formData.old_stay_date = backData.from_arr.find(obj => obj.FromTag === 'A').EndDate
 
 					this.searchMonthConcatOptions = backData.from_arr.filter(obj => obj.FromTag === 'B').map(item => ({
 						EdbInfoId: item.FromEdbInfoId,
@@ -376,8 +382,11 @@ export default {
 			formData: {
 				date: '',
 				pre_edb: '',
+				pre_date: '',
 				after_edb: '',
+				after_date: '',
 				old_stay_edb: '',
+				old_stay_date: '',
 				concat_edb: '',
 				edb_name: '',
 				menu: '',
@@ -449,13 +458,22 @@ export default {
 		// 选中指标更新默认值
 		chooseTarget(val,key){
 			if(!val) return
-			const arr=key==='searchMonthOptions'?this.searchMonthOptions:this.searchOptions
+			const arr=key==='old_stay_edb'?this.searchMonthOptions:this.searchOptions
+			
 			let obj = arr.find(item => item.EdbInfoId === val);
 			console.log(obj);
 			this.formData.edb_name=`${obj.EdbName}/拼接`
 			this.formData.menu=obj.ClassifyId||''
 			this.formData.frequency=obj.Frequency
 			this.formData.unit=obj.Unit
+
+			//日期也要常驻显示 加字段存了
+			const showDateMap = {
+				'old_stay_edb': { key:'old_stay_date',valKey:'EndDate' },
+				'after_edb': { key:'after_date',valKey:'EndDate' },
+				'pre_edb': { key:'pre_date',valKey:'StartDate' }
+			}
+			this.formData[showDateMap[key].key] = obj[showDateMap[key].valKey]
 		},
 
 		/* 搜索 */