spring
2025-02-15 237f95b05e0f122ee9ec7beaf82ba366a8b220ed
修改设备模块bug
已修改7个文件
5373 ■■■■■ 文件已修改
src/assets/api/controller.js 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/a6-device/borrow.vue 852 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/a6-device/calibration.vue 995 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/a6-device/files.vue 1236 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/a6-device/operation-instruction.vue 868 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/equipment/equipment-acceptance.vue 534 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/equipment/quantity-value-traceability-plan.vue 774 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -90,7 +90,10 @@
    responsi,
    deviceReservate,
    deviceInstruction,
    borrow
    borrow,
    getDocuments,
    product,
    deviceBorrow
  };
}
@@ -203,6 +206,7 @@
};
const deviceScope = {
  selectUserList: "/deviceScope/selectUserList", //获取用户列表
  selectDeviceParameter: "/deviceScope/selectDeviceParameter", //查询设备详情列表
  addDeviceParameter: "/deviceScope/addDeviceParameter", //添加设备详情参数
  delDeviceParameter: "/deviceScope/delDeviceParameter", //删除设备详情参数
@@ -653,7 +657,92 @@
// 6.2 人员
const personnel = {
  selectCNSAPersonTree: "/personBasicInfo/selectCNSAPersonTree", // 查询CNAS人员侧边栏
  saveCNASFile: "/personBasicInfo/saveCNASFile" // 公共文件保存接口
  getAnnex: "/personBasicInfo/getAnnex", // 获取附件
  basicInformationOfPersonnelSelectPage:
    "personBasicInfo/basicInformationOfPersonnelSelectPage", // 获取人员列表
  getAnnexByUserId: "/personBasicInfo/getAnnexByUserId",
  addAnnex: "/personBasicInfo/addAnnex", // 添加附件
  deleteAnnex: "/personBasicInfo/deleteAnnex", // 删除附件
  updateAnnex: "/personBasicInfo/updateAnnex", // 更新附件
  getCNASFile: "/personBasicInfo/getCNASFile", // 获取图片
  getCNASInformation: "/personBasicInfo/getCNASInformation", // 查询CNAS人员信息
  updateCNASInformation: "/personBasicInfo/updateCNASInformation", // 更新CNAS人员信息
  getCNASPersonnelInfo: "/personBasicInfo/getCNASPersonnelInfo", // 人员基本信息查询
  saveCNASPersonnelInfo: "/personBasicInfo/saveCNASPersonnelInfo", // 人员基本信息保存
  saveCNASFile: "/personBasicInfo/saveCNASFile", // 公共文件保存接口
  deleteCNASFile: "/personBasicInfo/deleteCNASFile", // 删除文件
  getBasicInfoFileList: "/personBasicInfo/getBasicInfoFileList", // 人员培训基本信息附件列表
  uploadBasicInfoFile: "/personBasicInfo/uploadBasicInfoFile", // 人员培训基本信息附件列表
  delBasicInfoFileList: "/personBasicInfo/delBasicInfoFileList", // 人员培训基本信息附件列表
  addBasicInfoWork: "/personBasicInfo/addBasicInfoWork", // 人员培训基本信息工作经历新增
  updateBasicInfoWorkList: "/personBasicInfo/updateBasicInfoWorkList", // 人员培训基本信息工作经历修改
  getBasicInfoWorkList: "/personBasicInfo/getBasicInfoWorkList", // 人员培训基本信息工作经历列表
  delBasicInfoWorkList: "/personBasicInfo/delBasicInfoWorkList", // 人员培训基本信息工作经历删除
  getThisYearTrainingDetailed: "/personTraining/getThisYearTrainingDetailed", // 查询今年人员培训信息
  personTrainingSelect: "/personTraining/personTrainingSelect", // 查询人员培训
  personTrainingDelete: "/personTraining/personTrainingDelete", // 删除人员培训信息
  approveAnnualPersonnelTraining:
    "/personTraining/approveAnnualPersonnelTraining", // 批准 年度人员培训
  reviewAnnualPersonnelTraining:
    "/personTraining/reviewAnnualPersonnelTraining", // 审核 年度人员培训
  personTrainingImport: "/personTraining/personTrainingImport", // 导入 人员培训
  exportPersonTraining: "/personTraining/exportPersonTraining", // 导出/人员培训
  queryTheAnnualPlanDetailsTable:
    "/personTraining/queryTheAnnualPlanDetailsTable", // 查询培训计划年度计划明细表
  addOrUpdatePersonTrainingDetailed:
    "/personTraining/addOrUpdatePersonTrainingDetailed", // 新增培训计划年度计划明细表
  deleteAnnualPlanDetailTable: "/personTraining/deleteAnnualPlanDetailTable", // 批量删除 年度计划明细表
  trainingAndAssessmentRecordsPage:
    "/personTraining/trainingAndAssessmentRecordsPage", // 培训与考核记录 查询
  deleteTrainingAndAssessmentRecords:
    "/personTraining/deleteTrainingAndAssessmentRecords", // 培训与考核记录 批量删除
  trainingAndAssessmentRecordsAdded:
    "/personTraining/trainingAndAssessmentRecordsAdded", // 培训与考核记录 提交
  trainingAndAssessmentRecordsEvaluate:
    "/personTraining/trainingAndAssessmentRecordsEvaluate", // 培训与考核记录 提交评价
  getTrainingDetailedFileList: "/personTraining/getTrainingDetailedFileList", // 人员培训详情附件列表
  delTrainingDetailedFileList: "/personTraining/delTrainingDetailedFileList", // 人员培训详情附件删除
  uploadTrainingDetailedFile: "/personTraining/uploadTrainingDetailedFile", // 人员培训详情附件新增
  personJobResponsibilitiesSave:
    "/personJobResponsibilities/personJobResponsibilitiesSave", // 新增岗位职责
  personJobResponsibilitiesDelete:
    "/personJobResponsibilities/personJobResponsibilitiesDelete", // 删除岗位职责
  personJobResponsibilitiesUpdate:
    "/personJobResponsibilities/personJobResponsibilitiesUpdate", // 更新岗位职责
  personJobResponsibilitiesSelect:
    "/personJobResponsibilities/personJobResponsibilitiesSelect", // 分页查询岗位职责
  personJobResponsibilitiesExport:
    "/personJobResponsibilities/personJobResponsibilitiesExport", // 导出岗位职责
  personTrackRecordSave: "/personTrackRecord/personTrackRecordSave", // 新增工作履历
  personTrackRecordDelete: "/personTrackRecord/personTrackRecordDelete", // 删除工作履历
  personTrackRecordUpdate: "/personTrackRecord/personTrackRecordUpdate", // 更新工作履历
  personTrackRecordSelect: "/personTrackRecord/personTrackRecordSelect", // 查询工作履历
  personTrackRecordExport: "/personTrackRecord/personTrackRecordExport", // 导出工作履历
  personTrainingRecordSelect:
    "/personTrainingRecord/personTrainingRecordSelect", // 查询培训记录
  personTrainingRecordExport:
    "/personTrainingRecord/personTrainingRecordExport", // 工作培训记录
  personPersonnelCapacityPage:
    "/personPersonnelCapacity/personPersonnelCapacityPage", // 查询人员能力
  deletePersonPersonnelCapacity:
    "/personPersonnelCapacity/deletePersonPersonnelCapacity", // 删除人员能力
  addOrUpdatePersonPersonnelCapacity:
    "/personPersonnelCapacity/addOrUpdatePersonPersonnelCapacity", // 新增编辑人员能力
  submitConfirmPersonnelCapability:
    "/personPersonnelCapacity/submitConfirmPersonnelCapability", // 新增编辑人员能力
  exportPersonnelCapacity: "/personPersonnelCapacity/exportPersonnelCapacity", // 导出人员能力
  newPersonnelAddedToTrainingRecords:
    "/personTraining/newPersonnelAddedToTrainingRecords", // 培训与考核 新增人员
  outOfFocusPreservation: "/personTraining/outOfFocusPreservation", // 培训与考核 失焦更新
  trainingSelectTrainingRecord:
    "/personTrainingRecord/trainingSelectTrainingRecord", // 查询人员 培训记录
  queryPersonnelDetails: "/personTrainingRecord/queryPersonnelDetails", // 查询人员明细 培训记录
  claimOfTrainingAndAssessmentRecords:
    "/personTraining/claimOfTrainingAndAssessmentRecords", // 认领/取消认领
  exportPersonTrainingRecord: "/personTraining/exportPersonTrainingRecord", // 导出人员培训与考核记录
  exportTrainingRecord: "/personTrainingRecord/exportTrainingRecord", // 导出培训记录
  confirmPersonnelCapability:
    "/personPersonnelCapacity/confirmPersonnelCapability" // 确认人员能力
};
// 8.3 客户满意度调查
@@ -1041,6 +1130,17 @@
    "/personJobResponsibilities/exportPersonJobResponsibilities" //导出人员职责,传参id
};
// 获取相关文档数据的api
const getDocuments = {
  list: "/documents",
  get: "/documents/getListByDId",
  updateDocument: "/documents/updateDocument"
};
// 产品相应的接口
const product = {
  list: "/api/products"
};
//设备故障相应的接口
const deviceFault = {
  list: "/api/device-faults",
@@ -1308,3 +1408,13 @@
  updateTraceabilityManagement:
    "/deviceTraceabilityManagement/updateTraceabilityManagement" // 修改量值溯源计划
};
// 6.4 设备
const deviceBorrow = {
  deviceBorrowPage: "/deviceBorrow/deviceBorrowPage", // 设备借出list
  deleteDeviceBorrow: "/deviceBorrow/deleteDeviceBorrow", //删除
  saveDeviceBorrow: "/deviceBorrow/saveDeviceBorrow", //保存
  getDeviceBorrow: "/deviceBorrow/getDeviceBorrow", //查看
  deviceBorrowExport: "/deviceBorrow/deviceBorrowExport", //导出
  directoryListing: "/procurementSuppliesContents/directoryListing" // 采购物资目录列表
};
src/components/do/a6-device/borrow.vue
@@ -4,27 +4,50 @@
    <div class="search">
      <div class="search_thing">
        <div class="search_label">流程编号:</div>
        <div ><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.processNumber"
            @keyup.enter.native="refreshTable()"></el-input></div>
        <div>
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="componentData.entity.processNumber"
            @keyup.enter.native="refreshTable()"
          ></el-input>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px;">
        <el-button size="small" @click="refresh()">重 置</el-button>
        <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
        <el-button size="small" type="primary" @click="refreshTable()"
          >查 询</el-button
        >
      </div>
      <div class="btns">
        <el-button size="small" type="primary" @click="add">新增</el-button>
        <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">导出</el-button>
        <!--        <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">导出</el-button>-->
      </div>
    </div>
    <div class="tables" style="margin-top: 10px;">
      <ValueTable ref="ValueTable" :url="$api.deviceBorrow.deviceBorrowPage"
          :delUrl="$api.deviceBorrow.deleteDeviceBorrow"
          :componentData="componentData" :key="upIndex"/>
      <ValueTable
        ref="ValueTable"
        :url="$api.deviceBorrow.deviceBorrowPage"
        :delUrl="$api.deviceBorrow.deleteDeviceBorrow"
        :componentData="componentData"
        :key="upIndex"
      />
    </div>
    <el-dialog title="仪器设备领(借)用登记" top="5vh" :visible.sync="dialogVisible" width="60%">
      <el-steps :active="currentStep" finish-status="success"  align-center>
        <el-step style="cursor:pointer" v-for="(v, i) in steps" :title="v" :key="i"
          @click.native="choiceStep(i)"></el-step>
    <el-dialog
      title="仪器设备领(借)用登记"
      top="5vh"
      :visible.sync="dialogVisible"
      width="60%"
    >
      <el-steps :active="currentStep" finish-status="success" align-center>
        <el-step
          style="cursor:pointer"
          v-for="(v, i) in steps"
          :title="v"
          :key="i"
          @click.native="choiceStep(i)"
        ></el-step>
      </el-steps>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <div v-show="currentStepClick === 0">
@@ -33,31 +56,62 @@
            <el-row>
              <el-col :span="12">
                <el-form-item label="编号:" prop="processNumber">
                  <el-input v-model="form.processNumber" size="small" :disabled="currentStep>0"></el-input>
                  <el-input
                    v-model="form.processNumber"
                    size="small"
                    :disabled="currentStep > 0"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="设备名称:">
                  <el-input v-model="form.deviceName" size="small" disabled></el-input>
                  <el-input
                    v-model="form.deviceName"
                    size="small"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="管理编号:" prop="unifyNumber">
                  <el-input v-model="form.unifyNumber" size="small" :disabled="currentStep>0"></el-input>
                  <el-input
                    v-model="form.unifyNumber"
                    size="small"
                    :disabled="currentStep > 0"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="借用人:" prop="recipientUser">
                  <el-select v-model="form.recipientUser" filterable placeholder="请选择" clearable
                   size="small" style="width: 100%;" :disabled="currentStep>0">
                    <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
                  <el-select
                    v-model="form.recipientUser"
                    filterable
                    placeholder="请选择"
                    clearable
                    size="small"
                    style="width: 100%;"
                    :disabled="currentStep > 0"
                  >
                    <el-option
                      v-for="item in responsibleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="借用人联系方式:" prop="borrowerContactInformation" label-width="150px">
                  <el-input v-model="form.borrowerContactInformation" size="small"></el-input>
                <el-form-item
                  label="借用人联系方式:"
                  prop="borrowerContactInformation"
                  label-width="150px"
                >
                  <el-input
                    v-model="form.borrowerContactInformation"
                    size="small"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
@@ -65,14 +119,22 @@
                  <el-date-picker
                    v-model="form.recipientTime"
                    type="date"
                    placeholder="选择日期" size="small"  format="yyyy-MM-dd" style="width: 100%" value-format="yyyy-MM-dd" :disabled="currentStep>0">
                    placeholder="选择日期"
                    size="small"
                    format="yyyy-MM-dd"
                    style="width: 100%"
                    value-format="yyyy-MM-dd"
                    :disabled="currentStep > 0"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="借用时状态:"
                >
                  <el-radio-group v-model="form.recipientState" :disabled="currentStep !== 0">
                <el-form-item label="借用时状态:">
                  <el-radio-group
                    v-model="form.recipientState"
                    :disabled="currentStep !== 0"
                  >
                    <el-radio :label="0">合格</el-radio>
                    <el-radio :label="1">维修</el-radio>
                    <el-radio :label="2">停用</el-radio>
@@ -82,23 +144,56 @@
              </el-col>
              <el-col :span="24">
                <el-form-item label="相关附件:" prop="fileName">
                  <el-input v-model="form.fileName" disabled size="small"
                    :style="`width: ${currentStep == 0 ? '88%' : '100%'};`">
                    <el-button slot="append" v-if="currentStep === 0" icon="el-icon-delete-solid"
                      @click="deleteFile"></el-button>
                  <el-input
                    v-model="form.fileName"
                    disabled
                    size="small"
                    :style="`width: ${currentStep == 0 ? '88%' : '100%'};`"
                  >
                    <el-button
                      slot="append"
                      v-if="currentStep === 0"
                      icon="el-icon-delete-solid"
                      @click="deleteFile"
                    ></el-button>
                  </el-input>
                  <el-upload ref="upload" style="float: right;" :action="action" :show-file-list="false"
                    :on-success="onSuccess" :disabled="currentStep !== 0">
                    <el-button style="position: relative;top: -4px" class="uploadFile" slot="trigger" size="small"
                      type="primary" v-if="currentStep === 0">附件上传</el-button>
                  <el-upload
                    ref="upload"
                    style="float: right;"
                    :action="action"
                    :show-file-list="false"
                    :on-success="onSuccess"
                    :disabled="currentStep !== 0"
                  >
                    <el-button
                      style="position: relative;top: -4px"
                      class="uploadFile"
                      slot="trigger"
                      size="small"
                      type="primary"
                      v-if="currentStep === 0"
                      >附件上传</el-button
                    >
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="下环节责任人:" prop="nextUser">
                  <el-select v-model="form.nextUser" filterable placeholder="请选择" clearable
                   size="small" style="width: 100%;" :disabled="currentStep !== 0">
                    <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
                  <el-select
                    v-model="form.nextUser"
                    filterable
                    placeholder="请选择"
                    clearable
                    size="small"
                    style="width: 100%;"
                    :disabled="currentStep !== 0"
                  >
                    <el-option
                      v-for="item in responsibleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
@@ -106,41 +201,75 @@
            </el-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              操作人:{{ form.submitOperationUser }}
            </el-col>
            <el-col :span="6">
              日期:{{ form.submitOperationTime }}
            </el-col>
            <el-col :span="4"> 操作人:{{ form.submitOperationUser }} </el-col>
            <el-col :span="6"> 日期:{{ form.submitOperationTime }} </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 1">
          <el-card style="margin-top: 1em; height: 51vh; overflow-y: scroll;">
            <el-row>
              <el-col :span="12">
                <el-form-item label="归还人:" prop="rebackUser" :rules="[{ required: currentStep === 1, message: '请输入归还人', trigger: 'change' }]">
                <el-form-item
                  label="归还人:"
                  prop="rebackUser"
                  :rules="[
                    {
                      required: currentStep === 1,
                      message: '请输入归还人',
                      trigger: 'change'
                    }
                  ]"
                >
                  <!-- <el-input v-model="form.rebackUser" size="small" :disabled="currentStep !== 1"></el-input> -->
                  <el-select v-model="form.rebackUser" filterable placeholder="请选择" clearable
                   size="small" style="width: 50%;" :disabled="currentStep !== 1">
                    <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
                  <el-select
                    v-model="form.rebackUser"
                    filterable
                    placeholder="请选择"
                    clearable
                    size="small"
                    style="width: 50%;"
                    :disabled="currentStep !== 1"
                  >
                    <el-option
                      v-for="item in responsibleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="归还日期:" prop="rebackTime" :rules="[{ required: currentStep === 1, message: '请选择归还日期', trigger: 'change' }]">
                <el-form-item
                  label="归还日期:"
                  prop="rebackTime"
                  :rules="[
                    {
                      required: currentStep === 1,
                      message: '请选择归还日期',
                      trigger: 'change'
                    }
                  ]"
                >
                  <el-date-picker
                    v-model="form.rebackTime"
                    :disabled="currentStep !== 1"
                    type="date"
                    placeholder="选择日期" size="small"  format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                    placeholder="选择日期"
                    size="small"
                    format="yyyy-MM-dd HH:mm:ss"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="接收状况:"
                >
                  <el-radio-group v-model="form.receiveState" :disabled="currentStep !== 1">
                <el-form-item label="接收状况:">
                  <el-radio-group
                    v-model="form.receiveState"
                    :disabled="currentStep !== 1"
                  >
                    <el-radio :label="0">合格</el-radio>
                    <el-radio :label="1">维修</el-radio>
                    <el-radio :label="2">停用</el-radio>
@@ -149,67 +278,87 @@
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="设备负责人:" prop="deviceUser" :rules="[{ required: currentStep === 1, message: '请选择设备负责人', trigger: 'change' }]">
                <el-form-item
                  label="设备负责人:"
                  prop="deviceUser"
                  :rules="[
                    {
                      required: currentStep === 1,
                      message: '请选择设备负责人',
                      trigger: 'change'
                    }
                  ]"
                >
                  <!-- <el-input v-model="form.deviceUser" size="small" :disabled="currentStep !== 1"></el-input> -->
                  <el-select v-model="form.deviceUser" filterable placeholder="请选择" clearable
                   size="small" style="width: 50%;" :disabled="currentStep !== 1">
                    <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
                  <el-select
                    v-model="form.deviceUser"
                    filterable
                    placeholder="请选择"
                    clearable
                    size="small"
                    style="width: 50%;"
                    :disabled="currentStep !== 1"
                  >
                    <el-option
                      v-for="item in responsibleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="备注:">
                  <el-input type="textarea" v-model="form.note" :disabled="currentStep !== 1"
                    size="small"></el-input>
                  <el-input
                    type="textarea"
                    v-model="form.note"
                    :disabled="currentStep !== 1"
                    size="small"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              操作人:{{ form.receiveOperationUser }}
            </el-col>
            <el-col :span="6">
              日期:{{ form.receiveOperationTime }}
            </el-col>
            <el-col :span="4"> 操作人:{{ form.receiveOperationUser }} </el-col>
            <el-col :span="6"> 日期:{{ form.receiveOperationTime }} </el-col>
          </el-row>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="submitForm('3reject')" v-if="currentStep !== 0 && currentStep !== 2">驳回</el-button>
        <el-button @click="submitForm('2save')" v-if="currentStep === 0">保存</el-button>
        <el-button type="primary" v-if="currentStep !== 2" @click="submitForm('1submit')">{{ currentStep === 0 ? '提交' :
          '通过'
          }}</el-button>
        <el-button
          @click="submitForm('3reject')"
          v-if="currentStep !== 0 && currentStep !== 2"
          >驳回</el-button
        >
        <el-button @click="submitForm('2save')" v-if="currentStep === 0"
          >保存</el-button
        >
        <el-button
          type="primary"
          v-if="currentStep !== 2"
          @click="submitForm('1submit')"
          >{{ currentStep === 0 ? "提交" : "通过" }}</el-button
        >
      </span>
    </el-dialog>
    <el-dialog title="流程跟踪" top="5vh" :visible.sync="dialogVisible0" width="60%">
      <el-table
      :data="deviceLogs"
      style="width: 100%">
        <el-table-column
          type="index"
          width="50">
    <el-dialog
      title="流程跟踪"
      top="5vh"
      :visible.sync="dialogVisible0"
      width="60%"
    >
      <el-table :data="deviceLogs" style="width: 100%">
        <el-table-column type="index" width="50"> </el-table-column>
        <el-table-column prop="operator" label="操作人" width="180">
        </el-table-column>
        <el-table-column
          prop="operator"
          label="操作人"
          width="180">
        <el-table-column prop="operationTime" label="操作日期" width="180">
        </el-table-column>
        <el-table-column
          prop="operationTime"
          label="操作日期"
          width="180">
        <el-table-column prop="operationType" label="提交类型">
        </el-table-column>
        <el-table-column
          prop="operationType"
          label="提交类型">
        </el-table-column>
        <el-table-column
          prop="operationContent"
          label="操作内容">
        <el-table-column prop="operationContent" label="操作内容">
        </el-table-column>
      </el-table>
    </el-dialog>
@@ -217,8 +366,8 @@
</template>
<script>
import ValueTable from '../../tool/value-table.vue'
import { dateFormat } from '../../../util/date'
import ValueTable from "../../tool/value-table.vue";
import { dateFormat } from "../../../util/date";
export default {
  props: {
    clickNodeVal: {
@@ -234,337 +383,382 @@
  data() {
    return {
      dialogVisible: false,
      dialogVisible0:false,
      dialogVisible0: false,
      //表头显示
      componentData:{
      componentData: {
        entity: {
          processNumber: null,
          deviceId:null,
          deviceId: null,
          orderBy: {
            field: 'id',
            order: 'asc'
            field: "id",
            order: "asc"
          }
          },
          isIndex: true,
          showSelect: false,
          select: false,
          do: [
        },
        isIndex: true,
        showSelect: false,
        select: false,
        do: [
          {
            id: 'show',
            font: '查看',
            type: 'text',
            method: 'lookDetail'
          },
            {
            id: 'delete',
            font: '删除',
            type: 'text',
            method: 'doDiy'
            id: "show",
            font: "查看",
            type: "text",
            method: "lookDetail"
          },
          {
            id: '111',
            font: '流程跟踪',
            type: 'text',
            method: 'handleLookList'
          }],
          init:false,
          tagField: {
            recipientState:{
              select: [{
                                value: 0,
                                type: 'success',
                                label: '合格'
                            }, {
                                value: 1,
                                type: 'warning',
                                label: '维修'
                            }, {
                                value: 2,
                                type: 'info',
                                label: '停用'
                            }, {
                                value: 3,
                                type: 'danger',
                                label: '报废'
                            }]
            }
            id: "delete",
            font: "删除",
            type: "text",
            method: "doDiy"
          },
          selectField: {},
          requiredAdd: [],
          requiredUp: [],
          {
            id: "111",
            font: "流程跟踪",
            type: "text",
            method: "handleLookList"
          }
        ],
        init: false,
        tagField: {
          recipientState: {
            select: [
              {
                value: 0,
                type: "success",
                label: "合格"
              },
              {
                value: 1,
                type: "warning",
                label: "维修"
              },
              {
                value: 2,
                type: "info",
                label: "停用"
              },
              {
                value: 3,
                type: "danger",
                label: "报废"
              }
            ]
          }
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: []
      },
      upIndex:0,
      entityCopy:null,
      upIndex: 0,
      entityCopy: null,
      currentStep: 0, // 步骤条显示第几步
      currentStepClick: 0, // 点击步骤条变化
      steps: ['借出', '借用'],
      steps: ["借出", "借用"],
      responsibleOptions: [], // 下环节负责人list
      form:{
        processNumber:null,
        deviceName:null,
        unifyNumber:null,
        recipientUser:null,
        recipientTime:null,
        nextUser:null,
        rebackUser:null,
        rebackTime:null,
        receiveState:null,
        deviceUser:null,
        fileName:null,
      form: {
        processNumber: null,
        deviceName: null,
        unifyNumber: null,
        recipientUser: null,
        recipientTime: null,
        nextUser: null,
        rebackUser: null,
        rebackTime: null,
        receiveState: null,
        deviceUser: null,
        fileName: null
      },
      rules:{
        processNumber: [{ required: true, message: '请输入编号', trigger: 'blur' }],
        deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
        unifyNumber: [{ required: true, message: '请输入管理编号', trigger: 'blur' }],
        recipientUser: [{ required: true, message: '请输入借用人', trigger: 'blur' }],
        borrowerContactInformation: [{ required: true, message: '请输入借用人联系方式', trigger: 'blur' }],
        recipientTime: [{ required: true, message: '请选择借用日期', trigger: 'change' }],
        nextUser: [{ required: true, message: '请选择下环节负责人', trigger: 'change' }],
      rules: {
        processNumber: [
          { required: true, message: "请输入编号", trigger: "blur" }
        ],
        deviceName: [
          { required: true, message: "请输入设备名称", trigger: "blur" }
        ],
        unifyNumber: [
          { required: true, message: "请输入管理编号", trigger: "blur" }
        ],
        recipientUser: [
          { required: true, message: "请输入借用人", trigger: "blur" }
        ],
        borrowerContactInformation: [
          { required: true, message: "请输入借用人联系方式", trigger: "blur" }
        ],
        recipientTime: [
          { required: true, message: "请选择借用日期", trigger: "change" }
        ],
        nextUser: [
          { required: true, message: "请选择下环节负责人", trigger: "change" }
        ]
      },
      deviceLogs:[],
      outLoading:false
    }
      deviceLogs: [],
      outLoading: false
    };
  },
  watch:{
  watch: {
    // 监听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal.value) {
        this.componentData.entity.deviceId = this.clickNodeVal.value
        this.entityCopy = this.HaveJson(this.componentData.entity)
        this.refreshTable()
        this.componentData.entity.deviceId = this.clickNodeVal.value;
        this.entityCopy = this.HaveJson(this.componentData.entity);
        this.refreshTable();
      }
    },
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {}
        this.currentStep = 0 // 步骤条显示第几步
        this.currentStepClick = 0 // 点击步骤条变化
        this.$refs['form'].clearValidate()
        this.form = {};
        this.currentStep = 0; // 步骤条显示第几步
        this.currentStepClick = 0; // 点击步骤条变化
        this.$refs["form"].clearValidate();
      }
    }
  },
  computed: {
    action() {
      return this.javaApi + this.$api.personnel.saveCNASFile
      return this.javaApi + this.$api.personnel.saveCNASFile;
    }
  },
  mounted() {
    this.componentData.entity.deviceId = this.clickNodeVal.value
    this.entityCopy = this.HaveJson(this.componentData.entity)
    this.componentData.entity.deviceId = this.clickNodeVal.value;
    this.entityCopy = this.HaveJson(this.componentData.entity);
    // console.log(333,this.clickNodeVal)
    this.getUserList()
    this.refreshTable()
    this.getUserList();
    this.refreshTable();
  },
  methods: {
    refreshTable(e) {
      this.$refs['ValueTable'].selectList(e)
      this.$refs["ValueTable"].selectList(e);
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.refreshTable()
      this.componentData.entity = this.HaveJson(this.entityCopy);
      this.refreshTable();
      // this.upIndex++
    },
    choiceStep(index) {
      this.currentStepClick = index
      this.currentStepClick = index;
    },
    //提交表单
    async submitForm(saveState) {
      this.$refs.form.validate((valid) => {
        if (valid === true || saveState !== '1submit') {
      this.$refs.form.validate(valid => {
        if (valid === true || saveState !== "1submit") {
          // 给当前环节设置创建人与时间
          let user = JSON.parse(localStorage.getItem('user'))
          const dateTime = dateFormat(new Date())
          let user = JSON.parse(localStorage.getItem("user"));
          const dateTime = dateFormat(new Date());
          // 获取当前环节操作人与日期
          switch (this.currentStep) {
            case 0:
              this.form.submitOperationUser = user.name
              this.form.submitOperationTime = dateTime
              break
              this.form.submitOperationUser = user.name;
              this.form.submitOperationTime = dateTime;
              break;
            case 1:
              this.form.receiveOperationUser = user.name
              this.form.receiveOperationTime = dateTime
              break
              this.form.receiveOperationUser = user.name;
              this.form.receiveOperationTime = dateTime;
              break;
            default:
              break
              break;
          }
          // 获取当前环节负责人
          switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) {
          switch (
            saveState === "3reject" ? this.currentStep - 1 : this.currentStep
          ) {
            case 0:
              this.form.nowUser = this.form.nextUser
              break
              this.form.nowUser = this.form.nextUser;
              break;
            default:
              break
              break;
          }
          let currentStepAction;
          // 设置该操作判断是否为提交,保存,驳回,通过
          switch (saveState) {
            // 提交,通过
            case '1submit':
              currentStepAction = this.currentStep + 1
              break
            case "1submit":
              currentStepAction = this.currentStep + 1;
              break;
            // 保存
            case '2save':
              currentStepAction = this.currentStep
              break
            case "2save":
              currentStepAction = this.currentStep;
              break;
            // 驳回
            case '3reject':
              currentStepAction = this.currentStep - 1
              break
            case "3reject":
              currentStepAction = this.currentStep - 1;
              break;
            default:
              break
              break;
          }
          // 获取当前状态
          this.form.nowState = currentStepAction === 2 ? '关闭' : this.steps[currentStepAction]
          this.form.deviceId = this.clickNodeVal.value
          delete  this.form.deviceLogs
          this.$axios.post(this.$api.deviceBorrow.saveDeviceBorrow, this.form, {
            headers: {
              'Content-Type': 'application/json'
            },
            noQs:true
          }).then(res => {
            if (res.code == 200) {
              this.$message.success('提交成功')
              this.dialogVisible = false
              this.refreshTable()
            }
          })
          this.form.nowState =
            currentStepAction === 2 ? "关闭" : this.steps[currentStepAction];
          this.form.deviceId = this.clickNodeVal.value;
          delete this.form.deviceLogs;
          this.$axios
            .post(this.$api.deviceBorrow.saveDeviceBorrow, this.form, {
              headers: {
                "Content-Type": "application/json"
              },
              noQs: true
            })
            .then(res => {
              if (res.code == 200) {
                this.$message.success("提交成功");
                this.dialogVisible = false;
                this.refreshTable();
              }
            });
        } else {
          let step = this.steps[this.currentStep]
          this.$message.warning(step + '  流程中有必填项未填!');
          let step = this.steps[this.currentStep];
          this.$message.warning(step + "  流程中有必填项未填!");
        }
      });
    },
    deleteFile() {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.fileName).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功!')
          }
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .delete(
              this.$api.personnel.deleteCNASFile +
                "?fileName=" +
                this.form.fileName
            )
            .then(res => {
              if (res.code == 200) {
                this.$message.success("删除成功!");
              }
            });
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      });
    },
    onSuccess(response, file, fileList) {
      if (response.code == 200) {
        // 在保存赋值新文件
        this.form.fileName = file.name
        this.form.url= response.data
        this.form.fileName = file.name;
        this.form.url = response.data;
      } else {
        this.$message.error(response.message)
        this.$message.error(response.message);
      }
    },
    // 获取负责人信息接口
    getUserList() {
      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
          this.responsibleOptions = res.data;
        }
      })
      });
    },
    // 查看详情
    lookDetail(row){
      this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow+'?id='+row.id).then(res => {
        if (res.code == 200) {
          this.form = res.data
          this.form.deviceName = this.clickNodeVal.label
          this.form.deviceId = this.clickNodeVal.value
          this.deviceLogs = res.data.deviceLogs
          let i = this.steps.findIndex(item => item == row.nowState)
          if(i==-1){
            this.currentStep = 2
            this.currentStepClick = 0
          }else{
            this.currentStep = i
            this.currentStepClick = i
    lookDetail(row) {
      this.$axios
        .get(this.$api.deviceBorrow.getDeviceBorrow + "?id=" + row.id)
        .then(res => {
          if (res.code == 200) {
            this.form = res.data;
            this.form.deviceName = this.clickNodeVal.label;
            this.form.deviceId = this.clickNodeVal.value;
            this.deviceLogs = res.data.deviceLogs;
            let i = this.steps.findIndex(item => item == row.nowState);
            if (i == -1) {
              this.currentStep = 2;
              this.currentStepClick = 0;
            } else {
              this.currentStep = i;
              this.currentStepClick = i;
            }
            console.log(this.currentStepClick);
            this.dialogVisible = true;
          }
          console.log(this.currentStepClick)
          this.dialogVisible = true
        }
      })
        });
    },
    // 新增
    add(){
      this.dialogVisible = true
    add() {
      this.dialogVisible = true;
      this.form = {
        processNumber:null,
        deviceName:null,
        unifyNumber:null,
        recipientUser:null,
        recipientTime:null,
        nextUser:null,
        rebackUser:null,
        rebackTime:null,
        receiveState:null,
        deviceUser:null,
        fileName:null,
      }
      this.form.deviceName = this.clickNodeVal.label
      this.form.deviceId = this.clickNodeVal.value
        processNumber: null,
        deviceName: null,
        unifyNumber: null,
        recipientUser: null,
        recipientTime: null,
        nextUser: null,
        rebackUser: null,
        rebackTime: null,
        receiveState: null,
        deviceUser: null,
        fileName: null
      };
      this.form.deviceName = this.clickNodeVal.label;
      this.form.deviceId = this.clickNodeVal.value;
    },
    //导出
    handleDown() {
      this.outLoading = true
      this.$axios.post(this.$api.deviceBorrow.deviceBorrowExport,{deviceId:this.clickNodeVal.value},{responseType: 'blob'}).then(res => {
        this.outLoading = false
        const blob = new Blob([res], {
          type: 'application/force-download'
        })
        const filename = decodeURI(this.clickNodeVal.label+'设备借出统计'+'.xlsx')
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
      this.outLoading = true;
      this.$axios
        .post(
          this.$api.deviceBorrow.deviceBorrowExport,
          { deviceId: this.clickNodeVal.value },
          { responseType: "blob" }
        )
        .then(res => {
          this.outLoading = false;
          const blob = new Blob([res], {
            type: "application/force-download"
          });
          const filename = decodeURI(
            this.clickNodeVal.label + "设备借出统计" + ".xlsx"
          );
          //将Blob 对象转换成字符串
          let reader = new FileReader();
          reader.readAsText(blob, "utf-8");
          reader.onload = () => {
            try {
              let result = JSON.parse(reader.result);
              if (result.message) {
                this.$message.error(result.message);
              } else {
                // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
                const elink = document.createElement("a");
                elink.download = filename;
                elink.style.display = "none";
                elink.href = URL.createObjectURL(blob);
                document.body.appendChild(elink);
                elink.click();
                URL.revokeObjectURL(elink.href); // 释放URL 对象
                document.body.removeChild(elink);
                this.$message.success("导出成功");
              }
            } catch (err) {
              console.log(err);
              // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
              const elink = document.createElement('a')
              elink.download = filename
              elink.style.display = 'none'
              elink.href = URL.createObjectURL(blob)
              document.body.appendChild(elink)
              const elink = document.createElement("a");
              elink.download = filename;
              elink.style.display = "none";
              elink.href = URL.createObjectURL(blob);
              document.body.appendChild(elink);
              elink.click();
              URL.revokeObjectURL(elink.href) // 释放URL 对象
              document.body.removeChild(elink)
              this.$message.success('导出成功')
              URL.revokeObjectURL(elink.href); // 释放URL 对象
              document.body.removeChild(elink);
              this.$message.success("导出成功");
            }
          } catch (err) {
            console.log(err);
            // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
            const elink = document.createElement('a')
            elink.download = filename
            elink.style.display = 'none'
            elink.href = URL.createObjectURL(blob)
            document.body.appendChild(elink)
            elink.click();
            URL.revokeObjectURL(elink.href) // 释放URL 对象
            document.body.removeChild(elink)
            this.$message.success('导出成功')
          }
        }
      })
          };
        });
    },
    handleLookList(row){
      this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow+'?id='+row.id).then(res => {
        if (res.code == 200) {
          this.deviceLogs = res.data.deviceLogs
          this.dialogVisible0 = true
        }
      })
    handleLookList(row) {
      this.$axios
        .get(this.$api.deviceBorrow.getDeviceBorrow + "?id=" + row.id)
        .then(res => {
          if (res.code == 200) {
            this.deviceLogs = res.data.deviceLogs;
            this.dialogVisible0 = true;
          }
        });
    }
  },
}
  }
};
</script>
<style scoped>
@@ -580,7 +774,7 @@
  display: inline-block;
  width: 3px;
  height: 16px;
  background: #3A7BFA;
  background: #3a7bfa;
  margin-right: 4px;
}
@@ -630,10 +824,10 @@
.form .search_label {
  width: 120px;
}
.el-radio{
.el-radio {
  margin-right: 10px;
}
.el-radio-group{
.el-radio-group {
  width: 100%;
  display: flex;
  margin-top: 12px;
src/components/do/a6-device/calibration.vue
@@ -2,105 +2,246 @@
<template>
  <div>
    <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="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
      >
    </div>
    <div class="tables" style="margin-top: 10px;">
      <el-table :data="tableData" height="calc(100vh - 20em)">
        <el-table-column label="序号" type="index" width="120">
          <template v-slot="scope">
            <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
            <span>{{
              (search.current - 1) * search.size + scope.$index + 1
            }}</span>
          </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="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="status">
          <template v-slot="scope">
            {{ scope.row.status === '0yes' ? '合格' : scope.row.status === '1no' ? '不合格' : '其他' }}
            {{
              scope.row.status === "0yes"
                ? "合格"
                : scope.row.status === "1no"
                ? "不合格"
                : "其他"
            }}
          </template>
        </el-table-column>
        <el-table-column label="校准证书编号" min-width="150" prop="certificateSerialNumber"></el-table-column>
        <el-table-column label="说明" min-width="150" prop="remark" show-overflow-tooltip></el-table-column>
        <el-table-column label="校准日期" min-width="150" prop="calibrationDate"></el-table-column>
        <el-table-column label="下次校准日期" min-width="150" prop="nextCalibrationDate"></el-table-column>
        <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
          label="校准证书编号"
          min-width="150"
          prop="certificateSerialNumber"
        ></el-table-column>
        <el-table-column
          label="说明"
          min-width="150"
          prop="remark"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          label="校准日期"
          min-width="150"
          prop="calibrationDate"
        ></el-table-column>
        <el-table-column
          label="下次校准日期"
          min-width="150"
          prop="nextCalibrationDate"
        ></el-table-column>
        <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"
        >
          <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="handleDeleteClick(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="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">
      <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"
      >
      </el-pagination>
    </div>
    <!-- 校准项目维护 -->
    <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>
        <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">
                <el-input v-model="form0.measurementParameter" clearable placeholder="请输入" size="small"></el-input>
                <el-input
                  v-model="form0.measurementParameter"
                  clearable
                  placeholder="请输入"
                  size="small"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="量程范围:" prop="rangeOfMeasurement">
                <el-input v-model="form0.rangeOfMeasurement" clearable placeholder="请输入" size="small"></el-input>
                <el-input
                  v-model="form0.rangeOfMeasurement"
                  clearable
                  placeholder="请输入"
                  size="small"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="最大允许误差:" prop="maxPermissibleError">
                <el-input v-model="form0.maxPermissibleError" clearable placeholder="请输入" size="small"></el-input>
                <el-input
                  v-model="form0.maxPermissibleError"
                  clearable
                  placeholder="请输入"
                  size="small"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="判定标准:" prop="judgmentCriteria">
                <el-input v-model="form0.judgmentCriteria" clearable placeholder="请输入" size="small"></el-input>
                <el-input
                  v-model="form0.judgmentCriteria"
                  clearable
                  placeholder="请输入"
                  size="small"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <h4>
        <span style="display: flex;align-items: center;"><span class="line"></span><span>设备校准参数</span></span>
        <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>
        <el-table-column label="最大允许误差" prop="maxPermissibleError"></el-table-column>
        <el-table-column label="判定标准" prop="judgmentCriteria"></el-table-column>
        <el-table-column
          label="计量参数"
          prop="measurementParameter"
        ></el-table-column>
        <el-table-column
          label="量程范围"
          prop="rangeOfMeasurement"
        ></el-table-column>
        <el-table-column
          label="最大允许误差"
          prop="maxPermissibleError"
        ></el-table-column>
        <el-table-column
          label="判定标准"
          prop="judgmentCriteria"
        ></el-table-column>
        <el-table-column label="创建人" prop="createdBy"></el-table-column>
        <el-table-column label="创建时间" prop="creationTime"></el-table-column>
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button size="small" type="text" @click="handleDelete(scope.row)">删除</el-button>
            <el-button size="small" type="text" @click="handleDelete(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </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;">
@@ -108,67 +249,117 @@
            <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>
                <el-input
                  v-model="calibrationRecord.unitOfMeasure"
                  :disabled="operationType === 'view'"
                  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">
                <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"
                >
                </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>
                <el-input
                  v-model="calibrationRecord.calculatingApparatus"
                  :disabled="operationType === 'view'"
                  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>
                <el-input
                  v-model="calibrationRecord.standardRange"
                  :disabled="operationType === 'view'"
                  size="small"
                  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-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-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>
                <el-input
                  v-model="calibrationRecord.byDocument"
                  :disabled="operationType === 'view'"
                  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">
              <el-form-item label="状态:" label-width="140px" prop="status" required>
                <el-radio-group v-model="calibrationRecord.status" :disabled="operationType === 'view'">
              <el-form-item
                label="状态:"
                label-width="140px"
                prop="status"
                required
              >
                <el-radio-group
                  v-model="calibrationRecord.status"
                  :disabled="operationType === 'view'"
                >
                  <el-radio label="0yes">合格</el-radio>
                  <el-radio label="1no">不合格</el-radio>
                  <el-radio label="2other">其他</el-radio>
@@ -177,35 +368,68 @@
            </el-col>
            <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">
                <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"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <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-button v-if="operationType === 'add'" slot="append" icon="el-icon-delete-solid"
                             @click="deleteFile"></el-button>
                <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="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-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 :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>
@@ -216,17 +440,36 @@
          </span>
        </h4>
        <el-table ref="calibrateTable" :data="calibrateParams" 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>
          <el-table-column label="最大允许误差" prop="maxPermissibleError"></el-table-column>
          <el-table-column label="判定标准" prop="judgmentCriteria"></el-table-column>
          <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>
          <el-table-column
            label="最大允许误差"
            prop="maxPermissibleError"
          ></el-table-column>
          <el-table-column
            label="判定标准"
            prop="judgmentCriteria"
          ></el-table-column>
          <el-table-column label="是否校准" prop="isCalibration">
            <template slot="header" slot-scope="scope">
              <span class="required-span">* </span>是否校准
            </template>
            <template slot-scope="scope">
              <el-radio-group v-model="scope.row.isCalibration" :disabled="operationType === 'view'">
              <el-radio-group
                v-model="scope.row.isCalibration"
                :disabled="operationType === 'view'"
              >
                <el-radio label="0yes">是</el-radio>
                <el-radio label="1no">否</el-radio>
              </el-radio-group>
@@ -237,7 +480,11 @@
              <span class="required-span">* </span>判定结果
            </template>
            <template slot-scope="scope">
              <el-radio-group v-model="scope.row.result" :disabled="operationType === 'view'" @input="checkRadio()">
              <el-radio-group
                v-model="scope.row.result"
                :disabled="operationType === 'view'"
                @input="checkRadio()"
              >
                <el-radio label="0yes">合格</el-radio>
                <el-radio label="1no">不合格</el-radio>
                <el-radio label="2other">其他</el-radio>
@@ -246,8 +493,11 @@
          </el-table-column>
          <el-table-column label="单项结果说明" prop="singleResultStatement">
            <template slot-scope="scope">
              <el-input v-model="scope.row.singleResultStatement" :disabled="operationType === 'view'"
                        size="small"></el-input>
              <el-input
                v-model="scope.row.singleResultStatement"
                :disabled="operationType === 'view'"
                size="small"
              ></el-input>
            </template>
          </el-table-column>
        </el-table>
@@ -267,16 +517,25 @@
        <!--        </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'"
          @click="dialogVisible1 = false"
          >取 消</el-button
        >
        <el-button
          v-if="operationType === 'add'"
          :loading="addRecordLoading"
          type="primary"
          @click="addRecord"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
<script>
import file from '../../../util/file';
import file from "../../../util/file";
import fileDownload from "../../../util/file";
export default {
@@ -295,348 +554,427 @@
      calibrateParamsLoading: false,
      addCalibrateLoading: false,
      calibrationRecord: {
        unitOfMeasure: '', // 计量单位
        unitOfMeasure: "", // 计量单位
        calibrationDate: null, // 校准日期
        nextCalibrationDate: null, // 下次校准日期
        calculatingApparatus: '', // 计算器具
        calculatingApparatus: "", // 计算器具
        confirmDate: null, // 确认日期
        standardRange: '', // 计算标准量程
        calibrationStandardUncertainty: '', // 计量标准不确定度
        byDocument: '', // 依据文件
        certificateSerialNumber: '', // 证书编号
        status: '', // 状态
        remark: '', // 备注
        systemFileName: '', //
        fileName: '', //
        standardRange: "", // 计算标准量程
        calibrationStandardUncertainty: "", // 计量标准不确定度
        byDocument: "", // 依据文件
        certificateSerialNumber: "", // 证书编号
        status: "", // 状态
        remark: "", // 备注
        systemFileName: "", //
        fileName: "" //
      },
      formRules: {
        unitOfMeasure: [{required: true, message: '请输入校准服务机构', trigger: 'blur'}],
        calibrationDate: [{required: true, message: '请选择校准日期', trigger: 'change'}],
        calculatingApparatus: [{required: true, message: '请输入计算器具', trigger: 'blur'}],
        standardRange: [{required: true, message: '请输入计算标准量程', trigger: 'blur'}],
        calibrationStandardUncertainty: [{required: true, message: '请输入计量标准不确定度', trigger: 'blur'}],
        byDocument: [{required: true, message: '请输入所依据文件', trigger: 'blur'}],
        status: [{required: true, message: '请选择状态', trigger: 'change'}],
        unitOfMeasure: [
          { required: true, message: "请输入校准服务机构", trigger: "blur" }
        ],
        calibrationDate: [
          { required: true, message: "请选择校准日期", trigger: "change" }
        ],
        calculatingApparatus: [
          { required: true, message: "请输入计算器具", trigger: "blur" }
        ],
        standardRange: [
          { required: true, message: "请输入计算标准量程", trigger: "blur" }
        ],
        calibrationStandardUncertainty: [
          { required: true, message: "请输入计量标准不确定度", trigger: "blur" }
        ],
        byDocument: [
          { required: true, message: "请输入所依据文件", trigger: "blur" }
        ],
        status: [{ required: true, message: "请选择状态", trigger: "change" }]
      },
      tableData: [],
      dialogVisible0: false,
      dialogVisible1: false,
      form0: {
        measurementParameter: '', // 计量参数
        rangeOfMeasurement: '',
        maxPermissibleError: '',
        judgmentCriteria: '',
        createdBy: '',
        action: '',
        measurementParameter: "", // 计量参数
        rangeOfMeasurement: "",
        maxPermissibleError: "",
        judgmentCriteria: "",
        createdBy: "",
        action: "",
        deviceId: null
      },
      form0Rules: {
        measurementParameter: [
          {required: true, message: '请输入计量参数', trigger: 'blur'}
          { required: true, message: "请输入计量参数", trigger: "blur" }
        ],
        rangeOfMeasurement: [
          {required: true, message: '请输入量程范围', trigger: 'blur'}
          { required: true, message: "请输入量程范围", trigger: "blur" }
        ],
        maxPermissibleError: [
          {required: true, message: '请输入最大允许误差', trigger: 'blur'}
          { required: true, message: "请输入最大允许误差", trigger: "blur" }
        ],
        judgmentCriteria: [
          {required: true, message: '请输入判定标准', trigger: 'blur'}
        ],
          { required: true, message: "请输入判定标准", trigger: "blur" }
        ]
      },
      addRecordLoading: false,
      tableDataOperate: [], // 本记录状态和操作日志
      upLoading: false,
      operationType: '',
      operationType: "",
      search: {
        size: 20,
        current: 1,
        total: 0
      },
    }
      }
    };
  },
  // 用于上传文件的信息
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
        token: sessionStorage.getItem("token")
      };
    },
    action() {
      return this.javaApi + this.$api.personnel.saveCNASFile
      return this.javaApi + this.$api.personnel.saveCNASFile;
    }
  },
  mounted() {
    //获取操作记录信息
    this.getOperateMsg();
    this.getTableList(this.clickNodeVal.value) // 获取设备校准列表数据
    this.getTableList(this.clickNodeVal.value); // 获取设备校准列表数据
  },
  methods: {
    //状态判定
    checkRadio(){
      let resultList = this.calibrateParams.map(ele=>ele.result)
      if(resultList && resultList.filter(ele=>ele=='1no').length>0){
        this.calibrationRecord.status = '1no'
      }else if(resultList && resultList.filter(ele=>ele=='2other').length==resultList.length){
        this.calibrationRecord.status = '2other'
      }else if(resultList && resultList.filter(ele=>ele=='0yes').length==resultList.length){
        this.calibrationRecord.status = '0yes'
    checkRadio() {
      let resultList = this.calibrateParams.map(ele => ele.result);
      if (resultList && resultList.filter(ele => ele == "1no").length > 0) {
        this.calibrationRecord.status = "1no";
      } else if (
        resultList &&
        resultList.filter(ele => ele == "2other").length == resultList.length
      ) {
        this.calibrationRecord.status = "2other";
      } else if (
        resultList &&
        resultList.filter(ele => ele == "0yes").length == resultList.length
      ) {
        this.calibrationRecord.status = "0yes";
      }
    },
    getNextCalibrationDate(val) {
      let oneYearLaterDate = new Date(val)
      let oneYearLaterDate = new Date(val);
      oneYearLaterDate.setFullYear(oneYearLaterDate.getFullYear() + 1);
      oneYearLaterDate.setDate(oneYearLaterDate.getDate() - 1);
      // let obj = oneYearLaterDate.toISOString().split('T')[0];
      this.calibrationRecord.nextCalibrationDate = oneYearLaterDate
      this.calibrationRecord.nextCalibrationDate = oneYearLaterDate;
    },
    handleSizeChange(val) {
      this.search.size = val
      this.search.size = val;
      this.getTableList(this.clickNodeVal.value);
    },
    handleCurrentChange(val) {
      this.search.current = val
      this.search.current = val;
      this.getTableList(this.clickNodeVal.value);
    },
    getTableList(deviceId) {
      this.$axios.get(this.$api.deviceCheck.deviceMetricRecordPage + '?deviceId=' + deviceId + "&size=" + this.search.size + "&current=" + this.search.current + "&type=calibrate").then(res => {
        this.tableData = res.data.records
        this.search.total = res.data.total
      })
      this.$axios
        .get(
          this.$api.deviceCheck.deviceMetricRecordPage +
            "?deviceId=" +
            deviceId +
            "&size=" +
            this.search.size +
            "&current=" +
            this.search.current +
            "&type=calibrate"
        )
        .then(res => {
          this.tableData = res.data.records;
          this.search.total = res.data.total;
        });
    },
    getOperateMsg() {
      this.$axios.get(this.$api.deviceOperate.list + "/" + this.clickNodeVal.value).then(res => {
        this.tableDataOperate = res.data
      })
      this.$axios
        .get(this.$api.deviceOperate.list + "/" + this.clickNodeVal.value)
        .then(res => {
          this.tableDataOperate = res.data;
        });
    },
    // 添加核查记录
    add(type) {
      this.operationType = type
      this.dialogVisible1 = true
      this.getXmsg()
      this.operationType = type;
      this.dialogVisible1 = true;
      this.getXmsg();
    },
    // 查看详情
    handleViewClick(type, row) {
      this.$axios.get(this.$api.deviceCheck.showDeviceMetricsCopy + "?id=" + row.id + "&type=calibrate").then(res => {
        this.calibrateParams = res.data
      })
      this.calibrationRecord = {...row}
      this.operationType = type
      this.dialogVisible1 = true
      this.$axios
        .get(
          this.$api.deviceCheck.showDeviceMetricsCopy +
            "?id=" +
            row.id +
            "&type=calibrate"
        )
        .then(res => {
          this.calibrateParams = res.data;
        });
      this.calibrationRecord = { ...row };
      this.operationType = type;
      this.dialogVisible1 = true;
    },
    // 表格删除操作
    handleDeleteClick(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetricRecord + "?id=" + row.id).then(res => {
          this.getTableList(this.clickNodeVal.value) // 获取设备校准列表数据
          this.$message.success('删除成功!')
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .delete(
              this.$api.deviceCheck.deleteDeviceMetricRecord + "?id=" + row.id
            )
            .then(res => {
              this.getTableList(this.clickNodeVal.value); // 获取设备校准列表数据
              this.$message.success("删除成功!");
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    handleAttachmentClick(row) {
      let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName)
      let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName);
      if (state) {
        let url = this.javaApi + '/img/' + row.systemFileName;
        fileDownload.downloadIamge(url, row.systemFileName)
        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');
        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.$message.success("下载成功");
      }
    },
    //导出
    handleDown() {
      this.outLoading = true
      this.$axios.get(this.$api.deviceCheck.deviceMetricRecordExport + '?deviceId=' + this.clickNodeVal.value + "&type=calibrate", {
        responseType: "blob"
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], {type: 'application/octet-stream'});
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '设备校准.xlsx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '设备校准.xlsx';
            link.click();
            this.$message.success('导出成功')
      this.outLoading = true;
      this.$axios
        .get(
          this.$api.deviceCheck.deviceMetricRecordExport +
            "?deviceId=" +
            this.clickNodeVal.value +
            "&type=calibrate",
          {
            responseType: "blob"
          }
        }
      })
        )
        .then(res => {
          this.outLoading = false;
          const blob = new Blob([res], { type: "application/octet-stream" });
          //将Blob 对象转换成字符串
          let reader = new FileReader();
          reader.readAsText(blob, "utf-8");
          reader.onload = () => {
            try {
              let result = JSON.parse(reader.result);
              if (result.message) {
                this.$message.error(result.message);
              } else {
                const url = URL.createObjectURL(blob);
                const link = document.createElement("a");
                link.href = url;
                link.download = "设备校准.xlsx";
                link.click();
                this.$message.success("导出成功");
              }
            } catch (err) {
              console.log(err);
              const url = URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.href = url;
              link.download = "设备校准.xlsx";
              link.click();
              this.$message.success("导出成功");
            }
          };
        });
    },
    deleteFile() {
      this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.calibrationRecord.systemFileName).then(res => {
          this.calibrationRecord.fileName = ''
          this.$refs.upload.clearFiles()
          if (res.code == 200) {
            this.$message.success('删除成功!')
          }
      this.$confirm("此操作将永久删除文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .delete(
              this.$api.personnel.deleteCNASFile +
                "?fileName=" +
                this.calibrationRecord.systemFileName
            )
            .then(res => {
              this.calibrationRecord.fileName = "";
              this.$refs.upload.clearFiles();
              if (res.code == 200) {
                this.$message.success("删除成功!");
              }
            });
        })
      }).catch((err) => {
        console.log('err----', err)
        this.$message({
          type: 'info',
          message: '已取消删除'
        .catch(err => {
          console.log("err----", err);
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      });
    },
    // 校准项目维护
    calibrationMaintenance() {
      this.dialogVisible0 = true
      this.dialogVisible0 = true;
      this.getXmsg();
    },
    // 获取设备校准参数table信息
    async getXmsg() {
      this.calibrateParamsLoading = true
      this.calibrateParamsLoading = true;
      try {
        await this.$axios.get(this.$api.deviceCheck.selectDeviceMetric + "?deviceId=" + this.clickNodeVal.value + "&type=calibrate").then(res => {
          if (res.code == 200) {
            this.calibrateParams = res.data
          }
          this.calibrateParamsLoading = false
        })
        await this.$axios
          .get(
            this.$api.deviceCheck.selectDeviceMetric +
              "?deviceId=" +
              this.clickNodeVal.value +
              "&type=calibrate"
          )
          .then(res => {
            if (res.code == 200) {
              this.calibrateParams = res.data;
            }
            this.calibrateParamsLoading = false;
          });
      } catch (e) {
        console.log('getXmsg---', e)
        this.calibrateParamsLoading = false
        console.log("getXmsg---", e);
        this.calibrateParamsLoading = false;
      }
    },
    // 校准项目维护-删除设备校准参数
    handleDelete(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetrics + '?id=' + row.id).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功!');
            this.getXmsg();
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除');
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .delete(this.$api.deviceCheck.deleteDeviceMetrics + "?id=" + row.id)
            .then(res => {
              if (res.code === 200) {
                this.$message.success("删除成功!");
                this.getXmsg();
              }
            });
        })
        .catch(() => {
          this.$message.info("已取消删除");
        });
    },
    addCalibrate() {
      this.$refs['form0'].validate((valid) => {
      this.$refs["form0"].validate(valid => {
        if (valid) {
          // 保存
          this.calibrateParamsLoading = true
          this.addCalibrateLoading = true
          this.calibrateParamsLoading = true;
          this.addCalibrateLoading = true;
          this.form0.deviceId = this.clickNodeVal.value;
          const user = JSON.parse(localStorage.getItem('user'))
          const user = JSON.parse(localStorage.getItem("user"));
          this.form0.createdBy = user.name;
          this.form0.type = 'calibrate'
          this.$axios.post(this.$api.deviceCheck.saveOrUpdateDeviceMetric, this.form0, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            if (res.code == 200) {
              this.$message.success('保存成功')
              this.$refs['form0'].resetFields()
              this.getXmsg() // 刷新设备校准参数表格
            }
            this.calibrateParamsLoading = false
            this.addCalibrateLoading = false
          })
          this.form0.type = "calibrate";
          this.$axios
            .post(this.$api.deviceCheck.saveOrUpdateDeviceMetric, this.form0, {
              headers: {
                "Content-Type": "application/json"
              }
            })
            .then(res => {
              if (res.code == 200) {
                this.$message.success("保存成功");
                this.$refs["form0"].resetFields();
                this.getXmsg(); // 刷新设备校准参数表格
              }
              this.calibrateParamsLoading = false;
              this.addCalibrateLoading = false;
            });
        } else {
          this.addCalibrateLoading = false
          this.$message.warning('有必填项未填');
          this.addCalibrateLoading = false;
          this.$message.warning("有必填项未填");
        }
      })
      });
    },
    addRecord() {
      this.$refs['calibrationRecord'].validate((valid) => {
      this.$refs["calibrationRecord"].validate(valid => {
        if (valid) {
          try {
            if (this.calibrateParams.some(m => m.isCalibration === undefined)) {
              this.$message.error('请选择是否校准')
              return
              this.$message.error("请选择是否校准");
              return;
            }
            if (!this.calibrateParams.every(m => m.result !== undefined)) {
              this.$message.error('请选择判定结果')
              return
              this.$message.error("请选择判定结果");
              return;
            }
            this.addRecordLoading = true
            this.addRecordLoading = true;
            this.calibrationRecord.deviceId = this.clickNodeVal.value;
            let user = JSON.parse(localStorage.getItem('user'))
            this.calibrationRecord.createUser = user.name
            this.calibrationRecord.type = 'calibrate'
            this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams
            this.$axios.post(this.$api.deviceCheck.addOrUpdateDeviceMetricRecord, this.calibrationRecord, {
              headers: {
                'Content-Type': 'application/json'
              }
            }).then(res => {
              if (res.code == 200) {
                this.$message.success('添加成功')
                this.dialogVisible1 = false
                this.getTableList(this.clickNodeVal.value)
              }
              this.addRecordLoading = false
            })
            let user = JSON.parse(localStorage.getItem("user"));
            this.calibrationRecord.createUser = user.name;
            this.calibrationRecord.type = "calibrate";
            this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams;
            this.$axios
              .post(
                this.$api.deviceCheck.addOrUpdateDeviceMetricRecord,
                this.calibrationRecord,
                {
                  headers: {
                    "Content-Type": "application/json"
                  }
                }
              )
              .then(res => {
                if (res.code == 200) {
                  this.$message.success("添加成功");
                  this.dialogVisible1 = false;
                  this.getTableList(this.clickNodeVal.value);
                }
                this.addRecordLoading = false;
              });
          } catch (e) {
            console.log('addRecord---', e)
            this.addRecordLoading = false
            console.log("addRecord---", e);
            this.addRecordLoading = false;
          }
        } else {
          this.$message.warning('有必填项未填');
          this.$message.warning("有必填项未填");
        }
      })
      });
    },
    resetCalibrationRecord() {
      this.$refs.calibrationRecord.resetFields()
      this.$refs.calibrationRecord.resetFields();
    },
    // 上传附件
    handleSuccessUp(response, file) {
      if (response.code == 200) {
        // 在保存赋值新文件
        this.calibrationRecord.fileName = file.name
        this.calibrationRecord.systemFileName = response.data
        this.calibrationRecord.fileName = file.name;
        this.calibrationRecord.systemFileName = response.data;
        this.upLoading = false;
      } else {
        this.upLoading = false;
        this.$message.error(response.message)
        this.$message.error(response.message);
      }
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');
        this.$refs.upload.clearFiles()
        this.$message.error("上传文件不超过10M");
        this.$refs.upload.clearFiles();
        return false;
      } else {
        this.upLoading = true;
@@ -644,9 +982,9 @@
      }
    },
    onError(err, file, fileList) {
      this.$message.error('上传失败')
      this.$refs.upload.clearFiles()
    },
      this.$message.error("上传失败");
      this.$refs.upload.clearFiles();
    }
    // end
  },
  watch: {
@@ -658,34 +996,33 @@
    },
    dialogVisible1(newVal) {
      if (newVal === false) {
        this.calibrateParams = []
        this.calibrateParams = [];
        this.calibrationRecord = {
          unitOfMeasure: '', // 计量单位
          unitOfMeasure: "", // 计量单位
          calibrationDate: null, // 校准日期
          nextCalibrationDate: null, // 下次校准日期
          calculatingApparatus: '', // 计算器具
          standardRange: '', // 计算标准量程
          calibrationStandardUncertainty: '', // 计量标准不确定度
          byDocument: '', // 依据文件
          certificateSerialNumber: '', // 证书编号
          status: '', // 状态
          remark: '', // 备注
        }
          calculatingApparatus: "", // 计算器具
          standardRange: "", // 计算标准量程
          calibrationStandardUncertainty: "", // 计量标准不确定度
          byDocument: "", // 依据文件
          certificateSerialNumber: "", // 证书编号
          status: "", // 状态
          remark: "" // 备注
        };
      }
    }
  }
}
};
function downloadImage(url) {
  const link = document.createElement('a');
  const link = document.createElement("a");
  link.href = url;
  link.target="_blank"
  link.download = 'attachment.jpg'; // 文件名
  link.target = "_blank";
  link.download = "attachment.jpg"; // 文件名
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
}
</script>
<style scoped>
.tables {
@@ -735,7 +1072,7 @@
  display: inline-block;
  width: 3px;
  height: 16px;
  background: #3A7BFA;
  background: #3a7bfa;
  margin-right: 4px;
}
@@ -772,7 +1109,3 @@
  background-color: #f5f5f5;
}
</style>
src/components/do/a6-device/files.vue
@@ -5,13 +5,21 @@
      <h4><span class="line"></span><span>设备档案</span></h4>
      <div class="btns">
        <el-button type="primary" size="small" @click="openEditForm"
          style="">修订档案</el-button>
          >修订档案</el-button
        >
        <el-button type="primary" size="small" @click="dialogVisible1 = true"
          style="">添加附件</el-button>
        <el-button type="primary" v-if="isPermission('showDeviceQrCodeButton')" size="small" @click="deviceDialog = true"
          style="">查看设备二维码</el-button>
          >添加附件</el-button
        >
        <el-button
          type="primary"
          v-if="isPermission('showDeviceQrCodeButton')"
          size="small"
          @click="deviceDialog = true"
          >查看设备二维码</el-button
        >
        <el-button type="primary" size="small" @click="handleDownOne"
          style="">导出</el-button>
          >导出</el-button
        >
      </div>
    </div>
    <el-divider></el-divider>
@@ -19,8 +27,12 @@
      <el-row :gutter="20">
        <el-col :span="6">
          <!-- 加时间戳避免浏览器缓存问题 -->
          <el-image :src="`${javaApi}/img/${Mdata.imageUpload}`" fit="fill" :key="'personalPicture' + timeStamp"
            style="width: 200px;height: 300px;border: 1px solid #000;border-radius: 10px;margin-left: 30px;margin-top: 20px;">
          <el-image
            :src="`${javaApi}/img/${Mdata.imageUpload}`"
            fit="fill"
            :key="'personalPicture' + timeStamp"
            style="width: 200px;height: 300px;border: 1px solid #000;border-radius: 10px;margin-left: 30px;margin-top: 20px;"
          >
            <div slot="error" class="image-slot">
              <i class="el-icon-picture-outline" style="font-size: 40px;"></i>
            </div>
@@ -30,11 +42,8 @@
          <div class="form-item">
            <label>设备名称</label>
            <!-- <p>{{ Mdata.deviceName }}</p> -->
            <el-tooltip
              class="item"
              :content="Mdata.deviceName"
            >
              <span class="text-ellipsis" >{{ Mdata.deviceName }}</span>
            <el-tooltip class="item" :content="Mdata.deviceName">
              <span class="text-ellipsis">{{ Mdata.deviceName }}</span>
            </el-tooltip>
          </div>
          <div class="form-item">
@@ -53,16 +62,13 @@
          <div class="form-item">
            <label>生产厂家</label>
            <!-- <p>{{ Mdata.manufacturer }}</p> -->
            <el-tooltip
              class="item"
              :content="Mdata.manufacturer"
            >
              <span class="text-ellipsis" >{{ Mdata.manufacturer }}</span>
            <el-tooltip class="item" :content="Mdata.manufacturer">
              <span class="text-ellipsis">{{ Mdata.manufacturer }}</span>
            </el-tooltip>
          </div>
          <div class="form-item">
            <label>资产编码</label>
              <p class="text-ellipsis">{{ Mdata.assetCode }}</p>
            <p class="text-ellipsis">{{ Mdata.assetCode }}</p>
          </div>
          <div class="form-item">
@@ -70,7 +76,7 @@
            <p>{{ Mdata.acquisitionDate | formaterDateTime }}</p>
          </div>
          <div class="form-item">
            <label>启用日期</label>
            <label>校准有效期</label>
            <p>{{ Mdata.activationDate | formaterDateTime }}</p>
          </div>
          <div class="form-item">
@@ -84,10 +90,7 @@
          </div>
          <div class="form-item">
            <label>准确度量值</label>
            <el-tooltip
              class="item"
              :content="Mdata.technicalIndicators"
            >
            <el-tooltip class="item" :content="Mdata.technicalIndicators">
              <span class="text-ellipsis">{{ Mdata.technicalIndicators }}</span>
            </el-tooltip>
            <!-- <p>{{ Mdata.technicalIndicators }}</p> -->
@@ -100,7 +103,6 @@
            <label>被授权人</label>
            <p>{{ Mdata.authorizedPersonName }}</p>
          </div>
        </el-col>
        <el-col :span="10">
          <div class="form-item">
@@ -116,13 +118,24 @@
            <p>{{ Mdata.factoryNo }}</p>
          </div>
          <div class="form-items">
              <label>设备状态</label>
              <el-radio-group v-model="Mdata.deviceStatus" style="margin-left: 10px;">
              <el-radio :label="0"  :disabled="Mdata.deviceStatus != 0">正常</el-radio>
              <el-radio :label="1"  :disabled="Mdata.deviceStatus != 1">维修</el-radio>
              <el-radio :label="2"  :disabled="Mdata.deviceStatus != 2">停用</el-radio>
              <el-radio :label="3"  :disabled="Mdata.deviceStatus != 3">报废</el-radio>
             </el-radio-group>
            <label>设备状态</label>
            <el-radio-group
              v-model="Mdata.deviceStatus"
              style="margin-left: 10px;"
            >
              <el-radio :label="0" :disabled="Mdata.deviceStatus != 0"
                >正常</el-radio
              >
              <el-radio :label="1" :disabled="Mdata.deviceStatus != 1"
                >维修</el-radio
              >
              <el-radio :label="2" :disabled="Mdata.deviceStatus != 2"
                >停用</el-radio
              >
              <el-radio :label="3" :disabled="Mdata.deviceStatus != 3"
                >报废</el-radio
              >
            </el-radio-group>
          </div>
          <div class="form-item">
            <label>存放点</label>
@@ -140,7 +153,7 @@
              :content="Mdata.insProductItem"
              placement="top"
            >
              <span class="text-ellipsis" >{{ Mdata.insProductItem }}</span>
              <span class="text-ellipsis">{{ Mdata.insProductItem }}</span>
            </el-tooltip>
          </div>
          <div class="form-item">
@@ -149,16 +162,16 @@
          </div>
          <div class="form-item">
            <label>最近溯源日期</label>
            <label>最近校准日期</label>
            <p>{{ Mdata.lastCalibrationDate | formaterDateTime }}</p>
          </div>
          <div class="form-item">
            <label>下次校准日期</label>
            <p>{{ Mdata.nextCalibrationDate | formaterDateTime }}</p>
          </div>
          <div class="form-item">
            <label>采购费用(元)</label>
            <p>{{ Mdata.unitPrice }}</p>
          </div>
          <div class="form-item">
            <label>停用时间</label>
            <p>{{ Mdata.nextCalibrationDate | formaterDateTime }}</p>
          </div>
          <div class="form-item">
            <label>设备负责人</label>
@@ -174,12 +187,27 @@
          </div>
        </el-col>
      </el-row>
      <h4 style="margin-bottom: 10px;margin-top: 10px;"><span class="line"></span><span>附件和相关文档</span></h4>
      <h4 style="margin-bottom: 10px;margin-top: 10px;">
        <span class="line"></span><span>附件和相关文档</span>
      </h4>
      <el-table height="200px" :data="tableDataA">
        <el-table-column header-align="center" align="center" prop="prop" label="序号" type="index" width="60" />
        <el-table-column
          header-align="center"
          align="center"
          prop="prop"
          label="序号"
          type="index"
          width="60"
        />
        <el-table-column prop="documentType" label="类型" min-width="100">
          <template v-slot="scope">
            {{ scope.row.documentType === '0' ? '附件' : scope.row.documentType === '1' ? '文档' : '' }}
            {{
              scope.row.documentType === "0"
                ? "附件"
                : scope.row.documentType === "1"
                ? "文档"
                : ""
            }}
          </template>
        </el-table-column>
        <el-table-column prop="name" label="名称" min-width="150" />
@@ -192,55 +220,110 @@
        <el-table-column prop="comments" label="备注" min-width="150" />
        <el-table-column fixed="right" label="操作" min-width="180">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="handleAttachmentClick(scope.row)">下载附件</el-button>
            <el-button type="text" size="small" @click="handleViewClick(scope.row)">查看</el-button>
            <el-button type="text" size="small" @click="handleDeleteClick(scope.row)">删除</el-button>
            <el-button
              type="text"
              size="small"
              @click="handleAttachmentClick(scope.row)"
              >下载附件</el-button
            >
            <el-button
              type="text"
              size="small"
              @click="handleViewClick(scope.row)"
              >查看</el-button
            >
            <el-button
              type="text"
              size="small"
              @click="handleDeleteClick(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 修订 -->
    <el-dialog title="修订档案" top="5vh" :visible.sync="dialogVisible" width="70%" @open="openFileRevisionDialog"
      :before-close="handleClose">
      <el-row style="display:flex;justify-content: space-around;">
    <el-dialog
      title="档案修订"
      top="5vh"
      :visible.sync="dialogVisible"
      width="70%"
      @open="openFileRevisionDialog"
      :before-close="handleClose"
    >
      <el-row
        style="display:flex;justify-content: space-around;max-height: 75vh;overflow-y: auto;"
      >
        <!-- 左边布局 -->
        <el-col :span="7">
          <el-col>
            <!-- 图片 -->
            <el-image class="img" style="width:100%;height: 320px;margin-bottom:16px"
              :src="javaApi + '/img/' + editData.imageUpload">
              <div slot="error" class="image-error" style="width: calc(100% -2px);
            <el-image
              class="img"
              style="width:100%;height: 320px;margin-bottom:16px"
              :src="javaApi + '/img/' + editData.imageUpload"
            >
              <div
                slot="error"
                class="image-error"
                style="width: calc(100% - 2px);
            height: 318px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #EEEEEE;">
                <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i>
            border: 1px solid #EEEEEE;"
              >
                <i
                  class="el-icon-picture-outline"
                  style="font-size:60px;color:#666666;"
                ></i>
              </div>
            </el-image>
            <!-- 表单 -->
            <el-form :model="editData" label-width="120px" ref="rules1" :rules="rules1">
            <el-form
              :model="editData"
              label-width="120px"
              ref="rules1"
              :rules="rules1"
            >
              <el-form-item label="仪器名称:" prop="deviceName">
                <el-input v-model="editData.deviceName" size="small"></el-input>
              </el-form-item>
              <el-form-item label="仪器名称EN:" prop="enDeviceName">
                <el-input v-model="editData.enDeviceName" size="small"></el-input>
                <el-input
                  v-model="editData.enDeviceName"
                  size="small"
                ></el-input>
              </el-form-item>
              <el-form-item label="规格型号:" prop="specificationModel">
                <el-input v-model="editData.specificationModel" size="small"></el-input>
                <el-input
                  v-model="editData.specificationModel"
                  size="small"
                ></el-input>
              </el-form-item>
              <el-form-item label="生产厂家:">
                <el-input v-model="editData.manufacturer" size="small"></el-input>
                <el-input
                  v-model="editData.manufacturer"
                  size="small"
                ></el-input>
              </el-form-item>
            </el-form>
          </el-col>
        </el-col>
        <!-- 中间布局 -->
        <el-col :span="7">
          <el-form :model="editData" label-width="116px" ref="rules2" :rules="rules1">
          <el-form
            :model="editData"
            label-width="116px"
            ref="rules2"
            :rules="rules1"
          >
            <el-form-item label="校准服务机构:">
              <el-input v-model="editData.calibrationServices" disabled size="small"></el-input>
              <el-input
                v-model="editData.calibrationServices"
                size="small"
              ></el-input>
            </el-form-item>
            <el-form-item label="资产编码:">
              <el-input v-model="editData.assetCode" size="small"></el-input>
@@ -252,21 +335,48 @@
              <el-input v-model="editData.factoryNo" size="small"></el-input>
            </el-form-item>
            <el-form-item label="管理编号:" prop="managementNumber">
              <el-input v-model="editData.managementNumber" size="small"></el-input>
              <el-input
                v-model="editData.managementNumber"
                size="small"
              ></el-input>
            </el-form-item>
            <el-form-item label="购置日期:">
              <el-date-picker style="width:100%" v-model="editData.acquisitionDate" type="date" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期">
              <el-date-picker
                style="width:100%"
                v-model="editData.acquisitionDate"
                type="date"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                size="small"
                placeholder="选择日期"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="启用日期:" prop="activationDate">
              <el-date-picker style="width:100%" v-model="editData.activationDate" type="date" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期">
            <el-form-item label="校准有效期:" prop="activationDate">
              <el-date-picker
                style="width:100%"
                v-model="editData.activationDate"
                type="date"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                size="small"
                placeholder="选择日期"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="负责人:">
              <el-select v-model="editData.equipmentManager" placeholder="请选择" size="small" style="width:100%">
                <el-option v-for="item in responsiblePersonList" :key="item.name" :label="item.name" :value="item.id">
              <el-select
                v-model="editData.equipmentManager"
                placeholder="请选择"
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="item in responsiblePersonList"
                  :key="item.name"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
@@ -274,39 +384,92 @@
              <el-input v-model="editData.storagePoint" size="small"></el-input>
            </el-form-item>
            <el-form-item label="技术指标:">
              <el-input v-model="editData.technicalIndicators" :rows="7" type="textarea" size="small"></el-input>
              <el-input
                v-model="editData.technicalIndicators"
                :rows="7"
                type="textarea"
                size="small"
              ></el-input>
            </el-form-item>
          </el-form>
        </el-col>
        <!-- 右边布局 -->
        <el-col :span="7">
          <el-form :model="editData" label-width="140px" ref="ruleForm" :rules="rules1">
          <el-form
            :model="editData"
            label-width="140px"
            ref="ruleForm"
            :rules="rules1"
          >
            <!-- 实验室列表 -->
            <el-form-item label="所属部门:">
              <el-select v-model="editData.subordinateDepartmentsId" placeholder="请选择" size="small" style="width:100%">
                <el-option v-for="item in subordinateDepartmentsList" :key="item.value" :label="item.label"
                  :value="item.value">
              <el-select
                v-model="editData.subordinateDepartmentsId"
                placeholder="请选择"
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="item in subordinateDepartmentsList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="检测项目:">
              <el-cascader v-model="editData.insProductIds" :options="options" :show-all-levels="false" :props="props"
                placeholder="请选择" size="small" style="width:100%;" :collapse-tags="true" separator="," filterable
                clearable></el-cascader>
              <el-cascader
                v-model="editData.insProductIds"
                :options="options"
                :show-all-levels="false"
                :props="props"
                placeholder="请选择"
                size="small"
                style="width:100%;"
                :collapse-tags="true"
                separator=","
                filterable
                clearable
              ></el-cascader>
            </el-form-item>
            <!-- <el-form-item label="最近校准日期:">
              <el-date-picker style="width:100%" v-model="Mdata.latestTraceability" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" type="date" size="small" placeholder="选择日期">
            <el-form-item label="最近校准日期:">
              <el-date-picker
                style="width:100%"
                v-model="editData.lastCalibrationDate"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                size="small"
                placeholder="选择日期"
              >
              </el-date-picker>
            </el-form-item> -->
            <!-- <el-form-item label="下次校准日期:">
              <el-date-picker style="width:100%" v-model="Mdata.nextCalibrationDate" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss" type="date" size="small" placeholder="选择日期">
            </el-form-item>
            <el-form-item label="下次校准日期:">
              <el-date-picker
                style="width:100%"
                v-model="editData.nextCalibrationDate"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                size="small"
                placeholder="选择日期"
              >
              </el-date-picker>
            </el-form-item> -->
            </el-form-item>
            <el-form-item label="设备类型:">
              <el-select v-model="editData.largeCategory" placeholder="请选择" size="small" style="width:100%">
                <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value">
              <el-select
                v-model="editData.largeCategory"
                placeholder="请选择"
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="item in equipmentList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
@@ -314,17 +477,41 @@
              <el-input v-model="editData.unitPrice" size="small"></el-input>
            </el-form-item>
            <el-form-item label="当前状态:" prop="deviceStatus">
              <el-select v-model="editData.deviceStatus" placeholder="请选择" size="small" style="width:100%">
                <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value">
              <el-select
                v-model="editData.deviceStatus"
                placeholder="请选择"
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="item in deviceStatusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="校准周期(月):" prop="calibrationDate">
              <el-input v-model="editData.calibrationDate" size="small"></el-input>
              <el-input
                v-model="editData.calibrationDate"
                size="small"
              ></el-input>
            </el-form-item>
            <el-form-item label="被授权人:">
              <el-select v-model="editData.authorizedPerson" multiple  placeholder="请选择" size="small" style="width:100%">
                <el-option v-for="item in responsiblePersonList" :key="item.name" :label="item.name" :value="item.id">
              <el-select
                v-model="editData.authorizedPerson"
                multiple
                placeholder="请选择"
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="item in responsiblePersonList"
                  :key="item.name"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
@@ -340,12 +527,25 @@
              </div> -->
              <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"
                  :on-error="onError" ref='upload' class="avatar-uploader"
                  >
                  <img v-if="editData.imageUpload" :src="javaApi + '/img/' + editData.imageUpload" class="avatar">
                <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"
                  :on-error="onError"
                  ref="upload"
                  class="avatar-uploader"
                >
                  <img
                    v-if="editData.imageUpload"
                    :src="javaApi + '/img/' + editData.imageUpload"
                    class="avatar"
                  />
                  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
              </div>
@@ -356,11 +556,19 @@
      <span slot="footer" class="dialog-footer">
        <el-row>
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="submitForm" :loading="upLoad">确 定</el-button>
          <el-button type="primary" @click="submitForm" :loading="upLoad"
            >确 定</el-button
          >
        </el-row>
      </span>
    </el-dialog>
    <el-dialog title="添加设备附件" top="5vh" v-if="dialogVisible1" :visible.sync="dialogVisible1" width="40%">
    <el-dialog
      title="添加设备附件"
      top="5vh"
      v-if="dialogVisible1"
      :visible.sync="dialogVisible1"
      width="40%"
    >
      <el-form ref="form" :model="addFile" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="12">
@@ -373,52 +581,107 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="档案名称:">
              <el-input size="small" placeholder="请输入" clearable v-model="addFile.name"></el-input>
              <el-input
                size="small"
                placeholder="请输入"
                clearable
                v-model="addFile.name"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="库号/资产编号:">
              <el-input size="small" placeholder="请输入" clearable v-model="addFile.number"></el-input>
              <el-input
                size="small"
                placeholder="请输入"
                clearable
                v-model="addFile.number"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="版本:">
              <el-input size="small" placeholder="请输入" clearable v-model="addFile.version"></el-input>
              <el-input
                size="small"
                placeholder="请输入"
                clearable
                v-model="addFile.version"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="份数:">
              <el-input-number v-model="addFile.quantity" controls-position="right" style="width: 100%;" size="small"
                :min="0" :max="10"></el-input-number>
              <el-input-number
                v-model="addFile.quantity"
                controls-position="right"
                style="width: 100%;"
                size="small"
                :min="0"
                :max="10"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="页码:">
              <el-input-number v-model="addFile.pageCount" controls-position="right" style="width: 100%;" size="small"
                :min="0" :max="10"></el-input-number>
              <el-input-number
                v-model="addFile.pageCount"
                controls-position="right"
                style="width: 100%;"
                size="small"
                :min="0"
                :max="10"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="提供者:">
              <el-input size="small" placeholder="请输入" clearable v-model="addFile.provider"></el-input>
              <el-input
                size="small"
                placeholder="请输入"
                clearable
                v-model="addFile.provider"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="归档日期:">
              <el-date-picker type="date" style="width:100%" placeholder="请选择日期" size="small" v-model="addFile.archiveDate"
                format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
              <el-date-picker
                type="date"
                style="width:100%"
                placeholder="请选择日期"
                size="small"
                v-model="addFile.archiveDate"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注:">
              <el-input type="textarea" :rows="2" size="small" v-model="addFile.comments"></el-input>
              <el-input
                type="textarea"
                :rows="2"
                size="small"
                v-model="addFile.comments"
              ></el-input>
            </el-form-item>
          </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"
                :on-remove="handleRemove" :on-success="onSuccess" :before-remove="beforeRemove" multiple :limit="1"
                :on-exceed="handleExceed" :file-list="fileList">
              <el-upload
                class="upload-demo"
                :action="action"
                :headers="headers"
                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>
              </el-upload>
            </el-form-item>
@@ -427,36 +690,56 @@
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-row>
          <el-button @click="dialogVisible1 = false" size="small">取 消</el-button>
          <el-button type="primary" @click="saveRecord" size="small" :loading="isLoading">{{ isAddFileUpdate == true ?
            '更新' :
            '确 定' }}</el-button>
          <el-button @click="dialogVisible1 = false" size="small"
            >取 消</el-button
          >
          <el-button
            type="primary"
            @click="saveRecord"
            size="small"
            :loading="isLoading"
            >{{ isAddFileUpdate == true ? "更新" : "确 定" }}</el-button
          >
        </el-row>
      </span>
    </el-dialog>
    <el-dialog
      title="设备二维码"
      :visible.sync="deviceDialog"
       top="5vh"
      width="30%">
      top="5vh"
      width="30%"
    >
      <div style="width:90%;text-align: right;">
        <el-button type="primary" size="mini" @click="clickGeneratePicture">下载图片</el-button>
        <el-button type="primary" size="mini" @click="labelPrint">标签打印</el-button>
        <el-button type="primary" size="mini" @click="clickGeneratePicture"
          >下载图片</el-button
        >
        <el-button type="primary" size="mini" @click="labelPrint"
          >标签打印</el-button
        >
      </div>
      <div class="device-main" ref="deviceQrCode" id="deviceCode">
        <div class="device-center" >
          <p class="device-title">{{Mdata.deviceName}}</p>
        <div class="device-center">
          <p class="device-title">{{ Mdata.deviceName }}</p>
          <div class="device-footer">
            <div>
                <vueQr class="qr-code" :text="'https://zttx-lims.ztt.cn:8021/lims/qr/qrScan?code='+Mdata.managementNumber+'&type=device'" :size="200" :margin="10"></vueQr>
              <vueQr
                class="qr-code"
                :text="
                  'https://zttx-lims.ztt.cn:8021/lims/qr/qrScan?code=' +
                    Mdata.managementNumber +
                    '&type=device'
                "
                :size="200"
                :margin="10"
              ></vueQr>
            </div>
            <div class="device-number">
              <span class="device-text">设备编码:</span>
              <span class="device-text">{{Mdata.managementNumber}}</span>
              <span class="device-text">{{ Mdata.managementNumber }}</span>
            </div>
            <div class="device-name">
              <span class="device-text">设备型号:</span>
              <span class="device-text">{{Mdata.specificationModel}}</span>
              <span class="device-text">{{ Mdata.specificationModel }}</span>
            </div>
          </div>
        </div>
@@ -466,20 +749,20 @@
</template>
<script>
import { MessageBox } from 'element-ui'
import ValueTable from '../../tool/value-table.vue'
import fileDownload from '../../../util/file'
import vueQr from 'vue-qr'
import PrintJS from 'print-js'
import domtoimage from 'dom-to-image';
import {isPermission} from '../../../util/auth'
import { MessageBox } from "element-ui";
import ValueTable from "../../tool/value-table.vue";
import fileDownload from "../../../util/file";
import vueQr from "vue-qr";
import PrintJS from "print-js";
import domtoimage from "dom-to-image";
import { isPermission } from "../../../util/auth";
export default {
  filters:{
    formaterDateTime(dateTime){
      if(dateTime === undefined || dateTime === null || dateTime === ''){
        return dateTime
  filters: {
    formaterDateTime(dateTime) {
      if (dateTime === undefined || dateTime === null || dateTime === "") {
        return dateTime;
      }
      return dateTime.split(" ")[0]
      return dateTime.split(" ")[0];
    }
  },
  props: {
@@ -496,40 +779,40 @@
  },
  data() {
    return {
      isPermission:isPermission,
      deviceDialog: false,//查看设备二维码弹框
      isPermission: isPermission,
      deviceDialog: false, //查看设备二维码弹框
      rules1: {
        deviceName: [
            { required: true, message: '请输入仪器名称', trigger: 'blur' },
          ],
          enDeviceName: [
            { required: true, message: '请输入仪器名称EN', trigger: 'blur' },
          ],
          specificationModel: [
            { required: true, message: '请输入规格型号', trigger: 'blur' },
          ],
          managementNumber: [
            { required: true, message: '请输入管理编号', trigger: 'blur' },
          ],
          activationDate: [
            { required: true, message: '请输入启用日期', trigger: 'blur' },
          ],
          deviceStatus: [
            { required: true, message: '请输入当前状态', trigger: 'blur' },
          ],
          calibrationDate: [
            { required: true, message: '请输入校准周期(月)', trigger: 'blur' },
          ],
          { required: true, message: "请输入仪器名称", trigger: "blur" }
        ],
        enDeviceName: [
          { required: true, message: "请输入仪器名称EN", trigger: "blur" }
        ],
        specificationModel: [
          { required: true, message: "请输入规格型号", trigger: "blur" }
        ],
        managementNumber: [
          { required: true, message: "请输入管理编号", trigger: "blur" }
        ],
        activationDate: [
          { required: true, message: "请输入校准有效期", trigger: "blur" }
        ],
        deviceStatus: [
          { required: true, message: "请输入当前状态", trigger: "blur" }
        ],
        calibrationDate: [
          { required: true, message: "请输入校准周期(月)", trigger: "blur" }
        ]
      },
      // dateForm: {
      // },
      fileList: [], // 添加附件上传文件列表
      timeStamp: '', // 给图片添加key,在每次加载页面的时候新建时间戳
      timeStamp: "", // 给图片添加key,在每次加载页面的时候新建时间戳
      equipmentManager: [],
      formLabelWidth: '100px',
      formLabelWidth: "100px",
      dialogVisible1: false,
      recordNumber: '',
      recordNumber: "",
      inLoading: false, // 控制上传按钮加载状态
      isLoading: false, // 控制确定按钮加载状态
      formData: {},
@@ -537,17 +820,17 @@
      num: 1,
      //添加附件数据收集
      addFile: {
        documentType: '', // 维护类型
        documentType: "", // 维护类型
        archiveDate: null, // 归档日期
        name: '', // 档案名称
        number: '', // 库号/资产编号
        version: '', // 版本
        name: "", // 档案名称
        number: "", // 库号/资产编号
        version: "", // 版本
        quantity: 1, // 份数
        pageCount: 1, // 页码
        provider: '', // 提供者
        provider: "", // 提供者
        comments: "", // 备注
        fileName: "", // 文件原名称
        systemFileName: "", // 系统生成名称
        systemFileName: "" // 系统生成名称
      },
      componentData: {
        entity: { name: "", orderBy: { field: "id", order: "asc" } },
@@ -555,361 +838,397 @@
      },
      upIndex: 0,
      dialogVisible: false,
      dialogVisible1: false,
      inLoading: false,
      upLoad: false,
      responsiblePersonList: [],
      subordinateDepartmentsList: [],
      options: [],
      equipmentList: [],
      deviceStatusList: [],
      props: { multiple: true, emitPath: false, value: 'id', label: 'name' },
      props: { multiple: true, emitPath: false, value: "id", label: "name" },
      // 收集设备档案数据
      Mdata: {
        deviceName: null
      },
      isAddFileUpdate: false,
      editData: {
        authorizedPerson: [],
      },
    }
        authorizedPerson: []
      }
    };
  },
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
        token: sessionStorage.getItem("token")
      };
    },
    action() {
      return this.javaApi + this.$api.deviceScope.uploadFile
      return this.javaApi + this.$api.deviceScope.uploadFile;
    }
  },
  mounted() {
    // 收集数据
    this.getList(this.clickNodeVal.value)
    this.getList(this.clickNodeVal.value);
    // 获取相关文档的数据
    this.getPage()
    this.timeStamp = Date.now()
    this.getPage();
    this.timeStamp = Date.now();
  },
  methods: {
      /**
    /**
     * 将页面指定节点内容转为图片
     * 1.拿到想要转换为图片的内容节点DOM;
     * 2.转换,拿到转换后的canvas
     * 3.转换为图片
     */
     clickGeneratePicture() {
      const _than = this
      domtoimage.toPng(_than.$refs.deviceQrCode,{ quality: 1,width:440,}).then(function (dataUrl) {
        // 将转换后的图像数据存储为 data URL
        fileDownload.downloadIamge(dataUrl,_than.Mdata.deviceName)
      });
    clickGeneratePicture() {
      const _than = this;
      domtoimage
        .toPng(_than.$refs.deviceQrCode, { quality: 1, width: 440 })
        .then(function(dataUrl) {
          // 将转换后的图像数据存储为 data URL
          fileDownload.downloadIamge(dataUrl, _than.Mdata.deviceName);
        });
    },
    //打印设备二维码
    labelPrint(){
    labelPrint() {
      PrintJS({
            printable: 'deviceCode',//页面
            type: "html",//文档类型
            maxWidth:360,
            css: ['/static/css/device-print.css'],
            style: '@page { size: auto;  margin: 0mm;}',
            targetStyles: ["*"], // 使用dom的所有样式,很重要
        });
        printable: "deviceCode", //页面
        type: "html", //文档类型
        maxWidth: 360,
        css: ["/static/css/device-print.css"],
        style: "@page { size: auto;  margin: 0mm;}",
        targetStyles: ["*"] // 使用dom的所有样式,很重要
      });
    },
    openFileRevisionDialog() {
      // 获取档案修订负责人下拉框数据
      this.selectDevicePrincipal()
      this.selectDevicePrincipal();
      // 获取档案修订所属部门下拉框数据
      this.obtainItemParameterList()
      this.obtainItemParameterList();
      // 获取档案修订设备状态下拉框数据
      this.selectEnumByCategory()
      this.selectEnumByCategory();
      // 获取档案修订检验项目级联弹框数据
      this.getInsProductIds()
      this.getInsProductIds();
    },
    //附件和相关文档事件
    handleAttachmentClick(row) {
      console.log(row)
      if (row.fileName && row.documentType == 0) {
        const fileUrl = this.javaApi + '/img/' + row.fileName;
        fileDownload.downloadIamge(fileUrl, row.systemFileName)
      } else if (row.fileName && row.documentType == 1) {
        const url = this.javaApi+'/word/'+ row.fileName
        const link = document.createElement('a');
        link.href = url;
        link.download = row.fileName;
        link.click();
        this.$message.success('下载成功')
      console.log(row);
      if (row.fileName) {
        let state = /\.(jpg|jpeg|png|gif)$/i.test(row.fileName);
        if (state) {
          let url = this.javaApi + "/img/" + row.fileName;
          fileDownload.downloadIamge(url, row.fileName);
        } else {
          const url = this.javaApi + "/word/" + row.fileName;
          const link = document.createElement("a");
          link.href = url;
          link.download = row.fileName;
          link.click();
          this.$message.success("下载成功");
        }
      } else {
        this.$message.warning('未上传文件!')
        this.$message.warning("未上传文件!");
      }
    },
    handleViewClick(row) {
      this.isAddFileUpdate = true
      this.addFile = { ...row }
      this.dialogVisible1 = true
      this.isAddFileUpdate = true;
      this.addFile = { ...row };
      this.dialogVisible1 = true;
      if (row.fileName) {
        const obj = Object.assign({
          name: row.fileName,
          url: row.fileName,
          status: 'success',
          uid: Date.now(),
        })
        this.fileList.push(obj)
          status: "success",
          uid: Date.now()
        });
        this.fileList.push(obj);
      }
    },
    handleDeleteClick(row) {
      // 删除逻辑
      MessageBox.confirm('确定要删除该记录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        this.$axios.delete(this.$api.getDocuments.list + "/" + row.id).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功')
            this.getPage()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      MessageBox.confirm("确定要删除该记录吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .delete(this.$api.getDocuments.list + "/" + row.id)
            .then(res => {
              if (res.code == 200) {
                this.$message.success("删除成功");
                this.getPage();
              }
            });
        })
        .catch(() => {
          this.$message.info("已取消删除");
        });
    },
    saveRecord() {
      //转换数据
      this.addFile.deviceId = this.clickNodeVal.value
      let obj= this.addFile.systemFileName
      this.addFile.systemFileName = obj.name
      this.addFile.fileName = obj.url
      this.addFile.deviceId = this.clickNodeVal.value;
      let obj = this.addFile.systemFileName;
      this.addFile.systemFileName = obj.name;
      this.addFile.fileName = obj.url;
      // 更新
      if (this.isAddFileUpdate) {
        this.$axios.put(this.$api.getDocuments.updateDocument, this.addFile, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          if (res.code == 200) {
            this.$message.success('更新成功')
            this.dialogVisible1 = false;
            this.getPage()
          }
        })
        this.$axios
          .put(this.$api.getDocuments.updateDocument, this.addFile, {
            headers: {
              "Content-Type": "application/json"
            }
          })
          .then(res => {
            if (res.code == 200) {
              this.$message.success("更新成功");
              this.dialogVisible1 = false;
              this.getPage();
            }
          });
      } else {
        // 新增
        this.$axios.post(this.$api.getDocuments.list, this.addFile).then(res => {
          if (res.code == 200) {
            this.$message.success('保存成功')
            this.dialogVisible1 = false;
            this.getPage()
          }
        })
        this.$axios
          .post(this.$api.getDocuments.list, this.addFile)
          .then(res => {
            if (res.code == 200) {
              this.$message.success("保存成功");
              this.dialogVisible1 = false;
              this.getPage();
            }
          });
      }
    },
    onSuccess(response, file, fileList) {
      if (response.code == 200) {
        this.addFile.systemFileName = response.data
        this.addFile.fileName = file.name
        this.addFile.systemFileName = response.data;
        this.addFile.fileName = file.name;
      } else {
        this.$refs.uploadFile.clearFiles()
        this.$message.error('上传失败:' + response.message)
        this.$refs.uploadFile.clearFiles();
        this.$message.error("上传失败:" + response.message);
      }
    },
    handleRemove(file, fileList) {
      this.deleteFile(this.addFile.systemFileName)
      this.deleteFile(this.addFile.systemFileName);
    },
    deleteFile(fileName) {
      this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + fileName).then(res => {
        this.$message.success('删除成功!')
      })
      this.$axios
        .delete(this.$api.personnel.deleteCNASFile + "?fileName=" + fileName)
        .then(res => {
          this.$message.success("删除成功!");
        });
    },
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
      this.$message.warning(
        `当前限制选择 1 个文件,本次选择了 ${
          files.length
        } 个文件,共选择了 ${files.length + fileList.length} 个文件`
      );
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}?`);
    },
    // 获取相关文档数据的api
    getPage() {
      this.$axios.get(this.$api.getDocuments.get + "/" + this.clickNodeVal.value).then(res => {
        if (res.code == 200)
          this.tableDataA = res.data
      })
      this.$axios
        .get(this.$api.getDocuments.get + "/" + this.clickNodeVal.value)
        .then(res => {
          if (res.code == 200) this.tableDataA = res.data;
        });
    },
    // 收集数据
    getList(id) {
      this.$axios
        .get(
          this.$api.deviceScope.selectDeviceByCode + "?id=" + id)
        .get(this.$api.deviceScope.selectDeviceByCode + "?id=" + id)
        .then(res => {
          // 将分类列表的信息存起来
          if (res.code == 200) {
            this.Mdata = res.data;
            this.Mdata.insProductIds = this.Mdata.insProductIds.split(',')
            this.Mdata.authorizedPerson = JSON.parse(this.Mdata.authorizedPerson)
            this.Mdata.insProductIds = this.Mdata.insProductIds.split(",");
            if (this.Mdata.authorizedPerson) {
              this.Mdata.authorizedPerson = JSON.parse(
                this.Mdata.authorizedPerson
              );
            }
          }
        });
    },
    handleData(m) {
      if (m) {
        return m
        return m;
      } else {
        return '-'
        return "-";
      }
    },
    handleClose() {
      this.dialogVisible = false
      this.dialogVisible = false;
    },
    //打开修订档案弹框
    openEditForm(){
      this.editData = JSON.parse(JSON.stringify(this.Mdata))
      this.$nextTick(()=>{
        this.dialogVisible = true
      })
    openEditForm() {
      this.editData = JSON.parse(JSON.stringify(this.Mdata));
      this.$nextTick(() => {
        this.dialogVisible = true;
      });
    },
    //修订档案
    submitForm() {
      let flag = true
      this.$refs['rules1'].validate((valid) => {
      let flag = true;
      this.$refs["rules1"].validate(valid => {
        if (!valid) {
          flag = false;
          return false;
        }
      });
      this.$refs['rules2'].validate((valid) => {
      this.$refs["rules2"].validate(valid => {
        if (!valid) {
          flag = false;
          return false;
        }
      });
      this.$refs['ruleForm'].validate((valid) => {
      this.$refs["ruleForm"].validate(valid => {
        if (!valid) {
          flag = false;
          return false;
        }
      });
      if(!flag) {
      if (!flag) {
        return;
      }
      delete this.editData.nextCalibrationDate
      delete this.editData.createTime
      delete this.editData.updateTime
      delete this.editData.createUser
      delete this.editData.updateUser
      delete this.editData.orderBy
      // this.Mdata.equipmentManager = 1;
      this.editData.userAllow = this.equipmentManager.toString();
      this.editData.insProductIds = Array.isArray(this.editData.insProductIds)
        ? this.editData.insProductIds.join(',')
        : '';
      delete this.editData.createTime;
      delete this.editData.updateTime;
      delete this.editData.createUser;
      delete this.editData.updateUser;
      delete this.editData.orderBy;
      const formData = this.HaveJson(this.editData);
      formData.userAllow = this.equipmentManager.toString();
      formData.insProductIds = Array.isArray(formData.insProductIds)
        ? formData.insProductIds.join(",")
        : "";
      if (formData.authorizedPerson.length === 0) {
        formData.authorizedPerson = "";
      } else {
        formData.authorizedPerson = JSON.stringify(formData.authorizedPerson);
      }
      this.upLoad = true;
      this.editData.authorizedPerson = JSON.stringify(this.editData.authorizedPerson)
      this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.editData, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        if (res.code === 201) {
          this.upLoad = false
          return
        }
        this.$message.success('修改成功')
        this.upLoad = false
        this.getList(this.clickNodeVal.value)
        this.dialogVisible = false
      }).catch(e => {
        this.$message.error('修改失败')
        this.dialogVisible = false
        this.upLoad = false
      })
      this.$axios
        .post(this.$api.deviceScope.upDeviceParameter, formData, {
          headers: {
            "Content-Type": "application/json"
          }
        })
        .then(res => {
          if (res.code === 201) {
            this.upLoad = false;
            return;
          }
          this.$message.success("修改成功");
          this.upLoad = false;
          this.getList(this.clickNodeVal.value);
          this.dialogVisible = false;
        })
        .catch(e => {
          this.$message.error("修改失败");
          this.dialogVisible = false;
          this.upLoad = false;
        });
    },
    // 导出
    handleDownOne(row) {
      this.outLoading = true
      this.$axios.get(this.$api.deviceCheck.exportDeviceFile + '?deviceId=' + this.clickNodeVal.value, {
        responseType: "blob"
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '设备档案卡.doc';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '设备档案卡.doc';
            link.click();
            this.$message.success('导出成功')
      this.outLoading = true;
      this.$axios
        .get(
          this.$api.deviceCheck.exportDeviceFile +
            "?deviceId=" +
            this.clickNodeVal.value,
          {
            responseType: "blob"
          }
        }
      })
        )
        .then(res => {
          this.outLoading = false;
          const blob = new Blob([res], { type: "application/octet-stream" });
          //将Blob 对象转换成字符串
          let reader = new FileReader();
          reader.readAsText(blob, "utf-8");
          reader.onload = () => {
            try {
              let result = JSON.parse(reader.result);
              if (result.message) {
                this.$message.error(result.message);
              } else {
                const url = URL.createObjectURL(blob);
                const link = document.createElement("a");
                link.href = url;
                link.download = "设备档案卡.doc";
                link.click();
                this.$message.success("导出成功");
              }
            } catch (err) {
              console.log(err);
              const url = URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.href = url;
              link.download = "设备档案卡.doc";
              link.click();
              this.$message.success("导出成功");
            }
          };
        });
    },
    handleSuccessUpImg2(response) {
      if (response.code == 200) {
        this.$nextTick(() => {
          this.editData.imageUpload = response.data.url;
          this.editData.imageName = response.data.name;
          console.log(this.javaApi + 'img/' + this.editData.imageUpload);
        })
          console.log(this.javaApi + "img/" + this.editData.imageUpload);
        });
      }
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');
        this.$refs.upload.clearFiles()
        this.$message.error("上传文件不超过10M");
        this.$refs.upload.clearFiles();
        return false;
      } else {
        return true;
      }
    },
    onError(err, file, fileList) {
      this.$message.error('上传失败')
      this.$refs.upload.clearFiles()
      this.$message.error("上传失败");
      this.$refs.upload.clearFiles();
    },
    // 获取负责人列表
    selectDevicePrincipal() {
      this.$axios.post(this.$api.user.selectUserList, this.componentData, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        this.responsiblePersonList = res.data.body.records;
      })
      this.$axios
        .post(this.$api.user.selectUserList, this.componentData, {
          headers: {
            "Content-Type": "application/json"
          }
        })
        .then(res => {
          this.responsiblePersonList = res.data.body.records;
        });
    },
    obtainItemParameterList() {
      this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
            label: a.laboratoryName,
            value: a.id
          })
        })
        this.subordinateDepartmentsList = data
      })
      this.$axios
        .get(this.$api.laboratoryScope.obtainItemParameterList)
        .then(res => {
          let data = [];
          res.data.forEach(a => {
            data.push({
              label: a.laboratoryName,
              value: a.id
            });
          });
          this.subordinateDepartmentsList = data;
        });
    },
    getInsProductIds() {
      this.$axios.post(this.$api.capacityScope.getInsProduction).then(res => {
        this.options = res.data.map((m, i) => {
          m.id = m.name;
          return m
        })
          return m;
        });
        this.options.forEach(item => {
          if (item.children.length == 0) {
            item.children = null;
@@ -922,49 +1241,53 @@
                  if (n.children && n.children.length == 0) {
                    n.children = null;
                  }
                })
                });
              }
            })
            });
          }
        })
      })
        });
      });
    },
    // 获取字典
    selectEnumByCategory() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "设备状态"
      }).then(res => {
        this.deviceStatusList = res.data
        this.deviceStatusList.forEach(a => {
          if (!isNaN(a.value)) {
            a.value = parseInt(a.value)
          }
      this.$axios
        .post(this.$api.enums.selectEnumByCategory, {
          category: "设备状态"
        })
      })
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "设备分类"
      }).then(res => {
        this.equipmentList = res.data
      })
    },
        .then(res => {
          this.deviceStatusList = res.data;
          this.deviceStatusList.forEach(a => {
            if (!isNaN(a.value)) {
              a.value = parseInt(a.value);
            }
          });
        });
      this.$axios
        .post(this.$api.enums.selectEnumByCategory, {
          category: "设备分类"
        })
        .then(res => {
          this.equipmentList = res.data;
        });
    }
  },
  watch: {
    // 监听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal.value) {
        this.getList(newVal.value)
        this.getPage()
        this.getList(newVal.value);
        this.getPage();
      }
    },
    dialogVisible1(newVal) {
      if (newVal == false) {
        this.isAddFileUpdate = false
        this.addFile = {}
        this.fileList = []
        this.isAddFileUpdate = false;
        this.addFile = {};
        this.fileList = [];
      }
    }
  }
}
};
</script>
<style scoped>
@@ -994,7 +1317,7 @@
  display: inline-block;
  width: 3px;
  height: 16px;
  background: #3A7BFA;
  background: #3a7bfa;
  margin-right: 4px;
}
@@ -1022,21 +1345,20 @@
.text-ellipsis {
  display: inline-block;
  width: 200px;                    /* 或者您可以设置一个具体的宽度值 */
  box-sizing: border-box;         /* 确保padding和border不影响元素的总宽度 */
  white-space: nowrap;            /* 禁止文本换行 */
  text-overflow: ellipsis;        /* 使用省略号表示被截断的文本 */
  overflow: hidden;               /* 隐藏超出容器的内容 */
  width: 200px; /* 或者您可以设置一个具体的宽度值 */
  box-sizing: border-box; /* 确保padding和border不影响元素的总宽度 */
  white-space: nowrap; /* 禁止文本换行 */
  text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
  overflow: hidden; /* 隐藏超出容器的内容 */
}
.form-items {
  line-height: 34px;
   /* display: flex; */
  /* display: flex; */
  /* align-items: center;  */
  margin-left: 15%;
  font-size: 14px;
}
.form-item label {
  min-width: 130px;
@@ -1080,98 +1402,98 @@
}
.avatar-uploader .el-upload {
    border: 1px dashed #190505;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
  border: 1px dashed #190505;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.device-main{
  width:90%;
  margin:0px 5%;
  height:460px;
  padding:25px 0px;
.device-main {
  width: 90%;
  margin: 0px 5%;
  height: 460px;
  padding: 25px 0px;
  background-color: #fff;
}
.device-center{
  width:90%;
  height:460px;
  margin:0px 5%;
.device-center {
  width: 90%;
  height: 460px;
  margin: 0px 5%;
  border-radius: 15px;
  background-color: #fff;
  overflow: hidden;
  /* box-shadow: 3px 3px 8px 0 rgba(0, 0, 0, 0.3); */
  filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.3))
  filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.3));
}
.device-title{
.device-title {
  position: relative;
  top:20px;
  top: 20px;
  z-index: 2;
  font-size: clamp(1rem, 0.582rem + 1.59vw, 1.475rem);
  font-weight: bold;
  color: #4f6ab2;
  width: 100%;
  height:90px;
  height: 90px;
  line-height: 100px;
  text-align: center;
}
.device-footer{
  width:100%;
  height:420px;
.device-footer {
  width: 100%;
  height: 420px;
  background-color: #3361d0;
  position: relative
  position: relative;
}
.device-footer::after{
.device-footer::after {
  content: "";
  width: 100%;
    height: 70px;
    position: absolute;
  top:-30px;
  height: 70px;
  position: absolute;
  top: -30px;
  border-radius: 0 0 50% 50%;
  background-color: #fff;
}
.device-footer .qr-code{
.device-footer .qr-code {
  width: 55%;
  height: 200px;
  position: relative;
  top: 60px;
  left:22.5%;
  left: 22.5%;
  background-color: #fff;
  border-radius: 15px;
  overflow: hidden;
}
.device-number{
  width:80%;
.device-number {
  width: 80%;
  height: 20px;
  margin-left:20%;
  margin-left: 20%;
  position: relative;
  top: 80px;
}
.device-text{
  color:#fff;
.device-text {
  color: #fff;
  font-weight: bold;
  font-size:100%;
  font-size: 100%;
}
.device-name{
  width:80%;
  margin-left:20%;
.device-name {
  width: 80%;
  margin-left: 20%;
  height: 20px;
  position: relative;
  top: 90px;
src/components/do/a6-device/operation-instruction.vue
@@ -7,46 +7,125 @@
          <p style="line-height: 30px;">作业指导书</p>
        </el-col>
        <el-col :span="12" style="text-align: right;">
          <el-button size="small" type="primary" @click="getList">刷新</el-button>
          <el-button size="small" type="primary" @click="dialogVisible = true">受控申请</el-button>
          <el-button size="small" type="primary" @click="getList"
            >刷新</el-button
          >
          <el-button size="small" type="primary" @click="dialogVisible = true"
            >受控申请</el-button
          >
        </el-col>
      </el-row>
    </div>
    <el-table :data="tableData" border height="calc(100vh - 18em)">
      <el-table-column type="index" label="序号" width="120">
        <template v-slot="scope">
          <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
          <span>{{
            (search.current - 1) * search.size + scope.$index + 1
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="申请编号" min-width="150" prop="applicationNumber"></el-table-column>
      <el-table-column label="设备名称" min-width="150" prop="deviceName"></el-table-column>
      <el-table-column label="设备编号" min-width="150" prop="deviceNumber"></el-table-column>
      <el-table-column label="设备型号" min-width="150" prop="deviceModel"></el-table-column>
      <el-table-column label="文件编号" min-width="150" prop="documentNumber"></el-table-column>
      <el-table-column label="文件名字" min-width="150" prop="fileName"></el-table-column>
      <el-table-column label="文档说明" min-width="150" prop="documentNote"></el-table-column>
      <el-table-column label="上传人" min-width="150" prop="uploaderName"></el-table-column>
      <el-table-column label="上传时间" min-width="150" prop="updateTime"></el-table-column>
      <el-table-column label="生效时间" min-width="150" prop="entryIntoForceTime"></el-table-column>
      <el-table-column label="审批人" min-width="150" prop="approverName"></el-table-column>
      <el-table-column
        label="申请编号"
        min-width="150"
        prop="applicationNumber"
      ></el-table-column>
      <el-table-column
        label="设备名称"
        min-width="150"
        prop="deviceName"
      ></el-table-column>
      <el-table-column
        label="设备编号"
        min-width="150"
        prop="deviceNumber"
      ></el-table-column>
      <el-table-column
        label="设备型号"
        min-width="150"
        prop="deviceModel"
      ></el-table-column>
      <el-table-column
        label="文件编号"
        min-width="150"
        prop="documentNumber"
      ></el-table-column>
      <el-table-column
        label="文件名字"
        min-width="150"
        prop="fileName"
      ></el-table-column>
      <el-table-column
        label="文档说明"
        min-width="150"
        prop="documentNote"
      ></el-table-column>
      <el-table-column
        label="上传人"
        min-width="150"
        prop="uploaderName"
      ></el-table-column>
      <el-table-column
        label="上传时间"
        min-width="150"
        prop="updateTime"
      ></el-table-column>
      <el-table-column
        label="生效时间"
        min-width="150"
        prop="entryIntoForceTime"
      ></el-table-column>
      <el-table-column
        label="审批人"
        min-width="150"
        prop="approverName"
      ></el-table-column>
      <el-table-column label="审批状态" min-width="150" prop="status">
        <template v-slot="scope">
          {{scope.row.status === true ? '通过' : scope.row.status === false ? '不通过' : '未审核'}}
          {{
            scope.row.status === true
              ? "通过"
              : scope.row.status === false
              ? "不通过"
              : "未审核"
          }}
        </template>
      </el-table-column>
      <el-table-column label="操作" min-width="180" fixed="right" prop="name">
        <template v-slot="scope">
          <el-button type="text" size="small" @click="downloadFile(scope.row.fileSystemName)">下载</el-button>
          <el-button type="text" size="small" style="color: red;" @click="deleteHomeworkGuidebook(scope.row)">删除</el-button>
          <el-button type="text" size="small" @click="instructionEditFun(scope.row)">编辑</el-button>
          <el-button type="text" size="small" @click="approval(scope.row)">审批</el-button>
          <el-button
            type="text"
            size="small"
            @click="downloadFile(scope.row.fileSystemName)"
            >下载</el-button
          >
          <el-button
            type="text"
            size="small"
            style="color: red;"
            @click="deleteHomeworkGuidebook(scope.row)"
            >删除</el-button
          >
          <el-button
            type="text"
            size="small"
            @click="instructionEditFun(scope.row)"
            >编辑</el-button
          >
          <el-button type="text" size="small" @click="approval(scope.row)"
            >审批</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1"
                   :page-sizes="[10, 20, 30, 50, 100]" :page-size="search.size"
                   layout="->,total, sizes, prev, pager, next, jumper"
                   :total="search.total">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="1"
      :page-sizes="[10, 20, 30, 50, 100]"
      :page-size="search.size"
      layout="->,total, sizes, prev, pager, next, jumper"
      :total="search.total"
    >
    </el-pagination>
    <el-dialog :visible.sync="dialogVisible" title="受控申请" width="60%">
      <div style="height: 60vh; overflow-y: auto; overflow-x: hidden;">
@@ -54,133 +133,317 @@
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="申请编号:">
                <el-input v-model="instructionForm.applicationNumber" disabled size="small" clearable></el-input>
                <el-input
                  v-model="instructionForm.applicationNumber"
                  disabled
                  size="small"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item label="附件:" style="float: left;">
                <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList1"
                           :headers="headers"
                           :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove1"
                           :on-success="onSuccess1"
                           class="upload-demo" multiple>
                <el-upload
                  ref="uploadFile"
                  :action="action"
                  :before-remove="beforeRemove"
                  :file-list="fileList1"
                  :headers="headers"
                  :limit="1"
                  :on-error="onError"
                  :on-exceed="handleExceed"
                  :on-remove="handleRemove1"
                  :on-success="onSuccess1"
                  class="upload-demo"
                  multiple
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请部门:">
                <el-input v-model="instructionForm.applicationDepartment" clearable size="small"></el-input>
                <el-input
                  v-model="instructionForm.applicationDepartment"
                  clearable
                  size="small"
                ></el-input>
              </el-form-item>
              <el-form-item label="责任人:">
                <el-input v-model="instructionForm.personLiable" clearable size="small"></el-input>
                <el-input
                  v-model="instructionForm.personLiable"
                  clearable
                  size="small"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="受控申请说明:" prop="controlledApplicationDescription"
                            :rules="[{required: true, message: '请输入受控申请说明', trigger: 'blur'}]">
                <el-input v-model="instructionForm.controlledApplicationDescription" type="textarea"
                          clearable></el-input>
              <el-form-item
                label="受控申请说明:"
                prop="controlledApplicationDescription"
                :rules="[
                  {
                    required: true,
                    message: '请输入受控申请说明',
                    trigger: 'blur'
                  }
                ]"
              >
                <el-input
                  v-model="instructionForm.controlledApplicationDescription"
                  type="textarea"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div style="text-align: right; margin-bottom: 10px">
          <el-button size="small" type="primary" @click="dialogVisible1 = true">添加受控文件</el-button>
          <el-button size="small" type="primary" @click="openAddDia"
            >添加受控文件</el-button
          >
          <el-button size="small" @click="delFile">删除</el-button>
        </div>
        <el-table :data="documentTableData" border style="width: 100%;"
                  tooltip-effect="dark"
                  :row-key="getRowKey"
                  @selection-change="handleSelectionChange" height="30em">
          <el-table-column type="selection" width="55%">
          </el-table-column>
          <el-table-column label="序号" prop="id" type="index" width="60"></el-table-column>
          <el-table-column label="设备名称" prop="deviceName" show-overflow-tooltip min-width="125"></el-table-column>
          <el-table-column label="设备编号" prop="deviceNumber" show-overflow-tooltip min-width="125"></el-table-column>
          <el-table-column label="设备型号" prop="deviceModel" show-overflow-tooltip min-width="125"></el-table-column>
          <el-table-column label="文件编号" prop="documentNumber" show-overflow-tooltip
                           min-width="125"></el-table-column>
          <el-table-column label="文件名称" prop="fileName" show-overflow-tooltip min-width="125"></el-table-column>
          <el-table-column label="上传人" prop="author" show-overflow-tooltip min-width="125"></el-table-column>
          <el-table-column label="上传时间" prop="updateTime" show-overflow-tooltip min-width="125"></el-table-column>
        <el-table
          :data="documentTableData"
          border
          style="width: 100%;"
          tooltip-effect="dark"
          :row-key="getRowKey"
          @selection-change="handleSelectionChange"
          height="30em"
        >
          <el-table-column type="selection" width="55%"> </el-table-column>
          <el-table-column
            label="序号"
            prop="id"
            type="index"
            width="60"
          ></el-table-column>
          <el-table-column
            label="设备名称"
            prop="deviceName"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="设备编号"
            prop="deviceNumber"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="设备型号"
            prop="deviceModel"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="文档编号"
            prop="documentNumber"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="文件名称"
            prop="fileName"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="上传人"
            prop="author"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column
            label="上传时间"
            prop="updateTime"
            show-overflow-tooltip
            min-width="125"
          ></el-table-column>
          <el-table-column min-width="100" label="操作" fixed="right">
            <template #default="{row, $index}">
              <el-button type="text" size="small" @click="downloadFile(row.fileSystemName)">下载</el-button>
              <el-button type="text" @click="editFun(row, $index)">编辑</el-button>
            <template v-slot="scope">
              <el-button
                type="text"
                size="small"
                @click="downloadFile(scope.row.fileSystemName)"
                >下载</el-button
              >
              <el-button type="text" @click="editFun(scope.row, scope.$index)"
                >编辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer">
        <el-button @click="dialogVisible = false" size="small">取 消</el-button>
        <el-button size="small" type="primary" @click="submitFun">提交</el-button>
        <el-button size="small" type="primary" @click="submitFun"
          >提交</el-button
        >
      </span>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisible1" title="添加设备作业指导书" width="40%">
    <el-dialog
      :visible.sync="dialogVisible1"
      title="添加设备作业指导书"
      width="40%"
    >
      <div style="height: 50vh;">
        <el-form ref="form" :model="form" label-width="90px">
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="文件类型:" prop="documentType"
                            :rules="[{required: true, message: '请输入文件类型', trigger: 'blur'}]">
                <el-input v-model="form.documentType" clearable size="small" placeholder="请输入文件类型"></el-input>
              <el-form-item
                label="文件类型:"
                prop="documentType"
                :rules="[
                  { required: true, message: '请输入文件类型', trigger: 'blur' }
                ]"
              >
                <el-input
                  v-model="form.documentType"
                  clearable
                  size="small"
                  placeholder="请输入文件类型"
                ></el-input>
              </el-form-item>
              <el-form-item label="设备名称:" prop="deviceName"
                            :rules="[{required: true, message: '请选择设备', trigger: 'change'}]">
                <el-select v-model="form.deviceName" size="small" clearable style="width: 100%"
                           placeholder="请选择设备名称"
                           @change="onDeviceNameChange" filterable>
                  <el-option v-for="item in deviceNameOption"
                             :key="item.id"
                             :label="item.label"
                             :value="item.value">
              <el-form-item
                label="设备名称:"
                prop="deviceName"
                :rules="[
                  { required: true, message: '请选择设备', trigger: 'change' }
                ]"
              >
                <el-select
                  v-model="form.deviceName"
                  size="small"
                  clearable
                  style="width: 100%"
                  placeholder="请选择设备名称"
                  @change="onDeviceNameChange"
                  filterable
                >
                  <el-option
                    v-for="item in deviceNameOption"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="文档编号:" prop="documentNumber"
                            :rules="[{required: true, message: '请输入文档编号', trigger: 'blur'}]">
                <el-input v-model="form.documentNumber" size="small" clearable placeholder="请输入文档编号"></el-input>
              <el-form-item
                label="文档编号:"
                prop="documentNumber"
                :rules="[
                  { required: true, message: '请输入文档编号', trigger: 'blur' }
                ]"
              >
                <el-input
                  v-model="form.documentNumber"
                  size="small"
                  clearable
                  placeholder="请输入文档编号"
                ></el-input>
              </el-form-item>
              <el-form-item label="管理编号:">
                <el-input v-model="form.deviceNumber" size="small" clearable disabled
                          placeholder="请输入管理编号"></el-input>
                <el-input
                  v-model="form.deviceNumber"
                  size="small"
                  clearable
                  disabled
                  placeholder="请输入管理编号"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="文件版本:" prop="documentVersion"
                            :rules="[{required: true, message: '请输入文件版本', trigger: 'blur'}]">
                <el-input v-model="form.documentVersion" size="small" placeholder="请输入文件版本" clearable></el-input>
              <el-form-item
                label="文件版本:"
                prop="documentVersion"
                :rules="[
                  { required: true, message: '请输入文件版本', trigger: 'blur' }
                ]"
              >
                <el-input
                  v-model="form.documentVersion"
                  size="small"
                  placeholder="请输入文件版本"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="作者:" prop="author"
                            :rules="[{required: true, message: '请输入作者', trigger: 'blur'}]">
                <el-input v-model="form.author" size="small" clearable></el-input>
              <el-form-item
                label="作者:"
                prop="author"
                :rules="[
                  { required: true, message: '请输入作者', trigger: 'blur' }
                ]"
              >
                <el-input
                  v-model="form.author"
                  size="small"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="提交日期:" prop="submitDate"
                            :rules="[{required: true, message: '请选择提交日期', trigger: 'change'}]">
                <el-date-picker v-model="form.submitDate" format="yyyy-MM-dd" style="width: 100%" size="small" clearable
                                placeholder="选择日期"
                                type="date" value-format="yyyy-MM-dd">
              <el-form-item
                label="提交日期:"
                prop="submitDate"
                :rules="[
                  {
                    required: true,
                    message: '请选择提交日期',
                    trigger: 'change'
                  }
                ]"
              >
                <el-date-picker
                  v-model="form.submitDate"
                  format="yyyy-MM-dd"
                  style="width: 100%"
                  size="small"
                  clearable
                  placeholder="选择日期"
                  type="date"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="文档说明:" prop="documentNote"
                            :rules="[{required: true, message: '请输入文档说明', trigger: 'blur'}]">
                <el-input v-model="form.documentNote" placeholder="请输入文档说明" type="textarea" clearable></el-input>
              <el-form-item
                label="文档说明:"
                prop="documentNote"
                :rules="[
                  { required: true, message: '请输入文档说明', trigger: 'blur' }
                ]"
              >
                <el-input
                  v-model="form.documentNote"
                  placeholder="请输入文档说明"
                  type="textarea"
                  clearable
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="附件:" style="float: left;">
                <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList"
                           :headers="headers"
                           :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove"
                           :on-success="onSuccess"
                           class="upload-demo" multiple>
                <el-upload
                  ref="uploadFile"
                  :action="action"
                  :before-remove="beforeRemove"
                  :file-list="fileList"
                  :headers="headers"
                  :limit="1"
                  :on-error="onError"
                  :on-exceed="handleExceed"
                  :on-remove="handleRemove"
                  :on-success="onSuccess"
                  class="upload-demo"
                  multiple
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
              </el-form-item>
@@ -189,8 +452,10 @@
        </el-form>
      </div>
      <span slot="footer">
        <el-button @click="dialogVisible1 = false" size="small">取 消</el-button>
        <el-button type="primary" @click="addFile" size="small">确 定</el-button>
        <el-button @click="closeDia" size="small">取 消</el-button>
        <el-button type="primary" @click="addFile" size="small"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
@@ -208,7 +473,7 @@
      }
    }
  },
  name: '',
  name: "",
  components: {},
  data() {
    return {
@@ -219,19 +484,20 @@
      },
      dialogVisible: false,
      dialogVisible1: false,
      value: '',
      value: "",
      selectRow: null,
      device: null,
      tableDataIndex: "",
      form: {
        documentType: '',
        documentNumber: '',
        deviceName: '',
        deviceModel: '',
        deviceNumber: '',
        fileName: '',
        fileSystemName: '',
        submitDate: '',
        documentNote: '',
        documentType: "",
        documentNumber: "",
        deviceName: "",
        deviceModel: "",
        deviceNumber: "",
        fileName: "",
        fileSystemName: "",
        submitDate: "",
        documentNote: ""
      },
      tableData: [],
      documentTableData: [],
@@ -243,228 +509,279 @@
      deviceNameOption: [], //设备名称下拉框数据
      entity: {
        deviceName: null,
        laboratoryName: '',
        storagePoint: ''
        laboratoryName: "",
        storagePoint: ""
      },
      selectedRow: [],
      instructionForm: {
        applicationNumber: '', // 申请编号
        applicationDepartment: '', // 申请部门
        personLiable: '', // 责任人
        controlledApplicationDescription: '', // 受控申请说明
        applicationNumber: "", // 申请编号
        applicationDepartment: "", // 申请部门
        personLiable: "", // 责任人
        controlledApplicationDescription: "" // 受控申请说明
      }
    }
    };
  },
  mounted() {
    this.getAllDevice();
    this.getList()
    this.getList();
  },
  watch: {
    // 监听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal) {
        this.getList()
        this.clickSidebar(newVal)
      }
    },
    dialogVisible1(newVal) {
      this.form.deviceName = this.clickNodeVal.label
      this.onDeviceNameChange()
      if (newVal === false) {
        this.$refs.form.resetFields()
        // this.form = {}
        this.fileList = []
        this.getList();
        this.clickSidebar(newVal);
      }
    },
    dialogVisible(newVal) {
      if (newVal === false) {
        this.instructionForm = {}
        this.documentTableData = []
        this.fileList1 = []
        this.instructionForm = {};
        this.documentTableData = [];
        this.fileList1 = [];
      }
    }
  },
  methods: {
    approval(row) {
      this.$confirm('是否审批通过!', '提示', {
        confirmButtonText: '通过',
        cancelButtonText: '不通过',
        type: 'warning'
      }).then(() => {
        this.approvalFun(row.id, true)
      }).catch(() => {
        this.approvalFun(row.id, false)
      });
      this.$confirm("是否审批通过!", "提示", {
        confirmButtonText: "通过",
        cancelButtonText: "不通过",
        type: "warning"
      })
        .then(() => {
          this.approvalFun(row.id, true);
        })
        .catch(() => {
          this.approvalFun(row.id, false);
        });
    },
    approvalFun(id, status) {
      this.$axios.get(this.$api.deviceCheck.approvalOfHomeworkInstructionManual + "?id=" + id + "&status=" + status).then(res => {
        this.getList()
      })
      this.$axios
        .get(
          this.$api.deviceCheck.approvalOfHomeworkInstructionManual +
            "?id=" +
            id +
            "&status=" +
            status
        )
        .then(res => {
          this.getList();
        });
      this.$message({
        type: 'success',
        message: '操作成功!'
        type: "success",
        message: "操作成功!"
      });
    },
    getRowKey (row) {
      return row.index
    getRowKey(row) {
      return row.index;
    },
    deleteHomeworkGuidebook(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.get(this.$api.deviceCheck.homeworkGuidebook + "?id=" + row.id + "&instructionId=" + row.instructionId).then(res => {
          this.$message.success('删除成功!')
          this.getList()
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .get(
              this.$api.deviceCheck.homeworkGuidebook +
                "?id=" +
                row.id +
                "&instructionId=" +
                row.instructionId
            )
            .then(res => {
              this.$message.success("删除成功!");
              this.getList();
            });
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      });
    },
    downloadFile(fileName) {
      let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName)
      let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName);
      if (state) {
        let url = this.javaApi + '/img/' + fileName;
        fileDownload.downloadIamge(url, fileName)
        let url = this.javaApi + "/img/" + fileName;
        fileDownload.downloadIamge(url, fileName);
      } else {
        const url = this.javaApi+'/word/'+ fileName
        const link = document.createElement('a');
        const url = this.javaApi + "/word/" + fileName;
        const link = document.createElement("a");
        link.href = url;
        link.download = fileName;
        link.click();
        this.$message.success('下载成功')
        this.$message.success("下载成功");
      }
    },
    instructionEditFun(row) {
      this.dialogVisible = true
      this.$axios.get(this.$api.deviceCheck.homeworkGuidebookEditor + "?instructionId=" + row.instructionId).then(res => {
        if (res.code == 200) {
          this.instructionForm = res.data.instruction;
          if (this.instructionForm.fileSystemName) {
            this.fileList1.push({name: this.instructionForm.fileName})
      this.dialogVisible = true;
      this.$axios
        .get(
          this.$api.deviceCheck.homeworkGuidebookEditor +
            "?instructionId=" +
            row.instructionId
        )
        .then(res => {
          if (res.code == 200) {
            this.instructionForm = res.data.instruction;
            if (this.instructionForm.fileSystemName) {
              this.fileList1.push({ name: this.instructionForm.fileName });
            }
            this.documentTableData = res.data.list;
            // 删除用
            this.documentTableData.forEach((v, k) => {
              v.index = k;
            });
          }
          this.documentTableData = res.data.list;
          // 删除用
          this.documentTableData.forEach((v, k) => {
            v.index = k
          })
        }
      })
        });
    },
    handleSizeChange(val) {
      this.search.size = val
      this.getList()
      this.search.size = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.search.current = val
      this.getList()
      this.search.current = val;
      this.getList();
    },
    submitFun() {
      this.$refs.form1.validate((valid) => {
      this.$refs.form1.validate(valid => {
        if (valid) {
          this.instructionForm.feTempHumRecordList = this.documentTableData
          this.$axios.post(this.$api.deviceCheck.newHomeworkGuidebookAdded, this.instructionForm, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            if (res.code == 200) {
              this.$message.success('操作成功!')
              this.dialogVisible = false
              this.getList()
            }
          })
          this.instructionForm.feTempHumRecordList = this.documentTableData;
          this.$axios
            .post(
              this.$api.deviceCheck.newHomeworkGuidebookAdded,
              this.instructionForm,
              {
                headers: {
                  "Content-Type": "application/json"
                }
              }
            )
            .then(res => {
              if (res.code == 200) {
                this.$message.success("操作成功!");
                this.dialogVisible = false;
                this.getList();
              }
            });
        } else {
          return false;
        }
      });
    },
    clickSidebar(clickNodeVal) {
      this.laboratoryNameIsNull = false
      this.laboratoryNameIsNull = false;
      // 是否存在value,存在value代表为三级
      if (!clickNodeVal.value) {
        this.list = [];
        this.entity.laboratoryName = null
        this.entity.storagePoint = null
        this.entity.laboratoryName = null;
        this.entity.storagePoint = null;
        // 等于1代表为树的一级,label为部门
        if (clickNodeVal.label === '其他') {
          this.laboratoryNameIsNull = true
          this.getAllDevice()
          return
        if (clickNodeVal.label === "其他") {
          this.laboratoryNameIsNull = true;
          this.getAllDevice();
          return;
        }
        if (clickNodeVal.level === 1) {
          this.entity.laboratoryName = clickNodeVal.label
          this.entity.laboratoryName = clickNodeVal.label;
          // 等于二级。label为存储地点
        } else if (clickNodeVal.level === 2) {
          // 其他表示没有配置实验室,只配置了地点
          if (clickNodeVal.parent.label === '其他') {
            this.laboratoryNameIsNull = true
          if (clickNodeVal.parent.label === "其他") {
            this.laboratoryNameIsNull = true;
          } else {
            this.entity.laboratoryName = clickNodeVal.parent.label
            this.entity.laboratoryName = clickNodeVal.parent.label;
          }
          this.entity.storagePoint = clickNodeVal.label
          this.entity.storagePoint = clickNodeVal.label;
        }
        this.getAllDevice()
        this.getAllDevice();
      }
    },
    //新增
    // 新增
    addFile() {
      this.$refs.form.validate((valid) => {
      this.$refs.form.validate(valid => {
        if (valid) {
          if (this.form.index !== undefined) {
            this.$set(this.documentTableData, this.form.index, this.form)
          if (this.tableDataIndex !== undefined) {
            this.$set(this.documentTableData, this.tableDataIndex, this.form);
            this.dialogVisible1 = false;
            this.$message.success('修改成功');
            this.$message.success("修改成功");
            console.log(
              "this.documentTableData---edit",
              this.documentTableData[this.tableDataIndex]
            );
          } else {
            this.documentTableData.push(this.form);
            // 删除用
            this.documentTableData.forEach((v, k) => {
              v.index = k
            })
            this.dialogVisible1 = false;
            this.$message.success('添加成功');
            this.$message.success("添加成功");
          }
        } else {
          return false;
        }
      });
    },
    openAddDia() {
      this.dialogVisible1 = true;
      this.tableDataIndex = undefined;
      this.form = {
        documentType: "",
        documentNumber: "",
        deviceName: "",
        deviceModel: "",
        deviceNumber: "",
        fileName: "",
        fileSystemName: "",
        submitDate: "",
        documentNote: ""
      };
      this.form.deviceName = this.clickNodeVal.label;
      this.onDeviceNameChange();
      this.fileList = [];
    },
    editFun(row, index) {
      this.form = {...row}
      // 更新用
      this.form.index = index;
      this.form = { ...row };
      this.tableDataIndex = index;
      console.log("this.tableDataIndex", this.tableDataIndex);
      // 回显列表
      if (this.form.fileSystemName) {
        this.fileList.push({name: this.form.fileName})
        this.fileList.push({ name: this.form.fileName });
      }
      this.dialogVisible1 = true
      this.dialogVisible1 = true;
    },
    closeDia() {
      this.dialogVisible1 = false;
      this.$refs["form"].resetFields();
      this.fileList = [];
    },
    handleSelectionChange(selected) {
      this.selectedRow = selected
      this.selectedRow = selected;
    },
    async delFile() {
      if (this.selectedRow.length === 0) {
        this.$message.error('请选择要删除的选项');
        this.$message.error("请选择要删除的选项");
        return;
      }
      // 删除保存好的数据
      let ids = this.selectedRow
        .filter(item => item.id!== undefined)
        .map(item => item.id).join(',');
        .filter(item => item.id !== undefined)
        .map(item => item.id)
        .join(",");
      //有错误
      const res = await this.$axios.get(this.$api.deviceCheck.deleteHomeworkGuidebook + '?ids=' + ids);
      const res = await this.$axios.get(
        this.$api.deviceCheck.deleteHomeworkGuidebook + "?ids=" + ids
      );
      if (res.code === 200) {
        // 删除视图的数据
        for (const resKey in this.selectedRow) {
          this.documentTableData = this.documentTableData.filter(item => item.index === this.selectedRow[resKey].index)
          this.documentTableData = this.documentTableData.filter(
            item => item.index === this.selectedRow[resKey].index
          );
        }
        this.$message.success({
          message: '删除成功',
          type: 'success'
          message: "删除成功",
          type: "success"
        });
      }
    },
@@ -477,47 +794,65 @@
      this.instructionForm.fileSystemName = response.data;
    },
    onError(error, file, fileList) {
      this.$message.error('上传失败:', error, file, fileList);
      this.$message.error("上传失败:", error, file, fileList);
    },
    handleRemove(file, fileList) {
      this.form.fileName = ''
      this.form.fileSystemName = ''
      this.form.fileName = "";
      this.form.fileSystemName = "";
    },
    handleRemove1(file, fileList) {
      this.form.fileName = ''
      this.form.fileSystemName = ''
      this.form.fileName = "";
      this.form.fileSystemName = "";
    },
    beforeRemove(file) {
      return this.$confirm(`确定移除 ${file.name}?`)
      return this.$confirm(`确定移除 ${file.name}?`);
    },
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件。`);
      this.$message.warning(
        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件。`
      );
    },
    getList() {
      this.$axios.get(this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions + "?size=" + this.search.size + "&current=" + this.search.current).then(res => {
        if (res.code == 200) {
          this.tableData = res.data.records;
          this.search.total = res.data.total
        }
      })
      this.$axios
        .get(
          this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions +
            "?size=" +
            this.search.size +
            "&current=" +
            this.search.current
        )
        .then(res => {
          if (res.code == 200) {
            this.tableData = res.data.records;
            this.search.total = res.data.total;
          }
        });
    },
    getAllDevice() {
      this.$axios.post(this.$api.deviceScope.selectDeviceParameter + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull, {
        page: {
          current: 1,
          size: -1
        },
        entity: this.entity
      }, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        if (res.code == 200) {
          this.devices = res.data.body.records;
          this.updateDeviceNameOptions();
        }
      })
      this.$axios
        .post(
          this.$api.deviceScope.selectDeviceParameter +
            "?laboratoryNameIsNull=" +
            this.laboratoryNameIsNull,
          {
            page: {
              current: 1,
              size: -1
            },
            entity: this.entity
          },
          {
            headers: {
              "Content-Type": "application/json"
            }
          }
        )
        .then(res => {
          if (res.code == 200) {
            this.devices = res.data.body.records;
            this.updateDeviceNameOptions();
          }
        });
    },
    // 更新设备名称下拉框的选项
    updateDeviceNameOptions() {
@@ -529,29 +864,30 @@
    // 设备名称改变时触发
    onDeviceNameChange() {
      // 根据选中的设备名称,更新管理编号下拉框的选项
      const selectedDevice = this.devices.find(device => device.deviceName === this.form.deviceName);
      const selectedDevice = this.devices.find(
        device => device.deviceName === this.form.deviceName
      );
      if (selectedDevice) {
        this.form.deviceNumber = selectedDevice.managementNumber;
        this.form.deviceModel = selectedDevice.specificationModel;
        this.form.deviceId = selectedDevice.id
        this.form.deviceId = selectedDevice.id;
      }
    },
    }
  },
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
        token: sessionStorage.getItem("token")
      };
    },
    action() {
      return this.javaApi + this.$api.personnel.saveCNASFile
      return this.javaApi + this.$api.personnel.saveCNASFile;
    }
  },
}
  }
};
</script>
<style scoped>
h4 {
  font-weight: 400;
  font-size: 16px;
src/components/equipment/equipment-acceptance.vue
@@ -2,48 +2,117 @@
  <div>
    <div>
      <div style="margin: 10px 0;text-align: right">
        <el-button size="small" type="primary" @click="handleForm('add')">新增</el-button>
        <el-button size="small" type="primary" @click="handleForm('add')"
          >新增</el-button
        >
      </div>
      <div>
        <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData"
                  height="calc(100vh - 18em)"
                  style="width: 100% ;">
        <el-table
          ref="yearTable"
          v-loading="yearTableDetailDataLoading"
          :data="yearTableDetailData"
          height="calc(100vh - 18em)"
          style="width: 100% ;"
        >
          <!-- 表格列 -->
          <el-table-column align="center" header-align="center" label="序号" prop="prop" type="index" width="70"></el-table-column>
          <el-table-column label="到货日期" min-width="150" prop="arrivalDate"></el-table-column>
          <el-table-column label="金额" min-width="100" prop="goldAmount"></el-table-column>
          <el-table-column label="维修单位" min-width="150" prop="maintenanceunit"></el-table-column>
          <el-table-column
            align="center"
            header-align="center"
            label="序号"
            prop="prop"
            type="index"
            width="70"
          ></el-table-column>
          <el-table-column
            label="到货日期"
            min-width="150"
            prop="arrivalDate"
          ></el-table-column>
          <el-table-column
            label="金额"
            min-width="100"
            prop="goldAmount"
          ></el-table-column>
          <el-table-column
            label="维修单位"
            min-width="150"
            prop="maintenanceunit"
          ></el-table-column>
          <!-- 操作按钮 -->
          <el-table-column align="center" label="操作" min-width="180">
            <template slot-scope="scope">
              <el-button size="small" type="text" @click="handleForm('edit',scope.row.acceptanceId)">编辑</el-button>
              <el-button size="small" type="text" @click="handleForm('view',scope.row.acceptanceId)">查看</el-button>
              <el-button size="small" type="text" @click="record(scope.row)">附件</el-button>
              <el-button size="small" type="text" @click="handleDownOne(scope.row.acceptanceId)">导出</el-button>
              <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.acceptanceId)">删除</el-button>
              <el-button
                size="small"
                type="text"
                @click="handleForm('edit', scope.row.acceptanceId)"
                >编辑</el-button
              >
              <el-button
                size="small"
                type="text"
                @click="handleForm('view', scope.row.acceptanceId)"
                >查看</el-button
              >
              <el-button size="small" type="text" @click="record(scope.row)"
                >附件</el-button
              >
              <el-button
                size="small"
                type="text"
                @click="handleDownOne(scope.row.acceptanceId)"
                >导出</el-button
              >
              <el-button
                size="small"
                style="color: #f56c6c"
                type="text"
                @click="deleteFun(scope.row.acceptanceId)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]"
                       :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1"
                       @current-change="handleCurrentChange1">
        <el-pagination
          :current-page="1"
          :page-size="pagination1.size"
          :page-sizes="[10, 20, 30, 50, 100]"
          :total="pagination1.total"
          layout="->,total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange1"
          @current-change="handleCurrentChange1"
        >
        </el-pagination>
      </div>
    </div>
    <acceptance-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></acceptance-form>
    <acceptance-form
      v-if="applicationForm"
      ref="applicationForm"
      @closeDialog="closeDialog"
    ></acceptance-form>
    <!--上传报告-->
    <el-dialog :visible.sync="filesDialogVisible" title="附件" width="80%" @closed="closeFilesLook">
    <el-dialog
      :visible.sync="filesDialogVisible"
      title="附件"
      width="80%"
      @closed="closeFilesLook"
    >
      <div style="display: flex;justify-content: space-between;">
        <el-upload ref='upload'
                   :action="fileAction"
                   :auto-upload="true"
                   :before-upload="fileBeforeUpload"
                   :data="{acceptanceId: acceptanceId}"
                   :headers="headers" :on-error="onError"
                   :on-success="handleSuccessUp"
                   :show-file-list="false"
                   accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;">
          <el-button size="small" style="height: 38px" type="primary">附件上传</el-button>
        <el-upload
          ref="upload"
          :action="fileAction"
          :auto-upload="true"
          :before-upload="fileBeforeUpload"
          :data="{ acceptanceId: acceptanceId }"
          :headers="headers"
          :on-error="onError"
          :on-success="handleSuccessUp"
          :show-file-list="false"
          accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar"
          style="width: 80px !important;"
        >
          <el-button size="small" style="height: 38px" type="primary"
            >附件上传</el-button
          >
        </el-upload>
      </div>
      <div>
@@ -54,16 +123,24 @@
          :highlightCurrentRow="true"
          :table-data="tableData"
          :table-loading="tableLoading"
          style="margin-top: 0.5em;">
          style="margin-top: 0.5em;"
        >
        </ZTTable>
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="lookDialogVisible"
      fullscreen
      title="查看附件" top="5vh" width="800px">
      <filePreview v-if="lookDialogVisible" :currentFile="{}"
                   :fileUrl="fileUrl" style="height: 90vh;overflow-y: auto;"/>
      title="查看附件"
      top="5vh"
      width="800px"
    >
      <filePreview
        v-if="lookDialogVisible"
        :currentFile="{}"
        :fileUrl="fileUrl"
        style="height: 90vh;overflow-y: auto;"
      />
    </el-dialog>
  </div>
</template>
@@ -72,16 +149,16 @@
import AcceptanceForm from "./acceptance-form.vue";
import ZTTable from "../caorui/ZTTable/index.vue";
import filePreview from "../tool/file-preview.vue";
import file from "../../util/file";
export default {
  name: "equipment-acceptance",
  // import 引入的组件需要注入到对象中才能使用
  components: {filePreview, ZTTable, AcceptanceForm},
  components: { filePreview, ZTTable, AcceptanceForm },
  props: {
    clickNodeVal: {
      type: Object,
      default: () => {
      }
      default: () => {}
    }
  },
  data() {
@@ -90,7 +167,7 @@
      pagination1: {
        size: 10,
        current: 1,
        total: 0,
        total: 0
      },
      yearTableDetailDataLoading: false,
      yearTableDetailData: [],
@@ -98,36 +175,36 @@
      filesDialogVisible: false,
      columnData: [
        {
          label: '文件名称',
          prop: 'fileName',
          minWidth: '150px'
          label: "文件名称",
          prop: "fileName",
          minWidth: "150px"
        },
        {
          dataType: 'action',
          minWidth: '100',
          label: '操作',
          fixed: 'right',
          dataType: "action",
          minWidth: "100",
          label: "操作",
          fixed: "right",
          operation: [
            {
              name: '预览',
              type: 'text',
              clickFun: (row) => {
                this.handleLook(row)
              name: "预览",
              type: "text",
              clickFun: row => {
                this.handleLook(row);
              }
            },
            {
              name: '下载',
              type: 'text',
              clickFun: (row) => {
                this.upload(row)
              name: "下载",
              type: "text",
              clickFun: row => {
                this.upload(row);
              }
            },
            {
              name: '删除',
              type: 'text',
              color: '#f56c6c',
              clickFun: (row) => {
                this.delete(row)
              name: "删除",
              type: "text",
              color: "#f56c6c",
              clickFun: row => {
                this.delete(row);
              }
            }
          ]
@@ -135,210 +212,252 @@
      ],
      tableData: [],
      tableLoading: false,
      acceptanceId: '', // 上传附件当前行的id
      currentInfo:{},
      acceptanceId: "", // 上传附件当前行的id
      currentInfo: {},
      lookDialogVisible: false,
      fileUrl: ''
    }
      fileUrl: ""
    };
  },
  mounted() {
    this.getYearTableDetailData(this.clickNodeVal.value)
    this.getYearTableDetailData(this.clickNodeVal.value);
  },
  // 方法集合
  methods: {
    // 查询
    getYearTableDetailData(deviceId) {
      this.yearTableDetailDataLoading = true
      this.$axios.post(this.$api.deviceAcceptance.pageDeviceAcceptance, {
        page: {
          current: this.pagination1.current,
          size: this.pagination1.size,
        },
        entity: {
          deviceId: deviceId,
        }
      }, {
        headers: {
          'Content-Type': 'application/json'
        },
        noQs: true
      }).then(res => {
        if (res.code == 200) {
          this.yearTableDetailData = res.data.records
          this.pagination1.total = res.data.total
        }
        this.yearTableDetailDataLoading = false
      }).catch(err => {
        this.yearTableDetailDataLoading = false
      })
      this.yearTableDetailDataLoading = true;
      this.$axios
        .post(
          this.$api.deviceAcceptance.pageDeviceAcceptance,
          {
            page: {
              current: this.pagination1.current,
              size: this.pagination1.size
            },
            entity: {
              deviceId: deviceId
            }
          },
          {
            headers: {
              "Content-Type": "application/json"
            },
            noQs: true
          }
        )
        .then(res => {
          if (res.code == 200) {
            this.yearTableDetailData = res.data.records;
            this.pagination1.total = res.data.total;
          }
          this.yearTableDetailDataLoading = false;
        })
        .catch(err => {
          this.yearTableDetailDataLoading = false;
        });
    },
    handleForm(type, id) {
      this.applicationForm = true
      this.applicationForm = true;
      this.$nextTick(() => {
        this.$refs.applicationForm.openDialog(type, id, this.clickNodeVal.value)
      })
        this.$refs.applicationForm.openDialog(
          type,
          id,
          this.clickNodeVal.value
        );
      });
    },
    closeDialog() {
      this.applicationForm = false
      this.getYearTableDetailData(this.clickNodeVal.value)
      this.applicationForm = false;
      this.getYearTableDetailData(this.clickNodeVal.value);
    },
    // 打开报告弹框
    record (row) {
      this.filesDialogVisible = true
      this.acceptanceId = row.acceptanceId
      this.searchTableList()
    record(row) {
      this.filesDialogVisible = true;
      this.acceptanceId = row.acceptanceId;
      this.searchTableList();
    },
    // 查询附件列表
    searchTableList () {
      this.tableLoading = true
      this.$axios.get(this.$api.deviceAcceptance.getDeviceAcceptanceFileList + '?acceptanceId=' + this.acceptanceId).then(res => {
        this.tableLoading = false
        if (res.code === 201) return
        this.tableData = res.data
      }).catch(err => {
        this.tableLoading = false
        console.log('err---', err);
      })
    searchTableList() {
      this.tableLoading = true;
      this.$axios
        .get(
          this.$api.deviceAcceptance.getDeviceAcceptanceFileList +
            "?acceptanceId=" +
            this.acceptanceId
        )
        .then(res => {
          this.tableLoading = false;
          if (res.code === 201) return;
          this.tableData = res.data;
        })
        .catch(err => {
          this.tableLoading = false;
          console.log("err---", err);
        });
    },
    // 查看文件
    handleLook(row){
      this.currentInfo = row
      this.lookDialogVisible = true
      const state = /\.(jpg|jpeg|png|gif)$/i.test(this.currentInfo.fileUrl)
    handleLook(row) {
      this.currentInfo = row;
      this.lookDialogVisible = true;
      const state = /\.(jpg|jpeg|png|gif)$/i.test(this.currentInfo.fileUrl);
      if (state) {
        this.fileUrl = this.javaApi+'/img/'+ this.currentInfo.fileUrl
        this.fileUrl = this.javaApi + "/img/" + this.currentInfo.fileUrl;
      } else {
        this.fileUrl = this.javaApi+'/word/'+ this.currentInfo.fileUrl
        this.fileUrl = this.javaApi + "/word/" + this.currentInfo.fileUrl;
      }
    },
    // 下载
    upload (row) {
      let url = '';
      if(row.type==1){
        url = this.javaApi+'/img/'+row.fileUrl
        file.downloadIamge(url,row.fileName)
      }else{
        url = this.javaApi+'/word/'+row.fileUrl
        const link = document.createElement('a');
    upload(row) {
      let url = "";
      if (row.type == 1) {
        url = this.javaApi + "/img/" + row.fileUrl;
        file.downloadIamge(url, row.fileName);
      } else {
        url = this.javaApi + "/word/" + row.fileUrl;
        const link = document.createElement("a");
        link.href = url;
        link.download = row.fileName;
        link.click();
      }
    },
    // 删除
    delete (row) {
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableLoading = true
        this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptanceFileList + '?acceptanceFileId=' + row.acceptanceFileId).then(res => {
          this.tableLoading = false
          if (res.code === 201) return
          this.$message.success('删除成功')
          this.searchTableList()
        }).catch(err => {
          this.tableLoading = false
          console.log('err---', err);
    delete(row) {
      this.$confirm("此操作将删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.tableLoading = true;
          this.$axios
            .get(
              this.$api.deviceAcceptance.delDeviceAcceptanceFileList +
                "?acceptanceFileId=" +
                row.acceptanceFileId
            )
            .then(res => {
              this.tableLoading = false;
              if (res.code === 201) return;
              this.$message.success("删除成功");
              this.searchTableList();
            })
            .catch(err => {
              this.tableLoading = false;
              console.log("err---", err);
            });
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      });
    },
    // 上传附件
    fileBeforeUpload(file) {
      let flag = true
      let flag = true;
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');
        this.$refs.upload.clearFiles()
        flag = false
        this.$message.error("上传文件不超过10M");
        this.$refs.upload.clearFiles();
        flag = false;
      }
      if (!flag) {
        return Promise.reject(flag); //正确的终止
      }
    },
    onError(err, file, fileList,type) {
      this.$message.error('上传失败')
      this.$refs.upload.clearFiles()
    onError(err, file, fileList, type) {
      this.$message.error("上传失败");
      this.$refs.upload.clearFiles();
    },
    handleSuccessUp(response, ) {
    handleSuccessUp(response) {
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success('上传成功');
        this.searchTableList()
        this.$message.success("上传成功");
        this.searchTableList();
      }
    },
    closeFilesLook () {
      this.filesDialogVisible = false
    closeFilesLook() {
      this.filesDialogVisible = false;
    },
    // 分页
    handleSizeChange1(val) {
      this.pagination1.size = val
      this.getYearTableDetailData(this.clickNodeVal.value)
      this.pagination1.size = val;
      this.getYearTableDetailData(this.clickNodeVal.value);
    },
    // 分页
    handleCurrentChange1(val) {
      this.pagination1.current = val
      this.getYearTableDetailData(this.clickNodeVal.value)
      this.pagination1.current = val;
      this.getYearTableDetailData(this.clickNodeVal.value);
    },
    // 导出
    handleDownOne(id) {
      this.outLoading = true
      this.$axios.get(this.$api.deviceAcceptance.exportDeviceAcceptance + '?acceptanceId=' + id, {
        responseType: "blob"
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], {type: 'application/octet-stream'});
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '设备验收.doc';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '设备验收.doc';
            link.click();
            this.$message.success('导出成功')
      this.outLoading = true;
      this.$axios
        .get(
          this.$api.deviceAcceptance.exportDeviceAcceptance +
            "?acceptanceId=" +
            id,
          {
            responseType: "blob"
          }
        }
      })
        )
        .then(res => {
          this.outLoading = false;
          const blob = new Blob([res], { type: "application/octet-stream" });
          //将Blob 对象转换成字符串
          let reader = new FileReader();
          reader.readAsText(blob, "utf-8");
          reader.onload = () => {
            try {
              let result = JSON.parse(reader.result);
              if (result.message) {
                this.$message.error(result.message);
              } else {
                const url = URL.createObjectURL(blob);
                const link = document.createElement("a");
                link.href = url;
                link.download = "设备验收.doc";
                link.click();
                this.$message.success("导出成功");
              }
            } catch (err) {
              console.log(err);
              const url = URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.href = url;
              link.download = "设备验收.doc";
              link.click();
              this.$message.success("导出成功");
            }
          };
        });
    },
    // 删除
    deleteFun(id) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptance + '?acceptanceId=' + id).then(res => {
          this.$message.success('删除成功!');
          this.getYearTableDetailData(this.clickNodeVal.value);
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .get(
              this.$api.deviceAcceptance.delDeviceAcceptance +
                "?acceptanceId=" +
                id
            )
            .then(res => {
              this.$message.success("删除成功!");
              this.getYearTableDetailData(this.clickNodeVal.value);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    }
  },
  watch: {
    // 监听点击el-tree的数据,进行数据刷新
@@ -346,20 +465,21 @@
      if (newVal.value) {
        this.getYearTableDetailData(newVal.value);
      }
    },
    }
  },
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
        token: sessionStorage.getItem("token")
      };
    },
    fileAction() {
      return this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile
      return (
        this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile
      );
    }
  },
}
  }
};
</script>
<style scoped>
src/components/equipment/quantity-value-traceability-plan.vue
@@ -2,130 +2,352 @@
  <div>
    <div>
      <div style="margin: 10px 0;text-align: right">
        <el-button size="small" type="primary" @click="getYearTableDetailData">刷新</el-button>
        <el-button size="small" type="primary" @click="handleForm('add')">新增</el-button>
        <el-button size="small" type="primary" @click="getYearTableDetailData"
          >刷新</el-button
        >
        <el-button size="small" type="primary" @click="handleForm('add')"
          >新增</el-button
        >
      </div>
      <div>
        <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData"
                  height="calc(100vh - 18em)"
                  style="width: 100% ;">
        <el-table
          ref="yearTable"
          v-loading="yearTableDetailDataLoading"
          :data="yearTableDetailData"
          height="calc(100vh - 18em)"
          style="width: 100% ;"
        >
          <!-- 表格列 -->
          <el-table-column align="center" header-align="center" label="序号" prop="prop" type="index" width="70"></el-table-column>
          <el-table-column label="年份" min-width="80" prop="planYear"></el-table-column>
          <el-table-column label="文件名称" min-width="120" prop="compiler"></el-table-column>
          <el-table-column label="编制人" min-width="150" prop="compiler"></el-table-column>
          <el-table-column label="编制时间" min-width="150" prop="datePreparation"></el-table-column>
          <el-table-column label="批准人" min-width="180" prop="audit"></el-table-column>
          <el-table-column
            align="center"
            header-align="center"
            label="序号"
            prop="prop"
            type="index"
            width="70"
          ></el-table-column>
          <el-table-column
            label="年份"
            min-width="80"
            prop="planYear"
          ></el-table-column>
          <el-table-column
            label="文件名称"
            min-width="120"
            prop="compiler"
          ></el-table-column>
          <el-table-column
            label="编制人"
            min-width="150"
            prop="compiler"
          ></el-table-column>
          <el-table-column
            label="编制时间"
            min-width="150"
            prop="datePreparation"
          ></el-table-column>
          <el-table-column
            label="批准人"
            min-width="180"
            prop="audit"
          ></el-table-column>
          <el-table-column label="批准状态" min-width="180" prop="status">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status ===  1" type="success">批 准</el-tag>
              <el-tag v-if="scope.row.status ===  0" type="danger">不批准</el-tag>
              <el-tag v-if="scope.row.status === 1" type="success"
                >批 准</el-tag
              >
              <el-tag v-if="scope.row.status === 0" type="danger"
                >不批准</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column label="批准时间" min-width="180" prop="auditDate"></el-table-column>
          <el-table-column
            label="批准时间"
            min-width="180"
            prop="auditDate"
          ></el-table-column>
          <!-- 操作按钮 -->
          <el-table-column align="center" fixed="right" label="操作" min-width="180">
          <el-table-column
            align="center"
            fixed="right"
            label="操作"
            min-width="180"
          >
            <template slot-scope="scope">
              <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('edit', scope.row)">编辑</el-button>
              <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('check', scope.row)">批准</el-button>
              <el-button size="small" type="text" @click="handleDownOne(scope.row.traceabilityManagementId)">导出</el-button>
              <el-button :disabled="scope.row.status === 1" size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.traceabilityManagementId)">删除</el-button>
              <el-button
                :disabled="scope.row.status === 1"
                size="small"
                type="text"
                @click="handleForm('edit', scope.row)"
                >编辑</el-button
              >
              <el-button
                :disabled="scope.row.status === 1"
                size="small"
                type="text"
                @click="handleForm('check', scope.row)"
                >批准</el-button
              >
              <el-button
                size="small"
                type="text"
                @click="handleDownOne(scope.row.traceabilityManagementId)"
                >导出</el-button
              >
              <el-button
                :disabled="scope.row.status === 1"
                size="small"
                style="color: #f56c6c"
                type="text"
                @click="deleteFun(scope.row.traceabilityManagementId)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]"
                       :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1"
                       @current-change="handleCurrentChange1">
        <el-pagination
          :current-page="1"
          :page-size="pagination1.size"
          :page-sizes="[10, 20, 30, 50, 100]"
          :total="pagination1.total"
          layout="->,total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange1"
          @current-change="handleCurrentChange1"
        >
        </el-pagination>
      </div>
    </div>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
               :visible.sync="applicationForm" title="仪器设备量值溯源管理总体计划"
               width="80%" @close="closeDialog">
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :visible.sync="applicationForm"
      title="仪器设备量值溯源管理总体计划"
      width="80%"
      @close="closeDialog"
    >
      <div style="display: flex;align-items: center;">
        <el-button v-if="operationType !== 'check'" size="small" type="primary" @click="addTableRow">添加</el-button>
        <el-button
          v-if="operationType !== 'check'"
          size="small"
          type="primary"
          @click="addTableRow"
          >添加</el-button
        >
        <span style="width: 60px">年份:</span>
        <el-date-picker
          v-model="form.planYear"
          type="year"
          value-format="yyyy"
          :disabled="operationType === 'check'"
          clearable
          size="small"
          format="yyyy"
          placeholder="选择年">
          placeholder="选择年"
        >
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <el-table ref="yearTable" :data="deviceTraceabilityManagementDetails"
                  height="300px" id="templateParamTable" row-key="deviceId"
                  style="width: 100% ;">
          <el-table-column align="center" header-align="center" label="序号" type="index" width="60"></el-table-column>
        <el-table
          ref="yearTable"
          :data="deviceTraceabilityManagementDetails"
          height="300px"
          id="templateParamTable"
          row-key="deviceId"
          style="width: 100% ;"
        >
          <el-table-column
            align="center"
            header-align="center"
            label="序号"
            type="index"
            width="60"
          ></el-table-column>
          <el-table-column label="设备名称" min-width="170" prop="deviceId">
            <template slot-scope="scope">
              <el-input v-model="scope.row.deviceName" :disabled="operationType === 'check'" clearable size="small"></el-input>
              <el-input
                v-model="scope.row.deviceName"
                :disabled="operationType === 'check'"
                clearable
                size="small"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="型号" min-width="140" prop="specificationModel">
          <el-table-column
            label="型号"
            min-width="140"
            prop="specificationModel"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.specificationModel" :disabled="operationType === 'check'" clearable size="small"></el-input>
              <el-input
                v-model="scope.row.specificationModel"
                :disabled="operationType === 'check'"
                clearable
                size="small"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="设备编号" min-width="140" prop="managementNumber">
          <el-table-column
            label="设备编号"
            min-width="140"
            prop="managementNumber"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.managementNumber" :disabled="operationType === 'check'" clearable size="small"></el-input>
              <el-input
                v-model="scope.row.managementNumber"
                :disabled="operationType === 'check'"
                clearable
                size="small"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="技术指标参数" min-width="120" prop="technicalIndexParameters">
          <el-table-column
            label="技术指标参数"
            min-width="120"
            prop="technicalIndexParameters"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input>
              <el-input
                v-model="scope.row.technicalIndexParameters"
                :disabled="operationType === 'check'"
                clearable
                size="small"
                type="textarea"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="技术指标要求" min-width="120" prop="technicalRequirements">
          <el-table-column
            label="技术指标要求"
            min-width="120"
            prop="technicalRequirements"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.technicalRequirements" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input>
              <el-input
                v-model="scope.row.technicalRequirements"
                :disabled="operationType === 'check'"
                clearable
                size="small"
                type="textarea"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="检定周期" min-width="120" prop="verificationCycle">
          <el-table-column
            label="检定周期"
            min-width="120"
            prop="verificationCycle"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.verificationCycle" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input>
              <el-input
                v-model="scope.row.verificationCycle"
                :disabled="operationType === 'check'"
                clearable
                size="small"
                type="textarea"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="检定单位" min-width="90" prop="verificationUnit">
          <el-table-column
            label="检定单位"
            min-width="90"
            prop="verificationUnit"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.verificationUnit" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input>
              <el-input
                v-model="scope.row.verificationUnit"
                :disabled="operationType === 'check'"
                clearable
                size="small"
                type="textarea"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="备注" min-width="90" prop="remark">
            <template slot-scope="scope">
              <el-input v-model="scope.row.remark" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input>
              <el-input
                v-model="scope.row.remark"
                :disabled="operationType === 'check'"
                clearable
                size="small"
                type="textarea"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="80" align="center">
            <template slot-scope="scope">
              <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">删除</el-button>
              <el-button
                style="color: #f56c6c"
                type="text"
                @click="deleteRow(scope.$index)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
        <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="submitForm">确 认</el-button>
        <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(0)">不通过</el-button>
        <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(1)">通 过</el-button>
        <el-button
          v-if="operationType !== 'check'"
          :loading="submitFormLoading"
          type="primary"
          @click="submitForm"
          >确 认</el-button
        >
        <el-button
          v-if="operationType === 'check'"
          :loading="submitFormLoading"
          type="primary"
          @click="checkStatus(0)"
          >不通过</el-button
        >
        <el-button
          v-if="operationType === 'check'"
          :loading="submitFormLoading"
          type="primary"
          @click="checkStatus(1)"
          >通 过</el-button
        >
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
               :visible.sync="addEquipDia" title="添加设备" width="50%">
      <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500"
                style="width: 100%" @selection-change="handleSelectionChange">
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :visible.sync="addEquipDia"
      title="添加设备"
      width="50%"
    >
      <el-table
        ref="multipleTable"
        :data="equipOptions"
        tooltip-effect="dark"
        height="500"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column label="设备名称" prop="label" width="190"></el-table-column>
        <el-table-column prop="specificationModel" label="型号" width="120"></el-table-column>
        <el-table-column prop="managementNumber" label="设备编号"></el-table-column>
        <el-table-column
          label="设备名称"
          prop="label"
          width="190"
        ></el-table-column>
        <el-table-column
          prop="specificationModel"
          label="型号"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="managementNumber"
          label="设备编号"
        ></el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addEquipDia = false">取 消</el-button>
        <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="changeMachineName">确 认</el-button>
        <el-button
          v-if="operationType !== 'check'"
          :loading="submitFormLoading"
          type="primary"
          @click="changeMachineName"
          >确 认</el-button
        >
      </span>
    </el-dialog>
  </div>
@@ -141,8 +363,7 @@
  props: {
    clickNodeVal: {
      type: Object,
      default: () => {
      }
      default: () => {}
    }
  },
  data() {
@@ -151,7 +372,7 @@
      pagination1: {
        size: 10,
        current: 1,
        total: 0,
        total: 0
      },
      yearTableDetailDataLoading: false,
      yearTableDetailData: [],
@@ -160,146 +381,190 @@
      deviceIds: [],
      applicationForm: false,
      submitFormLoading: false,
      operationType: '',
      operationType: "",
      equipOptions: [],
      form: {
        planYear: '',
        planYear: "",
        deviceTraceabilityManagementDetails: []
      },
      addEquipDia: false,
    }
      addEquipDia: false
    };
  },
  mounted() {
    this.getYearTableDetailData()
    this.getYearTableDetailData();
  },
  // 方法集合
  methods: {
    // 查询
    getYearTableDetailData() {
      this.yearTableDetailDataLoading = true
      this.$axios.post(this.$api.deviceTraceabilityManagement.selectDeviceTraceabilityManagementByPage, {
        page: {
          current: this.pagination1.current,
          size: this.pagination1.size,
        },
        entity: {}
      }, {
        headers: {
          'Content-Type': 'application/json'
        },
        noQs: true
      }).then(res => {
        if (res.code == 200) {
          this.yearTableDetailData = res.data.records
          this.pagination1.total = res.data.total
        }
        this.yearTableDetailDataLoading = false
      }).catch(err => {
        this.yearTableDetailDataLoading = false
      })
      this.yearTableDetailDataLoading = true;
      this.$axios
        .post(
          this.$api.deviceTraceabilityManagement
            .selectDeviceTraceabilityManagementByPage,
          {
            page: {
              current: this.pagination1.current,
              size: this.pagination1.size
            },
            entity: {}
          },
          {
            headers: {
              "Content-Type": "application/json"
            },
            noQs: true
          }
        )
        .then(res => {
          if (res.code == 200) {
            this.yearTableDetailData = res.data.records;
            this.pagination1.total = res.data.total;
          }
          this.yearTableDetailDataLoading = false;
        })
        .catch(err => {
          this.yearTableDetailDataLoading = false;
        });
    },
    // 打开新增和编辑弹框
    handleForm(type, row) {
      this.operationType = type
      this.applicationForm = true
      this.form = {
        planYear: '',
          deviceTraceabilityManagementDetails: []
      },
      this.deviceTraceabilityManagementDetails = []
      this.operationType = type;
      this.applicationForm = true;
      (this.form = {
        planYear: "",
        deviceTraceabilityManagementDetails: []
      }),
        (this.deviceTraceabilityManagementDetails = []);
      if (row) {
        this.traceabilityManagementId = row.traceabilityManagementId
        this.$axios.get(this.$api.deviceTraceabilityManagement.getTraceabilityManagementDetail + '?traceabilityManagementId=' + this.traceabilityManagementId).then(res => {
          if (res.code === 200) {
            this.form = res.data
            this.deviceTraceabilityManagementDetails = this.form.deviceTraceabilityManagementDetails
          }
        }).catch(error => {
          console.error(error)
        })
        this.traceabilityManagementId = row.traceabilityManagementId;
        this.$axios
          .get(
            this.$api.deviceTraceabilityManagement
              .getTraceabilityManagementDetail +
              "?traceabilityManagementId=" +
              this.traceabilityManagementId
          )
          .then(res => {
            if (res.code === 200) {
              this.form = res.data;
              this.deviceTraceabilityManagementDetails = this.form.deviceTraceabilityManagementDetails;
            }
          })
          .catch(error => {
            console.error(error);
          });
      }
    },
    // 添加设备
    addTableRow () {
      this.addEquipDia = true
      this.getEquipOptions()
    addTableRow() {
      this.addEquipDia = true;
      this.getEquipOptions();
    },
    handleSelectionChange (selection) {
      this.selectionRows = selection
    handleSelectionChange(selection) {
      this.selectionRows = selection;
    },
    // 赋值仪器编号
    changeMachineName() {
      this.deviceTraceabilityManagementDetails = []
      this.deviceTraceabilityManagementDetails = [];
      this.selectionRows.map(val => {
        this.deviceTraceabilityManagementDetails.push({deviceId: val.id,managementNumber: val.value, deviceName: val.label, specificationModel: val.specificationModel})
      })
      this.addEquipDia = false
      this.rowDrop()
        this.deviceTraceabilityManagementDetails.push({
          deviceId: val.id,
          managementNumber: val.value,
          deviceName: val.label,
          specificationModel: val.specificationModel
        });
      });
      this.addEquipDia = false;
      this.rowDrop();
    },
    rowDrop() {
      const that = this
      const that = this;
      const tbody = document.querySelector(
        '#templateParamTable .el-table__body-wrapper tbody'
      )
        "#templateParamTable .el-table__body-wrapper tbody"
      );
      if (!this.sortTable) {
        this.sortTable = Sortable.create(tbody, {
          animation: 200, //动画时长
          handle: ".el-table__row", //可拖拽区域class
          //拖拽中事件
          onMove: ({ dragged, related }) => {
            const oldRow = that.deviceTraceabilityManagementDetails[dragged.rowIndex] //旧位置数据
            const newRow = that.deviceTraceabilityManagementDetails[related.rowIndex] //被拖拽的新数据
            const oldRow =
              that.deviceTraceabilityManagementDetails[dragged.rowIndex]; //旧位置数据
            const newRow =
              that.deviceTraceabilityManagementDetails[related.rowIndex]; //被拖拽的新数据
          },
          //拖拽结束事件
          onEnd: evt => {
            const curRow = that.deviceTraceabilityManagementDetails.splice(evt.oldIndex, 1)[0];
            that.deviceTraceabilityManagementDetails.splice(evt.newIndex, 0, curRow);
            const curRow = that.deviceTraceabilityManagementDetails.splice(
              evt.oldIndex,
              1
            )[0];
            that.deviceTraceabilityManagementDetails.splice(
              evt.newIndex,
              0,
              curRow
            );
          }
        })
        });
      }
    },
    // 删除表格行
    deleteRow (index) {
      this.deviceTraceabilityManagementDetails.splice(index, 1)
    deleteRow(index) {
      this.deviceTraceabilityManagementDetails.splice(index, 1);
    },
    // 提交新增和修改
    submitForm() {
      this.form.deviceTraceabilityManagementDetails = this.HaveJson(this.deviceTraceabilityManagementDetails)
      this.submitFormLoading = true
      if (this.operationType === 'add') {
        this.$axios.post(this.$api.deviceTraceabilityManagement.addTraceabilityManagement,
          this.form, {
            headers: {
              'Content-Type': 'application/json'
            },
            noQs: true
          }).then(res => {
          if (res.code == 200) {
            this.$message.success('新增成功')
            this.applicationForm = false
            this.getYearTableDetailData()
          }
          this.submitFormLoading = false
        }).catch(err => {
          this.submitFormLoading = false
        })
      this.form.deviceTraceabilityManagementDetails = this.HaveJson(
        this.deviceTraceabilityManagementDetails
      );
      this.submitFormLoading = true;
      if (this.operationType === "add") {
        this.$axios
          .post(
            this.$api.deviceTraceabilityManagement.addTraceabilityManagement,
            this.form,
            {
              headers: {
                "Content-Type": "application/json"
              },
              noQs: true
            }
          )
          .then(res => {
            if (res.code == 200) {
              this.$message.success("新增成功");
              this.applicationForm = false;
              this.getYearTableDetailData();
            }
            this.submitFormLoading = false;
          })
          .catch(err => {
            this.submitFormLoading = false;
          });
      } else {
        this.$axios.post(this.$api.deviceTraceabilityManagement.updateTraceabilityManagement,
          this.form, {
            headers: {
              'Content-Type': 'application/json'
            },
            noQs: true
          }).then(res => {
          if (res.code == 200) {
            this.$message.success('修改成功')
            this.applicationForm = false
            this.getYearTableDetailData()
          }
          this.submitFormLoading = false
        }).catch(err => {
          this.submitFormLoading = false
        })
        this.$axios
          .post(
            this.$api.deviceTraceabilityManagement.updateTraceabilityManagement,
            this.form,
            {
              headers: {
                "Content-Type": "application/json"
              },
              noQs: true
            }
          )
          .then(res => {
            if (res.code == 200) {
              this.$message.success("修改成功");
              this.applicationForm = false;
              this.getYearTableDetailData();
            }
            this.submitFormLoading = false;
          })
          .catch(err => {
            this.submitFormLoading = false;
          });
      }
    },
    // 提交审核
@@ -307,106 +572,133 @@
      const params = {
        status: status,
        traceabilityManagementId: this.traceabilityManagementId
      }
      this.$axios.post(this.$api.deviceTraceabilityManagement.reviewTraceabilityManagementStatus,
        params, {
          headers: {
            'Content-Type': 'application/json'
          },
          noQs: true
        }).then(res => {
        if (res.code == 200) {
          this.$message.success('审核成功')
          this.applicationForm = false
          this.getYearTableDetailData()
        }
        this.submitFormLoading = false
      }).catch(err => {
        this.submitFormLoading = false
      })
      };
      this.$axios
        .post(
          this.$api.deviceTraceabilityManagement
            .reviewTraceabilityManagementStatus,
          params,
          {
            headers: {
              "Content-Type": "application/json"
            },
            noQs: true
          }
        )
        .then(res => {
          if (res.code == 200) {
            this.$message.success("审核成功");
            this.applicationForm = false;
            this.getYearTableDetailData();
          }
          this.submitFormLoading = false;
        })
        .catch(err => {
          this.submitFormLoading = false;
        });
    },
    closeDialog() {
      this.applicationForm = false
      this.getYearTableDetailData()
      this.applicationForm = false;
      this.getYearTableDetailData();
    },
    // 分页
    handleSizeChange1(val) {
      this.pagination1.size = val
      this.getYearTableDetailData()
      this.pagination1.size = val;
      this.getYearTableDetailData();
    },
    // 分页
    handleCurrentChange1(val) {
      this.pagination1.current = val
      this.getYearTableDetailData()
      this.pagination1.current = val;
      this.getYearTableDetailData();
    },
    handleDownOne(id) {
      this.outLoading = true
      this.$axios.get(this.$api.deviceTraceabilityManagement.exportDeviceTraceabilityManagement + '?traceabilityManagementId=' + id, {
        responseType: "blob"
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], {type: 'application/octet-stream'});
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '仪器设备量值溯源管理总体计划.doc';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '仪器设备量值溯源管理总体计划.doc';
            link.click();
            this.$message.success('导出成功')
      this.outLoading = true;
      this.$axios
        .get(
          this.$api.deviceTraceabilityManagement
            .exportDeviceTraceabilityManagement +
            "?traceabilityManagementId=" +
            id,
          {
            responseType: "blob"
          }
        }
      })
        )
        .then(res => {
          this.outLoading = false;
          const blob = new Blob([res], { type: "application/octet-stream" });
          //将Blob 对象转换成字符串
          let reader = new FileReader();
          reader.readAsText(blob, "utf-8");
          reader.onload = () => {
            try {
              let result = JSON.parse(reader.result);
              if (result.message) {
                this.$message.error(result.message);
              } else {
                const url = URL.createObjectURL(blob);
                const link = document.createElement("a");
                link.href = url;
                link.download = "仪器设备量值溯源管理总体计划.doc";
                link.click();
                this.$message.success("导出成功");
              }
            } catch (err) {
              console.log(err);
              const url = URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.href = url;
              link.download = "仪器设备量值溯源管理总体计划.doc";
              link.click();
              this.$message.success("导出成功");
            }
          };
        });
    },
    // 删除
    deleteFun(id) {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.get(this.$api.deviceTraceabilityManagement.deleteTraceabilityManagement + '?traceabilityManagementId=' + id).then(res => {
          this.$message.success('删除成功!');
          this.getYearTableDetailData();
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$axios
            .get(
              this.$api.deviceTraceabilityManagement
                .deleteTraceabilityManagement +
                "?traceabilityManagementId=" +
                id
            )
            .then(res => {
              this.$message.success("删除成功!");
              this.getYearTableDetailData();
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 获取所有设备
    getEquipOptions() {
      this.equipOptions = []
      this.$axios.get(this.$api.deviceScope.deviceScopeSearch + '?status=0').then(res => {
        if (res.code === 200 && res.data) {
          this.equipOptions = res.data.map(m => {
            m.value = m.managementNumber
            m.label = m.deviceName
            return m
          })
        }
      }).catch(error => {
        console.error(error)
      })
    },
      this.equipOptions = [];
      this.$axios
        .get(this.$api.deviceScope.deviceScopeSearch + "?status=0")
        .then(res => {
          if (res.code === 200 && res.data) {
            this.equipOptions = res.data.map(m => {
              m.value = m.managementNumber;
              m.label = m.deviceName;
              return m;
            });
          }
        })
        .catch(error => {
          console.error(error);
        });
    }
  },
  watch: {
    // 监听点击el-tree的数据,进行数据刷新
@@ -414,9 +706,9 @@
      if (newVal.value) {
        this.getYearTableDetailData();
      }
    },
    }
  }
}
};
</script>
<style scoped>