中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

252 lines
9.4 KiB

<template>
<el-dialog title="检验结果填报" append-to-body :modelValue="showDialog" width="80%" @close="closeDialog">
<div style="height: 600px;overflow-y: auto;overflow-x:hidden ;">
<div style="font-weight: 550;">任务信息</div>
<div class="info_box">
<el-row class="item_item" :gutter="20">
<el-col :span="6">
<span>任务编号</span><span>{{detailForm.code}}</span>
</el-col>
<el-col :span="6">
<span>试验项目</span><span>{{detailForm.cycleTestItemName}}</span>
</el-col>
<el-col :span="6">
<span>试验件</span><span>{{detailForm.testTypeName}}</span>
</el-col>
<el-col :span="6">
<span>试验标准</span>
<span style="color: #1890ff;cursor:pointer;" @click="downloadA(detailForm.standard.link,detailForm.standard.originalName)">{{detailForm.cycleTestStandardName}}</span>
<!-- <a style="color: #1890ff;cursor:pointer;" :href="detailForm.link" :download="detailForm.cycleTestStandardName">{{ detailForm.cycleTestStandardName }}</a> -->
</el-col>
</el-row>
<el-row class="item_item" :gutter="20">
<el-col :span="6">
<span>试验条件</span><span>{{detailForm.cycleTestItemCondition}}</span>
</el-col>
<el-col :span="6">
<span>工艺员</span><span>{{detailForm.processUserName}}</span>
</el-col>
<!-- <el-col :span="6">
<span>试验员</span><span>{{detailForm.mecMan.userName}}</span>
</el-col> -->
<el-col :span="6">
<span>任务状态</span><span>{{detailForm.statusName}}</span>
</el-col>
<el-col :span="6">
<span>任务生成时间</span><span>{{detailForm.genDatetime}}</span>
</el-col>
</el-row>
<el-row class="item_item" :gutter="20">
<el-col :span="6">
<span>任务下发时间</span><span>{{detailForm.issueDate}}</span>
</el-col>
<el-col :span="6">
<span>任务接收时间</span><span>{{detailForm.acceptDate}}</span>
</el-col>
<el-col :span="6">
<span>任务完成时间</span><span>{{detailForm.finishDate}}</span>
</el-col>
</el-row>
</div>
<div style="font-weight: 550;" v-if="detailForm.isDone == 1">试验结果</div>
<div class="info_box" v-if="detailForm.isDone == 1">
<el-row class="item_item" :gutter="20" v-if="detailForm.isDone == 1">
<el-col :span="6">
<span>试验结果:</span>
<!-- <span style="color: #1890FF;cursor: pointer;">{{detailForm.testDate}}</span> -->
<span style="color: #1890ff;cursor: pointer;" @click="downloadA(detailForm.link,detailForm.originalName)">{{detailForm.originalName}}</span>
</el-col>
<el-col :span="6">
<span>试验时间:</span>
<span>{{detailForm.testDate}}</span>
</el-col>
</el-row>
<el-row class="item_item" :gutter="20" v-show="detailForm.isDone == 2" >
<el-col :span="6">
<span>未试验原因</span><span>{{detailForm.reasonForNo}}</span>
</el-col>
</el-row>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import {getDetail} from '@/api/qualityManagement/periodicTesting/testTask'
export default {
props:{
showDialog: {
type: Boolean,
default: false
},
rowId:{
type:Number,
default:0
},
rowObj:{
type:Object,
default:{}
},
dialogType:{
type:String,
default:''
}
},
data(){
return{
detailForm:{},
initialInspectionForm:{},
auditForm:{},
drugForm:{},
recheckForm:{},
userData:[
{
"jobName": "软件工程师",
"deptName": "MES开发部",
"ldapName": null,
"userSex": 1,
"deptId": 1,
"mobile": null,
"userName": "测试",
"userId": 521,
"userCode": "0001"
},
{
"jobName": null,
"deptName": "MES开发部",
"ldapName": "jinna",
"userSex": 2,
"deptId": 1,
"mobile": null,
"userName": "靳娜",
"userId": 21,
"userCode": "jinna"
},
{
"jobName": null,
"deptName": "MES开发部",
"ldapName": "zd001",
"userSex": 1,
"deptId": 1,
"mobile": null,
"userName": "张迪",
"userId": 601,
"userCode": "zd001"
}
],
initialInspectionFormRules:{
isTest:[{required:true,message:'请选择是否进行化验',trigger:'blur'}],
meterNum:[{required:true,message:'请输入测量值',trigger:'blur'}],
testTime:[{required:true,message:'请选择化验时间',trigger:'blur'}],
},
auditRules:{
isAudit:[{required:true,message:'请选择是否审核通过',trigger:'blur'}],
},
drugRules:{
drugBatch:[{required:true,message:'请输入药品批次',trigger:'blur'}],
drugRecipient:[{required:true,message:'请选择领药人',trigger:'blur'}],
},
recheckRules:{
isTest:[{required:true,message:'请选择是否进行化验',trigger:'blur'}],
meterNum:[{required:true,message:'请输入测量值',trigger:'blur'}],
testTime:[{required:true,message:'请选择化验时间',trigger:'blur'}],
}
}
},
mounted(){
this.getDetail()
},
methods:{
// 获取详情数据
getDetail(){
getDetail(this.rowId).then(res =>{
this.detailForm = res.data.data
})
},
downloadA(fileUrl, fileName){
const xhr = new XMLHttpRequest();
xhr.open('GET', fileUrl, true);
xhr.responseType = 'blob';
xhr.onload = function () {
if (xhr.status === 200) {
const res = xhr.response;
const link = document.createElement('a');
link.style.display = 'none';
const url = window.URL.createObjectURL(res);
link.href = url;
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
window.URL.revokeObjectURL(link.href);
document.body.removeChild(link);
} else {
console.error('下载失败:', xhr.status);
ElMessage.error('下载失败,请稍后重试');
}
};
xhr.onerror = function() {
console.error('下载请求出错');
ElMessage.error('下载请求出错,请检查网络连接');
};
xhr.send();
},
closeDialog(){
this.$emit('closeDialog');
},
//输入框数字校验
handleMeterNum(value){
this.initialInspectionForm.meterNum = value.replace(/[^\d]/g, '');
},
handleCondNum(value){
this.initialInspectionForm.condNum = value.replace(/[^\d]/g, '');
},
handleActualAdd(value){
// 1. 过滤非法字符
let val = value.replace(/[^\d.]/g, '');
// 2. 处理多个小数点
const dotIndex = val.indexOf('.');
if (dotIndex !== -1) {
val = val.substring(0, dotIndex + 1) +
val.substring(dotIndex + 1).replace(/\./g, '');
}
// 3. 限制小数点后五位
if (dotIndex !== -1) {
const decimalPart = val.split('.')
if (decimalPart[1] && decimalPart[1].length > 5) {
val = decimalPart[0] + '.' + decimalPart[1].substring(0, 5);
}
}
console.log('val-----------------',val)
this.initialInspectionForm.actualAdd = val
},
// 提交
submit(){
this.closeDialog()
},
}
}
</script>
<style lang="scss">
.info_box{
padding: 20px 0;
border-bottom: 1px solid #eee;
margin-bottom: 20px;
.item_item{
padding: 5px 0;
}
}
</style>