aldehyde 0.2.469 → 0.2.471
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/entity-select/entity-select.js +3 -3
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/layout2/components/user-button.js +2 -2
- package/lib/layout2/components/user-button.js.map +1 -1
- package/lib/list/calendar/index.d.ts.map +1 -1
- package/lib/list/calendar/index.js +3 -2
- package/lib/list/calendar/index.js.map +1 -1
- package/lib/list/gantt/index.d.ts.map +1 -1
- package/lib/list/gantt/index.js +2 -1
- package/lib/list/gantt/index.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +3 -2
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.js +1 -1
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +61 -2
- package/lib/table/select-table.js.map +1 -1
- package/lib/tmpl/interface.d.ts +10 -8
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/superagent.js +2 -2
- package/lib/tmpl/superagent.js.map +1 -1
- package/lib/tree/tree-utils.js +4 -3
- package/lib/tree/tree-utils.js.map +1 -1
- package/lib/units/index.js +5 -5
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/entity-select/entity-select.tsx +1 -1
- package/src/aldehyde/layout2/components/user-button.tsx +11 -11
- package/src/aldehyde/list/calendar/index.tsx +3 -2
- package/src/aldehyde/list/gantt/index.tsx +2 -1
- package/src/aldehyde/table/act-table.tsx +3 -2
- package/src/aldehyde/table/column/column-builder.tsx +1 -1
- package/src/aldehyde/table/select-table.tsx +59 -3
- package/src/aldehyde/tmpl/interface.tsx +10 -8
- package/src/aldehyde/tmpl/superagent.js +3 -3
- package/src/aldehyde/tree/tree-utils.tsx +3 -3
- package/src/aldehyde/units/index.tsx +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Space, Button, Popconfirm } from "antd";
|
|
2
|
+
import { Space, Button, Popconfirm, message } 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, RouterCompProps } from "../tmpl/interface";
|
|
6
|
+
import { DtmplData, QueryKey, SelectConfig, SelectedRow, ControlBaseProps, LtmplConfig, ActTableMode, RouterCompProps, CustomButtonConfig, CustomButton } from "../tmpl/interface";
|
|
7
7
|
import TableUnits from "./table-util";
|
|
8
8
|
import Units from "../units";
|
|
9
9
|
import SupportInputTypes from '../tmpl/control-type-supportor';
|
|
@@ -50,6 +50,8 @@ interface SelectTableStat {
|
|
|
50
50
|
ltmplConfig?: LtmplConfig;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
let serial_number = new Date().getTime();
|
|
54
|
+
|
|
53
55
|
class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat> {
|
|
54
56
|
static contextType = LocaleContext;
|
|
55
57
|
context: React.ContextType<typeof LocaleContext>;
|
|
@@ -389,6 +391,60 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
389
391
|
}
|
|
390
392
|
};
|
|
391
393
|
|
|
394
|
+
buttonClickable = () => {
|
|
395
|
+
let new_serial_number = new Date().getTime();
|
|
396
|
+
if (new_serial_number - serial_number > 1500) {
|
|
397
|
+
serial_number = new_serial_number;
|
|
398
|
+
return true;
|
|
399
|
+
} else {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// 自由按钮事件
|
|
405
|
+
doCustomButton = async (customButton: CustomButton, records: DtmplData[]) => {
|
|
406
|
+
if (customButton?.onClick) {
|
|
407
|
+
customButton.onClick();
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (!this.buttonClickable()) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const { serverKey } = this.props;
|
|
414
|
+
let doType = customButton.doType;
|
|
415
|
+
let config: CustomButtonConfig = Units.getCustomButtonConfig(customButton.id);
|
|
416
|
+
if ("request_refresh" == doType) {
|
|
417
|
+
if (config && config.doAction) {
|
|
418
|
+
await config.doAction(customButton, records);
|
|
419
|
+
} else if (config && config.getRequestUrl) {
|
|
420
|
+
let url = await config.getRequestUrl(customButton, records);
|
|
421
|
+
await HcserviceV3.doPostRequest(serverKey, url);
|
|
422
|
+
} else if (customButton.path) {
|
|
423
|
+
let codes = [];
|
|
424
|
+
let res = undefined;
|
|
425
|
+
if (records != null) {
|
|
426
|
+
records.forEach(item => {
|
|
427
|
+
codes.push(item.code)
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
if (customButton.requestMethod === "get") {
|
|
431
|
+
res = await HcserviceV3.doGetRequest(serverKey, customButton.path, { codes });
|
|
432
|
+
} else {
|
|
433
|
+
res = await HcserviceV3.doPostRequest(serverKey, customButton.path, { codes });
|
|
434
|
+
}
|
|
435
|
+
if (res?.msg || res?.message) {
|
|
436
|
+
message.info(res.msg || res.message);
|
|
437
|
+
}
|
|
438
|
+
} else {
|
|
439
|
+
message.error("Button Config Error");
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
this.doSearch({ serial_number });
|
|
443
|
+
} else {
|
|
444
|
+
message.error("Unsuport Button dotype " + doType);
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
|
|
392
448
|
|
|
393
449
|
render() {
|
|
394
450
|
let { maxSelectedRows, selectedRows, selectedDatas, serverKey, sourceId, mainCode, fieldConfig, funcMode, onClosePopover } = this.props;
|
|
@@ -431,7 +487,7 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
431
487
|
ltmplConfig={{ ...selectConfig, customButtons: [...(selectConfig.customButtons || []), ...addAction, ...closePopover] }}
|
|
432
488
|
data={criteriaData}
|
|
433
489
|
doSearch={this.doSearch} loading={loading}
|
|
434
|
-
doCustomButton={
|
|
490
|
+
doCustomButton={this.doCustomButton}
|
|
435
491
|
doAction={this.doSelectedAction}
|
|
436
492
|
/>
|
|
437
493
|
</div> : null}
|
|
@@ -517,7 +517,6 @@ export interface SelectConfig extends TmplBase {
|
|
|
517
517
|
commonCriterias: CriteriaConfig[];
|
|
518
518
|
split2TabCriterias: CriteriaConfig[];
|
|
519
519
|
defaultCriteriaValue?: object;
|
|
520
|
-
primaryColumn?: ColumnConfig;
|
|
521
520
|
groupIColumns?: ColumnConfig[];
|
|
522
521
|
primaryCriteria: CriteriaConfig;
|
|
523
522
|
orderColumn: ColumnConfig;
|
|
@@ -620,13 +619,16 @@ export interface LtmplConfig extends SelectConfig {
|
|
|
620
619
|
rowTotalCols?: number;
|
|
621
620
|
defaultShowTotalCols?: number;
|
|
622
621
|
showType?: "table" | "verticalList" | "cardList";
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
622
|
+
extDisplayConfig?: { // 展示增强配置
|
|
623
|
+
primaryColumn?: ColumnConfig;
|
|
624
|
+
primaryColumnLabel?: ColumnConfig;
|
|
625
|
+
secondColumn?: ColumnConfig;
|
|
626
|
+
secondColumnLabel?: ColumnConfig;
|
|
627
|
+
mainPicture?: ColumnConfig;
|
|
628
|
+
mainPictureLabel?: ColumnConfig;
|
|
629
|
+
labelColumn?: ColumnConfig;
|
|
630
|
+
cardShowCols?: ColumnConfig[];
|
|
631
|
+
};
|
|
630
632
|
rowCardCount?: number;
|
|
631
633
|
defaultDtmplData?: DtmplData;
|
|
632
634
|
rightPercent?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import superagent from "superagent";
|
|
2
|
-
import {message} from "antd";
|
|
2
|
+
import { message } from "antd";
|
|
3
3
|
import Units from "../units";
|
|
4
4
|
import translate from "../locale/translate";
|
|
5
5
|
|
|
@@ -73,9 +73,9 @@ export default class Superagent {
|
|
|
73
73
|
} else if (res.status === 201) {
|
|
74
74
|
//Units.setLocalStorge("hydrocarbonToken", hydrocarbonToken)
|
|
75
75
|
resolve(res);
|
|
76
|
-
} else if (res.status ===
|
|
76
|
+
} else if (res.status === 401) {
|
|
77
77
|
Units.toLogin();
|
|
78
|
-
} else if (
|
|
78
|
+
} else if ([403, 405, 406].includes(res.status)) {
|
|
79
79
|
message.error(translate("${权限不足}"), 5);
|
|
80
80
|
resolve(res);
|
|
81
81
|
} else if (res.status === 404 || res.status === 504) {
|
|
@@ -35,19 +35,19 @@ export default class TreeUtils {
|
|
|
35
35
|
let res: LtmplConfigRes = await HCDataSource.requestLtmplConfig(null, ttmplNodeConfig.rootGtmplId);
|
|
36
36
|
let rootLTmplConfig: LtmplConfig = res.ltmplConfig;
|
|
37
37
|
ttmplNodeConfig.rootLTmplConfig = rootLTmplConfig;
|
|
38
|
-
ttmplNodeConfig.rootTitleId = rootLTmplConfig.primaryColumn
|
|
38
|
+
ttmplNodeConfig.rootTitleId = rootLTmplConfig.extDisplayConfig.primaryColumn?.id;
|
|
39
39
|
}
|
|
40
40
|
if (ttmplNodeConfig.branchRatmplId) {
|
|
41
41
|
let res: LtmplConfigRes = await HCDataSource.requestLtmplConfig(null, ttmplNodeConfig.branchRatmplId);
|
|
42
42
|
let branchLTmplConfig: LtmplConfig = res.ltmplConfig;
|
|
43
43
|
ttmplNodeConfig.branchLTmplConfig = branchLTmplConfig;
|
|
44
|
-
ttmplNodeConfig.branchTitleId = branchLTmplConfig.primaryColumn
|
|
44
|
+
ttmplNodeConfig.branchTitleId = branchLTmplConfig.extDisplayConfig.primaryColumn?.id;
|
|
45
45
|
}
|
|
46
46
|
if (ttmplNodeConfig.leafRatmplId) {
|
|
47
47
|
let res: LtmplConfigRes = await HCDataSource.requestLtmplConfig(null, ttmplNodeConfig.leafRatmplId);
|
|
48
48
|
let leafLTmplConfig: LtmplConfig = res.ltmplConfig;
|
|
49
49
|
ttmplNodeConfig.leafLTmplConfig = leafLTmplConfig;
|
|
50
|
-
ttmplNodeConfig.leafTitleId = leafLTmplConfig.primaryColumn
|
|
50
|
+
ttmplNodeConfig.leafTitleId = leafLTmplConfig.extDisplayConfig.primaryColumn?.id;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return ttmplNodeConfig;
|
|
@@ -1151,8 +1151,8 @@ export default {
|
|
|
1151
1151
|
if (user?.orgGtmplSourceId && !["null"].includes(user.orgGtmplSourceId)) {
|
|
1152
1152
|
const { ltmplConfig } = await HcserviceV3.requestLtmplConfig(null, user.orgGtmplSourceId) || {};
|
|
1153
1153
|
const { entities } = await HcserviceV3.requestLtmplQueryTop(null, user.orgGtmplSourceId, { top: 1 }) || {};
|
|
1154
|
-
const primaryColumnId = ltmplConfig?.primaryColumn?.id; // 首字段
|
|
1155
|
-
const mainPictureId = ltmplConfig?.mainPicture?.id; // 主图字段
|
|
1154
|
+
const primaryColumnId = ltmplConfig?.extDisplayConfig?.primaryColumn?.id; // 首字段
|
|
1155
|
+
const mainPictureId = ltmplConfig?.extDisplayConfig?.mainPicture?.id; // 主图字段
|
|
1156
1156
|
const orgName = entities?.[0]?.fieldMap?.[primaryColumnId];
|
|
1157
1157
|
const homeImg = entities?.[0]?.fieldMap?.[mainPictureId];
|
|
1158
1158
|
user = { ...user, orgName, homeImg }
|