@kengic/core.react 0.0.1-beta.51 → 0.0.1-beta.53
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/kengic-core.react.js
CHANGED
|
@@ -66454,106 +66454,117 @@ function List(e, t) {
|
|
|
66454
66454
|
}
|
|
66455
66455
|
List.method = "GET";
|
|
66456
66456
|
List.url = "/workstation/workstation/list";
|
|
66457
|
-
function
|
|
66457
|
+
function useKg() {
|
|
66458
66458
|
const e = useIntl();
|
|
66459
66459
|
return {
|
|
66460
66460
|
/**
|
|
66461
|
-
*
|
|
66462
|
-
* <p>https://ant.design/components/modal#modalmethod</p>
|
|
66461
|
+
* 翻译.
|
|
66463
66462
|
*
|
|
66464
|
-
* @param
|
|
66463
|
+
* @param id 被翻译的数据.
|
|
66464
|
+
* @return 翻译后的数据.
|
|
66465
66465
|
*/
|
|
66466
|
-
|
|
66467
|
-
|
|
66468
|
-
const r = Modal.confirm({
|
|
66469
|
-
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$2, { icon: "ant-design:exclamation-circle-outlined" }),
|
|
66470
|
-
title: e.formatMessage({ id: "kg.confirm" }),
|
|
66471
|
-
content: e.formatMessage({ id: "kg.confirmDelete" }),
|
|
66472
|
-
okText: e.formatMessage({ id: "kg.confirm" }),
|
|
66473
|
-
okButtonProps: {
|
|
66474
|
-
danger: !0,
|
|
66475
|
-
...t.okButtonProps ?? {}
|
|
66476
|
-
},
|
|
66477
|
-
cancelButtonProps: {
|
|
66478
|
-
// 通过设置样式, 隐藏取消按钮
|
|
66479
|
-
class: t.kgHideCancelButton === !0 ? "kg-invisible" : "",
|
|
66480
|
-
disabled: !1,
|
|
66481
|
-
...t.cancelButtonProps ?? {}
|
|
66482
|
-
},
|
|
66483
|
-
cancelText: e.formatMessage({ id: "kg.cancel" }),
|
|
66484
|
-
closable: !1,
|
|
66485
|
-
centered: !0,
|
|
66486
|
-
autoFocusButton: null,
|
|
66487
|
-
keyboard: !1,
|
|
66488
|
-
...t
|
|
66489
|
-
});
|
|
66490
|
-
return r.showLoading = () => {
|
|
66491
|
-
r.update((n) => {
|
|
66492
|
-
const a = cloneDeep(n);
|
|
66493
|
-
return a.okButtonProps.loading = !0, a.cancelButtonProps.disabled = !0, a;
|
|
66494
|
-
});
|
|
66495
|
-
}, r.hideLoading = () => {
|
|
66496
|
-
r.update((n) => {
|
|
66497
|
-
const a = cloneDeep(n);
|
|
66498
|
-
return a.okButtonProps.loading = !1, a.cancelButtonProps.disabled = !1, a;
|
|
66499
|
-
});
|
|
66500
|
-
}, r;
|
|
66466
|
+
t(t) {
|
|
66467
|
+
return e.formatMessage({ id: t });
|
|
66501
66468
|
}
|
|
66502
66469
|
};
|
|
66503
66470
|
}
|
|
66471
|
+
class KgUtil {
|
|
66472
|
+
/**
|
|
66473
|
+
* 确认弹窗.
|
|
66474
|
+
* 设置了多个属性的默认值, 简化使用.
|
|
66475
|
+
* https://www.antdv.com/components/modal
|
|
66476
|
+
* @param props
|
|
66477
|
+
*/
|
|
66478
|
+
static confirm(t) {
|
|
66479
|
+
const r = Modal.confirm({
|
|
66480
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$2, { icon: "ant-design:exclamation-circle-outlined" }),
|
|
66481
|
+
title: t.intl.formatMessage({ id: "kg.confirm" }),
|
|
66482
|
+
content: t.intl.formatMessage({ id: "kg.confirmDelete" }),
|
|
66483
|
+
okText: t.intl.formatMessage({ id: "kg.confirm" }),
|
|
66484
|
+
okButtonProps: {
|
|
66485
|
+
danger: !0,
|
|
66486
|
+
...t.okButtonProps ?? {}
|
|
66487
|
+
},
|
|
66488
|
+
cancelButtonProps: {
|
|
66489
|
+
// 通过设置样式, 隐藏取消按钮
|
|
66490
|
+
class: t.kgHideCancelButton === !0 ? "kg-invisible" : "",
|
|
66491
|
+
disabled: !1,
|
|
66492
|
+
...t.cancelButtonProps ?? {}
|
|
66493
|
+
},
|
|
66494
|
+
cancelText: t.intl.formatMessage({ id: "kg.cancel" }),
|
|
66495
|
+
closable: !1,
|
|
66496
|
+
centered: !0,
|
|
66497
|
+
autoFocusButton: null,
|
|
66498
|
+
keyboard: !1,
|
|
66499
|
+
...t
|
|
66500
|
+
});
|
|
66501
|
+
return r.showLoading = () => {
|
|
66502
|
+
r.update((n) => {
|
|
66503
|
+
const a = cloneDeep(n);
|
|
66504
|
+
return a.okButtonProps.loading = !0, a.cancelButtonProps.disabled = !0, a;
|
|
66505
|
+
});
|
|
66506
|
+
}, r.hideLoading = () => {
|
|
66507
|
+
r.update((n) => {
|
|
66508
|
+
const a = cloneDeep(n);
|
|
66509
|
+
return a.okButtonProps.loading = !1, a.cancelButtonProps.disabled = !1, a;
|
|
66510
|
+
});
|
|
66511
|
+
}, r;
|
|
66512
|
+
}
|
|
66513
|
+
}
|
|
66504
66514
|
function KgWorkStationModal() {
|
|
66505
|
-
var
|
|
66506
|
-
const e = useID(), t = doKgWorkStation(e), r =
|
|
66515
|
+
var ia;
|
|
66516
|
+
const e = useID(), t = doKgWorkStation(e), r = useIntl(), n = useKg(), a = useReduxDispatch(), s = useReduxSelector(getIsVisible(e)), u = useReduxSelector(getIsOpen(e)), [g, C] = reactExports.useState([]), [w, D] = reactExports.useState([]), [G, ne] = reactExports.useState([]), oe = useReduxSelector(getWorkStation(e)), se = useReduxSelector(getWorkStationArea(e)), ue = ((ia = g.find((ca) => ca.devcod === w[0])) == null ? void 0 : ia.workstationAreas) ?? [], ae = {
|
|
66507
66517
|
hideSelectAll: !0,
|
|
66508
|
-
onChange(
|
|
66509
|
-
|
|
66518
|
+
onChange(ca) {
|
|
66519
|
+
D(ca.length > 1 ? [ca[0]] : ca);
|
|
66510
66520
|
},
|
|
66511
|
-
selectedRowKeys:
|
|
66512
|
-
},
|
|
66521
|
+
selectedRowKeys: w
|
|
66522
|
+
}, ct = {
|
|
66513
66523
|
hideSelectAll: !0,
|
|
66514
|
-
onChange(
|
|
66515
|
-
|
|
66524
|
+
onChange(ca) {
|
|
66525
|
+
ne(ca.length > 1 ? [ca[0]] : ca);
|
|
66516
66526
|
},
|
|
66517
|
-
selectedRowKeys:
|
|
66518
|
-
},
|
|
66527
|
+
selectedRowKeys: G
|
|
66528
|
+
}, ea = [
|
|
66519
66529
|
{
|
|
66520
66530
|
dataIndex: "devcodDsc",
|
|
66521
|
-
render: (
|
|
66531
|
+
render: (ca) => ca,
|
|
66522
66532
|
title: /* @__PURE__ */ jsxRuntimeExports.jsx(MemoizedFormattedMessage, { id: "KgWorkStation.workStation" })
|
|
66523
66533
|
}
|
|
66524
|
-
],
|
|
66534
|
+
], ut = [
|
|
66525
66535
|
{
|
|
66526
66536
|
dataIndex: "wrkareDsc",
|
|
66527
|
-
render: (
|
|
66537
|
+
render: (ca) => ca,
|
|
66528
66538
|
title: /* @__PURE__ */ jsxRuntimeExports.jsx(MemoizedFormattedMessage, { id: "KgWorkStation.workStationArea" })
|
|
66529
66539
|
}
|
|
66530
66540
|
];
|
|
66531
66541
|
reactExports.useEffect(() => {
|
|
66532
|
-
|
|
66533
|
-
}, [
|
|
66534
|
-
function
|
|
66542
|
+
u && oa();
|
|
66543
|
+
}, [u]);
|
|
66544
|
+
function ra() {
|
|
66535
66545
|
t.closeModal();
|
|
66536
66546
|
}
|
|
66537
|
-
function
|
|
66538
|
-
const
|
|
66539
|
-
|
|
66547
|
+
function ta() {
|
|
66548
|
+
const ca = () => {
|
|
66549
|
+
a(setWorkStation({ id: e, workStation: g.find((sa) => sa.devcod === w[0]) ?? null })), a(setWorkStationArea({ id: e, workStationArea: ue.find((sa) => sa.wrkare === G[0]) ?? null }));
|
|
66540
66550
|
};
|
|
66541
|
-
|
|
66542
|
-
content:
|
|
66551
|
+
s ? (w[0] !== (oe == null ? void 0 : oe.devcod) || G[0] !== (se == null ? void 0 : se.wrkare)) && (ca(), KgUtil.confirm({
|
|
66552
|
+
content: r.formatMessage({ id: "KgWorkStation.reloadMessage" }),
|
|
66553
|
+
intl: r,
|
|
66543
66554
|
kgHideCancelButton: !0,
|
|
66544
66555
|
okButtonProps: { danger: !1 },
|
|
66545
|
-
okText:
|
|
66556
|
+
okText: n.t("kg.refresh"),
|
|
66546
66557
|
onOk: () => {
|
|
66547
66558
|
window.location.reload();
|
|
66548
66559
|
}
|
|
66549
|
-
})) : (
|
|
66560
|
+
})) : (ca(), emit({ event: "onOk", id: e, parameter: {} })), t.closeModal();
|
|
66550
66561
|
}
|
|
66551
|
-
async function
|
|
66552
|
-
var
|
|
66553
|
-
const
|
|
66554
|
-
|
|
66562
|
+
async function oa() {
|
|
66563
|
+
var sa, va;
|
|
66564
|
+
const ca = ((sa = await List({ params: { pageNo: 1, pageSize: 999 } })) == null ? void 0 : sa.records) ?? [];
|
|
66565
|
+
ca.find((ga) => ga.devcod === (oe == null ? void 0 : oe.devcod)) ? (D([oe == null ? void 0 : oe.devcod]), (va = oe == null ? void 0 : oe.workstationAreas) != null && va.find((ga) => ga.wrkare === (se == null ? void 0 : se.wrkare)) ? ne([se == null ? void 0 : se.wrkare]) : ne([])) : (D([]), ne([])), C(ca);
|
|
66555
66566
|
}
|
|
66556
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children:
|
|
66567
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: u && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66557
66568
|
KgModal,
|
|
66558
66569
|
{
|
|
66559
66570
|
open: !0,
|
|
@@ -66562,22 +66573,22 @@ function KgWorkStationModal() {
|
|
|
66562
66573
|
confirmLoading: !1,
|
|
66563
66574
|
wrapClassName: "kgcrant-kg-work-station-modal",
|
|
66564
66575
|
zIndex: 2e3,
|
|
66565
|
-
onCancel:
|
|
66566
|
-
onOk:
|
|
66576
|
+
onCancel: ra,
|
|
66577
|
+
onOk: ta,
|
|
66567
66578
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex" }, children: [
|
|
66568
66579
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flex: "1", borderRight: "1px solid #f0f0f0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66569
66580
|
ForwardTable,
|
|
66570
66581
|
{
|
|
66571
66582
|
className: "kg-flex-table",
|
|
66572
|
-
dataSource:
|
|
66573
|
-
columns:
|
|
66583
|
+
dataSource: g,
|
|
66584
|
+
columns: ea,
|
|
66574
66585
|
size: "small",
|
|
66575
66586
|
pagination: !1,
|
|
66576
|
-
rowSelection:
|
|
66577
|
-
rowKey: (
|
|
66578
|
-
onRow: (
|
|
66587
|
+
rowSelection: ae,
|
|
66588
|
+
rowKey: (ca) => ca.devcod,
|
|
66589
|
+
onRow: (ca) => ({
|
|
66579
66590
|
onClick() {
|
|
66580
|
-
|
|
66591
|
+
w.includes(ca.devcod) ? D([]) : D([ca.devcod]);
|
|
66581
66592
|
}
|
|
66582
66593
|
})
|
|
66583
66594
|
}
|
|
@@ -66586,15 +66597,15 @@ function KgWorkStationModal() {
|
|
|
66586
66597
|
ForwardTable,
|
|
66587
66598
|
{
|
|
66588
66599
|
className: "kg-flex-table",
|
|
66589
|
-
dataSource:
|
|
66590
|
-
columns:
|
|
66600
|
+
dataSource: ue,
|
|
66601
|
+
columns: ut,
|
|
66591
66602
|
size: "small",
|
|
66592
66603
|
pagination: !1,
|
|
66593
|
-
rowSelection:
|
|
66594
|
-
rowKey: (
|
|
66595
|
-
onRow: (
|
|
66604
|
+
rowSelection: ct,
|
|
66605
|
+
rowKey: (ca) => ca.wrkare,
|
|
66606
|
+
onRow: (ca) => ({
|
|
66596
66607
|
onClick() {
|
|
66597
|
-
|
|
66608
|
+
G.includes(ca.wrkare) ? ne([]) : ne([ca.wrkare]);
|
|
66598
66609
|
}
|
|
66599
66610
|
})
|
|
66600
66611
|
}
|
package/package.json
CHANGED
package/src/hook/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './kg
|
|
1
|
+
export * from './kg.hook.tsx';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './kg.util.tsx';
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { ModalFuncProps } from 'antd';
|
|
2
|
-
|
|
2
|
+
import { IntlShape } from 'react-intl';
|
|
3
|
+
/**
|
|
4
|
+
* 工具方法.
|
|
5
|
+
*/
|
|
6
|
+
export declare class KgUtil {
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
8
|
+
* 确认弹窗.
|
|
9
|
+
* 设置了多个属性的默认值, 简化使用.
|
|
10
|
+
* https://www.antdv.com/components/modal
|
|
7
11
|
* @param props
|
|
8
12
|
*/
|
|
9
|
-
confirm(props: IKgVarButtonModalProperties): ModalFunc;
|
|
10
|
-
}
|
|
13
|
+
static confirm(props: IKgVarButtonModalProperties): ModalFunc;
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* 按钮确认弹窗的参数.
|
|
13
17
|
*/
|
|
14
18
|
export type IKgVarButtonModalProperties = ModalFuncProps & {
|
|
19
|
+
intl: IntlShape;
|
|
15
20
|
/** 是否隐藏取消按钮. */
|
|
16
21
|
kgHideCancelButton?: boolean;
|
|
17
22
|
};
|