spring
2025-03-03 f01d916828cf9746a0f438d9472af9271efd9729
src/views/CNAS/resourceDemand/device/component/calibration.vue
@@ -4,7 +4,7 @@
    <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)">
@@ -240,20 +240,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 +251,8 @@
</template>
<script>
import fileDownload from "@/utils/file";
import {
  deviceMetricRecordPage,
  deviceLog,
  showDeviceMetricsCopy,
  deleteDeviceMetricRecord,
  deviceMetricRecordExport,
@@ -276,7 +260,9 @@
  selectDeviceMetric,
  deleteDeviceMetrics,
  addOrUpdateDeviceMetricRecord,
  saveOrUpdateDeviceMetric
} from '@/api/cnas/resourceDemand/device.js'
import { mapGetters } from "vuex";
export default {
  props: {
    clickNodeVal: {
@@ -343,7 +329,6 @@
        ],
      },
      addRecordLoading: false,
      tableDataOperate: [], // 本记录状态和操作日志
      upLoading: false,
      operationType: '',
      search: {
@@ -355,13 +340,13 @@
  },
  // 用于上传文件的信息
  computed: {
    ...mapGetters(["nickName"]),
    action() {
      return this.javaApi + '/personBasicInfo/saveCNASFile'
    }
  },
  mounted() {
    //获取操作记录信息
    this.getOperateMsg();
    this.getTableList(this.clickNodeVal.value) // 获取设备校准列表数据
  },
  methods: {
@@ -397,11 +382,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 +390,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 }
@@ -439,13 +419,11 @@
      let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName)
      if (state) {
        let url = this.javaApi + '/img/' + row.systemFileName;
        fileDownload.downloadIamge(url, row.systemFileName)
        this.$download.saveAs(url, row.systemFileName)
        this.$message.success('下载成功')
      } else {
        const url = this.javaApi + '/word/' + row.systemFileName
        const link = document.createElement('a');
        link.href = url;
        link.download = row.systemFileName;
        link.click();
        this.$download.saveAs(url, row.systemFileName)
        this.$message.success('下载成功')
      }
    },
@@ -454,7 +432,7 @@
      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' });
@@ -527,10 +505,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 +536,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 +612,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>