update 混料批次

This commit is contained in:
lb 2023-03-14 17:07:59 +08:00
parent f9ad79f6bc
commit 977dbb7c41
4 changed files with 62 additions and 11 deletions

View File

@ -248,7 +248,7 @@ export default {
},
/** init **/
init(id, detailMode) {
init(id, detailMode, extraParams) {
// console.log("[DialogJustForm] init", this.dataForm, id, detailMode);
if (this.$refs.dataForm) {
// console.log("[DialogJustForm] clearing form validation...");
@ -257,6 +257,7 @@ export default {
}
this.detailMode = detailMode ?? false;
this.$nextTick(() => {
this.dataForm.id = id || null;
if (this.dataForm.id) {
@ -297,7 +298,15 @@ 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;
}
});

View File

@ -75,6 +75,11 @@ export default {
type: Array,
default: () => ["key"],
},
attachListQueryExtra: {
// listQueryExtra
type: String,
default: "",
},
initDataWhenLoad: { type: Boolean, default: true },
/** dialog configs 或许可以从 tableConfig 计算出来 computed... */
dialogConfigs: {
@ -83,8 +88,8 @@ export default {
},
triggerUpdate: {
type: String,
default: ''
}
default: "",
},
},
computed: {
dialogType() {
@ -99,9 +104,9 @@ export default {
triggerUpdate(val, oldVal) {
if (val && val !== oldVal) {
// get list
this.getList()
this.getList();
}
}
},
},
data() {
return {
@ -442,9 +447,15 @@ export default {
/** 打开对话框 */
openDialog(row_id, detail_mode, tag_info) {
this.dialogVisible = true;
let extraParams = null;
if (this.attachListQueryExtra && this.listQueryExtra.length) {
this.listQueryExtra.forEach((item) => {
let found = item[this.attachListQueryExtra];
if (found !== null && found !== undefined) extraParams = found;
});
}
this.$nextTick(() => {
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info);
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
});
},
},

View File

@ -1,5 +1,5 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
// import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
// import StatusComponent from "@/components/noTemplateComponents/statusComponent";
import { timeFilter } from "@/utils/filters";
@ -42,14 +42,44 @@ export default function () {
{
button: {
type: "plain",
name: "新增批次",
name: "新增",
permission: "",
},
},
];
const dialogJustFormConfigs = {
// extra blenderOrderId
// extraIds: {},
form: {
rows: [
[
{
input: true,
label: "批次编码",
prop: "batchNo",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入批次编码" },
},
{
input: true,
label: "批次重量",
prop: "batchSize",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入批次重量" },
},
],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true },
],
},
};
return {
// dialogConfigs,
dialogConfigs: dialogJustFormConfigs,
tableConfig: {
table: null, // 此处可省略el-table 上的配置项
column: tableProps, // el-column-item 上的配置项

View File

@ -4,6 +4,7 @@
:head-config="headFormConfigs"
:dialog-configs="dialogConfigs"
:list-query-extra="[{ blenderOrderId: id }]"
attach-list-query-extra="blenderOrderId"
:trigger-update="triggerUpdateKey"
/>
</template>