zhuhao пре 1 година
родитељ
комит
7ee69764cf

+ 28 - 3
src/views/report/components/patentList/components/customFields/index.vue

@@ -54,6 +54,12 @@ export default {
         return []
       }
     },
+    // 检索式的数组数据
+    searchPatentCheck: {
+      default: () => {
+        return []
+      }
+    },
   },
   components: {
     queryPage,
@@ -89,7 +95,12 @@ export default {
     }
   },
   watch: {
-
+    searchOption: {
+      deep: true,
+      handler() {
+        // this.esCountAnalysis({})
+      },
+    },
   },
   async mounted() {
     // 获取显示的统计栏位
@@ -98,6 +109,20 @@ export default {
     this.getAllCountColumns()
   },
   methods: {
+    // 检索条件取消时统计勾选项一并取消
+    close() {
+      // console.log(this.searchPatentCheck);
+      let data = this.searchPatentCheck
+      for (let i = 0; i < data.length; i++) {
+        console.log(data[i]);
+        let a = this.field.filter(item => {
+          return item.value == data[i].value
+        })
+        if (a) {
+          a[0].check = data[i].check
+        }
+      }
+    },
     // 树点击不关联模式
     async switchChange(val) {
       this.ifHaveChild = val
@@ -109,7 +134,7 @@ export default {
       }
     },
     // ipc、cpc、loc、upc切换选择
-    selectChange({val:val,data:data}) {
+    selectChange({ val: val, data: data }) {
       this.getOptions(data)
     },
     // 点击面板中的搜索
@@ -159,7 +184,7 @@ export default {
     esCountAnalysis(row) {
       var countVOS = []
       if (row.filedKind == -1) {//专利本身栏位(专利著录)
-        let value = ['IPC','CPC','UPC','LOC'].includes(row.value) ? row.select : row.value
+        let value = ['IPC', 'CPC', 'UPC', 'LOC'].includes(row.value) ? row.select : row.value
         countVOS = [
           {
             field: value,

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

@@ -15,7 +15,7 @@
               </div>
               <!-- <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
               </mySearch> -->
-              <searchPatent :searchFiled="searchFiled" :searchPatentCheck="searchPatentCheck"
+              <searchPatent ref="searchPatent" :searchFiled="searchFiled" :searchPatentCheck="searchPatentCheck"
                 @searchValue="handleSearchValue"></searchPatent>
             </div>
             <el-button v-if="taskId" type="primary" size="small" @click="handleFieldManage">显示栏位管理</el-button>
@@ -60,8 +60,8 @@
         </el-container>
       </div>
       <div class="height_100 right" v-show="showRight">
-        <customFields :projectId="projectId" :taskId="taskId" :searchOption="searchOption" :customFields="customFields"
-          @customTab="handleCustomFields"></customFields>
+        <customFields ref="customFields" :projectId="projectId" :taskId="taskId" :searchOption="searchStr" :customFields="customFields"
+          @customTab="handleCustomFields" :searchPatentCheck="searchPatentCheck"></customFields>
       </div>
     </div>
 
@@ -110,7 +110,7 @@ export default {
       //检索字段
       searchFiled: [],
       //检索条件
-      searchOption: {},
+      // searchOption: {},
       //专利数据库数据总数
       total: 0,
       //分页信息
@@ -126,15 +126,16 @@ export default {
       tableData: [],
       // 获取显示自定义栏位
       fieldList: [],
-      // 存放自定义栏位的筛选数据
-      customFields: [],
       // 统计勾选的值(自定义字段)
       statisticsCustom: [],
       // 统计勾选的值(专利著录(专利本身))
       searchPatentCheck: [],
       // 分类选择是否关联子类
       ifHaveChild: false,
-      // 
+      // 存放专利本身检索条件
+      searchStr: '',
+      // 存放自定义栏位的检索条件
+      customFields: [],
     }
   },
   computed: {},
@@ -146,7 +147,10 @@ export default {
   methods: {
     // 处理后的条件
     handleSearchValue({ searchStr, customFields }) {
-      this.getList(searchStr,customFields)
+      this.searchStr = searchStr
+      this.customFields = customFields
+      this.$refs.customFields.close()
+      this.getList()
     },
     // 树类型是否包括子分类
     handleIfHaveChild(val) {
@@ -161,22 +165,33 @@ export default {
             this.searchPatentCheck.push(item)
 
           } else {
+            // console.log(item);
+            var checkName = []
+            if (item.type == 'Array') {
+              checkName = item.options.filter(item2 => item.check.includes(item2.id)).map(item3 => item3.name); 
+            }
             var obj = {
-              fieldId: item.value,
-              fieldType: item.fieldType,
+              value: item.value,
+              name: item.name,
               filedKind: item.filedKind,
-              value: item.check,
+              check: item.check,
+              checkName: checkName,//自定义栏位多选
+              type:item.type,
               ifHaveChild: this.ifHaveChild
             }
+            console.log(item, obj);
             this.searchPatentCheck.push(obj)
           }
         }
       })
+      this.$nextTick(() => {
+        this.$refs.searchPatent.search2()
+      })
     },
     // 处理任务
     handleClick(row, location) {
       var search = {
-        searchOption: this.searchOption,
+        searchOption: this.searchStr,
         location: location
       }
       this.$s.setSession('search', search)
@@ -231,48 +246,21 @@ export default {
           })
           // 处理自定义栏位筛选
           this.searchFiled = searchFiled.filter(item => {
-            return item.type != 'tree'
+            return item.type != 'tree' 
           })
         }
       })
     },
 
-    // 搜索
-    search(val) {
-      let params = {}
-      val.forEach(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 {
-          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()
-    },
     //获取专利列表
-    getList(searchStr,customFields) {
+    getList() {
       let params = {
         ...this.queryParams,//分页信息
         projectId: this.projectId,
         taskId: this.taskId,
-        searchQuery: searchStr || '',//检索条件
-        customFields: customFields || [],
+        searchQuery: this.searchStr || '',//检索条件
+        customFields: this.customFields || [],
         orderDTOList: this.sort,//排序信息
       }
       this.$api.QueryPatent(params).then(res => {
@@ -343,7 +331,7 @@ export default {
           path: '/allocationTask',
           query: {
             projectId: this.projectId,
-            searchOption: JSON.stringify(this.searchOption),//输入框检索条件
+            searchOption: JSON.stringify(this.searchStr),//输入框检索条件
             customFields: JSON.stringify(this.customFields),//右侧勾选自定义栏位的条件
           }
         }

+ 148 - 149
src/views/report/components/patentList/components/searchPatent.vue

@@ -13,31 +13,44 @@
         </el-select>
       </div>
       <el-button @click="search" type="primary" size="small">检索</el-button>
-      <el-button @click="lookSearch" type="text" size="">检索式</el-button>
-    </div>
 
-    <el-dialog title="查看/编辑检索式" :visible.sync="dialogVisible" width="800px" :before-close="handleClose">
+      <el-popover placement="bottom" width="260" trigger="click">
+        <div v-for="(item, index) in searchStorageText" :key="item.value">
+          <div style="margin-bottom:10px;background:#F0F9EB">
+            <span>{{ item.label }}</span>
+            <span> = </span>
+            <template v-if="item.type == 'Array'">
+              <span>(</span>
+              <template v-if="item.filedKind == 0">
+                <span v-for="(result, i) in item.checkName" :key="result" @click="resultBtn(item, index, i)">{{ result
+                }}<i class="el-icon-close"></i>
+                  <b v-if="item.checkName.length - 1 > i"> OR </b>
+                </span></template>
+              <template v-else>
+                <span v-for="(result, i) in item.inputValue" :key="result" @click="resultBtn(item, index, i)">{{ result
+                }}<i class="el-icon-close"></i>
+                  <b v-if="item.inputValue.length - 1 > i"> OR </b>
+                </span>
+              </template>
+              <span>)</span>
+              <!-- <span>({{ item.result.join(' OR ') }})</span> -->
+            </template>
+            <template v-else>
+              <span @click="resultBtn(item, index, 0)">{{ item.inputValue }}<i class="el-icon-close"></i></span>
+            </template>
+          </div>
+        </div>
 
-      <p><b>检索式专利检索</b><span style="margin-left:10px">[例: TI=计算机 ]</span></p>
-      <div>
-        <el-input type="textarea" :rows="4" readonly v-model="searchStr"></el-input>
-      </div>
-      <p><b>检索式自定义栏位检索</b><span style="margin-left:10px"></span></p>
-      <div>
-        <el-input type="textarea" :rows="4" readonly v-model="searchCustomStr"></el-input>
-      </div>
+        <el-button slot="reference" type="primary" size="small" class="margin-left_10">检索式</el-button>
+      </el-popover>
+
+    </div>
 
 
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="handleClose">取 消</el-button>
-        <el-button type="primary" @click="handleFinish">检 索</el-button>
-      </span>
-    </el-dialog>
   </div>
 </template>
 
 <script>
-import field from '@/api/field'
 export default {
   props: {
     // 所有的检索字段(包含自定义字段)
@@ -60,6 +73,7 @@ export default {
       options: [],
       // 存储条件
       searchStorage: [],
+      searchStorageText: [],
       // 专利检索式
       searchStr: '',
       // 自定义栏位检索式
@@ -110,122 +124,151 @@ export default {
         this.getGroup()
       },
     },
-    // 统计传过来的条件
-    searchPatentCheck: {
-      deep: true,
-      handler() {
-        this.storage2()
-      },
-    },
   },
   mounted() {
 
   },
   methods: {
+    // 点击检索式中的检索条件
+    resultBtn(item, index, i) {
+      // console.log('点击率', item, index, i);
+      // console.log(item);
+      // return
+      if (Array.isArray(item.inputValue)) {
+        item.inputValue.splice(i, 1)
+        if (this.searchStorageText[index].inputValue.length == 0) {
+          this.searchStorageText.splice(index, 1)
+          let spliceName = ''
+          if (item.dele == 'storage') {
+            spliceName = 'searchStorage'
+          } else {
+            spliceName = 'searchPatentCheck'
+          }
+          this[spliceName].splice(index, 1)
+          // console.log(this.searchStorage, this.searchPatentCheck);
+        }
+        if (item.checkName && item.checkName.length > 0) {
+          item.checkName.splice(i, 1)
+        }
+      } else {
+        let spliceName = ''
+        if (item.dele == 'storage') {
+          spliceName = 'searchStorage'
+        } else {
+          spliceName = 'searchPatentCheck'
+        }
+        let a = this[spliceName].findIndex(itemFind => {
+          return itemFind.inputValue == item.inputValue
+        })
+        if (a != -1) {
+          this[spliceName].splice(a, 1)
+        }
+        this.searchStorageText.splice(index, 1)
+        this.searchStr = ''
+      }
+      this.search2()
+    },
     // cascader变化事件
     cascaderChange(val) {
+      let a = this.options.find(item => {
+        return item.value == val[0]
+      })
+      this.isControl = a.children.find(item => {
+        return item.value == val[1]
+      })
       this.isControl.placeholder = '请输入检索内容'
-      this.isControl.customField = false
-      if (val[0] == 'dateType') {
+      if (this.isControl.type == '2') {
         this.isControl.placeholder = '请输入日期(格式2020 ~ 2023)'
       }
-      if (val[0] == 'customField') {
-        this.isControl.customField = true
-        let a = this.options.filter(item => {
-          return item.value == 'customField'
-        })
-        let b = a[0].children.filter(item => {
-          return item.value == val[1]
-        })
-        if (b && b[0].type == '2') {
-          this.isControl.placeholder = '请输入日期(格式2020 ~ 2023)'
-        }
-      }
       if (val[0] == 'typeStatus') {
         this.$set(this.isControl, 'select', true)
       }
-      console.log(this.isControl);
-      this.casString = val[val.length - 1]
-    },
-    // 存储条件(统计)
-    storage2() {
-      console.log(this.searchPatentCheck);
-      if (this.searchPatentCheck.length > 0) {
-        let obj = {}
-        let data = this.searchPatentCheck
-        for (let i = 0; i < data.length; i++) {
-          if (data[i].filedKind == -1) {//统计专利本身栏位
-            obj = {
-              [data[i].value]: data[i].check.length > 1 ? `(${data[i].check.join(' OR ')})` : data[i].check[0]
-            }
-          } else {//统计自定义字段栏位
-            obj = {
-              fieldId: data[i].fieldId,
-              value: data[i].value,
-            }
-          }
-
-        }
-        this.searchStorage.push(obj)
-        this.getSearchStorage()
-        console.log(this.searchStorage);
-      }
     },
     // 存储条件
     storage() {
-      let obj = {}
-      if (!this.isControl.customField) {//专利本身
-        obj = {
-          [this.casString]: this.inputValue.indexOf('OR') != -1 ? `(${this.inputValue})` : this.inputValue
-        }
-      } else {//自定义栏位
-        obj = {
-          fieldId: this.casString,
-          value: [this.inputValue],
-        }
-      }
-      this.searchStorage.push(obj)
+      this.isControl.inputValue = this.inputValue
+      let isControl = JSON.parse(JSON.stringify(this.isControl))
+      this.searchStorage.push(isControl)
+
+    },
+    getSearchOptionData() {
+      var data = []
+      // console.log(this.searchStorage, this.searchPatentCheck);
+      this.searchStorage.forEach(item => {
+        data.push(
+          {
+            label: item.label,
+            value: item.value,
+            inputValue: item.inputValue,
+            type: item.type,
+            group: item.group,
+            dele: 'storage',
+          }
+        )
+      })
+      this.searchPatentCheck.forEach(item => {
+        console.log(item);
+        var type = 1
+        data.push(
+          {
+            label: item.name,
+            value: item.value,
+            inputValue: item.check,
+            checkName: item.checkName,
+            filedKind: item.filedKind,
+            type: item.type,
+            group: item.filedKind == -1 ? 'nos' : 'customField',
+            dele: 'patentCheck',
+          }
+        )
+      })
+      this.searchStorageText = data
+      console.log(this.searchStorageText);
+      return data
     },
     // 页面检索按钮
     search() {
       this.storage()
+      this.search2()
+    },
+    search2() {
+      this.getSearchOptionData()
+      // return
       this.getSearchStorage()
     },
+    // 处理检索条件
     getSearchStorage() {
-      if (this.searchStorage.length > 0) {
-        let data = this.searchStorage
-        let customFields = []
-        for (let i = 0; i < data.length; i++) {
-          if (!data[i].fieldId) {//专利本身
-            if (i == 0) {
-              for (let k in data[i]) {
-                this.searchStr = `${k}=${data[i][k]}`
-              }
+      let customFields = []
+      // console.log(this.searchStorageText);
+      this.searchStorageText.forEach((item, index) => {
+        if (item.group == 'nos') {
+          if (index == 0) {
+            if (Array.isArray(item.inputValue)) {
+              this.searchStr = `${item.value} = (${item.inputValue.join(' OR ')})`
             } else {
-              for (let k in data[i]) {
-                this.searchStr += ` AND ${k}=${data[i][k]}`
-              }
+              this.searchStr = `${item.value} = (${item.inputValue})`
             }
-          } else {//自定义栏位
-            customFields.push(data[i])
+
+          } else {
+            if (Array.isArray(item.inputValue)) {
+              this.searchStr += ` AND ${item.value} = (${item.inputValue.join(' OR ')})`
+            } else {
+              this.searchStr += ` AND ${item.value} = (${item.inputValue})`
+            }
+          }
+        } else {
+          let a = {
+            fieldId: item.value,
+            value: item.filedKind ? item.inputValue : [this.inputValue],
           }
+          customFields.push(a)
         }
-        console.log(this.searchStr, customFields);
-        this.$emit('searchValue', { searchStr: this.searchStr, customFields: customFields, })
-      }
-    },
-    // 查看检索式
-    lookSearch() {
-      this.dialogVisible = true
-    },
-    // 弹窗检索按钮
-    handleFinish() {
-      this.handleClose()
-    },
-    // 关闭查看、编辑检索式弹窗
-    handleClose() {
-      this.dialogVisible = false
+      })
+      // console.log(this.searchStr,this.searchStorage,this.searchPatentCheck);
+      this.$emit('searchValue', { searchStr: this.searchStr, customFields: customFields, })
     },
+
+
     getGroup() {
       let obj = {
         text: '文本',
@@ -278,50 +321,6 @@ export default {
       }
       this.options = Object.values(filedObj)
     },
-
-    search1() {
-      console.log(this.casString, this.inputValue);
-      if (this.casString && this.inputValue) {
-        if (!this.searchValue[this.casString]) {
-          this.searchValue[this.casString] = []
-          this.searchValue[this.casString].push(this.inputValue)
-        } else {
-          this.searchValue[this.casString].push(this.inputValue)
-        }
-        if (Object.keys(this.searchValue).length > 0) {
-          let arr = Object.keys(this.searchValue)
-          for (let i = 0; i < arr.length; i++) {
-            if (i == 0) {
-              if (this.searchValue[arr[i]].length > 1) {
-                this.searchStr = `${arr[i]} = (${this.searchValue[arr[i]].join(' OR ')})`
-              } else {
-                if (this.inputValue.indexOf('OR') != -1) {
-                  this.searchStr = `${arr[i]} = (${this.searchValue[arr[i]][0]})`
-                } else {
-                  this.searchStr = `${arr[i]} = ${this.searchValue[arr[i]][0]}`
-                }
-              }
-            } else {
-              if (this.searchValue[arr[i]].length > 1) {
-                this.searchStr += ` AND ${arr[i]} = (${this.searchValue[arr[i]].join(' OR ')})`
-              } else {
-                if (this.inputValue.indexOf('OR') != -1) {
-                  this.searchStr += ` AND ${arr[i]} = (${this.searchValue[arr[i]][0]})`
-                } else {
-                  this.searchStr += ` AND ${arr[i]} = ${this.searchValue[arr[i]][0]}`
-                }
-
-              }
-            }
-          }
-        }
-        console.log(this.searchStr);
-        console.log(this.searchValue);
-        this.inputValue = ''
-      } else {
-        this.$message.error('请选择栏位并输入需要搜索的内容')
-      }
-    },
   },
 }
 </script>