wbFinalize.uvue 59 KB

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