aldehyde 0.2.179 → 0.2.181
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/utils.d.ts +2 -0
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +39 -5
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +8 -4
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +1 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +28 -7
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/query-table.d.ts +3 -0
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +31 -1
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/table-util.d.ts.map +1 -1
- package/lib/table/table-util.js +18 -20
- package/lib/table/table-util.js.map +1 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +11 -5
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/utils.tsx +42 -8
- package/src/aldehyde/routable/ltmpl-route.tsx +20 -6
- package/src/aldehyde/table/act-table.tsx +79 -35
- package/src/aldehyde/table/query-table.tsx +38 -0
- package/src/aldehyde/table/table-util.tsx +21 -21
- package/src/aldehyde/units/index.tsx +10 -6
|
@@ -19,6 +19,8 @@ import Table from "./control-table-x-axis-wrapper";
|
|
|
19
19
|
import {
|
|
20
20
|
AlignCenterOutlined,
|
|
21
21
|
AlignLeftOutlined,
|
|
22
|
+
CaretDownOutlined,
|
|
23
|
+
CaretUpOutlined,
|
|
22
24
|
CopyOutlined,
|
|
23
25
|
DeleteOutlined,
|
|
24
26
|
DownloadOutlined,
|
|
@@ -134,7 +136,7 @@ interface ActTableStat {
|
|
|
134
136
|
showCustomCard?: boolean;
|
|
135
137
|
customButton?: CustomButton;
|
|
136
138
|
customButtonData?: DtmplData[];
|
|
137
|
-
showRatmplSelector?:boolean;
|
|
139
|
+
showRatmplSelector?: boolean;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
@@ -158,7 +160,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
158
160
|
showCustomCard: false,
|
|
159
161
|
customButtonData: undefined,
|
|
160
162
|
customButton: undefined,
|
|
161
|
-
showRatmplSelector:false,
|
|
163
|
+
showRatmplSelector: false,
|
|
162
164
|
};
|
|
163
165
|
|
|
164
166
|
static contextType = LocaleContext;
|
|
@@ -422,7 +424,10 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
422
424
|
let itemType = SupportInputTypes.getSupportControlType(item);
|
|
423
425
|
if (s < 12 && item.title != "操作" && item.title != "序号") {
|
|
424
426
|
if (hiddenColIds.includes("10000")) {
|
|
425
|
-
TableUnits.sort(column, itemType);
|
|
427
|
+
// TableUnits.sort(column, itemType, "descend");
|
|
428
|
+
const order = this.handleColumnOrder(column["dataIndex"]);
|
|
429
|
+
|
|
430
|
+
TableUnits.sort(column, itemType, order);
|
|
426
431
|
}
|
|
427
432
|
}
|
|
428
433
|
//特殊列处理
|
|
@@ -745,7 +750,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
745
750
|
}
|
|
746
751
|
});
|
|
747
752
|
|
|
748
|
-
console.log(tableColumns);
|
|
753
|
+
console.log("columns", tableColumns);
|
|
749
754
|
|
|
750
755
|
return tableColumns;
|
|
751
756
|
};
|
|
@@ -892,7 +897,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
892
897
|
};
|
|
893
898
|
|
|
894
899
|
doDelete = async () => {
|
|
895
|
-
const { sourceId, serverKey,mainCode } = this.props;
|
|
900
|
+
const { sourceId, serverKey, mainCode } = this.props;
|
|
896
901
|
const {
|
|
897
902
|
selectedRows,
|
|
898
903
|
hiddenColIds,
|
|
@@ -905,7 +910,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
905
910
|
let result: boolean = await HcserviceV3.deleteData(
|
|
906
911
|
serverKey,
|
|
907
912
|
sourceId,
|
|
908
|
-
selectedRows,
|
|
913
|
+
selectedRows,
|
|
914
|
+
mainCode
|
|
909
915
|
);
|
|
910
916
|
if (result) {
|
|
911
917
|
//重新加载数据
|
|
@@ -918,13 +924,17 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
918
924
|
};
|
|
919
925
|
|
|
920
926
|
doDeleteByCode = async (code: string) => {
|
|
921
|
-
const { sourceId, serverKey,mainCode } = this.props;
|
|
927
|
+
const { sourceId, serverKey, mainCode } = this.props;
|
|
922
928
|
const { hiddenColIds, hiddenRowCodes, sortedColConfigs } = this.state;
|
|
923
929
|
this.setState({
|
|
924
930
|
loading: true,
|
|
925
931
|
});
|
|
926
|
-
|
|
927
|
-
|
|
932
|
+
let result: boolean = await HcserviceV3.deleteByCode(
|
|
933
|
+
serverKey,
|
|
934
|
+
sourceId,
|
|
935
|
+
[code],
|
|
936
|
+
mainCode
|
|
937
|
+
);
|
|
928
938
|
if (result) {
|
|
929
939
|
//重新加载数据
|
|
930
940
|
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
|
|
@@ -1092,8 +1102,6 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1092
1102
|
}
|
|
1093
1103
|
};
|
|
1094
1104
|
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
1105
|
changeRowSelection = (
|
|
1098
1106
|
selectedRows: SelectedRow[],
|
|
1099
1107
|
selectedDatas: DtmplData[]
|
|
@@ -1169,12 +1177,13 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1169
1177
|
</Button>
|
|
1170
1178
|
</Popover>
|
|
1171
1179
|
) : null}
|
|
1172
|
-
{buttons.includes("ratmplSelect")
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1180
|
+
{buttons.includes("ratmplSelect") ? (
|
|
1181
|
+
<Button onClick={() => this.setState({ showRatmplSelector: true })}>
|
|
1182
|
+
{translate("${选择}")}
|
|
1183
|
+
</Button>
|
|
1184
|
+
) : (
|
|
1185
|
+
""
|
|
1186
|
+
)}
|
|
1178
1187
|
{buttons.includes("dtmplAdd") && doCreate && !readOnly ? (
|
|
1179
1188
|
ltmplConfig.classAddConfigs &&
|
|
1180
1189
|
ltmplConfig.classAddConfigs.length > 0 ? (
|
|
@@ -1408,6 +1417,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1408
1417
|
pageNo,
|
|
1409
1418
|
onChangePage,
|
|
1410
1419
|
serverKey,
|
|
1420
|
+
doSearch,
|
|
1421
|
+
criteriaData,
|
|
1411
1422
|
} = this.props;
|
|
1412
1423
|
const { translate } = this.context;
|
|
1413
1424
|
|
|
@@ -1443,6 +1454,11 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1443
1454
|
}
|
|
1444
1455
|
}
|
|
1445
1456
|
}
|
|
1457
|
+
|
|
1458
|
+
const sortColumnData = [];
|
|
1459
|
+
if (Array.isArray(criteriaData["sortColIds"])) {
|
|
1460
|
+
sortColumnData.push(...criteriaData["sortColIds"]);
|
|
1461
|
+
}
|
|
1446
1462
|
return (
|
|
1447
1463
|
<>
|
|
1448
1464
|
{/*暂时不支持L2chart 后续用echart*/}
|
|
@@ -1525,6 +1541,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1525
1541
|
: ltmplConfig.subtotalYColumn
|
|
1526
1542
|
}
|
|
1527
1543
|
groupIColumns={ltmplConfig.groupIColumns}
|
|
1544
|
+
doSearch={doSearch}
|
|
1545
|
+
sortColumnData={sortColumnData}
|
|
1528
1546
|
/>
|
|
1529
1547
|
)}
|
|
1530
1548
|
{/*此处放页脚*/}
|
|
@@ -1543,7 +1561,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1543
1561
|
this.setState({
|
|
1544
1562
|
showRatmplSelector: false,
|
|
1545
1563
|
});
|
|
1546
|
-
const {serverKey,sourceId,mainCode,doSearch}=this.props;
|
|
1564
|
+
const { serverKey, sourceId, mainCode, doSearch } = this.props;
|
|
1547
1565
|
if (!selectedRows || selectedRows.length <= 0) {
|
|
1548
1566
|
return;
|
|
1549
1567
|
}
|
|
@@ -1553,10 +1571,33 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1553
1571
|
for (let row of selectedRows) {
|
|
1554
1572
|
codes.push(row.code);
|
|
1555
1573
|
}
|
|
1556
|
-
await HcserviceV3.saveRatmplSelectCodes(
|
|
1574
|
+
await HcserviceV3.saveRatmplSelectCodes(
|
|
1575
|
+
serverKey,
|
|
1576
|
+
sourceId,
|
|
1577
|
+
mainCode,
|
|
1578
|
+
codes
|
|
1579
|
+
);
|
|
1557
1580
|
doSearch(null);
|
|
1558
1581
|
};
|
|
1559
1582
|
|
|
1583
|
+
handleColumnOrder(columnId) {
|
|
1584
|
+
const sortColumns = this.props.criteriaData["sortColIds"];
|
|
1585
|
+
|
|
1586
|
+
if (!Array.isArray(sortColumns)) return undefined;
|
|
1587
|
+
|
|
1588
|
+
for (const column of sortColumns) {
|
|
1589
|
+
const [key, sort] = column.split("_");
|
|
1590
|
+
|
|
1591
|
+
if (key === columnId) {
|
|
1592
|
+
if (sort === "asc") return "ascend";
|
|
1593
|
+
if (sort === "desc") return "descend";
|
|
1594
|
+
continue;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
return undefined;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1560
1601
|
render() {
|
|
1561
1602
|
let {
|
|
1562
1603
|
queryKey,
|
|
@@ -1565,7 +1606,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1565
1606
|
recordCode,
|
|
1566
1607
|
showCustomCard,
|
|
1567
1608
|
customButton,
|
|
1568
|
-
customButtonData,
|
|
1609
|
+
customButtonData,
|
|
1610
|
+
showRatmplSelector,
|
|
1569
1611
|
} = this.state;
|
|
1570
1612
|
let {
|
|
1571
1613
|
sourceId,
|
|
@@ -1573,7 +1615,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1573
1615
|
title,
|
|
1574
1616
|
collapsible,
|
|
1575
1617
|
initCollapse,
|
|
1576
|
-
tip,
|
|
1618
|
+
tip,
|
|
1619
|
+
serverKey,
|
|
1620
|
+
mainCode,
|
|
1577
1621
|
} = this.props;
|
|
1578
1622
|
const { translate } = this.context;
|
|
1579
1623
|
|
|
@@ -1630,21 +1674,21 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1630
1674
|
roleCode={recordCode}
|
|
1631
1675
|
/>
|
|
1632
1676
|
{showRatmplSelector ? (
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1677
|
+
<ModelSelectTable
|
|
1678
|
+
serverKey={serverKey}
|
|
1679
|
+
// defaultCriteriaValue={fieldGroupConfig.defaultCriteriaValue}
|
|
1680
|
+
// maxSelectedRows={fieldGroupConfig.max}
|
|
1681
|
+
open={showRatmplSelector}
|
|
1682
|
+
onOK={this.saveRatmplSelect}
|
|
1683
|
+
onCancel={() => {
|
|
1684
|
+
this.setState({ showRatmplSelector: false });
|
|
1685
|
+
}}
|
|
1686
|
+
mainCode={mainCode}
|
|
1687
|
+
sourceId={sourceId}
|
|
1688
|
+
existRelation={"false"}
|
|
1689
|
+
></ModelSelectTable>
|
|
1646
1690
|
) : (
|
|
1647
|
-
|
|
1691
|
+
""
|
|
1648
1692
|
)}
|
|
1649
1693
|
</>
|
|
1650
1694
|
);
|
|
@@ -67,6 +67,8 @@ interface QueryTableProps {
|
|
|
67
67
|
subtotalXColumn?: { id: string }[];
|
|
68
68
|
subtotalYColumn?: { id: string }[];
|
|
69
69
|
groupIColumns?: { id: string; title: string; sourceId: string }[]; // 组间合计key
|
|
70
|
+
doSearch?: (params: object) => void;
|
|
71
|
+
sortColumnData?: string[];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
interface QueryTableStat {
|
|
@@ -1012,6 +1014,41 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
1012
1014
|
// return {};
|
|
1013
1015
|
}
|
|
1014
1016
|
|
|
1017
|
+
onChange(pagination, filters, sorter, extra) {
|
|
1018
|
+
console.log("params", pagination, filters, sorter, extra);
|
|
1019
|
+
if (extra.action === "sort") {
|
|
1020
|
+
const extParams: Record<string, string> = {};
|
|
1021
|
+
const sortColumnData = JSON.parse(
|
|
1022
|
+
JSON.stringify(this.props.sortColumnData)
|
|
1023
|
+
);
|
|
1024
|
+
|
|
1025
|
+
const tgt = sortColumnData.findIndex((item) => {
|
|
1026
|
+
const key = item.split("_")[0];
|
|
1027
|
+
|
|
1028
|
+
if (key === sorter.field) return true;
|
|
1029
|
+
return false;
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
if (tgt !== -1) {
|
|
1033
|
+
sortColumnData.splice(tgt, 1);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
if (sorter.order) {
|
|
1037
|
+
Object.assign(extParams, {
|
|
1038
|
+
sortColIds: [
|
|
1039
|
+
...sortColumnData,
|
|
1040
|
+
sorter.field + "_" + (sorter.order === "ascend" ? "asc" : "desc"),
|
|
1041
|
+
],
|
|
1042
|
+
});
|
|
1043
|
+
} else {
|
|
1044
|
+
Object.assign(extParams, {
|
|
1045
|
+
sortColIds: [...sortColumnData],
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
this.props.doSearch(extParams);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1015
1052
|
render() {
|
|
1016
1053
|
const {
|
|
1017
1054
|
pageInfo,
|
|
@@ -1332,6 +1369,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
1332
1369
|
row: this.DraggableBodyRow,
|
|
1333
1370
|
},
|
|
1334
1371
|
}}
|
|
1372
|
+
onChange={this.onChange.bind(this)}
|
|
1335
1373
|
></Table>
|
|
1336
1374
|
) : (
|
|
1337
1375
|
""
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
col['showSorterTooltip'] = false;
|
|
4
|
+
sort(col, itemType: string, defaultSort?) {
|
|
5
|
+
let colName = col["dataIndex"];
|
|
6
|
+
// if (itemType == "decimal" || itemType == "int" || itemType == "float" || itemType == "double") { //排序b
|
|
7
|
+
// col["sorter"] = (a, b) => a[colName] - b[colName];
|
|
8
|
+
// } else if (itemType == "text" || itemType == "textarea" || itemType == "date" || itemType == "datetime") {
|
|
9
|
+
// col["sorter"] = (a, b) => a[colName] ? a[colName].localeCompare(b[colName], 'zh-CN') : -1;
|
|
10
|
+
// } else {
|
|
11
|
+
// col["sorter"] = (a, b) => { //排序
|
|
12
|
+
// if (a[colName] && b[colName] && a[colName].localeCompare) {
|
|
13
|
+
// return a[colName] ? a[colName].localeCompare(b[colName], 'zh-CN') : -1;
|
|
14
|
+
// } else {
|
|
15
|
+
// return 1;
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
// }
|
|
19
|
+
col["sorter"] = true;
|
|
20
|
+
if (defaultSort) {
|
|
21
|
+
col["defaultSortOrder"] = defaultSort;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
col["showSorterTooltip"] = false;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -600,17 +600,21 @@ export default {
|
|
|
600
600
|
}
|
|
601
601
|
//排序
|
|
602
602
|
paramKeys.sort();
|
|
603
|
-
|
|
603
|
+
debugger
|
|
604
604
|
for (let key of paramKeys) {
|
|
605
605
|
let value = data[key];
|
|
606
|
-
let str =
|
|
606
|
+
let str = encodeURIComponent(key);
|
|
607
607
|
if (!value) {
|
|
608
|
+
} else if (key === "sortColIds") {
|
|
609
|
+
value.forEach((_value) => {
|
|
610
|
+
_result.push(str + "[]=" + encodeURIComponent(_value));
|
|
611
|
+
});
|
|
608
612
|
} else if (value && value.constructor === Array) {
|
|
609
613
|
value.forEach((_value) => {
|
|
610
|
-
_result.push(str + "[]=" +
|
|
614
|
+
_result.push(str + "[]=" + encodeURIComponent(_value));
|
|
611
615
|
});
|
|
612
616
|
} else {
|
|
613
|
-
_result.push(str + "=" +
|
|
617
|
+
_result.push(str + "=" + encodeURIComponent(value));
|
|
614
618
|
}
|
|
615
619
|
}
|
|
616
620
|
return _result.length ? prefix + _result.join("&") : "";
|
|
@@ -659,7 +663,7 @@ export default {
|
|
|
659
663
|
obj[name] = [];
|
|
660
664
|
}
|
|
661
665
|
obj[name].push(
|
|
662
|
-
|
|
666
|
+
decodeURIComponent(
|
|
663
667
|
this.configParamTrans(
|
|
664
668
|
res[1],
|
|
665
669
|
this.getItemType(name, res[1], ltmplConfig)
|
|
@@ -670,7 +674,7 @@ export default {
|
|
|
670
674
|
const res = arr2[i].split("=");
|
|
671
675
|
const name = res[0];
|
|
672
676
|
if (name) {
|
|
673
|
-
obj[name] =
|
|
677
|
+
obj[name] = decodeURIComponent(
|
|
674
678
|
this.configParamTrans(
|
|
675
679
|
res[1],
|
|
676
680
|
this.getItemType(name, res[1], ltmplConfig)
|