From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001 From: Crunchy <3114200645@qq.com> Date: 星期二, 29 四月 2025 13:25:29 +0800 Subject: [PATCH] Merge branch 'dev' into dev_tides --- src/views/CNAS/resourceDemand/device/component/calibration.vue | 73 +++++++----------------------------- 1 files changed, 15 insertions(+), 58 deletions(-) diff --git a/src/views/CNAS/resourceDemand/device/component/calibration.vue b/src/views/CNAS/resourceDemand/device/component/calibration.vue index 655c2b4..b0fcdfa 100644 --- a/src/views/CNAS/resourceDemand/device/component/calibration.vue +++ b/src/views/CNAS/resourceDemand/device/component/calibration.vue @@ -4,10 +4,10 @@ <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;"> - <el-table :data="tableData" height="calc(100vh - 20em)"> + <el-table :data="tableData" height="calc(100vh - 20em)" :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border> <el-table-column label="搴忓彿" type="index" width="120"> <template v-slot="scope"> <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> @@ -36,8 +36,8 @@ </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" + @size-change="handleSizeChange" @current-change="handleCurrentChange" background> </el-pagination> </div> <!-- 鏍″噯椤圭洰缁存姢 --> @@ -78,6 +78,7 @@ </h4> <!-- 璁惧鏍″噯鍙傛暟琛ㄦ牸 --> <el-table ref="calibrateTable" v-loading="calibrateParamsLoading" :data="calibrateParams" max-height="450" stripe + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border style="width: 100%"> <el-table-column label="缂栧彿" type="index" width="80"></el-table-column> <el-table-column label="璁¢噺鍙傛暟" prop="measurementParameter"></el-table-column> @@ -204,7 +205,7 @@ <span class="line"></span><span>鏍″噯鏉$洰纭缁撴灉</span> </span> </h4> - <el-table ref="calibrateTable" :data="calibrateParams" border> + <el-table ref="calibrateTable" :data="calibrateParams" :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border> <el-table-column label="缂栧彿" type="index" width="60"></el-table-column> <el-table-column label="璁¢噺鍙傛暟" prop="measurementParameter"></el-table-column> <el-table-column label="閲忕▼鑼冨洿" prop="rangeOfMeasurement"></el-table-column> @@ -240,20 +241,6 @@ </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> @@ -265,10 +252,8 @@ </template> <script> -import fileDownload from "@/utils/file"; import { deviceMetricRecordPage, - deviceLog, showDeviceMetricsCopy, deleteDeviceMetricRecord, deviceMetricRecordExport, @@ -276,7 +261,9 @@ selectDeviceMetric, deleteDeviceMetrics, addOrUpdateDeviceMetricRecord, + saveOrUpdateDeviceMetric } from '@/api/cnas/resourceDemand/device.js' +import { mapGetters } from "vuex"; export default { props: { clickNodeVal: { @@ -343,7 +330,6 @@ ], }, addRecordLoading: false, - tableDataOperate: [], // 鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織 upLoading: false, operationType: '', search: { @@ -355,13 +341,13 @@ }, // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� computed: { + ...mapGetters(["nickName"]), action() { return this.javaApi + '/personBasicInfo/saveCNASFile' } }, mounted() { //鑾峰彇鎿嶄綔璁板綍淇℃伅 - this.getOperateMsg(); this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 }, methods: { @@ -397,11 +383,6 @@ this.search.total = res.data.total }) }, - getOperateMsg() { - deviceLog(this.clickNodeVal.value).then(res => { - this.tableDataOperate = res.data - }) - }, // 娣诲姞鏍告煡璁板綍 add(type) { this.operationType = type @@ -410,7 +391,7 @@ }, // 鏌ョ湅璇︽儏 handleViewClick(type, row) { - showDeviceMetricsCopy({ id: row.id, type: calibrate }).then(res => { + showDeviceMetricsCopy({ id: row.id, type: 'calibrate' }).then(res => { this.calibrateParams = res.data }) this.calibrationRecord = { ...row } @@ -436,30 +417,18 @@ }) }, handleAttachmentClick(row) { - let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName) - if (state) { - let url = this.javaApi + '/img/' + row.systemFileName; - fileDownload.downloadIamge(url, row.systemFileName) - } else { - const url = this.javaApi + '/word/' + row.systemFileName - const link = document.createElement('a'); - link.href = url; - link.download = row.systemFileName; - link.click(); - this.$message.success('涓嬭浇鎴愬姛') - } + this.$download.saveAs(row.systemFileName, row.systemFileName) }, //瀵煎嚭 handleDown() { this.outLoading = true deviceMetricRecordExport({ deviceId: this.clickNodeVal.value, - type: calibrate + type: 'calibrate' }).then(res => { this.outLoading = false const blob = new Blob([res], { type: 'application/octet-stream' }); this.$download.saveAs(blob, '璁惧鏍″噯.xlsx') - this.$message.success('瀵煎嚭鎴愬姛') }) }, deleteFile() { @@ -527,10 +496,9 @@ this.calibrateParamsLoading = true this.addCalibrateLoading = true this.form0.deviceId = this.clickNodeVal.value; - const user = JSON.parse(localStorage.getItem('user')) - this.form0.createdBy = user.name; + this.form0.createdBy = this.nickName; this.form0.type = 'calibrate' - deleteDeviceMetrics(this.form0).then(res => { + saveOrUpdateDeviceMetric(this.form0).then(res => { if (res.code == 200) { this.$message.success('淇濆瓨鎴愬姛') this.$refs['form0'].resetFields() @@ -559,8 +527,7 @@ } this.addRecordLoading = true this.calibrationRecord.deviceId = this.clickNodeVal.value; - let user = JSON.parse(localStorage.getItem('user')) - this.calibrationRecord.createUser = user.name + this.calibrationRecord.createUser = this.nickName this.calibrationRecord.type = 'calibrate' this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams addOrUpdateDeviceMetricRecord(this.calibrationRecord).then(res => { @@ -636,16 +603,6 @@ } } } -} - -function downloadImage(url) { - const link = document.createElement('a'); - link.href = url; - link.target = "_blank" - link.download = 'attachment.jpg'; // 鏂囦欢鍚� - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); } </script> -- Gitblit v1.9.3