spring
2025-03-03 f01d916828cf9746a0f438d9472af9271efd9729
src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
@@ -1,16 +1,9 @@
<!-- 作业指导书 -->
<template>
  <div>
    <div style="width:100%;height:30px;margin:5px 0px">
      <el-row>
        <el-col :span="12" style="text-align: left;">
          <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-col>
      </el-row>
    <div style="margin: 10px 0;text-align: right">
      <el-button size="small" type="primary" @click="getList">刷新</el-button>
      <el-button size="small" type="primary" @click="dialogVisible = true">受控申请</el-button>
    </div>
    <el-table :data="tableData" border height="calc(100vh - 18em)">
      <el-table-column type="index" label="序号" width="120">
@@ -58,8 +51,8 @@
              </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>
                  :headers="uploadHeader" :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>
@@ -86,7 +79,7 @@
          <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">
          @selection-change="handleSelectionChange" height="29em">
          <el-table-column type="selection" width="55%">
          </el-table-column>
          <el-table-column label="序号" prop="id" type="index" width="60"></el-table-column>
@@ -165,8 +158,8 @@
            <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>
                  :headers="uploadHeader" :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>
@@ -184,7 +177,15 @@
<script>
import fileDownload from "@/utils/file";
import {
  approvalOfHomeworkInstructionManual,
  homeworkGuidebook,
  homeworkGuidebookEditor,
  newHomeworkGuidebookAdded,
  deleteHomeworkGuidebook,
  pageByPageQueryOfHomeworkInstructions,
  selectDeviceParameter,
} from '@/api/cnas/resourceDemand/device.js'
export default {
  props: {
    clickNodeVal: {
@@ -275,13 +276,14 @@
      });
    },
    approvalFun(id, status) {
      this.$axios.get(this.$api.deviceCheck.approvalOfHomeworkInstructionManual + "?id=" + id + "&status=" + status).then(res => {
      approvalOfHomeworkInstructionManual({ id, status }).then(res => {
        this.getList()
        this.$message({
          type: 'success',
          message: '操作成功!'
        });
      })
      this.$message({
        type: 'success',
        message: '操作成功!'
      });
    },
    getRowKey(row) {
      return row.index
@@ -292,7 +294,10 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.get(this.$api.deviceCheck.homeworkGuidebook + "?id=" + row.id + "&instructionId=" + row.instructionId).then(res => {
        homeworkGuidebook({
          id: row.id,
          instructionId: row.instructionId
        }).then(res => {
          this.$message.success('删除成功!')
          this.getList()
        })
@@ -319,7 +324,7 @@
    },
    instructionEditFun(row) {
      this.dialogVisible = true
      this.$axios.get(this.$api.deviceCheck.homeworkGuidebookEditor + "?instructionId=" + row.instructionId).then(res => {
      homeworkGuidebookEditor({ instructionId: row.instructionId }).then(res => {
        if (res.code == 200) {
          this.instructionForm = res.data.instruction;
          if (this.instructionForm.fileSystemName) {
@@ -345,11 +350,7 @@
      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 => {
          newHomeworkGuidebookAdded(this.instructionForm).then(res => {
            if (res.code == 200) {
              this.$message.success('操作成功!')
              this.dialogVisible = false
@@ -445,7 +446,7 @@
        .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 deleteHomeworkGuidebook({ ids });
      if (res.code === 200) {
        // 删除视图的数据
        for (const resKey in this.selectedRow) {
@@ -483,7 +484,7 @@
      this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件。`);
    },
    getList() {
      this.$axios.get(this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions + "?size=" + this.search.size + "&current=" + this.search.current).then(res => {
      pageByPageQueryOfHomeworkInstructions({ ...this.search }).then(res => {
        if (res.code == 200) {
          this.tableData = res.data.records;
          this.search.total = res.data.total
@@ -491,17 +492,7 @@
      })
    },
    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 => {
      selectDeviceParameter({ laboratoryNameIsNull: this.laboratoryNameIsNull }).then(res => {
        if (res.code == 200) {
          this.devices = res.data.records;
          this.updateDeviceNameOptions();
@@ -527,13 +518,8 @@
    },
  },
  computed: {
    headers() {
      return {
        'token': sessionStorage.getItem('token')
      }
    },
    action() {
      return this.javaApi + this.$api.personnel.saveCNASFile
      return this.javaApi + '/personBasicInfo/saveCNASFile'
    }
  },
}