diff --git a/src/views/water/lake/trend/index.vue b/src/views/water/lake/trend/index.vue index 02a87f4..e16ac7d 100644 --- a/src/views/water/lake/trend/index.vue +++ b/src/views/water/lake/trend/index.vue @@ -14,6 +14,8 @@ v-model:value="queryParams.yearList" :options="yearOptions" placeholder="请选择年度" + @change="handleYearChange" + allowClear > @@ -25,6 +27,8 @@ v-model:value="queryParams.monthList" :options="monthOptions" placeholder="请选择月份" + @change="handleMonthChange" + allowClear > @@ -52,6 +56,8 @@ v-model:value="queryParams.placeList" :options="sectionOptions" placeholder="请选择断面名称" + @change="handleSectionChange" + allowClear > @@ -63,6 +69,8 @@ v-model:value="queryParams.monitorIndexList" :options="indicatorOptions" placeholder="请选择监测指标" + @change="handleIndexChange" + allowClear > @@ -135,6 +143,7 @@ export default { innerSection: [], // 内湖断面 specialSection: [], // 专湖断面 innerIndex: [ + { label: "全选", value: "全选", limit:"0",color:"#209f53" }, { label: "pH值", value: "ph", limit:"9",color:"#209f53" }, { label: "透明度(cm)", value: "transparency", limit:"0.01",color:"#209f53" }, // { label: "溶解氧饱和度(﹪)", value: "dissolvedOxygenSaturation", limit:"6",color:"#20749f" }, @@ -159,6 +168,7 @@ export default { // { label: "氧化还原电位(mV)", value: "oxidationReductionPotential", limit:"1",color:"#209f53" }, ], // 内湖监测指标 specialIndex: [ + { label: "全选", value: "全选", limit:"0",color:"#209f53" }, // { label: "浊度(NTU)", value: "turbidity", limit:"1",color:"#209f53" }, { label: "水温(℃)", value: "wTemp", limit:"2",color:"#209f53" }, // { label: "水位(m)", value: "wd", limit:"1",color:"#209f53" }, @@ -238,11 +248,64 @@ export default { }, mounted() { this.loadOptionData(); + + Array.prototype.remove = function(val) { + var index = this.indexOf(val); + if (index > -1) { + this.splice(index, 1); + } + }; }, methods: { + // 全选 + //年份 + handleYearChange(e){ + if(e.indexOf('全选')>-1){ + this.queryParams.yearList = [...this.yearOptions.map(item=>( + item.value + ))] + this.queryParams.yearList.remove('全选'); + } + }, + // 月份 + handleMonthChange(e){ + if(e.indexOf('全选')>-1){ + this.queryParams.monthList = [...this.monthOptions.map(item=>( + item.value + ))] + this.queryParams.monthList.remove('全选'); + } + }, + // 断面 + handleSectionChange(e){ + if(e.indexOf('全选')>-1){ + this.queryParams.placeList = [...this.sectionOptions.map(item=>( + item.value + ))] + this.queryParams.placeList.remove('全选'); + } + }, + // 指标 + handleIndexChange(e){ + if(e.indexOf('全选')>-1){ + this.queryParams.monitorIndexList = [...this.indicatorOptions.map(item=>( + item.value + ))] + this.queryParams.monitorIndexList.remove('全选'); + } + }, + // 下拉列表 loadOptionData() { let yy = new Date().getFullYear(); + this.yearOptions.push({ + label: '全选', + value: '全选', + }) + this.monthOptions.push({ + label: '全选', + value: '全选', + }) for (let i = 1; i <= 12; i++) { this.yearOptions.push({ label: yy - i, @@ -313,6 +376,10 @@ export default { res.data.data.forEach((item) => { palceOptions[item.sectionName] = item.sectionName; }); + newPlace.push({ + label: '全选', + value: '全选', + }) for (let i in palceOptions) { newPlace.push({ label: palceOptions[i], @@ -631,7 +698,11 @@ export default { }, // 生成年月标识 buildYearMonth(obj){ + if(this.queryParams.xco == "Xco_1"){ + return obj.year; + }else{ return obj.year + (obj.month ? ('-'+obj.month) : ""); + } },