aldehyde 0.2.332 → 0.2.334

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/lib/controls/rfield/index.js +1 -1
  2. package/lib/controls/rfield/index.js.map +1 -1
  3. package/lib/detail/button/inline-edit-button.d.ts +13 -0
  4. package/lib/detail/button/inline-edit-button.d.ts.map +1 -0
  5. package/lib/detail/button/inline-edit-button.js +17 -0
  6. package/lib/detail/button/inline-edit-button.js.map +1 -0
  7. package/lib/detail/dtmpl.css +8 -1
  8. package/lib/index.d.ts +2 -1
  9. package/lib/index.d.ts.map +1 -1
  10. package/lib/index.js +3 -1
  11. package/lib/index.js.map +1 -1
  12. package/lib/layout2/components/theme-button.js +1 -1
  13. package/lib/layout2/components/theme-button.js.map +1 -1
  14. package/lib/layout2/components/user-button.d.ts +2 -1
  15. package/lib/layout2/components/user-button.d.ts.map +1 -1
  16. package/lib/layout2/components/user-button.js +8 -2
  17. package/lib/layout2/components/user-button.js.map +1 -1
  18. package/lib/layout3/components/tabs-layout.js +1 -1
  19. package/lib/layout3/components/tabs-layout.js.map +1 -1
  20. package/lib/layout3/css/header.css +166 -138
  21. package/lib/layout3/css/main.css +114 -16
  22. package/lib/layout3/css/sider.css +7 -6
  23. package/lib/layout3/css/tabs-layout.css +17 -8
  24. package/lib/layout3/header.d.ts.map +1 -1
  25. package/lib/layout3/header.js +2 -1
  26. package/lib/layout3/header.js.map +1 -1
  27. package/lib/layout3/page.d.ts.map +1 -1
  28. package/lib/layout3/page.js +1 -1
  29. package/lib/layout3/page.js.map +1 -1
  30. package/lib/layout3/sider.js +1 -1
  31. package/lib/layout3/sider.js.map +1 -1
  32. package/lib/layout4/components/tabs-layout.d.ts +5 -0
  33. package/lib/layout4/components/tabs-layout.d.ts.map +1 -0
  34. package/lib/layout4/components/tabs-layout.js +68 -0
  35. package/lib/layout4/components/tabs-layout.js.map +1 -0
  36. package/lib/layout4/css/header.css +157 -0
  37. package/lib/layout4/css/main.css +119 -0
  38. package/lib/layout4/css/sider.css +11 -0
  39. package/lib/layout4/css/tabs-layout.css +43 -0
  40. package/lib/layout4/header.d.ts +11 -0
  41. package/lib/layout4/header.d.ts.map +1 -0
  42. package/lib/layout4/header.js +137 -0
  43. package/lib/layout4/header.js.map +1 -0
  44. package/lib/layout4/imgs/header-bg.png +0 -0
  45. package/lib/layout4/imgs/home.png +0 -0
  46. package/lib/layout4/imgs/menu-item-bg.png +0 -0
  47. package/lib/layout4/imgs/user.png +0 -0
  48. package/lib/layout4/main.d.ts +8 -0
  49. package/lib/layout4/main.d.ts.map +1 -0
  50. package/lib/layout4/main.js +14 -0
  51. package/lib/layout4/main.js.map +1 -0
  52. package/lib/layout4/page.d.ts +8 -0
  53. package/lib/layout4/page.d.ts.map +1 -0
  54. package/lib/layout4/page.js +60 -0
  55. package/lib/layout4/page.js.map +1 -0
  56. package/lib/layout4/sider.d.ts +10 -0
  57. package/lib/layout4/sider.d.ts.map +1 -0
  58. package/lib/layout4/sider.js +125 -0
  59. package/lib/layout4/sider.js.map +1 -0
  60. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  61. package/lib/lowcode-components/bar-chart/index.js +13 -1
  62. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  63. package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
  64. package/lib/lowcode-components/base-map/index.js +13 -1
  65. package/lib/lowcode-components/base-map/index.js.map +1 -1
  66. package/lib/lowcode-components/base-table/index.d.ts.map +1 -1
  67. package/lib/lowcode-components/base-table/index.js +10 -4
  68. package/lib/lowcode-components/base-table/index.js.map +1 -1
  69. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
  70. package/lib/lowcode-components/capsule-bar-chart/index.js +13 -1
  71. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
  72. package/lib/lowcode-components/carousel/index.d.ts.map +1 -1
  73. package/lib/lowcode-components/carousel/index.js +14 -1
  74. package/lib/lowcode-components/carousel/index.js.map +1 -1
  75. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
  76. package/lib/lowcode-components/circular-progress-chart/index.js +14 -1
  77. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
  78. package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
  79. package/lib/lowcode-components/column-3d-chart/index.js +13 -1
  80. package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
  81. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  82. package/lib/lowcode-components/column-chart/index.js +14 -1
  83. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  84. package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
  85. package/lib/lowcode-components/data-number/index.js +23 -5
  86. package/lib/lowcode-components/data-number/index.js.map +1 -1
  87. package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
  88. package/lib/lowcode-components/effectScatter-map/index.js +13 -1
  89. package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
  90. package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
  91. package/lib/lowcode-components/effectScatter-map-3d/index.js +13 -1
  92. package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
  93. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  94. package/lib/lowcode-components/gauge-chart/index.js +20 -3
  95. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  96. package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
  97. package/lib/lowcode-components/line-bar-chart/index.js +13 -1
  98. package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
  99. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  100. package/lib/lowcode-components/line-chart/index.js +13 -1
  101. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  102. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  103. package/lib/lowcode-components/liquid-chart/index.js +20 -3
  104. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  105. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts +5 -5
  106. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.d.ts.map +1 -1
  107. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js +8 -19
  108. package/lib/lowcode-components/lowcode-view/component/abstract-designer-controller.js.map +1 -1
  109. package/lib/lowcode-components/lowcode-view/component/component-container.d.ts.map +1 -1
  110. package/lib/lowcode-components/lowcode-view/component/component-container.js +6 -5
  111. package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
  112. package/lib/lowcode-components/lowcode-view/component/component-controller.d.ts.map +1 -1
  113. package/lib/lowcode-components/lowcode-view/component/component-controller.js +9 -3
  114. package/lib/lowcode-components/lowcode-view/component/component-controller.js.map +1 -1
  115. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts +0 -4
  116. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts.map +1 -1
  117. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js +7 -5
  118. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js.map +1 -1
  119. package/lib/lowcode-components/lowcode-view/index.d.ts +1 -0
  120. package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
  121. package/lib/lowcode-components/lowcode-view/index.js +54 -11
  122. package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
  123. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  124. package/lib/lowcode-components/pie-chart/index.js +13 -1
  125. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  126. package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
  127. package/lib/lowcode-components/progress-chart/index.js +20 -3
  128. package/lib/lowcode-components/progress-chart/index.js.map +1 -1
  129. package/lib/lowcode-components/stroke-animation/index.d.ts.map +1 -1
  130. package/lib/lowcode-components/stroke-animation/index.js +20 -3
  131. package/lib/lowcode-components/stroke-animation/index.js.map +1 -1
  132. package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -1
  133. package/lib/lowcode-components/text-scroller/index.js +20 -3
  134. package/lib/lowcode-components/text-scroller/index.js.map +1 -1
  135. package/lib/table/act-table.d.ts +8 -0
  136. package/lib/table/act-table.d.ts.map +1 -1
  137. package/lib/table/act-table.js +52 -13
  138. package/lib/table/act-table.js.map +1 -1
  139. package/lib/table/column/column-builder.d.ts.map +1 -1
  140. package/lib/table/column/column-builder.js +32 -8
  141. package/lib/table/column/column-builder.js.map +1 -1
  142. package/lib/table/relation-table.d.ts.map +1 -1
  143. package/lib/table/relation-table.js +2 -0
  144. package/lib/table/relation-table.js.map +1 -1
  145. package/lib/tmpl/hcservice-v3.d.ts +5 -0
  146. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  147. package/lib/tmpl/hcservice-v3.js +17 -0
  148. package/lib/tmpl/hcservice-v3.js.map +1 -1
  149. package/lib/tmpl/interface.d.ts +6 -1
  150. package/lib/tmpl/interface.d.ts.map +1 -1
  151. package/lib/tmpl/interface.js.map +1 -1
  152. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  153. package/lib/tmpl/tmpl-config-analysis.js +2 -2
  154. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  155. package/lib/tree/index.css +11 -9
  156. package/lib/tree/tmpl-tree.js +1 -1
  157. package/lib/tree/tmpl-tree.js.map +1 -1
  158. package/package.json +1 -1
  159. package/src/aldehyde/controls/rfield/index.tsx +1 -1
  160. package/src/aldehyde/detail/button/inline-edit-button.tsx +40 -0
  161. package/src/aldehyde/detail/dtmpl.css +8 -1
  162. package/src/aldehyde/index.tsx +6 -1
  163. package/src/aldehyde/layout2/components/theme-button.tsx +1 -1
  164. package/src/aldehyde/layout2/components/user-button.tsx +23 -14
  165. package/src/aldehyde/layout3/components/tabs-layout.tsx +1 -1
  166. package/src/aldehyde/layout3/css/header.css +166 -138
  167. package/src/aldehyde/layout3/css/main.css +114 -16
  168. package/src/aldehyde/layout3/css/sider.css +7 -6
  169. package/src/aldehyde/layout3/css/tabs-layout.css +17 -8
  170. package/src/aldehyde/layout3/header.tsx +8 -6
  171. package/src/aldehyde/layout3/page.tsx +6 -1
  172. package/src/aldehyde/layout3/sider.tsx +1 -1
  173. package/src/aldehyde/layout4/components/tabs-layout.tsx +106 -0
  174. package/src/aldehyde/layout4/css/header.css +157 -0
  175. package/src/aldehyde/layout4/css/main.css +119 -0
  176. package/src/aldehyde/layout4/css/sider.css +11 -0
  177. package/src/aldehyde/layout4/css/tabs-layout.css +43 -0
  178. package/src/aldehyde/layout4/header.tsx +182 -0
  179. package/src/aldehyde/layout4/imgs/header-bg.png +0 -0
  180. package/src/aldehyde/layout4/imgs/home.png +0 -0
  181. package/src/aldehyde/layout4/imgs/menu-item-bg.png +0 -0
  182. package/src/aldehyde/layout4/imgs/user.png +0 -0
  183. package/src/aldehyde/layout4/imgs/user.svg +27 -0
  184. package/src/aldehyde/layout4/main.tsx +27 -0
  185. package/src/aldehyde/layout4/page.tsx +91 -0
  186. package/src/aldehyde/layout4/sider.tsx +178 -0
  187. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +14 -1
  188. package/src/aldehyde/lowcode-components/base-map/index.tsx +14 -1
  189. package/src/aldehyde/lowcode-components/base-table/index.tsx +29 -12
  190. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +14 -1
  191. package/src/aldehyde/lowcode-components/carousel/index.tsx +15 -1
  192. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +14 -1
  193. package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +14 -1
  194. package/src/aldehyde/lowcode-components/column-chart/index.tsx +15 -1
  195. package/src/aldehyde/lowcode-components/data-number/index.tsx +23 -4
  196. package/src/aldehyde/lowcode-components/data.d.ts +2 -0
  197. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +14 -1
  198. package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +14 -1
  199. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +21 -2
  200. package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +14 -1
  201. package/src/aldehyde/lowcode-components/line-chart/index.tsx +14 -1
  202. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +21 -2
  203. package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-controller.ts +8 -15
  204. package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +7 -6
  205. package/src/aldehyde/lowcode-components/lowcode-view/component/component-controller.ts +10 -4
  206. package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +7 -10
  207. package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +56 -22
  208. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +14 -1
  209. package/src/aldehyde/lowcode-components/progress-chart/index.tsx +21 -2
  210. package/src/aldehyde/lowcode-components/stroke-animation/index.tsx +21 -2
  211. package/src/aldehyde/lowcode-components/text-scroller/index.tsx +21 -2
  212. package/src/aldehyde/table/act-table.tsx +275 -229
  213. package/src/aldehyde/table/column/column-builder.tsx +550 -505
  214. package/src/aldehyde/table/relation-table.tsx +1 -0
  215. package/src/aldehyde/tmpl/hcservice-v3.tsx +29 -0
  216. package/src/aldehyde/tmpl/interface.tsx +6 -1
  217. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +6 -6
  218. package/src/aldehyde/tree/index.css +11 -9
  219. package/src/aldehyde/tree/tmpl-tree.tsx +1 -1
@@ -1,14 +1,9 @@
1
1
  import React from "react";
2
- import {
3
- ActionRenderProps,
4
- ColumnConfig,
5
- DtmplData,
6
- LtmplConfig,
7
- } from "../../tmpl/interface";
2
+ import { ActionRenderProps, ColumnConfig, DtmplData, LtmplConfig, FieldConfig } from "../../tmpl/interface";
8
3
  import TableUnits from "../table-util";
9
4
  import SupportInputTypes from "../../tmpl/control-type-supportor";
10
- import {Button, Popconfirm, Popover, Space, Tooltip} from "antd";
11
- import {SortableHandle} from "react-sortable-hoc";
5
+ import { Button, Popconfirm, Popover, Space, Tooltip, Form as AntdForm } from "antd";
6
+ import { SortableHandle } from "react-sortable-hoc";
12
7
  import {
13
8
  AlignLeftOutlined, CopyOutlined, DeleteOutlined,
14
9
  EllipsisOutlined,
@@ -16,148 +11,174 @@ import {
16
11
  EyeOutlined,
17
12
  FormOutlined,
18
13
  KeyOutlined,
19
- MenuOutlined, QuestionCircleOutlined
14
+ MenuOutlined, QuestionCircleOutlined,
20
15
  } from "@ant-design/icons";
21
16
  import ActionUtils from "../../controls/action/utils";
22
17
  import ViewButton from "../../detail/button/view-button";
23
18
  import EditButton from "../../detail/button/edit-button";
19
+ import InlineEditButton from "../../detail/button/inline-edit-button";
24
20
  import HcserviceV3 from "../../tmpl/hcservice-v3";
25
21
  import Action from "../../controls/action";
26
22
  import CquickButton from "../../controls/cquery/cquick-button";
27
- import {ViewControl} from "../../index";
23
+ import { ViewControl } from "../../index";
28
24
  import NewinFileView from "../../controls/file-view/newin-file-view";
25
+ import { EntryControl } from "../../index";
26
+ import TmplConfigAnalysis from "../../tmpl/tmpl-config-analysis";
29
27
 
28
+ const FormItem = AntdForm.Item;
30
29
 
31
- interface ColumnBuilderProps extends ActionRenderProps{
32
- ltmplConfig: LtmplConfig,
33
- hiddenColIds?: string[],
34
- hiddenRowCodes?: string[],
35
- sortedColConfigs?: ColumnConfig[],
36
- unHiden?:()=>any,
37
- onHide?:(code: string)=>any,
38
- operatable?:boolean,
30
+ const isDisabled = (record: DtmplData, item: FieldConfig) => {
31
+ if (!item.rowEditType) {
32
+ return false;
33
+ }
34
+ let isNew: boolean = record.editStatus === "new";
35
+ let type = item.rowEditType;
36
+ if (type === "editable" || (type === "editonly" && !isNew) || (type === "addonly" && isNew)) {
37
+ return false;
38
+ } else if (type === "readonly") {
39
+ return true;
40
+ }
41
+ return true;
42
+ }
43
+
44
+
45
+ interface ColumnBuilderProps extends ActionRenderProps {
46
+ ltmplConfig: LtmplConfig,
47
+ hiddenColIds?: string[],
48
+ hiddenRowCodes?: string[],
49
+ sortedColConfigs?: ColumnConfig[],
50
+ unHiden?: () => any,
51
+ onHide?: (code: string) => any,
52
+ operatable?: boolean
39
53
  }
40
54
 
41
55
  interface ReportColumnBuilderProps {
42
56
  columnConfigs: ColumnConfig[],
43
57
  hiddenColIds?: string[],
44
- translate:(...strs: string[]) => string;
58
+ translate: (...strs: string[]) => string;
45
59
  leftFixedCols: number,
46
60
  hiddenRowCodes?: string[],
47
- unHiden?:()=>any,
48
- onHide?:(code: string)=>any,
61
+ unHiden?: () => any,
62
+ onHide?: (code: string) => any,
49
63
  }
50
64
 
51
65
 
52
66
  export default {
53
67
 
54
68
  buildTableColumns(props: ColumnBuilderProps) {
55
- const {
56
- ltmplConfig,
57
- hiddenColIds,
58
- hiddenRowCodes,
59
- sortedColConfigs, unHiden,
60
- onHide,translate,
61
- sortColumns,serverKey,
62
- } = props;
63
-
64
-
65
- let tableColumns = [];
66
- let s = 0;
67
- let colConfigs = sortedColConfigs ? sortedColConfigs : ltmplConfig.columns;
68
-
69
- let currentDataColIndex = 0;
70
-
71
- colConfigs.forEach((item) => {
72
- let column = {};
73
- if (hiddenColIds && hiddenColIds.includes(item.originalId) ) {
74
- return
75
- }else{
76
- tableColumns.push(column);
77
- }
78
- let title1=translate("${"+item.title+"}");
79
- column["title"] =item.tip? <>{title1}<Tooltip placement="top" title={item.tip}>
80
- <Button type={'text'} size={'small'} disabled={true} icon={<QuestionCircleOutlined />} /></Tooltip> </>: title1;
81
- column["dataIndex"] = item.id;
82
- column["key"] = item.id;
83
- if (item["colWidth"]) column["width"] = item["colWidth"];
84
- if (item["statColType"]) column["statColType"] = item["statColType"];
85
- if (item["aggFunc"]) column["cal"] = item["aggFunc"];
86
- if (item["order"]) column["order"] = Number(item["order"]);
87
- // column['ellipsis']= true;
88
- s++;
89
- let itemType = SupportInputTypes.getSupportControlType(item);
90
- if (s < 12 && item.title != "操作" && item.title != "序号") {
91
- if (hiddenColIds.includes("10000")) {
92
- const order = this.handleColumnOrder(column["dataIndex"], sortColumns);
93
- if (item.sortable) {
94
- TableUnits.sort(column, itemType, order);
95
- }
96
- }
97
- }
98
- //特殊列处理
99
- //序号
100
- if (item.title === "序号") {
101
- column["width"] = item.colWidth ? item.colWidth : 50;
102
- column["title"] = translate("${序号}");
103
- column["align"] = item.valueAlign ? item.valueAlign : "center";
104
- column["render"] = (text, record, index) => <label>{index + 1}</label>;
105
- item["sorter"] = undefined;
106
- } else if (item.id == "10000") {
107
- this.setSortProps(column,item,translate);
108
- } else if (item.id == "20000") {
109
- this.setHiddenRecordOpt(column,hiddenRowCodes,unHiden,onHide,translate);
110
- } else if (item.title === "操作" && props.operatable) {
111
- column["操作"] = "1";
112
- column["fixed"] = "right";
113
- column["align"] = "left";
114
- column["width"] = item.colWidth ? item.colWidth : 160;
115
- column["className"] = "opsColumn";
116
- column["title"] = <>{translate("${操作}")}</>;
117
- column["render"] = (text, record) => (
118
- this.renderAction(props,record)
119
- );
120
- } else {
121
- currentDataColIndex++;
122
- column["className"] = "opsColumn";
123
-
124
- // column["title"] = item.tip? <>{title1}<Tooltip placement="top" title={item.tip}>
125
- // <Button icon={<QuestionCircleOutlined />} /></Tooltip> </>: title1;
126
- column["width"] = item.colWidth ? item.colWidth : 160;
127
- column["ellipsis"] = {showTitle: true};
128
- column["align"] = item.valueAlign ? item.valueAlign : "left";
129
- if (
130
- ltmplConfig.leftFixedCols &&
131
- ltmplConfig.leftFixedCols >= currentDataColIndex
132
- ) {
133
- column["fixed"] = "left";
134
- } else {
135
- column["fixed"] = item.colFixed
136
- ? item.colFixed == "right"
137
- ? "right"
138
- : "left"
139
- : false;
140
- }
141
- column["render"] = (text, record) => {
142
- return (
143
- <div className={record['dataType']?record['dataType']=="小计"?"xiaoji":'heji':""}>
144
- <ViewControl
145
- serverKey={serverKey}
146
- fieldConfig={item}
147
- value={record[item.id]}
148
- holderType={"table"}
149
- /></div>
150
- );
151
- };
152
- }
153
- });
154
-
155
- console.log("columns", tableColumns);
156
-
157
- return tableColumns;
158
- },
69
+ const {
70
+ ltmplConfig,
71
+ hiddenColIds,
72
+ hiddenRowCodes,
73
+ sortedColConfigs, unHiden,
74
+ onHide, translate,
75
+ sortColumns, serverKey,
76
+ editings
77
+ } = props;
78
+
79
+
80
+ let tableColumns = [];
81
+ let s = 0;
82
+ let colConfigs = sortedColConfigs ? sortedColConfigs : ltmplConfig.columns;
83
+
84
+ let currentDataColIndex = 0;
85
+
86
+ colConfigs.forEach((item) => {
87
+ let column = {};
88
+ if (hiddenColIds && hiddenColIds.includes(item.originalId)) {
89
+ return
90
+ } else {
91
+ tableColumns.push(column);
92
+ }
93
+ let title1 = translate("${" + item.title + "}");
94
+ column["title"] = item.tip ? <>{title1}<Tooltip placement="top" title={item.tip}>
95
+ <Button type={'text'} size={'small'} disabled={true} icon={<QuestionCircleOutlined />} /></Tooltip> </> : title1;
96
+ column["dataIndex"] = item.id;
97
+ column["key"] = item.id;
98
+ if (item["colWidth"]) column["width"] = item["colWidth"];
99
+ if (item["statColType"]) column["statColType"] = item["statColType"];
100
+ if (item["aggFunc"]) column["cal"] = item["aggFunc"];
101
+ if (item["order"]) column["order"] = Number(item["order"]);
102
+ // column['ellipsis']= true;
103
+ s++;
104
+ let itemType = SupportInputTypes.getSupportControlType(item);
105
+ if (s < 12 && item.title != "操作" && item.title != "序号") {
106
+ if (hiddenColIds.includes("10000")) {
107
+ const order = this.handleColumnOrder(column["dataIndex"], sortColumns);
108
+ if (item.sortable) {
109
+ TableUnits.sort(column, itemType, order);
110
+ }
111
+ }
112
+ }
113
+ //特殊列处理
114
+ //序号
115
+ if (item.title === "序号") {
116
+ column["width"] = item.colWidth ? item.colWidth : 50;
117
+ column["title"] = translate("${序号}");
118
+ column["align"] = item.valueAlign ? item.valueAlign : "center";
119
+ column["render"] = (text, record, index) => <label>{index + 1}</label>;
120
+ item["sorter"] = undefined;
121
+ } else if (item.id == "10000") {
122
+ this.setSortProps(column, item, translate);
123
+ } else if (item.id == "20000") {
124
+ this.setHiddenRecordOpt(column, hiddenRowCodes, unHiden, onHide, translate);
125
+ } else if (item.title === "操作" && props.operatable) {
126
+ column["操作"] = "1";
127
+ column["fixed"] = "right";
128
+ column["align"] = "left";
129
+ column["width"] = item.colWidth ? item.colWidth : 160;
130
+ column["className"] = "opsColumn";
131
+ column["title"] = <>{translate("${操作}")}</>;
132
+ column["render"] = (text, record) => this.renderAction(props, record);
133
+ } else {
134
+ currentDataColIndex++;
135
+ column["className"] = "opsColumn";
136
+ // column["title"] = item.tip? <>{title1}<Tooltip placement="top" title={item.tip}>
137
+ // <Button icon={<QuestionCircleOutlined />} /></Tooltip> </>: title1;
138
+ column["width"] = item.colWidth ? item.colWidth : 160;
139
+ column["ellipsis"] = { showTitle: true };
140
+ column["align"] = item.valueAlign ? item.valueAlign : "left";
141
+ if (
142
+ ltmplConfig.leftFixedCols &&
143
+ ltmplConfig.leftFixedCols >= currentDataColIndex
144
+ ) {
145
+ column["fixed"] = "left";
146
+ } else {
147
+ column["fixed"] = item.colFixed
148
+ ? item.colFixed == "right"
149
+ ? "right"
150
+ : "left"
151
+ : false;
152
+ }
153
+ column["render"] = (text, record) => {
154
+ return (editings.indexOf(record.code) >= 0 ?
155
+ <FormItem style={{ margin: 0 }}
156
+ name={record.code + "_" + item.id}
157
+ key={record.code + "_" + item.id}
158
+ rules={TmplConfigAnalysis.getRules(item, translate)}
159
+ initialValue={record[item.id]}>
160
+ <EntryControl
161
+ serverKey={serverKey}
162
+ fieldConfig={{ ...item, disabled: isDisabled(record, item) }}
163
+ value={record[item.id]}
164
+ />
165
+ </FormItem> :
166
+ <div className={record['dataType'] ? record['dataType'] === "小计" ? "xiaoji" : 'heji' : ""}>
167
+ <ViewControl
168
+ serverKey={serverKey}
169
+ fieldConfig={item}
170
+ value={record[item.id]}
171
+ holderType="table"
172
+ />
173
+ </div>
174
+ );
175
+ };
176
+ }
177
+ });
178
+ return tableColumns;
179
+ },
159
180
 
160
- setSortProps(column:object,item:ColumnConfig,translate){
181
+ setSortProps(column: object, item: ColumnConfig, translate) {
161
182
  column["title"] = (
162
183
  <Tooltip title={translate("${拖拽排序}")}>
163
184
  {translate("${" + item.title + "}")}
@@ -167,9 +188,9 @@ export default {
167
188
  column["dataIndex"] = item.id;
168
189
  column["key"] = item.id;
169
190
  column["className"] = "drag-visible";
170
- column["render"] = () => <DragHandle/>;
191
+ column["render"] = () => <DragHandle />;
171
192
  },
172
- setHiddenRecordOpt(column:object,hiddenRowCodes,unHiden,onHide,translate){
193
+ setHiddenRecordOpt(column: object, hiddenRowCodes, unHiden, onHide, translate) {
173
194
  //隐藏
174
195
  column["align"] = "center";
175
196
  column["width"] = 40;
@@ -178,10 +199,10 @@ export default {
178
199
  {hiddenRowCodes.length > 0 ? (
179
200
  <Tooltip title={translate("${取消隐藏}")}>
180
201
  <Button
181
- style={{marginRight: "0px"}}
202
+ style={{ marginRight: "0px" }}
182
203
  size="small"
183
204
  shape={"circle"}
184
- icon={<EyeOutlined/>}
205
+ icon={<EyeOutlined />}
185
206
  type={"text"}
186
207
  onClick={() => unHiden()}
187
208
  ></Button>
@@ -195,8 +216,8 @@ export default {
195
216
  <Tooltip title={translate("${隐藏}")}>
196
217
  {" "}
197
218
  <Button
198
- style={{marginRight: "0px"}}
199
- icon={<EyeInvisibleOutlined/>}
219
+ style={{ marginRight: "0px" }}
220
+ icon={<EyeInvisibleOutlined />}
200
221
  type="dashed"
201
222
  size="small"
202
223
  onClick={() => onHide(record.code)}
@@ -205,393 +226,417 @@ export default {
205
226
  );
206
227
  },
207
228
 
208
- buildReportTableColumns(props: ReportColumnBuilderProps) {
209
- const {
210
- columnConfigs,translate, leftFixedCols,hiddenColIds,hiddenRowCodes,unHiden,onHide
211
- } = props;
229
+ buildReportTableColumns(props: ReportColumnBuilderProps) {
230
+ const {
231
+ columnConfigs, translate, leftFixedCols, hiddenColIds, hiddenRowCodes, unHiden, onHide
232
+ } = props;
233
+
234
+ let tableColumns = [];
235
+ let s = 0;
236
+ let colConfigs = columnConfigs;
237
+
238
+ let currentDataColIndex = 0;
239
+
240
+ colConfigs.forEach((item) => {
241
+ if (item.hidden || (hiddenColIds && hiddenColIds.includes(item.originalId))) {
242
+ return
243
+ }
244
+ let column = {};
245
+ if (item.upperColumnTitle) {
246
+ let parent;
247
+ tableColumns.forEach(t => {
248
+ if (t.title == item.upperColumnTitle && t.children) {
249
+ parent = t;
250
+ return
251
+ }
252
+ })
253
+ if (parent) {
254
+ parent.children.push(column);
255
+ } else {
256
+ tableColumns.push({ title: item.upperColumnTitle, children: [column] })
257
+ }
258
+ } else {
259
+ tableColumns.push(column);
260
+ }
261
+
262
+ let title1 = translate("${" + item.title + "}");
263
+ column["title"] = item.tip ? <>{title1}<Tooltip placement="top" title={item.tip}>
264
+ <Button type={'text'} size={'small'} disabled={true} icon={<QuestionCircleOutlined />} /></Tooltip> </> : title1;
265
+ column["dataIndex"] = item.id;
266
+ column["key"] = item.id;
267
+ if (item["colWidth"]) column["width"] = item["colWidth"];
268
+ if (item["order"]) column["order"] = Number(item["order"]);
269
+ // column['ellipsis']= true;
270
+ s++;
271
+
272
+ //特殊列处理
273
+ //序号
274
+ if (item.title === "序号") {
275
+ column["width"] = item.colWidth ? item.colWidth : 50;
276
+ column["title"] = translate("${序号}");
277
+ column["align"] = item.valueAlign ? item.valueAlign : "center";
278
+ column["render"] = (text, record, index) =>
279
+ <label className={record['dataType'] ? record['dataType'] == "小计" ? "xiaoji" : 'heji' : ""}>{record[item.id]}</label>;
280
+ item["sorter"] = undefined;
281
+ } else if (item.id == "10000") {
282
+ this.setSortProps(column, item, translate);
283
+ } else if (item.id == "20000") {
284
+ this.setHiddenRecordOpt(column, hiddenRowCodes, unHiden, onHide, translate);
285
+ } else {
286
+ currentDataColIndex++;
287
+ column["className"] = "opsColumn";
288
+ //column["title"] = translate("${" + item.title + "}");
289
+ column["width"] = item.colWidth ? item.colWidth : 160;
290
+ column["ellipsis"] = { showTitle: true };
291
+ column["align"] = item.valueAlign ? item.valueAlign : "left";
292
+ if (
293
+ leftFixedCols &&
294
+ leftFixedCols >= currentDataColIndex
295
+ ) {
296
+ column["fixed"] = "left";
297
+ } else {
298
+ column["fixed"] = item.colFixed
299
+ ? item.colFixed == "right"
300
+ ? "right"
301
+ : "left"
302
+ : false;
303
+ }
304
+ column["render"] = (text, record) => {
305
+ return (
306
+ <div className={record['dataType'] ? record['dataType'] == "小计" ? "xiaoji" : 'heji' : ""}>
307
+ <ViewControl
308
+ // serverKey={serverKey}
309
+ fieldConfig={item}
310
+ value={record[item.id]}
311
+ holderType={"table"}
312
+ /></div>
313
+ );
314
+ };
315
+ }
316
+ });
317
+
318
+ // console.log("columns", tableColumns);
319
+
320
+ return tableColumns;
321
+ },
322
+
323
+ handleColumnOrder(columnId, sortColumns) {
324
+ //const sortColumns = this.props.criteriaData["sortColIds"];
212
325
 
213
- let tableColumns = [];
214
- let s = 0;
215
- let colConfigs = columnConfigs;
326
+ if (!Array.isArray(sortColumns)) return undefined;
216
327
 
217
- let currentDataColIndex = 0;
328
+ for (const column of sortColumns) {
329
+ const [key, sort] = column.split("_");
218
330
 
219
- colConfigs.forEach((item) => {
220
- if (item.hidden || (hiddenColIds && hiddenColIds.includes(item.originalId)) ) {
221
- return
331
+ if (key === columnId) {
332
+ if (sort === "asc") return "ascend";
333
+ if (sort === "desc") return "descend";
334
+ continue;
335
+ }
222
336
  }
223
- let column = {};
224
- if(item.upperColumnTitle){
225
- let parent;
226
- tableColumns.forEach(t=>{
227
- if(t.title==item.upperColumnTitle && t.children){
228
- parent=t;
229
- return
230
- }
231
- })
232
- if(parent){
233
- parent.children.push(column);
234
- }else{
235
- tableColumns.push({title:item.upperColumnTitle,children:[column]})
337
+ return undefined;
338
+ },
339
+ renderAction(props: ActionRenderProps, record: DtmplData) {
340
+ const { ltmplConfig, showView,
341
+ doEdit,
342
+ doRAction,
343
+ customEditable,
344
+ serverKey,
345
+ readOnly,
346
+ sourceId, translate, doCustomButton, doRowJump, blockMenuTreeDrawerOpen,
347
+ doRowAction, doDeleteByCode, editRowEdit, editings, cancelRowEdit, saveRowData } = props;
348
+ const { buttons, builtInButtons, defShowRowActionCount } = ltmplConfig;
349
+
350
+ let actionButtons: any[] = [];
351
+
352
+ if (buttons.includes("detail") &&
353
+ showView &&
354
+ ActionUtils.isShow(
355
+ ltmplConfig.buttonViewAction?.preposes,
356
+ [record],
357
+ undefined
358
+ )) {
359
+ actionButtons.push(<ViewButton
360
+ showView={showView}
361
+ data={record}
362
+ ltmplConfig={ltmplConfig}></ViewButton>);
236
363
  }
237
- }else{
238
- tableColumns.push(column);
239
- }
240
-
241
- let title1=translate("${"+item.title+"}");
242
- column["title"] =item.tip? <>{title1}<Tooltip placement="top" title={item.tip}>
243
- <Button type={'text'} size={'small'} disabled={true} icon={<QuestionCircleOutlined />} /></Tooltip> </>: title1;
244
- column["dataIndex"] = item.id;
245
- column["key"] = item.id;
246
- if (item["colWidth"]) column["width"] = item["colWidth"];
247
- if (item["order"]) column["order"] = Number(item["order"]);
248
- // column['ellipsis']= true;
249
- s++;
250
-
251
- //特殊列处理
252
- //序号
253
- if (item.title === "序号") {
254
- column["width"] = item.colWidth ? item.colWidth : 50;
255
- column["title"] = translate("${序号}");
256
- column["align"] = item.valueAlign ? item.valueAlign : "center";
257
- column["render"] = (text, record, index) =>
258
- <label className={record['dataType']?record['dataType']=="小计"?"xiaoji":'heji':""}>{record[item.id]}</label>;
259
- item["sorter"] = undefined;
260
- } else if (item.id == "10000") {
261
- this.setSortProps(column,item,translate);
262
- } else if (item.id == "20000") {
263
- this.setHiddenRecordOpt(column,hiddenRowCodes,unHiden,onHide,translate);
264
- }else {
265
- currentDataColIndex++;
266
- column["className"] = "opsColumn";
267
- //column["title"] = translate("${" + item.title + "}");
268
- column["width"] = item.colWidth ? item.colWidth : 160;
269
- column["ellipsis"] = {showTitle: true};
270
- column["align"] = item.valueAlign ? item.valueAlign : "left";
271
- if (
272
- leftFixedCols &&
273
- leftFixedCols >= currentDataColIndex
274
- ) {
275
- column["fixed"] = "left";
276
- } else {
277
- column["fixed"] = item.colFixed
278
- ? item.colFixed == "right"
279
- ? "right"
280
- : "left"
281
- : false;
364
+ if (buttons.includes("customDetail") &&
365
+ showView &&
366
+ ActionUtils.isShow(
367
+ ltmplConfig.buttonViewAction?.preposes,
368
+ [record],
369
+ undefined
370
+ )) {
371
+ actionButtons.push(<Button
372
+ size="small"
373
+ type="primary"
374
+ icon={<AlignLeftOutlined />}
375
+ onClick={() => showView({ code: record.code })}
376
+ ></Button>)
282
377
  }
283
- column["render"] = (text, record) => {
284
- return (
285
- <div className={record['dataType']?record['dataType']=="小计"?"xiaoji":'heji':""}>
286
- <ViewControl
287
- // serverKey={serverKey}
288
- fieldConfig={item}
289
- value={record[item.id]}
290
- holderType={"table"}
291
- /></div>
292
- );
293
- };
294
- }
295
- });
296
378
 
297
- // console.log("columns", tableColumns);
379
+ if (buttons.includes("dtmplEdit") && doEdit && !readOnly) {
380
+ (
381
+ actionButtons.push(<EditButton
382
+ doEdit={doEdit}
383
+ data={record}
384
+ ltmplConfig={ltmplConfig}
385
+ ></EditButton>)
386
+ )
387
+ };
388
+ // 行内编辑
389
+ if (buttons.includes("rowEdit")) {
390
+ actionButtons.push(<InlineEditButton
391
+ editings={editings}
392
+ editRowEdit={editRowEdit}
393
+ cancelRowEdit={cancelRowEdit}
394
+ saveRowData={saveRowData}
395
+ data={record}
396
+ />);
397
+ }
298
398
 
299
- return tableColumns;
300
- },
399
+ if (builtInButtons?.includes("blockAuthMenuTree") && !readOnly) {
400
+ actionButtons.push(<Button
401
+ size="small"
402
+ type="dashed"
403
+ icon={
404
+ <KeyOutlined
405
+ rotate={180}
406
+ style={{ color: "#f5222d", marginRight: "4px" }}
407
+ />
408
+ }
409
+ onClick={() => blockMenuTreeDrawerOpen(record)
410
+ }
411
+ ></Button>)
412
+ }
301
413
 
302
- handleColumnOrder (columnId, sortColumns) {
303
- //const sortColumns = this.props.criteriaData["sortColIds"];
414
+ if ((buttons.includes("dtmplCustomEdit") || customEditable) &&
415
+ doEdit &&
416
+ !readOnly &&
417
+ ActionUtils.isShow(
418
+ ltmplConfig.buttonEditAction?.preposes,
419
+ [record],
420
+ undefined
421
+ )) {
422
+ actionButtons.push(<Button
423
+ size="small"
424
+ type="dashed"
425
+ icon={<FormOutlined />}
426
+ onClick={() =>
427
+ doEdit({
428
+ code: record.code,
429
+ mode: "update",
430
+ toCustomPage: true,
431
+ })
432
+ }
433
+ ></Button>)
434
+ }
435
+ if (buttons.includes("copy") && doEdit && !readOnly) {
436
+ actionButtons.push(<Tooltip title={translate("${复制}")}>
437
+ <Button
438
+ size="small"
439
+ type="dashed"
440
+ icon={<CopyOutlined />}
441
+ onClick={async () => {
442
+ //先复制
443
+ let toCustomPage = false;
444
+ if (buttons.includes("dtmplCustomEdit") || customEditable) {
445
+ toCustomPage = true;
446
+ }
447
+ let code = await HcserviceV3.doCopy(
448
+ serverKey,
449
+ sourceId,
450
+ record.code
451
+ );
452
+ if (code) {
453
+ doEdit({ code, mode: "update", toCustomPage });
454
+ }
455
+ }}
456
+ ></Button>
457
+ </Tooltip>)
458
+ }
304
459
 
305
- if (!Array.isArray(sortColumns)) return undefined;
460
+ if (ltmplConfig.rowCustomButtons) {
461
+ ltmplConfig.rowCustomButtons.map((customButton) => {
462
+ if (ActionUtils.isShow(
463
+ customButton.preposes,
464
+ [record],
465
+ undefined
466
+ )) {
467
+ actionButtons.push(
468
+ <Button
469
+ key={customButton.id}
470
+ size="small"
471
+ type={
472
+ customButton.buttonType
473
+ ? customButton.buttonType
474
+ : "dashed"
475
+ }
476
+ onClick={() =>
477
+ doCustomButton(customButton, [record])
478
+ }
479
+ >
480
+ {translate("${" + customButton.title + "}")}
481
+ </Button>
482
+ )
483
+ };
484
+ })
485
+ }
486
+ if (ltmplConfig.ractions && !readOnly) {
487
+ ltmplConfig.ractions.map((raction) => {
488
+ actionButtons.push(
489
+ ActionUtils.isShow(
490
+ raction?.preposes,
491
+ [record],
492
+ undefined
493
+ ) ?
494
+ <Button
495
+ key={raction.id}
496
+ size="small"
497
+ type="dashed"
498
+ onClick={() => doRAction(raction.id, record.code)}
499
+ >
500
+ {translate("${" + raction.title + "}")}
501
+ </Button> : ""
502
+ );
503
+ })
504
+ }
306
505
 
307
- for (const column of sortColumns) {
308
- const [key, sort] = column.split("_");
506
+ if (ltmplConfig.rowActions &&
507
+ !readOnly &&
508
+ ltmplConfig.rowActions.length > 0) {
509
+ ltmplConfig.rowActions.map((action) => {
510
+ actionButtons.push(
511
+ <Action
512
+ serverKey={serverKey}
513
+ iconType={"icon"}
514
+ key={action.id}
515
+ data={[record]}
516
+ actionConfig={action}
517
+ doAction={doRowAction}
518
+ buttonSize={"small"}
519
+ serial={1}
520
+ ></Action>
521
+ );
522
+ })
523
+ }
309
524
 
310
- if (key === columnId) {
311
- if (sort === "asc") return "ascend";
312
- if (sort === "desc") return "descend";
313
- continue;
314
- }
525
+ if (ltmplConfig.rowJumps &&
526
+ ltmplConfig.rowJumps.length > 0 &&
527
+ !readOnly) {
528
+ ltmplConfig.rowJumps.map((jump) => {
529
+ if (ActionUtils.isShow(
530
+ jump.preposes,
531
+ [record],
532
+ undefined
533
+ )) {
534
+ actionButtons.push(
535
+ <Button
536
+ key={jump.id}
537
+ size="small"
538
+ type="dashed"
539
+ onClick={() => doRowJump(jump, record)}
540
+ >
541
+ {translate("${" + jump.title + "}")}
542
+ </Button>
543
+ )
544
+ };
545
+ })
546
+ }
547
+ if (ltmplConfig.rowCQuerys &&
548
+ ltmplConfig.rowCQuerys.length > 0 &&
549
+ !readOnly
550
+ ) {
551
+ ltmplConfig.rowCQuerys.map((cquery) => {
552
+ if (ActionUtils.isShow(
553
+ cquery.preposes,
554
+ [record],
555
+ undefined
556
+ )) {
557
+ actionButtons.push(
558
+ <CquickButton
559
+ serverKey={serverKey}
560
+ key={cquery.id}
561
+ size={"small"}
562
+ pageType={"drawer"}
563
+ cQueryConfig={cquery}
564
+ mainCode={
565
+ cquery.mainCodeColId
566
+ ? record[cquery.mainCodeColId]
567
+ : record.code
568
+ }
569
+ />
570
+ )
571
+ };
572
+ })
573
+ }
574
+ if (ltmplConfig.rowFileButtons &&
575
+ ltmplConfig.rowFileButtons.length > 0) {
576
+ ltmplConfig.rowFileButtons.map((openFileButton) => {
577
+ let v = record[openFileButton.fieldId];
578
+ if (v) {
579
+ if (v instanceof Array) {
580
+ v = v[0];
581
+ }
582
+ if (v.includes("@R@") > 0) {
583
+ v = v.split("@R@")[1];
584
+ }
585
+ actionButtons.push(
586
+ <NewinFileView
587
+ title={openFileButton.title}
588
+ filePath={HcserviceV3.toFilePath(v, serverKey)}
589
+ serverKey={serverKey}
590
+ key={openFileButton.id}
591
+ //size={"small"}
592
+ />
593
+ );
594
+ }
595
+ })
596
+ }
597
+ if (buttons.includes("singleDelete") &&
598
+ !readOnly &&
599
+ ActionUtils.isShow(
600
+ ltmplConfig.buttonDeleteAction?.preposes,
601
+ [record],
602
+ undefined
603
+ )) {
604
+ actionButtons.push(
605
+ <Popconfirm
606
+ placement="rightBottom"
607
+ title={translate("${确定要[删除]此数据吗}?")}
608
+ onConfirm={() => {
609
+ doDeleteByCode(record.code);
610
+ }}
611
+ okText={translate("${确定}")}
612
+ cancelText={translate("${取消}")}
613
+ okType={"danger"}
614
+ >
615
+ <Button size="small" type="dashed" danger>
616
+ <DeleteOutlined />
617
+ </Button>
618
+ </Popconfirm>
619
+ )
620
+ }
621
+ let showButtons = [];
622
+ if (defShowRowActionCount <= 0 || defShowRowActionCount >= actionButtons.length) {
623
+ showButtons = actionButtons
624
+ } else {
625
+ showButtons = actionButtons.slice(0, defShowRowActionCount)
626
+ showButtons.push(
627
+ <Popover content={<Space wrap>
628
+ {actionButtons.slice(defShowRowActionCount, actionButtons.length)}
629
+ </Space>} title={"更多操作"} trigger="hover">
630
+ <Button size={"small"} icon={<EllipsisOutlined />} shape="circle" ></Button>
631
+ </Popover>
632
+ );
633
+ }
634
+ return <Space size={[0, 4]} wrap>
635
+ {showButtons}
636
+ </Space>
315
637
  }
316
- return undefined;
317
- },
318
- renderAction(props:ActionRenderProps, record:DtmplData){
319
- const {ltmplConfig, showView,
320
- doEdit,
321
- doRAction,
322
- customEditable,
323
- serverKey,
324
- readOnly,
325
- sourceId, translate,doCustomButton, doRowJump, blockMenuTreeDrawerOpen,
326
- doRowAction, doDeleteByCode}=props;
327
- const {buttons, builtInButtons,defShowRowActionCount} = ltmplConfig;
328
-
329
- let actionButtons:any[]=[];
330
-
331
- if(buttons.includes("detail") &&
332
- showView &&
333
- ActionUtils.isShow(
334
- ltmplConfig.buttonViewAction?.preposes,
335
- [record],
336
- undefined
337
- ) ){actionButtons.push(<ViewButton
338
- showView={showView}
339
- data={record}
340
- ltmplConfig={ltmplConfig}></ViewButton>);}
341
- if(buttons.includes("customDetail") &&
342
- showView &&
343
- ActionUtils.isShow(
344
- ltmplConfig.buttonViewAction?.preposes,
345
- [record],
346
- undefined
347
- ) ) {
348
- actionButtons.push(<Button
349
- size="small"
350
- type="primary"
351
- icon={<AlignLeftOutlined/>}
352
- onClick={() => showView({code: record.code})}
353
- ></Button>)
354
- }
355
-
356
- if(buttons.includes("dtmplEdit") && doEdit && !readOnly ){ (
357
- actionButtons.push(<EditButton
358
- doEdit={doEdit}
359
- data={record}
360
- ltmplConfig={ltmplConfig}
361
- ></EditButton>)
362
- ) };
363
- if( builtInButtons?.includes("blockAuthMenuTree") && !readOnly ) {
364
- actionButtons.push(<Button
365
- size="small"
366
- type="dashed"
367
- icon={
368
- <KeyOutlined
369
- rotate={180}
370
- style={{color: "#f5222d", marginRight: "4px"}}
371
- />
372
- }
373
- onClick={() => blockMenuTreeDrawerOpen(record)
374
- }
375
- ></Button>)
376
- }
377
-
378
- if((buttons.includes("dtmplCustomEdit") || customEditable) &&
379
- doEdit &&
380
- !readOnly &&
381
- ActionUtils.isShow(
382
- ltmplConfig.buttonEditAction?.preposes,
383
- [record],
384
- undefined
385
- ) ){
386
- actionButtons.push(<Button
387
- size="small"
388
- type="dashed"
389
- icon={<FormOutlined/>}
390
- onClick={() =>
391
- doEdit({
392
- code: record.code,
393
- mode: "update",
394
- toCustomPage: true,
395
- })
396
- }
397
- ></Button>)
398
- }
399
- if(buttons.includes("copy") && doEdit && !readOnly ) {
400
- actionButtons.push( <Tooltip title={translate("${复制}")}>
401
- <Button
402
- size="small"
403
- type="dashed"
404
- icon={<CopyOutlined/>}
405
- onClick={async () => {
406
- //先复制
407
- let toCustomPage = false;
408
- if (buttons.includes("dtmplCustomEdit") || customEditable) {
409
- toCustomPage = true;
410
- }
411
- let code = await HcserviceV3.doCopy(
412
- serverKey,
413
- sourceId,
414
- record.code
415
- );
416
- if (code) {
417
- doEdit({code, mode: "update", toCustomPage});
418
- }
419
- }}
420
- ></Button>
421
- </Tooltip>)
422
- }
423
-
424
- if(ltmplConfig.rowCustomButtons ){
425
- ltmplConfig.rowCustomButtons.map((customButton) => {
426
- if(ActionUtils.isShow(
427
- customButton.preposes,
428
- [record],
429
- undefined
430
- )){
431
- actionButtons.push(
432
- <Button
433
- key={customButton.id}
434
- size="small"
435
- type={
436
- customButton.buttonType
437
- ? customButton.buttonType
438
- : "dashed"
439
- }
440
- onClick={() =>
441
- doCustomButton(customButton, [record])
442
- }
443
- >
444
- {translate("${" + customButton.title + "}")}
445
- </Button>
446
- )};
447
- })}
448
- if(ltmplConfig.ractions && !readOnly){
449
- ltmplConfig.ractions.map((raction) => {
450
- actionButtons.push (
451
- ActionUtils.isShow(
452
- raction?.preposes,
453
- [record],
454
- undefined
455
- ) ?
456
- <Button
457
- key={raction.id}
458
- size="small"
459
- type="dashed"
460
- onClick={() => doRAction(raction.id, record.code)}
461
- >
462
- {translate("${" + raction.title + "}")}
463
- </Button> : ""
464
- );
465
- })}
466
-
467
- if(ltmplConfig.rowActions &&
468
- !readOnly &&
469
- ltmplConfig.rowActions.length > 0)
470
- { ltmplConfig.rowActions.map((action) => {
471
- actionButtons.push(
472
- <Action
473
- serverKey={serverKey}
474
- iconType={"icon"}
475
- key={action.id}
476
- data={[record]}
477
- actionConfig={action}
478
- doAction={doRowAction}
479
- buttonSize={"small"}
480
- serial={1}
481
- ></Action>
482
- );
483
- })}
484
-
485
- if(ltmplConfig.rowJumps &&
486
- ltmplConfig.rowJumps.length > 0 &&
487
- !readOnly) {
488
- ltmplConfig.rowJumps.map((jump) => {
489
- if(ActionUtils.isShow(
490
- jump.preposes,
491
- [record],
492
- undefined
493
- )){
494
- actionButtons.push (
495
- <Button
496
- key={jump.id}
497
- size="small"
498
- type="dashed"
499
- onClick={() => doRowJump(jump, record)}
500
- >
501
- {translate("${" + jump.title + "}")}
502
- </Button>
503
- )};
504
- })}
505
- if(ltmplConfig.rowCQuerys &&
506
- ltmplConfig.rowCQuerys.length > 0 &&
507
- !readOnly
508
- ){
509
- ltmplConfig.rowCQuerys.map((cquery) => {
510
- if(ActionUtils.isShow(
511
- cquery.preposes,
512
- [record],
513
- undefined
514
- )){
515
- actionButtons.push (
516
- <CquickButton
517
- serverKey={serverKey}
518
- key={cquery.id}
519
- size={"small"}
520
- pageType={"drawer"}
521
- cQueryConfig={cquery}
522
- mainCode={
523
- cquery.mainCodeColId
524
- ? record[cquery.mainCodeColId]
525
- : record.code
526
- }
527
- />
528
- )};
529
- })
530
- }
531
- if(ltmplConfig.rowFileButtons &&
532
- ltmplConfig.rowFileButtons.length > 0)
533
- { ltmplConfig.rowFileButtons.map((openFileButton) => {
534
- let v = record[openFileButton.fieldId];
535
- if (v) {
536
- if (v instanceof Array) {
537
- v = v[0];
538
- }
539
- if (v.includes("@R@") > 0) {
540
- v = v.split("@R@")[1];
541
- }
542
- actionButtons.push (
543
- <NewinFileView
544
- title={openFileButton.title}
545
- filePath={HcserviceV3.toFilePath(v, serverKey)}
546
- serverKey={serverKey}
547
- key={openFileButton.id}
548
- //size={"small"}
549
- />
550
- );
551
- }
552
- })
553
- }
554
- if(buttons.includes("singleDelete") &&
555
- !readOnly &&
556
- ActionUtils.isShow(
557
- ltmplConfig.buttonDeleteAction?.preposes,
558
- [record],
559
- undefined
560
- ) ){ actionButtons.push(
561
- <Popconfirm
562
- placement="rightBottom"
563
- title={translate("${确定要[删除]此数据吗}?")}
564
- onConfirm={() => {
565
- doDeleteByCode(record.code);
566
- }}
567
- okText={translate("${确定}")}
568
- cancelText={translate("${取消}")}
569
- okType={"danger"}
570
- >
571
- <Button size="small" type="dashed" danger>
572
- <DeleteOutlined/>
573
- </Button>
574
- </Popconfirm>
575
- ) }
576
- let showButtons=[];
577
- if(defShowRowActionCount<=0 || defShowRowActionCount >= actionButtons.length ) {
578
- showButtons = actionButtons
579
- } else{
580
- showButtons = actionButtons.slice(0,defShowRowActionCount)
581
- showButtons.push(
582
- <Popover content={ <Space wrap>
583
- {actionButtons.slice(defShowRowActionCount,actionButtons.length)}
584
- </Space> } title={"更多操作"} trigger="hover">
585
- <Button size={"small"} icon={<EllipsisOutlined />} shape="circle" ></Button>
586
- </Popover>
587
- );
588
- }
589
- return <Space size={[0, 4]} wrap>
590
- {showButtons}
591
- </Space>
592
- }
593
638
 
594
639
  }
595
640
  const DragHandle = SortableHandle(() => (
596
- <MenuOutlined style={{cursor: "grab", color: "#999"}}/>
641
+ <MenuOutlined style={{ cursor: "grab", color: "#999" }} />
597
642
  ))