| | |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="info" |
| | | plain |
| | | icon="Upload" |
| | | @click="handleImport">导入</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">删除</el-button> |
| | |
| | | <form-dia ref="formDia" |
| | | @close="handleQuery"></form-dia> |
| | | <view-dia ref="viewDia"></view-dia> |
| | | <!-- 反馈登记导入对话框 --> |
| | | <el-dialog :title="upload.title" |
| | | v-model="upload.open" |
| | | width="400px" |
| | | append-to-body> |
| | | <el-upload ref="uploadRef" |
| | | :limit="1" |
| | | accept=".xlsx, .xls" |
| | | :headers="upload.headers" |
| | | :action="upload.url" |
| | | :disabled="upload.isUploading" |
| | | :on-progress="handleFileUploadProgress" |
| | | :on-success="handleFileSuccess" |
| | | :on-error="handleFileError" |
| | | :auto-upload="false" |
| | | drag> |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | <span>仅允许导入 xls、xlsx 格式文件。</span> |
| | | <el-link type="primary" |
| | | :underline="false" |
| | | style="font-size: 12px; vertical-align: baseline" |
| | | @click="importTemplate">下载模板</el-link> |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitFileForm">确 定</el-button> |
| | | <el-button @click="upload.open = false">取 消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | getSalesLedgerDetail, |
| | | } from "@/api/customerService/index.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { getToken } from "@/utils/auth.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | import { Document, FolderOpened, UserFilled } from "@element-plus/icons-vue"; |
| | |
| | | }; |
| | | const formDia = ref(); |
| | | const viewDia = ref(); |
| | | const uploadRef = ref(); |
| | | |
| | | // 导入弹窗 |
| | | const upload = reactive({ |
| | | open: false, |
| | | title: "", |
| | | isUploading: false, |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | url: import.meta.env.VITE_APP_BASE_API + "/afterSalesService/import", |
| | | }); |
| | | |
| | | // 字典获取 |
| | | /* |
| | |
| | | }); |
| | | }; |
| | | |
| | | /** 导入按钮操作 */ |
| | | const handleImport = () => { |
| | | upload.title = "反馈登记导入"; |
| | | upload.open = true; |
| | | }; |
| | | |
| | | /** 下载模板 */ |
| | | const importTemplate = () => { |
| | | proxy.download( |
| | | "/afterSalesService/importTemplate", |
| | | {}, |
| | | "反馈登记导入模板.xlsx" |
| | | ); |
| | | }; |
| | | |
| | | /** 提交上传文件 */ |
| | | const submitFileForm = () => { |
| | | upload.isUploading = true; |
| | | uploadRef.value.submit(); |
| | | }; |
| | | |
| | | /** 文件上传中处理 */ |
| | | const handleFileUploadProgress = () => { |
| | | upload.isUploading = true; |
| | | }; |
| | | |
| | | /** 文件上传成功处理 */ |
| | | const handleFileSuccess = response => { |
| | | upload.isUploading = false; |
| | | upload.open = false; |
| | | uploadRef.value.clearFiles(); |
| | | if (response.code === 200) { |
| | | const failCount = response.failCount || 0; |
| | | if (failCount > 0) { |
| | | const errors = Array.isArray(response.errors) ? response.errors : []; |
| | | proxy.$modal |
| | | .alert(`${response.msg}\n\n${errors.join("\n")}`, "导入结果", { |
| | | confirmButtonText: "知道了", |
| | | dangerouslyUseHTMLString: false, |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | }); |
| | | } else { |
| | | proxy.$modal.msgSuccess(response.msg || "导入成功"); |
| | | getList(); |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError(response.msg || "导入失败"); |
| | | } |
| | | }; |
| | | |
| | | /** 文件上传失败处理 */ |
| | | const handleFileError = () => { |
| | | upload.isUploading = false; |
| | | proxy.$modal.msgError("文件上传失败"); |
| | | }; |
| | | |
| | | const getStatsCountByStatus = (list, status) => { |
| | | if (!Array.isArray(list)) return 0; |
| | | return list.find(item => item?.status === status)?.count || 0; |