浏览代码

专利检索修改

zhuliu 1 年之前
父节点
当前提交
203c6c8d03

+ 59 - 28
src/utils/model/search/search.vue

@@ -85,15 +85,23 @@
                               </div>
                         <!-- </el-col> -->
                     <!-- </el-row> -->
-                    <div style="width:50px">
-                        <span v-if="list.length==1" style="opacity: 0;"> 内容 </span>
-                        <el-button v-else size="small" @click="deleteList(i)"><i class="el-icon-delete"></i></el-button>
+                    <div style="width:80px">
+                        <!-- <span v-if="list.length==1" style="opacity: 0;"> 内容 </span> -->
+                        <span v-if="list.length==1" class="btns"> 
+                            <el-button v-if="searchValue" size="small" @click="add(i)"><i class="el-icon-plus"></i></el-button>
+                            <el-button size="small" @click="deleteList(i)" style="opacity:0"><i class="el-icon-delete"></i></el-button>
+                        </span>
+                        <span v-else class="btns">
+                            <el-button v-if="searchValue" size="small" @click="add(i)"><i class="el-icon-plus"></i></el-button>
+                            <el-button size="small" @click="deleteList(i)"><i class="el-icon-delete"></i></el-button>
+                        </span>
+                        
                     </div>
                 </div>
 
             </div>
             <div class="button_group" v-if="searchValue">
-                <el-button size="small" type="primary" @click="add">增加</el-button>
+                <!-- <el-button size="small" type="primary" @click="add">增加</el-button> -->
                 <el-button size="small" type="primary" @click="search2">检索</el-button>
                 <el-button size="small" @click="reset">重置</el-button>
                 <!-- <el-button size="small" @click="createSearch" v-if="searchValue">生成检索式</el-button> -->
@@ -120,12 +128,16 @@ export default {
             type:Array,
             default: ()=>{ return [
                 {
-                    label:'并且',
-                    value:'&&'
+                    name:'并且',
+                    value:'AND'
+                },
+                {
+                    name:'或者',
+                    value:'OR'
                 },
                 {
-                    label:'或者',
-                    value:'||'
+                    name:'非',
+                    value:'NOT'
                 },
             ] }
         },
@@ -224,8 +236,11 @@ export default {
     },
     watch:{
         field(){
-            this.list.length = 0
-            this.rule()
+            if(this.list.length == 0){
+                this.rule()
+            }
+            // this.list.length = 0
+            
         },
         list: {
             handler(val) {
@@ -244,6 +259,7 @@ export default {
           })
           // this.constants.GJ=this.countryList
         }
+        
     },
     methods: {
         change(list){
@@ -261,40 +277,48 @@ export default {
         //校验
         rule(){
             if(this.list.length>=1){
+                this.createSearch()
                 return false
             }else{
                 this.list.push({
+                    dataType:1,
                     logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
                     // field:this.field.length>0?this.field[0][this.fieldProps.value]:'',
                     field:'PN',
                     placeholder:'请输入公开号,例:CN102860161 OR CN1526554846',
                     operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:'',
+                    value:''
                 })
                 // this.rule()
             }
         },
         //增加
-        add(){
-            this.list.push({
-                logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
-                // field:this.field.length>0?this.field[0][this.fieldProps.value]:'',
-                field:'PN',
-                placeholder:'请输入公开号,例:CN102860161 OR CN1526554846',
-                operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:'',
-            },
-            // {
-            //     logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
-            //     field:this.field.length>0?this.field[0][this.fieldProps.value]:'',
-            //     operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:''
-            // }
-            )
+        add(index){
+            var obj = {
+                    dataType:1,
+                    logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
+                    // field:this.field.length>0?this.field[0][this.fieldProps.value]:'',
+                    field:'PN',
+                    placeholder:'请输入公开号,例:CN102860161 OR CN1526554846',
+                    operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:'',
+                    value:''
+                }
+            if(index || index == 0){
+                this.list.splice(index+1,0,obj)
+                return
+            }
+            this.list.push(obj)
         },
         //鼠标悬浮文字提示
         getTitle(val){
             if(val){
-                return this.filedList.filter(item=>{
+                var obj = this.filedList.find(item=>{
                     return item.value == val
-                })[0].label + '('+ val + ')'
+                })
+                if(obj){
+                    return obj.label + '('+ val + ')'
+                }
+                return '';
             }
         },
         //删除
@@ -305,11 +329,13 @@ export default {
         reset(){
             this.list = [
                 {
+                    dataType:1,
                     logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
                     // field:this.field.length>0?this.field[0][this.fieldProps.value]:'',
                     field:'PN',
                     placeholder:'请输入公开号,例:CN102860161 OR CN1526554846',
-                    operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:''
+                    operator:this.operator.length>0?this.operator[0][this.operatorProps.value]:'',
+                    value:''
                 },
                 // {
                 //     logical:this.logical.length>0?this.logical[0][this.logicalProps.value]:'',
@@ -424,12 +450,13 @@ export default {
         },
     //检索式检索
     search2() {
-      this.$emit('search', this.searchStr.trim())
+      this.$emit('search', this.searchStr.trim(),this.list)
     },
     // 二次检索和重新检索
     searchTwo(val) {
       var a = {
         searchStr: this.searchStr.trim(),
+        data:this.list
       }
       if (val == 'repeat') {//二次检索
         a.isRepeat = true
@@ -442,6 +469,10 @@ export default {
 }
 </script>
 <style lang="scss" scoped>
+.btns{
+    display: flex;
+    align-items: center;
+}
     .content_border{
         width:100%;
         // min-width: 1500px;

+ 59 - 4
src/views/components/import/conditionImport/FormSearch.vue

@@ -84,7 +84,7 @@
                                                 <div v-else-if="item.children[index+1].dataType==3" style="width:100%">
                                                     <el-select v-model="form[item.children[index+1].value]" size="small" multiple filterable collapse-tags placeholder="请选择,可多选" style="width:100%">
                                                         <el-option
-                                                            v-for="item in item.children[index+1].value=='GJ'?countryList:constants[item.children[index+1].value]"
+                                                            v-for="item in item.children[index+1].value=='GJ'?countryList.filter(item=>item.value!='CN'):constants[item.children[index+1].value]"
                                                             :key="item.value"
                                                             :label="item.label"
                                                             :value="item.value">
@@ -113,7 +113,8 @@
 </template>
 <script>
 export default {
-    props:['countryList','DBType'],
+    name:'FormSearch',
+    props:['countryList','DBType','selected','editData'],
     data() {
         return {
             form:{
@@ -123,6 +124,7 @@ export default {
             },
             dbType:this.DBType=='WD'?'2':'1',
             constants:this.$constants,
+            filedList:[],
             option1:[//法律状态
                 {
                     label:'有效',
@@ -156,10 +158,27 @@ export default {
     watch:{
         DBType(val){
             this.dbType = val == 'WD'?'2':'1'
+            if(val == 'WD'){
+                this.$set(this.form,'GJ',JSON.parse(JSON.stringify(this.selected))) 
+            }else{
+               this.$set(this.form,'GJ',[]) 
+            }
         }
     },
     mounted() {
-        
+        if(this.DBType == 'WD'){
+            this.$set(this.form,'GJ',JSON.parse(JSON.stringify(this.selected))) 
+        }else{
+            this.$set(this.form,'GJ',[]) 
+        }
+        var field=JSON.parse(JSON.stringify(this.$constants.searchField))
+        this.filedList =[].concat(...field.map(item=>{return item.children}))
+        if(this.editData && this.editData.component == 'FormSearch'){
+            if(this.editData.data && this.editData.data.length>0){
+                this.form = this.customToForm(this.editData.data)
+            }
+            
+        }
     },
     methods: {
         selectAll () {
@@ -252,9 +271,45 @@ export default {
             if(str.charAt(str.length-1)==' '){
                 str=str.slice(0,str.length-5);
             }
-            this.$emit('search',str)
+            var params = {
+                data:this.formToCustom(this.form),
+                DBType:this.DBType,
+                component:'FormSearch'
+            }
+            this.$emit('search',str,params)
+        },
+        //表格数据格式转高级检索数据格式
+        formToCustom(data){
+            var list = []
+            for(let key in data){
+                var item = data[key]
+                var a = this.filedList.find(item=>{
+                    return item.value == key
+                })
+                
+                var obj = {
+                    dataType : a.dataType,
+                    placeholder : a.placeholder,
+                    field:key,
+                    value:item,
+                    logical:'AND',
+                    operator:'=',
+                }
+                list.push(obj)
+            }
+            return list
+        },
+        //高级检索数据格式转表格数据格式
+        customToForm(data){
+            var obj = {}
+            for(var i = 0;i<data.length;i++){
+                var item = data[i]
+                obj[item.field] = item.value
+            }
+            return obj
         },
     },
+    
 }
 </script>
 <style lang="scss">

+ 18 - 5
src/views/components/import/conditionImport/customSearch.vue

@@ -23,7 +23,7 @@
         </el-aside>
         <el-main>
             <div>
-                <myFormSearch :logical="logical" :logicalProps="logicalProps" :operator="operator" :field="field" :searchValue="true" @search="search"></myFormSearch>
+                <myFormSearch :logical="logical" :logicalProps="logicalProps" :list="(editData && editData.component == 'customSearch')?editData.data:list" :operator="operator" :field="field" :searchValue="true" @search="search"></myFormSearch>
             </div>
         </el-main>
     </el-container>
@@ -32,11 +32,13 @@
 
 <script>
 export default {
+  name:'customSearch',
   components: {
   },
-  props: ['countryList','DBType','selected'],
+  props: ['countryList','DBType','selected','editData'],
   data() {
     return {
+      list:[],
         height:document.getElementsByClassName('el-main')[0].clientHeight,
         checkList:[],
         checked:false,
@@ -104,6 +106,11 @@ export default {
     }
     this.countryList1 = this.countryList.filter(item=>item.value!='CN')
     this.getField()
+    if(this.editData && this.editData.component == 'customSearch'){
+      if(this.editData.checkList){
+        this.checkList = this.editData.checkList
+      }     
+    }
   },
   methods: {
     querySearch() {
@@ -132,8 +139,14 @@ export default {
         return item.children.length>0
       })
     },
-    search(val){
+    search(val,data){
+      var params = {
+        data:data,
+        DBType:this.DBType,
+        component:'customSearch'
+      }
       if(this.DBType == 'WD' && this.checkList.length>0){
+        params.checkList = this.checkList
         if(val){
           if(this.checkList.length==1){
             var a = `GJ=${this.checkList[0]}`
@@ -148,9 +161,9 @@ export default {
             var str = `GJ=(${this.checkList.join(" OR ")})`
           }
         }
-        this.$emit('search',str)
+        this.$emit('search',str,params)
       }else{
-        this.$emit('search',`${val}`)
+        this.$emit('search',`${val}`,params)
       }
       
     },

+ 24 - 4
src/views/components/import/conditionImport/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="background:white">
-    <search :importData="importData"></search>
+    <search :importData="importData" :editData="editData"></search>
   </div>
 </template>
 
@@ -13,15 +13,35 @@ export default {
   props: {},
   data() {
     return {
+      importData:this.$route.query,
+      editData:null
     };
   },
   watch: {},
   computed: {
-    importData() {
-      return this.$route.query
+    // importData() {
+    //   return this.$route.query
+    // },
+    isEdit(){
+      return this.$route.query.isEdit
+    },
+  },
+  created() {
+    if(this.isEdit){
+      var params = this.$s.getSession('conditionImport')
+      if(!params){
+        return
+      }
+      if(params.importData){
+        this.importData = params.importData
+      }
+      if(params.data){
+        this.editData = params.data
+      }
+    }else{
+      this.$s.setSession('conditionImport',null)
     }
   },
-  created() {},
   mounted() {
   },
   methods: {},

+ 15 - 5
src/views/components/import/conditionImport/search.vue

@@ -18,7 +18,7 @@
         </div>
         
         <div style="width:70%;margin:0 auto;">
-            <component :is='isComponent' @search="search" :countryList="countryList" :DBType="DBType" :selected="selected"></component>
+            <component :is='isComponent' @search="search" :editData="editData" :countryList="countryList" :DBType="DBType" :selected="selected"></component>
         </div>
 
         <el-dialog title="检索历史" :visible.sync="dialogVisible" width="1200px" :append-to-body="true" :close-on-click-modal="false">
@@ -44,7 +44,7 @@ export default {
         searchHistory
     },
     mixins:[mixins],
-    props:[],
+    props:['editData'],
     data() {
         return {
             isComponent:'FormSearch',
@@ -55,6 +55,14 @@ export default {
         }
     },
     mounted() {
+        if(this.editData){
+            if(this.editData.component){
+                this.isComponent = this.editData.component
+            }
+            if(this.editData.DBType){
+                this.DBType = this.editData.DBType
+            }
+        }
         this.getCountry()
     },
     methods: {
@@ -141,7 +149,7 @@ export default {
         changeComponent(val){
             this.isComponent = val
         },
-        search(val){
+        search(val,data){
             if(val == ''){
                 this.$message.error('检索信息不能为空')
                 return false
@@ -161,9 +169,11 @@ export default {
             })
             let params = {
               params:{},
-              countryList:this.countryList
+              countryList:this.countryList,
+              data:data,
+              importData:this.importData
             }
-            this.$s.setSession('queryParams',params)
+            this.$s.setSession('conditionImport',params)
             // this.$s.setSession('retrieveRecordId',0)
             // window.open(router.href, '_blank');
         },

+ 52 - 4
src/views/components/import/conditionImport/searchResult.vue

@@ -76,10 +76,15 @@
       <div>
         <el-input type="textarea" :rows="4" v-model="condition.searchCondition"></el-input>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="visible = false">取 消</el-button>
-        <el-button type="primary" @click="searchFinish">检 索</el-button>
-        <el-button type="primary" v-if="condition.reportType==1||condition.reportType == 2||condition.reportType == 3" @click="saveSearchCondition">保存检索式</el-button>
+      <span slot="footer" class="dialog-footer footer2">
+        <div>
+          <!-- <el-button @click="editSearchCondition">编 辑</el-button> -->
+        </div>
+        <div>
+          <el-button @click="visible = false">取 消</el-button>
+          <el-button type="primary" @click="searchFinish">检 索</el-button>
+          <el-button type="primary" v-if="condition.reportType==1||condition.reportType == 2||condition.reportType == 3" @click="saveSearchCondition">保存检索式</el-button>
+        </div>
       </span>
     </el-dialog>
     <addAndEditSearchRecords ref="addAndEditSearchRecords" :projectId="condition.importToId"></addAndEditSearchRecords>
@@ -219,8 +224,46 @@ export default {
       } else {
         this.condition.searchCondition = val.searchStr
       }
+      if(val.data){
+        var params = this.$s.getSession('conditionImport')
+        if(params.data){
+          if(val.isRepeat){
+            if(params.data.data && params.data.data.length>0){
+              params.data.data.push(val.data[0])
+            }else{
+              params.data.data=[val.data[0]]
+            }
+            var data = []
+            params.data.data.forEach(item=>{
+              if(item.dataType == 3){
+                if(item.value && item.value.length>0){
+                  data.push(item)
+                }
+              }else{
+                if(item.value){
+                  data.push(item)
+                }
+              }
+            })
+            params.data.data = data
+          }else{
+            params.data.data = val.data
+          }
+          params.data.component = 'customSearch'
+          this.$s.setSession('conditionImport',params)
+        }
+      }
       await this.searchBth()
     },
+    //编辑检索式,跳转到检索界面
+    editSearchCondition(){
+      this.$router.push({
+        path: '/conditionImport',
+        query:{
+          isEdit:true
+        }
+      })
+    },
     searchBth() {
       this.queryParams.retrieveRecordId = null
       this.queryParams.current = 1
@@ -550,6 +593,11 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
+.footer2{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
 .total {
   margin-right: 10px;
   font-weight: 400;