udpate 混料批次编辑

This commit is contained in:
lb 2023-03-15 14:57:54 +08:00
rodzic 977dbb7c41
commit a94d5c2715
6 zmienionych plików z 30 dodań i 26 usunięć

Wyświetl plik

@ -121,6 +121,10 @@ export default {
type: Boolean,
default: false,
},
// extraParams: {
// type: Object,
// default: () => ({})
// }
},
inject: ["urls"],
data() {
@ -248,7 +252,7 @@ export default {
},
/** init **/
init(id, detailMode, extraParams) {
init(id, detailMode, tagInfo, extraParams) {
// console.log("[DialogJustForm] init", this.dataForm, id, detailMode);
if (this.$refs.dataForm) {
// console.log("[DialogJustForm] clearing form validation...");
@ -258,6 +262,14 @@ export default {
this.detailMode = detailMode ?? false;
/** 判断 extraParams */
if (extraParams && typeof extraParams === "object") {
for (const [key, value] of Object.entries(extraParams)) {
// console.log("[dialog] dataForm | key | value", this.dataForm, key, value);
this.$set(this.dataForm, key, value);
}
}
this.$nextTick(() => {
this.dataForm.id = id || null;
if (this.dataForm.id) {
@ -298,15 +310,6 @@ export default {
});
});
} else {
// extraParams
if (extraParams && typeof extraParams === "object") {
for (const [key, value] of Object.entries(extraParams)) {
this.$set(this.dataForm, key, value);
console.log('[DialogJustForm] setting: ', key, value)
}
}
this.loadingStatus = false;
}
});

Wyświetl plik

@ -59,23 +59,23 @@ export default {
let emitFull = false;
let eventType = "default";
let customField;
let payload = {};
if (typeof opt === "object") {
eventType = opt.name;
customField = opt.emitField || "id";
emitFull = opt.emitFull || false;
if ("url" in opt) {
payload.url = this.injectData.url;
}
if ("toRouter" in opt) {
payload.toRouter = opt.toRouter;
}
} else {
eventType = opt;
}
/** 处理 toRouter */
let payload = { type: eventType, data: emitFull ? this.injectData : customField ? this.injectData[customField] : this.injectData.id };
if ("url" in opt) {
payload.url = this.injectData.url;
}
if ("toRouter" in opt) {
payload.toRouter = opt.toRouter;
}
// this.$emit('emit-data', { type: eventType, data: emitFull ? this.injectData : customField ? this.injectData[customField] : this.injectData.id, url: this.injectData.url, toRouter: opt.toRouter })
payload = { ...payload, type: eventType, data: emitFull ? this.injectData : customField ? this.injectData[customField] : this.injectData.id };
this.$emit("emit-data", payload);
},
},

Wyświetl plik

@ -451,10 +451,11 @@ export default {
if (this.attachListQueryExtra && this.listQueryExtra.length) {
this.listQueryExtra.forEach((item) => {
let found = item[this.attachListQueryExtra];
if (found !== null && found !== undefined) extraParams = found;
if (found !== null && found !== undefined) extraParams = item;
});
}
this.$nextTick(() => {
console.log(`[edit-dialog] extraParams: ${extraParams}`)
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
});
},

Wyświetl plik

@ -29,9 +29,9 @@ export default function () {
prop: "operations",
name: "操作",
fixed: "right",
width: 160,
width: 120,
subcomponent: TableOperaionComponent,
options: ['add', { name: 'edit', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual'} }] // 只有 injectRow.task 为手动时,才允许编辑
options: [{ name: 'edit', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } }] // 只有 injectRow.task 为手动时,才允许编辑
},
];

Wyświetl plik

@ -24,7 +24,7 @@ export default {
computed: {
// id
id() {
return this.$route.params.id || "";
return this.$route.query.id || "";
},
},
data() {
@ -39,10 +39,10 @@ export default {
},
watch: {
$route: {
handler: function (val) {
if (val.params.id) {
handler: function (route) {
if (route.query.id) {
this.triggerUpdateKey = Math.random().toString()
console.log('[$oute changed] val.params.id', val.params.id, this.triggerUpdateKey)
console.log('[$oute changed] val.params.id', route.query.id, this.triggerUpdateKey)
}
},
immediate: true,

Wyświetl plik

@ -212,7 +212,7 @@ export default {
case 'view-batch': {
this.$router.push({
name: toRouter,
params: {
query: {
id: data // id
}
})