吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/index.vue
@@ -1,8 +1,8 @@
<template>
   <basic-container>
      <el-tabs class="gd-tabs" v-model="activeName" @tab-click="tabsClick">
         <el-tab-pane label="全部 " name="all"></el-tab-pane>
         <el-tab-pane label="我的巡查任务" name="my"></el-tab-pane>
         <el-tab-pane :label="`全部(${allTotal})`" name="all"></el-tab-pane>
         <el-tab-pane :label="`我的巡查任务(${myTotal})`" name="my"></el-tab-pane>
      </el-tabs>
      <el-form ref="queryParamsRef" :model="searchParams" class="gd-search-form">
         <el-form-item label="任务名称" prop="patrolTaskName">
@@ -25,7 +25,7 @@
               @change="handleSearch"
            >
               <el-option
                  v-for="item in dictObj.patrolTaskType"
                  v-for="item in dictObj.workOrderType"
                  :key="item.dictKey"
                  :label="item.dictValue"
                  :value="item.dictKey"
@@ -72,7 +72,9 @@
      </el-form>
      <div class="gd-table-toolbar">
         <el-button v-if="requester" :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button>
         <el-button v-if="permission.flyOrder_add" :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">
            拆分工单
         </el-button>
      </div>
      <div class="gd-table-container" v-loading="loading">
@@ -84,7 +86,7 @@
               <el-table-column prop="taskNo" show-overflow-tooltip label="巡查任务编号" />
               <el-table-column prop="patrolTaskType" show-overflow-tooltip label="巡查任务类型">
                  <template v-slot="{ row }">
                     {{ getDictLabel(row.patrolTaskType, dictObj.patrolTaskType) }}
                     {{ getDictLabel(row.patrolTaskType, dictObj.workOrderType) }}
                  </template>
               </el-table-column>
               <el-table-column prop="taskStatus" show-overflow-tooltip label="巡查任务状态">
@@ -98,7 +100,7 @@
               <el-table-column prop="taskDesc" show-overflow-tooltip label="巡查任务描述" />
               <el-table-column label="操作" class-name="operation-btns">
                  <template v-slot="{ row }">
                     <el-link  type="primary"  @click="viewDiaLogView(row)">查看</el-link>
                     <el-link type="primary" @click="viewDiaLogView(row)">查看</el-link>
                  </template>
               </el-table-column>
            </el-table>
@@ -139,7 +141,8 @@
import { airlineListApi } from '@/api/zkxt'
const store = useStore()
const requester = computed(() => store.state.user.userInfo?.role_id === '2014158512610869250')
const permission = computed(() => store.state.user.permission)
// 初始化查询参数
const initSearchParams = () => ({
   patrolTaskName: '', // 任务名称
@@ -153,6 +156,8 @@
const searchParams = ref(initSearchParams()) // 查询参数
const dateRange = ref([]) // 执行时间范围
const total = ref(0) // 总条数
const allTotal = ref(0) // 全部tab总条数
const myTotal = ref(0) // 我的巡查任务tab总条数
const loading = ref(true) // 列表加载中
const list = ref([]) // 列表数据
const selectedIds = ref([]) // 勾选的ID列表
@@ -162,14 +167,12 @@
const dialogVisible = ref(false)
const viewDiaLogVisible = ref(false)
const dictObj = ref({
   patrolTaskType: [], // 巡查任务类型
   workOrderType: [], // 工单类型
   deviceLoadDemand: [], // 设备负载需求
   taskStatus: [], // 巡查任务状态
})
const activeName = ref('all')
provide('dictObj', dictObj)
provide('requester', requester)
// 获取列表
async function getList() {
@@ -222,7 +225,7 @@
function viewDiaLogView(row) {
   viewDiaLogVisible.value = true
   nextTick(() => {
      let mode = ['1', '4'].includes(row.taskStatus) && requester.value ? 'edit' : 'view'
      let mode = ['1', '4'].includes(row.taskStatus) && permission.value.flyOrder_add ? 'edit' : 'view'
      viewDiaLogRef.value?.open({ mode, row })
   })
}
@@ -247,7 +250,7 @@
// 获取字典
function getDictList() {
   getDictionaryByCode('patrolTaskType,workOrderType,deviceLoadDemand,taskStatus').then(res => {
   getDictionaryByCode('workOrderType,deviceLoadDemand,taskStatus').then(res => {
      dictObj.value = res.data.data
   })
}
@@ -259,7 +262,25 @@
   })
}
// 获取两个tab的总条数
async function getTabTotals() {
   const allRes = await gdPatrolTaskPageApi({
      current: 1,
      size: 1,
      createUser: '',
   })
   allTotal.value = allRes?.data?.data?.total ?? 0
   const myRes = await gdPatrolTaskPageApi({
      current: 1,
      size: 1,
      createUser: store.state.user.userInfo.user_id,
   })
   myTotal.value = myRes?.data?.data?.total ?? 0
}
onMounted(() => {
   getTabTotals()
   getList()
   getDictList()
   getAirList()