| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094 |
- <template>
- <view class="detail-page">
- <scroll-view class="detail-content" :scroll-y="true">
- <!-- 工单信息 -->
- <view class="info-section">
- <view class="section-title">
- <text class="section-title-text">工单信息</text>
- </view>
- <view class="info-card">
- <view class="info-item">
- <text class="info-label">工单编码</text>
- <text class="info-value">{{ workOrderProjectNo ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">工单类型</text>
- <text class="info-value">{{ orderType == '1' ? '维修工单' : '维保工单' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">风机编号</text>
- <text class="info-value">{{ pcsDeviceName ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">维保中心</text>
- <text class="info-value">{{ gxtCenter ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">场站</text>
- <text class="info-value">{{ pcsStationName ?? '-' }}</text>
- </view>
- <!-- <view class="info-item">
- <text class="info-label">品牌</text>
- <text class="info-value">{{ detailData.model ?? '' }}</text>
- </view> -->
- <view class="info-item">
- <text class="info-label">机型</text>
- <text class="info-value">{{ brand ?? '-' }} {{ model ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">接单时间</text>
- <text class="info-value">{{ acceptTime ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">故障代码</text>
- <text class="info-value">{{ faultCode ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">故障条文</text>
- <text class="info-value">{{ faultBarcode ?? '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">故障描述</text>
- <text class="info-value">{{ faultDesc ?? '-' }}</text>
- </view>
- </view>
- </view>
- <!-- 结单表单 -->
- <view class="info-section">
- <view class="section-title">
- <text class="section-title-text">结单信息</text>
- </view>
- <view class="info-card">
- <!-- 信息录入 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">信息录入<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <radio-group @change="handleInfoEntryChange" :disabled="infoEntryDisabled" class="uni-flex uni-row radio-group">
- <view v-for="(option, index) in infoEntryOptions" :key="index" class="radio-label">
- <radio :value="option.dictValue" :checked="infoEntry == option.dictValue">{{ option.dictLabel }}</radio>
- <!-- <text></text> -->
- </view>
- </radio-group>
- </view>
- </view>
- <!-- MIS工单编码选择(当信息录入为1时显示) -->
- <view class="info-item" v-if="infoEntry == '1'">
- <view class="info-label">
- <text class="form-label required">MIS工单编码<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="input-with-select">
- <input
- class="input-field"
- placeholder="请输入或选择MIS工单编码"
- v-model="misNo"
- @focus="handleMisNoInputFocus"
- @blur="handleMisNoInputBlur"
- @input="handleMisNoInput"
- :readonly="infoEntry == '1'"
- :style="{ paddingRight: '120rpx' }" />
- <text class="select-mis-btn" @click="openMisListModal">选择</text>
- </view>
- </view>
- </view>
- <!-- 工作票编号(当信息录入为2时可编辑) -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">工作票编号<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <input
- class="input-field"
- placeholder="请输入工作票编号"
- v-model="workPermitNum"
- maxlength="20"
- :disabled="infoEntry == '1'"
- @change="handleWorkPermitNumChange"
- />
- </view>
- </view>
- <!-- 开始时间 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">开始时间<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="form-picker" @click="infoEntry == '1' ? showStartTimePicker = false : showStartTimePicker = true">
- <input
- class="input-field"
- placeholder="请选择开始时间"
- v-model="realStartTime"
- type="none"
- style="pointer-events: none;"
- />
- </view>
- </view>
- </view>
- <!-- 结束时间 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">结束时间<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="form-picker" @click="infoEntry == '1' ? showEndTimePicker = false : showEndTimePicker = true">
- <input
- class="input-field"
- placeholder="请选择结束时间"
- v-model="realEndTime"
- type="none"
- style="pointer-events: none;"
- />
- <!-- <text class="input-field">
- {{ realEndTime != '' ? realEndTime : '请选择结束时间' }}
- </text> -->
- </view>
- </view>
- </view>
- <!-- 挂起结束时间 -->
- <view class="info-item" v-if="resumeInfo != null && resumeShow">
- <view class="info-label">
- <text class="form-label required">挂起结束时间<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="form-picker" @click="showResumeTimePicker = true">
- <input
- class="input-field"
- placeholder="请选择挂起结束时间"
- v-model="resumeTime"
- type="none"
- />
- </view>
- </view>
- </view>
- <!-- 工作部位 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label">工作部位<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="form-picker" @click="showWorkAreaPicker = true">
- <input
- class="input-field"
- placeholder="请选择工作部位"
- v-model="workAreaLabel"
- readonly
- />
- </view>
- </view>
- </view>
- <!-- 外委人员数 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">外委人员数(人)</text>
- </view>
- <view class="info-value">
- <input
- type="number"
- class="input-field"
- placeholder="请输入外委人员数"
- v-model="wwryNum"
- @input="onWwryNumInput"
- />
- </view>
- </view>
- <!-- 外来人员数 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">外来人员数(人)</text>
- </view>
- <view class="info-value">
- <input
- type="number"
- class="input-field"
- placeholder="请输入外来人员数"
- v-model="wlryNum"
- @input="onWlryNumInput"
- />
- </view>
- </view>
- <!-- 工作负责人 -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">工作负责人<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="input-with-clear">
- <input
- class="input-field"
- placeholder="请选择工作负责人"
- v-model="teamLeaderName"
- @click="showLeaderPicker = true"
- :disabled="infoEntry == '1'"
- />
- </view>
- </view>
- </view>
- <!-- 工作班成员选择(当信息录入为2时可编辑) -->
- <view class="info-item">
- <view class="info-label">
- <text class="form-label required">工作班成员<text style="color: red;">*</text></text>
- </view>
- <view class="info-value">
- <view class="input-with-clear">
- <input
- class="input-field"
- placeholder="请选择工作班成员"
- v-model="workGroupMemberName"
- @click="showUserSelect = true"
- :disabled="infoEntry == '1'"
- />
- <!-- <text class="select-users-count" v-if="selectedUserIds.length > 0" :style="{ marginRight: selectedUserIds.length > 0 ? '60rpx' : '0' }">({{ selectedUserIds.length }}人)</text> -->
- <text class="select-clear" v-if="selectedUserIds.length > 0" @click="clearSelectedUsers">×</text>
- </view>
- </view>
- </view>
- <!-- 维保内容 -->
- <view class="info-item full-width">
- <view class="info-label">
- <text class="form-label required">真实故障原因</text>
- </view>
- <view class="info-value">
- <textarea
- class="textarea-field"
- placeholder="请输入真实故障原因"
- v-model="realFailureReason"
- maxlength="500"
- :show-confirm-bar="false"
- auto-height
- ></textarea>
- </view>
- </view>
- <!-- 附件上传 -->
- <view class="info-item full-width">
- <view class="info-label">
- <text class="form-label">附件(可选)</text>
- </view>
- <view class="info-value">
- <upload-image
- :limit="8"
- :modelValue="uploadedFiles"
- :businessType="'workOrder'"
- @update:modelValue="uploadedFiles = $event as UTSArray<UploadResponse>"
- />
- </view>
- </view>
- </view>
- </view>
- <!-- 时间选择器弹窗 -->
- <!-- Start Date Picker -->
- <l-popup v-model="showStartTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
- <l-date-time-picker
- title="选择开始时间"
- :mode="1 | 2 | 4 | 8 | 16"
- format="YYYY-MM-DD HH:mm"
- :modelValue="realStartTime"
- confirm-btn="确定"
- cancel-btn="取消"
- @confirm="onStartDateConfirm"
- @cancel="showStartTimePicker = false">
- </l-date-time-picker>
- </l-popup>
- <!-- End Date Picker -->
- <l-popup v-model="showEndTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
- <l-date-time-picker
- title="选择结束时间"
- :mode="31"
- format="YYYY-MM-DD HH:mm"
- :modelValue="realEndTime"
- confirm-btn="确定"
- cancel-btn="取消"
- @confirm="onEndDateConfirm"
- @cancel="showEndTimePicker = false">
- </l-date-time-picker>
- </l-popup>
- <l-popup v-model="showResumeTimePicker" position="bottom" :safe-area-inset-bottom="true" :z-index="10000">
- <l-date-time-picker
- title="选择挂起结束时间"
- :mode="31"
- format="YYYY-MM-DD HH:mm"
- :modelValue="resumeTime"
- confirm-btn="确定"
- cancel-btn="取消"
- @confirm="onResumeTimeConfirm"
- @cancel="showResumeTimePicker = false">
- </l-date-time-picker>
- </l-popup>
- <!-- 人员选择弹窗 -->
- <view v-if="showUserSelect" class="picker-modal">
- <view class="modal-mask" @click="showUserSelect = false"></view>
- <view class="modal-content">
- <view class="modal-header">
- <text class="modal-title">选择工作班成员</text>
- <text class="modal-close" @click="confirmSelectedUsers">确定</text>
- </view>
- <view class="search-bar">
- <view class="search-box">
- <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
- <input class="search-input" type="text" placeholder="搜索姓名" v-model="userKeyword" @input="handleUserSearch" />
- <text v-if="userKeyword.length > 0" class="clear-icon" @click="clearUserSearch">✕</text>
- </view>
- </view>
- <scroll-view class="modal-body" scroll-y="true">
- <view
- v-for="(user, index) in userList"
- :key="index"
- class="picker-option"
- @click="toggleUserSelection(user)"
- >
- <text class="option-text">{{ (user['nickName'] as string | null) ?? '' }}</text>
- <text class="option-text">{{ ((user['dept'] as UTSJSONObject | null)?.['deptName'] as string | null) ?? '' }}</text>
- <text class="option-check" v-if="isSelected(user)">✓</text>
- </view>
- </scroll-view>
- </view>
- </view>
- <!-- MIS工单列表弹窗 -->
- <view v-if="showMisListModal" class="picker-modal">
- <view class="modal-mask" @click="closeMisListModal"></view>
- <view class="modal-content">
- <view class="modal-header">
- <text class="modal-title">选择MIS工单</text>
- <text class="modal-close" @click="closeMisListModal">取消</text>
- </view>
- <!-- 搜索栏 -->
- <view class="search-bar">
- <view class="search-box">
- <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
- <input class="search-input" type="text" placeholder="搜索 MIS工单编码" v-model="misListKeyword" @input="searchMisList" />
- <text v-if="misListKeyword.length > 0" class="clear-icon" @click="clearMisListSearch">✕</text>
- </view>
- </view>
- <!-- 列表内容 -->
- <scroll-view class="modal-body" scroll-y="true">
- <!-- 有数据时显示列表 -->
- <view v-if="misList.length > 0">
- <view
- v-for="(item, index) in misList"
- :key="index"
- class="picker-option"
- @click="selectMisItem(item, index)"
- >
- <!-- <text class="option-text">{{ option.label }}</text> -->
- <view>
- <text class="option-text">MIS工单编码</text>
- <text class="option-text">工作票编号</text>
- </view>
- <view>
- <text class="option-text">{{ ((item['misNo'] as string | null) ?? '-')}}</text>
- <text class="option-text">{{ item['workPermitNum'] as string | null ?? '-' }}</text>
- </view>
- <text v-if="index === selectedMisInfoIndex" class="option-check">✓</text>
- </view>
- </view>
- <!-- 无数据时显示提示 -->
- <view v-else class="empty-tip">
- <text>未找到匹配的MIS工单</text>
- </view>
- </scroll-view>
- </view>
- </view>
- <!-- 工作部位选择弹窗 -->
- <view v-if="showWorkAreaPicker" class="picker-modal">
- <view class="modal-mask" @click="showWorkAreaPicker = false"></view>
- <view class="modal-content">
- <view class="modal-header">
- <text class="modal-title">选择工作部位</text>
- <text class="modal-close" @click="confirmSelectedWorkAreas">确定</text>
- </view>
- <scroll-view class="modal-body" scroll-y="true">
- <view
- v-for="(item, index) in workAreaDictList"
- :key="index"
- class="picker-option"
- @click="toggleWorkAreaSelection(item)"
- >
- <text class="option-text">{{ item.dictLabel ?? '' }}</text>
- <text class="option-check" v-if="isWorkAreaSelected(item)">✓</text>
- </view>
- </scroll-view>
- </view>
- </view>
- <!-- 工作负责人弹窗 -->
- <view v-if="showLeaderPicker" class="picker-modal">
- <view class="modal-mask" @click="showLeaderPicker = false"></view>
- <view class="modal-content">
- <view class="modal-header">
- <text class="modal-title">选择工作负责人</text>
- <text class="modal-close" @click="showLeaderPicker = false">取消</text>
- </view>
- <view class="search-bar">
- <view class="search-box">
- <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
- <input class="search-input" type="text" placeholder="搜索姓名" v-model="teamKeyword" @input="handleSearch" />
- <text v-if="teamKeyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
- </view>
- </view>
- <scroll-view class="modal-body" scroll-y="true">
- <!-- 有数据时显示列表 -->
- <view v-if="teamLeaderList.length > 0">
- <view
- v-for="(user, index) in teamLeaderList"
- :key="index"
- class="picker-option"
- :class="{ 'selected': index === selectedTeamLeaderIndex }"
- @click="selectLeaderManually(user, index)"
- >
- <text class="option-text">{{ (user['nickName'] as string | null) ?? '' }}</text>
- <text class="option-text">{{ ((user['dept'] as UTSJSONObject | null)?.['deptName'] as string | null) ?? '' }}</text>
- <text v-if="index === selectedTeamLeaderIndex" class="option-check">✓</text>
- </view>
- </view>
- <!-- 无数据时显示提示 -->
- <view v-else class="empty-tip">
- <text>未找到匹配的人员</text>
- </view>
- </scroll-view>
- </view>
- </view>
- </scroll-view>
- <!-- 确认结单按钮 -->
- <view class="accept-button-container">
- <button class="accept-button" @click="handleSubmit" :loading="submitLoading">{{ submitLoading ? '提交中...' : '确认结单' }}</button>
- </view>
- <!-- 加载中状态 -->
- <view v-if="loading" class="loading-mask">
- <text class="loading-text">加载中...</text>
- </view>
- </view>
- </template>
- <script setup lang="uts">
- import { ref, watch } from 'vue'
- import type { acceptOrderInfo } from '../../../types/order'
- import type { WorkOrderFlow } from '../../../types/flow'
- import { getOrderInfoById, getRepairOrderInfoById, returnRepairOrder, repairFinishOrder } from '../../../api/order/detail'
- import { getMisInfoList, listWorkPerson, getOrderList, listAutoMisInfo, allListOrder } from '../../../api/order/list'
- import type { SysDictData } from '../../../types/dict'
- import { getDictDataByType } from '../../../api/dict/index'
- import type { UserInfo } from '../../../types/user'
- import type { UploadResponse } from '../../../types/workbench'
- import {checkPermi} from '../../../utils/storage'
- import { getUserList, getLeaderList } from '../../../api/user/list'
- import uploadImage from '../../../components/upload-image/upload-image.uvue'
- // 工单信息
- const orderId = ref<string>('')
- const workOrderProjectNo = ref<string>('')
- const workOrderStatus = ref<string>('')
- const orderType = ref<string>('')
- const pcsDeviceName = ref<string>('')
- const gxtCenter = ref<string>('')
- const pcsStationName = ref<string>('')
- const brand = ref<string>('')
- const model = ref<string>('')
- const acceptTime = ref<string>('')
- const returnType = ref<string>('')
- const returnReason = ref<string>("")
- const returnTypeLabel = ref<string>("")
- const acceptReturnType = ref<string>('')
- const acceptReturnReason = ref<string>("")
- const teamLeaderId = ref<Number | null>(null)
- const teamLeaderName = ref<string>('')
- const pauseTime = ref<string>('')
- const restartTime = ref<string>('')
- const faultCode = ref<string>('')
- const faultBarcode = ref<string>('')
- const faultDesc = ref<string>('')
- const suspendReason = ref<string>('') // 挂起原因
- const flowList = ref<UTSJSONObject[]>([]) //流转过程
- const suspendInfo = ref<UTSJSONObject | null>(null)
- const resumeInfo = ref<UTSJSONObject | null>(null)
- const resumeShow = ref<boolean>(false)
- const resumeTime = ref<string>('') // 挂起结束时间
- const showResumeTimePicker = ref<boolean>(false)
- // 添加字典加载状态
- const dictLoaded = ref<boolean>(false)
- // 结单表单相关变量
- const infoEntry = ref<string>('') // 信息录入
- const misNo = ref<string>('') // MIS工单编码
- const workPermitNum = ref<string>('') // 工作票编号
- const realStartTime = ref<string>('') // 开始时间
- const realEndTime = ref<string>('') // 结束时间
- const wwryNum = ref<string>('') // 外委人员数
- const wlryNum = ref<string>('') // 外来人员数
- const workGroupMemberName = ref<string>('') // 工作班成员
- const attachmentUrls = ref<string>('') // 附件URLs(逗号分隔的字符串格式)
- const uploadedFiles = ref<UploadResponse[]>([]) // 上传的文件对象数组
- const repairOrderPersonList = ref<UTSJSONObject[]>([]) // 工作班成员数组
- const selectedUserIds = ref<string[]>([]) // 选中的用户ID数组
- const selectedUsers = ref<UTSJSONObject[]>([]) // 选中的用户对象数组
- const realFailureReason = ref<string>('') //真实故障原因
- const workArea = ref<string>('') //工作部位
- const workAreaLabel = ref<string>('')
- const workAreaDictList = ref<SysDictData[]>([]) // 工作部位字典列表
- const selectedWorkAreas = ref<SysDictData[]>([]) // 选中的工作部位
- const showWorkAreaPicker = ref<boolean>(false) // 显示工作部位选择器
- // 选中的负责人信息
- const selectedTeamLeaderName = ref<string>('')
- const selectedTeamLeaderIndex = ref<number>(-1)
- const showLeaderPicker = ref<boolean>(false)
- const teamLeaderList = ref<UTSJSONObject[]>([])
- const teamAllLeaderList = ref<UTSJSONObject[]>([])
- let teamKeyword = ref<string>("")
- // 时间选择器相关变量
- const showStartTimePicker = ref<boolean>(false)
- const showEndTimePicker = ref<boolean>(false)
- const startTimeDate = ref<string>('')
- const startTimeTime = ref<string>('')
- const endTimeDate = ref<string>('')
- const endTimeTime = ref<string>('')
- // 监听开始时间和结束时间变化
- watch(realStartTime, (value: string) => {
- // 在这里添加开始时间变化时的处理逻辑
- if (resumeInfo.value != null && value != '') {
- const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
- if (suspendTime != '' && value != '') {
- const suspendDate = new Date(suspendTime)
- const startDate = new Date(value)
- if (suspendDate.getTime() < startDate.getTime()) { // 开工前挂起
- const resumeDate = new Date(resumeTime.value)
- const endDate = new Date(realEndTime.value)
- if (resumeDate.getTime() > startDate.getTime() || (realEndTime.value != '' && resumeDate.getTime() > endDate.getTime())) {
- resumeShow.value = true
- } else {
- resumeShow.value = false
- }
- } else if (suspendDate.getTime() >= startDate.getTime()) { // 作业中挂起
- const resumeDate = new Date(resumeTime.value)
- const endDate = new Date(realEndTime.value)
- if (resumeDate.getTime() < startDate.getTime() || (realEndTime.value != '' && resumeDate.getTime() > endDate.getTime())) {
- resumeShow.value = true
- } else {
- resumeShow.value = false
- }
- } else {
- resumeShow.value = false
- }
- } else {
- resumeShow.value = false
- }
- }
- })
- watch(realEndTime, (value: string) => {
- // 在这里添加结束时间变化时的处理逻辑
- if (resumeInfo.value != null && value != '') {
- const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
- if (suspendTime != '' && realStartTime.value != '' && new Date(suspendTime).getTime() < new Date(realStartTime.value).getTime()) { // 开工前挂起
- if (value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(realStartTime.value).getTime()) {
- resumeShow.value = true
- } else if(value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(value).getTime()) {
- resumeShow.value = true
- } else {
- resumeShow.value = false
- }
- } else if(suspendTime != '' && realStartTime.value != '' && new Date(suspendTime).getTime() >= new Date(realStartTime.value).getTime()) { // 作业中挂起
- if (realStartTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() < new Date(realStartTime.value).getTime()) {
- resumeShow.value = true
- } else if(value != '' && resumeTime.value != '' && new Date(resumeTime.value).getTime() > new Date(value).getTime()) {
- resumeShow.value = true
- } else {
- resumeShow.value = false
- }
- } else {
- resumeShow.value = false
- }
- }
- })
- // MIS工单选择相关变量
- const showMisNoQuickSelect = ref<boolean>(false)
- const quickMisNoList = ref<UTSJSONObject[]>([])
- // 添加MIS工单列表弹窗显示状态
- const showMisListModal = ref<boolean>(false)
- // MIS工单列表数据
- const misList = ref<UTSJSONObject[]>([])
- const allMisList = ref<UTSJSONObject[]>([])
- // 分页信息
- const misListPage = ref<number>(1)
- const misListPageSize = ref<number>(999)
- const misListTotal = ref<number>(0)
- // 搜索关键词
- const misListKeyword = ref<string>('')
- const userKeyword = ref<string>('')
- // 人员选择相关变量
- const showUserSelect = ref<boolean>(false)
- const userList = ref<UTSJSONObject[]>([])
- const userAllList = ref<UTSJSONObject[]>([])
- // 信息录入选项
- const infoEntryOptions = ref<SysDictData[]>([])
- const selectedMisInfoIndex = ref<number>(-1)
- // 获取信息录入字典列表
- const loadInfoEntryDictList = async (): Promise<void> => {
- try {
- const result = await getDictDataByType('gxt_info_entry') // 假设信息录入类型字典类型为gxt_info_entry
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const data = resultObj['data'] as any[]
- const dictData: SysDictData[] = []
- if (data.length > 0) {
- for (let i = 0; i < data.length; i++) {
- const item = data[i] as UTSJSONObject
- // 只提取需要的字段
- const dictItem: SysDictData = {
- dictValue: item['dictValue'] as string | null,
- dictLabel: item['dictLabel'] as string | null,
- dictCode: null,
- dictSort: null,
- dictType: null,
- cssClass: null,
- listClass: null,
- isDefault: null,
- status: null,
- default: null,
- createTime: null,
- remark: null
- }
- dictData.push(dictItem)
- }
- }
- infoEntryOptions.value = dictData
- }
- } catch (e: any) {
- console.error('获取信息录入类型字典失败:', e.message)
- // 设置默认值
- infoEntryOptions.value = [
- { dictValue: '1', dictLabel: 'MIS工单', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null },
- { dictValue: '2', dictLabel: '手工录入', dictCode: null, dictSort: null, dictType: null, cssClass: null, listClass: null, isDefault: null, status: null, default: null, createTime: null, remark: null }
- ];
- }
- }
- // 获取工作部位字典列表
- const loadWorkAreaDictList = async (): Promise<void> => {
- try {
- const result = await getDictDataByType('gxt_work_area')
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const data = resultObj['data'] as any[]
- const dictData: SysDictData[] = []
- if (data.length > 0) {
- for (let i = 0; i < data.length; i++) {
- const item = data[i] as UTSJSONObject
- // 只提取需要的字段
- const dictItem: SysDictData = {
- dictValue: item['dictValue'] as string | null,
- dictLabel: item['dictLabel'] as string | null,
- dictCode: null,
- dictSort: null,
- dictType: null,
- cssClass: null,
- listClass: null,
- isDefault: null,
- status: null,
- default: null,
- createTime: null,
- remark: null
- }
- dictData.push(dictItem)
- }
- }
- workAreaDictList.value = dictData
- }
- } catch (e: any) {
- console.error('获取工作部位字典失败:', e.message)
- }
- }
- // 获取用户列表
- const getUserAllList = async (): Promise<void> => {
- try {
- // 这里应该调用获取用户列表的API
- const result = await getLeaderList(-1); // 空参数调用
- const resultObj = result as UTSJSONObject;
- const code = resultObj['code'] as number
- const users = resultObj['data'] as UTSJSONObject[] | null
- if (code == 200 && users != null ) {
- // 解析列表数据
- // const rows = resultObj['rows'] as UTSJSONObject[]
- userList.value = users
- userAllList.value = users
- teamLeaderList.value = users
- teamAllLeaderList.value = users
- // userList.value = result.data || [];
- }
- } catch (error) {
- console.error('获取用户列表失败:', error);
- uni.showToast({
- title: '获取用户列表失败',
- icon: 'none'
- });
- }
- };
- // 外委人员数输入处理
- const onWwryNumInput = (): void => {
- let value = wwryNum.value;
- // 移除非数字字符,包括负号和小数点
- value = value.replace(/[^0-9]/g, '');
- wwryNum.value = value;
- };
- // 外来人员数输入处理
- const onWlryNumInput = (): void => {
- let value = wlryNum.value;
- // 移除非数字字符,包括负号和小数点
- value = value.replace(/[^0-9]/g, '');
- wlryNum.value = value;
- };
- // 验证和提交
- const submitLoading = ref<boolean>(false)
- // 信息录入禁用状态
- const infoEntryDisabled = ref<boolean>(false)
- // 接受用户名
- const acceptUserName = ref<string>('')
- // 选择器选项类型
- type PickerOption = {
- label: string
- value: string
- }
- // 手动选择负责人
- const selectLeaderManually = (user: UTSJSONObject, index: number): void => {
- selectedTeamLeaderIndex.value = index
- const uid = user['userId']
- if (uid != null) {
- teamLeaderId.value = uid as Number
- }
- const name = user['nickName']
- teamLeaderName.value = name != null ? name.toString() : ''
- showLeaderPicker.value = false
- }
- // 信息录入变化处理
- const handleInfoEntryChange = (e: UniRadioGroupChangeEvent): void => {
- // 兼容 radio-group 事件:detail 可能不存在,直接取 e.value
- const val = e.detail?.value as string | null
- infoEntry.value = val ?? ''
- if (infoEntry.value == '1') {
- // 当选择MIS工单时,清空手工录入的字段
- workPermitNum.value = '';
- realStartTime.value = '';
- realEndTime.value = '';
- workGroupMemberName.value = '';
- }
- };
- // 工作票编号变化处理
- const handleWorkPermitNumChange = async(): Promise<void> => {
- if (infoEntry.value == '2') {
- // 查询工作票编号是否已存在
- const queryParams = {
- workPermitNum: workPermitNum.value,
- } as UTSJSONObject;
- const response = await allListOrder(queryParams)
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- if (rows != null && rows.length > 0) {
- uni.showToast({ title: '工作票编号:' + workPermitNum.value + '已存在', icon: 'none' })
- workPermitNum.value = ''
- return
- }
- }
- };
- // MIS工单编码输入处理
- const handleMisNoInputFocus = (): void => {
- showMisNoQuickSelect.value = true;
- };
- const handleMisNoInputBlur = (): void => {
- setTimeout(() => {
- showMisNoQuickSelect.value = false;
- }, 200);
- };
- const handleMisNoInput = (e: SysDictData): void => {
- misNo.value = (e['detail'] as string | null) ?? '';
- // 这里可以添加实时搜索MIS工单的逻辑
- };
- const handleMisNoClear = (): void => {
- misNo.value = '';
- showMisNoQuickSelect.value = false;
- };
- const handleMisNoQuickSelect = (item: UTSJSONObject): void => {
- misNo.value = (item['misNo'] as string | null) ?? '';
- showMisNoQuickSelect.value = false;
- };
- // 获取MIS工单列表
- const getMisList = async (): Promise<void> => {
- try {
- const queryParams = {
- pcsDeviceName: pcsDeviceName.value,
- pcsStationName: pcsStationName.value,
- workOrderStatus: '结束'
- } as UTSJSONObject;
- // 调用获取MIS工单列表的API
- const result = await getMisInfoList(queryParams);
- const resultObj = result as UTSJSONObject;
- if (resultObj['code'] == 200) {
- // 解析列表数据
- const rows = resultObj['rows'] as UTSJSONObject[]
- misList.value = rows;
- allMisList.value = rows
- // 解析总数
- misListTotal.value = resultObj['total'] as number;
- } else {
- const msg = resultObj['msg'] as string | null
- uni.showToast({
- title: msg ?? '获取MIS工单列表失败',
- icon: 'none'
- })
- }
- } catch (error: any) {
- console.error('获取MIS工单列表失败:', error);
- uni.showToast({
- title: error.message ?? '获取MIS工单列表失败',
- icon: 'none'
- });
- }
- };
- // 打开MIS工单选择弹窗
- const openMisListModal = (): void => {
- showMisListModal.value = true;
- misListPage.value = 1; // 重置为第一页
- getMisList(); // 获取列表数据
- };
- // 选择MIS工单
- const selectMisItem = async (item: UTSJSONObject, index: number): Promise<void> => {
- selectedMisInfoIndex.value = index
- // 回填MIS工单相关信息
- misNo.value = item['misNo'] as string | '';
- // 查询MIS工单是否已存在
- const response = await getOrderList(1, 10, misNo.value, '')
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- if (rows != null && rows.length > 0) {
- uni.showToast({ title: 'MIS工单:' + misNo.value + '已存在', icon: 'none' })
- misNo.value = ''
- return
- }
- // 查询相关工作班成员
- await listWorkPerson(misNo.value).then(response => {
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- repairOrderPersonList.value = rows ?? []
- if (rows != null && rows.length > 0) {
- // 查找 isLeader 等于 1 的负责人(优先获取第一个符合条件的,贴合常规单负责人场景)
- const leaderPerson = rows.find(person => person.isLeader == 1);
- if(leaderPerson != null) {
- teamLeaderId.value = (leaderPerson['userId'] as Number | null) ?? null
- teamLeaderName.value = (leaderPerson['nickName'] as string | null) ?? ''
- }
- const nickNames = rows
- .filter(person => person.isLeader != 1)
- .map(person => (person.nickName as string | null) ?? '')
- .join(',');
- workGroupMemberName.value = nickNames;
- }
- })
- workPermitNum.value = item['workPermitNum'] as string | '';
- realStartTime.value = item['realStartTime'] as string | '';
- realEndTime.value = item['realEndTime'] as string | '';
- // 关闭弹窗
- showMisListModal.value = false;
- };
- // 搜索
- const handleUserSearch = (): void => {
- const keyword = userKeyword.value
- userList.value = userAllList.value.filter(leader => {
- const nickName = leader['nickName'] as string | null
- return nickName != null && nickName.indexOf(keyword) >= 0
- })
- }
- // 关闭MIS工单选择弹窗
- const closeMisListModal = (): void => {
- showMisListModal.value = false;
- };
- // 搜索
- const searchMisList = (): void => {
- const keyword = misListKeyword.value
- misList.value = allMisList.value.filter(misInfo => {
- const misNo = misInfo['misNo'] as string | null
- // return misNo != null && misNo.indexOf(keyword) >= 0
- const workPermitNum = misInfo['workPermitNum'] as string | null
- // 逻辑或(||)连接两个条件,满足其一即可
- const misNoMatch = misNo != null && misNo.indexOf(keyword) >= 0
- const workPermitNumMatch = workPermitNum != null && workPermitNum.indexOf(keyword) >= 0
- return misNoMatch || workPermitNumMatch
- })
- }
- // 清除MIS工单搜索
- const clearMisListSearch = (): void => {
- misListKeyword.value = "";
- misList.value = allMisList.value
- };
- // 清除用户搜索
- const clearUserSearch = (): void => {
- userKeyword.value = "";
- userList.value = userAllList.value
- };
- // 搜索工作负责人
- const handleSearch = (): void => {
- const keyword = teamKeyword.value
- teamLeaderList.value = teamAllLeaderList.value.filter(leader => {
- const nickName = leader['nickName'] as string | null
- return nickName != null && nickName.indexOf(keyword) >= 0
- })
- }
- // 清空搜索工作负责人
- const clearSearch = (): void => {
- teamKeyword.value = ""
- teamLeaderList.value = teamAllLeaderList.value
- }
- function onStartDateConfirm(value: string) {
- // 检查结束时间是否小于新的开始时间
- if (realEndTime.value != '' && new Date(value) > new Date(realEndTime.value as string)) {
- uni.showToast({ title: '开始时间不能大于结束时间', icon: 'none' })
- return
- }
- realStartTime.value = value
- showStartTimePicker.value = false
- }
- function onEndDateConfirm(value: string) {
- // 检查新的结束时间是否小于开始时间
- if (realStartTime.value != '' && new Date(realStartTime.value as string) > new Date(value)) {
- uni.showToast({ title: '结束时间不能小于开始时间', icon: 'none' })
- return
- }
- realEndTime.value = value
- showEndTimePicker.value = false
- }
- function onResumeTimeConfirm(value: string) {
- // 检查新的结束时间是否小于开始时间
- if (resumeTime.value != '' && new Date(realStartTime.value as string) > new Date(value)) {
- uni.showToast({ title: '结束时间不能小于开始时间', icon: 'none' })
- return
- }
- resumeTime.value = value
- showResumeTimePicker.value = false
- }
- // 检查用户是否已被选中
- const isSelected = (user: UTSJSONObject): boolean => {
- const userId = user['userId'] as string | number | null;
- if (userId !== null) {
- return selectedUserIds.value.includes(userId.toString());
- }
- // 如果没有userId,则比较nickName
- const nickName = user['nickName'] as string | null;
- if (nickName !== null) {
- return selectedUsers.value.some(selected =>
- (selected['nickName'] as string | null) === nickName
- );
- }
- return false;
- };
- // 切换用户选择状态
- const toggleUserSelection = (user: UTSJSONObject): void => {
- const userId = user['userId'] as string | number | null;
- const nickName = user['nickName'] as string | null;
- if (userId !== null) {
- const userIdStr = userId.toString();
- const index = selectedUserIds.value.indexOf(userIdStr);
- if (index > -1) {
- // 取消选择
- selectedUserIds.value.splice(index, 1);
- selectedUsers.value = selectedUsers.value.filter(selected =>
- (selected['userId'] as string | number | null)?.toString() !== userIdStr
- );
- } else {
- // 添加选择
- selectedUserIds.value.push(userIdStr);
- selectedUsers.value.push(user);
- }
- } else if (nickName !== null) {
- // 如果没有userId,通过nickName来识别
- const index = selectedUsers.value.findIndex(selected =>
- (selected['nickName'] as string | null) === nickName
- );
- if (index > -1) {
- // 取消选择
- selectedUsers.value.splice(index, 1);
- // 同时移除对应的userId(如果有的话)
- const userToRemoveId = user['userId'] as string | number | null;
- if (userToRemoveId !== null) {
- const idIndex = selectedUserIds.value.indexOf(userToRemoveId.toString());
- if (idIndex > -1) {
- selectedUserIds.value.splice(idIndex, 1);
- }
- }
- } else {
- // 添加选择
- selectedUsers.value.push(user);
- const userToAddId = user['userId'] as string | number | null;
- if (userToAddId !== null) {
- selectedUserIds.value.push(userToAddId.toString());
- }
- }
- }
- };
- // 确认选择的用户
- const confirmSelectedUsers = (): void => {
- // 将选中的用户姓名拼接成字符串
- const nickNames = selectedUsers.value
- .map(user => (user['nickName'] as string | null) ?? '')
- .filter(name => name !== '')
- .join(',');
- workGroupMemberName.value = nickNames;
- // 更新repairOrderPersonList为选中的用户
- repairOrderPersonList.value = [...selectedUsers.value];
- showUserSelect.value = false;
- };
- // 清空已选择的用户
- const clearSelectedUsers = (): void => {
- // 清空选中的用户数组
- selectedUsers.value = [];
- selectedUserIds.value = [];
- // 清空显示的用户名
- workGroupMemberName.value = '';
- // 清空工作班成员列表
- repairOrderPersonList.value = [];
- };
- // 检查工作部位是否已被选中
- const isWorkAreaSelected = (workArea: SysDictData): boolean => {
- return selectedWorkAreas.value.some(selected =>
- (selected.dictValue as string | null) === (workArea.dictValue as string | null)
- );
- };
- // 切换工作部位选择状态
- const toggleWorkAreaSelection = (workArea: SysDictData): void => {
- const index = selectedWorkAreas.value.findIndex(selected =>
- (selected.dictValue as string | null) === (workArea.dictValue as string | null)
- );
- if (index > -1) {
- // 取消选择
- selectedWorkAreas.value.splice(index, 1);
- } else {
- // 添加选择
- selectedWorkAreas.value.push(workArea);
- }
- };
- // 确认选择的工作部位
- const confirmSelectedWorkAreas = (): void => {
- // 将选中的工作部位标签拼接成字符串,用逗号分隔
- const labels = selectedWorkAreas.value
- .map(item => item.dictLabel ?? '')
- .filter(label => label !== '');
- workAreaLabel.value = labels.join(', ');
- // 将选中的工作部位值拼接成字符串,用逗号分隔
- workArea.value = selectedWorkAreas.value
- .map(item => item.dictValue ?? '')
- .filter(value => value !== '')
- .join(',');
- showWorkAreaPicker.value = false;
- };
- // 表单验证
- const validateForm = (): boolean => {
- if (infoEntry.value == '') {
- uni.showToast({
- title: '请选择信息录入方式',
- icon: 'none'
- });
- return false;
- }
- if (infoEntry.value == '1' && (misNo.value == '')) {
- uni.showToast({
- title: '请输入MIS工单编码',
- icon: 'none'
- });
- return false;
- }
- if (workPermitNum.value == '') {
- uni.showToast({
- title: '请输入工作票编号',
- icon: 'none'
- });
- return false;
- }
- if (realStartTime.value == '') {
- uni.showToast({
- title: '请选择开始时间',
- icon: 'none'
- });
- return false;
- }
- if (realEndTime.value == '') {
- uni.showToast({
- title: '请选择结束时间',
- icon: 'none'
- });
- return false;
- }
- if (new Date(realEndTime.value) <= new Date(realStartTime.value)) {
- uni.showToast({
- title: '结束时间必须大于开始时间',
- icon: 'none'
- });
- return false;
- }
- if (teamLeaderName.value == '') {
- uni.showToast({
- title: '请选择工作负责人',
- icon: 'none'
- });
- return false;
- }
- if (workGroupMemberName.value == '') {
- uni.showToast({
- title: '请选择工作班成员',
- icon: 'none'
- });
- return false;
- }
- if (workArea.value == '') {
- uni.showToast({
- title: '请选择工作部位',
- icon: 'none'
- });
- return false;
- }
- if(resumeShow.value) {
- if(resumeTime.value == '') {
- uni.showToast({
- title: '请选挂起结束时间',
- icon: 'none'
- });
- return false;
- } else {
- const suspendTime = (suspendInfo.value?.['actionTime'] as string | null) ?? ''
- if (suspendTime != '' && realStartTime.value != '' && new Date(suspendTime) < new Date(realStartTime.value)) { // 开工前挂起
- if (resumeTime.value != '' && new Date(resumeTime.value) > new Date(realStartTime.value)) {
- uni.showToast({
- title: '开工前挂起结束时间晚于实际开始时间,请调整',
- icon: 'none'
- });
- return false;
- } else if(realEndTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value) > new Date(realEndTime.value)) {
- uni.showToast({
- title: '开工前挂起结束时间晚于实际结束时间,请调整',
- icon: 'none'
- });
- return false;
- }
- } else if(suspendTime != '' && realStartTime.value != '' && new Date(suspendTime) >= new Date(realStartTime.value)) { // 作业中挂起
- if (resumeTime.value != '' && new Date(resumeTime.value) < new Date(realStartTime.value)) {
- uni.showToast({
- title: '作业中挂起结束时间早于实际开始时间,请调整',
- icon: 'none'
- });
- return false;
- } else if(realEndTime.value != '' && resumeTime.value != '' && new Date(resumeTime.value) > new Date(realEndTime.value)) {
- uni.showToast({
- title: '作业中挂起结束时间晚于实际结束时间,请调整',
- icon: 'none'
- });
- return false;
- }
- }
- }
- }
- return true;
- };
- const isDealing = ref(false)
- const hasDealed = ref(false)
- // 提交表单
- const handleSubmit = async (): Promise<void> => {
- if (!validateForm()) {
- return;
- }
- submitLoading.value = true;
- try {
- if (isDealing.value || hasDealed.value) return // 双重保险
- isDealing.value = true
- // 确保附件URLs是最新的逗号分隔格式
- attachmentUrls.value = uploadedFiles.value.map(file => file.fileName).join(',');
- flowList.value = []
- if (resumeTime.value != '' && resumeInfo.value != null && resumeTime.value != (resumeInfo.value['actionTime'] as string | null)) { //存入新的挂起结束时间
- resumeInfo.value['actionTime'] = resumeTime.value
- flowList.value.push(resumeInfo.value as UTSJSONObject)
- }
- const finishData = {
- id: orderId.value,
- orderType: orderType.value,
- workOrderProjectNo: workOrderProjectNo.value,
- infoEntry: infoEntry.value,
- misOrderNo: infoEntry.value == '1' ? misNo.value : null,
- workPermitNum: workPermitNum.value,
- realStartTime: realStartTime.value,
- realEndTime: realEndTime.value,
- wwryNum: wwryNum.value,
- wlryNum: wlryNum.value,
- workGroupMemberName: workGroupMemberName.value,
- realFailureReason: realFailureReason.value,
- attachmentUrls: attachmentUrls.value,
- repairOrderPersonList: repairOrderPersonList.value,
- teamLeaderId: teamLeaderId.value,
- teamLeaderName: teamLeaderName.value,
- finalizeMethod: '2',
- workOrderStatus: 'completed',
- workArea: workArea.value,
- repairOrderFlowList: flowList.value,
- repairMethod: '1'
- } as UTSJSONObject;
- const result = await repairFinishOrder(finishData);
- const resultObj = result as UTSJSONObject;
- const code = resultObj['code'] as number;
- if (code == 200) {
- uni.showToast({
- title: '结单成功',
- icon: 'success'
- });
- hasDealed.value = true
- // 使用事件总线通知列表页面刷新
- uni.$emit('refreshOrderList', {});
- uni.$emit('refreshAssignedCount');
- uni.$emit('refreshOverdueCount');
- setTimeout(() => {
- uni.navigateBack();
- }, 800);
- } else {
- const msg = resultObj['msg'] as string;
- uni.showToast({
- title: msg.length > 0 ? msg : '结单失败',
- icon: 'none'
- });
- }
- } catch (error: Error) {
- uni.showToast({
- title: error.message,
- icon: 'none'
- });
- } finally {
- submitLoading.value = false;
- isDealing.value = false // 无论成功失败都解锁
- }
- };
- const loading = ref<boolean>(false)
- // 加载详情数据
- const loadDetail = async (id: string, orderType?: string): Promise<void> => {
- try {
- loading.value = true
- let result: any;
- // 根据orderType决定调用哪个API
- if (orderType == '1') {
- // 维修工单
- result = await getRepairOrderInfoById(id)
- } else {
- // 维保工单
- result = await getOrderInfoById(id)
- }
- // 提取响应数据
- const resultObj = result as UTSJSONObject
- const code = resultObj['code'] as number
- const data = resultObj['data'] as UTSJSONObject | null
- if (code == 200 && data != null) {
- workOrderStatus.value = (data['workOrderStatus'] as string | null) ?? ''
- workOrderProjectNo.value = (data['workOrderProjectNo'] as string | null) ?? ''
- pcsDeviceName.value = (data['pcsDeviceName'] as string | null) ?? ''
- gxtCenter.value = (data['gxtCenter'] as string | null) ?? ''
- pcsStationName.value = (data['pcsStationName'] as string | null) ?? ''
- brand.value = (data['brand'] as string | null) ?? ''
- model.value = (data['model'] as string | null) ?? ''
- acceptTime.value = (data['acceptTime'] as string | null) ?? ''
- acceptUserName.value = (data['acceptUserName'] as string | null) ?? ''
- // 初始化结单表单默认值
- infoEntry.value = '1' // 默认为手工录入
- teamLeaderId.value = (data['teamLeaderId'] as Number | null) ?? null
- teamLeaderName.value = (data['teamLeaderName'] as string | null) ?? ''
- returnType.value = workOrderStatus.value == 'to_finish' ? '1' : ''
- faultCode.value = (data['faultCode'] as string | null) ?? ''
- faultBarcode.value = (data['faultBarcode'] as string | null) ?? ''
- faultDesc.value = (data['faultDesc'] as string | null) ?? ''
- suspendReason.value = (data['suspendReason'] as string | null) ?? ''
- // 初始化附件数据
- const attachmentUrlsFromServer = (data['attachmentUrls'] as string | null) ?? ''
- if (attachmentUrlsFromServer.length > 0) {
- attachmentUrls.value = attachmentUrlsFromServer
- // 将逗号分隔的URL字符串转换为UploadResponse对象数组
- const urls = attachmentUrlsFromServer.split(',')
- const fileArr : UploadResponse[] = []
- for (let i = 0; i < urls.length; i++) {
- const url = urls[i]
- const item : UploadResponse = {
- url: url,
- fileId: '',
- fileName: url.substring(url.lastIndexOf('/') + 1),
- filePath: url,
- fileSize: 0,
- fileExt: url.substring(url.lastIndexOf('.') + 1),
- businessType: 'workOrder'
- }
- fileArr.push(item)
- }
- uploadedFiles.value = fileArr
- }
- pauseTime.value = (data['occurTime'] as string | null) ?? ''
- restartTime.value = (data['restartTime'] as string | null) ?? ''
- if(pauseTime.value != '' && restartTime.value != '') {
- const queryParams = {
- pauseTime: pauseTime.value,
- restartTime: restartTime.value,
- pcsDeviceName: pcsDeviceName.value,
- pcsStationName: pcsStationName.value,
- workOrderStatus: '结束'
- } as UTSJSONObject;
- const result = await listAutoMisInfo(queryParams)
- // 提取响应数据
- const resultObj = result as UTSJSONObject
- const code = resultObj['code'] as number
- const misInfo = resultObj['rows'] as UTSJSONObject[] | null
- if (code == 200 && misInfo != null) {
- if(misInfo.length > 0 && misInfo.length == 1) {
- // 有工作票号提示
- const workPermitNum2 = misInfo[0]['workPermitNum'] as string | null
- const misNo2 = misInfo[0]['misNo'] as string | null
-
- if (workPermitNum2 != null && workPermitNum2.length > 0) {
- const response = await getOrderList(1, 10, misNo2 ?? '', '')
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- if (rows != null && rows.length > 0) {
- misNo.value = ''
- // infoEntry.value = '2'
- uni.showToast({
- title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
- icon: 'none'
- });
- return
- } else {
- misNo.value = (misInfo[0]['misNo'] as string | null) ?? ''
- realStartTime.value = (misInfo[0]['realStartTime'] as string | null) ?? ''
- realEndTime.value = (misInfo[0]['realEndTime'] as string | null) ?? ''
- workPermitNum.value = (misInfo[0]['workPermitNum'] as string | null) ?? ''
- // 查询相关工作班成员
- listWorkPerson(misNo.value).then(response => {
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- repairOrderPersonList.value = rows ?? []
- if (rows != null && rows.length > 0) {
- // 查询负责人信息并回填
- for (const person of repairOrderPersonList.value) {
- // 严格判断isLeader为1(兼容数字/字符串类型)
- if (person.isLeader == 1) {
- teamLeaderName.value = (person.nickName as string | null) ?? '';
- teamLeaderId.value = (person.userId as Number | null) ?? null;
- break; // 找到后立即停止循环
- }
- }
- const nickNames = rows
- .filter(person => person.isLeader != 1)
- .map(person => (person.nickName as string | null) ?? '')
- .join(',');
- workGroupMemberName.value = nickNames;
-
- repairOrderPersonList.value.map(person => {
- // 构造查询参数:username 和 nickName
- const queryParams = {
- userName: person.userName, // 假设person对象有username字段
- nickName: person.nickName // 假设person对象有nickName字段
- };
- getUserList(queryParams).then(response => {
- const responseObj = response as UTSJSONObject
- const rows = responseObj['rows'] as UTSJSONObject[] | null
- if (rows == null || rows.length == 0) {
- let msg = "已匹配到MIS工单,但工作班成员'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
- if (person.isLeader == 1) {
- msg = "已匹配到MIS工单,但工作负责人'" + person.nickName + "'在系统中不存在,系统无法自动结单,请检查"
- }
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000 // 自定义显示时间,单位ms
- });
- }
- });
- })
-
- }
- })
- }
- } else {
- misNo.value = ''
- // infoEntry.value = '2'
- uni.showToast({
- title: '已匹配到MIS工单,但未关联工作票号,系统无法自动结单,请进入工作票录入方式。',
- icon: 'none'
- });
- return
- }
- } else if(misInfo.length == 0) {
- misNo.value = ''
- // infoEntry.value = '2'
- uni.showToast({
- title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
- icon: 'none'
- });
- return
- } else if(misInfo.length > 1) {
- infoEntryDisabled.value = false
- }
- }
- } else {
- infoEntryDisabled.value = true
- misNo.value = ''
- // infoEntry.value = '2'
- uni.showToast({
- title: '未找到匹配的MIS工单,请确认风机停复机时间是否已录入工效通系统或请进入工作票录入方式',
- icon: 'none'
- });
- }
- flowList.value = data['repairOrderFlowList'] as UTSJSONObject[]
- if (suspendReason.value != '' && flowList.value.length > 0) {
- // 获取最后一个 actionType 等于 'resume' 的项
- const lastResumeItem = flowList.value.findLast(item => item['actionType'] === 'resume') as UTSJSONObject | null
- if (lastResumeItem != null) {
- resumeInfo.value = lastResumeItem
- // 直接给 resumeTime 赋值,无需 formData
- resumeTime.value = (lastResumeItem['actionTime'] as string | null) ?? ''
- }
- const lastSuspendItem = flowList.value.findLast(item => (item['actionType'] as string | null) === 'to_approve') as UTSJSONObject | null
- if (lastSuspendItem != null) {
- suspendInfo.value = lastSuspendItem
- }
- }
- } else {
- const msg = resultObj['msg'] as string | null
- uni.showToast({
- title: msg ?? '加载失败',
- icon: 'none'
- })
- }
- } catch (e: any) {
- uni.showToast({
- title: e.message ?? '加载失败',
- icon: 'none'
- })
- } finally {
- loading.value = false
- }
- }
- // 页面加载
- onLoad((options: any) => {
- const params = options as UTSJSONObject
- const id = params['id'] as string | null
- const orderTypeParam = params['orderType'] as string | null
- if (id != null && orderTypeParam != null) {
- // 先尝试从参数中获取orderType
- // const orderTypeNumber = parseInt(orderTypeParam)
- orderType.value = orderTypeParam
- orderId.value = id
- loadDetail(id, orderTypeParam)
- }
- })
- // 初始化
- onMounted(() => {
- getUserAllList();
- loadInfoEntryDictList();
- loadWorkAreaDictList();
- })
- </script>
- <style lang="scss">
- .detail-page {
- flex: 1;
- background-color: #e8f0f9;
- }
- .detail-content {
- flex: 1;
- padding: 20rpx 0;
- }
- .info-section {
- margin: 0 30rpx 24rpx;
- .section-title {
- position: relative;
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- &::before {
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- width: 8rpx;
- height: 32rpx;
- background-color: #007aff;
- border-radius: 4rpx;
- }
- &-text {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .info-card {
- background-color: #ffffff;
- border-radius: 16rpx;
- padding: 30rpx;
- .info-item {
- flex-direction: row;
- padding: 20rpx 0;
- border-bottom: 1rpx solid #f0f0f0;
- &:last-child {
- border-bottom: none;
- }
- &.full-width {
- flex-direction: column;
- .info-label {
- margin-bottom: 12rpx;
- }
- .info-value {
- line-height: 44rpx;
- }
- }
- .info-label {
- width: 240rpx;
- font-size: 28rpx;
- color: #666666;
- white-space: nowrap;
- }
- .info-value {
- flex: 1;
- font-size: 28rpx;
- color: #333333;
- text-align: left;
- &.highlight {
- color: #007aff;
- font-weight: bold;
- }
- &.input {
- text-align: left;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- padding: 10rpx;
- }
- .input-with-clear {
- position: relative;
- display: flex;
- align-items: center;
- }
- .select-clear {
- position: absolute;
- right: 20rpx;
- color: #ccc;
- text-align: center;
- font-size: 40rpx;
- font-weight: bold;
- z-index: 1;
- }
- .input-with-select {
- position: relative;
- display: flex;
- align-items: center;
- }
- .select-mis-btn {
- line-height: 50rpx;
- text-align: center;
- position: absolute;
- right: 0rpx;
- padding: 6rpx 12rpx;
- background-color: #007aff;
- color: #fff;
- border-radius: 6rpx;
- font-size: 26rpx;
- z-index: 1;
- max-width: 100rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- .flow-item {
- padding: 20rpx 0;
- border-bottom: 1rpx solid #f0f0f0;
- &:last-child {
- border-bottom: none;
- }
- .flow-header {
- flex-direction: row;
- justify-content: space-between;
- margin-bottom: 10rpx;
- .flow-operator {
- font-size: 28rpx;
- color: #333333;
- font-weight: bold;
- }
- .flow-time {
- font-size: 24rpx;
- color: #999999;
- }
- }
- .flow-content {
- flex-direction: column;
- .flow-action {
- font-size: 26rpx;
- color: #666666;
- margin-bottom: 8rpx;
- }
- .flow-remark {
- font-size: 24rpx;
- color: #999999;
- background-color: #f5f5f5;
- padding: 10rpx;
- border-radius: 8rpx;
- }
- }
- }
- .no-data {
- text-align: center;
- padding: 40rpx 0;
- font-size: 28rpx;
- color: #999999;
- }
- }
- }
- .accept-button-container {
- padding: 30rpx 30rpx 50rpx;
- background-color: #ffffff;
- .accept-button {
- width: 100%;
- height: 80rpx;
- background-color: #007aff;
- color: #ffffff;
- font-size: 32rpx;
- border-radius: 16rpx;
- border: none;
- &:active {
- background-color: #0062cc;
- }
- }
- }
- .loading-mask {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- justify-content: center;
- align-items: center;
- background-color: rgba(0, 0, 0, 0.3);
- .loading-text {
- padding: 30rpx 60rpx;
- background-color: rgba(0, 0, 0, 0.7);
- color: #ffffff;
- font-size: 28rpx;
- border-radius: 12rpx;
- }
- }
- .picker-modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 1000;
- }
- .modal-mask {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- }
- .modal-content {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: #ffffff;
- border-top-left-radius: 16rpx;
- border-top-right-radius: 16rpx;
- min-height: 700rpx;
- }
- .modal-header {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .modal-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- .modal-close {
- font-size: 28rpx;
- color: #007aff;
- }
- .modal-body {
- max-height: 800rpx;
- min-height: 800rpx;
- }
- .picker-option {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 24rpx 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .picker-option.selected {
- background-color: #f8f9fa;
- }
- .picker-option:last-child {
- border-bottom: none;
- }
- .option-text {
- font-size: 28rpx;
- color: #333333;
- margin-bottom: 10rpx;
- }
- .option-text:last-child {
- margin-bottom: 0;
- }
- .option-check {
- font-size: 28rpx;
- color: #007aff;
- }
- .empty-tip {
- justify-content: space-between;
- padding: 24rpx 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #999;
- }
- .picker-option {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 24rpx 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .picker-option:last-child {
- border-bottom: none;
- }
- .picker-option.selected {
- background-color: #f8f9fa;
- }
- .picker-mis-option {
- justify-content: space-between;
- align-items: center;
- padding: 24rpx 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .picker-mis-option:last-child {
- border-bottom: none;
- }
- .picker-mis-option.selected {
- background-color: #f8f9fa;
- }
- .option-row {
- flex-direction: row;
- justify-content: space-around;
- align-items: center;
- }
- .option-text {
- font-size: 28rpx;
- color: #333333;
- }
- .mis-list {
- flex: 1;
- height: 100%;
- display: flex;
- flex-direction: column;
- }
- .empty-tip {
- text-align: center;
- padding: 40rpx;
- color: #999;
- font-size: 28rpx;
- }
- .form-item {
- flex-direction: row;
- padding: 20rpx 0;
- border-bottom: 1rpx solid #f0f0f0;
- }
- .reject-reason-textarea {
- width: 100%;
- min-height: 100rpx;
- line-height: 1.5;
- }
- .input-field {
- width: 100%;
- height: 60rpx;
- padding: 0 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- background-color: #f8f9fa;
- }
- .select-mis-btn {
- width: 150rpx;
- height: 60rpx;
- margin-left: 10rpx;
- background-color: #007aff;
- color: #fff;
- border: none;
- border-radius: 8rpx;
- font-size: 24rpx;
- }
- .textarea-field {
- width: 100%;
- min-height: 120rpx;
- padding: 20rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 8rpx;
- font-size: 28rpx;
- background-color: #f8f9fa;
- }
- .radio-label {
- display: flex;
- align-items: center;
- margin-right: 30rpx;
- }
- .quick-select-dropdown {
- position: absolute;
- top: 100%;
- left: 0;
- right: 0;
- background: #fff;
- border: 1rpx solid #ddd;
- border-top: none;
- z-index: 1000;
- max-height: 300rpx;
- }
- .quick-select-item {
- padding: 20rpx;
- border-bottom: 1rpx solid #eee;
- }
- .mis-no {
- font-size: 28rpx;
- color: #333;
- }
- .search-bar {
- padding: 20rpx 30rpx;
- background-color: #d7eafe;
- }
- .search-box {
- flex-direction: row;
- align-items: center;
- height: 72rpx;
- padding: 0 24rpx;
- background-color: #f5f5f5;
- border-radius: 36rpx;
- .search-icon {
- width: 32rpx;
- height: 32rpx;
- margin-right: 12rpx;
- }
- .search-input {
- flex: 1;
- font-size: 28rpx;
- color: #333333;
- }
- .clear-icon {
- margin-left: 12rpx;
- font-size: 28rpx;
- color: #999999;
- }
- }
- .mis-list {
- flex: 1;
- height: 100%;
- display: flex;
- flex-direction: column;
- }
- .select-users-count {
- margin-left: 10rpx;
- font-size: 24rpx;
- color: #666;
- }
- </style>
|