aldehyde 0.2.405 → 0.2.407
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/action/index.d.ts.map +1 -1
- package/lib/controls/action/index.js +4 -5
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/direct-file-view/index.js +5 -5
- package/lib/controls/direct-file-view/index.js.map +1 -1
- package/lib/controls/entity-select/entity-select.js +1 -1
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.js +2 -3
- package/lib/controls/entity-select/popover-entity-select.js.map +1 -1
- package/lib/controls/entry-control.js +1 -1
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/select/index.js +1 -1
- package/lib/controls/select/index.js.map +1 -1
- package/lib/form/criteria-form.d.ts.map +1 -1
- package/lib/form/criteria-form.js +10 -4
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +6 -0
- package/lib/layout2/page.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +2 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +3 -2
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/splitview-ltmpl-route.js +1 -1
- package/lib/routable/splitview-ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +15 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +102 -23
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts +3 -0
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +45 -12
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/index.css +16 -2
- package/lib/table/relation-table.d.ts +4 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/select-table.d.ts +2 -81
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +40 -7
- package/lib/table/select-table.js.map +1 -1
- package/lib/tmpl/interface.d.ts +9 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +5 -5
- package/src/aldehyde/controls/direct-file-view/index.tsx +5 -5
- package/src/aldehyde/controls/entity-select/entity-select.tsx +1 -1
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +2 -2
- package/src/aldehyde/controls/entry-control.tsx +1 -1
- package/src/aldehyde/controls/select/index.tsx +1 -1
- package/src/aldehyde/form/criteria-form.tsx +5 -2
- package/src/aldehyde/layout2/page.tsx +6 -0
- package/src/aldehyde/routable/ltmpl-route.tsx +5 -2
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +1 -1
- package/src/aldehyde/table/act-table.tsx +110 -36
- package/src/aldehyde/table/column/column-builder.tsx +76 -28
- package/src/aldehyde/table/index.css +16 -2
- package/src/aldehyde/table/select-table.tsx +46 -10
- package/src/aldehyde/tmpl/interface.tsx +9 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Button, Card, Checkbox, Col, Divider, Popover, Row, Space, Drawer, Tooltip,
|
|
4
|
-
message, Layout, Table, Form as AntdForm, FormInstance
|
|
4
|
+
message, Layout, Table, Form as AntdForm, FormInstance, Modal, Input, Alert, Tabs
|
|
5
5
|
} from "antd";
|
|
6
6
|
import {
|
|
7
7
|
ExportOutlined, FundOutlined, LineChartOutlined,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "../tmpl/interface";
|
|
17
17
|
|
|
18
18
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
19
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
19
20
|
import QueryTable from "./query-table";
|
|
20
21
|
import CriteriaForm from "./../form/criteria-form";
|
|
21
22
|
import ProgramConfig from "../units";
|
|
@@ -64,6 +65,7 @@ interface ActTableProps extends TmplBaseProps {
|
|
|
64
65
|
tableType?: "common" | "report" | "select";
|
|
65
66
|
operatable?: boolean;
|
|
66
67
|
onSelectChange?: (val: { selectedRows: SelectedRow[], selectedDatas: DtmplData[] }) => void;
|
|
68
|
+
defShowType?: ActTableViewModel; // 默认视图
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
interface ActTableStat {
|
|
@@ -91,6 +93,9 @@ interface ActTableStat {
|
|
|
91
93
|
ltreeData?: object;
|
|
92
94
|
userCriteriaData: object;
|
|
93
95
|
editings: string[]; // 行内编辑code
|
|
96
|
+
delModalOpen?: boolean; // 强删除弹窗是否打开
|
|
97
|
+
tabsOptions?: { key: string, label: React.ReactNode, id?: string, ids?: string[] }[]; // tabs选项
|
|
98
|
+
tabActiveKey?: string; // Tabs选中项
|
|
94
99
|
}
|
|
95
100
|
let serial_number = new Date().getTime();
|
|
96
101
|
let busyReminderTime = 0;
|
|
@@ -122,6 +127,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
122
127
|
ltreeData: {},
|
|
123
128
|
userCriteriaData: undefined,
|
|
124
129
|
editings: [], // 行内编辑code
|
|
130
|
+
delModalOpen: false, // 强删除弹窗是否打开
|
|
131
|
+
tabsOptions: [],
|
|
132
|
+
tabActiveKey: "all",
|
|
125
133
|
};
|
|
126
134
|
|
|
127
135
|
static contextType = LocaleContext;
|
|
@@ -137,7 +145,37 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
137
145
|
operatable: true,
|
|
138
146
|
};
|
|
139
147
|
|
|
140
|
-
|
|
148
|
+
// 获取标签选项
|
|
149
|
+
getTabsOptions = () => {
|
|
150
|
+
const { ltmplConfig, criteriaData } = this.props;
|
|
151
|
+
const { translate } = this.context;
|
|
152
|
+
if (!ltmplConfig?.split2TabCriterias) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const allIds = [];
|
|
156
|
+
const options = ltmplConfig.split2TabCriterias.map(fieldConfig => {
|
|
157
|
+
const id = `c_${fieldConfig.id}`;
|
|
158
|
+
allIds.push(id);
|
|
159
|
+
const items = HCDataSource.getEnums(fieldConfig.mstrucId);
|
|
160
|
+
const options = items.map((item) => ({
|
|
161
|
+
label: <span style={{ padding: "0 10px" }}>{translate("${" + item.title + "}")}</span>,
|
|
162
|
+
key: item.value,
|
|
163
|
+
id
|
|
164
|
+
}));
|
|
165
|
+
if (fieldConfig.relDeduplication && fieldConfig.exceptCodes?.length) {
|
|
166
|
+
return options.filter(item => !fieldConfig.exceptCodes.includes(item.key));
|
|
167
|
+
}
|
|
168
|
+
return options;
|
|
169
|
+
})?.flat() || [];
|
|
170
|
+
const defOption = {
|
|
171
|
+
label: <span style={{ padding: "0 10px" }}>{translate("${全部}")}</span>,
|
|
172
|
+
key: "all",
|
|
173
|
+
ids: allIds
|
|
174
|
+
};
|
|
175
|
+
const temId = Object.keys(criteriaData).find(r => allIds.includes(r));
|
|
176
|
+
const tabActiveKey = temId ? criteriaData[temId] : "all";
|
|
177
|
+
this.setState({ tabsOptions: [defOption, ...options], tabActiveKey });
|
|
178
|
+
}
|
|
141
179
|
|
|
142
180
|
loadData = async (
|
|
143
181
|
hiddenColIds: string[],
|
|
@@ -146,7 +184,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
146
184
|
) => {
|
|
147
185
|
const {
|
|
148
186
|
sourceId, criteriaData, ltmplConfig,
|
|
149
|
-
mainCode, level, pageNo, pageSize, serverKey,
|
|
187
|
+
mainCode, level, pageNo, pageSize, serverKey, defShowType
|
|
150
188
|
} = this.props;
|
|
151
189
|
|
|
152
190
|
if (!this.isSameSourceQuery(sourceId, criteriaData)) {
|
|
@@ -200,7 +238,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
200
238
|
pageSize: pageSize ? pageSize : defaultPageSize ? defaultPageSize : 10,
|
|
201
239
|
virtualEndPageNo: undefined,
|
|
202
240
|
};
|
|
203
|
-
const viewModels = this.state.viewModels.length > 0 ? this.state.viewModels : [showType || "table"];
|
|
241
|
+
const viewModels = this.state.viewModels.length > 0 ? this.state.viewModels : [defShowType || showType || "table"];
|
|
204
242
|
|
|
205
243
|
/** 构建 dataSource **/
|
|
206
244
|
//构建过滤条件
|
|
@@ -342,7 +380,6 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
342
380
|
this.setState({ customButton: undefined });
|
|
343
381
|
}}
|
|
344
382
|
>
|
|
345
|
-
{" "}
|
|
346
383
|
{translate("${关闭}")}
|
|
347
384
|
</Button>
|
|
348
385
|
}
|
|
@@ -398,6 +435,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
398
435
|
...ltmplConfig.columns,
|
|
399
436
|
];
|
|
400
437
|
}
|
|
438
|
+
this.getTabsOptions();
|
|
401
439
|
this.loadData(defaultDisabledColIds, [], sortedColConfigs);
|
|
402
440
|
}
|
|
403
441
|
|
|
@@ -586,10 +624,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
586
624
|
//重新加载数据
|
|
587
625
|
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
|
|
588
626
|
doDelete && doDelete(code);
|
|
627
|
+
this.setState({ loading: false, delModalOpen: false, recordCode: undefined });
|
|
589
628
|
} else {
|
|
590
|
-
this.setState({
|
|
591
|
-
loading: false,
|
|
592
|
-
});
|
|
629
|
+
this.setState({ loading: false });
|
|
593
630
|
}
|
|
594
631
|
};
|
|
595
632
|
|
|
@@ -1247,11 +1284,30 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1247
1284
|
}
|
|
1248
1285
|
// 行内编辑end
|
|
1249
1286
|
|
|
1287
|
+
// 删除确认弹窗打开
|
|
1288
|
+
doDelModalOpen = (code: string) => {
|
|
1289
|
+
this.setState({ recordCode: code, delModalOpen: true });
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
// tab页切换查询
|
|
1293
|
+
doTabSearch = (val: string) => {
|
|
1294
|
+
const { tabsOptions, tabActiveKey } = this.state;
|
|
1295
|
+
let new_serial_number = new Date().getTime();
|
|
1296
|
+
if (new_serial_number - serial_number < 2000) return;
|
|
1297
|
+
if (tabActiveKey === val) return;
|
|
1298
|
+
const item = tabsOptions.find(r => r.key === val);
|
|
1299
|
+
let params = { [item.id]: val };
|
|
1300
|
+
if (val === "all") {
|
|
1301
|
+
params = item.ids?.reduce((total, cur) => { total[cur] = undefined; return total; }, {});
|
|
1302
|
+
}
|
|
1303
|
+
this.actTableDoSearch(params);
|
|
1304
|
+
this.setState({ tabActiveKey: val });
|
|
1305
|
+
}
|
|
1250
1306
|
|
|
1251
1307
|
renderContent = () => {
|
|
1252
1308
|
let {
|
|
1253
1309
|
queryKey, loading, selectedRows, hiddenRowCodes, viewModels, sortedColConfigs, hiddenColIds, showL2ActTable,
|
|
1254
|
-
pageInfo, editings
|
|
1310
|
+
pageInfo, editings, userCriteriaData, tabsOptions, tabActiveKey
|
|
1255
1311
|
} = this.state;
|
|
1256
1312
|
let {
|
|
1257
1313
|
mainCode, sourceId, ltmplConfig, funcMode, operatable,
|
|
@@ -1281,7 +1337,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1281
1337
|
onHide: this.onHide, doCustomButton: this.doCustomButton, doRowJump: this.doRowJump,
|
|
1282
1338
|
blockMenuTreeDrawerOpen: this.blockMenuTreeDrawerOpen,
|
|
1283
1339
|
doRowAction: this.doRowAction, doDeleteByCode: this.doDeleteByCode, sortColumns: criteriaData["sortColIds"],
|
|
1284
|
-
editings, editRowEdit: this.editRowEdit, cancelRowEdit: this.cancelRowEdit, saveRowData: this.saveRowData
|
|
1340
|
+
editings, editRowEdit: this.editRowEdit, cancelRowEdit: this.cancelRowEdit, saveRowData: this.saveRowData,
|
|
1341
|
+
doDelModalOpen: this.doDelModalOpen, mainCode, criteriaData: userCriteriaData, actTableDoSearch: this.actTableDoSearch
|
|
1285
1342
|
}
|
|
1286
1343
|
);
|
|
1287
1344
|
|
|
@@ -1381,21 +1438,18 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1381
1438
|
dangerouslySetInnerHTML={{ __html: ltmplConfig.header }}
|
|
1382
1439
|
></div>
|
|
1383
1440
|
) : null}
|
|
1384
|
-
|
|
1385
|
-
<
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
{/*</Space>*/}
|
|
1397
|
-
<p className="fr" style={{ marginBottom: "4px" }}>{this.renderHeaderButtons()}</p>
|
|
1398
|
-
</h3>
|
|
1441
|
+
{tabsOptions.length ?
|
|
1442
|
+
<Tabs tabBarGutter={12} size="small" activeKey={tabActiveKey} items={tabsOptions} onChange={this.doTabSearch} tabBarExtraContent={this.renderHeaderButtons()} /> :
|
|
1443
|
+
<>
|
|
1444
|
+
<h3 >
|
|
1445
|
+
<p className="act-table-title" style={{ position: "relative", float: "left", marginBottom: "4px" }}> {!title
|
|
1446
|
+
? translate("${" + ltmplConfig.title + "}")
|
|
1447
|
+
: typeof title == "string"
|
|
1448
|
+
? translate("${" + title + "}")
|
|
1449
|
+
: title}</p>
|
|
1450
|
+
</h3>
|
|
1451
|
+
<p className="fr" style={{ marginBottom: "4px" }}>{this.renderHeaderButtons()}</p>
|
|
1452
|
+
</>}
|
|
1399
1453
|
</span>
|
|
1400
1454
|
)
|
|
1401
1455
|
) : null}
|
|
@@ -1458,13 +1512,12 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1458
1512
|
};
|
|
1459
1513
|
|
|
1460
1514
|
render() {
|
|
1461
|
-
let {
|
|
1462
|
-
|
|
1463
|
-
} =
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
} = this.props;
|
|
1515
|
+
let { queryKey, loading, blockMenuTreeDrawerOpen, recordCode, showRatmplSelector, delModalOpen } = this.state;
|
|
1516
|
+
let { sourceId, ltmplConfig, title, collapsible, initCollapse, tip, serverKey, mainCode } = this.props;
|
|
1517
|
+
const { strongDeleteConfirmText } = ltmplConfig || {};
|
|
1518
|
+
const { translate } = this.context;
|
|
1519
|
+
const delFormRef = React.createRef<FormInstance>(); // 强删除表单的form Ref
|
|
1520
|
+
|
|
1468
1521
|
if (!ltmplConfig || !sourceId) {
|
|
1469
1522
|
return (
|
|
1470
1523
|
<>
|
|
@@ -1528,10 +1581,31 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1528
1581
|
mainCode={mainCode}
|
|
1529
1582
|
sourceId={sourceId}
|
|
1530
1583
|
existRelation={"false"}
|
|
1531
|
-
|
|
1532
|
-
) :
|
|
1533
|
-
|
|
1534
|
-
|
|
1584
|
+
/>
|
|
1585
|
+
) : ""}
|
|
1586
|
+
{delModalOpen ?
|
|
1587
|
+
<Modal
|
|
1588
|
+
open={delModalOpen}
|
|
1589
|
+
title={translate("${确定要[删除]此数据吗}?")}
|
|
1590
|
+
onOk={() => delFormRef.current.validateFields().then(() => this.doDeleteByCode(recordCode)).catch(() => { })}
|
|
1591
|
+
onCancel={() => this.setState({ recordCode: undefined, delModalOpen: false })}
|
|
1592
|
+
>
|
|
1593
|
+
<AntdForm ref={delFormRef} layout="vertical">
|
|
1594
|
+
<AntdForm.Item noStyle >
|
|
1595
|
+
<Alert message={translate("${风险操作,此操作不可逆,是否继续操作}?")} type="warning" showIcon style={{ margin: "12px 0" }} />
|
|
1596
|
+
</AntdForm.Item>
|
|
1597
|
+
<AntdForm.Item
|
|
1598
|
+
label={<div>{translate("${请手动输入}")}<span style={{ color: "#ff4d4f" }}> “ {translate("${" + strongDeleteConfirmText + "}")} ” </span>{translate("${完成验证}")}</div>}
|
|
1599
|
+
name="rule"
|
|
1600
|
+
rules={[
|
|
1601
|
+
{ required: true, message: translate("${请输入" + strongDeleteConfirmText + "}") },
|
|
1602
|
+
{ validator: (_, value) => value && value !== translate("${" + strongDeleteConfirmText + "}") ? Promise.reject(new Error(translate("${请输入" + strongDeleteConfirmText + "}"))) : Promise.resolve() }
|
|
1603
|
+
]}
|
|
1604
|
+
>
|
|
1605
|
+
<Input placeholder={translate("${" + strongDeleteConfirmText + "}")} />
|
|
1606
|
+
</AntdForm.Item>
|
|
1607
|
+
</AntdForm>
|
|
1608
|
+
</Modal> : ""}
|
|
1535
1609
|
</>
|
|
1536
1610
|
);
|
|
1537
1611
|
}
|
|
@@ -24,6 +24,7 @@ import { ViewControl } from "../../index";
|
|
|
24
24
|
import NewinFileView from "../../controls/file-view/newin-file-view";
|
|
25
25
|
import { EntryControl } from "../../index";
|
|
26
26
|
import TmplConfigAnalysis from "../../tmpl/tmpl-config-analysis";
|
|
27
|
+
import Icon from "../../icon/aliIcon";
|
|
27
28
|
import "./index.less";
|
|
28
29
|
|
|
29
30
|
const FormItem = AntdForm.Item;
|
|
@@ -50,7 +51,10 @@ interface ColumnBuilderProps extends ActionRenderProps {
|
|
|
50
51
|
sortedColConfigs?: ColumnConfig[],
|
|
51
52
|
unHiden?: () => any,
|
|
52
53
|
onHide?: (code: string) => any,
|
|
53
|
-
operatable?: boolean
|
|
54
|
+
operatable?: boolean,
|
|
55
|
+
mainCode?: string,
|
|
56
|
+
criteriaData?: object,
|
|
57
|
+
actTableDoSearch?: (data: object) => void
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
interface ReportColumnBuilderProps {
|
|
@@ -74,7 +78,7 @@ export default {
|
|
|
74
78
|
sortedColConfigs, unHiden,
|
|
75
79
|
onHide, translate,
|
|
76
80
|
sortColumns, serverKey,
|
|
77
|
-
editings
|
|
81
|
+
editings, mainCode, criteriaData, actTableDoSearch
|
|
78
82
|
} = props;
|
|
79
83
|
|
|
80
84
|
const { primaryColumn, primaryColumnLabel } = ltmplConfig
|
|
@@ -196,6 +200,35 @@ export default {
|
|
|
196
200
|
);
|
|
197
201
|
};
|
|
198
202
|
}
|
|
203
|
+
// 表头列搜索
|
|
204
|
+
if (item.appendCriteria) {
|
|
205
|
+
const criteria = item.appendCriteria;
|
|
206
|
+
let searchVal = criteriaData?.[`c_${criteria.id}`];
|
|
207
|
+
column["filterDropdown"] = ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (<div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}>
|
|
208
|
+
<EntryControl
|
|
209
|
+
serverKey={serverKey}
|
|
210
|
+
mainCode={mainCode}
|
|
211
|
+
value={searchVal}
|
|
212
|
+
fieldConfig={criteria}
|
|
213
|
+
onChange={(val) => {
|
|
214
|
+
const value = val?.target ? val.target.value : val;
|
|
215
|
+
setSelectedKeys(value ? [value] : []);
|
|
216
|
+
searchVal = value;
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", paddingTop: 8 }}>
|
|
220
|
+
<Button type="text" size="small" onClick={() => {
|
|
221
|
+
clearFilters();
|
|
222
|
+
searchVal = undefined;
|
|
223
|
+
}}>{translate("${重置}")}</Button>
|
|
224
|
+
<Button onClick={() => {
|
|
225
|
+
actTableDoSearch({ [`c_${criteria.id}`]: selectedKeys[0] });
|
|
226
|
+
confirm();
|
|
227
|
+
}} type="primary" size="small">{translate("${确定}")}</Button>
|
|
228
|
+
</div>
|
|
229
|
+
</div>);
|
|
230
|
+
column["filteredValue"] = searchVal || undefined;
|
|
231
|
+
}
|
|
199
232
|
});
|
|
200
233
|
return tableColumns;
|
|
201
234
|
},
|
|
@@ -366,8 +399,8 @@ export default {
|
|
|
366
399
|
serverKey,
|
|
367
400
|
readOnly,
|
|
368
401
|
sourceId, translate, doCustomButton, doRowJump, blockMenuTreeDrawerOpen,
|
|
369
|
-
doRowAction, doDeleteByCode, editRowEdit, editings, cancelRowEdit, saveRowData } = props;
|
|
370
|
-
const { buttons, builtInButtons, defShowRowActionCount } = ltmplConfig;
|
|
402
|
+
doRowAction, doDeleteByCode, editRowEdit, editings, cancelRowEdit, saveRowData, doDelModalOpen } = props;
|
|
403
|
+
const { buttons, builtInButtons, defShowRowActionCount, strongDeleteConfirmText } = ltmplConfig;
|
|
371
404
|
|
|
372
405
|
let actionButtons: any[] = [];
|
|
373
406
|
|
|
@@ -499,7 +532,11 @@ export default {
|
|
|
499
532
|
doCustomButton(customButton, [record])
|
|
500
533
|
}
|
|
501
534
|
>
|
|
502
|
-
{
|
|
535
|
+
{customButton.icon ?
|
|
536
|
+
<Tooltip placement="top" title={translate("${" + customButton.title + "}")}>
|
|
537
|
+
<Icon type={customButton.icon}></Icon>
|
|
538
|
+
</Tooltip>
|
|
539
|
+
: translate("${" + customButton.title + "}")}
|
|
503
540
|
</Button>
|
|
504
541
|
)
|
|
505
542
|
};
|
|
@@ -507,21 +544,26 @@ export default {
|
|
|
507
544
|
}
|
|
508
545
|
if (ltmplConfig.ractions && !readOnly) {
|
|
509
546
|
ltmplConfig.ractions.map((raction) => {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
547
|
+
if (ActionUtils.isShow(
|
|
548
|
+
raction?.preposes,
|
|
549
|
+
[record],
|
|
550
|
+
undefined
|
|
551
|
+
)) {
|
|
552
|
+
actionButtons.push(
|
|
516
553
|
<Button
|
|
517
554
|
key={raction.id}
|
|
518
555
|
size="small"
|
|
519
556
|
type="dashed"
|
|
520
557
|
onClick={() => doRAction(raction.id, record.code)}
|
|
521
558
|
>
|
|
522
|
-
{
|
|
523
|
-
|
|
524
|
-
|
|
559
|
+
{raction.icon ?
|
|
560
|
+
<Tooltip placement="top" title={translate("${" + raction.title + "}")}>
|
|
561
|
+
<Icon type={raction.icon}></Icon>
|
|
562
|
+
</Tooltip>
|
|
563
|
+
: translate("${" + raction.title + "}")}
|
|
564
|
+
</Button>
|
|
565
|
+
);
|
|
566
|
+
}
|
|
525
567
|
})
|
|
526
568
|
}
|
|
527
569
|
|
|
@@ -560,7 +602,11 @@ export default {
|
|
|
560
602
|
type="dashed"
|
|
561
603
|
onClick={() => doRowJump(jump, record)}
|
|
562
604
|
>
|
|
563
|
-
{
|
|
605
|
+
{jump.icon ?
|
|
606
|
+
<Tooltip placement="top" title={translate("${" + jump.title + "}")}>
|
|
607
|
+
<Icon type={jump.icon}></Icon>
|
|
608
|
+
</Tooltip>
|
|
609
|
+
: translate("${" + jump.title + "}")}
|
|
564
610
|
</Button>
|
|
565
611
|
)
|
|
566
612
|
};
|
|
@@ -624,20 +670,22 @@ export default {
|
|
|
624
670
|
undefined
|
|
625
671
|
)) {
|
|
626
672
|
actionButtons.push(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
title={translate("${确定要[删除]此数据吗}?")}
|
|
630
|
-
onConfirm={() => {
|
|
631
|
-
doDeleteByCode(record.code);
|
|
632
|
-
}}
|
|
633
|
-
okText={translate("${确定}")}
|
|
634
|
-
cancelText={translate("${取消}")}
|
|
635
|
-
okType={"danger"}
|
|
636
|
-
>
|
|
637
|
-
<Button size="small" type="dashed" danger>
|
|
673
|
+
strongDeleteConfirmText ?
|
|
674
|
+
<Button size="small" type="dashed" danger onClick={() => doDelModalOpen(record.code)}>
|
|
638
675
|
<DeleteOutlined />
|
|
639
|
-
</Button>
|
|
640
|
-
|
|
676
|
+
</Button> :
|
|
677
|
+
<Popconfirm
|
|
678
|
+
placement="rightBottom"
|
|
679
|
+
title={translate("${确定要[删除]此数据吗}?")}
|
|
680
|
+
onConfirm={() => doDeleteByCode(record.code)}
|
|
681
|
+
okText={translate("${确定}")}
|
|
682
|
+
cancelText={translate("${取消}")}
|
|
683
|
+
okType={"danger"}
|
|
684
|
+
>
|
|
685
|
+
<Button size="small" type="dashed" danger>
|
|
686
|
+
<DeleteOutlined />
|
|
687
|
+
</Button>
|
|
688
|
+
</Popconfirm>
|
|
641
689
|
)
|
|
642
690
|
}
|
|
643
691
|
let showButtons = [];
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
.editTableList .ant-upload-list-picture .ant-upload-list-item {
|
|
2
2
|
width: 110px;
|
|
3
3
|
}
|
|
4
|
+
|
|
4
5
|
.SearchForm {
|
|
5
6
|
padding: 8px;
|
|
6
7
|
background: #fff;
|
|
7
8
|
box-shadow: 0 0 5px rgb(187, 182, 182);
|
|
8
9
|
border-radius: 3px;
|
|
9
10
|
}
|
|
11
|
+
|
|
10
12
|
.actTable button {
|
|
11
13
|
margin-right: 5px;
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
.actTable a {
|
|
14
17
|
margin-right: 5px;
|
|
15
18
|
}
|
|
19
|
+
|
|
16
20
|
.actTable h3 {
|
|
17
21
|
font-size: 18px;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
.ant-table .ant-table-selection-column {
|
|
21
25
|
/*position: relative;*/
|
|
22
|
-
z-index: 3;
|
|
26
|
+
z-index: 3;
|
|
27
|
+
/* 或者更高的值 */
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
.react-resizable {
|
|
@@ -86,6 +91,15 @@
|
|
|
86
91
|
background-color: var(--color-3) !important;
|
|
87
92
|
}
|
|
88
93
|
|
|
89
|
-
.sortable-item-hover:hover
|
|
94
|
+
.sortable-item-hover:hover>td {
|
|
90
95
|
background-color: var(--ant-table-row-hover-bg);
|
|
91
96
|
}
|
|
97
|
+
|
|
98
|
+
.actTable .ant-tabs-nav {
|
|
99
|
+
margin-bottom: 8px;
|
|
100
|
+
align-items: end;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.actTable .ant-tabs-nav::before {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
@@ -3,8 +3,9 @@ import { Space, Button, Popconfirm } from "antd";
|
|
|
3
3
|
import { DeleteOutlined, EditOutlined, AlignCenterOutlined } from "@ant-design/icons";
|
|
4
4
|
import debounce from "lodash/debounce";
|
|
5
5
|
import "./index.css";
|
|
6
|
-
import { DtmplData, QueryKey, SelectConfig, SelectedRow, ControlBaseProps, LtmplConfig, ActTableMode } from "../tmpl/interface";
|
|
6
|
+
import { DtmplData, QueryKey, SelectConfig, SelectedRow, ControlBaseProps, LtmplConfig, ActTableMode, RouterCompProps } from "../tmpl/interface";
|
|
7
7
|
import TableUnits from "./table-util";
|
|
8
|
+
import Units from "../units";
|
|
8
9
|
import SupportInputTypes from '../tmpl/control-type-supportor';
|
|
9
10
|
import HCDataSource from '../tmpl/hc-data-source';
|
|
10
11
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
@@ -15,8 +16,12 @@ import { LocaleContext } from "../locale/LocaleProvider";
|
|
|
15
16
|
import DtmplViewDrawer from "../module/dtmpl-view-drawer";
|
|
16
17
|
import DtmplEditPage from "../module/dtmpl-edit-page";
|
|
17
18
|
import DtmplCustomEditModalPage from "../custom-page/dtmpl-custom-edit-modal-page";
|
|
19
|
+
import withRouter from "../routable/withroute";
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
// 弹窗selectTable类型,查询参数不缓存
|
|
22
|
+
const popoverTableTypes = ["table-entity-select", "relation-existion"];
|
|
23
|
+
|
|
24
|
+
interface SelectTableProps extends ControlBaseProps, RouterCompProps {
|
|
20
25
|
mainCode?: string,
|
|
21
26
|
maxSelectedRows?: number,
|
|
22
27
|
serverKey?: string,
|
|
@@ -69,31 +74,42 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
69
74
|
ltmplConfig: undefined,
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
loadData = async (selectConfig: SelectConfig, criteriaData:
|
|
77
|
+
loadData = async (selectConfig: SelectConfig, criteriaData: { [key: string]: any }, npageNo?: number) => {
|
|
73
78
|
this.setState({ loading: true });
|
|
74
79
|
const { mainCode, serverKey, sourceId, fieldConfig } = this.props;
|
|
75
80
|
const baseCriteria = fieldConfig.baseCriteria || {};
|
|
76
81
|
const { pageNo, pageSize } = this.state;
|
|
77
82
|
const { defaultPageSize } = selectConfig;
|
|
78
|
-
const pno = npageNo ? npageNo : pageNo;
|
|
79
83
|
let pageInfo = {
|
|
80
|
-
pageNo:
|
|
81
|
-
pageSize: pageSize
|
|
84
|
+
pageNo: npageNo || criteriaData?.pageNo || pageNo,
|
|
85
|
+
pageSize: criteriaData?.pageSize || pageSize || defaultPageSize || 10,
|
|
82
86
|
virtualEndPageNo: undefined,
|
|
83
87
|
}
|
|
84
88
|
/** 构建 dataSource **/
|
|
85
89
|
//构建过滤条件
|
|
86
90
|
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(serverKey, sourceId, { ...criteriaData, ...baseCriteria, ...pageInfo, mainCode });
|
|
87
91
|
this.setState({
|
|
88
|
-
pageNo:
|
|
92
|
+
pageNo: pageInfo.pageNo,
|
|
89
93
|
queryKey,
|
|
90
94
|
criteriaData,
|
|
91
95
|
loading: false,
|
|
92
96
|
});
|
|
93
97
|
}
|
|
94
98
|
|
|
99
|
+
// 判断是否为弹出表格
|
|
100
|
+
getIsPopoverTable = () => {
|
|
101
|
+
const { fieldConfig } = this.props;
|
|
102
|
+
return !popoverTableTypes.includes(fieldConfig.controlType || fieldConfig.extControlType)
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
async componentDidMount() {
|
|
96
|
-
|
|
106
|
+
const { location } = this.props;
|
|
107
|
+
let criteriaData = {};
|
|
108
|
+
const ltmplConfig = await this.loadConfig();
|
|
109
|
+
if (this.getIsPopoverTable()) {
|
|
110
|
+
criteriaData = Units.transQueryStrToParams(location.search, ltmplConfig);
|
|
111
|
+
}
|
|
112
|
+
await this.loadData(ltmplConfig, criteriaData || {});
|
|
97
113
|
}
|
|
98
114
|
|
|
99
115
|
loadConfig = async () => {
|
|
@@ -190,9 +206,22 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
190
206
|
}
|
|
191
207
|
}
|
|
192
208
|
|
|
209
|
+
getMenuId = () => {
|
|
210
|
+
const { searchParams } = this.props;
|
|
211
|
+
let menuId = searchParams.get("menuId");
|
|
212
|
+
return menuId;
|
|
213
|
+
};
|
|
214
|
+
|
|
193
215
|
doSearch = async (params_) => {
|
|
216
|
+
const { location } = this.props;
|
|
194
217
|
const { selectConfig, criteriaData } = this.state;
|
|
195
|
-
let params = { ...criteriaData, ...params_ }
|
|
218
|
+
let params = { ...criteriaData, ...params_, pageNo: 1, };
|
|
219
|
+
if (this.getIsPopoverTable()) {
|
|
220
|
+
// 自定义页面中使用组件选择表格,查询条件缓存在url中
|
|
221
|
+
const menuId = this.getMenuId();
|
|
222
|
+
const newfliter = Units.transQueryParamsToStr({ ...params, menuId, sourceId: menuId });
|
|
223
|
+
this.props.navigate(`${location.pathname}?${newfliter}`, { replace: true });
|
|
224
|
+
}
|
|
196
225
|
await this.loadData(selectConfig, params, 1);
|
|
197
226
|
}
|
|
198
227
|
|
|
@@ -267,6 +296,13 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
267
296
|
}
|
|
268
297
|
|
|
269
298
|
onChangePage = (pageNo, pageSize) => {
|
|
299
|
+
const { location } = this.props;
|
|
300
|
+
const { criteriaData } = this.state;
|
|
301
|
+
if (this.getIsPopoverTable()) {
|
|
302
|
+
const menuId = this.getMenuId();
|
|
303
|
+
const newfliter = Units.transQueryParamsToStr({ ...criteriaData, pageNo, pageSize, menuId, sourceId: menuId });
|
|
304
|
+
this.props.navigate(`${location.pathname}?${newfliter}`, { replace: true });
|
|
305
|
+
}
|
|
270
306
|
this.setState({ pageNo, pageSize });
|
|
271
307
|
}
|
|
272
308
|
|
|
@@ -447,4 +483,4 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
447
483
|
}
|
|
448
484
|
}
|
|
449
485
|
|
|
450
|
-
export default SelectTable;
|
|
486
|
+
export default withRouter(SelectTable);
|
|
@@ -108,6 +108,7 @@ export interface TmplBase {
|
|
|
108
108
|
id?: string;
|
|
109
109
|
title?: string;
|
|
110
110
|
tip?: string;
|
|
111
|
+
icon?: string;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export interface OrderableTmplBase extends TmplBase {
|
|
@@ -220,6 +221,7 @@ export interface JumpConfig extends OrderableTmplBase {
|
|
|
220
221
|
searchParams: FieldConfig[];
|
|
221
222
|
routeParams: FieldConfig[];
|
|
222
223
|
preposes: FieldConfig[];
|
|
224
|
+
icon?: string;
|
|
223
225
|
}
|
|
224
226
|
export interface ClassAddConfig extends OrderableTmplBase { }
|
|
225
227
|
export interface ClassEditConfig extends OrderableTmplBase {
|
|
@@ -446,6 +448,8 @@ export interface FieldConfig extends FieldBase {
|
|
|
446
448
|
relDeduplication?: boolean;
|
|
447
449
|
preview?: boolean; // 图片组件预览配置
|
|
448
450
|
dateControlShortcutKeys?: string[]; // 时间范围预设配置
|
|
451
|
+
placeholder?: string; // 占位符
|
|
452
|
+
appendCriteria?: CriteriaConfig; // 列查询条件配置
|
|
449
453
|
}
|
|
450
454
|
|
|
451
455
|
export interface ActionRenderProps {
|
|
@@ -467,6 +471,7 @@ export interface ActionRenderProps {
|
|
|
467
471
|
cancelRowEdit?: (code: string) => void,
|
|
468
472
|
saveRowData?: (data: DtmplData) => void,
|
|
469
473
|
editings?: string[],
|
|
474
|
+
doDelModalOpen?: (code: string) => any,
|
|
470
475
|
}
|
|
471
476
|
|
|
472
477
|
export interface FileRule {
|
|
@@ -482,6 +487,8 @@ export interface SelectConfig extends TmplBase {
|
|
|
482
487
|
defShowRowActionCount: number;
|
|
483
488
|
columns: ColumnConfig[];
|
|
484
489
|
criterias: CriteriaConfig[];
|
|
490
|
+
commonCriterias: CriteriaConfig[];
|
|
491
|
+
split2TabCriterias: CriteriaConfig[];
|
|
485
492
|
defaultCriteriaValue?: object;
|
|
486
493
|
primaryColumn?: ColumnConfig;
|
|
487
494
|
groupIColumns?: ColumnConfig[];
|
|
@@ -614,6 +621,7 @@ export interface LtmplConfig extends SelectConfig {
|
|
|
614
621
|
calendarDateColumnConfig?: ColumnConfig;
|
|
615
622
|
calendarShowType?: "month" | "year";
|
|
616
623
|
calendarDateSelectorUsable?: boolean;
|
|
624
|
+
strongDeleteConfirmText?: string; // 强确认删除文本
|
|
617
625
|
}
|
|
618
626
|
|
|
619
627
|
export interface EnumItem {
|
|
@@ -828,7 +836,7 @@ export interface BlockType {
|
|
|
828
836
|
hiddenOnDisabled?: boolean; // 是否隐藏
|
|
829
837
|
customPath?: string; // 自定义页面路径
|
|
830
838
|
dragDropPageId?: string;
|
|
831
|
-
pageType?: "列表" | "详情" | "编辑" | "添加" | "编辑或添加" | "树" | "导入" | "报表" | "分屏-列表" | "分屏-报表"; // 页面类型
|
|
839
|
+
pageType?: "列表" | "详情" | "编辑" | "添加" | "编辑或添加" | "树" | "导入" | "报表" | "分屏-列表" | "分屏-报表" | "甘特图" | "日历"; // 页面类型
|
|
832
840
|
defaultCriteriaValue?: { [key: string]: string }; // 一些组件参数
|
|
833
841
|
linkTarget?: HTMLAttributeAnchorTarget; // 页面跳转方式
|
|
834
842
|
items?: BlockType[];
|