update testingStep dialgowithmenu

This commit is contained in:
lb
2023-07-25 16:33:59 +08:00
parent 0c384fcf10
commit 96344ed345
12 changed files with 1572 additions and 86 deletions

View File

@@ -270,7 +270,6 @@ export default {
inject: ["urls"],
data() {
const dataForm = {};
let dataForm__duplicate = null;
const autoDisabledQueue = [];
const watingToRefreshQueue = [];
const cached = {};
@@ -374,15 +373,12 @@ export default {
});
});
if (this.configs.form.duplicate) dataForm__duplicate = JSON.parse(JSON.stringify(dataForm));
return {
// configs,
btnLoading: false,
loadingStatus: false,
activeMenu: this.configs.menu[0].name,
dataForm,
dataForm__duplicate,
detailMode: false,
autoDisabledQueue,
watingToRefreshQueue,
@@ -423,44 +419,44 @@ export default {
};
},
mounted() {
// this.configs.form.rows.forEach((row) => {
// row.forEach((col) => {
// if (
// col.changeReflects &&
// typeof col.changeReflects === "object" &&
// "fromKey" in col.changeReflects &&
// "toProp" in col.changeReflects
// ) {
// this.$watch(
// () => this.dataForm[col.prop],
// (val) => {
// if (val && col.prop in this.cached) {
// console.log("here changeReflects", col.prop, col.changeReflects.toProp, this.cached[col.prop]);
// if (typeof col.changeReflects.fromKey === "string") {
// this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find((item) => item.id === val)?.[
// col.changeReflects.fromKey
// ];
// } else if (Array.isArray(col.changeReflects.fromKey) && col.changeReflects.delimiter) {
// const foundItem = (this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(
// (item) => item.id === val
// ));
// if (foundItem) {
// const values = col.changeReflects.fromKey.map((key) => foundItem[key]);
// this.dataForm[col.changeReflects.toProp] = values.join(col.changeReflects.delimiter);
// } else {
// this.dataForm[col.changeReflects.toProp] = col.changeReflects.delimiter;
// console.log("[DialogWithMenu] mounted() 没找到对应数据");
// }
// }
// }
// },
// {
// immediate: false,
// }
// );
// }
// });
// });
this.configs.form.rows.forEach((row) => {
row.forEach((col) => {
if (
col.changeReflects &&
typeof col.changeReflects === "object" &&
"fromKey" in col.changeReflects &&
"toProp" in col.changeReflects
) {
this.$watch(
() => this.dataForm[col.prop],
(val) => {
if (val && col.prop in this.cached) {
console.log("here changeReflects", col.prop, col.changeReflects.toProp, this.cached[col.prop]);
if (typeof col.changeReflects.fromKey === "string") {
this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find((item) => item.id === val)?.[
col.changeReflects.fromKey
];
} else if (Array.isArray(col.changeReflects.fromKey) && col.changeReflects.delimiter) {
const foundItem = (this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(
(item) => item.id === val
));
if (foundItem) {
const values = col.changeReflects.fromKey.map((key) => foundItem[key]);
this.dataForm[col.changeReflects.toProp] = values.join(col.changeReflects.delimiter);
} else {
this.dataForm[col.changeReflects.toProp] = col.changeReflects.delimiter;
console.log("[DialogWithMenu] mounted() 没找到对应数据");
}
}
}
},
{
immediate: false,
}
);
}
});
});
},
watch: {
@@ -782,17 +778,7 @@ export default {
console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]);
},
handleSelectChange(col, eventValue) {
console.log("[dialog] select change: ", col, eventValue, this.dataForm__duplicate);
if (this.dataForm__duplicate !== null) {
console.log("before B--------->", this.dataForm__duplicate);
const shape = this.cached[col.prop].find((item) => item.id === eventValue);
this.$set(
this.dataForm__duplicate,
col.changeReflects.toProp,
shape && col.changeReflects.toProp in shape ? shape[col.changeReflects.toProp] : null
);
console.log("B--------->", shape, this.dataForm__duplicate);
}
console.log("[dialog] select change: ", col, eventValue);
},
handleSwitchChange(val) {
console.log("[dialog] switch change: ", val, this.dataForm);
@@ -812,8 +798,6 @@ export default {
case "update": {
this.$refs.dataForm[0].validate((passed, result) => {
if (passed) {
// 判断dataForm类型
let dataForm = this.dataForm__duplicate !== null ? this.dataForm__duplicate : this.dataForm;
// 如果通过验证
this.btnLoading = true;
this.loadingStatus = true;
@@ -823,8 +807,7 @@ export default {
const hasAttachment = !!this.configs.menu.find((item) => item.key === "attachment");
if (hasAttachment) {
const fileIds = this.fileList.map((item) => item.id);
// this.$set(this.dataForm, "fileIds", fileIds);
dataForm.fileIds = fileIds;
this.$set(this.dataForm, "fileIds", fileIds);
}
// 加载额外需要的 id
@@ -845,8 +828,6 @@ export default {
// console.log('actualPayload', actualPayload);
// }
console.log("before update:", dataForm);
// 实际发送请求
this.btnLoading = true;
this.$http({
@@ -854,8 +835,7 @@ export default {
method,
data: {
...extraIds,
// ...this.dataForm,
...dataForm,
...this.dataForm,
},
})
.then(({ data: res }) => {

View File

@@ -11,7 +11,7 @@ export default {
},
data() {
return {
orderStatusMap: ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝"],
orderStatusMap: ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝", "已下发"],
};
},
render: function (h) {