Browse Source

serverInvokeUrlTransform 增加参数
grid 增加刷新按钮

luoyifan 3 years ago
parent
commit
0264080e11
5 changed files with 19 additions and 13 deletions
  1. 13 6
      src/controls/grid.js
  2. 1 1
      src/controls/stores.js
  3. 0 1
      src/controls/yvtree.js
  4. 1 1
      src/lib/ajax.ts
  5. 4 4
      src/lib/config.ts

+ 13 - 6
src/controls/grid.js

@@ -3,8 +3,6 @@ import {grid} from '../Defaults'
 import {baseConfig} from "./base";
 import {lookupFn, lookupScope} from "../lib/lib";
 import LAY_EXCEL from "lay-excel"
-import {serverInvokeUrlTransform} from "../lib/config";
-import {calcObject, calcObjectFlat} from "../lib/systemLib";
 import {
     disabled,
     fieldLabel,
@@ -16,7 +14,7 @@ import {
 } from "../PropertyDescriptionTable";
 import {PropertyDescription} from "../PropertyDescription";
 import {gridInvokeBuild} from "./stores";
-import { msg } from 'src/message';
+import {msg} from 'src/message';
 
 
 const defaultGrid = grid
@@ -106,7 +104,7 @@ export default function () {
                 buttons.push({
                     xtype: 'button',
                     tooltip: '保存表格自定义配置',
-                    iconCls: 'x-fa fa-cog',
+                    iconCls: 'x-fa fa-cogs',
                     handler: this.saveGridUIConfig
                 })
             }
@@ -114,7 +112,7 @@ export default function () {
                 buttons.push({
                     xtype: 'button',
                     tooltip: '还原表格自定义配置',
-                    iconCls: 'x-fa fa-repeat',
+                    iconCls: 'x-fa fa-reply-all',
                     handler: this.clearGridUIConfig
                 })
             }
@@ -158,7 +156,16 @@ export default function () {
                     newConfig.bbar = {
                         xtype: 'toolbar', overflowHandler: 'menu',
                         items: [
-                            ...buttons
+                            {
+                                xtype: 'button',
+                                tooltip: '刷新',
+                                iconCls: 'x-fa fa-refresh',
+                                handler: () => {
+                                    this.reload()
+                                }
+                            },
+                            '-',
+                            ...buttons,
                         ]
                     }
                 }

+ 1 - 1
src/controls/stores.js

@@ -21,7 +21,7 @@ export function gridInvokeBuild(scope, grid, config, dataSource, reloadParams =
             proxy: {
                 type: 'jsonAjax',
                 $owner: me,
-                url: serverInvokeUrlTransform(dataSource.url),
+                url: serverInvokeUrlTransform(dataSource.url, {scope, grid, isExcelExport, excelExportCallBack}),
                 extraParams: _.defaultsDeep({}, reloadParams, params),
                 reader: {
                     type: 'json',

+ 0 - 1
src/controls/yvtree.js

@@ -2,7 +2,6 @@ import _ from 'lodash'
 import {tree} from '../Defaults'
 import {baseConfig} from "./base";
 import {lookupFn, lookupScope} from "../lib/lib";
-import {serverInvokeUrlTransform} from "../lib/config";
 import {calcObject, calcObjectFlat, invokeServer} from "../lib/systemLib";
 import {msg} from "../message";
 

+ 1 - 1
src/lib/ajax.ts

@@ -130,7 +130,7 @@ export function createAjax(createOption: CreateAjaxOption): ApiFunction {
                 break
 
             case "invoke":
-                ax.url = serverInvokeUrlTransform(option.url)
+                ax.url = serverInvokeUrlTransform(option.url, option)
                 ax.method = 'POST';
                 ax.headers = {
                     'Content-Type': 'application/json',

+ 4 - 4
src/lib/config.ts

@@ -2,9 +2,9 @@ import {ConfigProcess} from "../types";
 import {ApiFunction} from "./ajax";
 import _ from 'lodash'
 
-export type ServerInvokeUrlTransformFunction = (jsUrl: string) => string | undefined;
+export type ServerInvokeUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
 
-export type SqlUrlTransformFunction = (jsUrl: string) => string | undefined;
+export type SqlUrlTransformFunction = (jsUrl: string, option?: any) => string | undefined;
 
 export interface ApiConvert {
     /**
@@ -94,8 +94,8 @@ export function setDesignMode(v: boolean) {
 /**
  * 将业务定义的 url 转换为调用服务端 groovy 的 url
  */
-export function serverInvokeUrlTransform(url: string): string {
-    return _.get(window, '_YvanUI_serverInvokePrefix')(url);
+export function serverInvokeUrlTransform(url: string, option?: any): string {
+    return _.get(window, '_YvanUI_serverInvokePrefix')(url, option);
 }
 
 /**