From b373b324b677d377abbcbefd7434e4af4d8f64cc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 10 三月 2025 17:52:09 +0800
Subject: [PATCH] 设备搬迁
---
src/views/CNAS/resourceDemand/device/component/calibration.vue | 253 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 204 insertions(+), 49 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/calibration.vue b/src/views/CNAS/resourceDemand/device/component/calibration.vue
index f11b502..c522343 100644
--- a/src/views/CNAS/resourceDemand/device/component/calibration.vue
+++ b/src/views/CNAS/resourceDemand/device/component/calibration.vue
@@ -4,9 +4,9 @@
<div class="btnS">
<el-button size="small" type="primary" @click="calibrationMaintenance()">鏍″噯椤圭洰缁存姢</el-button>
<el-button size="small" type="primary" @click="add('add')">娣诲姞鏍″噯璁板綍</el-button>
- <!-- <el-button size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button> -->
+ <el-button size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button>
</div>
- <div class="tables" style="margin-top: 10px;">
+ <div class="tables" style="margin-top: 16px;">
<el-table :data="tableData" height="calc(100vh - 20em)">
<el-table-column label="搴忓彿" type="index" width="120">
<template v-slot="scope">
@@ -14,7 +14,8 @@
</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="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' ? '涓嶅悎鏍�' : '鍏朵粬' }}
@@ -27,28 +28,79 @@
<el-table-column label="纭鏃ユ湡" min-width="150" prop="confirmDate"></el-table-column>
<el-table-column label="鐧昏浜�" min-width="150" prop="createUser"></el-table-column>
<el-table-column label="鐧昏鏃ユ湡" min-width="150" prop="createTime"></el-table-column>
- <el-table-column fixed="right" label="鎿嶄綔" min-width="180" align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="150">
<template #default="{ row }">
- <el-button size="small" type="text" @click="handleAttachmentClick(row)">涓嬭浇闄勪欢</el-button>
- <el-button size="small" type="text" @click="handleViewClick('view', row)">鏌ョ湅</el-button>
+ <el-button size="small" type="text" @click="handleAttachmentClick(row)">闄勪欢</el-button>
+ <!-- <el-button size="small" type="text" @click="handleViewClick('view', row)">鏌ョ湅</el-button> -->
+ <el-button size="small" type="text" @click="handleViewClick('add', row)">缂栬緫</el-button>
<el-button size="small" type="text" @click="handleDeleteClick(row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
- :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" style="margin-right: 5%;"
- @size-change="handleSizeChange" @current-change="handleCurrentChange">
+ :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" style="margin-right: 5%;"
+ @size-change="handleSizeChange" @current-change="handleCurrentChange">
</el-pagination>
</div>
+ <!-- 鏂囦欢棰勮 -->
+ <el-dialog
+ :visible.sync="lookDialogVisible"
+ fullscreen
+ title="鏌ョ湅闄勪欢" width="800px">
+ <filePreview v-if="lookDialogVisible" :currentFile="{}"
+ :fileUrl="previewFile" style="height: 90vh;overflow-y: auto;top: 0"/>
+ </el-dialog>
+ <!-- 闄勪欢寮规 -->
+ <el-dialog
+ title="闄勪欢"
+ :visible.sync="dialogVisibleFile"
+ width="60%"
+ >
+ <el-upload
+ ref="upload"
+ style="margin-top: 5px;margin-bottom: 10px;"
+ :action="action"
+ :data="uploadData"
+ :headers="uploadHeader"
+ :before-upload="beforeUpload"
+ :on-success="onSuccess"
+ >
+ <el-button type="primary" size="small" :loading="upLoading">涓婁紶闄勪欢</el-button>
+ </el-upload>
+ <el-table
+ :data="fileData"
+ border
+ height="400px"
+ style="width: 100%">
+ <el-table-column label="搴忓彿" type="index" width="240px">
+ </el-table-column>
+ <el-table-column label="鏂囦欢鍚嶇О" prop="fileName">
+ </el-table-column>
+ <el-table-column label="鎿嶄綔">
+ <template slot-scope="scope">
+ <el-button type="text" @click="preview(scope.row)">棰勮</el-button>
+ <el-button type="text" @click="download(scope.row)">涓嬭浇</el-button>
+ <el-button type="text" @click="delFile(scope.row)" style="color: red;">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <span slot="footer" class="dialog-footer">
+ <el-button type="primary" @click="dialogVisibleFile = false">鍏� 闂�</el-button>
+ </span>
+ </el-dialog>
+
+
+
<!-- 鏍″噯椤圭洰缁存姢 -->
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible0"
- title="鏍″噯椤圭洰缁存姢" top="5vh" width="70%">
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="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-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">
@@ -77,8 +129,9 @@
<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
- style="width: 100%">
+ <el-table ref="calibrateTable" v-loading="calibrateParamsLoading" :data="calibrateParams"
+ max-height="450"
+ stripe 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>
@@ -95,8 +148,9 @@
</el-dialog>
<!-- 娣诲姞鏍″噯璁板綍 -->
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible1"
- title="娣诲姞鏍″噯璁板綍" top="5vh" width="80%" @close="resetCalibrationRecord">
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible1" title="鏍″噯璁板綍"
+ top="5vh"
+ width="80%" @close="resetCalibrationRecord">
<div style="height: 70vh;overflow-y: auto;overflow-x: hidden;">
<h4>
<div style="display: flex;align-items: center;">
@@ -104,58 +158,62 @@
<span>娣诲姞璁惧鏍″噯璁板綍</span>
</div>
</h4>
- <el-form ref="calibrationRecord" :model="calibrationRecord" :rules="formRules" label-position="right"
- label-width="120px">
+ <el-form ref="calibrationRecord" :model="calibrationRecord"
+ :rules="formRules" label-position="right" label-width="120px">
<el-row>
<el-col :span="6">
<el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:" prop="unitOfMeasure">
<el-input v-model="calibrationRecord.unitOfMeasure" :disabled="operationType === 'view'"
- size="small"></el-input>
+ size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="鏍″噯鏃ユ湡:" prop="calibrationDate">
<el-date-picker v-model="calibrationRecord.calibrationDate" :disabled="operationType === 'view'"
- format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 90%" type="date"
- value-format="yyyy-MM-dd" @change="getNextCalibrationDate">
+ format="yyyy-MM-dd"
+ placeholder="閫夋嫨鏃ユ湡"
+ size="small"
+ style="width: 90%" type="date"
+ value-format="yyyy-MM-dd" @change="getNextCalibrationDate">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="涓嬫鏍″噯鏃ユ湡:" label-width="140px">
- <el-date-picker v-model="calibrationRecord.nextCalibrationDate" disabled format="yyyy-MM-dd"
- placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 90%" type="date" value-format="yyyy-MM-dd">
+ <el-date-picker v-model="calibrationRecord.nextCalibrationDate" disabled
+ format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 90%"
+ type="date" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="璁$畻鍣ㄥ叿:" prop="calculatingApparatus">
<el-input v-model="calibrationRecord.calculatingApparatus" :disabled="operationType === 'view'"
- size="small"></el-input>
+ size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="璁$畻鏍囧噯閲忕▼:" prop="standardRange">
<el-input v-model="calibrationRecord.standardRange" :disabled="operationType === 'view'" size="small"
- style="width: 90%"></el-input>
+ style="width: 90%"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="璁¢噺鏍囧噯涓嶇‘瀹氬害:" label-width="140px" prop="calibrationStandardUncertainty">
- <el-input v-model="calibrationRecord.calibrationStandardUncertainty"
- :disabled="operationType === 'view'" size="small" style="width: 90%"></el-input>
+ <el-input v-model="calibrationRecord.calibrationStandardUncertainty" :disabled="operationType === 'view'" size="small"
+ style="width: 90%"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鎵�渚濇嵁鏂囦欢:" prop="byDocument">
<el-input v-model="calibrationRecord.byDocument" :disabled="operationType === 'view'"
- size="small"></el-input>
+ size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="璇佷功缂栧彿:" prop="certificateSerialNumber">
- <el-input v-model="calibrationRecord.certificateSerialNumber" :disabled="operationType === 'view'"
- size="small" style="width: 90%"></el-input>
+ <el-input v-model="calibrationRecord.certificateSerialNumber" :disabled="operationType === 'view'" size="small"
+ style="width: 90%"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
@@ -170,31 +228,32 @@
<el-col :span="6">
<el-form-item label="纭鏃ユ湡:">
<el-date-picker v-model="calibrationRecord.confirmDate" :disabled="operationType === 'view'"
- format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 100%" type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss">
+ format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 100%"
+ type="datetime" value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-col>
- <el-col :span="17">
+ <!-- <el-col :span="17">
<el-form-item label="闄勪欢锛�" prop="fileName">
- <el-input v-model="calibrationRecord.fileName"
- :style="`width: ${operationType === 'add' ? '85%' : '100%'};}`" disabled size="small">
+ <el-input v-model="calibrationRecord.fileName" :style="`width: ${operationType === 'add' ? '85%' : '100%'};}`" disabled
+ size="small">
<el-button v-if="operationType === 'add'" slot="append" icon="el-icon-delete-solid"
- @click="deleteFile"></el-button>
+ @click="deleteFile"></el-button>
</el-input>
- <el-upload v-if="operationType === 'add'" ref="upload" :action="action" :before-upload="beforeUpload"
- :headers="uploadHeader" :limit="1" :on-error="onError" :on-success="handleSuccessUp"
- :show-file-list="false" style="float: right;">
+ <el-upload v-if="operationType === 'add'" ref="upload" :action="action" :before-upload="beforeUpload" :headers="headers"
+ :limit="1" :on-error="onError" :on-success="handleSuccessUp"
+ :show-file-list="false"
+ style="float: right;">
<el-button :loading="upLoading" size="small" style="position: relative; top: -4px;"
- type="primary">闄勪欢涓婁紶
+ type="primary">闄勪欢涓婁紶
</el-button>
</el-upload>
</el-form-item>
- </el-col>
+ </el-col> -->
<el-col :span="24">
<el-form-item label="澶囨敞:">
- <el-input v-model="calibrationRecord.remark" :disabled="operationType === 'view'" :rows="3" size="small"
- style="width: 96%" type="textarea"></el-input>
+ <el-input v-model="calibrationRecord.remark" :disabled="operationType === 'view'" :rows="3" size="small" style="width: 96%"
+ type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -236,15 +295,29 @@
<el-table-column label="鍗曢」缁撴灉璇存槑" prop="singleResultStatement">
<template slot-scope="scope">
<el-input v-model="scope.row.singleResultStatement" :disabled="operationType === 'view'"
- size="small"></el-input>
+ size="small"></el-input>
</template>
</el-table-column>
</el-table>
+ <!-- 鎿嶄綔鏃ュ織 -->
+ <!-- <h4>-->
+ <!-- <div style="display: flex;-->
+ <!-- align-items: center;">-->
+ <!-- <span class="line"></span><span>鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織</span>-->
+ <!-- </div>-->
+ <!-- </h4>-->
+ <!-- <el-table :data="tableDataOperate" style="width: 100%">-->
+ <!-- <el-table-column type="index" label="搴忓彿" width="100"></el-table-column>-->
+ <!-- <el-table-column prop="operator" label="鎿嶄綔浜�" width="120"></el-table-column>-->
+ <!-- <el-table-column prop="operationTime" label="鎿嶄綔鏃堕棿" width="180"></el-table-column>-->
+ <!-- <el-table-column prop="operationType" label="鎿嶄綔绫诲瀷" width="120"></el-table-column>-->
+ <!-- <el-table-column prop="operationContent" label="鎿嶄綔鍐呭"></el-table-column>-->
+ <!-- </el-table>-->
</div>
<span slot="footer" class="dialog-footer">
<el-button v-if="operationType === 'add'" @click="dialogVisible1 = false">鍙� 娑�</el-button>
- <el-button v-if="operationType === 'add'" :loading="addRecordLoading" type="primary" @click="addRecord">纭�
- 瀹�</el-button>
+ <el-button v-if="operationType === 'add'" :loading="addRecordLoading" type="primary"
+ @click="addRecord">纭� 瀹�</el-button>
</span>
</el-dialog>
</div>
@@ -260,10 +333,12 @@
selectDeviceMetric,
deleteDeviceMetrics,
addOrUpdateDeviceMetricRecord,
- saveOrUpdateDeviceMetric
+ saveOrUpdateDeviceMetric, downLoadDeviceCalibrationFile, getDeviceCalibrationFile, delDeviceCalibrationFile
} from '@/api/cnas/resourceDemand/device.js'
import { mapGetters } from "vuex";
+import filePreview from "@/components/Preview/filePreview.vue";
export default {
+ components: {filePreview},
props: {
clickNodeVal: {
type: Object,
@@ -278,6 +353,12 @@
calibrateParams: [],
calibrateParamsLoading: false,
addCalibrateLoading: false,
+ previewFile: '',
+ lookDialogVisible: false,
+ recordId: null,
+ uploadData: {},
+ fileData: [],
+ dialogVisibleFile: false,
calibrationRecord: {
unitOfMeasure: '', // 璁¢噺鍗曚綅
calibrationDate: null, // 鏍″噯鏃ユ湡
@@ -350,6 +431,67 @@
this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁
},
methods: {
+ preview(row) {
+ let list = row.fileUrl.split('.')
+ let suffix = list[list.length - 1]
+ if(suffix.toLowerCase().includes("pdf")) {
+ let link = document.createElement('a')
+ let url = this.javaApi + 'word' + row.fileUrl
+ console.log(url);
+ link.href = url
+ link.target= '_blank'
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ }else{
+ let url = ''
+ if(suffix.toLowerCase().includes('docx')) {
+ url = this.javaApi + 'word' + row.fileUrl
+ }else if(suffix.toLowerCase().includes('xls')) {
+ url = this.javaApi + 'excel' + row.fileUrl
+ }else{
+ url = this.javaApi + 'img' + row.fileUrl
+ }
+ this.previewFile = url
+ this.$nextTick(() => {
+ this.lookDialogVisible = true
+ })
+ }
+ },
+ download(row) {
+ downLoadDeviceCalibrationFile({id: row.id}).then(res => {
+ const blob = new Blob([res],{type: row.mime})
+ this.$download.saveAs(blob, row.fileName)
+ })
+ },
+ delFile(row) {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ delDeviceCalibrationFile({id: row.id}).then(res => {
+ this.$message({
+ type: 'success',
+ message: '鍒犻櫎鎴愬姛!'
+ });
+ this.getFileData(this.recordId);
+ })
+ })
+ },
+ handleAttachmentClick(row) {
+ // 妯℃嫙涓嬭浇闄勪欢
+ // const imageUrl = this.javaApi + '/img/' + row.systemFileName; // 鍥剧墖 URL
+ // file.downloadIamge(imageUrl,row.fileName)
+ this.recordId = row.id
+ this.dialogVisibleFile = true
+ this.getFileData(row.id)
+ },
+ getFileData(id) {
+ getDeviceCalibrationFile({id: id}).then(res =>{
+ this.fileData = res.data
+ })
+ },
//鐘舵�佸垽瀹�
checkRadio() {
let resultList = this.calibrateParams.map(ele => ele.result)
@@ -414,9 +556,6 @@
message: '宸插彇娑堝垹闄�'
});
})
- },
- handleAttachmentClick(row) {
- this.$download.saveAs(row.systemFileName, row.systemFileName)
},
//瀵煎嚭
handleDown() {
@@ -562,15 +701,31 @@
}
},
beforeUpload(file) {
+ let list = file.name.split('.')
+ let suffix = list[list.length - 1]
+
+ console.log(suffix);
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
this.$refs.upload.clearFiles()
return false;
} else {
this.upLoading = true;
+ this.$set(this.uploadData,'id',this.recordId)
+ this.$set(this.uploadData,'suffix',suffix)
return true;
}
},
+ onSuccess(response,file,fileList) {
+ if(response.code == 200) {
+ this.$message.success("涓婁紶鎴愬姛")
+ this.upLoading = false
+ this.$refs.upload.clearFiles()
+ this.getFileData(this.recordId)
+ } else {
+ this.$message.error(response.msg)
+ }
+ },
onError(err, file, fileList) {
this.$message.error('涓婁紶澶辫触')
this.$refs.upload.clearFiles()
--
Gitblit v1.9.3