aldehyde 0.2.287 → 0.2.288
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.
- package/lib/controls/select/index.d.ts.map +1 -1
- package/lib/controls/select/index.js +0 -1
- package/lib/controls/select/index.js.map +1 -1
- package/lib/controls/upload/index.js +1 -1
- package/lib/controls/upload/mult-file-upload.js +1 -1
- package/lib/form/dtmpl-form.d.ts +3 -0
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +24 -3
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/lowcode-components/act-table/index.d.ts +30 -0
- package/lib/lowcode-components/act-table/index.d.ts.map +1 -0
- package/lib/lowcode-components/act-table/index.js +86 -0
- package/lib/lowcode-components/act-table/index.js.map +1 -0
- package/lib/lowcode-components/act-table/index.less +27 -0
- package/lib/lowcode-components/base-table/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-table/index.js +8 -4
- package/lib/lowcode-components/base-table/index.js.map +1 -1
- package/lib/lowcode-components/index.d.ts +2 -0
- package/lib/lowcode-components/index.d.ts.map +1 -1
- package/lib/lowcode-components/index.js +2 -1
- package/lib/lowcode-components/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
- package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
- package/lib/module/dtmpl-edit-card.d.ts +2 -2
- package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-card.js +13 -5
- package/lib/module/dtmpl-edit-card.js.map +1 -1
- package/lib/table/relation-table.d.ts +3 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +32 -18
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/control-type-supportor.d.ts +2 -0
- package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.js +18 -0
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +1 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +11 -59
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +24 -0
- package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/select/index.tsx +0 -1
- package/src/aldehyde/controls/upload/index.tsx +1 -1
- package/src/aldehyde/controls/upload/mult-file-upload.tsx +1 -1
- package/src/aldehyde/form/dtmpl-form.tsx +28 -2
- package/src/aldehyde/lowcode-components/act-table/index.less +27 -0
- package/src/aldehyde/lowcode-components/act-table/index.tsx +127 -0
- package/src/aldehyde/lowcode-components/base-table/index.tsx +8 -4
- package/src/aldehyde/lowcode-components/index.ts +4 -2
- package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
- package/src/aldehyde/module/dtmpl-edit-card.tsx +282 -272
- package/src/aldehyde/table/relation-table.tsx +915 -893
- package/src/aldehyde/tmpl/control-type-supportor.tsx +18 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +15 -62
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +22 -0
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Typography, Popconfirm, FormInstance,
|
|
3
|
+
Button,
|
|
4
|
+
Col,
|
|
5
|
+
Form as AntdForm,
|
|
6
|
+
Popover,
|
|
7
|
+
Row,
|
|
8
|
+
Space,
|
|
9
|
+
Tooltip,
|
|
10
|
+
Typography, Popconfirm, FormInstance,
|
|
12
11
|
} from "antd";
|
|
13
12
|
import Table from "./control-table-x-axis-wrapper";
|
|
14
13
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
AlignLeftOutlined, CheckOutlined, CloseCircleOutlined,
|
|
15
|
+
DeleteOutlined,
|
|
16
|
+
EditOutlined,
|
|
17
|
+
FormOutlined,
|
|
18
|
+
PlusSquareOutlined,
|
|
19
|
+
SnippetsOutlined,
|
|
21
20
|
} from "@ant-design/icons";
|
|
22
21
|
import "./index.css";
|
|
23
22
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
ClassAddConfig,
|
|
24
|
+
DtmplData,
|
|
25
|
+
FieldGroupConfig,
|
|
26
|
+
SelectedRow,
|
|
27
|
+
ViewOrEdit,
|
|
29
28
|
} from "../tmpl/interface";
|
|
30
29
|
import SupportInputTypes from "../tmpl/control-type-supportor";
|
|
31
30
|
import TableUnits from "./table-util";
|
|
@@ -38,925 +37,948 @@ import CollapseCard from "../controls/collapse-card";
|
|
|
38
37
|
import RowEditor from "../detail/edit/row-editor";
|
|
39
38
|
import Action from "../controls/action";
|
|
40
39
|
import CountingTag from "../controls/counting-tag";
|
|
41
|
-
import {
|
|
40
|
+
import {LocaleContext} from "../locale/LocaleProvider";
|
|
42
41
|
import VerticalList from "../list/vertical-list";
|
|
43
42
|
import {EntryControl} from "../index";
|
|
44
43
|
import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
const FormItem = AntdForm.Item;
|
|
48
|
-
const {
|
|
47
|
+
const {Text} = Typography;
|
|
49
48
|
|
|
50
49
|
interface RelationTableProps {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
showRightNav?: boolean;
|
|
51
|
+
mainCode?: string;
|
|
52
|
+
serverKey?: string;
|
|
53
|
+
parentId: string;
|
|
54
|
+
loading: boolean;
|
|
55
|
+
viewOrEdit: ViewOrEdit;
|
|
56
|
+
refreshId?: string;
|
|
57
|
+
fieldGroupConfig: FieldGroupConfig;
|
|
58
|
+
value: DtmplData[];
|
|
59
|
+
parentFormInstance?: FormInstance;
|
|
60
|
+
onChange?: (fieldGroupConfig: FieldGroupConfig, value: DtmplData[]) => void;
|
|
61
|
+
onEditing?: (editing: boolean) => void;
|
|
62
|
+
initCollapse?: boolean;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
interface RelationTableStat {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
selectedCode?: string;
|
|
67
|
+
showDtmplView?: boolean;
|
|
68
|
+
showDtmplEdit?: boolean;
|
|
69
|
+
showSelectTable?: boolean;
|
|
70
|
+
tableLoading?: boolean;
|
|
71
|
+
showRowEdit?: boolean;
|
|
72
|
+
selectedDtmplData?: DtmplData;
|
|
73
|
+
filterStr?: string;
|
|
74
|
+
pageSize?: number;
|
|
75
|
+
addTmplId?: string;
|
|
76
|
+
editings?: string[];
|
|
77
|
+
uploadingFiles?: object[];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
class RelationTable extends React.PureComponent<
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
RelationTableProps,
|
|
82
|
+
RelationTableStat
|
|
83
83
|
> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async componentDidUpdate(prevProps) {
|
|
113
|
-
const { fieldGroupConfig } = this.props;
|
|
114
|
-
const { fieldGroupConfig: preFieldGroupConfig } = prevProps;
|
|
115
|
-
if (
|
|
116
|
-
fieldGroupConfig.disabled != preFieldGroupConfig.disabled ||
|
|
117
|
-
fieldGroupConfig.mainCode != preFieldGroupConfig.mainCode
|
|
118
|
-
) {
|
|
119
|
-
this.setState({ filterStr: "" });
|
|
84
|
+
state = {
|
|
85
|
+
showDtmplView: false,
|
|
86
|
+
selectedCode: undefined,
|
|
87
|
+
showSelectTable: false,
|
|
88
|
+
showDtmplEdit: false,
|
|
89
|
+
tableLoading: false,
|
|
90
|
+
showRowEdit: false,
|
|
91
|
+
selectedDtmplData: undefined,
|
|
92
|
+
filterStr: undefined,
|
|
93
|
+
pageSize: 10,
|
|
94
|
+
addTmplId: undefined,
|
|
95
|
+
editings: [],
|
|
96
|
+
uploadingFiles: [],
|
|
97
|
+
};
|
|
98
|
+
static contextType = LocaleContext;
|
|
99
|
+
context: React.ContextType<typeof LocaleContext>;
|
|
100
|
+
static defaultProps = {};
|
|
101
|
+
formRef = React.createRef<FormInstance>();
|
|
102
|
+
|
|
103
|
+
async componentDidMount() {
|
|
104
|
+
// const {fieldGroupConfig} = this.props;
|
|
105
|
+
// if (fieldGroupConfig.displayConfig.includes('folded')) {
|
|
106
|
+
// this.setState({
|
|
107
|
+
// collapse: true,
|
|
108
|
+
// })
|
|
109
|
+
// }
|
|
120
110
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
dataSource = [];
|
|
131
|
-
value.forEach((item, index) => {
|
|
132
|
-
let flag = true;
|
|
133
|
-
if (filterStr) {
|
|
134
|
-
flag = false;
|
|
135
|
-
for (let value of Object.values(item.fieldMap)) {
|
|
136
|
-
if (value && value.toString().indexOf(filterStr) >= 0) {
|
|
137
|
-
flag = true;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (flag) {
|
|
142
|
-
let row = {
|
|
143
|
-
key: item.code,
|
|
144
|
-
relationLabel: item.relationLabel,
|
|
145
|
-
code: item.code, //增加code,为了删除操作
|
|
146
|
-
...item.fieldMap,
|
|
147
|
-
};
|
|
148
|
-
dataSource.push(row);
|
|
111
|
+
|
|
112
|
+
async componentDidUpdate(prevProps) {
|
|
113
|
+
const {fieldGroupConfig} = this.props;
|
|
114
|
+
const {fieldGroupConfig: preFieldGroupConfig} = prevProps;
|
|
115
|
+
if (
|
|
116
|
+
fieldGroupConfig.disabled != preFieldGroupConfig.disabled ||
|
|
117
|
+
fieldGroupConfig.mainCode != preFieldGroupConfig.mainCode
|
|
118
|
+
) {
|
|
119
|
+
this.setState({filterStr: ""});
|
|
149
120
|
}
|
|
150
|
-
});
|
|
151
121
|
}
|
|
152
122
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
//配置字段的 默认次过滤条件
|
|
182
|
-
if(item.relValueField ){
|
|
183
|
-
if(!item.baseCriteria){
|
|
184
|
-
item.baseCriteria={}
|
|
123
|
+
buildDataSource = () => {
|
|
124
|
+
const {filterStr} = this.state;
|
|
125
|
+
const {value} = this.props;
|
|
126
|
+
let dataSource = undefined;
|
|
127
|
+
|
|
128
|
+
/** 构建 dataSource **/
|
|
129
|
+
if (value) {
|
|
130
|
+
dataSource = [];
|
|
131
|
+
value.forEach((item, index) => {
|
|
132
|
+
let flag = true;
|
|
133
|
+
if (filterStr) {
|
|
134
|
+
flag = false;
|
|
135
|
+
for (let value of Object.values(item.fieldMap)) {
|
|
136
|
+
if (value && value.toString().indexOf(filterStr) >= 0) {
|
|
137
|
+
flag = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (flag) {
|
|
142
|
+
let row = {
|
|
143
|
+
key: item.code,
|
|
144
|
+
relationLabel: item.relationLabel,
|
|
145
|
+
code: item.code, //增加code,为了删除操作
|
|
146
|
+
...item.fieldMap,
|
|
147
|
+
};
|
|
148
|
+
dataSource.push(row);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
185
151
|
}
|
|
186
|
-
item.baseCriteria={...item.baseCriteria,"secondCriteria":parentFormInstance.getFieldValue(item.relValueField.id)};
|
|
187
|
-
item.configChanged=true;
|
|
188
|
-
}
|
|
189
|
-
column["render"] = (text, record) => {
|
|
190
|
-
|
|
191
|
-
return (editings.indexOf(record.code)>=0?
|
|
192
|
-
|
|
193
|
-
<FormItem style={{margin:0}}
|
|
194
|
-
name={record.code+"_"+item.id}
|
|
195
|
-
key={record.code+"_"+item.id}
|
|
196
|
-
rules={TmplConfigAnalysis.getRules(item,translate)}
|
|
197
|
-
initialValue={record[item.id]} >
|
|
198
|
-
<EntryControl
|
|
199
|
-
serverKey={serverKey}
|
|
200
|
-
//holderType={"table"}
|
|
201
|
-
fieldConfig={item}
|
|
202
|
-
value={record[item.id]}
|
|
203
|
-
/></FormItem>:
|
|
204
|
-
<ViewControl
|
|
205
|
-
serverKey={serverKey}
|
|
206
|
-
holderType={"table"}
|
|
207
|
-
fieldConfig={item}
|
|
208
|
-
value={record[item.id]}
|
|
209
|
-
/>
|
|
210
|
-
);
|
|
211
|
-
};
|
|
212
|
-
});
|
|
213
|
-
if (showRelationName) {
|
|
214
|
-
//判断是否有关系属性
|
|
215
|
-
let rela = {
|
|
216
|
-
dataIndex: "relationLabel",
|
|
217
|
-
name: "relation",
|
|
218
|
-
title: translate("${关系}"),
|
|
219
|
-
type: "relation",
|
|
220
|
-
editable: true,
|
|
221
|
-
fieldAvailable: true,
|
|
222
|
-
id: "10000", //关系默认id是'10000'
|
|
223
|
-
options: relationNames,
|
|
224
|
-
};
|
|
225
|
-
columns.unshift(rela);
|
|
226
|
-
}
|
|
227
152
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
size="small"
|
|
267
|
-
onClick={() => this.showEditDtmplModel(record)}
|
|
268
|
-
></Button>
|
|
269
|
-
) : (
|
|
270
|
-
""
|
|
271
|
-
)}
|
|
272
|
-
{fieldGroupConfig.rowActions &&
|
|
273
|
-
fieldGroupConfig.rowActions.length > 0
|
|
274
|
-
? fieldGroupConfig.rowActions.map((action) => {
|
|
275
|
-
return (
|
|
276
|
-
<Action
|
|
277
|
-
serverKey={serverKey}
|
|
278
|
-
disabled={disabled}
|
|
279
|
-
key={action.id}
|
|
280
|
-
data={[record]}
|
|
281
|
-
actionConfig={action}
|
|
282
|
-
doAction={this.doRowAction}
|
|
283
|
-
buttonSize={"small"}
|
|
284
|
-
></Action>
|
|
285
|
-
);
|
|
286
|
-
})
|
|
287
|
-
: ""}
|
|
288
|
-
{/*行编辑*/}
|
|
289
|
-
{rowEdit && editings.indexOf(record.code)<0 ? (
|
|
290
|
-
addOrEditType !== "tableRow" ?
|
|
291
|
-
<RowEditor
|
|
292
|
-
serverKey={serverKey}
|
|
293
|
-
disabled={disabled}
|
|
294
|
-
buttonIcon={<EditOutlined />}
|
|
295
|
-
dtmplData={this.getRowEditData(record.code)}
|
|
296
|
-
fieldGroupConfig={fieldGroupConfig}
|
|
297
|
-
onOk={this.handleRowEdit}
|
|
298
|
-
tooltipTitle={translate("${编辑}${当前行}")}
|
|
299
|
-
></RowEditor>:<Button icon={<EditOutlined />} size={'small'}
|
|
300
|
-
onClick={()=>this.setState({editings:[...editings,record.code]})} >
|
|
301
|
-
</Button>
|
|
302
|
-
) : ""
|
|
153
|
+
return dataSource;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
buildColumns = () => {
|
|
157
|
+
const {viewOrEdit, fieldGroupConfig, serverKey, parentFormInstance} = this.props;
|
|
158
|
+
const {
|
|
159
|
+
buttons,
|
|
160
|
+
fields,
|
|
161
|
+
showRelationName,
|
|
162
|
+
relationNames,
|
|
163
|
+
disabled,
|
|
164
|
+
deleteData, addOrEditType
|
|
165
|
+
} = fieldGroupConfig;
|
|
166
|
+
const {translate} = this.context;
|
|
167
|
+
const {editings} = this.state;
|
|
168
|
+
let columns = [];
|
|
169
|
+
/** 构建column **/
|
|
170
|
+
let s = 0;
|
|
171
|
+
fields.forEach((item) => {
|
|
172
|
+
let column = {};
|
|
173
|
+
columns.push(column);
|
|
174
|
+
column["title"] = translate("${" + item.title + "}");
|
|
175
|
+
column["dataIndex"] = item.id;
|
|
176
|
+
s++;
|
|
177
|
+
let itemType = SupportInputTypes.getControlType(item, null);
|
|
178
|
+
if (s < 12 && item.sortable) {
|
|
179
|
+
TableUnits.sort(column, itemType);
|
|
180
|
+
}
|
|
181
|
+
//配置字段的 默认次过滤条件
|
|
182
|
+
if (item.relValueField) {
|
|
183
|
+
if (!item.baseCriteria) {
|
|
184
|
+
item.baseCriteria = {}
|
|
185
|
+
}
|
|
186
|
+
item.baseCriteria = {
|
|
187
|
+
...item.baseCriteria,
|
|
188
|
+
"secondCriteria": parentFormInstance.getFieldValue(item.relValueField.id)
|
|
189
|
+
};
|
|
190
|
+
item.configChanged = true;
|
|
303
191
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
192
|
+
column["render"] = (text, record) => {
|
|
193
|
+
|
|
194
|
+
return (editings.indexOf(record.code) >= 0 ?
|
|
195
|
+
|
|
196
|
+
<FormItem style={{margin: 0}}
|
|
197
|
+
name={record.code + "_" + item.id}
|
|
198
|
+
key={record.code + "_" + item.id}
|
|
199
|
+
rules={TmplConfigAnalysis.getRules(item, translate)}
|
|
200
|
+
initialValue={record[item.id]}>
|
|
201
|
+
<EntryControl
|
|
202
|
+
serverKey={serverKey}
|
|
203
|
+
//holderType={"table"}
|
|
204
|
+
fieldConfig={item}
|
|
205
|
+
value={record[item.id]}
|
|
206
|
+
/></FormItem> :
|
|
207
|
+
<ViewControl
|
|
208
|
+
serverKey={serverKey}
|
|
209
|
+
holderType={"table"}
|
|
210
|
+
fieldConfig={item}
|
|
211
|
+
value={record[item.id]}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
if (showRelationName) {
|
|
217
|
+
//判断是否有关系属性
|
|
218
|
+
let rela = {
|
|
219
|
+
dataIndex: "relationLabel",
|
|
220
|
+
name: "relation",
|
|
221
|
+
title: translate("${关系}"),
|
|
222
|
+
type: "relation",
|
|
223
|
+
editable: true,
|
|
224
|
+
fieldAvailable: true,
|
|
225
|
+
id: "10000", //关系默认id是'10000'
|
|
226
|
+
options: relationNames,
|
|
227
|
+
};
|
|
228
|
+
columns.unshift(rela);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
//添加操作列
|
|
232
|
+
|
|
233
|
+
const viewable = buttons.includes("detail");
|
|
234
|
+
const rowEdit = buttons.includes("rowEdit");
|
|
235
|
+
const dtmplEdit = buttons.includes("dtmplEdit");
|
|
236
|
+
const deletable = buttons.includes("singleDelete");
|
|
237
|
+
if (
|
|
238
|
+
viewOrEdit == "edit" &&
|
|
239
|
+
(viewable || rowEdit || dtmplEdit || deletable)
|
|
240
|
+
) {
|
|
241
|
+
const actionColumn = {};
|
|
242
|
+
columns.push(actionColumn);
|
|
243
|
+
actionColumn["操作"] = 1;
|
|
244
|
+
actionColumn["title"] = translate("${操作}");
|
|
245
|
+
actionColumn["fixed"] = "right";
|
|
246
|
+
actionColumn["key"] = "action";
|
|
247
|
+
actionColumn["render"] = (record) => {
|
|
248
|
+
return (
|
|
249
|
+
<div className="actionbtn">
|
|
250
|
+
{/*详情*/}
|
|
251
|
+
{viewable ? (
|
|
252
|
+
<Button
|
|
253
|
+
disabled={disabled}
|
|
254
|
+
title={translate("${当前实体}")}
|
|
255
|
+
type="primary"
|
|
256
|
+
icon={<AlignLeftOutlined/>}
|
|
257
|
+
size="small"
|
|
258
|
+
onClick={() => this.showEntityView(record)}
|
|
259
|
+
></Button>
|
|
260
|
+
) : (
|
|
261
|
+
""
|
|
262
|
+
)}
|
|
263
|
+
{/*模板编辑*/}
|
|
264
|
+
{dtmplEdit ? (
|
|
265
|
+
<Button
|
|
266
|
+
disabled={disabled}
|
|
267
|
+
title={translate("${编辑}${当前实体}")}
|
|
268
|
+
icon={<FormOutlined/>}
|
|
269
|
+
size="small"
|
|
270
|
+
onClick={() => this.showEditDtmplModel(record)}
|
|
271
|
+
></Button>
|
|
272
|
+
) : (
|
|
273
|
+
""
|
|
274
|
+
)}
|
|
275
|
+
{fieldGroupConfig.rowActions &&
|
|
276
|
+
fieldGroupConfig.rowActions.length > 0
|
|
277
|
+
? fieldGroupConfig.rowActions.map((action) => {
|
|
278
|
+
return (
|
|
279
|
+
<Action
|
|
280
|
+
serverKey={serverKey}
|
|
281
|
+
disabled={disabled}
|
|
282
|
+
key={action.id}
|
|
283
|
+
data={[record]}
|
|
284
|
+
actionConfig={action}
|
|
285
|
+
doAction={this.doRowAction}
|
|
286
|
+
buttonSize={"small"}
|
|
287
|
+
></Action>
|
|
288
|
+
);
|
|
289
|
+
})
|
|
290
|
+
: ""}
|
|
291
|
+
{/*行编辑*/}
|
|
292
|
+
{rowEdit && editings.indexOf(record.code) < 0 ? (
|
|
293
|
+
addOrEditType !== "tableRow" ?
|
|
294
|
+
<RowEditor
|
|
295
|
+
serverKey={serverKey}
|
|
296
|
+
disabled={disabled}
|
|
297
|
+
buttonIcon={<EditOutlined/>}
|
|
298
|
+
dtmplData={this.getRowEditData(record.code)}
|
|
299
|
+
fieldGroupConfig={fieldGroupConfig}
|
|
300
|
+
onOk={this.handleRowEdit}
|
|
301
|
+
tooltipTitle={translate("${编辑当前行}")}
|
|
302
|
+
></RowEditor> : <Button icon={<EditOutlined/>} size={'small'}
|
|
303
|
+
onClick={() => this.editRowEdit(record.code)}>
|
|
304
|
+
</Button>
|
|
305
|
+
) : ""
|
|
306
|
+
}
|
|
307
|
+
{editings.indexOf(record.code) >= 0 ?
|
|
308
|
+
<><Tooltip placement="topRight" title={translate("${确定修改}")}>
|
|
309
|
+
<Button onClick={() => this.saveRowData(record.code)}
|
|
310
|
+
icon={<CheckOutlined/>} size={'small'}></Button></Tooltip>
|
|
311
|
+
<Tooltip placement="topRight" title={translate("${取消修改}")}>
|
|
312
|
+
<Button onClick={() => this.cancelRowEdit(record.code)}
|
|
313
|
+
icon={<CloseCircleOutlined/>} size={'small'}></Button>
|
|
314
|
+
</Tooltip>
|
|
315
|
+
</> : ""}
|
|
316
|
+
{/*删除*/}
|
|
317
|
+
{deletable ?
|
|
318
|
+
deleteData ? <Popconfirm
|
|
319
|
+
placement="leftBottom"
|
|
320
|
+
title={translate("${确定要[删除]选中数据吗}?")}
|
|
321
|
+
onConfirm={() => {
|
|
322
|
+
this.delete(record);
|
|
323
|
+
}}
|
|
324
|
+
okText={translate("${确定}")}
|
|
325
|
+
cancelText={translate("${取消}")}
|
|
326
|
+
okType={"danger"}
|
|
327
|
+
> <Button
|
|
328
|
+
disabled={disabled}
|
|
329
|
+
danger
|
|
330
|
+
type="primary"
|
|
331
|
+
icon={<DeleteOutlined/>}
|
|
332
|
+
size="small"></Button>
|
|
333
|
+
</Popconfirm> :
|
|
334
|
+
<Tooltip placement="right" title={translate("${删除}${当前行}")}>
|
|
335
|
+
<Button
|
|
336
|
+
disabled={disabled}
|
|
337
|
+
danger
|
|
338
|
+
type="primary"
|
|
339
|
+
icon={<DeleteOutlined/>}
|
|
340
|
+
size="small"
|
|
341
|
+
onClick={() => this.delete(record)}></Button></Tooltip>
|
|
342
|
+
|
|
343
|
+
: (
|
|
344
|
+
""
|
|
345
|
+
)}
|
|
346
|
+
</div>
|
|
347
|
+
);
|
|
348
|
+
};
|
|
349
|
+
} else if (viewOrEdit == "view" && viewable) {
|
|
350
|
+
const actionColumn = {};
|
|
351
|
+
columns.push(actionColumn);
|
|
352
|
+
actionColumn["操作"] = 1;
|
|
353
|
+
actionColumn["title"] = translate("${操作}");
|
|
354
|
+
actionColumn["fixed"] = "right";
|
|
355
|
+
actionColumn["key"] = "action";
|
|
356
|
+
actionColumn["render"] = (record) => {
|
|
357
|
+
return (
|
|
358
|
+
<div className="actionbtn">
|
|
359
|
+
{/*详情*/}
|
|
360
|
+
{viewable ? (
|
|
361
|
+
<Button
|
|
362
|
+
disabled={disabled}
|
|
363
|
+
title={translate("${当前实体}")}
|
|
364
|
+
type="primary"
|
|
365
|
+
icon={<AlignLeftOutlined/>}
|
|
366
|
+
size="small"
|
|
367
|
+
onClick={() => this.showEntityView(record)}
|
|
368
|
+
></Button>
|
|
369
|
+
) : (
|
|
370
|
+
""
|
|
371
|
+
)}
|
|
372
|
+
</div>
|
|
373
|
+
);
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return columns;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
doRowAction = async (actionId: string, codes: string[], params: object) => {
|
|
381
|
+
await this.doAction(
|
|
382
|
+
actionId,
|
|
383
|
+
[{title: undefined, code: codes[0]}],
|
|
384
|
+
params
|
|
341
385
|
);
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
<Button
|
|
356
|
-
disabled={disabled}
|
|
357
|
-
title={translate("${当前实体}")}
|
|
358
|
-
type="primary"
|
|
359
|
-
icon={<AlignLeftOutlined />}
|
|
360
|
-
size="small"
|
|
361
|
-
onClick={() => this.showEntityView(record)}
|
|
362
|
-
></Button>
|
|
363
|
-
) : (
|
|
364
|
-
""
|
|
365
|
-
)}
|
|
366
|
-
</div>
|
|
386
|
+
this.handleDtmplEdit(codes[0]);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
doAction = async (actionId: string, selectedRows: SelectedRow[], params) => {
|
|
390
|
+
this.setState({
|
|
391
|
+
tableLoading: true,
|
|
392
|
+
});
|
|
393
|
+
let {serverKey} = this.props;
|
|
394
|
+
let result: boolean = await HcserviceV3.postActions(
|
|
395
|
+
serverKey,
|
|
396
|
+
actionId,
|
|
397
|
+
selectedRows,
|
|
398
|
+
params
|
|
367
399
|
);
|
|
368
|
-
|
|
369
|
-
|
|
400
|
+
{
|
|
401
|
+
this.setState({
|
|
402
|
+
tableLoading: false,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
};
|
|
370
406
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
)
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
selectedCode: record.code,
|
|
405
|
-
showDtmplView: true,
|
|
406
|
-
});
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
hiddenEntityView = () => {
|
|
410
|
-
this.setState({
|
|
411
|
-
showDtmplView: false,
|
|
412
|
-
});
|
|
413
|
-
};
|
|
414
|
-
hiddenEntityEdit = () => {
|
|
415
|
-
this.setState({
|
|
416
|
-
showDtmplEdit: false,
|
|
417
|
-
});
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
editRow = (record) => {};
|
|
421
|
-
delete =async (record) => {
|
|
422
|
-
const { value, fieldGroupConfig, onChange,serverKey } = this.props;
|
|
423
|
-
//追加
|
|
424
|
-
const selectdDatas:DtmplData[] = [];
|
|
425
|
-
const selectdCodes:string[] = [];
|
|
426
|
-
if (value) {
|
|
427
|
-
for (let v of value) {
|
|
428
|
-
if (v.code != record.code) {
|
|
429
|
-
selectdDatas.push(v);
|
|
430
|
-
selectdCodes.push(v.code);
|
|
407
|
+
showEntityView = (record) => {
|
|
408
|
+
//console.log('tabel record:', record);
|
|
409
|
+
this.setState({
|
|
410
|
+
selectedCode: record.code,
|
|
411
|
+
showDtmplView: true,
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
hiddenEntityView = () => {
|
|
416
|
+
this.setState({
|
|
417
|
+
showDtmplView: false,
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
hiddenEntityEdit = () => {
|
|
421
|
+
this.setState({
|
|
422
|
+
showDtmplEdit: false,
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
editRow = (record) => {
|
|
427
|
+
};
|
|
428
|
+
delete = async (record) => {
|
|
429
|
+
const {value, fieldGroupConfig, onChange, serverKey} = this.props;
|
|
430
|
+
//追加
|
|
431
|
+
const selectdDatas: DtmplData[] = [];
|
|
432
|
+
const selectdCodes: string[] = [];
|
|
433
|
+
if (value) {
|
|
434
|
+
for (let v of value) {
|
|
435
|
+
if (v.code != record.code) {
|
|
436
|
+
selectdDatas.push(v);
|
|
437
|
+
selectdCodes.push(v.code);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
431
440
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
onChange(fieldGroupConfig, selectdDatas);
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
searchValue = (filterStr: string) => {
|
|
442
|
-
this.setState({
|
|
443
|
-
filterStr,
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
tabChange = (pagination) => {
|
|
448
|
-
//console.log('pagination',pagination);
|
|
449
|
-
this.setState({
|
|
450
|
-
pageSize: pagination.pageSize,
|
|
451
|
-
});
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
showSelect = () => {
|
|
455
|
-
//console.log('showSelectTable click');
|
|
456
|
-
this.setState({
|
|
457
|
-
showSelectTable: true,
|
|
458
|
-
});
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
select = async (selectedRows: SelectedRow[]) => {
|
|
462
|
-
this.setState({
|
|
463
|
-
showSelectTable: false,
|
|
464
|
-
});
|
|
465
|
-
if (!selectedRows || selectedRows.length <= 0) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
441
|
+
//直接删除
|
|
442
|
+
if (fieldGroupConfig.deleteData) {
|
|
443
|
+
let result: boolean = await HcserviceV3.deleteByCode(serverKey, fieldGroupConfig.id, [record.code]);
|
|
444
|
+
}
|
|
445
|
+
onChange(fieldGroupConfig, selectdDatas);
|
|
446
|
+
};
|
|
468
447
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
await this.add(codes);
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
add = async (codes: string[]) => {
|
|
478
|
-
const { value, fieldGroupConfig, onChange, serverKey } = this.props;
|
|
479
|
-
const { relationNames } = fieldGroupConfig;
|
|
480
|
-
this.setState({
|
|
481
|
-
tableLoading: true,
|
|
482
|
-
});
|
|
483
|
-
let selectdDatas: DtmplData[] = await HcserviceV3.requestSelectedData(
|
|
484
|
-
serverKey,
|
|
485
|
-
fieldGroupConfig.id,
|
|
486
|
-
codes
|
|
487
|
-
);
|
|
488
|
-
|
|
489
|
-
//添加默认关系
|
|
490
|
-
if (selectdDatas) {
|
|
491
|
-
for (let d of selectdDatas) {
|
|
492
|
-
d["relationLabel"] = relationNames[0];
|
|
493
|
-
}
|
|
494
|
-
}
|
|
448
|
+
searchValue = (filterStr: string) => {
|
|
449
|
+
this.setState({
|
|
450
|
+
filterStr,
|
|
451
|
+
});
|
|
452
|
+
};
|
|
495
453
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
454
|
+
tabChange = (pagination) => {
|
|
455
|
+
//console.log('pagination',pagination);
|
|
456
|
+
this.setState({
|
|
457
|
+
pageSize: pagination.pageSize,
|
|
458
|
+
});
|
|
459
|
+
};
|
|
500
460
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
break;
|
|
461
|
+
showSelect = () => {
|
|
462
|
+
//console.log('showSelectTable click');
|
|
463
|
+
this.setState({
|
|
464
|
+
showSelectTable: true,
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
select = async (selectedRows: SelectedRow[]) => {
|
|
469
|
+
this.setState({
|
|
470
|
+
showSelectTable: false,
|
|
471
|
+
});
|
|
472
|
+
if (!selectedRows || selectedRows.length <= 0) {
|
|
473
|
+
return;
|
|
515
474
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
this.setState({
|
|
522
|
-
showDtmplEdit: false,
|
|
523
|
-
});
|
|
524
|
-
await this.add([code]);
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
handleDtmplEdit = async (code: string) => {
|
|
528
|
-
const { value, fieldGroupConfig, onChange } = this.props;
|
|
529
|
-
const {
|
|
530
|
-
serverKey,
|
|
531
|
-
} = fieldGroupConfig;
|
|
532
|
-
this.setState({
|
|
533
|
-
tableLoading: true,
|
|
534
|
-
showDtmplEdit: false,
|
|
535
|
-
});
|
|
536
|
-
let data: DtmplData = (
|
|
537
|
-
await HcserviceV3.requestSelectedData(serverKey, fieldGroupConfig.id, [
|
|
538
|
-
code,
|
|
539
|
-
])
|
|
540
|
-
)[0];
|
|
541
|
-
let datas: DtmplData[] = [...value];
|
|
542
|
-
|
|
543
|
-
if (datas && data) {
|
|
544
|
-
for (let v of datas) {
|
|
545
|
-
if (v.code == data.code) {
|
|
546
|
-
v.fieldMap = data.fieldMap;
|
|
475
|
+
|
|
476
|
+
//查询
|
|
477
|
+
const codes: string[] = [];
|
|
478
|
+
for (let row of selectedRows) {
|
|
479
|
+
codes.push(row.code);
|
|
547
480
|
}
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
481
|
+
await this.add(codes);
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
add = async (codes: string[]) => {
|
|
485
|
+
const {value, fieldGroupConfig, onChange, serverKey} = this.props;
|
|
486
|
+
const {relationNames} = fieldGroupConfig;
|
|
487
|
+
this.setState({
|
|
488
|
+
tableLoading: true,
|
|
489
|
+
});
|
|
490
|
+
let selectdDatas: DtmplData[] = await HcserviceV3.requestSelectedData(
|
|
491
|
+
serverKey,
|
|
492
|
+
fieldGroupConfig.id,
|
|
493
|
+
codes
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
//添加默认关系
|
|
497
|
+
if (selectdDatas) {
|
|
498
|
+
for (let d of selectdDatas) {
|
|
499
|
+
d["relationLabel"] = relationNames[0];
|
|
500
|
+
}
|
|
568
501
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
502
|
+
|
|
503
|
+
//追加
|
|
504
|
+
if (value) {
|
|
505
|
+
selectdDatas.unshift(...value);
|
|
572
506
|
}
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (isAdd) {
|
|
577
|
-
datas.unshift(dtmplData);
|
|
578
|
-
}
|
|
579
|
-
onChange(fieldGroupConfig, datas);
|
|
580
|
-
|
|
581
|
-
// if (isAdd) {
|
|
582
|
-
// message.success(translate("${已添加}"));
|
|
583
|
-
// } else {
|
|
584
|
-
// message.success(translate("${已修改}"));
|
|
585
|
-
// }
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
showAddDtmplModel = (addTmplId?: string) => {
|
|
589
|
-
this.setState({
|
|
590
|
-
showDtmplEdit: true,
|
|
591
|
-
addTmplId,
|
|
592
|
-
selectedCode: undefined,
|
|
593
|
-
});
|
|
594
|
-
};
|
|
595
|
-
showEditDtmplModel = (record) => {
|
|
596
|
-
this.setState({
|
|
597
|
-
showDtmplEdit: true,
|
|
598
|
-
addTmplId: undefined,
|
|
599
|
-
selectedCode: record.code,
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
|
|
604
|
-
const { translate } = this.context;
|
|
605
|
-
|
|
606
|
-
if (classAddConfigs && classAddConfigs.length < 1) {
|
|
607
|
-
return translate("${没有分类添加按钮}");
|
|
608
|
-
}
|
|
609
|
-
return classAddConfigs.map((config) => {
|
|
610
|
-
return (
|
|
611
|
-
<p>
|
|
612
|
-
<Button
|
|
613
|
-
size={"small"}
|
|
614
|
-
type={"text"}
|
|
615
|
-
onClick={() => this.showAddDtmplModel(config.id)}
|
|
616
|
-
>
|
|
617
|
-
{config.title}
|
|
618
|
-
</Button>
|
|
619
|
-
</p>
|
|
620
|
-
);
|
|
621
|
-
});
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
addNewRow=(defaultValue)=>{
|
|
625
|
-
const { value, fieldGroupConfig, onChange } = this.props;
|
|
626
|
-
const {editings}=this.state;
|
|
627
|
-
let datas: DtmplData[] = [];
|
|
628
|
-
if (value) {
|
|
629
|
-
datas = [...value];
|
|
630
|
-
}
|
|
631
|
-
let fieldMaps=[];
|
|
632
|
-
if(!defaultValue){
|
|
633
|
-
fieldMaps=[{}]
|
|
634
|
-
}else if(Array.isArray(defaultValue)){
|
|
635
|
-
fieldMaps=defaultValue;
|
|
636
|
-
}else{
|
|
637
|
-
fieldMaps=[defaultValue]
|
|
638
|
-
}
|
|
639
507
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
newData.relationLabel=fieldGroupConfig.relationNames[0]
|
|
646
|
-
newData.fieldMap=f;
|
|
647
|
-
datas.unshift(newData);
|
|
648
|
-
editingCodes.push(newData.code);
|
|
649
|
-
}
|
|
508
|
+
onChange(fieldGroupConfig, selectdDatas);
|
|
509
|
+
this.setState({
|
|
510
|
+
tableLoading: false,
|
|
511
|
+
});
|
|
512
|
+
};
|
|
650
513
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
514
|
+
getRowEditData = (code?: string) => {
|
|
515
|
+
const {value} = this.props;
|
|
516
|
+
let data = undefined;
|
|
517
|
+
if (code) {
|
|
518
|
+
for (let dtmplData of value) {
|
|
519
|
+
if (code == dtmplData.code) {
|
|
520
|
+
data = dtmplData;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return data;
|
|
526
|
+
};
|
|
527
|
+
handleDtmplAdd = async (code: string) => {
|
|
528
|
+
this.setState({
|
|
529
|
+
showDtmplEdit: false,
|
|
530
|
+
});
|
|
531
|
+
await this.add([code]);
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
handleDtmplEdit = async (code: string) => {
|
|
535
|
+
const {value, fieldGroupConfig, onChange} = this.props;
|
|
536
|
+
const {
|
|
537
|
+
serverKey,
|
|
538
|
+
} = fieldGroupConfig;
|
|
539
|
+
this.setState({
|
|
540
|
+
tableLoading: true,
|
|
541
|
+
showDtmplEdit: false,
|
|
542
|
+
});
|
|
543
|
+
let data: DtmplData = (
|
|
544
|
+
await HcserviceV3.requestSelectedData(serverKey, fieldGroupConfig.id, [
|
|
545
|
+
code,
|
|
546
|
+
])
|
|
547
|
+
)[0];
|
|
548
|
+
let datas: DtmplData[] = [...value];
|
|
549
|
+
|
|
550
|
+
if (datas && data) {
|
|
551
|
+
for (let v of datas) {
|
|
552
|
+
if (v.code == data.code) {
|
|
553
|
+
v.fieldMap = data.fieldMap;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
onChange(fieldGroupConfig, datas);
|
|
558
|
+
this.setState({
|
|
559
|
+
tableLoading: false,
|
|
560
|
+
});
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
handleRowEdit = (dtmplData: DtmplData) => {
|
|
564
|
+
const {value, fieldGroupConfig, onChange} = this.props;
|
|
565
|
+
let datas: DtmplData[] = [];
|
|
566
|
+
if (value) {
|
|
567
|
+
datas = [...value];
|
|
568
|
+
}
|
|
569
|
+
let isAdd = true;
|
|
570
|
+
for (let v of datas) {
|
|
571
|
+
if (v.code == dtmplData.code) {
|
|
572
|
+
isAdd = false;
|
|
573
|
+
if (dtmplData.editStatus) {
|
|
574
|
+
v.editStatus = dtmplData.editStatus;
|
|
575
|
+
}
|
|
576
|
+
v.fieldMap = dtmplData.fieldMap;
|
|
577
|
+
if (dtmplData.relationLabel) {
|
|
578
|
+
v.relationLabel = dtmplData.relationLabel;
|
|
579
|
+
}
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (isAdd) {
|
|
584
|
+
datas.unshift(dtmplData);
|
|
585
|
+
}
|
|
586
|
+
onChange(fieldGroupConfig, datas);
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
showAddDtmplModel = (addTmplId?: string) => {
|
|
590
|
+
this.setState({
|
|
591
|
+
showDtmplEdit: true,
|
|
592
|
+
addTmplId,
|
|
593
|
+
selectedCode: undefined,
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
showEditDtmplModel = (record) => {
|
|
597
|
+
this.setState({
|
|
598
|
+
showDtmplEdit: true,
|
|
599
|
+
addTmplId: undefined,
|
|
600
|
+
selectedCode: record.code,
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
|
|
605
|
+
const {translate} = this.context;
|
|
606
|
+
|
|
607
|
+
if (classAddConfigs && classAddConfigs.length < 1) {
|
|
608
|
+
return translate("${没有分类添加按钮}");
|
|
609
|
+
}
|
|
610
|
+
return classAddConfigs.map((config) => {
|
|
611
|
+
return (
|
|
612
|
+
<p>
|
|
613
|
+
<Button
|
|
614
|
+
size={"small"}
|
|
615
|
+
type={"text"}
|
|
616
|
+
onClick={() => this.showAddDtmplModel(config.id)}
|
|
617
|
+
>
|
|
618
|
+
{config.title}
|
|
619
|
+
</Button>
|
|
620
|
+
</p>
|
|
621
|
+
);
|
|
622
|
+
});
|
|
623
|
+
};
|
|
654
624
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
625
|
+
addNewRow = (defaultValue) => {
|
|
626
|
+
const {value, fieldGroupConfig, onChange, onEditing} = this.props;
|
|
627
|
+
const {editings} = this.state;
|
|
628
|
+
let datas: DtmplData[] = [];
|
|
629
|
+
if (value) {
|
|
630
|
+
datas = [...value];
|
|
631
|
+
}
|
|
632
|
+
let fieldMaps = [];
|
|
633
|
+
if (!defaultValue) {
|
|
634
|
+
fieldMaps = [{}]
|
|
635
|
+
} else if (Array.isArray(defaultValue)) {
|
|
636
|
+
fieldMaps = defaultValue;
|
|
637
|
+
} else {
|
|
638
|
+
fieldMaps = [defaultValue]
|
|
639
|
+
}
|
|
660
640
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
641
|
+
let editingCodes = [...editings];
|
|
642
|
+
let i = 0;
|
|
643
|
+
for (let f of fieldMaps) {
|
|
644
|
+
let newData: DtmplData = {};
|
|
645
|
+
newData.code = Date.now() + "" + i++;
|
|
646
|
+
newData.relationLabel = fieldGroupConfig.relationNames[0]
|
|
647
|
+
newData.fieldMap = f;
|
|
648
|
+
datas.unshift(newData);
|
|
649
|
+
editingCodes.push(newData.code);
|
|
665
650
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
cancelRowEdit=(code:string)=>{
|
|
674
|
-
const {editings}=this.state
|
|
675
|
-
// editings..unshift(code);
|
|
676
|
-
let arr = editings.filter(item => item !== code);
|
|
677
|
-
this.setState({editings:[...arr]});
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
uploadFiles=(values)=> {
|
|
681
|
-
|
|
682
|
-
const {batchAddFileField} = this.props.fieldGroupConfig
|
|
683
|
-
if (values) {
|
|
684
|
-
|
|
685
|
-
let uploading = false;
|
|
686
|
-
let vals=JSON.parse(values);
|
|
687
|
-
for (let value of vals) {
|
|
688
|
-
if (!value.status || value.status != "done") {
|
|
689
|
-
uploading = true;
|
|
651
|
+
|
|
652
|
+
this.setState({editings: editingCodes})
|
|
653
|
+
onChange(fieldGroupConfig, datas);
|
|
654
|
+
if (onEditing) {
|
|
655
|
+
onEditing(editingCodes.length>0);
|
|
690
656
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
editRowEdit = (code) => {
|
|
660
|
+
const {editings}=this.state;
|
|
661
|
+
const {onEditing} = this.props;
|
|
662
|
+
let edis=[...editings, code];
|
|
663
|
+
this.setState({editings:edis });
|
|
664
|
+
if (onEditing) {
|
|
665
|
+
onEditing(edis.length>0);
|
|
698
666
|
}
|
|
699
|
-
this.addNewRow(datas);
|
|
700
|
-
this.setState({uploadingFiles:[]})
|
|
701
|
-
}else{
|
|
702
|
-
this.setState({uploadingFiles:values})
|
|
703
|
-
}
|
|
704
667
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
<>
|
|
727
|
-
<Button onClick={()=>this.addNewRow(undefined)}>{translate("${添加一行}")}</Button>
|
|
728
|
-
{batchAddFileField? <EntryControl value={uploadingFiles} onChange={this.uploadFiles} fieldConfig={{controlType:"relfile"}}/> :""}
|
|
729
|
-
</>:
|
|
730
|
-
<RowEditor
|
|
731
|
-
serverKey={serverKey}
|
|
732
|
-
disabled={buttonDisabled}
|
|
733
|
-
buttonStyle={{marginBottom:10}}
|
|
734
|
-
buttonTitle={translate("${新建一行}")}
|
|
735
|
-
fieldGroupConfig={fieldGroupConfig}
|
|
736
|
-
onOk={this.handleRowEdit}
|
|
737
|
-
></RowEditor>
|
|
738
|
-
) : (
|
|
739
|
-
""
|
|
740
|
-
)}
|
|
741
|
-
{buttons.includes("dtmplAdd") ? (
|
|
742
|
-
fieldGroupConfig.classAddConfigs &&
|
|
743
|
-
fieldGroupConfig.classAddConfigs.length > 0 ? (
|
|
744
|
-
<Popover
|
|
745
|
-
arrow={false}
|
|
746
|
-
content={this.getAddTmplButton(
|
|
747
|
-
fieldGroupConfig.classAddConfigs
|
|
748
|
-
)}
|
|
749
|
-
placement="bottomRight"
|
|
750
|
-
>
|
|
751
|
-
<Tooltip>
|
|
752
|
-
<Button icon={<PlusSquareOutlined />}>
|
|
753
|
-
{translate("${新增}")}
|
|
754
|
-
</Button>
|
|
755
|
-
</Tooltip>
|
|
756
|
-
</Popover>
|
|
757
|
-
) : (
|
|
758
|
-
<Button
|
|
759
|
-
disabled={buttonDisabled}
|
|
760
|
-
icon={<PlusSquareOutlined />}
|
|
761
|
-
size="small"
|
|
762
|
-
onClick={() => this.showAddDtmplModel()}
|
|
763
|
-
style={{ marginBottom: 10 }}
|
|
764
|
-
>
|
|
765
|
-
{translate("${新增}")}
|
|
766
|
-
</Button>
|
|
767
|
-
)
|
|
768
|
-
) : (
|
|
769
|
-
""
|
|
770
|
-
)}
|
|
771
|
-
{buttons.includes("selectAdd") ? (
|
|
772
|
-
<Button
|
|
773
|
-
disabled={buttonDisabled}
|
|
774
|
-
type="primary"
|
|
775
|
-
icon={<SnippetsOutlined />}
|
|
776
|
-
size="small"
|
|
777
|
-
onClick={this.showSelect}
|
|
778
|
-
style={{ marginBottom: 10 }}
|
|
779
|
-
>
|
|
780
|
-
{translate("${选择}")}
|
|
781
|
-
</Button>
|
|
782
|
-
) : (
|
|
783
|
-
""
|
|
784
|
-
)}
|
|
785
|
-
{fieldGroupConfig.min && (!value || value.length <= 0) ? (
|
|
786
|
-
<Text style={{ color: "red" }}>
|
|
787
|
-
{translate("${请选择或添加}")}
|
|
788
|
-
{translate("${" + fieldGroupConfig.title + "}")}
|
|
789
|
-
</Text>
|
|
790
|
-
) : null}
|
|
791
|
-
<FormItem
|
|
792
|
-
name={"$virtual" + fieldGroupConfig.id}
|
|
793
|
-
style={{ margin: 0, maxHeight: "32px" }}
|
|
794
|
-
rules={
|
|
795
|
-
fieldGroupConfig.min
|
|
796
|
-
? [
|
|
797
|
-
{
|
|
798
|
-
required: true,
|
|
799
|
-
message: ``,
|
|
800
|
-
},
|
|
801
|
-
]
|
|
802
|
-
: null
|
|
668
|
+
|
|
669
|
+
cancelRowEdit = (code: string) => {
|
|
670
|
+
const {onEditing} = this.props
|
|
671
|
+
const {editings} = this.state
|
|
672
|
+
let arr = editings.filter(item => item !== code);
|
|
673
|
+
this.setState({editings: [...arr]});
|
|
674
|
+
if (onEditing) {
|
|
675
|
+
onEditing(arr.length>0);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
saveRowData = async (code: string) => {
|
|
680
|
+
let currentForm = this.formRef.current;
|
|
681
|
+
let dtmplData: DtmplData = {code};
|
|
682
|
+
dtmplData.fieldMap = {};
|
|
683
|
+
dtmplData.editStatus = "changed";
|
|
684
|
+
|
|
685
|
+
await currentForm.validateFields().then(async (values) => {
|
|
686
|
+
for (let key in values) {
|
|
687
|
+
if (values.hasOwnProperty(key) && key.startsWith(code)) {
|
|
688
|
+
dtmplData.fieldMap[key.split("_")[1]] = values[key];
|
|
803
689
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
value={value}
|
|
810
|
-
></CountingTag>
|
|
811
|
-
</FormItem>
|
|
812
|
-
</Space>
|
|
813
|
-
</Col>
|
|
814
|
-
</Row>
|
|
815
|
-
);
|
|
816
|
-
} else {
|
|
817
|
-
return "";
|
|
690
|
+
}
|
|
691
|
+
this.cancelRowEdit(code);
|
|
692
|
+
this.handleRowEdit(dtmplData);
|
|
693
|
+
}).catch(errorInfo => {
|
|
694
|
+
})
|
|
818
695
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
? mainCode
|
|
848
|
-
: parentId;
|
|
849
|
-
let page = {
|
|
850
|
-
pageSize: pageSize,
|
|
851
|
-
hideOnSinglePage: true,
|
|
852
|
-
defaultCurrent: 1,
|
|
853
|
-
total: value ? value.length : undefined,
|
|
854
|
-
showTotal: (total) => {
|
|
855
|
-
return translate("${总共}" + total + "${条}");
|
|
856
|
-
},
|
|
857
|
-
};
|
|
858
|
-
let exceptCodes = [];
|
|
859
|
-
if (value) {
|
|
860
|
-
for (let v of value) {
|
|
861
|
-
exceptCodes.push(v.code);
|
|
862
|
-
}
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
uploadFiles = (values) => {
|
|
700
|
+
|
|
701
|
+
const {batchAddFileField} = this.props.fieldGroupConfig
|
|
702
|
+
if (values) {
|
|
703
|
+
|
|
704
|
+
let uploading = false;
|
|
705
|
+
let vals = JSON.parse(values);
|
|
706
|
+
for (let value of vals) {
|
|
707
|
+
if (!value.status || value.status != "done") {
|
|
708
|
+
uploading = true;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
let datas = [];
|
|
712
|
+
if (!uploading) {
|
|
713
|
+
for (let value of vals) {
|
|
714
|
+
let data = {};
|
|
715
|
+
data[batchAddFileField.id] = JSON.stringify(value);
|
|
716
|
+
datas.push(data);
|
|
717
|
+
}
|
|
718
|
+
this.addNewRow(datas);
|
|
719
|
+
this.setState({uploadingFiles: []})
|
|
720
|
+
} else {
|
|
721
|
+
this.setState({uploadingFiles: values})
|
|
722
|
+
}
|
|
723
|
+
}
|
|
863
724
|
}
|
|
864
725
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
726
|
+
buildButtons = () => {
|
|
727
|
+
const {fieldGroupConfig, viewOrEdit, value, serverKey} = this.props;
|
|
728
|
+
const {translate} = this.context;
|
|
729
|
+
const {buttons, disabled, addOrEditType, batchAddFileField} = fieldGroupConfig;
|
|
730
|
+
const {showRowEdit, uploadingFiles} = this.state;
|
|
731
|
+
|
|
732
|
+
const buttonDisabled: boolean = disabled
|
|
733
|
+
? disabled
|
|
734
|
+
: fieldGroupConfig.max
|
|
735
|
+
? fieldGroupConfig.max <= (value ? value.length : 0)
|
|
736
|
+
: false;
|
|
737
|
+
|
|
738
|
+
if (viewOrEdit == "edit") {
|
|
739
|
+
return (
|
|
740
|
+
<Row>
|
|
741
|
+
<Col span={20}>
|
|
742
|
+
<Space>
|
|
743
|
+
{buttons.includes("rowAdd") ? (
|
|
744
|
+
addOrEditType == "tableRow" ?
|
|
745
|
+
<>
|
|
746
|
+
<Button
|
|
747
|
+
onClick={() => this.addNewRow(undefined)}>{translate("${添加一行}")}</Button>
|
|
748
|
+
{batchAddFileField ?
|
|
749
|
+
<EntryControl value={uploadingFiles} onChange={this.uploadFiles}
|
|
750
|
+
fieldConfig={{controlType: "relfile"}}/> : ""}
|
|
751
|
+
</> :
|
|
752
|
+
<RowEditor
|
|
753
|
+
serverKey={serverKey}
|
|
754
|
+
disabled={buttonDisabled}
|
|
755
|
+
buttonStyle={{marginBottom: 10}}
|
|
756
|
+
buttonTitle={translate("${新建一行}")}
|
|
757
|
+
fieldGroupConfig={fieldGroupConfig}
|
|
758
|
+
onOk={this.handleRowEdit}
|
|
759
|
+
></RowEditor>
|
|
760
|
+
) : (
|
|
761
|
+
""
|
|
762
|
+
)}
|
|
763
|
+
{buttons.includes("dtmplAdd") ? (
|
|
764
|
+
fieldGroupConfig.classAddConfigs &&
|
|
765
|
+
fieldGroupConfig.classAddConfigs.length > 0 ? (
|
|
766
|
+
<Popover
|
|
767
|
+
arrow={false}
|
|
768
|
+
content={this.getAddTmplButton(
|
|
769
|
+
fieldGroupConfig.classAddConfigs
|
|
770
|
+
)}
|
|
771
|
+
placement="bottomRight"
|
|
772
|
+
>
|
|
773
|
+
<Tooltip>
|
|
774
|
+
<Button icon={<PlusSquareOutlined/>}>
|
|
775
|
+
{translate("${新增}")}
|
|
776
|
+
</Button>
|
|
777
|
+
</Tooltip>
|
|
778
|
+
</Popover>
|
|
779
|
+
) : (
|
|
780
|
+
<Button
|
|
781
|
+
disabled={buttonDisabled}
|
|
782
|
+
icon={<PlusSquareOutlined/>}
|
|
783
|
+
size="small"
|
|
784
|
+
onClick={() => this.showAddDtmplModel()}
|
|
785
|
+
style={{marginBottom: 10}}
|
|
786
|
+
>
|
|
787
|
+
{translate("${新增}")}
|
|
788
|
+
</Button>
|
|
789
|
+
)
|
|
790
|
+
) : (
|
|
791
|
+
""
|
|
792
|
+
)}
|
|
793
|
+
{buttons.includes("selectAdd") ? (
|
|
794
|
+
<Button
|
|
795
|
+
disabled={buttonDisabled}
|
|
796
|
+
type="primary"
|
|
797
|
+
icon={<SnippetsOutlined/>}
|
|
798
|
+
size="small"
|
|
799
|
+
onClick={this.showSelect}
|
|
800
|
+
style={{marginBottom: 10}}
|
|
801
|
+
>
|
|
802
|
+
{translate("${选择}")}
|
|
803
|
+
</Button>
|
|
804
|
+
) : (
|
|
805
|
+
""
|
|
806
|
+
)}
|
|
807
|
+
{fieldGroupConfig.min && (!value || value.length <= 0) ? (
|
|
808
|
+
<Text style={{color: "red"}}>
|
|
809
|
+
{translate("${请选择或添加}")}
|
|
810
|
+
{translate("${" + fieldGroupConfig.title + "}")}
|
|
811
|
+
</Text>
|
|
812
|
+
) : null}
|
|
813
|
+
<FormItem
|
|
814
|
+
name={"$virtual" + fieldGroupConfig.id}
|
|
815
|
+
style={{margin: 0, maxHeight: "32px"}}
|
|
816
|
+
rules={
|
|
817
|
+
fieldGroupConfig.min
|
|
818
|
+
? [
|
|
819
|
+
{
|
|
820
|
+
required: true,
|
|
821
|
+
message: ``,
|
|
822
|
+
},
|
|
823
|
+
]
|
|
824
|
+
: null
|
|
825
|
+
}
|
|
826
|
+
>
|
|
827
|
+
<CountingTag
|
|
828
|
+
min={fieldGroupConfig.min + ""}
|
|
829
|
+
style={{marginBottom: 10}}
|
|
830
|
+
count={value ? value.length : 0}
|
|
831
|
+
value={value}
|
|
832
|
+
></CountingTag>
|
|
833
|
+
</FormItem>
|
|
834
|
+
</Space>
|
|
835
|
+
</Col>
|
|
836
|
+
</Row>
|
|
837
|
+
);
|
|
838
|
+
} else {
|
|
839
|
+
return "";
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
render() {
|
|
844
|
+
const {
|
|
845
|
+
fieldGroupConfig,
|
|
846
|
+
value,
|
|
847
|
+
parentId,
|
|
848
|
+
loading,
|
|
849
|
+
initCollapse,
|
|
850
|
+
mainCode,
|
|
851
|
+
serverKey,
|
|
852
|
+
showRightNav, parentFormInstance
|
|
853
|
+
} = this.props;
|
|
854
|
+
const {
|
|
855
|
+
pageSize,
|
|
856
|
+
selectedCode,
|
|
857
|
+
showDtmplView,
|
|
858
|
+
showSelectTable,
|
|
859
|
+
showDtmplEdit,
|
|
860
|
+
addTmplId,
|
|
861
|
+
tableLoading,
|
|
862
|
+
} = this.state;
|
|
863
|
+
const {translate} = this.context;
|
|
864
|
+
|
|
865
|
+
const {buttons, viewModel} = fieldGroupConfig;
|
|
866
|
+
let mainCode1 = fieldGroupConfig.mainCode
|
|
867
|
+
? fieldGroupConfig.mainCode
|
|
868
|
+
: mainCode
|
|
869
|
+
? mainCode
|
|
870
|
+
: parentId;
|
|
871
|
+
let page = {
|
|
872
|
+
pageSize: pageSize,
|
|
873
|
+
hideOnSinglePage: true,
|
|
874
|
+
defaultCurrent: 1,
|
|
875
|
+
total: value ? value.length : undefined,
|
|
876
|
+
showTotal: (total) => {
|
|
877
|
+
return translate("${总共}" + total + "${条}");
|
|
878
|
+
},
|
|
879
|
+
};
|
|
880
|
+
let exceptCodes = [];
|
|
881
|
+
if (value) {
|
|
882
|
+
for (let v of value) {
|
|
883
|
+
exceptCodes.push(v.code);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
return fieldGroupConfig.displayConfig.includes("nonDataNonDisplayed") &&
|
|
888
|
+
(!value || value.length <= 0) ? (
|
|
889
|
+
""
|
|
954
890
|
) : (
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
891
|
+
<>
|
|
892
|
+
<CollapseCard
|
|
893
|
+
showRightNav={showRightNav}
|
|
894
|
+
initCollapse={
|
|
895
|
+
initCollapse || fieldGroupConfig.displayConfig.includes("folded")
|
|
896
|
+
}
|
|
897
|
+
title={fieldGroupConfig.title}
|
|
898
|
+
tip={fieldGroupConfig.tip}
|
|
899
|
+
id={parentId + fieldGroupConfig.id}
|
|
900
|
+
className={`hoverable`}
|
|
901
|
+
styles={{header: {background: "#f2f4f5"}, body: {padding: "6px"}}}
|
|
902
|
+
loading={loading}
|
|
903
|
+
//暂时注释掉,后续要支持配置。
|
|
904
|
+
//extra={<Input.Search onSearch={this.searchValue} allowClear placeholder=""/>}
|
|
905
|
+
>
|
|
906
|
+
<div className="editTableList">
|
|
907
|
+
{this.buildButtons()}
|
|
908
|
+
{viewModel && viewModel == "verticalList" ? <VerticalList
|
|
909
|
+
dataSource={this.buildDataSource()}
|
|
910
|
+
columnConfigs={fieldGroupConfig?.fields}
|
|
911
|
+
serverKey={serverKey}
|
|
912
|
+
columns={this.buildColumns()}/> :
|
|
913
|
+
<AntdForm
|
|
914
|
+
ref={this.formRef} component={false}>
|
|
915
|
+
<Table
|
|
916
|
+
size={"small"}
|
|
917
|
+
locale={{
|
|
918
|
+
emptyText: (
|
|
919
|
+
<div style={{textAlign: "center", width: "100%"}}>
|
|
920
|
+
<Text disabled>{translate("${暂无数据}...")}</Text>
|
|
921
|
+
</div>
|
|
922
|
+
),
|
|
923
|
+
}}
|
|
924
|
+
bordered
|
|
925
|
+
loading={tableLoading}
|
|
926
|
+
dataSource={this.buildDataSource()}
|
|
927
|
+
columns={this.buildColumns()}
|
|
928
|
+
pagination={page}
|
|
929
|
+
onChange={this.tabChange}
|
|
930
|
+
/></AntdForm>}
|
|
931
|
+
</div>
|
|
932
|
+
</CollapseCard>
|
|
933
|
+
{buttons.includes("detail") ? (
|
|
934
|
+
<ModalDtmplView
|
|
935
|
+
serverKey={serverKey}
|
|
936
|
+
mainCode={mainCode1}
|
|
937
|
+
open={showDtmplView}
|
|
938
|
+
onCancel={this.hiddenEntityView}
|
|
939
|
+
sourceId={fieldGroupConfig.id}
|
|
940
|
+
code={selectedCode}
|
|
941
|
+
>
|
|
942
|
+
{" "}
|
|
943
|
+
</ModalDtmplView>
|
|
944
|
+
) : (
|
|
945
|
+
""
|
|
946
|
+
)}
|
|
947
|
+
{buttons.includes("dtmplEdit") || buttons.includes("dtmplAdd") ? (
|
|
948
|
+
<DtmplEditPage
|
|
949
|
+
addTmplId={addTmplId}
|
|
950
|
+
serverKey={serverKey}
|
|
951
|
+
mainCode={mainCode1}
|
|
952
|
+
open={showDtmplEdit}
|
|
953
|
+
onCancel={this.hiddenEntityEdit}
|
|
954
|
+
sourceId={fieldGroupConfig.id}
|
|
955
|
+
code={selectedCode}
|
|
956
|
+
parentFormInstance={parentFormInstance}
|
|
957
|
+
onOk={selectedCode ? this.handleDtmplEdit : this.handleDtmplAdd}
|
|
958
|
+
/>
|
|
959
|
+
) : (
|
|
960
|
+
""
|
|
961
|
+
)}
|
|
962
|
+
{buttons.includes("selectAdd") ? (
|
|
963
|
+
<ModelSelectTable
|
|
964
|
+
serverKey={serverKey}
|
|
965
|
+
defaultCriteriaValue={fieldGroupConfig.defaultCriteriaValue}
|
|
966
|
+
maxSelectedRows={fieldGroupConfig.max}
|
|
967
|
+
open={showSelectTable}
|
|
968
|
+
onOK={this.select}
|
|
969
|
+
onCancel={() => {
|
|
970
|
+
this.setState({showSelectTable: false});
|
|
971
|
+
}}
|
|
972
|
+
exceptCodes={exceptCodes}
|
|
973
|
+
mainCode={mainCode1}
|
|
974
|
+
sourceId={fieldGroupConfig.id}
|
|
975
|
+
></ModelSelectTable>
|
|
976
|
+
) : (
|
|
977
|
+
""
|
|
978
|
+
)}
|
|
979
|
+
</>
|
|
980
|
+
);
|
|
981
|
+
}
|
|
960
982
|
}
|
|
961
983
|
|
|
962
984
|
export default RelationTable;
|