systemLib.d.ts 7.8 KB

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