core/Form.php
private function validDynamic(Field $field)
    {
        if ($field->dynamic === null || !is_array($field->dynamic)) {
            return;
        }
        $value = $field->value;
        if (is_object($value)) {
            return;
        }
        if (is_array($value)) {
            $value = json_encode($value, JSON_UNESCAPED_UNICODE);
        }
        foreach ($field->dynamic as $item) {
            if (!isset($item['eq']) && !isset($item['neq']) && !isset($item['in']) && !isset($item['nin'])) {
                continue;
            }
            if (!isset($item['hide']) && !isset($item['show']) && !isset($item['off']) && !isset($item['on'])) {
                continue;
            }
            //判断相等
            if (isset($item['eq'])) {
                $bval = $item['eq'];
                if (is_array($bval)) {
                    $bval = json_encode($value, JSON_UNESCAPED_UNICODE);
                }
                if ($bval != $value) {
                    continue;
                }
            }
            //判断不等
            if (isset($item['neq'])) {
                $bval = $item['neq'];
                if (is_array($bval)) {
                    $bval = json_encode($value, JSON_UNESCAPED_UNICODE);
                }
                if ($bval == $value) {
                    continue;
                }
            }
            //在集合里面
            if (isset($item['in'])) {
                $bval = $item['in'];
                if (!is_array($bval)) {
                    continue;
                }
                $in = false;
                foreach ($bval as $bitem) {
                    if (strval($bitem) == strval($value)) {
                        $in = true;
                        break;
                    }
                }
                if (!$in) {
                    continue;
                }
            }
            //不在集合里面
            if (isset($item['nin'])) {
                $bval = $item['nin'];
                if (!is_array($bval)) {
                    continue;
                }
                $in = false;
                foreach ($bval as $bitem) {
                    if (strval($bitem) == strval($value)) {
                        $in = true;
                        break;
                    }
                }
                if ($in) {
                    continue;
                }
            }

            //校验item
            $temp = [];

            foreach (['hide', 'off'] as $type) {
                if (!isset($item[$type])) {
                    continue;
                }
                if (!(is_string($item[$type]) || is_array($item[$type]))) {
                    continue;
                }
                //转数组
                $temp[$type] = is_string($item[$type]) ? explode(',', $item[$type]) : $item[$type];
            }

            if (isset($temp['hide'])) {
                foreach ($temp['hide'] as $name) {
                    if (!is_string($name) || empty($name)) {
                        continue;
                    }
                    $box = $this->getField($name);
                    if ($box == null || empty($box->boxId)) {
                        continue;
                    }
                    $box->dataValDisabled = true;
                    $box->close = true;
                }
            }
            if (isset($temp['off'])) {
                foreach ($temp['off'] as $name) {
                    if (!is_string($name) || empty($name)) {
                        continue;
                    }
                    $box = $this->getField($name);
                    if ($box == null || empty($box->boxId)) {
                        continue;
                    }
                    $box->dataValDisabled = true;
                }
            }
        }

    }
private function validDynamic(Field $field)
    {
        if ($field->dynamic === null || !is_array($field->dynamic)) {
            return;
        }
        $value = $field->value;
        if (is_object($value)) {
            return;
        }
        if (is_array($value)) {
            $value = json_encode($value, JSON_UNESCAPED_UNICODE);
        }
        foreach ($field->dynamic as $item) {
            if (!isset($item['eq']) && !isset($item['neq']) && !isset($item['in']) && !isset($item['nin'])) {
                continue;
            }
            if (!isset($item['hide']) && !isset($item['show']) && !isset($item['off']) && !isset($item['on'])) {
                continue;
            }
            //判断相等
            if (isset($item['eq'])) {
                $bval = $item['eq'];
                if (is_array($bval)) {
                    $bval = json_encode($value, JSON_UNESCAPED_UNICODE);
                }
                if ($bval != $value) {
                    continue;
                }
            }
            //判断不等
            if (isset($item['neq'])) {
                $bval = $item['neq'];
                if (is_array($bval)) {
                    $bval = json_encode($value, JSON_UNESCAPED_UNICODE);
                }
                if ($bval == $value) {
                    continue;
                }
            }
            //在集合里面
            if (isset($item['in'])) {
                $bval = $item['in'];
                if (!is_array($bval)) {
                    continue;
                }
                $in = false;
                foreach ($bval as $bitem) {
                    if (strval($bitem) == strval($value)) {
                        $in = true;
                        break;
                    }
                }
                if (!$in) {
                    continue;
                }
            }
            //不在集合里面
            if (isset($item['nin'])) {
                $bval = $item['nin'];
                if (!is_array($bval)) {
                    continue;
                }
                $in = false;
                foreach ($bval as $bitem) {
                    if (strval($bitem) == strval($value)) {
                        $in = true;
                        break;
                    }
                }
                if ($in) {
                    continue;
                }
            }

            //校验item
            $temp = [];

            foreach (['hide', 'off'] as $type) {
                if (!isset($item[$type])) {
                    continue;
                }
                if (!(is_string($item[$type]) || is_array($item[$type]))) {
                    continue;
                }
                //转数组
                $temp[$type] = is_string($item[$type]) ? explode(',', $item[$type]) : $item[$type];
            }

            if (isset($temp['hide'])) {
                foreach ($temp['hide'] as $name) {
                    if (!is_string($name) || empty($name)) {
                        continue;
                    }
                    $box = $this->getField($name);
                    if ($box == null || empty($box->boxId)) {
                        continue;
                    }
                    $box->dataValDisabled = true;
                    $box->close = true;
                }
            }
            if (isset($temp['off'])) {
                foreach ($temp['off'] as $name) {
                    if (!is_string($name) || empty($name)) {
                        continue;
                    }
                    $box = $this->getField($name);
                    if ($box == null || empty($box->boxId)) {
                        continue;
                    }
                    $box->dataValDisabled = true;
                }
            }
        }

    }
验证动态字段数据
@param Field $field