<template>
|
<el-dialog
|
title="发送签字确认"
|
:visible.sync="visible"
|
width="500px"
|
:close-on-click-modal="false"
|
@open='open'
|
@close="handleClose"
|
>
|
<div class="receive-dialog">
|
<!-- 人员选择区域 -->
|
<div class="personnel-selection" v-if="personnelList.length > 0">
|
<div class="personnel-table">
|
<el-table
|
ref="personnelTable"
|
:data="personnelList"
|
style="width: 100%"
|
border
|
size="small"
|
@row-click="handlePersonnelRowClick"
|
:row-class-name="getPersonnelRowClassName"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="index" width="55" align="center" label="编号"></el-table-column>
|
<el-table-column prop="nickName" label="化验师姓名" min-width="120" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.nickName }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="id" label="操作" min-width="120" align="center">
|
<template slot-scope="scope">
|
<!-- <el-radio v-model="selectedPersonnelId" :label="scope.row.nickName"></el-radio> -->
|
<el-checkbox :value="selectedPersonnelId ==scope.row.id"></el-checkbox>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column prop="id" label="人员ID" min-width="120" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.id }}</span>
|
</template>
|
</el-table-column> -->
|
</el-table>
|
</div>
|
</div>
|
|
<div class="receive-tip">
|
您已选中 <span class="sample-count">{{ sampleCount }}</span> 条样品发送,请签字确认
|
</div>
|
|
<div class="approval-dialog-approve">
|
<div class="add-group">
|
<div>*</div>
|
<span>签字确认</span>
|
<el-button type="primary" class="el-icon-plus" @click="openSignature">签名</el-button>
|
</div>
|
<img
|
v-if="imgSrc"
|
style="width: 200px; height: 100px; margin-left: 25px"
|
:src="getFullUrl(imgSrc)"
|
fit="fit"
|
/>
|
</div>
|
</div>
|
|
<div slot="footer" class="dialog-footer select-member-footer">
|
<el-button @click="handleClose">取 消</el-button>
|
<el-button type="primary" @click="handleConfirm" :disabled="!selectedPersonnelId || !imgSrc">
|
确认发送
|
</el-button>
|
</div>
|
|
<SignatureCanvas
|
:visible="signatureDialogVisible"
|
@confirm="handleSignatureConfirm"
|
@close="signatureDialogVisible = false"
|
/>
|
</el-dialog>
|
</template>
|
|
<script>
|
import SignatureCanvas from "@/components/SignatureCanvas.vue";
|
import {getFullUrl} from '@/utils/utils.js'
|
import {queryDetail} from '@/components/service.js'
|
|
export default {
|
name: "ReceiveConfirmDialog",
|
components: {
|
SignatureCanvas,
|
},
|
props: {
|
visible: {
|
type: Boolean,
|
default: false,
|
},
|
sampleCount: {
|
type: Number,
|
default: 1,
|
},
|
personnelList: {
|
type: Array,
|
default: () => [],
|
validator: (value) => {
|
return value.every(item => item.id && item.nickName)
|
}
|
},
|
},
|
data() {
|
return {
|
signatureDialogVisible: false,
|
imgSrc: "",
|
selectedPersonnelId: null,
|
};
|
},
|
methods: {
|
getFullUrl,
|
open(){
|
queryDetail().then(res=>{
|
if(res){
|
this.imgSrc=res.signPicture
|
}
|
})
|
},
|
handleClose() {
|
this.$emit("update:visible", false);
|
this.imgSrc = "";
|
},
|
openSignature() {
|
this.signatureDialogVisible = true;
|
},
|
handleSignatureConfirm(imageData) {
|
this.signatureDialogVisible = false;
|
this.imgSrc = ""; // 先清空
|
this.$nextTick(() => {
|
this.imgSrc = imageData;
|
});
|
},
|
handlePersonnelRowClick(row, column, event) {
|
// 当点击表格行时,设置为选中状态
|
this.$refs.personnelTable.clearSelection();
|
this.$refs.personnelTable.toggleRowSelection(row);
|
this.selectedPersonnelId = row.id;
|
},
|
getPersonnelRowClassName({ row }) {
|
// 根据是否选中来设置行样式
|
return row.id === this.selectedPersonnelId ? 'selected-personnel' : '';
|
},
|
handleSelectionChange(selection) {
|
// 当radio选择改变时,更新选中的人员
|
if (selection && selection.id) {
|
this.selectedPersonnelId = selection.id;
|
} else {
|
this.selectedPersonnelId = null;
|
}
|
},
|
handleConfirm() {
|
if (!this.selectedPersonnelId) {
|
this.$message.warning("请先选择接收人员");
|
return;
|
}
|
if (!this.imgSrc) {
|
this.$message.warning("请先完成签名确认");
|
return;
|
}
|
|
this.$emit("confirm", {
|
personnelId: this.selectedPersonnelId,
|
personnelName: this.personnelList.find(p => p.id === this.selectedPersonnelId)?.name || '',
|
imgSrc: this.imgSrc
|
});
|
this.handleClose();
|
},
|
handleClose() {
|
this.$emit("update:visible", false);
|
this.imgSrc = "";
|
this.selectedPersonnelId = null; // 清空选中的人员
|
},
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
::v-deep .el-dialog__header {
|
border-bottom: 1px solid #e4e7ed;
|
}
|
|
.receive-dialog {
|
padding: 20px;
|
|
.receive-tip {
|
font-size: 14px;
|
color: #333;
|
margin-bottom: 20px;
|
|
.sample-count {
|
color: #409EFF;
|
font-weight: bold;
|
}
|
}
|
}
|
|
.approval-dialog-approve {
|
margin-top: 26px;
|
|
img {
|
border: 2px dashed #049c9a;
|
}
|
}
|
|
.add-group {
|
padding-left: 25px;
|
margin-top: 14px;
|
display: flex;
|
align-items: center;
|
margin-bottom: 19px;
|
|
div {
|
color: #f56c6c;
|
}
|
|
span {
|
font-weight: 500;
|
font-size: 14px;
|
color: #222222;
|
line-height: 21px;
|
margin: 0 32px 0 8px;
|
}
|
}
|
|
.personnel-selection {
|
margin-bottom: 20px;
|
}
|
|
.personnel-table {
|
padding-left: 25px;
|
margin-bottom: 19px;
|
|
::v-deep .el-table {
|
border-radius: 4px;
|
|
.el-table__header-wrapper {
|
thead {
|
th {
|
background-color: #f5f7fa;
|
color: #606266;
|
font-weight: 500;
|
font-size: 13px;
|
border-color: #ebeef5;
|
}
|
}
|
}
|
|
.el-table__body-wrapper {
|
tbody {
|
td {
|
border-color: #ebeef5;
|
font-size: 13px;
|
|
&.cell {
|
padding: 8px 0;
|
}
|
}
|
|
.selected-personnel {
|
background-color: #ecf5ff;
|
}
|
|
tr:hover {
|
background-color: #f5f7fa;
|
}
|
|
tr.selected-personnel:hover {
|
background-color: #ecf5ff;
|
}
|
}
|
}
|
}
|
}
|
|
.dialog-footer {
|
align-items: center;
|
display: flex;
|
justify-content: center;
|
|
button {
|
width: 150px;
|
}
|
}
|
</style>
|