wbFinalize.uvue 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763
  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>
  43. </view>
  44. <!-- 结单表单 -->
  45. <view class="info-section">
  46. <view class="section-title">
  47. <text class="section-title-text">结单信息</text>
  48. </view>
  49. <view class="info-card">
  50. <!-- 信息录入 -->
  51. <view class="info-item">
  52. <view class="info-label">
  53. <text class="form-label required">信息录入<text style="color: red;">*</text></text>
  54. </view>
  55. <view class="info-value">
  56. <radio-group @change="handleInfoEntryChange" :disabled="infoEntryDisabled" class="uni-flex uni-row radio-group">
  57. <view v-for="(option, index) in infoEntryOptions" :key="index" class="radio-label">
  58. <radio :value="option.dictValue" :checked="infoEntry == option.dictValue">{{ option.dictLabel }}</radio>
  59. <!-- <text></text> -->
  60. </view>
  61. </radio-group>
  62. </view>
  63. </view>
  64. <!-- MIS工单编码选择(当信息录入为1时显示) -->
  65. <view class="info-item" v-if="infoEntry == '1'">
  66. <view class="info-label">
  67. <text class="form-label required">MIS工单编码<text style="color: red;">*</text></text>
  68. </view>
  69. <view class="info-value">
  70. <view class="input-with-select">
  71. <input
  72. class="input-field"
  73. placeholder="请输入或选择MIS工单编码"
  74. v-model="misNo"
  75. @focus="handleMisNoInputFocus"
  76. @blur="handleMisNoInputBlur"
  77. @input="handleMisNoInput"
  78. :readonly="infoEntry == '1'"
  79. :style="{ paddingRight: '120rpx' }" />
  80. <text class="select-mis-btn" @click="openMisListModal">选择</text>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 工作票编号(当信息录入为2时可编辑) -->
  85. <view class="info-item">
  86. <view class="info-label">
  87. <text class="form-label required">工作票编号<text style="color: red;">*</text></text>
  88. </view>
  89. <view class="info-value">
  90. <input
  91. class="input-field"
  92. placeholder="请输入工作票编号"
  93. v-model="workPermitNum"
  94. maxlength="20"
  95. :disabled="infoEntry == '1'"
  96. />
  97. </view>
  98. </view>
  99. <!-- 开始时间 -->
  100. <view class="info-item">
  101. <view class="info-label">
  102. <text class="form-label required">开始时间<text style="color: red;">*</text></text>
  103. </view>
  104. <view class="info-value">
  105. <view class="form-picker" @click="showStartTimePicker = true">
  106. <input
  107. class="input-field"
  108. placeholder="请选择开始时间"
  109. v-model="realStartTime"
  110. readonly
  111. />
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 结束时间 -->
  116. <view class="info-item">
  117. <view class="info-label">
  118. <text class="form-label required">结束时间<text style="color: red;">*</text></text>
  119. </view>
  120. <view class="info-value">
  121. <view class="form-picker" @click="showEndTimePicker = true">
  122. <input
  123. class="input-field"
  124. placeholder="请选择结束时间"
  125. v-model="realEndTime"
  126. readonly
  127. />
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 外委人员数 -->
  132. <view class="info-item">
  133. <view class="info-label">
  134. <text class="form-label required">外委人员数(人)</text>
  135. </view>
  136. <view class="info-value">
  137. <input
  138. type="number"
  139. class="input-field"
  140. placeholder="请输入外委人员数"
  141. v-model="wwryNum"
  142. />
  143. </view>
  144. </view>
  145. <!-- 外来人员数 -->
  146. <view class="info-item">
  147. <view class="info-label">
  148. <text class="form-label required">外来人员数(人)</text>
  149. </view>
  150. <view class="info-value">
  151. <input
  152. type="number"
  153. class="input-field"
  154. placeholder="请输入外来人员数"
  155. v-model="wlryNum"
  156. />
  157. </view>
  158. </view>
  159. <!-- 工作负责人 -->
  160. <view class="info-item">
  161. <view class="info-label">
  162. <text class="form-label required">工作负责人<text style="color: red;">*</text></text>
  163. </view>
  164. <view class="info-value">
  165. <view class="input-with-clear">
  166. <input
  167. class="input-field"
  168. placeholder="请选择工作负责人"
  169. v-model="teamLeaderName"
  170. @click="showLeaderPicker = true"
  171. />
  172. </view>
  173. </view>
  174. </view>
  175. <!-- 工作班成员选择(当信息录入为2时可编辑) -->
  176. <view class="info-item">
  177. <view class="info-label">
  178. <text class="form-label required">工作班成员<text style="color: red;">*</text></text>
  179. </view>
  180. <view class="info-value">
  181. <view class="input-with-clear">
  182. <input
  183. class="input-field"
  184. placeholder="请选择工作班成员"
  185. v-model="workGroupMemberName"
  186. @click="showUserSelect = true"
  187. :disabled="infoEntry == '1'"
  188. />
  189. <text class="select-users-count" v-if="selectedUserIds.length > 0" :style="{ marginRight: selectedUserIds.length > 0 ? '60rpx' : '0' }">({{ selectedUserIds.length }}人)</text>
  190. <text class="select-clear" v-if="selectedUserIds.length > 0" @click="clearSelectedUsers">×</text>
  191. </view>
  192. </view>
  193. </view>
  194. <!-- 维保内容 -->
  195. <view class="info-item full-width">
  196. <view class="info-label">
  197. <text class="form-label required">维保内容<text style="color: red;">*</text></text>
  198. </view>
  199. <view class="info-value">
  200. <textarea
  201. class="textarea-field"
  202. placeholder="请输入维保内容"
  203. v-model="content"
  204. maxlength="500"
  205. :disabled="infoEntry == '1'"
  206. :show-confirm-bar="false"
  207. auto-height
  208. ></textarea>
  209. </view>
  210. </view>
  211. <!-- 附件上传 -->
  212. <view class="info-item full-width">
  213. <view class="info-label">
  214. <text class="form-label">附件(可选)</text>
  215. </view>
  216. <view class="info-value">
  217. <upload-image
  218. :limit="8"
  219. :modelValue="uploadedFiles"
  220. :businessType="'workOrder'"
  221. @update:modelValue="uploadedFiles = $event as UTSArray<UploadResponse>"
  222. />
  223. </view>
  224. </view>
  225. </view>
  226. </view>
  227. <!-- 时间选择器弹窗 -->
  228. <!-- Start Date Picker -->
  229. <l-popup v-model="showStartTimePicker" position="bottom">
  230. <l-date-time-picker
  231. title="选择开始时间"
  232. :mode="1 | 2 | 4 | 8 | 16"
  233. format="YYYY-MM-DD HH:mm"
  234. :modelValue="realStartTime"
  235. confirm-btn="确定"
  236. cancel-btn="取消"
  237. @confirm="onStartDateConfirm"
  238. @cancel="showStartTimePicker = false">
  239. </l-date-time-picker>
  240. </l-popup>
  241. <!-- End Date Picker -->
  242. <l-popup v-model="showEndTimePicker" position="bottom">
  243. <l-date-time-picker
  244. title="选择结束时间"
  245. :mode="31"
  246. format="YYYY-MM-DD HH:mm"
  247. :modelValue="realStartTime"
  248. confirm-btn="确定"
  249. cancel-btn="取消"
  250. @confirm="onEndDateConfirm"
  251. @cancel="showEndTimePicker = false">
  252. </l-date-time-picker>
  253. </l-popup>
  254. <!-- 人员选择弹窗 -->
  255. <view v-if="showUserSelect" class="picker-modal">
  256. <view class="modal-mask" @click="showUserSelect = false"></view>
  257. <view class="modal-content">
  258. <view class="modal-header">
  259. <text class="modal-title">选择工作班成员</text>
  260. <text class="modal-close" @click="confirmSelectedUsers">确定</text>
  261. </view>
  262. <view class="search-bar">
  263. <view class="search-box">
  264. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  265. <input class="search-input" type="text" placeholder="搜索姓名" v-model="userKeyword" @input="handleUserSearch" />
  266. <text v-if="userKeyword.length > 0" class="clear-icon" @click="clearUserSearch">✕</text>
  267. </view>
  268. </view>
  269. <scroll-view class="modal-body" scroll-y="true">
  270. <view
  271. v-for="(user, index) in userList"
  272. :key="index"
  273. class="picker-option"
  274. @click="toggleUserSelection(user)"
  275. >
  276. <text class="option-text">{{ (user['nickName'] as string | null) ?? '' }}</text>
  277. <text class="option-text">{{ ((user['dept'] as UTSJSONObject | null)?.['deptName'] as string | null) ?? '' }}</text>
  278. <text class="option-check" v-if="isSelected(user)">✓</text>
  279. </view>
  280. </scroll-view>
  281. </view>
  282. </view>
  283. <!-- MIS工单列表弹窗 -->
  284. <view v-if="showMisListModal" class="picker-modal">
  285. <view class="modal-mask" @click="closeMisListModal"></view>
  286. <view class="modal-content">
  287. <view class="modal-header">
  288. <text class="modal-title">选择MIS工单</text>
  289. <text class="modal-close" @click="closeMisListModal">取消</text>
  290. </view>
  291. <!-- 搜索栏 -->
  292. <view class="search-bar">
  293. <view class="search-box">
  294. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  295. <input class="search-input" type="text" placeholder="搜索 MIS工单编码" v-model="misListKeyword" @input="searchMisList" />
  296. <text v-if="misListKeyword.length > 0" class="clear-icon" @click="clearMisListSearch">✕</text>
  297. </view>
  298. </view>
  299. <!-- 列表内容 -->
  300. <scroll-view class="modal-body" scroll-y="true">
  301. <!-- 有数据时显示列表 -->
  302. <view v-if="misList.length > 0">
  303. <view
  304. v-for="(item, index) in misList"
  305. :key="index"
  306. class="picker-option"
  307. @click="selectMisItem(item, index)"
  308. >
  309. <!-- <text class="option-text">{{ option.label }}</text>
  310. <text class="option-text">{{ option.value }}</text> -->
  311. <text class="option-text">{{ ((item['misNo'] as string | null) ?? '-')}}</text>
  312. <text class="option-text">{{ item['workPermitNum'] as string | null ?? '-' }}</text>
  313. <text v-if="index === selectedMisInfoIndex" class="option-check">✓</text>
  314. </view>
  315. </view>
  316. <!-- 无数据时显示提示 -->
  317. <view v-else class="empty-tip">
  318. <text>未找到匹配的MIS工单</text>
  319. </view>
  320. </scroll-view>
  321. </view>
  322. </view>
  323. <!-- 工作负责人弹窗 -->
  324. <view v-if="showLeaderPicker" class="picker-modal">
  325. <view class="modal-mask" @click="showLeaderPicker = false"></view>
  326. <view class="modal-content">
  327. <view class="modal-header">
  328. <text class="modal-title">选择工作负责人</text>
  329. <text class="modal-close" @click="showLeaderPicker = false">取消</text>
  330. </view>
  331. <view class="search-bar">
  332. <view class="search-box">
  333. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  334. <input class="search-input" type="text" placeholder="搜索姓名" v-model="teamKeyword" @input="handleSearch" />
  335. <text v-if="teamKeyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
  336. </view>
  337. </view>
  338. <scroll-view class="modal-body" scroll-y="true">
  339. <!-- 有数据时显示列表 -->
  340. <view v-if="teamLeaderList.length > 0">
  341. <view
  342. v-for="(user, index) in teamLeaderList"
  343. :key="index"
  344. class="picker-option"
  345. :class="{ 'selected': index === selectedTeamLeaderIndex }"
  346. @click="selectLeaderManually(user, index)"
  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 v-if="index === selectedTeamLeaderIndex" class="option-check">✓</text>
  351. </view>
  352. </view>
  353. <!-- 无数据时显示提示 -->
  354. <view v-else class="empty-tip">
  355. <text>未找到匹配的人员</text>
  356. </view>
  357. </scroll-view>
  358. </view>
  359. </view>
  360. </scroll-view>
  361. <!-- 确认结单按钮 -->
  362. <view class="accept-button-container">
  363. <button class="accept-button" @click="handleSubmit" :loading="submitLoading">{{ submitLoading ? '提交中...' : '确认结单' }}</button>
  364. </view>
  365. <!-- 加载中状态 -->
  366. <view v-if="loading" class="loading-mask">
  367. <text class="loading-text">加载中...</text>
  368. </view>
  369. </view>
  370. </template>
  371. <script setup lang="uts">
  372. import { ref } from 'vue'
  373. import type { acceptOrderInfo } from '../../../types/order'
  374. import type { WorkOrderFlow } from '../../../types/flow'
  375. import { getOrderInfoById, getRepairOrderInfoById, returnRepairOrder, finishOrder } from '../../../api/order/detail'
  376. import { getMisInfoList, listWorkPerson, getOrderList, listAutoMisInfo } from '../../../api/order/list'
  377. import type { SysDictData } from '../../../types/dict'
  378. import { getDictDataByType } from '../../../api/dict/index'
  379. import type { UserInfo } from '../../../types/user'
  380. import type { UploadResponse } from '../../../types/workbench'
  381. import {checkPermi} from '../../../utils/storage'
  382. import { getUserList, getLeaderList } from '../../../api/user/list'
  383. import uploadImage from '../../../components/upload-image/upload-image.uvue'
  384. // 工单信息
  385. const orderId = ref<string>('')
  386. const workOrderProjectNo = ref<string>('')
  387. const workOrderStatus = ref<string>('')
  388. const orderType = ref<string>('')
  389. const pcsDeviceName = ref<string>('')
  390. const gxtCenter = ref<string>('')
  391. const pcsStationName = ref<string>('')
  392. const brand = ref<string>('')
  393. const model = ref<string>('')
  394. const acceptTime = ref<string>('')
  395. const returnType = ref<string>('')
  396. const returnReason = ref<string>("")
  397. const returnTypeLabel = ref<string>("")
  398. const acceptReturnType = ref<string>('')
  399. const acceptReturnReason = ref<string>("")
  400. const teamLeaderId = ref<Number | null>(null)
  401. const teamLeaderName = ref<string>('')
  402. const pauseTime = ref<string>('')
  403. const restartTime = ref<string>('')
  404. // 添加字典加载状态
  405. const dictLoaded = ref<boolean>(false)
  406. // 结单表单相关变量
  407. const infoEntry = ref<string>('') // 信息录入
  408. const misNo = ref<string>('') // MIS工单编码
  409. const workPermitNum = ref<string>('') // 工作票编号
  410. const realStartTime = ref<string>('') // 开始时间
  411. const realEndTime = ref<string>('') // 结束时间
  412. const wwryNum = ref<string>('') // 外委人员数
  413. const wlryNum = ref<string>('') // 外来人员数
  414. const workGroupMemberName = ref<string>('') // 工作班成员
  415. const content = ref<string>('') // 维保内容
  416. const attachmentUrls = ref<string>('') // 附件URLs(逗号分隔的字符串格式)
  417. const uploadedFiles = ref<UploadResponse[]>([]) // 上传的文件对象数组
  418. const workOrderPersonList = ref<UTSJSONObject[]>([]) // 工作班成员数组
  419. const selectedUserIds = ref<string[]>([]) // 选中的用户ID数组
  420. const selectedUsers = ref<UTSJSONObject[]>([]) // 选中的用户对象数组
  421. // 时间选择器相关变量
  422. const showStartTimePicker = ref<boolean>(false)
  423. const showEndTimePicker = ref<boolean>(false)
  424. const startTimeDate = ref<string>('')
  425. const startTimeTime = ref<string>('')
  426. const endTimeDate = ref<string>('')
  427. const endTimeTime = ref<string>('')
  428. // MIS工单选择相关变量
  429. const showMisNoQuickSelect = ref<boolean>(false)
  430. const quickMisNoList = ref<UTSJSONObject[]>([])
  431. // 添加MIS工单列表弹窗显示状态
  432. const showMisListModal = ref<boolean>(false)
  433. // MIS工单列表数据
  434. const misList = ref<UTSJSONObject[]>([])
  435. const allMisList = ref<UTSJSONObject[]>([])
  436. // 分页信息
  437. const misListPage = ref<number>(1)
  438. const misListPageSize = ref<number>(999)
  439. const misListTotal = ref<number>(0)
  440. // 搜索关键词
  441. const misListKeyword = ref<string>('')
  442. const userKeyword = ref<string>('')
  443. // 人员选择相关变量
  444. const showUserSelect = ref<boolean>(false)
  445. const userList = ref<UTSJSONObject[]>([])
  446. const userAllList = ref<UTSJSONObject[]>([])
  447. // 信息录入选项
  448. const infoEntryOptions = ref<SysDictData[]>([])
  449. const selectedMisInfoIndex = ref<number>(-1)
  450. // 选中的负责人信息
  451. const selectedTeamLeaderName = ref<string>('')
  452. const selectedTeamLeaderIndex = ref<number>(-1)
  453. const showLeaderPicker = ref<boolean>(false)
  454. const teamLeaderList = ref<UTSJSONObject[]>([])
  455. const teamAllLeaderList = ref<UTSJSONObject[]>([])
  456. let teamKeyword = ref<string>("")
  457. // 获取信息录入字典列表
  458. const loadInfoEntryDictList = async (): Promise<void> => {
  459. try {
  460. const result = await getDictDataByType('gxt_info_entry') // 假设信息录入类型字典类型为gxt_info_entry
  461. const resultObj = result as UTSJSONObject
  462. if (resultObj['code'] == 200) {
  463. const data = resultObj['data'] as any[]
  464. const dictData: SysDictData[] = []
  465. if (data.length > 0) {
  466. for (let i = 0; i < data.length; i++) {
  467. const item = data[i] as UTSJSONObject
  468. // 只提取需要的字段
  469. const dictItem: SysDictData = {
  470. dictValue: item['dictValue'] as string | null,
  471. dictLabel: item['dictLabel'] as string | null,
  472. dictCode: null,
  473. dictSort: null,
  474. dictType: null,
  475. cssClass: null,
  476. listClass: null,
  477. isDefault: null,
  478. status: null,
  479. default: null,
  480. createTime: null,
  481. remark: null
  482. }
  483. dictData.push(dictItem)
  484. }
  485. }
  486. infoEntryOptions.value = dictData
  487. }
  488. } catch (e: any) {
  489. console.error('获取信息录入类型字典失败:', e.message)
  490. // 设置默认值
  491. infoEntryOptions.value = [
  492. { dictValue: '1', dictLabel: 'MIS工单', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null },
  493. { dictValue: '2', dictLabel: '手工录入', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null }
  494. ];
  495. }
  496. }
  497. // 获取用户列表
  498. const getUserAllList = async (): Promise<void> => {
  499. try {
  500. // 这里应该调用获取用户列表的API
  501. const result = await getLeaderList(-1); // 空参数调用
  502. const resultObj = result as UTSJSONObject;
  503. const code = resultObj['code'] as number
  504. const users = resultObj['data'] as UTSJSONObject[] | null
  505. if (code == 200 && users != null ) {
  506. // 解析列表数据
  507. // const rows = resultObj['rows'] as UTSJSONObject[]
  508. userList.value = users;
  509. userAllList.value = users
  510. teamLeaderList.value = users
  511. teamAllLeaderList.value = users
  512. // userList.value = result.data || [];
  513. }
  514. } catch (error) {
  515. console.error('获取用户列表失败:', error);
  516. uni.showToast({
  517. title: '获取用户列表失败',
  518. icon: 'none'
  519. });
  520. }
  521. };
  522. // 验证和提交
  523. const submitLoading = ref<boolean>(false)
  524. // 信息录入禁用状态
  525. const infoEntryDisabled = ref<boolean>(false)
  526. // 接受用户名
  527. const acceptUserName = ref<string>('')
  528. // 选择器选项类型
  529. type PickerOption = {
  530. label: string
  531. value: string
  532. }
  533. // 选中的挂起原因
  534. const selectedReasonIndex = ref<number>(-1)
  535. const returnTypeOptions = ref<PickerOption[]>([])
  536. const showReasonPicker = ref<boolean>(false)
  537. // 获取负责人列表(使用用户列表接口)
  538. const dictList = async (): Promise<void> => {
  539. try {
  540. const dictString = ref("")
  541. if(workOrderStatus.value != 'to_finish') {
  542. dictString.value = "gxt_accept_return_type"
  543. } else {
  544. dictString.value = "gxt_return_type"
  545. }
  546. const result = await getDictDataByType(dictString.value)
  547. const resultObj = result as UTSJSONObject
  548. if (resultObj['code'] == 200) {
  549. const data = resultObj['data'] as any[]
  550. const options: PickerOption[] = []
  551. if (data.length > 0) {
  552. for (let i = 0; i < data.length; i++) {
  553. const item = data[i] as UTSJSONObject
  554. let dictItem: SysDictData = {
  555. dictValue: item['dictValue'] as string | null,
  556. dictLabel: item['dictLabel'] as string | null,
  557. dictCode: null,
  558. dictSort: null,
  559. dictType: null,
  560. cssClass: null,
  561. listClass: null,
  562. isDefault: null,
  563. status: null,
  564. default: null,
  565. createTime: null,
  566. remark: null
  567. }
  568. // 构建选择器选项
  569. options.push({
  570. label: dictItem.dictLabel ?? '',
  571. value: dictItem.dictValue ?? ''
  572. })
  573. }
  574. }
  575. returnTypeOptions.value = options
  576. }
  577. } catch (e: any) {
  578. console.error('获取挂起原因失败:', e.message)
  579. }
  580. }
  581. // 手动选择负责人
  582. const selectLeaderManually = (user: UTSJSONObject, index: number): void => {
  583. selectedTeamLeaderIndex.value = index
  584. const uid = user['userId']
  585. if (uid != null) {
  586. teamLeaderId.value = uid as Number
  587. }
  588. const name = user['nickName']
  589. teamLeaderName.value = name != null ? name.toString() : ''
  590. showLeaderPicker.value = false
  591. }
  592. // 信息录入变化处理
  593. const handleInfoEntryChange = (e: UniRadioGroupChangeEvent): void => {
  594. // 兼容 radio-group 事件:detail 可能不存在,直接取 e.value
  595. const val = e.detail?.value as string | null
  596. infoEntry.value = val ?? ''
  597. if (infoEntry.value == '1') {
  598. // 当选择MIS工单时,清空手工录入的字段
  599. workPermitNum.value = '';
  600. realStartTime.value = '';
  601. realEndTime.value = '';
  602. workGroupMemberName.value = '';
  603. }
  604. };
  605. // MIS工单编码输入处理
  606. const handleMisNoInputFocus = (): void => {
  607. showMisNoQuickSelect.value = true;
  608. };
  609. const handleMisNoInputBlur = (): void => {
  610. setTimeout(() => {
  611. showMisNoQuickSelect.value = false;
  612. }, 200);
  613. };
  614. const handleMisNoInput = (e: SysDictData): void => {
  615. // misNo.value = (e['detail'] as string | null) ?? '';
  616. // 这里可以添加实时搜索MIS工单的逻辑
  617. };
  618. const handleMisNoClear = (): void => {
  619. misNo.value = '';
  620. showMisNoQuickSelect.value = false;
  621. };
  622. const handleMisNoQuickSelect = (item: UTSJSONObject): void => {
  623. misNo.value = (item['misNo'] as string | null) ?? '';
  624. showMisNoQuickSelect.value = false;
  625. };
  626. // 获取MIS工单列表
  627. const getMisList = async (): Promise<void> => {
  628. try {
  629. const queryParams = {
  630. pcsDeviceName: pcsDeviceName.value,
  631. pcsStationName: pcsStationName.value,
  632. workOrderStatus: '结束'
  633. } as UTSJSONObject;
  634. // 调用获取MIS工单列表的API
  635. const result = await getMisInfoList(queryParams);
  636. const resultObj = result as UTSJSONObject;
  637. if (resultObj['code'] == 200) {
  638. // 解析列表数据
  639. const rows = resultObj['rows'] as UTSJSONObject[]
  640. misList.value = rows;
  641. allMisList.value = rows
  642. // 解析总数
  643. misListTotal.value = resultObj['total'] as number;
  644. } else {
  645. const msg = resultObj['msg'] as string | null
  646. uni.showToast({
  647. title: msg ?? '获取MIS工单列表失败',
  648. icon: 'none'
  649. })
  650. }
  651. } catch (error: any) {
  652. console.error('获取MIS工单列表失败:', error);
  653. uni.showToast({
  654. title: error.message ?? '获取MIS工单列表失败',
  655. icon: 'none'
  656. });
  657. }
  658. };
  659. // 打开MIS工单选择弹窗
  660. const openMisListModal = (): void => {
  661. showMisListModal.value = true;
  662. misListPage.value = 1; // 重置为第一页
  663. getMisList(); // 获取列表数据
  664. };
  665. // 选择MIS工单
  666. const selectMisItem = async (item: UTSJSONObject, index: number): Promise<void> => {
  667. selectedMisInfoIndex.value = index
  668. // 回填MIS工单相关信息
  669. misNo.value = item['misNo'] as string | '';
  670. // 查询MIS工单是否已存在
  671. const response = await getOrderList(1, 10, misNo.value, '')
  672. const responseObj = response as UTSJSONObject
  673. const rows = responseObj['rows'] as UTSJSONObject[] | null
  674. if (rows != null && rows.length > 0) {
  675. uni.showToast({ title: 'MIS工单:' + misNo.value + '已存在', icon: 'none' })
  676. misNo.value = ''
  677. return
  678. }
  679. // 查询相关工作班成员
  680. await listWorkPerson(misNo.value).then(response => {
  681. const responseObj = response as UTSJSONObject
  682. const rows = responseObj['rows'] as UTSJSONObject[] | null
  683. workOrderPersonList.value = rows ?? []
  684. if (rows != null && rows.length > 0) {
  685. // 查找 isLeader 等于 1 的负责人(优先获取第一个符合条件的,贴合常规单负责人场景)
  686. const leaderPerson = rows.find(person => person.isLeader == 1);
  687. if(leaderPerson != null) {
  688. teamLeaderId.value = (leaderPerson['userId'] as Number | null) ?? null
  689. teamLeaderName.value = (leaderPerson['nickName'] as string | null) ?? ''
  690. }
  691. const nickNames = rows
  692. .filter(person => person.isLeader != 1)
  693. .map(person => (person.nickName as string | null) ?? '')
  694. .join(',');
  695. workGroupMemberName.value = nickNames;
  696. }
  697. })
  698. workPermitNum.value = item['workPermitNum'] as string | '';
  699. realStartTime.value = item['realStartTime'] as string | '';
  700. realEndTime.value = item['realEndTime'] as string | '';
  701. // 关闭弹窗
  702. showMisListModal.value = false;
  703. };
  704. // 搜索
  705. const handleUserSearch = (): void => {
  706. const keyword = userKeyword.value
  707. userList.value = userAllList.value.filter(leader => {
  708. const nickName = leader['nickName'] as string | null
  709. return nickName != null && nickName.indexOf(keyword) >= 0
  710. })
  711. }
  712. // 关闭MIS工单选择弹窗
  713. const closeMisListModal = (): void => {
  714. showMisListModal.value = false;
  715. };
  716. // 搜索
  717. const searchMisList = (): void => {
  718. const keyword = misListKeyword.value
  719. misList.value = allMisList.value.filter(misInfo => {
  720. const misNo = misInfo['misNo'] as string | null
  721. // return misNo != null && misNo.indexOf(keyword) >= 0
  722. const workPermitNum = misInfo['workPermitNum'] as string | null
  723. // 逻辑或(||)连接两个条件,满足其一即可
  724. const misNoMatch = misNo != null && misNo.indexOf(keyword) >= 0
  725. const workPermitNumMatch = workPermitNum != null && workPermitNum.indexOf(keyword) >= 0
  726. return misNoMatch || workPermitNumMatch
  727. })
  728. }
  729. // 清除MIS工单搜索
  730. const clearMisListSearch = (): void => {
  731. misListKeyword.value = "";
  732. misList.value = allMisList.value
  733. };
  734. // 清除用户搜索
  735. const clearUserSearch = (): void => {
  736. userKeyword.value = "";
  737. userList.value = userAllList.value
  738. };
  739. // 搜索工作负责人
  740. const handleSearch = (): void => {
  741. const keyword = teamKeyword.value
  742. teamLeaderList.value = teamAllLeaderList.value.filter(leader => {
  743. const nickName = leader['nickName'] as string | null
  744. return nickName != null && nickName.indexOf(keyword) >= 0
  745. })
  746. }
  747. // 清空搜索工作负责人
  748. const clearSearch = (): void => {
  749. teamKeyword.value = ""
  750. teamLeaderList.value = teamAllLeaderList.value
  751. }
  752. function onStartDateConfirm(value: string) {
  753. // 检查结束时间是否小于新的开始时间
  754. if (realEndTime.value != '' && new Date(value) > new Date(realEndTime.value as string)) {
  755. uni.showToast({ title: '开始时间不能大于结束时间', icon: 'none' })
  756. return
  757. }
  758. realStartTime.value = value
  759. showStartTimePicker.value = false
  760. }
  761. function onEndDateConfirm(value: string) {
  762. // 检查新的结束时间是否小于开始时间
  763. if (realStartTime.value != '' && new Date(realStartTime.value as string) > new Date(value)) {
  764. uni.showToast({ title: '结束时间不能小于开始时间', icon: 'none' })
  765. return
  766. }
  767. realEndTime.value = value
  768. showEndTimePicker.value = false
  769. }
  770. // 检查用户是否已被选中
  771. const isSelected = (user: UTSJSONObject): boolean => {
  772. const userId = user['userId'] as string | number | null;
  773. if (userId !== null) {
  774. return selectedUserIds.value.includes(userId.toString());
  775. }
  776. // 如果没有userId,则比较nickName
  777. const nickName = user['nickName'] as string | null;
  778. if (nickName !== null) {
  779. return selectedUsers.value.some(selected =>
  780. (selected['nickName'] as string | null) === nickName
  781. );
  782. }
  783. return false;
  784. };
  785. // 切换用户选择状态
  786. const toggleUserSelection = (user: UTSJSONObject): void => {
  787. const userId = user['userId'] as string | number | null;
  788. const nickName = user['nickName'] as string | null;
  789. if (userId !== null) {
  790. const userIdStr = userId.toString();
  791. const index = selectedUserIds.value.indexOf(userIdStr);
  792. if (index > -1) {
  793. // 取消选择
  794. selectedUserIds.value.splice(index, 1);
  795. selectedUsers.value = selectedUsers.value.filter(selected =>
  796. (selected['userId'] as string | number | null)?.toString() !== userIdStr
  797. );
  798. } else {
  799. // 添加选择
  800. selectedUserIds.value.push(userIdStr);
  801. selectedUsers.value.push(user);
  802. }
  803. } else if (nickName !== null) {
  804. // 如果没有userId,通过nickName来识别
  805. const index = selectedUsers.value.findIndex(selected =>
  806. (selected['nickName'] as string | null) === nickName
  807. );
  808. if (index > -1) {
  809. // 取消选择
  810. selectedUsers.value.splice(index, 1);
  811. // 同时移除对应的userId(如果有的话)
  812. const userToRemoveId = user['userId'] as string | number | null;
  813. if (userToRemoveId !== null) {
  814. const idIndex = selectedUserIds.value.indexOf(userToRemoveId.toString());
  815. if (idIndex > -1) {
  816. selectedUserIds.value.splice(idIndex, 1);
  817. }
  818. }
  819. } else {
  820. // 添加选择
  821. selectedUsers.value.push(user);
  822. const userToAddId = user['userId'] as string | number | null;
  823. if (userToAddId !== null) {
  824. selectedUserIds.value.push(userToAddId.toString());
  825. }
  826. }
  827. }
  828. };
  829. // 确认选择的用户
  830. const confirmSelectedUsers = (): void => {
  831. // 将选中的用户姓名拼接成字符串
  832. const nickNames = selectedUsers.value
  833. .map(user => (user['nickName'] as string | null) ?? '')
  834. .filter(name => name !== '')
  835. .join(',');
  836. workGroupMemberName.value = nickNames;
  837. // 更新workOrderPersonList为选中的用户
  838. workOrderPersonList.value = [...selectedUsers.value];
  839. showUserSelect.value = false;
  840. };
  841. // 清空已选择的用户
  842. const clearSelectedUsers = (): void => {
  843. // 清空选中的用户数组
  844. selectedUsers.value = [];
  845. selectedUserIds.value = [];
  846. // 清空显示的用户名
  847. workGroupMemberName.value = '';
  848. // 清空工作班成员列表
  849. workOrderPersonList.value = [];
  850. };
  851. // 表单验证
  852. const validateForm = (): boolean => {
  853. if (infoEntry.value == '') {
  854. uni.showToast({
  855. title: '请选择信息录入方式',
  856. icon: 'none'
  857. });
  858. return false;
  859. }
  860. if (infoEntry.value == '1' && (misNo.value == '')) {
  861. uni.showToast({
  862. title: '请输入MIS工单编码',
  863. icon: 'none'
  864. });
  865. return false;
  866. }
  867. if (workPermitNum.value == '') {
  868. uni.showToast({
  869. title: '请输入工作票编号',
  870. icon: 'none'
  871. });
  872. return false;
  873. }
  874. if (realStartTime.value == '') {
  875. uni.showToast({
  876. title: '请选择开始时间',
  877. icon: 'none'
  878. });
  879. return false;
  880. }
  881. if (realEndTime.value == '') {
  882. uni.showToast({
  883. title: '请选择结束时间',
  884. icon: 'none'
  885. });
  886. return false;
  887. }
  888. if (new Date(realEndTime.value) <= new Date(realStartTime.value)) {
  889. uni.showToast({
  890. title: '结束时间必须大于开始时间',
  891. icon: 'none'
  892. });
  893. return false;
  894. }
  895. if (teamLeaderName.value == '') {
  896. uni.showToast({
  897. title: '请选择工作负责人',
  898. icon: 'none'
  899. });
  900. return false;
  901. }
  902. if (workGroupMemberName.value == '') {
  903. uni.showToast({
  904. title: '请选择工作班成员',
  905. icon: 'none'
  906. });
  907. return false;
  908. }
  909. // if (infoEntry.value == '2' && (workGroupMemberName.value == '' || selectedUsers.value.length == 0)) {
  910. // uni.showToast({
  911. // title: '请选择工作班成员',
  912. // icon: 'none'
  913. // });
  914. // return false;
  915. // }
  916. return true;
  917. };
  918. const isDealing = ref(false)
  919. const hasDealed = ref(false)
  920. // 提交表单
  921. const handleSubmit = async (): Promise<void> => {
  922. if (!validateForm()) {
  923. return;
  924. }
  925. submitLoading.value = true;
  926. try {
  927. if (isDealing.value || hasDealed.value) return // 双重保险
  928. isDealing.value = true
  929. // 确保附件URLs是最新的逗号分隔格式
  930. attachmentUrls.value = uploadedFiles.value.map(file => file.fileName).join(',');
  931. const finishData = {
  932. id: orderId.value,
  933. orderType: orderType.value,
  934. workOrderProjectNo: workOrderProjectNo.value,
  935. infoEntry: infoEntry.value,
  936. misNo: infoEntry.value == '1' ? misNo.value : null,
  937. workPermitNum: workPermitNum.value,
  938. realStartTime: realStartTime.value,
  939. realEndTime: realEndTime.value,
  940. wwryNum: wwryNum.value,
  941. wlryNum: wlryNum.value,
  942. workGroupMemberName: workGroupMemberName.value,
  943. content: content.value,
  944. attachmentUrls: attachmentUrls.value,
  945. workOrderPersonList: workOrderPersonList.value,
  946. teamLeaderId: teamLeaderId.value,
  947. teamLeaderName: teamLeaderName.value,
  948. finalizeMethod: '2',
  949. workOrderStatus: 'completed'
  950. } as UTSJSONObject;
  951. const result = await finishOrder(finishData);
  952. const resultObj = result as UTSJSONObject;
  953. const code = resultObj['code'] as number;
  954. if (code == 200) {
  955. uni.showToast({
  956. title: '结单成功',
  957. icon: 'success'
  958. });
  959. hasDealed.value = true
  960. // 使用事件总线通知列表页面刷新
  961. uni.$emit('refreshOrderList', {});
  962. uni.$emit('refreshAssignedCount');
  963. uni.$emit('refreshOverdueCount');
  964. setTimeout(() => {
  965. uni.navigateBack();
  966. }, 800);
  967. } else {
  968. const msg = resultObj['msg'] as string;
  969. uni.showToast({
  970. title: msg.length > 0 ? msg : '结单失败',
  971. icon: 'none'
  972. });
  973. }
  974. } catch (error: any) {
  975. console.error('结单失败:', error);
  976. uni.showToast({
  977. title: '结单失败',
  978. icon: 'none'
  979. });
  980. } finally {
  981. submitLoading.value = false;
  982. isDealing.value = false // 无论成功失败都解锁
  983. }
  984. };
  985. const loading = ref<boolean>(false)
  986. // 加载详情数据
  987. const loadDetail = async (id: string, orderType?: string): Promise<void> => {
  988. try {
  989. loading.value = true
  990. let result: any;
  991. // 根据orderType决定调用哪个API
  992. if (orderType == '1') {
  993. // 维修工单
  994. result = await getRepairOrderInfoById(id)
  995. } else {
  996. // 维保工单
  997. result = await getOrderInfoById(id)
  998. }
  999. // 提取响应数据
  1000. const resultObj = result as UTSJSONObject
  1001. const code = resultObj['code'] as number
  1002. const data = resultObj['data'] as UTSJSONObject | null
  1003. if (code == 200 && data != null) {
  1004. workOrderStatus.value = (data['workOrderStatus'] as string | null) ?? ''
  1005. workOrderProjectNo.value = (data['workOrderProjectNo'] as string | null) ?? ''
  1006. pcsDeviceName.value = (data['pcsDeviceName'] as string | null) ?? ''
  1007. gxtCenter.value = (data['gxtCenter'] as string | null) ?? ''
  1008. pcsStationName.value = (data['pcsStationName'] as string | null) ?? ''
  1009. brand.value = (data['brand'] as string | null) ?? ''
  1010. model.value = (data['model'] as string | null) ?? ''
  1011. acceptTime.value = (data['acceptTime'] as string | null) ?? ''
  1012. acceptUserName.value = (data['acceptUserName'] as string | null) ?? ''
  1013. // 初始化结单表单默认值
  1014. infoEntry.value = '1' // 默认为手工录入
  1015. teamLeaderId.value = (data['teamLeaderId'] as Number | null) ?? null
  1016. teamLeaderName.value = (data['teamLeaderName'] as string | null) ?? ''
  1017. returnType.value = workOrderStatus.value == 'to_finish' ? '1' : ''
  1018. content.value = (data['content'] as string | null) ?? ''
  1019. // 初始化附件数据
  1020. const attachmentUrlsFromServer = (data['attachmentUrls'] as string | null) ?? ''
  1021. if (attachmentUrlsFromServer.length > 0) {
  1022. attachmentUrls.value = attachmentUrlsFromServer
  1023. // 将逗号分隔的URL字符串转换为UploadResponse对象数组
  1024. const urls = attachmentUrlsFromServer.split(',')
  1025. const fileArr : UploadResponse[] = []
  1026. for (let i = 0; i < urls.length; i++) {
  1027. const url = urls[i]
  1028. const item : UploadResponse = {
  1029. url: url,
  1030. fileId: '',
  1031. fileName: url.substring(url.lastIndexOf('/') + 1),
  1032. filePath: url,
  1033. fileSize: 0,
  1034. fileExt: url.substring(url.lastIndexOf('.') + 1),
  1035. businessType: 'workOrder'
  1036. }
  1037. fileArr.push(item)
  1038. }
  1039. uploadedFiles.value = fileArr
  1040. }
  1041. pauseTime.value = (data['pauseTime'] as string | null) ?? ''
  1042. restartTime.value = (data['restartTime'] as string | null) ?? ''
  1043. if(pauseTime.value != '' && restartTime.value != '') {
  1044. const queryParams = {
  1045. pauseTime: pauseTime.value,
  1046. restartTime: restartTime.value,
  1047. pcsDeviceName: pcsDeviceName.value,
  1048. pcsStationName: pcsStationName.value,
  1049. workOrderStatus: '结束'
  1050. } as UTSJSONObject;
  1051. const result = await listAutoMisInfo(queryParams)
  1052. // 提取响应数据
  1053. const resultObj = result as UTSJSONObject
  1054. const code = resultObj['code'] as number
  1055. const misInfo = resultObj['rows'] as UTSJSONObject[] | null
  1056. if (code == 200 && misInfo != null) {
  1057. if(misInfo.length > 0 && misInfo.length == 1) {
  1058. // 有工作票号提示
  1059. const workPermitNum2 = misInfo[0]['workPermitNum'] as string | null
  1060. const misNo2 = misInfo[0]['misNo'] as string | null
  1061. if (workPermitNum2 != null && workPermitNum2.length > 0) {
  1062. const response = await getOrderList(1, 10, misNo2 ?? '', '')
  1063. const responseObj = response as UTSJSONObject
  1064. const rows = responseObj['rows'] as UTSJSONObject[] | null
  1065. if (rows != null && rows.length > 0) {
  1066. misNo.value = ''
  1067. // infoEntry.value = '2'
  1068. uni.showToast({
  1069. title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
  1070. icon: 'none'
  1071. });
  1072. return
  1073. } else {
  1074. misNo.value = (misInfo[0]['misNo'] as string | null) ?? ''
  1075. realStartTime.value = (misInfo[0]['realStartTime'] as string | null) ?? ''
  1076. realEndTime.value = (misInfo[0]['realEndTime'] as string | null) ?? ''
  1077. workPermitNum.value = (misInfo[0]['workPermitNum'] as string | null) ?? ''
  1078. // 查询相关工作班成员
  1079. await listWorkPerson(misNo.value).then(response => {
  1080. const responseObj = response as UTSJSONObject
  1081. const rows = responseObj['rows'] as UTSJSONObject[] | null
  1082. workOrderPersonList.value = rows ?? []
  1083. if (rows != null && rows.length > 0) {
  1084. // 查询负责人信息并回填
  1085. for (const person of workOrderPersonList.value) {
  1086. // 严格判断isLeader为1(兼容数字/字符串类型)
  1087. if (person.isLeader == 1) {
  1088. teamLeaderId.value = (person.userId as Number | null) ?? null;
  1089. teamLeaderName.value = (person.nickName as string | null) ?? '';
  1090. break; // 找到后立即停止循环
  1091. }
  1092. }
  1093. const nickNames = rows
  1094. .filter(person => person.isLeader != 1)
  1095. .map(person => (person.nickName as string | null) ?? '')
  1096. .join(',');
  1097. workGroupMemberName.value = nickNames;
  1098. }
  1099. })
  1100. }
  1101. } else {
  1102. misNo.value = ''
  1103. // infoEntry.value = '2'
  1104. uni.showToast({
  1105. title: '已匹配到MIS工单,但未关联工作票号,系统无法自动结单,请进入工作票录入方式。',
  1106. icon: 'none'
  1107. });
  1108. return
  1109. }
  1110. } else if(misInfo.length == 0) {
  1111. misNo.value = ''
  1112. // infoEntry.value = '2'
  1113. uni.showToast({
  1114. title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
  1115. icon: 'none'
  1116. });
  1117. return
  1118. } else if(misInfo.length > 1) {
  1119. infoEntryDisabled.value = false
  1120. }
  1121. }
  1122. } else {
  1123. infoEntryDisabled.value = true
  1124. misNo.value = ''
  1125. // infoEntry.value = '2'
  1126. uni.showToast({
  1127. title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
  1128. icon: 'none'
  1129. });
  1130. }
  1131. // await dictList()
  1132. if (returnTypeOptions.value.length > 0 && workOrderStatus.value == 'to_finish') {
  1133. // returnTypeLabel.value = returnTypeOptions.value[0].label
  1134. // 循环匹配
  1135. for (const option of returnTypeOptions.value) {
  1136. // 严格匹配value
  1137. if (returnType.value == option.value) {
  1138. returnTypeLabel.value = option.label;
  1139. break; // 匹配成功后跳出循环,提升性能
  1140. }
  1141. }
  1142. }
  1143. } else {
  1144. const msg = resultObj['msg'] as string | null
  1145. uni.showToast({
  1146. title: msg ?? '加载失败',
  1147. icon: 'none'
  1148. })
  1149. }
  1150. } catch (e: any) {
  1151. uni.showToast({
  1152. title: e.message ?? '加载失败',
  1153. icon: 'none'
  1154. })
  1155. } finally {
  1156. loading.value = false
  1157. }
  1158. }
  1159. // 页面加载
  1160. onLoad((options: any) => {
  1161. const params = options as UTSJSONObject
  1162. const id = params['id'] as string | null
  1163. const orderTypeParam = params['orderType'] as string | null
  1164. if (id != null && orderTypeParam != null) {
  1165. // 先尝试从参数中获取orderType
  1166. // const orderTypeNumber = parseInt(orderTypeParam)
  1167. orderType.value = orderTypeParam
  1168. orderId.value = id
  1169. loadDetail(id, orderTypeParam)
  1170. }
  1171. })
  1172. // 初始化
  1173. onMounted(() => {
  1174. getUserAllList();
  1175. loadInfoEntryDictList();
  1176. })
  1177. </script>
  1178. <style lang="scss">
  1179. .detail-page {
  1180. flex: 1;
  1181. background-color: #e8f0f9;
  1182. }
  1183. .detail-content {
  1184. flex: 1;
  1185. padding: 20rpx 0;
  1186. }
  1187. .info-section {
  1188. margin: 0 30rpx 24rpx;
  1189. .section-title {
  1190. position: relative;
  1191. padding-left: 20rpx;
  1192. margin-bottom: 20rpx;
  1193. &::before {
  1194. // content: '';
  1195. position: absolute;
  1196. left: 0;
  1197. top: 50%;
  1198. transform: translateY(-50%);
  1199. width: 8rpx;
  1200. height: 32rpx;
  1201. background-color: #007aff;
  1202. border-radius: 4rpx;
  1203. }
  1204. &-text {
  1205. font-size: 32rpx;
  1206. font-weight: bold;
  1207. color: #333333;
  1208. }
  1209. }
  1210. .info-card {
  1211. background-color: #ffffff;
  1212. border-radius: 16rpx;
  1213. padding: 30rpx;
  1214. .info-item {
  1215. flex-direction: row;
  1216. padding: 20rpx 0;
  1217. border-bottom: 1rpx solid #f0f0f0;
  1218. &:last-child {
  1219. border-bottom: none;
  1220. }
  1221. &.full-width {
  1222. flex-direction: column;
  1223. .info-label {
  1224. margin-bottom: 12rpx;
  1225. }
  1226. .info-value {
  1227. line-height: 44rpx;
  1228. }
  1229. }
  1230. .info-label {
  1231. width: 240rpx;
  1232. font-size: 28rpx;
  1233. color: #666666;
  1234. white-space: nowrap;
  1235. }
  1236. .info-value {
  1237. flex: 1;
  1238. font-size: 28rpx;
  1239. color: #333333;
  1240. text-align: right;
  1241. &.highlight {
  1242. color: #007aff;
  1243. font-weight: bold;
  1244. }
  1245. &.input {
  1246. text-align: left;
  1247. border: 1rpx solid #e0e0e0;
  1248. border-radius: 8rpx;
  1249. padding: 10rpx;
  1250. }
  1251. .input-with-clear {
  1252. position: relative;
  1253. display: flex;
  1254. align-items: center;
  1255. }
  1256. .select-clear {
  1257. position: absolute;
  1258. right: 20rpx;
  1259. color: #ccc;
  1260. text-align: center;
  1261. font-size: 40rpx;
  1262. font-weight: bold;
  1263. z-index: 1;
  1264. }
  1265. .input-with-select {
  1266. position: relative;
  1267. display: flex;
  1268. align-items: center;
  1269. }
  1270. .select-mis-btn {
  1271. line-height: 50rpx;
  1272. text-align: center;
  1273. position: absolute;
  1274. right: 0rpx;
  1275. padding: 6rpx 12rpx;
  1276. background-color: #007aff;
  1277. color: #fff;
  1278. border-radius: 6rpx;
  1279. font-size: 26rpx;
  1280. z-index: 1;
  1281. max-width: 100rpx;
  1282. overflow: hidden;
  1283. text-overflow: ellipsis;
  1284. white-space: nowrap;
  1285. }
  1286. }
  1287. }
  1288. .flow-item {
  1289. padding: 20rpx 0;
  1290. border-bottom: 1rpx solid #f0f0f0;
  1291. &:last-child {
  1292. border-bottom: none;
  1293. }
  1294. .flow-header {
  1295. flex-direction: row;
  1296. justify-content: space-between;
  1297. margin-bottom: 10rpx;
  1298. .flow-operator {
  1299. font-size: 28rpx;
  1300. color: #333333;
  1301. font-weight: bold;
  1302. }
  1303. .flow-time {
  1304. font-size: 24rpx;
  1305. color: #999999;
  1306. }
  1307. }
  1308. .flow-content {
  1309. flex-direction: column;
  1310. .flow-action {
  1311. font-size: 26rpx;
  1312. color: #666666;
  1313. margin-bottom: 8rpx;
  1314. }
  1315. .flow-remark {
  1316. font-size: 24rpx;
  1317. color: #999999;
  1318. background-color: #f5f5f5;
  1319. padding: 10rpx;
  1320. border-radius: 8rpx;
  1321. }
  1322. }
  1323. }
  1324. .no-data {
  1325. text-align: center;
  1326. padding: 40rpx 0;
  1327. font-size: 28rpx;
  1328. color: #999999;
  1329. }
  1330. }
  1331. }
  1332. .accept-button-container {
  1333. padding: 30rpx 30rpx 50rpx;
  1334. background-color: #ffffff;
  1335. .accept-button {
  1336. width: 100%;
  1337. height: 80rpx;
  1338. background-color: #007aff;
  1339. color: #ffffff;
  1340. font-size: 32rpx;
  1341. border-radius: 16rpx;
  1342. border: none;
  1343. &:active {
  1344. background-color: #0062cc;
  1345. }
  1346. }
  1347. }
  1348. .loading-mask {
  1349. position: absolute;
  1350. top: 0;
  1351. left: 0;
  1352. right: 0;
  1353. bottom: 0;
  1354. justify-content: center;
  1355. align-items: center;
  1356. background-color: rgba(0, 0, 0, 0.3);
  1357. .loading-text {
  1358. padding: 30rpx 60rpx;
  1359. background-color: rgba(0, 0, 0, 0.7);
  1360. color: #ffffff;
  1361. font-size: 28rpx;
  1362. border-radius: 12rpx;
  1363. }
  1364. }
  1365. .picker-modal {
  1366. position: fixed;
  1367. top: 0;
  1368. left: 0;
  1369. right: 0;
  1370. bottom: 0;
  1371. z-index: 1000;
  1372. }
  1373. .modal-mask {
  1374. position: absolute;
  1375. top: 0;
  1376. left: 0;
  1377. right: 0;
  1378. bottom: 0;
  1379. background-color: rgba(0, 0, 0, 0.5);
  1380. }
  1381. .modal-content {
  1382. position: absolute;
  1383. bottom: 0;
  1384. left: 0;
  1385. right: 0;
  1386. background-color: #ffffff;
  1387. border-top-left-radius: 16rpx;
  1388. border-top-right-radius: 16rpx;
  1389. min-height: 700rpx;
  1390. }
  1391. .modal-header {
  1392. flex-direction: row;
  1393. justify-content: space-between;
  1394. align-items: center;
  1395. padding: 30rpx;
  1396. border-bottom: 1rpx solid #f0f0f0;
  1397. }
  1398. .modal-title {
  1399. font-size: 32rpx;
  1400. font-weight: bold;
  1401. color: #333333;
  1402. }
  1403. .modal-close {
  1404. font-size: 28rpx;
  1405. color: #007aff;
  1406. }
  1407. .modal-body {
  1408. max-height: 800rpx;
  1409. min-height: 800rpx;
  1410. }
  1411. .picker-option {
  1412. flex-direction: row;
  1413. justify-content: space-between;
  1414. align-items: center;
  1415. padding: 24rpx 30rpx;
  1416. border-bottom: 1rpx solid #f0f0f0;
  1417. }
  1418. .picker-option.selected {
  1419. background-color: #f8f9fa;
  1420. }
  1421. .picker-option:last-child {
  1422. border-bottom: none;
  1423. }
  1424. .option-text {
  1425. font-size: 28rpx;
  1426. color: #333333;
  1427. margin-bottom: 10rpx;
  1428. }
  1429. .option-text:last-child {
  1430. margin-bottom: 0;
  1431. }
  1432. .option-check {
  1433. font-size: 28rpx;
  1434. color: #007aff;
  1435. }
  1436. .empty-tip {
  1437. justify-content: space-between;
  1438. padding: 24rpx 30rpx;
  1439. display: flex;
  1440. align-items: center;
  1441. justify-content: center;
  1442. color: #999;
  1443. }
  1444. .picker-option {
  1445. flex-direction: row;
  1446. justify-content: space-between;
  1447. align-items: center;
  1448. padding: 24rpx 30rpx;
  1449. border-bottom: 1rpx solid #f0f0f0;
  1450. }
  1451. .picker-option:last-child {
  1452. border-bottom: none;
  1453. }
  1454. .picker-option.selected {
  1455. background-color: #f8f9fa;
  1456. }
  1457. .option-text {
  1458. font-size: 28rpx;
  1459. color: #333333;
  1460. }
  1461. .mis-list {
  1462. flex: 1;
  1463. height: 100%;
  1464. display: flex;
  1465. flex-direction: column;
  1466. }
  1467. .empty-tip {
  1468. text-align: center;
  1469. padding: 40rpx;
  1470. color: #999;
  1471. font-size: 28rpx;
  1472. }
  1473. .form-item {
  1474. flex-direction: row;
  1475. padding: 20rpx 0;
  1476. border-bottom: 1rpx solid #f0f0f0;
  1477. }
  1478. .reject-reason-textarea {
  1479. width: 100%;
  1480. min-height: 100rpx;
  1481. line-height: 1.5;
  1482. }
  1483. .input-field {
  1484. width: 100%;
  1485. height: 60rpx;
  1486. padding: 0 20rpx;
  1487. border: 1rpx solid #e0e0e0;
  1488. border-radius: 8rpx;
  1489. font-size: 28rpx;
  1490. background-color: #f8f9fa;
  1491. }
  1492. .select-mis-btn {
  1493. width: 150rpx;
  1494. height: 60rpx;
  1495. margin-left: 10rpx;
  1496. background-color: #007aff;
  1497. color: #fff;
  1498. border: none;
  1499. border-radius: 8rpx;
  1500. font-size: 24rpx;
  1501. }
  1502. .textarea-field {
  1503. width: 100%;
  1504. min-height: 120rpx;
  1505. padding: 20rpx;
  1506. border: 1rpx solid #e0e0e0;
  1507. border-radius: 8rpx;
  1508. font-size: 28rpx;
  1509. background-color: #f8f9fa;
  1510. }
  1511. .radio-label {
  1512. display: flex;
  1513. align-items: center;
  1514. margin-right: 30rpx;
  1515. }
  1516. .quick-select-dropdown {
  1517. position: absolute;
  1518. top: 100%;
  1519. left: 0;
  1520. right: 0;
  1521. background: #fff;
  1522. border: 1rpx solid #ddd;
  1523. border-top: none;
  1524. z-index: 1000;
  1525. max-height: 300rpx;
  1526. }
  1527. .quick-select-item {
  1528. padding: 20rpx;
  1529. border-bottom: 1rpx solid #eee;
  1530. }
  1531. .mis-no {
  1532. font-size: 28rpx;
  1533. color: #333;
  1534. }
  1535. .search-bar {
  1536. padding: 20rpx 30rpx;
  1537. background-color: #d7eafe;
  1538. }
  1539. .search-box {
  1540. flex-direction: row;
  1541. align-items: center;
  1542. height: 72rpx;
  1543. padding: 0 24rpx;
  1544. background-color: #f5f5f5;
  1545. border-radius: 36rpx;
  1546. .search-icon {
  1547. width: 32rpx;
  1548. height: 32rpx;
  1549. margin-right: 12rpx;
  1550. }
  1551. .search-input {
  1552. flex: 1;
  1553. font-size: 28rpx;
  1554. color: #333333;
  1555. }
  1556. .clear-icon {
  1557. margin-left: 12rpx;
  1558. font-size: 28rpx;
  1559. color: #999999;
  1560. }
  1561. }
  1562. .mis-list {
  1563. flex: 1;
  1564. height: 100%;
  1565. display: flex;
  1566. flex-direction: column;
  1567. }
  1568. .select-users-count {
  1569. margin-left: 10rpx;
  1570. font-size: 24rpx;
  1571. color: #666;
  1572. }
  1573. </style>