nursing_unit_vue/src/views/iot/tplink/camera/components/CameraPreviewModal.vue

87 lines
2.2 KiB
Vue

<template>
<!-- <j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> -->
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<div v-if="showCamera">
<CameraPreviewForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CameraPreviewForm>
</div>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
<!-- </j-modal> -->
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import CameraPreviewForm from './CameraPreviewForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('70%');
const visible = ref<boolean>(false);
const showCamera = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
// const player = ref();
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = record.deviceName;
showCamera.value = true;
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
nextTick(() => {
registerForm.value.destroy();
showCamera.value = false;
});
}
defineExpose({
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
.ant-modal-body {
height: auto !important;
overflow: hidden !important;
}
</style>
<style lang="less" scoped></style>