吉安感知网项目-前端
罗广辉
2026-01-23 9546b29f6984b27aad3ccd6a319a9b8a00ba9911
feat: 飞手change
2 files modified
94 ■■■■■ changed files
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/FormDiaLog.vue 76 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue 18 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/FormDiaLog.vue
@@ -11,7 +11,7 @@
        <div class="gd-dialog-form">
            <!-- 关联工单选择 -->
            <div class="work-order-section">
                <div class="detail-title" :style="{marginBottom: 0,marginRight: pxToRem(10)}">选择工单</div>
                <div class="detail-title" :style="{ marginBottom: 0, marginRight: pxToRem(10) }">选择工单</div>
                <el-select
                    class="gd-select"
                    style="width: 150px"
@@ -29,7 +29,7 @@
            <!-- 工单信息展示 -->
            <div class="work-order-info" v-if="selectedWorkOrder">
                <el-row class="detail-row-view" >
                <el-row class="detail-row-view">
                    <el-col :span="12">
                        <div class="info-item">
                            <span class="label">工单类型</span>
@@ -59,7 +59,7 @@
            <!-- 子任务表格表单 -->
            <div class="task-table-section" v-if="selectedWorkOrderId">
                <div class="detail-title" :style="{marginTop: pxToRem(10)}">添加子任务</div>
                <div class="detail-title" :style="{ marginTop: pxToRem(10) }">添加子任务</div>
                <div class="task-table-container">
                    <el-table :data="taskList">
                        <el-table-column width="50" label="">
@@ -76,13 +76,14 @@
                            </template>
                        </el-table-column>
                        <el-table-column prop="patrolTaskType" label="巡查任务类型" min-width="140">
                            <template v-slot="{ row }">
                            <template v-slot="{ row, $index }">
                                <el-select
                                    class="gd-select"
                                    popper-class="gd-select-popper"
                                    v-model="row.patrolTaskType"
                                    placeholder="请选择"
                                    :disabled="dialogReadonly"
                                    @change="handlePatrolTaskTypeChange($index, $event)"
                                >
                                    <el-option
                                        v-for="item in dictObj.patrolTaskType"
@@ -120,16 +121,21 @@
                            </template>
                        </el-table-column>
                        <el-table-column prop="recommendFlyerName" label="推荐飞手" min-width="120">
                            <template v-slot="{ row }">
                            <template v-slot="{ row, $index }">
                                <el-select
                                    class="gd-select"
                                    popper-class="gd-select-popper"
                                    v-model="row.recommendFlyerName"
                                    placeholder="请选择"
                                    filterable
                                    :disabled="dialogReadonly"
                                    :disabled="dialogReadonly || !taskList[$index].patrolTaskType"
                                >
                                    <el-option v-for="item in flyerList" :key="item.id" :label="item.flyerName" :value="item.flyerName" />
                                    <el-option
                                        v-for="item in flyerListMap[$index] || []"
                                        :key="item.id"
                                        :label="item.flyerName"
                                        :value="item.flyerName"
                                    />
                                </el-select>
                            </template>
                        </el-table-column>
@@ -222,7 +228,7 @@
const selectedWorkOrder = ref(null) // 选中的工单信息
// 下拉选项
const flyerList = ref([]) // 飞手列表
const flyerListMap = ref({}) // 飞手列表,按行索引存储
const deviceList = ref([]) // 设备列表
const routeOptions = ref([
    { name: '航线1', id: '1' },
@@ -251,36 +257,57 @@
function removeTaskRow(index) {
    if (taskList.value.length > 1) {
        taskList.value.splice(index, 1)
        // 重新整理 flyerListMap 的索引
        const newFlyerListMap = {}
        Object.keys(flyerListMap.value).forEach(key => {
            const keyIndex = parseInt(key)
            if (keyIndex < index) {
                newFlyerListMap[keyIndex] = flyerListMap.value[keyIndex]
            } else if (keyIndex > index) {
                newFlyerListMap[keyIndex - 1] = flyerListMap.value[keyIndex]
            }
        })
        flyerListMap.value = newFlyerListMap
    }
}
// 获取工单列表
async function getWorkOrderList() {
    const res = await gdWorkOrderPageApi({ size: 999,workOrderStatus: '20' })
    const res = await gdWorkOrderPageApi({ size: 999, workOrderStatus: '20' })
    workOrderList.value = res?.data?.data?.records ?? []
}
// 处理巡查任务类型变化
async function handlePatrolTaskTypeChange(index, skilledTaskType) {
    // 清空该行已选择的飞手
    taskList.value[index].recommendFlyerName = ''
    // 获取对应的飞手列表
    await getFlyerList(index, skilledTaskType)
}
// 获取飞手列表
async function getFlyerList() {
async function getFlyerList(index, skilledTaskType) {
    const res = await gdFlyerPageApi({
        size: 999,
        // todo 需要传入前面的巡查类型
        // patrolTaskType:  '1',
        skilledTaskType,
    })
    flyerList.value = res?.data?.data?.records ?? []
    flyerListMap.value[index] = res?.data?.data?.records ?? []
}
// 获取设备列表
async function getDeviceList() {
    const res = await gdManageDeviceListApi({
        deviceIds: selectedWorkOrder.value.recommendDeviceIds
        deviceIds: selectedWorkOrder.value.recommendDeviceIds,
    })
    deviceList.value = res?.data?.data ?? []
}
watch(()=>selectedWorkOrderId.value,()=>{
    getDeviceList()
})
watch(
    () => selectedWorkOrderId.value,
    () => {
        getDeviceList()
    }
)
// 提交新增
async function handleSubmit() {
@@ -330,7 +357,7 @@
        }))
        await gdPatrolTaskSaveApi(dataList)
        dialogMode.value === 'add' ? ElMessage.success('新增成功') : ElMessage.success('修改成功')
        dialogMode.value === 'edit' && await gdPatrolTaskAuditApi({ auditStatus: 7, id: preID })
        dialogMode.value === 'edit' && (await gdPatrolTaskAuditApi({ auditStatus: 7, id: preID }))
        visible.value = false
        emit('success')
    } finally {
@@ -340,33 +367,38 @@
// 打开弹框
async function open({ mode = 'add', row } = {}) {
    console.log(row,'rowrow')
    console.log(row, 'rowrow')
    dialogMode.value = mode
    if (mode === 'add') {
        selectedWorkOrderId.value = null
        selectedWorkOrder.value = null
        taskList.value = [initTaskRow()]
        flyerListMap.value = {}
    } else {
        // 编辑/查看模式 - 加载已有数据
        selectedWorkOrderId.value = row?.workOrderId
        handleWorkOrderChange(row?.workOrderId)
        taskList.value = [{ ...row }]
        flyerListMap.value = {}
        // 如果有巡查类型,加载对应的飞手列表
        if (row?.patrolTaskType) {
            getFlyerList(0, row.patrolTaskType)
        }
    }
}
onMounted(() => {
    getWorkOrderList()
    getFlyerList()
})
defineExpose({ open })
</script>
<style scoped lang="scss">
.detail-row-view{
.detail-row-view {
    margin-top: 10px;
}
.work-order-section{
.work-order-section {
    display: flex;
    align-items: center;
}
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue
@@ -170,17 +170,16 @@
        </div>
        <template #footer>
            <template v-if="requester">
                <el-button
                    v-if="!dialogReadonly || ['1','4'].includes(taskStatus)"
                    v-if="!dialogReadonly || ['1', '4'].includes(taskStatus)"
                    :loading="submitting"
                    :disabled="submitting"
                    @click="handleSubmit"
                >
                    提交
                </el-button>
                <el-button v-if="['1','4'].includes(taskStatus)" @click="viewDescription">
                <el-button v-if="['1', '4'].includes(taskStatus)" @click="viewDescription">
                    {{ gdStatusObj[taskStatus].reason }}
                </el-button>
                <el-button @click="statusChange(3)" v-if="taskStatus === '3'">撤回任务</el-button>
@@ -192,9 +191,9 @@
                    {{ gdStatusObj[taskStatus].reason }}
                </el-button>
                <el-button v-if="taskStatus === '0'" @click="addDescription">拒绝签收</el-button>
                <el-button v-if="taskStatus === '0'" @click="statusChange(1)" >签收</el-button>
                <el-button v-if="taskStatus === '3'" @click="addDescription" >驳回</el-button>
                <el-button v-if="taskStatus === '3'" @click="statusChange(4)" >同意</el-button>
                <el-button v-if="taskStatus === '0'" @click="statusChange(1)">签收</el-button>
                <el-button v-if="taskStatus === '3'" @click="addDescription">驳回</el-button>
                <el-button v-if="taskStatus === '3'" @click="statusChange(4)">同意</el-button>
            </template>
        </template>
@@ -258,19 +257,17 @@
    { name: '航线3', id: '3' },
])
const gdStatusObj = {
    '0': { reason: '拒绝原因',operationType: '2' },
    '0': { reason: '拒绝原因', operationType: '2' },
    '1': { reason: '拒绝原因' },
    '2': { reason: '' },
    '3': { reason: '驳回原因',operationType: '5' },
    '3': { reason: '驳回原因', operationType: '5' },
    '4': { reason: '驳回原因' },
    '5': { reason: '' },
    '6': { reason: '拒绝原因' },
    '7': { reason: '拒绝原因' },
    '8': { reason: '' },
}
let viewer
@@ -288,7 +285,6 @@
    visible.value = false
    emit('success')
}
// 填写说明
function addDescription() {