lxp
2025-03-12 952a20f1c005d80e9bf881287c40e6f4e4266a0b
src/views/CNAS/resourceDemand/device/component/check-and-accept.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,934 @@
<!-- è®¾å¤‡éªŒæ”¶ -->
<template>
  <div>
    <div class="search">
      <div class="search_thing">
        <div class="search_label">流程编号:</div>
        <div class="search_input"><el-input v-model="search.processNumber" clearable placeholder="请输入" size="small"
            @keyup.enter.native="getDeviceAList(clickNodeVal.value)"></el-input></div>
      </div>
      <div class="search_thing" style="padding-left: 30px;">
        <el-button size="small" @click="resetSearch">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="getDeviceAList(clickNodeVal.value)">查 è¯¢</el-button>
      </div>
      <div class="btns">
        <el-button size="small" type="primary" @click="dialogVisible = true">添加验收</el-button>
        <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">导出</el-button>
      </div>
    </div>
    <div class="tables" style="margin-top: 10px;">
      <el-table ref="table" :data="tableDataAlist" height="100%" v-loading="tableLoading">
        <el-table-column label="序号" type="index" width="60">
          <template v-slot="scope">
            <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column label="流程编号" min-width="150" prop="processNumber" show-overflow-tooltip/>
        <el-table-column label="设备名称" min-width="140" prop="deviceName" show-overflow-tooltip/>
        <el-table-column label="管理编号" min-width="140" prop="managementNumber" show-overflow-tooltip/>
        <el-table-column label="序列号" min-width="80" prop="serialNumber" />
        <el-table-column label="提交者" min-width="100" prop="submitUser" />
        <el-table-column label="提交日期" min-width="150" prop="createTime" />
        <el-table-column label="当前状态" min-width="140" prop="currentState" />
        <el-table-column label="当前负责人" min-width="120" prop="currentResponsible" />
        <el-table-column fixed="right" label="操作" min-width="140">
          <template #default="{ row }">
            <el-button size="small" type="text" @click="handleAttachmentClick(row)">附件</el-button>
            <el-button size="small" type="text" @click="handleViewClick(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" @size-change="handleSizeChange"
        @current-change="handleCurrentChange">
      </el-pagination>
    </div>
    <!-- æ·»åŠ è®¾å¤‡æ•…éšœè®°å½• -->
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="仪器设备验收记录"
      width="60%" @open="openRecordAcceptance">
      <el-steps :active="currentStep" finish-status="success">
        <el-step v-for="(v, i) in steps" :key="i" :title="v" style="cursor:pointer"
          @click.native="choiceStep(i)"></el-step>
      </el-steps>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <div v-show="currentStepClick === 0">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <!-- æ–°å¢žè®¾å¤‡äº‹è®°å½•卡片 -->
            <el-row>
              <el-col :span="24">
                <el-form-item label="流程编号:" prop="processNumber">
                  <el-input v-model="form.processNumber" disabled size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="设备名称:">
                  <el-input v-model="form.deviceName" disabled size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="生产厂家:">
                  <el-input v-model="form.manufacturer" disabled size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="设备型号:">
                  <el-input v-model="form.specificationModel" disabled size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="管理编号:">
                  <el-input v-model="form.managementNumber" disabled size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item :rules="[{ required: currentStep === 0, message: '请输入序列号', trigger: 'blur' }]" label="序列号:"
                  prop="serialNumber">
                  <el-input v-model="form.serialNumber" :disabled="currentStep !== 0" size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item :rules="[{ required: currentStep === 0, message: '请输入设备类别', trigger: 'change' }]" label="设备类别:"
                  prop="deviceClass">
                  <el-radio-group v-model="form.deviceClass" :disabled="currentStep !== 0">
                    <el-radio label="0precision">精密型设备</el-radio>
                    <el-radio label="1conventional">常规设备</el-radio><br />
                    <el-radio label="2auxiliary_class">辅助类设备</el-radio>
                    <el-radio label="4environmental">环境类设备</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 0, message: '请输入开箱前检查外包装有无破损', trigger: 'blur' }]" label="开箱前检查外包装有无破损:" label-width="220px"
                  prop="checkOuterPackaging">
                  <el-input v-model="form.checkOuterPackaging" :disabled="currentStep !== 0" size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="相关附件:" prop="fileName">
                  <el-input v-model="form.fileName" :style="`width: ${currentStep == 0 ? '88%' : '100%'};`" disabled
                    size="small">
                    <el-button v-if="currentStep === 0" slot="append" icon="el-icon-delete-solid"
                      @click="deleteFile"></el-button>
                  </el-input>
                  <el-upload ref="upload" :action="action" :on-success="onSuccess" :show-file-list="false"
                    style="float: right;">
                    <el-button v-if="currentStep === 0" slot="trigger" class="uploadFile" 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 :rules="[{ required: currentStep === 0, message: '请选择下环节责任人', trigger: 'change' }]" label="下环节责任人:"
                  prop="submitNextPesponsible">
                  <el-select v-model="form.submitNextPesponsible" :disabled="currentStep !== 0" clearable filterable
                    placeholder="请选择下环节负责人" size="small" style="width: 50%;">
                    <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 :rules="[{ required: currentStep === 0, message: '请输入设备开箱验收结论', trigger: 'change' }]" label="设备开箱验收结论:" label-width="150px"
                  prop="unpackingAcceptanceConclusion">
                  <el-radio-group v-model="form.unpackingAcceptanceConclusion" :disabled="currentStep !== 0">
                    <el-radio :label="'0qualified'">合格</el-radio>
                    <el-radio :label="'1unqualified'">不合格,缺少备件供应商补发</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <div style="margin-bottom: 20px; width: 100%;">
                  <label>备件确认:</label>
                  <el-button v-if="currentStep === 0" size="small" style="float: right;"
                    type="primary" @click="addTableRow('sparePartsConfirmationList')">增加行</el-button>
                </div>
                <el-table :data="form.sparePartsConfirmationList" border stripe style="width: 100%; min-height: 30vh">
                  <el-table-column label="序号" prop="序号" type="index" width="80" />
                  <el-table-column label="名称" min-width="120" prop="name">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 0" v-model="scope.row.name" size="small"></el-input>
                      <label v-else>{{ scope.row.name }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column label="数量" min-width="120" prop="number">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 0" v-model="scope.row.number" size="small"></el-input>
                      <label v-else>{{ scope.row.number }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" min-width="120" prop="note">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 0" v-model="scope.row.note" size="small"></el-input>
                      <label v-else>{{ scope.row.note }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="currentStep === 0" fixed="right" label="操作" width="90">
                    <template slot-scope="scope">
                      <el-button icon="el-icon-delete" type="text"
                        @click="deleteRow(scope.$index, scope.row, 'sparePartsConfirmationList')">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
              <el-col :span="24">
                <div style="margin: 20px 0; width: 100%;">
                  <label>文件类确认:</label>
                  <el-button v-if="currentStep === 0" size="small" style="float: right;"
                    type="primary" @click="addTableRow('fileClassConfirmationList')">增加行</el-button>
                </div>
                <el-table :data="form.fileClassConfirmationList" border stripe style="width: 100%; min-height: 30vh">
                  <el-table-column label="序号" prop="序号" type="index" width="80" />
                  <el-table-column label="应有册数" min-width="120" prop="expectedCopies">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 0" v-model="scope.row.expectedCopies" size="small"></el-input>
                      <label v-else>{{ scope.row.expectedCopies }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column label="实际收到册数" min-width="120" prop="actualCopies">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 0" v-model="scope.row.actualCopies" size="small"></el-input>
                      <label v-else>{{ scope.row.actualCopies }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="currentStep === 0" fixed="right" label="操作" width="90">
                    <template v-slot="scope">
                      <el-button icon="el-icon-delete" type="text"
                        @click="deleteRow(scope.$index, scope.row, 'fileClassConfirmationList')">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
              <el-col :span="24" style="margin-top: 10px;">
                <el-form-item label="备注:" label-width="90px">
                  <el-input v-model="form.submitRemarks" :disabled="currentStep !== 0" size="small"
                    type="textarea"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.submitOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.submitDate }}
            </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 1">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <el-row>
              <el-col :span="24">
                <el-form-item label="复核意见:" prop="accidentDescription">
                  <el-input v-model="form.unpackingReviewOpinion" :disabled="currentStep !== 1" size="small"
                    type="textarea"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 1, message: '请输入下环节责任人', trigger: 'change' }]" label="下环节责任人:"
                  prop="unpackingNextPesponsible">
                  <el-select v-model="form.unpackingNextPesponsible" :disabled="currentStep !== 1" clearable filterable
                    placeholder="请选择下环节负责人" size="small" style="width: 50%;">
                    <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-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.unpackingOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.unpackingDate }}
            </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 2">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <el-row>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 2, message: '请输入安装位置', trigger: 'blur' }]" label="安装位置:"
                  prop="installLocation">
                  <el-input v-model="form.installLocation" :disabled="currentStep !== 2" clearable placeholder="请输入安装位置"
                    size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="备注:">
                  <el-input v-model="form.installRemarks" :disabled="currentStep !== 2" size="small"
                    type="textarea"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 2, message: '请输入下环节责任人', trigger: 'blur' }]" label="下环节责任人:"
                  prop="installNextPesponsible">
                  <el-select v-model="form.installNextPesponsible" :disabled="currentStep !== 2" clearable filterable
                    placeholder="请选择下环节负责人" size="small" style="width: 50%;">
                    <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">
                <div style="margin-bottom: 20px; width: 100%;">
                  <label>安装验收记录</label>
                  <el-button v-if="currentStep === 2" size="small" style="float: right;"
                    type="primary" @click="addTableRow('installationAcceptanceRecordList')">增加行</el-button>
                </div>
                <el-table :data="form.installationAcceptanceRecordList" border stripe
                  style="width: 100%; min-height: 30vh">
                  <el-table-column label="序号" prop="序号" type="index" width="80" />
                  <el-table-column label="项目" min-width="120" prop="installationProject">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 2" v-model="scope.row.installationProject"
                        size="small"></el-input>
                      <label v-else>{{ scope.row.installationProject }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column label="安装情况" min-width="120" prop="installationSituation">
                    <template v-slot="scope">
                      <el-input v-if="currentStep === 2" v-model="scope.row.installationSituation"
                        size="small"></el-input>
                      <label v-else>{{ scope.row.installationSituation }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column label="安装完成" min-width="120" prop="installationCompleted">
                    <template v-slot="scope">
                      <el-select v-if="currentStep === 2" v-model="scope.row.installationCompleted" placeholder="请选择">
                        <el-option label="是" value="0yes"></el-option>
                        <el-option label="否" value="1no"></el-option>
                      </el-select>
                      <label v-else>{{ scope.row.installationCompleted === '0yes' ? '是' :
                        scope.row.installationCompleted === '1no' ? '否' : '' }}</label>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="currentStep === 2" fixed="right" label="操作" width="90">
                    <template slot-scope="scope">
                      <el-button icon="el-icon-delete" type="text"
                        @click="deleteRow(scope.$index, scope.row, 'installationAcceptanceRecordList')">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
            </el-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.installOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.installDate }}
            </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 3">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <el-row>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 3, message: '请输入复合意见', trigger: 'blur' }]" label="复合意见:"
                  prop="installationAcceptanceCompoundOpinion">
                  <el-input v-model="form.installationAcceptanceCompoundOpinion" :disabled="currentStep !== 3"
                    size="small" type="textarea"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 3, message: '请输入下环节负责人', trigger: 'change' }]" label="下环节责任人:"
                  prop="installationAcceptanceNextPesponsible">
                  <el-select v-model="form.installationAcceptanceNextPesponsible" :disabled="currentStep !== 3" clearable
                    filterable placeholder="请选择下环节负责人" size="small" style="width: 50%;">
                    <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-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.installationAcceptanceOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.installationAcceptanceDate }}
            </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 4">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <div style="margin-bottom: 20px; width: 100%;">
              <label>验收核查记录:</label>
              <el-button v-if="currentStep === 4" size="small" style="float: right;"
                type="primary" @click="addTableRow('acceptanceCheckRecordList')">增加行</el-button>
            </div>
            <el-table :data="form.acceptanceCheckRecordList" border style="width: 100%; min-height: 30vh">
              <el-table-column label="序号" prop="sequence" width="80">
              </el-table-column>
              <el-table-column label="仪器模块" min-width="120" prop="instrumentModule">
                <template v-slot="scope">
                  <el-input v-if="currentStep === 4" v-model="scope.row.instrumentModule" size="small"></el-input>
                  <label v-else>{{ scope.row.instrumentModule }}</label>
                </template>
              </el-table-column>
              <el-table-column label="核查参数" min-width="120" prop="verificationParameter">
                <template v-slot="scope">
                  <el-input v-if="currentStep === 4" v-model="scope.row.verificationParameter" size="small"></el-input>
                  <label v-else>{{ scope.row.verificationParameter }}</label>
                </template>
              </el-table-column>
              <el-table-column label="可接收限" min-width="120" prop="acceptableLimit">
                <template v-slot="scope">
                  <el-input v-if="currentStep === 4" v-model="scope.row.acceptableLimit" size="small"></el-input>
                  <label v-else>{{ scope.row.acceptableLimit }}</label>
                </template>
              </el-table-column>
              <el-table-column label="核查结果" min-width="120" prop="verificationResult">
                <template v-slot="scope">
                  <el-input v-if="currentStep === 4" v-model="scope.row.verificationResult" size="small"></el-input>
                  <label v-else>{{ scope.row.verificationResult }}</label>
                </template>
              </el-table-column>
              <el-table-column label="核查结论" min-width="120" prop="verificationConclusion">
                <template v-slot="scope">
                  <el-select v-if="currentStep === 4" v-model="scope.row.verificationConclusion" placeholder="请选择">
                    <el-option label="符合" value="0accordWith"></el-option>
                    <el-option label="不符合" value="1inconformity"></el-option>
                  </el-select>
                  <label v-else>{{ scope.row.verificationConclusion }}</label>
                </template>
              </el-table-column>
              <el-table-column v-if="currentStep === 4" fixed="right" label="操作" width="90">
                <template slot-scope="scope">
                  <el-button size="small" type="text"
                    @click="deleteRow(scope.$index, scope.row, 'acceptanceCheckRecordList')">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-form-item :rules="[{ required: currentStep === 4, message: '请输入设备开箱验收结论', trigger: 'change' }]" label="设备开箱验收结论:"
              label-width="150px" prop="acceptanceCheckUnpackingConclusion">
              <el-radio-group v-model="form.acceptanceCheckUnpackingConclusion" :disabled="currentStep !== 4">
                <el-radio :label="'0qualified'">合格</el-radio>
                <el-radio :label="'1unqualified'">不合格,缺少备件供应商补发</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item :rules="[{ required: currentStep === 4, message: '请输入下环节责任人', trigger: 'change' }]" label="下环节责任人:"
              prop="acceptanceCheckNextPesponsible">
              <el-select v-model="form.acceptanceCheckNextPesponsible" :disabled="currentStep !== 4" clearable
                filterable placeholder="请选择下环节负责人" size="small" style="width: 50%;">
                <el-option v-for="item in responsibleOptions" :key="item.value" :label="item.label" :value="item.name">
                </el-option>
              </el-select>
            </el-form-item>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.acceptanceCheckOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.acceptanceCheckDate }}
            </el-col>
          </el-row>
        </div>
        <div v-show="currentStepClick === 5">
          <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;">
            <el-row>
              <el-col :span="24">
                <el-form-item :rules="[{ required: currentStep === 5, message: '请输入审核意见', trigger: 'blur' }]" label="审核意见:"
                  prop="acceptanceAuditAuditOpinion">
                  <el-input v-model="form.acceptanceAuditAuditOpinion" :disabled="currentStep !== 5" size="small"
                    type="textarea"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
          <el-row style="margin-top: 1em;">
            <el-col :span="4">
              æ“ä½œäººï¼š{{ form.acceptanceAuditOperatingPersonnel }}
            </el-col>
            <el-col :span="6">
              æ—¥æœŸï¼š{{ form.acceptanceAuditDate }}
            </el-col>
          </el-row>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button v-if="currentStep !== 0 && currentStep !== 6" @click="submitForm('3reject')">驳回</el-button>
        <el-button v-if="currentStep === 0" @click="submitForm('2save')">保存</el-button>
        <el-button v-if="currentStep !== 6" type="primary" @click="submitForm('1submit')">{{ currentStep === 0 ? '提交' :
          '通过'
          }}</el-button>
      </span>
    </el-dialog>
  </div>
  <!-- æŸ¥å•编辑框 -->
</template>
<script>
import { dateFormat } from '@/utils/date'
import file from "@/utils/file";
import {
  deleteCNASFile, deleteIncidentReport,
  deleteIncidentReportAll, getShowIncidentReport, incidentReportExport, incidentReportPage,
  saveIncidentReportData,
  selectDeviceByCode
} from "@/api/cnas/resourceDemand/device";
import {selectUserCondition} from "@/api/system/user";
import {mapGetters} from "vuex";
export default {
  props: {
    clickNodeVal: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      //事故设备信息
      tableDataAlist: [], // æ›´æ”¹å˜é‡åç§°
      tableLoading: false,
      dialogVisible: false,
      rules: {
        quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }],
      },
      currentStep: 0, // æ­¥éª¤æ¡æ˜¾ç¤ºç¬¬å‡ æ­¥
      currentStepClick: 0, // ç‚¹å‡»æ­¥éª¤æ¡å˜åŒ–
      steps: ['提交', '开箱验收复核', '安装验收检查', '安装验收复核', '验收核查', '验收核查审核'],
      form: {
        sparePartsConfirmationList: [], // å¤‡ä»¶ç¡®è®¤List
        fileClassConfirmationList: [], // æ–‡ä»¶ç¡®è®¤List
        installationAcceptanceRecordList: [], // å®‰è£…验收记录
        acceptanceCheckRecordList: [], // éªŒæ”¶æ ¸æŸ¥è®°å½•
        fileName: '', // æ–‡ä»¶åç§°
        systemFileName: '', // ç³»ç»Ÿæ–‡ä»¶åç§°
      },
      outLoading: false,
      responsibleOptions: [], // ä¸‹çŽ¯èŠ‚è´Ÿè´£äººlist
      isUpdate: false,
      search: {
        size: 20,
        current: 1,
        total: 0,
        processNumber: '',
      },
    }
  },
  computed: {
    action() {
      return this.javaApi + '/personBasicInfo/saveCNASFile'
    },
    ...mapGetters(["nickName"]),
  },
  mounted() {
    // èŽ·å–è®¾å¤‡äº‹æ•…ä¿¡æ¯
    this.getDeviceAList(this.clickNodeVal.value);
    window.excelClosed = this.closed
  },
  methods: {
    handleSizeChange(val) {
      this.search.size = val
      this.getDeviceAList(this.clickNodeVal.value);
    },
    handleCurrentChange(val) {
      this.search.current = val
      this.getDeviceAList(this.clickNodeVal.value);
    },
    deleteFile() {
      this.$confirm('此操作将永久删除该文件, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteCNASFile({fileName: this.form.systemFileName}).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功!')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    onSuccess(response, file, fileList) {
      if (response.code == 200) {
        // åœ¨ä¿å­˜èµ‹å€¼æ–°æ–‡ä»¶
        this.form.fileName = file.name
        this.form.systemFileName = response.data
      } else {
        this.$message.error(response.message)
      }
    },
    addTableRow(value) {
      switch (value) {
        // å¤‡ä»¶ç¡®è®¤
        case 'sparePartsConfirmationList':
          const obj = Object.assign({
            name: '',
            number: null,
            note: ''
          })
          this.form.sparePartsConfirmationList.push(obj)
          break
        // æ–‡ä»¶ç¡®è®¤List
        case 'fileClassConfirmationList':
          const obj1 = Object.assign({
            expectedCopies: '',
            actualCopies: '',
          })
          this.form.fileClassConfirmationList.push(obj1)
          break
        // å®‰è£…验收记录
        case 'installationAcceptanceRecordList':
          const obj2 = Object.assign({
            installationProject: '',
            installationSituation: '',
            installationCompleted: ''
          })
          this.form.installationAcceptanceRecordList.push(obj2)
          break
        // éªŒæ”¶æ ¸æŸ¥è®°å½•
        case 'acceptanceCheckRecordList':
          const obj3 = Object.assign({
            instrumentModule: '',
            verificationParameter: '',
            acceptableLimit: '',
            verificationResult: '',
            verificationConclusion: ''
          })
          this.form.acceptanceCheckRecordList.push(obj3)
        default:
          break
      }
    },
    deleteRow(index, row, type) {
      switch (type) {
        // å¤‡ä»¶ç¡®è®¤
        case 'sparePartsConfirmationList':
          if (row.sparePartsId) {
            deleteIncidentReportAll({sparePartsId: row.sparePartsId}).then(res => { });
          }
          this.form.sparePartsConfirmationList.splice(index, 1)
          this.$message.success('删除成功!')
          break
        // æ–‡ä»¶ç¡®è®¤List
        case 'fileClassConfirmationList':
          if (row.fileId) {
            deleteIncidentReportAll({fileId: row.fileId}).then(res => { });
          }
          this.form.fileClassConfirmationList.splice(index, 1)
          this.$message.success('删除成功!')
          break
        // å®‰è£…验收记录
        case 'installationAcceptanceRecordList':
          if (row.installId) {
            deleteIncidentReportAll({installId: row.installId}).then(res => { });
          }
          this.form.installationAcceptanceRecordList.splice(index, 1)
          this.$message.success('删除成功!')
          break
        // éªŒæ”¶æ ¸æŸ¥è®°å½•
        case 'acceptanceCheckRecordList':
          if (row.acceptanceCheckId) {
            deleteIncidentReportAll({acceptanceCheckId: row.acceptanceCheckId}).then(res => { });
          }
          this.form.acceptanceCheckRecordList.splice(index, 1)
          this.$message.success('删除成功!')
        default:
          break
      }
    },
    choiceStep(index) {
      this.currentStepClick = index
    },
    openRecordAcceptance() {
      // èŽ·å–è®¾å¤‡åŸºç¡€ä¿¡æ¯
      selectDeviceByCode({id: this.clickNodeVal.value}).then(res => {
        this.form.deviceName = res.data.deviceName
        this.form.manufacturer = res.data.manufacturer
        this.form.specificationModel = res.data.specificationModel
        this.form.managementNumber = res.data.managementNumber
        this.$nextTick(() => {
          this.$refs['form'].clearValidate()
        })
      });
      // èŽ·å–è´Ÿè´£äººä¿¡æ¯
      this.getUserList()
    },
    //提交表单
    async submitForm(saveState) {
      this.$refs.form.validate((valid) => {
        if (valid === true || saveState !== '1submit') {
          // ç»™å½“前环节设置创建人与时间
          const dateTime = dateFormat(new Date())
          // èŽ·å–å½“å‰çŽ¯èŠ‚æ“ä½œäººä¸Žæ—¥æœŸ
          switch (this.currentStep) {
            case 0:
              this.form.submitOperatingPersonnel = this.nickName
              this.form.submitDate = dateTime
              break
            case 1:
              this.form.unpackingOperatingPersonnel = this.nickName
              this.form.unpackingDate = dateTime
              break
            case 2:
              this.form.installOperatingPersonnel = this.nickName
              this.form.installDate = dateTime
              break
            case 3:
              this.form.installationAcceptanceOperatingPersonnel = this.nickName
              this.form.installationAcceptanceDate = dateTime
              break
            case 4:
              this.form.acceptanceCheckOperatingPersonnel = this.nickName
              this.form.acceptanceCheckDate = dateTime
              break
            case 5:
              this.form.acceptanceAuditOperatingPersonnel = this.nickName
              this.form.acceptanceAuditDate = dateTime
              break
            default:
              break
          }
          // èŽ·å–å½“å‰çŽ¯èŠ‚è´Ÿè´£äºº
          switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) {
            case 0:
              this.form.currentResponsible = this.form.submitNextPesponsible
              break
            case 1:
              this.form.currentResponsible = this.form.unpackingNextPesponsible
              break
            case 2:
              this.form.currentResponsible = this.form.installNextPesponsible
              break
            case 3:
              this.form.currentResponsible = this.form.installationAcceptanceNextPesponsible
              break
            case 4:
              this.form.currentResponsible = this.form.acceptanceCheckNextPesponsible
              break
            default:
              break
          }
          let currentStepAction;
          // è®¾ç½®è¯¥æ“ä½œåˆ¤æ–­æ˜¯å¦ä¸ºæäº¤ï¼Œä¿å­˜ï¼Œé©³å›žï¼Œé€šè¿‡
          switch (saveState) {
            // æäº¤ï¼Œé€šè¿‡
            case '1submit':
              currentStepAction = this.currentStep + 1
              break
            // ä¿å­˜
            case '2save':
              currentStepAction = this.currentStep
              break
            // é©³å›ž
            case '3reject':
              currentStepAction = this.currentStep - 1
              break
            default:
              break
          }
          // èŽ·å–å½“å‰çŠ¶æ€
          this.form.currentState = currentStepAction === 6 ? '关闭' : this.steps[currentStepAction]
          this.form.deviceId = this.clickNodeVal.value
          saveIncidentReportData(this.form).then(res => {
            if (res.code == 200) {
              this.$message.success('提交成功')
              this.getDeviceAList(this.clickNodeVal.value);
              this.dialogVisible = false
            }
          })
        } else {
          let step = this.steps[this.currentStep]
          this.$message.warning(step + '  æµç¨‹ä¸­æœ‰å¿…填项未填!');
        }
      });
    },
    // èŽ·å–è´Ÿè´£äººä¿¡æ¯æŽ¥å£
    getUserList() {
      selectUserCondition().then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      })
    },
    resetSearch() {
      this.search = {
        size: 20,
          current: 1,
          total: 0,
          processNumber: '',
      }
      this.getDeviceAList(this.clickNodeVal.value);
    },
    // èŽ·å–è®¾å¤‡äº‹æ•…ä¿¡æ¯(根据从vuex中获取到的设备名称id进行数据查询)
    getDeviceAList(deviceId) {
      this.tableLoading = true
      incidentReportPage({deviceId: deviceId, size:this.search.size, current:this.search.current, processNumber: this.search.processNumber}).then(res => {
        this.tableLoading = false
        if (res.code == 200) {
          this.tableDataAlist = res.data.records
          this.search.total = res.data.total
        }
      }).catch(err => {
        this.tableLoading = false
      })
    },
    //table äº‹ä»¶å¤„理开始处
    // ä¸‹è½½é™„ä»¶
    handleAttachmentClick(row) {
      this.$download.saveAs(row.systemFileName, row.fileName)
    },
    handleViewClick(row) {
      getShowIncidentReport({id: row.id}).then(res => {
        this.form = { ...res.data }
        // å¦‚果索引为6表示全部通过
        this.currentStep = this.steps.indexOf(this.form.currentState) === -1 ? 6 : this.steps.indexOf(this.form.currentState)
        this.currentStepClick = this.currentStep === 6 ? 0 : this.currentStep
        this.$nextTick(() => {
          this.$refs['form'].clearValidate()
        })
      })
      this.dialogVisible = true
    },
    handleDeleteClick(row) {
      this.$confirm('此操作将删除该数据, æ˜¯å¦ç»§ç»­?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteIncidentReport({id: row.id}).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功')
            this.getDeviceAList(this.clickNodeVal.value);
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    //导出
    handleDown() {
      this.outLoading = true
      incidentReportExport({deviceId: this.clickNodeVal.value}).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '设备验收.xlsx')
      })
    },
  },
  watch: {
    // ç›‘听点击el-tree的数据,进行数据刷新
    clickNodeVal(newVal) {
      if (newVal.value) {
        this.getDeviceAList(newVal.value);
      }
    },
    dialogVisible(newVal) {
      if (!newVal) {
        this.form = {
          sparePartsConfirmationList: [], // å¤‡ä»¶ç¡®è®¤List
          fileClassConfirmationList: [], // æ–‡ä»¶ç¡®è®¤List
          installationAcceptanceRecordList: [], // å®‰è£…验收记录
          acceptanceCheckRecordList: [], // éªŒæ”¶æ ¸æŸ¥è®°å½•
          fileName: '', // æ–‡ä»¶åç§°
          systemFileName: '', // ç³»ç»Ÿæ–‡ä»¶åç§°
        }
        this.currentStep = 0 // æ­¥éª¤æ¡æ˜¾ç¤ºç¬¬å‡ æ­¥
        this.currentStepClick = 0 // ç‚¹å‡»æ­¥éª¤æ¡å˜åŒ–
        this.$refs['form'].clearValidate()
      }
    }
  }
}
function downloadImage(url) {
  const link = document.createElement('a');
  link.href = url;
  link.download = 'attachment.jpg'; // æ–‡ä»¶å
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
}
</script>
<style scoped>
>>>.el-radio {
  color: #606266;
  font-weight: 500;
  cursor: pointer;
  margin-right: 0px;
  width: 10em;
}
.tables {
  width: 100%;
  height: calc(100vh - 17em);
}
.search {
  margin-top: 10px;
  background-color: #fff;
  height: 40px;
  display: flex;
  align-items: center;
  position: relative;
}
.search_thing {
  display: flex;
  align-items: center;
  height: 40px;
}
.search_label {
  font-size: 14px;
  text-align: right;
}
.search_input {
  width: calc(100% - 120px);
}
.btns {
  position: absolute;
  right: 0px;
  top: 40%;
  transform: translate(0, -50%);
  /* text-align: right; */
}
.search_thing {
  display: flex;
  margin-bottom: 10px;
}
.search_label {
  /* width: 150px; */
  text-align: right;
  padding-right: 10px;
}
.search_input {
  flex-grow: 1;
}
.line {
  width: 20px;
  height: 1px;
  background-color: #ccc;
  display: inline-block;
  margin-right: 10px;
}
.form .search_label {
  width: 120px;
}
</style>