调整MyDialog组件 支持传递按钮名
This commit is contained in:
parent
e20e06c303
commit
7f4ba633ec
@ -15,8 +15,8 @@
|
|||||||
<slot></slot>
|
<slot></slot>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="onCancel">取消</el-button>
|
<el-button @click="onCancel"> {{ onCancelName }} </el-button>
|
||||||
<el-button type="primary" @click="onConfirm"> 确认 </el-button>
|
<el-button type="primary" @click="onConfirm"> {{ onConfirmName }} </el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -58,6 +58,14 @@ const props = defineProps({
|
|||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
|
onConfirmName: {
|
||||||
|
type: String,
|
||||||
|
default: "确认",
|
||||||
|
},
|
||||||
|
onCancelName: {
|
||||||
|
type: String,
|
||||||
|
default: "取消",
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const normalizedComponent = computed(() =>
|
const normalizedComponent = computed(() =>
|
||||||
|
|||||||
@ -79,6 +79,17 @@ const INIT_FORM = {
|
|||||||
}; // 表单初始值
|
}; // 表单初始值
|
||||||
const form = reactive({ ...INIT_FORM }); // 表单
|
const form = reactive({ ...INIT_FORM }); // 表单
|
||||||
|
|
||||||
|
// 重置表单方法
|
||||||
|
const resetForm = () => {
|
||||||
|
// 深拷贝重置嵌套对象
|
||||||
|
form.material = { ...INIT_FORM.material };
|
||||||
|
form.photos = [...INIT_FORM.photos];
|
||||||
|
|
||||||
|
form.material.yhzid = yhzid.value;
|
||||||
|
form.material.jd = yhzData.value?.jd;
|
||||||
|
form.material.wd = yhzData.value?.wd;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 节点过滤函数
|
// 节点过滤函数
|
||||||
@ -367,10 +378,7 @@ const getDetailData = async (row) => {
|
|||||||
const openAddModel = () => {
|
const openAddModel = () => {
|
||||||
model.title = `新增物资`;
|
model.title = `新增物资`;
|
||||||
model.content = AddDialog;
|
model.content = AddDialog;
|
||||||
Object.assign(form, INIT_FORM);
|
resetForm(); // 重置表单
|
||||||
form.material.yhzid = yhzid.value;
|
|
||||||
form.material.jd = yhzData.value?.jd;
|
|
||||||
form.material.wd = yhzData.value?.wd;
|
|
||||||
model.props = {
|
model.props = {
|
||||||
yhzData: yhzData.value,
|
yhzData: yhzData.value,
|
||||||
form: form,
|
form: form,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user