|
|
|
@ -8,10 +8,10 @@
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div ref="logic" class="logic-content">
|
|
|
|
|
<div v-for="(item, index) in logicData" :key="index">
|
|
|
|
|
<div v-for="(item, index) in ruleConditionGroupList" :key="index">
|
|
|
|
|
<div v-if="index !== 0" class="flex-row group-logic-content">
|
|
|
|
|
<i class="active-point" />
|
|
|
|
|
<el-radio-group v-model="item.groupLogic" class="group-logic">
|
|
|
|
|
<el-radio-group v-model="groupLogic" class="group-logic">
|
|
|
|
|
<el-radio-button
|
|
|
|
|
v-for="logic in logicSymbolOptions"
|
|
|
|
|
:key="logic.value"
|
|
|
|
@ -31,7 +31,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="group">
|
|
|
|
|
<span class="group-title">影响案件指标的原子指标项目</span>
|
|
|
|
|
<el-radio-group v-model="item.rowLogic" :disabled="item.atomicData.length === 1" class="row-logic">
|
|
|
|
|
<el-radio-group v-model="item.rowLogic" :disabled="item.ruleConditionList.length === 1" class="row-logic">
|
|
|
|
|
<el-radio-button
|
|
|
|
|
v-for="logic in logicSymbolOptions"
|
|
|
|
|
:key="logic.value"
|
|
|
|
@ -40,21 +40,22 @@
|
|
|
|
|
{{ logic.label }}
|
|
|
|
|
</el-radio-button>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
<div v-for="(subItem, subIndex) in item.atomicData" :key="subIndex">
|
|
|
|
|
<div v-for="(subItem, subIndex) in item.ruleConditionList" :key="subIndex">
|
|
|
|
|
<div class="flex-row row-content">
|
|
|
|
|
<span class="row-line" />
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-remove-outline"
|
|
|
|
|
type="text"
|
|
|
|
|
style="color: red"
|
|
|
|
|
:disabled="item.atomicData.length === 1"
|
|
|
|
|
:disabled="item.ruleConditionList.length === 1"
|
|
|
|
|
@click="handleRowClick(item, subItem)"
|
|
|
|
|
/>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="subItem.atomicIndex"
|
|
|
|
|
v-model="subItem.atomicIndexId"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 300px"
|
|
|
|
|
@change="((val)=>{selectAtomic(val, subItem)})"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in atomicIndexData"
|
|
|
|
@ -76,12 +77,29 @@
|
|
|
|
|
:value="option.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<div v-if="subItem.relationalSymbol==='3' && subItem.indexSource ==='3'">
|
|
|
|
|
<el-input v-model="modelText" style="width: 80px;margin-left: 20px" readonly />
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="subItem.operator"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100px;margin-left: 20px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in operatorList"
|
|
|
|
|
:key="option"
|
|
|
|
|
:label="option"
|
|
|
|
|
:value="option"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input v-model="subItem.value" style="width: 150px;margin-left: 20px" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-sku">
|
|
|
|
|
<div v-if="subItem.indexSource === '5'" class="row-sku">
|
|
|
|
|
<div class="row-sku-top">
|
|
|
|
|
<i class="el-icon-circle-plus-outline" style="color: #3763FF;font-size: 14px;" />
|
|
|
|
|
<span>添加单个条件</span>
|
|
|
|
|
<el-radio-group v-model="subItem.groupLogic" class="group-logic">
|
|
|
|
|
<span @click="addOperandUnitList(index,subIndex)">添加属性</span>
|
|
|
|
|
<el-radio-group v-model="subItem.logic" class="group-logic">
|
|
|
|
|
<el-radio-button
|
|
|
|
|
v-for="logic in logicSymbolOptions"
|
|
|
|
|
:key="logic.value"
|
|
|
|
@ -90,7 +108,121 @@
|
|
|
|
|
{{ logic.label }}
|
|
|
|
|
</el-radio-button>
|
|
|
|
|
</el-radio-group></div>
|
|
|
|
|
<div v-for="(items,i) in "></div>
|
|
|
|
|
<div v-for="(items,i) in subItem.operandUnitList" :key="i">
|
|
|
|
|
<div class="flex-row row-content">
|
|
|
|
|
<!-- <span class="row-line" /> -->
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-remove-outline"
|
|
|
|
|
type="text"
|
|
|
|
|
style="color: red"
|
|
|
|
|
:disabled="subItem.operandUnitList.length === 1"
|
|
|
|
|
@click="delItem(subItem, items)"
|
|
|
|
|
/>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="items.leftOperand.propertyKey"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
@change="((val)=>{selectPropertyKey(val, items,subItem.atomicIndexId)})"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in atomicIndexAttributeScope[subItem.atomicIndexId]"
|
|
|
|
|
:key="option.value"
|
|
|
|
|
:label="option.value"
|
|
|
|
|
:value="option.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="items.leftOperand.propertyKey"
|
|
|
|
|
v-model="items.leftOperand.aggregateType"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100px;margin-left: 20px;"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in getOptionList(items.leftOperand.propertyKey,subItem.atomicIndexId,'aggregateList')"
|
|
|
|
|
:key="option.key"
|
|
|
|
|
:label="option.value"
|
|
|
|
|
:value="option.key"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="items.leftOperand.propertyKey"
|
|
|
|
|
v-model="items.operator"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100px;margin-left: 20px;"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in getOptionList(items.leftOperand.propertyKey,subItem.atomicIndexId,'operatorList')"
|
|
|
|
|
:key="option"
|
|
|
|
|
:label="option"
|
|
|
|
|
:value="option"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="items.leftOperand.propertyKey"
|
|
|
|
|
v-model="items.rightOperand.operandType"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100px;margin-left: 20px;"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
|
|
key="6"
|
|
|
|
|
label="值"
|
|
|
|
|
value="6"
|
|
|
|
|
/> <el-option
|
|
|
|
|
|
|
|
|
|
key="5"
|
|
|
|
|
label="原子指标"
|
|
|
|
|
value="5"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<div v-if="items.rightOperand.operandType ==='6'" style="margin-left: 20px;">
|
|
|
|
|
<el-input v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='1'" v-model="items.rightOperand.value" placeholder="请输入" />
|
|
|
|
|
<el-input v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='2'" v-model="items.rightOperand.value" type="number" placeholder="请输入" />
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='3'"
|
|
|
|
|
v-model="items.rightOperand.value"
|
|
|
|
|
format="yyyy-MM-dd"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
type="date"
|
|
|
|
|
placeholder="选择日期"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="items.rightOperand.operandType ==='5'"
|
|
|
|
|
v-model="items.rightOperand.atomicIndexId"
|
|
|
|
|
style="margin-left: 20px;width: 200px;"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
@change="(()=>{items.rightOperand.propertyKey = ''})"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in atomicIndexData"
|
|
|
|
|
:key="option.id"
|
|
|
|
|
:label="option.name"
|
|
|
|
|
:value="option.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="items.rightOperand.operandType ==='5'"
|
|
|
|
|
v-model="items.rightOperand.propertyKey"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 150px;margin-left: 20px;"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="option in atomicIndexAttributeScope[items.rightOperand.atomicIndexId]"
|
|
|
|
|
:key="option.value"
|
|
|
|
|
:label="option.value"
|
|
|
|
|
:value="option.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<el-button
|
|
|
|
@ -126,6 +258,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import mixin from '@/views/mixin'
|
|
|
|
|
// import { CirclePlus } from "@element-plus/icons-vue";
|
|
|
|
|
import { listAtomicIndexAttributeScope } from '@/api/indexRule'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'CustomLogic',
|
|
|
|
|
mixins: [mixin],
|
|
|
|
@ -135,20 +268,24 @@ export default {
|
|
|
|
|
required: true,
|
|
|
|
|
defaultValue: []
|
|
|
|
|
},
|
|
|
|
|
judgeLogic: {
|
|
|
|
|
type: String,
|
|
|
|
|
indexRule: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
defaultValue: ''
|
|
|
|
|
default: () => {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 原子指标逻辑数据
|
|
|
|
|
logicData: [
|
|
|
|
|
{ groupLogic: '1', rowLogic: '1', atomicData: [{ atomicIndex: '', relationalSymbol: '', attributeList:[{
|
|
|
|
|
|
|
|
|
|
}] }] }
|
|
|
|
|
ruleConditionGroupList: [
|
|
|
|
|
{ rowLogic: '2', ruleConditionList: [{ atomicIndexId: '', indexSource: '', logic: '2', relationalSymbol: '', operator: '', value: '', operandUnitList: [] }] }
|
|
|
|
|
],
|
|
|
|
|
groupLogic: '2',
|
|
|
|
|
modelText: '数量',
|
|
|
|
|
atomicIndexAttributeScope: {},
|
|
|
|
|
operatorList: ['>', '>=', '<', '<=', '=', '!='],
|
|
|
|
|
// 逻辑运算符
|
|
|
|
|
logicSymbolOptions: JSON.parse(sessionStorage.getItem('logic_symbol'))
|
|
|
|
|
// 关系数据
|
|
|
|
@ -170,24 +307,104 @@ export default {
|
|
|
|
|
// watch: {
|
|
|
|
|
// isChange(val) {
|
|
|
|
|
// if (val === true) {
|
|
|
|
|
// this.logicData = [
|
|
|
|
|
// { groupLogic: '1', rowLogic: '1', atomicData: [{ atomicIndex: '', relationalSymbol: '' }] }
|
|
|
|
|
// this.ruleConditionGroupList = [
|
|
|
|
|
// { groupLogic: '1', rowLogic: '1', ruleConditionList: [{ atomicIndexId: '', relationalSymbol: '' }] }
|
|
|
|
|
// ]
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
mounted() {
|
|
|
|
|
if (!this.judgeLogic) return
|
|
|
|
|
this.logicData = JSON.parse(this.judgeLogic)
|
|
|
|
|
this.logicData.map((item) => {
|
|
|
|
|
item.atomicData.map((subItem) => {
|
|
|
|
|
if (!this.getListValueFlag(subItem.atomicIndex)) {
|
|
|
|
|
subItem.atomicIndex = ''
|
|
|
|
|
this.getAtomicIndexAttributeScope()
|
|
|
|
|
if (!this.indexRule.ruleConditionGroupList || this.indexRule.ruleConditionGroupList.length === 0) return
|
|
|
|
|
this.groupLogic = this.indexRule.groupLogic
|
|
|
|
|
this.ruleConditionGroupList = this.indexRule.ruleConditionGroupList
|
|
|
|
|
this.ruleConditionGroupList.map((item) => {
|
|
|
|
|
item.ruleConditionList.map((subItem) => {
|
|
|
|
|
if (!this.getListValueFlag(subItem.atomicIndexId)) {
|
|
|
|
|
subItem.atomicIndexId = ''
|
|
|
|
|
subItem.indexSource = ''
|
|
|
|
|
subItem.operandUnitList = []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取指标类型
|
|
|
|
|
getIndexSource(val) {
|
|
|
|
|
for (const item of this.atomicIndexData) {
|
|
|
|
|
if (val === item.id) {
|
|
|
|
|
return item.indexSource
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 原子指标属性
|
|
|
|
|
async getAtomicIndexAttributeScope() {
|
|
|
|
|
const list = []
|
|
|
|
|
for (const item of this.atomicIndexData) {
|
|
|
|
|
list.push(item.id)
|
|
|
|
|
}
|
|
|
|
|
const res = await listAtomicIndexAttributeScope(list)
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
this.atomicIndexAttributeScope = res.data
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getAttrValueType(value, atomicIndexId) {
|
|
|
|
|
if (value && atomicIndexId) {
|
|
|
|
|
const list = this.atomicIndexAttributeScope[atomicIndexId]
|
|
|
|
|
for (const item of list) {
|
|
|
|
|
if (item.value === value) {
|
|
|
|
|
return item.valueType
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 获取属性下拉
|
|
|
|
|
getOptionList(value, atomicIndexId, type) {
|
|
|
|
|
if (value && atomicIndexId) {
|
|
|
|
|
const list = this.atomicIndexAttributeScope[atomicIndexId]
|
|
|
|
|
for (const item of list) {
|
|
|
|
|
if (item.value === value) {
|
|
|
|
|
return item[type]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectAtomic(val, subItem) {
|
|
|
|
|
this.getAtomicIndexAttributeScope(val)
|
|
|
|
|
subItem.indexSource = this.getIndexSource(val)
|
|
|
|
|
this.$set(subItem, 'relationalSymbol', '')
|
|
|
|
|
this.$set(subItem, 'operator', '')
|
|
|
|
|
this.$set(subItem, 'value', '')
|
|
|
|
|
},
|
|
|
|
|
// 选择左边属性
|
|
|
|
|
selectPropertyKey(val, items, id) {
|
|
|
|
|
items.leftOperand.valueType = this.getAttrValueType(val, id)
|
|
|
|
|
this.$set(items.leftOperand, 'aggregateType', '')
|
|
|
|
|
this.$set(items, 'rightOperand', {
|
|
|
|
|
atomicIndexId: '',
|
|
|
|
|
value: '',
|
|
|
|
|
valueType: '',
|
|
|
|
|
operandType: '',
|
|
|
|
|
propertyKey: ''
|
|
|
|
|
})
|
|
|
|
|
this.$set(items, 'operator', '')
|
|
|
|
|
},
|
|
|
|
|
// 添加属性
|
|
|
|
|
addOperandUnitList(index, subIndex) {
|
|
|
|
|
this.ruleConditionGroupList[index].ruleConditionList[subIndex].operandUnitList.push({
|
|
|
|
|
leftOperand: {
|
|
|
|
|
atomicIndexId: '',
|
|
|
|
|
operandType: '5'
|
|
|
|
|
},
|
|
|
|
|
rightOperand: {
|
|
|
|
|
atomicIndexId: '',
|
|
|
|
|
value: '',
|
|
|
|
|
valueType: '',
|
|
|
|
|
operandType: '',
|
|
|
|
|
propertyKey: ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 添加
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.gridOptions.data.push({
|
|
|
|
@ -208,41 +425,43 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 添加单个条件
|
|
|
|
|
handleAddRow(val) {
|
|
|
|
|
val.atomicData.push({
|
|
|
|
|
atomicIndex: '',
|
|
|
|
|
relationalSymbol: ''
|
|
|
|
|
val.ruleConditionList.push({
|
|
|
|
|
atomicIndexId: '', indexSource: '', rowLogic: '', relationalSymbol: '', operator: '', value: '', operandUnitList: []
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 添加条件组
|
|
|
|
|
handleAddGroup(index) {
|
|
|
|
|
this.logicData.splice(index, 0, {
|
|
|
|
|
groupLogic: '1',
|
|
|
|
|
rowLogic: '&',
|
|
|
|
|
atomicData: [
|
|
|
|
|
{ atomicIndex: '', relationalSymbol: '' }
|
|
|
|
|
]
|
|
|
|
|
if (this.ruleConditionGroupList.length > 1) return
|
|
|
|
|
this.ruleConditionGroupList.splice(index, 0, {
|
|
|
|
|
rowLogic: '2', ruleConditionList: [{ atomicIndexId: '', indexSource: '', rowLogic: '', relationalSymbol: '', operator: '', value: '', operandUnitList: [] }]
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 删除条件组
|
|
|
|
|
handleDelGroup(item) {
|
|
|
|
|
this.logicData.splice(this.logicData.indexOf(item), 1)
|
|
|
|
|
this.ruleConditionGroupList.splice(this.ruleConditionGroupList.indexOf(item), 1)
|
|
|
|
|
},
|
|
|
|
|
// 删除单个原子指标
|
|
|
|
|
handleRowClick(item, subItem) {
|
|
|
|
|
item.atomicData.splice(item.atomicData.indexOf(subItem), 1)
|
|
|
|
|
item.ruleConditionList.splice(item.ruleConditionList.indexOf(subItem), 1)
|
|
|
|
|
},
|
|
|
|
|
delItem(item, subItem) {
|
|
|
|
|
item.operandUnitList.splice(item.operandUnitList.indexOf(subItem), 1)
|
|
|
|
|
},
|
|
|
|
|
// 验证是否可用
|
|
|
|
|
validate() {
|
|
|
|
|
let valid = true
|
|
|
|
|
this.logicData.map((item) => {
|
|
|
|
|
item.atomicData.map((subItem) => {
|
|
|
|
|
if (!subItem.atomicIndex || !subItem.relationalSymbol) {
|
|
|
|
|
this.ruleConditionGroupList.map((item) => {
|
|
|
|
|
item.ruleConditionList.map((subItem) => {
|
|
|
|
|
if (!subItem.atomicIndexId || !subItem.relationalSymbol) {
|
|
|
|
|
valid = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
if (valid) {
|
|
|
|
|
return this.logicData
|
|
|
|
|
return {
|
|
|
|
|
groupLogic: this.groupLogic,
|
|
|
|
|
ruleConditionGroupList: this.ruleConditionGroupList
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.$baseMessage.error('请选择原子指标和关系符号')
|
|
|
|
|
}
|
|
|
|
@ -298,8 +517,11 @@ export default {
|
|
|
|
|
left: 310px;
|
|
|
|
|
}
|
|
|
|
|
.row-sku {
|
|
|
|
|
padding-left: 50px;
|
|
|
|
|
background: rgba(55,99,255,0.05);
|
|
|
|
|
margin: 0 42px;
|
|
|
|
|
padding: 18px;
|
|
|
|
|
.row-sku-top {
|
|
|
|
|
// padding-left: 50px;
|
|
|
|
|
span {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #3763FF;
|
|
|
|
|