update 混料“
This commit is contained in:
@@ -263,13 +263,15 @@ export default {
|
||||
|
||||
if (col.fetchData)
|
||||
col.fetchData().then(({ data: res }) => {
|
||||
console.log("[Fetch Data]", res.data.list);
|
||||
if (res.code === 0 && res.data.list) {
|
||||
console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
|
||||
if (res.code === 0) {
|
||||
if (!col.options || !col.options.length)
|
||||
this.$set(
|
||||
col,
|
||||
"options",
|
||||
res.data.list.map((i) => ({ label: i.name, value: i.id }))
|
||||
"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 }))
|
||||
);
|
||||
// col.options = res.data.list;
|
||||
else if (col.options.length) {
|
||||
@@ -277,7 +279,9 @@ export default {
|
||||
this.$set(
|
||||
col,
|
||||
"options",
|
||||
res.data.list.map((i) => ({ label: i.name, value: i.id }))
|
||||
"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 }))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -649,11 +653,23 @@ export default {
|
||||
this.$set(this.dataForm, "fileIds", fileIds);
|
||||
}
|
||||
|
||||
// 加载额外需要的 id
|
||||
let extraIds = {}
|
||||
if (this.configs.extraIds && typeof this.configs.extraIds === 'object') {
|
||||
// 如果配置里,有 extraIds 选项
|
||||
Object.entries(this.configs.extraIds).forEach(([key, value]) => {
|
||||
extraIds[key] = value
|
||||
})
|
||||
}
|
||||
|
||||
// 实际发送请求
|
||||
this.$http({
|
||||
url: this.urls.base,
|
||||
method,
|
||||
data: this.dataForm,
|
||||
data: {
|
||||
...extraIds,
|
||||
...this.dataForm,
|
||||
}
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
console.log("[add&update] res is: ", res);
|
||||
@@ -759,7 +775,7 @@ export default {
|
||||
switch (type) {
|
||||
case "delete": {
|
||||
// 确认是否删除
|
||||
return this.$confirm(`是否删除条目: ${data.name ?? data.material ? data.material : data.id}`, "提示", {
|
||||
return this.$confirm(`是否删除条目: ${data.name ?? (data.material ? data.material : data.id)}`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
|
||||
Reference in New Issue
Block a user