wxFinalize.uvue 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306
  1. <template>
  2. <view class="detail-page">
  3. <scroll-view class="detail-content" :scroll-y="true">
  4. <!-- 工单信息 -->
  5. <view class="info-section">
  6. <view class="section-title">
  7. <text class="section-title-text">工单信息</text>
  8. </view>
  9. <view class="info-card">
  10. <view class="info-item">
  11. <text class="info-label">工单编码</text>
  12. <text class="info-value">{{ workOrderProjectNo ?? '-' }}</text>
  13. </view>
  14. <view class="info-item">
  15. <text class="info-label">工单类型</text>
  16. <text class="info-value">{{ orderType == '1' ? '维修工单' : '维保工单' }}</text>
  17. </view>
  18. <view class="info-item">
  19. <text class="info-label">风机编号</text>
  20. <text class="info-value">{{ pcsDeviceName ?? '-' }}</text>
  21. </view>
  22. <view class="info-item">
  23. <text class="info-label">维保中心</text>
  24. <text class="info-value">{{ gxtCenter ?? '-' }}</text>
  25. </view>
  26. <view class="info-item">
  27. <text class="info-label">场站</text>
  28. <text class="info-value">{{ pcsStationName ?? '-' }}</text>
  29. </view>
  30. <!-- <view class="info-item">
  31. <text class="info-label">品牌</text>
  32. <text class="info-value">{{ detailData.model ?? '' }}</text>
  33. </view> -->
  34. <view class="info-item">
  35. <text class="info-label">机型</text>
  36. <text class="info-value">{{ brand ?? '-' }} {{ model ?? '-' }}</text>
  37. </view>
  38. <view class="info-item">
  39. <text class="info-label">接单时间</text>
  40. <text class="info-value">{{ acceptTime ?? '-' }}</text>
  41. </view>
  42. <view class="info-item">
  43. <text class="info-label">故障代码</text>
  44. <text class="info-value">{{ faultCode ?? '-' }}</text>
  45. </view>
  46. <view class="info-item">
  47. <text class="info-label">故障条文</text>
  48. <text class="info-value">{{ faultBarcode ?? '-' }}</text>
  49. </view>
  50. <view class="info-item">
  51. <text class="info-label">故障描述</text>
  52. <text class="info-value">{{ faultDesc ?? '-' }}</text>
  53. </view>
  54. <view class="info-item" v-if="pauseTime != ''">
  55. <text class="info-label">发生时间</text>
  56. <text class="info-value">{{ pauseTime ?? '' }}</text>
  57. </view>
  58. <view class="info-item" v-if="restartTime != ''">
  59. <text class="info-label">复运时间</text>
  60. <text class="info-value">{{ restartTime ?? '' }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 结单表单 -->
  65. <view class="info-section">
  66. <view class="section-title">
  67. <text class="section-title-text">结单信息</text>
  68. </view>
  69. <view class="info-card">
  70. <!-- 信息录入 -->
  71. <view class="info-item">
  72. <view class="info-label">
  73. <text class="form-label required">信息录入<text style="color: red;">*</text></text>
  74. </view>
  75. <view class="info-value">
  76. <radio-group @change="handleInfoEntryChange" :disabled="infoEntryDisabled" class="uni-flex uni-row radio-group">
  77. <view v-for="(option, index) in infoEntryOptions" :key="index" class="radio-label">
  78. <radio :value="option.dictValue" :checked="infoEntry == option.dictValue">{{ option.dictLabel }}</radio>
  79. <!-- <text></text> -->
  80. </view>
  81. </radio-group>
  82. </view>
  83. </view>
  84. <!-- MIS工单编码选择(当信息录入为1时显示) -->
  85. <view class="info-item" v-if="infoEntry == '1'">
  86. <view class="info-label">
  87. <text class="form-label required">MIS工单编码<text style="color: red;">*</text></text>
  88. </view>
  89. <view class="info-value">
  90. <view class="input-with-select">
  91. <input
  92. class="input-field"
  93. placeholder="请输入或选择MIS工单编码"
  94. v-model="misNo"
  95. @focus="handleMisNoInputFocus"
  96. @blur="handleMisNoInputBlur"
  97. @input="handleMisNoInput"
  98. :readonly="infoEntry == '1'"
  99. :style="{ paddingRight: '120rpx' }" />
  100. <text class="select-mis-btn" @click="openMisListModal">选择</text>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 工作票编号(当信息录入为2时可编辑) -->
  105. <view class="info-item">
  106. <view class="info-label">
  107. <text class="form-label required">工作票编号<text style="color: red;">*</text></text>
  108. </view>
  109. <view class="info-value">
  110. <input
  111. class="input-field"
  112. placeholder="请输入工作票编号"
  113. v-model="workPermitNum"
  114. maxlength="20"
  115. :disabled="infoEntry == '1'"
  116. @change="handleWorkPermitNumChange"
  117. />
  118. </view>
  119. </view>
  120. <!-- 开始时间 -->
  121. <view class="info-item">
  122. <view class="info-label">
  123. <text class="form-label required">开始时间<text style="color: red;">*</text></text>
  124. </view>
  125. <view class="info-value">
  126. <view class="form-picker" @click="infoEntry == '1' ? showStartTimePicker = false : showStartTimePicker = true">
  127. <input
  128. class="input-field"
  129. placeholder="请选择开始时间"
  130. v-model="realStartTime"
  131. type="none"
  132. style="pointer-events: none;"
  133. />
  134. </view>
  135. </view>
  136. </view>
  137. <!-- 结束时间 -->
  138. <view class="info-item">
  139. <view class="info-label">
  140. <text class="form-label required">结束时间<text style="color: red;">*</text></text>
  141. </view>
  142. <view class="info-value">
  143. <view class="form-picker" @click="infoEntry == '1' ? showEndTimePicker = false : showEndTimePicker = true">
  144. <input
  145. class="input-field"
  146. placeholder="请选择结束时间"
  147. v-model="realEndTime"
  148. type="none"
  149. style="pointer-events: none;"
  150. />
  151. <!-- <text class="input-field">
  152. {{ realEndTime != '' ? realEndTime : '请选择结束时间' }}
  153. </text> -->
  154. </view>
  155. </view>
  156. </view>
  157. <!-- 挂起结束时间 -->
  158. <view class="info-item" v-if="resumeInfo != null && resumeShow">
  159. <view class="info-label">
  160. <text class="form-label required">挂起结束时间<text style="color: red;">*</text></text>
  161. </view>
  162. <view class="info-value">
  163. <view class="form-picker" @click="showResumeTimePicker = true">
  164. <input
  165. class="input-field"
  166. placeholder="请选择挂起结束时间"
  167. v-model="resumeTime"
  168. type="none"
  169. />
  170. </view>
  171. </view>
  172. </view>
  173. <!-- 工作部位 -->
  174. <view class="info-item">
  175. <view class="info-label">
  176. <text class="form-label">工作部位<text style="color: red;">*</text></text>
  177. </view>
  178. <view class="info-value">
  179. <view class="form-picker" @click="showWorkAreaPicker = true">
  180. <input
  181. class="input-field"
  182. placeholder="请选择工作部位"
  183. v-model="workAreaLabel"
  184. readonly
  185. />
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 外委人员数 -->
  190. <view class="info-item">
  191. <view class="info-label">
  192. <text class="form-label required">外委人员数(人)</text>
  193. </view>
  194. <view class="info-value">
  195. <input
  196. type="number"
  197. class="input-field"
  198. placeholder="请输入外委人员数"
  199. v-model="wwryNum"
  200. @input="onWwryNumInput"
  201. />
  202. </view>
  203. </view>
  204. <!-- 外来人员数 -->
  205. <view class="info-item">
  206. <view class="info-label">
  207. <text class="form-label required">外来人员数(人)</text>
  208. </view>
  209. <view class="info-value">
  210. <input
  211. type="number"
  212. class="input-field"
  213. placeholder="请输入外来人员数"
  214. v-model="wlryNum"
  215. @input="onWlryNumInput"
  216. />
  217. </view>
  218. </view>
  219. <!-- 工作负责人 -->
  220. <view class="info-item">
  221. <view class="info-label">
  222. <text class="form-label required">工作负责人<text style="color: red;">*</text></text>
  223. </view>
  224. <view class="info-value">
  225. <view class="input-with-clear">
  226. <input
  227. class="input-field"
  228. placeholder="请选择工作负责人"
  229. v-model="teamLeaderName"
  230. @click="showLeaderPicker = true"
  231. :disabled="infoEntry == '1' || overStopStatus == 2"
  232. />
  233. </view>
  234. </view>
  235. </view>
  236. <!-- 工作班成员选择(当信息录入为2时可编辑) -->
  237. <view class="info-item">
  238. <view class="info-label">
  239. <text class="form-label required">工作班成员<text style="color: red;">*</text></text>
  240. </view>
  241. <view class="info-value">
  242. <view class="input-with-clear">
  243. <input
  244. class="input-field"
  245. placeholder="请选择工作班成员"
  246. v-model="workGroupMemberName"
  247. @click="showUserSelect = true"
  248. :disabled="infoEntry == '1' || overStopStatus == 2"
  249. />
  250. <!-- <text class="select-users-count" v-if="selectedUserIds.length > 0" :style="{ marginRight: selectedUserIds.length > 0 ? '60rpx' : '0' }">({{ selectedUserIds.length }}人)</text> -->
  251. <text class="select-clear" v-if="selectedUserIds.length > 0" @click="clearSelectedUsers">×</text>
  252. </view>
  253. </view>
  254. </view>
  255. <!-- 维保内容 -->
  256. <view class="info-item full-width">
  257. <view class="info-label">
  258. <text class="form-label required">真实故障原因</text>
  259. </view>
  260. <view class="info-value">
  261. <textarea
  262. class="textarea-field"
  263. placeholder="请输入真实故障原因"
  264. v-model="realFailureReason"
  265. maxlength="500"
  266. :show-confirm-bar="false"
  267. auto-height
  268. ></textarea>
  269. </view>
  270. </view>
  271. <!-- 附件上传 -->
  272. <view class="info-item full-width">
  273. <view class="info-label">
  274. <text class="form-label">附件(可选)</text>
  275. </view>
  276. <view class="info-value">
  277. <upload-image
  278. :limit="8"
  279. :modelValue="uploadedFiles"
  280. :businessType="'workOrder'"
  281. @update:modelValue="uploadedFiles = $event as UTSArray<UploadResponse>"
  282. />
  283. </view>
  284. </view>
  285. </view>
  286. </view>
  287. <!-- 时间选择器弹窗 -->
  288. <!-- Start Date Picker -->
  289. <l-popup v-model="showStartTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
  290. <l-date-time-picker
  291. title="选择开始时间"
  292. :mode="1 | 2 | 4 | 8 | 16"
  293. format="YYYY-MM-DD HH:mm"
  294. :modelValue="realStartTime"
  295. confirm-btn="确定"
  296. cancel-btn="取消"
  297. @confirm="onStartDateConfirm"
  298. @cancel="showStartTimePicker = false">
  299. </l-date-time-picker>
  300. </l-popup>
  301. <!-- End Date Picker -->
  302. <l-popup v-model="showEndTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
  303. <l-date-time-picker
  304. title="选择结束时间"
  305. :mode="31"
  306. format="YYYY-MM-DD HH:mm"
  307. :modelValue="realEndTime"
  308. confirm-btn="确定"
  309. cancel-btn="取消"
  310. @confirm="onEndDateConfirm"
  311. @cancel="showEndTimePicker = false">
  312. </l-date-time-picker>
  313. </l-popup>
  314. <l-popup v-model="showResumeTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
  315. <l-date-time-picker
  316. title="选择挂起结束时间"
  317. :mode="31"
  318. format="YYYY-MM-DD HH:mm"
  319. :modelValue="resumeTime"
  320. confirm-btn="确定"
  321. cancel-btn="取消"
  322. @confirm="onResumeTimeConfirm"
  323. @cancel="showResumeTimePicker = false">
  324. </l-date-time-picker>
  325. </l-popup>
  326. <!-- 人员选择弹窗 -->
  327. <view v-if="showUserSelect && overStopStatus != 2" class="picker-modal">
  328. <view class="modal-mask" @click="showUserSelect = false"></view>
  329. <view class="modal-content">
  330. <view class="modal-header">
  331. <text class="modal-title">选择工作班成员</text>
  332. <text class="modal-close" @click="confirmSelectedUsers">确定</text>
  333. </view>
  334. <view class="search-bar">
  335. <view class="search-box">
  336. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  337. <input class="search-input" type="text" placeholder="搜索姓名" v-model="userKeyword" @input="handleUserSearch" />
  338. <text v-if="userKeyword.length > 0" class="clear-icon" @click="clearUserSearch">✕</text>
  339. </view>
  340. </view>
  341. <scroll-view class="modal-body" scroll-y="true">
  342. <view
  343. v-for="(user, index) in userList"
  344. :key="index"
  345. class="picker-option"
  346. @click="toggleUserSelection(user)"
  347. >
  348. <text class="option-text">{{ (user['nickName'] as string | null) ?? '' }}</text>
  349. <text class="option-text">{{ ((user['dept'] as UTSJSONObject | null)?.['deptName'] as string | null) ?? '' }}</text>
  350. <text class="option-check" v-if="isSelected(user)">✓</text>
  351. </view>
  352. </scroll-view>
  353. </view>
  354. </view>
  355. <!-- MIS工单列表弹窗 -->
  356. <view v-if="showMisListModal" class="picker-modal">
  357. <view class="modal-mask" @click="closeMisListModal"></view>
  358. <view class="modal-content">
  359. <view class="modal-header">
  360. <text class="modal-title">选择MIS工单</text>
  361. <text class="modal-close" @click="closeMisListModal">取消</text>
  362. </view>
  363. <!-- 搜索栏 -->
  364. <view class="search-bar">
  365. <view class="search-box">
  366. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  367. <input class="search-input" type="text" placeholder="搜索 MIS工单编码" v-model="misListKeyword" @input="searchMisList" />
  368. <text v-if="misListKeyword.length > 0" class="clear-icon" @click="clearMisListSearch">✕</text>
  369. </view>
  370. </view>
  371. <!-- 列表内容 -->
  372. <scroll-view class="modal-body" scroll-y="true">
  373. <!-- 有数据时显示列表 -->
  374. <view v-if="misList.length > 0">
  375. <view
  376. v-for="(item, index) in misList"
  377. :key="index"
  378. class="picker-option"
  379. @click="selectMisItem(item, index)"
  380. >
  381. <!-- <text class="option-text">{{ option.label }}</text> -->
  382. <view>
  383. <text class="option-text">MIS工单编码</text>
  384. <text class="option-text">工作票编号</text>
  385. </view>
  386. <view>
  387. <text class="option-text">{{ ((item['misNo'] as string | null) ?? '-')}}</text>
  388. <text class="option-text">{{ item['workPermitNum'] as string | null ?? '-' }}</text>
  389. </view>
  390. <text v-if="index === selectedMisInfoIndex" class="option-check">✓</text>
  391. </view>
  392. </view>
  393. <!-- 无数据时显示提示 -->
  394. <view v-else class="empty-tip">
  395. <text>未找到匹配的MIS工单</text>
  396. </view>
  397. </scroll-view>
  398. </view>
  399. </view>
  400. <!-- 工作部位选择弹窗 -->
  401. <view v-if="showWorkAreaPicker" class="picker-modal">
  402. <view class="modal-mask" @click="showWorkAreaPicker = false"></view>
  403. <view class="modal-content">
  404. <view class="modal-header">
  405. <text class="modal-title">选择工作部位</text>
  406. <text class="modal-close" @click="confirmSelectedWorkAreas">确定</text>
  407. </view>
  408. <scroll-view class="modal-body" scroll-y="true">
  409. <view
  410. v-for="(item, index) in workAreaDictList"
  411. :key="index"
  412. class="picker-option"
  413. @click="toggleWorkAreaSelection(item)"
  414. >
  415. <text class="option-text">{{ item.dictLabel ?? '' }}</text>
  416. <text class="option-check" v-if="isWorkAreaSelected(item)">✓</text>
  417. </view>
  418. </scroll-view>
  419. </view>
  420. </view>
  421. <!-- 工作负责人弹窗 -->
  422. <view v-if="showLeaderPicker && overStopStatus != 2" class="picker-modal">
  423. <view class="modal-mask" @click="showLeaderPicker = false"></view>
  424. <view class="modal-content">
  425. <view class="modal-header">
  426. <text class="modal-title">选择工作负责人</text>
  427. <text class="modal-close" @click="showLeaderPicker = false">取消</text>
  428. </view>
  429. <view class="search-bar">
  430. <view class="search-box">
  431. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  432. <input class="search-input" type="text" placeholder="搜索姓名" v-model="teamKeyword" @input="handleSearch" />
  433. <text v-if="teamKeyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
  434. </view>
  435. </view>
  436. <scroll-view class="modal-body" scroll-y="true">
  437. <!-- 有数据时显示列表 -->
  438. <view v-if="teamLeaderList.length > 0">
  439. <view
  440. v-for="(user, index) in teamLeaderList"
  441. :key="index"
  442. class="picker-option"
  443. :class="{ 'selected': index === selectedTeamLeaderIndex }"
  444. @click="selectLeaderManually(user, index)"
  445. >
  446. <text class="option-text">{{ (user['nickName'] as string | null) ?? '' }}</text>
  447. <text class="option-text">{{ ((user['dept'] as UTSJSONObject | null)?.['deptName'] as string | null) ?? '' }}</text>
  448. <text v-if="index === selectedTeamLeaderIndex" class="option-check">✓</text>
  449. </view>
  450. </view>
  451. <!-- 无数据时显示提示 -->
  452. <view v-else class="empty-tip">
  453. <text>未找到匹配的人员</text>
  454. </view>
  455. </scroll-view>
  456. </view>
  457. </view>
  458. </scroll-view>
  459. <!-- 确认结单按钮 -->
  460. <view class="accept-button-container">
  461. <button class="accept-button" @click="handleSubmit" :loading="submitLoading">{{ submitLoading ? '提交中...' : '确认结单' }}</button>
  462. </view>
  463. <!-- 加载中状态 -->
  464. <view v-if="loading" class="loading-mask">
  465. <text class="loading-text">加载中...</text>
  466. </view>
  467. </view>
  468. </template>
  469. <script setup lang="uts">
  470. import { ref, watch } from 'vue'
  471. import type { acceptOrderInfo } from '../../../types/order'
  472. import type { WorkOrderFlow } from '../../../types/flow'
  473. import { getOrderInfoById, getRepairOrderInfoById, returnRepairOrder, repairFinishOrder } from '../../../api/order/detail'
  474. import { getMisInfoList, listWorkPerson, getOrderList, listAutoMisInfo, allListOrder } from '../../../api/order/list'
  475. import type { SysDictData } from '../../../types/dict'
  476. import { getDictDataByType } from '../../../api/dict/index'
  477. import type { UserInfo } from '../../../types/user'
  478. import type { UploadResponse } from '../../../types/workbench'
  479. import {checkPermi} from '../../../utils/storage'
  480. import { getUserList, getLeaderList } from '../../../api/user/list'
  481. import uploadImage from '../../../components/upload-image/upload-image.uvue'
  482. // 工单信息
  483. const orderId = ref<string>('')
  484. const workOrderProjectNo = ref<string>('')
  485. const workOrderStatus = ref<string>('')
  486. const orderType = ref<string>('')
  487. const pcsDeviceName = ref<string>('')
  488. const gxtCenter = ref<string>('')
  489. const pcsStationName = ref<string>('')
  490. const brand = ref<string>('')
  491. const model = ref<string>('')
  492. const acceptTime = ref<string>('')
  493. const returnType = ref<string>('')
  494. const returnReason = ref<string>("")
  495. const returnTypeLabel = ref<string>("")
  496. const acceptReturnType = ref<string>('')
  497. const acceptReturnReason = ref<string>("")
  498. const teamLeaderId = ref<Number | null>(null)
  499. const teamLeaderName = ref<string>('')
  500. const pauseTime = ref<string>('')
  501. const restartTime = ref<string>('')
  502. const faultCode = ref<string>('')
  503. const faultBarcode = ref<string>('')
  504. const faultDesc = ref<string>('')
  505. const suspendReason = ref<string>('') // 挂起原因
  506. const flowList = ref<UTSJSONObject[]>([]) //流转过程
  507. const suspendInfo = ref<UTSJSONObject | null>(null)
  508. const resumeInfo = ref<UTSJSONObject | null>(null)
  509. const resumeShow = ref<boolean>(false)
  510. const resumeTime = ref<string>('') // 挂起结束时间
  511. const showResumeTimePicker = ref<boolean>(false)
  512. const oldWorkGroupMemberName = ref<string>('') // 旧工作班成员
  513. const oldRepairOrderPersonList = ref<UTSJSONObject[]>([]) // 旧工作班成员数组
  514. const overStopStatus = ref<Number | null>(null)
  515. const oldTeamLeaderName = ref<string>('')
  516. // 添加字典加载状态
  517. const dictLoaded = ref<boolean>(false)
  518. // 结单表单相关变量
  519. const infoEntry = ref<string>('') // 信息录入
  520. const misNo = ref<string>('') // MIS工单编码
  521. const workPermitNum = ref<string>('') // 工作票编号
  522. const realStartTime = ref<string>('') // 开始时间
  523. const realEndTime = ref<string>('') // 结束时间
  524. const wwryNum = ref<string>('') // 外委人员数
  525. const wlryNum = ref<string>('') // 外来人员数
  526. const workGroupMemberName = ref<string>('') // 工作班成员
  527. const attachmentUrls = ref<string>('') // 附件URLs(逗号分隔的字符串格式)
  528. const uploadedFiles = ref<UploadResponse[]>([]) // 上传的文件对象数组
  529. const repairOrderPersonList = ref<UTSJSONObject[]>([]) // 工作班成员数组
  530. const selectedUserIds = ref<string[]>([]) // 选中的用户ID数组
  531. const selectedUsers = ref<UTSJSONObject[]>([]) // 选中的用户对象数组
  532. const realFailureReason = ref<string>('') //真实故障原因
  533. const workArea = ref<string>('') //工作部位
  534. const workAreaLabel = ref<string>('')
  535. const workAreaDictList = ref<SysDictData[]>([]) // 工作部位字典列表
  536. const selectedWorkAreas = ref<SysDictData[]>([]) // 选中的工作部位
  537. const showWorkAreaPicker = ref<boolean>(false) // 显示工作部位选择器
  538. // 选中的负责人信息
  539. const selectedTeamLeaderName = ref<string>('')
  540. const selectedTeamLeaderIndex = ref<number>(-1)
  541. const showLeaderPicker = ref<boolean>(false)
  542. const teamLeaderList = ref<UTSJSONObject[]>([])
  543. const teamAllLeaderList = ref<UTSJSONObject[]>([])
  544. let teamKeyword = ref<string>("")
  545. // 时间选择器相关变量
  546. const showStartTimePicker = ref<boolean>(false)
  547. const showEndTimePicker = ref<boolean>(false)
  548. const startTimeDate = ref<string>('')
  549. const startTimeTime = ref<string>('')
  550. const endTimeDate = ref<string>('')
  551. const endTimeTime = ref<string>('')
  552. // 监听开始时间和结束时间变化
  553. watch(realStartTime, (value: string) => {
  554. // 在这里添加开始时间变化时的处理逻辑
  555. if (resumeInfo.value != null && value != '') {
  556. const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
  557. if (suspendTime != '' && value != '') {
  558. const suspendDate = new Date(suspendTime)
  559. const startDate = new Date(value)
  560. if (suspendDate.getTime() < startDate.getTime()) { // 开工前挂起
  561. const resumeDate = new Date(resumeTime.value)
  562. const endDate = new Date(realEndTime.value)
  563. if (resumeDate.getTime() > startDate.getTime() || (realEndTime.value != '' && resumeDate.getTime() > endDate.getTime())) {
  564. resumeShow.value = true
  565. } else {
  566. resumeShow.value = false
  567. }
  568. } else if (suspendDate.getTime() >= startDate.getTime()) { // 作业中挂起
  569. const resumeDate = new Date(resumeTime.value)
  570. const endDate = new Date(realEndTime.value)
  571. if (resumeDate.getTime() < startDate.getTime() || (realEndTime.value != '' && resumeDate.getTime() > endDate.getTime())) {
  572. resumeShow.value = true
  573. } else {
  574. resumeShow.value = false
  575. }
  576. } else {
  577. resumeShow.value = false
  578. }
  579. } else {
  580. resumeShow.value = false
  581. }
  582. }
  583. })
  584. watch(realEndTime, (value: string) => {
  585. // 在这里添加结束时间变化时的处理逻辑
  586. if (resumeInfo.value != null && value != '') {
  587. const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
  588. if (suspendTime != '' && realStartTime.value != '' && new Date(suspendTime).getTime() < new Date(realStartTime.value).getTime()) { // 开工前挂起
  589. if (value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(realStartTime.value).getTime()) {
  590. resumeShow.value = true
  591. } else if(value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(value).getTime()) {
  592. resumeShow.value = true
  593. } else {
  594. resumeShow.value = false
  595. }
  596. } else if(suspendTime != '' && realStartTime.value != '' && new Date(suspendTime).getTime() >= new Date(realStartTime.value).getTime()) { // 作业中挂起
  597. if (realStartTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() < new Date(realStartTime.value).getTime()) {
  598. resumeShow.value = true
  599. } else if(value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(value).getTime()) {
  600. resumeShow.value = true
  601. } else {
  602. resumeShow.value = false
  603. }
  604. } else {
  605. resumeShow.value = false
  606. }
  607. }
  608. })
  609. // MIS工单选择相关变量
  610. const showMisNoQuickSelect = ref<boolean>(false)
  611. const quickMisNoList = ref<UTSJSONObject[]>([])
  612. // 添加MIS工单列表弹窗显示状态
  613. const showMisListModal = ref<boolean>(false)
  614. // MIS工单列表数据
  615. const misList = ref<UTSJSONObject[]>([])
  616. const allMisList = ref<UTSJSONObject[]>([])
  617. // 分页信息
  618. const misListPage = ref<number>(1)
  619. const misListPageSize = ref<number>(999)
  620. const misListTotal = ref<number>(0)
  621. // 搜索关键词
  622. const misListKeyword = ref<string>('')
  623. const userKeyword = ref<string>('')
  624. // 人员选择相关变量
  625. const showUserSelect = ref<boolean>(false)
  626. const userList = ref<UTSJSONObject[]>([])
  627. const userAllList = ref<UTSJSONObject[]>([])
  628. // 信息录入选项
  629. const infoEntryOptions = ref<SysDictData[]>([])
  630. const selectedMisInfoIndex = ref<number>(-1)
  631. // 获取信息录入字典列表
  632. const loadInfoEntryDictList = async (): Promise<void> => {
  633. try {
  634. const result = await getDictDataByType('gxt_info_entry') // 假设信息录入类型字典类型为gxt_info_entry
  635. const resultObj = result as UTSJSONObject
  636. if (resultObj['code'] == 200) {
  637. const data = resultObj['data'] as any[]
  638. const dictData: SysDictData[] = []
  639. if (data.length > 0) {
  640. for (let i = 0; i < data.length; i++) {
  641. const item = data[i] as UTSJSONObject
  642. // 只提取需要的字段
  643. const dictItem: SysDictData = {
  644. dictValue: item['dictValue'] as string | null,
  645. dictLabel: item['dictLabel'] as string | null,
  646. dictCode: null,
  647. dictSort: null,
  648. dictType: null,
  649. cssClass: null,
  650. listClass: null,
  651. isDefault: null,
  652. status: null,
  653. default: null,
  654. createTime: null,
  655. remark: null
  656. }
  657. dictData.push(dictItem)
  658. }
  659. }
  660. infoEntryOptions.value = dictData
  661. }
  662. } catch (e: any) {
  663. console.error('获取信息录入类型字典失败:', e.message)
  664. // 设置默认值
  665. infoEntryOptions.value = [
  666. { dictValue: '1', dictLabel: 'MIS工单', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null },
  667. { dictValue: '2', dictLabel: '手工录入', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null }
  668. ];
  669. }
  670. }
  671. // 获取工作部位字典列表
  672. const loadWorkAreaDictList = async (): Promise<void> => {
  673. try {
  674. const result = await getDictDataByType('gxt_work_area')
  675. const resultObj = result as UTSJSONObject
  676. if (resultObj['code'] == 200) {
  677. const data = resultObj['data'] as any[]
  678. const dictData: SysDictData[] = []
  679. if (data.length > 0) {
  680. for (let i = 0; i < data.length; i++) {
  681. const item = data[i] as UTSJSONObject
  682. // 只提取需要的字段
  683. const dictItem: SysDictData = {
  684. dictValue: item['dictValue'] as string | null,
  685. dictLabel: item['dictLabel'] as string | null,
  686. dictCode: null,
  687. dictSort: null,
  688. dictType: null,
  689. cssClass: null,
  690. listClass: null,
  691. isDefault: null,
  692. status: null,
  693. default: null,
  694. createTime: null,
  695. remark: null
  696. }
  697. dictData.push(dictItem)
  698. }
  699. }
  700. workAreaDictList.value = dictData
  701. }
  702. } catch (e: any) {
  703. console.error('获取工作部位字典失败:', e.message)
  704. }
  705. }
  706. // 获取用户列表
  707. const getUserAllList = async (): Promise<void> => {
  708. try {
  709. // 这里应该调用获取用户列表的API
  710. const result = await getLeaderList(-1); // 空参数调用
  711. const resultObj = result as UTSJSONObject;
  712. const code = resultObj['code'] as number
  713. const users = resultObj['data'] as UTSJSONObject[] | null
  714. if (code == 200 && users != null ) {
  715. // 解析列表数据
  716. // const rows = resultObj['rows'] as UTSJSONObject[]
  717. userList.value = users
  718. userAllList.value = users
  719. teamLeaderList.value = users
  720. teamAllLeaderList.value = users
  721. // userList.value = result.data || [];
  722. }
  723. } catch (error) {
  724. console.error('获取用户列表失败:', error);
  725. uni.showToast({
  726. title: '获取用户列表失败',
  727. icon: 'none'
  728. });
  729. }
  730. };
  731. // 外委人员数输入处理
  732. const onWwryNumInput = (): void => {
  733. let value = wwryNum.value;
  734. // 移除非数字字符,包括负号和小数点
  735. value = value.replace(/[^0-9]/g, '');
  736. wwryNum.value = value;
  737. };
  738. // 外来人员数输入处理
  739. const onWlryNumInput = (): void => {
  740. let value = wlryNum.value;
  741. // 移除非数字字符,包括负号和小数点
  742. value = value.replace(/[^0-9]/g, '');
  743. wlryNum.value = value;
  744. };
  745. // 验证和提交
  746. const submitLoading = ref<boolean>(false)
  747. // 信息录入禁用状态
  748. const infoEntryDisabled = ref<boolean>(false)
  749. // 接受用户名
  750. const acceptUserName = ref<string>('')
  751. // 选择器选项类型
  752. type PickerOption = {
  753. label: string
  754. value: string
  755. }
  756. // 手动选择负责人
  757. const selectLeaderManually = (user: UTSJSONObject, index: number): void => {
  758. selectedTeamLeaderIndex.value = index
  759. const uid = user['userId']
  760. if (uid != null) {
  761. teamLeaderId.value = uid as Number
  762. }
  763. const name = user['nickName']
  764. teamLeaderName.value = name != null ? name.toString() : ''
  765. showLeaderPicker.value = false
  766. }
  767. // 信息录入变化处理
  768. const handleInfoEntryChange = (e: UniRadioGroupChangeEvent): void => {
  769. // 兼容 radio-group 事件:detail 可能不存在,直接取 e.value
  770. const val = e.detail?.value as string | null
  771. infoEntry.value = val ?? ''
  772. if (infoEntry.value == '1' && overStopStatus.value !=2) {
  773. // 当选择MIS工单时,清空手工录入的字段
  774. workPermitNum.value = '';
  775. realStartTime.value = '';
  776. realEndTime.value = '';
  777. workGroupMemberName.value = '';
  778. }
  779. };
  780. // 工作票编号变化处理
  781. const handleWorkPermitNumChange = async(): Promise<void> => {
  782. if (infoEntry.value == '2') {
  783. // 查询工作票编号是否已存在
  784. const queryParams = {
  785. workPermitNum: workPermitNum.value,
  786. } as UTSJSONObject;
  787. const response = await allListOrder(queryParams)
  788. const responseObj = response as UTSJSONObject
  789. const rows = responseObj['rows'] as UTSJSONObject[] | null
  790. if (rows != null && rows.length > 0) {
  791. uni.showToast({ title: '工作票编号:' + workPermitNum.value + '已存在', icon: 'none' })
  792. workPermitNum.value = ''
  793. return
  794. }
  795. }
  796. };
  797. // MIS工单编码输入处理
  798. const handleMisNoInputFocus = (): void => {
  799. showMisNoQuickSelect.value = true;
  800. };
  801. const handleMisNoInputBlur = (): void => {
  802. setTimeout(() => {
  803. showMisNoQuickSelect.value = false;
  804. }, 200);
  805. };
  806. const handleMisNoInput = (e: SysDictData): void => {
  807. misNo.value = (e['detail'] as string | null) ?? '';
  808. // 这里可以添加实时搜索MIS工单的逻辑
  809. };
  810. const handleMisNoClear = (): void => {
  811. misNo.value = '';
  812. showMisNoQuickSelect.value = false;
  813. };
  814. const handleMisNoQuickSelect = (item: UTSJSONObject): void => {
  815. misNo.value = (item['misNo'] as string | null) ?? '';
  816. showMisNoQuickSelect.value = false;
  817. };
  818. // 获取MIS工单列表
  819. const getMisList = async (): Promise<void> => {
  820. try {
  821. const queryParams = {
  822. pcsDeviceName: pcsDeviceName.value,
  823. pcsStationName: pcsStationName.value,
  824. workOrderStatus: '结束'
  825. } as UTSJSONObject;
  826. // 调用获取MIS工单列表的API
  827. const result = await getMisInfoList(queryParams);
  828. const resultObj = result as UTSJSONObject;
  829. if (resultObj['code'] == 200) {
  830. // 解析列表数据
  831. const rows = resultObj['rows'] as UTSJSONObject[]
  832. misList.value = rows;
  833. allMisList.value = rows
  834. // 解析总数
  835. misListTotal.value = resultObj['total'] as number;
  836. } else {
  837. const msg = resultObj['msg'] as string | null
  838. uni.showToast({
  839. title: msg ?? '获取MIS工单列表失败',
  840. icon: 'none'
  841. })
  842. }
  843. } catch (error: any) {
  844. console.error('获取MIS工单列表失败:', error);
  845. uni.showToast({
  846. title: error.message ?? '获取MIS工单列表失败',
  847. icon: 'none'
  848. });
  849. }
  850. };
  851. // 打开MIS工单选择弹窗
  852. const openMisListModal = (): void => {
  853. showMisListModal.value = true;
  854. misListPage.value = 1; // 重置为第一页
  855. getMisList(); // 获取列表数据
  856. };
  857. // 选择MIS工单
  858. const selectMisItem = async (item: UTSJSONObject, index: number): Promise<void> => {
  859. selectedMisInfoIndex.value = index
  860. // 回填MIS工单相关信息
  861. misNo.value = item['misNo'] as string | '';
  862. // 查询MIS工单是否已存在
  863. const response = await getOrderList(1, 10, misNo.value, '')
  864. const responseObj = response as UTSJSONObject
  865. const rows = responseObj['rows'] as UTSJSONObject[] | null
  866. if (rows != null && rows.length > 0) {
  867. uni.showToast({ title: '该MIS工单已被其他工单关联!请重新选择!', icon: 'none' })
  868. misNo.value = ''
  869. return
  870. }
  871. // 查询相关工作班成员
  872. await listWorkPerson(misNo.value).then(response => {
  873. const responseObj = response as UTSJSONObject
  874. const rows = responseObj['rows'] as UTSJSONObject[] | null
  875. repairOrderPersonList.value = rows ?? []
  876. if (rows != null && overStopStatus.value ==2) {
  877. let hasDifference = false
  878. const newPersonList = rows
  879. if (oldRepairOrderPersonList.value.length === 0) {
  880. // 旧列表为空,新列表不为空,存在差异
  881. hasDifference = true
  882. } else if (newPersonList.length !== oldRepairOrderPersonList.value.length) {
  883. // 列表长度不一致,存在差异
  884. hasDifference = true
  885. } else {
  886. // 比较每个人员的 nickName
  887. for (let newPerson of newPersonList) {
  888. const found = oldRepairOrderPersonList.value.some(oldPerson =>
  889. newPerson.nickName === oldPerson.nickName
  890. )
  891. if (!found) {
  892. hasDifference = true
  893. break
  894. }
  895. }
  896. }
  897. // 如果存在差异,提醒用户但不改变当前 repairOrderPersonList
  898. if (hasDifference) {
  899. uni.showModal({
  900. title: '提示',
  901. content: 'MIS 工单人员列表与当前工单人员列表不一致!',
  902. showCancel: false, // 只显示确定按钮
  903. confirmText: '确定',
  904. confirmColor: '#007aff', // 自定义按钮颜色,匹配你的UI风格
  905. success: (res) => {
  906. }
  907. });
  908. }
  909. }
  910. if (rows != null && rows.length > 0 && overStopStatus.value != 2) {
  911. // 查找 isLeader 等于 1 的负责人(优先获取第一个符合条件的,贴合常规单负责人场景)
  912. const leaderPerson = rows.find(person => person.isLeader == 1);
  913. if(leaderPerson != null) {
  914. teamLeaderId.value = (leaderPerson['userId'] as Number | null) ?? null
  915. teamLeaderName.value = (leaderPerson['nickName'] as string | null) ?? ''
  916. }
  917. const nickNames = rows
  918. .filter(person => person.isLeader != 1)
  919. .map(person => (person.nickName as string | null) ?? '')
  920. .join(',');
  921. workGroupMemberName.value = nickNames;
  922. }
  923. })
  924. workPermitNum.value = item['workPermitNum'] as string | '';
  925. realStartTime.value = item['realStartTime'] as string | '';
  926. realEndTime.value = item['realEndTime'] as string | '';
  927. // 关闭弹窗
  928. showMisListModal.value = false;
  929. };
  930. // 搜索
  931. const handleUserSearch = (): void => {
  932. const keyword = userKeyword.value
  933. userList.value = userAllList.value.filter(leader => {
  934. const nickName = leader['nickName'] as string | null
  935. return nickName != null && nickName.indexOf(keyword) >= 0
  936. })
  937. }
  938. // 关闭MIS工单选择弹窗
  939. const closeMisListModal = (): void => {
  940. showMisListModal.value = false;
  941. };
  942. // 搜索
  943. const searchMisList = (): void => {
  944. const keyword = misListKeyword.value
  945. misList.value = allMisList.value.filter(misInfo => {
  946. const misNo = misInfo['misNo'] as string | null
  947. // return misNo != null && misNo.indexOf(keyword) >= 0
  948. const workPermitNum = misInfo['workPermitNum'] as string | null
  949. // 逻辑或(||)连接两个条件,满足其一即可
  950. const misNoMatch = misNo != null && misNo.indexOf(keyword) >= 0
  951. const workPermitNumMatch = workPermitNum != null && workPermitNum.indexOf(keyword) >= 0
  952. return misNoMatch || workPermitNumMatch
  953. })
  954. }
  955. // 清除MIS工单搜索
  956. const clearMisListSearch = (): void => {
  957. misListKeyword.value = "";
  958. misList.value = allMisList.value
  959. };
  960. // 清除用户搜索
  961. const clearUserSearch = (): void => {
  962. userKeyword.value = "";
  963. userList.value = userAllList.value
  964. };
  965. // 搜索工作负责人
  966. const handleSearch = (): void => {
  967. const keyword = teamKeyword.value
  968. teamLeaderList.value = teamAllLeaderList.value.filter(leader => {
  969. const nickName = leader['nickName'] as string | null
  970. return nickName != null && nickName.indexOf(keyword) >= 0
  971. })
  972. }
  973. // 清空搜索工作负责人
  974. const clearSearch = (): void => {
  975. teamKeyword.value = ""
  976. teamLeaderList.value = teamAllLeaderList.value
  977. }
  978. function onStartDateConfirm(value: string) {
  979. // 检查结束时间是否小于新的开始时间
  980. if (realEndTime.value != '' && new Date(value) > new Date(realEndTime.value as string)) {
  981. uni.showToast({ title: '开始时间不能大于结束时间', icon: 'none' })
  982. return
  983. }
  984. realStartTime.value = value
  985. showStartTimePicker.value = false
  986. }
  987. function onEndDateConfirm(value: string) {
  988. // 检查新的结束时间是否小于开始时间
  989. if (realStartTime.value != '' && new Date(realStartTime.value as string) > new Date(value)) {
  990. uni.showToast({ title: '结束时间不能小于开始时间', icon: 'none' })
  991. return
  992. }
  993. realEndTime.value = value
  994. showEndTimePicker.value = false
  995. }
  996. function onResumeTimeConfirm(value: string) {
  997. // 检查新的结束时间是否小于开始时间
  998. if (resumeTime.value != '' && new Date(realStartTime.value as string) > new Date(value)) {
  999. uni.showToast({ title: '结束时间不能小于开始时间', icon: 'none' })
  1000. return
  1001. }
  1002. resumeTime.value = value
  1003. showResumeTimePicker.value = false
  1004. }
  1005. // 检查用户是否已被选中
  1006. const isSelected = (user: UTSJSONObject): boolean => {
  1007. const userId = user['userId'] as string | number | null;
  1008. if (userId !== null) {
  1009. return selectedUserIds.value.includes(userId.toString());
  1010. }
  1011. // 如果没有userId,则比较nickName
  1012. const nickName = user['nickName'] as string | null;
  1013. if (nickName !== null) {
  1014. return selectedUsers.value.some(selected =>
  1015. (selected['nickName'] as string | null) === nickName
  1016. );
  1017. }
  1018. return false;
  1019. };
  1020. // 切换用户选择状态
  1021. const toggleUserSelection = (user: UTSJSONObject): void => {
  1022. const userId = user['userId'] as string | number | null;
  1023. const nickName = user['nickName'] as string | null;
  1024. if (userId !== null) {
  1025. const userIdStr = userId.toString();
  1026. const index = selectedUserIds.value.indexOf(userIdStr);
  1027. if (index > -1) {
  1028. // 取消选择
  1029. selectedUserIds.value.splice(index, 1);
  1030. selectedUsers.value = selectedUsers.value.filter(selected =>
  1031. (selected['userId'] as string | number | null)?.toString() !== userIdStr
  1032. );
  1033. } else {
  1034. // 添加选择
  1035. selectedUserIds.value.push(userIdStr);
  1036. selectedUsers.value.push(user);
  1037. }
  1038. } else if (nickName !== null) {
  1039. // 如果没有userId,通过nickName来识别
  1040. const index = selectedUsers.value.findIndex(selected =>
  1041. (selected['nickName'] as string | null) === nickName
  1042. );
  1043. if (index > -1) {
  1044. // 取消选择
  1045. selectedUsers.value.splice(index, 1);
  1046. // 同时移除对应的userId(如果有的话)
  1047. const userToRemoveId = user['userId'] as string | number | null;
  1048. if (userToRemoveId !== null) {
  1049. const idIndex = selectedUserIds.value.indexOf(userToRemoveId.toString());
  1050. if (idIndex > -1) {
  1051. selectedUserIds.value.splice(idIndex, 1);
  1052. }
  1053. }
  1054. } else {
  1055. // 添加选择
  1056. selectedUsers.value.push(user);
  1057. const userToAddId = user['userId'] as string | number | null;
  1058. if (userToAddId !== null) {
  1059. selectedUserIds.value.push(userToAddId.toString());
  1060. }
  1061. }
  1062. }
  1063. };
  1064. // 确认选择的用户
  1065. const confirmSelectedUsers = (): void => {
  1066. // 将选中的用户姓名拼接成字符串
  1067. const nickNames = selectedUsers.value
  1068. .map(user => (user['nickName'] as string | null) ?? '')
  1069. .filter(name => name !== '')
  1070. .join(',');
  1071. workGroupMemberName.value = nickNames;
  1072. // 更新repairOrderPersonList为选中的用户
  1073. repairOrderPersonList.value = [...selectedUsers.value];
  1074. showUserSelect.value = false;
  1075. };
  1076. // 清空已选择的用户
  1077. const clearSelectedUsers = (): void => {
  1078. // 清空选中的用户数组
  1079. selectedUsers.value = [];
  1080. selectedUserIds.value = [];
  1081. // 清空显示的用户名
  1082. workGroupMemberName.value = '';
  1083. // 清空工作班成员列表
  1084. repairOrderPersonList.value = [];
  1085. };
  1086. // 检查工作部位是否已被选中
  1087. const isWorkAreaSelected = (workArea: SysDictData): boolean => {
  1088. return selectedWorkAreas.value.some(selected =>
  1089. (selected.dictValue as string | null) === (workArea.dictValue as string | null)
  1090. );
  1091. };
  1092. // 切换工作部位选择状态
  1093. const toggleWorkAreaSelection = (workArea: SysDictData): void => {
  1094. const index = selectedWorkAreas.value.findIndex(selected =>
  1095. (selected.dictValue as string | null) === (workArea.dictValue as string | null)
  1096. );
  1097. if (index > -1) {
  1098. // 取消选择
  1099. selectedWorkAreas.value.splice(index, 1);
  1100. } else {
  1101. // 添加选择
  1102. selectedWorkAreas.value.push(workArea);
  1103. }
  1104. };
  1105. // 确认选择的工作部位
  1106. const confirmSelectedWorkAreas = (): void => {
  1107. // 将选中的工作部位标签拼接成字符串,用逗号分隔
  1108. const labels = selectedWorkAreas.value
  1109. .map(item => item.dictLabel ?? '')
  1110. .filter(label => label !== '');
  1111. workAreaLabel.value = labels.join(', ');
  1112. // 将选中的工作部位值拼接成字符串,用逗号分隔
  1113. workArea.value = selectedWorkAreas.value
  1114. .map(item => item.dictValue ?? '')
  1115. .filter(value => value !== '')
  1116. .join(',');
  1117. showWorkAreaPicker.value = false;
  1118. };
  1119. // 表单验证
  1120. const validateForm = (): boolean => {
  1121. if (infoEntry.value == '') {
  1122. uni.showToast({
  1123. title: '请选择信息录入方式',
  1124. icon: 'none'
  1125. });
  1126. return false;
  1127. }
  1128. if (infoEntry.value == '1' && (misNo.value == '')) {
  1129. uni.showToast({
  1130. title: '请输入MIS工单编码',
  1131. icon: 'none'
  1132. });
  1133. return false;
  1134. }
  1135. if (workPermitNum.value == '') {
  1136. uni.showToast({
  1137. title: '请输入工作票编号',
  1138. icon: 'none'
  1139. });
  1140. return false;
  1141. }
  1142. if (realStartTime.value == '') {
  1143. uni.showToast({
  1144. title: '请选择开始时间',
  1145. icon: 'none'
  1146. });
  1147. return false;
  1148. }
  1149. if (realEndTime.value == '') {
  1150. uni.showToast({
  1151. title: '请选择结束时间',
  1152. icon: 'none'
  1153. });
  1154. return false;
  1155. }
  1156. // 统一转换为时间戳(避免格式问题,对比更精准)
  1157. const realStartTimeStamp = new Date(realStartTime.value).getTime();
  1158. const currentTimeStamp = new Date().getTime(); // 当前时间戳
  1159. const realEndTimeStamp = new Date(realEndTime.value).getTime(); // 结束时间戳
  1160. // 校验1:开始时间不能大于当前时间
  1161. if (realStartTimeStamp > currentTimeStamp) {
  1162. uni.showToast({
  1163. title: '开始时间不能大于当前时间',
  1164. icon: 'none'
  1165. });
  1166. return false;
  1167. }
  1168. // 校验2:开始时间不能大于结束时间(优化原有逻辑,用时间戳更稳定)
  1169. if (realStartTimeStamp >= realEndTimeStamp) {
  1170. uni.showToast({
  1171. title: '开始时间不能大于结束时间',
  1172. icon: 'none'
  1173. });
  1174. return false;
  1175. }
  1176. // 校验3:开始时间不能大于发生时间(pauseTime非空时校验)
  1177. if (pauseTime.value != '' && pauseTime.value.trim() !== '') {
  1178. const pauseTimeStamp = new Date(pauseTime.value).getTime();
  1179. if (realStartTimeStamp < pauseTimeStamp) {
  1180. uni.showToast({
  1181. title: '开始时间不能小于发生时间',
  1182. icon: 'none'
  1183. });
  1184. return false;
  1185. }
  1186. if (realEndTimeStamp < pauseTimeStamp) {
  1187. uni.showToast({
  1188. title: '结束时间不能小于发生时间',
  1189. icon: 'none'
  1190. });
  1191. return false;
  1192. }
  1193. }
  1194. // 校验4:开始时间不能大于恢复运行时间(restartTime非空时校验)
  1195. if (restartTime.value != '' && restartTime.value.trim() !== '') {
  1196. const restartTimeStamp = new Date(restartTime.value).getTime();
  1197. if (realStartTimeStamp > restartTimeStamp) {
  1198. uni.showToast({
  1199. title: '开始时间不能大于复运时间',
  1200. icon: 'none'
  1201. });
  1202. return false;
  1203. }
  1204. }
  1205. // 1. 结束时间不能大于当前时间
  1206. if (realEndTimeStamp > currentTimeStamp) {
  1207. uni.showToast({
  1208. title: '结束时间不能大于当前时间',
  1209. icon: 'none'
  1210. });
  1211. return false;
  1212. }
  1213. // 2. 结束时间不能小于恢复运行时间(restartTime/复运时间非空时校验)
  1214. if (restartTime.value != '' && restartTime.value.trim() !== '') {
  1215. const restartTimeStamp = new Date(restartTime.value).getTime();
  1216. if (realEndTimeStamp < restartTimeStamp) {
  1217. uni.showToast({
  1218. title: '结束时间不能小于复运时间',
  1219. icon: 'none'
  1220. });
  1221. return false;
  1222. }
  1223. }
  1224. if (teamLeaderName.value == '') {
  1225. uni.showToast({
  1226. title: '请选择工作负责人',
  1227. icon: 'none'
  1228. });
  1229. return false;
  1230. }
  1231. if (workGroupMemberName.value == '') {
  1232. uni.showToast({
  1233. title: '请选择工作班成员',
  1234. icon: 'none'
  1235. });
  1236. return false;
  1237. }
  1238. if (workArea.value == '') {
  1239. uni.showToast({
  1240. title: '请选择工作部位',
  1241. icon: 'none'
  1242. });
  1243. return false;
  1244. }
  1245. if(resumeShow.value) {
  1246. if(resumeTime.value == '') {
  1247. uni.showToast({
  1248. title: '请选挂起结束时间',
  1249. icon: 'none'
  1250. });
  1251. return false;
  1252. } else {
  1253. const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
  1254. if (suspendTime != '' && realStartTime.value != '' && new Date(suspendTime) < new Date(realStartTime.value)) { // 开工前挂起
  1255. if (resumeTime.value != '' && new Date(resumeTime.value) > new Date(realStartTime.value)) {
  1256. uni.showToast({
  1257. title: '开工前挂起结束时间晚于实际开始时间,请调整',
  1258. icon: 'none'
  1259. });
  1260. return false;
  1261. } else if(realEndTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value) > new Date(realEndTime.value)) {
  1262. uni.showToast({
  1263. title: '开工前挂起结束时间晚于实际结束时间,请调整',
  1264. icon: 'none'
  1265. });
  1266. return false;
  1267. }
  1268. } else if(suspendTime != '' && realStartTime.value != '' && new Date(suspendTime) >= new Date(realStartTime.value)) { // 作业中挂起
  1269. if (resumeTime.value != '' && new Date(resumeTime.value) < new Date(realStartTime.value)) {
  1270. uni.showToast({
  1271. title: '作业中挂起结束时间早于实际开始时间,请调整',
  1272. icon: 'none'
  1273. });
  1274. return false;
  1275. } else if(realEndTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value) > new Date(realEndTime.value)) {
  1276. uni.showToast({
  1277. title: '作业中挂起结束时间晚于实际结束时间,请调整',
  1278. icon: 'none'
  1279. });
  1280. return false;
  1281. }
  1282. }
  1283. }
  1284. }
  1285. return true;
  1286. };
  1287. const isDealing = ref(false)
  1288. const hasDealed = ref(false)
  1289. // 提交表单
  1290. const handleSubmit = async (): Promise<void> => {
  1291. if (!validateForm()) {
  1292. return;
  1293. }
  1294. submitLoading.value = true;
  1295. try {
  1296. if (isDealing.value || hasDealed.value) return // 双重保险
  1297. isDealing.value = true
  1298. // 确保附件URLs是最新的逗号分隔格式
  1299. attachmentUrls.value = uploadedFiles.value.map(file => file.fileName).join(',');
  1300. flowList.value = []
  1301. if (resumeTime.value != '' && resumeInfo.value != null && resumeTime.value != (resumeInfo.value['actionTime'] as string | null)) { //存入新的挂起结束时间
  1302. resumeInfo.value['actionTime'] = resumeTime.value
  1303. flowList.value.push(resumeInfo.value as UTSJSONObject)
  1304. }
  1305. const finishData = {
  1306. id: orderId.value,
  1307. orderType: orderType.value,
  1308. workOrderProjectNo: workOrderProjectNo.value,
  1309. infoEntry: infoEntry.value,
  1310. misOrderNo: infoEntry.value == '1' ? misNo.value : null,
  1311. workPermitNum: workPermitNum.value,
  1312. realStartTime: realStartTime.value,
  1313. realEndTime: realEndTime.value,
  1314. wwryNum: wwryNum.value,
  1315. wlryNum: wlryNum.value,
  1316. workGroupMemberName: workGroupMemberName.value,
  1317. realFailureReason: realFailureReason.value,
  1318. attachmentUrls: attachmentUrls.value,
  1319. repairOrderPersonList: repairOrderPersonList.value,
  1320. teamLeaderId: teamLeaderId.value,
  1321. teamLeaderName: teamLeaderName.value,
  1322. finalizeMethod: '2',
  1323. workOrderStatus: 'completed',
  1324. workArea: workArea.value,
  1325. repairOrderFlowList: flowList.value,
  1326. repairMethod: '1'
  1327. } as UTSJSONObject;
  1328. const result = await repairFinishOrder(finishData);
  1329. const resultObj = result as UTSJSONObject;
  1330. const code = resultObj['code'] as number;
  1331. if (code == 200) {
  1332. uni.showToast({
  1333. title: '结单成功',
  1334. icon: 'success'
  1335. });
  1336. hasDealed.value = true
  1337. // 使用事件总线通知列表页面刷新
  1338. uni.$emit('refreshOrderList', {});
  1339. uni.$emit('refreshAssignedCount');
  1340. uni.$emit('refreshOverdueCount');
  1341. setTimeout(() => {
  1342. uni.navigateBack();
  1343. }, 800);
  1344. } else {
  1345. const msg = resultObj['msg'] as string;
  1346. uni.showToast({
  1347. title: msg.length > 0 ? msg : '结单失败',
  1348. icon: 'none'
  1349. });
  1350. }
  1351. } catch (error: Error) {
  1352. uni.showToast({
  1353. title: error.message,
  1354. icon: 'none'
  1355. });
  1356. } finally {
  1357. submitLoading.value = false;
  1358. isDealing.value = false // 无论成功失败都解锁
  1359. }
  1360. };
  1361. const loading = ref<boolean>(false)
  1362. // 加载详情数据
  1363. const loadDetail = async (id: string, orderType?: string): Promise<void> => {
  1364. try {
  1365. loading.value = true
  1366. let result: any;
  1367. // 根据orderType决定调用哪个API
  1368. if (orderType == '1') {
  1369. // 维修工单
  1370. result = await getRepairOrderInfoById(id)
  1371. } else {
  1372. // 维保工单
  1373. result = await getOrderInfoById(id)
  1374. }
  1375. // 提取响应数据
  1376. const resultObj = result as UTSJSONObject
  1377. const code = resultObj['code'] as number
  1378. const data = resultObj['data'] as UTSJSONObject | null
  1379. if (code == 200 && data != null) {
  1380. workOrderStatus.value = (data['workOrderStatus'] as string | null) ?? ''
  1381. workOrderProjectNo.value = (data['workOrderProjectNo'] as string | null) ?? ''
  1382. pcsDeviceName.value = (data['pcsDeviceName'] as string | null) ?? ''
  1383. gxtCenter.value = (data['gxtCenter'] as string | null) ?? ''
  1384. pcsStationName.value = (data['pcsStationName'] as string | null) ?? ''
  1385. brand.value = (data['brand'] as string | null) ?? ''
  1386. model.value = (data['model'] as string | null) ?? ''
  1387. acceptTime.value = (data['acceptTime'] as string | null) ?? ''
  1388. acceptUserName.value = (data['acceptUserName'] as string | null) ?? ''
  1389. // 初始化结单表单默认值
  1390. infoEntry.value = '1' // 默认为手工录入
  1391. teamLeaderId.value = (data['teamLeaderId'] as Number | null) ?? null
  1392. teamLeaderName.value = (data['teamLeaderName'] as string | null) ?? ''
  1393. returnType.value = workOrderStatus.value == 'to_finish' ? '1' : ''
  1394. faultCode.value = (data['faultCode'] as string | null) ?? ''
  1395. faultBarcode.value = (data['faultBarcode'] as string | null) ?? ''
  1396. faultDesc.value = (data['faultDesc'] as string | null) ?? ''
  1397. suspendReason.value = (data['suspendReason'] as string | null) ?? ''
  1398. workGroupMemberName.value = (data['workGroupMemberName'] as string | null) ?? ''
  1399. oldWorkGroupMemberName.value = (data['workGroupMemberName'] as string | null) ?? '' // 旧工作班成员
  1400. oldRepairOrderPersonList.value = (data['repairOrderPersonList'] as UTSJSONObject[] | null) ?? [] // 旧工作班成员数组
  1401. overStopStatus.value = (data['overStopStatus'] as Number | null) ?? null
  1402. oldTeamLeaderName.value = (data['teamLeaderName'] as string | null) ?? ''
  1403. // 初始化附件数据
  1404. const attachmentUrlsFromServer = (data['attachmentUrls'] as string | null) ?? ''
  1405. if (attachmentUrlsFromServer.length > 0) {
  1406. attachmentUrls.value = attachmentUrlsFromServer
  1407. // 将逗号分隔的URL字符串转换为UploadResponse对象数组
  1408. const urls = attachmentUrlsFromServer.split(',')
  1409. const fileArr : UploadResponse[] = []
  1410. for (let i = 0; i < urls.length; i++) {
  1411. const url = urls[i]
  1412. const item : UploadResponse = {
  1413. url: url,
  1414. fileId: '',
  1415. fileName: url.substring(url.lastIndexOf('/') + 1),
  1416. filePath: url,
  1417. fileSize: 0,
  1418. fileExt: url.substring(url.lastIndexOf('.') + 1),
  1419. businessType: 'workOrder'
  1420. }
  1421. fileArr.push(item)
  1422. }
  1423. uploadedFiles.value = fileArr
  1424. }
  1425. pauseTime.value = (data['occurTime'] as string | null) ?? ''
  1426. restartTime.value = (data['restartTime'] as string | null) ?? ''
  1427. if(pauseTime.value != '' && restartTime.value != '') {
  1428. const queryParams = {
  1429. pauseTime: pauseTime.value,
  1430. restartTime: restartTime.value,
  1431. pcsDeviceName: pcsDeviceName.value,
  1432. pcsStationName: pcsStationName.value,
  1433. workOrderStatus: '结束',
  1434. orderType: 1
  1435. } as UTSJSONObject;
  1436. const result = await listAutoMisInfo(queryParams)
  1437. // 提取响应数据
  1438. const resultObj = result as UTSJSONObject
  1439. const code = resultObj['code'] as number
  1440. const misInfo = resultObj['rows'] as UTSJSONObject[] | null
  1441. if (code == 200 && misInfo != null) {
  1442. if(misInfo.length > 0 && misInfo.length == 1) {
  1443. // 有工作票号提示
  1444. const workPermitNum2 = misInfo[0]['workPermitNum'] as string | null
  1445. const misNo2 = misInfo[0]['misNo'] as string | null
  1446. if (workPermitNum2 != null && workPermitNum2.length > 0) {
  1447. const response = await getOrderList(1, 10, misNo2 ?? '', '')
  1448. const responseObj = response as UTSJSONObject
  1449. const rows = responseObj['rows'] as UTSJSONObject[] | null
  1450. if (rows != null && rows.length > 0) {
  1451. misNo.value = ''
  1452. uni.showModal({
  1453. title: '提示',
  1454. content: '已匹配到' + misNo2 + '工单,但该MIS工单已被其他工单关联,请检查是否重复操作。',
  1455. showCancel: false, // 只显示确定按钮
  1456. confirmText: '确定',
  1457. confirmColor: '#007aff', // 自定义按钮颜色,匹配你的UI风格
  1458. success: (res) => {
  1459. }
  1460. });
  1461. } else {
  1462. misNo.value = (misInfo[0]['misNo'] as string | null) ?? ''
  1463. realStartTime.value = (misInfo[0]['realStartTime'] as string | null) ?? ''
  1464. realEndTime.value = (misInfo[0]['realEndTime'] as string | null) ?? ''
  1465. workPermitNum.value = (misInfo[0]['workPermitNum'] as string | null) ?? ''
  1466. // 查询相关工作班成员
  1467. listWorkPerson(misNo.value).then(response => {
  1468. const responseObj = response as UTSJSONObject
  1469. const rows = responseObj['rows'] as UTSJSONObject[] | null
  1470. repairOrderPersonList.value = rows ?? []
  1471. if (rows != null && rows.length > 0) {
  1472. // 查询负责人信息并回填
  1473. for (const person of repairOrderPersonList.value) {
  1474. // 严格判断isLeader为1(兼容数字/字符串类型)
  1475. if (person.isLeader == 1) {
  1476. if(overStopStatus.value == 2 && oldTeamLeaderName.value != person.nickName) {
  1477. uni.showModal({
  1478. title: '提示',
  1479. content: 'MIS工单工作负责人与手动选择的工作负责人不一致',
  1480. showCancel: false, // 只显示确定按钮
  1481. confirmText: '确定',
  1482. confirmColor: '#007aff',
  1483. success: (res) => {
  1484. }
  1485. });
  1486. break;
  1487. } else {
  1488. teamLeaderName.value = (person.nickName as string | null) ?? '';
  1489. teamLeaderId.value = (person.userId as Number | null) ?? null;
  1490. break; // 找到后立即停止循环
  1491. }
  1492. }
  1493. }
  1494. // 当 overStopStatus == 2 时,比对旧的 repairOrderPersonList 和新的 MIS 工单获取的 repairOrderPersonList
  1495. if (overStopStatus.value == 2) {
  1496. let hasDifference = false
  1497. const newPersonList = repairOrderPersonList.value
  1498. if (oldRepairOrderPersonList.value.length === 0) {
  1499. // 旧列表为空,新列表不为空,存在差异
  1500. hasDifference = true
  1501. } else if (newPersonList.length !== oldRepairOrderPersonList.value.length) {
  1502. // 列表长度不一致,存在差异
  1503. hasDifference = true
  1504. } else {
  1505. // 比较每个人员的 nickName
  1506. for (let newPerson of newPersonList) {
  1507. const found = oldRepairOrderPersonList.value.some(oldPerson =>
  1508. newPerson.nickName === oldPerson.nickName
  1509. )
  1510. if (!found) {
  1511. hasDifference = true
  1512. break
  1513. }
  1514. }
  1515. }
  1516. // 如果存在差异,提醒用户但不改变当前 repairOrderPersonList
  1517. if (hasDifference) {
  1518. uni.showModal({
  1519. title: '提示',
  1520. content: 'MIS工单人员列表与当前工单人员列表不一致!',
  1521. showCancel: false, // 只显示确定按钮
  1522. confirmText: '确定',
  1523. confirmColor: '#007aff',
  1524. success: (res) => {
  1525. }
  1526. });
  1527. }
  1528. } else {
  1529. const nickNames = rows
  1530. .filter(person => person.isLeader != 1)
  1531. .map(person => (person.nickName as string | null) ?? '')
  1532. .join(',');
  1533. workGroupMemberName.value = nickNames;
  1534. repairOrderPersonList.value.map(person => {
  1535. // 构造查询参数:username 和 nickName
  1536. const queryParams = {
  1537. userName: person.userName, // 假设person对象有username字段
  1538. nickName: person.nickName // 假设person对象有nickName字段
  1539. };
  1540. getUserList(queryParams).then(response => {
  1541. const responseObj = response as UTSJSONObject
  1542. const rows = responseObj['rows'] as UTSJSONObject[] | null
  1543. if (rows == null || rows.length == 0) {
  1544. let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查。"
  1545. if (person.isLeader == 1) {
  1546. msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查。"
  1547. }
  1548. // uni.showToast({
  1549. // title: msg,
  1550. // icon: 'none',
  1551. // duration: 3000 // 自定义显示时间,单位ms
  1552. // });
  1553. uni.showModal({
  1554. title: '提示',
  1555. content: msg,
  1556. showCancel: false, // 只显示确定按钮
  1557. confirmText: '确定',
  1558. confirmColor: '#007aff',
  1559. success: (res) => {
  1560. }
  1561. });
  1562. }
  1563. });
  1564. })
  1565. }
  1566. }
  1567. })
  1568. }
  1569. } else {
  1570. misNo.value = ''
  1571. // infoEntry.value = '2'
  1572. uni.showModal({
  1573. title: '提示',
  1574. content: '已匹配到MIS工单,但未关联工作票号,系统无法自动结单,请进入工作票录入方式。',
  1575. showCancel: false, // 只显示确定按钮
  1576. confirmText: '确定',
  1577. confirmColor: '#007aff',
  1578. success: (res) => {
  1579. }
  1580. });
  1581. }
  1582. } else if(misInfo.length == 0) {
  1583. misNo.value = ''
  1584. // infoEntry.value = '2'
  1585. uni.showModal({
  1586. title: '提示',
  1587. content: '未找到匹配的MIS工单,请确认开始时间是否介于停机时间与恢复运行时间之间,并且结束时间晚于恢复运行时间。',
  1588. showCancel: false, // 只显示确定按钮
  1589. confirmText: '确定',
  1590. confirmColor: '#007aff',
  1591. success: (res) => {
  1592. }
  1593. });
  1594. } else if(misInfo.length > 1) {
  1595. misNo.value = ''
  1596. // infoEntry.value = '2'
  1597. // uni.showToast({
  1598. // title: '已匹配到多个MIS工单,请手动结单,信息录入选择关联MIS。',
  1599. // icon: 'none',
  1600. // duration: 3000
  1601. // });
  1602. uni.showModal({
  1603. title: '提示',
  1604. content: '已匹配到多个MIS工单,请手动结单,信息录入选择关联MIS。',
  1605. showCancel: false, // 只显示确定按钮
  1606. confirmText: '确定',
  1607. confirmColor: '#007aff',
  1608. success: (res) => {
  1609. }
  1610. });
  1611. }
  1612. }
  1613. } else {
  1614. misNo.value = ''
  1615. uni.showModal({
  1616. title: '提示',
  1617. content: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式。',
  1618. showCancel: false, // 只显示确定按钮
  1619. confirmText: '确定',
  1620. confirmColor: '#007aff',
  1621. success: (res) => {
  1622. }
  1623. });
  1624. }
  1625. flowList.value = data['repairOrderFlowList'] as UTSJSONObject[]
  1626. if (suspendReason.value != '' && flowList.value.length > 0) {
  1627. // 获取最后一个 actionType 等于 'resume' 的项
  1628. const lastResumeItem = flowList.value.findLast(item => item['actionType'] === 'resume') as UTSJSONObject | null
  1629. if (lastResumeItem != null) {
  1630. resumeInfo.value = lastResumeItem
  1631. // 直接给 resumeTime 赋值,无需 formData
  1632. resumeTime.value = (lastResumeItem['actionTime'] as string | null) ?? ''
  1633. }
  1634. const lastSuspendItem = flowList.value.findLast(item => (item['actionType'] as string | null) === 'to_approve') as UTSJSONObject | null
  1635. if (lastSuspendItem != null) {
  1636. suspendInfo.value = lastSuspendItem
  1637. }
  1638. }
  1639. } else {
  1640. const msg = resultObj['msg'] as string | null
  1641. uni.showToast({
  1642. title: msg ?? '加载失败',
  1643. icon: 'none'
  1644. })
  1645. }
  1646. } catch (e: any) {
  1647. uni.showToast({
  1648. title: e.message ?? '加载失败',
  1649. icon: 'none'
  1650. })
  1651. } finally {
  1652. loading.value = false
  1653. }
  1654. }
  1655. // 页面加载
  1656. onLoad((options: any) => {
  1657. const params = options as UTSJSONObject
  1658. const id = params['id'] as string | null
  1659. const orderTypeParam = params['orderType'] as string | null
  1660. if (id != null && orderTypeParam != null) {
  1661. // 先尝试从参数中获取orderType
  1662. // const orderTypeNumber = parseInt(orderTypeParam)
  1663. orderType.value = orderTypeParam
  1664. orderId.value = id
  1665. loadDetail(id, orderTypeParam)
  1666. }
  1667. })
  1668. // 初始化
  1669. onMounted(() => {
  1670. getUserAllList();
  1671. loadInfoEntryDictList();
  1672. loadWorkAreaDictList();
  1673. })
  1674. </script>
  1675. <style lang="scss">
  1676. .detail-page {
  1677. flex: 1;
  1678. background-color: #e8f0f9;
  1679. }
  1680. .detail-content {
  1681. flex: 1;
  1682. padding: 20rpx 0;
  1683. }
  1684. .info-section {
  1685. margin: 0 30rpx 24rpx;
  1686. .section-title {
  1687. position: relative;
  1688. padding-left: 20rpx;
  1689. margin-bottom: 20rpx;
  1690. &::before {
  1691. position: absolute;
  1692. left: 0;
  1693. top: 50%;
  1694. transform: translateY(-50%);
  1695. width: 8rpx;
  1696. height: 32rpx;
  1697. background-color: #007aff;
  1698. border-radius: 4rpx;
  1699. }
  1700. &-text {
  1701. font-size: 32rpx;
  1702. font-weight: bold;
  1703. color: #333333;
  1704. }
  1705. }
  1706. .info-card {
  1707. background-color: #ffffff;
  1708. border-radius: 16rpx;
  1709. padding: 30rpx;
  1710. .info-item {
  1711. flex-direction: row;
  1712. padding: 20rpx 0;
  1713. border-bottom: 1rpx solid #f0f0f0;
  1714. &:last-child {
  1715. border-bottom: none;
  1716. }
  1717. &.full-width {
  1718. flex-direction: column;
  1719. .info-label {
  1720. margin-bottom: 12rpx;
  1721. }
  1722. .info-value {
  1723. line-height: 44rpx;
  1724. }
  1725. }
  1726. .info-label {
  1727. width: 240rpx;
  1728. font-size: 28rpx;
  1729. color: #666666;
  1730. white-space: nowrap;
  1731. }
  1732. .info-value {
  1733. flex: 1;
  1734. font-size: 28rpx;
  1735. color: #333333;
  1736. text-align: left;
  1737. &.highlight {
  1738. color: #007aff;
  1739. font-weight: bold;
  1740. }
  1741. &.input {
  1742. text-align: left;
  1743. border: 1rpx solid #e0e0e0;
  1744. border-radius: 8rpx;
  1745. padding: 10rpx;
  1746. }
  1747. .input-with-clear {
  1748. position: relative;
  1749. display: flex;
  1750. align-items: center;
  1751. }
  1752. .select-clear {
  1753. position: absolute;
  1754. right: 20rpx;
  1755. color: #ccc;
  1756. text-align: center;
  1757. font-size: 40rpx;
  1758. font-weight: bold;
  1759. z-index: 1;
  1760. }
  1761. .input-with-select {
  1762. position: relative;
  1763. display: flex;
  1764. align-items: center;
  1765. }
  1766. .select-mis-btn {
  1767. line-height: 50rpx;
  1768. text-align: center;
  1769. position: absolute;
  1770. right: 0rpx;
  1771. padding: 6rpx 12rpx;
  1772. background-color: #007aff;
  1773. color: #fff;
  1774. border-radius: 6rpx;
  1775. font-size: 26rpx;
  1776. z-index: 1;
  1777. max-width: 100rpx;
  1778. overflow: hidden;
  1779. text-overflow: ellipsis;
  1780. white-space: nowrap;
  1781. }
  1782. }
  1783. }
  1784. .flow-item {
  1785. padding: 20rpx 0;
  1786. border-bottom: 1rpx solid #f0f0f0;
  1787. &:last-child {
  1788. border-bottom: none;
  1789. }
  1790. .flow-header {
  1791. flex-direction: row;
  1792. justify-content: space-between;
  1793. margin-bottom: 10rpx;
  1794. .flow-operator {
  1795. font-size: 28rpx;
  1796. color: #333333;
  1797. font-weight: bold;
  1798. }
  1799. .flow-time {
  1800. font-size: 24rpx;
  1801. color: #999999;
  1802. }
  1803. }
  1804. .flow-content {
  1805. flex-direction: column;
  1806. .flow-action {
  1807. font-size: 26rpx;
  1808. color: #666666;
  1809. margin-bottom: 8rpx;
  1810. }
  1811. .flow-remark {
  1812. font-size: 24rpx;
  1813. color: #999999;
  1814. background-color: #f5f5f5;
  1815. padding: 10rpx;
  1816. border-radius: 8rpx;
  1817. }
  1818. }
  1819. }
  1820. .no-data {
  1821. text-align: center;
  1822. padding: 40rpx 0;
  1823. font-size: 28rpx;
  1824. color: #999999;
  1825. }
  1826. }
  1827. }
  1828. .accept-button-container {
  1829. padding: 30rpx 30rpx 50rpx;
  1830. background-color: #ffffff;
  1831. .accept-button {
  1832. width: 100%;
  1833. height: 80rpx;
  1834. background-color: #007aff;
  1835. color: #ffffff;
  1836. font-size: 32rpx;
  1837. border-radius: 16rpx;
  1838. border: none;
  1839. &:active {
  1840. background-color: #0062cc;
  1841. }
  1842. }
  1843. }
  1844. .loading-mask {
  1845. position: absolute;
  1846. top: 0;
  1847. left: 0;
  1848. right: 0;
  1849. bottom: 0;
  1850. justify-content: center;
  1851. align-items: center;
  1852. background-color: rgba(0, 0, 0, 0.3);
  1853. .loading-text {
  1854. padding: 30rpx 60rpx;
  1855. background-color: rgba(0, 0, 0, 0.7);
  1856. color: #ffffff;
  1857. font-size: 28rpx;
  1858. border-radius: 12rpx;
  1859. }
  1860. }
  1861. .picker-modal {
  1862. position: fixed;
  1863. top: 0;
  1864. left: 0;
  1865. right: 0;
  1866. bottom: 0;
  1867. z-index: 1000;
  1868. }
  1869. .modal-mask {
  1870. position: absolute;
  1871. top: 0;
  1872. left: 0;
  1873. right: 0;
  1874. bottom: 0;
  1875. background-color: rgba(0, 0, 0, 0.5);
  1876. }
  1877. .modal-content {
  1878. position: absolute;
  1879. bottom: 0;
  1880. left: 0;
  1881. right: 0;
  1882. background-color: #ffffff;
  1883. border-top-left-radius: 16rpx;
  1884. border-top-right-radius: 16rpx;
  1885. min-height: 700rpx;
  1886. }
  1887. .modal-header {
  1888. flex-direction: row;
  1889. justify-content: space-between;
  1890. align-items: center;
  1891. padding: 30rpx;
  1892. border-bottom: 1rpx solid #f0f0f0;
  1893. }
  1894. .modal-title {
  1895. font-size: 32rpx;
  1896. font-weight: bold;
  1897. color: #333333;
  1898. }
  1899. .modal-close {
  1900. font-size: 28rpx;
  1901. color: #007aff;
  1902. }
  1903. .modal-body {
  1904. max-height: 800rpx;
  1905. min-height: 800rpx;
  1906. }
  1907. .picker-option {
  1908. flex-direction: row;
  1909. justify-content: space-between;
  1910. align-items: center;
  1911. padding: 24rpx 30rpx;
  1912. border-bottom: 1rpx solid #f0f0f0;
  1913. }
  1914. .picker-option.selected {
  1915. background-color: #f8f9fa;
  1916. }
  1917. .picker-option:last-child {
  1918. border-bottom: none;
  1919. }
  1920. .option-text {
  1921. font-size: 28rpx;
  1922. color: #333333;
  1923. margin-bottom: 10rpx;
  1924. }
  1925. .option-text:last-child {
  1926. margin-bottom: 0;
  1927. }
  1928. .option-check {
  1929. font-size: 28rpx;
  1930. color: #007aff;
  1931. }
  1932. .empty-tip {
  1933. justify-content: space-between;
  1934. padding: 24rpx 30rpx;
  1935. display: flex;
  1936. align-items: center;
  1937. justify-content: center;
  1938. color: #999;
  1939. }
  1940. .picker-option {
  1941. flex-direction: row;
  1942. justify-content: space-between;
  1943. align-items: center;
  1944. padding: 24rpx 30rpx;
  1945. border-bottom: 1rpx solid #f0f0f0;
  1946. }
  1947. .picker-option:last-child {
  1948. border-bottom: none;
  1949. }
  1950. .picker-option.selected {
  1951. background-color: #f8f9fa;
  1952. }
  1953. .picker-mis-option {
  1954. justify-content: space-between;
  1955. align-items: center;
  1956. padding: 24rpx 30rpx;
  1957. border-bottom: 1rpx solid #f0f0f0;
  1958. }
  1959. .picker-mis-option:last-child {
  1960. border-bottom: none;
  1961. }
  1962. .picker-mis-option.selected {
  1963. background-color: #f8f9fa;
  1964. }
  1965. .option-row {
  1966. flex-direction: row;
  1967. justify-content: space-around;
  1968. align-items: center;
  1969. }
  1970. .option-text {
  1971. font-size: 28rpx;
  1972. color: #333333;
  1973. }
  1974. .mis-list {
  1975. flex: 1;
  1976. height: 100%;
  1977. display: flex;
  1978. flex-direction: column;
  1979. }
  1980. .empty-tip {
  1981. text-align: center;
  1982. padding: 40rpx;
  1983. color: #999;
  1984. font-size: 28rpx;
  1985. }
  1986. .form-item {
  1987. flex-direction: row;
  1988. padding: 20rpx 0;
  1989. border-bottom: 1rpx solid #f0f0f0;
  1990. }
  1991. .reject-reason-textarea {
  1992. width: 100%;
  1993. min-height: 100rpx;
  1994. line-height: 1.5;
  1995. }
  1996. .input-field {
  1997. width: 100%;
  1998. height: 60rpx;
  1999. padding: 0 20rpx;
  2000. border: 1rpx solid #e0e0e0;
  2001. border-radius: 8rpx;
  2002. font-size: 28rpx;
  2003. background-color: #f8f9fa;
  2004. }
  2005. .select-mis-btn {
  2006. width: 150rpx;
  2007. height: 60rpx;
  2008. margin-left: 10rpx;
  2009. background-color: #007aff;
  2010. color: #fff;
  2011. border: none;
  2012. border-radius: 8rpx;
  2013. font-size: 24rpx;
  2014. }
  2015. .textarea-field {
  2016. width: 100%;
  2017. min-height: 120rpx;
  2018. padding: 20rpx;
  2019. border: 1rpx solid #e0e0e0;
  2020. border-radius: 8rpx;
  2021. font-size: 28rpx;
  2022. background-color: #f8f9fa;
  2023. }
  2024. .radio-label {
  2025. display: flex;
  2026. align-items: center;
  2027. margin-right: 30rpx;
  2028. }
  2029. .quick-select-dropdown {
  2030. position: absolute;
  2031. top: 100%;
  2032. left: 0;
  2033. right: 0;
  2034. background: #fff;
  2035. border: 1rpx solid #ddd;
  2036. border-top: none;
  2037. z-index: 1000;
  2038. max-height: 300rpx;
  2039. }
  2040. .quick-select-item {
  2041. padding: 20rpx;
  2042. border-bottom: 1rpx solid #eee;
  2043. }
  2044. .mis-no {
  2045. font-size: 28rpx;
  2046. color: #333;
  2047. }
  2048. .search-bar {
  2049. padding: 20rpx 30rpx;
  2050. background-color: #d7eafe;
  2051. }
  2052. .search-box {
  2053. flex-direction: row;
  2054. align-items: center;
  2055. height: 72rpx;
  2056. padding: 0 24rpx;
  2057. background-color: #f5f5f5;
  2058. border-radius: 36rpx;
  2059. .search-icon {
  2060. width: 32rpx;
  2061. height: 32rpx;
  2062. margin-right: 12rpx;
  2063. }
  2064. .search-input {
  2065. flex: 1;
  2066. font-size: 28rpx;
  2067. color: #333333;
  2068. }
  2069. .clear-icon {
  2070. margin-left: 12rpx;
  2071. font-size: 28rpx;
  2072. color: #999999;
  2073. }
  2074. }
  2075. .mis-list {
  2076. flex: 1;
  2077. height: 100%;
  2078. display: flex;
  2079. flex-direction: column;
  2080. }
  2081. .select-users-count {
  2082. margin-left: 10rpx;
  2083. font-size: 24rpx;
  2084. color: #666;
  2085. }
  2086. </style>