update 订单新增编辑的字段

This commit is contained in:
lb
2023-03-09 17:01:53 +08:00
parent 79ed2d4f6a
commit 2eaafd5786
4 changed files with 284 additions and 145 deletions

View File

@@ -1,6 +1,7 @@
<template>
<el-dialog
class="dialog-just-form"
style="padding: 40px"
:visible="dialogVisible"
@close="handleClose"
:destroy-on-close="false"
@@ -8,14 +9,14 @@
:fullscreen="fullscreen"
>
<!-- title -->
<div slot="title" class="dialog-title">
<div slot="title" class="dialog-title" style="padding: 40px 40px 0">
<h1 class="">
{{ detailMode ? "查看详情" : dataForm.id ? "编辑" : "新增" }}
{{ detailMode ? "查看详情" : dataForm.id ? "修改订单" : "新增订单" }}
</h1>
</div>
<!-- form -->
<el-form ref="dataForm" :model="dataForm" v-loading="loadingStatus">
<el-form ref="dataForm" :model="dataForm" v-loading="loadingStatus" style="padding: 0 40px">
<el-row v-for="(row, rowIndex) in configs.form.rows" :key="'row_' + rowIndex" :gutter="20">
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length" :class="{ h0: col.hidden }">
<!-- 通过多个 col === null 可以控制更灵活的 span 大小 -->
@@ -66,7 +67,7 @@
:is="col.component"
:key="'component_' + col.prop"
@update:modelValue="handleComponentModelUpdate(col.prop, $event)"
:modelValue="dataForm[col.prop]"
:modelValue="dataForm[col.prop] ?? ''"
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
/>
</div>
@@ -108,8 +109,8 @@ export default {
},
fullscreen: {
type: Boolean,
default: false
}
default: false,
},
},
inject: ["urls"],
data() {
@@ -124,7 +125,10 @@ export default {
this.$set(
col,
"options",
res.data.list.map((i) => ({ label: i.name, value: i.id }))
res.data.list.map((i) => ({
label: i.name,
value: col.optionValueProp && `${col.optionValueProp}` in i ? i[col.optionValueProp] : i.id,
}))
);
} else {
col.options.splice(0);
@@ -175,6 +179,7 @@ export default {
/** init **/
init(parentId, detailMode) {
console.log("herer........", this.fullscreen);
if (this.$refs.dataForm) {
this.$refs.dataForm.clearValidate();
}

View File

@@ -27,7 +27,7 @@
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<DialogJustForm ref="order-dialog" v-if="dialogVisible" />
<DialogJustForm modal-append-to-body ref="order-dialog" :dialog-visible.sync="dialogVisible" fullscreen :configs="dialogConfig" />
</section>
</template>
@@ -326,6 +326,7 @@ export default {
this.dialogVisible = true;
this.$nextTick(() => {
console.log('init dialog', row_id, detail_mode)
this.$refs["order-dialog"].init(/** some args... */ row_id, detail_mode);
});
},