|
|
@@ -683,12 +683,32 @@ function handleDelete(row) {
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
function handleExport() {
|
|
|
- // 显示字段选择对话框
|
|
|
- showExportFieldsDialog.value = true;
|
|
|
- // 初始时不选中任何字段(符合用户期望)
|
|
|
- exportFieldsSelected.value = [];
|
|
|
- // 获取导出字段数据
|
|
|
- getExportFieldsData();
|
|
|
+ // 获取导出字段数据并处理默认选中
|
|
|
+ getExportFieldsData().then(() => {
|
|
|
+ // 显示字段选择对话框
|
|
|
+ showExportFieldsDialog.value = true;
|
|
|
+
|
|
|
+ // 定义默认选中的字段(基于字段标签)
|
|
|
+ const defaultSelectedLabels = [
|
|
|
+ '风机编号',
|
|
|
+ '维保中心',
|
|
|
+ '场站',
|
|
|
+ '品牌',
|
|
|
+ '机型',
|
|
|
+ '责任人'
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 在导出字段中查找对应的key
|
|
|
+ const selectedKeys = [];
|
|
|
+ exportFieldsData.value.forEach(field => {
|
|
|
+ if (defaultSelectedLabels.includes(field.label)) {
|
|
|
+ selectedKeys.push(field.key);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置默认选中的字段
|
|
|
+ exportFieldsSelected.value = selectedKeys;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/** 确认导出 */
|
|
|
@@ -713,9 +733,10 @@ function confirmExport() {
|
|
|
|
|
|
/** 获取导出字段数据 */
|
|
|
function getExportFieldsData() {
|
|
|
- getExportFields().then(response => {
|
|
|
- exportFieldsData.value = response.data
|
|
|
- })
|
|
|
+ return getExportFields().then(response => {
|
|
|
+ exportFieldsData.value = response.data;
|
|
|
+ return response.data;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/** 导入按钮操作 */
|