@ebiz/designer-components 0.0.18-kzy.2 → 0.0.18-kzy.4
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/dist/designer-components.css +2 -2
- package/dist/index.mjs +46510 -41918
- package/package.json +1 -1
- package/src/apiService/simpleDataService.js +9 -4
- package/src/components/Button.vue +1 -1
- package/src/components/EbizDetailBlock.vue +82 -0
- package/src/components/EbizDialog.vue +249 -0
- package/src/components/EbizPageHeader.vue +96 -0
- package/src/components/EbizRemoteSelect.vue +22 -11
- package/src/components/EbizRouteBreadcrumb.vue +3 -1
- package/src/components/EbizTable.vue +113 -133
- package/src/components/EbizTableColumn.vue +117 -0
- package/src/components/EbizTableSort.vue +181 -0
- package/src/components/EbizTimePicker.vue +144 -0
- package/src/components/EbizTree.vue +153 -0
- package/src/components/EbizTreeSelector.vue +423 -0
- package/src/components/TddesignButton.vue +153 -0
- package/src/components/TdesignUpload.vue +2 -3
- package/src/components/TinyGridEditorSelect.vue +238 -0
- package/src/index.js +22 -1
- package/src/router/index.js +64 -5
- package/src/views/Button.vue +7 -3
- package/src/views/EbizDetailBlockDemo.vue +31 -0
- package/src/views/Home.vue +33 -2
- package/src/views/PageHeaderDemo.vue +105 -0
- package/src/views/TableSortDemo.vue +144 -0
- package/src/views/TableView.vue +69 -0
- package/src/views/TimePickerDemo.vue +147 -0
- package/src/views/TreeDemo.vue +255 -0
- package/src/views/TreeSelectorDemo.vue +246 -0
package/package.json
CHANGED
@@ -7,8 +7,10 @@
|
|
7
7
|
import axios from 'axios'
|
8
8
|
import { TinyNotify } from '@opentiny/vue'
|
9
9
|
|
10
|
-
//
|
11
|
-
const API_BASE_URL = "http://localhost:8090/api";
|
10
|
+
// 本地开发使用
|
11
|
+
// const API_BASE_URL = "http://localhost:8090/api";
|
12
|
+
// 组件发布使用
|
13
|
+
const API_BASE_URL = 'http://' + window.location.host + '/api'
|
12
14
|
|
13
15
|
/**
|
14
16
|
* 创建axios实例
|
@@ -57,7 +59,10 @@ axiosInstance.interceptors.response.use(
|
|
57
59
|
return data.data
|
58
60
|
} else {
|
59
61
|
// message.error(data.message || '请求失败');
|
60
|
-
return Promise.reject(
|
62
|
+
return Promise.reject({
|
63
|
+
code: data.code,
|
64
|
+
message: data.message || data.msg || '请求失败'
|
65
|
+
})
|
61
66
|
}
|
62
67
|
},
|
63
68
|
(error) => {
|
@@ -173,7 +178,7 @@ const dataService = {
|
|
173
178
|
}
|
174
179
|
params.apiId = apiConfig.apiId
|
175
180
|
if (apiConfig.key) {
|
176
|
-
params.
|
181
|
+
params.apiKey = apiConfig.key
|
177
182
|
}
|
178
183
|
|
179
184
|
const config = { ...defaultConfig, ...restConfig }
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="ebiz-detail-block">
|
3
|
+
<t-row v-for="(item, index) in detailItems" :key="index" class="detail-item">
|
4
|
+
<t-col :span="6" class="label" :style="labelStyle">{{ item.label }}</t-col>
|
5
|
+
<t-col :span="18" class="value" :style="valueStyle">{{ item.value }}</t-col>
|
6
|
+
</t-row>
|
7
|
+
</div>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script lang="js" setup>
|
11
|
+
import { computed, toRefs } from 'vue'
|
12
|
+
import { Row as TRow, Col as TCol } from 'tdesign-vue-next'
|
13
|
+
|
14
|
+
const props = defineProps({
|
15
|
+
model: {
|
16
|
+
type: Object,
|
17
|
+
default: () => { }
|
18
|
+
},
|
19
|
+
labelMap: {
|
20
|
+
type: Object,
|
21
|
+
default: () => { }
|
22
|
+
},
|
23
|
+
gap: {
|
24
|
+
type: [String, Number],
|
25
|
+
default: '0'
|
26
|
+
},
|
27
|
+
labelSize: {
|
28
|
+
type: [String, Number],
|
29
|
+
default: '14'
|
30
|
+
},
|
31
|
+
labelColor: {
|
32
|
+
type: String,
|
33
|
+
default: '#86909C'
|
34
|
+
},
|
35
|
+
valueSize: {
|
36
|
+
type: [String, Number],
|
37
|
+
default: '14'
|
38
|
+
},
|
39
|
+
valueColor: {
|
40
|
+
type: String,
|
41
|
+
default: '#0A0A0A'
|
42
|
+
}
|
43
|
+
})
|
44
|
+
|
45
|
+
const { model, labelMap, gap, labelSize, labelColor, valueSize, valueColor } = toRefs(props)
|
46
|
+
|
47
|
+
const labelStyle = computed(() => ({
|
48
|
+
fontSize: typeof labelSize.value === 'number' ? `${labelSize.value}px` : labelSize.value,
|
49
|
+
color: labelColor.value,
|
50
|
+
marginBottom: typeof gap.value === 'number' ? `${gap.value}px` : gap.value
|
51
|
+
}))
|
52
|
+
|
53
|
+
const valueStyle = computed(() => ({
|
54
|
+
fontSize: typeof valueSize.value === 'number' ? `${valueSize.value}px` : valueSize.value,
|
55
|
+
color: valueColor.value
|
56
|
+
}))
|
57
|
+
|
58
|
+
const detailItems = computed(() => {
|
59
|
+
return Object.entries(model.value).map(([key, value]) => ({
|
60
|
+
label: labelMap.value[key] || key,
|
61
|
+
value: value || '--'
|
62
|
+
}))
|
63
|
+
})
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<style scoped>
|
67
|
+
.ebiz-detail-block {
|
68
|
+
padding: 16px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.detail-item {
|
72
|
+
line-height: 32px;
|
73
|
+
}
|
74
|
+
|
75
|
+
.label {
|
76
|
+
width: 50%;
|
77
|
+
}
|
78
|
+
|
79
|
+
.value {
|
80
|
+
width: 50%;
|
81
|
+
}
|
82
|
+
</style>
|
@@ -0,0 +1,249 @@
|
|
1
|
+
<template>
|
2
|
+
<t-dialog
|
3
|
+
v-model:visible="dialogVisible"
|
4
|
+
:attach="attach"
|
5
|
+
:body-class="bodyClass"
|
6
|
+
:body-scroll-lock="bodyScrollLock"
|
7
|
+
:cancel-btn="cancelBtn"
|
8
|
+
:class-prefix="classPrefix"
|
9
|
+
:close-btn="closeBtn"
|
10
|
+
:close-on-esc-keydown="closeOnEscKeydown"
|
11
|
+
:close-on-overlay-click="closeOnOverlayClick"
|
12
|
+
:confirm-btn="confirmBtn"
|
13
|
+
:content="content"
|
14
|
+
:default-visible="defaultVisible"
|
15
|
+
:destroy-on-close="destroyOnClose"
|
16
|
+
:dialog-class="dialogClass"
|
17
|
+
:draggable="draggable"
|
18
|
+
:footer="footer"
|
19
|
+
:header="header"
|
20
|
+
:mode="mode"
|
21
|
+
:placement="placement"
|
22
|
+
:prevent-scroll-through="preventScrollThrough"
|
23
|
+
:show-overlay="showOverlay"
|
24
|
+
:top="top"
|
25
|
+
:width="width"
|
26
|
+
:zIndex="zIndex"
|
27
|
+
@cancel="handleCancel"
|
28
|
+
@close="handleClose"
|
29
|
+
@closed="handleClosed"
|
30
|
+
@confirm="handleConfirm"
|
31
|
+
@opened="handleOpened"
|
32
|
+
@overlay-click="handleOverlayClick"
|
33
|
+
@update:visible="handleUpdateVisible"
|
34
|
+
>
|
35
|
+
<!-- 默认插槽 -->
|
36
|
+
<slot></slot>
|
37
|
+
|
38
|
+
<!-- 页脚插槽 -->
|
39
|
+
<template v-if="$slots.footer" #footer>
|
40
|
+
<slot name="footer"></slot>
|
41
|
+
</template>
|
42
|
+
|
43
|
+
<!-- 头部插槽 -->
|
44
|
+
<template #header>
|
45
|
+
<slot name="header">{{ title }}</slot>
|
46
|
+
</template>
|
47
|
+
</t-dialog>
|
48
|
+
</template>
|
49
|
+
|
50
|
+
<script>
|
51
|
+
export default {
|
52
|
+
name: "EbizDialog"
|
53
|
+
}
|
54
|
+
</script>
|
55
|
+
|
56
|
+
<script setup>
|
57
|
+
import { ref, defineProps, defineEmits, watch } from 'vue';
|
58
|
+
import { Dialog as TDialog } from 'tdesign-vue-next';
|
59
|
+
|
60
|
+
// 定义组件接收的属性
|
61
|
+
const props = defineProps({
|
62
|
+
// 对话框挂载的节点
|
63
|
+
attach: {
|
64
|
+
type: [String, Function, Element],
|
65
|
+
default: 'body'
|
66
|
+
},
|
67
|
+
// 对话框内容的类名
|
68
|
+
bodyClass: {
|
69
|
+
type: String,
|
70
|
+
default: ''
|
71
|
+
},
|
72
|
+
// 是否锁定body滚动
|
73
|
+
bodyScrollLock: {
|
74
|
+
type: Boolean,
|
75
|
+
default: true
|
76
|
+
},
|
77
|
+
// 取消按钮配置
|
78
|
+
cancelBtn: {
|
79
|
+
type: [String, Object, Boolean],
|
80
|
+
default: null
|
81
|
+
},
|
82
|
+
// 类名前缀
|
83
|
+
classPrefix: {
|
84
|
+
type: String,
|
85
|
+
default: 't'
|
86
|
+
},
|
87
|
+
// 关闭按钮配置
|
88
|
+
closeBtn: {
|
89
|
+
type: [String, Object, Boolean],
|
90
|
+
default: true
|
91
|
+
},
|
92
|
+
// 是否支持按ESC键关闭对话框
|
93
|
+
closeOnEscKeydown: {
|
94
|
+
type: Boolean,
|
95
|
+
default: true
|
96
|
+
},
|
97
|
+
// 点击蒙层是否关闭
|
98
|
+
closeOnOverlayClick: {
|
99
|
+
type: Boolean,
|
100
|
+
default: true
|
101
|
+
},
|
102
|
+
// 确认按钮配置
|
103
|
+
confirmBtn: {
|
104
|
+
type: [String, Object, Boolean],
|
105
|
+
default: '确认'
|
106
|
+
},
|
107
|
+
// 对话框内容
|
108
|
+
content: {
|
109
|
+
type: [String, Function],
|
110
|
+
default: ''
|
111
|
+
},
|
112
|
+
// 默认是否显示对话框
|
113
|
+
defaultVisible: {
|
114
|
+
type: Boolean,
|
115
|
+
default: false
|
116
|
+
},
|
117
|
+
// 关闭时是否销毁对话框
|
118
|
+
destroyOnClose: {
|
119
|
+
type: Boolean,
|
120
|
+
default: false
|
121
|
+
},
|
122
|
+
// 对话框样式类
|
123
|
+
dialogClass: {
|
124
|
+
type: String,
|
125
|
+
default: ''
|
126
|
+
},
|
127
|
+
// 是否可拖拽
|
128
|
+
draggable: {
|
129
|
+
type: Boolean,
|
130
|
+
default: false
|
131
|
+
},
|
132
|
+
// 底部内容
|
133
|
+
footer: {
|
134
|
+
type: [Boolean, Function],
|
135
|
+
default: true
|
136
|
+
},
|
137
|
+
// 头部内容
|
138
|
+
header: {
|
139
|
+
type: [Boolean, Function],
|
140
|
+
default: true
|
141
|
+
},
|
142
|
+
// 对话框类型
|
143
|
+
mode: {
|
144
|
+
type: String,
|
145
|
+
default: 'modal',
|
146
|
+
validator: (val) => ['modal', 'modeless', 'full-screen'].includes(val)
|
147
|
+
},
|
148
|
+
// 对话框位置
|
149
|
+
placement: {
|
150
|
+
type: String,
|
151
|
+
default: 'top',
|
152
|
+
validator: (val) => ['top', 'center'].includes(val)
|
153
|
+
},
|
154
|
+
// 防止滚动穿透
|
155
|
+
preventScrollThrough: {
|
156
|
+
type: Boolean,
|
157
|
+
default: true
|
158
|
+
},
|
159
|
+
// 是否显示遮罩层
|
160
|
+
showOverlay: {
|
161
|
+
type: Boolean,
|
162
|
+
default: true
|
163
|
+
},
|
164
|
+
// 对话框标题
|
165
|
+
title: {
|
166
|
+
type: [String, Function],
|
167
|
+
default: ''
|
168
|
+
},
|
169
|
+
// 距离顶部的位置
|
170
|
+
top: {
|
171
|
+
type: [String, Number],
|
172
|
+
default: '15%'
|
173
|
+
},
|
174
|
+
// 对话框可见性
|
175
|
+
visible: {
|
176
|
+
type: Boolean,
|
177
|
+
default: undefined
|
178
|
+
},
|
179
|
+
// 对话框宽度
|
180
|
+
width: {
|
181
|
+
type: [String, Number],
|
182
|
+
default: '500px'
|
183
|
+
},
|
184
|
+
// 对话框层级
|
185
|
+
zIndex: {
|
186
|
+
type: Number,
|
187
|
+
default: 2500
|
188
|
+
}
|
189
|
+
});
|
190
|
+
|
191
|
+
// 定义组件的事件
|
192
|
+
const emit = defineEmits([
|
193
|
+
'cancel',
|
194
|
+
'close',
|
195
|
+
'closed',
|
196
|
+
'confirm',
|
197
|
+
'opened',
|
198
|
+
'overlay-click',
|
199
|
+
'update:visible'
|
200
|
+
]);
|
201
|
+
|
202
|
+
// 内部维护的可见性状态
|
203
|
+
const dialogVisible = ref(props.visible !== undefined ? props.visible : props.defaultVisible);
|
204
|
+
|
205
|
+
// 监听visible属性变化
|
206
|
+
watch(() => props.visible, (newValue) => {
|
207
|
+
dialogVisible.value = newValue;
|
208
|
+
});
|
209
|
+
|
210
|
+
// 取消按钮点击事件
|
211
|
+
const handleCancel = (e) => {
|
212
|
+
emit('cancel', e);
|
213
|
+
};
|
214
|
+
|
215
|
+
// 关闭事件
|
216
|
+
const handleClose = (e) => {
|
217
|
+
emit('close', e);
|
218
|
+
};
|
219
|
+
|
220
|
+
// 关闭动画结束后触发
|
221
|
+
const handleClosed = () => {
|
222
|
+
emit('closed');
|
223
|
+
};
|
224
|
+
|
225
|
+
// 确认按钮点击事件
|
226
|
+
const handleConfirm = (e) => {
|
227
|
+
emit('confirm', e);
|
228
|
+
};
|
229
|
+
|
230
|
+
// 对话框打开动画结束后触发
|
231
|
+
const handleOpened = () => {
|
232
|
+
emit('opened');
|
233
|
+
};
|
234
|
+
|
235
|
+
// 点击遮罩层触发
|
236
|
+
const handleOverlayClick = (context) => {
|
237
|
+
emit('overlay-click', context);
|
238
|
+
};
|
239
|
+
|
240
|
+
// 可见性变化事件
|
241
|
+
const handleUpdateVisible = (visible) => {
|
242
|
+
dialogVisible.value = visible;
|
243
|
+
emit('update:visible', visible);
|
244
|
+
};
|
245
|
+
</script>
|
246
|
+
|
247
|
+
<style lang="less" scoped>
|
248
|
+
/* 自定义样式 */
|
249
|
+
</style>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="ebiz-page-header">
|
3
|
+
<div>
|
4
|
+
<div style="display: flex; align-items: center;">
|
5
|
+
<t-breadcrumb>
|
6
|
+
<t-breadcrumb-item :to="{ path: '/' }">
|
7
|
+
<template #icon><t-icon name="home" /></template>首页
|
8
|
+
</t-breadcrumb-item>
|
9
|
+
<t-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">
|
10
|
+
<template #icon v-if="item.icon">
|
11
|
+
<t-icon :name="item.icon" />
|
12
|
+
</template>
|
13
|
+
{{ item.title }}
|
14
|
+
</t-breadcrumb-item>
|
15
|
+
</t-breadcrumb>
|
16
|
+
</div>
|
17
|
+
<slot></slot>
|
18
|
+
</div>
|
19
|
+
<div style="display: flex; align-items: center;">
|
20
|
+
<slot name="right"></slot>
|
21
|
+
<div class="help-doc" @click="goToHelp">
|
22
|
+
<t-icon name="chat-bubble-help-filled"></t-icon>
|
23
|
+
<span>帮助文档</span>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<script setup>
|
31
|
+
import { ref, onMounted, watch } from 'vue'
|
32
|
+
import { useRouter, useRoute } from 'vue-router'
|
33
|
+
import { Breadcrumb as TBreadcrumb, BreadcrumbItem as TBreadcrumbItem, Icon as TIcon } from "tdesign-vue-next"
|
34
|
+
|
35
|
+
const router = useRouter()
|
36
|
+
const route = useRoute()
|
37
|
+
|
38
|
+
const breadcrumbList = ref([])
|
39
|
+
|
40
|
+
// 计算面包屑导航列表
|
41
|
+
const generateBreadcrumb = () => {
|
42
|
+
const matched = route.matched
|
43
|
+
if (!matched.length) return
|
44
|
+
|
45
|
+
const result = []
|
46
|
+
matched.forEach(route => {
|
47
|
+
if (route.meta && route.meta.title) {
|
48
|
+
result.push({
|
49
|
+
title: route.meta.title,
|
50
|
+
icon: route.meta.icon || '',
|
51
|
+
path: route.path
|
52
|
+
})
|
53
|
+
}
|
54
|
+
})
|
55
|
+
|
56
|
+
breadcrumbList.value = result
|
57
|
+
}
|
58
|
+
|
59
|
+
// 跳转到帮助文档页面
|
60
|
+
const goToHelp = () => {
|
61
|
+
router.push(`/help?route=${route.path}`)
|
62
|
+
}
|
63
|
+
|
64
|
+
// 监听路由变化
|
65
|
+
watch(() => route.path, () => {
|
66
|
+
generateBreadcrumb()
|
67
|
+
}, { immediate: true })
|
68
|
+
|
69
|
+
onMounted(() => {
|
70
|
+
generateBreadcrumb()
|
71
|
+
})
|
72
|
+
</script>
|
73
|
+
|
74
|
+
<style scoped>
|
75
|
+
.ebiz-page-header {
|
76
|
+
display: flex;
|
77
|
+
align-items: center;
|
78
|
+
justify-content: space-between;
|
79
|
+
}
|
80
|
+
|
81
|
+
.help-doc {
|
82
|
+
display: flex;
|
83
|
+
align-items: center;
|
84
|
+
color: var(--td-brand-color);
|
85
|
+
cursor: pointer;
|
86
|
+
transition: opacity 0.2s;
|
87
|
+
}
|
88
|
+
|
89
|
+
.help-doc:hover {
|
90
|
+
opacity: 0.8;
|
91
|
+
}
|
92
|
+
|
93
|
+
.help-doc span {
|
94
|
+
margin-left: 4px;
|
95
|
+
}
|
96
|
+
</style>
|
@@ -41,7 +41,9 @@ const props = defineProps({
|
|
41
41
|
*/
|
42
42
|
queryParams: {
|
43
43
|
type: Object,
|
44
|
-
default: () => ({
|
44
|
+
default: () => ({
|
45
|
+
name: ''
|
46
|
+
})
|
45
47
|
},
|
46
48
|
/**
|
47
49
|
* 是否多选
|
@@ -141,25 +143,30 @@ const focus = () => {
|
|
141
143
|
|
142
144
|
defineExpose({
|
143
145
|
focus,
|
144
|
-
selectRef
|
146
|
+
selectRef,
|
147
|
+
options
|
145
148
|
});
|
146
149
|
|
147
150
|
// 远程搜索处理函数
|
148
151
|
const handleRemoteSearch = async (keyword) => {
|
149
152
|
loading.value = true;
|
150
|
-
console.log('handleRemoteSearch', keyword);
|
151
153
|
try {
|
152
154
|
const params = {
|
153
155
|
queryParams: {
|
154
156
|
...queryParams.value,
|
155
|
-
keyword
|
157
|
+
name: keyword
|
156
158
|
}
|
157
159
|
};
|
158
|
-
const res = await dataService.fetch(params,
|
160
|
+
const res = await dataService.fetch(params, {
|
161
|
+
key: props.apiConfig.key,
|
162
|
+
apiId: props.apiConfig.apiId,
|
163
|
+
apiType: 'MULTIPLE_DATA_SEARCH'
|
164
|
+
});
|
159
165
|
|
160
166
|
options.value = res.data.map(item => ({
|
161
|
-
|
162
|
-
|
167
|
+
...item,
|
168
|
+
label: labelField.value ? item[labelField.value] : (item.label || item.name),
|
169
|
+
value: valueField.value ? item[valueField.value] : (item.value || item.id)
|
163
170
|
}));
|
164
171
|
} catch (error) {
|
165
172
|
console.error('远程搜索失败:', error);
|
@@ -188,7 +195,11 @@ const handleBlur = (value, context) => {
|
|
188
195
|
const handleChange = (value, context) => {
|
189
196
|
emit('update:modelValue', value);
|
190
197
|
emit('change', value, context);
|
191
|
-
|
198
|
+
if (value instanceof Array) {
|
199
|
+
emit('selectOption', options.value.filter(item => value.includes(item.value)));
|
200
|
+
} else {
|
201
|
+
emit('selectOption', options.value.find(item => item.value === value));
|
202
|
+
}
|
192
203
|
};
|
193
204
|
|
194
205
|
// 组件挂载时,如果有默认值则加载对应的选项
|
@@ -205,10 +216,10 @@ onMounted(async () => {
|
|
205
216
|
apiType: 'MULTIPLE_DATA_SEARCH'
|
206
217
|
});
|
207
218
|
|
208
|
-
console.log('res', res)
|
209
219
|
options.value = res.data.map(item => ({
|
210
|
-
|
211
|
-
|
220
|
+
...item,
|
221
|
+
label: labelField.value ? item[labelField.value] : (item.label || item.name),
|
222
|
+
value: valueField.value ? item[valueField.value] : (item.value || item.id)
|
212
223
|
}));
|
213
224
|
} catch (error) {
|
214
225
|
console.error('加载默认选项失败:', error);
|