forked from wangjiadong/comp
parent
f93e947e75
commit
818d6a1943
1 changed files with 68 additions and 63 deletions
@ -1,77 +1,82 @@ |
||||
<template> |
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> |
||||
<AwardPersionForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></AwardPersionForm> |
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" |
||||
:okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> |
||||
<AwardPersionForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"> |
||||
</AwardPersionForm> |
||||
</a-modal> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
import { ref, nextTick, defineExpose } from 'vue'; |
||||
import AwardPersionForm from './AwardPersionForm.vue' |
||||
import { ref, nextTick, defineExpose, watch } from 'vue'; |
||||
import AwardPersionForm from './AwardPersionForm.vue' |
||||
|
||||
const title = ref<string>(''); |
||||
const width = ref<number>(800); |
||||
const visible = ref<boolean>(false); |
||||
const disableSubmit = ref<boolean>(false); |
||||
const registerForm = ref(); |
||||
const emit = defineEmits(['register', 'success']); |
||||
|
||||
/** |
||||
const title = ref<string>(''); |
||||
const width = ref<number>(800); |
||||
const visible = ref<boolean>(false); |
||||
const disableSubmit = ref<boolean>(false); |
||||
const registerForm = ref(); |
||||
const emit = defineEmits(['register', 'success']); |
||||
watch(() => visible.value, newVal => { |
||||
if (!newVal) registerForm.value.setIsT(false); |
||||
}) |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
function add() { |
||||
function add() { |
||||
title.value = '新增'; |
||||
visible.value = true; |
||||
nextTick(() => { |
||||
registerForm.value.add(); |
||||
registerForm.value.setIsT(false); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
/** |
||||
* 编辑 |
||||
* @param record |
||||
*/ |
||||
function edit(record) { |
||||
function edit(record) { |
||||
title.value = disableSubmit.value ? '详情' : '编辑'; |
||||
visible.value = true; |
||||
nextTick(() => { |
||||
registerForm.value.edit(record); |
||||
registerForm.value.setIsT(true); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
/** |
||||
* 确定按钮点击事件 |
||||
*/ |
||||
function handleOk() { |
||||
function handleOk() { |
||||
registerForm.value.submitForm(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
/** |
||||
* form保存回调事件 |
||||
*/ |
||||
function submitCallback() { |
||||
function submitCallback() { |
||||
handleCancel(); |
||||
emit('success'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
/** |
||||
* 取消按钮回调事件 |
||||
*/ |
||||
function handleCancel() { |
||||
function handleCancel() { |
||||
visible.value = false; |
||||
} |
||||
} |
||||
|
||||
defineExpose({ |
||||
defineExpose({ |
||||
add, |
||||
edit, |
||||
disableSubmit, |
||||
}); |
||||
}); |
||||
</script> |
||||
|
||||
<style> |
||||
/**隐藏样式-modal确定按钮 */ |
||||
.jee-hidden { |
||||
/**隐藏样式-modal确定按钮 */ |
||||
.jee-hidden { |
||||
display: none !important; |
||||
} |
||||
} |
||||
</style> |
||||
|
Loading…
Reference in new issue