liding
2026-09-20 2b2fa317c30ee2de7a8b6f5fc964532031adea66
src/views/business/reportPreparation/index.vue
@@ -53,22 +53,31 @@
            :auto-upload="true" :before-upload="fileBeforeUpload1" :headers="uploadHeader" :on-error="onError1"
            :on-success="handleSuccessUp1" :show-file-list="false" accept='.doc,.docx'>
            <el-button size="small" type="text"
              :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName">上传</el-button>
                       :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName">上传
            </el-button>
          </el-upload>
<!--          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"-->
<!--            @click="handleRestore(scope.row)">还原</el-button>-->
          <el-button type="text" size="small" @click="sendBackTask(scope.row)">退回任务</el-button>
          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"
            @click="sendBackTask(scope.row)">退回任务</el-button>
          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"
            @click="handle(scope.row)">提交</el-button>
                     @click="handle(scope.row)">提交
          </el-button>
          <el-button type="text" size="small"
            :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 1 || nickName !== scope.row.examineUser"
            @click="handleIssued(scope.row)">审核</el-button>
                     @click="handleIssued(scope.row)">审核
          </el-button>
          <el-button type="text" size="small"
            :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 0 || scope.row.isExamine == null || scope.row.isRatify == 1 || nickName !== scope.row.ratifyUser"
            @click="handleApprove(scope.row)">批准</el-button>
                     @click="handleApprove(scope.row)">批准
          </el-button>
          <el-button style="margin-left: 10px" type="text" size="small"
                     :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">下载</el-button>
                     :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">下载
          </el-button>
          <el-button type="text" size="small"
                     :loading="regeneratingReportId === scope.row.id"
                     :disabled="regeneratingReportId === scope.row.id"
                     @click="handleRegenerate(scope.row)">重新生成
          </el-button>
          <el-button type="text" size="small" @click="viewInspectInfo(scope.row)">原始记录</el-button>
          <el-button type="text" size="small" @click="handleFileLook(scope.row)">附件上传</el-button>
        </div>
@@ -105,7 +114,9 @@
    <el-dialog :modal-append-to-body="false" :visible.sync="issuedReasonVisible" title="不通过原因" width="400px">
      <div class="search_thing">
        <div class="search_label">不通过原因:</div>
        <div class="search_input"><el-input v-model="reason" clearable placeholder="请输入" size="small"></el-input></div>
        <div class="search_input">
          <el-input v-model="reason" clearable placeholder="请输入" size="small"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button :disabled="loadingIssuedReason" @click="issuedReasonVisible = false">取消</el-button>
@@ -130,7 +141,9 @@
    <el-dialog :modal-append-to-body="false" :visible.sync="approveReasonVisible" title="不批准原因" width="400px">
      <div class="search_thing">
        <div class="search_label">不批准原因:</div>
        <div class="search_input"><el-input v-model="reason" clearable placeholder="请输入" size="small"></el-input></div>
        <div class="search_input">
          <el-input v-model="reason" clearable placeholder="请输入" size="small"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button :disabled="loadingApproveReason" @click="approveReasonVisible = false">取消</el-button>
@@ -189,12 +202,30 @@
        <el-upload ref='upload' :action="fileAction" :auto-upload="true" :before-upload="fileBeforeUpload"
          :data="{ orderId: filesLookInfo.insOrderId }" :headers="uploadHeader" :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;">
                   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>
      <lims-table :tableData="tableDataFile" :column="columnFile" height="600px"
        key="tableDataFile" :tableLoading="tableLoadingFile"></lims-table>
    </el-dialog>
    <el-dialog title="选择下载报告" :visible.sync="downloadDialogVisible" width="400px"
               :close-on-click-modal="false" @closed="closeDownloadDialog">
      <el-form label-width="90px">
        <el-form-item label="报告类型:">
          <el-radio-group v-model="selectedReportType">
            <el-radio :label="0">检测报告</el-radio>
            <el-radio :label="1" :disabled="!downloadRow || !downloadRow.inspectionUrl">检验报告</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="downloadDialogVisible = false">取 消</el-button>
        <el-button type="primary" :loading="downloadingReportType !== null"
                   :disabled="selectedReportType === null || downloadingReportType !== null"
                   @click="downloadSelectedReport(selectedReportType)">下 载</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -207,6 +238,7 @@
  downloadReport,
  examineReport,
  pageInsReport,
  regenerateReport,
  ratifyReport,
  sendBackTask,
  upReportUrl,
@@ -217,6 +249,7 @@
import { selectUserCondition } from "@/api/business/inspectionTask";
import limsTable from "@/components/Table/lims-table.vue";
import {delFile, downFile, getFileList} from "@/api/business/rawMaterialOrder";
export default {
  name: 'ReportPreparation',
  components: { limsTable, onlyoffice },
@@ -255,6 +288,11 @@
      mutiList: [],
      outLoading: false,
      outExportLoading: false,
      regeneratingReportId: null,
      downloadDialogVisible: false,
      downloadRow: null,
      selectedReportType: 0,
      downloadingReportType: null,
      inLoading: false,
      addApproverDia: false, // 指定审批人员弹框
      approver: '', // 审批人员
@@ -492,7 +530,7 @@
          fixed: "right",
          dataType: "slot",
          slot: "action",
          width: '360px',
          width: '440px',
          label: "操作"
        }
      ],
@@ -749,7 +787,28 @@
      }
    },
    download(row) {
      downloadReport(row.id).then(res => {
      this.downloadRow = row
      // 历史数据只有检测报告:直接按检测报告下载,保持原有操作习惯。
      if (!row.inspectionUrl) {
        this.downloadSelectedReport(0)
        return
      }
      this.selectedReportType = 0
      this.downloadDialogVisible = true
    },
    closeDownloadDialog() {
      if (this.downloadingReportType === null) {
        this.downloadRow = null
        this.selectedReportType = 0
      }
    },
    downloadSelectedReport(reportType) {
      if (!this.downloadRow) {
        return
      }
      const row = this.downloadRow
      this.downloadingReportType = reportType
      downloadReport(row.id, reportType).then(res => {
        if (res.type && res.type.includes('application/json')) {
          const reader = new FileReader()
          reader.onload = () => {
@@ -762,11 +821,33 @@
          reader.readAsText(res)
          return
        }
        const reportUrl = row.urlS || row.url || ''
        const reportUrl = reportType === 1 ? row.inspectionUrl : (row.urlS || row.url || '')
        const filename = decodeURIComponent(reportUrl.substring(reportUrl.lastIndexOf('/') + 1)) || `${row.code}.docx`
        this.$download.saveAs(res, filename)
        this.downloadDialogVisible = false
      }).catch(() => {
        this.$message.error('报告下载失败')
      }).finally(() => {
        this.downloadingReportType = null
        if (!this.downloadDialogVisible) {
          this.downloadRow = null
        }
      })
    },
    handleRegenerate(row) {
      this.$confirm('将根据当前原始记录重新生成并覆盖系统报告,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.regeneratingReportId = row.id
        return regenerateReport(row.id).then(() => {
          this.$message.success('报告重新生成成功')
          this.refreshTable()
        }).finally(() => {
          this.regeneratingReportId = null
        })
      }).catch(() => {
      })
    },
    // 还原操作