| | |
| | | <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"> |
| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="任务类型" prop="patrolTaskType"> |
| | | <el-select |
| | | class="gd-select gray" |
| | | popper-class="gd-select-popper" |
| | | <el-cascader |
| | | class="gd-cascader gray" |
| | | popper-class="gd-cascader-popper" |
| | | v-model="searchParams.patrolTaskType" |
| | | :options="workOrderTypeXT" |
| | | :props="taskTypeCascaderProps" |
| | | placeholder="请选择" |
| | | clearable |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in dictObj.patrolTaskType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div class="gd-table-toolbar"> |
| | | <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"> |
| | | <div class="gd-table-toolbar"> |
| | | <el-button v-if="permission.flyOrder_add" :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')"> |
| | | 拆分工单 |
| | | </el-button> |
| | | </div> |
| | | |
| | | <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="index" width="64" label="序号" /> |
| | | <el-table-column prop="patrolTaskName" show-overflow-tooltip label="巡查任务名称" /> |
| | | <el-table-column prop="workOrderName" show-overflow-tooltip label="关联工单" /> |
| | | <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) }} |
| | | {{ getTaskTypeLabel(row.patrolTaskType, workOrderTypeXT) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="taskStatus" show-overflow-tooltip label="巡查任务状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.taskStatus, dictObj.taskStatus) }} |
| | | <span :style="{ color: colors?.[row?.taskStatus] }"> |
| | | {{ getDictLabel(row.taskStatus, dictObj.taskStatus) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="executeTime" show-overflow-tooltip label="任务执行时间" /> |
| | | <el-table-column prop="workOrderName" show-overflow-tooltip label="关联工单" /> |
| | | <el-table-column prop="createTime" show-overflow-tooltip label="巡查任务创建时间" /> |
| | | <el-table-column prop="taskDesc" show-overflow-tooltip label="巡查任务描述" /> |
| | | <el-table-column label="操作" class-name="operation-btns"> |
| | | <el-table-column label="操作" class-name="operation-btns" fixed="right"> |
| | | <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> |
| | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { dateRangeFormat, getDictLabel } from '@ztzf/utils' |
| | | import { getDictListApi } from '@/api/zkxt' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { gdPatrolTaskPageApi, gdPatrolTaskRemoveApi } from './inspectionRequestApi' |
| | | import ViewDiaLog from '@/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue' |
| | | import { useStore } from 'vuex' |
| | | import { airlineListApi } from '@/api/zkxt' |
| | | import { |
| | | getTaskTypeLabel, |
| | | normalizeTaskTypeOptions, |
| | | taskTypeCascaderProps, |
| | | } from '../taskTypeOptions' |
| | | |
| | | const store = useStore() |
| | | const permission = computed(() => store.state.user.permission) |
| | |
| | | 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列表 |
| | |
| | | const dialogVisible = ref(false) |
| | | const viewDiaLogVisible = ref(false) |
| | | const dictObj = ref({ |
| | | patrolTaskType: [], // 巡查任务类型 |
| | | workOrderType: [], // 工单类型 |
| | | deviceLoadDemand: [], // 设备负载需求 |
| | | taskStatus: [], // 巡查任务状态 |
| | | }) |
| | | const workOrderTypeXT = ref([]) |
| | | const activeName = ref('all') |
| | | provide('dictObj', dictObj) |
| | | provide('workOrderTypeXT', workOrderTypeXT) |
| | | |
| | | const colors = { |
| | | 0: '#F6A000', //0待签收 |
| | | 1: '#FF0202', //1拒绝签收 |
| | | 2: '#FF0202', //2已撤回 |
| | | 3: '#212BF4', //3待审核 |
| | | 4: '#FF0000', //4审核驳回 |
| | | 5: '#0068F0', //5审核通过 |
| | | 6: '#FD6716', //6待验收 |
| | | 7: '#FF0000', //7拒绝验收 |
| | | 8: '#019612', //8验收通过 |
| | | } |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | |
| | | const res = await gdPatrolTaskPageApi({ |
| | | ...searchParams.value, |
| | | startTime: range[0], |
| | | endTime: range[1], |
| | | createUser: activeName.value === 'my' ? store.state.user.userInfo.user_id : '', |
| | | patrolTaskType: searchParams?.value?.patrolTaskType?.join?.(','), |
| | | }) |
| | | list.value = res?.data?.data?.records ?? [] |
| | | total.value = res?.data?.data?.total ?? 0 |
| | |
| | | selectedIds.value = rows.map(item => item.id) |
| | | } |
| | | |
| | | const routeOptions = ref([]) |
| | | const getAirName = id => { |
| | | const item = routeOptions.value.find(item => item.id === id) |
| | | return item ? item.name : id |
| | | } |
| | | provide('routeOptions', routeOptions) |
| | | provide('getAirName', getAirName) |
| | | function getAirList() { |
| | | airlineListApi({}).then(res => { |
| | | routeOptions.value = res.data.data || [] |
| | | }) |
| | | } |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('patrolTaskType,workOrderType,deviceLoadDemand,taskStatus').then(res => { |
| | | getDictionaryByCode('workOrderType,deviceLoadDemand,taskStatus').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | getDictListApi('task_inspection_type').then(res => { |
| | | workOrderTypeXT.value = normalizeTaskTypeOptions(res.data.data || []) |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | // 获取两个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() |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"></style> |