Merge pull request #10785 from dataease/pr@dev-v2_st

fix(仪表板): 编辑下拉树规则提示异常
This commit is contained in:
dataeaseShu 2024-07-03 22:51:48 +08:00 committed by GitHub
commit 2fd9a61a08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 17 deletions

View File

@ -252,6 +252,15 @@ const setTreeDefault = () => {
} }
} }
const handleCheckedFieldsChange = (value: string[]) => { const handleCheckedFieldsChange = (value: string[]) => {
handleDialogClick()
const checkedCount = value.length
checkAll.value = checkedCount === fields.value.length
isIndeterminate.value = checkedCount > 0 && checkedCount < fields.value.length
if (curComponent.value.displayType === '8') return
setType()
}
const handleCheckedFieldsChangeTree = (value: string[]) => {
handleDialogClick() handleDialogClick()
const checkedCount = value.length const checkedCount = value.length
checkAll.value = checkedCount === fields.value.length checkAll.value = checkedCount === fields.value.length
@ -1008,8 +1017,8 @@ const showError = computed(() => {
if (displayType === '9') { if (displayType === '9') {
let displayField = null let displayField = null
return checkedFields.some(id => { return checkedFields.some(id => {
const arr = fields.value.find(itx => itx.componentId === id) const arr = (fields.value || []).find(itx => itx.componentId === id)
const field = arr.id const field = arr?.id
if (!field) return false if (!field) return false
if (displayField === null) { if (displayField === null) {
displayField = field displayField = field
@ -1332,7 +1341,7 @@ defineExpose({
<div class="field-list"> <div class="field-list">
<el-checkbox-group <el-checkbox-group
v-model="curComponent.checkedFields" v-model="curComponent.checkedFields"
@change="handleCheckedFieldsChange" @change="handleCheckedFieldsChangeTree"
> >
<div v-for="field in fields" :key="field.componentId" class="list-item"> <div v-for="field in fields" :key="field.componentId" class="list-item">
<el-checkbox :label="field.componentId" <el-checkbox :label="field.componentId"
@ -1477,14 +1486,18 @@ defineExpose({
<div class="list-item" v-if="curComponent.displayType === '9'"> <div class="list-item" v-if="curComponent.displayType === '9'">
<div class="label" style="width: 135px; height: 26px; line-height: 26px"> <div class="label" style="width: 135px; height: 26px; line-height: 26px">
下拉树结构设计 下拉树结构设计
<el-button v-if="!!curComponent.treeFieldList.length" text @click="startTreeDesign"> <el-button
v-if="curComponent.treeFieldList && !!curComponent.treeFieldList.length"
text
@click="startTreeDesign"
>
<template #icon> <template #icon>
<icon name="icon_edit_outlined"></icon> <icon name="icon_edit_outlined"></icon>
</template> </template>
</el-button> </el-button>
</div> </div>
<div class="search-tree"> <div class="search-tree">
<template v-if="!!curComponent.treeFieldList.length"> <template v-if="curComponent.treeFieldList && !!curComponent.treeFieldList.length">
<div <div
v-for="(ele, index) in curComponent.treeFieldList" v-for="(ele, index) in curComponent.treeFieldList"
:key="ele.id" :key="ele.id"

View File

@ -150,7 +150,7 @@ const activeName = inject('api-active-name')
/> />
</el-col> </el-col>
<el-col :span="activeName === 'params' ? 10 : 5"> <el-col :span="10">
<el-input <el-input
v-model="element.description" v-model="element.description"
maxlength="200" maxlength="200"
@ -158,17 +158,6 @@ const activeName = inject('api-active-name')
show-word-limit show-word-limit
/> />
</el-col> </el-col>
<el-col v-if="activeName !== 'params'" :span="5">
<el-autocomplete
v-if="suggestions"
v-model="element.name"
:disabled="isReadOnly"
:fetch-suggestions="querySearch"
:placeholder="keyText"
show-word-limit
/>
</el-col>
<el-col :span="1"> <el-col :span="1">
<el-button text :disabled="isDisable() || isReadOnly" @click="remove(index)"> <el-button text :disabled="isDisable() || isReadOnly" @click="remove(index)">
<template #icon> <template #icon>