Commit 1146ee0d by Lin

fix(shortLightAlloction): 优化上传文件逻辑,处理无匹配员工时的反馈与状态更新

1 parent 59d340f1
......@@ -428,13 +428,22 @@ export default {
cancelFun: this.whitelistFiles[index].cancelAxios,
})
.then((res) => {
this.$set(this.whitelistFiles[index], "uploadProgress", 100);
// 接口 data 内员工列表(axios 拦截器已解包为 data 对象)
const raw = res && typeof res === "object" ? res : {};
const list = Array.isArray(raw.staffList)
? raw.staffList
: (Array.isArray(raw.data?.staffList) ? raw.data.staffList : []);
// 优先判断:无匹配员工时不落库、不覆盖原有名单与文件地址,仅清空本次上传控件
if (!list.length) {
this.whitelistFiles = [];
this.uploadFileList = [];
this.$refs.whitelistUpload && this.$refs.whitelistUpload.clearFiles();
this.$message.warning("文件无匹配数据请重新上传");
return;
}
this.$set(this.whitelistFiles[index], "uploadProgress", 100);
this.phoneWhitelistStaffList = list;
// 尝试从返回值中取可预览的 url(不同后端可能字段不同)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!