wbFinalize.uvue 59 KB

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