|
|
@@ -14,7 +14,7 @@
|
|
|
|
|
|
<template>
|
|
|
<view class="equipment-list-container">
|
|
|
- <NavBar title="管线集列表(分配项目)" />
|
|
|
+ <NavBar title="管道工程列表" />
|
|
|
|
|
|
<scroll-view
|
|
|
class="list-scroll"
|
|
|
@@ -76,7 +76,7 @@
|
|
|
:key="childPipe.id"
|
|
|
class="child-pipe-cell"
|
|
|
>
|
|
|
- <view class="child-pipe-top" @click="handleSelectChildPipe(childPipe, pipeSet.id)">
|
|
|
+ <view class="child-pipe-top" @click="handleSelectChildPipe(childPipe, pipeSet.id, pipeSet.mainID)">
|
|
|
<view class="row">
|
|
|
<view v-if="orderId" class="checkbox-wrapper">
|
|
|
<view class="checkbox" :class="{ checked: selectedChildPipeMap[childPipe.id] }">
|
|
|
@@ -148,16 +148,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <view v-if="showTipsPopup" class="popup-mask" @click="closeTipsPopup">
|
|
|
- <view class="popup-content tips-popup" @click.stop>
|
|
|
- <text class="tips-text">{{ tipsPopupData.text }}</text>
|
|
|
- <view class="popup-actions">
|
|
|
- <button class="action-btn cancel-btn" @click="closeTipsPopup">取消</button>
|
|
|
- <button class="action-btn confirm-btn" @click="handleBatchClaim">确定</button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
<view v-if="showMoreOperate" class="more-operate-overlay" @click="showMoreOperate = false">
|
|
|
<view class="more-operate-panel" :class="{ 'more-panel-show': showMoreOperate }">
|
|
|
<view
|
|
|
@@ -257,25 +247,51 @@
|
|
|
@hide="showUpdateContactPopup = false"
|
|
|
@confirm="handleUpdateSafetyManagerConfirm"
|
|
|
/>
|
|
|
+
|
|
|
+ <view
|
|
|
+ v-if="showCheckProject"
|
|
|
+ class="popup-mask"
|
|
|
+ @click="closeCheckProjectPopup"
|
|
|
+ @touchmove.stop.prevent
|
|
|
+ >
|
|
|
+ <view class="popup-content check-project-popup" @click.stop @touchmove.stop>
|
|
|
+ <view class="popup-header">
|
|
|
+ <text class="popup-title">添加检验项目</text>
|
|
|
+ <text class="popup-close" @click="closeCheckProjectPopup">✕</text>
|
|
|
+ </view>
|
|
|
+ <PipeCheckProject
|
|
|
+ v-if="showCheckProject"
|
|
|
+ :propject-list="checkProjectList"
|
|
|
+ :select-templates="selectTemplates"
|
|
|
+ use-online="1"
|
|
|
+ :equip-data="equipDataForPopup"
|
|
|
+ @change="handleCheckProjectChange"
|
|
|
+ @confirm="handleCheckProjectConfirm"
|
|
|
+ @cancel="closeCheckProjectPopup"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, computed } from 'vue'
|
|
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
-import { batchClaim, pressure2NotVerifyPageApi } from '@/api/task'
|
|
|
+import { pressure2NotVerifyPageApi } from '@/api/task'
|
|
|
import { useUserStore } from '@/store/user'
|
|
|
import {
|
|
|
PressureCheckerMyTaskStatus,
|
|
|
PressureCheckerMyTaskStatusMap,
|
|
|
+ PressureReportType,
|
|
|
EquipmentType,
|
|
|
} from '@/utils/dictMap'
|
|
|
import dayjs from 'dayjs'
|
|
|
import UpdateSafetyManagerPopup from '@/pages/unClaim/components/UpdateSafetyManagerPopup.vue'
|
|
|
import { TaskOrderFuncName, requestFunc } from '@/api/ApiRouter/taskOrder'
|
|
|
-import { getPipeDetailByOrderItemId, getPipeTaskItemListByOrderId } from '@/api/pipe/pipeTaskOrder'
|
|
|
+import { getPipeDetailByOrderItemId, getPipeTaskItemListByOrderId, addInspectProject } from '@/api/pipe/pipeTaskOrder'
|
|
|
import { updateEquipPipe } from '@/api/pipe/pipeEquip'
|
|
|
import NavBar from '@/components/NavBar/NavBar.vue'
|
|
|
+import PipeCheckProject from '@/pages/taskOnline/components/PipeCheckProject.vue'
|
|
|
|
|
|
|
|
|
|
|
|
@@ -311,9 +327,6 @@ const canSuspend = ref(false)
|
|
|
const canAddInspectionplan = ref(false)
|
|
|
const canUpdateContact = ref(false)
|
|
|
|
|
|
-const showTipsPopup = ref(false)
|
|
|
-const tipsPopupData = ref<PopupData>({ text: '', isClaim: false })
|
|
|
-
|
|
|
const showMoreOperate = ref(false)
|
|
|
const showSuspendPopup = ref(false)
|
|
|
const suspendReason = ref('')
|
|
|
@@ -330,6 +343,12 @@ const templateListColumn = computed(() => [
|
|
|
const showUpdateContactPopup = ref(false)
|
|
|
const currentItem = ref<any>({})
|
|
|
|
|
|
+const showCheckProject = ref(false)
|
|
|
+const checkProjectList = ref<any[][]>([])
|
|
|
+const selectTemplates = ref<Record<string, any[]>>({})
|
|
|
+const currentSelectedItems = ref<any[]>([])
|
|
|
+const equipDataForPopup = ref<any>({})
|
|
|
+
|
|
|
const currentSafeManager = computed(() => ({
|
|
|
name: currentItem.value?.securityMan || '',
|
|
|
phone: currentItem.value?.securityManPhone || '',
|
|
|
@@ -350,7 +369,7 @@ const fetchPipeSetList = async () => {
|
|
|
const res = await getPipeTaskItemListByOrderId({ id: orderId.value })
|
|
|
pipeSetList.value = res?.data?.orderItems || []
|
|
|
} catch (error) {
|
|
|
- console.error('获取管线集列表失败:', error)
|
|
|
+ console.error('获取管道工程列表失败:', error)
|
|
|
} finally {
|
|
|
loading.value = false
|
|
|
}
|
|
|
@@ -395,7 +414,7 @@ const fetchPipeSetChildren = async (pipeSetId: string) => {
|
|
|
const res = await getPipeDetailByOrderItemId({ orderItemId: mainID })
|
|
|
pipeSetChildren.value[pipeSetId] = res?.data || []
|
|
|
} catch (error) {
|
|
|
- console.error('获取下级管线失败:', error)
|
|
|
+ console.error('获取管道设备失败:', error)
|
|
|
pipeSetChildren.value[pipeSetId] = []
|
|
|
} finally {
|
|
|
pipeSetChildrenLoading.value[pipeSetId] = false
|
|
|
@@ -415,12 +434,12 @@ const handleSelectPipeSet = (item: any) => {
|
|
|
selectAllPipeSet.value = selectedPipeSets.value.length === pipeSetList.value.length
|
|
|
}
|
|
|
|
|
|
-const handleSelectChildPipe = (childPipe: any, pipeSetId: string) => {
|
|
|
+const handleSelectChildPipe = (childPipe: any, pipeSetId: string, orderItemId: string) => {
|
|
|
if (!orderId.value) return
|
|
|
const isSelected = !selectedChildPipeMap.value[childPipe.id]
|
|
|
selectedChildPipeMap.value[childPipe.id] = isSelected
|
|
|
if (isSelected) {
|
|
|
- selectedChildPipes.value.push({ ...childPipe, pipeSetId })
|
|
|
+ selectedChildPipes.value.push({ ...childPipe, pipeSetId, orderItemId })
|
|
|
} else {
|
|
|
selectedChildPipes.value = selectedChildPipes.value.filter((ele) => ele.id !== childPipe.id)
|
|
|
}
|
|
|
@@ -466,91 +485,79 @@ const initSelect = () => {
|
|
|
updateOperateStatus()
|
|
|
}
|
|
|
|
|
|
-const showBatchClaimPopup = (popupData: PopupData) => {
|
|
|
- const networkType = uni.getNetworkTypeSync?.()
|
|
|
- if (networkType === 'none') {
|
|
|
- return uni.showToast({ title: '暂无网络无法认领,请联网后认领设备', icon: 'error' })
|
|
|
- }
|
|
|
- if (!selectedPipeSets.value.length && !selectedChildPipes.value.length) {
|
|
|
- return uni.showToast({
|
|
|
- title: `请选择要批量${popupData.isClaim ? '取消认领' : '认领'}的管线`,
|
|
|
- icon: 'error',
|
|
|
- })
|
|
|
- }
|
|
|
- tipsPopupData.value = popupData
|
|
|
- showTipsPopup.value = true
|
|
|
-}
|
|
|
-
|
|
|
-const closeTipsPopup = () => {
|
|
|
- showTipsPopup.value = false
|
|
|
-}
|
|
|
|
|
|
-const handleBatchClaim = async () => {
|
|
|
- closeTipsPopup()
|
|
|
- const ids = [
|
|
|
- ...selectedPipeSets.value.map((item: any) => item.id),
|
|
|
- ...selectedChildPipes.value.map((item: any) => item.id),
|
|
|
- ]
|
|
|
- const params: { ids: string[]; isCancel?: true } = { ids }
|
|
|
- if (tipsPopupData.value.isClaim) {
|
|
|
- params.isCancel = true
|
|
|
+const showCheckProjectPopup = async () => {
|
|
|
+ if (selectedChildPipes.value.length) {
|
|
|
+ return uni.showToast({ title: '选中管道设备时不可添加项目', icon: 'error' })
|
|
|
}
|
|
|
- try {
|
|
|
- const result = await batchClaim(params)
|
|
|
- updateClaim(result, ids, !tipsPopupData.value.isClaim)
|
|
|
- } catch (error) {
|
|
|
- uni.showToast({ title: '操作失败', icon: 'error' })
|
|
|
+ if (!selectedPipeSets.value.length) {
|
|
|
+ return uni.showToast({ title: '请先选择管道工程', icon: 'error' })
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-const fetchClaimEquipments = async (equipmentId: string, isClaim: boolean) => {
|
|
|
- const networkType = uni.getNetworkTypeSync?.()
|
|
|
- if (networkType === 'none') {
|
|
|
- return uni.showToast({ title: '暂无网络无法认领,请联网后认领设备', icon: 'error' })
|
|
|
- }
|
|
|
- const currentUserInfo = userInfo.value
|
|
|
- if (!currentUserInfo) {
|
|
|
- return uni.redirectTo({ url: '/pages/login/login' })
|
|
|
- }
|
|
|
try {
|
|
|
- let result: any
|
|
|
- if (isClaim) {
|
|
|
- result = await requestFunc(TaskOrderFuncName.EquipmentConfirmClaim, EquipmentType.PIPE, {
|
|
|
- id: equipmentId,
|
|
|
- })
|
|
|
- } else {
|
|
|
- result = await requestFunc(TaskOrderFuncName.EquipmentCancelClaim, EquipmentType.PIPE, {
|
|
|
- id: equipmentId,
|
|
|
- })
|
|
|
+ uni.showLoading({ title: '加载中...' })
|
|
|
+ const firstSelectedPipeSet = selectedPipeSets.value[0]
|
|
|
+ if (firstSelectedPipeSet) {
|
|
|
+ equipDataForPopup.value = {
|
|
|
+ taskOrder: {
|
|
|
+ id: orderId.value,
|
|
|
+ checkType: firstSelectedPipeSet.checkType,
|
|
|
+ },
|
|
|
+ taskOrderItem: firstSelectedPipeSet,
|
|
|
+ reportList: firstSelectedPipeSet.reportRespVOList || [],
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const projectList: any[][] = []
|
|
|
+ for (const item of selectedPipeSets.value) {
|
|
|
+ if (item.reportRespVOList || item.reportDOList) {
|
|
|
+ projectList.push(item.reportRespVOList || item.reportDOList)
|
|
|
+ }
|
|
|
}
|
|
|
- updateClaim(result, [equipmentId], !isClaim)
|
|
|
+ checkProjectList.value = projectList
|
|
|
+ uni.hideLoading()
|
|
|
} catch (error) {
|
|
|
- uni.showToast({ title: '操作失败', icon: 'error' })
|
|
|
+ uni.hideLoading()
|
|
|
+ console.error('加载管道工程详情失败:', error)
|
|
|
+ return uni.showToast({ title: '加载失败', icon: 'error' })
|
|
|
}
|
|
|
+
|
|
|
+ selectTemplates.value = {}
|
|
|
+ currentSelectedItems.value = []
|
|
|
+ showCheckProject.value = true
|
|
|
}
|
|
|
|
|
|
-const updateClaim = async (result: any, equipmentIds: string[], isClaim: boolean) => {
|
|
|
- if (result?.code === 0 && result?.data === true) {
|
|
|
- uni.showToast({ title: `${isClaim ? '认领' : '取消认领'}成功` })
|
|
|
- initSelect()
|
|
|
- await fetchPipeSetList()
|
|
|
- } else {
|
|
|
- const msg = result?.msg || `${isClaim ? '认领' : '取消认领'}失败`
|
|
|
- uni.showToast({ title: msg, icon: 'error' })
|
|
|
- }
|
|
|
+const closeCheckProjectPopup = () => {
|
|
|
+ showCheckProject.value = false
|
|
|
+ currentSelectedItems.value = []
|
|
|
}
|
|
|
|
|
|
-const showCheckProjectPopup = () => {
|
|
|
- if (selectedChildPipes.value.length) {
|
|
|
- return uni.showToast({ title: '选中管线时不可添加项目', icon: 'error' })
|
|
|
- }
|
|
|
- if (!selectedPipeSets.value.length) {
|
|
|
- return uni.showToast({ title: '请先选择管线集', icon: 'error' })
|
|
|
- }
|
|
|
- const ids = selectedPipeSets.value.map((item: any) => item.id)
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/equipment/detail/components/checkProjectPopup/addCheckProjectPopup?selectedEquipmentIds=${ids.join(',')}&useOnline=1`,
|
|
|
+const handleCheckProjectChange = (selectedItems: any[]) => {
|
|
|
+ currentSelectedItems.value = selectedItems
|
|
|
+}
|
|
|
+
|
|
|
+const handleCheckProjectConfirm = (itemList: any[]) => {
|
|
|
+ console.log('确认选中的检验项目:', itemList)
|
|
|
+ console.log('selected pipe:', selectedPipeSets.value)
|
|
|
+ const reqList = []
|
|
|
+ selectedPipeSets.value.forEach((item: any) => {
|
|
|
+ itemList.forEach((project: any) => {
|
|
|
+ reqList.push({
|
|
|
+ connectId: project.connectId,
|
|
|
+ fee: project.fee,
|
|
|
+ templateId: project.templateId,
|
|
|
+ type: project.type,
|
|
|
+ orderItemId: item.mainID
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
+ addInspectProject({
|
|
|
+ itemList: reqList,
|
|
|
+ type: 200,
|
|
|
+ orderId: orderId.value,
|
|
|
+ })
|
|
|
+ fetchPipeSetList()
|
|
|
+ closeCheckProjectPopup()
|
|
|
}
|
|
|
|
|
|
const showSuspendPopupFunc = () => {
|
|
|
@@ -559,7 +566,7 @@ const showSuspendPopupFunc = () => {
|
|
|
return uni.showToast({ title: '当前网络连接不可用,请检查网络设置后重新操作', icon: 'error' })
|
|
|
}
|
|
|
if (!selectedChildPipes.value.length) {
|
|
|
- return uni.showToast({ title: '请先选择下级管线', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '请先选择管道设备', icon: 'error' })
|
|
|
}
|
|
|
showMoreOperate.value = false
|
|
|
showSuspendPopup.value = true
|
|
|
@@ -579,7 +586,7 @@ const suspendCheck = async () => {
|
|
|
const reqData = {
|
|
|
orderItemDetails: selectedChildPipes.value.map((item: any) => ({
|
|
|
id: item.id,
|
|
|
- equipPipeId: item.equipPipeId,
|
|
|
+ equipPipeId: item.orderItemId,
|
|
|
})),
|
|
|
reason: suspendReason.value,
|
|
|
reasonDict: '',
|
|
|
@@ -612,13 +619,13 @@ const createInform = async () => {
|
|
|
if (!orderId.value) return
|
|
|
|
|
|
if (selectedPipeSets.value.length !== 1) {
|
|
|
- return uni.showToast({ title: '只能选择一个管线集添加重大问题线索', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '只能选择一个管道工程添加重大问题线索', icon: 'error' })
|
|
|
}
|
|
|
|
|
|
const selectedPipeSet = selectedPipeSets.value[0]
|
|
|
- const majorIssue = selectedPipeSet.reportDOList?.find((item: any) => item.reportType == 500)
|
|
|
+ const majorIssue = selectedPipeSet.reportRespVOList?.find((item: any) => item.reportType == PressureReportType.MAINQUESTION)
|
|
|
if (majorIssue) {
|
|
|
- return uni.showToast({ title: '该管线集已添加了重大问题线索', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '该管道工程已添加了重大问题线索', icon: 'error' })
|
|
|
}
|
|
|
|
|
|
uni.showLoading({ title: '提交中...', mask: true })
|
|
|
@@ -626,7 +633,7 @@ const createInform = async () => {
|
|
|
const orderFormResp = await requestFunc(TaskOrderFuncName.GetOrderForm, EquipmentType.PIPE, {
|
|
|
orderId: orderId.value,
|
|
|
businessType: 400,
|
|
|
- orderItemId: selectedPipeSet.id,
|
|
|
+ orderItemId: selectedPipeSet.mainID,
|
|
|
})
|
|
|
const templateId = orderFormResp?.data?.templateId || ''
|
|
|
const reqData = {
|
|
|
@@ -634,31 +641,36 @@ const createInform = async () => {
|
|
|
businessType: 400,
|
|
|
modifiedReason: '',
|
|
|
orderId: orderId.value,
|
|
|
- orderItemId: selectedPipeSet.id,
|
|
|
+ orderItemId: selectedPipeSet.mainID,
|
|
|
},
|
|
|
orderId: orderId.value,
|
|
|
- orderItemId: selectedPipeSet.id,
|
|
|
+ orderItemId: selectedPipeSet.mainID,
|
|
|
prepareId: userInfo.value?.id || '',
|
|
|
prepareName: userInfo.value?.nickname || '',
|
|
|
templateId: templateId,
|
|
|
}
|
|
|
const addMajorIssueResp = await requestFunc(TaskOrderFuncName.AddMajorIssues, EquipmentType.PIPE, reqData)
|
|
|
+ if (addMajorIssueResp?.code !== 0) {
|
|
|
+ return uni.showToast({ title: addMajorIssueResp?.msg || '操作失败', icon: 'error' })
|
|
|
+ }
|
|
|
const refId = addMajorIssueResp?.data || ''
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/editor/importanceEditor?templateId=${templateId}&refId=${refId}`,
|
|
|
+ url: `/pages/editor/mainQuestionEditor?templateId=${templateId}&refId=${refId}`,
|
|
|
})
|
|
|
} catch (error) {
|
|
|
uni.hideLoading()
|
|
|
uni.showToast({ title: '操作失败', icon: 'error' })
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const showAddInspectionplanPopup = async () => {
|
|
|
if (!canAddInspectionplan.value) {
|
|
|
if (selectedChildPipes.value.length) {
|
|
|
- return uni.showToast({ title: '选中管线时不可添加检验方案', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '选中管道设备时不可添加检验方案', icon: 'error' })
|
|
|
}
|
|
|
- return uni.showToast({ title: '请先选择管线集', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '请先选择管道工程', icon: 'error' })
|
|
|
}
|
|
|
showMoreOperate.value = false
|
|
|
showInspectionplanPopup.value = true
|
|
|
@@ -699,7 +711,7 @@ const addInspectionplanConfirm = async () => {
|
|
|
try {
|
|
|
const reqData = {
|
|
|
orderId: orderId.value,
|
|
|
- orderItemIds: selectedPipeSets.value.map((item) => item.id),
|
|
|
+ orderItemIds: selectedPipeSets.value.map((item) => item.mainID),
|
|
|
prepareId: userInfo.value?.id || '',
|
|
|
prepareJson: JSON.stringify({
|
|
|
prepareName: userInfo.value?.nickname || '',
|
|
|
@@ -710,6 +722,9 @@ const addInspectionplanConfirm = async () => {
|
|
|
templateId: selectedTemplateId.value,
|
|
|
}
|
|
|
const res = await requestFunc(TaskOrderFuncName.AddMajorIssues, EquipmentType.PIPE, reqData)
|
|
|
+ if (res?.code !== 0) {
|
|
|
+ return uni.showToast({ title: res?.msg || '操作失败', icon: 'error' })
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/editor/inspectionPlanEditor?templateId=${selectedTemplateId.value}&refId=${res?.data || ''}`,
|
|
|
})
|
|
|
@@ -728,7 +743,7 @@ const handleUpdateContact = () => {
|
|
|
|
|
|
const handleUpdateSafetyManagerConfirm = async (params: { name: string; phone: string }) => {
|
|
|
if (selectedPipeSets.value.length < 1) {
|
|
|
- return uni.showToast({ title: '请选择管道项目', icon: 'error' })
|
|
|
+ return uni.showToast({ title: '请选择管道工程', icon: 'error' })
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
@@ -1227,4 +1242,26 @@ const handleRouteToEquipmentDetail = (item: any, pageType: string) => {
|
|
|
::deep(.wd-collapse-item__arrow) {
|
|
|
display: none;
|
|
|
}
|
|
|
+
|
|
|
+.check-project-popup {
|
|
|
+ width: 85%;
|
|
|
+ max-width: none;
|
|
|
+ height: 80vh;
|
|
|
+ padding: 0;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-header {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 15px;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-close {
|
|
|
+ font-size: 20px;
|
|
|
+ color: #999;
|
|
|
+}
|
|
|
</style>
|