add 烧制工艺
This commit is contained in:
@@ -253,14 +253,16 @@ export default {
|
||||
inject: ["urls"],
|
||||
data() {
|
||||
const dataForm = {};
|
||||
const autoDisabledList = [];
|
||||
const autoDisabledQueue = [];
|
||||
const watingToRefreshQueue = [];
|
||||
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col.upload) dataForm[col.prop] = col.default ?? [];
|
||||
else dataForm[col.prop] = col.default ?? null;
|
||||
|
||||
if (col.autoDisabled) autoDisabledList.push(col.prop);
|
||||
|
||||
if (col.autoDisabled) autoDisabledQueue.push(col.prop);
|
||||
if (!!col.refreshOptionsAfterConfirm) watingToRefreshQueue.push(col);
|
||||
if (col.fetchData)
|
||||
col.fetchData().then(({ data: res }) => {
|
||||
console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
|
||||
@@ -275,7 +277,7 @@ export default {
|
||||
);
|
||||
// col.options = res.data.list;
|
||||
else if (col.options.length) {
|
||||
res.data.list.unshift(...col.options);
|
||||
"list" in res.data ? res.data.list.unshift(...col.options) : res.data.unshift(...col.options);
|
||||
this.$set(
|
||||
col,
|
||||
"options",
|
||||
@@ -326,7 +328,8 @@ export default {
|
||||
activeMenu: this.configs.menu[0].name,
|
||||
dataForm,
|
||||
detailMode: false,
|
||||
autoDisabledList,
|
||||
autoDisabledQueue,
|
||||
watingToRefreshQueue,
|
||||
showBaseDialog: false,
|
||||
baseDialogConfig: null,
|
||||
subList: [],
|
||||
@@ -387,7 +390,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
disableCondition(prop) {
|
||||
return this.detailMode || (this.disableXXX && this.autoDisabledList.indexOf(prop) !== -1);
|
||||
return this.detailMode || (this.disableXXX && this.autoDisabledQueue.indexOf(prop) !== -1);
|
||||
},
|
||||
/** utitilities */
|
||||
showButton(operate) {
|
||||
@@ -654,12 +657,12 @@ export default {
|
||||
}
|
||||
|
||||
// 加载额外需要的 id
|
||||
let extraIds = {}
|
||||
if (this.configs.extraIds && typeof this.configs.extraIds === 'object') {
|
||||
let extraIds = {};
|
||||
if (this.configs.extraIds && typeof this.configs.extraIds === "object") {
|
||||
// 如果配置里,有 extraIds 选项
|
||||
Object.entries(this.configs.extraIds).forEach(([key, value]) => {
|
||||
extraIds[key] = value
|
||||
})
|
||||
extraIds[key] = value;
|
||||
});
|
||||
}
|
||||
|
||||
// 实际发送请求
|
||||
@@ -669,7 +672,7 @@ export default {
|
||||
data: {
|
||||
...extraIds,
|
||||
...this.dataForm,
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
console.log("[add&update] res is: ", res);
|
||||
@@ -677,6 +680,28 @@ export default {
|
||||
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
|
||||
this.$emit("refreshDataList");
|
||||
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 }))
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.handleClose();
|
||||
} else {
|
||||
this.$message({
|
||||
|
||||
Reference in New Issue
Block a user