新增地铁管理

This commit is contained in:
wangcheng 2023-04-27 11:32:25 +08:00
parent 08ea90acd8
commit f01a7eff15
47 changed files with 5493 additions and 5011 deletions

View File

@ -0,0 +1,8 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "station", false, {
openStation: boolean;
onClose: () => void;
subwayId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
entity: 'station',
projection: {
id: 1,
name: 1,
},
isList: false,
formData: function (_a) {
var station = _a.data, features = _a.features;
return {
id: station === null || station === void 0 ? void 0 : station.id,
name: station === null || station === void 0 ? void 0 : station.name,
};
},
filters: [],
properties: {
openStation: false,
onClose: function () { return undefined; },
subwayId: '',
},
data: {},
lifetimes: {
ready: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
return [2 /*return*/];
}); });
},
},
methods: {},
});

View File

@ -0,0 +1,10 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'station', false, {
oakId: string;
name: string;
onClose: () => void;
openStation: boolean;
subwayId: string;
}, {}>): JSX.Element;

View File

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
function Render(props) {
var _this = this;
var methods = props.methods, data = props.data;
var t = methods.t;
var oakFullpath = data.oakFullpath, oakId = data.oakId, name = data.name, openStation = data.openStation, onClose = data.onClose, subwayId = data.subwayId;
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: oakId ? '编辑站点' : '新增站点', open: openStation, destroyOnClose: true, okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88", onOk: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
// if (!subwayId) {
// methods.update({ subwayId, });
// }
methods.execute();
onClose();
return [2 /*return*/];
});
}); }, onCancel: function () {
onClose();
} }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u7AD9\u70B9\u540D\u79F0", value: name, onChange: function (_a) {
var value = _a.target.value;
methods.update({ name: value });
} }) }) })) }));
}
exports.default = Render;

View File

@ -0,0 +1,7 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "subway", false, {
openSubway: boolean;
onClose: () => void;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
entity: 'subway',
projection: {
id: 1,
name: 1,
},
isList: false,
formData: function (_a) {
var subway = _a.data, features = _a.features;
return {
id: subway === null || subway === void 0 ? void 0 : subway.id,
name: subway === null || subway === void 0 ? void 0 : subway.name,
};
},
filters: [],
properties: {
openSubway: false,
onClose: function () { return undefined; },
},
data: {},
lifetimes: {
ready: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
return [2 /*return*/];
}); });
},
},
methods: {},
});

View File

@ -0,0 +1,9 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'subway', false, {
oakId: string;
name: string;
onClose: () => void;
openSubway: boolean;
}, {}>): JSX.Element;

View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
function Render(props) {
var _this = this;
var methods = props.methods, data = props.data;
var t = methods.t;
var oakFullpath = data.oakFullpath, oakId = data.oakId, name = data.name, openSubway = data.openSubway, onClose = data.onClose;
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: oakId ? '编辑地铁' : '新增地铁', open: openSubway, destroyOnClose: true, okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88", onOk: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
methods.execute();
onClose();
return [2 /*return*/];
});
}); }, onCancel: function () {
onClose();
} }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u7EBF\u8DEF\u540D\u79F0", value: name, onChange: function (_a) {
var value = _a.target.value;
methods.update({ name: value });
} }) }) })) }));
}
exports.default = Render;

View File

@ -1,2 +1,2 @@
import { CreateOperationData as Station } from "../general-app-domain/Station/Schema";
import { CreateOperationData as Station } from '../general-app-domain/Station/Schema';
export declare const station: Station[];

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,2 @@
import { CreateOperationData as Subway } from "../general-app-domain/Subway/Schema";
import { CreateOperationData as Subway } from '../general-app-domain/Subway/Schema';
export declare const subway: Subway[];

View File

@ -3,93 +3,78 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.subway = void 0;
exports.subway = [
{
id: "330100023133",
name: "1号线",
areaId: "330100",
id: '330100023133',
name: '1号线',
areaId: '330100',
},
{
id: "330100023132",
name: "1号线",
areaId: "330100",
id: '900000150789',
name: '绍兴1号线',
areaId: '330100',
},
{
id: "900000150789",
name: "绍兴1号线",
areaId: "330100",
id: '330100020003',
name: '2号线',
areaId: '330100',
},
{
id: "330100020003",
name: "2号线",
areaId: "330100",
id: '900000092651',
name: '3号线',
areaId: '330100',
},
{
id: "900000092651",
name: "3号线",
areaId: "330100",
id: '900000029624',
name: '4号线',
areaId: '330100',
},
{
id: "900000096933",
name: "3号线",
areaId: "330100",
id: '900000065767',
name: '5号线',
areaId: '330100',
},
{
id: "900000029624",
name: "4号线",
areaId: "330100",
id: '900000073754',
name: '6号线',
areaId: '330100',
},
{
id: "900000065767",
name: "5号线",
areaId: "330100",
id: '900000099060',
name: '7号线',
areaId: '330100',
},
{
id: "900000073754",
name: "6号线",
areaId: "330100",
id: '900000099066',
name: '8号线',
areaId: '330100',
},
{
id: "900000062493",
name: "6号线",
areaId: "330100",
id: '900000166808',
name: '9号线',
areaId: '330100',
},
{
id: "900000099060",
name: "7号线",
areaId: "330100",
id: '900000122963',
name: '10号线',
areaId: '330100',
},
{
id: "900000099066",
name: "8号线",
areaId: "330100",
id: '900000130963',
name: '16号线',
areaId: '330100',
},
{
id: "900000166808",
name: "9号线",
areaId: "330100",
id: '900000101230',
name: '19号线',
areaId: '330100',
},
{
id: "900000122963",
name: "10号线",
areaId: "330100",
id: '900000150702',
name: '杭海城际',
areaId: '330100',
},
{
id: "900000130963",
name: "16号线",
areaId: "330100",
},
{
id: "900000101230",
name: "19号线",
areaId: "330100",
},
{
id: "900000150702",
name: "杭海城际",
areaId: "330100",
},
{
id: "900000109349",
name: "S1线",
areaId: "330300",
id: '900000109349',
name: 'S1线',
areaId: '330300',
},
];

View File

@ -1,2 +1,2 @@
import { CreateOperationData as SubwayStation } from "../general-app-domain/SubwayStation/Schema";
import { CreateOperationData as SubwayStation } from '../general-app-domain/SubwayStation/Schema';
export declare const subwayStation: SubwayStation[];

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ exports.default = OakComponent({
},
},
],
actions: ['visit'],
sorters: [
{
sorter: function () {
@ -48,17 +49,15 @@ exports.default = OakComponent({
],
formData: function (_a) {
var messages = _a.data, features = _a.features, props = _a.props;
var pagination = this.getPagination();
return {
messages: messages,
pagination: pagination,
};
},
lifetimes: {
attached: function () {
var _this = this;
this.subscribed.push(this.features.token.subscribe(function () { return _this.reRender(); }));
}
},
},
methods: {
goDetailById: function (id) {

View File

@ -1,13 +1,8 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', true, {
pagination?: {
pageSize: number;
total: number;
currentPage: number;
};
messages: EntityDict['message']['Schema'][];
messages: RowWithActions<EntityDict, 'message'>[];
}, {
goDetailById: (id: string) => void;
}>): JSX.Element;

View File

@ -6,16 +6,17 @@ var antd_1 = require("antd");
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
var cellButton_1 = tslib_1.__importDefault(require("../../../components/message/cellButton"));
var actionBtnPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/lib/components/actionBtnPanel"));
var MessageType = {
adminNotification: '系统通知',
conversationMessage: '客服消息',
};
function Render(props) {
var _this = this;
var data = props.data, methods = props.methods;
var t = methods.t, setPageSize = methods.setPageSize, setCurrentPage = methods.setCurrentPage, goDetailById = methods.goDetailById;
var messages = data.messages, oakFullpath = data.oakFullpath, oakLoading = data.oakLoading, pagination = data.pagination;
var _a = pagination || {}, pageSize = _a.pageSize, total = _a.total, currentPage = _a.currentPage;
var messages = data.messages, oakFullpath = data.oakFullpath, oakLoading = data.oakLoading, oakPagination = data.oakPagination;
var _a = oakPagination || {}, pageSize = _a.pageSize, total = _a.total, currentPage = _a.currentPage;
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u6D88\u606F\u901A\u77E5" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: messages || [], rowKey: "id",
// scroll={{ x: 1200 }}
columns: [
@ -67,9 +68,31 @@ function Render(props) {
title: '操作',
align: 'center',
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ wrap: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
goDetailById(record === null || record === void 0 ? void 0 : record.id);
} }, { children: "\u8BE6\u60C5" })), (0, jsx_runtime_1.jsx)(cellButton_1.default, { oakId: record.id, oakPath: "".concat(oakFullpath, ".").concat(record.id) })] })));
var _a;
return ((0, jsx_runtime_1.jsx)(actionBtnPanel_1.default, { mode: "table-cell", entity: "message", items: [
{
label: '详情',
onClick: function () {
goDetailById(record.id);
},
},
{
action: 'visit',
show: (_a = record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('visit'),
onClick: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
methods.updateItem({}, record.id, 'visit');
return [4 /*yield*/, methods.execute()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); },
},
] }));
},
fixed: 'right',
},

4
lib/pages/subwayLine/list/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "subway", true, {}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,125 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
entity: 'subway',
projection: {
id: 1,
name: 1,
areaId: 1,
subwayStation$subway: {
$entity: 'subwayStation',
data: {
id: 1,
subwayId: 1,
stationId: 1,
station: {
id: 1,
name: 1,
}
}
}
},
pagination: {
currentPage: 1,
pageSize: 100,
more: true,
},
isList: true,
data: {
areaId: '330100',
areaOptions: [],
},
properties: {},
filters: [
{
filter: function () {
return {
areaId: '330100'
};
},
'#name': 'area',
},
// {
// filter() {
// return {
// };
// },
// '#name': 'type',
// },
],
listeners: {},
formData: function (_a) {
var subway = _a.data;
var treeData = subway
// ?.filter((ele) => !ele!.subwayStation$subway)
.map(function (ele) {
return {
title: ele.name,
key: ele.id,
isLeaf: false,
children: ele.subwayStation$subway
.map(function (ele2) { return ({
title: ele2.station.name,
key: "".concat(ele.id, "/").concat(ele2.station.id),
isLeaf: true,
}); }) || [],
};
});
return {
treeData: treeData,
};
},
lifetimes: {
ready: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var area, areaOptions;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.features.cache.refresh('area', {
data: {
id: 1,
name: 1,
level: 1,
subway$areaId: {
$entity: 'subway',
data: {
id: 1
}
}
},
filter: {
level: 'city',
},
})];
case 1:
area = (_a.sent()).data;
areaOptions = area === null || area === void 0 ? void 0 : area.map(function (ele) { return ({
label: ele.name,
value: ele.id,
}); });
this.setState({
areaOptions: areaOptions,
});
return [2 /*return*/];
}
});
});
},
},
methods: {
setFilterByAreaId: function (areaId) {
this.addNamedFilter({
filter: {
areaId: areaId,
},
'#name': 'area',
}, true);
},
setAreaId: function (areaId) {
this.setState({
areaId: areaId,
});
}
},
});

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "地铁线路管理",
"usingComponents": {}
}

View File

@ -0,0 +1,9 @@
{
"add": "创建",
"search": "搜索",
"entrepreneurial": "创业服务",
"industry": "产业服务",
"knowledge": "知识分享",
"attractInvestment": "招商服务",
"other": "其他"
}

15
lib/pages/subwayLine/list/web.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
import { DataNode } from 'antd/es/tree';
export default function Render(props: WebComponentProps<EntityDict, 'subway', true, {
treeData: DataNode[];
areaId: string;
areaOptions: {
label: string;
value: string;
}[];
}, {
setAreaId: (areaId: string) => void;
setFilterByAreaId: (areaId: string) => void;
}>): JSX.Element;

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var upsertSubway_1 = tslib_1.__importDefault(require("../../../components/subwayLine/upsertSubway"));
var upsertStation_1 = tslib_1.__importDefault(require("../../../components/subwayLine/upsertStation"));
function Render(props) {
var data = props.data, methods = props.methods;
var oakFullpath = data.oakFullpath, treeData = data.treeData, areaOptions = data.areaOptions, areaId = data.areaId;
var t = methods.t, setAreaId = methods.setAreaId, setFilterByAreaId = methods.setFilterByAreaId;
var _a = tslib_1.__read((0, react_1.useState)(false), 2), openSubway = _a[0], setSubway = _a[1];
var _b = tslib_1.__read((0, react_1.useState)(false), 2), openStation = _b[0], setStation = _b[1];
var _c = tslib_1.__read((0, react_1.useState)(''), 2), subwayId = _c[0], setSubwayId = _c[1];
var _d = tslib_1.__read((0, react_1.useState)(''), 2), stationId = _d[0], setStationId = _d[1];
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5730\u94C1\u7EBF\u8DEF\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)("div", { children: ["\u70B9\u51FB\u5207\u6362\u57CE\u5E02\uFF1A", (0, jsx_runtime_1.jsx)(antd_1.Select, { placeholder: '切换城市', value: areaId, onChange: function (value) {
setAreaId(value);
setFilterByAreaId(value);
}, style: { width: '20%' }, options: areaOptions, allowClear: true })] }), (0, jsx_runtime_1.jsx)(antd_1.Tree, { className: web_module_less_1.default.tree, blockNode: true, treeData: treeData, titleRender: function (nodeData) {
return ((0, jsx_runtime_1.jsxs)(antd_1.Row, tslib_1.__assign({ align: "middle", style: { flex: 1 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "auto" }, { children: nodeData.title })), (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ flex: "none" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Space, { children: !nodeData.isLeaf ? (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
setSubwayId(nodeData.key);
setSubway(true);
} }, { children: "\u7F16\u8F91" })) :
(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
var index = nodeData.key.indexOf('/') + 1;
var temp = nodeData.key.substr(index);
setStationId(temp);
setStation(true);
} }, { children: "\u7F16\u8F91" })) }) }))] })));
} }), openSubway && ((0, jsx_runtime_1.jsx)(upsertSubway_1.default, { onClose: function () { return setSubway(false); }, openSubway: openSubway, oakId: subwayId, oakPath: "".concat(oakFullpath, ".").concat(subwayId), oakAutoUnmount: true })), openStation && ((0, jsx_runtime_1.jsx)(upsertStation_1.default, { onClose: function () { return setStation(false); }, openStation: openStation, oakId: stationId, subwayId: subwayId, oakPath: "$subwayLine/upsertStation,".concat(stationId), oakAutoUnmount: true }))] })) })));
}
exports.default = Render;

View File

@ -0,0 +1,4 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, keyof import("../../../general-app-domain").EntityDict, false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,161 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
entity: 'service',
projection: {
id: 1,
areaId: 1,
name: 1,
parentId: 1,
parent: {
id: 1,
areaId: 1,
name: 1,
regToYearValue: 1,
regToYearUnit: 1,
type: 1,
},
regToYearValue: 1,
regToYearUnit: 1,
type: 1,
show: 1,
description: 1,
extraFile$entity: {
$entity: 'extraFile',
data: {
id: 1,
tag1: 1,
origin: 1,
bucket: 1,
objectId: 1,
filename: 1,
extra1: 1,
extension: 1,
type: 1,
entity: 1,
},
filter: {
tag1: 'icon',
},
},
},
isList: false,
formData: function (_a) {
var _b;
var service = _a.data;
return {
name: service === null || service === void 0 ? void 0 : service.name,
areaId: service === null || service === void 0 ? void 0 : service.areaId,
parentId: service === null || service === void 0 ? void 0 : service.parentId,
regToYearValue: service === null || service === void 0 ? void 0 : service.regToYearValue,
regToYearUnit: service === null || service === void 0 ? void 0 : service.regToYearUnit,
type: service === null || service === void 0 ? void 0 : service.type,
parentName: (_b = service === null || service === void 0 ? void 0 : service.parent) === null || _b === void 0 ? void 0 : _b.name,
description: service === null || service === void 0 ? void 0 : service.description,
show: service === null || service === void 0 ? void 0 : service.show,
};
},
data: {
typeArr: [
{
label: '创业服务',
value: 'entrepreneurial',
},
{
label: '产业服务',
value: 'industry',
},
{
label: '招商服务',
value: 'attractInvestment',
},
{
label: '其他',
value: 'other',
},
],
},
lifetimes: {
ready: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, parentId, oakId, _b, service;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
_a = this.props, parentId = _a.parentId, oakId = _a.oakId;
if (!!oakId) return [3 /*break*/, 3];
if (!parentId) return [3 /*break*/, 2];
return [4 /*yield*/, this.features.cache.refresh('service', {
data: {
id: 1,
type: 1,
show: 1,
},
filter: {
id: parentId,
},
})];
case 1:
_b = tslib_1.__read.apply(void 0, [(_c.sent()).data, 1]), service = _b[0];
if (service) {
this.update({
parentId: parentId,
type: service.type,
show: service.show,
});
}
return [3 /*break*/, 3];
case 2:
this.update({
type: 'entrepreneurial',
show: 'shop',
});
_c.label = 3;
case 3: return [2 /*return*/];
}
});
});
},
},
methods: {
confirm: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.state.type) {
this.setMessage({
type: 'error',
content: '请选择类型',
});
return [2 /*return*/];
}
if (!this.state.name) {
this.setMessage({
type: 'error',
content: '请输入服务名称',
});
return [2 /*return*/];
}
if (!this.state.show) {
this.setMessage({
type: 'error',
content: '请选择展示形式',
});
return [2 /*return*/];
}
return [4 /*yield*/, this.execute()];
case 1:
_a.sent();
this.navigateBack();
return [2 /*return*/];
}
});
});
},
reset: function () {
this.clean();
},
},
});

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "创建服务",
"usingComponents": {}
}

19
lib/pages/subwayLine/upsert/web.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '@oak-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'service', false, {
parentId?: string;
parentName: string;
type: string;
description: string;
name: string;
typeArr: Array<{
label: string;
value: string;
}>;
oakId: string;
show: string;
}, {
confirm: () => void;
reset: () => void;
}>): JSX.Element;

View File

@ -0,0 +1,99 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var gallery_1 = tslib_1.__importDefault(require("@oak-general-business/components/extraFile/gallery"));
var pageHeader_1 = tslib_1.__importDefault(require("@oak-general-business/components/common/pageHeader"));
var TextArea = antd_1.Input.TextArea;
function render(props) {
var data = props.data, methods = props.methods;
var t = methods.t, update = methods.update, reset = methods.reset, confirm = methods.confirm;
var oakId = data.oakId, oakFullpath = data.oakFullpath, parentId = data.parentId, parentName = data.parentName, type = data.type, description = data.description, name = data.name, typeArr = data.typeArr, show = data.show;
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u6DFB\u52A0\u670D\u52A1" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 16 }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 20 } }, { children: [parentId ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.parent'), name: "parent" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { children: parentName }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.name'), name: "name", rules: [
{
required: true,
message: '服务名称必填',
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u670D\u52A1\u540D\u79F0", onChange: function (e) {
update({
name: e.target.value,
});
}, value: name }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.show'), name: "show", rules: [
{
required: true,
message: "\u672A\u586B\u5199".concat(t('service:attr.show')),
},
], requiredMark: true, tooltip: "\u6D89\u53CA\u4EA7\u54C1\u521B\u5EFA\u548C\u8BE6\u60C5\u663E\u793A" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Select, { value: show, onChange: function (value) {
update({
show: value,
});
}, options: [
'shop',
'independent',
'self',
].map(function (ele) { return ({
label: t("service:v.show.".concat(ele)),
value: ele,
}); }) }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.description'), name: "description" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TextArea, { placeholder: "\u8BF7\u8F93\u5165\u63CF\u8FF0(\u9009\u586B)", value: description, onChange: function (e) {
update({
description: e.target.value,
});
}, maxLength: 200, autoSize: {
minRows: 2,
maxRows: 6,
} }) }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.type'), name: "type", rules: [
{
required: true,
message: "\u672A\u586B\u5199".concat(t('service:attr.type')),
},
], requiredMark: true }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Select, { value: type, onChange: function (value) {
update({
type: value,
});
}, options: typeArr }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.name'), name: "name", rules: [
{
required: true,
message: '服务名称必填',
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165\u670D\u52A1\u540D\u79F0", onChange: function (e) {
update({
name: e.target.value,
});
}, value: name }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.show'), name: "show", rules: [
{
required: true,
message: "\u672A\u586B\u5199".concat(t('service:attr.show')),
},
], requiredMark: true, tooltip: "\u6D89\u53CA\u4EA7\u54C1\u521B\u5EFA\u548C\u8BE6\u60C5\u663E\u793A" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Select, { value: show, onChange: function (value) {
update({
show: value,
});
}, options: [
'shop',
'independent',
'self',
].map(function (ele) { return ({
label: t("service:v.show.".concat(ele)),
value: ele,
}); }) }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u56FE\u6807", rules: [
{
required: true,
},
], help: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.help }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u4EC5\u652F\u6301SVG\u683C\u5F0F\u3002" }) })) }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { accept: ".svg, .SVG", oakPath: oakFullpath
? "".concat(oakFullpath, ".extraFile$entity")
: undefined, type: "image", origin: "qiniu", tag1: "icon", entity: "service" }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('service:attr.description'), name: "description" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TextArea, { showCount: true, placeholder: "\u8BF7\u8F93\u5165\u63CF\u8FF0(\u9009\u586B)", value: description, onChange: function (e) {
update({
description: e.target.value,
});
}, maxLength: 200, autoSize: {
minRows: 2,
maxRows: 6,
} }) }) }))] })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
confirm();
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
reset();
} }, { children: "\u91CD\u7F6E" }))] }) }))] })) })) }) })) })));
}
exports.default = render;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
[{"id":"330100023133","name":"1号线","areaId":"330100"},{"id":"330100023132","name":"1号线","areaId":"330100"},{"id":"900000150789","name":"绍兴1号线","areaId":"330100"},{"id":"330100020003","name":"2号线","areaId":"330100"},{"id":"900000092651","name":"3号线","areaId":"330100"},{"id":"900000096933","name":"3号线","areaId":"330100"},{"id":"900000029624","name":"4号线","areaId":"330100"},{"id":"900000065767","name":"5号线","areaId":"330100"},{"id":"900000073754","name":"6号线","areaId":"330100"},{"id":"900000062493","name":"6号线","areaId":"330100"},{"id":"900000099060","name":"7号线","areaId":"330100"},{"id":"900000099066","name":"8号线","areaId":"330100"},{"id":"900000166808","name":"9号线","areaId":"330100"},{"id":"900000122963","name":"10号线","areaId":"330100"},{"id":"900000130963","name":"16号线","areaId":"330100"},{"id":"900000101230","name":"19号线","areaId":"330100"},{"id":"900000150702","name":"杭海城际","areaId":"330100"},{"id":"900000109349","name":"S1线","areaId":"330300"}]
[{"id":"330100023133","name":"1号线","areaId":"330100"},{"id":"900000150789","name":"绍兴1号线","areaId":"330100"},{"id":"330100020003","name":"2号线","areaId":"330100"},{"id":"900000092651","name":"3号线","areaId":"330100"},{"id":"900000029624","name":"4号线","areaId":"330100"},{"id":"900000065767","name":"5号线","areaId":"330100"},{"id":"900000073754","name":"6号线","areaId":"330100"},{"id":"900000099060","name":"7号线","areaId":"330100"},{"id":"900000099066","name":"8号线","areaId":"330100"},{"id":"900000166808","name":"9号线","areaId":"330100"},{"id":"900000122963","name":"10号线","areaId":"330100"},{"id":"900000130963","name":"16号线","areaId":"330100"},{"id":"900000101230","name":"19号线","areaId":"330100"},{"id":"900000150702","name":"杭海城际","areaId":"330100"},{"id":"900000109349","name":"S1线","areaId":"330300"}]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,103 @@
@import "../../../config/styles/mp/mixins.less";
.container {
padding-top: 100rpx;
display: flex;
flex-direction: column;
flex: 1;
background-color: #f7f8fb;
min-height: 100vh;
.safe-area-inset-bottom()
}
.stickyView {
box-sizing: border-box;
padding: 20rpx;
border-bottom: 1px solid rgba(200, 200, 200, 0.3);
position: fixed;
top: 0;
width: 750rpx;
display: flex;
align-items: center;
background-color: #fff;
z-index: 999;
}
.addText {
padding-left: 20rpx;
color: var(--oak-color-primary);
white-space: nowrap;
display: flex;
align-items: center;
justify-content: center;
}
.card {
margin: 20rpx;
margin-bottom: 0rpx;
border-radius: 20rpx;
display: flex;
flex-direction: column;
background-color: #fff;
.title-view {
padding: 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
display: flex;
align-items: center;
font-weight: 600;
}
}
.card-content {
padding: 32rpx;
padding-top: 0rpx;
display: flex;
flex-direction: column;
}
.card-op {
border-top: 0.8px solid rgba(200, 200, 200, 0.2);
height: 80rpx;
display: flex;
align-items: center;
}
.card-btn {
color: var(--oak-color-primary);
display: flex;
flex: 1;
align-items: center;
justify-content: center;
}
.text-view {
display: flex;
align-items: center;
justify-content: space-between;
.label {
color: #888;
}
}
.state-view {
display: flex;
align-items: center;
}
.badge {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background-color: var(--oak-color-success);
margin-right: 5px;
}
.success {
background-color: var(--oak-color-success);
}
.failed {
background-color: var(--oak-color-error);
}
.inCharge {
background-color: var(--oak-color-primary);
}
.init {
background-color: var(--oak-color-warning);
}
}
[class='text-view']:not(:last-child) {
margin-bottom: 16rpx;
}

View File

@ -0,0 +1,29 @@
import { EntityDict } from '../../../general-app-domain';
export default OakComponent({
entity: 'station',
projection: {
id: 1,
name: 1,
},
isList: false,
formData({ data: station, features }) {
return {
id: station?.id,
name: station?.name,
};
},
filters: [],
properties: {
openStation: false,
onClose: () => undefined as void,
subwayId: '' as string,
},
data: {
},
lifetimes: {
async ready() { },
},
methods: {},
});

View File

@ -0,0 +1,6 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -0,0 +1,70 @@
import React, { useState } from 'react';
import { Table, Tag, Button, Space, Input, Modal, Col, Row, Select, Tabs } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import dayjs from 'dayjs';
import Style from './web.module.less';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(
props: WebComponentProps<
EntityDict,
'station',
false,
{
oakId: string,
name: string,
onClose: () => void;
openStation: boolean;
subwayId: string;
},
{}
>
) {
const { methods, data, } = props;
const {
t,
} = methods;
const {
oakFullpath,
oakId,
name,
openStation,
onClose,
subwayId,
} = data;
return (
<div>
<Modal
title={oakId ? '编辑站点' : '新增站点'}
open={openStation}
destroyOnClose={true}
okText="确定"
cancelText="取消"
onOk={async () => {
// if (!subwayId) {
// methods.update({ subwayId, });
// }
methods.execute();
onClose();
}}
onCancel={() => {
onClose();
}}
>
<>
<Input
placeholder="请输入站点名称"
value={name}
onChange={({ target: { value } }) => {
methods.update({ name: value });
}}
/>
</>
</Modal>
</div>
);
}

View File

@ -0,0 +1,103 @@
@import "../../../config/styles/mp/mixins.less";
.container {
padding-top: 100rpx;
display: flex;
flex-direction: column;
flex: 1;
background-color: #f7f8fb;
min-height: 100vh;
.safe-area-inset-bottom()
}
.stickyView {
box-sizing: border-box;
padding: 20rpx;
border-bottom: 1px solid rgba(200, 200, 200, 0.3);
position: fixed;
top: 0;
width: 750rpx;
display: flex;
align-items: center;
background-color: #fff;
z-index: 999;
}
.addText {
padding-left: 20rpx;
color: var(--oak-color-primary);
white-space: nowrap;
display: flex;
align-items: center;
justify-content: center;
}
.card {
margin: 20rpx;
margin-bottom: 0rpx;
border-radius: 20rpx;
display: flex;
flex-direction: column;
background-color: #fff;
.title-view {
padding: 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
display: flex;
align-items: center;
font-weight: 600;
}
}
.card-content {
padding: 32rpx;
padding-top: 0rpx;
display: flex;
flex-direction: column;
}
.card-op {
border-top: 0.8px solid rgba(200, 200, 200, 0.2);
height: 80rpx;
display: flex;
align-items: center;
}
.card-btn {
color: var(--oak-color-primary);
display: flex;
flex: 1;
align-items: center;
justify-content: center;
}
.text-view {
display: flex;
align-items: center;
justify-content: space-between;
.label {
color: #888;
}
}
.state-view {
display: flex;
align-items: center;
}
.badge {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background-color: var(--oak-color-success);
margin-right: 5px;
}
.success {
background-color: var(--oak-color-success);
}
.failed {
background-color: var(--oak-color-error);
}
.inCharge {
background-color: var(--oak-color-primary);
}
.init {
background-color: var(--oak-color-warning);
}
}
[class='text-view']:not(:last-child) {
margin-bottom: 16rpx;
}

View File

@ -0,0 +1,28 @@
import { EntityDict } from '../../../general-app-domain';
export default OakComponent({
entity: 'subway',
projection: {
id: 1,
name: 1,
},
isList: false,
formData({ data: subway, features }) {
return {
id: subway?.id,
name: subway?.name,
};
},
filters: [],
properties: {
openSubway: false,
onClose: () => undefined as void,
},
data: {
},
lifetimes: {
async ready() { },
},
methods: {},
});

View File

@ -0,0 +1,6 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -0,0 +1,64 @@
import React, { useState } from 'react';
import { Table, Tag, Button, Space, Input, Modal, Col, Row, Select, Tabs } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import dayjs from 'dayjs';
import Style from './web.module.less';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(
props: WebComponentProps<
EntityDict,
'subway',
false,
{
oakId: string,
name: string,
onClose: () => void;
openSubway: boolean;
},
{}
>
) {
const { methods, data, } = props;
const {
t,
} = methods;
const {
oakFullpath,
oakId,
name,
openSubway,
onClose,
} = data;
return (
<div>
<Modal
title={oakId ? '编辑地铁' : '新增地铁'}
open={openSubway}
destroyOnClose={true}
okText="确定"
cancelText="取消"
onOk={async () => {
methods.execute();
onClose();
}}
onCancel={() => {
onClose();
}}
>
<>
<Input
placeholder="请输入线路名称"
value={name}
onChange={({ target: { value } }) => {
methods.update({ name: value });
}}
/>
</>
</Modal>
</div>
);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +1,78 @@
import { CreateOperationData as Subway } from "../general-app-domain/Subway/Schema";
import { CreateOperationData as Subway } from '../general-app-domain/Subway/Schema';
export const subway: Subway[] = [
{
id: "330100023133",
name: "1号线",
areaId: "330100",
id: '330100023133',
name: '1号线',
areaId: '330100',
},
{
id: "330100023132",
name: "1号线",
areaId: "330100",
id: '900000150789',
name: '绍兴1号线',
areaId: '330100',
},
{
id: "900000150789",
name: "绍兴1号线",
areaId: "330100",
id: '330100020003',
name: '2号线',
areaId: '330100',
},
{
id: "330100020003",
name: "2号线",
areaId: "330100",
id: '900000092651',
name: '3号线',
areaId: '330100',
},
{
id: "900000092651",
name: "3号线",
areaId: "330100",
id: '900000029624',
name: '4号线',
areaId: '330100',
},
{
id: "900000096933",
name: "3号线",
areaId: "330100",
id: '900000065767',
name: '5号线',
areaId: '330100',
},
{
id: "900000029624",
name: "4号线",
areaId: "330100",
id: '900000073754',
name: '6号线',
areaId: '330100',
},
{
id: "900000065767",
name: "5号线",
areaId: "330100",
id: '900000099060',
name: '7号线',
areaId: '330100',
},
{
id: "900000073754",
name: "6号线",
areaId: "330100",
id: '900000099066',
name: '8号线',
areaId: '330100',
},
{
id: "900000062493",
name: "6号线",
areaId: "330100",
id: '900000166808',
name: '9号线',
areaId: '330100',
},
{
id: "900000099060",
name: "7号线",
areaId: "330100",
id: '900000122963',
name: '10号线',
areaId: '330100',
},
{
id: "900000099066",
name: "8号线",
areaId: "330100",
id: '900000130963',
name: '16号线',
areaId: '330100',
},
{
id: "900000166808",
name: "9号线",
areaId: "330100",
id: '900000101230',
name: '19号线',
areaId: '330100',
},
{
id: "900000122963",
name: "10号线",
areaId: "330100",
id: '900000150702',
name: '杭海城际',
areaId: '330100',
},
{
id: "900000130963",
name: "16号线",
areaId: "330100",
},
{
id: "900000101230",
name: "19号线",
areaId: "330100",
},
{
id: "900000150702",
name: "杭海城际",
areaId: "330100",
},
{
id: "900000109349",
name: "S1线",
areaId: "330300",
id: '900000109349',
name: 'S1线',
areaId: '330300',
},
];

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "地铁线路管理",
"usingComponents": {}
}

View File

@ -0,0 +1,134 @@
// import { TreeNode } from '@project/types/interface';
import { EntityDict } from '../../../general-app-domain';
type TreeNode = {
key: string;
title: string;
children?: TreeNode[];
isLeaf?: boolean;
};
export default OakComponent({
entity: 'subway',
projection: {
id: 1,
name: 1,
areaId: 1,
subwayStation$subway: {
$entity: 'subwayStation',
data: {
id: 1,
subwayId: 1,
stationId: 1,
station: {
id: 1,
name: 1,
}
}
}
},
pagination: {
currentPage: 1,
pageSize: 100,
more: true,
},
isList: true,
data: {
areaId: '330100' as string,
areaOptions: [] as Array<{ label: string, value: string }>,
},
properties: {},
filters: [
{
filter() {
return {
areaId: '330100'
}
},
'#name': 'area',
},
// {
// filter() {
// return {
// };
// },
// '#name': 'type',
// },
],
listeners: {},
formData: ({ data: subway }) => {
const treeData: TreeNode[] = subway
// ?.filter((ele) => !ele!.subwayStation$subway)
.map((ele) => {
return {
title: ele!.name!,
key: ele!.id!,
isLeaf: false,
children:
ele.subwayStation$subway!
.map((ele2) => ({
title: ele2!.station!.name,
key: `${ele.id}/${ele2!.station!.id}`,
isLeaf: true,
})) || [],
};
});
return {
treeData,
};
},
lifetimes: {
async ready() {
const { data: area } = await this.features.cache.refresh(
'area',
{
data: {
id: 1,
name: 1,
level: 1,
subway$areaId: {
$entity: 'subway',
data: {
id: 1
}
}
},
filter: {
level: 'city',
},
}
);
const areaOptions = area?.map(
(ele: any) => ({
label: ele.name,
value: ele.id,
})
)
this.setState({
areaOptions,
});
},
},
methods: {
setFilterByAreaId(areaId: string) {
this.addNamedFilter(
{
filter: {
areaId,
},
'#name': 'area',
},
true
);
},
setAreaId(areaId: string) {
this.setState({
areaId,
})
}
},
});

View File

@ -0,0 +1,10 @@
{
"add": "创建",
"search": "搜索",
"entrepreneurial": "创业服务",
"industry": "产业服务",
"knowledge": "知识分享",
"attractInvestment": "招商服务",
"other": "其他"
}

View File

@ -0,0 +1,22 @@
/** index.wxss **/
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.space {
margin-bottom: 15px;
}
.tree {
:global {
.ant-tree-title {
display: flex;
flex: 1;
}
}
}

View File

@ -0,0 +1,157 @@
import React, { useState } from 'react';
import { Button, Space, Tree, Row, Col, Tabs, Select } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import Style from './web.module.less';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
import { DataNode } from 'antd/es/tree'
import UpsertSubway from '../../../components/subwayLine/upsertSubway';
import UpsertStation from '../../../components/subwayLine/upsertStation';
export default function Render(
props: WebComponentProps<
EntityDict,
'subway',
true,
{
treeData: DataNode[];
areaId: string;
areaOptions: { label: string; value: string }[];
},
{
setAreaId: (areaId: string) => void;
setFilterByAreaId: (areaId: string) => void;
}
>
) {
const { data, methods } = props;
const { oakFullpath, treeData, areaOptions, areaId } = data;
const { t, setAreaId, setFilterByAreaId } = methods;
const [openSubway, setSubway] = useState(false);
const [openStation, setStation] = useState(false);
const [subwayId, setSubwayId] = useState('');
const [stationId, setStationId] = useState('');
return (
<PageHeader title="地铁线路管理">
<div className={Style.container}>
{/* <Space className={Style.space}>
<Button
type="primary"
onClick={() => {
goServiceUpsert();
}}
>
</Button>
</Space> */}
<div>
<Select
placeholder={'切换城市'}
value={areaId}
onChange={(value) => {
setAreaId(value);
setFilterByAreaId(value);
}}
style={{ width: '20%' }}
options={areaOptions}
allowClear
></Select>
</div>
<Tree
className={Style.tree}
blockNode={true}
treeData={treeData}
titleRender={(nodeData) => {
return (
<Row align="middle" style={{ flex: 1 }}>
<Col flex="auto">
{(nodeData as any).title}
</Col>
<Col flex="none">
<Space>
{!nodeData.isLeaf ? <Button
onClick={() =>
{
setSubwayId((nodeData as any).key)
setSubway(true)
}
}
>
</Button> :
<Button
onClick={() =>
{
const index = (nodeData as any).key.indexOf('/') + 1;
const temp = (nodeData as any).key.substr(index);
setStationId(temp)
setStation(true)
}
}
>
</Button>
}
{/* {!nodeData.isLeaf && (
<Button
onClick={() =>
{
setSubwayId((nodeData as any).key)
setStation(true)
}
}
>
</Button>
// <Button
// type="primary"
// onClick={() =>
// goServiceUpsert(
// nodeData!
// .key as string
// )
// }
// >
// 添加站点
// </Button>
)} */}
</Space>
</Col>
</Row>
);
}}
/>
{openSubway && (
<UpsertSubway
onClose={() => setSubway(false)}
openSubway={openSubway}
oakId={subwayId}
oakPath={`${oakFullpath}.${subwayId}`}
oakAutoUnmount={true}
/>
)}
{openStation && (
<UpsertStation
onClose={() => setStation(false)}
openStation={openStation}
oakId={stationId}
subwayId={subwayId}
oakPath={`$subwayLine/upsertStation,${stationId}`}
oakAutoUnmount={true}
/>
)}
</div>
</PageHeader>
);
}