浏览代码

图表分析

zhuliu 1 年之前
父节点
当前提交
32506d3ba2

+ 5 - 3
src/api/index.js

@@ -1,6 +1,6 @@
 import report from "./report";
 import template from "./template";
-import custom from "./custom";
+// import custom from "./custom";
 import field from "./field";
 import data from "./data";
 // import common from "./common";
@@ -36,11 +36,12 @@ import patentMining from "./newApi/patentMining"
 import task2 from "./newApi/task"
 import importAndExport from './newApi/importAndExport'
 import patent from './newApi/patent'
+import custom from "./newApi/custom";
 
 export default {
   ...report,
   ...template,
-  ...custom,
+  
   ...field,
   ...data,
   ...oauth2,
@@ -71,5 +72,6 @@ export default {
   ...patentMining,
   ...task2,
   ...importAndExport,
-  ...patent
+  ...patent,
+  ...custom,
 }

+ 43 - 0
src/api/newApi/custom.js

@@ -0,0 +1,43 @@
+import axios from '@/utils/axios'
+
+export default {
+
+    /**
+     * 查询组别/分析项接口
+     * @param {*} data type==1是组别,type==2是分析项
+     * @returns 
+     */
+    queryAnalyseGroup(data) {
+        return axios.post('/xiaoshi/customAnalyse/queryAnalyseGroup', data)
+    },
+    /**
+    * 删除组别/分析项接口
+    */
+    delAnalyseGroup(data) {
+        return axios.post('/xiaoshi/customAnalyse/delAnalyseGroup', data)
+    },
+    /**
+    * 添加组别/分析项接口
+    */
+    addAnalyseGroup(data) {
+        return axios.post('/xiaoshi/customAnalyse/addAnalyseGroup', data)
+    },
+    /**
+    * 编辑组别/分析项接口
+    */
+    editAnalyseGroup(data) {
+        return axios.post('/xiaoshi/customAnalyse/editAnalyseGroup', data)
+    },
+    /**
+    * 查询组别/分析项详情包含图表接口
+    */
+    queryAnalyseDetail(data) {
+        return axios.post('/xiaoshi/customAnalyse/queryAnalyseDetail', data)
+    },
+    /**
+    * 分析统计的栏位日期最大/最小值接口
+    */
+    getFieldRange(data) {
+        return axios.post('/xiaoshi/patent/getFieldRange', data)
+    },
+}

+ 9 - 3
src/api/newApi/importAndExport.js

@@ -36,7 +36,13 @@ export default {
    /**
     * 获取报告模板
     */
-   queryTempleByType(data) {
-    return axios.post('/xiaoshi/template/queryTempleByType', data)
-},
+    queryTempleByType(data) {
+        return axios.post('/xiaoshi/template/queryTempleByType', data)
+    },
+    /**
+    * 获取报告模板
+    */
+    exportReport(params) {
+        return axios.get('/xiaoshi/reportDocument/exportReport', {params})
+    },
 }

+ 8 - 0
src/api/newApi/patent.js

@@ -255,4 +255,12 @@ export default {
   deleteHightLight(data) {
     return axios.post("/xiaoshi/hightlightTemplate/delete", data);
   },
+  /**
+   * 添加标签
+   * @param {*} data 
+   * @returns 
+   */
+  addPatentLabel(data) {
+    return axios.post("/xiaoshi/patentLabel/addPatentLabel", data);
+  },
 }

+ 58 - 14
src/store/modules/chart.js

@@ -70,27 +70,71 @@ export default {
     async getSourceDataList({ commit, state, getters, dispatch }, dimension) {
       let form = { ...state.form }
       state.selectedLoad[dimension] = true
-      if (form.schema[dimension].ptype !== 0) {
+      if (form.schema[dimension].ptype !== 0 && form.schema[dimension].ptype !== 4 &&  form.schema[dimension].ptype !== 3) {
+        // let params = {
+        //   uid: form.uid || '',
+        //   patentKey: state.patentKey,
+        //   dimension: dimension,
+        //   expandId: form.schema[dimension].expand || 0,
+        //   fieldId: form.schema[dimension].field,
+        //   type: form.schema[dimension].type,
+        //   ptype: form.schema[dimension].ptype,
+        //   num: form.schema[dimension].num,
+        //   projectId: getters.projectId
+        // }
+        var count = []
+        var obj = form.schema[dimension]
+        if(obj.filedKind == 0){
+          count.push(
+            {
+              field:'field',
+              fieldId:form.schema[dimension].field,
+              topN: form.schema[dimension].num,
+            }
+          )
+        }else if(form.schema[dimension].type == 'DateTime'){
+          count.push(
+            {
+              field:form.schema[dimension].field,
+              topN: form.schema[dimension].num,
+              format:form.schema[dimension].expand
+            }
+          )
+        }else{
+          if(['classify'].includes(form.schema[dimension].groupBy)){
+            count.push(
+              {
+                field:form.schema[dimension].expand,
+                topN: form.schema[dimension].num,
+              }
+            )
+          }else{
+            count.push(
+              {
+                field:form.schema[dimension].field,
+                topN: form.schema[dimension].num,
+              }
+            )
+          }
+          
+        }
         let params = {
-          uid: form.uid || '',
-          patentKey: state.patentKey,
-          dimension: dimension,
-          expandId: form.schema[dimension].expand || 0,
-          fieldId: form.schema[dimension].field,
-          type: form.schema[dimension].type,
-          ptype: form.schema[dimension].ptype,
-          num: form.schema[dimension].num,
-          projectId: getters.projectId
+          ...form.search,
+          countVOS:count
         }
         try {
-          const response = await Api.getCustomItemSourceDataList(params)
-          form.source[dimension] = response.data
+          const response = await Api.esCountAnalysis(params)
+          if(response.code == 200){
+            form.source[dimension] = response.data.detailDTOS
+          }else{
+            form.source[dimension] = []
+          }
           switch (dimension) {
             case 'x':
-              form.setting.title1 = getSourceName(form.schema.x.field, form.schema.x.expand, form.schema.x.num)
+              form.setting.title1 = getSourceName(form.schema.x, form.schema.x.expand, form.schema.x.num)
               break
             case 'y':
-              form.setting.title2 = getSourceName(form.schema.y.field, form.schema.y.expand, form.schema.x.num)
+              form.setting.title2 = getSourceName(form.schema.y, form.schema.y.expand, form.schema.x.num)
               break
           }
           dispatch('getItemSettingColor', [])

+ 73 - 62
src/utils/chart.js

@@ -97,69 +97,80 @@ export const getXAxisName = (patentField, fieldId, expandId) => {
 }
 
 export const getSourceName = (fieldId, expandId, num) => {
-  if (fieldId === 25 && expandId === 12) {
-    return '申请年度'
-  }
-  if (fieldId === 25 && expandId === 10) {
-    return '申请季度'
-  }
-  if (fieldId === 25 && expandId === 9) {
-    return '申请月度'
-  }
-  if (fieldId === 25 && expandId === 11) {
-    return '申请半年度'
-  }
-  if (fieldId === 25 && expandId === 13) {
-    return '每2年申请'
-  }
-  if (fieldId === 25 && expandId === 14) {
-    return '每3年申请'
-  }
-  if (fieldId === 25 && expandId === 15) {
-    return '每5年申请'
-  }
-  if (fieldId === 26 && expandId === 12) {
-    return '公开年度'
-  }
-  if (fieldId === 26 && expandId === 10) {
-    return '公开季度'
-  }
-  if (fieldId === 26 && expandId === 9) {
-    return '公开月度'
-  }
-  if (fieldId === 26 && expandId === 11) {
-    return '公开半年度'
-  }
-  if (fieldId === 26 && expandId === 13) {
-    return '每2年公开'
-  }
-  if (fieldId === 26 && expandId === 14) {
-    return '每3年公开'
-  }
-  if (fieldId === 26 && expandId === 15) {
-    return '每5年公开'
-  }
-  if (fieldId === 27 && expandId === 12) {
-    return '授权年度'
-  }
-  if (fieldId === 27 && expandId === 10) {
-    return '授权季度'
-  }
-  if (fieldId === 27 && expandId === 9) {
-    return '授权月度'
-  }
-  if (fieldId === 27 && expandId === 11) {
-    return '授权半年度'
-  }
-  if (fieldId === 27 && expandId === 13) {
-    return '每2年授权'
-  }
-  if (fieldId === 27 && expandId === 14) {
-    return '每3年授权'
-  }
-  if (fieldId === 27 && expandId === 15) {
-    return '每5年授权'
+  if(fieldId.type == 'DateTime'){
+    if(fieldId.field == 'PD' && expandId){
+      return `公开${expandId}度`
+    }
+    if(fieldId.field == 'GD' && expandId){
+      return `授权${expandId}度`
+    }
+    if(fieldId.field == 'AD' && expandId){
+      return `申请${expandId}度`
+    }
   }
+  // if (fieldId === 25 && expandId === 12) {
+  //   return '申请年度'
+  // }
+  // if (fieldId === 25 && expandId === 10) {
+  //   return '申请季度'
+  // }
+  // if (fieldId === 25 && expandId === 9) {
+  //   return '申请月度'
+  // }
+  // if (fieldId === 25 && expandId === 11) {
+  //   return '申请半年度'
+  // }
+  // if (fieldId === 25 && expandId === 13) {
+  //   return '每2年申请'
+  // }
+  // if (fieldId === 25 && expandId === 14) {
+  //   return '每3年申请'
+  // }
+  // if (fieldId === 25 && expandId === 15) {
+  //   return '每5年申请'
+  // }
+  // if (fieldId === 26 && expandId === 12) {
+  //   return '公开年度'
+  // }
+  // if (fieldId === 26 && expandId === 10) {
+  //   return '公开季度'
+  // }
+  // if (fieldId === 26 && expandId === 9) {
+  //   return '公开月度'
+  // }
+  // if (fieldId === 26 && expandId === 11) {
+  //   return '公开半年度'
+  // }
+  // if (fieldId === 26 && expandId === 13) {
+  //   return '每2年公开'
+  // }
+  // if (fieldId === 26 && expandId === 14) {
+  //   return '每3年公开'
+  // }
+  // if (fieldId === 26 && expandId === 15) {
+  //   return '每5年公开'
+  // }
+  // if (fieldId === 27 && expandId === 12) {
+  //   return '授权年度'
+  // }
+  // if (fieldId === 27 && expandId === 10) {
+  //   return '授权季度'
+  // }
+  // if (fieldId === 27 && expandId === 9) {
+  //   return '授权月度'
+  // }
+  // if (fieldId === 27 && expandId === 11) {
+  //   return '授权半年度'
+  // }
+  // if (fieldId === 27 && expandId === 13) {
+  //   return '每2年授权'
+  // }
+  // if (fieldId === 27 && expandId === 14) {
+  //   return '每3年授权'
+  // }
+  // if (fieldId === 27 && expandId === 15) {
+  //   return '每5年授权'
+  // }
   const field = Store.getters.patentField.find(item => item.id === fieldId)
   if (!field) {
     return ''

+ 6 - 0
src/utils/constants.js

@@ -8,6 +8,12 @@ export default {
     { label: '公用', value: 2, class: 'success' },
     { label: '指定专利数据库', value: 1, class: 'danger' },
   ],
+  permissions2: [
+    { label: '系统公用', value: 1, class: 'success' },
+    { label: '系统私用', value: 2, class: 'danger' },
+    { label: '指定专利数据库公用', value: 3, class: 'success' },
+    { label: '指定专利数据库私用', value: 4, class: 'danger' },
+  ],
   patentType: [
     { label: '实用新型', value: 1, class: 'primary' },
     { label: '发明申请', value: 2, class: 'success' },

+ 1 - 1
src/views/analyse/custom/components/Charts/index.vue

@@ -18,7 +18,6 @@ export default {
       type: String,
       default: '500px'
     },
-    form: Object
   },
   data() {
     return {
@@ -34,6 +33,7 @@ export default {
       if (!this.form.setting.type) {
         return false
       }
+      
       this.chartType = this.$constants.chartType.find(item => item.value === this.form.setting.type)
       if (this.chartType.type === 1 && this.form.schema.y.field) {
         return false

+ 346 - 281
src/views/analyse/custom/components/Tabs/DataItem.vue

@@ -2,13 +2,13 @@
   <div class="select-box" v-loading="selectedLoad[dimension]">
     <el-cascader v-model="form.schema[dimension].field" :options="options[dimension]" :props="props" @change="onChange(true, true)" :show-all-levels="false" clearable style="width: 100%"></el-cascader>
     <el-select v-if="expandField[dimension].length" v-model="form.schema[dimension].expand" @change="onChange3(dimension)" placeholder="请选择拓展字段" style="width: 100%;margin-top: 15px;">
-      <el-option v-for="item in expandField[dimension]" :value="item.id" :label="item.name"></el-option>
+      <el-option v-for="item in expandField[dimension]" :value="item.id" :key="item.id" :label="item.name"></el-option>
     </el-select>
     <div>
       <div style="text-align: right;height: 40px;">
         <template v-if="form.schema[dimension].type !== 6">
           <el-button v-if="form.schema[dimension].ptype === 3 || form.schema[dimension].ptype === 4" type="text" @click="handleEdit">编辑</el-button>
-          <template v-else-if="form.schema[dimension].ptype === 1 || form.schema[dimension].ptype === 2">
+          <template v-else>
             <el-dropdown size="medium" @command="handleCommand">
               <el-button type="text" class="el-dropdown-link">
                 <span v-if="form.schema[dimension].num !== allData">{{ form.schema[dimension].ptype === 1 ? `Top` : `最近` }} {{ form.schema[dimension].num }}</span>
@@ -33,7 +33,7 @@
             <template v-if="form.schema[dimension].type !== 6">
               <el-checkbox-group v-model="selected[dimension]">
                 <el-row v-for="item in form.source[dimension]">
-                  <el-checkbox :label="item.name">{{ item.name }}</el-checkbox>
+                  <el-checkbox :label="item.name">{{ item.name }}<span v-if="item.number == 0 || item.number">({{ item.number }})</span></el-checkbox>
                 </el-row>
               </el-checkbox-group>
             </template>
@@ -45,58 +45,103 @@
       </el-container>
     </div>
     <el-dialog title="编辑" :visible.sync="dialogVisible" width="700px" :append-to-body="true"  :close-on-click-modal="false">
-      <div class="sc-form-table">
-        <el-table :data="copyData" border>
-          <el-table-column type="index" width="50" fixed="left">
-            <template slot="header">
-              <el-button type="primary" icon="el-icon-plus" size="mini" circle @click="rowAdd()"></el-button>
-            </template>
-            <template slot-scope="scope">
-              <div class="sc-form-table-handle">
-                <span>{{scope.$index + 1}}</span>
-                <el-button type="danger" icon="el-icon-delete" size="mini" plain circle @click="rowDel(scope.row, scope.$index)"></el-button>
-              </div>
-            </template>
-          </el-table-column>
-          <el-table-column label="名称" align="center" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.name" size="small"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column label="开始" align="center" width="200">
-            <template slot-scope="scope">
-              <div v-if="form.schema[dimension].ptype === 3">
-                <el-select v-model="scope.row.min.operator" size="small" placeholder="" style="width: 60px;">
-                  <el-option :value="0" label=">"></el-option>
-                  <el-option :value="1" label="≥"></el-option>
-                </el-select>
-                <el-input v-model="scope.row.min.value" size="small" style="width: 100px;padding-left: 10px;"></el-input>
-              </div>
-              <div v-else-if="form.schema[dimension].ptype === 4">
-                <el-date-picker v-model="scope.row.startTime" value-format="yyyy-MM-dd" size="small" type="date" placeholder="选择开始日期" style="width: 100%;"></el-date-picker>
-              </div>
-            </template>
-          </el-table-column>
-          <el-table-column label="结束" align="center" width="200">
-            <template slot-scope="scope">
-              <div v-if="form.schema[dimension].ptype === 3">
-                <el-select v-model="scope.row.max.operator" size="small" placeholder="" style="width: 60px;">
-                  <el-option :value="2" label="<"></el-option>
-                  <el-option :value="3" label="≤"></el-option>
-                </el-select>
-                <el-input v-model="scope.row.max.value" size="small" style="width: 100px;padding-left: 10px;"></el-input>
-              </div>
-              <div v-else-if="form.schema[dimension].ptype === 4">
-                <el-date-picker v-model="scope.row.endTime" value-format="yyyy-MM-dd" size="small" type="date" placeholder="选择结束日期" style="width: 100%;"></el-date-picker>
-              </div>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
+      <el-container>
+        <el-header v-if="form.schema[dimension].ptype === 4">
+          <div class="head">
+            <p>
+              <span>最小年份:{{ minDate }}</span>
+              <span>最大年份:{{ maxDate }}</span>
+            </p>
+            <div>
+              <el-popover placement="bottom" title="" ref="popover" width="100" trigger="click">
+                <el-main class="patent-fast-edit-popover">
+                  <div class="btn" @click="quickAdd(0)">清空</div>
+                  <div class="btn" @click="quickAdd(2)">2年</div>
+                  <div class="btn" @click="quickAdd(3)">3年</div>
+                  <div class="btn" @click="quickAdd(4)">5年</div>
+                  <el-divider></el-divider>
+                  <div class="select-number">
+                    <el-input size="mini" type="number" v-model="num" @change="quickAdd(num)"></el-input>
+                    <span>年</span>
+                  </div>
+                </el-main>
+                <el-button type="text" size="small" class="margin-left_10" slot="reference"> 快速添加<i
+                  class="el-icon-arrow-down el-icon--right"></i></el-button>
+            </el-popover>
+
+            </div>
+          </div>
+        </el-header>
+        <el-main class="sc-form-table">
+          <el-table :data="copyData" border>
+            <el-table-column type="index" width="50" >
+              <template slot="header">
+                <el-button type="primary" icon="el-icon-plus" size="mini" circle @click="rowAdd()"></el-button>
+              </template>
+              <template slot-scope="scope">
+                <div>
+                  <!-- <span>{{scope.$index + 1}}</span> -->
+                  <el-button type="danger" icon="el-icon-delete" size="mini" plain circle @click="rowDel(scope.row, scope.$index)"></el-button>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="名称" align="center" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <div v-if="quick">
+                  {{ scope.row.name }}
+                </div>
+                <div v-else>
+                  <el-input v-model="scope.row.name" size="small"></el-input>
+                </div>
+                
+              </template>
+            </el-table-column>
+            <el-table-column label="开始" align="center" width="200">
+              <template slot-scope="scope">
+                <div v-if="quick">
+                  {{ scope.row.startTime }}
+                </div>
+                <div v-else>
+                  <div v-if="form.schema[dimension].ptype === 3">
+                    <el-select v-model="scope.row.min.operator" size="small" placeholder="" style="width: 60px;">
+                      <el-option :value="0" label=">"></el-option>
+                      <el-option :value="1" label="≥"></el-option>
+                    </el-select>
+                    <el-input v-model="scope.row.min.value" size="small" style="width: 100px;padding-left: 10px;"></el-input>
+                  </div>
+                  <div v-else-if="form.schema[dimension].ptype === 4">
+                    <el-date-picker v-model="scope.row.startTime" value-format="yyyy-MM-dd" size="small" type="date" placeholder="选择开始日期" style="width: 100%;"></el-date-picker>
+                  </div>
+                </div>
+                
+              </template>
+            </el-table-column>
+            <el-table-column label="结束" align="center" width="200">
+              <template slot-scope="scope">
+                <div v-if="quick">
+                  {{ scope.row.endTime }}
+                </div>
+                <div v-else>
+                  <div v-if="form.schema[dimension].ptype === 3">
+                    <el-select v-model="scope.row.max.operator" size="small" placeholder="" style="width: 60px;">
+                      <el-option :value="2" label="<"></el-option>
+                      <el-option :value="3" label="≤"></el-option>
+                    </el-select>
+                    <el-input v-model="scope.row.max.value" size="small" style="width: 100px;padding-left: 10px;"></el-input>
+                  </div>
+                  <div v-else-if="form.schema[dimension].ptype === 4">
+                    <el-date-picker v-model="scope.row.endTime" value-format="yyyy-MM-dd" size="small" type="date" placeholder="选择结束日期" style="width: 100%;"></el-date-picker>
+                  </div>
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-main>
+      </el-container>
       <div slot="footer" class="dialog-footer">
         <el-button @click="cancel">取 消</el-button>
         <el-button type="primary" @click="handleConfirm" :loading="loadingBtn">确 定</el-button>
-      </div>
+      </div> 
     </el-dialog>
   </div>
 </template>
@@ -119,7 +164,7 @@ export default {
       parentId: -1,
       props: {
         expandTrigger: 'click',
-        value: 'id',
+        value: 'value',
         label: 'name',
         emitPath: false
       },
@@ -132,22 +177,26 @@ export default {
         y: [],
       },
       typeList: {
-        '90': '分类号',
-        '91': '公司/人',
-        '92': '日期',
-        '93': '区域',
-        '94': '引用/同族',
+        'classify': '分类号',
+        'company': '公司/人',
+        'dateType': '日期',
+        'nation': '区域',
+        'amount': '引用/同族',
         '95': '其他',
         '96': '自定义字段',
       },
       defaultProps: {
         children: 'children',
         label: 'name'
-      }
+      },
+      maxDate:'',
+      minDate:'',
+      quick:false,
+      num:0,
     }
   },
   computed: {
-    ...mapGetters(['projectId', 'userinfo', 'customField', 'patentField'])
+    ...mapGetters([ 'userinfo',  'patentField'])
   },
   watch: {
     selected: {
@@ -163,6 +212,7 @@ export default {
     }
   },
   mounted() {
+    this.initData()
     this.onChange(false, false)
     if (this.form.schema[this.dimension].type === 6) {
       let tree = getTreeDataList(this.form.source[this.dimension], [])
@@ -178,34 +228,136 @@ export default {
     getSourceName() {
       switch (this.dimension) {
         case 'x':
-          this.form.setting.title1 = getSourceName(this.form.schema.x.field, this.form.schema.x.expand, this.form.schema.x.num)
+          this.form.setting.title1 = getSourceName(this.form.schema.x, this.form.schema.x.expand, this.form.schema.x.num)
           break
         case 'y':
-          this.form.setting.title2 = getSourceName(this.form.schema.y.field, this.form.schema.y.expand, this.form.schema.y.num)
+          this.form.setting.title2 = getSourceName(this.form.schema.y, this.form.schema.y.expand, this.form.schema.y.num)
           break
       }
     },
+    initData(){
+      var data = this.patentField
+      for (let i = 0; i < data.length; i++) {
+        if(data[i].groupBy == 'dateType'){
+          data[i].expand = [
+                {
+                    "id": '月',
+                    "name": "月",
+                    "ptype": 2
+                },
+                {
+                    "id": "季",
+                    "name": "季",
+                    "ptype": 2
+                },
+                {
+                    "id": "半年",
+                    "name": "半年",
+                    "ptype": 2
+                },
+                {
+                    "id": "年",
+                    "name": "年",
+                    "ptype": 2
+                },
+                {
+                    "id": "自定义",
+                    "name": "自定义",
+                    "ptype": 4
+                }
+            ]
+        }
+        // 给ipc、cpc、upc、loc添加大小类等
+        if (data[i].groupBy == 'classify') {
+            var special= {
+              MC: [
+                { id: 'IC', name: '部' },
+                { id: 'IC2', name: '大类' },
+                { id: 'IC3', name: '小类' },
+                { id: 'IC4', name: '大组' },
+                { id: 'IC5', name: '小组' },
+              ],
+              CPC: [
+                { id: 'CPC', name: '部' },
+                { id: 'CPC2', name: '大类' },
+                { id: 'CPC3', name: '小类' },
+                { id: 'CPC4', name: '大组' },
+                { id: 'CPC5', name: '小组' },
+              ],
+              UPC: [
+                // { value: '0', label: '分类号' },//老系统有
+                { id: 'UPC', name: '大类' },
+                { id: 'UPC2', name: '小类' },
+              ],
+              LOC: [
+                // { value: '0', label: '分类号' },//老系统有
+                { id: 'LOC', name: '大类' },
+                { id: 'LOC2', name: '小类' },
+              ],
+            }
+            data[i].expand = special[data[i].value]
+          }
+      }
+      this.$store.commit('SET_SYSTEM_FIELD',data)
+    },
     initOptions() {
-      for (let key in this.options) {
-        let data = []
-        for (let type in this.typeList) {
-          let children = {
-            id: type,
-            name: this.typeList[type],
-            children: []
+      let obj = {
+        text: '文本',
+        number: '号码',
+        typeStatus: '类型及状态',
+        classify: '分类',
+        dateType: '日期',
+        company: '公司/人',
+        typeStatus: '类型及状态',
+        address: '地址',
+        nation: '国家/地区',
+        amount: '引用',
+        customField: '自定义字段',
+      }
+      let filedObj = {}
+      let data = this.patentField
+      for (let i = 0; i < data.length; i++) {
+        if (data[i].filedKind == -1) {//专利本身
+          if(['text','number','address'].includes(data[i].groupBy)){
+            continue
+          }
+          if(data[i].groupBy == 'nation'){
+            if(data[i].name.indexOf('县')!=-1 ){
+              continue
+            }
           }
-          if (type === '96') {
-            children.children = this.patentField.filter(item => item.type < 90 || item.type === 96)
+          if (filedObj[data[i].groupBy]) {
+            filedObj[data[i].groupBy].children.push(data[i])
           } else {
-            children.children = this.patentField.filter(item => String(item.type) === type)
+            filedObj[data[i].groupBy] = {
+              value: data[i].groupBy,
+              name: obj[data[i].groupBy],
+              children: [
+                data[i]
+              ],
+            }
+          }
+          
+        } else {//自定义字段
+          if (filedObj.customField) {
+            filedObj.customField.children.push(data[i])
+          } else {
+            filedObj[data[i].group] = {
+              value: 'customField',
+              name: obj.customField,
+              children: [data[i]]
+            }
           }
-          data.push(children)
         }
-        this.$set(this.options, key, data)
+      }
+      var options = Object.values(filedObj)
+      for (let key in this.options) {
+        this.$set(this.options, key, options)
       }
     },
     updateSelected() {
       this.selected[this.dimension] = this.form.source[this.dimension].slice(0, this.form.schema[this.dimension].num).map(item => item.name)
+      // this.$store.commit('SET_CHART_SELECTED', this.selected)
       this.getSourceName()
     },
     async handleCommand(command) {
@@ -214,7 +366,7 @@ export default {
       this.updateSelected()
     },
     async onChange(option, reset) {
-      const field = this.patentField.find(item => item.id === this.form.schema[this.dimension].field)
+      const field = this.patentField.find(item => item.value === this.form.schema[this.dimension].field)
       if (field) {
         this.$set(this.expandField, this.dimension, field.expand || [])
       } else {
@@ -231,18 +383,28 @@ export default {
     },
     getSchemaType() {
       let ptype = 0, type = 0
-      const field = this.patentField.find(item => item.id === this.form.schema[this.dimension].field)
+      const field = this.patentField.find(item => item.value === this.form.schema[this.dimension].field)
       if (field) {
         type = field.type
-        if (field.ptype === 0 && this.form.schema[this.dimension].expand) {
+        if (!field.ptype && this.form.schema[this.dimension].expand) {
           const expand = field.expand.find(item => item.id === this.form.schema[this.dimension].expand)
           ptype = expand.ptype
         } else {
           ptype = field.ptype
+          if (['classify'].includes(field.groupBy)) {
+            ptype = 0
+          }
+          if(['amount'].includes(field.groupBy)){
+            ptype = 3
+          }
         }
+        this.$set(this.form.schema[this.dimension], 'fieldKind', field.filedKind)
+        this.$set(this.form.schema[this.dimension], 'name', field.name)
+        this.$set(this.form.schema[this.dimension], 'groupBy', field.groupBy)
       } else {
         ptype = 0
       }
+     
       this.$set(this.form.schema[this.dimension], 'type', type)
       this.$set(this.form.schema[this.dimension], 'ptype', ptype)
     },
@@ -255,212 +417,57 @@ export default {
       } else {
         this.form.source[dimension] = []
       }
-      if (this.form.source[dimension].length === 0) {
-        switch (this.form.schema[dimension].field) {
-          case 32:
-            this.form.source[dimension] = [{
-              name: '0',
-              min: {
-                operator: 1,
-                value: '0'
-              },
-              max: {
-                operator: 3,
-                value: '0'
-              },
-              selected: true
-            }, {
-              name: '1-5',
-              min: {
-                operator: 1,
-                value: '1'
-              },
-              max: {
-                operator: 3,
-                value: '5'
-              },
-              selected: true
-            }, {
-              name: '6-10',
-              min: {
-                operator: 1,
-                value: '6'
-              },
-              max: {
-                operator: 3,
-                value: '10'
-              },
-              selected: true
-            }, {
-              name: '11-20',
-              min: {
-                operator: 1,
-                value: '11'
-              },
-              max: {
-                operator: 3,
-                value: '20'
-              },
-              selected: true
-            }, {
-              name: '21-30',
-              min: {
-                operator: 1,
-                value: '21'
-              },
-              max: {
-                operator: 3,
-                value: '30'
-              },
-              selected: true
-            }, {
-              name: '30以上',
-              min: {
-                operator: 1,
-                value: '30'
-              },
-              max: {
-                operator: 3,
-                value: '99999'
-              },
-              selected: true
-            }]
-            break
-          case 33:
-            this.form.source[dimension] = [{
-              name: '0',
-              min: {
-                operator: 1,
-                value: '0'
-              },
-              max: {
-                operator: 3,
-                value: '0'
-              },
-              selected: true
-            }, {
-              name: '1-5',
-              min: {
-                operator: 1,
-                value: '1'
-              },
-              max: {
-                operator: 3,
-                value: '5'
-              },
-              selected: true
-            }, {
-              name: '6-10',
-              min: {
-                operator: 1,
-                value: '6'
-              },
-              max: {
-                operator: 3,
-                value: '10'
-              },
-              selected: true
-            }, {
-              name: '11-30',
-              min: {
-                operator: 1,
-                value: '11'
-              },
-              max: {
-                operator: 3,
-                value: '30'
-              },
-              selected: true
-            }, {
-              name: '30以上',
-              min: {
-                operator: 1,
-                value: '30'
-              },
-              max: {
-                operator: 3,
-                value: '99999'
-              },
-              selected: true
-            }]
-            break
-          case 34:
-          case 35:
-          case 55:
-            this.form.source[dimension] = [{
-              name: '1',
-              min: {
-                operator: 1,
-                value: '1'
-              },
-              max: {
-                operator: 3,
-                value: '1'
-              },
-              selected: true
-            }, {
-              name: '2-5',
-              min: {
-                operator: 1,
-                value: '2'
-              },
-              max: {
-                operator: 3,
-                value: '5'
-              },
-              selected: true
-            }, {
-              name: '6-10',
-              min: {
-                operator: 1,
-                value: '6'
-              },
-              max: {
-                operator: 3,
-                value: '10'
-              },
-              selected: true
-            }, {
-              name: '11-20',
-              min: {
-                operator: 1,
-                value: '11'
-              },
-              max: {
-                operator: 3,
-                value: '20'
-              },
-              selected: true
-            }, {
-              name: '20-50',
-              min: {
-                operator: 1,
-                value: '20'
-              },
-              max: {
-                operator: 3,
-                value: '50'
-              },
-              selected: true
-            }, {
-              name: '50以上',
-              min: {
-                operator: 1,
-                value: '50'
-              },
-              max: {
-                operator: 3,
-                value: '99999'
-              },
-              selected: true
-            }]
-            break
-        }
-      }
+
       this.updateSelected()
     },
-    handleEdit() {
+    //快速添加
+    quickAdd(option1){
+      if(option1 == 0){
+        this.copyData = []
+        this.quick = false
+        return false
+      }
+      var min = Number(this.minDate)
+      var max = Number(this.maxDate)
+      var data = []
+     
+      var option = Number(option1)
+      for(var i = max;i>min;i=i-option){
+        var prev = (i-option)<min?min:i-option
+        data.push(
+          {
+            name:`${prev}-${i}`,
+            endTime:i,
+            startTime:prev
+          }
+        )
+      }
+      this.quick = true
+      this.copyData = data
+      this.$refs.popover.doClose()
+    },
+    async handleEdit() {
       this.copyData = JSON.parse(JSON.stringify(this.form.source[this.dimension]))
+      if(this.form.schema[this.dimension].type == 'DateTime'){
+        const field = this.patentField.find(item => item.value === this.form.schema[this.dimension].field)
+        if(field){
+          if(!field.minDate && !field.maxDate){
+            var param = {
+              ...this.form.search,
+              field:field.field
+            }
+            await this.$api.getFieldRange(param).then(response=>{
+              if(response.code == 200){
+                field.maxDate = response.data.maxDate
+                field.minDate = response.data.minDate
+              }
+            })
+          }
+          this.maxDate = field.maxDate
+          this.minDate = field.minDate
+        }
+      }
+      this.quick  = false
       this.dialogVisible = true
     },
     cancel() {
@@ -470,7 +477,11 @@ export default {
       this.validateForm().then(async (response) => {
         this.form.source[this.dimension] = JSON.parse(JSON.stringify(this.copyData))
         let selected = this.selected
-        selected[this.dimension] = this.form.source[this.dimension].map(item => item.name)
+        if(this.form.schema[this.dimension].ptype == 4){
+          selected[this.dimension] = this.form.source[this.dimension].map(item => `${item.startTime}-${item.endTime}`)
+        }else if(this.form.schema[this.dimension].ptype == 3){
+          selected[this.dimension] = this.form.source[this.dimension].map(item => `${item.min.value}-${item.max.value}`)
+        }
         this.$store.commit('SET_CHART_SELECTED', selected)
         this.$store.commit('SET_RELOAD_DATA', true)
         this.dialogVisible = false
@@ -597,3 +608,57 @@ export default {
   }
 }
 </style>
+<style lang="scss" scoped>
+  .head{
+    width: 100%;
+    display:flex;
+    justify-content:space-between;
+    align-items: center;
+  }
+</style>
+<style lang="scss" scoped>
+.patent-fast-edit-popover {
+  padding: 0 !important;
+
+  .btn {
+    color: #000;
+    line-height: 30px;
+    border-radius: 5px;
+    padding-left: 10px;
+    text-align: left;
+    font-size: 14px;
+    cursor: pointer;
+
+    &:hover {
+      background: #adadad;
+      color: #fff;
+    }
+  }
+
+  .disabled {
+    cursor: not-allowed !important;
+  }
+
+  .bottom {
+    text-align: right;
+    color: #1e9fff;
+    line-height: 40px;
+    padding-left: 10px;
+    font-size: 18px;
+  }
+
+  .el-divider--horizontal {
+    margin: 10px 0 !important;
+  }
+
+  .select-number {
+    .el-input {
+      width: 70px;
+    }
+
+    span {
+      padding: 0 3px;
+    }
+  }
+}
+</style>

+ 47 - 27
src/views/analyse/custom/components/Tabs/Item.vue

@@ -1,27 +1,37 @@
 <template>
   <!-- 分析项 -->
-  <div class="custom-analyse-tabs-item">
-    <el-collapse v-model="activeItem2">
-      <el-collapse-item v-for="menu in treeList" :name="menu.id">
-        <template slot="title">
-          <div class="custom-title">
-            <span class="label">{{ menu.name }}</span>
-            <span class="do" v-if="$permission('/workspace/folder/analyticSystem/chartAnalysis/groupModify') && $r(projectId,[1,2])">
-              <i class="el-icon-edit" @click.stop="handleEdit(menu)"></i>
-              <i class="el-icon-delete" @click.stop="handleDelete(menu)"></i>
-            </span>
-          </div>
-        </template>
-        <div v-for="item in menu.children" @click="handleSelect(item.uid)" class="tree-item" :class="{ 'is-active2' : item.uid === form.uid }">
-          <div class="custom-title">
-            <span class="label">{{ item.name }}</span>
-            <span class="do" v-if="$permission('/workspace/folder/analyticSystem/chartAnalysis/groupItemDelete') && $r(projectId,[1,2])">
-              <i class="el-icon-delete" @click.stop="handleDelete(item)"></i>
-            </span>
-          </div>
+  <div class="custom-analyse-tabs-item height_100">
+    <el-container>
+      <el-header>
+        <div class="head">
+          <el-button size="small" type="primary" @click="handleAdd3">添加组</el-button>
         </div>
-      </el-collapse-item>
-    </el-collapse>
+      </el-header>
+      <el-main>
+        <el-collapse v-model="activeItem2">
+          <el-collapse-item v-for="menu in treeList" :key="menu.id" :name="menu.id">
+            <template slot="title">
+              <div class="custom-title">
+                <span class="label">{{ menu.name }}</span>
+                <span class="do">
+                  <i class="el-icon-edit" @click.stop="handleEdit(menu,1)"></i>
+                  <i class="el-icon-delete" @click.stop="handleDelete(menu,1)"></i>
+                </span>
+              </div>
+            </template>
+            <div v-for="item in menu.children" :key="item.uid" @click="handleSelect(item.uid)" class="tree-item" :class="{ 'is-active2' : item.uid === form.uid }">
+              <div class="custom-title">
+                <span class="label">{{ item.name }}</span>
+                <span class="do">
+                  <i class="el-icon-delete" @click.stop="handleDelete(item,2)"></i>
+                </span>
+              </div>
+            </div>
+          </el-collapse-item>
+        </el-collapse>
+      </el-main>
+    </el-container>
+    
   </div>
 </template>
 
@@ -38,19 +48,29 @@ export default {
   mounted() {
   },
   methods: {
-    handleEdit(value) {
-      this.$emit('edit', value)
+    handleEdit(value,type) {
+      this.$emit('edit', value,type)
     },
-    handleDelete(value) {
-      this.$emit('delete', value)
+    handleDelete(value,type) {
+      this.$emit('delete', value,type)
     },
     handleSelect(key) {
       this.$emit('select', key)
-    }
+    },
+    handleAdd3(){
+      this.$emit('handleAdd3')
+    },
   }
 }
 </script>
-
+<style lang="scss" scoped>
+  .head{
+    width: 100%;
+    display: flex;
+    justify-content: flex-end;
+    margin-right:10px;
+  }
+</style>
 <style lang="scss">
 .custom-analyse-tabs-item {
   .el-collapse-item__header {

+ 3 - 2
src/views/analyse/custom/components/Tabs/mixins.js

@@ -2,10 +2,11 @@ import { mapGetters } from "vuex";
 
 export default {
   props: {
-    activeItem: Array
+    activeItem: Array,
+    // treeList:Array
   },
   computed: {
-    ...mapGetters(['userinfo', 'projectId']),
+    ...mapGetters(['userinfo']),
     form() {
       return this.$store.state.chart.form
     },

+ 109 - 0
src/views/analyse/custom/components/dialog/addAnalyseGroup.vue

@@ -0,0 +1,109 @@
+<template>
+  <div>
+    <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" :append-to-body="true"  :close-on-click-modal="false">
+      <el-form v-if="dialogVisible" ref="ruleForm" :model="form2" :rules="rules" label-position="left" label-width="100px">
+        <el-form-item label="所属组" prop="parentId" v-if="form2.type == 2">
+          <el-select v-model="form2.parentId" filterable allow-create placeholder="请选择" style="width: 100%">
+            <el-option v-for="item in treeList" :label="item.name" :key="item.id" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item :label="`${form2.type==2 ? '项目名称' : '组名称'}`" prop="name">
+          <el-input v-model="form2.name" placeholder="请输入"></el-input>
+        </el-form-item>
+        <el-form-item label="显示顺序" prop="sort">
+          <el-input v-model.number="form2.sort" type="number" placeholder="请输入"></el-input>
+        </el-form-item>
+        <el-form-item label="使用权限" prop="permissions" v-if="form2.type">
+          <el-select v-model="form2.permissions" placeholder="请选择" style="width: 100%">
+            <el-option v-for="item in $constants.permissions2" :label="item.label" :key="item.value" :value="item.value"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">关 闭</el-button>
+        <el-button type="primary" @click="handleConfirm" :loading="loadingBtn">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+export default {
+  components: {},
+  props: {
+    projectId:{
+      default:0
+    },
+    treeList:{
+      default:()=>{
+        return []
+      }
+    }
+  },
+  data() {
+    return {
+      title:'',
+      dialogVisible:false,
+      form2:{},
+      loadingBtn:false,
+      rules: {
+        parentId: [
+          {required: true, message: '请选择上级目录', trigger: 'change'},
+        ],
+        name: [
+          {required: true, message: '请输入名称', trigger: 'blur'},
+        ],
+        permissions: [
+          {required: true, message: '请输选择使用权限', trigger: 'change'},
+        ],
+        sort: [
+          {required: true, message: '请输入显示次序', trigger: 'blur'},
+        ],
+      },
+    };
+  },
+  watch: {},
+  computed: {},
+  created() {},
+  mounted() {},
+  methods: {
+    open(title,form){
+      console.log(form)
+      this.title = title
+      this.form2 = form
+      this.dialogVisible = true
+    },
+    handleClose(){
+      this.dialogVisible = false
+    },
+    handleConfirm(){
+      this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.form2.projectId = this.projectId
+          var a = ''
+          var api = ''
+          if(this.form2.id){
+            a = '编辑'
+            api = 'editAnalyseGroup'
+          }else{
+            a = '新增'
+            api = 'addAnalyseGroup'
+          }
+          this.$api[api](this.form2).then(response=>{
+            if(response.code == 200){
+              this.$message.success(a+'成功')
+              this.$emit('save',true)
+              this.handleClose()
+            }
+          }).catch(error=>{
+            this.$message.error(a+'失败')
+          })
+        }
+      })
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 348 - 0
src/views/analyse/custom/index copy.vue

@@ -0,0 +1,348 @@
+<template>
+  <div class="height_100 custom-analyse">
+    <el-container>
+      <el-aside width="350px">
+        <TabItem :active-item="activeItem" :treeList="treeList" @edit="handleEdit" @delete="handleDelete" @select="handleSelect" @handleAdd3="handleAdd3"></TabItem>
+      </el-aside>
+      <el-main>
+        <el-header>
+          <template>
+            <div class="custom-analyse-options">
+                <div>
+                    <el-button type="text" size="small" @click="openDrawer(1)">分析栏位</el-button>
+                    <el-button type="text" size="small" @click="openDrawer(2)">图形配置</el-button>
+                </div>
+                <div>
+                    <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
+                    
+                    <el-dropdown size="small">
+                        <el-button size="small" type="text">
+                        更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
+                        </el-button>
+                        <el-dropdown-menu slot="dropdown">
+                        <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
+                        </el-dropdown-menu>
+                    </el-dropdown>
+                </div>
+            </div>
+          </template>
+        </el-header>
+        <el-main class="custom-analyse-chart-img-box">
+          <div v-if="showChart">
+            <chart ref="chartDom" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
+          </div>
+        </el-main>
+      </el-main>
+    </el-container>
+    <addAnalyseGroup ref="addAnalyseGroup" :projectId="projectId" @save="queryAnalyseGroup"></addAnalyseGroup>
+    <el-drawer
+        :title="title"
+        :visible.sync="drawer"
+        direction="rtl"
+        :before-close="handleClose"
+        size="500px">
+        <div style="width:500px">
+            <component :is='components'></component> 
+        </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+import html2canvas from "html2canvas";
+import { downLoad, findChildren, getTreeLastChildren, getTreeDataList, downLoadBase64 } from "@/utils";
+import { customPage } from "./mixins";
+
+import addAnalyseGroup from './components/dialog/addAnalyseGroup.vue'
+import Chart from "./components/Charts/index.vue";
+import TabItem from "./components/Tabs/Item";
+import TabData from "./components/Tabs/Data";
+import TabStyle from "./components/Tabs/Style";
+export default {
+  components: {
+    addAnalyseGroup,
+    Chart,
+    TabItem,
+    TabData,
+    TabStyle
+  },
+  mixins: [customPage],
+  props: {},
+  data() {
+    return {
+        activeItem:[],
+        // treeList:[],
+        showChart:false,
+        title:'',
+        drawer:false,
+        components:'',
+        saveType: 1,
+    };
+  },
+  watch: {},
+  computed: {
+    ...mapGetters(['userinfo']),
+    search(){
+        var a = this.$route.query.search
+        if(a){
+            a = JSON.parse(a)
+        }
+        return a
+    },
+    projectId(){
+        return this.$route.query.projectId
+    },
+    patentNum(){
+        return this.$route.query.patentNum || 0
+    },
+  },
+  created() {},
+  mounted() {
+    this.init()
+  },
+  methods: {
+    //初始化
+    async init(){
+        await this.queryAnalyseGroup()
+        if(this.treeList && this.treeList.length>0 && this.treeList[0].children.length > 0){
+            this.activeItem=[this.treeList[0].id]
+            this.queryAnalyseDetail = (this.treeList[0].children[0].id)
+        }else{
+            this.handleAdd()
+            this.saveType = 1
+        }
+    },
+    //添加空数据
+    handleAdd() {
+      let table = []
+      for (let i = 0; i < 10; i++) {
+        table.push({
+          min: 0,
+          max: 0,
+          color: null
+        })
+      }
+      let form = {
+        setting: {
+          type: 1,
+          showType: 0,
+          tableType: 0,
+          theme: "customed",
+          titleSize: 14,
+          dataSize: 14,
+          axisSize: 14,
+          dataLabel: false,
+          dataLabel2: false,
+          dataLabel3: false,
+          title1Dir: 0,
+          title1: "",
+          title2: "",
+          dataPosition: "top",
+          fontFamily: "sans-serif",
+          fontFamily2: "sans-serif",
+          fontFamily3: "sans-serif",
+          fontFamily4: "sans-serif",
+          fontWeight: false,
+          fontWeight2: false,
+          nameLocation: "end",
+          nameLocation2: "end",
+          width: "100",
+          height: "650",
+          widthUnit: "%",
+          heightUnit: "px",
+          splitLine: false,
+          splitLine2: false,
+          legend: true,
+          gridTop: "0",
+          gridLeft: "0",
+          gridBottom: "0",
+          gridRight: "0",
+          labelColor: "#000000",
+          legendColor: "#000000",
+          legendLocation: "top",
+          legendFontSize: "13",
+          fontSize: "13",
+          fontSize2: "13",
+          fontColor: "#000000",
+          fontColor2: "#000000",
+          show: true,
+          show2: true,
+          interval: true,
+          interval2: true,
+          rotate: "0",
+          rotate2: "0",
+          paddingTop: 0,
+          paddingBottom: 0,
+          paddingRight: 0,
+          paddingLeft: 0,
+          paddingTop2: 0,
+          paddingLeft2: 0,
+          paddingBottom2: 0,
+          paddingRight2: 0,
+          type2: "scroll",
+          barWidth: "",
+          scatterSize: "0",
+          config: {
+            color: [],
+            line: {
+              name: "",
+              first: "",
+              second: "",
+              operator: 0,
+              enable: false
+            },
+            table: table
+          }
+        },
+        schema: {
+          x: {
+            num: 10
+          },
+          y: {
+            num: 10
+          },
+        },
+        source: {
+          x: [],
+          y: []
+        },
+      }
+    //   this.form = form
+      this.$store.commit('SET_CHART_FORM', form)
+    },
+    //查询分析项详情
+    queryAnalyseDetail(id){
+        var params = {
+            id : id
+        }
+        this.$api.queryAnalyseDetail().then(response=>{
+            if(response.code == 200){
+
+            }
+        })
+    },
+    //查询分析组
+    queryAnalyseGroup(){
+        var params = {
+            projectId:this.projectId,
+        }
+        this.$api.queryAnalyseGroup(params).then(response=>{
+            if(response.code == 200){
+                // this.treeList = response.data
+                this.$store.commit('SET_CHART_TREE', response.data)
+            }
+        }).catch(error=>{
+            this.$store.commit('SET_CHART_TREE', [])
+        })
+    },
+    //添加组
+    handleAdd3(){
+        var form = {
+            type:1,
+            permissions: 2,
+            parentId: 0,
+            sort: this.treeList.length + 1,
+            name: '',
+        }
+        var title = '添加组'
+        this.$refs.addAnalyseGroup.open(title,form)
+    },
+    //编辑组
+    handleEdit(value,type) {
+      var title = '编辑组'
+      var form = { ...value }
+      form.type = type
+      this.$refs.addAnalyseGroup.open(title,form)
+    },
+    //删除组
+    handleDelete(value,type) {
+      this.$confirm('确认删除本条数据吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        var params = {
+            id:value
+        }
+        this.$api.delAnalyseGroup(params).then(response=>{
+            if(response.code == 200){
+                this.$message.success('删除成功'),
+                this.queryAnalyseGroup()
+            }
+        }).catch(error=>{
+            this.$message.error('删除失败')
+        })
+      })
+    },
+    //查看图示
+    handleSelect() {
+      
+    },
+    //0是保存,1是另存为
+    handleAdd1(type){
+
+    },
+    //截图
+    async handleScreenshot() {
+      const canvas = await html2canvas(this.$refs.chartDom.$el)
+      const base64 = canvas.toDataURL('image/jpg')
+      downLoadBase64(base64, '图片.png')
+    },
+    //导出数据
+    async handleExport() {
+    //   const { count, type, xAxis } = this.getExportParams()
+    //   this.$api.exportCustomItem(count, type, xAxis).then(response => {
+    //     downLoad(response, moment().format('YYYYMMDDHHmmss') + '.xls')
+    //   }).catch(error => {
+    //   })
+    },
+    //打开抽屉
+    openDrawer(type){
+        var components = {
+            1:'tabData',
+            2:'tabStyle'
+        }
+        this.title = type == 1?'数据':'样式配置'
+        this.components = components[type]
+        this.drawer = true
+    },
+    //关闭抽屉
+    handleClose(){
+        this.drawer = false
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.custom-analyse {
+  .custom-analyse-chart-img-box {
+    background: #ffffff;
+  }
+  .custom-analyse-chart-title {
+    padding: 20px;
+    span {
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
+  .custom-analyse-options {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    width: 100%;
+    padding: 20px;
+    .number {
+      padding-left: 10px;
+      color: #409EFF;
+    }
+    .text {
+      font-size: 13px;
+      padding-right: 20px;
+    }
+  }
+}
+</style>

+ 282 - 266
src/views/analyse/custom/index.vue

@@ -1,158 +1,99 @@
 <template>
-  <div class="custom-analyse">
+  <div class="height_100 custom-analyse">
     <el-container>
       <el-aside width="350px">
-        <!-- <el-container>
-          <el-header class="custom-analyse-tabs">
-            <el-tabs v-model="activeTab" type="card">
-              <el-tab-pane label="分析项" name="TabItem"></el-tab-pane>
-              <el-tab-pane label="数据" name="TabData"></el-tab-pane>
-              <el-tab-pane label="样式" name="TabStyle"></el-tab-pane>
-              <el-tab-pane label="辅助线" name="TabLine" :disabled="enable.indexOf(form.setting.type) === -1"></el-tab-pane>
-            </el-tabs>
-          </el-header>
-          <el-main class="nopadding"> -->
-            <!-- <component
-                :is="activeTab"
-                :active-item="activeItem"
-                @edit="handleEdit"
-                @delete="handleDelete"
-                @select="handleSelect"
-            ></component> -->
-          <!-- </el-main>
-        </el-container> -->
-        <TabItem :active-item="activeItem" @edit="handleEdit" @delete="handleDelete" @select="handleSelect"></TabItem>
+        <TabItem :active-item="activeItem" :treeList="treeList" @edit="handleEdit" @delete="handleDelete" @select="handleSelect" @handleAdd3="handleAdd3"></TabItem>
       </el-aside>
-      <el-container>
-        <el-header>
+      <el-main>
+        <el-header style="height:45px !important">
           <template>
             <div class="custom-analyse-options">
-              <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
-              <el-button size="small" type="primary" @click="handleAdd3">添加组</el-button>
-              <el-dropdown size="small">
-                <el-button size="small" type="warning">
-                  更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
-                </el-button>
-                <el-dropdown-menu slot="dropdown">
-                  <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
-                  <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
-                  <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
-                  <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
-                </el-dropdown-menu>
-              </el-dropdown>
+                <div>
+                    <el-button type="text" size="small" @click="openDrawer(1)">分析栏位</el-button>
+                    <el-button type="text" size="small" @click="openDrawer(2)">图形配置</el-button>
+                </div>
+                <div>
+                    <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
+                    
+                    <el-dropdown size="small">
+                        <el-button size="small" type="text">
+                        更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
+                        </el-button>
+                        <el-dropdown-menu slot="dropdown">
+                        <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
+                        <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
+                        </el-dropdown-menu>
+                    </el-dropdown>
+                </div>
             </div>
           </template>
         </el-header>
         <el-main class="custom-analyse-chart-img-box">
           <div v-if="showChart">
-            <chart ref="chartDom" :form="from" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
+            <chart ref="chartDom" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
           </div>
         </el-main>
-      </el-container>
+      </el-main>
     </el-container>
-
-    <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" :append-to-body="true"  :close-on-click-modal="false">
-      <el-form v-if="dialogVisible" ref="ruleForm" :model="form2" :rules="rules" label-position="left" label-width="100px">
-        <el-form-item label="所属组" prop="parentId" v-if="form2.type">
-          <el-select v-model="form2.parentId" filterable allow-create placeholder="请选择" style="width: 100%">
-            <el-option v-for="item in treeList" :label="item.name" :key="item.id" :value="item.id"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item :label="`${form2.type ? '项目名称' : '组名称'}`" prop="name">
-          <el-input v-model="form2.name" placeholder="请输入"></el-input>
-        </el-form-item>
-        <el-form-item label="显示顺序" prop="sort">
-          <el-input v-model.number="form2.sort" type="number" placeholder="请输入"></el-input>
-        </el-form-item>
-        <el-form-item label="使用权限" prop="permissions" v-if="form2.type">
-          <el-select v-model="form2.permissions" placeholder="请选择" style="width: 100%">
-            <el-option v-for="item in $constants.permissions" :label="item.label" :key="item.value" :value="item.value"></el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancel">关 闭</el-button>
-        <el-button type="primary" @click="handleConfirm" :loading="loadingBtn">确 定</el-button>
-      </div>
-    </el-dialog>
+    <addAnalyseGroup ref="addAnalyseGroup" :projectId="projectId" :treeList="treeList" @save="getTreeList"></addAnalyseGroup>
     <el-drawer
-        title="图表配置"
+        :title="title"
         :visible.sync="drawer"
         direction="rtl"
         :before-close="handleClose"
         size="500px">
-        <div style="width:500px">
-            <Style :form="form"></Style> 
-        </div>
+            <el-container>
+                <el-main>
+                    <component :is='components'></component> 
+                </el-main>
+                <el-footer class="footer-common">
+                    <el-button @click="handleClose">取 消</el-button>
+                    <el-button type="primary" @click="submit" :loading="loadingBtn">确 定</el-button>
+                </el-footer>
+            </el-container>
+            
     </el-drawer>
   </div>
 </template>
 
 <script>
-import Chart from "./components/Charts/index.vue";
 import { mapGetters } from "vuex";
+import html2canvas from "html2canvas";
 import { downLoad, findChildren, getTreeLastChildren, getTreeDataList, downLoadBase64 } from "@/utils";
+import { detectionChartType, getFormPermissions, getTreeNameByIds, getXAxisName, getSourceName } from "@/utils/chart";
 import { customPage } from "./mixins";
 import moment from "moment";
-import TreeSelect from '@riophae/vue-treeselect'
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { detectionChartType, getFormPermissions, getTreeNameByIds, getXAxisName, getSourceName } from "@/utils/chart";
+import addAnalyseGroup from './components/dialog/addAnalyseGroup.vue'
+import Chart from "./components/Charts/index.vue";
 import TabItem from "./components/Tabs/Item";
 import TabData from "./components/Tabs/Data";
-// import TabLine from "./components/Tabs/Line";
-import html2canvas from "html2canvas";
-
+import TabStyle from "./components/Tabs/Style";
 export default {
   components: {
-    TreeSelect,
+    addAnalyseGroup,
     Chart,
     TabItem,
     TabData,
-    TabStyle,
-    TabLine
+    TabStyle
   },
   mixins: [customPage],
+  props: {},
   data() {
     return {
-      activeTab: 'TabItem',
-      enable: [2, 5, 6, 8, 9, 17],
-      saveType: 0,
-      form2: {},
-      rules: {
-        parentId: [
-          {required: true, message: '请选择上级目录', trigger: 'change'},
-        ],
-        name: [
-          {required: true, message: '请输入名称', trigger: 'blur'},
-        ],
-        permissions: [
-          {required: true, message: '请输选择使用权限', trigger: 'change'},
-        ],
-        sort: [
-          {required: true, message: '请输入显示次序', trigger: 'blur'},
-        ],
-      },
-      showChart: true,
-      showPage: false,
-      loadingBtn2: false,
-      loadingBtn3: false,
-      activeName: '1',
-      activeItem: [],
-      loading: false,
-      loadingBtn: false,
-      title: '',
-      chartTitle: '',
-      dialogVisible: false,
-      loadData: true,
-      drawer: false,
-      tempForm: {
-        name: '',
-        sort: 0
-      },
-      //图形配置
-      form:{}
-    }
+        activeItem:[],
+        // treeList:[],
+        showChart:false,
+        title:'',
+        drawer:false,
+        components:'TabData',
+        saveType: 1,
+        loadingBtn:false,
+        id:null
+    };
   },
+  watch: {},
   computed: {
     ...mapGetters(['userinfo']),
     search(){
@@ -169,11 +110,20 @@ export default {
         return this.$route.query.patentNum || 0
     },
   },
+  created() {},
   mounted() {
-
     this.getData()
   },
   methods: {
+    openDrawer(type){
+        var components = {
+            1:'tabData',
+            2:'tabStyle'
+        }
+        this.title = type == 1?'数据':'样式配置'
+        this.components = components[type]
+        this.drawer = true
+    },
     normalizer(node) {
       if (node.children && !node.children.length) {
         delete node.children;
@@ -184,17 +134,8 @@ export default {
         children: node.children
       };
     },
-    cancel() {
-      this.saveType = 0
-      this.dialogVisible = false
-    },
-    errorPage() {
 
-    },
-    handleClose() {
-      this.saveType = 0
-      this.dialogVisible = false
-    },
+
     reset() {
 
     },
@@ -205,9 +146,10 @@ export default {
           this.handleAdd()
           this.showChart = false
           this.saveType = 1
+          this.openDrawer(1)
         } else {
           this.activeItem = [this.treeList[0].id]
-          await this.handleSelect(this.treeList[0].children[0].uid)
+          await this.handleSelect(this.treeList[0].children[0].id)
         }
         this.showPage = true
 
@@ -218,13 +160,13 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        const response = await this.$api.deleteCustomItem(value.id)
+        const response = await this.$api.delAnalyseGroup({id:value.id})
         this.$message.success('删除成功')
         await this.getTreeList()
         if (this.form.id === value.id) {
           const tree = this.treeList.find(item => item.id === value.parentId)
           if (tree && tree.children.length) {
-            await this.handleSelect(tree.children[tree.children.length - 1].uid)
+            await this.handleSelect(tree.children[tree.children.length - 1].id)
           } else {
             this.handleAdd()
           }
@@ -234,7 +176,7 @@ export default {
     // 获取需要进行的每一个分析项
     async getTreeList() {
       this.loading = true
-      const response = await this.$api.getCustomTree({ projectId: this.projectId })
+      const response = await this.$api.queryAnalyseGroup({ projectId: this.projectId })
       // 获取到的数据存
       this.$store.commit('SET_CHART_TREE', response.data)
       this.setChildren(this.treeList, 'isDisabled')
@@ -273,16 +215,15 @@ export default {
       }
     },
     handleAdd3() {
-      this.title = '添加组'
-      this.form2 = {
-        parentId: 0,
-        name: '',
-        sort: this.treeList.length + 1,
-        type: 0,
-        permissions: 2,
-        projectId: this.projectId
-      }
-      this.dialogVisible = true
+      var form = {
+            type:1,
+            permissions: 2,
+            parentId: 0,
+            sort: this.treeList.length + 1,
+            name: '',
+        }
+        var title = '添加组'
+        this.$refs.addAnalyseGroup.open(title,form)
     },
     async handleScreenshot() {
       const canvas = await html2canvas(this.$refs.chartDom.$el)
@@ -291,33 +232,30 @@ export default {
     },
     async handleAdd1(saveType) {
       this.saveType = saveType
-      this.onChange()
-      this.title = '保存自定义分析'
-      let data = {
-        parentId: null,
-        permissions: 2,
-        name: '',
-        sort: 0
-      }
-      if (this.form.uid) {
-        const response = await this.$api.getCustomItem(this.form.uid)
+    //   this.onChange()
+      var title = '保存自定义分析'
+      let data = {}
+        if(this.saveType == 1){
+
+        }else{
+            data.id = this.id
+        }
+      if (this.id && this.saveType == 0) {
+        const response = await this.$api.queryAnalyseDetail({id:this.id})
         data = response.data
-        this.tempForm.name = data.name
-        this.tempForm.sort = data.sort
       }
-      this.form2 = {
-        id: data.id,
-        parentId: data.parentId,
-        type: 1,
-        permissions: data.permissions,
-        name: data.name,
-        sort: data.sort,
-        setting: this.form.setting,
-        schema: this.form.schema,
-        source: this.form.source,
+      var form2 = {
+        ...data,
+        type:2,
+        // setting: this.form.setting,
+        // schema: this.form.schema,
+        // source: this.form.source,
         projectId: this.projectId
       }
-      this.dialogVisible = true
+      form2.setting = this.form.setting
+      form2.schema = this.form.schema
+      form2.source = this.form.source
+      this.$refs.addAnalyseGroup.open(title,form2)
     },
     handleAdd() {
       let table = []
@@ -329,6 +267,7 @@ export default {
         })
       }
       let form = {
+        search:this.search,
         setting: {
           type: 1,
           showType: 0,
@@ -359,10 +298,10 @@ export default {
           splitLine: false,
           splitLine2: false,
           legend: true,
-          gridTop: "0",
-          gridLeft: "0",
-          gridBottom: "0",
-          gridRight: "0",
+          gridTop: "10",
+          gridLeft: "10",
+          gridBottom: "10",
+          gridRight: "10",
           labelColor: "#000000",
           legendColor: "#000000",
           legendLocation: "top",
@@ -377,10 +316,10 @@ export default {
           interval2: true,
           rotate: "0",
           rotate2: "0",
-          paddingTop: 0,
-          paddingBottom: 0,
-          paddingRight: 0,
-          paddingLeft: 0,
+          paddingTop: 10,
+          paddingBottom: 10,
+          paddingRight: 10,
+          paddingLeft: 10,
           paddingTop2: 0,
           paddingLeft2: 0,
           paddingBottom2: 0,
@@ -402,7 +341,8 @@ export default {
         },
         schema: {
           x: {
-            num: 10
+            num: 10,
+            // field:'PA'
           },
           y: {
             num: 10
@@ -413,13 +353,13 @@ export default {
           y: []
         },
       }
-      this.form = form
       this.$store.commit('SET_CHART_FORM', form)
     },
-    async handleEdit(value) {
-      this.title = '编辑组'
-      this.form2 = { ...value }
-      this.dialogVisible = true
+    handleEdit(value,type) {
+      var title = '编辑组'
+      var form = { ...value }
+      form.type = type
+      this.$refs.addAnalyseGroup.open(title,form)
     },
     getDataCountParams() {
       let source = {
@@ -463,26 +403,112 @@ export default {
     },
     async getDataCount() {
       if (this.reloadData) {
-        const { source, schema } = this.getDataCountParams()
-        let params = {
-          type: this.form.setting.type,
-          schema: schema,
-          source: source,
-          patentKey: this.patentKey,
-          projectId: this.projectId
+        var data = {}
+        var sign = false
+        var count = []
+        var dimensions = []
+        console.log(this.form)
+        if(this.form.schema.x.field && this.form.schema.y.field){
+            sign = true
+            dimensions = ['x','y']
+        }else{
+            sign = false
+            dimensions = ['x']
+            
+        }
+        if (!this.form.setting.type) {
+            if(sign){
+               this.form.setting.type = 2 
+            }else{
+                this.form.setting.type = 1
+            }
+        }else{
+            var chartType = this.$constants.chartType.find(item=>{
+                return item.value == this.form.setting.type
+            }).type
+            if(sign && chartType == 1){
+                this.form.setting.type = 2 
+            }else if(!sign && chartType == 2){
+                this.form.setting.type = 1
+            }
+        }
+        dimensions.forEach(dimension=>{
+            var form = this.form
+            var obj = form.schema[dimension]
+            if(obj.filedKind == 0){
+                count.push(
+                    {
+                        field:'field',
+                        fieldId:form.schema[dimension].field,
+                        topN: form.schema[dimension].num,
+                        values:this.selected[dimension]
+                    }
+                )
+            }else if(form.schema[dimension].type == 'DateTime'){
+                count.push(
+                    {
+                        field:form.schema[dimension].field,
+                        topN: form.schema[dimension].num,
+                        format:form.schema[dimension].expand,
+                        values:this.selected[dimension]
+                    }
+                )
+            }else{
+                if(['classify'].includes(form.schema[dimension].groupBy)){
+                    count.push(
+                    {
+                        field:form.schema[dimension].expand,
+                        topN: form.schema[dimension].num,
+                        values:this.selected[dimension]
+                    }
+                    )
+                }else{
+                    count.push(
+                    {
+                        field:form.schema[dimension].field,
+                        topN: form.schema[dimension].num,
+                        values:this.selected[dimension]
+                    }
+                    )
+                }
+                
+            }
+        })
+        
+        var params = {
+            ...this.form.search,
+            countVOS:count
         }
-        this.loading = true
-        try {
-          const response = await this.$api.getDataCount(params)
-          this.$store.commit('SET_DATA_COUNT', response.data)
-          this.refreshChart()
-          this.$store.commit('SET_RELOAD_DATA', false)
-          this.loading = false
-          this.showChart = true
+        try{
+            const response = await this.$api.esCountAnalysis(params)
+            if(sign){
+                var res = Object.keys(response.data.analyseMap)
+                for(var i = 0;i<res.length;i++){
+                    // var x = this.form.source.x[i]
+                    // data[x.name] = {}
+                    // for(var j = 0;j<this.form.source.y.length;j++){
+                    //     data[x.name][this.form.source.y[j].name] = this.form.source.y[j].number
+                    // }
+                    var analyseMapData = response.data.analyseMap[res[i]]
+                    var obj = {}
+                    for(var j =0 ;j<analyseMapData.length;j++){
+                        obj[analyseMapData[j].name] = analyseMapData[j].number
+                    }
+                    data[res[i]] = obj
+                }
+            }else{
+                for(var i = 0;i<response.data.detailDTOS.length;i++){
+                    data[response.data.detailDTOS[i].name] = response.data.detailDTOS[i].number
+                }
+            }
+            
         } catch (e) {
-          this.loading = false
-          this.showChart = false
+            data = []
         }
+        this.$store.commit('SET_DATA_COUNT', data)
+        this.refreshChart()
+        this.$store.commit('SET_RELOAD_DATA', false)
+        this.showChart = true
       }
     },
     getTreeAllNode(dimension) {
@@ -518,7 +544,7 @@ export default {
       })
       return name.join('/')
     },
-    getExportParams() {
+    getExportParams() { 
       const xAxis = getXAxisName(this.patentField, this.form.schema.x.field, this.form.schema.x.expand)
       let type = this.form.schema.y.field ? 2 : 1
       type = this.form.setting.type === 21 ? 3 : type
@@ -572,14 +598,55 @@ export default {
       return { count, type, xAxis }
     },
     async handleExport() {
-      this.loadingBtn3 = true
-      const { count, type, xAxis } = this.getExportParams()
-      this.$api.exportCustomItem(count, type, xAxis).then(response => {
-        downLoad(response, moment().format('YYYYMMDDHHmmss') + '.xls')
-        this.loadingBtn3 = false
-      }).catch(error => {
-        this.loadingBtn3 = false
-      })
+        if(!this.form.schema.x.field && !this.form.schema.y.field){
+            this.$message.error('请先添加数据')
+            return false
+        }
+        var data = Object.keys(this.count)
+        var head = ''
+        var body = ''
+        if(this.form.schema.x.field && this.form.schema.y.field){
+            head = `<td>${this.form.schema.x.name}</td>`
+            for(var i = 0;i<this.selected.y.length;i++){
+                head = head + `<td>${this.selected.y[i]}</td>`
+            }
+            for(var i = 0;i<data.length;i++){
+                body = body + `<tr><td>${data[i]}</td>`
+                for(var j = 0;j<this.selected.y.length;j++){
+                    body = body + `<td>${this.count[data[i]][this.selected.y[j]]}</td>`
+                }
+                body = body + '</tr>'
+            }
+        }else{
+            head = `<td>${this.form.schema.x.name}</td><td>数量</td>`
+            for(var i = 0;i<data.length;i++){
+                body = body + `<tr><td>${data[i]}</td><td>${this.count[data[i]]}</td></tr>`
+            }
+        }
+        if(!head && !body){
+            this.$message.error('导出失败,请重试')
+            return false
+        }
+        // return false
+        // Worksheet名
+        const worksheet = 'Sheet1'
+        const uri = 'data:application/vnd.ms-excel;base64,'
+
+        // 下载的表格模板数据
+        const template = `<html xmlns:o="urn:schemas-microsoft-com:office:office"
+          xmlns:x="urn:schemas-microsoft-com:office:excel"
+          xmlns="http://www.w3.org/TR/REC-html40">
+          <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
+          <x:Name>${worksheet}</x:Name>
+          <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
+          </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
+          </head><body><table><tr>${head}</tr>${body}</table></body></html>`
+        // 下载模板
+        let link = document.createElement('a')
+        link.setAttribute('href', uri + window.btoa(unescape(encodeURIComponent(template))))
+        link.setAttribute('download', moment().format('YYYYMMDDHHmmss') + '.xls')
+        link.click()
+        link = null
     },
     resetChartType() {
       this.form.setting.type = null
@@ -606,15 +673,14 @@ export default {
       if (op && cg) {
         this.resetChartType()
       }
-      if (!this.form.setting.type) {
-        this.$message.error('请选择图表类型')
-        return false
-      }
-      await this.getDataCount()
+      
+      this.getDataCount()
       this.refreshChart()
       this.showChart = true
+      this.handleClose()
     },
     async handleSelect(key) {
+        this.id = ley
       let source = {
         x: [],
         y: []
@@ -622,7 +688,7 @@ export default {
       this.$store.commit('SET_RELOAD_DATA', true)
       this.activeName = '1'
       this.loading = true
-      const response = await this.$api.getCustomItem(key)
+      const response = await this.$api.queryAnalyseDetail({id:key})
       this.$store.commit('SET_CHART_FORM', JSON.parse(JSON.stringify(response.data)))
       if (this.enable.indexOf(this.form.setting.type) === -1) {
         this.form.setting.config.line.enable = false
@@ -656,66 +722,12 @@ export default {
         this.loading = false
       })
     },
-    handleConfirm() {
-      this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          this.loadingBtn = true
-          let form = JSON.parse(JSON.stringify(this.form2))
-          for (let key in form.schema) {
-            form.schema[key].field = form.schema[key].field || 0
-            form.schema[key].expand = form.schema[key].expand || 0
-            if (form.schema[key].type === 6) {
-              form.source[key] = this.treeKey[key].map(item => { return { name: item, selected: true } })
-            }
-          }
-          try {
-            let response
-            if (typeof form.parentId === 'string') {
-              form.parentName = form.parentId
-              form.parentId = undefined
-            }
-            if (form.type) {
-              form.permissions = getFormPermissions(form)
-            }
-            if (!this.saveType && form.id) {
-              response = await this.$api.editCustomItem(form)
-              this.$message.success('编辑成功')
-            } else {
-              form.id = null
-              response = await this.$api.addCustomItem(form)
-              this.activeItem.push(response.data.parentId)
-              this.$message.success('添加成功')
-              if (form.type) {
-                await this.handleSelect(response.data.uid)
-              }
-            }
-            if (form.type) {
-              this.chartTitle = response.data.name
-            }
-            await this.getTreeList()
-            this.loadingBtn = false
-            this.handleClose()
-          } catch (e) {
-            this.loadingBtn = false
-          }
-        } else {
-          // console.log('error submit!!');
-          return false;
-        }
-      });
-    },
+
   }
-}
+};
 </script>
-
-<style lang="scss">
+<style lang="scss" scoped>
 .custom-analyse {
-  .custom-analyse-tabs {
-    .el-tabs__header {
-      margin-top: 35px !important;
-      margin-left: 22px;
-    }
-  }
   .custom-analyse-chart-img-box {
     background: #ffffff;
   }
@@ -727,6 +739,10 @@ export default {
     }
   }
   .custom-analyse-options {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    width: 100%;
     padding: 20px;
     .number {
       padding-left: 10px;

+ 708 - 0
src/views/analyse/custom/index1.vue

@@ -0,0 +1,708 @@
+<template>
+  <div class="custom-analyse">
+    <el-container>
+      <el-aside width="350px">
+        <!-- <el-container>
+          <el-header class="custom-analyse-tabs">
+            <el-tabs v-model="activeTab" type="card">
+              <el-tab-pane label="分析项" name="TabItem"></el-tab-pane>
+              <el-tab-pane label="数据" name="TabData"></el-tab-pane>
+              <el-tab-pane label="样式" name="TabStyle"></el-tab-pane>
+              <el-tab-pane label="辅助线" name="TabLine" :disabled="enable.indexOf(form.setting.type) === -1"></el-tab-pane>
+            </el-tabs>
+          </el-header>
+          <el-main class="nopadding"> -->
+            <!-- <component
+                :is="activeTab"
+                :active-item="activeItem"
+                @edit="handleEdit"
+                @delete="handleDelete"
+                @select="handleSelect"
+            ></component> -->
+          <!-- </el-main>
+        </el-container> -->
+        <TabItem :active-item="activeItem" @edit="handleEdit" @delete="handleDelete" @select="handleSelect"></TabItem>
+      </el-aside>
+      <el-container>
+        <el-header>
+          <template>
+            <div class="custom-analyse-options">
+              <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
+              <el-button size="small" type="primary" @click="handleAdd3">添加组</el-button>
+              <el-dropdown size="small">
+                <el-button size="small" type="warning">
+                  更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
+                </el-button>
+                <el-dropdown-menu slot="dropdown">
+                  <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
+                  <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
+                  <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
+                  <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
+            </div>
+          </template>
+        </el-header>
+        <el-main class="custom-analyse-chart-img-box">
+          <div v-if="showChart">
+            <chart ref="chartDom" :form="from" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
+          </div>
+        </el-main>
+      </el-container>
+    </el-container>
+
+    <addAnalyseGroup ref="addAnalyseGroup" :projectId="projectId" @save="queryAnalyseGroup"></addAnalyseGroup>
+    <el-drawer
+        title="图表配置"
+        :visible.sync="drawer"
+        direction="rtl"
+        :before-close="handleClose"
+        size="500px">
+        <div style="width:500px">
+          <component :is='components'></component> 
+        </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import Chart from "./components/Charts/index.vue";
+import { mapGetters } from "vuex";
+import { downLoad, findChildren, getTreeLastChildren, getTreeDataList, downLoadBase64 } from "@/utils";
+import { customPage } from "./mixins";
+import moment from "moment";
+import TreeSelect from '@riophae/vue-treeselect'
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { detectionChartType, getFormPermissions, getTreeNameByIds, getXAxisName, getSourceName } from "@/utils/chart";
+import TabItem from "./components/Tabs/Item";
+import TabData from "./components/Tabs/Data";
+// import TabLine from "./components/Tabs/Line";
+import html2canvas from "html2canvas";
+import addAnalyseGroup from './components/dialog/addAnalyseGroup.vue'
+export default {
+  components: {
+    TreeSelect,
+    Chart,
+    TabItem,
+    TabData,
+    TabStyle,
+    TabLine,
+    addAnalyseGroup
+  },
+  mixins: [customPage],
+  data() {
+    return {
+      components:'',
+      activeTab: 'TabItem',
+      enable: [2, 5, 6, 8, 9, 17],
+      saveType: 0,
+      form2: {},
+      rules: {
+        parentId: [
+          {required: true, message: '请选择上级目录', trigger: 'change'},
+        ],
+        name: [
+          {required: true, message: '请输入名称', trigger: 'blur'},
+        ],
+        permissions: [
+          {required: true, message: '请输选择使用权限', trigger: 'change'},
+        ],
+        sort: [
+          {required: true, message: '请输入显示次序', trigger: 'blur'},
+        ],
+      },
+      showChart: true,
+      showPage: false,
+      loadingBtn2: false,
+      loadingBtn3: false,
+      activeName: '1',
+      activeItem: [],
+      loading: false,
+      loadingBtn: false,
+      title: '',
+      chartTitle: '',
+      dialogVisible: false,
+      loadData: true,
+      drawer: false,
+      tempForm: {
+        name: '',
+        sort: 0
+      },
+    }
+  },
+  computed: {
+    ...mapGetters(['userinfo']),
+    search(){
+        var a = this.$route.query.search
+        if(a){
+            a = JSON.parse(a)
+        }
+        return a
+    },
+    projectId(){
+        return this.$route.query.projectId
+    },
+    patentNum(){
+        return this.$route.query.patentNum || 0
+    },
+  },
+  mounted() {
+    this.getData()
+  },
+  methods: {
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.name,
+        children: node.children
+      };
+    },
+
+
+    reset() {
+
+    },
+    // 获取???
+    async getData() {
+        await this.getTreeList()
+        if (this.treeList.length === 0 || this.treeList[0].children.length === 0) {
+          this.handleAdd()
+          this.showChart = false
+          this.saveType = 1
+        } else {
+          this.activeItem = [this.treeList[0].id]
+          await this.handleSelect(this.treeList[0].children[0].uid)
+        }
+        this.showPage = true
+
+    },
+    handleDelete(value) {
+      this.$confirm('确认删除本条数据吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const response = await this.$api.deleteCustomItem(value.id)
+        this.$message.success('删除成功')
+        await this.getTreeList()
+        if (this.form.id === value.id) {
+          const tree = this.treeList.find(item => item.id === value.parentId)
+          if (tree && tree.children.length) {
+            await this.handleSelect(tree.children[tree.children.length - 1].uid)
+          } else {
+            this.handleAdd()
+          }
+        }
+      })
+    },
+    // 获取需要进行的每一个分析项
+    async getTreeList() {
+      this.loading = true
+      const response = await this.$api.getCustomTree({ projectId: this.projectId })
+      // 获取到的数据存
+      this.$store.commit('SET_CHART_TREE', response.data)
+      this.setChildren(this.treeList, 'isDisabled')
+      this.loading = false
+    },
+    handleClose() {
+      this.drawer = false
+    },
+    setChildren(arr, key) {
+      arr.forEach(item => {
+        if (item.children && item.children.length) {
+          this.setChildren(item.children, key)
+        } else {
+          this.$set(item, key, item.type === 1)
+        }
+      })
+    },
+    refreshChart() {
+      this.$nextTick(() => {
+        let chartDom = this.$refs.chartDom
+        if (chartDom) {
+          chartDom.refreshChart()
+        }
+      })
+    },
+    onChange() {
+      if (this.saveType || !this.form2.id) {
+        this.form2.name = getSourceName(this.form.schema.x.field, this.form.schema.x.expand, this.form.schema.x.num)
+        const tree = this.treeList.find(item => item.id === this.form2.parentId)
+        if (tree) {
+          this.form2.sort = tree.children.length + 1
+        }
+      } else {
+        this.form2.name = this.tempForm.name
+        this.form2.sort = this.tempForm.sort
+      }
+    },
+    handleAdd3() {
+      var form = {
+            type:1,
+            permissions: 2,
+            parentId: 0,
+            sort: this.treeList.length + 1,
+            name: '',
+        }
+        var title = '添加组'
+        this.$refs.addAnalyseGroup.open(title,form)
+    },
+    async handleScreenshot() {
+      const canvas = await html2canvas(this.$refs.chartDom.$el)
+      const base64 = canvas.toDataURL('image/jpg')
+      downLoadBase64(base64, '图片.png')
+    },
+    async handleAdd1(saveType) {
+      this.saveType = saveType
+      this.onChange()
+      this.title = '保存自定义分析'
+      let data = {
+        parentId: null,
+        permissions: 2,
+        name: '',
+        sort: 0
+      }
+      if (this.form.uid) {
+        const response = await this.$api.getCustomItem(this.form.uid)
+        data = response.data
+        this.tempForm.name = data.name
+        this.tempForm.sort = data.sort
+      }
+      this.form2 = {
+        id: data.id,
+        parentId: data.parentId,
+        type: 1,
+        permissions: data.permissions,
+        name: data.name,
+        sort: data.sort,
+        setting: this.form.setting,
+        schema: this.form.schema,
+        source: this.form.source,
+        projectId: this.projectId
+      }
+      this.dialogVisible = true
+    },
+    handleAdd() {
+      let table = []
+      for (let i = 0; i < 10; i++) {
+        table.push({
+          min: 0,
+          max: 0,
+          color: null
+        })
+      }
+      let form = {
+        setting: {
+          type: 1,
+          showType: 0,
+          tableType: 0,
+          theme: "customed",
+          titleSize: 14,
+          dataSize: 14,
+          axisSize: 14,
+          dataLabel: false,
+          dataLabel2: false,
+          dataLabel3: false,
+          title1Dir: 0,
+          title1: "",
+          title2: "",
+          dataPosition: "top",
+          fontFamily: "sans-serif",
+          fontFamily2: "sans-serif",
+          fontFamily3: "sans-serif",
+          fontFamily4: "sans-serif",
+          fontWeight: false,
+          fontWeight2: false,
+          nameLocation: "end",
+          nameLocation2: "end",
+          width: "100",
+          height: "650",
+          widthUnit: "%",
+          heightUnit: "px",
+          splitLine: false,
+          splitLine2: false,
+          legend: true,
+          gridTop: "0",
+          gridLeft: "0",
+          gridBottom: "0",
+          gridRight: "0",
+          labelColor: "#000000",
+          legendColor: "#000000",
+          legendLocation: "top",
+          legendFontSize: "13",
+          fontSize: "13",
+          fontSize2: "13",
+          fontColor: "#000000",
+          fontColor2: "#000000",
+          show: true,
+          show2: true,
+          interval: true,
+          interval2: true,
+          rotate: "0",
+          rotate2: "0",
+          paddingTop: 0,
+          paddingBottom: 0,
+          paddingRight: 0,
+          paddingLeft: 0,
+          paddingTop2: 0,
+          paddingLeft2: 0,
+          paddingBottom2: 0,
+          paddingRight2: 0,
+          type2: "scroll",
+          barWidth: "",
+          scatterSize: "0",
+          config: {
+            color: [],
+            line: {
+              name: "",
+              first: "",
+              second: "",
+              operator: 0,
+              enable: false
+            },
+            table: table
+          }
+        },
+        schema: {
+          x: {
+            num: 10
+          },
+          y: {
+            num: 10
+          },
+        },
+        source: {
+          x: [],
+          y: []
+        },
+      }
+      this.form = form
+      this.$store.commit('SET_CHART_FORM', form)
+    },
+    handleEdit(value,type) {
+      var title = '编辑组'
+      var form = { ...value }
+      form.type = type
+      this.$refs.addAnalyseGroup.open(title,form)
+    },
+    getDataCountParams() {
+      let source = {
+        x: [],
+        y: [],
+      }
+      let schema = {
+        x: {},
+        y: {}
+      }
+      let merge = {
+        x: 0,
+        y: 0
+      }
+      Object.keys(source).forEach(dimension => {
+        if (this.form.schema[dimension].type === 6) {
+          if (this.form.setting.type === 20) {
+            source[dimension] = this.getTreeAllNode(dimension)
+            merge[dimension] = 1
+          } else if (this.form.setting.type === 30) {
+            source[dimension] = this.getTreeLastChildren(dimension)
+          } else {
+            source[dimension] = this.getPatentTreeChildren(dimension)
+            merge[dimension] = 1
+          }
+        } else {
+          source[dimension] = this.form.source[dimension].filter(item => item.selected)
+        }
+      })
+      Object.keys(schema).forEach(dimension => {
+        schema[dimension] = {
+          expand: this.form.schema[dimension].expand || 0,
+          field: this.form.schema[dimension].field || 0,
+          num: this.form.schema[dimension].num,
+          type: this.form.schema[dimension].type,
+          ptype: this.form.schema[dimension].ptype,
+          merge: merge[dimension]
+        }
+      })
+      return { source, schema }
+    },
+    async getDataCount() {
+      if (this.reloadData) {
+        const { source, schema } = this.getDataCountParams()
+        let params = {
+          type: this.form.setting.type,
+          schema: schema,
+          source: source,
+          patentKey: this.patentKey,
+          projectId: this.projectId
+        }
+        this.loading = true
+        try {
+          const response = await this.$api.getDataCount(params)
+          this.$store.commit('SET_DATA_COUNT', response.data)
+          this.refreshChart()
+          this.$store.commit('SET_RELOAD_DATA', false)
+          this.loading = false
+          this.showChart = true
+        } catch (e) {
+          this.loading = false
+          this.showChart = false
+        }
+      }
+    },
+    getTreeAllNode(dimension) {
+      const tree = getTreeDataList(this.form.source[dimension], [])
+      return tree.map(item => { return { id : item.id } })
+    },
+    getTreeLastChildren(dimension) {
+      const tree = getTreeDataList(this.form.source[dimension], [])
+      const data = tree.filter(item => this.treeKey[dimension].indexOf(item.id) !== -1)
+      let arr = data.filter(item =>  !item.children || !item.children.length)
+      data.map(item => arr.push(...getTreeLastChildren(item.children || [], [])))
+      return arr.map(item => { return { id : item.id } })
+    },
+    getPatentTreeChildren(dimension) {
+      const tree = getTreeDataList(this.form.source[dimension], [])
+      const selected = this.treeKey[dimension].map(item => item)
+      let arr = []
+      selected.map(item => {
+        const node = tree.find(t => t.id === item)
+        arr.push(node)
+        arr.push(...getTreeLastChildren(node.children || [], []))
+      })
+      return arr.map(item => { return { id : item.id } })
+    },
+    getTreeNodeName(node, tree) {
+      const path = node.path.split('/').map(p => parseInt(p, 0))
+      let name = []
+      path.map(item => {
+        const n = tree.find(x => x.id === item)
+        if (n) {
+          name.push(n.name)
+        }
+      })
+      return name.join('/')
+    },
+    getExportParams() { 
+      const xAxis = getXAxisName(this.patentField, this.form.schema.x.field, this.form.schema.x.expand)
+      let type = this.form.schema.y.field ? 2 : 1
+      type = this.form.setting.type === 21 ? 3 : type
+      let count = JSON.parse(JSON.stringify(this.count))
+      const xt = this.form.schema.x.type === 6
+      const yt = this.form.schema.y.type === 6
+      const xs = getTreeDataList(this.form.source.x, [])
+      const ys = getTreeDataList(this.form.source.y, [])
+      if (xt && !yt) {
+        for (let key in count) {
+          const xn = xs.find(item => item.id === parseInt(key))
+          const name = this.getTreeNodeName(xn, xs)
+          if (xn) {
+            count[name] = count[key]
+            delete count[key]
+          }
+        }
+      }
+      if (xt && yt) {
+        for (let xk in count) {
+          const xn = xs.find(item => item.id === parseInt(xk))
+          const xa = this.getTreeNodeName(xn, xs)
+          let data = {}
+          for (let yk in count[xk]) {
+            const yn = ys.find(item => item.id === parseInt(yk))
+            const ya = this.getTreeNodeName(yn, ys)
+            if (yn) {
+              data[ya] = count[xk][yk]
+            }
+          }
+          if (xn) {
+            count[xa] = data
+            delete count[xk]
+          }
+        }
+      }
+      if (!xt && yt) {
+        for (let key in count) {
+          let data = {}
+          for (let y in count[key]) {
+            const yn = ys.find(item => item.id === parseInt(y))
+            const ya = this.getTreeNodeName(yn, ys)
+            if (yn) {
+              data[ya] = count[key][y]
+              delete count[y]
+            }
+          }
+          count[key] = data
+        }
+      }
+      return { count, type, xAxis }
+    },
+    async handleExport() {
+      this.loadingBtn3 = true
+      const { count, type, xAxis } = this.getExportParams()
+      this.$api.exportCustomItem(count, type, xAxis).then(response => {
+        downLoad(response, moment().format('YYYYMMDDHHmmss') + '.xls')
+        this.loadingBtn3 = false
+      }).catch(error => {
+        this.loadingBtn3 = false
+      })
+    },
+    resetChartType() {
+      this.form.setting.type = null
+      this.$store.dispatch('resetSettingColor')
+    },
+    async submit() {
+      if (!this.form.schema.x.field) {
+        this.$message.error('请选择一维数据')
+        return false
+      }else{
+        if(this.form.source.x.length == 0){
+          this.$message.error('一维数据为空')
+          return false
+        }
+      }
+      if(this.form.schema.y.field){
+        if(this.form.source.y.length == 0){
+          this.$message.error('二维数据为空')
+          return false
+        }
+      }
+      const chartType = this.$constants.chartType.find(c => c.value === this.form.setting.type)
+      const { op, cg } = detectionChartType(chartType || {}, this.form)
+      if (op && cg) {
+        this.resetChartType()
+      }
+      if (!this.form.setting.type) {
+        this.$message.error('请选择图表类型')
+        return false
+      }
+      await this.getDataCount()
+      this.refreshChart()
+      this.showChart = true
+    },
+    async handleSelect(key) {
+      let source = {
+        x: [],
+        y: []
+      }
+      this.$store.commit('SET_RELOAD_DATA', true)
+      this.activeName = '1'
+      this.loading = true
+      const response = await this.$api.getCustomItem(key)
+      this.$store.commit('SET_CHART_FORM', JSON.parse(JSON.stringify(response.data)))
+      if (this.enable.indexOf(this.form.setting.type) === -1) {
+        this.form.setting.config.line.enable = false
+      }
+      for (let key in response.data.source) {
+        source[key] = response.data.source[key]
+        if (response.data.source[key].length === 0 || response.data.schema[key].type === 6) {
+          await this.$store.dispatch('getSourceDataList', key)
+          if (response.data.setting.title1) {
+            this.form.setting.title1 = response.data.setting.title1
+          }
+          if (response.data.setting.title2) {
+            this.form.setting.title2 = response.data.setting.title2
+          }
+        }
+      }
+      for (let key in response.data.schema) {
+        if (this.form.schema[key].type !== 6) {
+          this.$set(this.selected, key, this.form.source[key].slice(0, response.data.schema[key].num).map(item => item.name))
+          this.form.source[key].map(item => {
+            item.selected = this.selected[key].indexOf(item.name) !== -1
+          })
+        } else {
+          this.treeKey[key] = source[key].map(item => parseInt(item.name))
+          this.selected[key] = getTreeNameByIds(this.form.source[key], this.treeKey[key])
+        }
+      }
+      await this.$store.dispatch('getItemSettingColor', [])
+      await this.getDataCount()
+      this.$nextTick(() => {
+        this.loading = false
+      })
+    },
+    handleConfirm() {
+      this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loadingBtn = true
+          let form = JSON.parse(JSON.stringify(this.form2))
+          for (let key in form.schema) {
+            form.schema[key].field = form.schema[key].field || 0
+            form.schema[key].expand = form.schema[key].expand || 0
+            if (form.schema[key].type === 6) {
+              form.source[key] = this.treeKey[key].map(item => { return { name: item, selected: true } })
+            }
+          }
+          try {
+            let response
+            if (typeof form.parentId === 'string') {
+              form.parentName = form.parentId
+              form.parentId = undefined
+            }
+            if (form.type) {
+              form.permissions = getFormPermissions(form)
+            }
+            if (!this.saveType && form.id) {
+              response = await this.$api.editCustomItem(form)
+              this.$message.success('编辑成功')
+            } else {
+              form.id = null
+              response = await this.$api.addCustomItem(form)
+              this.activeItem.push(response.data.parentId)
+              this.$message.success('添加成功')
+              if (form.type) {
+                await this.handleSelect(response.data.uid)
+              }
+            }
+            if (form.type) {
+              this.chartTitle = response.data.name
+            }
+            await this.getTreeList()
+            this.loadingBtn = false
+            this.handleClose()
+          } catch (e) {
+            this.loadingBtn = false
+          }
+        } else {
+          // console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+  }
+}
+</script>
+
+<style lang="scss">
+.custom-analyse {
+  .custom-analyse-tabs {
+    .el-tabs__header {
+      margin-top: 35px !important;
+      margin-left: 22px;
+    }
+  }
+  .custom-analyse-chart-img-box {
+    background: #ffffff;
+  }
+  .custom-analyse-chart-title {
+    padding: 20px;
+    span {
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
+  .custom-analyse-options {
+    padding: 20px;
+    .number {
+      padding-left: 10px;
+      color: #409EFF;
+    }
+    .text {
+      font-size: 13px;
+      padding-right: 20px;
+    }
+  }
+}
+</style>

+ 17 - 16
src/views/analyse/custom/mixins.js

@@ -6,9 +6,9 @@ import html2canvas from 'html2canvas'
 
 export const customPage = {
   computed: {
-    // form() {
-    //   return this.$store.state.chart.form
-    // },
+    form() {
+      return this.$store.state.chart.form
+    },
     changeNum() {
       return this.$store.state.chart.changeNum
     },
@@ -38,13 +38,7 @@ export const customPage = {
     }
   },
   watch:{
-    patentKey(val){
-      if (val) {
-        this.getPatentListNum()
-      } else {
-        this.errorPage()
-      }
-    }
+
   },
   methods: {
     getShowLabel(dict, value) {
@@ -219,16 +213,17 @@ export const chartOption = {
       let temp = JSON.parse(JSON.stringify(this.selected.x))
       let data = []
       let t, y, m
+     
       temp.map(item => {
         switch (this.form.schema.x.expand) {
-          case 9:
-          case 12:
+          case '月':
+          case '年':
             data.push({
               name: item,
               time: new Date(item).getTime()
             })
             break
-          case 10:
+          case '季':
             t = item.split('-')
             y = t[0]
             m = (parseInt(t[1].replaceAll('Q', '')) - 1) * 3 + 1
@@ -237,7 +232,7 @@ export const chartOption = {
               time: new Date(y + '-' + m).getTime()
             })
             break
-          case 11:
+          case '半年':
             t = item.split('-')
             y = t[0]
             m = parseInt(t[1].replaceAll('H', '')) * 6
@@ -248,7 +243,7 @@ export const chartOption = {
             break
           case 13:
           case 14:
-          case 15:
+          case '自定义':
             t = item.split('-')
             y = t[0]
             data.push({
@@ -283,6 +278,9 @@ export const chartOption = {
         splitLine: {
           show: this.form.setting.splitLine2
         },
+        axisLine:{
+          show:this.form.setting.show2
+        },
         axisLabel: this.getAxisLabel('value', 'y')
       }
       let series = [{
@@ -347,6 +345,9 @@ export const chartOption = {
         splitLine: {
           show: this.form.setting.splitLine2
         },
+        axisLine:{
+          show:this.form.setting.show2
+        },
         axisLabel: this.getAxisLabel('value', 'y')
       }]
       let legend = [...this.selected.y]
@@ -429,7 +430,7 @@ export const chartOption = {
       const chartDom = document.getElementById(id);
       const myChart = this.$echarts.init(chartDom);
       myChart.setOption(chartOption)
-      this.$store.commit('SET_MY_CHART', myChart)
+      // this.$store.commit('SET_MY_CHART', myChart)
       return myChart
     },
   }

+ 5 - 2
src/views/product/components/framework/index.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 架构 -->
-  <div>
-    <viewIndex style="height: 100%;" :name="row.name" :id="row.id" :categoryId="row.categoryId" :type="row.type"></viewIndex>
+  <div class="height_100">
+    <viewIndex style="height: 100%;" :name="row.name" :id="row.id" :categoryId="row.categoryId" :type="row.type" :projectId="projectId"></viewIndex>
   </div>
 </template>
 
@@ -21,6 +21,9 @@ export default {
     row() {
       return JSON.parse(this.$route.query.row)
     },
+    projectId(){
+      return this.$route.query.projectId
+    }
   },
   mounted() {
     

+ 31 - 7
src/views/product/components/framework/viewIndex.vue

@@ -65,6 +65,9 @@
         </el-aside>
         <el-container>
           <el-main>
+            <div v-if="getPathName()">
+              <p>所属架构:{{ getPathName() }}</p>
+            </div>
             <component :is="componentType" :tableData="tableData" :queryParams="queryParams" @option="handleOption"
               @on-sort="handleSort">
             </component>
@@ -95,7 +98,10 @@ export default {
     },//产品名称或者是产品类别名称
     id: {},//产品id或者是产品类别id
     categoryId: {},//产品类别Id
-    type: {}//类型1是产品类别,2是产品
+    type: {},//类型1是产品类别,2是产品
+    projectId:{
+      default:null
+    }
   },
   components: {
     frameworkTable,
@@ -154,14 +160,13 @@ export default {
       }
     }
   },
-  mounted() {
+  async mounted() {
+    // 请求架构路径
+    this.getPath()
     // 请求数据(左侧tree)
-    this.getList()
+    await this.getList(true)
     // 请求列表的数据(右侧table)
     this.getTableList()
-    // 请求架构路径
-    this.getPath()
-
 
   },
   methods: {
@@ -320,15 +325,22 @@ export default {
       this.getTableList()
     },
     // 请求数据(tree)
-    async getList() {
+    async getList(type) {
       let params = {
         name: this.productName,//事件名称
         type: this.row.type,//类型:1产品类别,2产品,3技术分类,4自定义树
         typeId: this.row.id,//产品或类别id
+        projectId:this.projectId
       }
       await this.$api.queryTreeNodeTree(params).then(res => {
         if (res.code == 200) {
           this.treeData = res.data.data
+          if(type){
+            if(this.treeData.length>0){
+              this.parentId = this.treeData[0].parentId
+            }
+          }
+          
         }
       }).catch(err => {
         this.$message.error(err.message)
@@ -402,6 +414,18 @@ export default {
         this.$message.error(err.message)
       })
     },
+    getPathName(){
+      var obj = this.treeDataPath.find(item=>{
+        return item.id == this.parentId
+      })
+      if(obj){
+        if(obj.pathName == '/'){
+          return ''
+        }
+        return obj.pathName
+      }
+      return ''
+    },
     // 请求架构路径
     getPath() {
       let params = {

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

@@ -431,6 +431,7 @@ export default {
           break
       }
     },
+    
     otherFiles(row){
 
     },
@@ -458,7 +459,20 @@ export default {
     },
     //架构
     framework(row){
-
+      var form = {
+        // name:row.name,
+        // id:row.id,
+        // categoryId:row.categoryId,
+        // type:val,
+      }
+      let router = this.$router.resolve({
+        path: '/frameworkIndex',
+        query: {
+          row: JSON.stringify(form),
+          projectId:row.id
+        }
+      })
+      window.open(router.href, '_blank')
     },
     //专利导入
     patentImport(row,type){

+ 1 - 0
src/views/project/patentCollection/index.vue

@@ -601,6 +601,7 @@ export default {
         searchQuery: this.searchStr || '',//检索条件
         customFields: this.customFields || [],
         orderDTOList: this.sort,//排序信息
+        projectId:this.projectId
       }
       const router = this.$router.resolve({
         path: '/customChart',

+ 4 - 6
src/views/project/patentDetails/components/patentMessage/PatentBasic.vue

@@ -26,7 +26,7 @@
               </el-link>
             </td>
           </tr>
-          <tr>
+          <tr v-if="!outside"> 
             <td width="80"><span  class="patent-basic-label">标签:</span></td>
             <td>
               <div class="patent-label">
@@ -202,14 +202,12 @@ export default {
       });
     },
     handleSubmitLabel() {
+      console.log(this.patent.label)
       let data = {
         projectId: this.projectId,
-        patentId: this.patent.id,
-        type: 96,
-        field: '54-0',
-        selected: this.patent.label.map(item => item.name)
+        patentNo:this.patent.patentNo,
       }
-      this.$api.updatePatentLabel(data).then(response => {
+      this.$api.addPatentLabel(data).then(response => {
         this.$message.success('操作成功')
       }).catch(error => {
       })

+ 16 - 0
src/views/report/components/dialog/exportReport.vue

@@ -62,6 +62,7 @@
 </template>
 
 <script>
+import { downLoad2 } from "@/utils";
 export default {
   components: {},
   props: {},
@@ -129,6 +130,21 @@ export default {
     },
     submitExport(){
         this.loadingTemplate = true
+        var params = {
+            templeId:this.templateId,
+            projectId:this.projectId
+        }
+        this.$api.exportReport(params).then(response=>{
+            if(response.code == 200){
+                this.loadingTemplate = false
+                downLoad2(response.data.data)
+                this.$message.success('导出成功')
+                this.close()
+            }
+        }).catch(error=>{
+            this.loadingTemplate = false
+            this.$message.error('导出失败')
+        })
     },
   },
 };

+ 1 - 0
src/views/report/components/patentList/components/customFields/index.vue

@@ -380,6 +380,7 @@ export default {
         }
 
       }
+      this.$store.commit('SET_SYSTEM_FIELD',this.filedAll)
     },
 
     // 获取显示的统计栏位