@ebiz/designer-components 0.0.18-beta.31 → 0.0.18-beta.33

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-beta.31",
3
+ "version": "0.0.18-beta.33",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -6,7 +6,6 @@
6
6
 
7
7
  import axios from 'axios'
8
8
  import { TinyNotify } from '@opentiny/vue'
9
-
10
9
  // 从环境变量获取API基础URL
11
10
  const API_BASE_URL = 'http://' + window.location.host + '/api'
12
11
 
@@ -57,7 +56,10 @@ axiosInstance.interceptors.response.use(
57
56
  return data.data
58
57
  } else {
59
58
  // message.error(data.message || '请求失败');
60
- return Promise.reject(new Error(data.message || data.msg || '请求失败'))
59
+ return Promise.reject({
60
+ code: data.code,
61
+ message: data.message || data.msg || '请求失败'
62
+ })
61
63
  }
62
64
  },
63
65
  (error) => {
@@ -173,7 +175,7 @@ const dataService = {
173
175
  }
174
176
  params.apiId = apiConfig.apiId
175
177
  if (apiConfig.key) {
176
- params.key = apiConfig.key
178
+ params.apiKey = apiConfig.key
177
179
  }
178
180
 
179
181
  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>
@@ -1,20 +1,29 @@
1
1
  <template>
2
2
  <div class="ebiz-page-header">
3
- <t-breadcrumb>
4
- <t-breadcrumb-item :to="{ path: '/' }">
5
- <template #icon><t-icon name="home" /></template>首页
6
- </t-breadcrumb-item>
7
- <t-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">
8
- <template #icon>
9
- <t-icon :name="item.icon" />
10
- </template>
11
- {{ item.title }}
12
- </t-breadcrumb-item>
13
- </t-breadcrumb>
14
- <div class="help-doc" @click="goToHelp">
15
- <t-icon name="chat-bubble-help-filled"></t-icon>
16
- <span>帮助文档</span>
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>
17
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
+
18
27
  </div>
19
28
  </template>
20
29
 
@@ -67,7 +76,6 @@ onMounted(() => {
67
76
  display: flex;
68
77
  align-items: center;
69
78
  justify-content: space-between;
70
- padding: 16px 0;
71
79
  }
72
80
 
73
81
  .help-doc {
@@ -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
  * 是否禁用
@@ -140,24 +142,29 @@ const focus = () => {
140
142
 
141
143
  defineExpose({
142
144
  focus,
143
- selectRef
145
+ selectRef,
146
+ options
144
147
  });
145
148
 
146
149
  // 远程搜索处理函数
147
150
  const handleRemoteSearch = async (keyword) => {
148
151
  loading.value = true;
149
- console.log('handleRemoteSearch', keyword);
150
152
  try {
151
153
  const params = {
152
154
  queryParams: {
153
155
  ...queryParams.value,
154
- keyword
156
+ name: keyword
155
157
  }
156
158
  };
157
- const res = await dataService.fetch(params, props.apiConfig);
159
+ const res = await dataService.fetch(params, {
160
+ key: props.apiConfig.key,
161
+ apiId: props.apiConfig.apiId,
162
+ apiType: 'MULTIPLE_DATA_SEARCH'
163
+ });
158
164
  const { labelField, valueField } = props.optionsConfig;
159
165
 
160
166
  options.value = res.data.map(item => ({
167
+ ...item,
161
168
  label: labelField ? item[labelField] : (item.label || item.name),
162
169
  value: valueField ? item[valueField] : (item.value || item.id)
163
170
  }));
@@ -206,6 +213,7 @@ onMounted(async () => {
206
213
  const { labelField, valueField } = props.optionsConfig;
207
214
 
208
215
  options.value = res.data.map(item => ({
216
+ ...item,
209
217
  label: labelField ? item[labelField] : (item.label || item.name),
210
218
  value: valueField ? item[valueField] : (item.value || item.id)
211
219
  }));
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <t-tree
3
+ v-bind="$attrs"
4
+ :data="data"
5
+ :value="modelValue"
6
+ :expanded="expandedModel"
7
+ :actived="activedModel"
8
+ :transition="transition"
9
+ :disable-check="disableCheck"
10
+ :keys="keys"
11
+ @change="handleChange"
12
+ @expand="handleExpand"
13
+ @active="handleActive"
14
+ @select="$emit('select', $event)"
15
+ @drag-start="$emit('drag-start', $event)"
16
+ @drag-end="$emit('drag-end', $event)"
17
+ @drag-over="$emit('drag-over', $event)"
18
+ @drag-leave="$emit('drag-leave', $event)"
19
+ @drag-drop="$emit('drag-drop', $event)"
20
+ @click="$emit('click', $event)"
21
+ @load="$emit('load', $event)"
22
+ >
23
+ <template v-if="$slots.default" #default="slotProps">
24
+ <slot :node="slotProps.node"></slot>
25
+ </template>
26
+ <template v-if="$slots.empty" #empty>
27
+ <slot name="empty"></slot>
28
+ </template>
29
+ <template v-if="$slots.icon" #icon="slotProps">
30
+ <slot name="icon" :node="slotProps.node"></slot>
31
+ </template>
32
+ <template v-if="$slots.label" #label="slotProps">
33
+ <slot name="label" :node="slotProps.node"></slot>
34
+ </template>
35
+ <template v-if="$slots.line" #line="slotProps">
36
+ <slot name="line" :node="slotProps.node"></slot>
37
+ </template>
38
+ <template v-if="$slots.operations" #operations="slotProps">
39
+ <slot name="operations" :node="slotProps.node"></slot>
40
+ </template>
41
+ </t-tree>
42
+ </template>
43
+
44
+ <script setup>
45
+ import { Tree as TTree } from 'tdesign-vue-next';
46
+ import { computed } from 'vue';
47
+
48
+ // 定义组件属性
49
+ const props = defineProps({
50
+ // 选中值
51
+ modelValue: {
52
+ type: Array,
53
+ default: () => []
54
+ },
55
+ // 展开节点
56
+ expanded: {
57
+ type: Array,
58
+ default: () => []
59
+ },
60
+ // 激活节点
61
+ actived: {
62
+ type: Array,
63
+ default: () => []
64
+ },
65
+ // 数据
66
+ items: {
67
+ type: Array,
68
+ default: () => []
69
+ },
70
+ // 是否启用过渡动画
71
+ transition: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ // 自定义节点禁用状态,返回true表示禁用
76
+ disableCheck: {
77
+ type: Function,
78
+ default: null
79
+ },
80
+ // 自定义节点数据中的字段名称
81
+ keys: {
82
+ type: Object,
83
+ default: () => ({
84
+ label: 'label',
85
+ value: 'value',
86
+ children: 'children'
87
+ })
88
+ }
89
+ });
90
+
91
+ // 定义组件事件
92
+ const emit = defineEmits([
93
+ 'update:modelValue',
94
+ 'update:expanded',
95
+ 'update:actived',
96
+ 'change',
97
+ 'expand',
98
+ 'active',
99
+ 'select',
100
+ 'click',
101
+ 'load',
102
+ 'drag-start',
103
+ 'drag-end',
104
+ 'drag-over',
105
+ 'drag-leave',
106
+ 'drag-drop'
107
+ ]);
108
+
109
+ // 处理items映射到data
110
+ const data = computed(() => props.items);
111
+
112
+ // 展开事件
113
+ const expandedModel = computed({
114
+ get: () => props.expanded,
115
+ set: (val) => emit('update:expanded', val)
116
+ });
117
+
118
+ // 激活节点
119
+ const activedModel = computed({
120
+ get: () => props.actived,
121
+ set: (val) => emit('update:actived', val)
122
+ });
123
+
124
+ // 值改变事件
125
+ const handleChange = (val, context) => {
126
+ emit('update:modelValue', val);
127
+ emit('change', val, context);
128
+ };
129
+
130
+ // 节点展开事件
131
+ const handleExpand = (val, context) => {
132
+ emit('update:expanded', val);
133
+ emit('expand', val, context);
134
+ };
135
+
136
+ // 节点激活事件
137
+ const handleActive = (val, context) => {
138
+ emit('update:actived', val);
139
+ emit('active', val, context);
140
+ };
141
+ </script>
142
+
143
+ <style>
144
+ .t-tree {
145
+ width: 100%;
146
+ }
147
+ </style>