Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #10

Closed
Yolo-00 opened this issue Mar 29, 2024 · 8 comments
Closed

bug #10

Yolo-00 opened this issue Mar 29, 2024 · 8 comments

Comments

@Yolo-00
Copy link

Yolo-00 commented Mar 29, 2024

image
第一次配置完表单数据后,保存
第二次进入使用第一次保存的数据表单生成没有问题但是字段名称 fieldName 会重新生成
这样会导致第一次保存时写入的显示条件报错并失效

@haixin-fang
Copy link
Owner

@Yolo-00 这个问题比较大 感谢反馈 这两天我修复下 非常感谢

@Yolo-00
Copy link
Author

Yolo-00 commented Apr 7, 2024

@haixin-fang
方便问下这个问题在进程中吗?

@haixin-fang
Copy link
Owner

@Yolo-00 无法复现 有demo吗

@Yolo-00
Copy link
Author

Yolo-00 commented Apr 7, 2024

重复设置就能复现出来
第一次设置没有问题
当点击设置按钮 再次设置, fieldName 就会重新生成,而不是根据initConfig设置value

<el-button @click="handleSet">设置</el-button>
const handleSet = () => {
    editorRef.value.setJson(initConfig);
};
onMounted(() =>{
 editorRef.value.setJson(initConfig);
})
# initConfig
[
    {
        "ControlType": "Selected",
        "nameCn": "选择器",
        "id": "w4W4kdKNfeon1zp3rHPbk",
        "layout": false,
        "data": {
            "fieldName": "structure",
            "label": "电箱结构",
            "tip": "",
            "placeholder": "请选择电箱结构",
            "showRule": "{}",
            "required": true,
            "rule": "[]",
            "itemConfig": {
                "value": "",
                "items": [
                    {
                        "label": "一体式",
                        "value": "Y",
                        "select": false,
                        "id": 1
                    },
                    {
                        "label": "分体式",
                        "value": "F",
                        "select": false,
                        "id": 2
                    },
                    {
                        "label": "其他类型",
                        "value": "Q",
                        "select": false,
                        "id": 3
                    }
                ],
                "id": ""
            },
            "csslist": []
        }
    },
    {
        "ControlType": "Selected",
        "nameCn": "选择器",
        "id": "6ho85NPNrPQ0PQSxzKTSj",
        "layout": false,
        "data": {
            "fieldName": "coldStorage",
            "label": "冷库类型",
            "tip": "",
            "placeholder": "请选择冷库类型",
            "showRule": "{}",
            "required": true,
            "rule": "[]",
            "itemConfig": {
                "value": "",
                "items": [
                    {
                        "label": "医用冷库",
                        "value": "Y",
                        "select": false,
                        "id": 1
                    },
                    {
                        "label": "常规冷库",
                        "value": "C",
                        "select": false,
                        "id": 2
                    },
                    {
                        "label": "其他类型",
                        "value": "Q",
                        "select": false,
                        "id": 3
                    }
                ],
                "id": ""
            }
        }
    },
    {
        "ControlType": "Selected",
        "nameCn": "选择器",
        "id": "DhNx9iDzSTiPmBcRblyEW",
        "layout": false,
        "data": {
            "fieldName": "productionUnit",
            "label": "生产机组(台)",
            "tip": "",
            "placeholder": "请选择生产机组",
            "showRule": [
                [
                    {
                        "field": "coldStorage",
                        "logic": "=",
                        "type": "选项",
                        "value": "Y"
                    }
                ]
            ],
            "required": true,
            "rule": "[]",
            "itemConfig": {
                "value": "",
                "items": [
                    {
                        "label": "1",
                        "value": "1",
                        "select": false,
                        "id": 1
                    },
                    {
                        "label": "2",
                        "value": "2",
                        "select": false,
                        "id": 2
                    }
                ],
                "id": ""
            }
        }
    },
    {
        "ControlType": "Text",
        "nameCn": "文本框",
        "id": "Sd8QZrr3EQ5E4Kf5Qn7-W",
        "layout": false,
        "data": {
            "fieldName": "unitPower",
            "label": "机组功率(HP)",
            "tip": "",
            "placeholder": "请输入机组功率",
            "showRule": [
                [
                    {
                        "field": "structure",
                        "logic": "!=",
                        "type": "选项",
                        "value": "Y"
                    }
                ]
            ],
            "required": true,
            "rule": [],
            "default": ""
        }
    }
]

@Yolo-00
Copy link
Author

Yolo-00 commented Apr 11, 2024

@haixin-fang 大佬这个问题解决了吗?

@haixin-fang
Copy link
Owner

@Yolo-00 这两周太忙了没空看 我这周抽空看下

@Yolo-00
Copy link
Author

Yolo-00 commented Apr 11, 2024

image
我简单看了下应该是这里的问题,但是不确定这个是否有什么特殊作用,所以也没有提交pr

haixin-fang added a commit that referenced this issue Apr 13, 2024
@haixin-fang
Copy link
Owner

@Yolo-00 问题已修复, 当初是因为可能多个表单设置同一个filedName, 所以在底层去重了下, 现在把该限制已去掉

@Yolo-00 Yolo-00 closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants