gaoluyang
2025-03-10 b373b324b677d377abbcbefd7434e4af4d8f64cc
设备搬迁
已修改4个文件
123 ■■■■■ 文件已修改
src/api/cnas/resourceDemand/device.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/calibration.vue 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/files.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/management.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/resourceDemand/device.js
@@ -1359,6 +1359,15 @@
    responseType: "blob"
  });
}
//设备校准导出
export function downLoadDeviceCalibrationFile(query) {
  return request({
    url: "/personBasicInfo/downLoadDeviceCalibrationFile",
    method: "get",
    params: query,
    responseType: "blob"
  });
}
//删除 设备故障
export function deleteDeviceFaultOne(query) {
  return request({
@@ -1367,3 +1376,19 @@
    params: query,
  });
}
//删除 设备校准
export function delDeviceCalibrationFile(query) {
  return request({
    url: "/personBasicInfo/delDeviceCalibrationFile",
    method: "delete",
    params: query,
  });
}
//设备校准查询
export function getDeviceCalibrationFile(query) {
  return request({
    url: "/personBasicInfo/getDeviceCalibrationFile",
    method: "get",
    params: query,
  });
}
src/views/CNAS/resourceDemand/device/component/calibration.vue
@@ -61,7 +61,7 @@
          style="margin-top: 5px;margin-bottom: 10px;"
          :action="action"
          :data="uploadData"
          :headers="headers"
          :headers="uploadHeader"
          :before-upload="beforeUpload"
          :on-success="onSuccess"
      >
@@ -333,7 +333,7 @@
  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";
@@ -353,6 +353,12 @@
      calibrateParams: [],
      calibrateParamsLoading: false,
      addCalibrateLoading: false,
      previewFile: '',
      lookDialogVisible: false,
      recordId: null,
      uploadData: {},
      fileData: [],
      dialogVisibleFile: false,
      calibrationRecord: {
        unitOfMeasure: '', // 计量单位
        calibrationDate: null, // 校准日期
@@ -425,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)
@@ -489,9 +556,6 @@
          message: '已取消删除'
        });
      })
    },
    handleAttachmentClick(row) {
      this.$download.saveAs(row.systemFileName, row.systemFileName)
    },
    //导出
    handleDown() {
@@ -637,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()
src/views/CNAS/resourceDemand/device/component/files.vue
@@ -338,7 +338,7 @@
              <div>
                <div v-show="editData.imageName" class="picName">{{ editData.imageName }}</div>
                <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false"
                           accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload"
                           accept='image/jpg,image/jpeg,image/png' :headers="uploadHeader" :on-change="beforeUpload"
                           :on-error="onError" ref='upload' class="avatar-uploader"
                >
                  <img v-if="editData.imageUpload" :src="javaApi + '/img/' + editData.imageUpload" class="avatar">
@@ -412,7 +412,7 @@
          </el-col>
          <el-col :span="24">
            <el-form-item label="附件:" style="float: left;">
              <el-upload class="upload-demo" :action="action" :headers="headers" ref="uploadFile" :on-error="onError"
              <el-upload class="upload-demo" :action="action" :headers="uploadHeader" ref="uploadFile" :on-error="onError"
                         :on-remove="handleRemove" :on-success="onSuccess" :before-remove="beforeRemove" multiple :limit="1"
                         :on-exceed="handleExceed" :file-list="fileList">
                <el-button size="small" type="primary">点击上传</el-button>
src/views/CNAS/resourceDemand/device/component/management.vue
@@ -170,7 +170,7 @@
                style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;">
                <div v-show="formData.imageName" class="picName">{{ formData.imageName }}</div>
                <el-upload :disabled="isUp" :action="action" :on-success="handleSuccessUpImg2"
                           :show-file-list="false" accept='image/jpg,image/jpeg,image/png' :headers="headers"
                           :show-file-list="false" accept='image/jpg,image/jpeg,image/png' :headers="uploadHeader"
                           :on-change="beforeUpload" :on-error="onError" ref='upload'>
                  <el-button type="text" style="height:30px;padding-top:8px">上传</el-button>
                </el-upload>
@@ -308,7 +308,7 @@
                style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;line-height:32px;display:flex;justify-content: space-around;font-size: 13px;">
                <div v-show="formData2.imageName" class="picName">{{ formData2.imageName }}</div>
                <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false"
                           accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload"
                           accept='image/jpg,image/jpeg,image/png' :headers="uploadHeader" :on-change="beforeUpload"
                           :on-error="onError" ref='upload'>
                  <el-button type="text" style="height:30px;padding-top:8px">上传</el-button>
                </el-upload>