ソースを参照

井筒-领域检索

xiaoqiao 1 年間 前
コミット
3ec4e3c27b

+ 12 - 0
src/main/java/com/bowintek/practice/controller/EsIndexController.java

@@ -90,6 +90,18 @@ public class EsIndexController {
         return RespGenerstor.success(1);
     }
 
+    @ResponseBody
+    @GetMapping("/getAllList")
+    public BaseResponse<PageInfo<EsIndexVo>> getAllList() throws Exception {
+
+        PageInfo<EsIndexVo> result = esIndexService.getList(1, 999, null, null, null);
+
+        result.getList().forEach(x->{
+            x.setFieldList( esIndexService.getFieldList(x.getIndexId()));
+        });
+        return RespGenerstor.success(result);
+    }
+
     @ResponseBody
     @GetMapping("/exportEsIndex")
     public void exportEsIndex(HttpServletResponse response,

+ 3 - 0
src/main/java/com/bowintek/practice/vo/EsIndexVo.java

@@ -3,7 +3,10 @@ package com.bowintek.practice.vo;
 import com.bowintek.practice.model.EsIndex;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class EsIndexVo extends EsIndex {
     private String displayTypeName;
+    private List<EsIndexfieldVo> fieldList;
 }

+ 138 - 0
vue/src/components/basic/chart/chart-base.vue

@@ -0,0 +1,138 @@
+<template>
+  <div class="echart" :id="('popover-'+getChartId())" :style="chartStylePopover"></div>
+</template>
+
+<script lang="ts">
+  import {defineComponent, computed, markRaw, watch} from 'vue';
+  import * as echarts from "echarts";
+  import {get} from '@/api/common';
+
+  export  default defineComponent ({
+    props:{
+      wellId: null as any,
+      lineColor : null as any,
+      timeType : null as any, //日 day 月 month 年 year
+      dataType : null as any//gas产气量 oil产油量
+    },
+    name : 'ChartBase',
+    data() {
+      return{
+        loading : false,
+        chartStylePopover: { width: "100%" , height: "230px" },
+        chart : null as any,
+        serieType : 'bar',
+        hovered : false,
+        datas : null,
+        id : Date.now()
+      }
+    },
+    setup(props, context){
+      console.log("ChartCell setup" , props, context);
+
+      const timeType = computed(() => {
+        return props.timeType ? props.timeType : 'day'
+      });
+      const dataType = computed(() => {
+        return props.dataType ? props.dataType : 'oil'
+      });
+      const wellId = computed(() => {
+        return props.wellId ? props.wellId : null
+      });
+      const lineColor = computed(()=>{
+        return props.lineColor? props.lineColor : '#0058D0';
+      });
+
+      const units = {oil:'10kt', gas:'10^8m³',vol:'10kt'};
+
+      return{
+        timeType,
+        dataType,
+        wellId,
+        lineColor,
+        units
+      }
+    },
+    mounted(){
+      console.log("mounted chart-cell" , this.id);
+      if(this.wellId!=null && this.wellId!=undefined && this.wellId.trim().length>0)
+        this.readerChart();
+
+      watch(
+        () => this.wellId,
+        (n, o) => {
+          if(n!=o) {
+            console.log("wellIdChangeLog",this.getChartId(), n, o);
+            if(n!=null && n!=undefined && n.trim().length>0) {
+              this.chartDispose();
+              this.readerChart();
+            }
+          }
+        }
+      );
+    },
+    methods:{
+      getChartId:function (){
+        return this.id + "-" + this.wellId + "-" +this.dataType;
+      },
+      getDatas:async function(){
+        //数据查询逻辑,如果不查询,改此方法返回数据即可
+        if(this.datas==null){
+          const result = await get('/factwell/getFactWellList',
+            { wellId: this.wellId, timeType: this.timeType });
+          this.datas = result.rows;
+        }
+        return this.datas;
+      },
+      getxAxis:async function (show){
+        let dataArys = await this.getDatas();
+        let xAxis = {type : 'category', data : [] as any, show : show, axisLabel:{rotate:50}};
+        //数据组装,这里根据业务组装x轴数据
+        (dataArys! as any).forEach(row=>{ xAxis.data.push(row.time_str) });
+        return xAxis;
+      },
+      getyAxis:function (){
+        return {type: 'value', show:false };
+      },
+      getSeries:async function (symbolSize){
+        let dataArys = await this.getDatas();
+        let series = [{type: this.serieType, data:[] as any, showSymbol:true, symbolSize:symbolSize, symbol: 'circle',
+          itemStyle : {color:this.lineColor}, lineStyle : {width:1}}];
+        //数据组装,这里根据业务组装y轴数据
+        (dataArys! as any).forEach(row=>{ series[0].data.push(row[this.dataType]) });
+        console.log("getSeries", series);
+        return series;
+      },
+
+      readerChart: async function () {
+        let xAxis = await this.getxAxis(true);
+        xAxis['nameRotate'] = 0;
+        let unitStr = "";
+        if(this.units[this.dataType]) unitStr = "("+this.units[this.dataType]+")"
+
+        const option = {
+          //title: { text: '作业区域报表' },
+          tooltip: { trigger: 'item', triggerOn:"mousemove",showContent:true },
+          grid: { top:'3%', left: '3%', right: '3%', bottom: '6%', containLabel: true },
+          xAxis: xAxis,
+          yAxis: { type: 'value', axisLabel: { formatter : '{value}'+unitStr}},
+          series: await this.getSeries(5)
+        };
+        console.log("readerChart-"+this.serieType,option);
+
+        if(this.chart==null)
+          this.chart = markRaw(echarts.init(document.getElementById('popover-'+this.getChartId()) as HTMLElement));
+        if(this.chart!=null) {
+          this.chart.setOption(option);
+          this.chart.resize();
+        }
+      },
+      chartDispose:function (){
+        if(this.chart!=null) this.chart.dispose();
+        this.chart = null;
+        this.datas = null;
+      }
+    }
+  })
+</script>
+
+<style lang="less" scoped></style>

+ 12 - 6
vue/src/components/basic/es-result/chat-view.vue

@@ -3,7 +3,9 @@
     <div class="search-title">2023年度作业区域 年报 | 月报</div>
     <div class="search-view">
       <div class="search-view-chat">
-        <img class="search-chat" src="~@/assets/images/chat.png"/>
+        <div class="search-view-chat-img">
+        <ChartBase :timeType="('month')" :dataType="('gas')" :wellId="data.well_id"></ChartBase>
+        </div>
         <div>
           <span>井号:留70-175X</span>
           <span>井ID: HB_la0X7IYDTvIlePbaHlRc4SF3sfx33</span>
@@ -22,20 +24,24 @@
 </template>
 
 <script lang="ts">
-import {defineComponent, ref} from 'vue';
+import {defineComponent} from 'vue';
+import ChartBase from '@/components/basic/chart/chart-base.vue'
 
 export default defineComponent({
   name: 'chat-view',
-  components: {},
+  components: {ChartBase},
   props: {
-    kid: String,
+    indexSetting: Object,
+    data: Object,
   },
   setup(props) {
     console.log(props);
-    const data = ref([]);
+    const title = props.indexSetting?.indexName;
+    const fieldData = props.indexSetting?.fieldList;
+    const data = props.data;
 
     return {
-      data
+      fieldData, data,title
     };
   }
 });

+ 10 - 3
vue/src/components/basic/es-result/query-criteria.vue

@@ -46,7 +46,9 @@ import QueryHistoryComplete from '@/components/basic/querylog/history-complete.v
 export default defineComponent({
   name: 'query-criteria',
   components: {QueryHistoryComplete},
-  props: {},
+  props: {
+    queryObject: Object,
+  },
   setup(props) {
     console.log(props);
     const formState = reactive({
@@ -57,7 +59,12 @@ export default defineComponent({
       defaultField: '',
       defaultKeyString: ''
     });
-    const queryList = ref<any>([]);
+    if(props.queryObject&&props.queryObject.queryList.length>0){
+      formState.defaultField =props.queryObject.queryList[0].field;
+      formState.defaultKeyString =props.queryObject.queryList[0].keyString;
+    }
+
+    const queryList = ref<any>(props.queryObject ? props.queryObject.queryList.slice(1) : []);
 
     const operTexts = [
       {value: '=', label: '等于'},
@@ -102,7 +109,7 @@ export default defineComponent({
         value: formState.well_common_name
       });
       //多个值测试,如 组织单位 in 哪些值
-      queryObject.limiters.push({fields: ["well_type.keyword"], opreation: '包括IN', value: '直井'});
+     // queryObject.limiters.push({fields: ["well_type.keyword"], opreation: '包括IN', value: '直井'});
 
       console.log(queryObject);
       return queryObject;

+ 3 - 7
vue/src/components/basic/es-result/table-view.vue

@@ -11,8 +11,7 @@
 
 
 <script lang="ts">
-import {defineComponent, ref} from 'vue';
-import {get} from "@/api/common";
+import {defineComponent} from 'vue';
 
 export default defineComponent({
   name: 'table-view',
@@ -24,12 +23,9 @@ export default defineComponent({
   setup(props) {
     console.log(props);
     const title = props.indexSetting?.indexName;
-    const fieldData = ref([]);
+    const fieldData = props.indexSetting?.fieldList;
     const data = props.data;
-    get('esindex/getFieldList',
-      {indexId: props.indexSetting?.indexId}).then(result => {
-      fieldData.value = result;
-    })
+
     return {
       fieldData, data,title
     };

+ 15 - 6
vue/src/views/esdomain/result.vue

@@ -9,7 +9,7 @@
       </a-space>
     </div>
     <div v-show="pageState.showMoreQuery">
-      <queryCriteria ref="queryRef"></queryCriteria>
+      <queryCriteria ref="queryRef" :query-object="queryObject"></queryCriteria>
     </div>
     <a-divider orientation="center" @click="pageState.showMoreQuery=!pageState.showMoreQuery">
       <template v-if="!pageState.showMoreQuery">
@@ -60,6 +60,9 @@
               </p>
             </div>
           </div>
+          <div v-if="dataList.length==0">
+            没有查询的数据
+          </div>
           <template v-for="(it,index) in dataList">
             <div>
               <div class="search-body-title">
@@ -68,10 +71,11 @@
               </div>
               <div class="search-body-item">
                 <component :is="it.component" :indexSetting="it.indexSetting" :data="it" v-show="it.showMore||index<=3"></component>
+                <component is="chatView" :indexSetting="it.indexSetting" :data="it" v-show="it.showMore||index<=3"></component>
 
                 <a-divider orientation="center" @click="it.showMore=!it.showMore">
                   <template v-if="!it.showMore">
-                    展开更多
+                    展 
                     <DoubleRightOutlined rotate="90"/>
                   </template>
                   <template v-else>
@@ -159,7 +163,7 @@ export default defineComponent({
       page: 1, rows: 10, subjectName: '', tabName: '', tabCode: null, total: 0
     });
     const displayType = ['cycleView', 'tableView', 'listView', 'chatView', 'docView'];
-
+    const queryObject=ref();
     const pageState = reactive({
       showMoreQuery: false,
       defaultOrder: '',
@@ -190,7 +194,7 @@ export default defineComponent({
       {value: 'wellName', label: '井名'}
     ] as SelectProps['options'];
 
-    get('esindex/getList', {page: 1, rows: 99}).then(result => {
+    get('esindex/getAllList', {}).then(result => {
       indexList.value = result.list;
     })
     const showWell = (well_id) => {
@@ -252,12 +256,14 @@ export default defineComponent({
       dataList,
       handleChange,
       pageParams,
-      keyList
+      keyList,
+      queryObject
     };
   },
   created() {
     let queryObject = localStorage.getItem("queryObject");
     if (queryObject != null) {
+      this.queryObject=JSON.parse(queryObject);
       this.loadData(JSON.parse(queryObject));
     }
   },
@@ -266,7 +272,7 @@ export default defineComponent({
 });
 </script>
 
-<style lang="less" scoped>
+<style lang="less">
 .search-group{
   display: flex;
   width: 100%;
@@ -389,6 +395,9 @@ export default defineComponent({
   .search-view-chat {
     display: flex;
 
+    .search-view-chat-img{
+      width: 1200px;
+    }
     .search-chat {
       margin-right: 10px;
     }