@jiangliffey/elpis 1.0.0
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/.eslintignore +3 -0
- package/.eslintrc +55 -0
- package/CLAUDE.md +81 -0
- package/README.md +200 -0
- package/app/controller/base.js +38 -0
- package/app/controller/project.js +74 -0
- package/app/controller/view.js +22 -0
- package/app/extend/logger.js +35 -0
- package/app/middleware/api-params-verify.js +81 -0
- package/app/middleware/api-sign-verify.js +35 -0
- package/app/middleware/error-handler.js +33 -0
- package/app/middleware/project-handler.js +27 -0
- package/app/middleware.js +37 -0
- package/app/pages/asserts/custom.css +12 -0
- package/app/pages/boot.js +50 -0
- package/app/pages/common/curl.js +89 -0
- package/app/pages/common/utils.js +2 -0
- package/app/pages/dashboard/complex-view/header-view/complex-view/sub-menu/sub-menu.vue +21 -0
- package/app/pages/dashboard/complex-view/header-view/header-view.vue +123 -0
- package/app/pages/dashboard/complex-view/iframe-view/iframe-view.vue +43 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue +40 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue +124 -0
- package/app/pages/dashboard/complex-view/schema-view/components/component-config.js +23 -0
- package/app/pages/dashboard/complex-view/schema-view/components/create-form/create-form.vue +87 -0
- package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue +100 -0
- package/app/pages/dashboard/complex-view/schema-view/components/edit-form/edit-form.vue +118 -0
- package/app/pages/dashboard/complex-view/schema-view/hook/schema.js +124 -0
- package/app/pages/dashboard/complex-view/schema-view/schema-view.vue +80 -0
- package/app/pages/dashboard/complex-view/sider-view/complex-view/sub-menu/sub-menu.vue +21 -0
- package/app/pages/dashboard/complex-view/sider-view/sider-view.vue +135 -0
- package/app/pages/dashboard/dashboard.vue +96 -0
- package/app/pages/dashboard/entry.dashboard.js +45 -0
- package/app/pages/dashboard/todo/todo.vue +11 -0
- package/app/pages/store/index.js +4 -0
- package/app/pages/store/menu.js +58 -0
- package/app/pages/store/project.js +14 -0
- package/app/pages/widgets/header-container/asserts/avatar.png +0 -0
- package/app/pages/widgets/header-container/asserts/logo.png +0 -0
- package/app/pages/widgets/header-container/header-container.vue +106 -0
- package/app/pages/widgets/schema-form/complex-view/input/input.vue +134 -0
- package/app/pages/widgets/schema-form/complex-view/input-number/input-number.vue +136 -0
- package/app/pages/widgets/schema-form/complex-view/select/select.vue +116 -0
- package/app/pages/widgets/schema-form/form-item-config.js +23 -0
- package/app/pages/widgets/schema-form/schema-form.vue +135 -0
- package/app/pages/widgets/schema-search-bar/complex-view/date-range/date-range.vue +50 -0
- package/app/pages/widgets/schema-search-bar/complex-view/dynamic-select/dynamic-select.vue +67 -0
- package/app/pages/widgets/schema-search-bar/complex-view/input/input.vue +44 -0
- package/app/pages/widgets/schema-search-bar/complex-view/select/select.vue +51 -0
- package/app/pages/widgets/schema-search-bar/schema-search-bar.vue +129 -0
- package/app/pages/widgets/schema-search-bar/search-item-config.js +27 -0
- package/app/pages/widgets/schema-table/schema-table.vue +235 -0
- package/app/pages/widgets/sider-container/sider-container.vue +31 -0
- package/app/public/static/logo.png +0 -0
- package/app/public/static/normalize.css +239 -0
- package/app/router/project.js +6 -0
- package/app/router/view.js +8 -0
- package/app/router-schema/project.js +30 -0
- package/app/service/base.js +11 -0
- package/app/service/project.js +56 -0
- package/app/view/entry.tpl +26 -0
- package/app/webpack/config/webpack.base.js +203 -0
- package/app/webpack/config/webpack.dev.js +59 -0
- package/app/webpack/config/webpack.prod.js +107 -0
- package/app/webpack/dev.js +53 -0
- package/app/webpack/libs/blank.js +3 -0
- package/app/webpack/prod.js +17 -0
- package/config/config.default.js +3 -0
- package/docs/dashboard-model.js +153 -0
- package/elpis-core/env.js +23 -0
- package/elpis-core/index.js +96 -0
- package/elpis-core/loader/config.js +50 -0
- package/elpis-core/loader/controller.js +54 -0
- package/elpis-core/loader/extend.js +49 -0
- package/elpis-core/loader/middleware.js +53 -0
- package/elpis-core/loader/router-schema.js +41 -0
- package/elpis-core/loader/router.js +45 -0
- package/elpis-core/loader/service.js +54 -0
- package/index.js +40 -0
- package/model/index.js +99 -0
- package/package.json +92 -0
- package/test/controller/project.test.js +225 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="schema-table">
|
|
3
|
+
<el-table
|
|
4
|
+
v-if="schema && schema.properties"
|
|
5
|
+
v-loading="loading"
|
|
6
|
+
:data="tableData"
|
|
7
|
+
class="table"
|
|
8
|
+
>
|
|
9
|
+
<template v-for="(schemaItem, key) in schema.properties" :key="key">
|
|
10
|
+
<el-table-column
|
|
11
|
+
v-if="schemaItem.option.visible !== false"
|
|
12
|
+
:key="key"
|
|
13
|
+
:prop="key"
|
|
14
|
+
:label="schemaItem.label"
|
|
15
|
+
v-bind="schemaItem.option"
|
|
16
|
+
></el-table-column>
|
|
17
|
+
</template>
|
|
18
|
+
<el-table-column
|
|
19
|
+
v-if="buttons?.length > 0"
|
|
20
|
+
label="操作"
|
|
21
|
+
fixed="right"
|
|
22
|
+
:width="operationWidth"
|
|
23
|
+
>
|
|
24
|
+
<template #default="scope">
|
|
25
|
+
<el-button
|
|
26
|
+
v-for="item in buttons"
|
|
27
|
+
link
|
|
28
|
+
v-bind="item"
|
|
29
|
+
@click="operationHandler({ btnConfig: item, rowData: scope.row })"
|
|
30
|
+
>
|
|
31
|
+
{{ item.label }}
|
|
32
|
+
</el-button>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
</el-table>
|
|
36
|
+
<el-row justify="end" class="pagination">
|
|
37
|
+
<el-pagination
|
|
38
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
39
|
+
:current-page="currentPage"
|
|
40
|
+
:page-size="pageSize"
|
|
41
|
+
:page-sizes="[10, 20, 50, 100, 200]"
|
|
42
|
+
:total="total"
|
|
43
|
+
@size-change="onPageSizeChange"
|
|
44
|
+
@current-change="onCurrentPageChange"
|
|
45
|
+
></el-pagination>
|
|
46
|
+
</el-row>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup>
|
|
51
|
+
import { ref, toRefs, computed, watch, nextTick, onMounted } from 'vue';
|
|
52
|
+
import $curl from '$elpisCommon/curl.js';
|
|
53
|
+
|
|
54
|
+
const props = defineProps({
|
|
55
|
+
/**
|
|
56
|
+
* schema 配置,结构如下:
|
|
57
|
+
* {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
key: {
|
|
61
|
+
...schema, // 标准 schema 配置
|
|
62
|
+
type: '', // 字段类型
|
|
63
|
+
label: '', // 字段中文名
|
|
64
|
+
option: {
|
|
65
|
+
...elTableColumnConfig, // 标准 el-table-column 配置
|
|
66
|
+
visible: true, // 默认为 true (false 或 不配置时,表示不在表单中显示)
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
*/
|
|
73
|
+
schema: Object,
|
|
74
|
+
/**
|
|
75
|
+
* 表格数据源 api
|
|
76
|
+
*/
|
|
77
|
+
api: String,
|
|
78
|
+
/**
|
|
79
|
+
* api 请求参数,请求 API 时携带
|
|
80
|
+
*/
|
|
81
|
+
apiParams: Object,
|
|
82
|
+
/**
|
|
83
|
+
* buttons 操作按钮相关配置,结构如下:
|
|
84
|
+
* [{
|
|
85
|
+
label: '', // 按钮中文名
|
|
86
|
+
eventKey: '', // 按钮事件名
|
|
87
|
+
eventOption: {}, // 按钮事件具体配置
|
|
88
|
+
...elButtonConfig // 标准el-button 配置
|
|
89
|
+
},...],
|
|
90
|
+
*/
|
|
91
|
+
buttons: Array
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const { schema, api, apiParams, buttons } = toRefs(props);
|
|
95
|
+
|
|
96
|
+
const emit = defineEmits(['operate'])
|
|
97
|
+
|
|
98
|
+
const operationWidth = computed(() => {
|
|
99
|
+
return buttons?.value?.length > 0 ? buttons.value.reduce((pre, cur) => {
|
|
100
|
+
return pre + cur.label.length * 18;
|
|
101
|
+
}, 50) : 50;
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const loading = ref(false);
|
|
105
|
+
const tableData = ref([]);
|
|
106
|
+
const currentPage = ref(1);
|
|
107
|
+
const pageSize = ref(50);
|
|
108
|
+
const total = ref(0);
|
|
109
|
+
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
initData();
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
watch(
|
|
115
|
+
[ schema, api, apiParams ],
|
|
116
|
+
() => {
|
|
117
|
+
initData();
|
|
118
|
+
},
|
|
119
|
+
{ deep: true }
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
const initData = () => {
|
|
123
|
+
currentPage.value = 1;
|
|
124
|
+
pageSize.value = 50;
|
|
125
|
+
nextTick(async() => {
|
|
126
|
+
await loadTableData();
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 如果 schema/api 可能在短时间连续变化,可以加防抖
|
|
131
|
+
let timerId = null;
|
|
132
|
+
const loadTableData = async() => {
|
|
133
|
+
if(timerId) {
|
|
134
|
+
clearTimeout(timerId);
|
|
135
|
+
}
|
|
136
|
+
timerId = setTimeout(async() => {
|
|
137
|
+
await fetchTableData();
|
|
138
|
+
timerId = null;
|
|
139
|
+
}, 100);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
const fetchTableData = async() => {
|
|
144
|
+
if(!api.value) { return; }
|
|
145
|
+
|
|
146
|
+
showLoading();
|
|
147
|
+
|
|
148
|
+
// 请求table数据
|
|
149
|
+
const res = await $curl({
|
|
150
|
+
method: 'get',
|
|
151
|
+
url: `${api.value}/list`,
|
|
152
|
+
query: {
|
|
153
|
+
...apiParams.value,
|
|
154
|
+
page: currentPage.value,
|
|
155
|
+
size: pageSize.value
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
hideLoading();
|
|
160
|
+
|
|
161
|
+
if(!res || !res.success || !Array.isArray(res.data)) {
|
|
162
|
+
tableData.value = [];
|
|
163
|
+
total.value = 0;
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
tableData.value = buildTableData(res.data);
|
|
168
|
+
total.value = res.metadata.total;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 对后端返回的数据进行渲染前的预处理
|
|
173
|
+
* @param {Object} data 列表数据
|
|
174
|
+
*/
|
|
175
|
+
const buildTableData = (listData) => {
|
|
176
|
+
if(!schema.value?.properties) {
|
|
177
|
+
return listData;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return listData.map(rowData => {
|
|
181
|
+
for(const dKey in rowData) {
|
|
182
|
+
const schemaItem = schema.value.properties[dKey];
|
|
183
|
+
// 处理toFixed
|
|
184
|
+
if(schemaItem?.option?.toFixed) {
|
|
185
|
+
rowData[dKey] = rowData[dKey].toFixed && rowData[dKey].toFixed(schemaItem.option.toFixed);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return rowData;
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const showLoading = () => {
|
|
193
|
+
loading.value = true;
|
|
194
|
+
}
|
|
195
|
+
const hideLoading = () => {
|
|
196
|
+
loading.value = false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const operationHandler = ({ btnConfig, rowData }) => {
|
|
200
|
+
emit('operate', { btnConfig, rowData });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const onPageSizeChange = async(value) => {
|
|
204
|
+
pageSize.value = value;
|
|
205
|
+
await loadTableData();
|
|
206
|
+
}
|
|
207
|
+
const onCurrentPageChange = async(value) => {
|
|
208
|
+
currentPage.value = value;
|
|
209
|
+
await loadTableData();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
defineExpose({
|
|
213
|
+
initData,
|
|
214
|
+
loadTableData,
|
|
215
|
+
showLoading,
|
|
216
|
+
hideLoading
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
</script>
|
|
220
|
+
|
|
221
|
+
<style lang="less" scoped>
|
|
222
|
+
.schema-table {
|
|
223
|
+
flex: 1;
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
overflow: auto;
|
|
227
|
+
|
|
228
|
+
.table {
|
|
229
|
+
flex: 1;
|
|
230
|
+
}
|
|
231
|
+
.pagination {
|
|
232
|
+
margin: 10px 0;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-container class="sider-container">
|
|
3
|
+
<el-aside width="200px" class="aside">
|
|
4
|
+
<slot name="menu-content"></slot>
|
|
5
|
+
</el-aside>
|
|
6
|
+
<el-main class="main">
|
|
7
|
+
<slot name="main-content"></slot>
|
|
8
|
+
</el-main>
|
|
9
|
+
</el-container>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<style lang="less" scoped>
|
|
17
|
+
.sider-container {
|
|
18
|
+
height: 100%;
|
|
19
|
+
|
|
20
|
+
.aside {
|
|
21
|
+
border-right: 1px solid #e8e8e8;
|
|
22
|
+
}
|
|
23
|
+
.main {
|
|
24
|
+
overflow: auto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:deep(.el-menu) {
|
|
29
|
+
border-right: 0;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 1. Set default font family to sans-serif.
|
|
5
|
+
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
|
6
|
+
* user zoom.
|
|
7
|
+
*/
|
|
8
|
+
html,body,span,div,p,a,table,tbody,td,h1,h2,h3,img,form,font,strong,b,i,dl,dt,dd,ol,ul,li,dl,dd,dt,iframe,label,blockquote,input,button
|
|
9
|
+
{
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
list-style: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html {
|
|
16
|
+
font-family: "Open Sans","Helvetica Neue","Microsoft Yahei",sans-serif;/* 1 */
|
|
17
|
+
-ms-text-size-adjust: 100%; /* 2 */
|
|
18
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Remove default margin.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Links
|
|
30
|
+
========================================================================== */
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Remove the gray background color from active links in IE 10.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
a {
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Improve readability when focused and also mouse hovered in all browsers.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
a:active,
|
|
46
|
+
a:hover {
|
|
47
|
+
outline: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Text-level semantics
|
|
51
|
+
========================================================================== */
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
b,
|
|
58
|
+
strong {
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Embedded content
|
|
63
|
+
========================================================================== */
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Remove border when inside `a` element in IE 8/9/10.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
img {
|
|
70
|
+
border: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/* Grouping content
|
|
75
|
+
========================================================================== */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Address margin not present in IE 8/9 and Safari.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
figure {
|
|
82
|
+
margin: 1em 40px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/* Forms
|
|
87
|
+
========================================================================== */
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Known limitation: by default, Chrome and Safari on OS X allow very limited
|
|
91
|
+
* styling of `select`, unless a `border` property is set.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 1. Correct color not being inherited.
|
|
96
|
+
a * Known issue: affects color of disabled elements.
|
|
97
|
+
* 2. Correct font properties not being inherited.
|
|
98
|
+
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
button,
|
|
102
|
+
input,
|
|
103
|
+
optgroup,
|
|
104
|
+
select,
|
|
105
|
+
textarea {
|
|
106
|
+
color: inherit; /* 1 */
|
|
107
|
+
font: inherit; /* 2 */
|
|
108
|
+
margin: 0; /* 3 */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Address `overflow` set to `hidden` in IE 8/9/10/11.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
button {
|
|
116
|
+
overflow: visible;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Address inconsistent `text-transform` inheritance for `button` and `select`.
|
|
121
|
+
* All other form control elements do not inherit `text-transform` values.
|
|
122
|
+
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
|
|
123
|
+
* Correct `select` style inheritance in Firefox.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
button,
|
|
127
|
+
select {
|
|
128
|
+
text-transform: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
|
133
|
+
* and `video` controls.
|
|
134
|
+
* 2. Correct inability to style clickable `input` types in iOS.
|
|
135
|
+
* 3. Improve usability and consistency of cursor style between image-type
|
|
136
|
+
* `input` and others.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
button,
|
|
140
|
+
html input[type="button"], /* 1 */
|
|
141
|
+
input[type="reset"],
|
|
142
|
+
input[type="submit"] {
|
|
143
|
+
-webkit-appearance: button; /* 2 */
|
|
144
|
+
cursor: pointer; /* 3 */
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Re-set default cursor for disabled elements.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
button[disabled],
|
|
152
|
+
html input[disabled] {
|
|
153
|
+
cursor: default;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Remove inner padding and border in Firefox 4+.
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
button::-moz-focus-inner,
|
|
161
|
+
input::-moz-focus-inner {
|
|
162
|
+
border: 0;
|
|
163
|
+
padding: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
|
|
168
|
+
* the UA stylesheet.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
input {
|
|
172
|
+
line-height: normal;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* It's recommended that you don't attempt to style these elements.
|
|
177
|
+
* Firefox's implementation doesn't respect box-sizing, padding, or width.
|
|
178
|
+
*
|
|
179
|
+
* 1. Address box sizing set to `content-box` in IE 8/9/10.
|
|
180
|
+
* 2. Remove excess padding in IE 8/9/10.
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
input[type="checkbox"],
|
|
184
|
+
input[type="radio"] {
|
|
185
|
+
box-sizing: border-box; /* 1 */
|
|
186
|
+
padding: 0; /* 2 */
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
|
|
191
|
+
* `font-size` values of the `input`, it causes the cursor style of the
|
|
192
|
+
* decrement button to change from `default` to `text`.
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
196
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
197
|
+
height: auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
|
|
202
|
+
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
|
|
203
|
+
* (include `-moz` to future-proof).
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
input[type="search"] {
|
|
207
|
+
-webkit-appearance: textfield; /* 1 */
|
|
208
|
+
-moz-box-sizing: content-box;
|
|
209
|
+
-webkit-box-sizing: content-box; /* 2 */
|
|
210
|
+
box-sizing: content-box;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
|
|
215
|
+
* Safari (but not Chrome) clips the cancel button when the search input has
|
|
216
|
+
* padding (and `textfield` appearance).
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
input[type="search"]::-webkit-search-cancel-button,
|
|
220
|
+
input[type="search"]::-webkit-search-decoration {
|
|
221
|
+
-webkit-appearance: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* Tables
|
|
225
|
+
========================================================================== */
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Remove most spacing between table cells.
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
table {
|
|
232
|
+
border-collapse: collapse;
|
|
233
|
+
border-spacing: 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
td,
|
|
237
|
+
th {
|
|
238
|
+
padding: 0;
|
|
239
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
module.exports = (app, router) => {
|
|
2
|
+
const { project: projectController } = app.controller;
|
|
3
|
+
router.get('/api/project', projectController.get.bind(projectController));
|
|
4
|
+
router.get('/api/project/list', projectController.getList.bind(projectController));
|
|
5
|
+
router.get('/api/project/model_list', projectController.getModelList.bind(projectController));
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module.exports = (app, router) => {
|
|
2
|
+
const { view: viewController } = app.controller;
|
|
3
|
+
|
|
4
|
+
// 用户输入 http://localhost:3000/view/xxx 就会调用 viewController 的 renderPage 方法,能渲染 output/entry.xxx 页面
|
|
5
|
+
router.get('/view/:page', viewController.renderPage.bind(viewController));
|
|
6
|
+
// 用户输入 http://localhost:3000/view/xxx/xxx/xxx/* 能渲染出对应的页面
|
|
7
|
+
router.get('/view/:page/*', viewController.renderPage.bind(viewController));
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'/api/project': {
|
|
3
|
+
get: {
|
|
4
|
+
query: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
proj_key: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
required: ['proj_key']
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
'/api/project/list': {
|
|
16
|
+
get: {
|
|
17
|
+
query: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
proj_key: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
'/api/project/model_list': {
|
|
28
|
+
get: {}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module.exports = (app) => {
|
|
2
|
+
const BaseService = require('./base')(app);
|
|
3
|
+
const modelList = require('../../model/index.js')(app);
|
|
4
|
+
return class ProjectService extends BaseService {
|
|
5
|
+
/**
|
|
6
|
+
* 根据 projKey 获取项目配置
|
|
7
|
+
*/
|
|
8
|
+
get(projKey) {
|
|
9
|
+
// let projConfig;
|
|
10
|
+
|
|
11
|
+
// modelList.forEach(modelItem => {
|
|
12
|
+
// if(modelItem.project[projKey]) {
|
|
13
|
+
// projConfig = modelItem.project[projKey];
|
|
14
|
+
// }
|
|
15
|
+
// })
|
|
16
|
+
|
|
17
|
+
// return projConfig;
|
|
18
|
+
if (!projKey) { return; }
|
|
19
|
+
|
|
20
|
+
for (const modelItem of modelList) {
|
|
21
|
+
const project = modelItem.project || {};
|
|
22
|
+
if (project[projKey]) {
|
|
23
|
+
return project[projKey];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 获取统一模型下的项目列表(如果无 projKey,全量获取)
|
|
31
|
+
*/
|
|
32
|
+
getList({ projKey }) {
|
|
33
|
+
return modelList.reduce((preList, modelItem) => {
|
|
34
|
+
const { project } = modelItem;
|
|
35
|
+
|
|
36
|
+
// 如果有传 projKey 则只取当前同模型下的项目,不传的情况下则取全量。
|
|
37
|
+
if(projKey && !project[projKey]) {
|
|
38
|
+
return preList;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
for(const pKey in project) {
|
|
42
|
+
preList.push(project[pKey]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return preList;
|
|
46
|
+
}, []);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 获取所有模型与项目的结构化数据
|
|
51
|
+
*/
|
|
52
|
+
async getModelList() {
|
|
53
|
+
return modelList;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html class="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<link rel="stylesheet" href="/static/normalize.css">
|
|
6
|
+
<link rel="icon" href="/static/logo.png" type="image/x-icon">
|
|
7
|
+
<title>{{name}}</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body style="margin: 0;">
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<input id="projKey" value="{{ projKey }}" style="display: none;">
|
|
12
|
+
<input id="env" value="{{ env }}" style="display: none;">
|
|
13
|
+
<input id="options" value="{{ options }}" style="display: none;">
|
|
14
|
+
</body>
|
|
15
|
+
<script type="text/javascript"></script>
|
|
16
|
+
<script>
|
|
17
|
+
try {
|
|
18
|
+
window.projKey = document.getElementById('projKey')?.value;
|
|
19
|
+
window.env = document.getElementById('env').value;
|
|
20
|
+
const options = document.getElementById('options').value;
|
|
21
|
+
window.options = JSON.parse(options);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(e);
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
</html>
|