#
Junjie
3 天以前 070dd3ec9ad599e9c668351ce3d0bd78b54f9745
src/main/webapp/static/js/config/config.js
@@ -998,6 +998,37 @@
        }
    ];
    function applySelectTypeOptions(options) {
        var normalizedOptions = [];
        (options || []).forEach(function (item) {
            var rawValue = '';
            var label = '';
            if (item && typeof item === 'object') {
                rawValue = item.value !== undefined ? item.value : (item.rawValue !== undefined ? item.rawValue : (item.label !== undefined ? item.label : ''));
                label = item.label !== undefined ? item.label : rawValue;
            } else {
                rawValue = item;
                label = item;
            }
            rawValue = isEmptyValue(rawValue) ? '' : String(rawValue);
            label = isEmptyValue(label) ? rawValue : String(label);
            if (!rawValue) {
                return;
            }
            normalizedOptions.push({
                rawValue: rawValue,
                label: label
            });
        });
        fieldMeta.forEach(function (field) {
            if (field.field !== 'selectType') {
                return;
            }
            field.kind = 'enum';
            field.enumOptions = normalizedOptions;
        });
    }
    function isEmptyValue(value) {
        return value === null || value === undefined || value === '';
    }
@@ -1436,6 +1467,7 @@
                }
            },
            created: function () {
                this.fetchSelectTypeOptions();
                this.loadTable();
            },
            mounted: function () {
@@ -1583,6 +1615,26 @@
                        }
                    });
                },
                fetchSelectTypeOptions: function () {
                    var self = this;
                    $.ajax({
                        url: baseUrl + '/config/getSelectTypes',
                        method: 'POST',
                        headers: self.authHeaders(),
                        success: function (res) {
                            if (self.handleForbidden(res)) {
                                return;
                            }
                            if (!res || res.code !== 200) {
                                return;
                            }
                            applySelectTypeOptions(Array.isArray(res.data) ? res.data : []);
                            self.fieldMeta = fieldMeta.slice();
                            self.allColumns = fieldMeta.slice();
                            self.requestTableLayout(80);
                        }
                    });
                },
                handleSearch: function () {
                    this.page.curr = 1;
                    this.loadTable();