zhangzaipeng před 3 roky
rodič
revize
67bee28197

+ 4 - 0
single_table/single-controller.js.ftl

@@ -14,6 +14,10 @@ export default class ${moduleName} extends Scope {
     onLoad() {
     }
 
+    refresh() {
+        this.refs.grid1.reload()
+    }
+
     grid1Select(sender, selected) {
         this.viewModel.set('${primaryKey}', selected[0]?.data?.${primaryKey})
     }

+ 74 - 66
single_table/single-view.js.ftl

@@ -2,6 +2,80 @@ export default {
     title: '${menuName!"默认名称4"}',
     layout: 'fit',
     referenceHolder: true,
+    tbar: {
+    xtype: 'toolbar',
+    items: [
+            {
+                xtype: 'button',
+                text: '刷新',
+                iconCls: 'x-fa fa-plus',
+                listeners: {
+                    click: 'scope.refresh'
+                },
+            },
+            <#switch editType>
+                <#case 1>
+                    <#break>
+                <#case 2>
+                    {
+                        xtype: 'button',
+                        text: '添加',
+                        iconCls: 'x-fa fa-plus',
+                        listeners: {
+                            click: 'scope.add'
+                        },
+                    },
+                    <#break>
+                <#case 3>
+                    {
+                        xtype: 'button',
+                        text: '添加',
+                        iconCls: 'x-fa fa-plus',
+                        listeners: {
+                            click: 'scope.add'
+                        },
+                    },
+                    {
+                        xtype: 'button',
+                        text: '编辑',
+                        iconCls: 'x-fa fa-edit',
+                        bind: {
+                            disabled: '{grid1.selection === null}'
+                        },
+                        listeners: {
+                            click: 'scope.edit'
+                        }
+                    },
+                    <#break>
+                <#default>
+            </#switch>
+            <#if delete?? && delete>
+                {
+                    xtype: 'button',
+                    text: '删除',
+                    iconCls: 'x-fa fa-remove',
+                    bind: {
+                    disabled: '{grid1.selection === null}'
+                    },
+                    listeners: {
+                        click: 'scope.remove'
+                    },
+                },
+            </#if>
+            <#if editType != 1 || delete>
+                {
+                    xtype: 'button',
+                    text: '保存',
+                    iconCls: 'x-fa fa-save',
+                    bind: {
+                    },
+                    listeners: {
+                        click: 'scope.save'
+                    },
+                },
+            </#if>
+            ]
+    },
     items: [
         {
             layout: 'border',
@@ -36,72 +110,6 @@ export default {
                         selectionchange: 'scope.grid1Select'
                     },
                     </#if>
-                    tbar: {
-                        xtype: 'toolbar',
-                        items: [
-                        <#switch editType>
-                            <#case 1>
-                                <#break>
-                            <#case 2>
-                            {
-                                xtype: 'button',
-                                text: '添加',
-                                iconCls: 'x-fa fa-plus',
-                                listeners: {
-                                    click: 'scope.add'
-                                },
-                            },
-                                <#break>
-                            <#case 3>
-                            {
-                                xtype: 'button',
-                                text: '添加',
-                                iconCls: 'x-fa fa-plus',
-                                listeners: {
-                                    click: 'scope.add'
-                                },
-                            },
-                            {
-                                xtype: 'button',
-                                text: '编辑',
-                                iconCls: 'x-fa fa-edit',
-                                bind: {
-                                    disabled: '{grid1.selection === null}'
-                                },
-                                listeners: {
-                                    click: 'scope.edit'
-                                }
-                            },
-                            <#break>
-                            <#default>
-                        </#switch>
-                        <#if delete?? && delete>
-                            {
-                                xtype: 'button',
-                                text: '删除',
-                                iconCls: 'x-fa fa-remove',
-                                bind: {
-                                    disabled: '{grid1.selection === null}'
-                                },
-                                listeners: {
-                                    click: 'scope.remove'
-                                },
-                            },
-                        </#if>
-                        <#if editType != 1 || delete>
-                            {
-                                xtype: 'button',
-                                text: '保存',
-                                iconCls: 'x-fa fa-save',
-                                bind: {
-                                },
-                                listeners: {
-                                    click: 'scope.save'
-                                },
-                            },
-                        </#if>
-                        ]
-                    },
                     columns: [
                         {
                             xtype: "rownumberer",