|
|
@@ -422,6 +422,41 @@ export default { |
|
|
|
); |
|
|
|
}, |
|
|
|
|
|
|
|
updateOptions() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (!this.dataForm?.id) resolve(null); |
|
|
|
|
|
|
|
if (this.watingToRefreshQueue.length) { |
|
|
|
this.watingToRefreshQueue.forEach((opt) => { |
|
|
|
console.log("[刷新数据, ", opt, "]"); |
|
|
|
if ("fetchData" in opt) { |
|
|
|
opt.fetchData(this.dataForm.id).then(({ data: res }) => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.$set( |
|
|
|
opt, |
|
|
|
"options", |
|
|
|
"list" in res.data |
|
|
|
? res.data.list.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
: res.data.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
); |
|
|
|
|
|
|
|
resolve({ done: true }); |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
|
message: `${res.code}: ${res.msg}`, |
|
|
|
type: "error", |
|
|
|
duration: 1500, |
|
|
|
}); |
|
|
|
|
|
|
|
resolve({ done: false }); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else resolve(null); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/** init **/ |
|
|
|
init(id, detailMode, menu) { |
|
|
|
// this.dialogVisible = true; |
|
|
@@ -440,27 +475,31 @@ export default { |
|
|
|
// 提前获取属性列表 |
|
|
|
this.getSubList(); |
|
|
|
// 获取详情 |
|
|
|
this.$http.get(this.urls.base + `/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res && res.code === 0) { |
|
|
|
const dataFormKeys = Object.keys(this.dataForm); |
|
|
|
this.dataForm = __pick(res.data, dataFormKeys); |
|
|
|
if ("files" in res.data) { |
|
|
|
console.log("[DialogWithMenu] fileList===>", res.data.files, this.fileList); |
|
|
|
/** 返回的文件列表 */ |
|
|
|
this.fileList = res.data.files |
|
|
|
? res.data.files.map((file) => ({ |
|
|
|
id: file.id, |
|
|
|
name: file.fileUrl.split("/").pop(), |
|
|
|
url: file.fileUrl, |
|
|
|
typeCode: file.typeCode, |
|
|
|
})) |
|
|
|
: []; |
|
|
|
} |
|
|
|
} |
|
|
|
this.loadingStatus = false; |
|
|
|
// 是否要跳转到附件页 |
|
|
|
if (menu && menu.key) { |
|
|
|
this.activeMenu = this.configs.menu.find((item) => item.key === menu.key)?.name; |
|
|
|
this.updateOptions().then((result) => { |
|
|
|
if (result === null || (typeof result === "object" && result.done)) { |
|
|
|
this.$http.get(this.urls.base + `/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res && res.code === 0) { |
|
|
|
const dataFormKeys = Object.keys(this.dataForm); |
|
|
|
this.dataForm = __pick(res.data, dataFormKeys); |
|
|
|
if ("files" in res.data) { |
|
|
|
console.log("[DialogWithMenu] fileList===>", res.data.files, this.fileList); |
|
|
|
/** 返回的文件列表 */ |
|
|
|
this.fileList = res.data.files |
|
|
|
? res.data.files.map((file) => ({ |
|
|
|
id: file.id, |
|
|
|
name: file.fileUrl.split("/").pop(), |
|
|
|
url: file.fileUrl, |
|
|
|
typeCode: file.typeCode, |
|
|
|
})) |
|
|
|
: []; |
|
|
|
} |
|
|
|
} |
|
|
|
this.loadingStatus = false; |
|
|
|
// 是否要跳转到附件页 |
|
|
|
if (menu && menu.key) { |
|
|
|
this.activeMenu = this.configs.menu.find((item) => item.key === menu.key)?.name; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
@@ -682,25 +721,25 @@ export default { |
|
|
|
this.loadingStatus = false; |
|
|
|
|
|
|
|
// 如果 watingToRefreshQueue 队列里有数据 |
|
|
|
if (this.watingToRefreshQueue.length) { |
|
|
|
// 刷新队列 |
|
|
|
this.watingToRefreshQueue.forEach((opt) => { |
|
|
|
console.log('[刷新数据, ', opt, ']') |
|
|
|
if ("fetchData" in opt) { |
|
|
|
opt.fetchData().then(({ data: res }) => { |
|
|
|
if (res.code === 0) { |
|
|
|
this.$set( |
|
|
|
opt, |
|
|
|
"options", |
|
|
|
"list" in res.data |
|
|
|
? res.data.list.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
: res.data.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// if (this.watingToRefreshQueue.length) { |
|
|
|
// // 刷新队列 |
|
|
|
// this.watingToRefreshQueue.forEach((opt) => { |
|
|
|
// console.log("[刷新数据, ", opt, "]"); |
|
|
|
// if ("fetchData" in opt) { |
|
|
|
// opt.fetchData().then(({ data: res }) => { |
|
|
|
// if (res.code === 0) { |
|
|
|
// this.$set( |
|
|
|
// opt, |
|
|
|
// "options", |
|
|
|
// "list" in res.data |
|
|
|
// ? res.data.list.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
// : res.data.map((i) => ({ label: i.name, value: i.id })) |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
this.handleClose(); |
|
|
|
} else { |
|
|
|