zhuhao 1 년 전
부모
커밋
c3f07637ae

+ 90 - 1
src/utils/model/retrieval/search.vue

@@ -84,6 +84,12 @@ export default {
       default: () => {
         return {};
       },
+    },
+    projectId: {
+      default:null
+    },
+    taskId: {
+      default:null
     }
   },
   data() {
@@ -92,16 +98,21 @@ export default {
       label: '',
       value: null,
       field: {},
-      searchOptions: []
+      searchOptions: [],
+      innerChange:false
     };
   },
   watch: {
     SearchFields() {
+      if (this.innerChange) {
+        return
+      }
       this.getLabel()
     },
     searchValue: {
       deep: true,
       handler(n, o) {
+        console.log(this.SearchFields);
         if (!this.inner) {
           this.getSearchOptions()
         } else {
@@ -199,6 +210,84 @@ export default {
         return item.value == val
       })
       this.getValue()
+      this.getOption()
+    },
+
+    //获取选项
+    getOption() {
+      if (this.field.type == '3') {
+        if (this.field.options && this.field.options.length > 0) {
+          return false
+        }
+        switch (this.field.group) {
+          case 'customField':
+            this.getCustomField()
+            break;
+          case 'product':
+            this.queryProductCategory(2)
+            break;
+          case 'productCategory':
+            this.queryProductCategory(1)
+            break;
+          case 'technical':
+            this.queryProductCategory(3)
+            break;
+          case 'nos':
+            break;
+          default:
+            break
+        }
+      } else {
+        return false
+      }
+    },
+    //获取自定义选项
+    getCustomField() {
+      if (this.field.type == 'tree') {
+        this.queryProductCategory(4)
+        return false
+      }
+      let params = {
+        customFieldId: this.field.value,
+      }
+      this.innerChange = true
+      this.$api.queryCustomOption(params).then(response => {
+        if (response.code == 200) {
+          var a = response.data.data.map(item => {
+            return {
+              label: item.name,
+              value: item.id
+            }
+          })
+          this.$set(this.field, 'options', a)
+          this.$nextTick(() => {
+            this.innerChange = false
+          })
+          
+        }
+      }).catch(error => {
+        // this.field.options = []
+      })
+    },
+    //获取产品或产品类别架构以及技术分类
+    queryProductCategory(type) {
+      let params = {
+        projectId: this.projectId,
+        taskId: this.taskId,
+        type: type,//类型:1产品类别,2产品,3技术分类,4自定义树
+        typeId: this.field.value,//产品或类别id
+      }
+      this.innerChange = true
+      this.$api.queryTreeNodeTree(params).then(res => {
+        if (res.code == 200) {
+          this.$set(this.field, 'options', response.data.data)
+          this.$nextTick(() => {
+            this.innerChange = false
+          })
+        }
+      }).catch(err => {
+        
+      })
     },
     getValue() {
       if (this.field.type == 3) {

+ 9 - 3
src/views/components/dialog/fields.vue

@@ -46,7 +46,7 @@ export default {
     taskId: {
       default: null,
     },
-    filed: {
+    sign: {
       type:Boolean,
       default: false,
     },
@@ -115,10 +115,16 @@ export default {
         taskId: this.taskId,
       }
       let apiItem = this.projectId ? 'setTableColumns' : 'setCustomField'
-      if (this.filed) {
-        apiItem='setShowCountColumns'
+      // sign为true时是统计栏位
+      if (this.sign) {
+        apiItem = 'setShowCountColumns'
+        params.value = this.filedList.filter(item => {
+          return item.ifHidden == false
+        })
       }
       this.loading = true
+      console.log(params, apiItem);
+      console.log(apiItem);
       this.$api[apiItem](params).then((response) => {
         if (response.code == 200) {
           this.loading = false

+ 153 - 11
src/views/report/components/patentList/components/customFields.vue

@@ -7,15 +7,24 @@
         </el-tabs>
       </el-header>
       <el-main>
-        <component :is="activeNameTabs" :projectId="projectId" :taskId="taskId"></component>
+        <component :is="activeNameTabs" :projectId="projectId" :taskId="taskId" :field="field" :fieldTree="fieldTree"
+          @collapseChange="handleCollapse" @search="handleSearch">
+          <div slot="footerBtn">
+            <el-button type="primary" size="small" @click="handleMore">更多过滤项</el-button>
+          </div>
+        </component>
       </el-main>
     </el-container>
+
+    <fieldsVue ref="fieldsVue" type="patent" :projectId="projectId" :taskId="taskId" :sign="true"
+      @getFieldList="getFieldList"></fieldsVue>
   </div>
 </template>
 
 <script>
 import queryPage from './tab1.vue'
 import selectPage from './tab2.vue'
+import fieldsVue from '@/views/components/dialog/fields.vue'
 export default {
   props: {
     projectId: {
@@ -28,34 +37,167 @@ export default {
   components: {
     queryPage,
     selectPage,
+    fieldsVue,
   },
   data() {
     return {
       activeNameTabs: 'queryPage',
-      menu:[
+      menu: [
         {
-          label:'查询筛选',
-          path:'queryPage'
+          label: '查询筛选',
+          path: 'queryPage'
         },
         {
-          label:'分类选择',
-          path:'selectPage'
+          label: '分类选择',
+          path: 'selectPage'
         },
       ],
+      // 存放数据
+      field: [],
+      fieldTree: [],
+      // 勾选的数据
+      valObj: {
+        valueOne: '',
+        valueTwo: '',
+      },
+      // 总数据
+      customFields: [],
+      // 是否重新创建dom
+      ifShow: true,
+      // 所有的统计栏位
+      filedAll: [],
     }
   },
   watch: {
 
   },
-  mounted() {
-
+  async mounted() {
+    // 获取显示的统计栏位
+    await this.getShowCountColumns()
+    // 获取所有统计栏位的数据
+    this.getAllCountColumns()
   },
   methods: {
-    
-    handleClickTab(tab, event) {
-      // this.activeNameTabs = tab.name
+    // 点击面板中的搜索
+    handleSearch({ row, }) {
+      this.getShowCountColumns(row)
+      this.getAllCountColumns(row)
+    },
+    // 点击当前面板
+    async handleCollapse({ row, sign}) {
+      if (row.filedKind == -1) {//专利著录//调用专利著录的统计接口?
+
+      } else if (row.filedKind == 0) {//调用查询自定义字段选项
+        await this.queryCustomOption(row ,sign)
+        this.$nextTick(() => {
+          this.esCountSearch(row)
+        })
+      } else {
+
+      }
     },
+    // 查询自定义栏位选项数据
+    async queryCustomOption(row,sign) {
+      let params = {
+        customFieldId: row.value,
+      }
+      await this.$api.queryCustomOption(params).then(response => {
+        if (response.code == 200) {
+          if (sign == 'check') {
+            this.$set(row, 'options', response.data.data)
+          } else {
+            this.$set(row, 'child', response.data.data)
+          }
+          this.$set(row,'check',[])
+        }
+      }).catch(error => {
 
+      })
+    },
+    // 获取统计数字
+    esCountSearch(val,sign) {
+      let params = [{
+        field: 'field',
+        fieldId: val.value,
+        valueOne: this.valObj.valueOne || '',
+        valueTwo: this.valObj.valueTwo || '',
+      }]
+      this.$api.esCountSearch(params).then(response => {
+        if (response.code == 200) {
+          this.$set(val, 'nums', response.data.detailDTOS)
+          this.refresh()
+        }
+      }).catch(error => {
+        this.$set(val, 'nums', [])
+      })
+    },
+    // 获取所有的统计栏位
+    getAllCountColumns() {
+      let params = {
+        projectId: this.projectId,
+        taskId: this.taskId,
+      }
+      this.$api.getAllCountColumns(params).then(res => {
+        if (res.code == 200) {
+          this.handleFiled(res.data.data)
+        }
+      })
+    },
+    // 给数据添加ifHidden
+    handleFiled(data) {
+      for (var i = 0; i < data.length; i++) {
+        data[i].ifHidden = true
+        if (data[i].filedKind != -1 && data[i].filedKind != 0) {
+          continue;
+        }
+        for (var j = 0; j < this.field.length; j++) {
+          if (data[i].name == this.field[j].name && data[i].filedKind == this.field[j].filedKind) {
+            data[i].ifHidden = false
+            break;
+          }
+        }
+      }
+      // 查询筛选:只展示非树类型
+      this.filedAll = data.filter(item => {
+        if (item.filedKind == -1 || (item.filedKind == 0 && item.type != 'tree')) {
+          return item
+        }
+      })
+      // 分类选择:获取树类型
+      this.fieldTree = data.filter(item2 => {
+        if ([7, 8, 9].includes(item2.filedKind) || (item2.filedKind == 0 && item2.type == 'tree')) {
+          return item2
+        }
+      })
+    },
+    // 获取显示的统计栏位
+    async getShowCountColumns() {
+      let params = {
+        projectId: this.projectId,
+        taskId: this.taskId,
+      }
+      await this.$api.getShowCountColumns(params).then(res => {
+        if (res.code == 200) {
+          //filedKind-1专利著录 0自定义字段 7产品 8产品类别 9技术分类
+          var data = res.data.data
+          // 查询筛选:获取非树类型
+          this.field = data.filter(item => {
+            if (item.filedKind == -1 || (item.filedKind == 0 && item.type != 'tree')) {
+              return item
+            }
+          })
+        }
+      })
+    },
+    // 过滤组件传的值
+    getFieldList(val) {
+      this.getShowCountColumns()
+      this.getAllCountColumns()
+    },
+    // 更多过滤项
+    handleMore() {
+      this.$refs.fieldsVue.open(this.filedAll)
+    },
   }
 }
 </script>

+ 32 - 11
src/views/report/components/patentList/components/index.vue

@@ -15,6 +15,7 @@
               </div>
               <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
               </mySearch>
+              <!-- <searchPopover :SearchFields="searchFiled" @search="search" :searchValue="searchOption"></searchPopover> -->
             </div>
             <el-button v-if="taskId" type="primary" size="small" @click="handleFieldManage">显示栏位管理</el-button>
             <div v-else style="display:flex;align-items:center">
@@ -61,7 +62,7 @@
       </div>
     </div>
 
-    <field ref="field" type="patentProject" :projectId="projectId" :taskId="taskId" @getFieldList="getFieldList"></field>
+    <field ref="field" type="patent" :projectId="projectId" :taskId="taskId" @getFieldList="getFieldList"></field>
   </div>
 </template>
 
@@ -69,6 +70,7 @@
 import field from '@/views/components/dialog/fields.vue';
 import PatentTableListView from '@/views/project/patentCollection/components/views/Table.vue'
 import customFields from './customFields.vue';
+import searchPopover from './searchPopover.vue'
 export default {
   props: {
     taskId: {
@@ -94,6 +96,7 @@ export default {
     PatentTableListView,
     field,
     customFields,
+    searchPopover,
   },
   data() {
     return {
@@ -174,11 +177,11 @@ export default {
       // }
 
     },
-    //获取table栏位及分组字段、检索字段
+    //获取检索字段
     async getColumn() {
       let params = [{
         tableName: 'patent',
-        projectId:this.projectId,
+        projectId: this.projectId,
       }]
       await this.$api.getQueryFields(params).then(res => {
         if (res.code == 200) {
@@ -186,33 +189,51 @@ export default {
           // 搜索字段
           let searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
             label: 'name',
-            value: 'value',
+            value: 'field',
             type: 'type',
+            group: 'group',
+            fieldType:'fieldType'
           })
-          this.searchFiled= searchFiled.filter(item => {
+          // 处理自定义栏位筛选
+          this.searchFiled = searchFiled.filter(item => {
             return item.type != 'tree'
           })
         }
       })
     },
+
     // 搜索
     search(val) {
       let params = {}
       val.forEach(item => {
-        if (item.type == 3) {
-          params[item.value] = item.searchValue.map(itemValue => {
-            return itemValue.value
-          })
+        console.log(item)
+        if (item.group != 'nos') {
+          this.customFields = []
+          var obj = {
+            fieldId: item.value,
+            fieldType: item.fieldType,
+            value:item.type=='3'?item.searchValue.map(id=>id.value):[item.searchValue.label]
+          }
+          this.customFields.push(obj)
         } else {
-          params[item.value] = item.searchValue.label
+          if (item.type == 3) {
+            params[item.value] = item.searchValue.map(itemValue => {
+              return itemValue.value
+            })
+          } else {
+            params[item.value] = item.searchValue.label
+          }
         }
+        
       })
-      // 返回字符串
       this.searchOption = params
       // 调用查询接口
       this.queryParams.current = 1
       this.getList()
     },
+    handleCustom(){
+      
+    },
     //获取专利列表
     getList() {
       let params = {

+ 132 - 0
src/views/report/components/patentList/components/searchPopover.vue

@@ -0,0 +1,132 @@
+<template>
+  <div>
+    <template v-if="searchOptions.length > 0">
+      <el-popover placement="bottom" title="" width="300" trigger="hover" class="margin-left_10">
+        <div class="main">
+          <div v-for="(item, index) in searchOptions" :key="item.value" class="box">
+            <el-alert type="success" :closable="false">
+              <div class="content">
+                <span class="color-black">{{ item.label }}</span>
+                <b class="padding_0_5">=</b>
+                <span class="color-black">
+                  <span v-if="item.type == 3">
+                    <span class="padding_0_5">(</span>
+                    <span v-for="(data, i) in item.searchValue" :key="data.label">
+                      <span class="query-data-label" @click="handleCancelQueryParams(item, index, i)">{{ data.label }}<i
+                          class="el-icon-close"></i></span>
+                      <b v-if="item.searchValue.length - 1 > i" class="padding_0_5 color-primary">OR</b>
+                    </span>
+                    <span class="padding_0_5">)</span>
+                  </span>
+                  <span v-else>
+                    <span class="query-data-label" @click="handleCancelQueryParams(item, index)">{{ item.searchValue.label
+                    }}<i class="el-icon-close"></i></span>
+                  </span>
+                </span>
+              </div>
+            </el-alert>
+          </div>
+        </div>
+        <el-button slot="reference" size="small" type="primary" style="width:100%">
+          检索条件<i class="el-icon-arrow-down el-icon--right"></i>
+        </el-button>
+      </el-popover>
+    </template>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    searchValue: {
+      default: () => {
+        return {};
+      },
+    },
+    SearchFields: {
+      default: () => {
+        return [];
+      },
+    },
+  },
+  data() {
+    return {
+      searchOptions: [],
+      inner: false,
+    }
+  },
+  watch: {
+    SearchFields() {
+      // if (this.innerChange) {
+      //   return
+      // }
+      // this.getLabel()
+    },
+    searchValue: {
+      deep: true,
+      handler(n, o) {
+        console.log(n, this.searchValue, this.searchOptions);
+        if (!this.inner) {
+          this.getSearchOptions()
+        } else {
+          this.inner = false
+        }
+
+      }
+    }
+  },
+  mounted() {
+    this.getSearchOptions()
+  },
+  methods: {
+    getSearchOptions() {
+      this.searchOptions = []
+      if (Object.keys(this.searchValue).length > 0) {
+        Object.keys(this.searchValue).forEach(key => {
+          if (this.searchValue[key] || (typeof this.searchValue[key] == 'object' && this.searchValue[key].length > 0)) {
+            var field = this.SearchFields.find(item => {
+              return item.value == key
+            })
+            if (!field) {
+              return false
+            }
+            if (typeof this.searchValue[key] == 'object') {
+              this.searchOptions.push(
+                {
+                  ...field,
+                  searchValue: field.options.filter(item => {
+                    return this.searchValue[key].indexOf(item.value) != -1
+                  })
+                }
+              )
+            } else {
+              this.searchOptions.push(
+                {
+                  ...field,
+                  searchValue: {
+                    label: this.searchValue[key]
+                  }
+                }
+              )
+            }
+          }
+        })
+      }
+    },
+    handleCancelQueryParams(data, index, i) {
+      this.inner = true
+      if (data.type == 3) {
+        data.searchValue.splice(i, 1)
+        if (data.searchValue.length == 0) {
+          this.searchOptions.splice(index, 1)
+        }
+      } else {
+        this.searchOptions.splice(index, 1)
+      }
+      this.$emit('search', this.searchOptions)
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 83 - 192
src/views/report/components/patentList/components/tab1.vue

@@ -4,175 +4,94 @@
       <el-main class="" style="overflow-y: auto;">
         <template>
           <el-collapse v-model="activeNames" style="margin: 0px 5px 0px 5px;">
-            <el-collapse-item v-for="item in field" :title="item.name" :name="item.id" :key="item.id" :loading="loading"
-              @click.native="handleChange(item)">
 
+            <el-collapse-item v-for="item in field" :title="item.name" :name="item.value" :key="item.value"
+              @click.native.stop="handleChange(item)">
 
-              <div style="display:flex;margin-bottom: 10px;">
-                <div v-if="[1].includes(item.type)" class="year-data-picker">
-                  <el-date-picker clear-icon size="small" type="year" v-model="valObj.valueOne" value-format="yyyy"
-                    placeholder="请选择时间"></el-date-picker>
-                  <span style="margin: 5px;">至</span>
-                  <el-date-picker clear-icon size="small" type="year" v-model="valObj.valueTwo" value-format="yyyy"
-                    placeholder="请选择时间"></el-date-picker>
+              <div @click.stop="handleStop">
+                <div style="display:flex;margin-bottom: 10px;">
+                  <div v-if="[1].includes(item.type)" class="year-data-picker">
+                    <el-date-picker clear-icon size="small" type="year" value-format="yyyy"
+                      placeholder="请选择时间"></el-date-picker>
+                    <span style="margin: 5px;">至</span>
+                    <el-date-picker clear-icon size="small" type="year" value-format="yyyy"
+                      placeholder="请选择时间"></el-date-picker>
+                  </div>
+                  <template v-if="![4, 5].includes(item.type)">
+                    <el-input size="small" placeholder="请输入查询内容"></el-input>
+                    <el-button @click.stop="handleSearch(item)" size="small" type="primary" class="margin-left_10"
+                      icon="el-icon-search" circle></el-button>
+                  </template>
                 </div>
-                <template v-if="![4, 5].includes(item.type)">
-                  <el-input size="small" v-model="valObj.valueOne" placeholder="请输入查询内容"></el-input>
-                  <el-button @click.stop="handleSearch(item)" size="small" type="primary" class="margin-left_10"
-                    icon="el-icon-search" circle></el-button>
-                </template>
-              </div>
-              <el-checkbox-group v-model="valObj[item.id]" @change.stop="onChange($event, item.id)">
-                <div class="source-checkbox" v-if="ifShow">
-                  <el-checkbox v-for="source in item.options" :label="source.id" :key="source.id">
-                    <span class="source-checkbox-label" :title="source.name">{{ source.name }}</span>
-                    <span class="source-checkbox-count">({{ getCount(item, source.id) }})</span>
-                  </el-checkbox>
-                </div>
-              </el-checkbox-group>
+                <el-checkbox-group v-model="item.check" @change.stop="onChange($event, item)">
+                  <div class="source-checkbox" v-if="ifShow">
+                    <el-checkbox v-for="source in item.options" :label="source.id" :key="source.id">
+                      <span class="source-checkbox-label" :title="source.name">{{ source.name }}</span>
+                      <span class="source-checkbox-count">({{ getCount(item, source.id) }})</span>
+                    </el-checkbox>
+                  </div>
+                </el-checkbox-group>
 
-              <div class="patent-query-filter-search-bottom">
-                <el-button type="success" size="small" @click.stop="handleSelectAll(item)">全选</el-button>
-                <el-button type="danger" size="small" @click.stop="handleSelectCancel(item)">取消</el-button>
+                <div class="patent-query-filter-search-bottom">
+                  <el-button type="success" size="small" @click.stop="handleSelectAll(item)">全选</el-button>
+                  <el-button type="danger" size="small" @click.stop="handleSelectCancel(item)">取消</el-button>
+                </div>
               </div>
-
             </el-collapse-item>
           </el-collapse>
         </template>
       </el-main>
       <el-footer style="display: flex;align-items: center;justify-content: end;">
-        <el-button type="primary" size="small" @click="handleMore">更多过滤项</el-button>
+        <slot name="footerBtn"></slot>
+
       </el-footer>
     </el-container>
 
-    <fieldsVue ref="fieldsVue" type="" :projectId="projectId" :taskId="taskId" :filed="true" @getFieldList="getFieldList">
-    </fieldsVue>
   </div>
 </template>
 
 <script>
-import fieldsVue from '@/views/components/dialog/fields.vue'
 export default {
-  props: ['projectId', 'taskId'],
+  props: {
+    field: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    checkArr: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+  },
   components: {
-    fieldsVue
+
   },
   data() {
     return {
-      // 控制折叠面板
       activeNames: [],
-      // 存放数据
-      field: [],
-      loading: false,
-      // 勾选的数据
-      valObj: {
-        check: [],
-        valueOne: '',
-        valueTwo: '',
-      },
-      // 分页信息
-      queryParams: {
-        current: 1,
-        size: 10,
-      },
-      total: 0,
-      // 总数据
-      customFields: [],
-      // 是否重新创建dom
       ifShow: true,
-      filedAll:[],
+    }
+  },
+  watch: {
+    field: {
+      handler() {
+        this.ifShow = false
+        this.$nextTick(() => {
+          this.ifShow = true
+        })
+      },
+      deep: true
     }
   },
   mounted() {
-    // 获取自定义字段的栏位数据
-    this.getList()
-    // 获取显示的统计栏位
-    this.getShowCountColumns()
-    // 获取所有统计栏位的数据
-    this.getAllCountColumns()
+
   },
   methods: {
-    // 获取所有的统计栏位
-    getAllCountColumns() {
-      let params = {
-        projectId:this.projectId,
-        taskId:this.taskId,
-      }
-      this.$api.getAllCountColumns(params).then(res => {
-        if (res.code == 200) {
-          
-        }
-      })
-    },
-    // 获取显示的统计栏位
-    getShowCountColumns() {
-      let params = {
-        projectId:this.projectId,
-        taskId:this.taskId,
-      }
-      this.$api.getShowCountColumns(params).then(res => {
-        if (res.code == 200) {
-          
-        }
-      })
-    },
-    // 过滤组件传的值
-    getFieldList(val) {
-      this.filed = this.filed.concat(data)
-    },
-    // 更多过滤项
-    handleMore() {
-      this.$refs.handleMore.open(this.filedAll)
-    },
-    // 全选
-    handleSelectAll(val) {
-      this.valObj[val.id] = val.options.map(item => {
-        return item.id
-      })
-      // this.valObj[val.id]=[8]
-      // console.log(check);
-      // this.valObj.check[val.id] = JSON.parse(JSON.stringify(check))
-      // this.valObj.check[val.id] = check
-      this.$set(this.valObj, val.id, 8)
-      console.log(this.valObj);
-    },
-    // 取消
-    handleSelectCancel(val) {
-      this.valObj.check[val.id] = []
-    },
-    // 查询自定义栏位数据
-    getList() {
-      var params = {
-        ...this.queryParams,
-        searchQuery: `projectId=${this.projectId}`,
-        orderDTOList: [],
-      }
-      this.loading = true
-      this.$api.queryCustomField(params).then(response => {
-        if (response.code == 200) {
-          this.field = response.data.data.filter(item => {
-            return item.type != 6
-          })
-          this.loading = false
-        }
-      }).catch(error => {
-        this.loading = false
-      })
-    },
-    // 查询自定义栏位选项数据
-    async queryCustomOption(row) {
-      let params = {
-        customFieldId: row.id,
-      }
-      await this.$api.queryCustomOption(params).then(response => {
-        if (response.code == 200) {
-          this.$set(row, 'options', response.data.data)
-        }
-      }).catch(error => {
-
-      })
-    },
-    // 处理树类型的文件数字
+    handleStop(){},   
+    // 处理专利文件数字
     getCount(field, value) {
       var num = 0
       if (field.nums) {
@@ -185,65 +104,37 @@ export default {
         return num
       }
     },
-    refresh() {
-      this.$set(this, 'ifShow', false)
-      this.$nextTick(() => {
-        this.$set(this, 'ifShow', true)
-      })
-    },
-    // 点击当前的折叠面板
-    async handleChange(val) {
-      this.$set(this.valObj, val.id, [])
-      await this.queryCustomOption(val)
-      this.$nextTick(() => {
-        this.esCountSearch(val)
-      })
+    // 点击面板
+    handleChange(row) {
+      console.log(row);
+      this.$emit('collapseChange', { row: row, sign: 'check' })
     },
     // 点击折叠面板中的搜索
     handleSearch(val) {
-      // this.queryCustomOption(val)
-      this.esCountSearch(val)
-    },
-    // 获取统计数字
-    esCountSearch(val) {
-      let params = [{
-        field: 'field',
-        fieldId: val.id,
-        valueOne: this.valObj.valueOne || '',
-        valueTwo: this.valObj.valueTwo || '',
-      }]
-      this.$api.esCountSearch(params).then(response => {
-        if (response.code == 200) {
-          this.$set(val, 'nums', response.data.detailDTOS)
-          this.refresh()
-        }
-      }).catch(error => {
-
-      })
+      this.$emit('search', { row: val })
     },
     // 选中的数据
-    onChange(filed, filedId) {
-      let obj = {
-        [filedId]: filed
+    onChange(data, field) {
+      console.log(data, field);
+      var obj = {
+        fieldId: field.value,
+        fieldType: field.fieldType,
+        value: [],
       }
-      this.handleFiledData(obj, filedId)
+      let arr = []
+      arr.push(obj)
+      this.$emit('customTab',arr)
+      console.log(obj);
     },
-    // 处理customFields中的数据
-    handleFiledData(obj, filedId) {
-      if (this.customFields && this.customFields.length > 0) {
-        this.customFields.forEach(item => {
-          for (let k in item) {
-            if (k == filedId) {
-              item[k] = obj[filedId]
-            } else {
-              this.customFields.push(obj)
-            }
-          }
-        })
-      } else {
-        this.customFields.push(obj)
-      }
-      // this.$emit('customFields', this.customFields)
+    // 全选
+    handleSelectAll(val) {
+      val.check = val.options.map(item => {
+        return item.id
+      })
+    },
+    // 取消
+    handleSelectCancel(val) {
+      val.check=[]
     },
   },
 }

+ 29 - 115
src/views/report/components/patentList/components/tab2.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <template>
+    <template v-if="fieldTree.length > 0">
       <el-collapse v-model="activeNames" style="margin: 0px 5px 0px 5px;">
-        <el-collapse-item v-for="item in field" :title="item.name" :name="item.id" :key="item.id" :loading="loading"
+        <el-collapse-item v-for="item in fieldTree" :title="item.name" :name="item.value" :key="item.value"
           @click.native.stop="handleChange(item)">
           <div v-if="ifShow">
-            <el-tree @check-change="onChangeTree($event, item.id)" :ref="item.id" :data="item.child" show-checkbox
+            <el-tree @check-change="onChangeTree($event, item.value)" :ref="item.value" :data="item.child" show-checkbox
               node-key="id" check-strictly default-expand-all :props="{ children: 'child', label: 'name' }">
               <div class="custom-filter-tree-node" slot-scope="{ node, data }">
                 <span class="name">{{ data.name }}</span>
@@ -17,85 +17,44 @@
         </el-collapse-item>
       </el-collapse>
     </template>
-
+    <template v-else>
+      <div>暂无数据</div>
+    </template>
   </div>
 </template>
 
 <script>
 export default {
-  props: ['projectId','taskId'],
+  props: {
+    fieldTree: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+  },
   data() {
     return {
-      // 控制折叠面板
       activeNames: [],
-      // 存放数据
-      field: [],
-      loading: false,
-      // 勾选的数据
-      valObj: {
-        check: [],
-        valueOne: '',
-        valueTwo: '',
-      },
-      // 分页信息
-      queryParams: {
-        current: 1,
-        size: 10,
-      },
-      total: 0,
-      // 总数据
-      customFields: [],
-      // 
-      ifShow: true,
+      ifShow:true,
     }
   },
   watch: {
+    fieldTree: {
+      handler() {
+        this.ifShow = false
+        this.$nextTick(() => {
+          this.ifShow = true
+        })
+      },
+      deep: true
+    }
   },
   mounted() {
-    this.getList()
+
   },
   methods: {
-    // 查询自定义栏位数据
-    getList() {
-      var params = {
-        ...this.queryParams,
-        searchQuery: `projectId=${this.projectId}`,
-        orderDTOList: [],
-      }
-      this.loading = true
-      this.$api.queryCustomField(params).then(response => {
-        if (response.code == 200) {
-          this.field = response.data.data.filter(item => {
-            return item.type == 6
-          })
-          this.loading = false
-        }
-      }).catch(error => {
-        this.loading = false
-      })
-    },
-    // 查询自定义栏位选项数据
-    async queryCustomOption(row) {
-      let params = {
-        customFieldId: row.id,
-      }
-      await this.$api.queryCustomOption(params).then(response => {
-        if (response.code == 200) {
-          this.$set(row, 'child', response.data.data)
-          // row.child = response.data.data
-
-        }
-      }).catch(error => {
-
-      })
-    },
-    refresh() {
-      this.$set(this, 'ifShow', false)
-      this.$nextTick(() => {
-        this.$set(this, 'ifShow', true)
-      })
-    },
-    // 处理树类型的文件数字
+    // 处理专利文件数字
     getCount(field, value) {
       var num = 0
       if (field.nums) {
@@ -105,40 +64,12 @@ export default {
         if (obj) {
           num = obj.number
         }
-        console.log(num, obj);
         return num
       }
     },
-
-    // 点击当前的折叠面板
-    async handleChange(val) {
-      await this.queryCustomOption(val)
-      this.$nextTick(() => {
-        this.esCountSearch(val)
-      })
-
-    },
-    // 点击折叠面板中的搜索
-    async handleSearch(val) {
-      await this.queryCustomOption(val)
-      this.esCountSearch(val)
-    },
-    // 获取统计数字
-    esCountSearch(val) {
-      let params = [{
-        field: 'field',
-        fieldId: val.id,
-        valueOne: this.valObj.valueOne || '',
-        valueTwo: this.valObj.valueTwo || '',
-      }]
-      this.$api.esCountSearch(params).then(response => {
-        if (response.code == 200) {
-          this.$set(val, 'nums', response.data.detailDTOS)
-          this.refresh()
-        }
-      }).catch(error => {
-
-      })
+    // 点击面板
+    handleChange(row) {
+      this.$emit('collapseChange', { row: row, sign: 'tree' })
     },
     // 选中的值
     onChangeTree(filed, filedId) {//当前节点的数据,当前栏位的数据 
@@ -159,23 +90,6 @@ export default {
       }
       this.handleFiledData(obj, filedId)
     },
-    // 处理customFields中的数据
-    handleFiledData(obj, filedId) {
-      if (this.customFields && this.customFields.length > 0) {
-        this.customFields.forEach(item => {
-          for (let k in item) {
-            if (k == filedId) {
-              item[k] = obj[filedId]
-            } else {
-              this.customFields.push(obj)
-            }
-          }
-        })
-      } else {
-        this.customFields.push(obj)
-      }
-      // this.$emit('customFields', this.customFields)
-    },
   },
 }
 </script>