Browse Source

主页搜索

zhuliu 1 năm trước cách đây
mục cha
commit
2b9c42712f

+ 7 - 0
src/api/newApi/product.js

@@ -81,5 +81,12 @@ export default {
   groupProductMarketData(data) {
     return axios.post("/xiaoshi/productMarketData/groupProductMarketData", data);
   },
+  /**
+   * 获取公司和地区
+   */
+  getAllCompanyAndArea(data) {
+    return axios.post("/xiaoshi/productMarketData/getAllCompanyAndArea", data);
+  },
+  
   
 };

+ 10 - 15
src/router/index.js

@@ -159,13 +159,6 @@ const routes = [
             component: () => import('@/views/product/components/details'),
           },
       //     {
-      //       path: "/categoryDetails",
-      //       meta: {
-      //        title: '产品类别详情',
-      //       },
-      //       component: () => import('@/views/product/components/categoryDetails'),
-      //     },
-      //     {
       //       path: "/mindIndex",
       //       meta: {
       //        title: '可视化',
@@ -173,14 +166,16 @@ const routes = [
       //      },
       //      component: () => import('@/views/product/components/jsMind'),
       //    },
-      //    {
-      //       path: "/chartIndex",
-      //       meta: {
-      //         title: '趋势图',
-      //         button: [],
-      //       },
-      //       component: () => import('@/views/product/components/echarts'),
-      //     },
+         {
+            path: "/chartIndex",
+            name:'chartIndex',
+            meta: {
+              title: '趋势图',
+              sign: 'chartIndex',
+              belong:'Product'
+            },
+            component: () => import('@/views/product/components/echarts'),
+          },
           {
             path: "/frameworkIndex",
             meta: {

+ 4 - 2
src/views/home/components/showDialog.js

@@ -7,8 +7,10 @@ let DrawerConstructor = Vue.extend(showDialog);
 let instance;
  
 /**
- * Scenario:[],eventId:'',eventName:''
- * @param {*} value 
+ * 打开查看事件流程详情
+ * @param {Object} value 
+ * @example
+ * {Scenario:[],eventId:'',eventName:''}
  * @returns 
  */
 const Drawer = function(value) {

+ 11 - 7
src/views/home/index.vue

@@ -110,13 +110,17 @@ export default {
     
     // 点击搜索
     search(){
-      this.$eventVisual(
-        {
-          Scenario:["专利培育布局"],
-          eventId:'69',
-          eventName:'事件21'
-        }
-      )
+      if(!this.queryParams.select){
+        this.$message.error('请选择需要检索的信息')
+        return false
+      }
+      localStorage.searchContent = this.queryParams.content
+      this.$router.push({
+        name:this.queryParams.select,
+      })
+      setTimeout(function () {
+        localStorage.searchContent = ''
+      }, 1000);
     },
     
     //获取提示信息

+ 2 - 1
src/views/patentMining/components/viewIndex.vue

@@ -108,7 +108,8 @@ export default {
       //检索条件
       searchOption: {
         scenarioNames:this.scenarioId,
-        matterNames:this.matterId
+        matterNames:this.matterId,
+        name:localStorage.searchContent
       },
       // table栏位信息
       columnList: [],

+ 8 - 4
src/views/product/components/details/components/index.vue

@@ -20,11 +20,15 @@
   
 <script>
 import basicMessage from './basicMessage.vue';
-import market from '../../market/index.vue'
+// import market from '../../market/index.vue'
+import chart from '../../echarts/components/echarts.vue'
+import marketAndTrend from './marketAndTrend.vue';
   export default {
     components: {
         basicMessage,
-        market
+        // market,
+        chart,
+        marketAndTrend
     //   ProductMessage:() => import('./productMessage.vue'),
     //   RelatedPatents:()=> import("../relatedPatents/components/relatedPatents.vue"),
     //   // MarketingData:()=> import('../marketingData.vue'),
@@ -69,7 +73,7 @@ import market from '../../market/index.vue'
                     {
                         label:'趋势图',
                         value:'2',
-                        path:'basicMessage1'
+                        path:'chart'
                     },
                     {
                         label:'分类架构',
@@ -93,7 +97,7 @@ import market from '../../market/index.vue'
                     {
                         label:'营销数据',
                         value:'2',
-                        path:'market'
+                        path:'marketAndTrend'
                     },
                     {
                         label:'商品化专利',

+ 50 - 0
src/views/product/components/details/components/marketAndTrend.vue

@@ -0,0 +1,50 @@
+<template>
+    <div class="echart">
+      <div class="item">
+          <MarketingData :id="id" :type="type" :name="name"></MarketingData>
+      </div>
+      <div>
+          <chart :id="id" :type="type" :name="name"></chart>
+      </div>
+    </div>
+</template>
+  
+  <script>
+  export default {
+    components: {
+      MarketingData:()=> import('../../market/index.vue'),
+      chart:() => import('../../echarts/components/echarts.vue'),
+    },
+    props: {
+        type:{
+
+        },
+        id:{
+
+        },
+        name:{
+
+        },
+    },
+    data() {
+      return {
+      };
+    },
+    watch: {},
+    computed: {},
+    created() {},
+    mounted() {},
+    methods: {},
+  };
+  </script>
+  <style lang="scss" scoped>
+  .echart{
+      display: flex;
+      height: 100%;
+      .item{
+          padding:10px;
+          height: 100%;
+          border-right: 1px solid gray;
+      }
+  }
+  </style>

+ 54 - 36
src/views/product/components/echarts/components/MultipleLine/index.vue

@@ -32,8 +32,8 @@
 </template>
 
 <script>
-import {chartOptionMixins,settingMethod} from '@/views/workspace/components/setting/mixins'
-import Style from '@/views/workspace/components/setting/style.vue'
+import {chartOptionMixins,settingMethod} from '@/views/components/setting/mixins'
+import Style from '@/views/components/setting/style.vue'
 var that = this
 export default {
   name: "CMultipleLine",
@@ -99,6 +99,7 @@ export default {
       // this.$emit('form',this.form)
     },
     open(chartData,name,relation,timeUnit){
+      console.log(chartData,name,relation,timeUnit)
       this.chartData = chartData
       this.relation = relation
       this.name = name
@@ -141,44 +142,61 @@ export default {
       var timeList = []
       var productNameList = []
       var data = []
-      this.chartData.forEach(item => {
-        productNameList.push(item.productName)
-        data.push({
-          name:item.productName,
+      data.push(
+        {
+          name:'',
           type:'line',
           connectNulls:true,
-          saleVOS:item.saleVOS,
           data:[]
-        })
-        item.saleVOS.forEach(item1=>{
-          var index = timeList.findIndex(i=>{
-            return item1[relation.x] == i
-          })
-          if(index == -1){
-            timeList.push(item1[relation.x])
-          }
-        })
-      });
-      timeList = timeList.sort((a,b)=>{
-          if(timeUnit == 0){
-            return Date.parse(a.replace(/-/g, "/")) - Date.parse(b.replace(/-/g, "/"))
-          }else if(timeUnit==1){
-            return  Date.parse(a.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))-Date.parse(b.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))
-          }else{
-            return Date.parse(a.substring(0,a.length-1))-Date.parse(b.substring(0,b.length-1))
-          }
-        }),
-      data.forEach(item=>{
-        if(item.saleVOS && item.saleVOS.length>0){
-          item.saleVOS.forEach(item2=>{
-            var index = timeList.findIndex(i=>{
-              return item2[relation.x] == i
-            })
-            item.data[index] = item2[relation.y]
-          })
         }
+      )
+      productNameList=['']
+      timeList = this.chartData.map(item=>{
+        return item[relation.x]
+      })
+      data[0].data = this.chartData.map(item=>{
+        return item[relation.y]
+      })
+
+
+      // this.chartData.forEach(item => {
+      //   productNameList.push(item.productName)
+      //   data.push({
+      //     name:item.productName,
+      //     type:'line',
+      //     connectNulls:true,
+      //     saleVOS:item.saleVOS,
+      //     data:[]
+      //   })
+      //   item.saleVOS.forEach(item1=>{
+      //     var index = timeList.findIndex(i=>{
+      //       return item1[relation.x] == i
+      //     })
+      //     if(index == -1){
+      //       timeList.push(item1[relation.x])
+      //     }
+      //   })
+      // });
+      // timeList = timeList.sort((a,b)=>{
+      //     if(timeUnit == 0){
+      //       return Date.parse(a.replace(/-/g, "/")) - Date.parse(b.replace(/-/g, "/"))
+      //     }else if(timeUnit==1){
+      //       return  Date.parse(a.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))-Date.parse(b.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))
+      //     }else{
+      //       return Date.parse(a.substring(0,a.length-1))-Date.parse(b.substring(0,b.length-1))
+      //     }
+      //   }),
+      // data.forEach(item=>{
+      //   if(item.saleVOS && item.saleVOS.length>0){
+      //     item.saleVOS.forEach(item2=>{
+      //       var index = timeList.findIndex(i=>{
+      //         return item2[relation.x] == i
+      //       })
+      //       item.data[index] = item2[relation.y]
+      //     })
+      //   }
         
-      });
+      // });
       
       this.selected = {
         x:timeList,
@@ -189,7 +207,7 @@ export default {
         this.setColor()
       }
       
-      // console.log(this.selected)
+      console.log(this.selected)
       let {backgroundColor, title, legend, xAxis, yAxis, series, grid,toolbox } = this.get2AxisOption('line', '')
       // console.log(legend, xAxis, yAxis, series, grid)
       return {

+ 47 - 51
src/views/product/components/echarts/components/echarts.vue

@@ -17,19 +17,19 @@
                     <el-select v-model="queryParams.area" @change="changeEcharts()" clearable  placeholder="请选择地区">
                         <el-option
                             v-for="item in areaList"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value">
+                            :key="item"
+                            :label="item"
+                            :value="item">
                         </el-option>
                     </el-select>
                 </el-form-item>
-                <el-form-item label="公司" v-if="type == 1">
+                <el-form-item label="公司" v-if="type == 3">
                     <el-select v-model="queryParams.companyName" @change="changeEcharts()" clearable  placeholder="请选择公司">
                         <el-option
                             v-for="item in companyList"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value">
+                            :key="item"
+                            :label="item"
+                            :value="item">
                         </el-option>
                     </el-select>
                 </el-form-item>
@@ -52,9 +52,8 @@
             
         </div>
         <div>
-            <component v-if="type == 1" :is="component" :ref="components" :domId="components" :NewForm="form"  @form="getForm"></component>
+            <component v-if="type == 3" :is="component" :ref="components" :domId="components" :NewForm="form"  @form="getForm"></component>
             <component :is='component' :ref="component"  :NewForm="form" @form="getForm"></component>  
-            
         </div>  
         <el-drawer
             title="图表配置"
@@ -95,7 +94,7 @@ export default {
                     label:{
                         x:'marketDate',
                         xStr:'时间',
-                        y:'saleTotalMoney',
+                        y:'saleMoneyTotal',
                         yStr:'销售额'
                     },
                     value:1
@@ -113,14 +112,17 @@ export default {
             timeList:[
                 {
                     value:0,
+                    groupValue:'groupMonthTime',
                     label:'月'
                 },
                 {
                     value:1,
+                    groupValue:'groupSeasonTime',
                     label:'季度'
                 },
                 {
                     value:2,
+                    groupValue:'groupYearTime',
                     label:'年'
                 },
             ],
@@ -156,15 +158,15 @@ export default {
                 return i.value == this.queryParams.relation
             })
             var name = this.name + (this.type==3?'产品类别':'产品') + '趋势图'
-           if(this.type==1){
+           if(this.type==3){
                 this.$refs[this.components].open(this.chartData.filter(item=>{
-                    return item.productId==0
+                    return !item.productId
                 }),'趋势总图',relation.label,this.queryParams.timeUnit)
                 this.$refs[this.component].open(this.chartData.filter(item=>{
                     return item.productId!=0
                 }),name,relation.label,this.queryParams.timeUnit)
             }else{
-                this.$refs[this.component].open([this.chartData],name,relation.label,this.queryParams.timeUnit)
+                this.$refs[this.component].open(this.chartData,name,relation.label,this.queryParams.timeUnit)
             }
         },
         async changeEcharts(){
@@ -175,57 +177,51 @@ export default {
            
         },
        async init(){
-            const [chartData,areaList] = await Promise.allSettled([this.getData(),this.getAreaList()])
+            const [chartData,companyAndArea] = await Promise.allSettled([this.getData(),this.getAllCompanyAndArea()])
             this.chartData = chartData.status =='fulfilled'?chartData.value:[]
-            this.areaList= areaList.status =='fulfilled'?areaList.value.map(item=>{
-                return {
-                    value:item,
-                    label:item
-                }
-            }):[]
-            if(this.type == 3){
-                this.getCompanyList()
-            }
+            this.areaList= companyAndArea.status =='fulfilled'?companyAndArea.value.saleAreas:[]
+            this.companyList= companyAndArea.status =='fulfilled'?companyAndArea.value.companyNames:[]
             this.changeRelation()
             
             
         },
        async getData(){
-            if(this.type == 3){
-                this.queryParams.categoryId = this.id
-                this.queryParams.categoryArea = this.queryParams.area
-                return await this.$api.showTrend(this.queryParams)
-                    .then( async response=>await response.data)
-            }else if(this.type == 2){
-                this.queryParams.productId = this.id
-                this.queryParams.saleArea = this.queryParams.area
-                return await this.$api.ProductShowTrend(this.queryParams).then( async response=>await response.data)
-            }
-           
-            
+           var params= {
+                saleArea:this.queryParams.area,
+                companyName:this.queryParams.companyName,
+           }
+           if(this.type == 3){
+                params.categoryId = this.id
+           }else{
+                params.productId = this.id
+           }
+           var queryParams = {
+                size:99999,
+                current:1,
+                searchQuery:this.$commonJS.objectToString(params),
+                groupBy:this.timeList.find(item=>{
+                    return item.value == this.queryParams.timeUnit
+                }).groupValue,
+                orderDTOList:[
+                    {
+                        "orderBy": "saleTime", 
+                        "orderType": 0 
+                    }
+                ]
+           }
+           return await this.$api.groupProductMarketData(queryParams).then( async response=>await response.data.data.values)
         },
-        getAreaList(){
+        //获取所有公司和地区
+        getAllCompanyAndArea(){
             var params = {}
-            if(this.type == 1){
+            if(this.type == 3){
                 params.categoryId = this.id
             }else{
                 params.productId = this.id
             }
-            return this.$api.getAreaList(params).then(response=> response.data)
+            return this.$api.getAllCompanyAndArea(params).then(response=> response.data)
         },
-        getCompanyList(){
-             this.$api.getCompanyList({id:this.id}).then(response=>{
-                if(response.code == 200){
-                     this.companyList=response.data?response.data.map(item=>{
-                        return {
-                            value:item,
-                            label:item
-                        }
-                    }):[]
-                }
-            }
-            )
-        }
+
     },
 }
 </script>

+ 1 - 1
src/views/product/components/framework/viewIndex.vue

@@ -90,7 +90,7 @@ import frameworkTable from './view/table.vue'
 import classifyNode from '../dialog/classifyNode.vue';
 export default {
   props: {
-    row: Object,
+    row: Object,//name:产品名称或者是产品类别名称;id:产品id或者是产品类别id;typesof:类型
     typesOf: String,//1是产品类别分类架构,2是产品架构
   },
   components: {

+ 23 - 5
src/views/product/components/index.vue

@@ -96,7 +96,7 @@ export default {
       //检索条件
       searchOption: {
         questionName: this.eventName,
-        applicationScenario: this.applicationScenario
+        product_name:localStorage.searchContent
       },
       //分组的值
       groupingValue: 'noGrouping',
@@ -185,6 +185,7 @@ export default {
           this.$refs.addEditCategory.open(row)
           break;
         case '1'://趋势图
+          this.showTrend(row,3)
           break;
         case '2'://预览图片
           this.checkImage(row)
@@ -214,7 +215,7 @@ export default {
           this.$refs.addEditProduct.open(row)
           break;
         case '1'://预览图片
-          
+          this.checkImage(row)
           break;
         case '2'://产品架构
           this.toFramework(row,2)
@@ -222,10 +223,10 @@ export default {
         case '3'://产品的营销数据
           this.$refs.marketing.open(row)
           break;
-        case '4'://产品的营销数据
-
+        case '4'://产品的营销数据趋势图
+          this.showTrend(row,2)
           break;
-        case '5'://产品的营销数据
+        case '5'://专利布局可视化
 
           break;
         case '6'://商品化专利
@@ -236,6 +237,23 @@ export default {
           break;
       }
     },
+    /**
+     * 营销数据趋势图
+     * @param {Object} row 
+     * @param {Number} val 
+     */
+     showTrend(row, val) {//val为数据类型,1为产品类别,2为产品
+      const router = this.$router.resolve({
+        path: '/chartIndex',
+        query: {
+          id: row.id,
+          type: val,
+          name: row.name
+        }
+      })
+      window.open(router.href, '_blank');
+    },
+
      // 进入商品化专利
      toCommodity(row) {
       let router = this.$router.resolve({

+ 2 - 1
src/views/project/index.vue

@@ -111,7 +111,8 @@ export default {
       //检索条件
       searchOption: {
         scenarioNames:this.scenarioId,
-        matterNames:this.matterId
+        matterNames:this.matterId,
+        name:localStorage.searchContent
       },
       //专利数据库数据总数
       total: 0,