2025-01-09 13:50:08 +08:00
|
|
|
<template>
|
2025-01-16 13:01:06 +08:00
|
|
|
<el-dialog v-model="signDialogVisible" title="签名" width="935">
|
2025-01-09 13:50:08 +08:00
|
|
|
<div class="position-relative">
|
2025-01-16 13:01:06 +08:00
|
|
|
<Vue3Signature class="b b-solid b-gray" ref="signature" w="900px" h="400px" />
|
2025-01-09 13:50:08 +08:00
|
|
|
<el-button
|
2025-01-16 13:55:15 +08:00
|
|
|
class="pos-absolute bottom-20px right-10px"
|
2025-01-09 13:50:08 +08:00
|
|
|
type="primary"
|
|
|
|
text
|
|
|
|
size="small"
|
|
|
|
@click="signature.clear()"
|
|
|
|
>
|
2025-01-16 13:01:06 +08:00
|
|
|
<Icon icon="ep:delete" class="mr-5px" />
|
2025-01-09 13:50:08 +08:00
|
|
|
清除
|
|
|
|
</el-button>
|
|
|
|
</div>
|
|
|
|
<template #footer>
|
|
|
|
<div class="dialog-footer">
|
|
|
|
<el-button @click="signDialogVisible = false">取消</el-button>
|
2025-01-16 13:01:06 +08:00
|
|
|
<el-button type="primary" @click="submit"> 提交 </el-button>
|
2025-01-09 13:50:08 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-01-16 13:01:06 +08:00
|
|
|
import Vue3Signature from 'vue3-signature'
|
2025-01-09 13:50:08 +08:00
|
|
|
import * as FileApi from '@/api/infra/file'
|
2025-01-16 13:55:15 +08:00
|
|
|
import download from '@/utils/download'
|
2025-01-09 13:50:08 +08:00
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
const signDialogVisible = ref(false)
|
|
|
|
const signature = ref()
|
|
|
|
|
|
|
|
const open = async () => {
|
|
|
|
signDialogVisible.value = true
|
|
|
|
}
|
2025-01-16 13:01:06 +08:00
|
|
|
defineExpose({ open })
|
2025-01-09 13:50:08 +08:00
|
|
|
|
|
|
|
const emits = defineEmits(['success'])
|
|
|
|
const submit = async () => {
|
|
|
|
message.success('签名上传中请稍等。。。')
|
2025-01-16 13:01:06 +08:00
|
|
|
const res = await FileApi.updateFile({
|
2025-01-16 13:55:15 +08:00
|
|
|
file: download.base64ToFile(signature.value.save('image/png'), '签名')
|
2025-01-16 13:01:06 +08:00
|
|
|
})
|
2025-01-09 13:50:08 +08:00
|
|
|
emits('success', res.data)
|
|
|
|
signDialogVisible.value = false
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2025-01-16 13:01:06 +08:00
|
|
|
<style scoped></style>
|