Przeglądaj źródła

Merge branch 'ETA_1.0.5'

hbchen 1 rok temu
rodzic
commit
003dd63da0

+ 1 - 0
config/index.js

@@ -38,6 +38,7 @@ module.exports = {
     proxyTable:{
 		'/adminapi': {
       target: "http://8.136.199.33:7778",
+      // target: "http://192.168.20.49:8605",
 			// secure:false,  // 如果是https接口,需要配置这个参数
 			changeOrigin:true, // 如果接口跨域,需要进行这个参数配置
 			pathRewrite:{

BIN
src/assets/img/icons/question_mark_black.png


+ 130 - 5
src/views/dataEntry_manage/addChart.vue

@@ -102,6 +102,59 @@
 					</el-select>
 				</div>
 
+				<div class="xaxis-range-cont" v-if="chartInfo.ChartType===2 && tableData && tableData.length>0">
+					<!-- 仅用于季节性图配置 -->
+					<div style="margin-bottom: 12px;" class="xaxis-range-tip">
+						横坐标显示范围 
+						<el-tooltip>
+							<div slot="content">
+								<p class="hint-message">配置横坐标显示的时间刻度</p>
+								<p class="hint-message">1、若开始日期小于结束日期,则默认不跨年,允许勾选跨年</p>
+								<p class="hint-message">2、若开始日期大于等于结束日期,则跨年,不允许取消勾选</p>
+							</div>
+							<img src="~@/assets/img/icons/question_mark_black.png" style="height: 16px;cursor: pointer;margin-left: 6px;" />
+						</el-tooltip>
+					</div>
+					<el-date-picker
+						style="width: 45%;"
+						v-model="SeasonExtraConfig.XStartDate"
+						value-format="MM-dd"
+						popper-class="x-range-picker-date"
+						format="MM-dd"
+						placeholder="开始日期"
+						@change="xAxisChange"
+						:clearable="false"
+					></el-date-picker>
+					<el-date-picker
+						style="width: 45%;"
+						v-model="SeasonExtraConfig.XEndDate"
+						value-format="MM-dd"
+						popper-class="x-range-picker-date"
+						format="MM-dd"
+						placeholder="结束日期"
+						@change="xAxisChange"
+						:clearable="false"
+					></el-date-picker>
+					<!-- <el-date-picker
+						style="width: 90%;"
+						v-model="xAxisRange"
+						type="daterange"
+						value-format="MM-dd"
+						format="MM-dd"
+						popper-class="x-range-picker-date"
+						start-placeholder="开始日期"
+						end-placeholder="结束日期"
+						@change="xAxisRangeChange"
+						:clearable="false"
+						></el-date-picker> -->
+					<el-checkbox label="跨年" v-model="isSpanYear" :disabled="isSpanYearDisable"
+					style="margin-top: 12px;" @change="changeIsSpanYear"></el-checkbox>
+					<div class="legend-set-text" @click="openLegendEditDia">
+						<span>图例名称设置</span>
+						<img src="~@/assets/img/icons/edit-blue.png" />
+					</div>
+				</div>
+
 				<div class="targetset-cont">
 					<!-- 仅用于散点图配置 -->
 					<div class="scatter-setting" v-if="chartInfo.ChartType === 5 && tableData.length">
@@ -295,7 +348,7 @@
 							}}</el-button>
 						</template>
 						<!-- 季节性图选择年份区间 -->
-						<date-picker
+						<!-- <date-picker
 							v-else-if="chartInfo.ChartType === 2"
 							v-model="season_year"
 							type="month"
@@ -303,7 +356,10 @@
 							range
 							placeholder="年份日期选择"
 							@change="seasonYearChange"
-						/>
+						/> -->
+						<div v-else-if="chartInfo.ChartType === 2" @click="openDateDia" class="date-setting">
+							{{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+						</div>
 					</div>
 				</div>
 				<div class="cont-bottom">
@@ -477,8 +533,17 @@
     <DateChooseDia
       :isDateDia="isDateDia"
       :dateForm="dateForm"
+			:earliestDate="earliestDate"
       @cancel="isDateDia = false"
       @dateBack="dataChangeBack"
+    />
+
+		<!-- 季节性 图例设置 -->
+		<LegendEditDia
+      :isEditLegend="legendEditDiaShow"
+			:legendList="SeasonExtraConfig.ChartLegend"
+      @cancel="legendEditDiaShow = false"
+      @saveLegend="saveLegend"
     />
   </div>
 </template>
@@ -491,8 +556,9 @@ import Chart from './components/chart';
 import DateChooseDia from './components/DateChooseDia';
 import barOption from './components/barOptionSection.vue';
 import sectionalScatterOption from './components/sectionalScatterOption.vue';
+import LegendEditDia from './components/LegendEditDia.vue';
 export default {
-  components: { Chart,DateChooseDia,barOption,sectionalScatterOption },
+  components: { Chart,DateChooseDia,barOption,sectionalScatterOption,LegendEditDia},
 	directives: {
     drag(el, bindings) {
       el.onmousedown = function (e) {
@@ -534,6 +600,9 @@ export default {
 						this.setAddChartDefault();
 						this.setChartOptionHandle(newval);
 					}
+					
+					// 设置起始日期和最新日期
+					this.setExtremumDate()
 
 				}else {
 					this.chartInfo.ChartName = '';
@@ -569,12 +638,18 @@ export default {
 			this.$refs.diaForm.validate((valid) => {
 				if(valid) {
 					// 季节图只允许添加一个指标
-					if(this.chartInfo.ChartType === 2 && this.tableData.length > 1)  return this.$message.warning('您选择的图表样式为季节性图表,只支持单指标画图');
+					if(this.chartInfo.ChartType === 2 && this.tableData.length > 1) return this.$message.warning('您选择的图表样式为季节性图表,只支持单指标画图');
 
 					if(this.chartInfo.ChartType === 7 && !this.$refs.BarOptRef.dateList.length)  return this.$message.warning('请添加日期');
 
 					if(this.chartInfo.ChartType === 10 && !this.$refs.SectionScatterOptRef.seriesArr[0].edbs)  return this.$message.warning('请添加系列指标');
 
+					if(this.chartInfo.ChartType === 2){
+						if(!(this.SeasonExtraConfig.XStartDate && this.SeasonExtraConfig.XEndDate)){
+							return this.$message.warning('横坐标显示范围不能为空');
+						}
+					}
+					
 					let db_arr = this.tableData.map(item => ({
 							ChartColor: item.ChartColor,
 							PredictChartColor: item.PredictChartColor,
@@ -605,6 +680,7 @@ export default {
 						? {
 								...public_param,
 								DateType: this.year_select,
+								StartYear: this.count_year || 0,
 								StartDate:
 										[5,6].includes(this.year_select)
 											? this.select_date[0]
@@ -612,7 +688,7 @@ export default {
 								EndDate: this.year_select === 5 ? this.select_date[1] : '',
 							} 
 						: typePrams
-
+					// console.log(params);
 					dataBaseInterface.chartAdd(params).then(res => {
 						if(res.Ret !== 200) return;
 							this.setChartImage(res.Data);
@@ -736,6 +812,32 @@ export default {
 				color: #606266;
 				margin-top: 20px;
 			}
+			.xaxis-range-cont{
+				color: #606266;
+				margin-top: 20px;
+				.xaxis-range-tip{
+					display: flex;
+					align-items: center;
+					justify-content: flex-start;
+					.hint-message{
+						font-size: 15px;
+						line-height: 22px;
+					}
+				}
+				.legend-set-text{
+					font-size: 15px;
+					color: #1B7BDE;
+					display: flex;
+					align-items: center;
+					justify-content: flex-start;
+					margin-top: 20px;
+					cursor: pointer;
+					img{
+						height: 16px;
+						margin-left: 5px;
+					}
+				}
+			}
 			.targetset-cont {
 				padding: 30px 0 20px;
 				.el-input__inner {
@@ -826,6 +928,13 @@ export default {
 					.btn-sty {
 						border: 1px solid #409eff;
 					}
+					.date-setting{
+						border: 1px solid #DCDFE6;
+						border-radius: 4px;
+						cursor: pointer;
+						color: #333333;
+						line-height: 16px;
+					}
 				}
 				.top-right {
 					font-size: 16px;
@@ -960,6 +1069,12 @@ export default {
 			.year-btn,.btn-sty {
 				font-size: $font-normal;
 			}
+			.date-setting{
+				width: 210px;
+				height: 40px;
+				padding: 12px;
+				font-size: $font-normal;
+			}
 		}
 
 		@media screen and (max-width: 1710px){
@@ -979,6 +1094,12 @@ export default {
 				padding: 6px;
 				border: 1px solid #409eff;
 			}
+			.date-setting{
+				width: 180px;
+				height: 36px;
+				padding: 10px;
+				font-size: $font-small;
+			}
 		}
 	}
 }
@@ -987,4 +1108,8 @@ export default {
 .edb-item-style .el-input__icon {
 	line-height: 27px;
 }
+/*他不要下拉选择框 QAQ */
+.x-range-picker-date {
+	display: none;
+}
 </style>

+ 116 - 26
src/views/dataEntry_manage/chartSetting.vue

@@ -340,7 +340,7 @@
                 }}</el-button>
               </template>
               <!-- 季节性图选择年份区间 -->
-              <date-picker
+              <!-- <date-picker
                 v-else-if="chartInfo.ChartType === 2"
                 v-model="season_year"
                 type="month"
@@ -348,7 +348,10 @@
                 range
                 placeholder="年份日期选择"
                 @change="seasonYearChange"
-              />
+              /> -->
+              <div v-else-if="chartInfo.ChartType === 2" @click="openDateDia" class="date-setting">
+                {{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+              </div>
             </div>
           </div>
           <div class="cont-bottom">
@@ -673,6 +676,7 @@
     <DateChooseDia
       :isDateDia="isDateDia"
       :dateForm="dateForm"
+      :earliestDate="earliestDate"
       @cancel="isDateDia = false"
       @dateBack="dataChangeBack"
     />
@@ -1542,10 +1546,13 @@ export default {
       }
       if (res.Ret !== 200) return;
       this.chartInfo = res.Data.ChartInfo;
-      
-
+  
       this.tableData = res.Data.EdbInfoList;
+      // 设置起始日期和最新日期
+      this.setExtremumDate()
+
       this.setDefaultDateSelect(); //设置默认的日期选中
+      this.setDefaultPreviewOption(); //设置默认预览配置项
 
       sessionStorage.setItem('defaultArr',JSON.stringify(res.Data.EdbInfoList));
 
@@ -1566,31 +1573,72 @@ export default {
     setDefaultDateSelect() {
       this.year_select = this.chartInfo.DateType;
       this.select_date = [this.chartInfo.StartDate, this.chartInfo.EndDate];
+      this.count_year = this.chartInfo.StartYear;
       this.calendar_type = this.chartInfo.Calendar; //日历类型
-      this.season_year = [
-        this.chartInfo.SeasonStartDate,
-        this.chartInfo.SeasonEndDate,
-      ];
+      
+      if(this.chartInfo.ChartType==2){
+        if(this.year_select==20){
+          let latestYear = parseInt(this.tableData[0].LatestDate.substring(0,4))
+          this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
+        }else if(this.year_select==6){
+          this.season_year = [this.chartInfo.SeasonStartDate,this.tableData[0].LatestDate];
+        }else{
+          this.season_year = [this.chartInfo.SeasonStartDate,this.chartInfo.SeasonEndDate]
+        }
+      }
+
+
       this.dateTip =
         this.chartInfo.DateType === 5
           ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
           : this.chartInfo.DateType === 6
           ? `${this.chartInfo.StartDate}~至今`
-          : '请选择时间段';
+          : this.chartInfo.DateType === 20
+          ?`最近${this.chartInfo.StartYear}年`
+          :'请选择时间段';
+
+    },
+    // 设置默认预览配置项
+    setDefaultPreviewOption(){
+      if(this.chartInfo.ChartType==2){
+        if(this.chartInfo.SeasonExtraConfig){
+          this.SeasonExtraConfig = JSON.parse(this.chartInfo.SeasonExtraConfig)
+        }else{
+          // 返回空就是默认值
+          this.SeasonExtraConfig.XStartDate="01-01"
+          this.SeasonExtraConfig.XEndDate="12-31",
+          this.SeasonExtraConfig.JumpYear=0
+        }
+
+        // 从DataList中取 ChartLegend
+        this.SeasonExtraConfig.ChartLegend=[]
+        const chartDataHandle = this.calendar_type === "农历"?
+                            this.tableData[0].DataList.filter((item, index) => index > 0):
+                            this.tableData[0].DataList
+
+        chartDataHandle.map(item =>{
+          this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
+        })
+      }
     },
 
     /* 获取图表详情信息  type为refresh刷新指标不存储时间 */
     async getPreviewChartInfo(type) {
+      let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
+
       let params = {
         ChartType: this.chartInfo.ChartType,
         DateType: this.year_select,
-        StartDate: [5, 6].includes(this.year_select)
-          ? this.select_date[0]
+        StartDate: [5 , 6].includes(this.year_select)
+          ? dateArray[0]
           : '',
-        EndDate: this.year_select === 5 ? this.select_date[1] : '',
+        EndDate: this.year_select === 5 ? dateArray[1] : '',
         Calendar: this.calendar_type,
-        SeasonStartDate: this.season_year ? this.season_year[0] : '',
-        SeasonEndDate: this.season_year ? this.season_year[1] : '',
+        // ETA1.0.5 去除了这两个入参
+        // SeasonStartDate: this.season_year ? this.season_year[0] : '',
+        // SeasonEndDate: this.season_year ? this.season_year[1] : '',
+        SeasonExtraConfig:this.SeasonExtraConfig,
+        StartYear:this.count_year || 0,
         ChartEdbInfoList: this.tableData.map(_ => ({
           EdbInfoId: _.EdbInfoId,
           EdbInfoType: _.EdbInfoType,
@@ -1765,9 +1813,11 @@ export default {
           case 2:
             typeChartParam = {
               ...public_param,
+              DateType: this.year_select,
+              StartYear:this.count_year || 0,
               Calendar: this.calendar_type,
-              SeasonStartDate: this.season_year ? this.season_year[0] : '',
-              SeasonEndDate: this.season_year ? this.season_year[1] : '',
+              StartDate: this.season_year ? this.season_year[0] : '',
+              EndDate: this.season_year ? this.season_year[1] : '',
             }
             break
           case 7:
@@ -1796,6 +1846,7 @@ export default {
           ? {
               ...public_param,
               DateType: this.year_select,
+              StartYear:this.count_year || 0,
               StartDate:
                 this.year_select === 5 || this.year_select === 6
                   ? this.select_date[0]
@@ -1977,34 +2028,64 @@ export default {
       this.select_date = '';
       this.dateTip = '请选择时间段';
       //保存表格配置和上下限 曲线图需要保存表格配置 季节图就不用了
-      this.saveNowOptions();
+      // this.saveNowOptions();
       // 图表已存在
       this.selected_chartid && this.getPreviewChartInfo();
     },
     /* 打开时间段弹窗 */
     openDateDia() {
       // 自定义时间段回显
+			let selectDateStart = this.chartInfo.ChartType === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chartInfo.ChartType === 2?this.season_year[1]:this.select_date[1]
+
       this.dateForm = {
         date_type: this.year_select,
         start_date:
           this.year_select === 5 || this.year_select === 6
-            ? this.select_date[0]
+            ? selectDateStart
             : '',
-        end_date: this.year_select === 5 ? this.select_date[1] : '',
+        end_date: this.year_select === 5 ? selectDateEnd : '',
+        count_year: this.year_select === 20 ? this.count_year : ''
       };
       this.isDateDia = true;
     },
     /* 保存完自定义日期 刷新数据  保存当前的图表配置和上下限 只改变图表*/
     dataChangeBack(data) {
+      // console.log(data,'timeData');
       this.year_select = data.dateType;
       this.isDateDia = false;
       this.select_date = [data.start_date, data.end_date];
-      if (data.dateType === 5) {
-        this.dateTip = `${data.start_date}~${data.end_date}`;
-      } else {
-        this.dateTip = `${data.start_date}~至今`;
+      this.count_year = data.count_year
+
+      let dateStart = data.start_date
+			let dateEnd = data.end_date
+			let latestYear = parseInt(this.latestDate.substring(0,4))
+			if(data.dateType==20){
+				dateStart = `${latestYear-data.count_year+1}-01-01`
+				dateEnd = `${latestYear}-12-31`
+			}
+
+      if(this.chartInfo.ChartType === 2){
+        // 季节性图
+				if(data.dateType==6){
+					dateEnd = this.$moment(new Date()).format("YYYY-MM-DD")
+				}
+				this.season_year = [dateStart, dateEnd];
+				// 因为原本季节性图不支持 DateType为5和6的 所以季节性也将StartDate和EndDate传过去
+				this.select_date = [dateStart, dateEnd];
+      }else{
+				this.select_date = [dateStart, dateEnd];
+
+        if(data.dateType==20){
+          this.dateTip = `最近${data.count_year}年`
+        }else if (data.dateType === 5) {
+          this.dateTip = `${data.start_date}~${data.end_date}`;
+        } else {
+          this.dateTip = `${data.start_date}~至今`;
+        }
       }
-      this.saveNowOptions();
+
+      // this.saveNowOptions();
       this.getPreviewChartInfo();
     },
 
@@ -2159,7 +2240,7 @@ export default {
     },
     /* 季节图切换年份  保持当前配置 */
     seasonYearChange() {
-      this.saveNowOptions();
+      // this.saveNowOptions();
       this.getPreviewChartInfo();
     },
     /* 一键刷新 超长等待..*/
@@ -2613,7 +2694,6 @@ export default {
     padding-left: 50px;
     padding-right: 10px;
   }
-
   @media screen and (min-width: 1711px) {
     .el-icon-refresh {
       font-size: 17px;
@@ -2797,6 +2877,16 @@ export default {
                 padding: 10px;
                 border: 1px solid #409eff;
               }
+              .date-setting{
+                width: 210px;
+                height: 40px;
+                padding: 12px;
+                border: 1px solid #DCDFE6;
+                border-radius: 4px;
+                cursor: pointer;
+                font-size: 14px;
+                color: #333333;
+              }
             }
             .top-right {
               font-size: 16px;

+ 80 - 36
src/views/dataEntry_manage/components/DateChooseDia.vue

@@ -10,41 +10,44 @@
 		custom-class="dateDialog"
 		width="650px">
 			<div class="dialog-min">
-				<el-radio-group v-model="dateType" @change="changeType">
-					<el-radio :label="1" border>起始时间设置</el-radio>
+				<el-radio-group v-model="radioType" @change="changeType">
+					<el-radio :label="1" border>最近N年</el-radio>
 					<el-radio :label="2" border>区间设置</el-radio>
 				</el-radio-group>
 				<div class="date-cont">
-					<template v-if="dateType===2">
-						<date-picker
-							v-model="start_date"
-							type="month"
-							value-type="format"
-							placeholder="起始时间"
-						></date-picker>
-						<span style="margin:0 20px">至</span>
-						<date-picker
-							v-model="end_date"
-							type="month"
-							value-type="format"
-							placeholder="结束时间"
-						></date-picker>
+					<template v-if="radioType===1">
+						<span style="margin:0 20px;color: #000000;">年数</span>
+						<el-input v-model.number="count_year" placeholder="请输入数字"></el-input>
 					</template>
 					<template v-else>
-						<date-picker
+						<el-date-picker
+							v-show="dateType==1"
 							v-model="start_date"
-							type="month"
+							type="date"
+							value-type="format"
+							value-format="yyyy-MM-dd"
+							placeholder="选择日期"
+							:picker-options="pickerOptions"
+						></el-date-picker>
+						<el-date-picker
+							v-show="dateType==2"
+							v-model="dates"
+							type="daterange"
+							unlink-panels
 							value-type="format"
-							placeholder="起始时间"
-						></date-picker>
-						<span style="margin:0 20px">至</span>
-						<el-button type="text" style="font-size: 16px">至今</el-button>
+							value-format="yyyy-MM-dd"
+							start-placeholder="开始日期"
+							end-placeholder="结束日期"
+							:picker-options="pickerOptions"
+						></el-date-picker>
+						<el-checkbox label="至今" :checked="dateType == 1" @change="changeDateType"
+						style="margin-left: 18px;"></el-checkbox>
 					</template>
 				</div>
 			</div>
 			<div class="dia-bot">
-				<el-button type="primary" style="margin-right:20px" @click="saveHandle">保存</el-button>
-				<el-button type="primary" plain @click="cancelHandle">取消</el-button>
+				<el-button plain @click="cancelHandle" style="width: 120px;">取消</el-button>
+				<el-button type="primary" style="width: 120px;margin-left:30px" @click="saveHandle">保存</el-button>
 			</div>
 		</el-dialog>
 </template>
@@ -58,49 +61,90 @@ export default {
 		},
 		dialogTitle: {
 			type: String,
-			default:'设置默认时间'
+			default:'时间长度设置'
 		},
 		dateForm: {
 			type:Object
+		},
+		// 最早的日期,开始时间不得早于这个
+		earliestDate:{
+			type: String,
+			default:'0000-00-00'
 		}
 	},
 	watch: {
 		isDateDia(val) {
 			if(val) {
+				this.radioType = this.dateForm.date_type === 5 || this.dateForm.date_type === 6 ? 2 : 1;
 				this.dateType = this.dateForm.date_type === 5 ? 2 : 1;
 				this.start_date = this.dateForm.start_date;
 				this.end_date = this.dateForm.end_date;
+				this.dates = this.radioType == 2&&this.dateType==2?[this.start_date,this.end_date]:[]
+				this.count_year = this.dateForm.count_year
+			}
+		},
+		dates(value){
+			if(!value){
+				this.start_date = ''
+				this.end_date = ''
+				return 
+			}
+
+			if(value && value.length>0){
+				this.start_date = value[0]
+				this.end_date = value[1]
 			}
 		}
 	},
 	data () {
 		return {
-			dateType:1,
+			radioType:1,
+			dateType:2,
 			start_date: '',
 			end_date: '',
+			count_year:'',// 年数
+			dates:[],
+			pickerOptions:{
+				disabledDate:(date)=>{
+					return date < (new Date(`${this.earliestDate} 00:00:00`) || 0)
+				},
+			}
 		};
 	},
 	methods: {
 		/* 确认时间 返回回调 */
 		saveHandle() {
-			if(!this.start_date || (!this.end_date && this.dateType === 2)) {
+			if(this.radioType == 1 && (!parseInt(this.count_year))) {
+				this.$message.warning('请输入正确的数字')
+				return 
+			}
+			// console.log(this.radioType,this.dateType,this.start_date,this.end_date,this.dates,this.count_year);
+
+			if(this.radioType == 2 && (!this.start_date || (!this.end_date && this.dateType === 2))) {
 				this.$message.warning('请选择正确的时间段')
 			}else {
 				this.$emit('dateBack',{
-					dateType: this.dateType === 1 ? 6 : 5,
+					dateType: this.radioType==1?20:this.dateType === 1 ? 6 : 5,
 					start_date: this.start_date,
-					end_date: this.dateType === 1 ? '' : this.end_date
+					end_date: this.dateType === 1 ? '' : this.end_date,
+					count_year:this.count_year
 				})
 			}
 		},
 		changeType() {
-			this.start_date = '';
-			this.end_date = '';
+			this.dateType=1
+			this.dates=null
+			this.count_year = ''
+		},
+		changeDateType(check){
+			this.dateType=check?1:2
+			this.dates=null
 		},
 		cancelHandle() {
+			this.radioType = 1
 			this.dateType = 1;
-			this.start_date = '';
-			this.end_date = '';
+			this.dates=null
+			this.count_year = ''
 			this.$emit('cancel')
 		}
 	},
@@ -124,13 +168,13 @@ export default {
 		width: 220px !important;
 	}
 	.dialog-min {
-		padding: 10px 20px;
+		padding: 0 35px 60px;
 		.date-cont {
-			margin-top: 30px;
+			margin-top: 50px;
 		}
 	}
 	.dia-bot {
-		margin: 52px 0 30px;
+		margin: 60px 0 30px;
 		display: flex;
 		justify-content: center;
 	}

+ 97 - 0
src/views/dataEntry_manage/components/LegendEditDia.vue

@@ -0,0 +1,97 @@
+<template>
+  <el-dialog
+  :modal-append-to-body='false'
+  title="图例名称设置" 
+  :visible.sync="isEditLegend"
+  :close-on-click-modal="false"
+  @close="cancelHandle"
+  center
+  v-dialogDrag 
+  width="620px">
+    <div class="dialog-legend">
+      <div v-for="(item,index) in legendListCopy" :key="item.Name" class="legend-item">
+        <div class="legend-item-color" :style="{backgroundColor:seasonColor[index]}"></div>
+        <el-input v-model.trim="item.Value" placeholder="请输入图例名称" style="width: 295px;"></el-input>
+      </div>
+      <div class="legend-box-hint">默认取该曲线最新日期的数据年份作为图例名称,手动编辑为其他格式,则不再自动更新</div>
+    </div>
+    <div class="dia-bot">
+      <el-button plain @click="cancelHandle" style="width: 120px;">取消</el-button>
+      <el-button type="primary" style="width: 120px;margin-left:30px" @click="saveHandle">保存</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import {seasonOptions} from "@/utils/defaultOptions.js" 
+import _ from 'lodash';
+export default {
+name:'',
+props: {
+  isEditLegend: {
+    type: Boolean,
+    required:true
+  },
+  legendList:{
+    type: Array,
+    required:true
+  }
+},
+computed:{
+  seasonColor(){
+    return seasonOptions.colors.slice(-this.legendList.length)
+  }
+},
+data () {
+  return {
+    legendListCopy:[]
+  };
+},
+watch: {
+  isEditLegend(val) {
+    if(val) {
+      this.legendListCopy = _.cloneDeep(this.legendList)
+    }
+  }
+},
+methods: {
+  saveHandle() {
+    if(this.legendListCopy.some(item=> !item.Value)){
+      this.$message.error("所有图例名称都不能为空")
+      return
+    }
+    this.$emit('saveLegend',this.legendListCopy)
+  },
+  cancelHandle() {
+    this.$emit('cancel')
+  }
+}
+}
+</script>
+<style lang='scss' scoped>
+.dialog-legend{
+  padding: 10px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  .legend-item{
+    margin-bottom:8px ;
+    display: flex;
+    align-items: center;
+    .legend-item-color{
+      width: 30px;
+      height: 2px;
+      margin-right: 20px;
+    }
+  }
+  .legend-box-hint{
+    margin-top: 10px;
+    color: #C0C4CC;
+    font-size: 14px;
+    font-weight: 100;
+  }
+}
+.dia-bot{
+  margin: 30px 0;
+}
+</style>

+ 10 - 0
src/views/dataEntry_manage/css/chartfit.scss

@@ -175,6 +175,16 @@ $font-normal:14px;
 							padding: 6px;
 							border: 1px solid #409eff;
 						}
+						.date-setting{
+							width: 180px;
+							height: 36px;
+							padding: 10px;
+							border: 1px solid #DCDFE6;
+							border-radius: 4px;
+							cursor: pointer;
+							font-size: 12px;
+							color: #333333;
+						}
 					}
 					.top-right {
 						.join_txt {

+ 64 - 11
src/views/dataEntry_manage/databaseComponents/chartTrendRender.vue

@@ -21,7 +21,7 @@
 				</el-button>
 			</template>
 			<!-- 季节图时间选择 -->
-			<template v-else-if="chart_type===2">
+			<!-- <template v-else-if="chart_type===2">
 				<date-picker
 						v-model="season_year"
 						type="month"
@@ -30,7 +30,10 @@
 						placeholder="年份日期选择"
 						@change="getDataByPath"
 				/>
-			</template>
+			</template> -->
+			<div v-else-if="chart_type === 2" @click="openDateDia" class="date-setting">
+				{{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+			</div>
 			<el-button type="primary" plain size="mini" class="btn-sty" style="margin-left:auto;"
 				@click="chartTypeChange" v-if="!isOnlyShowBaseChart">
 				<i class="el-icon-sort" style="transform: rotate(90deg);"></i>
@@ -179,6 +182,8 @@ export default {
 				MinValue: 0,
 				MaxValue: 0
 			},
+			// 最近几年
+			count_year:'',
 		};
 	},
 	methods: {
@@ -197,6 +202,7 @@ export default {
 			let params = {
 				EdbInfoId: this.edbid,
 				DateType: this.year_select,
+				StartYear:this.count_year || 0,
 				StartDate: this.select_date[0] || '',
 				EndDate: this.select_date[1] || ''
 			}
@@ -205,7 +211,9 @@ export default {
 				? await dataBaseInterface.ebd_data(params)
 				: await dataBaseInterface.ebdSeasonData({
 						EdbInfoId: this.edbid,
+						DateType: this.year_select,
 						Calendar: this.calendar_type,
+						StartYear:this.count_year || 0,
 						StartDate: this.season_year[0] || '',
 						EndDate: this.season_year[1] || '',
 					})
@@ -219,6 +227,13 @@ export default {
 					} : EdbInfo;
 					this.tableData = DataList || [];
 
+
+					if(this.chart_type==2 && !(this.season_year && this.season_year.length>0)){
+						// 第一次进行初始化显示
+						let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+						this.season_year = [`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`];
+					}
+
 					this.chart_type === 1 ? this.setOptions() : this.setSeasonOptions();
 					this.showChart = true;
 					this.$nextTick(()=>{
@@ -250,6 +265,7 @@ export default {
 			let params = {
 				VarietyEdbId: this.edbid,
 				DateType: this.year_select,
+				StartYear:this.count_year || 0,
 				StartDate: this.select_date[0] || '',
 				EndDate: this.select_date[1] || ''
 			}
@@ -258,7 +274,9 @@ export default {
 				? await supplyApi.getEdbDetailData(params)
 				: await supplyApi.getEdbSeasonData({
 						VarietyEdbId: this.edbid,
+						DateType: this.year_select,
 						Calendar: this.calendar_type,
+						StartYear:this.count_year || 0,
 						StartDate: this.season_year[0] || '',
 						EndDate: this.season_year[1] || '',
 					})
@@ -271,7 +289,11 @@ export default {
 						...this.oldOptions
 					} : EdbInfo;
 					this.tableData = DataList || [];
-
+					if(this.chart_type==2 && !(this.season_year && this.season_year.length>0)){
+						// 第一次进行初始化显示
+						let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+						this.season_year = [`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`];
+					}
 					this.chart_type === 1 ? this.setOptions() : this.setSeasonOptions();
 					this.showChart = true;
 		},
@@ -293,13 +315,17 @@ export default {
 		/* 打开时间段弹窗 */
     openDateDia() {
       // 自定义时间段回显
+
+			let selectDateStart = this.chart_type === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chart_type === 2?this.season_year[1]:this.select_date[1]
       this.dateForm = {
         date_type: this.year_select,
         start_date:
           this.year_select === 5 || this.year_select === 6
-            ? this.select_date[0]
+            ? selectDateStart
             : '',
-        end_date: this.year_select === 5 ? this.select_date[1] : '',
+        end_date: this.year_select === 5 ? selectDateEnd : '',
+        count_year: this.year_select === 20 ? this.count_year : ''
       };
       this.isDateDia = true;
     },
@@ -309,12 +335,26 @@ export default {
       this.year_select = data.dateType;
       this.isDateDia = false;
       this.select_date = [data.start_date, data.end_date];
+      this.count_year = data.count_year
 
       this.dateTip =
         data.dateType === 5
           ? `${data.start_date}~${data.end_date}`
-          : `${data.start_date}~至今`;
-
+          : data.dateType === 6
+					?`${data.start_date}~至今`
+					:`最近${this.count_year}年`
+			if(this.chart_type === 2){
+				let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+				let dateStart = data.start_date
+				let dateEnd = data.end_date
+				if(data.dateType==20){
+					dateStart = `${latestYear-this.count_year+1}-01-01`
+					dateEnd = `${latestYear}-12-31`
+				}else if(data.dateType==6){
+					dateEnd = this.chartInfo.LatestDate
+				}
+				this.season_year = [dateStart, dateEnd];
+			}
 			const { MinValue,MaxValue } = this.chartInfo;
 			this.oldOptions = {
 				MinValue,
@@ -512,7 +552,7 @@ export default {
             yAxis: 0,
             name: j.Year,
           };
-          const data_array = _.cloneDeep(j.DataList);
+          const data_array = this.calendar_type === '农历'?_.cloneDeep(j.Items):_.cloneDeep(j.DataList);
           data_array &&
             data_array.forEach((item) => {
               serie_item.data.push([item.DataTimestamp, item.Value]);
@@ -645,8 +685,8 @@ export default {
             };
 
       this.options = {
-        colors:
-          this.calendar_type === '公历'
+				colors:
+				this.calendar_type === '公历'
             ? seasonOptions.colors.slice(-chartData.length)
             : seasonOptions.colors.slice(-filterArr.length),
         series: seasonData,
@@ -682,7 +722,9 @@ export default {
 		init(type='') {
 			if(type!=='no_reset') this.chart_type = 1;
 			this.isShowOnyearData = false;
-			this.year_select = 10;
+			this.year_select = this.chart_type==1 ? 10 : 20;
+			// 季节性图默认展示最近5年数据
+			this.count_year=5
 			this.select_date = [];
 			this.options = {};
 			this.dateTip = '请选择时间段';
@@ -733,6 +775,17 @@ export default {
 			background-color: #fff;
 			color: #0052D9;
 		}
+		.date-setting{
+			width: 210px;
+			// height: 40px;
+			padding: 10px;
+			border: 1px solid #DCDFE6;
+			border-radius: 4px;
+			cursor: pointer;
+			font-size: 14px;
+			color: #333333;
+			box-sizing: border-box;
+		}
 		.change-chart-btn{
 				float: right;
 				color: #409eff;

+ 67 - 13
src/views/dataEntry_manage/databaseComponents/createChart.vue

@@ -33,17 +33,19 @@
 				<el-button type="text" class="btn-sty" @click="showOnChart('toggle')" v-if="!isOnlyShowBaseChart">{{ isShowOnyearData ? '隐藏同比图' : '展示同比图'}}</el-button>
 			</template>
 			<!-- 季节图时间选择 -->
-			<template v-else-if="chart_type===2">
-				<date-picker
+			<!-- <template v-else-if="chart_type===2"> -->
+				<!-- <date-picker
 						v-model="season_year"
 						type="month"
 						value-type="format"
 						range
 						placeholder="年份日期选择"
 						@change="getDataByPath"
-				/>
-			</template>
-
+				/> -->
+			<!-- </template> -->
+			<div v-else-if="chart_type === 2" @click="openDateDia" class="date-setting">
+				{{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+			</div>
 			<span class="change-chart-btn" @click="chartTypeChange" v-if="!isOnlyShowBaseChart">切换{{chart_type==1?'季节性图':'曲线图'}}</span>
 		</div>
 		<div class="min-wrapper">
@@ -183,6 +185,8 @@ export default {
 				MinValue: 0,
 				MaxValue: 0
 			},
+			// 最近几年
+			count_year:'',
 		};
 	},
 	methods: {
@@ -201,6 +205,7 @@ export default {
 			let params = {
 				EdbInfoId: this.edbid,
 				DateType: this.year_select,
+				StartYear:this.count_year || 0,
 				StartDate: this.select_date[0] || '',
 				EndDate: this.select_date[1] || ''
 			}
@@ -209,7 +214,9 @@ export default {
 				? await dataBaseInterface.ebd_data(params)
 				: await dataBaseInterface.ebdSeasonData({
 						EdbInfoId: this.edbid,
+						DateType: this.year_select,
 						Calendar: this.calendar_type,
+						StartYear:this.count_year || 0,
 						StartDate: this.season_year[0] || '',
 						EndDate: this.season_year[1] || '',
 					})
@@ -222,7 +229,11 @@ export default {
 						...this.oldOptions
 					} : EdbInfo;
 					this.tableData = DataList || [];
-
+					if(this.chart_type==2 && !(this.season_year && this.season_year.length>0)){
+						// 第一次进行初始化显示
+						let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+						this.season_year = [`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`];
+					}
 					this.chart_type === 1 ? this.setOptions() : this.setSeasonOptions();
 					this.showChart = true;
 		},
@@ -232,6 +243,7 @@ export default {
 			let params = {
 				VarietyEdbId: this.edbid,
 				DateType: this.year_select,
+				StartYear:this.count_year || 0,
 				StartDate: this.select_date[0] || '',
 				EndDate: this.select_date[1] || ''
 			}
@@ -240,7 +252,9 @@ export default {
 				? await supplyApi.getEdbDetailData(params)
 				: await supplyApi.getEdbSeasonData({
 						VarietyEdbId: this.edbid,
+						DateType: this.year_select,
 						Calendar: this.calendar_type,
+						StartYear:this.count_year || 0,
 						StartDate: this.season_year[0] || '',
 						EndDate: this.season_year[1] || '',
 					})
@@ -254,6 +268,12 @@ export default {
 					} : EdbInfo;
 					this.tableData = DataList || [];
 
+					if(this.chart_type==2 && !(this.season_year && this.season_year.length>0)){
+						// 第一次进行初始化显示
+						let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+						this.season_year = [`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`];
+					}
+
 					this.chart_type === 1 ? this.setOptions() : this.setSeasonOptions();
 					this.showChart = true;
 		},
@@ -275,13 +295,17 @@ export default {
 		/* 打开时间段弹窗 */
     openDateDia() {
       // 自定义时间段回显
+
+			let selectDateStart = this.chart_type === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chart_type === 2?this.season_year[1]:this.select_date[1]
       this.dateForm = {
         date_type: this.year_select,
         start_date:
           this.year_select === 5 || this.year_select === 6
-            ? this.select_date[0]
+            ? selectDateStart
             : '',
-        end_date: this.year_select === 5 ? this.select_date[1] : '',
+        end_date: this.year_select === 5 ? selectDateEnd : '',
+        count_year: this.year_select === 20 ? this.count_year : ''
       };
       this.isDateDia = true;
     },
@@ -291,12 +315,26 @@ export default {
       this.year_select = data.dateType;
       this.isDateDia = false;
       this.select_date = [data.start_date, data.end_date];
+      this.count_year = data.count_year
 
       this.dateTip =
         data.dateType === 5
           ? `${data.start_date}~${data.end_date}`
-          : `${data.start_date}~至今`;
-
+          : data.dateType === 6
+					?`${data.start_date}~至今`
+					:`最近${this.count_year}年`
+			if(this.chart_type === 2){
+				let latestYear = parseInt(this.chartInfo.LatestDate.substring(0,4))
+				let dateStart = data.start_date
+				let dateEnd = data.end_date
+				if(data.dateType==20){
+					dateStart = `${latestYear-this.count_year+1}-01-01`
+					dateEnd = `${latestYear}-12-31`
+				}else if(data.dateType==6){
+					dateEnd = this.chartInfo.LatestDate
+				}
+				this.season_year = [dateStart, dateEnd];
+			}
 			const { MinValue,MaxValue } = this.chartInfo;
 			this.oldOptions = {
 				MinValue,
@@ -328,6 +366,7 @@ export default {
 
 			let params = {
 				DateType: this.year_select,
+				StartYear:this.count_year || 0,
 				StartDate: this.select_date[0] || '',
 				EndDate: this.select_date[1] || ''
 			}
@@ -481,6 +520,7 @@ export default {
 		setSeasonOptions() {
 			console.log(this.tableData)
       const chartData = _.cloneDeep(this.tableData);
+
       let seasonYdata = [],
         seasonData = [];
 
@@ -494,7 +534,7 @@ export default {
             yAxis: 0,
             name: j.Year,
           };
-          const data_array = _.cloneDeep(j.DataList);
+          const data_array = this.calendar_type === '农历'?_.cloneDeep(j.Items):_.cloneDeep(j.DataList);
           data_array &&
             data_array.forEach((item) => {
               serie_item.data.push([item.DataTimestamp, item.Value]);
@@ -628,7 +668,7 @@ export default {
 
       this.options = {
         colors:
-          this.calendar_type === '公历'
+				this.calendar_type === '公历'
             ? seasonOptions.colors.slice(-chartData.length)
             : seasonOptions.colors.slice(-filterArr.length),
         series: seasonData,
@@ -663,8 +703,11 @@ export default {
 
 		init(type='') {
 			if(type!=='no_reset') this.chart_type = 1;
+
 			this.isShowOnyearData = false;
-			this.year_select = 10;
+			this.year_select = this.chart_type==1 ? 10 : 20;
+			// 季节性图默认展示最近5年数据
+			this.count_year=5
 			this.select_date = [];
 			this.options = {};
 			this.dateTip = '请选择时间段';
@@ -744,6 +787,17 @@ export default {
 			padding: 10px;
 			border: 1px solid #409eff;
 		}
+		.date-setting{
+			width: 210px;
+			// height: 40px;
+			padding: 10px;
+			border: 1px solid #DCDFE6;
+			border-radius: 4px;
+			cursor: pointer;
+			font-size: 14px;
+			color: #333333;
+			box-sizing: border-box;
+		}
 		.change-chart-btn{
 				float: right;
 				color: #409eff;

+ 184 - 11
src/views/dataEntry_manage/editChart.vue

@@ -110,6 +110,60 @@
 						</el-option>
 					</el-select>
 				</div>
+
+				<div class="xaxis-range-cont" v-if="chartInfo.ChartType===2">
+					<!-- 仅用于季节性图配置 -->
+					<div style="margin-bottom: 12px;" class="xaxis-range-tip">
+						横坐标显示范围 
+						<el-tooltip>
+							<div slot="content">
+								<p class="hint-message">配置横坐标显示的时间刻度</p>
+								<p class="hint-message">1、若开始日期小于结束日期,则默认不跨年,允许勾选跨年</p>
+								<p class="hint-message">2、若开始日期大于等于结束日期,则跨年,不允许取消勾选</p>
+							</div>
+							<img src="~@/assets/img/icons/question_mark_black.png" style="height: 16px;cursor: pointer;margin-left: 6px;" />
+						</el-tooltip>
+					</div>
+					<el-date-picker
+						style="width: 45%;"
+						v-model="SeasonExtraConfig.XStartDate"
+						value-format="MM-dd"
+						popper-class="x-range-picker-date"
+						format="MM-dd"
+						placeholder="开始日期"
+						@change="xAxisChange"
+						:clearable="false"
+					></el-date-picker>
+					<el-date-picker
+						style="width: 45%;"
+						v-model="SeasonExtraConfig.XEndDate"
+						value-format="MM-dd"
+						popper-class="x-range-picker-date"
+						format="MM-dd"
+						placeholder="结束日期"
+						@change="xAxisChange"
+						:clearable="false"
+					></el-date-picker>
+					<!-- <el-date-picker
+						style="width: 90%;"
+						v-model="xAxisRange"
+						type="daterange"
+						value-format="MM-dd"
+						popper-class="x-range-picker-date"
+						format="MM-dd"
+						start-placeholder="开始日期"
+						end-placeholder="结束日期"
+						@change="xAxisRangeChange"
+						:clearable="false"
+					></el-date-picker> -->
+					<el-checkbox label="跨年" v-model="isSpanYear" :disabled="isSpanYearDisable"
+					style="margin-top: 12px;" @change="changeIsSpanYear"></el-checkbox>
+					<div class="legend-set-text" @click="openLegendEditDia">
+						<span>图例名称设置</span>
+						<img src="~@/assets/img/icons/edit-blue.png" />
+					</div>
+				</div>
+
 				<div class="targetset-cont">
 						<!-- 仅用于散点图配置提出 -->
 					<div class="scatter-setting" v-if="chartInfo.ChartType === 5 && tableData.length">
@@ -293,7 +347,7 @@
 							}}</el-button>
 						</template>
 						<!-- 季节性图选择年份区间 -->
-						<date-picker
+						<!-- <date-picker
 							v-else-if="chartInfo.ChartType === 2"
 							v-model="season_year"
 							type="month"
@@ -301,7 +355,11 @@
 							range
 							placeholder="年份日期选择"
 							@change="seasonYearChange"
-						/>
+						/> -->
+						<div v-else-if="chartInfo.ChartType === 2" style="padding: 10px 20px;border: 1px solid #eee;border-radius: 8px;cursor: pointer;"
+						@click="openDateDia">
+							{{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+						</div>
 					</div>
 				</div>
 				<div class="cont-bottom">
@@ -479,10 +537,19 @@
     <DateChooseDia
       :isDateDia="isDateDia"
       :dateForm="dateForm"
+			:earliestDate="earliestDate"
       @cancel="isDateDia = false"
       @dateBack="dataChangeBack"
     />
 
+		<!-- 季节性 图例设置 -->
+		<LegendEditDia
+      :isEditLegend="legendEditDiaShow"
+			:legendList="SeasonExtraConfig.ChartLegend"
+      @cancel="legendEditDiaShow = false"
+      @saveLegend="saveLegend"
+    />
+
 		<!-- 图表另存 -->
     <SaveChartOther 
       :show.sync="isShowSaveOther" 
@@ -501,8 +568,10 @@ import DateChooseDia from './components/DateChooseDia';
 import SaveChartOther from './components/SaveChartOther';
 import barOption from './components/barOptionSection.vue';
 import sectionalScatterOption from './components/sectionalScatterOption.vue';
+import LegendEditDia from './components/LegendEditDia.vue';
+
 export default {
-  components: { Chart,DateChooseDia,SaveChartOther,barOption,sectionalScatterOption },
+  components: { Chart,DateChooseDia,SaveChartOther,barOption,sectionalScatterOption,LegendEditDia },
 	directives: {
     drag(el, bindings) {
       el.onmousedown = function (e) {
@@ -540,6 +609,8 @@ export default {
 						this.setAddChartDefault();
 						newval.length && !this.chartInfo.WarnMsg && this.setChartOptionHandle(newval);
 					}
+					// 设置起始日期和最新日期
+					this.setExtremumDate()
 				}
       },
       deep: true,
@@ -578,8 +649,15 @@ export default {
 						Unit: BarChartInfo ? BarChartInfo.Unit : ''
 					};
           this.tableData = EdbInfoList;
-          this.setDefaultDateSelect(); //设置默认的日期选中
-					
+
+					this.calendar_type = this.chartInfo.Calendar; //日历类型
+					this.setDefaultPreviewOption() // 设置配置项
+
+					this.$nextTick(()=>{
+						this.setDefaultDateSelect(); //设置默认的日期选中
+					})
+
+
 					if(this.chartInfo.ChartType === 7) {
 						//特殊柱形图数据
 						this.initBarData(res.Data)
@@ -596,19 +674,58 @@ export default {
     setDefaultDateSelect() {
       this.year_select = this.chartInfo.DateType;
       this.select_date = [this.chartInfo.StartDate, this.chartInfo.EndDate];
-      this.calendar_type = this.chartInfo.Calendar; //日历类型
-      this.season_year = [
-        this.chartInfo.SeasonStartDate,
-        this.chartInfo.SeasonEndDate,
-      ];
+			this.count_year = this.chartInfo.StartYear;
+      // this.calendar_type = this.chartInfo.Calendar; //日历类型
+
+			if(this.chartInfo.ChartType==2){
+        if(this.year_select==20){
+          let latestYear = parseInt(this.tableData[0].LatestDate.substring(0,4))
+          this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
+        }else if(this.year_select==6){
+          this.season_year = [this.chartInfo.SeasonStartDate,this.tableData[0].LatestDate];
+        }else{
+          this.season_year = [this.chartInfo.SeasonStartDate,this.chartInfo.SeasonEndDate]
+        }
+      }
+
       this.dateTip =
         this.chartInfo.DateType === 5
           ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
           : this.chartInfo.DateType === 6
           ? `${this.chartInfo.StartDate}~至今`
-          : '请选择时间段';
+          : this.chartInfo.DateType === 20
+          ?`最近${this.chartInfo.StartYear}年`
+          :'请选择时间段';
+			
     },
+    // 设置配置项
+    setDefaultPreviewOption(){
+      if(this.chartInfo.ChartType==2){
+				this.count_year = this.chartInfo.StartYear
+				// if(!(this.chartInfo.SeasonEndDate && this.chartInfo.SeasonStartDate)){
+				// 	// 获取最近日期的年
+				// 	let latestYear = parseInt(this.latestDate.substring(0,4))
+				// 	this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
+				// }
+        if(this.chartInfo.SeasonExtraConfig){
+          this.SeasonExtraConfig = JSON.parse(this.chartInfo.SeasonExtraConfig)
+					// console.log(this.SeasonExtraConfig);
+					this.isSpanYear=!!this.SeasonExtraConfig.JumpYear
+					this.isSpanYearDisable=
+					!!(new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) > new Date(`2023-${this.SeasonExtraConfig.XEndDate}`) || 
+					new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) == new Date(`2023-${this.SeasonExtraConfig.XEndDate}`))
+        }
+				// 图例名称 需要在DataList中取,SeasonExtraConfig里面的可能是旧的
+				this.SeasonExtraConfig.ChartLegend=[]
+				const chartDataHandle = this.calendar_type === "农历"?
+														this.tableData[0].DataList.filter((item, index) => index > 0):
+														this.tableData[0].DataList
 
+				chartDataHandle.map(item =>{
+					this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
+				})
+      }
+    },
 		 /* 保存 */
 		saveHandle() {
 			if(!this.tableData.length) return this.$message.warning('暂未选择指标');
@@ -622,6 +739,11 @@ export default {
 
 					if(this.chartInfo.ChartType === 10 && !this.$refs.SectionScatterOptRef.seriesArr[0].edbs)  return this.$message.warning('请添加系列指标');
 
+					if(this.chartInfo.ChartType === 2){
+						if(!(this.SeasonExtraConfig.XStartDate && this.SeasonExtraConfig.XEndDate)){
+							return this.$message.warning('横坐标显示范围不能为空');
+						}
+					}
 					let db_arr = this.tableData.map(item => ({
 							ChartColor: item.ChartColor,
 							PredictChartColor: item.PredictChartColor,
@@ -653,6 +775,7 @@ export default {
 					? {
 							...public_param,
 							DateType: this.year_select,
+							StartYear: this.count_year || 0,
 							StartDate:
 									[5,6].includes(this.year_select)
 										? this.select_date[0]
@@ -767,6 +890,32 @@ export default {
 				color: #606266;
 				margin-top: 10px;
 			}
+			.xaxis-range-cont{
+				color: #606266;
+				margin-top: 20px;
+				.xaxis-range-tip{
+					display: flex;
+					align-items: center;
+					justify-content: flex-start;
+					.hint-message{
+						font-size: 15px;
+						line-height: 22px;
+					}
+				}
+				.legend-set-text{
+					font-size: 15px;
+					color: #1B7BDE;
+					display: flex;
+					align-items: center;
+					justify-content: flex-start;
+					margin-top: 20px;
+					cursor: pointer;
+					img{
+						height: 16px;
+						margin-left: 5px;
+					}
+				}
+			}
 			.targetset-cont {
 				padding: 30px 0 20px;
 				.el-input__inner {
@@ -856,6 +1005,13 @@ export default {
 					.btn-sty {
 						border: 1px solid #409eff;
 					}
+					.date-setting{
+						border: 1px solid #DCDFE6;
+						border-radius: 4px;
+						cursor: pointer;
+						color: #333333;
+						line-height: 16px;
+					}
 				}
 				.top-right {
 					font-size: 16px;
@@ -990,6 +1146,12 @@ export default {
 			.year-btn,.btn-sty {
 				font-size: $font-normal;
 			}
+			.date-setting{
+				width: 210px;
+				height: 40px;
+				padding: 12px;
+				font-size: $font-normal;
+			}
 		}
 
 		@media screen and (max-width: 1710px){
@@ -1009,6 +1171,12 @@ export default {
 				padding: 6px;
 				border: 1px solid #409eff;
 			}
+			.date-setting{
+				width: 180px;
+				height: 36px;
+				padding: 10px;
+				font-size: $font-small;
+			}
 		}
 	}
 }
@@ -1017,4 +1185,9 @@ export default {
 .edb-item-style .el-input__icon {
 	line-height: 27px;
 }
+
+/*他不要下拉选择框 QAQ */
+.x-range-picker-date {
+	display: none;
+}
 </style>

+ 210 - 37
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -52,6 +52,19 @@ export default {
 			search_have_more: true,
 			search_page: 1,
 			current_search:'',
+			// 季节性图和额外配置
+			SeasonExtraConfig:{
+				ChartLegend:[], // 图例名称数组
+				XStartDate:"01-01", // 横坐标显示范围 - 开始
+				XEndDate:"12-31", // 横坐标显示范围-结束
+				JumpYear:0, //是否跨年
+			},
+			// 横坐标显示范围回显 - 季节性图
+			// xAxisRange:["01-01","12-31"],
+			// 是否跨过一年
+			isSpanYear:false,
+			isSpanYearDisable:false,
+			legendEditDiaShow:false,
 		}
 	},
 	computed: {
@@ -131,31 +144,50 @@ export default {
 
 			/* 正常图获取指标数据 柱形图不获取 */
 			if(this.chartInfo.ChartType !== 7) {
-				let params = this.sameOptionType.includes(this.chartInfo.ChartType) 
-					? {
-						EdbInfoId: item.EdbInfoId,
-						ChartType: this.chartInfo.ChartType,
-						DateType: this.year_select,
-						StartDate:
-							this.year_select === 5 || this.year_select === 6
-								? this.select_date[0]
-								: '',
-						EndDate: this.year_select === 5 ? this.select_date[1] : '',
-					} 
-					: {
-						EdbInfoId: item.EdbInfoId,
-						ChartType: this.chartInfo.ChartType,
-						Calendar: this.calendar_type,
-						SeasonStartDate: this.season_year ? this.season_year[0] : '',
-						SeasonEndDate: this.season_year ? this.season_year[1] : '',
-					};
+				// let params = this.sameOptionType.includes(this.chartInfo.ChartType) 
+				// 	? {
+				// 		EdbInfoId: item.EdbInfoId,
+				// 		ChartType: this.chartInfo.ChartType,
+				// 		DateType: this.year_select,
+				// 		StartDate:
+				// 			this.year_select === 5 || this.year_select === 6
+				// 				? this.select_date[0]
+				// 				: '',
+				// 		EndDate: this.year_select === 5 ? this.select_date[1] : '',
+				// 	} 
+				// 	: {
+				// 		EdbInfoId: item.EdbInfoId,
+				// 		ChartType: this.chartInfo.ChartType,
+				// 		Calendar: this.calendar_type,
+				// 		SeasonStartDate: '',
+				// 		SeasonEndDate: '',
+				// 	};
+				let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
+
+				let params = {
+					EdbInfoId: item.EdbInfoId,
+					ChartType: this.chartInfo.ChartType,
+					Calendar: this.chartInfo.ChartType===2?this.calendar_type:undefined,
+					DateType: this.year_select,
+					StartYear:this.count_year,
+					StartDate:
+						this.year_select === 5 || this.year_select === 6
+							? dateArray[0]
+							: '',
+					EndDate: this.year_select === 5 ? dateArray[1] : '',
+				} 
 				dataBaseInterface.chartInfo(params).then((res) => {
 					if(res.Ret !== 200) return;
 						let [ tableItem ] = res.Data.EdbInfoList;
-	
 						// 同一指标切换图表类型
 						if(type) {
 							this.tableData = [ tableItem ];
+
+							this.$nextTick(()=>{
+								// 等待 tableData的 监听里面的获取到 起始时间和最近日期
+								this.setChartDefault()
+							})
+
 							return
 						};
 						//检查添加指标是否已存在
@@ -167,7 +199,13 @@ export default {
 							else if(this.chartInfo.ChartType === 5 && this.tableData.length >= 2) return this.$message.warning('您选择的图表样式为散点图,最多支持2个指标')
 							this.tableData.push(tableItem);
 							this.isSetExtremeValue = true;
-							console.log(this.tableData)
+							// console.log(this.tableData)
+
+							this.$nextTick(()=>{
+								// 等待 tableData的 监听里面的获取到 起始时间和最近日期
+								this.setChartDefault()
+							})
+
 						}else {
 							this.$message.warning('录入指标已存在');
 						}
@@ -231,16 +269,20 @@ export default {
 
 		/* 曲线图切换筛选项时请求数据 */
 		async getPreviewSplineInfo() {
+			let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
 			let params = {
         ChartType: this.chartInfo.ChartType,
         DateType: this.year_select,
-        StartDate: [5, 6].includes(this.year_select)
-          ? this.select_date[0]
+        StartDate: [5 , 6].includes(this.year_select)
+          ? dateArray[0]
           : '',
-        EndDate: this.year_select === 5 ? this.select_date[1] : '',
+        EndDate: this.year_select === 5 ? dateArray[1]: '',
         Calendar: this.calendar_type,
-        SeasonStartDate: this.season_year ? this.season_year[0] : '',
-        SeasonEndDate: this.season_year ? this.season_year[1] : '',
+				StartYear:this.count_year || 0,
+				// ETA1.0.5 去除了这两个入参
+        // SeasonStartDate: this.season_year ? this.season_year[0] : '',
+        // SeasonEndDate: this.season_year ? this.season_year[1] : '',
+				SeasonExtraConfig:this.SeasonExtraConfig,
         ChartEdbInfoList: this.tableData.map(_ => ({
           EdbInfoId: _.EdbInfoId,
           EdbInfoType: _.EdbInfoType,
@@ -255,6 +297,18 @@ export default {
 
       const { EdbInfoList } = res.Data;
 
+			if(this.chartInfo.ChartType == 2){
+				const chartDataHandle = this.calendar_type === "农历"?
+															EdbInfoList[0].DataList.filter((item, index) => index > 0):
+															EdbInfoList[0].DataList
+
+				// 季节性图例回显
+				this.SeasonExtraConfig.ChartLegend = []
+				chartDataHandle.map(item =>{
+					this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
+				})
+			}
+
       this.tableData.forEach((item) => {
         let edbData = EdbInfoList.find(_ => _.EdbInfoId===item.EdbInfoId);
         item.DataList = edbData.DataList;
@@ -274,13 +328,17 @@ export default {
 		/* 打开时间段弹窗 */
 		openDateDia() {
 			// 自定义时间段回显
+			let selectDateStart = this.chartInfo.ChartType === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chartInfo.ChartType === 2?this.season_year[1]:this.select_date[1]
+
 			this.dateForm = {
 				date_type: this.year_select,
 				start_date:
 					this.year_select === 5 || this.year_select === 6
-						? this.select_date[0]
+						? selectDateStart
 						: '',
-				end_date: this.year_select === 5 ? this.select_date[1] : '',
+				end_date: this.year_select === 5 ? selectDateEnd : '',
+				count_year: this.year_select === 20 ? this.count_year : ''
 			};
 			this.isDateDia = true;
 		},
@@ -288,23 +346,46 @@ export default {
 		dataChangeBack(data) {
 			this.year_select = data.dateType;
 			this.isDateDia = false;
-			this.select_date = [data.start_date, data.end_date];
-			if (data.dateType === 5) {
+      this.count_year = data.count_year
+
+			let dateStart = data.start_date
+			let dateEnd = data.end_date
+			let latestYear = parseInt(this.latestDate.substring(0,4))
+			if(data.dateType==20){
+				dateStart = `${latestYear-data.count_year+1}-01-01`
+				dateEnd = `${latestYear}-12-31`
+			}
+
+			if(this.chartInfo.ChartType === 2){
+				if(data.dateType==6){
+					// 回显
+					dateEnd = this.$moment(new Date()).format("YYYY-MM-DD")
+				}
+			}
+
+			this.season_year = [dateStart, dateEnd];
+			// 因为原本季节性图不支持 DateType为5和6的 所以季节性也将StartDate和EndDate传过去
+			this.select_date = [dateStart, dateEnd];
+
+			if(data.dateType==20){
+				this.dateTip = `最近${data.count_year}年`
+			}else if (data.dateType === 5) {
 				this.dateTip = `${data.start_date}~${data.end_date}`;
 			} else {
 				this.dateTip = `${data.start_date}~至今`;
 			}
+
 			this.getPreviewSplineInfo();
 		},
 
 			/* 季节图切换年份  保持当前配置 */
-		seasonYearChange() {
-			this.getPreviewSplineInfo();
-		},
+		// seasonYearChange() {
+		// 	this.getPreviewSplineInfo();
+		// },
 
 		/* 切换图重置状态 */
 		initStatus() {
-			this.year_select = 3;
+			this.year_select = this.chartInfo.ChartType === 2?20:3;
 			this.select_date = '';
 			this.isSetExtremeValue = true;
 			this.calendar_type = '公历';
@@ -314,6 +395,11 @@ export default {
 			this.barDateList = [];
       this.chartLimit = {};
       this.sectionScatterData = {};
+
+			this.$nextTick(()=>{
+				// 等待 tableData的 监听里面的获取到 起始时间和最近日期
+				this.setChartDefault()
+			})
 		},
 
 		/* 添加指标时 配置默认颜色 线条等 */
@@ -464,8 +550,11 @@ export default {
 					return {
 						...public_param,
 						Calendar: this.calendar_type,
-						SeasonStartDate: this.season_year ? this.season_year[0] : '',
-						SeasonEndDate: this.season_year ? this.season_year[1] : '',
+						DateType: this.year_select,
+						StartYear: this.count_year || 0,
+						StartDate: this.season_year ? this.season_year[0] : '',
+						EndDate: this.season_year ? this.season_year[1] : '',
+						SeasonExtraConfig:this.SeasonExtraConfig
 					}
 				case 7:
 					return {
@@ -496,8 +585,6 @@ export default {
 						StartDate: "",
 						EndDate: "",
 						Calendar: "公历",
-						SeasonStartDate: "",
-						SeasonEndDate: "",
 						ExtraConfig: JSON.stringify({
 							XName: this.$refs.SectionScatterOptRef.seriesArr[0].x_title,
 							YName: this.$refs.SectionScatterOptRef.seriesArr[0].y_title,
@@ -542,6 +629,92 @@ export default {
 			if(!this.options.series) return
 
 			this.options.yAxis[0].title.text = val;
+		},
+		// 设置图表的默认值
+		setChartDefault(){
+			// console.log(this.latestDate,this.earliestDate,'earliestDate');
+			if(!(this.tableData && this.tableData.length>0)) return 
+			if(this.chartInfo.ChartType === 2){
+				// 季节性图默认选择最近5年
+				this.year_select = 20
+				this.count_year = 5	
+				// 获取最近日期的年
+				let latestYear = parseInt(this.latestDate.substring(0,4))
+
+				this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
+				// this.xAxisRange = ['01-01','12-31']
+				this.SeasonExtraConfig.XStartDate = '01-01'
+				this.SeasonExtraConfig.XEndDate = '12-31'
+				this.isSpanYear=false
+				this.isSpanYearDisable=false
+				this.SeasonExtraConfig.ChartLegend=[]
+
+				const chartDataHandle = this.calendar_type === "农历"?
+														this.tableData[0].DataList.filter((item, index) => index > 0):
+														this.tableData[0].DataList
+				chartDataHandle.map(item =>{
+					this.SeasonExtraConfig.ChartLegend.push({Name:item.Years,Value:item.ChartLegend})
+				})
+			}
+		},
+		// 横轴显示范围改变
+		// xAxisRangeChange(date){
+		// 	console.log(date);
+		// 	if(date && date.length>0){
+		// 		// console.log(date[0],date[1]);
+		// 		let xStartDate = date[0]
+		// 		let xEndDate = date[1]
+		// 		if(new Date(`2023-${xStartDate}`) > new Date(`2023-${xEndDate}`) || 
+		// 		new Date(`2023-${xStartDate}`) == new Date(`2023-${xEndDate}`)){
+		// 			// 开始日期 >= 结束日期 跨年
+		// 			this.isSpanYear=true
+		// 			this.isSpanYearDisable=true
+		// 		}else{
+		// 			this.isSpanYearDisable=false
+		// 		}
+		// 		// this.xAxisRange = [xStartDate,xEndDate]
+		// 		this.SeasonExtraConfig.XStartDate = xStartDate
+		// 		this.SeasonExtraConfig.XEndDate = xEndDate
+		// 		this.SeasonExtraConfig.JumpYear = this.isSpanYear?1:0
+		// 		this.getPreviewSplineInfo()
+		// 	}else{
+		// 		this.isSpanYearDisable=false
+		// 	}
+		// },
+		// 横轴显示范围改变
+		xAxisChange(date){
+			if(this.SeasonExtraConfig.XStartDate && this.SeasonExtraConfig.XEndDate){
+				if(new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) > new Date(`2023-${this.SeasonExtraConfig.XEndDate}`) || 
+				new Date(`2023-${this.SeasonExtraConfig.XStartDate}`) == new Date(`2023-${this.SeasonExtraConfig.XEndDate}`)){
+					// 开始日期 >= 结束日期 跨年
+					this.isSpanYear=true
+					this.isSpanYearDisable=true
+				}else{
+					this.isSpanYearDisable=false
+				}
+				this.SeasonExtraConfig.JumpYear = this.isSpanYear?1:0
+				//修改横轴的时候,请求入参里的图例名称需要清空一下
+				this.SeasonExtraConfig.ChartLegend=[]
+				this.getPreviewSplineInfo()
+			}else{
+				this.isSpanYearDisable=false
+			}
+		},
+		changeIsSpanYear(value){
+			this.SeasonExtraConfig.JumpYear = value?1:0
+			this.getPreviewSplineInfo()
+		},
+		// 打开图例编辑窗口
+		openLegendEditDia(){
+			this.legendEditDiaShow=true
+		},
+		// 图例编辑接口保存
+		saveLegend(copyList){
+			if(copyList && copyList.length>0){
+				this.SeasonExtraConfig.ChartLegend = copyList
+				this.getPreviewSplineInfo()
+				this.legendEditDiaShow=false
+			}
 		}
 	}
 }

+ 100 - 65
src/views/dataEntry_manage/mixins/chartPublic.js

@@ -40,11 +40,20 @@ const basicYAxis = {
 export const chartSetMixin = {
 	data() {
 		return {
-			year_select: yearSelector[0].value, //默认区间15年至今
+      /**
+       * 默认区间15年至今 值等于 5、6、20 是自定义时间段
+       * 20代表最近几年 季节性图默认 最近5年
+       * 6代表至今 只需要选择开始日期
+       * 5代表范围 需要选择开始日期和结束日期
+       */
+			year_select: yearSelector[0].value,
       sameOptionType:[1,3,4,5,6],// 头部一样 配置一样的图表类型 曲线 散点 柱状 面积 组合
       yearSelector, //年份按钮组
       select_date: '', //自定义时间段
+      count_year: 0, //最近年数
       isDateDia: false, // 时间段弹窗
+      earliestDate:'', // 最早的日期 - 起始日期
+      latestDate:'', //最晚日期 - 最新日期
       dateForm: {},
       dateTip: '请选择时间段',
       predefineColors: defaultOpts.colors.slice(0, 2), //定义颜色蓝,红 默认颜色
@@ -157,7 +166,14 @@ export const chartSetMixin = {
       },
 
       /* 统计频率图 */
-      statisticFrequencyData: {}
+      statisticFrequencyData: {},
+      // 季节性图和额外配置 这里为了预览
+			SeasonExtraConfig:{
+				ChartLegend:[], // 图例名称数组
+				XStartDate:"01-01", // 横坐标显示范围 - 开始
+				XEndDate:"12-31", // 横坐标显示范围-结束
+				JumpYear:0, //是否跨年
+			},
 		}
 	},
   watch: {
@@ -739,12 +755,21 @@ export const chartSetMixin = {
       this.rightIndex = -1;
       this.rightTwoIndex = -1;
       const chartData = newval[0];
+      // 农历数据需要去除第一项  农历和公历处理逻辑一样
+      /**
+       * isPredictorChart - 预测指标的chartInfo.vue组件内定义的变量
+       * 预测指标成图 还是之前农历图的逻辑,有空再拆吧,做个兼容
+      */
+      const chartDataHandle=this.calendar_type === '农历'?
+                            this.isPredictorChart?chartData.DataList.List.filter((item, index) => index > 0):
+                            chartData.DataList.filter((item, index) => index > 0):
+                            chartData.DataList
+
       let seasonYdata = [],
         seasonData = [];
-
         /* 公历数据处理 处理数据列 y轴 */
-        if (this.calendar_type === '公历')
-        for (let j of chartData.DataList) {
+        // if (this.calendar_type === '公历')
+        for (let j of chartDataHandle) {
           //预测指标配置
           let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
           
@@ -752,16 +777,16 @@ export const chartSetMixin = {
             data: [],
             type: chartData.ChartStyle,
             yAxis: 0,
-            name: j.Year,
+            name: this.isPredictorChart?j.Year:j.ChartLegend,
             ...predict_params
           };
-          const data_array = _.cloneDeep(j.DataList);
+          const data_array = this.calendar_type === '农历' && this.isPredictorChart?_.cloneDeep(j.Items):_.cloneDeep(j.DataList);
           data_array &&
             data_array.forEach((item) => {
               serie_item.data.push([item.DataTimestamp, item.Value]);
             });
-          const index = chartData.DataList.findIndex(
-            (item) => item.Year === j.Year
+          const index = chartDataHandle.findIndex(
+            (item) => this.isPredictorChart?item.Year === j.Year:item.ChartLegend === j.ChartLegend
           );
           const s_yItem = {
             labels: {
@@ -792,57 +817,56 @@ export const chartSetMixin = {
           seasonYdata.push(s_yItem);
         }
 
-      /* 农历数据处理  */
-      let filterArr =
-        this.calendar_type === '农历'
-          ? chartData.DataList.List.filter((item, index) => index > 0)
-          : [];
-      if (this.calendar_type === '农历')
-        for (let j of filterArr) {
-           //预测指标配置
-          let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
-
-          let serie_item = {
-            data: [],
-            type: chartData.ChartStyle,
-            yAxis: 0,
-            name: j.Year,
-            ...predict_params
-          };
-          const data_array = _.cloneDeep(j.Items);
-          data_array &&
-            data_array.forEach((item) => {
-              serie_item.data.push([item.DataTimestamp, item.Value]);
-            });
-          const index = filterArr.findIndex((item) => item.Year === j.Year);
-          const s_yItem = {
-            labels: {
-              formatter: function () {
-                let val = this.value;
-                return index !== 0 ? '' : val;
-              },
-              align: 'center',
-            },
-            title: {
-              text:  `${chartData.Unit}`,
-              textCh:chartData.Unit, // 中文
-              // 中文不存在,无论英文有无都显示空
-              textEn:chartData.UnitEn||chartData.Unit, // 英文
-              styleEn:{}, // 英文样式
-              // text:  null,
-              align: 'high',
-              rotation: 0,
-              y: -15,
-              offset: -(12 * chartData.Unit.length),
-            },
-            max: Number(chartData.MaxData),
-            min: Number(chartData.MinData),
-            ...seasonOptions.yAxis,
-          };
-          seasonData.push(serie_item);
-          seasonYdata.push(s_yItem);
-        }
-
+      // /* 农历数据处理  */
+      // let filterArr =
+      //   this.calendar_type === '农历'
+      //     ? chartData.DataList.filter((item, index) => index > 0)
+      //     : [];
+      // if (this.calendar_type === '农历')
+      //   for (let j of filterArr) {
+      //      //预测指标配置
+      //     let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
+
+      //     let serie_item = {
+      //       data: [],
+      //       type: chartData.ChartStyle,
+      //       yAxis: 0,
+      //       name: j.ChartLegend,
+      //       ...predict_params
+      //     };
+      //     const data_array = _.cloneDeep(j.DataList);
+      //     data_array &&
+      //       data_array.forEach((item) => {
+      //         serie_item.data.push([item.DataTimestamp, item.Value]);
+      //       });
+      //     const index = filterArr.findIndex((item) => item.ChartLegend === j.ChartLegend);
+      //     const s_yItem = {
+      //       labels: {
+      //         formatter: function () {
+      //           let val = this.value;
+      //           return index !== 0 ? '' : val;
+      //         },
+      //         align: 'center',
+      //       },
+      //       title: {
+      //         text:  `${chartData.Unit}`,
+      //         textCh:chartData.Unit, // 中文
+      //         // 中文不存在,无论英文有无都显示空
+      //         textEn:chartData.UnitEn||chartData.Unit, // 英文
+      //         styleEn:{}, // 英文样式
+      //         // text:  null,
+      //         align: 'high',
+      //         rotation: 0,
+      //         y: -15,
+      //         offset: -(12 * chartData.Unit.length),
+      //       },
+      //       max: Number(chartData.MaxData),
+      //       min: Number(chartData.MinData),
+      //       ...seasonOptions.yAxis,
+      //     };
+      //     seasonData.push(serie_item);
+      //     seasonYdata.push(s_yItem);
+      //   }
       /* x轴显示月日  提示框显示月日*/
       defaultOpts.xAxis.labels = {
         formatter: function () {
@@ -862,7 +886,7 @@ export const chartSetMixin = {
         xDateFormat: '%m/%d',
       }
       let rangeSelector =
-        this.calendar_type === '农历'
+        this.calendar_type === '农历' && this.isPredictorChart
           ? {
               enabled: true,
               selected: 0,
@@ -900,10 +924,7 @@ export const chartSetMixin = {
             };
 
       this.options = {
-        colors:
-          this.calendar_type === '公历'
-            ? seasonOptions.colors.slice(-chartData.DataList.length)
-            : seasonOptions.colors.slice(-filterArr.length),
+        colors:seasonOptions.colors.slice(-chartDataHandle.length),
         series: seasonData,
         yAxis: seasonYdata,
         rangeSelector,
@@ -2040,6 +2061,20 @@ export const chartSetMixin = {
       }else {
         sourceMap[this.chartInfo.Source]();
       }
+    },
+    // 设置 起始日期 和 最新日期
+    setExtremumDate(){
+      //过滤、排序 拿到起始日期
+      let startDateList = this.tableData.map(it => it.StartDate)
+                                        .filter(Boolean)
+                                        .sort((a,b)=> new Date(a).getTime() - new Date(b).getTime())
+      this.earliestDate = startDateList[0]
+      //过滤、排序 拿到最新日期
+      let endDateList = this.tableData.map(it => it.LatestDate)
+                                      .filter(Boolean)
+                                      .sort((a,b)=> new Date(b).getTime() - new Date(a).getTime())
+      this.latestDate = endDateList[0]
+      console.log(this.earliestDate,this.latestDate,'this.latestDate');
     }
 	}
 }

+ 84 - 25
src/views/mychart_manage/components/chartDetailDia.vue

@@ -41,7 +41,7 @@
               }}</el-button>
             </template>
             <!-- 季节性图选择年份区间 -->
-            <date-picker
+            <!-- <date-picker
               v-else-if="chartInfo.ChartType === 2"
               v-model="season_year"
               type="month"
@@ -49,7 +49,10 @@
               range
               placeholder="年份日期选择"
               @change="seasonYearChange"
-            />
+            /> -->
+            <div v-else-if="chartInfo.ChartType === 2" @click="openDateDia" class="date-setting">
+              {{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+            </div>
           </div>
           <div class="top-right" v-if="chartInfo.Button">
             <span v-permission="permissionBtn.myETAPermission.myChart_move"
@@ -652,7 +655,7 @@ export default {
 
       /* 查看历史弹窗 */
 			isLookHistory: false,
-			lookEdbId: 0,
+			lookEdbId: 0
     };
   },
   methods: {
@@ -730,33 +733,48 @@ export default {
     /* 设置默认时间选中项 */
     setDefaultDateSelect() {
       this.year_select = this.chartInfo.DateType;
+      this.count_year = this.chartInfo.StartYear;
       this.select_date = [this.chartInfo.StartDate, this.chartInfo.EndDate];
       this.calendar_type = this.chartInfo.Calendar; //日历类型
-      this.season_year = [
-        this.chartInfo.SeasonStartDate,
-        this.chartInfo.SeasonEndDate,
-      ];
+
+      if(this.chartInfo.ChartType==2){
+        if(this.year_select==20){
+          let latestYear = parseInt(this.tableData[0].LatestDate.substring(0,4))
+          this.season_year=[`${latestYear-this.count_year+1}-01-01`,`${latestYear}-12-31`]
+        }else if(this.year_select==6){
+          this.season_year = [this.chartInfo.SeasonStartDate,this.tableData[0].LatestDate];
+        }else{
+          this.season_year = [this.chartInfo.SeasonStartDate,this.chartInfo.SeasonEndDate]
+        }
+      }
+
       this.dateTip =
         this.chartInfo.DateType === 5
           ? `${this.chartInfo.StartDate}~${this.chartInfo.EndDate}`
           : this.chartInfo.DateType === 6
           ? `${this.chartInfo.StartDate}~至今`
-          : '请选择时间段';
+          : this.chartInfo.DateType === 20
+          ?`最近${this.chartInfo.StartYear}年`
+          :'请选择时间段';
+
     },
 
     /* 曲线图筛选项发生变化时 非配置项 获取新的图表数据 */
    async getPreviewChartInfo() {
-
+      let dateArray=this.chartInfo.ChartType==2?this.season_year:this.select_date
       let params = {
         ChartType: this.chartInfo.ChartType,
         DateType: this.year_select,
-        StartDate: [5, 6].includes(this.year_select)
-          ? this.select_date[0]
+        StartDate: [5 , 6].includes(this.year_select)
+          ? dateArray[0]
           : '',
-        EndDate: this.year_select === 5 ? this.select_date[1] : '',
+        EndDate: this.year_select === 5 ? dateArray[1] : '',
         Calendar: this.calendar_type,
-        SeasonStartDate: this.season_year ? this.season_year[0] : '',
-        SeasonEndDate: this.season_year ? this.season_year[1] : '',
+        //ETA1.0.5 去除了这两个入参
+        // SeasonStartDate: this.season_year ? this.season_year[0] : '',
+        // SeasonEndDate: this.season_year ? this.season_year[1] : '',
+        SeasonExtraConfig:this.SeasonExtraConfig,
+        StartYear:this.count_year || 0,
         ChartEdbInfoList: this.tableData.map(_ => ({
           EdbInfoId: _.EdbInfoId,
           EdbInfoType: _.EdbInfoType,
@@ -781,13 +799,16 @@ export default {
     /* 打开时间段弹窗 */
     openDateDia() {
       // 自定义时间段回显
+      let selectDateStart = this.chartInfo.ChartType === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chartInfo.ChartType === 2?this.season_year[1]:this.select_date[1]
       this.dateForm = {
         date_type: this.year_select,
         start_date:
           this.year_select === 5 || this.year_select === 6
-            ? this.select_date[0]
+            ? selectDateStart
             : '',
-        end_date: this.year_select === 5 ? this.select_date[1] : '',
+        end_date: this.year_select === 5 ? selectDateEnd : '',
+        count_year: this.year_select === 20 ? this.count_year : ''
       };
       this.isDateDia = true;
     },
@@ -797,19 +818,33 @@ export default {
       this.year_select = data.dateType;
       this.isDateDia = false;
       this.select_date = [data.start_date, data.end_date];
-
+      this.count_year = data.count_year
+      
       this.dateTip =
-        data.dateType === 5
+          data.dateType === 5
           ? `${data.start_date}~${data.end_date}`
-          : `${data.start_date}~至今`;
-
-      this.saveNowOptions();
+          : data.dateType === 6
+					?`${data.start_date}~至今`
+					:`最近${this.count_year}年`
+      if(this.chartInfo.ChartType === 2){
+				let latestYear = parseInt(this.tableData[0].LatestDate.substring(0,4))
+				let dateStart = data.start_date
+				let dateEnd = data.end_date
+				if(data.dateType==20){
+					dateStart = `${latestYear-this.count_year+1}-01-01`
+					dateEnd = `${latestYear}-12-31`
+				}else if(data.dateType==6){
+					dateEnd = this.tableData[0].LatestDate
+				}
+				this.season_year = [dateStart, dateEnd];
+			}
+      // this.saveNowOptions();
       this.getPreviewChartInfo();
     },
 
     /* 季节图切换年份  保持当前配置 */
     seasonYearChange() {
-      this.saveNowOptions();
+      // this.saveNowOptions();
       this.getPreviewChartInfo();
     },
 
@@ -820,7 +855,7 @@ export default {
       this.dateTip = '请选择时间段';
   
       //保存表格配置和上下限 曲线图需要保存表格配置
-      this.saveNowOptions();
+      // this.saveNowOptions();
       this.getPreviewChartInfo();
     },
 
@@ -1055,8 +1090,10 @@ export default {
           typeChartParam = {
             ...public_param,
             Calendar: this.calendar_type,
-            SeasonStartDate: this.season_year ? this.season_year[0] : '',
-            SeasonEndDate: this.season_year ? this.season_year[1] : '',
+            DateType: this.year_select,
+            StartYear:this.count_year || 0,
+            StartDate: this.season_year ? this.season_year[0] : '',
+            EndDate: this.season_year ? this.season_year[1] : '',
           }
           break
         case 7:
@@ -1085,6 +1122,7 @@ export default {
         ? {
             ...public_param,
             DateType: this.year_select,
+            StartYear:this.count_year || 0,
             StartDate:
               this.year_select === 5 || this.year_select === 6
                 ? this.select_date[0]
@@ -1325,6 +1363,13 @@ export default {
   $normal_height: 650px;
   $mini_height: 550px;
 
+  .date-setting{
+    border: 1px solid #DCDFE6;
+    border-radius: 4px;
+    cursor: pointer;
+    color: #333333;
+    line-height: 16px;
+  }
   @media screen and (max-width: 1710px) {
 
     /* transform: scale(0.8);
@@ -1357,6 +1402,11 @@ export default {
     .btn-sty {
       padding: 8px;
     }
+    .date-setting{
+				width: 180px;
+				padding: 10px;
+				font-size: 12px;
+			}
   }
   @media screen and (min-width: 1711px) {
     .year-btn,.btn-sty,.top-right {
@@ -1371,6 +1421,15 @@ export default {
     .btn-sty {
       padding: 10px;
     }
+    .date-setting{
+      width: 210px;
+      padding: 10px;
+      border: 1px solid #DCDFE6;
+      border-radius: 4px;
+      cursor: pointer;
+      font-size: 14px;
+      color: #333333;
+    }
     .el-table__expanded-cell {
       padding: 20px 26px;
     }

+ 100 - 97
src/views/ppt_manage/mixins/mixins.js

@@ -334,6 +334,12 @@ export default {
     setSeasonChart() {
       /* 季节性图的图表配置 */
       const chartData = this.dataList[0];
+
+
+      // 农历数据需要去除第一项 在ETA1.0.5之后,除了这里 农历和公历处理逻辑一样
+      const chartDataHandle=this.calendar_type === '农历'?
+      chartData.DataList.filter((item, index) => index > 0):
+      chartData.DataList
       let seasonYdata = [],
         seasonData = [],
         chart = {
@@ -341,8 +347,8 @@ export default {
         };
 
       /* 公历数据处理 处理数据列 y轴 */
-      if (this.chartInfo.Calendar === '公历')
-        for (let j of chartData.DataList) {
+      // if (this.chartInfo.Calendar === '公历')
+        for (let j of chartDataHandle) {
            //预测指标配置
           let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
 
@@ -350,7 +356,7 @@ export default {
             data: [],
             type: chartData.ChartStyle,
             yAxis: 0,
-            name: j.Year,
+            name: j.ChartLegend,
             ...predict_params
           };
           const data_array = _.cloneDeep(j.DataList);
@@ -358,8 +364,8 @@ export default {
             data_array.forEach((item) => {
               serie_item.data.push([item.DataTimestamp, item.Value]);
             });
-          const index = chartData.DataList.findIndex(
-            (item) => item.Year === j.Year
+          const index = chartDataHandle.findIndex(
+            (item) => item.ChartLegend === j.ChartLegend
           );
           const s_yItem = {
             title: {
@@ -392,58 +398,58 @@ export default {
         }
 
       /* 农历数据处理  */
-      let filterArr =
-        this.chartInfo.Calendar === '农历'
-          ? chartData.DataList.List.filter((item, index) => index > 0)
-          : [];
-      if (this.chartInfo.Calendar === '农历')
-        for (let j of filterArr) {
-           //预测指标配置
-          let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
+      // let filterArr =
+      //   this.chartInfo.Calendar === '农历'
+      //     ? chartData.DataList.List.filter((item, index) => index > 0)
+      //     : [];
+      // if (this.chartInfo.Calendar === '农历')
+      //   for (let j of filterArr) {
+      //      //预测指标配置
+      //     let predict_params =  chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
           
-          let serie_item = {
-            data: [],
-            type: chartData.ChartStyle,
-            yAxis: 0,
-            name: j.Year,
-            ...predict_params
-          };
-          const data_array = _.cloneDeep(j.Items);
-          data_array &&
-            data_array.forEach((item) => {
-              serie_item.data.push([item.DataTimestamp, item.Value]);
-            });
-          const index = filterArr.findIndex((item) => item.Year === j.Year);
-
-          const s_yItem = {
-            title: {
-              text:  `${chartData.Unit}`,
-              textCh:chartData.Unit,
-              textEn:chartData.Unit?chartData.UnitEn:'',
-              // text: null,
-              align: 'high',
-              rotation: 0,
-              y: -15,
-              offset: -(12 * chartData.Unit.length),
-            },
-            labels: {
-              formatter: function (ctx) {
-                let val = ctx.value;
-                return index !== 0 ? '' : val;
-              },
-              align: 'center',
-              style: {
-                fontSize: '10px',
-              },
-              x: -5,
-            },
-            max: Number(chartData.MaxData),
-            min: Number(chartData.MinData),
-            ...seasonOptions.yAxis,
-          };
-          seasonData.push(serie_item);
-          seasonYdata.push(s_yItem);
-        }
+      //     let serie_item = {
+      //       data: [],
+      //       type: chartData.ChartStyle,
+      //       yAxis: 0,
+      //       name: j.Year,
+      //       ...predict_params
+      //     };
+      //     const data_array = _.cloneDeep(j.Items);
+      //     data_array &&
+      //       data_array.forEach((item) => {
+      //         serie_item.data.push([item.DataTimestamp, item.Value]);
+      //       });
+      //     const index = filterArr.findIndex((item) => item.Year === j.Year);
+
+      //     const s_yItem = {
+      //       title: {
+      //         text:  `${chartData.Unit}`,
+      //         textCh:chartData.Unit,
+      //         textEn:chartData.Unit?chartData.UnitEn:'',
+      //         // text: null,
+      //         align: 'high',
+      //         rotation: 0,
+      //         y: -15,
+      //         offset: -(12 * chartData.Unit.length),
+      //       },
+      //       labels: {
+      //         formatter: function (ctx) {
+      //           let val = ctx.value;
+      //           return index !== 0 ? '' : val;
+      //         },
+      //         align: 'center',
+      //         style: {
+      //           fontSize: '10px',
+      //         },
+      //         x: -5,
+      //       },
+      //       max: Number(chartData.MaxData),
+      //       min: Number(chartData.MinData),
+      //       ...seasonOptions.yAxis,
+      //     };
+      //     seasonData.push(serie_item);
+      //     seasonYdata.push(s_yItem);
+      //   }
 
       // 季节图x轴显示月/日 周度指标额外处理时间轴显示
       const xAxis = {
@@ -474,52 +480,49 @@ export default {
       };
 
       //农历默认选中一年数据并隐藏按钮  公历显示全部数据
-      let rangeSelector =
-        this.chartInfo.Calendar === '农历'
-          ? {
-              enabled: true,
-              selected: 0,
-              inputStyle: {
-                display: 'none',
-              },
-              labelStyle: {
-                display: 'none',
-              },
-              buttonTheme: {
-                style: {
-                  display: 'none',
-                },
-              },
-              buttons: [
-                {
-                  type: 'month',
-                  count: 12,
-                  text: '12月',
-                },
-                {
-                  type: 'month',
-                  count: 15,
-                  text: '15月',
-                },
-                {
-                  type: 'all',
-                  text: '全部',
-                },
-              ],
-            }
-          : {
-              enabled: false,
-            };
+      // let rangeSelector =
+      //   this.chartInfo.Calendar === '农历'
+      //     ? {
+      //         enabled: true,
+      //         selected: 0,
+      //         inputStyle: {
+      //           display: 'none',
+      //         },
+      //         labelStyle: {
+      //           display: 'none',
+      //         },
+      //         buttonTheme: {
+      //           style: {
+      //             display: 'none',
+      //           },
+      //         },
+      //         buttons: [
+      //           {
+      //             type: 'month',
+      //             count: 12,
+      //             text: '12月',
+      //           },
+      //           {
+      //             type: 'month',
+      //             count: 15,
+      //             text: '15月',
+      //           },
+      //           {
+      //             type: 'all',
+      //             text: '全部',
+      //           },
+      //         ],
+      //       }
+      //     : {
+      //         enabled: false,
+      //       };
 
       this.options = {
-        colors:
-          this.chartInfo.Calendar === '公历'
-            ? seasonOptions.colors.slice(-chartData.DataList.length)
-            : seasonOptions.colors.slice(-filterArr.length),
+        colors:seasonOptions.colors.slice(-chartDataHandle.length),
         series: seasonData,
         yAxis: seasonYdata,
         xAxis,
-        rangeSelector
+        // rangeSelector
       };
     },
 

+ 25 - 5
src/views/predictEdb_manage/addPredicEdb.vue

@@ -807,16 +807,36 @@ export default {
           }
         })
 
+      let dateArray=[]
+      let DateType,StartYear;
+      
+      if(this.$refs.chartInfo.chartInfo.ChartType==2){
+          DateType=this.$refs.chartInfo.year_select_season
+          StartYear=this.$refs.chartInfo.count_year_season
+          if(!(this.$refs.chartInfo.season_year && this.$refs.chartInfo.season_year.length>0)){
+              // 初始化日期显示
+              let latestYear = parseInt(this.$refs.chartInfo.tableData[0].LatestDate.substring(0,4))
+              this.$refs.chartInfo.season_year = [`${latestYear-StartYear+1}-01-01`,`${latestYear}-12-31`];
+          }
+          dateArray = this.$refs.chartInfo.season_year
+      }else{
+          DateType=this.$refs.chartInfo.year_select
+          StartYear=this.$refs.chartInfo.count_year
+          dateArray = this.$refs.chartInfo.select_date
+      }
+      
       let params = {
         SourceEdbInfoId: this.formData.oldEdb,
-        DateType: this.$refs.chartInfo.year_select,
-        StartDate: this.$refs.chartInfo.select_date[0] || "",
-        EndDate: this.$refs.chartInfo.select_date[1] || "",
+        DateType,
+        StartDate: dateArray[0] || "",
+        EndDate: dateArray[1] || "",
         Calendar: this.$refs.chartInfo.calendar_type,
         ChartType: this.$refs.chartInfo.chartInfo.ChartType,
-        SeasonStartDate: this.$refs.chartInfo.season_year[0] || "",
-        SeasonEndDate: this.$refs.chartInfo.season_year[1] || "",
+        // ETA1.0.5 去除了这两个参数
+        // SeasonStartDate: this.$refs.chartInfo.season_year[0] || "",
+        // SeasonEndDate: this.$refs.chartInfo.season_year[1] || "",
         DataDateType: this.formData.dateType,
+        StartYear:StartYear || 0
       }
 
       const res = await preDictEdbInterface.edbChartDataForAdd(rules_params.length ? {...params,RuleList: rules_params} : params);

+ 69 - 8
src/views/predictEdb_manage/components/chartInfo.vue

@@ -20,7 +20,7 @@
             >{{dateTip}}</el-button>
             </template>
             <!-- 季节图时间选择 -->
-            <template v-if="chartInfo.ChartType==2">
+            <!-- <template v-if="chartInfo.ChartType==2">
                 <date-picker
                     v-model="season_year"
                     type="month"
@@ -29,7 +29,10 @@
                     placeholder="年份日期选择"
                     @change="seasonYearChange"
                 />
-            </template>
+            </template> -->
+            <div v-else-if="chartInfo.ChartType === 2" @click="openDateDia" class="date-setting" style="display: inline-block;">
+				{{ season_year && season_year.length>0 ? season_year[0]+'~'+season_year[1]:"年份日期选择" }}
+			</div>
             <!-- <span v-permission="permissionBtn.predictEdbPermission.edbPreData_switchSeason"
                 class="change-chart-btn" @click="chartTypeChange">切换{{chartInfo.ChartType==1?'季节性图':'曲线图'}}</span> -->
             <el-button type="primary" size="mini" class="btn-sty" style="margin-left:auto;"
@@ -112,7 +115,8 @@ export default {
     },
     data() {
         return {
-            year_select: 10, //年份选择项 默认全部
+            year_select: 10, //年份选择项
+            year_select_season: 20, //季节性年份选择项 默认最近五年
             yearSelector: [
                 {
                     name: '全部',
@@ -133,6 +137,9 @@ export default {
             isDateDia: false, // 时间段弹窗
             dateForm: {},
             dateTip: '请选择时间段',
+            count_year:5,
+            count_year_season:5,
+            isPredictorChart:true, // 复用了相同的逻辑,为了预测指标图表和正常的图库图表区分开
         }
     },
     mounted() {
@@ -146,28 +153,71 @@ export default {
                     DataList:this.edbData.DataList
                 }
             ]
-
             this.setAddChartDefault();
             this.setChartOptionHandle(this.tableData)
         },
 
         changeYear(item){
-            this.year_select=item.value
+            this.year_select = item.value
             this.select_date = [];
             this.dateTip = '请选择时间段';
             this.$emit('refreshData','saveLimit')
         },
+		/* 打开时间段弹窗 */
+		openDateDia() {
+			// 自定义时间段回显
+			let selectDateStart = this.chartInfo.ChartType === 2?this.season_year[0]:this.select_date[0]
+			let selectDateEnd = this.chartInfo.ChartType === 2?this.season_year[1]:this.select_date[1]
 
+            let year_select_real = this.chartInfo.ChartType === 2?this.year_select_season:this.year_select
+
+			this.dateForm = {
+				date_type: year_select_real,
+				start_date:
+					year_select_real === 5 || year_select_real === 6
+						? selectDateStart
+						: '',
+				end_date: year_select_real === 5 ? selectDateEnd : '',
+				count_year: year_select_real === 20 ?
+                            this.chartInfo.ChartType === 2?this.count_year_season:this.count_year 
+                            : ''
+			};
+			this.isDateDia = true;
+		},
         /* 保存完自定义日期 刷新数据 保存当前的图表配置和上下限 只改变图表*/
         dataChangeBack(data) {
-            this.year_select = data.dateType;
             this.isDateDia = false;
-            this.select_date = [data.start_date, data.end_date];
+
+            if(this.chartInfo.ChartType==1){
+                this.year_select = data.dateType
+                this.count_year = data.count_year
+            }else{
+                this.year_select_season = data.dateType
+                this.count_year_season = data.count_year
+            }
+            let dateStart = data.start_date
+            let dateEnd = data.end_date
+            let latestYear = parseInt(this.tableData[0].LatestDate.substring(0,4))
+
+			if(this.chartInfo.ChartType === 2){
+                if(data.dateType==20){
+                    dateStart = `${latestYear-data.count_year+1}-01-01`
+                    dateEnd = `${latestYear}-12-31`
+                }else if(data.dateType==6){
+					// 回显
+					dateEnd = this.tableData[0].LatestDate
+				}
+                this.season_year = [dateStart, dateEnd];
+			}
+
+            this.select_date = [dateStart, dateEnd];
 
             this.dateTip =
                 data.dateType === 5
                 ? `${data.start_date}~${data.end_date}`
-                : `${data.start_date}~至今`;
+                : data.dateType === 6
+                ?`${data.start_date}~至今`
+                :`最近${this.count_year}年`
 
             this.$emit('refreshData','saveLimit')
         },
@@ -206,6 +256,17 @@ export default {
             background-color: #fff;
 			color: #0052D9;
         }
+        .date-setting{
+			width: 210px;
+			// height: 40px;
+			padding: 10px;
+			border: 1px solid #DCDFE6;
+			border-radius: 4px;
+			cursor: pointer;
+			font-size: 14px;
+			color: #333333;
+			box-sizing: border-box;
+		}
         .change-chart-btn{
             float: right;
             color: #409eff;

+ 26 - 6
src/views/predictEdb_manage/components/edbDetail.vue

@@ -85,15 +85,35 @@ export default {
     },
     methods: {
         getDetail(type=''){
+			let dateArray=[]
+            let DateType,StartYear;
+            
+            if(this.$refs.chartInfo.chartInfo.ChartType==2){
+                DateType=this.$refs.chartInfo.year_select_season
+                StartYear=this.$refs.chartInfo.count_year_season
+                if(!(this.$refs.chartInfo.season_year && this.$refs.chartInfo.season_year.length>0)){
+                    // 初始化日期显示
+                    let latestYear = parseInt(this.$refs.chartInfo.tableData[0].LatestDate.substring(0,4))
+                    this.$refs.chartInfo.season_year = [`${latestYear-StartYear+1}-01-01`,`${latestYear}-12-31`];
+                }
+                dateArray = this.$refs.chartInfo.season_year
+            }else{
+                DateType=this.$refs.chartInfo.year_select
+                StartYear=this.$refs.chartInfo.count_year
+                dateArray = this.$refs.chartInfo.select_date
+            }
+
             preDictEdbInterface.edbChartInfo({
 				EdbInfoId: this.id,
-                DateType: this.$refs.chartInfo.year_select,
-				StartDate: this.$refs.chartInfo.select_date[0]||'',
-				EndDate: this.$refs.chartInfo.select_date[1]||'',
+                DateType,
+				StartDate: dateArray[0]||'',
+				EndDate: dateArray[1]||'',
                 ChartType:this.$refs.chartInfo.chartInfo.ChartType,
-                SeasonStartDate:this.$refs.chartInfo.season_year[0]||'',
-                SeasonEndDate:this.$refs.chartInfo.season_year[1]||'',
-                Calendar:this.$refs.chartInfo.calendar_type
+                // ETA1.0.5 去除了这两个参数
+                // SeasonStartDate:this.$refs.chartInfo.season_year[0]||'',
+                // SeasonEndDate:this.$refs.chartInfo.season_year[1]||'',
+                Calendar:this.$refs.chartInfo.calendar_type,
+                StartYear:StartYear || 0
 			}).then(res=>{
                 if(res.Ret!=200) return
                 this.edbData.DataList=res.Data.DataList||[]

+ 7 - 0
src/views/predictEdb_manage/predictEdb.vue

@@ -651,6 +651,13 @@ export default {
 				if(this.$refs.detailComponentRef){
 					this.$refs.detailComponentRef.$refs.chartInfo.chartInfo.ChartType=1;
 					this.$refs.detailComponentRef.$refs.chartInfo.year_select=10;
+					this.$refs.detailComponentRef.$refs.chartInfo.year_select_season=20;
+
+					this.$refs.detailComponentRef.$refs.chartInfo.calendar_type='公历';
+
+					this.$refs.detailComponentRef.$refs.chartInfo.count_year=5;
+					this.$refs.detailComponentRef.$refs.chartInfo.count_year_season=5;
+					
 					this.$refs.detailComponentRef.$refs.chartInfo.select_date=[];
 					this.$refs.detailComponentRef.$refs.chartInfo.season_year=[];
 					this.$refs.detailComponentRef.$refs.chartInfo.dateTip='请选择时间段';