吉安感知网项目-前端
张含笑
2026-01-21 9eb8bb59b802ceef1f52d334c8e577f2bf02c90e
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/index.vue
@@ -38,7 +38,12 @@
               clearable
               @change="handleSearch"
            >
               <el-option v-for="item in taskStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
               <el-option
                  v-for="item in dictObj.taskStatus"
                  :key="item.dictKey"
                  :label="item.dictValue"
                  :value="item.dictKey"
               />
            </el-select>
         </el-form-item>
@@ -66,13 +71,13 @@
         <el-button color="#F2F3F5" @click="requester = !requester">我是{{ requester ? '需求方' : '服务方' }}</el-button>
         <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button>
<!--         <el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>-->
         <!--         <el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>-->
      </div>
      <div class="gd-table-container" v-loading="loading">
         <div class="gd-table-content gd-table-content-bg">
            <el-table class="gd-table" :data="list" @selection-change="handleSelectionChange">
<!--               <el-table-column type="selection" width="46" />-->
               <!--               <el-table-column type="selection" width="46" />-->
               <el-table-column type="index" width="64" label="序号" />
               <el-table-column prop="patrolTaskName" show-overflow-tooltip label="巡查任务名称" />
               <el-table-column prop="taskNo" show-overflow-tooltip label="巡查任务编号" />
@@ -83,7 +88,7 @@
               </el-table-column>
               <el-table-column prop="taskStatus" show-overflow-tooltip label="巡查任务状态">
                  <template v-slot="{ row }">
                     {{ getTaskStatusLabel(row.taskStatus) }}
                     {{ getDictLabel(row.taskStatus, dictObj.taskStatus) }}
                  </template>
               </el-table-column>
               <el-table-column prop="executeTime" show-overflow-tooltip label="任务执行时间" />
@@ -112,7 +117,7 @@
      </div>
      <FormDiaLog ref="dialogRef" @success="getList" v-if="dialogVisible" v-model="dialogVisible" />
      <ViewDiaLog ref="viewDiaLogRef" @success="getList" v-if="viewDiaLogVisible" v-model="viewDiaLogVisible" />
      <ViewDiaLog ref="viewDiaLogRef" @success="getList" @refusalAccept="refusalAccept" v-if="viewDiaLogVisible" v-model="viewDiaLogVisible" />
   </basic-container>
</template>
<script setup>
@@ -151,30 +156,11 @@
   patrolTaskType: [], // 巡查任务类型
   workOrderType: [], // 工单类型
   deviceLoadDemand: [], // 设备负载需求
   taskStatus: [], // 巡查任务状态
})
// 任务状态选项
const taskStatusOptions = [
   { label: '待签收', value: '0' },
   { label: '拒绝签收', value: '1' },
   { label: '已撤回', value: '2' },
   { label: '待审核', value: '3' },
   { label: '审核驳回', value: '4' },
   { label: '审核通过', value: '5' },
   { label: '待验收', value: '6' },
   { label: '拒绝验收', value: '7' },
   { label: '验收通过', value: '8' },
]
provide('dictObj', dictObj)
provide('taskStatusOptions', taskStatusOptions)
provide('requester', requester)
// 获取任务状态标签
function getTaskStatusLabel(value) {
   const item = taskStatusOptions.find(item => item.value === value)
   return item ? item.label : value
}
// 获取列表
async function getList() {
@@ -216,25 +202,9 @@
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) && requester.value ? 'edit' : 'view'
      viewDiaLogRef.value?.open({ mode, row })
   })
}
// 删除
async function handleDelete(row) {
   const tips = row ? '该条' : '选中的项'
   await ElMessageBox.confirm(`确认删除${tips}吗?`, '提示', {
      type: 'warning',
      customClass: 'gd-confirm-custom',
      confirmButtonClass: 'gd-confirm-button',
      cancelButtonClass: 'gd-confirm-cancel-button',
   })
   const ids = row ? row.id : selectedIds.value.join(',')
   await gdPatrolTaskRemoveApi({ ids })
   ElMessage.success('删除成功')
   selectedIds.value = []
   getList()
}
// 勾选值设置
@@ -244,11 +214,18 @@
// 获取字典
function getDictList() {
   getDictionaryByCode('patrolTaskType,workOrderType,deviceLoadDemand').then(res => {
   getDictionaryByCode('patrolTaskType,workOrderType,deviceLoadDemand,taskStatus').then(res => {
      dictObj.value = res.data.data
   })
}
function refusalAccept(row) {
   dialogVisible.value = true
   nextTick(() => {
      dialogRef.value?.open({ mode:'edit', row })
   })
}
onMounted(() => {
   getList()
   getDictList()