TaskOnlinePipeEquipmentList.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  1. <route lang="json5" type="page">
  2. {
  3. layout: 'default',
  4. style: {
  5. navigationBarTitleText: '管线集列表(分配项目)',
  6. navigationStyle: 'custom',
  7. disableScroll: true,
  8. 'app-plus': {
  9. bounce: 'none',
  10. },
  11. },
  12. }
  13. </route>
  14. <template>
  15. <view class="equipment-list-container">
  16. <NavBar title="管道工程列表" />
  17. <scroll-view
  18. class="list-scroll"
  19. scroll-y
  20. refresher-enabled
  21. :refresher-triggered="refreshing"
  22. @refresherrefresh="onRefresh"
  23. >
  24. <wd-collapse v-model="expandedNames" @change="handleCollapseChange">
  25. <wd-collapse-item
  26. v-for="pipeSet in pipeSetList"
  27. :key="pipeSet.id"
  28. :title="pipeSet.equipName + '(' + pipeSet.productNo + ')'"
  29. :name="pipeSet.id"
  30. >
  31. <template #title>
  32. <view class="pipe-set-header" @click.stop>
  33. <view class="row">
  34. <view v-if="orderId" class="checkbox-wrapper" @click="handleSelectPipeSet(pipeSet)">
  35. <view class="checkbox" :class="{ checked: selectedPipeSetMap[pipeSet.id] }">
  36. <image
  37. v-if="selectedPipeSetMap[pipeSet.id]"
  38. class="check-icon"
  39. src="/static/images/white-check.png"
  40. mode="aspectFit"
  41. />
  42. </view>
  43. </view>
  44. <view class="cell-top-left" @click="handleSelectPipeSet(pipeSet)">
  45. <text class="equip-name">{{ pipeSet.equipName }}({{ pipeSet.projectNo }})</text>
  46. <text class="main-checker">主检人:{{ pipeSet?.mainCheckerUser?.nickname || '' }}</text>
  47. <view
  48. class="status-tag"
  49. :class="
  50. pipeSet?.taskStatus !== PressureCheckerMyTaskStatus.CONFIRMED
  51. ? 'status-pending'
  52. : 'status-done'
  53. "
  54. >
  55. <text class="status-text">
  56. {{ PressureCheckerMyTaskStatusMap[pipeSet?.taskStatus] }}
  57. </text>
  58. </view>
  59. </view>
  60. <view class="expand-arrow" @click.stop="toggleCollapse(pipeSet.id)">
  61. <text class="arrow-icon" :class="{ 'arrow-expanded': expandedNames.includes(pipeSet.id) }">▶</text>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <view v-if="!pipeSetChildren[pipeSet.id]" class="loading-text">加载中...</view>
  67. <view v-else-if="pipeSetChildren[pipeSet.id].length === 0" class="empty-text-small">
  68. <text>暂无下级管线</text>
  69. </view>
  70. <view v-else>
  71. <view
  72. v-for="childPipe in pipeSetChildren[pipeSet.id]"
  73. :key="childPipe.id"
  74. class="child-pipe-cell"
  75. >
  76. <view class="child-pipe-top" @click="handleSelectChildPipe(childPipe, pipeSet.id, pipeSet.mainID)">
  77. <view class="row">
  78. <view v-if="orderId" class="checkbox-wrapper">
  79. <view class="checkbox" :class="{ checked: selectedChildPipeMap[childPipe.id] }">
  80. <image
  81. v-if="selectedChildPipeMap[childPipe.id]"
  82. class="check-icon"
  83. src="/static/images/white-check.png"
  84. mode="aspectFit"
  85. />
  86. </view>
  87. </view>
  88. <view class="cell-top-left">
  89. <text class="child-pipe-name">{{ childPipe.equipName || childPipe.pipeName || '' }}({{ childPipe.pipeNo }})</text>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="child-pipe-info" @click="handleRouteToEquipmentDetail(childPipe, 'EQUIPMENT')">
  94. <view class="info-box">
  95. <text class="info-label">
  96. 设备注册代码:
  97. <text class="info-value">{{ childPipe.pipeRegCode || '' }}</text>
  98. </text>
  99. </view>
  100. </view>
  101. <view class="cell-bottom">
  102. <view
  103. v-if="childPipe.isClaim"
  104. class="record-btn blue-btn"
  105. @click="handleRouteToEquipmentDetail(childPipe, 'INSPECT')"
  106. >
  107. <text class="blue-btn-text">记录录入</text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </wd-collapse-item>
  113. </wd-collapse>
  114. <view v-if="loading && pipeSetList.length === 0" class="loading-text">加载中...</view>
  115. <view v-if="!loading && pipeSetList.length === 0" class="empty-text">
  116. <text>暂无数据</text>
  117. </view>
  118. </scroll-view>
  119. <view v-if="orderId" class="bottom-operate">
  120. <view class="select-all" @click="handleSelectAllPipeSet">
  121. <view class="checkbox" :class="{ checked: selectAllPipeSet }">
  122. <image
  123. v-if="selectAllPipeSet"
  124. class="check-icon"
  125. src="/static/images/white-check.png"
  126. mode="aspectFit"
  127. />
  128. </view>
  129. <text class="select-all-text">全选项目</text>
  130. </view>
  131. <view class="btn-group">
  132. <button class="operate-btn blue-btn" @click="showMoreOperate = true">更多操作</button>
  133. <button
  134. class="operate-btn blue-btn"
  135. :class="{ 'btn-disabled': selectedChildPipes.length > 0 }"
  136. :style="selectedChildPipes.length > 0 ? { opacity: 0.5 } : {}"
  137. @click="selectedChildPipes.length === 0 && showCheckProjectPopup()"
  138. >
  139. 添加项目
  140. </button>
  141. </view>
  142. </view>
  143. <view v-if="showMoreOperate" class="more-operate-overlay" @click="showMoreOperate = false">
  144. <view class="more-operate-panel" :class="{ 'more-panel-show': showMoreOperate }">
  145. <view
  146. class="more-btn-item"
  147. :class="{ disabled: !canInform }"
  148. @click="canInform && createInform()"
  149. >
  150. <view class="more-btn-inner more-btn-border">
  151. <text class="more-btn-text" :style="{ color: canInform ? 'rgb(51,51,51)' : '#ccc' }">
  152. 重大问题线索
  153. </text>
  154. </view>
  155. </view>
  156. <view
  157. class="more-btn-item"
  158. :class="{ disabled: !canSuspend }"
  159. @click="canSuspend && showSuspendPopupFunc()"
  160. >
  161. <view class="more-btn-inner more-btn-border">
  162. <text class="more-btn-text" :style="{ color: canSuspend ? 'rgb(51,51,51)' : '#ccc' }">
  163. 客户拒检
  164. </text>
  165. </view>
  166. </view>
  167. <view
  168. class="more-btn-item"
  169. :class="{ disabled: !canAddInspectionplan }"
  170. @click="canAddInspectionplan && showAddInspectionplanPopup()"
  171. >
  172. <view class="more-btn-inner more-btn-border">
  173. <text
  174. class="more-btn-text"
  175. :style="{ color: canAddInspectionplan ? 'rgb(51,51,51)' : '#ccc' }"
  176. >
  177. 检验方案
  178. </text>
  179. </view>
  180. </view>
  181. <view
  182. class="more-btn-item"
  183. :class="{ disabled: !canUpdateContact }"
  184. @click="canUpdateContact && handleUpdateContact()"
  185. >
  186. <view class="more-btn-inner more-btn-border">
  187. <text
  188. class="more-btn-text"
  189. :style="{ color: canUpdateContact ? 'rgb(51,51,51)' : '#ccc' }"
  190. >
  191. 修改安全管理员
  192. </text>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. <view v-if="showSuspendPopup" class="popup-mask" @click="closeSuspendPopup">
  198. <view class="popup-content suspend-popup" @click.stop>
  199. <text class="popup-title">客户拒检</text>
  200. <textarea
  201. v-model="suspendReason"
  202. class="suspend-textarea"
  203. placeholder="请输入中止检验原因"
  204. />
  205. <view class="popup-actions">
  206. <button class="action-btn cancel-btn" @click="closeSuspendPopup">取消</button>
  207. <button class="action-btn confirm-btn" @click="suspendCheck">确定</button>
  208. </view>
  209. </view>
  210. </view>
  211. <view v-if="showInspectionplanPopup" class="popup-mask" @click="closeInspectionplanPopup">
  212. <view class="popup-content inspectionplan-popup" @click.stop>
  213. <text class="popup-title">添加检验方案</text>
  214. <view class="form-item">
  215. <text class="form-label">模板封面</text>
  216. <wd-picker
  217. v-model="selectedTemplateId"
  218. :columns="templateListColumn"
  219. @confirm="onTemplateChange"
  220. />
  221. </view>
  222. <view class="form-item">
  223. <text class="form-label">检验方案名称</text>
  224. <input v-model="inspectionplanName" class="form-input" placeholder="请输入检验方案名称" />
  225. </view>
  226. <view class="popup-actions">
  227. <button class="action-btn cancel-btn" @click="closeInspectionplanPopup">取消</button>
  228. <button class="action-btn confirm-btn" @click="addInspectionplanConfirm">确定</button>
  229. </view>
  230. </view>
  231. </view>
  232. <UpdateSafetyManagerPopup
  233. v-if="showUpdateContactPopup"
  234. :safe-manager="currentSafeManager.name"
  235. :safe-manager-phone="currentSafeManager.phone"
  236. @hide="showUpdateContactPopup = false"
  237. @confirm="handleUpdateSafetyManagerConfirm"
  238. />
  239. <view
  240. v-if="showCheckProject"
  241. class="popup-mask"
  242. @click="closeCheckProjectPopup"
  243. @touchmove.stop.prevent
  244. >
  245. <view class="popup-content check-project-popup" @click.stop @touchmove.stop>
  246. <view class="popup-header">
  247. <text class="popup-title">添加检验项目</text>
  248. <text class="popup-close" @click="closeCheckProjectPopup">✕</text>
  249. </view>
  250. <PipeCheckProject
  251. v-if="showCheckProject"
  252. :propject-list="checkProjectList"
  253. :select-templates="selectTemplates"
  254. use-online="1"
  255. :equip-data="equipDataForPopup"
  256. @change="handleCheckProjectChange"
  257. @confirm="handleCheckProjectConfirm"
  258. @cancel="closeCheckProjectPopup"
  259. />
  260. </view>
  261. </view>
  262. </view>
  263. </template>
  264. <script lang="ts" setup>
  265. import { ref, computed } from 'vue'
  266. import { onLoad, onShow } from '@dcloudio/uni-app'
  267. import { pressure2NotVerifyPageApi } from '@/api/task'
  268. import { useUserStore } from '@/store/user'
  269. import {
  270. PressureCheckerMyTaskStatus,
  271. PressureCheckerMyTaskStatusMap,
  272. PressureReportType,
  273. EquipmentType,
  274. } from '@/utils/dictMap'
  275. import dayjs from 'dayjs'
  276. import UpdateSafetyManagerPopup from '@/pages/unClaim/components/UpdateSafetyManagerPopup.vue'
  277. import { TaskOrderFuncName, requestFunc } from '@/api/ApiRouter/taskOrder'
  278. import { getPipeDetailByOrderItemId, getPipeTaskItemListByOrderId, addInspectProject } from '@/api/pipe/pipeTaskOrder'
  279. import { updateEquipPipeSafetyManager } from '@/api/pipe/pipeEquip'
  280. import NavBar from '@/components/NavBar/NavBar.vue'
  281. import PipeCheckProject from '@/pages/taskOnline/components/PipeCheckProject.vue'
  282. interface PopupData {
  283. text: string
  284. isClaim: boolean
  285. }
  286. defineOptions({ name: 'TaskOnlinePipeEquipmentList' })
  287. const userStore = useUserStore()
  288. const userInfo = computed(() => userStore.userInfo)
  289. const orderId = ref('')
  290. const orderNo = ref('')
  291. const pipeSetList = ref<any[]>([])
  292. const loading = ref(false)
  293. const refreshing = ref(false)
  294. const expandedNames = ref<string[]>([])
  295. const pipeSetChildren = ref<Record<string, any[]>>({})
  296. const pipeSetChildrenLoading = ref<Record<string, boolean>>({})
  297. const selectedPipeSets = ref<any[]>([])
  298. const selectedPipeSetMap = ref<Record<string, boolean>>({})
  299. const selectAllPipeSet = ref(false)
  300. const selectedChildPipes = ref<any[]>([])
  301. const selectedChildPipeMap = ref<Record<string, boolean>>({})
  302. const canInform = ref(false)
  303. const canSuspend = ref(false)
  304. const canAddInspectionplan = ref(false)
  305. const canUpdateContact = ref(false)
  306. const showMoreOperate = ref(false)
  307. const showSuspendPopup = ref(false)
  308. const suspendReason = ref('')
  309. const showInspectionplanPopup = ref(false)
  310. const inspectionplanName = ref('')
  311. const selectedTemplate = ref<any>(null)
  312. const selectedTemplateId = ref('')
  313. const templateList = ref<any[]>([])
  314. const templateListColumn = computed(() => [
  315. templateList.value.map((item) => ({ label: item.tbName, value: item.id })),
  316. ])
  317. const showUpdateContactPopup = ref(false)
  318. const currentItem = ref<any>({})
  319. const showCheckProject = ref(false)
  320. const checkProjectList = ref<any[][]>([])
  321. const selectTemplates = ref<Record<string, any[]>>({})
  322. const currentSelectedItems = ref<any[]>([])
  323. const equipDataForPopup = ref<any>({})
  324. const currentSafeManager = computed(() => ({
  325. name: currentItem.value?.securityMan || '',
  326. phone: currentItem.value?.securityManPhone || '',
  327. }))
  328. onLoad((options: any) => {
  329. orderId.value = options?.orderId || ''
  330. orderNo.value = options?.orderNo || ''
  331. })
  332. onShow(() => {
  333. fetchPipeSetList()
  334. })
  335. const fetchPipeSetList = async () => {
  336. loading.value = true
  337. try {
  338. const res = await getPipeTaskItemListByOrderId({ id: orderId.value })
  339. pipeSetList.value = res?.data?.orderItems || []
  340. } catch (error) {
  341. console.error('获取管道工程列表失败:', error)
  342. } finally {
  343. loading.value = false
  344. }
  345. }
  346. const onRefresh = async () => {
  347. refreshing.value = true
  348. await fetchPipeSetList()
  349. refreshing.value = false
  350. }
  351. const refreshList = () => {
  352. fetchPipeSetList()
  353. }
  354. const handleCollapseChange = ({ value }: any) => {
  355. const newNames = Array.isArray(value) ? value : [value]
  356. const added = newNames.find((name: string) => !expandedNames.value.includes(name))
  357. expandedNames.value = newNames
  358. if (added && !pipeSetChildren.value[added]) {
  359. fetchPipeSetChildren(added)
  360. }
  361. }
  362. const toggleCollapse = (pipeSetId: string) => {
  363. const isExpanded = expandedNames.value.includes(pipeSetId)
  364. if (isExpanded) {
  365. expandedNames.value = expandedNames.value.filter((id) => id !== pipeSetId)
  366. } else {
  367. expandedNames.value = [...expandedNames.value, pipeSetId]
  368. if (!pipeSetChildren.value[pipeSetId]) {
  369. fetchPipeSetChildren(pipeSetId)
  370. }
  371. }
  372. }
  373. const fetchPipeSetChildren = async (pipeSetId: string) => {
  374. pipeSetChildrenLoading.value[pipeSetId] = true
  375. try {
  376. const pipeSet = pipeSetList.value.find((item) => item.id === pipeSetId)
  377. const mainID = pipeSet?.mainID || pipeSetId
  378. const res = await getPipeDetailByOrderItemId({ orderItemId: mainID })
  379. pipeSetChildren.value[pipeSetId] = res?.data || []
  380. } catch (error) {
  381. console.error('获取管道设备失败:', error)
  382. pipeSetChildren.value[pipeSetId] = []
  383. } finally {
  384. pipeSetChildrenLoading.value[pipeSetId] = false
  385. }
  386. }
  387. const handleSelectPipeSet = (item: any) => {
  388. if (!orderId.value) return
  389. const isSelected = !selectedPipeSetMap.value[item.id]
  390. selectedPipeSetMap.value[item.id] = isSelected
  391. if (isSelected) {
  392. selectedPipeSets.value.push(item)
  393. } else {
  394. selectedPipeSets.value = selectedPipeSets.value.filter((ele) => ele.id !== item.id)
  395. }
  396. updateOperateStatus()
  397. selectAllPipeSet.value = selectedPipeSets.value.length === pipeSetList.value.length
  398. }
  399. const handleSelectChildPipe = (childPipe: any, pipeSetId: string, orderItemId: string) => {
  400. if (!orderId.value) return
  401. const isSelected = !selectedChildPipeMap.value[childPipe.id]
  402. selectedChildPipeMap.value[childPipe.id] = isSelected
  403. if (isSelected) {
  404. selectedChildPipes.value.push({ ...childPipe, pipeSetId, orderItemId })
  405. } else {
  406. selectedChildPipes.value = selectedChildPipes.value.filter((ele) => ele.id !== childPipe.id)
  407. }
  408. updateOperateStatus()
  409. }
  410. const handleSelectAllPipeSet = () => {
  411. const newSelectAll = !selectAllPipeSet.value
  412. selectAllPipeSet.value = newSelectAll
  413. selectedPipeSets.value = []
  414. const newMap: Record<string, boolean> = {}
  415. for (const item of pipeSetList.value) {
  416. newMap[item.id] = newSelectAll
  417. if (newSelectAll) {
  418. selectedPipeSets.value.push(item)
  419. }
  420. }
  421. selectedPipeSetMap.value = newMap
  422. updateOperateStatus()
  423. }
  424. const updateOperateStatus = () => {
  425. const hasChildPipeSelected = selectedChildPipes.value.length > 0
  426. if (hasChildPipeSelected) {
  427. canInform.value = false
  428. canAddInspectionplan.value = false
  429. canUpdateContact.value = false
  430. canSuspend.value = selectedChildPipes.value.length >= 1
  431. } else {
  432. canInform.value = selectedPipeSets.value.length === 1
  433. canAddInspectionplan.value = selectedPipeSets.value.length >= 1
  434. canUpdateContact.value = selectedPipeSets.value.length === 1
  435. canSuspend.value = false
  436. }
  437. }
  438. const initSelect = () => {
  439. selectedPipeSets.value = []
  440. selectedPipeSetMap.value = {}
  441. selectAllPipeSet.value = false
  442. selectedChildPipes.value = []
  443. selectedChildPipeMap.value = {}
  444. updateOperateStatus()
  445. }
  446. const showCheckProjectPopup = async () => {
  447. if (selectedChildPipes.value.length) {
  448. return uni.showToast({ title: '选中管道设备时不可添加项目', icon: 'error' })
  449. }
  450. if (!selectedPipeSets.value.length) {
  451. return uni.showToast({ title: '请先选择管道工程', icon: 'error' })
  452. }
  453. try {
  454. uni.showLoading({ title: '加载中...' })
  455. const firstSelectedPipeSet = selectedPipeSets.value[0]
  456. if (firstSelectedPipeSet) {
  457. equipDataForPopup.value = {
  458. taskOrder: {
  459. id: orderId.value,
  460. checkType: firstSelectedPipeSet.checkType,
  461. },
  462. taskOrderItem: firstSelectedPipeSet,
  463. reportList: firstSelectedPipeSet.reportRespVOList || [],
  464. }
  465. }
  466. const projectList: any[][] = []
  467. for (const item of selectedPipeSets.value) {
  468. if (item.reportRespVOList || item.reportDOList) {
  469. projectList.push(item.reportRespVOList || item.reportDOList)
  470. }
  471. }
  472. checkProjectList.value = projectList
  473. uni.hideLoading()
  474. } catch (error) {
  475. uni.hideLoading()
  476. console.error('加载管道工程详情失败:', error)
  477. return uni.showToast({ title: '加载失败', icon: 'error' })
  478. }
  479. selectTemplates.value = {}
  480. currentSelectedItems.value = []
  481. showCheckProject.value = true
  482. }
  483. const closeCheckProjectPopup = () => {
  484. showCheckProject.value = false
  485. currentSelectedItems.value = []
  486. }
  487. const handleCheckProjectChange = (selectedItems: any[]) => {
  488. currentSelectedItems.value = selectedItems
  489. }
  490. const handleCheckProjectConfirm = (itemList: any[]) => {
  491. console.log('确认选中的检验项目:', itemList)
  492. console.log('selected pipe:', selectedPipeSets.value)
  493. const reqList = []
  494. selectedPipeSets.value.forEach((item: any) => {
  495. itemList.forEach((project: any) => {
  496. reqList.push({
  497. connectId: project.connectId,
  498. fee: project.fee,
  499. templateId: project.templateId,
  500. type: project.type,
  501. orderItemId: item.mainID
  502. })
  503. })
  504. })
  505. addInspectProject({
  506. itemList: reqList,
  507. type: 200,
  508. orderId: orderId.value,
  509. })
  510. fetchPipeSetList()
  511. closeCheckProjectPopup()
  512. }
  513. const showSuspendPopupFunc = () => {
  514. const networkType = uni.getNetworkType?.()
  515. if (networkType === 'none') {
  516. return uni.showToast({ title: '当前网络连接不可用,请检查网络设置后重新操作', icon: 'error' })
  517. }
  518. if (!selectedChildPipes.value.length) {
  519. return uni.showToast({ title: '请先选择管道设备', icon: 'error' })
  520. }
  521. showMoreOperate.value = false
  522. showSuspendPopup.value = true
  523. }
  524. const closeSuspendPopup = () => {
  525. showSuspendPopup.value = false
  526. }
  527. const suspendCheck = async () => {
  528. if (!suspendReason.value.trim()) {
  529. return uni.showToast({ title: '请输入中止检验原因', icon: 'error' })
  530. }
  531. closeSuspendPopup()
  532. uni.showLoading({ title: '加载中' })
  533. try {
  534. const reqData = {
  535. orderItemDetails: selectedChildPipes.value.map((item: any) => ({
  536. id: item.id,
  537. equipPipeId: item.orderItemId,
  538. })),
  539. reason: suspendReason.value,
  540. reasonDict: '',
  541. flag: 1,
  542. }
  543. const result = await requestFunc(TaskOrderFuncName.BatchSuspendEquip, EquipmentType.PIPE, reqData)
  544. uni.hideLoading()
  545. if (result?.code === 0) {
  546. initSelect()
  547. refreshList()
  548. uni.showToast({ title: '中止检验成功', icon: 'success' })
  549. uni.$emit('RefreshOrder')
  550. } else {
  551. const msg = result?.msg || '中止检验失败'
  552. uni.showToast({ title: msg, icon: 'error' })
  553. }
  554. } catch (error) {
  555. uni.hideLoading()
  556. uni.showToast({ title: '中止检验失败', icon: 'error' })
  557. } finally {
  558. suspendReason.value = ''
  559. }
  560. }
  561. const createInform = async () => {
  562. const networkType = uni.getNetworkType?.()
  563. if (networkType === 'none') {
  564. return uni.showToast({ title: '无网络连接,请联网重试' })
  565. }
  566. if (!orderId.value) return
  567. if (selectedPipeSets.value.length !== 1) {
  568. return uni.showToast({ title: '只能选择一个管道工程添加重大问题线索', icon: 'error' })
  569. }
  570. const selectedPipeSet = selectedPipeSets.value[0]
  571. const majorIssue = selectedPipeSet.reportRespVOList?.find((item: any) => item.reportType == PressureReportType.MAINQUESTION)
  572. if (majorIssue) {
  573. return uni.showToast({ title: '该管道工程已添加了重大问题线索', icon: 'error' })
  574. }
  575. uni.showLoading({ title: '提交中...', mask: true })
  576. try {
  577. const orderFormResp = await requestFunc(TaskOrderFuncName.GetOrderForm, EquipmentType.PIPE, {
  578. orderId: orderId.value,
  579. businessType: 400,
  580. orderItemId: selectedPipeSet.mainID,
  581. })
  582. const templateId = orderFormResp?.data?.templateId || ''
  583. const reqData = {
  584. orderFormEnterReqVO: {
  585. businessType: 400,
  586. modifiedReason: '',
  587. orderId: orderId.value,
  588. orderItemId: selectedPipeSet.mainID,
  589. },
  590. orderId: orderId.value,
  591. orderItemId: selectedPipeSet.mainID,
  592. prepareId: userInfo.value?.id || '',
  593. prepareName: userInfo.value?.nickname || '',
  594. templateId: templateId,
  595. }
  596. const addMajorIssueResp = await requestFunc(TaskOrderFuncName.AddMajorIssues, EquipmentType.PIPE, reqData)
  597. if (addMajorIssueResp?.code !== 0) {
  598. return uni.showToast({ title: addMajorIssueResp?.msg || '操作失败', icon: 'error' })
  599. }
  600. const refId = addMajorIssueResp?.data || ''
  601. uni.navigateTo({
  602. url: `/pages/editor/mainQuestionEditor?templateId=${templateId}&refId=${refId}`,
  603. })
  604. } catch (error) {
  605. uni.hideLoading()
  606. uni.showToast({ title: '操作失败', icon: 'error' })
  607. } finally {
  608. uni.hideLoading()
  609. }
  610. }
  611. const showAddInspectionplanPopup = async () => {
  612. if (!canAddInspectionplan.value) {
  613. if (selectedChildPipes.value.length) {
  614. return uni.showToast({ title: '选中管道设备时不可添加检验方案', icon: 'error' })
  615. }
  616. return uni.showToast({ title: '请先选择管道工程', icon: 'error' })
  617. }
  618. showMoreOperate.value = false
  619. showInspectionplanPopup.value = true
  620. inspectionplanName.value = ''
  621. selectedTemplate.value = null
  622. try {
  623. const result = await pressure2NotVerifyPageApi({
  624. type: '6',
  625. reportType: 600,
  626. status: 200,
  627. pageNo: 1,
  628. pageSize: 9999,
  629. })
  630. templateList.value = result?.data || []
  631. } catch (error) {
  632. console.error('获取模板列表失败:', error)
  633. }
  634. }
  635. const closeInspectionplanPopup = () => {
  636. showInspectionplanPopup.value = false
  637. }
  638. const onTemplateChange = (selected) => {
  639. selectedTemplate.value = selected.selectedItems.label
  640. selectedTemplateId.value = selected.selectedItems.value
  641. }
  642. const addInspectionplanConfirm = async () => {
  643. if (!selectedTemplate.value) {
  644. return uni.showToast({ title: '请选择模板封面', icon: 'error' })
  645. }
  646. if (!inspectionplanName.value.trim()) {
  647. return uni.showToast({ title: '请输入检验方案名称', icon: 'error' })
  648. }
  649. closeInspectionplanPopup()
  650. uni.showLoading({ title: '提交中...', mask: true })
  651. try {
  652. const reqData = {
  653. orderId: orderId.value,
  654. orderItemIds: selectedPipeSets.value.map((item) => item.mainID),
  655. prepareId: userInfo.value?.id || '',
  656. prepareJson: JSON.stringify({
  657. prepareName: userInfo.value?.nickname || '',
  658. prepareDate: dayjs().format('YYYY年MM月DD日'),
  659. }),
  660. prepareName: userInfo.value?.nickname || '',
  661. reportName: inspectionplanName.value.trim(),
  662. templateId: selectedTemplateId.value,
  663. }
  664. const res = await requestFunc(TaskOrderFuncName.AddMajorIssues, EquipmentType.PIPE, reqData)
  665. if (res?.code !== 0) {
  666. return uni.showToast({ title: res?.msg || '操作失败', icon: 'error' })
  667. }
  668. uni.navigateTo({
  669. url: `/pages/editor/inspectionPlanEditor?templateId=${selectedTemplateId.value}&refId=${res?.data || ''}`,
  670. })
  671. } catch (error) {
  672. uni.hideLoading()
  673. uni.showToast({ title: '操作失败', icon: 'error' })
  674. }
  675. }
  676. const handleUpdateContact = () => {
  677. const current = selectedPipeSets.value[0]
  678. currentItem.value = current || {}
  679. showMoreOperate.value = false
  680. showUpdateContactPopup.value = true
  681. }
  682. const handleUpdateSafetyManagerConfirm = async (params: { name: string; phone: string }) => {
  683. if (selectedPipeSets.value.length < 1) {
  684. return uni.showToast({ title: '请选择管道工程', icon: 'error' })
  685. }
  686. try {
  687. uni.showLoading({ title: '提交中...' })
  688. const selectedPipeSet = selectedPipeSets.value[0]
  689. const results = await updateEquipPipeSafetyManager({
  690. id: selectedPipeSet.id,
  691. securityMan: params.name,
  692. securityManPhone: params.phone,
  693. })
  694. uni.hideLoading()
  695. const isSuccess = results?.code === 0
  696. if (isSuccess) {
  697. uni.showToast({ title: '修改成功', icon: 'success' })
  698. showUpdateContactPopup.value = false
  699. refreshList()
  700. } else {
  701. uni.showToast({ title: '修改失败', icon: 'none' })
  702. }
  703. } catch (error) {
  704. uni.hideLoading()
  705. console.error('修改安全管理员失败:', error)
  706. uni.showToast({ title: '修改失败', icon: 'none' })
  707. }
  708. }
  709. const handleRouteToEquipmentDetail = (item: any, pageType: string) => {
  710. uni.navigateTo({
  711. url: `/pages/equipment/detail/equipmentDetail?orderId=${orderId.value}&orderItemId=${item.id}&equipId=${item.equipId}&pageType=${pageType}&useOnline=1&canEdit=${true}`,
  712. })
  713. }
  714. </script>
  715. <style lang="scss" scoped>
  716. .equipment-list-container {
  717. display: flex;
  718. flex-direction: column;
  719. height: 100vh;
  720. background-color: #f5f5f5;
  721. }
  722. .list-scroll {
  723. flex: 1;
  724. overflow: hidden;
  725. }
  726. .pipe-set-header {
  727. flex: 1;
  728. }
  729. .expand-arrow {
  730. display: flex;
  731. align-items: center;
  732. justify-content: center;
  733. width: 32px;
  734. height: 32px;
  735. margin-left: 8px;
  736. }
  737. .arrow-icon {
  738. font-size: 12px;
  739. color: #999;
  740. transition: transform 0.3s ease;
  741. transform: rotate(0deg);
  742. }
  743. .arrow-icon.arrow-expanded {
  744. transform: rotate(90deg);
  745. }
  746. .row {
  747. display: flex;
  748. flex-direction: row;
  749. align-items: center;
  750. }
  751. .checkbox-wrapper {
  752. margin-right: 10px;
  753. }
  754. .checkbox {
  755. display: flex;
  756. align-items: center;
  757. justify-content: center;
  758. width: 18px;
  759. height: 18px;
  760. border: 1px solid rgb(187, 187, 187);
  761. border-radius: 3px;
  762. }
  763. .checkbox.checked {
  764. background-color: #2f8eff;
  765. border-color: #2f8eff;
  766. }
  767. .check-icon {
  768. width: 12px;
  769. height: 12px;
  770. }
  771. .cell-top-left {
  772. display: flex;
  773. flex: 1;
  774. flex-direction: row;
  775. flex-wrap: wrap;
  776. align-items: center;
  777. justify-content: space-between;
  778. }
  779. .equip-name {
  780. flex: 1;
  781. font-size: 16px;
  782. font-weight: bold;
  783. color: rgb(51, 51, 51);
  784. }
  785. .main-checker {
  786. flex-basis: 160px;
  787. flex-shrink: 0;
  788. font-size: 16px;
  789. font-weight: bold;
  790. color: rgb(51, 51, 51);
  791. }
  792. .status-tag {
  793. display: flex;
  794. flex-basis: 80px;
  795. flex-direction: row;
  796. flex-shrink: 0;
  797. align-items: center;
  798. justify-content: center;
  799. padding: 5px 0;
  800. border-radius: 4px;
  801. }
  802. .status-pending {
  803. background-color: rgba(230, 162, 60, 0.3);
  804. border: 1px solid rgba(230, 162, 60, 0.5);
  805. }
  806. .status-done {
  807. background-color: rgba(103, 194, 58, 0.3);
  808. border: 1px solid rgba(103, 194, 58, 0.5);
  809. }
  810. .status-text {
  811. font-size: 12px;
  812. color: rgb(202, 135, 35);
  813. }
  814. .status-done .status-text {
  815. color: rgb(80, 175, 33);
  816. }
  817. .child-pipe-cell {
  818. padding: 10px;
  819. margin-bottom: 8px;
  820. background-color: #fff;
  821. border: 1px solid #f0f0f0;
  822. border-radius: 5px;
  823. }
  824. .child-pipe-top {
  825. padding-bottom: 8px;
  826. margin-bottom: 8px;
  827. border-bottom: 1px solid rgb(244, 244, 244);
  828. }
  829. .child-pipe-name {
  830. flex: 1;
  831. font-size: 14px;
  832. font-weight: bold;
  833. color: rgb(51, 51, 51);
  834. }
  835. .child-pipe-info {
  836. display: flex;
  837. flex-direction: row;
  838. align-items: center;
  839. justify-content: space-between;
  840. margin-bottom: 8px;
  841. }
  842. .info-box {
  843. display: flex;
  844. flex: 1;
  845. flex-direction: row;
  846. flex-wrap: wrap;
  847. justify-content: space-between;
  848. padding: 8px 12px;
  849. background-color: rgb(244, 244, 244);
  850. border-radius: 5px;
  851. }
  852. .info-label {
  853. margin-top: 4px;
  854. font-size: 12px;
  855. color: rgb(108, 108, 108);
  856. }
  857. .info-value {
  858. color: rgb(51, 51, 51);
  859. }
  860. .cell-bottom {
  861. display: flex;
  862. flex-direction: row;
  863. align-items: center;
  864. justify-content: flex-end;
  865. }
  866. .claim-btn,
  867. .record-btn {
  868. display: flex;
  869. align-items: center;
  870. justify-content: center;
  871. min-width: 75px;
  872. height: 29px;
  873. padding: 0 5px;
  874. margin-left: 5px;
  875. border-radius: 3px;
  876. }
  877. .blue-btn {
  878. color: white;
  879. background-color: rgb(47, 142, 255);
  880. }
  881. .white-btn {
  882. background-color: #fff;
  883. border: 1px solid rgb(217, 217, 217);
  884. }
  885. .blue-btn-text {
  886. font-size: 12px;
  887. color: rgb(222, 238, 255);
  888. }
  889. .white-btn-text {
  890. font-size: 12px;
  891. color: rgb(59, 59, 59);
  892. }
  893. .loading-text {
  894. padding: 15px;
  895. font-size: 14px;
  896. color: #999;
  897. text-align: center;
  898. }
  899. .empty-text-small {
  900. display: flex;
  901. align-items: center;
  902. justify-content: center;
  903. padding: 20px 0;
  904. font-size: 13px;
  905. color: #999;
  906. }
  907. .empty-text {
  908. display: flex;
  909. flex-direction: column;
  910. align-items: center;
  911. justify-content: center;
  912. padding: 60px 0;
  913. font-size: 14px;
  914. color: #999;
  915. }
  916. .bottom-operate {
  917. display: flex;
  918. flex-direction: row;
  919. align-items: center;
  920. justify-content: space-between;
  921. height: 68px;
  922. padding: 8px 12px;
  923. background-color: #fff;
  924. border-top: 1px solid #eee;
  925. }
  926. .select-all {
  927. display: flex;
  928. flex-direction: row;
  929. align-items: center;
  930. }
  931. .select-all-text {
  932. margin-left: 6px;
  933. font-size: 14px;
  934. color: #333;
  935. }
  936. .btn-group {
  937. display: flex;
  938. flex-direction: row;
  939. align-items: center;
  940. }
  941. .btn-group > button {
  942. min-width: 70px;
  943. height: 32px;
  944. padding: 8px 4px;
  945. margin-left: 6px;
  946. font-size: 14px;
  947. line-height: 1;
  948. border: none;
  949. border-radius: 3px;
  950. }
  951. .operate-btn {
  952. display: flex;
  953. align-items: center;
  954. justify-content: center;
  955. }
  956. .popup-mask {
  957. position: fixed;
  958. top: 0;
  959. right: 0;
  960. bottom: 0;
  961. left: 0;
  962. z-index: 999;
  963. display: flex;
  964. align-items: center;
  965. justify-content: center;
  966. background-color: rgba(0, 0, 0, 0.5);
  967. }
  968. .popup-content {
  969. width: 80%;
  970. max-width: 320px;
  971. padding: 20px;
  972. background-color: #fff;
  973. border-radius: 8px;
  974. }
  975. .tips-text {
  976. display: block;
  977. margin-bottom: 20px;
  978. font-size: 16px;
  979. color: #333;
  980. text-align: center;
  981. }
  982. .popup-actions {
  983. display: flex;
  984. flex-direction: row;
  985. justify-content: space-around;
  986. }
  987. .action-btn {
  988. display: flex;
  989. align-items: center;
  990. justify-content: center;
  991. width: 100px;
  992. height: 36px;
  993. font-size: 14px;
  994. border: none;
  995. border-radius: 4px;
  996. }
  997. .cancel-btn {
  998. color: #666;
  999. background-color: #f5f5f5;
  1000. }
  1001. .confirm-btn {
  1002. color: #fff;
  1003. background-color: #2f8eff;
  1004. }
  1005. .more-operate-overlay {
  1006. position: fixed;
  1007. top: 0;
  1008. right: 0;
  1009. bottom: 0;
  1010. left: 0;
  1011. z-index: 998;
  1012. }
  1013. .more-operate-panel {
  1014. position: fixed;
  1015. right: 0;
  1016. bottom: 68px;
  1017. left: 0;
  1018. z-index: 999;
  1019. display: flex;
  1020. flex-direction: column;
  1021. overflow: hidden;
  1022. background-color: #fff;
  1023. border-radius: 5px;
  1024. box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  1025. transition: transform 0.3s ease;
  1026. transform: translateY(100%);
  1027. }
  1028. .more-panel-show {
  1029. transform: translateY(0);
  1030. }
  1031. .more-btn-item {
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: center;
  1035. padding: 0 15px 10px;
  1036. background-color: #fff;
  1037. }
  1038. .more-btn-inner {
  1039. display: flex;
  1040. align-items: center;
  1041. justify-content: center;
  1042. width: 100%;
  1043. padding-top: 10px;
  1044. }
  1045. .more-btn-border {
  1046. border-top: 1px solid #f4f5f6;
  1047. }
  1048. .more-btn-item.disabled {
  1049. opacity: 1;
  1050. }
  1051. .more-btn-text {
  1052. font-size: 14px;
  1053. color: #333;
  1054. }
  1055. .suspend-popup .popup-title,
  1056. .inspectionplan-popup .popup-title {
  1057. display: block;
  1058. margin-bottom: 15px;
  1059. font-size: 16px;
  1060. font-weight: 500;
  1061. color: #333;
  1062. text-align: center;
  1063. }
  1064. .suspend-textarea {
  1065. box-sizing: border-box;
  1066. width: 100%;
  1067. height: 80px;
  1068. padding: 8px;
  1069. margin-bottom: 15px;
  1070. font-size: 14px;
  1071. border: 1px solid #ddd;
  1072. border-radius: 4px;
  1073. }
  1074. .form-item {
  1075. display: flex;
  1076. flex-direction: column;
  1077. margin-bottom: 12px;
  1078. }
  1079. .form-label {
  1080. margin-bottom: 6px;
  1081. font-size: 14px;
  1082. color: #333;
  1083. }
  1084. .form-input {
  1085. padding: 0px;
  1086. font-size: 14px;
  1087. background-color: #f5f5f5;
  1088. border-radius: 4px;
  1089. }
  1090. ::deep(.wd-collapse-item) {
  1091. margin: 12px;
  1092. margin-bottom: 0;
  1093. overflow: hidden;
  1094. background-color: #fff;
  1095. border-radius: 5px;
  1096. }
  1097. ::deep(.wd-collapse-item__title) {
  1098. padding: 12px 15px;
  1099. font-size: 15px;
  1100. }
  1101. ::deep(.wd-collapse-item__title-wrapper) {
  1102. background-color: #fff;
  1103. }
  1104. ::deep(.wd-collapse-item__content) {
  1105. padding: 10px;
  1106. }
  1107. ::deep(.wd-collapse-item__arrow) {
  1108. display: none;
  1109. }
  1110. .check-project-popup {
  1111. width: 85%;
  1112. max-width: none;
  1113. height: 80vh;
  1114. padding: 0;
  1115. overflow: hidden;
  1116. }
  1117. .popup-header {
  1118. display: flex;
  1119. flex-direction: row;
  1120. align-items: center;
  1121. justify-content: space-between;
  1122. padding: 15px;
  1123. border-bottom: 1px solid #eee;
  1124. }
  1125. .popup-close {
  1126. font-size: 20px;
  1127. color: #999;
  1128. }
  1129. </style>