|
|
|
@ -16,12 +16,18 @@
|
|
|
|
|
style="margin-bottom: 6px; position: relative">
|
|
|
|
|
<div v-if="key != item.conditions.length - 1" class="r-line"></div>
|
|
|
|
|
<div :style="{ left: key == 0 ? '-29px' : '-16px' }" class="v-line"></div>
|
|
|
|
|
<a-select show-search :filter-option="filterOption" v-model:value="row.field"
|
|
|
|
|
<a-select v-if="Ismain" show-search :filter-option="filterOption" v-model:value="row.field"
|
|
|
|
|
style="width: 150px; margin-right: 6px" placeholder="查询字段" @change="changeHandle($event, row)">
|
|
|
|
|
<a-select-option v-for="item in schemas" :label="item.label" :key="item.field" :value="item.field">
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
<a-select v-if="!Ismain" show-search @blur="handleBlur($event, row)" :filter-option="filterOption1" v-model:value="row.field"
|
|
|
|
|
style="width: 150px; margin-right: 6px" placeholder="查询字段" @change="changeHandle1($event, row)">
|
|
|
|
|
<a-select-option v-for="item in schemas" :label="item.label" :key="item.field" :value="item.field">
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
<a-select v-model:value="row.operator" style="width: 90px; margin-right: 6px" placeholder="筛选符">
|
|
|
|
|
<a-select-option v-for="item in operatorOptions" :key="item.value" :value="item.value">
|
|
|
|
|
{{ item.label }}
|
|
|
|
@ -48,7 +54,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-spin>
|
|
|
|
|
<a-button class="add-group" type="link" @click="addGroup">
|
|
|
|
|
<a-button v-if="Ismain" class="add-group" type="link" @click="addGroup">
|
|
|
|
|
<span class="iconfont icon-calendar"></span>
|
|
|
|
|
添加条件组
|
|
|
|
|
</a-button>
|
|
|
|
@ -90,6 +96,10 @@ const props = defineProps({
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
Ismain: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
watch(
|
|
|
|
|
() => props.schemas,
|
|
|
|
@ -169,6 +179,45 @@ const queryOldData = reactive({
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
const queryOldData1 = reactive({
|
|
|
|
|
logicalOperator: '0',
|
|
|
|
|
groups: [
|
|
|
|
|
{
|
|
|
|
|
logicalOperator: '0',
|
|
|
|
|
conditions: [
|
|
|
|
|
{
|
|
|
|
|
field: null,
|
|
|
|
|
operator: null,
|
|
|
|
|
value: null,
|
|
|
|
|
component: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: null,
|
|
|
|
|
operator: null,
|
|
|
|
|
value: null,
|
|
|
|
|
component: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: null,
|
|
|
|
|
operator: null,
|
|
|
|
|
value: null,
|
|
|
|
|
component: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: null,
|
|
|
|
|
operator: null,
|
|
|
|
|
value: null,
|
|
|
|
|
component: '',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
function handleBlur(val,row){
|
|
|
|
|
if(result.value && !changeFlag.value){
|
|
|
|
|
row.field = result.value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 筛选符options
|
|
|
|
|
const operatorOptions = [
|
|
|
|
|
{
|
|
|
|
@ -209,15 +258,26 @@ const sourceData = {
|
|
|
|
|
logicalOperator: '',
|
|
|
|
|
groups: '',
|
|
|
|
|
}
|
|
|
|
|
const result = ref('')
|
|
|
|
|
function filterOption(input, option) {
|
|
|
|
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
|
}
|
|
|
|
|
function filterOption1(input, option) {
|
|
|
|
|
result.value = input
|
|
|
|
|
changeFlag.value = false
|
|
|
|
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
|
}
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
// 初始化弹窗,请求高级查询数据
|
|
|
|
|
const init = (IsApiData) => {
|
|
|
|
|
if (props.IsApi) {
|
|
|
|
|
const content = IsApiData ? IsApiData : {}
|
|
|
|
|
const source = JSON.parse(JSON.stringify(queryOldData))
|
|
|
|
|
let source = {} as any
|
|
|
|
|
if(props.Ismain){
|
|
|
|
|
source = JSON.parse(JSON.stringify(queryOldData))
|
|
|
|
|
} else {
|
|
|
|
|
source = JSON.parse(JSON.stringify(queryOldData1))
|
|
|
|
|
}
|
|
|
|
|
if (content && content?.groups?.length) {
|
|
|
|
|
queryData.logicalOperator = content.logicalOperator
|
|
|
|
|
queryData.groups = content.groups
|
|
|
|
@ -226,7 +286,12 @@ const init = (IsApiData) => {
|
|
|
|
|
queryData.groups = source.groups
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let source = JSON.parse(JSON.stringify(queryOldData))
|
|
|
|
|
let source = {} as any
|
|
|
|
|
if(props.Ismain){
|
|
|
|
|
source = JSON.parse(JSON.stringify(queryOldData))
|
|
|
|
|
} else {
|
|
|
|
|
source = JSON.parse(JSON.stringify(queryOldData1))
|
|
|
|
|
}
|
|
|
|
|
if (IsApiData) {
|
|
|
|
|
source = JSON.parse(IsApiData)
|
|
|
|
|
}
|
|
|
|
@ -244,6 +309,18 @@ const changeHandle = (e, row) => {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const changeFlag = ref(true)
|
|
|
|
|
const changeHandle1 = (e, row) => {
|
|
|
|
|
if(e){
|
|
|
|
|
changeFlag.value = true
|
|
|
|
|
}
|
|
|
|
|
row.value = null
|
|
|
|
|
props.schemas.forEach((item) => {
|
|
|
|
|
if (item.field == e) {
|
|
|
|
|
row.component = item.component
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 删除单组
|
|
|
|
|
const deleteItem = (index, key) => {
|
|
|
|
|
queryData.groups[index].conditions.splice(key, 1)
|
|
|
|
|