<template>
|
<el-dialog :title="type == 'detail' ? '出/入库详情' : '确认出入库'" :visible.sync="visible" width="550px"
|
:close-on-click-modal="false" custom-class="record-detail-dialog" @close="handleClose" @opened="opened">
|
<div class="dialog-content">
|
<el-form :model="formData" label-position="top">
|
<el-form-item label="出库/入库" required>
|
<div class="type-buttons">
|
<el-button v-if="formData.type == '1'" type="primary">出库</el-button>
|
<el-button v-if="formData.type == '2'" type="primary">入库</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.handleSignature }">
|
<template v-if="formData.handleSignature">
|
<img :src="formData.handleSignature" alt="操作人签字" />
|
</template>
|
<template v-else>
|
<span class="waiting-text">等待确认</span>
|
</template>
|
</div>
|
</el-form-item>
|
|
<el-form-item v-if="formData.handleSignature" label="出库时间" required class="time-item">
|
<div class="time-value">{{ formData.boundTime }}</div>
|
</el-form-item>
|
</div>
|
|
<div class="signature-row">
|
<el-form-item required class="signature-item">
|
<template #label>
|
<span>保藏人签字</span>
|
<el-button v-if="type != 'detail'" type="primary" class="edit-sign-btn"
|
@click="showSignature = true">修改签名</el-button>
|
</template>
|
<div class="signature-area" :class="{ 'waiting': !formData.preserveSignature }">
|
<template v-if="formData.preserveSignature">
|
<img :src="formData.preserveSignature" alt="保藏人签字" />
|
</template>
|
<template v-else>
|
<span class="waiting-text">等待确认</span>
|
</template>
|
</div>
|
</el-form-item>
|
|
<el-form-item v-if="formData.preserveSignature && type == 'detail'" label="确认时间" required
|
class="time-item">
|
<div class="time-value">{{ formData.confirmTime }}</div>
|
</el-form-item>
|
</div>
|
</el-form>
|
<div class="confirm-btn" v-if="type != 'detail'" style="text-align: center;margin-top: 20px;">
|
<el-button type="primary" style="width: 80px;" @click="handleOutbound">确认</el-button>
|
</div>
|
</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: () => ({})
|
},
|
type: {
|
type: String,
|
default: 'detail'
|
}
|
},
|
data() {
|
return {
|
formData: {
|
type: '1',
|
},
|
showSignature: false
|
}
|
},
|
watch: {
|
recordData: {
|
immediate: true,
|
handler(val) {
|
this.formData = { ...val }
|
}
|
}
|
},
|
methods: {
|
opened() {
|
this.formData.type = this.recordData.type
|
},
|
handleClose() {
|
this.$emit('close')
|
},
|
handleOutbound() {
|
if (!this.formData.preserveSignature) {
|
this.$message.warning('请等待所有签字确认后再进行出库操作')
|
return
|
}
|
this.$emit('confirm', this.formData)
|
this.handleClose()
|
},
|
handleSignatureConfirm(dataUrl) {
|
this.formData.preserveSignature = 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 {
|
display: flex;
|
|
gap: 12px;
|
|
.el-button {
|
width: 80px;
|
|
|
&: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>
|