<template>
|
<Card>
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>所属实验调度</div>
|
</div>
|
<Table :data="schedulingData" :total="0" :height="null" >
|
<template>
|
<el-table-column prop="projectName" label="所属项目课题方案" width="200"></el-table-column>
|
<el-table-column prop="experimentCode" label="实验编号" width="200"></el-table-column>
|
<el-table-column prop="experimentName" label="实验名称" width="200"></el-table-column>
|
<el-table-column prop="experimentDate" label="通知时间" width="200"></el-table-column>
|
<el-table-column prop="experimentStartTime" label="实验开始时间" width="200"></el-table-column>
|
<el-table-column prop="experimentEndTime" label="实验结束时间" width="200"></el-table-column>
|
<el-table-column prop="participantsName" label="参加人员" width="200"></el-table-column>
|
<el-table-column prop="status" label="状态" width="150">
|
<template slot-scope="scope">
|
<el-tag :type="getStatusType(scope.row.status)">
|
{{ getStatusText(scope.row.status) }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
</template>
|
</Table>
|
|
<!-- 送样-收样记录部分 -->
|
<div class="sample-record-section">
|
<div class="header-title-left" style="margin-top: 38px">
|
<img src="@/assets/public/headercard.png" />
|
<span>送样-收样记录</span>
|
<el-button
|
type="primary"
|
class="el-icon-plus"
|
@click="showAdditives = !showAdditives"
|
>
|
{{ showAdditives ? "收起辅料详情" : "展开辅料详情" }}
|
</el-button>
|
</div>
|
<div class="sample-code">取样单编号:{{ form.sampleCode || 'DD-25010BS01' }}</div>
|
|
<div class="sample-table">
|
<div class="table-header">
|
<el-button type="primary" class="batch-send" @click="handleBatchSend">批量发送</el-button>
|
</div>
|
<Table :data="sampleList" :total="sampleTotal" :height="null"
|
@selection-change="handleSelectionChange">
|
<template>
|
<el-table-column type="selection" width="55" :selectable="isSelectable"></el-table-column>
|
<el-table-column type="index" label="序号" width="80"></el-table-column>
|
<el-table-column prop="processTime" label="工艺时间" width="120"></el-table-column>
|
<el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column>
|
<el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column>
|
<el-table-column prop="temperature" label="温度" width="100"></el-table-column>
|
<el-table-column prop="samplePh" label="PH" width="100"></el-table-column>
|
<el-table-column prop="waterAddition" label="加水量" width="100"></el-table-column>
|
<template v-if="showAdditives">
|
<el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column>
|
<el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column>
|
</template>
|
<el-table-column prop="sampleAmount" label="取样量" width="100"></el-table-column>
|
<el-table-column prop="pictures" label="拍照" width="100">
|
<template slot-scope="scope">
|
<el-image
|
v-for="(url, index) in scope.row.pictures.split(',')"
|
:key="index"
|
:src="url"
|
:preview-src-list="[url]"
|
style="width: 50px; height: 50px;"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="handlePersonName" label="操作人员" width="100"></el-table-column>
|
<el-table-column prop="status" label="状态" width="100" fixed="right">
|
<template slot-scope="scope">
|
<el-tag :type="getSampleStatusType(scope.row.status)">
|
{{ getSampleStatusText(scope.row.status) }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="100" fixed="right">
|
<template slot-scope="scope">
|
<el-button type="text" @click="handleSend(scope.row)" v-if="scope.row.status == '1'">发送</el-button>
|
</template>
|
</el-table-column>
|
</template>
|
</Table>
|
</div>
|
</div>
|
|
<receive-confirm-dialog
|
:visible.sync="showReceiveConfirm"
|
:sample-count="selectedSamples.length"
|
@confirm="confirmSend"
|
/>
|
</Card>
|
</template>
|
|
<script>
|
import ReceiveConfirmDialog from './components/receiveConfirmDialog.vue'
|
import { getDetail, commitRecord, batchSendSamples, sendSample } from './service'
|
|
export default {
|
name: "SampleSubmission",
|
components: {
|
ReceiveConfirmDialog
|
},
|
data() {
|
return {
|
id: null,
|
showReceiveConfirm: false,
|
showAdditives: true,
|
schedulingData: [],
|
schedulingTotal: 0,
|
form: {
|
sampleCode: "",
|
},
|
sampleList: [],
|
sampleTotal: 0,
|
selectedSamples: [],
|
statusTypeMap: {
|
'-1': 'info',
|
'1': 'warning',
|
'2': 'success',
|
'3': 'info'
|
},
|
statusTextMap: {
|
'-1': '草稿箱',
|
'1': '待提交',
|
'2': '已提交',
|
'3': '已封存'
|
},
|
sampleStatusTypeMap: {
|
'1': 'warning',
|
'2': 'info',
|
'3': 'success'
|
},
|
sampleStatusTextMap: {
|
'1': '待发送',
|
'2': '待接收',
|
'3': '已接收'
|
}
|
};
|
},
|
created() {
|
this.id = this.$route.query.id;
|
if (this.id) {
|
this.getDetailData();
|
}
|
},
|
methods: {
|
async getDetailData() {
|
try {
|
const res = await getDetail({ id: this.id });
|
if (res) {
|
this.schedulingData = [res.experimentDispatch] || [];
|
this.schedulingTotal = this.schedulingData.length;
|
this.form.sampleCode = res.samplingCode || '';
|
this.sampleList = res.samplingRecordOperations || [];
|
this.sampleTotal = this.sampleList.length;
|
}
|
} catch (error) {
|
console.error('获取详情失败:', error);
|
this.$message.error('获取详情失败');
|
}
|
},
|
handleSelectionChange(selection) {
|
this.selectedSamples = selection;
|
},
|
async handleSend(row) {
|
this.selectedSamples = [row];
|
this.showReceiveConfirm = true;
|
},
|
async handleBatchSend() {
|
if (this.selectedSamples.length == 0) {
|
this.$message.warning('请先选择要发送的样品');
|
return;
|
}
|
this.showReceiveConfirm = true;
|
},
|
async confirmSend(signature) {
|
try {
|
const recordOperationIds = this.selectedSamples.map(item => item.id).join(',');
|
const res = await batchSendSamples({
|
recordOperationId: recordOperationIds,
|
sendSign: signature
|
});
|
|
if (res.code == 200) {
|
this.$message.success(`成功发送 ${this.selectedSamples.length} 个样品`);
|
this.selectedSamples = [];
|
this.showReceiveConfirm = false;
|
// 刷新数据
|
this.getDetailData();
|
} else {
|
this.$message.error(res.msg || '发送失败');
|
}
|
} catch (error) {
|
console.error('发送失败:', error);
|
this.$message.error('发送失败');
|
}
|
},
|
getStatusType(status) {
|
return this.statusTypeMap[status] || 'info';
|
},
|
getStatusText(status) {
|
return this.statusTextMap[status] || '未知状态';
|
},
|
isSelectable(row) {
|
return row.status == '1';
|
},
|
getSampleStatusType(status) {
|
return this.sampleStatusTypeMap[status] || 'info';
|
},
|
getSampleStatusText(status) {
|
return this.sampleStatusTextMap[status] || '未知状态';
|
},
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.header-title-left {
|
display: flex;
|
align-items: center;
|
gap: 13px;
|
margin-bottom: 20px;
|
|
img {
|
width: 12px;
|
height: 19px;
|
}
|
|
div, span {
|
flex-shrink: 0;
|
font-weight: bold;
|
font-size: 18px;
|
color: #222222;
|
line-height: 27px;
|
font-family: "Source Han Sans CN Bold Bold";
|
}
|
|
div:before {
|
content: "*";
|
color: #f56c6c;
|
margin-right: 4px;
|
}
|
|
.el-button {
|
margin-left: 16px;
|
}
|
}
|
|
.sample-record-section {
|
.sample-code {
|
font-family: PingFangSC, PingFang SC;
|
font-weight: 400;
|
font-size: 14px;
|
color: rgba(0,0,0,0.88);
|
margin: 20px 0;
|
}
|
|
.table-header {
|
margin-bottom: 16px;
|
text-align: left;
|
}
|
|
.sample-photo {
|
width: 60px;
|
height: 60px;
|
object-fit: cover;
|
}
|
}
|
</style>
|