重构租户管理城市数据处理逻辑,支持直辖市特殊处理
This commit is contained in:
@@ -11,9 +11,7 @@
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
drag
|
||||
:action="uploadAction"
|
||||
:headers="uploadHeaders"
|
||||
:data="uploadData"
|
||||
action="#"
|
||||
:accept="acceptFileTypes"
|
||||
:limit="1"
|
||||
:on-success="handleUploadSuccess"
|
||||
@@ -84,7 +82,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, nextTick, watch, computed } from 'vue';
|
||||
import { ref, reactive, nextTick, computed } from 'vue';
|
||||
import { ElMessage, ElMessageBox, type UploadInstance, type UploadFile, type UploadFiles } from 'element-plus';
|
||||
import { UploadFilled, Download } from '@element-plus/icons-vue';
|
||||
import JSZip from 'jszip';
|
||||
@@ -107,11 +105,6 @@ const currentFile = ref<File | null>(null);
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
|
||||
// 上传配置
|
||||
const uploadAction = '/customerService/product/import';
|
||||
const uploadHeaders = reactive({
|
||||
Authorization: `Bearer ${localStorage.getItem('token') || ''}`,
|
||||
});
|
||||
const uploadData = reactive({});
|
||||
const acceptFileTypes = '.zip,.ZIP';
|
||||
const fileSizeLimit = 50;
|
||||
|
||||
@@ -126,13 +119,15 @@ const hasFile = computed(() => fileList.value.length > 0);
|
||||
* 处理文件变化事件 - 修复版本
|
||||
*/
|
||||
const handleFileChange = (file: UploadFile, files: UploadFile[]) => {
|
||||
console.log('文件变化事件:', file.status, files.length);
|
||||
|
||||
// 更新文件列表
|
||||
fileList.value = files;
|
||||
// 更新文件列表,保持单选
|
||||
if (files.length > 1) {
|
||||
fileList.value = [files[files.length - 1]];
|
||||
} else {
|
||||
fileList.value = files;
|
||||
}
|
||||
|
||||
if (file.status === 'ready') {
|
||||
currentFile.value = file.raw;
|
||||
currentFile.value = file.raw!;
|
||||
ElMessage.success('文件已选择,可以开始导入');
|
||||
}
|
||||
};
|
||||
@@ -144,7 +139,6 @@ const handleRemove = (file: UploadFile, files: UploadFile[]) => {
|
||||
fileList.value = files;
|
||||
currentFile.value = null;
|
||||
importResult.value = null;
|
||||
ElMessage.info('文件已移除');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ import { addScript, updateScript } from '/@/api/customerService/script';
|
||||
|
||||
// 定义类型接口
|
||||
interface DialogRow {
|
||||
id: number;
|
||||
id?: number | string;
|
||||
tag: string;
|
||||
creator: string;
|
||||
content: string;
|
||||
|
||||
@@ -216,7 +216,7 @@ const handleAdd = () => {
|
||||
* 编辑话术
|
||||
*/
|
||||
const handleEdit = (row: ScriptItem) => {
|
||||
editRoleRef.value?.openDialog(row);
|
||||
editRoleRef.value?.openDialog(row as any);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user