<template>
|
<el-dialog
|
title="出/入库详情"
|
:visible.sync="visible"
|
width="520px"
|
:close-on-click-modal="false"
|
custom-class="record-detail-dialog"
|
@close="handleClose"
|
>
|
<div class="dialog-content">
|
<el-form :model="formData" label-position="top">
|
<el-form-item label="出库/入库" required>
|
<div class="type-buttons">
|
<el-button
|
type="primary"
|
@click="handleOutbound"
|
>出库</el-button>
|
</div>
|
</el-form-item>
|
|
<div class="signature-row">
|
<el-form-item label="操作人签字" required class="signature-item">
|
<div class="signature-area" :class="{ 'waiting': !formData.operatorSignature }">
|
<template v-if="formData.operatorSignature">
|
<img :src="formData.operatorSignature" alt="操作人签字" />
|
</template>
|
<template v-else>
|
<span class="waiting-text">等待确认</span>
|
</template>
|
</div>
|
</el-form-item>
|
|
<el-form-item
|
v-if="formData.operatorSignature"
|
label="出库时间"
|
required
|
class="time-item"
|
>
|
<div class="time-value">{{ formData.operateTime }}</div>
|
</el-form-item>
|
</div>
|
|
<div class="signature-row">
|
<el-form-item required class="signature-item">
|
<template #label>
|
<span>保藏人签字</span>
|
<el-button type="primary" class="edit-sign-btn" @click="showSignature = true">修改签名</el-button>
|
</template>
|
<div class="signature-area" :class="{ 'waiting': !formData.reviewerSignature }">
|
<template v-if="formData.reviewerSignature">
|
<img :src="formData.reviewerSignature" alt="保藏人签字" />
|
</template>
|
<template v-else>
|
<span class="waiting-text">等待确认</span>
|
</template>
|
</div>
|
</el-form-item>
|
|
<el-form-item
|
v-if="formData.reviewerSignature"
|
label="确认时间"
|
required
|
class="time-item"
|
>
|
<div class="time-value">{{ formData.confirmTime }}</div>
|
</el-form-item>
|
</div>
|
</el-form>
|
</div>
|
<signature-canvas :visible.sync="showSignature" @confirm="handleSignatureConfirm" @cancel="showSignature = false" />
|
</el-dialog>
|
</template>
|
|
<script>
|
import SignatureCanvas from '@/components/SignatureCanvas.vue'
|
export default {
|
name: 'RecordDetailDialog',
|
components: { SignatureCanvas },
|
props: {
|
visible: {
|
type: Boolean,
|
default: false
|
},
|
recordData: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
formData: {},
|
showSignature: false
|
}
|
},
|
watch: {
|
recordData: {
|
immediate: true,
|
handler(val) {
|
this.formData = { ...val }
|
}
|
}
|
},
|
methods: {
|
handleClose() {
|
this.$emit('update:visible', false)
|
this.$emit('close')
|
},
|
handleOutbound() {
|
if (!this.formData.operatorSignature || !this.formData.reviewerSignature) {
|
this.$message.warning('请等待所有签字确认后再进行出库操作')
|
return
|
}
|
this.$emit('confirm', this.formData)
|
this.handleClose()
|
},
|
handleSignatureConfirm(dataUrl) {
|
this.formData.reviewerSignature = dataUrl
|
this.showSignature = false
|
// 可选:this.formData.confirmTime = new Date().toLocaleString()
|
}
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
.record-detail-dialog {
|
:deep(.el-dialog__header) {
|
padding: 20px 24px;
|
margin: 0;
|
border-bottom: 1px solid #DCDFE6;
|
|
.el-dialog__title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #303133;
|
}
|
}
|
|
:deep(.el-dialog__body) {
|
padding: 24px;
|
}
|
}
|
|
.dialog-content {
|
:deep(.el-form-item__label) {
|
padding-bottom: 8px;
|
line-height: 20px;
|
font-size: 14px;
|
color: #606266;
|
|
&::before {
|
content: '*';
|
color: #F56C6C;
|
margin-right: 4px;
|
}
|
}
|
|
.type-buttons {
|
.el-button {
|
width: 80px;
|
background: #409EFF;
|
border-color: #409EFF;
|
color: #FFFFFF;
|
|
&:hover {
|
opacity: 0.8;
|
}
|
}
|
}
|
|
.signature-row {
|
display: flex;
|
gap: 24px;
|
margin-bottom: 24px;
|
|
&:last-child {
|
margin-bottom: 0;
|
}
|
|
.signature-item {
|
flex: 2;
|
margin-bottom: 0;
|
}
|
|
.time-item {
|
flex: 1;
|
margin-bottom: 0;
|
|
.time-value {
|
height: 120px;
|
line-height: 120px;
|
background: #F5F7FA;
|
border-radius: 4px;
|
padding: 0 12px;
|
font-size: 14px;
|
color: #606266;
|
}
|
}
|
|
.signature-area {
|
height: 120px;
|
width: 100%;
|
background: #FFFFFF;
|
border-radius: 4px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border: 1px solid #DCDFE6;
|
overflow: hidden;
|
padding: 0;
|
|
&.waiting {
|
border-style: dashed;
|
background: #FAFAFA;
|
}
|
|
img {
|
width: 100%;
|
height: 100%;
|
object-fit: cover;
|
display: block;
|
}
|
|
.waiting-text {
|
color: #909399;
|
font-size: 14px;
|
}
|
}
|
}
|
}
|
|
.edit-sign-btn {
|
margin-left: 12px;
|
}
|
</style>
|