|
@@ -9,7 +9,7 @@
|
|
|
<el-main>
|
|
|
<component :is="activeNameTabs" v-on="$listeners" :field="field" :activeName.sync="activeName"
|
|
|
:fieldTree="fieldTree" @collapseClick="handleCollapse" @search="handleSearch" @handleLoading="handleLoading"
|
|
|
- @switchChange="switchChange" @selectChange="selectChange">
|
|
|
+ @switchChange="switchChange" @selectChange="selectChange" @checkData="checkData">
|
|
|
<!-- <div slot="footerBtn">
|
|
|
<el-button type="primary" size="small" @click="handleMore">更多过滤项</el-button>
|
|
|
</div> -->
|
|
@@ -102,6 +102,11 @@ export default {
|
|
|
this.refreshOptions()
|
|
|
},
|
|
|
},
|
|
|
+ customFields: {
|
|
|
+ handler() {
|
|
|
+ this.refreshOptions()
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
async mounted() {
|
|
|
// 获取显示的统计栏位
|
|
@@ -111,26 +116,65 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 条件改变时刷新已打开的折叠面板
|
|
|
- refreshOptions() {
|
|
|
+ refreshOptions(sign) {
|
|
|
for (let i = 0; i < this.activeName.length; i++) {
|
|
|
var row = this.field.find(item => {
|
|
|
return item.value + 'a' + item.filedKind == this.activeName[i]
|
|
|
})
|
|
|
- this.getOptions(row)
|
|
|
+ this.getOptions(row,sign)
|
|
|
}
|
|
|
},
|
|
|
// 检索条件取消时统计勾选项一并取消//待修改,需要考虑产品架构、技术分类、等id重复的情况
|
|
|
close() {
|
|
|
- let data = this.searchPatentCheck
|
|
|
- // return
|
|
|
+ let currentData = this.searchPatentCheck
|
|
|
+ var obj = {}
|
|
|
+
|
|
|
+ for (var i = 0; i < currentData.length; i++){
|
|
|
+ var item = currentData[i]
|
|
|
+ var str = ''
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ str = item.value1 + 'a' + item.filedKind
|
|
|
+ } else {
|
|
|
+ str = item.value + 'a' + item.filedKind
|
|
|
+ }
|
|
|
+ if (obj[str]) {
|
|
|
+ obj[str].check.push(...item.check)
|
|
|
+ } else {
|
|
|
+ var obj2 = {
|
|
|
+ ...item
|
|
|
+ }
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ obj2.value = item.value1
|
|
|
+ obj2.field = item.field1
|
|
|
+ obj2.name = item.name1
|
|
|
+ }
|
|
|
+ obj[str] = obj2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var data = Object.values(obj)
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
|
if (data[i].filedKind == 0 && data[i].type == 'tree') {
|
|
|
-
|
|
|
+ var str = data[i].value + 'a' + data[i].filedKind
|
|
|
+ let a = ''
|
|
|
+ if ((data[i].type == 'Array' || data[i].type == 'tree')) {
|
|
|
+ a = this.fieldTree.filter(item => {
|
|
|
+ return item.value + 'a' + item.filedKind == str
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ a = this.field.filter(item => {
|
|
|
+ return item.value + 'a' + item.filedKind == str
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (a) {
|
|
|
+ a[0].check = data[i].check
|
|
|
+ }
|
|
|
} else {
|
|
|
- let a = this.field.filter(item => {
|
|
|
- return item.value == data[i].value
|
|
|
- })
|
|
|
+ let a = ''
|
|
|
+ a = this.field.filter(item => {
|
|
|
+ return item.value == data[i].value
|
|
|
+ })
|
|
|
+
|
|
|
if (a) {
|
|
|
a[0].check = data[i].check
|
|
|
}
|
|
@@ -138,6 +182,8 @@ export default {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
// 树点击不关联模式
|
|
|
async switchChange(val) {
|
|
|
this.ifHaveChild = val
|
|
@@ -154,9 +200,7 @@ export default {
|
|
|
},
|
|
|
// 点击面板中的搜索
|
|
|
handleSearch(row) {
|
|
|
- // this.getOptions(row)
|
|
|
- //查统计todo统计接口
|
|
|
- this.esCountAnalysis(row)
|
|
|
+ this.getOptions(row)
|
|
|
},
|
|
|
// 点击当前面板
|
|
|
async handleCollapse(current, data, type) {
|
|
@@ -171,36 +215,76 @@ export default {
|
|
|
return item.value + 'a' + item.filedKind == current
|
|
|
})
|
|
|
// 设置ipc、cpc、loc、upc选择
|
|
|
- this.getSelect(row)
|
|
|
+ // this.getSelect(row)
|
|
|
await this.getOptions(row)
|
|
|
}
|
|
|
},
|
|
|
//获取选项
|
|
|
- async getOptions(row) {
|
|
|
+ async getOptions(row,sign) {
|
|
|
if (row) {
|
|
|
+ // if (row.filedKind != -1 && (row.type == 'Array' || row.type == 'tree')) {
|
|
|
+ // switch (row.filedKind + '') {
|
|
|
+ // case '0':
|
|
|
+ // await this.queryCustomOption(row)
|
|
|
+ // break;
|
|
|
+ // case '7':
|
|
|
+ // await this.queryProductCategory(row, 2)
|
|
|
+ // break;
|
|
|
+ // case '8':
|
|
|
+ // await this.queryProductCategory(row, 1)
|
|
|
+ // break;
|
|
|
+ // case '9':
|
|
|
+ // await this.queryProductCategory(row, 3)
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
if (row.filedKind != -1 && (row.type == 'Array' || row.type == 'tree')) {
|
|
|
- switch (row.filedKind + '') {
|
|
|
- case '0':
|
|
|
- await this.queryCustomOption(row)
|
|
|
- break;
|
|
|
- case '7':
|
|
|
- await this.queryProductCategory(row, 2)
|
|
|
- break;
|
|
|
- case '8':
|
|
|
- await this.queryProductCategory(row, 1)
|
|
|
- break;
|
|
|
- case '9':
|
|
|
- await this.queryProductCategory(row, 3)
|
|
|
- break;
|
|
|
+ if (row.filedKind == 0) {
|
|
|
+ const [num, option] = await Promise.allSettled([this.esCountAnalysis(row), this.queryCustomOption(row)])
|
|
|
+ var nums = num.status == 'fulfilled' ? num.value : []
|
|
|
+ var options = option.status == 'fulfilled' ? option.value : []
|
|
|
+ this.$set(row, 'options', options)
|
|
|
+ if (!sign) {
|
|
|
+ this.$set(row, 'check', [])
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$set(row, 'nums', nums)
|
|
|
+ } else {
|
|
|
+ var type = {
|
|
|
+ 7: '2',
|
|
|
+ 8: '1',
|
|
|
+ 9: '3'
|
|
|
+ }
|
|
|
+ const [num,option] = await Promise.allSettled([this.esCountAnalysis(row),this.queryProductCategory(row,type[row.filedKind])])
|
|
|
+ var nums = num.status == 'fulfilled' ? num.value : []
|
|
|
+ var options = option.status == 'fulfilled' ? option.value : []
|
|
|
+ this.$set(row, 'options', options)
|
|
|
+ if (!sign) {
|
|
|
+ this.$set(row, 'check', [])
|
|
|
+ }
|
|
|
+ this.$set(row, 'nums', nums)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const [num] = await Promise.allSettled([this.esCountAnalysis(row)])
|
|
|
+ var nums = num.status == 'fulfilled' ? num.value : []
|
|
|
+ this.$set(row, 'options', nums)
|
|
|
+ if (!sign) {
|
|
|
+ this.$set(row, 'check', [])
|
|
|
+ }
|
|
|
+ if (row.optionsLength == nums.length || nums.length<10) {
|
|
|
+ this.$set(row, 'isShowBtn', false)
|
|
|
+ this.$set(row, 'optionsLength', nums.length)
|
|
|
+ } else {
|
|
|
+ this.$set(row, 'isShowBtn', true)
|
|
|
+ this.$set(row, 'optionsLength', nums.length)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
- esCountAnalysis(row) {
|
|
|
+ async esCountAnalysis(row) {
|
|
|
var countVOS = []
|
|
|
if (row.filedKind == -1) {//专利本身栏位(专利著录)
|
|
|
- let value = ['MC', 'CPC', 'UPC', 'LOC'].includes(row.value) ? row.select : row.value
|
|
|
+ let value = (row.children && row.children.length>0) ? row.select : row.value
|
|
|
countVOS = [
|
|
|
{
|
|
|
field: value,
|
|
@@ -217,8 +301,7 @@ export default {
|
|
|
fieldId: row.value,
|
|
|
valueOne: row.valueOne,
|
|
|
valueTwo: row.valueTwo,
|
|
|
-
|
|
|
- topN: 999,//自定义栏位没有加载更多
|
|
|
+ topN: 9999,//自定义栏位没有加载更多
|
|
|
ifHaveChild: row.type == 'tree' ? this.ifHaveChild : false,
|
|
|
fieldType: row.type
|
|
|
},
|
|
@@ -231,11 +314,8 @@ export default {
|
|
|
taskId: this.taskId,//任务id
|
|
|
countVOS: countVOS,//栏位的聚合入参
|
|
|
customFields: this.customFields,//自定义栏位查询
|
|
|
- // valueOne: row.valueOne,//搜索第一个栏位的值
|
|
|
- // valueTwo: row.valueTwo,//搜索第二个栏位的值
|
|
|
- // topN: row.topN,//显示条数
|
|
|
- // ifHaveChild: this.ifHaveChild,//是否开启不关联模式
|
|
|
}
|
|
|
+ return await this.$api.esCountAnalysis(params).then(res => res.data.detailDTOS)
|
|
|
this.$api.esCountAnalysis(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
var data = []
|
|
@@ -285,6 +365,7 @@ export default {
|
|
|
let params = {
|
|
|
customFieldId: row.value,
|
|
|
}
|
|
|
+ return await this.$api.queryCustomOption(params).then(response => response.data.data)
|
|
|
await this.$api.queryCustomOption(params).then(response => {
|
|
|
if (response.code == 200) {
|
|
|
var data = []
|
|
@@ -314,6 +395,7 @@ export default {
|
|
|
type: type,//类型:1产品类别,2产品,3技术分类,4自定义树
|
|
|
typeId: item.value,//产品或类别id
|
|
|
}
|
|
|
+ return await this.$api.queryTreeNodeTree(params).then(response => response.data.data)
|
|
|
await this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
if (row.type != 'tree') {
|
|
@@ -331,7 +413,6 @@ export default {
|
|
|
this.$set(row, 'check', [])
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
// 获取所有的统计栏位
|
|
|
getAllCountColumns() {
|
|
|
let params = {
|
|
@@ -359,26 +440,22 @@ export default {
|
|
|
if ([7, 8, 9].includes(data[i].filedKind) || (data[i].filedKind == 0 && data[i].type == 'tree')) {
|
|
|
this.fieldTree.push(data[i])
|
|
|
//查统计todo统计接口
|
|
|
- this.esCountAnalysis(data[i])
|
|
|
+ // this.esCountAnalysis(data[i])
|
|
|
continue;
|
|
|
}
|
|
|
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.getSelect(data[i])
|
|
|
for (var j = 0; j < this.showField.length; j++) {
|
|
|
if (data[i].name == this.showField[j].name && data[i].filedKind == this.showField[j].filedKind) {
|
|
|
data[i].ifHidden = false
|
|
|
+
|
|
|
this.field.push(data[i])
|
|
|
- this.getSelect(data[i])
|
|
|
+
|
|
|
//查统计todo统计接口
|
|
|
- this.esCountAnalysis(data[i])
|
|
|
+ // this.esCountAnalysis(data[i])
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -388,7 +465,6 @@ export default {
|
|
|
} else {
|
|
|
this.filedAll.push(data[i])
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
this.$store.commit('SET_SYSTEM_FIELD',this.filedAll)
|
|
|
},
|
|
@@ -401,51 +477,37 @@ export default {
|
|
|
}
|
|
|
await this.$api.getShowCountColumns(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- //filedKind-1专利著录 0自定义字段 7产品 8产品类别 9技术分类
|
|
|
- // res.data.data.forEach(item => {
|
|
|
- // this.$set(item, 'check', [])
|
|
|
- // if (item.filedKind == -1) {
|
|
|
- // item.value = item.field
|
|
|
- // }
|
|
|
- // })
|
|
|
var data = res.data.data
|
|
|
- // 查询筛选:获取非树类型
|
|
|
- // this.field = data.filter(item => {
|
|
|
- // if (item.filedKind == -1 || (item.filedKind == 0 && item.type != 'tree')) {
|
|
|
- // return item
|
|
|
- // }
|
|
|
- // })
|
|
|
this.showField = data.filter(item => {
|
|
|
if (item.filedKind == -1 || (item.filedKind == 0 && item.type != 'tree')) {
|
|
|
return item
|
|
|
}
|
|
|
})
|
|
|
- // this.field.forEach(item => {
|
|
|
- // this.getSelect(item)
|
|
|
- // })
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 设置ipc、cpc、loc、upc选择默认值
|
|
|
getSelect(data) {
|
|
|
- switch (data.value) {
|
|
|
- case 'MC':
|
|
|
- this.$set(data, 'select', 'IC')
|
|
|
- break;
|
|
|
- case 'CPC':
|
|
|
- this.$set(data, 'select', 'CPC')
|
|
|
- break;
|
|
|
- case 'UPC':
|
|
|
- this.$set(data, 'select', 'UPC')
|
|
|
- break;
|
|
|
- case 'LOC':
|
|
|
- this.$set(data, 'select', 'LOC')
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
+ if (data.children && data.children.length>0) {
|
|
|
+ this.$set(data, 'select', data.children[0].value)
|
|
|
}
|
|
|
+ // switch (data.value) {
|
|
|
+ // case 'MC':
|
|
|
+ // this.$set(data, 'select', 'IC')
|
|
|
+ // break;
|
|
|
+ // case 'CPC':
|
|
|
+ // this.$set(data, 'select', 'CPC')
|
|
|
+ // break;
|
|
|
+ // case 'UPC':
|
|
|
+ // this.$set(data, 'select', 'UPC')
|
|
|
+ // break;
|
|
|
+ // case 'LOC':
|
|
|
+ // this.$set(data, 'select', 'LOC')
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // default:
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
},
|
|
|
// 过滤组件传的值
|
|
|
getFieldList(val) {
|
|
@@ -454,19 +516,77 @@ export default {
|
|
|
return item.ifHidden == false
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
// 更多过滤项
|
|
|
handleMore() {
|
|
|
var data = JSON.parse(JSON.stringify(this.filedAll))
|
|
|
this.$refs.fieldsVue.open(data)
|
|
|
},
|
|
|
+ //获取子组件选择的值
|
|
|
+ checkData(value,row,checked) {
|
|
|
+ if (checked) {
|
|
|
+ if (!row.checkData) {
|
|
|
+ row.checkData=[]
|
|
|
+ }
|
|
|
+ row.checkData.push(
|
|
|
+ {
|
|
|
+ field: (row.children && row.children.length>0)?row.select:row.value,
|
|
|
+ value:value
|
|
|
+ }
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ var index = row.checkData.findIndex(item => {
|
|
|
+ return item.field == ((row.children && row.children.length>0)?row.select:row.value) && item.value == value
|
|
|
+ })
|
|
|
+ if (index != -1) {
|
|
|
+ row.checkData.splice(index,1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
//确认检索
|
|
|
sure() {
|
|
|
- let field = JSON.parse(JSON.stringify(this.field))
|
|
|
- let fieldTree = JSON.parse(JSON.stringify(this.fieldTree))
|
|
|
+ let field = this.filedAll.filter(item => {
|
|
|
+ return item.check && item.check.length>0
|
|
|
+ })
|
|
|
+ let fieldTree = this.fieldTree.filter(item => {
|
|
|
+ return item.check && item.check.length>0
|
|
|
+ })
|
|
|
let arr = field.concat(fieldTree)
|
|
|
+ var data = []
|
|
|
+ for (var i = 0; i < arr.length; i++){
|
|
|
+ var item = arr[i]
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ var obj = {}
|
|
|
+ for (var j = 0; j < item.checkData.length; j++){
|
|
|
+ var item1 = item.checkData[j]
|
|
|
+ if (obj[item1.field]) {
|
|
|
+ obj[item1.field].check.push(item1.value)
|
|
|
+ } else {
|
|
|
+ var obj2 = {
|
|
|
+ ...item
|
|
|
+ }
|
|
|
+ obj2.field1 = obj2.field
|
|
|
+ obj2.value1 = obj2.value
|
|
|
+ obj2.name = obj2.name
|
|
|
+ obj2.field = item1.field
|
|
|
+ obj2.value = item1.field
|
|
|
+ var label = item.children.find(item2 => {
|
|
|
+ return item2.value == item1.field
|
|
|
+ }).label
|
|
|
+ obj2.name = label
|
|
|
+ obj2.check = [item1.value]
|
|
|
+ obj[item1.field] = obj2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let key in obj) {
|
|
|
+ data.push(obj[key])
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ data.push(item)
|
|
|
+ }
|
|
|
this.$emit('ifHaveChild', this.ifHaveChild)
|
|
|
- this.$emit('customTab', arr)
|
|
|
+ this.$emit('customTab', data)
|
|
|
},
|
|
|
// 加载更多
|
|
|
handleLoading(val) {
|