gaoluyang
2026-06-02 10a440fac0dd665bf4af78e1e3c913dcf893bf10
src/views/equipmentManagement/repair/index.vue
@@ -94,51 +94,84 @@
          @pagination="changePage"
      >
        <template #statusRef="{ row }">
          <el-tag v-if="row.status === 2" type="danger">失败</el-tag>
          <el-tag v-if="row.status === 1" type="success">完结</el-tag>
          <el-tag v-if="row.status === 0" type="warning">待维修</el-tag>
          <el-tag v-if="row.status === 2"
                  type="danger">失败</el-tag>
          <el-tag v-if="row.status === 1"
                  type="success">完结</el-tag>
          <el-tag v-if="row.status === 3"
                  type="info">待验收</el-tag>
          <el-tag v-if="row.status === 0"
                  type="warning">待维修</el-tag>
        </template>
        <template #operation="{ row }">
          <el-button
            type="primary"
            link
            :disabled="row.status === 1"
            @click="editRepair(row.id)"
          >
          <el-button type="primary"
                     link
                     @click="viewRepair(row.id)">
            详情
          </el-button>
          <el-button type="primary"
                     link
                     :disabled="row.status === 1 || row.status === 3"
                     @click="editRepair(row.id)">
            编辑
          </el-button>
          <el-button
            type="success"
            link
            :disabled="row.status === 1"
            @click="addMaintain(row)"
          >
          <el-button type="success"
                     link
                     :disabled="row.status !== 0"
                     @click="addMaintain(row)">
            维修
          </el-button>
          <el-button
            type="danger"
            link
            :disabled="row.status === 1"
            @click="delRepairByIds(row.id)"
          >
          <el-button type="warning"
                     link
                     :disabled="row.status !== 3"
                     @click="openAcceptance(row)">
            验收
          </el-button>
          <el-button type="danger"
                     link
                     :disabled="row.status === 1 || row.status === 3"
                     @click="delRepairByIds(row.id)">
            删除
          </el-button>
          <el-button type="primary"
                     link
                     @click="openFileDialog(row)">
            附件
          </el-button>
        </template>
      </PIMTable>
    </div>
    <RepairModal ref="repairModalRef" @ok="getTableData"/>
    <MaintainModal ref="maintainModalRef" @ok="getTableData"/>
    <RepairModal ref="repairModalRef"
                 @ok="getTableData" />
    <MaintainModal ref="maintainModalRef"
                   @ok="getTableData" />
    <AcceptanceModal ref="acceptanceModalRef"
                     @ok="getTableData" />
    <FileList v-if="fileDialogVisible"
              v-model:visible="fileDialogVisible"
              :record-type="'device_repair'"
              :record-id="recordId" />
  </div>
</template>
<script setup>
import { onMounted, getCurrentInstance, computed } from "vue";
import {usePaginationApi} from "@/hooks/usePaginationApi";
import {getRepairPage, delRepair} from "@/api/equipmentManagement/repair";
import RepairModal from "./Modal/RepairModal.vue";
import {ElMessageBox, ElMessage} from "element-plus";
import dayjs from "dayjs";
import MaintainModal from "./Modal/MaintainModal.vue";
  import {
    onMounted,
    getCurrentInstance,
    computed,
    ref,
    defineAsyncComponent,
  } from "vue";
  import { usePaginationApi } from "@/hooks/usePaginationApi";
  import { getRepairPage, delRepair } from "@/api/equipmentManagement/repair";
  import RepairModal from "./Modal/RepairModal.vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import dayjs from "dayjs";
  import MaintainModal from "./Modal/MaintainModal.vue";
  import AcceptanceModal from "./Modal/AcceptanceModal.vue";
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
  );
defineOptions({
  name: "设备报修",
@@ -146,9 +179,10 @@
const {proxy} = getCurrentInstance();
// 模态框实例
const repairModalRef = ref();
const maintainModalRef = ref();
  // 模态框实例
  const repairModalRef = ref();
  const maintainModalRef = ref();
  const acceptanceModalRef = ref();
// 表格多选框选中项
const multipleList = ref([]);
@@ -232,7 +266,7 @@
        dataType: "slot",
        slot: "operation",
        align: "center",
        width: "300px",
        width: "320px",
      },
    ]
);
@@ -253,10 +287,19 @@
  getTableData();
};
// 多选后做什么
const handleSelectionChange = (selectionList) => {
  multipleList.value = selectionList;
};
  // 打开附件弹窗
  const recordId = ref(0);
  const fileDialogVisible = ref(false);
  const openFileDialog = async row => {
    recordId.value = row.id;
    fileDialogVisible.value = true;
  };
  // 多选后做什么
  const handleSelectionChange = selectionList => {
    multipleList.value = selectionList;
  };
// 检查选中的记录中是否有完结状态的
const hasFinishedStatus = computed(() => {
@@ -268,21 +311,31 @@
  repairModalRef.value.openAdd();
};
// 编辑报修
const editRepair = (id) => {
  repairModalRef.value.openEdit(id);
};
  // 详情查看
  const viewRepair = id => {
    repairModalRef.value.openView(id);
  };
  // 编辑报修
  const editRepair = id => {
    repairModalRef.value.openEdit(id);
  };
// 新增维修
const addMaintain = (row) => {
  maintainModalRef.value.open(row.id, row);
};
const changePage = ({page, limit}) => {
  pagination.currentPage = page;
  pagination.pageSize = limit;
  onCurrentChange(page);
};
  // 打开验收弹窗
  const openAcceptance = row => {
    acceptanceModalRef.value.open(row);
  };
  const changePage = ({ page, limit }) => {
    pagination.currentPage = page;
    pagination.pageSize = limit;
    onCurrentChange(page);
  };
// 单行删除
const delRepairByIds = async (ids) => {