84 lines
1.8 KiB
Vue
84 lines
1.8 KiB
Vue
<template>
|
|
<a-drawer :title="title" width="50vw" :visible="visible" @ok="handleOk" @cancel="handleCancel" cancelText="关闭"
|
|
:closable="true" :footer-style="{ textAlign: 'right' }" @close="handleCancel"
|
|
:bodyStyle="{ padding: '0px', background: 'linear-gradient(135deg, #f1f7ff 0%, #f1f7ff 100%)' }">
|
|
<DirectiveMediaForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
|
|
</DirectiveMediaForm>
|
|
<template #footer>
|
|
<a-button @click="handleCancel" style="margin-right: 8px;">关闭</a-button>
|
|
</template>
|
|
</a-drawer>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref, nextTick, defineExpose } from 'vue';
|
|
import DirectiveMediaForm from './DirectiveMediaForm.vue'
|
|
import JModal from '/@/components/Modal/src/JModal/JModal.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']);
|
|
|
|
/**
|
|
* 新增
|
|
*/
|
|
function add() {
|
|
title.value = '新增';
|
|
visible.value = true;
|
|
nextTick(() => {
|
|
registerForm.value.add();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
* @param record
|
|
*/
|
|
function edit(record) {
|
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
|
visible.value = true;
|
|
nextTick(() => {
|
|
registerForm.value.edit(record);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 确定按钮点击事件
|
|
*/
|
|
function handleOk() {
|
|
registerForm.value.submitForm();
|
|
}
|
|
|
|
/**
|
|
* form保存回调事件
|
|
*/
|
|
function submitCallback() {
|
|
handleCancel();
|
|
emit('success');
|
|
}
|
|
|
|
/**
|
|
* 取消按钮回调事件
|
|
*/
|
|
function handleCancel() {
|
|
visible.value = false;
|
|
}
|
|
|
|
defineExpose({
|
|
add,
|
|
edit,
|
|
disableSubmit,
|
|
});
|
|
</script>
|
|
|
|
<style lang="less">
|
|
/**隐藏样式-modal确定按钮 */
|
|
.jee-hidden {
|
|
display: none !important;
|
|
}
|
|
</style>
|
|
<style lang="less" scoped></style>
|