<!-- 设备校准 -->
|
<template>
|
<div>
|
<div class="btnS">
|
<el-button size="small" type="primary" @click="calibrationMaintenance()">校准项目维护</el-button>
|
<el-button size="small" type="primary" @click="add()">添加校准记录</el-button>
|
</div>
|
<div class="tables" style="margin-top: 10px;">
|
<el-table :data="tableData" height="calc(100vh - 20em)" border>
|
<el-table-column label="序号" type="index" width="120">
|
<template v-slot="scope">
|
<span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="记录编号" min-width="150" prop="processNumber"></el-table-column>
|
<el-table-column label="校准机构" min-width="150" prop="unitOfMeasure" show-overflow-tooltip></el-table-column>
|
<el-table-column label="校准结论" min-width="150" prop="status">
|
<template v-slot="scope">
|
{{ scope.row.status === '0yes' ? '合格' : scope.row.status === '1no' ? '不合格' : '其他' }}
|
</template>
|
</el-table-column>
|
<el-table-column label="校准证书编号" min-width="150" prop="certificateSerialNumber"></el-table-column>
|
<el-table-column label="说明" min-width="150" prop="remark" show-overflow-tooltip></el-table-column>
|
<el-table-column label="校准日期" min-width="150" prop="calibrationDate"
|
:formatter="formatDateCell"></el-table-column>
|
<el-table-column label="下次校准日期" min-width="150" prop="nextCalibrationDate"
|
:formatter="formatDateCell"></el-table-column>
|
<el-table-column label="确认日期" min-width="150" prop="confirmDate"
|
:formatter="formatDateCell"></el-table-column>
|
<el-table-column label="登记人" min-width="150" prop="createUser"></el-table-column>
|
<el-table-column label="登记日期" min-width="150" prop="createTime"
|
:formatter="formatDateCell"></el-table-column>
|
<el-table-column fixed="right" label="操作" min-width="180" align="center">
|
<template #default="{ row }">
|
<el-button size="small" link type="primary" @click="handleAttachmentClick(row)">下载附件</el-button>
|
<el-button size="small" link type="primary" @click="handleViewClick('view', row)">查看</el-button>
|
<el-button size="small" link type="primary" @click="handleDeleteClick(row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination :current-page="search.current" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
|
:total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
|
@size-change="handleSizeChange" @current-change="handleCurrentChange" background>
|
</el-pagination>
|
</div>
|
<!-- 校准项目维护 -->
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible0"
|
title="校准项目维护" top="5vh" width="70%">
|
<h4>
|
<span style="display: flex;align-items: center;"><span class="line"></span><span>设备校准参数维护</span></span>
|
<el-button :loading="addCalibrateLoading" size="small" type="primary" @click="addCalibrate">添 加</el-button>
|
</h4>
|
<div>
|
<el-form ref="form0" :model="form0" :rules="form0Rules" label-position="right" label-width="120px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="计量参数:" prop="measurementParameter">
|
<el-input v-model="form0.measurementParameter" clearable placeholder="请输入" size="small"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="量程范围:" prop="rangeOfMeasurement">
|
<el-input v-model="form0.rangeOfMeasurement" clearable placeholder="请输入" size="small"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="最大允许误差:" prop="maxPermissibleError">
|
<el-input v-model="form0.maxPermissibleError" clearable placeholder="请输入" size="small"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="判定标准:" prop="judgmentCriteria">
|
<el-input v-model="form0.judgmentCriteria" clearable placeholder="请输入" size="small"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<h4>
|
<span style="display: flex;align-items: center;"><span class="line"></span><span>设备校准参数</span></span>
|
</h4>
|
<!-- 设备校准参数表格 -->
|
<el-table ref="calibrateTable" v-loading="calibrateParamsLoading" :data="calibrateParams" max-height="450" stripe
|
border
|
style="width: 100%">
|
<el-table-column label="编号" type="index" width="80"></el-table-column>
|
<el-table-column label="计量参数" prop="measurementParameter"></el-table-column>
|
<el-table-column label="量程范围" prop="rangeOfMeasurement"></el-table-column>
|
<el-table-column label="最大允许误差" prop="maxPermissibleError"></el-table-column>
|
<el-table-column label="判定标准" prop="judgmentCriteria"></el-table-column>
|
<el-table-column label="创建人" prop="createdBy"></el-table-column>
|
<el-table-column label="创建时间" prop="creationTime" :formatter="formatDateCell"></el-table-column>
|
<el-table-column fixed="right" label="操作">
|
<template #default="scope">
|
<el-button size="small" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
|
<!-- 添加/查看校准记录弹窗 -->
|
<calibration-record-dia ref="calibrationRecordDia"
|
@success="getTableList(clickNodeVal.value)"></calibration-record-dia>
|
</div>
|
</template>
|
|
<script>
|
import {
|
deviceMetricRecordPage,
|
deleteDeviceMetricRecord,
|
selectDeviceMetric,
|
deleteDeviceMetrics,
|
saveOrUpdateDeviceMetric
|
} from '@/api/cnas/resourceDemand/device.js'
|
import CalibrationRecordDia from './calibrationRecordDia.vue'
|
import { formatListDate } from './dateFormat'
|
import { mapGetters } from "@/utils/store-compat";
|
export default {
|
components: { CalibrationRecordDia },
|
props: {
|
clickNodeVal: {
|
type: Object,
|
default: () => {
|
return {};
|
}
|
}
|
},
|
data() {
|
return {
|
value: "",
|
calibrateParams: [],
|
calibrateParamsLoading: false,
|
addCalibrateLoading: false,
|
tableData: [],
|
dialogVisible0: false,
|
form0: {
|
measurementParameter: '', // 计量参数
|
rangeOfMeasurement: '',
|
maxPermissibleError: '',
|
judgmentCriteria: '',
|
createdBy: '',
|
action: '',
|
deviceId: null
|
},
|
form0Rules: {
|
measurementParameter: [
|
{ required: true, message: '请输入计量参数', trigger: 'blur' }
|
],
|
rangeOfMeasurement: [
|
{ required: true, message: '请输入量程范围', trigger: 'blur' }
|
],
|
maxPermissibleError: [
|
{ required: true, message: '请输入最大允许误差', trigger: 'blur' }
|
],
|
judgmentCriteria: [
|
{ required: true, message: '请输入判定标准', trigger: 'blur' }
|
],
|
},
|
search: {
|
size: 20,
|
current: 1,
|
total: 0
|
},
|
}
|
},
|
// 用于上传文件的信息
|
computed: {
|
...mapGetters(["nickName"]),
|
},
|
mounted() {
|
//获取操作记录信息
|
this.getTableList(this.clickNodeVal.value) // 获取设备校准列表数据
|
},
|
methods: {
|
formatDateCell(row, column, cellValue) {
|
return formatListDate(cellValue)
|
},
|
handleSizeChange(val) {
|
this.search.size = val
|
this.getTableList(this.clickNodeVal.value);
|
},
|
handleCurrentChange(val) {
|
this.search.current = val
|
this.getTableList(this.clickNodeVal.value);
|
},
|
getTableList(deviceId) {
|
deviceMetricRecordPage({ deviceId, type: 'calibrate', ...this.search }).then(res => {
|
this.tableData = res.data.records
|
this.search.total = res.data.total
|
})
|
},
|
// 添加校准记录
|
add() {
|
this.$refs.calibrationRecordDia.open(this.clickNodeVal.value, 'add')
|
},
|
// 查看详情
|
handleViewClick(type, row) {
|
this.$refs.calibrationRecordDia.open(this.clickNodeVal.value, type, row)
|
},
|
// 表格删除操作
|
handleDeleteClick(row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteDeviceMetricRecord({ id: row.id }).then(res => {
|
this.getTableList(this.clickNodeVal.value) // 获取设备校准列表数据
|
this.$message.success('删除成功!')
|
})
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
})
|
},
|
handleAttachmentClick(row) {
|
if (!row.systemFileName) {
|
this.$message.warning('未上传文件!')
|
return
|
}
|
// 图片存 /img/,其他文档存 /word/
|
const isImage = /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(row.systemFileName)
|
const url = this.javaApi + (isImage ? '/img/' : '/word/') + row.systemFileName
|
this.$download.saveAs(url, row.fileName || row.systemFileName)
|
},
|
// 校准项目维护
|
calibrationMaintenance() {
|
this.dialogVisible0 = true
|
this.getXmsg();
|
},
|
// 获取设备校准参数table信息
|
async getXmsg() {
|
this.calibrateParamsLoading = true
|
try {
|
await selectDeviceMetric({ deviceId: this.clickNodeVal.value, type: 'calibrate' }).then(res => {
|
if (res.code == 200) {
|
this.calibrateParams = res.data
|
}
|
this.calibrateParamsLoading = false
|
})
|
} catch (e) {
|
console.log('getXmsg---', e)
|
this.calibrateParamsLoading = false
|
}
|
},
|
// 校准项目维护-删除设备校准参数
|
handleDelete(row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteDeviceMetrics({ id: row.id }).then(res => {
|
if (res.code === 200) {
|
this.$message.success('删除成功!');
|
this.getXmsg();
|
}
|
})
|
}).catch(() => {
|
this.$message.info('已取消删除');
|
})
|
},
|
addCalibrate() {
|
this.$refs['form0'].validate((valid) => {
|
if (valid) {
|
// 保存
|
this.calibrateParamsLoading = true
|
this.addCalibrateLoading = true
|
this.form0.deviceId = this.clickNodeVal.value;
|
this.form0.createdBy = this.nickName;
|
this.form0.type = 'calibrate'
|
saveOrUpdateDeviceMetric(this.form0).then(res => {
|
if (res.code == 200) {
|
this.$message.success('保存成功')
|
this.$refs['form0'].resetFields()
|
this.getXmsg() // 刷新设备校准参数表格
|
}
|
this.calibrateParamsLoading = false
|
this.addCalibrateLoading = false
|
})
|
} else {
|
this.addCalibrateLoading = false
|
this.$message.warning('有必填项未填');
|
}
|
})
|
},
|
// end
|
},
|
watch: {
|
// 监听点击el-tree的数据,进行数据刷新
|
clickNodeVal(newVal) {
|
if (newVal.value) {
|
this.getTableList(newVal.value);
|
}
|
}
|
}
|
}
|
|
</script>
|
<style scoped>
|
.tables {
|
width: 100%;
|
height: calc(100vh - 230px);
|
}
|
|
.search {
|
background-color: #fff;
|
height: 40px;
|
display: flex;
|
align-items: center;
|
position: relative;
|
}
|
|
.search_thing {
|
display: flex;
|
align-items: center;
|
height: 40px;
|
}
|
|
.search_label {
|
width: 70px;
|
font-size: 14px;
|
text-align: right;
|
margin-right: 10px;
|
}
|
|
.search_input {
|
width: calc(100% - 110px);
|
}
|
|
.btnS {
|
text-align: right;
|
margin-top: 10px;
|
}
|
|
h4 {
|
font-weight: 400;
|
font-size: 16px;
|
display: flex;
|
justify-content: space-between;
|
margin: 10px 0;
|
}
|
|
h4 .line {
|
display: inline-block;
|
width: 3px;
|
height: 16px;
|
background: var(--el-color-primary);
|
margin-right: 4px;
|
}
|
|
.check {
|
background-color: #fff;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
}
|
|
.check_thing {
|
flex: 0 0 calc(20% - 10px);
|
margin-bottom: 20px;
|
display: flex;
|
flex-direction: column;
|
align-items: flex-start;
|
}
|
|
.check_label {
|
font-size: 14px;
|
margin-bottom: 5px;
|
}
|
|
.check_data .check_input {
|
width: 100%;
|
}
|
|
.el-table {
|
font-size: 14px;
|
color: var(--lims-text);
|
}
|
|
.el-table thead {
|
background-color: #f5f5f5;
|
}
|
</style>
|