fix: bug#11218
This commit is contained in:
parent
cf06b77fe1
commit
79c280cece
|
@ -177,7 +177,7 @@ const functionRules = [
|
|||
return Promise.reject('请输入功能值');
|
||||
} else {
|
||||
const hasValue = value?.find(
|
||||
(item: { name: string; value: any }) => !item.value,
|
||||
(item: { name: string; value: any }) => item.value === undefined,
|
||||
);
|
||||
if (hasValue) {
|
||||
const functionItem = functions.value?.find(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { isEqual } from 'lodash-es'
|
||||
import { isBoolean, isEqual } from 'lodash-es'
|
||||
|
||||
export type DropdownButtonOptions = {
|
||||
label: string;
|
||||
|
@ -34,9 +34,10 @@ export const getComponent = (type: string): string => {
|
|||
export const getOption = (data: any[], value?: string | number | boolean, key: string = 'name'): DropdownButtonOptions | any => {
|
||||
let option
|
||||
if (value === undefined && value === null) return option
|
||||
let _value = isBoolean(value) ? String(value) : value
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i]
|
||||
if (isEqual(item[key], value)) {
|
||||
if (isEqual(item[key], _value)) {
|
||||
option = data[i]
|
||||
break
|
||||
} else if (item.children && item.children.length) {
|
||||
|
|
|
@ -162,7 +162,7 @@ watchEffect(() => {
|
|||
const option = getOption(_options, props.value as string, props.valueName) // 回显label值
|
||||
myValue.value = props.value
|
||||
mySource.value = props.source
|
||||
console.log(option, _options, props.valueName)
|
||||
console.log('paramsDropdown', option, _options, props.valueName, props.value, typeof props.value)
|
||||
if (option) {
|
||||
label.value = option[props.labelName] || option.name
|
||||
treeOpenKeys.value = openKeysByTree(_options, props.value, props.valueName)
|
||||
|
|
Loading…
Reference in New Issue