From 493a27022ad30291934db825bab591c7efdcbc09 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Wed, 12 Aug 2026 16:35:45 +0800
Subject: [PATCH] feat: 保存的时候一个按钮置灰

---
 applications/task-work-order/src/views/orderView/flyingHand/index.vue |   74 ++++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/flyingHand/index.vue b/applications/task-work-order/src/views/orderView/flyingHand/index.vue
index 46f1a72..36a1634 100644
--- a/applications/task-work-order/src/views/orderView/flyingHand/index.vue
+++ b/applications/task-work-order/src/views/orderView/flyingHand/index.vue
@@ -3,7 +3,13 @@
 	<basic-container>
 		<el-form ref="queryParamsRef" :model="searchParams" class="gd-search-form">
 			<el-form-item label="飞手姓名" prop="flyerName">
-				<el-select
+				<el-input
+				class="gd-input gray"
+					v-model="searchParams.flyerName"
+					placeholder="请输入飞手姓名"
+					clearable
+				/>
+				<!-- <el-select
 							class="gd-select gray"
 							popper-class="gd-select-popper"
 							v-model="searchParams.flyerName"
@@ -15,7 +21,7 @@
 								:label="item.name"
 								:value="item.id"
 							/>
-						</el-select>
+						</el-select> -->
 			</el-form-item>
 
 			<el-form-item label="擅长机型" prop="skilledUavType">
@@ -42,11 +48,11 @@
 			</el-form-item>
 		</el-form>
 
-        <div class="gd-table-toolbar">
-			<el-button :icon="Plus" color="#4C34FF" type="primary" @click="addFlyingHand">新增</el-button>
-		</div>
-
 		<div class="gd-table-container" v-loading="loading">
+			<div class="gd-table-toolbar">
+				<el-button :icon="Plus" color="#4C34FF" type="primary" @click="addFlyingHand">飞手建档</el-button>
+			</div>
+
 			<div class="gd-table-content gd-table-content-bg">
 				<el-table class="gd-table" :data="list">
 					<el-table-column type="index" width="64" label="序号" />
@@ -66,10 +72,10 @@
 					</el-table-column>
 					<el-table-column prop="skilledTaskType" show-overflow-tooltip label="擅长任务类型">
 						<template v-slot="{ row }">
-							{{ getDictLabel(row.skilledTaskType, dictObj.skilledTaskType) }}
+							{{ getTaskTypeLabel(row.skilledTaskType, workOrderTypeXT) }}
 						</template>
 					</el-table-column>
-					<el-table-column label="操作" class-name="operation-btns" width="180">
+					<el-table-column label="操作" class-name="operation-btns" width="180" fixed="right">
 						<template v-slot="{ row }">
 							<el-link @click="viewFlyingHand(row)">查看</el-link>
 							<el-link type="primary" @click="editFlyingHand(row)">编辑</el-link>
@@ -106,11 +112,15 @@
 import { onMounted, ref, nextTick } from 'vue'
 import { getDictionaryByCode } from '@/api/system/dictbiz'
 import { getDictLabel } from '@ztzf/utils'
-import { getFlyingHandPage, removeFlyingHand } from './flyingHandApi'
-import { deviceFlyerApi } from '@/api/zkxt'
+import { getFlyingHandPage, removeFlyingHand,getAllFlyerIds } from './flyingHandApi'
+import { deviceFlyerApi,deviceFlyerDetailApi, getDictListApi } from '@/api/zkxt'
 import FlyingHandDialog from './FlyingHandDialog.vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { prod } from 'mathjs'
+import {
+	getTaskTypeLabel,
+	normalizeTaskTypeOptions,
+} from '../orderManage/taskTypeOptions'
 
 // 初始化查询参数
 const initSearchParams = () => ({
@@ -130,12 +140,14 @@
 const flyingHandData = ref({})
 
 const dictObj = ref({
-	skilledTaskType: [], // 擅长任务类型
+	workOrderType: [], // 擅长任务类型
 	skilledUavType: [], // 擅长机型
 	technicalStrength: [] // 技术特长
 })
+const workOrderTypeXT = ref([])
 
 provide('dictObj', dictObj)
+provide('workOrderTypeXT', workOrderTypeXT)
 
 // 获取列表
 async function getList() {
@@ -153,6 +165,7 @@
 function handleSearch() {
 	searchParams.value.current = 1
 	getList()
+	getFlyingHandList()
 }
 
 // 重置查询
@@ -160,6 +173,7 @@
 	queryParamsRef.value?.resetFields()
 	searchParams.value.current = 1
 	getList()
+	getFlyingHandList()
 }
 
 // 添加飞手
@@ -172,8 +186,18 @@
 // 查看飞手
 function viewFlyingHand(row) {
 	dialogType.value = 'view'
-	flyingHandData.value = { ...row }
-	dialogVisible.value = true
+	if (row.flyerId) {
+		deviceFlyerDetailApi(row.flyerId).then(res => {
+			flyingHandData.value = { ...row }
+			flyingHandData.value.licenseFrontFileUrl = res.data.data.licenseFrontFileUrl
+			flyingHandData.value.licenseBackFileUrl = res.data.data.licenseBackFileUrl
+			flyingHandData.value.certification = [res.data.data.licenseFrontFileUrl, res.data.data.licenseBackFileUrl]
+			dialogVisible.value = true
+		})
+	} else {
+		flyingHandData.value = { ...row }
+		dialogVisible.value = true
+	}
 }
 
 // 编辑飞手
@@ -196,30 +220,44 @@
 	await removeFlyingHand({ ids: ids })
 	ElMessage.success('删除成功')
 	getList()
+	getFlyingHandList()
 }
 
 // 处理弹窗确认
 function handleConfirm() {
 	dialogVisible.value = false
 	getList()
+	getFlyingHandList()
 }
 
 // 获取字典
 function getDictList() {
-	getDictionaryByCode('skilledTaskType,skilledUavType,technicalStrength').then(res => {
+	getDictionaryByCode('workOrderType,skilledUavType,technicalStrength').then(res => {
 		dictObj.value = res.data.data
+	})
+	getDictListApi('task_inspection_type').then(res => {
+		workOrderTypeXT.value = normalizeTaskTypeOptions(res.data.data || [])
 	})
 }
 
 // 获取飞手列表
 const flyingHandList = ref([])
+const flyingHandEditList = ref([])
 function getFlyingHandList() {
-    deviceFlyerApi({ current: 1, size: 10 }).then(res => {
-        flyingHandList.value = res?.data?.data ?? []
-    })
+	getAllFlyerIds().then(resIds => {
+		console.log(resIds.data.data, '99999')
+		deviceFlyerApi({ current: 1, size: 9999 }).then(res => {
+			flyingHandEditList.value = res?.data?.data ?? []
+			flyingHandList.value = res?.data?.data ?? []
+			// 把已经建档的飞手从flyingHandList.value里面移除
+			flyingHandList.value = flyingHandList.value.filter(item => !resIds.data.data.includes(item.id))
+			console.log(flyingHandList.value, '11111')
+		})
+	})
 }
 
 provide('flyingHandList', flyingHandList)
+provide('flyingHandEditList', flyingHandEditList)
 
 onMounted(() => {
 	getList()
@@ -227,4 +265,4 @@
     getFlyingHandList()
 })
 </script>
-<style scoped lang="scss"></style>
\ No newline at end of file
+<style scoped lang="scss"></style>

--
Gitblit v1.9.3