core/Form.php
public function createDynamic(Field $field)
    {
        if ($field->dynamic === null || !is_array($field->dynamic)) {
            return;
        }
        if (!isset($field->dataDynamic) || empty($field->dataDynamic)) {
            $dynamic = [];
            foreach ($field->dynamic as $item) {
                $temp = [];
                $hasCondition = false;
                foreach (['eq', 'neq', 'in', 'nin'] as $qkey) {
                    if (!isset($item[$qkey])) {
                        continue;
                    }
                    $hasCondition = true;
                    $temp[$qkey] = $item[$qkey];
                }
                if (!$hasCondition) {
                    continue;
                }
                $hasType = false;
                foreach (['hide', 'show', 'off', 'on'] as $type) {
                    if (!isset($item[$type])) {
                        continue;
                    }
                    if (!(is_string($item[$type]) || is_array($item[$type]))) {
                        continue;
                    }
                    //获取ID数组值
                    $tempIds = [];
                    //转成数组
                    $typeitems = is_string($item[$type]) ? explode(',', $item[$type]) : $item[$type];
                    foreach ($typeitems as $name) {
                        if (!is_string($name) || empty($name)) {
                            continue;
                        }
                        $box = $this->getField($name);
                        if ($box == null || empty($box->boxId)) {
                            continue;
                        }
                        $tempIds[] = $box->boxId;
                    }
                    if (count($tempIds) > 0) {
                        $temp[$type] = $tempIds;
                        $hasType = true;
                    }
                }
                if (!$hasType) {
                    continue;
                }
                $dynamic[] = $temp;
            }
            //设置 yee-module 属性
            if (count($dynamic) > 0) {
                $field->dataDynamic = $dynamic;
            }
        }
        if (isset($field->dataDynamic) && count($field->dataDynamic) > 0) {
            if (isset($field->boxYeeModule)) {
                $module = explode(' ', $field->boxYeeModule);
                $module = array_filter($module, 'strlen');
                if (!in_array('dynamic', $module)) {
                    $module[] = 'dynamic';
                }
                $field->boxYeeModule = join(' ', $module);
            } else {
                $field->boxYeeModule = 'dynamic';
            }
        }
    }
public function createDynamic(Field $field)
    {
        if ($field->dynamic === null || !is_array($field->dynamic)) {
            return;
        }
        if (!isset($field->dataDynamic) || empty($field->dataDynamic)) {
            $dynamic = [];
            foreach ($field->dynamic as $item) {
                $temp = [];
                $hasCondition = false;
                foreach (['eq', 'neq', 'in', 'nin'] as $qkey) {
                    if (!isset($item[$qkey])) {
                        continue;
                    }
                    $hasCondition = true;
                    $temp[$qkey] = $item[$qkey];
                }
                if (!$hasCondition) {
                    continue;
                }
                $hasType = false;
                foreach (['hide', 'show', 'off', 'on'] as $type) {
                    if (!isset($item[$type])) {
                        continue;
                    }
                    if (!(is_string($item[$type]) || is_array($item[$type]))) {
                        continue;
                    }
                    //获取ID数组值
                    $tempIds = [];
                    //转成数组
                    $typeitems = is_string($item[$type]) ? explode(',', $item[$type]) : $item[$type];
                    foreach ($typeitems as $name) {
                        if (!is_string($name) || empty($name)) {
                            continue;
                        }
                        $box = $this->getField($name);
                        if ($box == null || empty($box->boxId)) {
                            continue;
                        }
                        $tempIds[] = $box->boxId;
                    }
                    if (count($tempIds) > 0) {
                        $temp[$type] = $tempIds;
                        $hasType = true;
                    }
                }
                if (!$hasType) {
                    continue;
                }
                $dynamic[] = $temp;
            }
            //设置 yee-module 属性
            if (count($dynamic) > 0) {
                $field->dataDynamic = $dynamic;
            }
        }
        if (isset($field->dataDynamic) && count($field->dataDynamic) > 0) {
            if (isset($field->boxYeeModule)) {
                $module = explode(' ', $field->boxYeeModule);
                $module = array_filter($module, 'strlen');
                if (!in_array('dynamic', $module)) {
                    $module[] = 'dynamic';
                }
                $field->boxYeeModule = join(' ', $module);
            } else {
                $field->boxYeeModule = 'dynamic';
            }
        }
    }
创建动态字段数据
@param Field $field