|
@@ -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>
|