relation页面上的一些细节
This commit is contained in:
parent
828cdba781
commit
3985054c06
|
|
@ -40,7 +40,7 @@ exports.default = OakComponent({
|
|||
},
|
||||
formData: function (_a) {
|
||||
var rows = _a.data;
|
||||
console.log(this.props.path);
|
||||
// console.log(this.props.path);
|
||||
return {
|
||||
rows: rows
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ var Title = antd_2.Typography.Title, Text = antd_2.Typography.Text;
|
|||
var actionAuth_1 = tslib_1.__importDefault(require("../actionAuth"));
|
||||
var relationAuth_1 = tslib_1.__importDefault(require("../relationAuth"));
|
||||
var react_1 = require("react");
|
||||
var web_pc_module_less_1 = tslib_1.__importDefault(require("./web.pc.module.less"));
|
||||
function render(props) {
|
||||
var _a = props.data, oakFullpath = _a.oakFullpath, entity = _a.entity, actions = _a.actions, checkedActions = _a.checkedActions, hasDirectActionAuth = _a.hasDirectActionAuth, hasDirectRelationAuth = _a.hasDirectRelationAuth, dras = _a.dras, daas = _a.daas, relationIds = _a.relationIds, relations = _a.relations, deduceRelationAttr = _a.deduceRelationAttr;
|
||||
var _b = props.methods, onActionsSelected = _b.onActionsSelected, onRelationsSelected = _b.onRelationsSelected, t = _b.t;
|
||||
|
|
@ -32,30 +33,38 @@ function render(props) {
|
|||
children: ((0, jsx_runtime_1.jsx)(actionAuth_1.default, { entity: entity, oakPath: oakFullpath && "".concat(oakFullpath, ".actionAuths"), actions: checkedActions }))
|
||||
}
|
||||
];
|
||||
if (hasDirectActionAuth) {
|
||||
items.push({
|
||||
label: 'directActionAuth',
|
||||
key: 'directActionAuth',
|
||||
children: ((0, jsx_runtime_1.jsx)(antd_1.Table, { columns: [
|
||||
{
|
||||
key: '2',
|
||||
title: t('sourceEntity'),
|
||||
width: 100,
|
||||
render: function (value, record) {
|
||||
return record[2];
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
title: t('path'),
|
||||
width: 200,
|
||||
render: function (value, record) {
|
||||
return record[1];
|
||||
},
|
||||
},
|
||||
], dataSource: daas, pagination: false }))
|
||||
});
|
||||
}
|
||||
/* if (hasDirectActionAuth) {
|
||||
items.push(
|
||||
{
|
||||
label: 'directActionAuth',
|
||||
key: 'directActionAuth',
|
||||
children: (
|
||||
<Table
|
||||
columns={[
|
||||
{
|
||||
key: '2',
|
||||
title: t('sourceEntity'),
|
||||
width: 100,
|
||||
render: (value, record) => {
|
||||
return record[2];
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '1',
|
||||
title: t('path'),
|
||||
width: 200,
|
||||
render: (value, record) => {
|
||||
return record[1];
|
||||
},
|
||||
},
|
||||
]}
|
||||
dataSource={daas}
|
||||
pagination={false}
|
||||
/>
|
||||
)
|
||||
}
|
||||
);
|
||||
} */
|
||||
if ((relations === null || relations === void 0 ? void 0 : relations.length) > 0) {
|
||||
items.push({
|
||||
label: 'relationAuth',
|
||||
|
|
@ -73,6 +82,6 @@ function render(props) {
|
|||
} }) }))] })));
|
||||
var showActionSelector = ['actionAuth', 'directActionAuth'].includes(tab);
|
||||
var showRelationSelector = ['relationAuth', 'directRelationAuth'].includes(tab);
|
||||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ justify: "center", style: { margin: 20, padding: 10, minHeight: 100 }, align: "middle" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: 8 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ style: { width: '100%' }, justify: "center", align: "middle" }, { children: [(0, jsx_runtime_1.jsxs)(Text, tslib_1.__assign({ strong: true }, { children: [t('actionAuth:attr.destEntity'), ":"] })), (0, jsx_runtime_1.jsx)(Text, tslib_1.__assign({ code: true, style: { marginLeft: 10 } }, { children: entity }))] })) })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: 12 }, { children: showActionSelector ? ActionSelector : (showRelationSelector && RelationSelector) }))] })), (0, jsx_runtime_1.jsx)(antd_1.Tabs, { defaultActiveKey: "1", type: "card", size: "large", items: items, onChange: function (key) { return setTab(key); } })] }));
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_pc_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ justify: "center", style: { margin: 20, padding: 10, minHeight: 100 }, align: "middle" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: 8 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ style: { width: '100%' }, justify: "center", align: "middle" }, { children: [(0, jsx_runtime_1.jsxs)(Text, tslib_1.__assign({ strong: true }, { children: [t('actionAuth:attr.destEntity'), ":"] })), (0, jsx_runtime_1.jsx)(Text, tslib_1.__assign({ code: true, style: { marginLeft: 10 } }, { children: entity }))] })) })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: 12 }, { children: showActionSelector ? ActionSelector : (showRelationSelector && RelationSelector) }))] })), (0, jsx_runtime_1.jsx)(antd_1.Tabs, { defaultActiveKey: "1", type: "card", size: "large", items: items, onChange: function (key) { return setTab(key); } })] })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
|
||||
onEntityClicked: (entity: string) => void;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -9,13 +9,24 @@ exports.default = OakComponent({
|
|||
links: links,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
onEntityClicked: function (entity) { return undefined; },
|
||||
},
|
||||
methods: {
|
||||
onEntityClicked: function (entity) {
|
||||
this.features.navigator.navigateTo({
|
||||
url: '/relation/entity',
|
||||
}, {
|
||||
entity: entity,
|
||||
});
|
||||
if (this.props.onEntityClicked) {
|
||||
this.props.onEntityClicked(entity);
|
||||
}
|
||||
else {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.warn('直接使用relation/entityList作为page用法即将废除,请使用自定义页面包裹');
|
||||
}
|
||||
this.features.navigator.navigateTo({
|
||||
url: '/relation/entity',
|
||||
}, {
|
||||
entity: entity,
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ var antd_1 = require("antd");
|
|||
var echarts_for_react_1 = tslib_1.__importDefault(require("echarts-for-react"));
|
||||
var react_1 = require("react");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var web_pc_module_less_1 = tslib_1.__importDefault(require("./web.pc.module.less"));
|
||||
function render(props) {
|
||||
var _a = props.data, data = _a.data, links = _a.links;
|
||||
var onEntityClicked = props.methods.onEntityClicked;
|
||||
|
|
@ -39,12 +40,12 @@ function render(props) {
|
|||
});
|
||||
}
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ style: {
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_pc_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ style: {
|
||||
margin: 20,
|
||||
} }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "filter" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (_a) {
|
||||
var currentTarget = _a.currentTarget;
|
||||
return setSearch(currentTarget.value);
|
||||
}, allowClear: true }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "strict mode" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Switch, { checked: strict, onChange: function (checked) { return setStrict(checked); } }) }) }))] })), (0, jsx_runtime_1.jsx)(echarts_for_react_1.default, { style: { width: '100%', height: '100%' }, option: {
|
||||
}, allowClear: true }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "strict mode" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Switch, { checked: strict, onChange: function (checked) { return setStrict(checked); } }) }) }))] })), (0, jsx_runtime_1.jsx)(echarts_for_react_1.default, { style: { width: '100%', height: '100%', minHeight: 750 }, option: {
|
||||
tooltip: {},
|
||||
series: [
|
||||
{
|
||||
|
|
@ -91,6 +92,6 @@ function render(props) {
|
|||
onEntityClicked(name_1);
|
||||
}
|
||||
},
|
||||
} })] }));
|
||||
} })] })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -242,6 +242,8 @@ export declare type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'a
|
|||
export declare type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation';
|
||||
export declare type WebComponentProps<ED extends EntityDict & BaseEntityDict, T extends keyof ED, IsList extends boolean, TData extends DataOption = {}, TMethod extends MethodOption = {}> = {
|
||||
methods: TMethod & OakCommonComponentMethods<ED, T> & OakListComponentMethods<ED, T> & OakSingleComponentMethods<ED, T>;
|
||||
data: TData & OakComponentData<ED, T> & (IsList extends true ? OakListComoponetData<ED, T> : {});
|
||||
data: TData & OakComponentData<ED, T> & (IsList extends true ? OakListComoponetData<ED, T> : {
|
||||
oakId?: string;
|
||||
});
|
||||
};
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default OakComponent({
|
|||
currentPage: 0,
|
||||
},
|
||||
formData({ data: rows }) {
|
||||
console.log(this.props.path);
|
||||
// console.log(this.props.path);
|
||||
return {
|
||||
rows
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-container);
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import ActionAuth from '../actionAuth';
|
|||
import RelationAuth from '../relationAuth';
|
||||
import { WebComponentProps } from '../../../types/Page';
|
||||
import { useState } from 'react';
|
||||
import ActionAuthSingle from '../../../components/relation/single';
|
||||
import Styles from './web.pc.module.less';
|
||||
|
||||
type ED = EntityDict & BaseEntityDict;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ export default function render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
}
|
||||
];
|
||||
|
||||
if (hasDirectActionAuth) {
|
||||
/* if (hasDirectActionAuth) {
|
||||
items.push(
|
||||
{
|
||||
label: 'directActionAuth',
|
||||
|
|
@ -95,7 +95,7 @@ export default function render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
} */
|
||||
|
||||
if (relations?.length > 0) {
|
||||
items.push(
|
||||
|
|
@ -149,7 +149,7 @@ export default function render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
const showRelationSelector = ['relationAuth', 'directRelationAuth'].includes(tab);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={Styles.container}>
|
||||
<Row justify="center" style={{ margin: 20, padding: 10, minHeight: 100 }} align="middle">
|
||||
<Col span={8}>
|
||||
<Row style={{ width: '100%' }} justify="center" align="middle">
|
||||
|
|
@ -168,6 +168,6 @@ export default function render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
items={items}
|
||||
onChange={(key) => setTab(key)}
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -9,13 +9,24 @@ export default OakComponent({
|
|||
links,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
onEntityClicked: (entity: string) => undefined as void,
|
||||
},
|
||||
methods: {
|
||||
onEntityClicked(entity: string) {
|
||||
this.features.navigator.navigateTo({
|
||||
url: '/relation/entity',
|
||||
}, {
|
||||
entity,
|
||||
});
|
||||
if (this.props.onEntityClicked) {
|
||||
this.props.onEntityClicked(entity);
|
||||
}
|
||||
else {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.warn('直接使用relation/entityList作为page用法即将废除,请使用自定义页面包裹');
|
||||
}
|
||||
this.features.navigator.navigateTo({
|
||||
url: '/relation/entity',
|
||||
}, {
|
||||
entity,
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.container {
|
||||
background-color: var(--oak-bg-color-container);
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import { Row, Switch, Col, Input, Form } from 'antd';
|
|||
import ReactEcharts from 'echarts-for-react';
|
||||
import { useState } from 'react';
|
||||
import { uniq } from 'oak-domain/lib/utils/lodash';
|
||||
import Styles from './web.pc.module.less';
|
||||
|
||||
type ED = EntityDict & BaseEntityDict;
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ export default function render(
|
|||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={Styles.container}>
|
||||
<Form
|
||||
style={{
|
||||
margin: 20,
|
||||
|
|
@ -94,7 +95,7 @@ export default function render(
|
|||
</Form.Item>
|
||||
</Form>
|
||||
<ReactEcharts
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
style={{ width: '100%', height: '100%', minHeight: 750 }}
|
||||
option={{
|
||||
tooltip: {},
|
||||
series: [
|
||||
|
|
@ -147,6 +148,6 @@ export default function render(
|
|||
},
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -519,5 +519,7 @@ export type WebComponentProps<
|
|||
TMethod extends MethodOption = {}> = {
|
||||
methods: TMethod & OakCommonComponentMethods<ED, T>
|
||||
& OakListComponentMethods<ED, T> & OakSingleComponentMethods<ED, T>;
|
||||
data: TData & OakComponentData<ED, T> & (IsList extends true ? OakListComoponetData<ED, T> : {});
|
||||
data: TData & OakComponentData<ED, T> & (IsList extends true ? OakListComoponetData<ED, T> : {
|
||||
oakId?: string;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue