gaoluyang
2025-03-10 d3793edc9e3479f162c0cab6930d17c919ecacae
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,10 +28,11 @@
        <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>
@@ -40,15 +42,65 @@
        @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="headers"
          :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,8 +158,8 @@
            <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">
@@ -116,15 +170,19 @@
            <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"
                                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>
@@ -142,8 +200,8 @@
            </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">
@@ -154,8 +212,8 @@
            </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>
                </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">附件上传
                  </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>
@@ -240,11 +299,25 @@
            </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>
@@ -263,7 +336,9 @@
  saveOrUpdateDeviceMetric
} 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,