cloud-web-corejs 1.0.54-dev.555 → 1.0.54-dev.557
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 +1 -3
- package/src/components/baseAlert/mixins.js +1 -61
- package/src/components/baseInputExport/mixins.js +1 -391
- package/src/components/errorMsg/mixins.js +1 -96
- package/src/components/excelImport/mixins.js +1 -774
- package/src/components/fileLibrary/index.vue +15 -17
- package/src/components/hiprint/view/design/index.vue +139 -47
- package/src/components/hiprint/view/design/preview.vue +75 -52
- package/src/components/hiprint/view/json-view.vue +31 -31
- package/src/components/luckysheet/dialog.vue +1 -12
- package/src/components/luckysheet/export.js +1 -591
- package/src/components/luckysheet/fileUtils.js +1 -147
- package/src/components/luckysheet/index.js +1 -72
- package/src/components/luckysheet/view.vue +0 -92
- package/src/components/oplogTable/mixins.js +1 -80
- package/src/components/table/index.js +1 -1044
- package/src/components/wf/wf.js +1 -2156
- package/src/components/wf/wfUtil.js +1 -279
- package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1 -1752
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1 -1630
- package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +1 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +1 -3043
- package/src/components/xform/form-render/container-item/table2-item.vue +12 -4
- package/src/components/xform/form-render/indexMixin.js +1 -3677
- package/src/mixins/tableTree/index.js +1 -196
- package/src/router/modules/customer.js +7 -7
- package/src/store/modules/permission.js +2 -2
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +1 -239
- package/src/views/bd/setting/form_script/mixins/dialog.js +1 -130
- package/src/views/bd/setting/form_script/mixins/edit.js +2 -199
- package/src/views/bd/setting/form_script/mixins/edit1.js +2 -193
- package/src/views/bd/setting/form_script/mixins/list.js +1 -236
- package/src/views/bd/setting/form_script/mixins/list1.js +1 -410
- package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +1 -278
- package/src/views/bd/setting/form_template/mixins/edit.js +1 -225
- package/src/views/bd/setting/form_template/mixins/list.js +1 -665
- package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +1 -187
- package/src/views/bd/setting/menu_kind/mixins/authDialog.js +1 -294
- package/src/views/bd/setting/menu_kind/mixins/list.js +1 -201
- package/src/views/bd/setting/table_model/mixins/edit.js +1 -1189
- package/src/views/bd/setting/table_model/mixins/list.js +1 -427
- package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +1 -195
- package/src/views/user/ledger_library/list.vue +12 -10
- package/src/views/user/position/list.vue +68 -124
- package/src/components/luckysheet/README.md +0 -329
- package/src/components/luckysheet/colorTest.js +0 -54
- package/src/components/luckysheet/exportExample.js +0 -182
- package/src/components/luckysheet/fileConversionExample.js +0 -127
- package/src/components/luckysheet/testExport.js +0 -57
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +0 -1639
- package/src/components/xform/utils/formula-util copy 2.js +0 -945
- package/src/components/xform/utils/formula-util copy.js +0 -856
|
@@ -2,70 +2,35 @@
|
|
|
2
2
|
<div id="containt">
|
|
3
3
|
<el-tabs v-model="activeName" class="tab-box">
|
|
4
4
|
<el-tab-pane :label="$t1('常规')" name="first">
|
|
5
|
-
<editView
|
|
6
|
-
|
|
7
|
-
visible-key="showEdit"
|
|
8
|
-
:_dataId.sync="dataId"
|
|
9
|
-
:parent-target="_self"
|
|
10
|
-
@reload="$reloadHandle"
|
|
11
|
-
></editView>
|
|
5
|
+
<editView v-if="showEdit" visible-key="showEdit" :_dataId.sync="dataId" :parent-target="_self"
|
|
6
|
+
@reload="$reloadHandle"></editView>
|
|
12
7
|
</el-tab-pane>
|
|
13
8
|
<el-tab-pane :label="$t1('列表')" name="second">
|
|
14
9
|
<div class="grid-height">
|
|
15
|
-
<vxe-grid
|
|
16
|
-
|
|
17
|
-
v-bind="vxeOption"
|
|
18
|
-
@resizable-change="$vxeTableUtil.onColumnWitchChange"
|
|
19
|
-
@custom="$vxeTableUtil.customHandle"
|
|
20
|
-
>
|
|
10
|
+
<vxe-grid ref="table-m1" v-bind="vxeOption" @resizable-change="$vxeTableUtil.onColumnWitchChange"
|
|
11
|
+
@custom="$vxeTableUtil.customHandle">
|
|
21
12
|
<template #form>
|
|
22
13
|
<div class="clearfix screen-btns">
|
|
23
14
|
<div class="fl">
|
|
24
|
-
<vxe-button
|
|
25
|
-
|
|
26
|
-
class="button-sty"
|
|
27
|
-
icon="el-icon-plus"
|
|
28
|
-
@click="openEditDialog"
|
|
29
|
-
>
|
|
30
|
-
{{ $t1("新增") }}
|
|
15
|
+
<vxe-button status="primary" class="button-sty" icon="el-icon-plus" @click="openEditDialog">
|
|
16
|
+
{{ $t1('新增') }}
|
|
31
17
|
</vxe-button>
|
|
32
|
-
<base-table-export
|
|
33
|
-
:option="{ title: $t1('岗位导出'), targetRef: 'table-m1' }"
|
|
34
|
-
:parent-target="_self"
|
|
35
|
-
/>
|
|
18
|
+
<base-table-export :option="{ title: $t1('岗位导出'), targetRef: 'table-m1'}" :parent-target="_self"/>
|
|
36
19
|
</div>
|
|
37
20
|
<div class="fr">
|
|
38
|
-
<vxe-button
|
|
39
|
-
|
|
40
|
-
class="button-sty"
|
|
41
|
-
@click="resetEvent"
|
|
42
|
-
type="text"
|
|
43
|
-
status="primary"
|
|
44
|
-
plain
|
|
45
|
-
>{{ $t1("重置") }}
|
|
21
|
+
<vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
|
|
22
|
+
plain>{{ $t1('重置') }}
|
|
46
23
|
</vxe-button>
|
|
47
|
-
<vxe-button
|
|
48
|
-
|
|
49
|
-
icon="el-icon-search"
|
|
50
|
-
class="button-sty"
|
|
51
|
-
@click="searchEvent"
|
|
52
|
-
>
|
|
53
|
-
{{ $t1("搜索") }}
|
|
24
|
+
<vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">
|
|
25
|
+
{{ $t1('搜索') }}
|
|
54
26
|
</vxe-button>
|
|
55
27
|
</div>
|
|
56
28
|
</div>
|
|
57
|
-
<vxe-form
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
title-width="92px"
|
|
61
|
-
title-align="right"
|
|
62
|
-
:data="formData"
|
|
63
|
-
@submit="searchEvent"
|
|
64
|
-
@reset="searchEvent"
|
|
65
|
-
>
|
|
66
|
-
<vxe-form-item :title="$t1('岗位名称') + ':'" field="name">
|
|
29
|
+
<vxe-form ref="form" class="screen-box" title-width="92px" title-align="right" :data="formData"
|
|
30
|
+
@submit="searchEvent" @reset="searchEvent">
|
|
31
|
+
<vxe-form-item :title="$t1('岗位名称')+':'" field="name">
|
|
67
32
|
<template v-slot>
|
|
68
|
-
<el-input v-model="formData.name" size="small" clearable
|
|
33
|
+
<el-input v-model="formData.name" size="small" clearable/>
|
|
69
34
|
</template>
|
|
70
35
|
</vxe-form-item>
|
|
71
36
|
<!-- <vxe-form-item :title="$t1('岗位编码')+':'" field="code">
|
|
@@ -83,18 +48,18 @@
|
|
|
83
48
|
</template>
|
|
84
49
|
|
|
85
50
|
<script>
|
|
86
|
-
import editView from
|
|
51
|
+
import editView from './edit.vue';
|
|
87
52
|
|
|
88
53
|
export default {
|
|
89
|
-
name:
|
|
90
|
-
components: {
|
|
54
|
+
name: 'position:list',
|
|
55
|
+
components: {editView},
|
|
91
56
|
data() {
|
|
92
57
|
return {
|
|
93
|
-
activeName:
|
|
58
|
+
activeName: 'second',
|
|
94
59
|
dataId: 0,
|
|
95
60
|
showEdit: false,
|
|
96
61
|
vxeOption: {},
|
|
97
|
-
formData: {}
|
|
62
|
+
formData: {}
|
|
98
63
|
};
|
|
99
64
|
},
|
|
100
65
|
mounted() {
|
|
@@ -102,85 +67,85 @@ export default {
|
|
|
102
67
|
},
|
|
103
68
|
methods: {
|
|
104
69
|
searchEvent() {
|
|
105
|
-
this.$refs[
|
|
70
|
+
this.$refs['table-m1'].commitProxy('reload');
|
|
106
71
|
},
|
|
107
72
|
resetEvent() {
|
|
108
73
|
this.formData = {};
|
|
109
|
-
this.$refs[
|
|
74
|
+
this.$refs['table-m1'].commitProxy('reload');
|
|
110
75
|
},
|
|
111
76
|
openEditDialog(id) {
|
|
112
|
-
this.dataId = !id || typeof id ==
|
|
113
|
-
this.activeName =
|
|
114
|
-
this.$openEditView(
|
|
77
|
+
this.dataId = !id || typeof id == 'object' ? 0 : id;
|
|
78
|
+
this.activeName = 'first';
|
|
79
|
+
this.$openEditView('showEdit');
|
|
115
80
|
},
|
|
116
81
|
initTableList() {
|
|
117
82
|
let that = this;
|
|
118
83
|
let tableOption = {
|
|
119
84
|
vue: this,
|
|
120
|
-
tableRef:
|
|
121
|
-
tableName:
|
|
122
|
-
path: USER_PREFIX +
|
|
85
|
+
tableRef: 'table-m1',
|
|
86
|
+
tableName: 'basic_position_list-m2',
|
|
87
|
+
path: USER_PREFIX + '/position/listCurrentPage',
|
|
123
88
|
param: () => {
|
|
124
89
|
return this.formData;
|
|
125
90
|
},
|
|
126
91
|
columns: [
|
|
127
|
-
{
|
|
92
|
+
{type: 'checkbox', width: 48, resizable: false, fixed: 'left'},
|
|
128
93
|
{
|
|
129
|
-
title: this.$t1(
|
|
130
|
-
field:
|
|
94
|
+
title: this.$t1('岗位名称'),
|
|
95
|
+
field: 'name',
|
|
131
96
|
width: 150,
|
|
132
|
-
fixed:
|
|
97
|
+
fixed: 'left'
|
|
133
98
|
},
|
|
134
99
|
/* {
|
|
135
100
|
field: 'code',
|
|
136
101
|
title: this.$t1('岗位编码'),
|
|
137
102
|
width: 250
|
|
138
103
|
}, */
|
|
139
|
-
{
|
|
104
|
+
{title: this.$t1('所属组织'), field: 'companyName', width: 150},
|
|
140
105
|
{
|
|
141
|
-
field:
|
|
142
|
-
title: this.$t1(
|
|
106
|
+
field: 'enabled',
|
|
107
|
+
title: this.$t1('是否启用'),
|
|
143
108
|
width: 150,
|
|
144
109
|
slots: {
|
|
145
|
-
default: ({
|
|
110
|
+
default: ({row}) => {
|
|
146
111
|
if (row.enabled) {
|
|
147
112
|
return [
|
|
148
113
|
<div class="txt-status">
|
|
149
|
-
<span>{this.$t1(
|
|
150
|
-
</div
|
|
114
|
+
<span>{this.$t1('启用')}</span>
|
|
115
|
+
</div>
|
|
151
116
|
];
|
|
152
117
|
} else {
|
|
153
118
|
return [
|
|
154
119
|
<div class="txt-status disable">
|
|
155
|
-
<span>{this.$t1(
|
|
156
|
-
</div
|
|
120
|
+
<span>{this.$t1('禁用')}</span>
|
|
121
|
+
</div>
|
|
157
122
|
];
|
|
158
123
|
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
161
126
|
},
|
|
162
127
|
{
|
|
163
|
-
field:
|
|
164
|
-
title: this.$t1(
|
|
165
|
-
width: 150
|
|
128
|
+
field: 'createDate',
|
|
129
|
+
title: this.$t1('创建时间'),
|
|
130
|
+
width: 150
|
|
166
131
|
},
|
|
167
132
|
{
|
|
168
|
-
field:
|
|
169
|
-
title: this.$t1(
|
|
170
|
-
width: 150
|
|
133
|
+
field: '_createBy',
|
|
134
|
+
title: this.$t1('创建人'),
|
|
135
|
+
width: 150
|
|
171
136
|
},
|
|
172
137
|
{
|
|
173
|
-
field:
|
|
174
|
-
title: this.$t1(
|
|
175
|
-
width: 150
|
|
138
|
+
field: '_modifyBy',
|
|
139
|
+
title: this.$t1('更新人'),
|
|
140
|
+
width: 150
|
|
176
141
|
},
|
|
177
142
|
{
|
|
178
143
|
width: 47,
|
|
179
|
-
fixed:
|
|
180
|
-
title:
|
|
144
|
+
fixed: 'right',
|
|
145
|
+
title: '',
|
|
181
146
|
sortable: false,
|
|
182
147
|
slots: {
|
|
183
|
-
default: ({
|
|
148
|
+
default: ({row}) => {
|
|
184
149
|
return [
|
|
185
150
|
<div>
|
|
186
151
|
<a
|
|
@@ -190,40 +155,19 @@ export default {
|
|
|
190
155
|
this.openEditDialog(row.id);
|
|
191
156
|
}}
|
|
192
157
|
>
|
|
193
|
-
<el-tooltip
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
content={this.$t1("查看")}
|
|
197
|
-
placement="top"
|
|
198
|
-
popper-class="tooltip-skin"
|
|
199
|
-
>
|
|
200
|
-
<i class="el-icon-edit" />
|
|
158
|
+
<el-tooltip enterable={false} effect="dark" content={this.$t1('查看')} placement="top"
|
|
159
|
+
popper-class="tooltip-skin">
|
|
160
|
+
<i class="el-icon-edit"/>
|
|
201
161
|
</el-tooltip>
|
|
202
162
|
</a>
|
|
203
|
-
</div
|
|
163
|
+
</div>
|
|
204
164
|
];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
config: {
|
|
210
|
-
loadingConfig: {
|
|
211
|
-
icon: "vxe-icon-indicator roll",
|
|
212
|
-
text: "正在拼命加载中...",
|
|
213
|
-
},
|
|
214
|
-
slots: {
|
|
215
|
-
loading() {
|
|
216
|
-
return `<div class="vxe-loading tttt">
|
|
217
|
-
<div class="vxe-loading__text">{this.loadingConfig.text}</div>
|
|
218
|
-
<div class="vxe-loading__icon">
|
|
219
|
-
<i class={this.loadingConfig.icon}></i>
|
|
220
|
-
</div>
|
|
221
|
-
</div>`;
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
},
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
]
|
|
225
169
|
};
|
|
226
|
-
this.$vxeTableUtil.initVxeTable(tableOption).then(
|
|
170
|
+
this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
|
|
227
171
|
this.vxeOption = opts;
|
|
228
172
|
});
|
|
229
173
|
},
|
|
@@ -231,14 +175,14 @@ export default {
|
|
|
231
175
|
let that = this;
|
|
232
176
|
that.$excelImport({
|
|
233
177
|
prefix: USER_PREFIX,
|
|
234
|
-
excel: USER_PREFIX +
|
|
178
|
+
excel: USER_PREFIX + '/excelTemplate/position/position.xlsx',
|
|
235
179
|
multi: false,
|
|
236
|
-
saveUrl: USER_PREFIX +
|
|
180
|
+
saveUrl: USER_PREFIX + '/position/save',
|
|
237
181
|
callback: () => {
|
|
238
182
|
that.searchEvent();
|
|
239
|
-
}
|
|
183
|
+
}
|
|
240
184
|
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
243
187
|
};
|
|
244
188
|
</script>
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
# Luckysheet Excel 导出功能改进说明
|
|
2
|
-
|
|
3
|
-
## 主要改进内容
|
|
4
|
-
|
|
5
|
-
### 1. **列宽处理优化**
|
|
6
|
-
- 添加了 `setColumnWidths` 函数,能够根据原始数据的列宽配置自动设置Excel列宽
|
|
7
|
-
- 提供了合理的默认列宽(15个字符宽度)
|
|
8
|
-
- 设置了列宽范围限制(8-100个字符),避免显示异常
|
|
9
|
-
|
|
10
|
-
### 2. **样式处理增强**
|
|
11
|
-
- **字体映射优化**: 改进了中文字体到Excel字体的标准映射
|
|
12
|
-
- 微软雅黑 → Microsoft YaHei
|
|
13
|
-
- 宋体 → SimSun
|
|
14
|
-
- 黑体 → SimHei
|
|
15
|
-
- 楷体 → KaiTi
|
|
16
|
-
- 仿宋 → FangSong
|
|
17
|
-
- **颜色处理**: 完善了RGBA颜色格式支持,正确处理透明度
|
|
18
|
-
- **字体大小**: 添加了8-72pt的范围限制
|
|
19
|
-
- **数字格式**: 新增完整的数字格式转换支持
|
|
20
|
-
|
|
21
|
-
### 3. **工作表属性完善**
|
|
22
|
-
- 添加了工作簿元数据(创建者、修改时间等)
|
|
23
|
-
- 设置了工作表属性(默认行高、标签颜色)
|
|
24
|
-
- 配置了页面设置(A4纸张、纵向布局)
|
|
25
|
-
- 使用了标准的Excel MIME类型
|
|
26
|
-
|
|
27
|
-
### 4. **新增功能**
|
|
28
|
-
- `setRowHeights`: 行高设置功能
|
|
29
|
-
- `convertNumberFormat`: 数字格式转换
|
|
30
|
-
- 更好的错误处理机制
|
|
31
|
-
- 内存管理优化
|
|
32
|
-
|
|
33
|
-
### 5. **Base64文件转换功能** ⭐ **新增**
|
|
34
|
-
- **File转Base64**: `fileToBase64(file)` - 将File对象转换为Base64数据URL
|
|
35
|
-
- **Base64转File**: `base64ToFile(base64, filename, mimeType)` - 将Base64数据转换回File对象
|
|
36
|
-
- **Base64转Blob**: `base64ToBlob(base64, mimeType)` - 将Base64数据转换为Blob对象
|
|
37
|
-
- **直接下载**: `downloadBase64File(base64, filename, mimeType)` - 直接下载Base64数据为文件
|
|
38
|
-
- **MIME类型常量**: 提供常用的文件MIME类型映射
|
|
39
|
-
|
|
40
|
-
### 6. **API接口保持兼容**
|
|
41
|
-
- 保留了原有的三个主要导出函数
|
|
42
|
-
- 添加了使用示例和详细文档
|
|
43
|
-
- 提供了多种使用场景的支持
|
|
44
|
-
|
|
45
|
-
## Base64转换功能使用说明
|
|
46
|
-
|
|
47
|
-
### 基本用法
|
|
48
|
-
|
|
49
|
-
```javascript
|
|
50
|
-
import {
|
|
51
|
-
fileToBase64,
|
|
52
|
-
base64ToFile,
|
|
53
|
-
base64ToBlob,
|
|
54
|
-
downloadBase64File,
|
|
55
|
-
MIME_TYPES
|
|
56
|
-
} from './fileUtils.js';
|
|
57
|
-
|
|
58
|
-
// File转Base64
|
|
59
|
-
const base64 = await fileToBase64(file);
|
|
60
|
-
|
|
61
|
-
// Base64转File
|
|
62
|
-
const file = base64ToFile(base64, 'filename.xlsx', MIME_TYPES.EXCEL);
|
|
63
|
-
|
|
64
|
-
// Base64转Blob
|
|
65
|
-
const blob = base64ToBlob(base64, MIME_TYPES.EXCEL);
|
|
66
|
-
|
|
67
|
-
// 直接下载
|
|
68
|
-
downloadBase64File(base64, 'download.xlsx', MIME_TYPES.EXCEL);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 在对话框中的应用
|
|
72
|
-
|
|
73
|
-
对话框组件现在会在提交时自动进行双向转换:
|
|
74
|
-
- 原始File对象 → Base64字符串
|
|
75
|
-
- Base64字符串 → 转换后的File对象
|
|
76
|
-
- 返回的数据包含:`file`、`base64`、`convertedFile` 三个版本
|
|
77
|
-
|
|
78
|
-
### 支持的文件类型
|
|
79
|
-
|
|
80
|
-
```javascript
|
|
81
|
-
const MIME_TYPES = {
|
|
82
|
-
EXCEL: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
83
|
-
PDF: 'application/pdf',
|
|
84
|
-
WORD: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
85
|
-
IMAGE_JPEG: 'image/jpeg',
|
|
86
|
-
IMAGE_PNG: 'image/png',
|
|
87
|
-
IMAGE_GIF: 'image/gif',
|
|
88
|
-
TEXT: 'text/plain',
|
|
89
|
-
JSON: 'application/json'
|
|
90
|
-
};
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## 使用示例
|
|
94
|
-
|
|
95
|
-
详细使用示例请参考 [fileConversionExample.js](./fileConversionExample.js) 文件。
|
|
96
|
-
|
|
97
|
-
## 注意事项
|
|
98
|
-
|
|
99
|
-
1. Base64转换会增加约33%的数据大小
|
|
100
|
-
2. 大文件转换时注意内存使用
|
|
101
|
-
3. 转换过程中会进行错误处理,失败时返回null
|
|
102
|
-
4. 文件名和MIME类型参数可以根据实际需求自定义
|
|
103
|
-
|
|
104
|
-
## API 接口说明
|
|
105
|
-
|
|
106
|
-
### 主要导出函数
|
|
107
|
-
|
|
108
|
-
#### 1. `exportExcel(luckysheet, fileName)`
|
|
109
|
-
直接导出Excel文件并触发下载
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
import { exportExcel } from './export'
|
|
113
|
-
|
|
114
|
-
// 基础使用
|
|
115
|
-
exportExcel(luckysheetData, '我的表格')
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### 2. `generateExcelBlob(luckysheet, fileName)`
|
|
119
|
-
生成Blob对象,可用于自定义下载或其他处理
|
|
120
|
-
|
|
121
|
-
```javascript
|
|
122
|
-
import { generateExcelBlob } from './export'
|
|
123
|
-
|
|
124
|
-
const blob = await generateExcelBlob(luckysheetData, '我的表格')
|
|
125
|
-
// 可以对blob进行进一步处理
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
#### 3. `generateExcelFile(luckysheet, fileName)`
|
|
129
|
-
生成File对象
|
|
130
|
-
|
|
131
|
-
```javascript
|
|
132
|
-
import { generateExcelFile } from './export'
|
|
133
|
-
|
|
134
|
-
const file = await generateExcelFile(luckysheetData, '我的表格')
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## 数据结构要求
|
|
138
|
-
|
|
139
|
-
### 单个工作表数据结构
|
|
140
|
-
|
|
141
|
-
```javascript
|
|
142
|
-
const sheetData = {
|
|
143
|
-
name: '工作表名称',
|
|
144
|
-
data: [
|
|
145
|
-
// 第一行(标题行)
|
|
146
|
-
[
|
|
147
|
-
{ v: '列1标题', ff: 1, fc: '#000000', bl: 1, fs: 12 },
|
|
148
|
-
{ v: '列2标题', ff: 1, fc: '#000000', bl: 1, fs: 12 }
|
|
149
|
-
],
|
|
150
|
-
// 数据行
|
|
151
|
-
[
|
|
152
|
-
{ v: '数据1', ff: 0, fc: '#333333', fs: 10 },
|
|
153
|
-
{ v: '数据2', ff: 0, fc: '#333333', fs: 10 }
|
|
154
|
-
]
|
|
155
|
-
],
|
|
156
|
-
config: {
|
|
157
|
-
merge: {}, // 合并单元格配置
|
|
158
|
-
borderInfo: [], // 边框信息
|
|
159
|
-
columnlen: { // 列宽配置
|
|
160
|
-
0: 100, // 第1列宽度100px
|
|
161
|
-
1: 80 // 第2列宽度80px
|
|
162
|
-
},
|
|
163
|
-
rowlen: { // 行高配置
|
|
164
|
-
0: 25, // 第1行高度25px
|
|
165
|
-
1: 20 // 第2行高度20px
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 多个工作表数据结构
|
|
172
|
-
|
|
173
|
-
```javascript
|
|
174
|
-
const multipleSheets = [
|
|
175
|
-
{
|
|
176
|
-
name: 'Sheet1',
|
|
177
|
-
data: [...],
|
|
178
|
-
config: {...}
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: 'Sheet2',
|
|
182
|
-
data: [...],
|
|
183
|
-
config: {...}
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## 单元格属性说明
|
|
189
|
-
|
|
190
|
-
| 属性 | 类型 | 说明 | 示例 |
|
|
191
|
-
|------|------|------|------|
|
|
192
|
-
| v | any | 单元格值 | `'文本'`, `123`, `true` |
|
|
193
|
-
| ff | number/string | 字体 | `0`(微软雅黑), `'Arial'` |
|
|
194
|
-
| fc | string | 字体颜色 | `'#FF0000'`, `'#FF000080'`(带透明度) |
|
|
195
|
-
| fs | number | 字体大小 | `12` |
|
|
196
|
-
| bl | number | 粗体 | `0`(正常), `1`(粗体) |
|
|
197
|
-
| it | number | 斜体 | `0`(正常), `1`(斜体) |
|
|
198
|
-
| ul | number | 下划线 | `0`(无), `1`(下划线) |
|
|
199
|
-
| cl | number | 删除线 | `0`(无), `1`(删除线) |
|
|
200
|
-
| bg | string | 背景色 | `'#FFFF00'` |
|
|
201
|
-
| vt | number | 垂直对齐 | `0`(居中), `1`(顶部), `2`(底部) |
|
|
202
|
-
| ht | number | 水平对齐 | `0`(居中), `1`(左对齐), `2`(右对齐) |
|
|
203
|
-
| tb | number | 文本换行 | `0`(不换行), `2`(换行) |
|
|
204
|
-
| tr | number | 文字旋转 | `0`(正常), `1`(45度), `2`(-45度) |
|
|
205
|
-
| f | string | 公式 | `'SUM(A1:A10)'` |
|
|
206
|
-
| ct | object | 内容类型 | `{fa: '0.00', s: [...]}` |
|
|
207
|
-
|
|
208
|
-
## 使用示例
|
|
209
|
-
|
|
210
|
-
### 1. 基础导出
|
|
211
|
-
|
|
212
|
-
```javascript
|
|
213
|
-
import { exportExcel } from './export'
|
|
214
|
-
|
|
215
|
-
// 导出单个工作表
|
|
216
|
-
exportExcel(singleSheetData, '员工信息表')
|
|
217
|
-
|
|
218
|
-
// 导出多个工作表
|
|
219
|
-
exportExcel(multipleSheetsData, '综合报表')
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### 2. 带进度的自定义导出
|
|
223
|
-
|
|
224
|
-
```javascript
|
|
225
|
-
import { customExportExample } from './exportExample'
|
|
226
|
-
|
|
227
|
-
customExportExample(
|
|
228
|
-
sheetData,
|
|
229
|
-
'我的报表',
|
|
230
|
-
(progress, message) => {
|
|
231
|
-
console.log(`导出进度: ${progress}% - ${message}`)
|
|
232
|
-
// 更新UI进度条
|
|
233
|
-
updateProgressBar(progress)
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### 3. 获取Blob进行自定义处理
|
|
239
|
-
|
|
240
|
-
```javascript
|
|
241
|
-
import { generateExcelBlob } from './export'
|
|
242
|
-
|
|
243
|
-
const blob = await generateExcelBlob(sheetData, '报表')
|
|
244
|
-
// 上传到服务器
|
|
245
|
-
await uploadToServer(blob)
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## 常见问题解决
|
|
249
|
-
|
|
250
|
-
### 1. 列宽显示不正确
|
|
251
|
-
|
|
252
|
-
确保在config中正确设置columnlen:
|
|
253
|
-
|
|
254
|
-
```javascript
|
|
255
|
-
config: {
|
|
256
|
-
columnlen: {
|
|
257
|
-
0: 120, // A列宽度120px
|
|
258
|
-
1: 80, // B列宽度80px
|
|
259
|
-
2: 150 // C列宽度150px
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### 2. 中文字体显示异常
|
|
265
|
-
|
|
266
|
-
使用标准的字体编号或名称:
|
|
267
|
-
|
|
268
|
-
```javascript
|
|
269
|
-
// 推荐使用编号
|
|
270
|
-
{ ff: 0, v: '微软雅黑文本' } // 最佳兼容性
|
|
271
|
-
|
|
272
|
-
// 或使用标准字体名称
|
|
273
|
-
{ ff: 'Microsoft YaHei', v: '中文文本' }
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### 3. 颜色显示不正确
|
|
277
|
-
|
|
278
|
-
确保颜色格式正确:
|
|
279
|
-
|
|
280
|
-
```javascript
|
|
281
|
-
// RGB格式
|
|
282
|
-
{ fc: '#FF0000', bg: '#FFFF00' }
|
|
283
|
-
|
|
284
|
-
// RGBA格式(带透明度)
|
|
285
|
-
{ fc: '#FF000080', bg: '#FFFF00CC' }
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
### 4. 数字格式不生效
|
|
289
|
-
|
|
290
|
-
在ct属性中指定数字格式:
|
|
291
|
-
|
|
292
|
-
```javascript
|
|
293
|
-
{
|
|
294
|
-
v: 1234.56,
|
|
295
|
-
ct: {
|
|
296
|
-
fa: '#,##0.00', // 千分位格式
|
|
297
|
-
t: 'n'
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## 性能优化建议
|
|
303
|
-
|
|
304
|
-
1. **大数据量处理**: 对于超过10000行的数据,建议分批导出
|
|
305
|
-
2. **复杂样式**: 避免过度复杂的样式设置,影响导出性能
|
|
306
|
-
3. **内存管理**: 及时清理不需要的Blob URL对象
|
|
307
|
-
4. **并发控制**: 避免同时进行多个大型导出操作
|
|
308
|
-
|
|
309
|
-
## 浏览器兼容性
|
|
310
|
-
|
|
311
|
-
- ✅ Chrome 60+
|
|
312
|
-
- ✅ Firefox 55+
|
|
313
|
-
- ✅ Safari 12+
|
|
314
|
-
- ✅ Edge 79+
|
|
315
|
-
|
|
316
|
-
## 更新日志
|
|
317
|
-
|
|
318
|
-
### v2.0.0 (当前版本)
|
|
319
|
-
|
|
320
|
-
- 🎉 重构导出核心逻辑
|
|
321
|
-
- 🎉 添加列宽自动设置功能
|
|
322
|
-
- 🎉 完善样式处理和字体映射
|
|
323
|
-
- 🎉 增强错误处理和性能优化
|
|
324
|
-
- 🎉 添加详细的使用文档和示例
|
|
325
|
-
|
|
326
|
-
### v1.0.0 (原版本)
|
|
327
|
-
|
|
328
|
-
- 基础的Excel导出功能
|
|
329
|
-
- 支持基本样式和合并单元格
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { exportExcel } from './export.js'
|
|
2
|
-
|
|
3
|
-
// 测试数据 - 包含rgb()格式的颜色
|
|
4
|
-
const testData = [{
|
|
5
|
-
name: '颜色测试工作表',
|
|
6
|
-
data: [
|
|
7
|
-
// 测试rgb()背景色
|
|
8
|
-
[{
|
|
9
|
-
v: '正确的候选人',
|
|
10
|
-
bg: 'rgb(106, 168, 79)', // 绿色背景
|
|
11
|
-
fc: 'rgb(0, 0, 0)', // 黑色字体
|
|
12
|
-
bl: 1,
|
|
13
|
-
ff: 5,
|
|
14
|
-
fs: 11
|
|
15
|
-
}],
|
|
16
|
-
// 测试rgb()背景色
|
|
17
|
-
[{
|
|
18
|
-
v: '当前的候选人',
|
|
19
|
-
bg: 'rgb(255, 255, 0)', // 黄色背景
|
|
20
|
-
fc: 'rgb(0, 0, 0)', // 黑色字体
|
|
21
|
-
bl: 1,
|
|
22
|
-
ff: 5,
|
|
23
|
-
fs: 11
|
|
24
|
-
}],
|
|
25
|
-
// 测试十六进制颜色
|
|
26
|
-
[{
|
|
27
|
-
v: '十六进制测试',
|
|
28
|
-
bg: '#ff9900', // 橙色背景
|
|
29
|
-
fc: '#ffffff', // 白色字体
|
|
30
|
-
bl: 1,
|
|
31
|
-
ff: 5,
|
|
32
|
-
fs: 11
|
|
33
|
-
}]
|
|
34
|
-
],
|
|
35
|
-
config: {
|
|
36
|
-
columnlen: {0: 200},
|
|
37
|
-
rowlen: {0: 25, 1: 25, 2: 25}
|
|
38
|
-
}
|
|
39
|
-
}]
|
|
40
|
-
|
|
41
|
-
// 测试函数
|
|
42
|
-
export async function testColorExport() {
|
|
43
|
-
try {
|
|
44
|
-
console.log('开始测试颜色导出...')
|
|
45
|
-
await exportExcel(testData, 'color-test')
|
|
46
|
-
console.log('颜色测试导出完成!')
|
|
47
|
-
return true
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('颜色测试导出失败:', error)
|
|
50
|
-
return false
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default { testColorExport }
|