| | |
| | | <template> |
| | | <basic-container> |
| | | <el-tabs class="gd-tabs" v-model="activeName" @tab-click="tabsClick"> |
| | | <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="workOrderName"> |
| | | <el-input |
| | | class="gd-input" |
| | | class="gd-input gray" |
| | | v-model="searchParams.workOrderName" |
| | | placeholder="请输入" |
| | | clearable |
| | |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="工单编号" prop="workOrderCode"> |
| | | <el-input |
| | | class="gd-input gray" |
| | | v-model="searchParams.workOrderCode" |
| | | placeholder="请输入" |
| | | clearable |
| | | @clear="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="工单类型" prop="workOrderType"> |
| | | <el-select |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | <el-cascader |
| | | class="gd-cascader gray" |
| | | popper-class="gd-cascader-popper" |
| | | v-model="searchParams.workOrderType" |
| | | :options="workOrderTypeXT" |
| | | :props="taskTypeCascaderProps" |
| | | placeholder="请选择" |
| | | clearable |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in dictObj.workOrderType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="工单状态" prop="workOrderStatus"> |
| | | <el-select |
| | | class="gd-select" |
| | | class="gd-select gray" |
| | | popper-class="gd-select-popper" |
| | | v-model="searchParams.workOrderStatus" |
| | | placeholder="请选择" |
| | |
| | | <el-option |
| | | v-for="item in dictObj.workOrderStatus" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :label="item.dictValue.split('_')[1]" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | |
| | | |
| | | <el-form-item label="执行时间" prop="executeTime"> |
| | | <el-date-picker |
| | | class="gd-date-picker" |
| | | class="gd-date-picker gray" |
| | | popper-class="gd-date-picker-popper" |
| | | v-model="executeTime" |
| | | v-model="dateRange" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="开始日期" |
| | |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="需求方名称" prop="createUserName"> |
| | | <el-input |
| | | class="gd-input gray" |
| | | v-model="searchParams.createUserName" |
| | | placeholder="请输入" |
| | | clearable |
| | | @clear="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="服务方名称" prop="serviceParty"> |
| | | <el-input |
| | | class="gd-input gray" |
| | | v-model="searchParams.serviceParty" |
| | | placeholder="请输入" |
| | | clearable |
| | | @clear="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item class="gd-search-actions"> |
| | | <el-button :icon="RefreshRight" @click="resetForm"></el-button> |
| | | <el-button class="search-btn" :icon="Search" @click="handleSearch"></el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div class="gd-table-toolbar"> |
| | | <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> |
| | | </div> |
| | | |
| | | <div class="gd-table-container" v-loading="loading"> |
| | | <div class="gd-table-toolbar"> |
| | | <el-button v-if="permission.order_release" :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 class="gd-table" :data="list" @selection-change="handleSelectionChange" @sort-change="handleSortChange"> |
| | | <el-table-column type="index" width="64" label="序号" /> |
| | | <el-table-column prop="workOrderName" show-overflow-tooltip label="工单名称" /> |
| | | <el-table-column prop="workOrderCode" show-overflow-tooltip label="工单编号" /> |
| | | <el-table-column prop="workOrderType" show-overflow-tooltip label="工单类型"> |
| | | <el-table-column prop="workOrderType" show-overflow-tooltip label="工单类型" sortable="custom"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.workOrderType, dictObj.workOrderType) }} |
| | | {{ getTaskTypeLabel(row.workOrderType, workOrderTypeXT) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" show-overflow-tooltip label="阶段状态" /> |
| | | <el-table-column prop="status" show-overflow-tooltip label="阶段状态"> |
| | | <template v-slot="{ row }"> |
| | | <span :style="{ color: colors?.[row?.workOrderStatus] }"> |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus).split('_')[0] }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="workOrderStatus" show-overflow-tooltip label="工单状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus) }} |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus).split('_')[1] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="executeTime" show-overflow-tooltip label="执行时间范围"> |
| | | <template v-slot="{ row }">{{ row.executeStartTime }} ~ {{ row.executeEndTime }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="serviceParty" show-overflow-tooltip label="服务方名称" /> |
| | | <el-table-column prop="createDeptName" show-overflow-tooltip label="需求方名称" /> |
| | | <el-table-column prop="createTime" show-overflow-tooltip label="工单创建时间" /> |
| | | <el-table-column label="操作" class-name="operation-btns"> |
| | | <template v-slot="{ row }"> |
| | | <el-link @click="openForm('view', row)">查看</el-link> |
| | | <el-link @click="openForm('edit', row)">编辑</el-link> |
| | | <el-link @click="handleDelete(row)">删除</el-link> |
| | | {{ dayjs(row.executeStartTime).format('YYYY-MM-DD') }} ~ |
| | | {{ dayjs(row.executeEndTime).format('YYYY-MM-DD') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUserName" show-overflow-tooltip label="需求方名称" /> |
| | | <el-table-column prop="serviceParty" show-overflow-tooltip label="服务方名称" /> |
| | | <el-table-column prop="createTime" show-overflow-tooltip label="工单创建时间" /> |
| | | <el-table-column label="操作" class-name="operation-btns" fixed="right"> |
| | | <template v-slot="{ row }"> |
| | | <el-link type="primary" @click="openFormChange(row)">查看</el-link> |
| | | <el-link type="primary" @click="routeManagement(row)">航线管理</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <PreviewFiles v-model="previewVisible" :src="testDock" type="docx" /> |
| | | <FormDiaLog ref="dialogRef" @success="getList" v-if="dialogVisible" v-model="dialogVisible" /> |
| | | </basic-container> |
| | | </template> |
| | |
| | | import { onMounted, ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDeptTree } from '@/api/system/dept' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { dateRangeFormat, getDictLabel } from '@ztzf/utils' |
| | | import { getDictListApi } from '@/api/zkxt' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { gdWorkOrderPageApi, gdWorkOrderRemoveApi } from './orderManageApi' |
| | | import dayjs from 'dayjs' |
| | | import PreviewFiles from '@/components/PreviewFiles/PreviewFiles.vue' |
| | | import testDock from '@/assets/docx/testDocx.docx' |
| | | import testPdf from '@/assets/pdf/testPdf.pdf' |
| | | import { useStore } from 'vuex' |
| | | import { |
| | | getTaskTypeLabel, |
| | | normalizeTaskTypeOptions, |
| | | taskTypeCascaderProps, |
| | | } from '../taskTypeOptions' |
| | | |
| | | const store = useStore() |
| | | const activeName = ref('all') |
| | | |
| | | const permission = computed(() => store.state.user.permission) |
| | | |
| | | // 初始化查询参数 |
| | | const initSearchParams = () => ({ |
| | | workOrderName: '', // 工单名称 |
| | | workOrderCode: '', // 工单编号 |
| | | workOrderType: '', // 工单类型 |
| | | workOrderStatus: '', // 工单状态 |
| | | executeStartTime: '', // 执行开始时间 |
| | | executeEndTime: '', // 执行结束时间 |
| | | createUserName: '', // 需求方名称 |
| | | serviceParty: '', // 服务方名称 |
| | | typePinyinFirst: '', // 工单类型拼音首字母(大写) |
| | | current: 1, // 当前页 |
| | | size: 10, // 每页大小 |
| | | }) |
| | | const searchParams = ref(initSearchParams()) // 查询参数 |
| | | const executeTime = ref([]) // 执行时间范围 |
| | | 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 queryParamsRef = ref(null) // 查询表单实例 |
| | | const dialogRef = ref(null) // 弹框实例 |
| | | const dialogVisible = ref(false) |
| | | const previewVisible = ref(false) |
| | | const dictObj = ref({ |
| | | deviceLoadDemand: [], // 设备负载需求 |
| | | workOrderType: [], // 工单类型 |
| | | workOrderStatus: [], // 工单状态 |
| | | }) |
| | | const workOrderTypeXT = ref([]) |
| | | provide('dictObj', dictObj) |
| | | const deptTree = ref([]) // 部门树 |
| | | const treeProps = { |
| | | label: 'name', |
| | | children: 'children', |
| | | } |
| | | provide('deptTree', deptTree) |
| | | provide('treeProps', treeProps) |
| | | provide('workOrderTypeXT', workOrderTypeXT) |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | | const range = dateRangeFormat(dateRange.value) |
| | | loading.value = true |
| | | try { |
| | | const res = await gdWorkOrderPageApi(searchParams.value) |
| | | const res = await gdWorkOrderPageApi({ |
| | | ...searchParams.value, |
| | | startTime: range[0], |
| | | endTime: range[1], |
| | | createUser: activeName.value === 'my' ? store.state.user.userInfo.user_id : '', |
| | | workOrderType: searchParams?.value?.workOrderType?.join?.(','), |
| | | typePinyinFirst: typePinyinFirst.value, |
| | | }) |
| | | list.value = res?.data?.data?.records ?? [] |
| | | total.value = res?.data?.data?.total ?? 0 |
| | | } finally { |
| | |
| | | |
| | | // 查询 |
| | | function handleSearch() { |
| | | // 处理执行时间范围 |
| | | if (executeTime.value && executeTime.value.length === 2) { |
| | | searchParams.value.executeStartTime = executeTime.value[0] |
| | | searchParams.value.executeEndTime = executeTime.value[1] |
| | | } else { |
| | | searchParams.value.executeStartTime = '' |
| | | searchParams.value.executeEndTime = '' |
| | | } |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | |
| | | // 重置查询 |
| | | function resetForm() { |
| | | queryParamsRef.value?.resetFields() |
| | | executeTime.value = [] |
| | | dateRange.value = [] |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | function tabsClick(tab, event) { |
| | | activeName.value = tab.props.name |
| | | resetForm() |
| | | handleSearch() |
| | | } |
| | | |
| | | // 新增/编辑/查看 弹框 |
| | |
| | | nextTick(() => { |
| | | dialogRef.value?.open({ mode, row }) |
| | | }) |
| | | } |
| | | // 工单状态:0草稿、10发布中_接单中、11发布中_拒绝接单、20响应中_待拆分、 |
| | | // 21响应中_申请取消、22响应中_申请修改、23响应中_已取消、 |
| | | // 30执行中_待全部完成、31执行中_协商修改、40完成待验_待全部验收、 |
| | | // 50验收通过_待结算、60结算完成_已结算 |
| | | function openFormChange(row) { |
| | | dialogVisible.value = true |
| | | nextTick(() => { |
| | | const mode = ['11'].includes(row.workOrderStatus) && permission.value.order_release ? 'edit' : 'view' |
| | | dialogRef.value?.open({ mode, row }) |
| | | }) |
| | | } |
| | | |
| | | function routeManagement(row) { |
| | | window.open(`/drone-web/#/route/manager?order-id=${row.id}`) |
| | | } |
| | | |
| | | const colors = { |
| | | 10: '#AE00FF', |
| | | 11: '#AE00FF', |
| | | 20: '#002BFF', |
| | | 21: '#002BFF', |
| | | 22: '#002BFF', |
| | | 23: '#002BFF', |
| | | 30: '#FF5106', |
| | | 31: '#FF5106', |
| | | 40: '#FF0000', |
| | | 50: '#008CFF', |
| | | 60: '#019612', |
| | | } |
| | | |
| | | // 删除 |
| | |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('deviceLoadDemand,workOrderType,workOrderStatus').then(res => { |
| | | getDictionaryByCode('deviceLoadDemand,workOrderType,workOrderStatus,taskStatus').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | getDictListApi('task_inspection_type').then(res => { |
| | | workOrderTypeXT.value = normalizeTaskTypeOptions(res.data.data || []) |
| | | }) |
| | | } |
| | | |
| | | // 获取部门树 |
| | | function getDeptTreeFun() { |
| | | getDeptTree().then(res => { |
| | | deptTree.value = res.data.data |
| | | // 获取两个tab的总条数 |
| | | async function getTabTotals() { |
| | | // 获取全部tab的总数 |
| | | const allRes = await gdWorkOrderPageApi({ |
| | | current: 1, |
| | | size: 1, |
| | | createUser: '', |
| | | }) |
| | | allTotal.value = allRes?.data?.data?.total ?? 0 |
| | | |
| | | // 获取我的任务工单tab的总数 |
| | | const myRes = await gdWorkOrderPageApi({ |
| | | current: 1, |
| | | size: 1, |
| | | createUser: store.state.user.userInfo.user_id, |
| | | }) |
| | | myTotal.value = myRes?.data?.data?.total ?? 0 |
| | | } |
| | | |
| | | // 工单类型排序方向:asc(升序)/ desc(降序)/ ''(不排序) |
| | | const typePinyinFirst = ref('') |
| | | |
| | | // 点击工单类型排序三角:上三角传 asc,下三角传 desc |
| | | function handleSortChange({ prop, order }) { |
| | | if (prop !== 'workOrderType') return |
| | | typePinyinFirst.value = order === 'ascending' ? 'asc' : order === 'descending' ? 'desc' : '' |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTabTotals() |
| | | getList() |
| | | getDictList() |
| | | getDeptTreeFun() |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .gd-search-form { |
| | | // 搜索项较多,用栅格分两排整齐排列(4 列 × 2 行) |
| | | display: grid; |
| | | grid-template-columns: repeat(5, max-content); |
| | | gap: 16px 40px; |
| | | align-items: center; |
| | | |
| | | // 清除公共样式里的行内间距,交给 grid 的 gap 统一控制 |
| | | :deep(.el-form-item) { |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | // 固定 label 宽度,让每一列的输入框起点对齐 |
| | | :deep(.el-form-item__label) { |
| | | width: 84px; |
| | | margin-right: 12px; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | // 操作按钮紧跟最后一个搜索项 |
| | | :deep(.gd-search-actions) { |
| | | justify-self: start; |
| | | margin-left: 30px !important; |
| | | } |
| | | } |
| | | </style> |