udpate 混料批次编辑

Šī revīzija ir iekļauta:
lb 2023-03-15 14:57:54 +08:00
vecāks 977dbb7c41
revīzija a94d5c2715
6 mainīti faili ar 30 papildinājumiem un 26 dzēšanām

Parādīt failu

@ -121,6 +121,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
// extraParams: {
// type: Object,
// default: () => ({})
// }
}, },
inject: ["urls"], inject: ["urls"],
data() { data() {
@ -248,7 +252,7 @@ export default {
}, },
/** init **/ /** init **/
init(id, detailMode, extraParams) { init(id, detailMode, tagInfo, extraParams) {
// console.log("[DialogJustForm] init", this.dataForm, id, detailMode); // console.log("[DialogJustForm] init", this.dataForm, id, detailMode);
if (this.$refs.dataForm) { if (this.$refs.dataForm) {
// console.log("[DialogJustForm] clearing form validation..."); // console.log("[DialogJustForm] clearing form validation...");
@ -258,6 +262,14 @@ export default {
this.detailMode = detailMode ?? false; 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.$nextTick(() => {
this.dataForm.id = id || null; this.dataForm.id = id || null;
if (this.dataForm.id) { if (this.dataForm.id) {
@ -298,15 +310,6 @@ export default {
}); });
}); });
} else { } 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; this.loadingStatus = false;
} }
}); });

Parādīt failu

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

Parādīt failu

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

Parādīt failu

@ -29,9 +29,9 @@ export default function () {
prop: "operations", prop: "operations",
name: "操作", name: "操作",
fixed: "right", fixed: "right",
width: 160, width: 120,
subcomponent: TableOperaionComponent, 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 为手动时,才允许编辑
}, },
]; ];

Parādīt failu

@ -24,7 +24,7 @@ export default {
computed: { computed: {
// id // id
id() { id() {
return this.$route.params.id || ""; return this.$route.query.id || "";
}, },
}, },
data() { data() {
@ -39,10 +39,10 @@ export default {
}, },
watch: { watch: {
$route: { $route: {
handler: function (val) { handler: function (route) {
if (val.params.id) { if (route.query.id) {
this.triggerUpdateKey = Math.random().toString() 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, immediate: true,

Parādīt failu

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