@ebiz/designer-components 0.0.18-kzy.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.0.18-kzy.3",
3
+ "version": "0.0.18-kzy.4",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -59,7 +59,10 @@ axiosInstance.interceptors.response.use(
59
59
  return data.data
60
60
  } else {
61
61
  // message.error(data.message || '请求失败');
62
- return Promise.reject(new Error(data.message || data.msg || '请求失败'))
62
+ return Promise.reject({
63
+ code: data.code,
64
+ message: data.message || data.msg || '请求失败'
65
+ })
63
66
  }
64
67
  },
65
68
  (error) => {
@@ -175,7 +178,7 @@ const dataService = {
175
178
  }
176
179
  params.apiId = apiConfig.apiId
177
180
  if (apiConfig.key) {
178
- params.key = apiConfig.key
181
+ params.apiKey = apiConfig.key
179
182
  }
180
183
 
181
184
  const config = { ...defaultConfig, ...restConfig }
@@ -41,7 +41,7 @@ const props = defineProps({
41
41
  },
42
42
  size: {//'large' | 'medium' | 'small' | 'mini'
43
43
  type: String,
44
- default: 'medium'
44
+ default: ''
45
45
  },
46
46
  apiConfig: {//接口配置
47
47
  type: Object,
@@ -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
  * 是否多选
@@ -62,7 +64,7 @@ const props = defineProps({
62
64
  */
63
65
  clearable: {
64
66
  type: Boolean,
65
- default: false
67
+ default: true
66
68
  },
67
69
  /**
68
70
  * 是否禁用
@@ -141,18 +143,18 @@ 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
160
  const res = await dataService.fetch(params, {
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <t-time-picker
3
+ v-bind="$attrs"
4
+ :value="modelValue"
5
+ :allow-input="allowInput"
6
+ :clearable="clearable"
7
+ :disabled="disabled"
8
+ :disable-time="disableTime"
9
+ :format="format"
10
+ :input-props="inputProps"
11
+ :placeholder="placeholder"
12
+ :popup-props="popupProps"
13
+ :size="size"
14
+ :steps="steps"
15
+ :range="range"
16
+ :range-separator="rangeSeparator"
17
+ :tips="tips"
18
+ @change="handleChange"
19
+ @blur="$emit('blur', $event)"
20
+ @focus="$emit('focus', $event)"
21
+ @close="$emit('close', $event)"
22
+ @open="$emit('open', $event)"
23
+ @dayclick="$emit('dayclick', $event)"
24
+ @pick="$emit('pick', $event)"
25
+ >
26
+ <template v-if="$slots.suffixIcon" #suffixIcon>
27
+ <slot name="suffixIcon"></slot>
28
+ </template>
29
+ <template v-if="$slots.panel" #panel="slotProps">
30
+ <slot name="panel" v-bind="slotProps"></slot>
31
+ </template>
32
+ <template v-if="$slots.prepend" #prepend>
33
+ <slot name="prepend"></slot>
34
+ </template>
35
+ <template v-if="$slots.tips" #tips>
36
+ <slot name="tips"></slot>
37
+ </template>
38
+ </t-time-picker>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { TimePicker as TTimePicker } from 'tdesign-vue-next';
43
+ import { computed } from 'vue';
44
+
45
+ const props = defineProps({
46
+ // 选中值
47
+ modelValue: {
48
+ type: [String, Array],
49
+ default: '',
50
+ },
51
+ // 是否允许直接输入时间
52
+ allowInput: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ // 是否允许清除选中值
57
+ clearable: {
58
+ type: Boolean,
59
+ default: true,
60
+ },
61
+ // 是否禁用组件
62
+ disabled: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ // 禁用时间项
67
+ disableTime: {
68
+ type: Function,
69
+ default: null,
70
+ },
71
+ // 时间格式
72
+ format: {
73
+ type: String,
74
+ default: 'HH:mm:ss',
75
+ },
76
+ // 透传给输入框的属性
77
+ inputProps: {
78
+ type: Object,
79
+ default: () => ({}),
80
+ },
81
+ // 输入框占位文本
82
+ placeholder: {
83
+ type: String,
84
+ default: '请选择时间',
85
+ },
86
+ // 透传给 popup 组件的属性
87
+ popupProps: {
88
+ type: Object,
89
+ default: () => ({}),
90
+ },
91
+ // 尺寸
92
+ size: {
93
+ type: String,
94
+ default: 'medium',
95
+ validator(val) {
96
+ return ['small', 'medium', 'large'].includes(val);
97
+ },
98
+ },
99
+ // 时间间隔步数
100
+ steps: {
101
+ type: Array,
102
+ default: () => [1, 1, 1],
103
+ },
104
+ // 是否为时间范围选择
105
+ range: {
106
+ type: Boolean,
107
+ default: false,
108
+ },
109
+ // 范围分隔符
110
+ rangeSeparator: {
111
+ type: String,
112
+ default: ' - ',
113
+ },
114
+ // 提示文本
115
+ tips: {
116
+ type: [String, Function],
117
+ default: '',
118
+ },
119
+ });
120
+
121
+ const emit = defineEmits([
122
+ 'update:modelValue',
123
+ 'change',
124
+ 'blur',
125
+ 'focus',
126
+ 'close',
127
+ 'open',
128
+ 'dayclick',
129
+ 'pick',
130
+ ]);
131
+
132
+ // 处理值变更事件
133
+ const handleChange = (value) => {
134
+ emit('update:modelValue', value);
135
+ emit('change', value);
136
+ };
137
+
138
+ </script>
139
+
140
+ <style>
141
+ .t-time-picker {
142
+ width: 100%;
143
+ }
144
+ </style>