@ebiz/designer-components 0.1.75 → 0.1.77
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,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ebiz-file-list" :class="{ 'mini-mode': size === 'mini' }">
|
|
3
3
|
<div v-if="computedFiles.length === 0" class="empty-state">
|
|
4
|
-
<t-icon name="file" size="
|
|
4
|
+
<t-icon name="file" size="20px" />
|
|
5
5
|
<p>暂无文件</p>
|
|
6
6
|
</div>
|
|
7
7
|
<div v-else class="file-list-container" :class="{ 'mini-container': size === 'mini' }">
|
|
@@ -362,12 +362,12 @@ const handleImageError = () => {
|
|
|
362
362
|
flex-direction: column;
|
|
363
363
|
align-items: center;
|
|
364
364
|
justify-content: center;
|
|
365
|
-
padding:
|
|
365
|
+
padding: 10px;
|
|
366
366
|
color: #999;
|
|
367
367
|
|
|
368
368
|
p {
|
|
369
369
|
margin: 8px 0 0 0;
|
|
370
|
-
font-size:
|
|
370
|
+
font-size: 12px;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
<template #body>
|
|
28
28
|
<div v-if="dialogType === 'normal'">
|
|
29
29
|
<slot name="body"></slot>
|
|
30
|
+
<slot></slot>
|
|
30
31
|
</div>
|
|
31
32
|
<div v-else-if="dialogType === 'add'">
|
|
32
33
|
<t-form ref="formRef" :loading="apiLoading" :colon="colon" :data="localFormData" :disabled="disabled"
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
<!-- 选择器 -->
|
|
42
42
|
<template v-else-if="type === 'select'">
|
|
43
43
|
<template v-if="isRemote">
|
|
44
|
-
<ebiz-remote-select v-model="computedModelValue" :
|
|
45
|
-
:
|
|
46
|
-
:
|
|
44
|
+
<ebiz-remote-select v-model="computedModelValue" :queryParams="queryParams"
|
|
45
|
+
:placeholder="placeholder || '请选择'" :disabled="disabled" :clearable="clearable"
|
|
46
|
+
:filterable="true" :multiple="multiple" :loading="loading" :apiConfig="remoteApiConfig"
|
|
47
|
+
@change="handleChange" />
|
|
47
48
|
</template>
|
|
48
49
|
<template v-else>
|
|
49
50
|
<t-select v-model="computedModelValue" :options="options" :placeholder="placeholder || '请选择'"
|
|
@@ -104,24 +105,11 @@
|
|
|
104
105
|
<!-- 视频上传 -->
|
|
105
106
|
<template v-else-if="type === 'video-upload'">
|
|
106
107
|
<div>
|
|
107
|
-
<ebiz-upload
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
:
|
|
111
|
-
:
|
|
112
|
-
:multiple="false"
|
|
113
|
-
:max="1"
|
|
114
|
-
:theme="'file'"
|
|
115
|
-
:action="action"
|
|
116
|
-
:headers="headers"
|
|
117
|
-
:withCredentials="withCredentials"
|
|
118
|
-
:beforeUpload="beforeUpload"
|
|
119
|
-
:formatResponse="formatResponse"
|
|
120
|
-
:placeholder="placeholder || '请上传视频'"
|
|
121
|
-
:sizeLimit="sizeLimit"
|
|
122
|
-
:tips="tips || '只能上传一个视频文件'"
|
|
123
|
-
@change="handleChange"
|
|
124
|
-
/>
|
|
108
|
+
<ebiz-upload v-if="!computedModelValue" v-model="computedModelValue" :disabled="disabled"
|
|
109
|
+
:accept="accept || 'video/*'" :multiple="false" :max="1" :theme="'file'" :action="action"
|
|
110
|
+
:headers="headers" :withCredentials="withCredentials" :beforeUpload="beforeUpload"
|
|
111
|
+
:formatResponse="formatResponse" :placeholder="placeholder || '请上传视频'" :sizeLimit="sizeLimit"
|
|
112
|
+
:tips="tips || '只能上传一个视频文件'" @change="handleChange" />
|
|
125
113
|
<div v-else style="display: flex; position: relative;">
|
|
126
114
|
<video :src="computedModelValue" controls autoplay muted width="400"></video>
|
|
127
115
|
<div style="position: absolute; top: 5px; right: 5px;">
|
|
@@ -157,19 +145,10 @@
|
|
|
157
145
|
|
|
158
146
|
<!-- 富文本编辑器 -->
|
|
159
147
|
<template v-else-if="type === 'rich-text'">
|
|
160
|
-
<ebiz-rich-text-editor
|
|
161
|
-
|
|
162
|
-
:
|
|
163
|
-
:
|
|
164
|
-
:readonly="readonly"
|
|
165
|
-
:height="editorHeight"
|
|
166
|
-
:toolbar-config="editorToolbarConfig"
|
|
167
|
-
:editor-config="editorConfig"
|
|
168
|
-
:image-path="editorImagePath"
|
|
169
|
-
:video-path="editorVideoPath"
|
|
170
|
-
:max-length="maxLength"
|
|
171
|
-
@change="handleChange"
|
|
172
|
-
/>
|
|
148
|
+
<ebiz-rich-text-editor v-model="computedModelValue" :placeholder="placeholder || '请输入内容'"
|
|
149
|
+
:disabled="disabled" :readonly="readonly" :height="editorHeight"
|
|
150
|
+
:toolbar-config="editorToolbarConfig" :editor-config="editorConfig" :image-path="editorImagePath"
|
|
151
|
+
:video-path="editorVideoPath" :max-length="maxLength" @change="handleChange" />
|
|
173
152
|
</template>
|
|
174
153
|
|
|
175
154
|
<!-- 子表格 -->
|
|
@@ -190,13 +169,13 @@
|
|
|
190
169
|
</div>
|
|
191
170
|
|
|
192
171
|
<!-- 表格 -->
|
|
193
|
-
<t-table :data="computedModelValue" :columns="computedTableColumns" :pagination="false"
|
|
194
|
-
size="small" bordered :empty="'暂无数据'"
|
|
172
|
+
<t-table :data="computedModelValue" :columns="computedTableColumns" :pagination="false"
|
|
173
|
+
row-key="__id" size="small" bordered :empty="'暂无数据'">
|
|
195
174
|
<!-- 序号列 -->
|
|
196
175
|
<template #index="{ rowIndex }">
|
|
197
176
|
{{ rowIndex + 1 }}
|
|
198
177
|
</template>
|
|
199
|
-
|
|
178
|
+
|
|
200
179
|
<!-- 动态渲染每个数据列 -->
|
|
201
180
|
<template v-for="col in tableColumns" :key="col.key" #[col.key]="{ row, rowIndex }">
|
|
202
181
|
<!-- 输入框 -->
|
|
@@ -213,10 +192,10 @@
|
|
|
213
192
|
@update:model-value="(value) => updateTableCell(rowIndex, col.key, value)" />
|
|
214
193
|
|
|
215
194
|
<!-- 选择器 -->
|
|
216
|
-
<t-select v-else-if="col.type === 'select'" v-model="row[col.key]"
|
|
217
|
-
:
|
|
218
|
-
:
|
|
219
|
-
:
|
|
195
|
+
<t-select v-else-if="col.type === 'select'" v-model="row[col.key]" :disabled="disabled"
|
|
196
|
+
:placeholder="col.placeholder || `请选择${col.name}`" :options="col.options || []"
|
|
197
|
+
:clearable="col.clearable !== false" :filterable="col.filterable"
|
|
198
|
+
:multiple="col.multiple"
|
|
220
199
|
@update:model-value="(value) => updateTableCell(rowIndex, col.key, value)" />
|
|
221
200
|
|
|
222
201
|
<!-- 日期选择器 -->
|
|
@@ -233,8 +212,7 @@
|
|
|
233
212
|
@update:model-value="(value) => updateTableCell(rowIndex, col.key, value)" />
|
|
234
213
|
|
|
235
214
|
<!-- 开关 -->
|
|
236
|
-
<t-switch v-else-if="col.type === 'switch'" v-model="row[col.key]"
|
|
237
|
-
:disabled="disabled"
|
|
215
|
+
<t-switch v-else-if="col.type === 'switch'" v-model="row[col.key]" :disabled="disabled"
|
|
238
216
|
@update:model-value="(value) => updateTableCell(rowIndex, col.key, value)" />
|
|
239
217
|
|
|
240
218
|
<!-- 文本域 -->
|
|
@@ -330,6 +308,11 @@ const props = defineProps({
|
|
|
330
308
|
'color-picker', 'employee', 'dept', 'table', 'rich-text'
|
|
331
309
|
].includes(val)
|
|
332
310
|
},
|
|
311
|
+
|
|
312
|
+
queryParams: {
|
|
313
|
+
type: Object,
|
|
314
|
+
default: () => ({})
|
|
315
|
+
},
|
|
333
316
|
/**
|
|
334
317
|
* 绑定的值
|
|
335
318
|
*/
|
|
@@ -756,9 +739,9 @@ const computedModelValue = computed({
|
|
|
756
739
|
// 表格列配置计算属性
|
|
757
740
|
const computedTableColumns = computed(() => {
|
|
758
741
|
if (props.type !== 'table' || !props.tableColumns?.length) return [];
|
|
759
|
-
|
|
742
|
+
|
|
760
743
|
const columns = [];
|
|
761
|
-
|
|
744
|
+
|
|
762
745
|
// 添加序号列
|
|
763
746
|
columns.push({
|
|
764
747
|
colKey: 'index',
|
|
@@ -766,7 +749,7 @@ const computedTableColumns = computed(() => {
|
|
|
766
749
|
width: 80,
|
|
767
750
|
align: 'center'
|
|
768
751
|
});
|
|
769
|
-
|
|
752
|
+
|
|
770
753
|
// 添加用户配置的列
|
|
771
754
|
const userColumns = props.tableColumns.map(col => ({
|
|
772
755
|
colKey: col.key,
|
|
@@ -774,9 +757,9 @@ const computedTableColumns = computed(() => {
|
|
|
774
757
|
width: col.width || undefined,
|
|
775
758
|
align: col.align || 'left'
|
|
776
759
|
}));
|
|
777
|
-
|
|
760
|
+
|
|
778
761
|
columns.push(...userColumns);
|
|
779
|
-
|
|
762
|
+
|
|
780
763
|
// 添加操作列
|
|
781
764
|
if (props.showTableActions) {
|
|
782
765
|
columns.push({
|
|
@@ -786,7 +769,7 @@ const computedTableColumns = computed(() => {
|
|
|
786
769
|
align: 'center'
|
|
787
770
|
});
|
|
788
771
|
}
|
|
789
|
-
|
|
772
|
+
|
|
790
773
|
return columns;
|
|
791
774
|
});
|
|
792
775
|
|
|
@@ -820,7 +803,7 @@ const clearVideoUpload = () => {
|
|
|
820
803
|
const addTableRow = () => {
|
|
821
804
|
const currentData = computedModelValue.value || [];
|
|
822
805
|
const newRow = {};
|
|
823
|
-
|
|
806
|
+
|
|
824
807
|
// 根据表格列配置初始化新行数据
|
|
825
808
|
props.tableColumns.forEach(col => {
|
|
826
809
|
// 根据列类型设置默认值
|
|
@@ -846,7 +829,7 @@ const addTableRow = () => {
|
|
|
846
829
|
break;
|
|
847
830
|
}
|
|
848
831
|
});
|
|
849
|
-
|
|
832
|
+
|
|
850
833
|
const newData = [...currentData, newRow];
|
|
851
834
|
// 只更新computedModelValue,让watch自动处理change事件
|
|
852
835
|
computedModelValue.value = JSON.parse(JSON.stringify(newData));
|
|
@@ -858,10 +841,10 @@ const addTableRow = () => {
|
|
|
858
841
|
*/
|
|
859
842
|
const removeTableRow = (rowIndex) => {
|
|
860
843
|
if (props.type !== 'table') return;
|
|
861
|
-
|
|
844
|
+
|
|
862
845
|
const currentData = [...(computedModelValue.value || [])];
|
|
863
846
|
currentData.splice(rowIndex, 1);
|
|
864
|
-
|
|
847
|
+
|
|
865
848
|
// 只更新computedModelValue,让watch自动处理change事件
|
|
866
849
|
computedModelValue.value = currentData;
|
|
867
850
|
};
|
|
@@ -874,14 +857,14 @@ const removeTableRow = (rowIndex) => {
|
|
|
874
857
|
*/
|
|
875
858
|
const updateTableCell = (rowIndex, colKey, value) => {
|
|
876
859
|
if (props.type !== 'table') return;
|
|
877
|
-
|
|
860
|
+
|
|
878
861
|
const currentData = [...(computedModelValue.value || [])];
|
|
879
862
|
if (currentData[rowIndex]) {
|
|
880
863
|
currentData[rowIndex] = {
|
|
881
864
|
...currentData[rowIndex],
|
|
882
865
|
[colKey]: value
|
|
883
866
|
};
|
|
884
|
-
|
|
867
|
+
|
|
885
868
|
// 只更新computedModelValue,让watch自动处理change事件
|
|
886
869
|
computedModelValue.value = currentData;
|
|
887
870
|
}
|