systemLib.d.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. export declare const SIMPLE_RE: RegExp;
  2. /**
  3. * 对某个表达式进行求值
  4. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  5. *
  6. * @example
  7. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  8. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  9. *
  10. * @param data 数据环境对象
  11. * @param express 表达式对象
  12. */
  13. export declare function calcExpress(data: any, express: any): any;
  14. /**
  15. * 对个对象进行表达式求值,不用回调
  16. * @example
  17. * calcObjectFlat({query:{a:'aValue',b1:'b1Value',b2:'b2Value',d1:1,d2:2}}, { a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}'] })
  18. *
  19. * {
  20. * a: '{query.a}',
  21. * b: {
  22. * b1: '{query.b1}',
  23. * b2: '{query.b2}',
  24. * },
  25. * c: 'aa',
  26. * d: [
  27. * '{query.d1}',
  28. * '{query.d2}'
  29. * ]
  30. * }
  31. *
  32. * 计算结果为
  33. * {
  34. * a: 'aValue',
  35. * b: {
  36. * b1: 'b1Value',
  37. * b2: 'b2Value'
  38. * },
  39. * c: 'aa'
  40. * d: [
  41. * '1',
  42. * '2'
  43. * ]
  44. * }
  45. *
  46. * @param data
  47. * @param paramObject
  48. */
  49. export declare function calcObjectFlat(data: any, paramObject: any): any;
  50. /**
  51. * 合併 data 到當前的 ViewModel 對象
  52. */
  53. export declare function mergeViewModel(viewModel: any, propertyName: any, data: any): void;
  54. /**
  55. * 转换内联结构的行,到平面结构
  56. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  57. *
  58. * @param array
  59. * @param flatOption
  60. * @return {[]}
  61. */
  62. export declare function flatRow(array: any): any[];
  63. /**
  64. * 根据表达式进入写值
  65. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  66. * express="test-{query.a}" 写值就会失败
  67. *
  68. * @example
  69. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  70. * 写值成功
  71. *
  72. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  73. * 写值失败
  74. *
  75. * @param viewModel VM对象
  76. * @param express 表达式对象
  77. * @param value 目标值
  78. */
  79. export declare function tryWriteByExpress(viewModel: any, express: any, value: any): void;
  80. /**
  81. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  82. * @example
  83. * tryWriteObject({ a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}']}, {a:'aValue', b:{b1:'b1Value', b2:'b2Value'}, c:'aa', d:[1,2]})
  84. *
  85. * expressObject:
  86. * {
  87. * a: '{query.a}',
  88. * b: {
  89. * b1: '{query.b1}',
  90. * b2: '{query.b2}',
  91. * },
  92. * c: 'aa',
  93. * d: [
  94. * '{query.a}',
  95. * '{query.b2}'
  96. * ]
  97. * }
  98. *
  99. * valueObject:
  100. * {
  101. * a: 'aValue',
  102. * b: {
  103. * b1: 'b1Value',
  104. * b2: 'b2Value'
  105. * },
  106. * c: 'aa'
  107. * c: [
  108. * 'aValue',
  109. * 'b2Value'
  110. * ]
  111. * }
  112. *
  113. * 系统会尝试回写
  114. * viewModel.set('query.a', 'aValue')
  115. * viewModel.set('query.b1', 'b1Value')
  116. * viewModel.set('query.b2', 'b2Value')
  117. *
  118. * @param expressObject 含表达式的对象
  119. * @param valueObject 表达式计算完成之后的结果对象
  120. * @param writeFn 写入的方法 (path, value)=>void
  121. */
  122. export declare function tryWriteObject(expressObject: any, valueObject: any, writeFn: any): void;
  123. /**
  124. * 尝试去掉变量两边括号
  125. * {a} => a
  126. * a => a
  127. */
  128. export declare function tryVarSimple(value: any): any;
  129. /**
  130. * 对多个表达式进行求值. 异步回调的方式返回
  131. * {
  132. * a: 1,
  133. * b: '{someBind}',
  134. * c: ['a', 'b', 'c'],
  135. * d: ['a', 'b', '{someBind}'],
  136. * e: {
  137. * y: 1,
  138. * z: 2
  139. * },
  140. * f: {
  141. * y: 1,
  142. * z: '{someBind}'
  143. * }
  144. * }
  145. *
  146. * // Will produce
  147. * {
  148. * b: value,
  149. * d: ['a', 'b', value],
  150. * f: {
  151. * y: 1,
  152. * z: value
  153. * }
  154. * }
  155. * @param viewModel scope.viewModel对象
  156. * @param paramObject 求值对象
  157. */
  158. export declare function calcObject(viewModel: any, paramObject: any): Promise<unknown>;
  159. /**
  160. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  161. * @param config 组件构造函数传入的 config 配置文件
  162. */
  163. export declare function getParentGrid(config: any): any;
  164. /**
  165. * 解析
  166. * {
  167. * condition: "{skuId}",
  168. * errorMsg: "无法编辑",
  169. * notice: 'msg'
  170. * }
  171. */
  172. export declare function tryEnable(data: any, enableSetting: any): boolean;
  173. /**
  174. * 动态的为 combo 或 columns.combo 设置下拉框的值
  175. * @param sender 目标对象
  176. * @param config 目标对象的配置(在构造函数之前也可以)
  177. * @param getDictFn 获取字典的方法
  178. * @param bizKey 传入字典的参数
  179. * @param multiValueSeparator 多个字典值的分割符号
  180. */
  181. export declare function setComboStore(sender: any, config: any, getDictFn: any, bizKey: any, multiValueSeparator?: string): Promise<unknown>;
  182. /**
  183. * 调用服务器 Ajax
  184. */
  185. export declare function invokeServer(url: string, ...args: any[]): any;
  186. export declare function clearViewModelValues(viewModel: any, propertyName: any): void;
  187. export declare function reloadGrid(scope: any, gridRefName: any): void;
  188. /**
  189. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  190. */
  191. export declare function toPlainObject(obj: any): any;
  192. export declare function confirm(msg: any, sender?: any): Promise<void>;
  193. /**
  194. * 任何符号字符串都替换成下换线
  195. */
  196. export declare function normId(value: string): string;
  197. /**
  198. *
  199. * @param sender
  200. * @param propertyName
  201. * @param gridRefName
  202. */
  203. export declare function clearViewModelReloadGrid(sender: any, propertyName: any, gridRefName: any): void;
  204. export declare class SystemEventFu {
  205. confirm(text: any, fn: any): (sender: any) => void;
  206. gridRemoveCurrentRow(gridRefName: any): (sender: any) => void;
  207. loadForm(invokeUrl: string, invokeParam: any, writeTarget: any): (sender: any) => void;
  208. commit(groovyUrl: string, arg0: any, successCallback: any): (sender: any) => void;
  209. formCommit(groovyUrl: string, arg0: any): (sender: any) => void;
  210. dialogSuccess(lookupObject: any): (sender: any) => void;
  211. clearViewModelValues(propertyName: string): (sender: any) => void;
  212. getGrid(url: any): (sender: any, config: any) => void;
  213. clearViewModelReloadGrid(propertyName: string, gridRefName?: string): (sender: any) => void;
  214. reloadGrid(gridRefName: string): (sender: any) => void;
  215. showDialog(url: string, lookupForData: any, successCallback: any): (sender: any) => void;
  216. showWidget(widgetUrl: any, lookup: any): (sender: any, queryValue: any) => void;
  217. clearViewModelByLookup(lookup: any): (sender: any) => void;
  218. closeMe(callBack: any): (sender: any) => void;
  219. }
  220. /**
  221. * 清空 viewmodel 里下属的所有属性
  222. * @param viewModel VM对象
  223. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  224. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  225. */
  226. export declare function clearViewModel(viewModel: any, propertyKey: any, ignoreProps: any): void;
  227. export declare function clearViewModelByLookup(sender: any, lookup: any): void;
  228. export declare function showWidget(widgetUrl: any, lookup: any, sender: any, queryValue: any, vjson?: {}): void;
  229. /**
  230. * 停止事件的默认行为
  231. * @param e
  232. */
  233. export declare function stopEvent(e: any): void;
  234. /**
  235. * 屏幕中央显示一个黑框提示
  236. */
  237. export declare function msg(content: any): void;
  238. /**
  239. * 错误对话框的强提醒
  240. */
  241. export declare function showErrorDialog(msg: any, sender?: any): void;
  242. /**
  243. * 用于计算 express 表达式
  244. */
  245. export declare function evalFunction(data: any, express: any): any;
  246. /**
  247. * 获取表格编辑的行数据
  248. */
  249. export declare function getGridEditRows(grid: any): {
  250. rows: any[];
  251. newRows: any[];
  252. modifyRows: any[];
  253. removeRecords: any[];
  254. err: string;
  255. };