Sfoglia il codice sorgente

表单引擎 - grid_dialog

luoyifan 2 anni fa
parent
commit
d5cee7c680
2 ha cambiato i file con 717 aggiunte e 1 eliminazioni
  1. 716 0
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 716 - 0
dist/yvan-ext.js

@@ -130327,6 +130327,646 @@ define(['exports'], function (exports) { 'use strict';
         delete ret.wrap;
         return ret;
     }
+    //# sourceMappingURL=grid_dialog.js.map
+
+    var model$1 = {
+        data: {}
+    };
+    //# sourceMappingURL=GridColumnCustom.model.js.map
+
+    var vjson = {
+        title: '自定义表格属性',
+        layout: 'fit',
+        width: 980,
+        height: 500,
+        fbar: [
+            {
+                xtype: "button",
+                text: "保存",
+                iconCls: 'x-fa fa-save',
+                listeners: {
+                    click: 'scope.commit',
+                }
+            },
+            {
+                xtype: "button",
+                text: "关闭",
+                iconCls: 'x-fa fa-times',
+                listeners: {
+                    click: 'system.closeMe()',
+                }
+            },
+        ],
+        items: [
+            {
+                region: 'center',
+                xtype: 'tabpanel',
+                items: [
+                    {
+                        title: '基本信息', reference: 'basic',
+                        layout: {
+                            type: 'vbox',
+                            pack: 'start',
+                            align: 'stretch'
+                        },
+                        defaults: {
+                            border: false,
+                            anchor: '100%',
+                            margin: '5',
+                        },
+                        scrollable: true,
+                        items: [
+                            {
+                                xtype: 'cols',
+                                items: [
+                                    {
+                                        fieldLabel: '路径',
+                                        bind: { value: '{__custom_path}' },
+                                        xtype: 'textfield',
+                                        flex: 2,
+                                    },
+                                    {
+                                        fieldLabel: '版本',
+                                        bind: { value: '{__custom_version}' },
+                                        xtype: 'textfield',
+                                    },
+                                ]
+                            },
+                            {
+                                xtype: 'cols',
+                                items: [
+                                    {
+                                        fieldLabel: '配置点',
+                                        bind: { value: '{__custom_point}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: 'reference',
+                                        bind: { value: '{reference}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: '编辑模式',
+                                        bind: { value: '{_mode}' },
+                                        xtype: 'combo',
+                                        dict: 'GRID_MODE',
+                                    },
+                                ]
+                            },
+                            {
+                                layout: 'hbox',
+                                defaults: {
+                                    margin: '0 0 0 15',
+                                },
+                                items: [
+                                    {
+                                        boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideFootbar}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏刷新', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideRefresh}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏导出', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideExport}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏自动调宽', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideAutoSize}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏清空筛选', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideClearFilter}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏保存布局', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideSaveGridUIConfig}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏重置布局', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hideClearGridUIConfig}"
+                                        }
+                                    },
+                                ]
+                            },
+                            {
+                                layout: 'hbox',
+                                defaults: {
+                                    margin: '0 0 0 15',
+                                },
+                                items: [
+                                    {
+                                        boxLabel: '自动载入数据源', xtype: 'checkbox',
+                                        bind: { value: '{autoLoad}' },
+                                        margin: '0 0 0 85',
+                                    },
+                                    {
+                                        boxLabel: '分页模式', xtype: 'checkbox',
+                                        bind: { value: '{pagination}' },
+                                    },
+                                    {
+                                        boxLabel: '显示行序号', xtype: 'checkbox',
+                                        bind: { value: '{show_rownum}' },
+                                    },
+                                    {
+                                        boxLabel: '后端排序', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{remoteSort}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '后端过滤', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{remoteFilter}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '隐藏', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{hidden}"
+                                        }
+                                    },
+                                ]
+                            },
+                            {
+                                layout: 'hbox',
+                                defaults: {
+                                    margin: '0 0 0 15',
+                                },
+                                items: [
+                                    {
+                                        boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
+                                        bind: {
+                                            value: "{enableColumnHide}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '用户拖拽字段', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{enableColumnMove}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '自定义筛选', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{gridfilters}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{enableColumnResize}"
+                                        }
+                                    },
+                                    {
+                                        boxLabel: '点击列头排序', xtype: 'checkbox',
+                                        bind: {
+                                            value: "{sortOnClick}"
+                                        }
+                                    },
+                                ]
+                            },
+                            {
+                                xtype: 'cols',
+                                items: [
+                                    {
+                                        fieldLabel: 'dbTableName',
+                                        labelWidth: 110,
+                                        bind: { value: '{behavior.dbTableName}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: 'theid',
+                                        bind: { value: '{theid}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: '添加行聚焦',
+                                        bind: { value: '{behavior.focusColumnAfterInsert}' },
+                                        xtype: 'textfield',
+                                    },
+                                ]
+                            },
+                            {
+                                xtype: 'cols',
+                                items: [
+                                    {
+                                        fieldLabel: '批量删除提示',
+                                        labelWidth: 110,
+                                        bind: { value: '{behavior.batchRemoveConfirm}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: '删除提示',
+                                        bind: { value: '{behavior.singleRemoveConfirm}' },
+                                        xtype: 'textfield',
+                                    },
+                                    {
+                                        fieldLabel: '触发刷新',
+                                        labelWidth: 110,
+                                        bind: { value: '{behavior.selectToReload}' },
+                                        xtype: 'textfield',
+                                    },
+                                ]
+                            },
+                        ]
+                    },
+                    {
+                        title: '字段', reference: 'grid1',
+                        xtype: 'yvgrid',
+                        pagination: false,
+                        _mode: 'edit',
+                        listeners: {
+                            buttonclick: 'scope.grid1Buttonclick',
+                        },
+                        hideFootbar: true,
+                        tbar: [
+                            {
+                                xtype: 'button',
+                                text: '添加',
+                                iconCls: 'x-fa fa-plus-circle',
+                                listeners: {
+                                    click: 'scope.addField'
+                                }
+                            },
+                            {
+                                xtype: 'button',
+                                text: '删除',
+                                iconCls: 'x-fa fa-minus-circle',
+                                listeners: {
+                                    click: 'scope.removeField'
+                                }
+                            },
+                            '-',
+                            {
+                                xtype: 'button',
+                                text: '自动分析',
+                                iconCls: 'x-fa fa-code-fork',
+                                listeners: {
+                                    click: 'scope.calcField'
+                                }
+                            },
+                            {
+                                xtype: 'button',
+                                text: '上移',
+                                iconCls: 'x-fa fa-arrow-up',
+                                listeners: {
+                                    click: 'scope.moveUp'
+                                }
+                            },
+                            {
+                                xtype: 'button',
+                                text: '下移',
+                                iconCls: 'x-fa fa-arrow-down',
+                                listeners: {
+                                    click: 'scope.moveDown'
+                                }
+                            },
+                        ],
+                        store: {},
+                        columns: [
+                            {
+                                dataIndex: 'dataIndex', header: "字段名", width: 140,
+                                editor: { xtype: 'textfield' }
+                            },
+                            {
+                                dataIndex: 'dbColumn', header: "数据库字段", width: 140,
+                                editor: { xtype: 'textfield' }
+                            },
+                            {
+                                dataIndex: 'header', header: '中文', width: 140,
+                                editor: { xtype: 'textfield' }
+                            },
+                            {
+                                dataIndex: 'dict', header: '字典', width: 110,
+                                editor: { xtype: 'combogrid' }
+                            },
+                            {
+                                dataIndex: 'editor_widget', header: '下拉表', width: 110,
+                                editor: { xtype: 'combogrid' }, hidden: true,
+                            },
+                            {
+                                dataIndex: 'width', header: '宽度', width: 80,
+                                editor: { xtype: 'numberfield' }, hidden: true,
+                            },
+                            {
+                                dataIndex: 'editor_xtype', header: '编辑器', width: 170,
+                                editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
+                            },
+                            {
+                                dataIndex: 'serverCreateValue', header: '服务端创建值',
+                                editor: { xtype: 'textfield' },
+                            },
+                            {
+                                dataIndex: 'createValue', text: '客户端新创建值',
+                                editor: { xtype: 'textfield' },
+                            },
+                            {
+                                dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false,
+                            },
+                            {
+                                dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false,
+                            },
+                            {
+                                dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false,
+                            },
+                            {
+                                dataIndex: 'formatter', header: '格式化', width: 110,
+                                editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
+                            },
+                            {
+                                dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false, hidden: true,
+                            },
+                            {
+                                dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                hidden: true,
+                            },
+                            {
+                                dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false, hidden: true,
+                            },
+                            {
+                                dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
+                                resizable: false, sortable: false, menuDisabled: true,
+                            },
+                            {
+                                dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false, hidden: true,
+                            },
+                            {
+                                dataIndex: 'form_order', text: '对话框序号',
+                                editor: { xtype: 'numberfield' },
+                            },
+                            {
+                                dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false,
+                            },
+                            {
+                                dataIndex: 'form_xtype', text: '对话框编辑器',
+                                editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
+                            },
+                            {
+                                dataIndex: 'form_fieldset', text: '对话框字段组',
+                                editor: { xtype: 'textfield' }, hidden: true,
+                            },
+                            {
+                                dataIndex: 'form_tab', text: '对话框选项卡',
+                                editor: { xtype: 'textfield' }, hidden: true,
+                            },
+                            {
+                                dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
+                                resizable: false, sortable: false, menuDisabled: true,
+                                checkedValue: true, uncheckedValue: false, hidden: true,
+                            },
+                        ],
+                    },
+                    {
+                        title: 'SQL和查询条件', reference: 'sql',
+                        layout: 'border',
+                        border: false,
+                        items: [
+                            {
+                                region: 'north',
+                                height: 200,
+                                border: false,
+                                split: true,
+                                xtype: 'yvgrid',
+                                reference: 'gridCondition',
+                                pagination: false,
+                                hideFootbar: true,
+                                _mode: 'edit',
+                                listeners: {
+                                    buttonclick: 'scope.conditionButtonclick',
+                                },
+                                store: {},
+                                tbar: {
+                                    xtype: 'toolbar',
+                                    border: false,
+                                    items: [
+                                        {
+                                            xtype: 'button',
+                                            text: '添加条件',
+                                            iconCls: 'x-fa fa-plus-circle',
+                                            listeners: {
+                                                click: 'scope.addCondition'
+                                            }
+                                        },
+                                        {
+                                            xtype: 'button',
+                                            text: '删除条件',
+                                            iconCls: 'x-fa fa-minus-circle',
+                                            listeners: {
+                                                click: 'scope.removeCondition'
+                                            }
+                                        },
+                                        '-',
+                                        {
+                                            xtype: 'button',
+                                            text: '自动分析条件变量',
+                                            iconCls: 'x-fa fa-code-fork',
+                                            listeners: {
+                                                click: 'scope.calcCondition'
+                                            }
+                                        },
+                                        {
+                                            xtype: 'button',
+                                            text: '上移',
+                                            iconCls: 'x-fa fa-arrow-up',
+                                            listeners: {
+                                                click: 'scope.moveUpCondition'
+                                            }
+                                        },
+                                        {
+                                            xtype: 'button',
+                                            text: '下移',
+                                            iconCls: 'x-fa fa-arrow-down',
+                                            listeners: {
+                                                click: 'scope.moveDownCondition'
+                                            }
+                                        },
+                                    ]
+                                },
+                                columns: [
+                                    {
+                                        text: '条件变量',
+                                        dataIndex: 'param_name',
+                                        width: 140,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            selectOnFocus: true
+                                        },
+                                    },
+                                    {
+                                        text: '中文标题',
+                                        dataIndex: 'fieldLabel',
+                                        width: 120,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            selectOnFocus: true
+                                        },
+                                    },
+                                    {
+                                        text: '编辑类型',
+                                        dataIndex: 'xtype',
+                                        width: 80,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            xtype: 'combo',
+                                            typeAhead: true,
+                                            triggerAction: 'all',
+                                            selectOnFocus: true,
+                                            store: [
+                                                ['textfield', 'textfield'],
+                                                ['combo', 'combo'],
+                                                ['datefield', 'datefield'],
+                                                ['datetimefield', 'datetimefield'],
+                                                ['numberfield', 'numberfield'],
+                                                ['multiplesearch', 'multiplesearch'],
+                                            ]
+                                        }
+                                    },
+                                    {
+                                        text: '权重',
+                                        dataIndex: 'conditionFieldFlex',
+                                        align: 'right',
+                                        width: 60,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            xtype: 'numberfield',
+                                            selectOnFocus: false,
+                                            minValue: 0,
+                                            maxValue: 10
+                                        },
+                                    },
+                                    {
+                                        text: '字典',
+                                        dataIndex: 'conditionFieldDict',
+                                        width: 160,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            selectOnFocus: false
+                                        },
+                                    },
+                                    {
+                                        xtype: 'checkcolumn',
+                                        dataIndex: "conditionFieldWrap", header: "换行",
+                                        width: 65,
+                                        sortable: false,
+                                        menuDisabled: true,
+                                    },
+                                    {
+                                        text: '扩展参数',
+                                        dataIndex: 'conditionFieldExtend',
+                                        sortable: false,
+                                        menuDisabled: true,
+                                        editor: {
+                                            selectOnFocus: false
+                                        },
+                                    },
+                                ]
+                            },
+                            {
+                                region: 'center',
+                                xtype: 'sqleditor',
+                                layout: 'fit',
+                                reference: 'sqlEditor',
+                                split: true,
+                            },
+                        ]
+                    },
+                ]
+            }
+        ]
+    };
+
+    var GridColumnCustom = /** @class */ (function (_super) {
+        __extends(GridColumnCustom, _super);
+        function GridColumnCustom() {
+            return _super.call(this, { model: model$1, vjson: vjson }) || this;
+        }
+        GridColumnCustom.prototype.commit = function () {
+        };
+        GridColumnCustom.prototype.grid1Buttonclick = function () {
+        };
+        GridColumnCustom.prototype.conditionButtonclick = function () {
+        };
+        GridColumnCustom.prototype.addField = function () {
+        };
+        GridColumnCustom.prototype.removeField = function () {
+        };
+        GridColumnCustom.prototype.calcField = function () {
+        };
+        GridColumnCustom.prototype.moveUp = function () {
+        };
+        GridColumnCustom.prototype.moveDown = function () {
+        };
+        GridColumnCustom.prototype.addCondition = function () {
+        };
+        GridColumnCustom.prototype.removeCondition = function () {
+        };
+        GridColumnCustom.prototype.calcCondition = function () {
+        };
+        GridColumnCustom.prototype.moveUpCondition = function () {
+        };
+        GridColumnCustom.prototype.moveDownCondition = function () {
+        };
+        return GridColumnCustom;
+    }(Scope));
+    //# sourceMappingURL=GridColumnCustom.js.map
+
+    function initGridCode(grid, newConfig, buttons) {
+        if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
+            buttons.push({
+                xtype: 'button',
+                tooltip: '定义表格属性',
+                iconCls: 'x-fa fa-codepen',
+                handler: function (btn) {
+                    var customWindow = new GridColumnCustom();
+                    customWindow.showDialog(btn, {}, {});
+                }
+            });
+            buttons.push({
+                xtype: 'button',
+                tooltip: '定义表格数据源',
+                iconCls: 'x-fa fa-database',
+                handler: function () {
+                    // showCustomGridDataSource(grid)
+                }
+            });
+        }
+    }
+    //# sourceMappingURL=grid_code.js.map
 
     window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
     var hexToString = function (hex) {
@@ -130437,6 +131077,7 @@ define(['exports'], function (exports) { 'use strict';
                         handler: this.clearGridUIConfig
                     });
                 }
+                initGridCode(me, newConfig, buttons);
                 if (!newConfig.hideFootbar) {
                     if (newConfig.pagination) {
                         newConfig.bbar = new Ext.PagingToolbar({
@@ -135166,6 +135807,80 @@ define(['exports'], function (exports) { 'use strict';
     }
     //# sourceMappingURL=SqlEditor.js.map
 
+    function initDict () {
+        var DICT_CACHE = window['DICT_CACHE'];
+        if (!DICT_CACHE) {
+            DICT_CACHE = {};
+            window['DICT_CACHE'] = DICT_CACHE;
+        }
+        DICT_CACHE.XTYPE = [
+            { id: 'datefield', text: '日期' },
+            { id: 'datetimefield', text: '日期时间' },
+            { id: 'textfield', text: '文本' },
+            { id: 'numberfield', text: '数字' },
+            { id: 'combo', text: '下拉框' },
+        ];
+        DICT_CACHE.operator = [
+            { id: '=', text: '=' },
+            { id: '>', text: '>' },
+            { id: '<', text: '<' },
+            { id: '>=', text: '>=' },
+            { id: '<=', text: '<=' },
+            { id: 'in', text: 'in' },
+            { id: 'notIn', text: 'notIn' },
+        ];
+        DICT_CACHE.GRID_MODE = [
+            { id: 'edit1', text: '单机编辑模式' },
+            { id: 'edit2', text: '双击编辑模式' },
+            { id: 'checkbox', text: '勾选' },
+            { id: 'checkonly', text: '只勾选' },
+            { id: 'select', text: '行选择模式' },
+        ];
+        DICT_CACHE.BOTH_SELECT = [
+            { id: 'N/A', text: '<无>' },
+            { id: 'textfield', text: '文本' },
+            { id: 'numberfield', text: '数字框' },
+            { id: 'datefield', text: '日期' },
+            { id: 'datetimefield', text: '日期时间' },
+            { id: 'combo', text: '下拉框' },
+            { id: 'combogrid', text: '下拉表' },
+            { id: 'checkbox', text: '勾选' },
+        ];
+        DICT_CACHE.ROW_LAYOUT = [
+            { id: 'flex', text: '按权重摆放' },
+            { id: 'hbox', text: '按宽度摆放' },
+        ];
+        DICT_CACHE.GRID_XTYPE = [
+            { id: 'N/A', text: '<无>' },
+            { id: 'textfield', text: '文本-textfield' },
+            { id: 'numberfield', text: '数字框-numberfield' },
+            { id: 'datefield', text: '日期-datefield' },
+            { id: 'datetimefield', text: '日期时间-datetimefield' },
+            { id: 'combo', text: '下拉框-combo' },
+            { id: 'combogrid', text: '下拉表-combogrid' },
+            { id: 'checkbox', text: '勾选-checkbox' },
+        ];
+        DICT_CACHE.FORM_XTYPE = [
+            { id: 'N/A', text: '<无>' },
+            { id: 'textfield', text: '文本-textfield' },
+            { id: 'numberfield', text: '数字框-numberfield' },
+            { id: 'datefield', text: '日期-datefield' },
+            { id: 'datetimefield', text: '日期时间-datetimefield' },
+            { id: 'combo', text: '下拉框-combo' },
+            { id: 'combogrid', text: '下拉表-combogrid' },
+            { id: 'checkbox', text: '勾选-checkbox' },
+            { id: 'multiplesearch', text: '多段文本-multiplesearch' },
+        ];
+        DICT_CACHE.GRID_FORMATTER = [
+            { id: 'N/A', text: '默认' },
+            { id: 'rownum', text: '序号-rownum' },
+            { id: 'button', text: '按钮-button' },
+            { id: 'checkbox', text: '勾选-checkbox' },
+            { id: 'progres', text: '进度条-progres' },
+        ];
+    }
+    //# sourceMappingURL=dict.js.map
+
     var FixClass = /** @class */ (function () {
         function FixClass() {
         }
@@ -135416,6 +136131,7 @@ define(['exports'], function (exports) { 'use strict';
         initSqlEditor();
         initSqlComplex();
         initParamComplex();
+        initDict();
     }
     //# sourceMappingURL=init.js.map
 

File diff suppressed because it is too large
+ 1 - 1
dist/yvan-ext.js.map