StatusOperationPanel.vue 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181
  1. <template>
  2. <div class="container-panel">
  3. <el-row class="info-panel">
  4. <div class="info-item">
  5. <span class="label">报告编号:</span>
  6. <span class="value">{{ selectedItem?.reportNo || '-' }}</span>
  7. </div>
  8. <div class="info-item" style="margin: 0 auto;" v-if="isShowRecordOrReportBtn">
  9. <!-- <el-switch-->
  10. <!-- v-model="isShowReportPdf"-->
  11. <!-- active-text="报告"-->
  12. <!-- inactive-text="记录"-->
  13. <!-- @change="handleChangeShowReportPdf"-->
  14. <!-- />-->
  15. <!-- <el-radio-group v-model="showReportPdfType" @change="handleChangeShowReportPdf">-->
  16. <!-- <el-radio-button label="record">记录</el-radio-button>-->
  17. <!-- <el-radio-button label="report">报告</el-radio-button>-->
  18. <!-- <el-radio-button label="result" v-if="selectedItem?.reportType === 100">结论报告</el-radio-button>-->
  19. <!-- </el-radio-group>-->
  20. <div class="capsule-tabs">
  21. <div
  22. class="tab-item"
  23. :class="{ active: showReportPdfType === 'record' }"
  24. @click="handleChangeShowReportPdf('record')"
  25. v-if="hasRecord"
  26. >
  27. <span>记录</span>
  28. </div>
  29. <div
  30. class="tab-item"
  31. :class="{ active: showReportPdfType === 'report' }"
  32. @click="handleChangeShowReportPdf('report')"
  33. >
  34. <span>报告</span>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="info-item" style="margin: 0 auto;">
  39. <span class="label">检验项目:</span>
  40. <span class="value" :title="selectedItem?.reportName || '-'">{{
  41. selectedItem?.reportName || '-'
  42. }}</span>
  43. </div>
  44. <div v-if="selectedItem?.reportType === 300">
  45. <span>{{ selectedItem.instructionId ? '已' : '未'}}关联操作指导书</span>
  46. <el-button
  47. type="primary"
  48. size="small"
  49. link
  50. class="edit-checker-btn"
  51. @click="handleShowAssociationOperationManual"
  52. >
  53. <Icon icon="ep:edit" />
  54. </el-button>
  55. </div>
  56. <div class="info-item" style="flex-basis: 300px; text-align: end;">
  57. <span class="label">{{ selectedItem?.reportType === 100 ? '主检人' : '检验员' }}:</span>
  58. <span
  59. class="value"
  60. :title="
  61. selectedItem?.reportType === 100
  62. ? taskOrderItem?.mainCheckerUser?.nickname || '-'
  63. : getCheckersName()
  64. "
  65. >{{
  66. selectedItem?.reportType === 100
  67. ? taskOrderItem?.mainCheckerUser?.nickname || '-'
  68. : getCheckersName()
  69. }}</span
  70. >
  71. <el-button
  72. v-if="!isAuditMode"
  73. type="primary"
  74. size="small"
  75. link
  76. class="edit-checker-btn"
  77. @click="
  78. () =>
  79. selectedItem?.reportType === 100 ? handleModifyMainChecker() : handleModifyChecker()
  80. "
  81. :disabled="(selectedItem?.reportType === 100)
  82. || (selectedItem?.checkUsers?.length > 0 && selectedItem?.checkUsers?.[0]?.id !== userStore?.user?.id && taskOrderItem?.mainCheckerUser?.id !== userStore?.user?.id)
  83. || isCompleteInput"
  84. >
  85. <!-- 主报告:登录用户为主检人的时,才可以修改主检人 -->
  86. <!-- 子报告:登录用户为检验员或主检人的时候,才可以修改检验员 -->
  87. <Icon icon="ep:edit" />
  88. </el-button>
  89. </div>
  90. </el-row>
  91. <el-row class="status-operation-panel">
  92. <!-- 未选择任何项目时的提示 -->
  93. <div v-if="!selectedItem" class="no-selection">
  94. <el-empty description="请选择一个检验项目查看详情" :image-size="100" />
  95. </div>
  96. <!-- 选择单个项目时显示详情操作 -->
  97. <div v-else class="single-item-panel">
  98. <!--
  99. 1、重大问题线索告知表
  100. 2、作业指导书
  101. 3、检验方案
  102. 以上报告类型不显示做进度栏目
  103. -->
  104. <InspectionItemProgress
  105. v-if="!onlyShowPdf"
  106. :selected-item="selectedItem"
  107. :task-info="taskInfo"
  108. :is-audit-mode="isAuditMode"
  109. @modify-checker="handleModifyChecker"
  110. />
  111. <!-- <div class="pdf-panel" :style="{ maxWidth: !onlyShowPdf ? '1200px' : 'unset' }"> -->
  112. <div ref="pdfPanelRef" class="pdf-panel" >
  113. <!-- PDF预览区域 -->
  114. <div class="!h-full" :style="{ width: pdfContentWidth + 'px'}">
  115. <SpreadViewer :initData="initData" ref="spreadRef" isFullscreen @saveSuccess="saveSuccess"/>
  116. </div>
  117. </div>
  118. <!--
  119. 1、重大问题线索告知表
  120. 2、作业指导书
  121. 3、检验方案
  122. 以上报告类型不显示右侧栏目
  123. -->
  124. <template v-if="showCheckBook && getReportStatusEnd">
  125. <div class="right-panel-container">
  126. <!-- 收缩展开按钮 -->
  127. <div class="toggle-btn" @click="togglePanel" :class="{ 'collapsed': !isExpanded }">
  128. <el-icon>
  129. <Back v-if="!isExpanded" />
  130. <Right v-else />
  131. </el-icon>
  132. </div>
  133. <div class="operation-panel" :class="{ 'expanded': isExpanded, 'collapsed': !isExpanded }">
  134. <div class="operation-inner custom-inner">
  135. <template v-if="checkBookDetail.rectificationStatus === 2">
  136. <div class="operation-item">
  137. <div class="item-header"> 回退原因 </div>
  138. <div class="item-content">
  139. <el-form
  140. ref="returnFormRef"
  141. :model="returnForm"
  142. :rules="returnFormRules"
  143. label-position="right"
  144. label-width="80px"
  145. >
  146. <el-form-item label="回退原因" prop="rejectionReason">
  147. <el-input
  148. v-model="returnForm.rejectionReason"
  149. type="textarea"
  150. :rows="5"
  151. maxlength="100"
  152. placeholder="请输入回退原因"
  153. />
  154. </el-form-item>
  155. </el-form>
  156. </div>
  157. </div>
  158. </template>
  159. <div class="operation-item1">
  160. <div class="item-header"> 处理人信息 </div>
  161. <div class="item-content">
  162. <div class="item-content-item">
  163. <span class="item-content-item-label">联系人姓名:</span>
  164. <span class="item-content-item-value">{{ checkBookDetail?.recipient || '-' }}</span>
  165. </div>
  166. <div class="item-content-item">
  167. <span class="item-content-item-label">联系人电话:</span>
  168. <span class="item-content-item-value">{{ checkBookDetail?.recipientPhone || '-'}}</span>
  169. </div>
  170. <div class="item-content-item">
  171. <span class="item-content-item-label">当前状态:</span>
  172. <span class="item-content-item-value">{{
  173. rectificationStatusMap[checkBookDetail?.rectificationStatus] || '-'
  174. }}</span>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="operation-item1 videoAndImg">
  179. <div class="item-header"> 整改材料 </div>
  180. <div class="item-content1">
  181. <div class="item-content1-item">图片:</div>
  182. <div class="item-content1-img">
  183. <template
  184. v-for="(path, index) in checkBookDetail.rectificationImage?.split(',') || []"
  185. :key="'img' + index"
  186. >
  187. <div class="item-content1-img-item">
  188. <el-image
  189. class="img-item"
  190. :src="buildFileUrl(path)"
  191. :preview-src-list="[buildFileUrl(path)]"
  192. fit="cover"
  193. preview-teleported
  194. />
  195. </div>
  196. </template>
  197. </div>
  198. </div>
  199. <div class="item-content1">
  200. <div class="item-content1-item">视频:</div>
  201. <div class="item-content1-img">
  202. <template
  203. v-for="(path, index) in checkBookDetail.rectificationVideo?.split(',') || []"
  204. :key="'vid' + index"
  205. >
  206. <div class="item-content1-img-item" @click="handlePreview(buildFileUrl(path), 'video')">
  207. <video class="img-item" :src="buildFileUrl(path)"></video>
  208. <div class="video-play-overlay">
  209. <el-icon :size="28"><VideoPlay /></el-icon>
  210. </div>
  211. </div>
  212. </template>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </template>
  220. <template v-else>
  221. <div class="right-panel-container">
  222. <!-- 收缩展开按钮 -->
  223. <div class="toggle-btn" @click="togglePanel" :class="{ 'collapsed': !isExpanded }" v-if="!onlyShowPdf">
  224. <el-icon>
  225. <Back v-if="!isExpanded" />
  226. <Right v-else />
  227. </el-icon>
  228. </div>
  229. <div class="operation-panel" :class="{ 'expanded': isExpanded, 'collapsed': !isExpanded }" v-if="!onlyShowPdf">
  230. <div class="operation-inner">
  231. <!-- 流转记录 -->
  232. <div class="operation-item">
  233. <div class="item-header"> 流转记录 </div>
  234. <div class="item-content">
  235. <el-empty
  236. v-if="!recordList.length"
  237. description="暂无流转记录"
  238. :image-size="120"
  239. />
  240. <div class="record-item" v-for="record in recordList" :key="record.id">
  241. <div class="record-item-title">{{ PressureReportType['SUGGUESTION'] === props.selectedItem?.reportType ? record.processName : PressureCheckerMyTaskStatusMap[record.process]
  242. }}</div>
  243. <div class="record-item-inner">
  244. <div class="content">
  245. <span>{{ record.createUser.nickname }}</span>
  246. <el-button
  247. :type="
  248. OAApprovalResultType[record.result] ||
  249. (record.result === 100
  250. ? 'success'
  251. : record.result === 200
  252. ? 'danger'
  253. : 'default')
  254. "
  255. round
  256. size="small"
  257. >{{
  258. OAApprovalResultMap[record.result] ||
  259. (record.result === 100
  260. ? '通过'
  261. : record.result === 200
  262. ? '拒绝'
  263. : record.result || '-')
  264. }}</el-button
  265. >
  266. <span class="time">{{
  267. !record.createTime
  268. ? '-'
  269. : dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss')
  270. }}</span>
  271. </div>
  272. <p class="desc">
  273. <span>描述</span>
  274. {{ record.remark && record.remark.trim() !== '' ? record.remark : '-' }}
  275. </p>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. <!-- 智能纠错 -->
  281. <div class="operation-item">
  282. <div class="item-header"> 智能纠错 </div>
  283. <div class="item-content">
  284. <el-empty
  285. v-if="!checkInputList.length"
  286. description="暂无纠错内容"
  287. :image-size="120"
  288. />
  289. <div class="error-item" v-for="input in checkInputList" :key="input.code">
  290. <el-icon color="#E0534E" :size="20"><InfoFilled /></el-icon>
  291. {{ input.code }}:{{ input.name }}
  292. </div>
  293. </div>
  294. </div>
  295. <!-- 历史版本 -->
  296. <div class="operation-item">
  297. <div class="item-header"> 历史版本 </div>
  298. <div class="item-content" v-if="historyList.length">
  299. <!-- <template> -->
  300. <div class="history-item" v-for="item in historyList" :key="item.id">
  301. <div class="history-title">{{ item.versionNoStr || '-' }}号版本</div>
  302. <p
  303. >修改原因:<span>{{ item.modifiedReason || '人工修改' }}</span></p
  304. >
  305. <div class="history-footer">
  306. <span class="name">{{ item.creatorName || '-' }}</span>
  307. <span class="time"
  308. >修改于{{
  309. dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss') || '-'
  310. }}</span
  311. >
  312. </div>
  313. <div class="my-2">
  314. <el-button type="primary" link @click="handleShowVersionInfo(item)"
  315. >查看详情</el-button
  316. >
  317. <el-button v-if="!checkerIsLoginUser" type="primary" link @click="restoreVersion(item)"
  318. >恢复版本</el-button
  319. >
  320. </div>
  321. </div>
  322. <!-- </template> -->
  323. </div>
  324. <template v-else>
  325. <el-empty description="暂无历史版本" :image-size="120" />
  326. </template>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. </template>
  332. </div>
  333. <!-- 审批人选择对话框 -->
  334. <AuditUserDialog
  335. v-if="isShowApprovalDialog"
  336. v-model="isShowApprovalDialog"
  337. :apiFn="getPipeRecheckUserList"
  338. title="请选择审批人"
  339. selectedAlertText="已选择审批人"
  340. width="700px"
  341. :columns="[
  342. {
  343. type: 'selection',
  344. fieldProps: {
  345. reserveSelection: true
  346. }
  347. },
  348. {
  349. label: '姓名',
  350. prop: 'nickname',
  351. search: {
  352. type: 'input',
  353. span: 12,
  354. prop: 'nickName'
  355. }
  356. },
  357. {
  358. label: '部门',
  359. prop: 'deptName',
  360. search: {
  361. type: 'input',
  362. span: 12
  363. }
  364. }
  365. ]"
  366. @confirm="handleApprovalSelectConfirm"
  367. />
  368. <Dialog
  369. v-model="isShowAuditDialog"
  370. width="400"
  371. :title="schemaFlag == 'proofread' ? '请选择校核人' : '请选择审核人'"
  372. >
  373. <CustomLargeListSelect
  374. v-model="form.recheckUser"
  375. :fetchFunc="getPipeRecheckUserList"
  376. label-key="nickname"
  377. value-key="id"
  378. searchKeyProp="nickName"
  379. @change="handleChangeEntrustUnit"
  380. />
  381. <template #footer>
  382. <el-button type="primary" @click="handleAuditSelectConfirm" :loading="submitting">保 存</el-button>
  383. <el-button @click="isShowAuditDialog = false">取 消</el-button>
  384. </template>
  385. </Dialog>
  386. <!-- 批量提交校核 -->
  387. <Dialog
  388. v-model="showBatchSubmitToRecheckDialog"
  389. width="400"
  390. title="批量提交校核"
  391. >
  392. <el-form ref="batchRecheckFormRef" :model="batchRecheckForm" :rules="batchRecheckFormRules" label-width="80px">
  393. <el-form-item label="提交记录" prop="reportIds">
  394. <el-select
  395. v-model="batchRecheckForm.reportIds"
  396. multiple
  397. clearable
  398. placeholder="请选择报告"
  399. >
  400. <el-option
  401. v-for="item in getCanSubmitRecheckReport"
  402. :key="item.id"
  403. :value="item.id"
  404. :label="item.reportName"
  405. />
  406. </el-select>
  407. </el-form-item>
  408. <el-form-item label="校核人" prop="recheckUser">
  409. <CustomLargeListSelect
  410. v-model="batchRecheckForm.recheckUser"
  411. :fetchFunc="getPipeRecheckUserList"
  412. label-key="nickname"
  413. value-key="id"
  414. searchKeyProp="nickName"
  415. @change="handleChangeEntrustUnit"
  416. placeholder="请选择校核人"
  417. />
  418. </el-form-item>
  419. <el-form-item label="">
  420. <span style="font-size: 13px; white-space: nowrap; margin-top: -16px; color: #999;">
  421. 您已完成{{getCanSubmitRecheckReport.length}}份记录录入,可以进行批量提交校核
  422. </span>
  423. </el-form-item>
  424. </el-form>
  425. <template #footer>
  426. <el-button type="primary" @click="handleBatchSubmitToRecheck">提 交</el-button>
  427. <el-button @click="showBatchSubmitToRecheckDialog = false">取 消</el-button>
  428. </template>
  429. </Dialog>
  430. <!-- 校核人选择对话框 暂时作废
  431. -->
  432. <!-- <AuditUserDialog
  433. v-if="isShowAuditDialog"
  434. v-model="isShowAuditDialog"
  435. :apiFn="getUserList"
  436. title="请选择校核人"
  437. selectedAlertText="已选择校核人"
  438. width="700px"
  439. :pageType="0"
  440. :columns="[
  441. {
  442. type: 'selection',
  443. fieldProps: {
  444. reserveSelection: true
  445. }
  446. },
  447. {
  448. label: '姓名',
  449. prop: 'nickname',
  450. search: {
  451. type: 'input',
  452. span: 12,
  453. prop: 'nickName'
  454. }
  455. },
  456. {
  457. label: '部门',
  458. prop: 'deptName',
  459. search: {
  460. type: 'input',
  461. span: 12
  462. }
  463. }
  464. ]"
  465. @confirm="handleAuditSelectConfirm"
  466. /> -->
  467. <!-- 报告审核人选择对话框 -->
  468. <AuditUserDialog
  469. v-if="isShowReportAuditDialog"
  470. v-model="isShowReportAuditDialog"
  471. :apiFn="getPipeRecheckUserList"
  472. title="请选择审核人"
  473. selectedAlertText="已选择审核人"
  474. width="700px"
  475. :columns="[
  476. {
  477. type: 'selection',
  478. fieldProps: {
  479. reserveSelection: true
  480. }
  481. },
  482. {
  483. label: '姓名',
  484. prop: 'nickname',
  485. search: {
  486. type: 'input',
  487. span: 12,
  488. prop: 'nickName'
  489. }
  490. },
  491. {
  492. label: '部门',
  493. prop: 'deptName',
  494. search: {
  495. type: 'input',
  496. span: 12
  497. }
  498. }
  499. ]"
  500. @confirm="handleReportAuditSelectConfirm"
  501. />
  502. </el-row>
  503. <!-- 检验结果录入-葡萄城模板 -->
  504. <InlineInspectionResultInput
  505. v-if="showInlineInspectionResultInput"
  506. v-model:visible="showInlineInspectionResultInput"
  507. :template-params="inspectionResultTemplateParams"
  508. @confirm="handleInspectionResultConfirm"
  509. @cancel="handleReturnToNormalMode"
  510. />
  511. <!-- 检验录入-模板 -->
  512. <!-- <InlineEditCheckRecord-->
  513. <!-- v-if="showInlineEditCheckRecord"-->
  514. <!-- :templateId="templateId"-->
  515. <!-- v-model:visible="showInlineEditCheckRecord"-->
  516. <!-- :report-list="reportList"-->
  517. <!-- :task-order-item="taskOrderItem"-->
  518. <!-- :template-params="templateParams"-->
  519. <!-- @confirm="handleTemplateConfirm"-->
  520. <!-- @cancel="handleRefresh"-->
  521. <!-- />-->
  522. <!-- 检验录入-模板 -->
  523. <CustomDialog v-model="showInlineEditCheckRecord" :show-footer="false" fullscreen :show-close="false">
  524. <SpreadViewer :initData="editData" ref="editSpreadRecordRef" @saveSuccess="saveSuccessRecord" @close="handleClose">
  525. <template #title>
  526. <div style="font-size: 20px; ">检测录入</div>
  527. </template>
  528. </SpreadViewer>
  529. </CustomDialog>
  530. <!-- 报告编制 - 模板 -->
  531. <!-- <InlineReportEdit-->
  532. <!-- v-if="showInlineReportEdit"-->
  533. <!-- v-model:visible="showInlineReportEdit"-->
  534. <!-- :template-params="templateParams"-->
  535. <!-- :report-list="reportList || []"-->
  536. <!-- :report-type="showReportPdfType"-->
  537. <!-- @confirm="handleTemplateConfirm"-->
  538. <!-- @cancel="handleRefresh"-->
  539. <!-- @refresh="()=>{refreshPdf = !refreshPdf}"-->
  540. <!-- />-->
  541. <!-- 报告编制 - 模板 -->
  542. <CustomDialog v-model="showInlineReportEdit" :show-footer="false" fullscreen :show-close="false">
  543. <SpreadViewer :initData="editData" ref="editSpreadReportRef" @saveSuccess="saveSuccessReport" @close="handleClose">
  544. <template #title>
  545. <div style="font-size: 20px; ">报告编制</div>
  546. </template>
  547. </SpreadViewer>
  548. </CustomDialog>
  549. <!-- 修改主检人弹窗 -->
  550. <UserSelectForm ref="userSelectFormRef" @confirm="handleUserSelect" :single="true" />
  551. <CustomDialog v-model="showReportDialog" :show-footer="false" width="1000px">
  552. <!-- <VuePdfEmbed
  553. v-loading="pdfLoading"
  554. :height="500"
  555. :width="968"
  556. :source="reportSource"
  557. @rendered="handlePdfRendered"
  558. />-->
  559. <SpreadViewer :initData="reportInitData" ref="reportSpreadRef" />
  560. </CustomDialog>
  561. <!-- 查看版本详情的弹窗 -->
  562. <CustomDialog v-model="showVersionDetail" title="查看详情" :show-footer="false" width="1000px">
  563. <SmartTable
  564. v-model:columns="versionColumns"
  565. :buttons="versionDetailButtons"
  566. :data="versionDataCompareList"
  567. :is-pagination="false"
  568. :show-refresh="false"
  569. />
  570. </CustomDialog>
  571. <!-- 图片预览对话框 -->
  572. <el-dialog
  573. v-model="previewVisible"
  574. class="preview-dialog"
  575. title="Warning"
  576. width="500"
  577. :show-footer="false"
  578. :show-close="false"
  579. align-center
  580. >
  581. <div class="preview-container">
  582. <video class="preview-video" v-if="previewType === 'video'" :src="previewUrl" auto-play controls></video>
  583. <img class="preview-image" v-else :src="previewUrl" />
  584. </div>
  585. </el-dialog>
  586. <dialog ref="previewDialogRef"></dialog >
  587. <ReportListUploadModal
  588. ref="reportListUploadModalRef"
  589. :selectedItem="selectedItem"
  590. :reportList="reportList"
  591. @confirm="handleRefresh"
  592. />
  593. <!-- 回退原因弹窗(面板收缩时使用) -->
  594. <el-dialog
  595. v-model="rejectionReasonDialogVisible"
  596. title="请输入回退原因"
  597. width="450px"
  598. :close-on-click-modal="false"
  599. >
  600. <el-form ref="rejectionReasonDialogFormRef" :model="tempRejectionReason" :rules="returnFormRules">
  601. <el-form-item label="回退原因" prop="rejectionReason">
  602. <el-input
  603. v-model="tempRejectionReason.rejectionReason"
  604. type="textarea"
  605. :rows="5"
  606. maxlength="100"
  607. placeholder="请输入回退原因"
  608. />
  609. </el-form-item>
  610. </el-form>
  611. <template #footer>
  612. <el-button @click="rejectionReasonDialogVisible = false">取消</el-button>
  613. <el-button type="primary" @click="handleRejectionReasonDialogConfirm">确定回退</el-button>
  614. </template>
  615. </el-dialog>
  616. </div>
  617. <!-- 新加 -->
  618. <Teleport v-if="teleportBtnRef" to=".teleport-btn">
  619. <template v-if="showCheckBook && getReportStatusEnd">
  620. <div v-if="[0, 2].includes(checkBookDetail.rectificationStatus)" class="default-toolbar">
  621. <el-button type="success" size="small" @click="() => handlePass(0)">整改通过</el-button>
  622. <el-button type="success" size="small" @click="() => handlePass(2)">整改不通过</el-button>
  623. <el-button type="primary" size="small" @click="handleRectificationMaterials">上传整改材料</el-button>
  624. <template v-if="checkBookDetail.rectificationStatus === 2">
  625. <el-button size="small" type="primary" @click="() => handlePass(1)">回退</el-button>
  626. </template>
  627. </div>
  628. <div v-if="[3].includes(checkBookDetail.rectificationStatus)" class="default-toolbar">
  629. <el-button type="primary" size="small" @click="handleRectificationMaterials">上传整改材料</el-button>
  630. </div>
  631. </template>
  632. <template v-else>
  633. <div class="operation-btns">
  634. <!-- 报告办结后,这部分按钮不再显示 -->
  635. <template v-if="!getReportStatusEnd && selectedItem">
  636. <!-- 根据报告类型和配置显示相应按钮 -->
  637. <template
  638. v-if="
  639. selectedItem.reportType === PressureReportType.SINGLE &&
  640. 'PipeCheckerTaskDetail' === routeName
  641. "
  642. >
  643. <!-- 独审报告根据配置显示按钮 -->
  644. <el-button
  645. v-if="currentReportConfig?.isApproval && isCanSubmitToAudit"
  646. type="danger"
  647. @click="handleSubmitAudit"
  648. :disabled="checkerIsLoginUser"
  649. size="small"
  650. >
  651. 提交报告审核
  652. </el-button>
  653. <!-- 没有审核只有审批 -->
  654. <el-button
  655. v-if="
  656. currentReportConfig?.isRatify &&
  657. !currentReportConfig?.isApproval &&
  658. isCanSubmitToAudit
  659. "
  660. type="danger"
  661. @click="handleApprovalSelectConfirm"
  662. :disabled="checkerIsLoginUser"
  663. size="small"
  664. >
  665. 提交报告审批
  666. </el-button>
  667. </template>
  668. <!-- 非独审报告默认显示审核按钮 -->
  669. <el-button
  670. v-if="
  671. selectedItem.reportType !== PressureReportType.SUB &&
  672. selectedItem.reportType !== PressureReportType.SINGLE &&
  673. isCanSubmitToAudit &&
  674. 'PipeCheckerTaskDetail' === routeName
  675. "
  676. type="danger"
  677. @click="handleSubmitAudit"
  678. :disabled="checkerIsLoginUser"
  679. size="small"
  680. >
  681. {{ selectedItem.reportType === PressureReportType['SUGGUESTION'] ? '提交审核' : '提交报告审核' }}
  682. </el-button>
  683. <el-button
  684. v-if="selectedItem.reportType === PressureReportType.SUB && selectedItem.taskStatus == PressureCheckerMyTaskStatus.REPORT_INPUT "
  685. type="danger"
  686. @click="handleCompletion"
  687. :disabled="checkerIsLoginUser"
  688. size="small"
  689. >
  690. 报告办结
  691. </el-button>
  692. <el-button type="primary" size="small" plain v-if="isCanEditReport" @click="handleEditRreport" :disabled="checkerIsLoginUser"
  693. >编制报告</el-button>
  694. <el-button v-if="isCanSubmitRecheck" type="primary" @click="handleSelectVerfiyer" :disabled="checkerIsLoginUser" size="small"
  695. >提交校核</el-button>
  696. <el-button
  697. type="primary"
  698. v-if="isCanEditTestRecord"
  699. plain
  700. @click="handleEditSpreadRecord"
  701. :disabled="checkerIsLoginUser"
  702. size="small"
  703. >{{ selectedItem.reportType === PressureReportType['SUGGUESTION'] ? '编制意见书' : '填写记录' }}</el-button>
  704. <!-- 撤销流程:报告审核或审批阶段,有OA流程ID且当前用户是发起人时显示 -->
  705. <el-button
  706. v-if="isCanCancelFlow"
  707. type="warning"
  708. @click="handleCancelFlow"
  709. size="small"
  710. >撤销流程</el-button>
  711. <!-- OA审核:报告审核或审批阶段,有OA流程ID时显示 -->
  712. <el-button
  713. v-if="isCanOAAudit"
  714. type="success"
  715. @click="handleOpenOAAudit"
  716. size="small"
  717. >OA审核</el-button>
  718. <!-- <el-button v-if="isCanSyncReportData" type="primary" @click="handleSyncReportData" :disabled="checkerIsLoginUser" size="small"-->
  719. <!-- >同步报表</el-button>-->
  720. </template>
  721. </div>
  722. </template>
  723. </Teleport>
  724. <AssociationOperationManual
  725. v-if="showAssociationOperationManual"
  726. :selectedItem="selectedItem"
  727. :reportList="reportList"
  728. :equipCode="props.taskOrderItem?.equipCode"
  729. @close="()=>{
  730. showAssociationOperationManual = false
  731. handleRefresh()
  732. }"
  733. />
  734. <!-- 上传整改材料弹窗 -->
  735. <Dialog
  736. v-model="ectificationMaterialsVisible"
  737. title="上传整改材料"
  738. width="750px"
  739. style="margin-bottom: 0px; height: 100vh"
  740. top="0vh"
  741. :scroll="true"
  742. height="100vh"
  743. :maxHeight="'calc(100vh - 55px - 60px - 63px)'"
  744. @close="handleClosePectificationMaterialsDialog"
  745. >
  746. <div v-loading="ectificationMaterialsLoading" class="rectification-dialog">
  747. <!-- 检验意见通知书上传 -->
  748. <div class="upload-section required">
  749. <div class="section-header">
  750. <div class="header-left">
  751. <i class="icon-document"></i>
  752. <span class="section-title">检验意见通知书</span>
  753. <span class="required-mark">*</span>
  754. </div>
  755. <span class="section-tip">仅支持PDF格式,限1个文件</span>
  756. </div>
  757. <div class="upload-area">
  758. <RectificationUpload
  759. v-model:fileList="ectificationMaterialsData.rectificationUrl"
  760. apiUrl="infra/file/upload"
  761. :limit="1"
  762. :disabled="ectificationMaterialsData.rectificationUrl.length >= 1 || ectificationMaterialsLoading"
  763. accept=".pdf"
  764. :default-file-name="selectedItem?.reportName || '检验意见通知书'"
  765. />
  766. </div>
  767. </div>
  768. <!-- 整改图片上传 -->
  769. <div class="upload-section">
  770. <div class="section-header">
  771. <div class="header-left">
  772. <i class="icon-image"></i>
  773. <span class="section-title">整改图片</span>
  774. </div>
  775. <span class="section-tip">支持JPG、PNG格式,最多20张,单个不超过2MB</span>
  776. </div>
  777. <div class="upload-area">
  778. <RectificationUpload
  779. v-model:fileList="ectificationMaterialsData.rectificationImage"
  780. apiUrl="infra/file/upload"
  781. :limit="20"
  782. :disabled="ectificationMaterialsData.rectificationImage.length >= 20 || ectificationMaterialsLoading"
  783. accept=".jpg,.jpeg,.png"
  784. :multiple="true"
  785. :maxSize="2097152"
  786. />
  787. </div>
  788. </div>
  789. <!-- 整改视频上传 -->
  790. <div class="upload-section">
  791. <div class="section-header">
  792. <div class="header-left">
  793. <i class="icon-video"></i>
  794. <span class="section-title">整改视频</span>
  795. </div>
  796. <span class="section-tip">支持MP4格式,最多5个,单个不超过10MB</span>
  797. </div>
  798. <div class="upload-area">
  799. <RectificationUpload
  800. v-model:fileList="ectificationMaterialsData.rectificationVideo"
  801. apiUrl="infra/file/upload"
  802. :limit="5"
  803. :disabled="ectificationMaterialsData.rectificationVideo.length >= 5 || ectificationMaterialsLoading"
  804. accept=".mp4"
  805. :multiple="true"
  806. :maxSize="10485760"
  807. />
  808. </div>
  809. </div>
  810. <!-- 温馨提示 -->
  811. <div class="info-tips">
  812. <i class="icon-info"></i>
  813. <div class="tips-content">
  814. <p class="tips-title">温馨提示:</p>
  815. <p>1. 请确保上传的文件清晰可辨,以便审核</p>
  816. <p>2. 整改材料将作为审核依据,请如实上传</p>
  817. </div>
  818. </div>
  819. </div>
  820. <template #footer>
  821. <el-button @click="()=> ectificationMaterialsVisible = false">取消</el-button>
  822. <el-button
  823. :loading="ectificationMaterialsLoading"
  824. type="primary"
  825. @click="handleSubmitChangeEctificationMaterialsDialog"
  826. >
  827. 确定提交
  828. </el-button>
  829. </template>
  830. </Dialog>
  831. </template>
  832. <script setup lang="tsx">
  833. import SmartTable from '@/components/SmartTable/SmartTable'
  834. import RectificationUpload from '@/views/pressure2/components/RectificationUpload.vue'
  835. import {computed, defineAsyncComponent, nextTick, reactive, ref, watch} from 'vue'
  836. import {useRoute} from 'vue-router'
  837. import { InfoFilled, View, Back, Right, WarningFilled, VideoPlay } from '@element-plus/icons-vue'
  838. import {dayjs, ElMessage, ElMessageBox, FormInstance, FormRules} from 'element-plus'
  839. import * as UserApi from '@/api/system/user'
  840. import {
  841. PressureCheckerMyTaskStatus,
  842. PressureCheckerMyTaskStatusMap,
  843. PressureReportType,
  844. PressureTaskOrderTaskStatus,
  845. SugguestionApproveConfig,
  846. } from '@/utils/constants'
  847. import { OAApprovalResultMap, OAApprovalResultType } from '@/utils/pressure2/oaConstants'
  848. import type {
  849. PipeTaskOrderDetailVO,
  850. PipeTaskOrderOrderItemVO,
  851. ReportItemVO
  852. } from '@/api/pressure2/pipetaskorder'
  853. import {PipeTaskOrderApi} from '@/api/pressure2/pipetaskorder'
  854. import InspectionItemProgress from './InspectionItemProgress.vue'
  855. import InlineInspectionResultInput from './InlineInspectionResultInput.vue'
  856. import UserSelectForm from '@/components/UserSelectForm/index.vue'
  857. import {reportInfoApi} from '@/api/reportInfoService'
  858. import {buildFileUrl} from '@/utils'
  859. import {useUserStore} from '@/store/modules/user'
  860. import {is} from '@/utils/is'
  861. import _ from 'lodash'
  862. import {uploadFile} from '@/api/common/index'
  863. import ReportListUploadModal from './reportListUploadModal.vue'
  864. import AssociationOperationManual from './AssociationOperationManual.vue'
  865. import {SpreadViewer} from "@/components/DynamicReport";
  866. import {InitParams} from "@/components/DynamicReport/SpreadInterface";
  867. import { cloneDeep, debounce } from 'lodash-es'
  868. import {BoilerTaskOrderApi} from "@/api/pressure2/boilertaskorder";
  869. import * as UserGroupApi from '@/api/bpm/userGroup'
  870. const CustomDialog = defineAsyncComponent(() => import('@/components/CustomDialog/index.vue'))
  871. const AuditUserDialog = defineAsyncComponent(
  872. () => import('@/views/Functional/components/AuditUserDialog.vue')
  873. )
  874. interface Props {
  875. selectedItem: ReportItemVO | null
  876. taskInfo: PipeTaskOrderDetailVO | null
  877. taskOrderItem: PipeTaskOrderOrderItemVO
  878. isAuditMode?: boolean
  879. reportId?: string | null
  880. reportList?: ReportItemVO[]
  881. taskId: string
  882. teleportBtnRef: Ref<HTMLDivElement | null>
  883. isFullscreen?: boolean
  884. }
  885. interface Emits {
  886. (e: 'refresh'): void
  887. (e: 'template-confirm', templateUrl?: string): void
  888. (e: 'modify-checker', item: ReportItemVO): void
  889. (e: 'submit-approval'): void
  890. (e: 'reject'): void
  891. (e: 'cancel'): void
  892. (e: 'submit-ratify'): void
  893. (e: 'update:selected-item', item: ReportItemVO): void
  894. (e: 'item-select', item: ReportItemVO): void
  895. }
  896. const props = defineProps<Props>()
  897. const emit = defineEmits<Emits>()
  898. const route = useRoute()
  899. const userStore = useUserStore()
  900. const schemaFlag = ref<string | null>(null) //等于proofread = 校核 audit=审核
  901. // 获取当前的路由Name
  902. const routeName = computed(() => route.name)
  903. const form = ref<Record<string, any>>({
  904. recheckUser: {}
  905. })
  906. const refreshPdf = ref(true)
  907. // 视图模式状态管理
  908. const viewMode = ref<'normal' | 'inspection-result'>('normal')
  909. // 批量提交的表单
  910. const batchRecheckForm = ref({
  911. reportIds: [],
  912. recheckUser: {}
  913. })
  914. const batchRecheckFormRules = {
  915. reportIds: [{required: true, message: '请选择提交记录', trigger: 'change'}],
  916. recheckUser: [{required: true, message: '请选择校核人', trigger: 'change'}]
  917. }
  918. // 格式化记录结果状态显示
  919. const formatRecordResult = (record) => {
  920. const resultMap = {
  921. 100: '通过',
  922. 200: '拒绝',
  923. 300: '已阅',
  924. 400: '同意',
  925. 500: '不同意'
  926. }
  927. return resultMap[record.result] || record.result || '-'
  928. }
  929. // 获取记录结果的按钮类型
  930. const getRecordResultButtonType = (record) => {
  931. if ([100, 300, 400].includes(record.result)) {
  932. return 'success'
  933. } else if ([200, 500].includes(record.result)) {
  934. return 'danger'
  935. } else {
  936. return 'default'
  937. }
  938. }
  939. const spreadRef=ref();
  940. const reportSpreadRef=ref();
  941. const initData=ref<InitParams>(
  942. {
  943. templateId: '',
  944. refId: '',
  945. refName:'',
  946. insId:'',
  947. opType: 0, // 0:excel,1: pdf
  948. manualUrl: '',
  949. });
  950. const reportInitData=ref<InitParams>(
  951. {
  952. templateId: '',
  953. refId: '',
  954. refName:'',
  955. insId:'',
  956. opType: 1, // 0:excel,1: pdf
  957. });
  958. const editSpreadRecordRef=ref();
  959. const editSpreadReportRef=ref();
  960. const editData=ref<InitParams>(
  961. {
  962. templateId: '',
  963. refId: '',
  964. refName:'',
  965. insId:'',
  966. opType: 0, // 0:excel,1: pdf
  967. });
  968. const batchRecheckFormRef = ref()
  969. // const isShowReportPdf = ref([PressureCheckerMyTaskStatus.REPORT_INPUT,PressureCheckerMyTaskStatus.REPORT_AUDIT,PressureCheckerMyTaskStatus.REPORT_APPROVE,PressureCheckerMyTaskStatus.REPORT_END].includes(props.selectedItem.taskStatus)
  970. // && ![400,500,600,700].includes(props.selectedItem.reportType))
  971. const showReportPdfType = ref('record')
  972. const refreshPdfFlag = ref(true)
  973. const hasRecord = ref(false)
  974. // 获取可以批量提交的报告
  975. const getCanSubmitRecheckReport = computed(() => {
  976. if(!props.reportList || !props.reportList.length) return []
  977. return props.reportList.filter((report: any) => {
  978. // 主报告、子报告、独审报告才有记录校核
  979. const reportTypes = [PressureReportType['SUB'], PressureReportType['SINGLE']]
  980. const status = PressureTaskOrderTaskStatus['RECORD_INPUT'] // 记录录入状态
  981. // report.reportUrl 已经录入数据
  982. // if(report.taskStatus !== status || !report.reportUrl) return false
  983. if(report.taskStatus !== status) return false
  984. else if(report.reportType === PressureReportType['MAIN'] && userStore.user.id === props.taskOrderItem?.mainCheckerUser?.id) return true
  985. else
  986. return reportTypes.includes(report.reportType) && (report.checkUsers?.[0]?.id === userStore.user.id || !report.checkUsers || !report.checkUsers.length)
  987. // 过滤掉主报告存在未办结检验意见通知书时
  988. }).filter((report: any) => {
  989. if(report.reportType !== PressureReportType['MAIN']){
  990. return true
  991. }
  992. const sugguestionReport = props.reportList?.find(x => x.reportType === PressureReportType['SUGGUESTION'])
  993. // 不存在检验意见通知书返回true
  994. if(!sugguestionReport) return true
  995. // 检验意见通知书已办结,返回true
  996. return sugguestionReport.taskStatus === PressureCheckerMyTaskStatus['REPORT_END'];
  997. })
  998. })
  999. // 当意见通知书未办结时,主报告不能流转到后续流程(提交校核)
  1000. const canSubmitMainReportType = (tipsText: string)=>{
  1001. // 不是主报告,直接返回true
  1002. if(PressureReportType.MAIN !== props?.selectedItem?.reportType) return true
  1003. // 判断检验意见通知书的状态
  1004. const report = props.reportList?.find(x => x.reportType === PressureReportType['SUGGUESTION'])
  1005. console.log('检验意见通知书', report)
  1006. // 不存在检验意见通知书返回true
  1007. if(!report) return true
  1008. // 检验意见通知书已办结,返回true
  1009. if(report.taskStatus === PressureCheckerMyTaskStatus['REPORT_END']) return true
  1010. ElMessageBox.alert(tipsText, '提示', {
  1011. showCancelButton: false,
  1012. confirmButtonText: '确定',
  1013. type: 'warning'
  1014. })
  1015. return false
  1016. }
  1017. // 校核人选择对话框状态
  1018. const showBatchSubmitToRecheckDialog = ref(false)
  1019. const isShowAuditDialog = ref(false)
  1020. const handleSelectVerfiyer = async () => {
  1021. try {
  1022. await spreadRef.value?.handleSave()
  1023. } catch (error) {
  1024. console.error('保存数据失败:', error)
  1025. ElMessage.error('保存数据失败,请重试')
  1026. return
  1027. }
  1028. const canSubmit = canSubmitMainReportType('该报告存在未办结检验意见通知书,无法提交校核')
  1029. if(!canSubmit) return
  1030. // 获取审核人\校核人配置信息
  1031. let res = await UserApi.getApprovalDetail({})
  1032. // 如果存在多份待提交校核的报告,执行批量校核弹窗
  1033. console.log('getCanSubmitRecheckReport', getCanSubmitRecheckReport,props.reportList,res)
  1034. if(getCanSubmitRecheckReport.value.length > 1) {
  1035. if(res && res.recheckUser) {
  1036. batchRecheckForm.value.recheckUser = res.recheckUser
  1037. }
  1038. batchRecheckForm.value.reportIds = getCanSubmitRecheckReport.value.map(x => x?.id)
  1039. showBatchSubmitToRecheckDialog.value = true
  1040. return
  1041. }
  1042. // 只有一份待提交校核的报告,执行以下逻辑
  1043. if(res && res.recheckUser) {
  1044. form.value.recheckUser = res.recheckUser
  1045. }
  1046. schemaFlag.value = 'proofread'
  1047. isShowAuditDialog.value = true
  1048. }
  1049. // 批量提交
  1050. const handleBatchSubmitToRecheck = async () => {
  1051. try {
  1052. await batchRecheckFormRef.value.validate()
  1053. } catch (err) {
  1054. ElMessage.error('请完善表单数据!')
  1055. return
  1056. }
  1057. if (_.isEmpty(batchRecheckForm.value.recheckUser)) {
  1058. return ElMessage.error('请选择校核人')
  1059. }
  1060. // 待提交的数据
  1061. const params = {
  1062. reportList: getCanSubmitRecheckReport.value.filter((x: any) => batchRecheckForm.value.reportIds.includes(x?.id)).map((x: any) => ({
  1063. id: x.id,
  1064. reportUrl: x.reportUrl,
  1065. dataJson: x?.prepareJson
  1066. })),
  1067. recheckId: batchRecheckForm.value.recheckUser?.id
  1068. }
  1069. const submitResult = await PipeTaskOrderApi.batchSubmitToRecheck(params)
  1070. if (submitResult) {
  1071. ElMessage.success('提交校核成功!')
  1072. showBatchSubmitToRecheckDialog.value = false
  1073. selectNextItem(getCanSubmitRecheckReport.value.filter((x: any) => batchRecheckForm.value.reportIds.includes(x?.id)))
  1074. // 这里可以做页面刷新
  1075. emit('template-confirm')
  1076. }
  1077. }
  1078. const submitting = ref(false)
  1079. const handleAuditSelectConfirm = async () => {
  1080. if (_.isEmpty(form.value.recheckUser)) {
  1081. return ElMessage.error(schemaFlag.value == 'proofread' ? '请选择校核人' : '请选择审核人')
  1082. }
  1083. // 审核
  1084. if (schemaFlag.value === 'audit') {
  1085. submitting.value = true
  1086. const submitResult = await PipeTaskOrderApi.submitReportAudit({
  1087. id: templateParams.value?.id,
  1088. approveId: form.value?.recheckUser?.id
  1089. })
  1090. submitting.value = false
  1091. if (submitResult) {
  1092. ElMessage.success('提交审核成功!')
  1093. isShowAuditDialog.value = false
  1094. selectNextItem([props.selectedItem])
  1095. // 这里可以做页面刷新
  1096. emit('template-confirm')
  1097. }
  1098. } else if (schemaFlag.value === 'proofread') {
  1099. // 校核
  1100. const saveResult = await PipeTaskOrderApi.submitTaskReportTemplate({
  1101. id: props?.selectedItem?.id,
  1102. recheckId: form.value?.recheckUser?.id
  1103. })
  1104. if (saveResult) {
  1105. ElMessage.success('提交校核成功!')
  1106. isShowAuditDialog.value = false
  1107. selectNextItem([props.selectedItem])
  1108. // 这里可以做页面刷新
  1109. emit('template-confirm')
  1110. }
  1111. }
  1112. }
  1113. /**
  1114. * 项目切换
  1115. */
  1116. const selectNextItem = (items:ReportItemVO[]) => {
  1117. // 找到其他在记录录入或者报告编制状态的第一项目
  1118. const ids = items.map(item => item.id)
  1119. const inputReportList= props.reportList.filter(
  1120. item => {
  1121. return !ids.includes(item.id)
  1122. }
  1123. ).filter(item =>{
  1124. return item.taskStatus === PressureTaskOrderTaskStatus['RECORD_INPUT'] || item.taskStatus === PressureTaskOrderTaskStatus['REPORT_INPUT']
  1125. })
  1126. console.log(inputReportList)
  1127. if (inputReportList.length > 0){
  1128. emit('item-select', inputReportList[0])
  1129. }
  1130. }
  1131. // 审批人选择对话框状态
  1132. const isShowApprovalDialog = ref(false)
  1133. // 监听项目切换,自动重置视图模式
  1134. watch(
  1135. () => props.selectedItem,
  1136. (newItem, oldItem) => {
  1137. if (newItem) {
  1138. showReportPdfType.value = [PressureCheckerMyTaskStatus.REPORT_INPUT,PressureCheckerMyTaskStatus.REPORT_AUDIT,PressureCheckerMyTaskStatus.REPORT_APPROVE,PressureCheckerMyTaskStatus.REPORT_END].includes(props.selectedItem.taskStatus)
  1139. && ![400,500,600,700].includes(props.selectedItem.reportType) ? 'report':'record'
  1140. handleRefreshData()
  1141. props.taskId && getReportAuditInfo()
  1142. console.log('切换项目', props.selectedItem)
  1143. hasRecord.value = props.selectedItem.templateId != null
  1144. if (props.selectedItem?.reportTemplateId == null){
  1145. showReportPdfType.value = 'record'
  1146. }
  1147. if (props.selectedItem?.templateId == null){
  1148. showReportPdfType.value = 'report'
  1149. }
  1150. }
  1151. // 当切换到不同的项目时,重置视图模式为normal
  1152. if (newItem?.id !== oldItem?.id) {
  1153. viewMode.value = 'normal'
  1154. }
  1155. },
  1156. { immediate: false }
  1157. )
  1158. const previewUrl = ref('')
  1159. const previewVisible = ref(false)
  1160. const previewType = ref('')
  1161. const handlePreview = (path: string, type: 'video' | 'image') => {
  1162. previewUrl.value = path;
  1163. previewType.value = type;
  1164. previewVisible.value = true;
  1165. }
  1166. /**
  1167. * 如果是"已经审核完的检验意见通知书,则查询相关的检验意见通知信息,显示在最右侧
  1168. */
  1169. const checkBookDetail = ref<Record<string, any>>({})
  1170. const showCheckBook = computed(() => {
  1171. const { reportType, taskStatus } = props.selectedItem || {}
  1172. // console.log(taskStatus, 'taskStatus', reportType)
  1173. // taskStatus: 800
  1174. return reportType === PressureReportType['SUGGUESTION']
  1175. })
  1176. const rectificationStatusMap = reactive({
  1177. 0: '待确认',
  1178. 1: '待整改',
  1179. 2: '已递交',
  1180. 3: '材料有误',
  1181. 4: '整改通过',
  1182. 5: '整改不通过'
  1183. })
  1184. const getReportAuditInfo = async () => {
  1185. if (props.selectedItem?.reportType === PressureReportType['SUGGUESTION']) {
  1186. const res = await PipeTaskOrderApi.exportCheckBookDetail({
  1187. id: props.selectedItem?.id
  1188. })
  1189. console.log(res, '查询检验意见通知书详细信息')
  1190. if (res) {
  1191. checkBookDetail.value = res
  1192. }
  1193. }
  1194. }
  1195. const returnForm = ref({
  1196. rejectionReason: ''
  1197. })
  1198. const returnFormRules = ref({
  1199. rejectionReason: [{ required: true, message: '请输入回退原因', trigger: 'blur' }]
  1200. })
  1201. const returnFormRef = ref()
  1202. const rejectionReasonDialogVisible = ref(false)
  1203. const tempRejectionReason = ref({ rejectionReason: '' })
  1204. const rejectionReasonDialogFormRef = ref()
  1205. const isCompleteInput = computed(() => {
  1206. return props.selectedItem?.taskStatus >= PressureCheckerMyTaskStatus.RECORD_CHECK
  1207. })
  1208. const isShowRecordOrReportBtn = computed(() => {
  1209. return [PressureReportType.MAIN,PressureReportType.SUB,PressureReportType.SINGLE].includes(props.selectedItem?.reportType)
  1210. })
  1211. // 通过 退回
  1212. const handlePass = async (type) => {
  1213. const params: Record<string, any> = {
  1214. reportId: props.selectedItem?.id,
  1215. approvalType: type
  1216. }
  1217. if (type === 1) {
  1218. if (isExpanded.value) {
  1219. try {
  1220. await returnFormRef.value.validate()
  1221. } catch {
  1222. ElMessage.warning('请填写回退原因')
  1223. return
  1224. }
  1225. params.rejectionReason = returnForm.value.rejectionReason
  1226. executePass(params, type)
  1227. } else {
  1228. tempRejectionReason.value.rejectionReason = returnForm.value.rejectionReason
  1229. rejectionReasonDialogVisible.value = true
  1230. }
  1231. return
  1232. }
  1233. executePass(params, type)
  1234. }
  1235. // 弹出框确认回退
  1236. const handleRejectionReasonDialogConfirm = async () => {
  1237. try {
  1238. await rejectionReasonDialogFormRef.value.validate()
  1239. } catch {
  1240. return
  1241. }
  1242. rejectionReasonDialogVisible.value = false
  1243. // 同步到主表单以便保持数据一致
  1244. returnForm.value.rejectionReason = tempRejectionReason.value.rejectionReason
  1245. const params: Record<string, any> = {
  1246. reportId: props.selectedItem?.id,
  1247. approvalType: 1,
  1248. rejectionReason: tempRejectionReason.value.rejectionReason
  1249. }
  1250. executePass(params, 1)
  1251. }
  1252. // 执行通过/退回操作
  1253. const executePass = (params: Record<string, any>, type: number) => {
  1254. const tipText = type === 1 ? '退回' : type === 2 ? '整改不通过' : '整改通过'
  1255. ElMessageBox.confirm(`确定${tipText}吗?`, '提示', {
  1256. confirmButtonText: '确定',
  1257. cancelButtonText: '取消',
  1258. type: 'warning'
  1259. }).then(() => {
  1260. PipeTaskOrderApi.inspectionApproval(params).then((res) => {
  1261. props.taskId && getReportAuditInfo()
  1262. emit('refresh')
  1263. }).catch(() => {
  1264. ElMessage.error('操作失败')
  1265. })
  1266. })
  1267. }
  1268. // 上传整改材料
  1269. const ectificationMaterialsData = ref<any>({
  1270. rectificationUrl: [],
  1271. rectificationImage: [],
  1272. rectificationVideo: [],
  1273. })
  1274. const ectificationMaterialsVisible = ref(false)
  1275. const ectificationMaterialsLoading = ref(false)
  1276. const handleRectificationMaterials = () => {
  1277. const detail = checkBookDetail.value || {}
  1278. ectificationMaterialsData.value = {
  1279. rectificationUrl: detail.rectificationUrl ? detail.rectificationUrl.split(',').filter(Boolean).map((url: string) => ({ url })) : [],
  1280. rectificationImage: detail.rectificationImage ? detail.rectificationImage.split(',').filter(Boolean).map((url: string) => ({ url })) : [],
  1281. rectificationVideo: detail.rectificationVideo ? detail.rectificationVideo.split(',').filter(Boolean).map((url: string) => ({ url })) : [],
  1282. }
  1283. ectificationMaterialsVisible.value = true
  1284. }
  1285. const handleClosePectificationMaterialsDialog = () => {
  1286. ectificationMaterialsVisible.value = false
  1287. }
  1288. const handleSubmitChangeEctificationMaterialsDialog = async () => {
  1289. if (ectificationMaterialsData.value?.rectificationUrl?.length == 0) {
  1290. return ElMessage.error('请上传证明材料')
  1291. }
  1292. ectificationMaterialsLoading.value = true
  1293. try {
  1294. const data = {
  1295. reportId: props.selectedItem?.id || '',
  1296. businessType: 1,
  1297. rectificationUrl: ectificationMaterialsData.value?.rectificationUrl?.length ? ectificationMaterialsData.value?.rectificationUrl?.map(item => item.url)?.join(',') : '',
  1298. rectificationImage: ectificationMaterialsData.value?.rectificationImage?.length ? ectificationMaterialsData.value?.rectificationImage?.map(item => item.url)?.join(',') : '',
  1299. rectificationVideo: ectificationMaterialsData.value?.rectificationVideo?.length ? ectificationMaterialsData.value?.rectificationVideo?.map(item => item.url)?.join(',') : '',
  1300. }
  1301. const response = await PipeTaskOrderApi.inspectionOpinionRectifyApi(data)
  1302. if (response) {
  1303. ectificationMaterialsLoading.value = false
  1304. ElMessage.success('上传成功')
  1305. ectificationMaterialsVisible.value = false
  1306. emit('refresh')
  1307. }
  1308. } catch (error) {
  1309. ectificationMaterialsLoading.value = false
  1310. }
  1311. }
  1312. // 获取检验员名称
  1313. const getCheckersName = (): string => {
  1314. if (!props.selectedItem?.checkUsers || props.selectedItem.checkUsers.length === 0) {
  1315. return '未分配'
  1316. }
  1317. return props.selectedItem.checkUsers.map((user) => user.nickname).join('、')
  1318. }
  1319. // 切换主检人
  1320. const handleUserSelect = async (id, userList) => {
  1321. const result = await PipeTaskOrderApi.updateReportMainChecker({
  1322. id: props.taskOrderItem?.id,
  1323. mainChecker: userList[0]?.id
  1324. })
  1325. if (result) {
  1326. ElMessage.success('修改主检人成功!')
  1327. emit('refresh')
  1328. }
  1329. }
  1330. const userSelectFormRef = ref()
  1331. const handleModifyMainChecker = () => {
  1332. userSelectFormRef.value.open(props.taskOrderItem?.mainCheckerUser?.id)
  1333. }
  1334. // 判断当前检验员或主检人是否为登录用户,如果不是,则功能按钮disabled
  1335. const checkerIsLoginUser = computed(() => {
  1336. const checkerUserIds = props.selectedItem?.checkUsers.map(checker => checker?.id)
  1337. return !(checkerUserIds?.includes(userStore?.user?.id) || props.taskOrderItem?.mainCheckerUser?.id === userStore?.user?.id)
  1338. })
  1339. // 判断当前项目是否已经到报告办结阶段
  1340. const getReportStatusEnd = computed(
  1341. () =>{
  1342. return props.selectedItem && props.selectedItem.taskStatus >= PressureCheckerMyTaskStatus['REPORT_CONFIRMATION']
  1343. }
  1344. )
  1345. // 判断“提交校核”按钮是否显示
  1346. const isCanSubmitRecheck = computed(() => {
  1347. if (props.selectedItem?.reportType === PressureReportType['SUGGUESTION'])
  1348. return props.selectedItem?.isRecheck || false
  1349. else if (props.selectedItem?.reportType === PressureReportType['MAINQUESTION']) return false
  1350. else
  1351. return (
  1352. props.selectedItem &&
  1353. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['RECORD_INPUT']
  1354. // && props.selectedItem.reportUrl
  1355. )
  1356. })
  1357. // 判断“提交审核&提交审批”按钮是否显示
  1358. const isCanSubmitToAudit = computed(() => {
  1359. const { selectedItem } = props
  1360. if (selectedItem && selectedItem?.reportType === PressureReportType['SUBCONTRACT']){
  1361. return selectedItem.taskStatus === PressureCheckerMyTaskStatus['CONFIRMED']
  1362. }
  1363. if (props.selectedItem && props.selectedItem?.reportType === PressureReportType['SUGGUESTION'])
  1364. return (
  1365. props.selectedItem?.isApproval &&
  1366. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['RECORD_INPUT']
  1367. )
  1368. else if (
  1369. props.selectedItem &&
  1370. props.selectedItem?.reportType === PressureReportType['MAINQUESTION']
  1371. )
  1372. return (
  1373. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['RECORD_INPUT'] &&
  1374. props.selectedItem?.reportUrl
  1375. )
  1376. else
  1377. return (
  1378. props.selectedItem &&
  1379. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['REPORT_INPUT']
  1380. )
  1381. })
  1382. // 判断“填写记录”按钮是否显示
  1383. const isCanEditTestRecord = computed(
  1384. () =>
  1385. props.selectedItem &&
  1386. (props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['RECORD_INPUT'] ||
  1387. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['CONFIRMED']) && props.selectedItem.reportType !== PressureReportType['SUBCONTRACT']
  1388. )
  1389. // 判断“编制报告”按钮是否显示
  1390. const isCanEditReport = computed(
  1391. () =>
  1392. props.selectedItem &&
  1393. props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['REPORT_INPUT']
  1394. )
  1395. // 判断"撤销流程"按钮是否显示:报告审核或审批阶段,且有OA流程ID,且当前用户是发起人
  1396. const isCanCancelFlow = computed(() => {
  1397. if (!props.selectedItem) return false
  1398. const isAuditOrApprove = [
  1399. PressureCheckerMyTaskStatus['REPORT_AUDIT'],
  1400. PressureCheckerMyTaskStatus['REPORT_APPROVE']
  1401. ].includes(props.selectedItem.taskStatus)
  1402. if (!isAuditOrApprove) return false
  1403. if (!props.selectedItem.summaryId) return false
  1404. return !checkerIsLoginUser.value
  1405. })
  1406. // 撤销流程
  1407. const handleCancelFlow = async () => {
  1408. if (!props.selectedItem?.summaryId) {
  1409. ElMessage.warning('未找到OA流程ID,无法撤销')
  1410. return
  1411. }
  1412. ElMessageBox.confirm('确定要撤销该流程吗?撤销后报告将回到报告编制阶段,您可以重新发起。', '撤销流程', {
  1413. confirmButtonText: '确定',
  1414. cancelButtonText: '取消',
  1415. type: 'warning'
  1416. }).then(async () => {
  1417. try {
  1418. const result = await PipeTaskOrderApi.cancelOAFlow(props.selectedItem.summaryId)
  1419. if (result) {
  1420. ElMessage.success('流程已撤销')
  1421. handleRefresh()
  1422. }
  1423. } catch (error) {
  1424. console.error('撤销流程失败:', error)
  1425. ElMessage.error('撤销流程失败,请稍后重试')
  1426. }
  1427. }).catch(() => {})
  1428. }
  1429. // 判断"OA审核"按钮是否显示:报告审核或审批阶段,且有OA流程ID,且当前用户是对应阶段的审核人/审批人
  1430. const isCanOAAudit = computed(() => {
  1431. if (!props.selectedItem) return false
  1432. const { taskStatus, summaryId, approvalId, ratifyId } = props.selectedItem
  1433. const currentUserId = userStore?.user?.id
  1434. // 审核阶段:只有审核人才能点击
  1435. if (taskStatus === PressureCheckerMyTaskStatus['REPORT_AUDIT']) {
  1436. return !!summaryId && approvalId === currentUserId
  1437. }
  1438. // 审批阶段:只有审批人才能点击
  1439. if (taskStatus === PressureCheckerMyTaskStatus['REPORT_APPROVE']) {
  1440. return !!summaryId && ratifyId === currentUserId
  1441. }
  1442. return false
  1443. })
  1444. // OA审核:弹出独立窗口
  1445. const oaAuditTimer = ref<ReturnType<typeof setInterval> | null>(null)
  1446. const handleOpenOAAudit = async () => {
  1447. // 清除之前的定时器
  1448. if (oaAuditTimer.value) {
  1449. clearInterval(oaAuditTimer.value)
  1450. oaAuditTimer.value = null
  1451. }
  1452. // 先打开空白弹窗
  1453. const win = window.open('', 'OAAudit', 'width=1200,height=800,left=100,top=50,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes')
  1454. try {
  1455. const link = await PipeTaskOrderApi.getAffairLink(props.selectedItem.summaryId)
  1456. if (link && win) {
  1457. win.location.href = link
  1458. // 轮询监听窗口关闭,关闭后触发报告状态更新
  1459. oaAuditTimer.value = setInterval(() => {
  1460. if (win.closed) {
  1461. clearInterval(oaAuditTimer.value!)
  1462. oaAuditTimer.value = null
  1463. PipeTaskOrderApi.updateReportBySummaryId(props.selectedItem.summaryId).finally(() => handleRefresh())
  1464. }
  1465. }, 500)
  1466. } else if (!win) {
  1467. ElMessage.warning('浏览器拦截了弹窗,请允许弹窗后重试')
  1468. } else {
  1469. win.close()
  1470. ElMessage.warning('未找到对应的OA审批链接')
  1471. }
  1472. } catch (error) {
  1473. console.error('获取OA审批链接失败:', error)
  1474. win?.close()
  1475. ElMessage.error('获取OA审批链接失败,请稍后重试')
  1476. }
  1477. }
  1478. // 判断"填写结果"按钮是否显示
  1479. const isCanEditRecordResult = computed(() => {
  1480. // 非我的任务详情页面,不显示
  1481. if ('PipeCheckerTaskDetail' !== routeName.value) return false
  1482. if (!props.selectedItem?.isAutoAmount || props.selectedItem?.isAutoAmount === '0') return false
  1483. if (
  1484. (props.selectedItem?.reportType === 100 || props.selectedItem?.reportType === 300) &&
  1485. props.selectedItem.taskStatus !== PressureCheckerMyTaskStatus['REPORT_END']
  1486. ) {
  1487. // 独审报告&主报告--“填写结果”:报告办结之前都可以填写
  1488. return true
  1489. }
  1490. // 查找主报告
  1491. const mainReport = props.reportList?.find((item) => item.reportType === 100) || {
  1492. taskStatus: null
  1493. }
  1494. if (
  1495. props.selectedItem?.reportType !== 100 &&
  1496. props.selectedItem?.reportType !== 300 &&
  1497. mainReport?.taskStatus !== PressureCheckerMyTaskStatus['REPORT_END']
  1498. ) {
  1499. // 非主报告 & 非独审报告 -- “填写结果”:主报告办结之前都可以填写
  1500. return true
  1501. }
  1502. return false
  1503. })
  1504. // 1、重大问题线索告知表 2、作业指导书 3、检验方案 只显示pdf
  1505. const onlyShowPdf = computed(() => {
  1506. const reportTypes = [
  1507. PressureReportType.MAINQUESTION,
  1508. PressureReportType.INSPECTIONPLAN,
  1509. PressureReportType.WORKINSTRUCTION
  1510. ]
  1511. return !props.selectedItem?.reportType
  1512. ? false
  1513. : reportTypes.includes(props.selectedItem?.reportType)
  1514. })
  1515. // 模板参数
  1516. const templateParams = computed(() => {
  1517. if (!props.selectedItem) return {}
  1518. return {
  1519. ...props.selectedItem,
  1520. equipCode: props.taskOrderItem?.equipCode || '',
  1521. equipId: props.taskOrderItem?.id || ''
  1522. }
  1523. })
  1524. // 判断是否为独审报告且不需要审批
  1525. const isApprovalWithoutRatify = computed(() => {
  1526. if (!props.selectedItem) return false
  1527. const reportType = (props.selectedItem as any).reportType
  1528. const isApproval = (props.selectedItem as any).isApproval
  1529. const isRatify = (props.selectedItem as any).isRatify
  1530. return (
  1531. reportType === PressureReportType.SINGLE &&
  1532. isApproval === true &&
  1533. isRatify === false &&
  1534. props.reportId === props.selectedItem.id
  1535. )
  1536. })
  1537. /**** 葡萄城:记录录入的显示和隐藏 ****/
  1538. const showInlineEditCheckRecord = ref(false)
  1539. const templateId = ref('')
  1540. const handleEditSpreadRecord = () => {
  1541. // console.log('templateParams', templateParams.value)
  1542. // DynamicTbInsApi.getOrCreatePreviewData('dc8fbb6078b2a2f0eadc0f6aedbeafa0').then(res => {
  1543. // showInlineEditCheckRecord.value = true
  1544. // templateId.value = res.id
  1545. // })
  1546. editPreview('record')
  1547. showInlineEditCheckRecord.value = true
  1548. }
  1549. const handleTemplateConfirm = (templateUrl: string) => {
  1550. console.log('templateUrl', templateUrl)
  1551. emit('template-confirm', templateUrl)
  1552. }
  1553. const handleRefresh = () => {
  1554. emit('refresh')
  1555. }
  1556. /**** 葡萄城:记录录入的显示和隐藏 end****/
  1557. /**** 葡萄城:检验结果录入的显示和隐藏 ****/
  1558. const showInlineInspectionResultInput = ref(false)
  1559. const inspectionResultTemplateParams = ref({})
  1560. // 检验结果录入模板参数
  1561. const handleInputCheckConclusion = () => {
  1562. showInlineInspectionResultInput.value = true
  1563. if (!props.selectedItem) return {}
  1564. inspectionResultTemplateParams.value = {
  1565. ...props.selectedItem,
  1566. equipCode: props.taskOrderItem?.equipCode || ''
  1567. }
  1568. }
  1569. const handleInspectionResultConfirm = (resultUrl: string) => {
  1570. emit('template-confirm', resultUrl)
  1571. viewMode.value = 'normal'
  1572. }
  1573. const handleReturnToNormalMode = () => {
  1574. viewMode.value = 'normal'
  1575. }
  1576. /**** 葡萄城:检验结果录入的显示和隐藏 end ****/
  1577. /**** 葡萄城:报告编制的显示和隐藏 ****/
  1578. const showInlineReportEdit = ref(false)
  1579. const handleEditRreport = () => {
  1580. if (showReportPdfType.value !== 'report' && showReportPdfType.value !== 'result'){
  1581. ElMessage.warning('请切换报告后再进行报告编制!')
  1582. return
  1583. }
  1584. editPreview('report')
  1585. showInlineReportEdit.value = true
  1586. }
  1587. // 获取当前报告的配置信息
  1588. const currentReportConfig = computed(() => {
  1589. if (
  1590. !props.selectedItem ||
  1591. props.selectedItem.reportType !== PressureReportType.SINGLE ||
  1592. !props.reportList
  1593. ) {
  1594. return null
  1595. }
  1596. // 从reportList中找到当前报告的配置
  1597. const currentReport = props.reportList.find((report) => report.id === templateParams.value?.id)
  1598. return currentReport
  1599. ? {
  1600. isApproval: (currentReport as any).isApproval,
  1601. isRatify: (currentReport as any).isRatify
  1602. }
  1603. : null
  1604. })
  1605. // 选择报告审核人弹窗的显示和隐藏
  1606. const isShowReportAuditDialog = ref(false)
  1607. // 提交报告审核
  1608. const handleSubmitAudit = async () => {
  1609. try {
  1610. await spreadRef.value?.handleSave()
  1611. } catch (error) {
  1612. console.error('保存数据失败:', error)
  1613. ElMessage.error('保存数据失败,请重试')
  1614. return
  1615. }
  1616. if([PressureReportType.SUGGUESTION, PressureReportType.MAINQUESTION].includes(props?.selectedItem?.reportType) && !props?.selectedItem?.reportUrl) {
  1617. // 【重大问题线索告知表,检验意见通知书】必须先填写记录,才能提交审核
  1618. ElMessage.warning('请先“填写记录”!再提交审核!')
  1619. return
  1620. }
  1621. if(PressureReportType.SINGLE === props?.selectedItem?.reportType && !props?.selectedItem?.prepareUrl) {
  1622. // 独审报告:用户可以不走报告编制环节直接提交审核,需要调用handleUploadAPIReportPreviewBlob将reportPreview接口的文件流拿来提交一遍
  1623. return handleUploadAPIReportPreviewBlob(handleSubmitAudit)
  1624. }
  1625. // 检查检验意见通知书是否“报告完结”
  1626. const canSubmit = canSubmitMainReportType('该报告存在未办结检验意见通知书,无法提交审核、审批')
  1627. if(!canSubmit) return
  1628. // 检查其他报告状态
  1629. const checkResult = checkOtherReportsFinished()
  1630. if (!checkResult.canSubmit) {
  1631. try {
  1632. await ElMessageBox.alert(
  1633. checkResult.message || '请先办结其他报告再提交主报告审核',
  1634. '无法提交审核'
  1635. )
  1636. } catch (error) {
  1637. // 用户关闭对话框,不需要处理
  1638. }
  1639. return
  1640. }
  1641. // if(PressureReportType.MAIN === props?.selectedItem?.reportType && !props?.selectedItem?.prepareUrl) {
  1642. // // 主报告:用户可以不走报告编制环节直接提交审核,需要调用handleUploadAPIReportPreviewBlob将reportPreview接口的文件流拿来提交一遍
  1643. // return handleUploadAPIReportPreviewBlob(handleSubmitAudit)
  1644. // }
  1645. // 检验意见通知书 && 重大问题线索通知 不需要选择审核人
  1646. if (
  1647. [PressureReportType['SUGGUESTION'], PressureReportType['MAINQUESTION']].includes(
  1648. templateParams.value?.reportType
  1649. )
  1650. ) {
  1651. ElMessageBox.confirm(`确定提交【${templateParams.value?.reportName}】`, '提示', {
  1652. confirmButtonText: '确定',
  1653. cancelButtonText: '取消'
  1654. })
  1655. .then(async () => {
  1656. const submitResult = await PipeTaskOrderApi.submitOpinionNoticeApproval({
  1657. id: templateParams.value?.id
  1658. })
  1659. if (submitResult) {
  1660. // 这里可以做页面刷新
  1661. emit('template-confirm')
  1662. }
  1663. })
  1664. .catch(() => {
  1665. console.log('用户取消提交审核')
  1666. })
  1667. } else {
  1668. let res = await UserApi.getApprovalDetail({}) // 判断是否有审批信息
  1669. if (res && res.approveUser) {
  1670. form.value.recheckUser = res.approveUser
  1671. }
  1672. schemaFlag.value = 'audit'
  1673. isShowAuditDialog.value = true
  1674. // isShowReportAuditDialog.value = true
  1675. }
  1676. }
  1677. const handleCompletion = async () => {
  1678. await PipeTaskOrderApi.handleCompletion(props.selectedItem.id)
  1679. handleRefresh()
  1680. ElMessage.success('报告已办结')
  1681. }
  1682. // 上传主报告文件流
  1683. const handleUploadAPIReportPreviewBlob = async (submitApprovalFn) => {
  1684. if(!props.selectedItem || props.selectedItem.taskStatus !== PressureTaskOrderTaskStatus.REPORT_INPUT) return
  1685. // 获取文件流
  1686. const blob = await PipeTaskOrderApi.getReportPreview({
  1687. reportId: props.selectedItem?.id,
  1688. type: 300, // 报告模板
  1689. fileType: 100 // xlsx
  1690. })
  1691. if(blob) {
  1692. // 上传文件流
  1693. const formData = new FormData()
  1694. formData.append('file', blob)
  1695. const response = await uploadFile(formData)
  1696. // 保存报告编制的url
  1697. const saveResult = await PipeTaskOrderApi.saveReportPrepare({
  1698. id: props.selectedItem.id,
  1699. prepareUrl: response,
  1700. })
  1701. if(saveResult) {
  1702. await emit('update:selected-item', {...props.selectedItem, prepareUrl: response})
  1703. // 提交审核
  1704. await submitApprovalFn()
  1705. }
  1706. }
  1707. }
  1708. const handleChangeEntrustUnit = (unit: Record<string, any>) => {
  1709. form.value.recheckUser = unit
  1710. }
  1711. // 检查其他报告是否已办结
  1712. const checkOtherReportsFinished = (): { canSubmit: boolean; message?: string } => {
  1713. if (!props.selectedItem) return { canSubmit: false }
  1714. // 如果不是主报告,直接允许提交
  1715. if (props.selectedItem.reportType !== PressureReportType.MAIN) {
  1716. return { canSubmit: true }
  1717. }
  1718. // 主报告需要检查其他报告状态
  1719. const unfinishedReports = !props.reportList
  1720. ? []
  1721. : props.reportList.filter((report) => {
  1722. // 排除当前报告
  1723. if (report.id === templateParams.value?.id) {
  1724. return false
  1725. }
  1726. // 检查子报告和独审报告是否已办结
  1727. const isSubReport = report.reportType === PressureReportType.SUB
  1728. const isSingleReport = report.reportType === PressureReportType.SINGLE
  1729. const isSUGGUESTIONReport = report.reportType === PressureReportType.SUGGUESTION
  1730. if (isSubReport || isSingleReport || isSUGGUESTIONReport) {
  1731. return report.taskStatus !== PressureCheckerMyTaskStatus.REPORT_END
  1732. }
  1733. return false
  1734. })
  1735. if (unfinishedReports.length > 0) {
  1736. const unfinishedNames = unfinishedReports.map((report) => report.reportName).join('、')
  1737. return {
  1738. canSubmit: false,
  1739. message: `请先办结其他报告再提交主报告审核。未办结的报告:${unfinishedNames}`
  1740. }
  1741. }
  1742. // 检查是否确认费用
  1743. // const reportsWithoutConfirmFee: any[] = []
  1744. // 检查当前报告中是否存在应确认费用,但未确认的报错
  1745. const reportsWithoutConfirmFee: any[] = !props.reportList
  1746. ? []
  1747. : props.reportList.filter(
  1748. (report: any) => report.isAutoAmount === '1' && report.feeConfirm === false
  1749. )
  1750. // if (currentReport) {
  1751. // reportsWithoutConfirmFee.push(currentReport)
  1752. // }
  1753. // 检查子报告是否都已录入结果
  1754. // const subReports = !props.reportList ? [] : props.reportList.filter(report => {
  1755. // return report.id !== templateParams.value?.id &&
  1756. // report.reportType === PressureReportType.SUB
  1757. // })
  1758. // subReports.forEach(report => {
  1759. // if (!report.formulaJson) {
  1760. // reportsWithoutConfirmFee.push(report)
  1761. // }
  1762. // })
  1763. if (reportsWithoutConfirmFee.length > 0) {
  1764. const reportNames = reportsWithoutConfirmFee.map((report) => report.reportName).join('、')
  1765. return {
  1766. canSubmit: false,
  1767. message: `请先确认费用再提交主报告审核。未确认费用的报告:${reportNames}`
  1768. }
  1769. }
  1770. return { canSubmit: true }
  1771. }
  1772. // 报告审核人选择确认
  1773. const handleReportAuditSelectConfirm = async (res: any) => {
  1774. const approveId = res[0]
  1775. const submitResult = await PipeTaskOrderApi.submitReportAudit({
  1776. id: templateParams.value?.id,
  1777. approveId
  1778. })
  1779. if (submitResult) {
  1780. // 这里可以做页面刷新
  1781. emit('template-confirm')
  1782. }
  1783. isShowReportAuditDialog.value = false
  1784. }
  1785. /**** 葡萄城:报告编制的显示和隐藏 end ****/
  1786. const handleModifyChecker = () => {
  1787. if (props.selectedItem) {
  1788. emit('modify-checker', props.selectedItem)
  1789. }
  1790. }
  1791. // 审批人选择确认
  1792. const handleApprovalSelectConfirm = async (res: any) => {
  1793. if (!props.selectedItem || !res || res.length === 0) {
  1794. ElMessage.warning('请选择审批人')
  1795. return
  1796. }
  1797. const ratifyId = res[0] // 获取选中的审批人ID
  1798. try {
  1799. await PipeTaskOrderApi.submitReportApprove({
  1800. id: props.selectedItem.id,
  1801. ratifyId: ratifyId
  1802. })
  1803. ElMessage.success('提交审批成功')
  1804. isShowApprovalDialog.value = false
  1805. emit('submit-approval')
  1806. } catch (error: any) {
  1807. console.error('提交审批失败:', error)
  1808. ElMessage.error('提交审批失败,请稍后重试')
  1809. isShowApprovalDialog.value = false
  1810. }
  1811. }
  1812. // 加载流转记录列表
  1813. const recordList = ref<any[]>([])
  1814. const recordListLoading = ref(false)
  1815. const loadRecordList = async () => {
  1816. if (!props.selectedItem) return
  1817. try {
  1818. let response = null
  1819. // 检验意见通知书&重大问题线索
  1820. switch (props.selectedItem.reportType) {
  1821. case PressureReportType['SUGGUESTION']:
  1822. case PressureReportType['MAINQUESTION']:
  1823. response = await PipeTaskOrderApi.getOpinionNoticeApprovalRecordList({
  1824. id: props.selectedItem.id
  1825. })
  1826. break
  1827. default:
  1828. // 其他
  1829. response = await PipeTaskOrderApi.getTaskOrderItemReportRecordPage({
  1830. pageSize: 10,
  1831. pageNo: 1,
  1832. reportId: props.selectedItem.id
  1833. })
  1834. }
  1835. // 根据实际接口返回的数据结构获取数据
  1836. console.log("XXXX",recordList.value)
  1837. recordList.value = response?.data?.list || response?.list || response || []
  1838. } catch (error: any) {
  1839. console.error('获取流转记录失败:', error)
  1840. ElMessage.error('获取流转记录失败,请稍后重试')
  1841. recordList.value = []
  1842. } finally {
  1843. recordListLoading.value = false
  1844. }
  1845. }
  1846. // 获取报告字段纠错列表
  1847. const checkInputList = ref<any[]>([])
  1848. const handleGetCheckKeyInputs = async () => {
  1849. checkInputList.value = []
  1850. //if (!dataJson) return
  1851. if (!props.selectedItem?.id) return ElMessage.warning('字段纠错传参有误')
  1852. let reportId = props.selectedItem?.id
  1853. //const templateId = showReportPdfType.value === 'report'? props.selectedItem?.reportTemplateId : props.selectedItem?.templateId;
  1854. let templateId = showReportPdfType.value === 'report' ? props.selectedItem?.reportTemplateId :
  1855. showReportPdfType.value === 'result' ? props.selectedItem?.resultTemplateId : props.selectedItem?.templateId;
  1856. if (showReportPdfType.value === 'report'){
  1857. reportId = "report_" + reportId;
  1858. }else if (showReportPdfType.value === 'result'){
  1859. reportId = "result_" + reportId;
  1860. }
  1861. const response = await PipeTaskOrderApi.getCheckKeyIsInput(
  1862. { id: templateId,reportId: reportId },
  1863. JSON.parse("{}")
  1864. )
  1865. //console.log(JSON.parse(dataJson))
  1866. if (response) checkInputList.value = formatCheckInputList(response)
  1867. }
  1868. function formatCheckInputList(response, checkInputList = [] as any[]) {
  1869. if (!response) return []
  1870. for (let checkItem of response) {
  1871. if (!checkItem.child) {
  1872. checkInputList.push({ code: checkItem.code, name: checkItem.name })
  1873. }
  1874. if (is(checkItem.child, 'Array') && checkItem.type === 'object') {
  1875. formatCheckInputList(checkItem.child, checkInputList)
  1876. }
  1877. if (is(checkItem.child, 'Array') && checkItem.type === 'array') {
  1878. const childMapper = checkItem.child.map((item, i) => {
  1879. return {
  1880. code: `${checkItem.code}: ${item.code}`,
  1881. name: item.name
  1882. }
  1883. })
  1884. formatCheckInputList(childMapper, checkInputList)
  1885. }
  1886. }
  1887. return checkInputList
  1888. }
  1889. // 获取版本记录列表
  1890. const showVersionDetail = ref(false)
  1891. const historyList = ref<any[]>([])
  1892. async function getOrderHistoryVersion(id: string) {
  1893. try {
  1894. const response = await PipeTaskOrderApi.getSafetyCheckRecordVersionPage({
  1895. pageNo: 1,
  1896. pageSize: 100,
  1897. businessType: 0,
  1898. orderItemReportId: id
  1899. })
  1900. historyList.value = response.list || []
  1901. } catch (error) {
  1902. console.error('获取历史版本失败:', error)
  1903. ElMessage.error('获取历史版本失败')
  1904. }
  1905. }
  1906. const versionDataCompareList = ref([])
  1907. const versionColumns = ref([
  1908. {
  1909. label: '字段名',
  1910. prop: 'displayName'
  1911. },
  1912. {
  1913. label: '修改前',
  1914. prop: 'oldValue',
  1915. render: (row, value) => (
  1916. <el-text link type="default">
  1917. {value || '-'}
  1918. </el-text>
  1919. )
  1920. },
  1921. {
  1922. label: '修改后',
  1923. prop: 'newValue',
  1924. render: (row, value) => <el-text type="primary">{value || '-'}</el-text>
  1925. }
  1926. ])
  1927. const versionDetailButtons = ref([
  1928. {
  1929. render: () => (
  1930. <el-button type="success" onClick={() => handleShowReportPdf()}>
  1931. 查看原文件PDF
  1932. </el-button>
  1933. )
  1934. }
  1935. ])
  1936. const showReportDialog = ref(false)
  1937. const currentUrl = ref('')
  1938. const reportSource = ref<any | null>(null)
  1939. const pdfLoading = ref(false)
  1940. // 恢复版本
  1941. const restoreVersion = (item: any) => {
  1942. ElMessageBox.confirm('是否确定恢复到该版本?', '提示', {
  1943. confirmButtonText: '确定',
  1944. cancelButtonText: '取消',
  1945. type: 'info',
  1946. center: true
  1947. })
  1948. .then(async () => {
  1949. const result = await PipeTaskOrderApi.saveTaskReportTemplate({
  1950. id: props.selectedItem?.id,
  1951. reportUrl: item.oldReportUrl,
  1952. prepareJson: item.oldPrepareJson,
  1953. reportType: showReportPdfType.value,
  1954. modifiedReason: '恢复版本'
  1955. })
  1956. console.log('restoreVersion', result)
  1957. if (result) {
  1958. ElMessage({
  1959. type: 'success',
  1960. message: '操作成功'
  1961. })
  1962. handleRefresh()
  1963. } else {
  1964. ElMessage.warning('操作失败,请联系管理员!')
  1965. }
  1966. })
  1967. .catch(() => {})
  1968. }
  1969. // 查看版本详情的pdf
  1970. const handleShowReportPdf = async () => {
  1971. if (currentUrl.value) {
  1972. const reportId = props.selectedItem?.id;
  1973. reportInitData.value.refId = showReportPdfType.value === 'report' ? "report_" + reportId :
  1974. showReportPdfType.value === 'result' ? "result_" + reportId : reportId
  1975. reportInitData.value.templateId = showReportPdfType.value === 'report' ? templateParams.value.reportTemplateId :
  1976. showReportPdfType.value === 'result' ? templateParams.value.resultTemplateId : templateParams.value.templateId
  1977. reportInitData.value.dataSource = currentUrl.value.oldPrepareJson ? JSON.parse(currentUrl.value.oldPrepareJson) : {}
  1978. showReportDialog.value = true
  1979. setTimeout(()=> {
  1980. reportSpreadRef.value?.reloadView();
  1981. })
  1982. pdfLoading.value = false
  1983. } else {
  1984. ElMessage.warning('报告缺失,请联系管理员!')
  1985. }
  1986. }
  1987. const handlePdfRendered = () => {
  1988. pdfLoading.value = false
  1989. currentUrl.value = ''
  1990. }
  1991. // 查看详情
  1992. const handleShowVersionInfo = (item) => {
  1993. showVersionDetail.value = true
  1994. console.log(item)
  1995. currentUrl.value = item
  1996. versionDataCompareList.value = JSON.parse(item.modifiedObject)
  1997. }
  1998. // 检验项目添加上传附件功能
  1999. const reportListUploadModalRef = ref<InstanceType<typeof ReportListUploadModal>>()
  2000. const handleUploadItem = () => {
  2001. reportListUploadModalRef.value?.openModal(route.query.type === 'PipeMyTask')
  2002. }
  2003. //切换记录和报告的显示
  2004. const handleChangeShowReportPdf = (showType: string) => {
  2005. if (showType === 'report' || showType === 'result'){
  2006. if (![PressureCheckerMyTaskStatus.REPORT_INPUT,PressureCheckerMyTaskStatus.REPORT_AUDIT,PressureCheckerMyTaskStatus.REPORT_APPROVE,PressureCheckerMyTaskStatus.REPORT_END].includes(props.selectedItem.taskStatus)){
  2007. ElMessage.error('该检验项目暂未生成报告!')
  2008. showReportPdfType.value = 'record';
  2009. return;
  2010. }
  2011. }
  2012. if (showType === 'result'){
  2013. if (!props.selectedItem?.resultTemplateId){
  2014. ElMessage.error('该检验项目没有结论报告!')
  2015. showReportPdfType.value = 'record';
  2016. return;
  2017. }
  2018. }
  2019. showReportPdfType.value = showType;
  2020. handleRefreshData()
  2021. }
  2022. const isCanSyncReportData = computed(() => {
  2023. return true
  2024. //return [PressureCheckerMyTaskStatus.CONFIRMED,PressureCheckerMyTaskStatus.RECORD_INPUT].includes(props.selectedItem.taskStatus)
  2025. })
  2026. const handleSyncReportData = async () => {
  2027. try {
  2028. const response = await PipeTaskOrderApi.syncReportData({
  2029. refId: props.selectedItem.id,
  2030. reportType : showReportPdfType.value
  2031. })
  2032. if (response){
  2033. ElMessage.success('同步数据成功')
  2034. handleRefresh()
  2035. }else{
  2036. ElMessage.error('同步数据失败,请稍后重试')
  2037. }
  2038. } catch (error: any) {
  2039. console.error('同步数据失败:', error)
  2040. ElMessage.error('同步数据失败,请稍后重试')
  2041. }
  2042. }
  2043. const getPipeRecheckUserList = async (params) => {
  2044. params.orderId = props.taskInfo.id
  2045. return await PipeTaskOrderApi.getPipeRecheckUserList(params)
  2046. }
  2047. const showAssociationOperationManual = ref(false)
  2048. const handleShowAssociationOperationManual = () => {
  2049. showAssociationOperationManual.value = true
  2050. }
  2051. // onMounted(() => {
  2052. // console.log(props)
  2053. // //initPreview()
  2054. // })
  2055. const initPreview=()=>{
  2056. const reportId = props.selectedItem?.id;
  2057. const refId = showReportPdfType.value === 'report' ? "report_" + reportId :
  2058. showReportPdfType.value === 'result' ? "result_" + reportId : reportId
  2059. const templateId = showReportPdfType.value === 'report' ? templateParams.value.reportTemplateId :
  2060. showReportPdfType.value === 'result' ? templateParams.value.resultTemplateId : templateParams.value.templateId
  2061. initData.value.templateId = templateId;
  2062. initData.value.refId = refId;
  2063. initData.value.refName = props.selectedItem?.reportName;
  2064. initData.value.opType = (props.selectedItem.taskStatus == 510 || props.selectedItem.taskStatus >= 600 || (showReportPdfType.value === 'record' && props.selectedItem.taskStatus > 500) || props?.selectedItem?.checkUsers?.[0]?.id != userStore?.user?.id) ? 1 : 0;
  2065. if (props.selectedItem.reportType === PressureReportType['INSPECTIONPLAN'] && props.selectedItem.manualUrl){
  2066. initData.value.manualUrl = props.selectedItem.manualUrl;
  2067. }else{
  2068. initData.value.manualUrl = '';
  2069. }
  2070. //spreadRef.value?.reloadView();
  2071. setTimeout(()=>{
  2072. spreadRef.value?.reloadView();
  2073. },50)
  2074. console.log('initPreview', initData.value)
  2075. }
  2076. const editPreview=(reportType: string)=>{
  2077. const reportId = props.selectedItem?.id;
  2078. const refId = showReportPdfType.value === 'report' ? "report_" + reportId :
  2079. showReportPdfType.value === 'result' ? "result_" + reportId : reportId
  2080. const templateId = showReportPdfType.value === 'report' ? templateParams.value.reportTemplateId :
  2081. showReportPdfType.value === 'result' ? templateParams.value.resultTemplateId : templateParams.value.templateId
  2082. editData.value.templateId = templateId;
  2083. editData.value.refId = refId;
  2084. editData.value.opType = 0;
  2085. setTimeout(()=>{
  2086. if (reportType === 'record'){
  2087. editSpreadRecordRef.value?.reloadView();
  2088. }else if(reportType === 'report'){
  2089. editSpreadReportRef.value?.reloadView();
  2090. }
  2091. },50)
  2092. console.log('editDataPreview', editData.value)
  2093. }
  2094. const saveSuccess = async (data)=>{
  2095. if (props.selectedItem.taskStatus >= PressureCheckerMyTaskStatus.REPORT_INPUT){
  2096. saveSuccessReport(data)
  2097. }else {
  2098. saveSuccessRecord(data)
  2099. }
  2100. }
  2101. const saveSuccessRecord = async (data)=>{
  2102. const dataJson = !data.dataSource ? '' : JSON.stringify(data.dataSource)
  2103. const params = {
  2104. id: props.selectedItem?.id,
  2105. reportUrl: props.selectedItem?.id,
  2106. prepareJson: dataJson
  2107. }
  2108. const saveResult = await PipeTaskOrderApi.saveTaskReportTemplate(params)
  2109. if (saveResult) {
  2110. showInlineEditCheckRecord.value = false
  2111. handleRefresh()
  2112. }
  2113. }
  2114. const handleClose = () => {
  2115. ElMessageBox.confirm('是否关闭?', {
  2116. confirmButtonText: '确认',
  2117. cancelButtonText: '取消',
  2118. type: 'warning',
  2119. }).then(() => {
  2120. showInlineEditCheckRecord.value = false
  2121. showInlineReportEdit.value = false
  2122. handleRefresh()
  2123. })
  2124. }
  2125. const saveSuccessReport = async (data)=>{
  2126. const dataJson = !data.dataSource ? '' : JSON.stringify(data.dataSource)
  2127. const saveResult = PipeTaskOrderApi.saveReportPrepare({
  2128. id: props.selectedItem?.id,
  2129. prepareJson: dataJson,
  2130. })
  2131. if(saveResult) {
  2132. showInlineReportEdit.value = false
  2133. handleRefresh()
  2134. }
  2135. }
  2136. const handleRefreshData = () => {
  2137. loadRecordList()
  2138. initPreview()
  2139. handleGetCheckKeyInputs()
  2140. getOrderHistoryVersion(props.selectedItem?.id)
  2141. }
  2142. // 应用项目 - 使用模板数据填充当前记录
  2143. const handleApplyTemplate = (defaultJson: Recordable) => {
  2144. if (!isCanEditTestRecord.value) {
  2145. return ElMessage.warning('非可编辑状态,不能应用模板')
  2146. }
  2147. initData.value = {
  2148. ...initData.value,
  2149. dataSource: defaultJson
  2150. }
  2151. setTimeout(() => {
  2152. spreadRef.value?.reloadView()
  2153. }, 50)
  2154. }
  2155. // 更新模板 - 打开记录编辑器供用户更新模板
  2156. const handleUpdateTemplateUrl = (item: ReportItemVO) => {
  2157. handleEditSpreadRecord()
  2158. }
  2159. const getData = () => {
  2160. return spreadRef.value?.getData()
  2161. }
  2162. defineExpose({
  2163. handleShowAssociationOperationManual,
  2164. handleApplyTemplate,
  2165. handleUpdateTemplateUrl,
  2166. getData
  2167. })
  2168. //新加
  2169. // 添加控制展开/收缩状态的变量
  2170. const isExpanded = ref(false);
  2171. // 添加切换面板展开/收缩的方法
  2172. const togglePanel = () => {
  2173. isExpanded.value = !isExpanded.value;
  2174. setTimeout((() => {
  2175. nextTick(handleWindowResize)
  2176. }), 300);
  2177. };
  2178. // 获取PDF宽度
  2179. const pdfContentWidth = ref<number>(1030)
  2180. const pdfPanelRef = ref<HTMLDivElement>()
  2181. const handleWindowResize = debounce(async () => {
  2182. if(!pdfPanelRef.value) return
  2183. const width = pdfPanelRef.value?.clientWidth - 20
  2184. pdfContentWidth.value = props.isFullscreen ? width : (width > 1030 ? 1030 : width)
  2185. if (initData.value.opType == 1){
  2186. spreadRef.value?.reloadView();
  2187. }else {
  2188. spreadRef.value?.handleSave();
  2189. }
  2190. }, 100)
  2191. onMounted(() => {
  2192. handleWindowResize()
  2193. window.addEventListener('resize', handleWindowResize)
  2194. })
  2195. onUnmounted(() => {
  2196. window.removeEventListener('resize', handleWindowResize)
  2197. })
  2198. // 全屏切换时重新计算PDF区域宽度
  2199. watch(() => props.isFullscreen, () => {
  2200. nextTick(() => {
  2201. handleWindowResize()
  2202. })
  2203. })
  2204. </script>
  2205. <style lang="scss" scoped>
  2206. .capsule-tabs {
  2207. display: inline-flex;
  2208. align-items: center;
  2209. gap: 2px;
  2210. padding: 2px;
  2211. border-radius: 20px;
  2212. margin-right: 12px;
  2213. flex-shrink: 0;
  2214. .tab-item {
  2215. display: inline-flex;
  2216. align-items: center;
  2217. justify-content: center;
  2218. padding: 4px 12px;
  2219. font-size: 12px;
  2220. background: white;
  2221. border-radius: 16px;
  2222. cursor: pointer;
  2223. transition: all 0.3s ease;
  2224. color: #606266;
  2225. font-weight: 500;
  2226. border: 1px solid transparent;
  2227. user-select: none;
  2228. white-space: nowrap;
  2229. min-width: 50px;
  2230. span {
  2231. font-size: 12px !important;
  2232. }
  2233. &:hover {
  2234. color: #409eff;
  2235. border-color: #409eff;
  2236. }
  2237. &.active {
  2238. background: linear-gradient(135deg, #409eff 0%, #66b1ff 100%);
  2239. color: white;
  2240. border-color: #409eff;
  2241. box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  2242. }
  2243. }
  2244. }
  2245. .container-panel {
  2246. height: 100%;
  2247. border: 1px solid var(--el-border-color);
  2248. .info-panel {
  2249. display: flex;
  2250. height: 32px;
  2251. padding: 0 8px 0 22px;
  2252. font-size: 14px;
  2253. color: #41475c;
  2254. background-color: #effaff;
  2255. justify-content: space-between;
  2256. align-items: center;
  2257. }
  2258. .status-operation-panel {
  2259. height: calc(100% - 32px);
  2260. .single-item-panel {
  2261. display: flex;
  2262. align-items: stretch;
  2263. justify-content: space-between;
  2264. width: 100%;
  2265. height: 100%;
  2266. }
  2267. .pdf-panel {
  2268. height: 100%;
  2269. padding: 10px;
  2270. flex: 1;
  2271. overflow: hidden;
  2272. }
  2273. .right-panel-container {
  2274. display: flex;
  2275. position: relative;
  2276. // 收缩展开按钮样式
  2277. .toggle-btn {
  2278. position: absolute;
  2279. left: -30px;
  2280. top: 50%;
  2281. transform: translateY(-50%);
  2282. width: 30px;
  2283. height: 60px;
  2284. background-color: #fff;
  2285. border: 1px solid var(--el-border-color);
  2286. border-radius: 10px 0 0 10px;
  2287. display: flex;
  2288. align-items: center;
  2289. justify-content: center;
  2290. cursor: pointer;
  2291. z-index: 100;
  2292. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  2293. transition: all 0.3s ease;
  2294. &:hover {
  2295. background-color: #f5f5f5;
  2296. }
  2297. &.collapsed {
  2298. left: -18px;
  2299. // border-radius: 0 10px 10px 0;
  2300. }
  2301. }
  2302. }
  2303. .operation-panel {
  2304. flex-basis: 300px;
  2305. padding: 10px 10px 10px 0;
  2306. box-sizing: border-box;
  2307. transition: all 0.3s ease;
  2308. // 展开状态样式
  2309. &.expanded {
  2310. width: 300px;
  2311. }
  2312. // 收缩状态样式
  2313. &.collapsed {
  2314. width: 0;
  2315. padding: 0;
  2316. border: none;
  2317. .default-toolbar,
  2318. .operation-inner {
  2319. display: none;
  2320. }
  2321. }
  2322. .operation-btns {
  2323. display: flex;
  2324. flex-wrap: wrap;
  2325. gap: 12px;
  2326. .el-button {
  2327. margin-bottom: 10px;
  2328. margin-left: 0;
  2329. }
  2330. }
  2331. }
  2332. .operation-inner {
  2333. height: 100%;
  2334. padding: 7px 10px 20px;
  2335. background-color: #fff;
  2336. border: 1px solid var(--el-border-color);
  2337. box-sizing: border-box;
  2338. }
  2339. .custom-inner{
  2340. display: flex;
  2341. flex-direction: column;
  2342. overflow: hidden;
  2343. height: 100%;
  2344. padding: 7px 10px 20px;
  2345. background-color: #fff;
  2346. border: 1px solid var(--el-border-color);
  2347. box-sizing: border-box;
  2348. .operation-item1 {
  2349. position: relative;
  2350. margin-bottom: 10px;
  2351. overflow-y: auto;
  2352. .item-header {
  2353. position: sticky;
  2354. top: 0;
  2355. left: 0;
  2356. z-index: 1000;
  2357. width: 100%;
  2358. height: 28px;
  2359. padding-left: 20px;
  2360. font-size: 16px;
  2361. line-height: 28px;
  2362. color: #fff;
  2363. background: #fff url('@/assets/imgs/pressure/my-task-detail-operation-bg.png') no-repeat
  2364. left top;
  2365. background-size: 100% 28px;
  2366. }
  2367. .item-content1 {
  2368. display: flex;
  2369. margin-top: 10px;
  2370. &-item {
  2371. font-size: 14px;
  2372. }
  2373. &-img {
  2374. flex: 1;
  2375. display: grid;
  2376. grid-template-columns: repeat(3, 1fr);
  2377. grid-gap: 10px;
  2378. .item-content1-img-item{
  2379. width: 100px;
  2380. height: 100px;
  2381. position: relative;
  2382. border-radius: 8px;
  2383. overflow: hidden;
  2384. cursor: pointer;
  2385. .video-play-overlay {
  2386. position: absolute;
  2387. top: 0;
  2388. left: 0;
  2389. width: 100%;
  2390. height: 100%;
  2391. border-radius: 8px;
  2392. transition: all 0.3s ease;
  2393. display: flex;
  2394. justify-content: center;
  2395. align-items: center;
  2396. background-color: rgba(0, 0, 0, 0.2);
  2397. color: #ffffffcc;
  2398. pointer-events: none;
  2399. &:hover {
  2400. background-color: rgba(0, 0, 0, 0.45);
  2401. color: #ffffff;
  2402. }
  2403. }
  2404. }
  2405. .img-item {
  2406. width: 100px;
  2407. height: 100px;
  2408. }
  2409. }
  2410. }
  2411. .record-item {
  2412. margin-bottom: 10px;
  2413. background-color: #f5f5fa;
  2414. border-radius: 2px;
  2415. }
  2416. .item-content {
  2417. padding: 10px 0;
  2418. font-size: 14px;
  2419. .el-empty {
  2420. width: 100%;
  2421. height: 150px;
  2422. padding: 0;
  2423. box-sizing: border-box;
  2424. }
  2425. &-item {
  2426. height: 32px;
  2427. display: flex;
  2428. align-items: center;
  2429. gap: 8px;
  2430. }
  2431. }
  2432. .record-item-title {
  2433. height: 31px;
  2434. padding: 0 13px;
  2435. line-height: 31px;
  2436. background: linear-gradient(270deg, rgb(128 176 251 / 20%) 0%, rgb(73 120 246 / 20%) 100%);
  2437. border-radius: 2px;
  2438. }
  2439. .record-item-inner {
  2440. padding: 11px 13px 8px;
  2441. .content {
  2442. display: flex;
  2443. align-items: center;
  2444. .el-button {
  2445. margin-left: 8px;
  2446. }
  2447. :deep(.el-button--small.is-round) {
  2448. height: auto;
  2449. padding: 3px 11px;
  2450. }
  2451. .time {
  2452. color: rgb(31 31 31 / 88%);
  2453. text-align: right;
  2454. opacity: 0.5;
  2455. flex: 1;
  2456. }
  2457. }
  2458. .desc {
  2459. margin-top: 7px;
  2460. color: #41475c;
  2461. opacity: 0.8;
  2462. span {
  2463. opacity: 0.5;
  2464. }
  2465. }
  2466. }
  2467. .error-item {
  2468. display: flex;
  2469. padding: 7px 10px;
  2470. color: #41475c;
  2471. background-color: #f5f5fa;
  2472. border: 1px solid var(--el-border-color);
  2473. border-width: 1px 0;
  2474. align-items: center;
  2475. .el-icon {
  2476. margin-right: 6px;
  2477. }
  2478. &:nth-child(n + 1) {
  2479. margin-top: -1px;
  2480. }
  2481. &:nth-child(even) {
  2482. background-color: #fff;
  2483. }
  2484. }
  2485. .history-item {
  2486. padding: 7px 10px 10px;
  2487. margin-bottom: 13px;
  2488. color: #41475c;
  2489. background-color: #f5f5fa;
  2490. border-radius: 2px;
  2491. .history-title {
  2492. display: flex;
  2493. align-items: center;
  2494. margin-left: -10px;
  2495. font-weight: 600;
  2496. line-height: 20px;
  2497. &::before {
  2498. display: block;
  2499. width: 4px;
  2500. height: 15px;
  2501. margin-right: 7px;
  2502. background: #4978f6;
  2503. content: '';
  2504. }
  2505. }
  2506. p {
  2507. margin: 10px 0;
  2508. line-height: 20px;
  2509. }
  2510. .history-footer {
  2511. display: flex;
  2512. // align-items: center;
  2513. font-size: 12px;
  2514. .name {
  2515. color: #4978f6;
  2516. }
  2517. .time {
  2518. margin-left: 2px;
  2519. color: rgb(65 71 92 / 50%);
  2520. }
  2521. div {
  2522. flex: 1;
  2523. display: flex;
  2524. justify-content: flex-end;
  2525. .el-button span {
  2526. font-size: 12px;
  2527. }
  2528. }
  2529. }
  2530. }
  2531. }
  2532. .videoAndImg {
  2533. flex: 1;
  2534. width: 100%;
  2535. overflow-y: auto;
  2536. }
  2537. }
  2538. .operation-item {
  2539. position: relative;
  2540. max-height: calc(100% / 3 - 10px);
  2541. margin-bottom: 10px;
  2542. overflow-y: auto;
  2543. .item-header {
  2544. position: sticky;
  2545. top: 0;
  2546. left: 0;
  2547. z-index: 1000;
  2548. width: 100%;
  2549. height: 28px;
  2550. padding-left: 20px;
  2551. font-size: 16px;
  2552. line-height: 28px;
  2553. color: #fff;
  2554. background: #fff url('@/assets/imgs/pressure/my-task-detail-operation-bg.png') no-repeat
  2555. left top;
  2556. background-size: 100% 28px;
  2557. }
  2558. .item-content1 {
  2559. display: flex;
  2560. margin-top: 10px;
  2561. &-item {
  2562. font-size: 14px;
  2563. }
  2564. &-img {
  2565. flex: 1;
  2566. display: grid;
  2567. grid-template-columns: repeat(3, 1fr);
  2568. grid-gap: 10px;
  2569. .item-content1-img-item{
  2570. width: 100px;
  2571. height: 100px;
  2572. position: relative;
  2573. border-radius: 8px;
  2574. overflow: hidden;
  2575. cursor: pointer;
  2576. .video-play-overlay {
  2577. position: absolute;
  2578. top: 0;
  2579. left: 0;
  2580. width: 100%;
  2581. height: 100%;
  2582. border-radius: 8px;
  2583. transition: all 0.3s ease;
  2584. display: flex;
  2585. justify-content: center;
  2586. align-items: center;
  2587. background-color: rgba(0, 0, 0, 0.2);
  2588. color: #ffffffcc;
  2589. pointer-events: none;
  2590. &:hover {
  2591. background-color: rgba(0, 0, 0, 0.45);
  2592. color: #ffffff;
  2593. }
  2594. }
  2595. }
  2596. .img-item {
  2597. width: 100px;
  2598. height: 100px;
  2599. }
  2600. }
  2601. }
  2602. .record-item {
  2603. margin-bottom: 10px;
  2604. background-color: #f5f5fa;
  2605. border-radius: 2px;
  2606. }
  2607. .item-content {
  2608. padding: 10px 0;
  2609. font-size: 14px;
  2610. .el-empty {
  2611. width: 100%;
  2612. height: 150px;
  2613. padding: 0;
  2614. box-sizing: border-box;
  2615. }
  2616. &-item {
  2617. height: 32px;
  2618. display: flex;
  2619. align-items: center;
  2620. gap: 8px;
  2621. }
  2622. }
  2623. .record-item-title {
  2624. height: 31px;
  2625. padding: 0 13px;
  2626. line-height: 31px;
  2627. background: linear-gradient(270deg, rgb(128 176 251 / 20%) 0%, rgb(73 120 246 / 20%) 100%);
  2628. border-radius: 2px;
  2629. }
  2630. .record-item-inner {
  2631. padding: 11px 13px 8px;
  2632. .content {
  2633. display: flex;
  2634. align-items: center;
  2635. .el-button {
  2636. margin-left: 8px;
  2637. }
  2638. :deep(.el-button--small.is-round) {
  2639. height: auto;
  2640. padding: 3px 11px;
  2641. }
  2642. .time {
  2643. color: rgb(31 31 31 / 88%);
  2644. text-align: right;
  2645. opacity: 0.5;
  2646. flex: 1;
  2647. }
  2648. }
  2649. .desc {
  2650. margin-top: 7px;
  2651. color: #41475c;
  2652. opacity: 0.8;
  2653. span {
  2654. opacity: 0.5;
  2655. }
  2656. }
  2657. }
  2658. .error-item {
  2659. display: flex;
  2660. padding: 7px 10px;
  2661. color: #41475c;
  2662. background-color: #f5f5fa;
  2663. border: 1px solid var(--el-border-color);
  2664. border-width: 1px 0;
  2665. align-items: center;
  2666. .el-icon {
  2667. margin-right: 6px;
  2668. }
  2669. &:nth-child(n + 1) {
  2670. margin-top: -1px;
  2671. }
  2672. &:nth-child(even) {
  2673. background-color: #fff;
  2674. }
  2675. }
  2676. .history-item {
  2677. padding: 7px 10px 10px;
  2678. margin-bottom: 13px;
  2679. color: #41475c;
  2680. background-color: #f5f5fa;
  2681. border-radius: 2px;
  2682. .history-title {
  2683. display: flex;
  2684. align-items: center;
  2685. margin-left: -10px;
  2686. font-weight: 600;
  2687. line-height: 20px;
  2688. &::before {
  2689. display: block;
  2690. width: 4px;
  2691. height: 15px;
  2692. margin-right: 7px;
  2693. background: #4978f6;
  2694. content: '';
  2695. }
  2696. }
  2697. p {
  2698. margin: 10px 0;
  2699. line-height: 20px;
  2700. }
  2701. .history-footer {
  2702. display: flex;
  2703. // align-items: center;
  2704. font-size: 12px;
  2705. .name {
  2706. color: #4978f6;
  2707. }
  2708. .time {
  2709. margin-left: 2px;
  2710. color: rgb(65 71 92 / 50%);
  2711. }
  2712. div {
  2713. flex: 1;
  2714. display: flex;
  2715. justify-content: flex-end;
  2716. .el-button span {
  2717. font-size: 12px;
  2718. }
  2719. }
  2720. }
  2721. }
  2722. }
  2723. }
  2724. }
  2725. .default-toolbar {
  2726. display: flex;
  2727. justify-content: flex-end;
  2728. gap: 16px;
  2729. white-space: nowrap;
  2730. ::v-deep .el-button {
  2731. margin-left: 0;
  2732. }
  2733. }
  2734. // 退回对话框样式
  2735. .reject-dialog-content {
  2736. .form-item {
  2737. margin-bottom: 20px;
  2738. &:last-child {
  2739. margin-bottom: 0;
  2740. }
  2741. .form-label {
  2742. display: block;
  2743. margin-bottom: 8px;
  2744. font-size: 14px;
  2745. font-weight: 500;
  2746. color: #606266;
  2747. }
  2748. }
  2749. }
  2750. :deep(.preview-dialog) {
  2751. background-color: transparent !important;
  2752. width: auto !important;
  2753. padding: 0 !important;
  2754. .el-dialog__header {
  2755. display: none;
  2756. }
  2757. .el-dialog__body{
  2758. padding: 0;
  2759. .preview-container{
  2760. padding: 0;
  2761. position: relative;
  2762. }
  2763. .preview-image,.preview-video {
  2764. height: 65vh;
  2765. max-width: 100vw;
  2766. }
  2767. }
  2768. }
  2769. .rectification-dialog {
  2770. padding: 8px 0;
  2771. .upload-section {
  2772. margin-bottom: 24px;
  2773. padding: 20px;
  2774. background: #fafafa;
  2775. border-radius: 8px;
  2776. transition: all 0.3s ease;
  2777. &:hover {
  2778. background: #f5f5f5;
  2779. }
  2780. &.required {
  2781. border: 1px solid #e8f4ff;
  2782. background: #f7fbff;
  2783. &:hover {
  2784. background: #f0f8ff;
  2785. }
  2786. }
  2787. .section-header {
  2788. display: flex;
  2789. align-items: center;
  2790. justify-content: space-between;
  2791. margin-bottom: 16px;
  2792. .header-left {
  2793. display: flex;
  2794. align-items: center;
  2795. gap: 8px;
  2796. .section-title {
  2797. font-size: 15px;
  2798. font-weight: 600;
  2799. color: #303133;
  2800. }
  2801. .required-mark {
  2802. color: #f56c6c;
  2803. font-size: 16px;
  2804. font-weight: bold;
  2805. }
  2806. i[class^="icon-"] {
  2807. font-size: 18px;
  2808. color: #409eff;
  2809. }
  2810. }
  2811. .section-tip {
  2812. font-size: 12px;
  2813. color: #909399;
  2814. background: #fff;
  2815. padding: 4px 12px;
  2816. border-radius: 12px;
  2817. border: 1px solid #e4e7ed;
  2818. }
  2819. }
  2820. .upload-area {
  2821. min-height: 80px;
  2822. }
  2823. }
  2824. .info-tips {
  2825. display: flex;
  2826. gap: 12px;
  2827. padding: 16px;
  2828. background: linear-gradient(135deg, #fff9e6 0%, #fff5cc 100%);
  2829. border-left: 4px solid #e6a23c;
  2830. border-radius: 6px;
  2831. margin-top: 20px;
  2832. .icon-info {
  2833. font-size: 20px;
  2834. color: #e6a23c;
  2835. flex-shrink: 0;
  2836. margin-top: 2px;
  2837. }
  2838. .tips-content {
  2839. flex: 1;
  2840. .tips-title {
  2841. font-weight: 600;
  2842. color: #606266;
  2843. margin-bottom: 8px;
  2844. font-size: 14px;
  2845. }
  2846. p {
  2847. font-size: 13px;
  2848. color: #606266;
  2849. line-height: 1.8;
  2850. margin: 0;
  2851. &:not(.tips-title) {
  2852. padding-left: 12px;
  2853. position: relative;
  2854. &::before {
  2855. content: "•";
  2856. position: absolute;
  2857. left: 0;
  2858. color: #e6a23c;
  2859. }
  2860. }
  2861. }
  2862. }
  2863. }
  2864. }
  2865. .icon-document::before {
  2866. content: "📄";
  2867. }
  2868. .icon-image::before {
  2869. content: "🖼️";
  2870. }
  2871. .icon-video::before {
  2872. content: "🎬";
  2873. }
  2874. .icon-info::before {
  2875. content: "ℹ️";
  2876. }
  2877. .dialog-content {
  2878. font-size: 15px;
  2879. line-height: 30px;
  2880. display: flex;
  2881. justify-content: center;
  2882. align-items: center;
  2883. height: 100%;
  2884. }
  2885. </style>