TaskConfigPanel.vue 104 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399
  1. <template>
  2. <div
  3. :class="['config-panel', { 'dispatch-config-panel': orderDispatchStyle }]"
  4. >
  5. <template v-if="orderDispatchStyle">
  6. <el-empty v-if="taskList.length === 0" description="暂无工序"></el-empty>
  7. <div v-else class="dispatch-style-panel">
  8. <div class="dispatch-report-type">
  9. <span class="dispatch-required">*</span>
  10. <span class="dispatch-report-label">报工类型:</span>
  11. <el-radio-group v-model="dispatchReportType">
  12. <el-radio :label="1">单件报工</el-radio>
  13. <el-radio :label="0">批量报工</el-radio>
  14. </el-radio-group>
  15. <div class="dispatch-plan-info">
  16. <span class="dispatch-plan-item">
  17. <span class="dispatch-plan-label">计划数量:</span>
  18. <span class="dispatch-plan-value">
  19. {{ dispatchPlanQuantityDisplay }}
  20. </span>
  21. </span>
  22. <span class="dispatch-plan-item">
  23. <span class="dispatch-plan-label">计划时间:</span>
  24. <span class="dispatch-plan-value">
  25. {{ dispatchPlanTimeDisplay }}
  26. </span>
  27. </span>
  28. </div>
  29. </div>
  30. <el-tabs
  31. v-model="activeTaskKey"
  32. type="border-card"
  33. class="dispatch-process-tabs"
  34. >
  35. <el-tab-pane
  36. v-for="(item, index) in dispatchTaskTabs"
  37. :key="dispatchTaskGroupKey(item)"
  38. :label="taskName(item, index)"
  39. :name="dispatchTaskGroupKey(item)"
  40. />
  41. </el-tabs>
  42. <div class="dispatch-process-meta">
  43. 工序编码:{{ taskCodeDisplay(activeTask) }},所属班组:{{
  44. dispatchTeamDisplay(activeTask)
  45. }}
  46. </div>
  47. <div class="dispatch-toolbar">
  48. <div class="dispatch-toolbar-left">
  49. <el-button
  50. v-if="showFirstTaskConfirmButton"
  51. type="primary"
  52. size="mini"
  53. :loading="dispatchToolbarLoading"
  54. :disabled="readonlyMode || isDispatchToolbarDisabled('confirm')"
  55. @click="handleFirstTaskConfirm"
  56. >
  57. 确定
  58. </el-button>
  59. <el-button
  60. type="primary"
  61. size="mini"
  62. :loading="dispatchToolbarLoading"
  63. :disabled="readonlyMode || isDispatchToolbarDisabled(1)"
  64. @click="handleDispatchToolbarAction(1)"
  65. >
  66. 任务派单
  67. </el-button>
  68. <el-button
  69. type="primary"
  70. size="mini"
  71. :loading="dispatchToolbarLoading"
  72. :disabled="readonlyMode || isDispatchToolbarDisabled(2)"
  73. @click="handleDispatchToolbarAction(2)"
  74. >
  75. 撤回
  76. </el-button>
  77. <el-button
  78. type="primary"
  79. size="mini"
  80. :loading="dispatchToolbarLoading"
  81. :disabled="readonlyMode || isDispatchToolbarDisabled(3)"
  82. @click="handleDispatchToolbarAction(3)"
  83. >
  84. 保存
  85. </el-button>
  86. <el-button
  87. type="success"
  88. size="mini"
  89. :loading="dispatchToolbarLoading"
  90. :disabled="
  91. readonlyMode || isDispatchToolbarDisabled('addStation')
  92. "
  93. @click="handleDispatchAddStation"
  94. >
  95. 添加工位
  96. </el-button>
  97. </div>
  98. <div class="dispatch-assign-mode">
  99. <span class="dispatch-assign-label">指派:</span>
  100. <el-radio-group :value="1" size="mini">
  101. <el-radio-button :label="1">工位</el-radio-button>
  102. <!-- <el-radio-button :label="3">产线</el-radio-button> -->
  103. </el-radio-group>
  104. </div>
  105. <div class="dispatch-toolbar-icons">
  106. <el-tooltip content="刷新" placement="top">
  107. <el-button
  108. square
  109. size="mini"
  110. :loading="dispatchRefreshLoading"
  111. @click="handleDispatchRefresh"
  112. >
  113. <i class="el-icon-refresh"></i>
  114. </el-button>
  115. </el-tooltip>
  116. <el-popover
  117. placement="bottom-end"
  118. width="220"
  119. trigger="click"
  120. popper-class="dispatch-column-popover"
  121. >
  122. <div class="dispatch-column-settings">
  123. <div class="dispatch-column-settings__title">列设置</div>
  124. <el-checkbox-group
  125. v-model="dispatchVisibleColumns"
  126. class="dispatch-column-settings__list"
  127. @change="handleDispatchColumnVisibleChange"
  128. >
  129. <el-checkbox
  130. v-for="column in dispatchColumnOptions"
  131. :key="column.key"
  132. :label="column.key"
  133. >
  134. {{ column.label }}
  135. </el-checkbox>
  136. </el-checkbox-group>
  137. </div>
  138. <el-button slot="reference" square size="mini">
  139. <i class="el-icon-s-operation"></i>
  140. </el-button>
  141. </el-popover>
  142. <el-tooltip
  143. :content="dotLineFullscreen ? '退出全屏' : '全屏展示'"
  144. placement="top"
  145. >
  146. <el-button square size="mini" @click="$emit('toggle-fullscreen')">
  147. <i
  148. :class="
  149. dotLineFullscreen
  150. ? 'el-icon-_screen-restore'
  151. : 'el-icon-full-screen'
  152. "
  153. ></i>
  154. </el-button>
  155. </el-tooltip>
  156. </div>
  157. </div>
  158. <div class="dispatch-table-wrap">
  159. <el-table
  160. ref="dispatchTable"
  161. :data="pagedDispatchObjectRows"
  162. border
  163. size="small"
  164. :row-key="dispatchObjectRowKey"
  165. :row-class-name="getDispatchTableRowClassName"
  166. height="100%"
  167. class="config-table dispatch-table"
  168. >
  169. <el-table-column
  170. type="index"
  171. label="序号"
  172. width="52"
  173. align="center"
  174. />
  175. <el-table-column width="44" align="center">
  176. <template slot="header">
  177. <el-checkbox
  178. class="dispatch-state-checkbox"
  179. :value="isCurrentPageDispatchChecked"
  180. :indeterminate="isCurrentPageDispatchIndeterminate"
  181. :disabled="
  182. readonlyMode || !currentPageSelectableDispatchRows.length
  183. "
  184. @change="handleCurrentPageDispatchCheckChange"
  185. />
  186. </template>
  187. <template slot-scope="{ row }">
  188. <el-tooltip
  189. :disabled="!isDeviceSnapshotLocked(row)"
  190. content="该工序已制定设备类型"
  191. placement="top"
  192. popper-class="dispatch-device-lock-tooltip"
  193. >
  194. <span class="dispatch-checkbox-wrap">
  195. <el-checkbox
  196. class="dispatch-state-checkbox"
  197. :value="isSelectedDispatchObject(row)"
  198. :disabled="isDispatchRowControlDisabled(row)"
  199. @change="handleDispatchObjectCheckChange(row, $event)"
  200. />
  201. </span>
  202. </el-tooltip>
  203. </template>
  204. </el-table-column>
  205. <el-table-column
  206. v-if="isDispatchColumnVisible('displayName')"
  207. prop="displayName"
  208. label="工位名称"
  209. align="center"
  210. min-width="180"
  211. >
  212. <template slot-scope="{ row }">
  213. <el-tooltip
  214. :disabled="!isDeviceSnapshotLocked(row) && !row.displayName"
  215. :content="
  216. isDeviceSnapshotLocked(row)
  217. ? '该工序已制定设备类型'
  218. : row.displayName || ''
  219. "
  220. placement="top"
  221. :popper-class="
  222. isDeviceSnapshotLocked(row)
  223. ? 'dispatch-device-lock-tooltip'
  224. : 'dispatch-workstation-tooltip'
  225. "
  226. >
  227. <span class="dispatch-workstation-name">
  228. {{ row.displayName }}
  229. </span>
  230. </el-tooltip>
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. v-if="isDispatchColumnVisible('code')"
  235. prop="code"
  236. label="编码"
  237. align="center"
  238. min-width="140"
  239. show-overflow-tooltip
  240. />
  241. <el-table-column
  242. v-if="isDispatchColumnVisible('assetCode')"
  243. prop="assetCode"
  244. label="设备编码"
  245. align="center"
  246. min-width="140"
  247. show-overflow-tooltip
  248. />
  249. <el-table-column
  250. v-if="isDispatchColumnVisible('assetName')"
  251. prop="assetName"
  252. label="设备名称"
  253. align="center"
  254. min-width="140"
  255. show-overflow-tooltip
  256. />
  257. <el-table-column
  258. v-if="isDispatchColumnVisible('assetModelType')"
  259. prop="assetModelType"
  260. label="设备型号"
  261. align="center"
  262. min-width="140"
  263. show-overflow-tooltip
  264. />
  265. <el-table-column
  266. v-if="isDispatchColumnVisible('assetCategoryLevelPath')"
  267. prop="assetCategoryLevelPath"
  268. label="设备类型"
  269. align="center"
  270. min-width="140"
  271. show-overflow-tooltip
  272. />
  273. <el-table-column
  274. v-if="isDispatchColumnVisible('status')"
  275. prop="status"
  276. label="状态"
  277. align="center"
  278. width="120"
  279. >
  280. <template slot-scope="{ row }">
  281. <span
  282. v-if="getDispatchStatusText(row.status)"
  283. :class="[
  284. 'dispatch-status-badge',
  285. { 'is-assigned': isDispatchRowAssigned(row) }
  286. ]"
  287. >
  288. {{ getDispatchStatusText(row.status) }}
  289. </span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column
  293. v-if="isDispatchColumnVisible('quantity')"
  294. label="数量"
  295. align="center"
  296. width="140"
  297. >
  298. <template slot-scope="{ row }">
  299. <el-tooltip
  300. :disabled="!isDeviceSnapshotLocked(row)"
  301. content="该工序已制定设备类型"
  302. placement="top"
  303. popper-class="dispatch-device-lock-tooltip"
  304. >
  305. <span class="dispatch-disabled-field">
  306. <el-input
  307. :value="row.quantity"
  308. placeholder="请输入数量"
  309. class="config-table-control"
  310. :disabled="isDispatchRowControlDisabled(row)"
  311. @input="handleDispatchRowQuantityInput(row, $event)"
  312. />
  313. </span>
  314. </el-tooltip>
  315. </template>
  316. </el-table-column>
  317. <el-table-column
  318. v-if="isDispatchColumnVisible('startTime')"
  319. label="计划开始时间"
  320. align="center"
  321. min-width="220"
  322. >
  323. <template slot-scope="{ row }">
  324. <el-tooltip
  325. :disabled="!isDeviceSnapshotLocked(row)"
  326. content="该工序已制定设备类型"
  327. placement="top"
  328. popper-class="dispatch-device-lock-tooltip"
  329. >
  330. <span class="dispatch-disabled-field">
  331. <el-date-picker
  332. v-model="row.executionStartTime"
  333. type="datetime"
  334. value-format="yyyy-MM-dd HH:mm:ss"
  335. placeholder="开始时间"
  336. clearable
  337. class="config-table-control"
  338. :disabled="isDispatchRowControlDisabled(row)"
  339. @change="handleDispatchRowStartTimeChange(row)"
  340. />
  341. </span>
  342. </el-tooltip>
  343. </template>
  344. </el-table-column>
  345. <el-table-column
  346. v-if="isDispatchColumnVisible('endTime')"
  347. label="计划完成时间"
  348. align="center"
  349. min-width="220"
  350. >
  351. <template slot-scope="{ row }">
  352. <div
  353. :class="{
  354. 'last-end-over-plan-wrap': isExecutionEndOverPlanEnd(
  355. getDispatchRowTask(row)
  356. ),
  357. 'end-over-delivery-wrap': isExecutionEndOverDelivery(
  358. getDispatchRowTask(row)
  359. )
  360. }"
  361. >
  362. <el-tooltip
  363. :disabled="!isDeviceSnapshotLocked(row)"
  364. content="该工序已制定设备类型"
  365. placement="top"
  366. popper-class="dispatch-device-lock-tooltip"
  367. >
  368. <span class="dispatch-disabled-field">
  369. <el-date-picker
  370. v-model="row.executionEndTime"
  371. type="datetime"
  372. value-format="yyyy-MM-dd HH:mm:ss"
  373. placeholder="完成时间"
  374. clearable
  375. class="config-table-control"
  376. :disabled="isDispatchRowControlDisabled(row)"
  377. @change="handleDispatchRowEndTimeChange(row)"
  378. />
  379. </span>
  380. </el-tooltip>
  381. </div>
  382. </template>
  383. </el-table-column>
  384. <el-table-column
  385. v-if="isDispatchColumnVisible('action')"
  386. label="操作"
  387. width="88"
  388. align="center"
  389. >
  390. <template slot-scope="{ row }">
  391. <el-link
  392. v-if="canDeleteAddedDispatchStation(row)"
  393. type="danger"
  394. :underline="false"
  395. @click="handleDeleteAddedDispatchStation(row)"
  396. >
  397. 删除
  398. </el-link>
  399. <el-popconfirm
  400. v-if="canResetDispatchRow(row)"
  401. title="确定要重置该条数据吗?"
  402. @confirm="handleDispatchRowReset(row)"
  403. >
  404. <template v-slot:reference>
  405. <el-link type="primary" :underline="false">重置</el-link>
  406. </template>
  407. </el-popconfirm>
  408. </template>
  409. </el-table-column>
  410. </el-table>
  411. </div>
  412. <div v-if="dispatchObjectRows.length" class="dispatch-pagination">
  413. <el-pagination
  414. background
  415. :current-page="dispatchPage"
  416. :page-size="dispatchPageSize"
  417. :page-sizes="[10, 20, 50, 100]"
  418. :total="dispatchObjectRows.length"
  419. layout="total, sizes, prev, pager, next, jumper"
  420. @size-change="handleDispatchPageSizeChange"
  421. @current-change="handleDispatchPageChange"
  422. />
  423. </div>
  424. </div>
  425. </template>
  426. <template v-else>
  427. <div class="panel-header">
  428. <div class="panel-title">工艺配置</div>
  429. <div class="panel-actions">
  430. <span v-if="readonlyMode" class="readonly-tip">
  431. 当前状态仅支持查看
  432. </span>
  433. <el-tooltip
  434. :content="dotLineFullscreen ? '退出全屏' : '全屏展示'"
  435. placement="top"
  436. >
  437. <el-button circle size="mini" @click="$emit('toggle-fullscreen')">
  438. <i
  439. :class="
  440. dotLineFullscreen
  441. ? 'el-icon-_screen-restore'
  442. : 'el-icon-full-screen'
  443. "
  444. ></i>
  445. </el-button>
  446. </el-tooltip>
  447. <el-button
  448. v-if="showApproveButton"
  449. type="primary"
  450. size="mini"
  451. :loading="approveLoading"
  452. :disabled="approveButtonDisabled"
  453. @click="$emit('approve')"
  454. >
  455. 审批
  456. </el-button>
  457. <el-button
  458. type="primary"
  459. size="mini"
  460. :disabled="!currentPlan || dotLineLoading || readonlyMode"
  461. @click="$emit('submit')"
  462. >
  463. 保存
  464. </el-button>
  465. </div>
  466. </div>
  467. <el-empty v-if="taskList.length === 0" description="暂无工艺"></el-empty>
  468. <div v-else class="task-config-table-wrap">
  469. <el-table
  470. :data="taskList"
  471. border
  472. size="small"
  473. row-key="_taskKey"
  474. :height="normalTableHeight"
  475. :max-height="normalTableMaxHeight"
  476. class="config-table"
  477. >
  478. <el-table-column
  479. type="index"
  480. label="序号"
  481. width="46"
  482. align="center"
  483. class-name="config-table-index-col"
  484. />
  485. <el-table-column
  486. label="工序名称"
  487. min-width="82"
  488. show-overflow-tooltip
  489. class-name="task-name-cell"
  490. align="center"
  491. >
  492. <template slot-scope="{ row, $index }">
  493. <span class="task-name-text">{{ taskName(row, $index) }}</span>
  494. </template>
  495. </el-table-column>
  496. <el-table-column label="工序并行" min-width="92" align="center">
  497. <template slot-scope="{ row }">
  498. <el-select
  499. v-model="row.isParallelism"
  500. placeholder="工序并行"
  501. :disabled="readonlyMode"
  502. class="config-table-control"
  503. @change="$emit('parallelism-change', row)"
  504. >
  505. <el-option label="否" :value="0" />
  506. <el-option label="是" :value="1" />
  507. </el-select>
  508. </template>
  509. </el-table-column>
  510. <el-table-column label="执行模式" min-width="84" align="center">
  511. <template slot-scope="{ row }">
  512. <el-select
  513. v-model="row.executionType"
  514. placeholder="执行模式"
  515. clearable
  516. :disabled="readonlyMode"
  517. class="config-table-control"
  518. @change="$emit('execution-type-change', row)"
  519. >
  520. <el-option
  521. v-for="opt in executionTypeOptions"
  522. :key="opt.value"
  523. :label="opt.label"
  524. :value="opt.value"
  525. />
  526. </el-select>
  527. </template>
  528. </el-table-column>
  529. <el-table-column
  530. :label="homemadeObjectLabel"
  531. min-width="116"
  532. align="center"
  533. >
  534. <template slot-scope="{ row }">
  535. <el-select
  536. v-if="execTypeNum(row) === execType.HOMEMADE"
  537. v-model="row.executionTeamId"
  538. placeholder="请选择"
  539. clearable
  540. filterable
  541. :disabled="readonlyMode"
  542. class="config-table-control"
  543. @change="$emit('execution-object-change', row)"
  544. >
  545. <!-- 班组排程需要按当前工序过滤工位;工厂排程回退为原 teamOptions。 -->
  546. <el-option
  547. v-for="team in homemadeOptions(row)"
  548. :key="team.id"
  549. :label="team.name"
  550. :value="team.id"
  551. />
  552. </el-select>
  553. <el-select
  554. v-else-if="execTypeNum(row) === execType.ENTRUST"
  555. v-model="row.executionFactoryId"
  556. placeholder="请选择"
  557. clearable
  558. filterable
  559. :disabled="readonlyMode"
  560. class="config-table-control"
  561. @change="$emit('execution-object-change', row)"
  562. >
  563. <el-option
  564. v-for="factory in factoryList"
  565. :key="factory.value"
  566. :label="factory.label"
  567. :value="factory.value"
  568. />
  569. </el-select>
  570. <el-select
  571. v-else-if="execTypeNum(row) === execType.OUTSOURCE"
  572. :value="''"
  573. placeholder="委外无需选择"
  574. disabled
  575. class="config-table-control"
  576. />
  577. <el-select
  578. v-else
  579. :value="''"
  580. placeholder="请先选择执行模式"
  581. disabled
  582. class="config-table-control"
  583. />
  584. </template>
  585. </el-table-column>
  586. <el-table-column
  587. v-if="showQuantityColumn"
  588. label="数量"
  589. min-width="82"
  590. align="center"
  591. >
  592. <!-- 数量只在班组排程工序配置中开放,工厂排程不渲染该列。 -->
  593. <template slot-scope="{ row }">
  594. <el-input-number
  595. v-model="row.quantity"
  596. :min="0"
  597. :controls="false"
  598. :precision="3"
  599. placeholder="请输入数量"
  600. :disabled="readonlyMode"
  601. class="config-table-control"
  602. />
  603. </template>
  604. </el-table-column>
  605. <el-table-column label="执行开始时间" min-width="164" align="center">
  606. <template slot-scope="{ row }">
  607. <el-date-picker
  608. v-model="row.executionStartTime"
  609. type="datetime"
  610. value-format="yyyy-MM-dd HH:mm:ss"
  611. placeholder="执行开始时间"
  612. clearable
  613. :disabled="readonlyMode"
  614. class="config-table-control"
  615. @change="$emit('time-change', row, 'executionStartTime')"
  616. />
  617. </template>
  618. </el-table-column>
  619. <el-table-column label="执行结束时间" min-width="164" align="center">
  620. <template slot-scope="{ row }">
  621. <div
  622. :class="{
  623. 'last-end-over-plan-wrap': isExecutionEndOverPlanEnd(row),
  624. 'end-over-delivery-wrap': isExecutionEndOverDelivery(row)
  625. }"
  626. >
  627. <el-date-picker
  628. v-model="row.executionEndTime"
  629. type="datetime"
  630. value-format="yyyy-MM-dd HH:mm:ss"
  631. placeholder="执行结束时间"
  632. clearable
  633. :disabled="readonlyMode"
  634. class="config-table-control"
  635. @change="$emit('time-change', row, 'executionEndTime')"
  636. />
  637. </div>
  638. </template>
  639. </el-table-column>
  640. <el-table-column label="操作" width="64" align="center">
  641. <template slot-scope="{ row }">
  642. <el-button
  643. type="text"
  644. size="small"
  645. :disabled="!currentPlan || dotLineLoading || readonlyMode"
  646. @click="$emit('row-submit', row)"
  647. >
  648. 缓存
  649. </el-button>
  650. </template>
  651. </el-table-column>
  652. </el-table>
  653. </div>
  654. </template>
  655. <choose-station
  656. v-if="orderDispatchStyle"
  657. ref="chooseStationRef"
  658. @chooseStationList="handleChooseStationList"
  659. />
  660. </div>
  661. </template>
  662. <script>
  663. import chooseStation from '@/views/workOrder/components/chooseStation.vue';
  664. import {
  665. checkAssignConfirm,
  666. listAssign,
  667. listByPlanIdAndTaskId,
  668. parameterGetByCode,
  669. resetAssignee,
  670. taskAssignment,
  671. taskRevoked,
  672. taskSave
  673. } from '@/api/mainData/index.js';
  674. import {
  675. getcheckLoginUserIsTeamLeader,
  676. releaseWorkOrder
  677. } from '@/api/workOrder/index.js';
  678. const DISPATCH_TEAM_ID_KEYS = [
  679. 'dispatchTeamId',
  680. 'teamId',
  681. 'firstTaskTeamId',
  682. 'firstTeamId',
  683. 'teamIds',
  684. 'executionTeamId'
  685. ];
  686. const DISPATCH_TEAM_NAME_KEYS = [
  687. 'dispatchTeamName',
  688. 'teamName',
  689. 'firstTaskTeamName',
  690. 'firstTeamName',
  691. 'teamNames',
  692. 'executionTeamName'
  693. ];
  694. export default {
  695. name: 'TaskConfigPanel',
  696. components: {
  697. chooseStation
  698. },
  699. props: {
  700. dotLineFullscreen: {
  701. type: Boolean,
  702. default: false
  703. },
  704. isCurrentPlanReadonly: {
  705. type: Boolean,
  706. default: false
  707. },
  708. orderDetailReadonly: {
  709. type: Boolean,
  710. default: false
  711. },
  712. currentPlan: {
  713. type: Object,
  714. default: null
  715. },
  716. dotLineLoading: {
  717. type: Boolean,
  718. default: false
  719. },
  720. taskList: {
  721. type: Array,
  722. default: () => []
  723. },
  724. executionTypeOptions: {
  725. type: Array,
  726. default: () => []
  727. },
  728. teamOptions: {
  729. type: Array,
  730. default: () => []
  731. },
  732. getHomemadeOptions: {
  733. type: Function,
  734. default: null
  735. },
  736. homemadeObjectLabel: {
  737. type: String,
  738. default: '执行对象'
  739. },
  740. showQuantityColumn: {
  741. type: Boolean,
  742. default: false
  743. },
  744. orderDispatchStyle: {
  745. type: Boolean,
  746. default: false
  747. },
  748. showApproveButton: {
  749. type: Boolean,
  750. default: false
  751. },
  752. approveButtonDisabled: {
  753. type: Boolean,
  754. default: true
  755. },
  756. approveLoading: {
  757. type: Boolean,
  758. default: false
  759. },
  760. tableMaxHeight: {
  761. type: Number,
  762. default: 390
  763. },
  764. fillTableHeight: {
  765. type: Boolean,
  766. default: false
  767. },
  768. factoryList: {
  769. type: Array,
  770. default: () => []
  771. },
  772. execType: {
  773. type: Object,
  774. required: true
  775. },
  776. taskName: {
  777. type: Function,
  778. required: true
  779. },
  780. execTypeNum: {
  781. type: Function,
  782. required: true
  783. },
  784. isExecutionEndOverDelivery: {
  785. type: Function,
  786. required: true
  787. },
  788. isExecutionEndOverPlanEnd: {
  789. type: Function,
  790. required: true
  791. }
  792. },
  793. data() {
  794. return {
  795. activeTaskKey: '',
  796. dispatchPage: 1,
  797. dispatchPageSize: 20,
  798. dispatchRowDraftMap: {},
  799. dispatchAssignmentMap: {},
  800. dispatchDeviceSnapshotMap: {},
  801. dispatchDeviceSnapshotLoading: false,
  802. dispatchDeviceSnapshotRequestKey: '',
  803. dispatchToolbarLoading: false,
  804. dispatchRefreshLoading: false,
  805. dispatchReportType: 1,
  806. dispatchColumnOptions: [
  807. { key: 'displayName', label: '工位名称' },
  808. { key: 'code', label: '编码' },
  809. { key: 'assetCode', label: '设备编码' },
  810. { key: 'assetName', label: '设备名称' },
  811. { key: 'assetModelType', label: '设备型号' },
  812. { key: 'assetCategoryLevelPath', label: '设备类型' },
  813. { key: 'status', label: '状态' },
  814. { key: 'quantity', label: '数量' },
  815. { key: 'startTime', label: '计划开始时间' },
  816. { key: 'endTime', label: '计划完成时间' },
  817. { key: 'action', label: '操作' }
  818. ],
  819. dispatchColumnVisible: {
  820. displayName: true,
  821. code: true,
  822. assetCode: true,
  823. assetName: true,
  824. assetModelType: true,
  825. assetCategoryLevelPath: true,
  826. status: true,
  827. quantity: true,
  828. startTime: true,
  829. endTime: true,
  830. action: true
  831. },
  832. suppressTaskListAssignReloadUntil: 0
  833. };
  834. },
  835. computed: {
  836. readonlyMode() {
  837. return this.orderDetailReadonly || this.isCurrentPlanReadonly;
  838. },
  839. dispatchVisibleColumns: {
  840. get() {
  841. return this.dispatchColumnOptions
  842. .filter((item) => this.dispatchColumnVisible[item.key] !== false)
  843. .map((item) => item.key);
  844. },
  845. set(keys) {
  846. const visibleKeys = new Set(keys);
  847. this.dispatchColumnOptions.forEach((item) => {
  848. this.$set(
  849. this.dispatchColumnVisible,
  850. item.key,
  851. visibleKeys.has(item.key)
  852. );
  853. });
  854. }
  855. },
  856. dispatchTaskTabs() {
  857. const groupMap = new Map();
  858. (this.taskList || []).forEach((item) => {
  859. const groupKey = this.dispatchTaskGroupKey(item);
  860. if (!groupMap.has(groupKey)) {
  861. groupMap.set(groupKey, item);
  862. }
  863. });
  864. return Array.from(groupMap.values());
  865. },
  866. activeTask() {
  867. return (
  868. (this.taskList || []).find(
  869. (item) => this.dispatchTaskGroupKey(item) === this.activeTaskKey
  870. ) ||
  871. this.dispatchTaskTabs[0] ||
  872. null
  873. );
  874. },
  875. showFirstTaskConfirmButton() {
  876. return (
  877. this.orderDispatchStyle &&
  878. !this.readonlyMode &&
  879. this.isFirstDispatchTask(this.activeTask)
  880. );
  881. },
  882. reportTypeValue() {
  883. return this.normalizeDispatchReportType(this.dispatchReportType);
  884. },
  885. dispatchPlanQuantityDisplay() {
  886. const plan = this.currentPlan || {};
  887. const num =
  888. plan.productNum ??
  889. plan.formingNum ??
  890. plan.planNum ??
  891. plan.requiredFormingNum ??
  892. '';
  893. const unit = plan.measuringUnit || plan.unit || '';
  894. const text = [num, unit]
  895. .filter((item) => item !== null && item !== undefined && item !== '')
  896. .join('');
  897. return text || '--';
  898. },
  899. dispatchPlanQuantityLimit() {
  900. const plan = this.currentPlan || {};
  901. return this.parseDispatchQuantity(
  902. plan.productNum ??
  903. plan.formingNum ??
  904. plan.planNum ??
  905. plan.requiredFormingNum ??
  906. ''
  907. );
  908. },
  909. dispatchPlanTimeDisplay() {
  910. const plan = this.currentPlan || {};
  911. const start =
  912. plan.startTime || plan.planStartTime || plan.executionStartTime || '';
  913. const end =
  914. plan.endTime ||
  915. plan.planEndTime ||
  916. plan.planCompleteTime ||
  917. plan.executionEndTime ||
  918. '';
  919. const startText = this.formatDispatchDateTime(start);
  920. const endText = this.formatDispatchDateTime(end);
  921. if (startText && endText) {
  922. return `${startText} 至 ${endText}`;
  923. }
  924. return startText || endText || '--';
  925. },
  926. dispatchObjectRows() {
  927. if (!this.activeTask) {
  928. return [];
  929. }
  930. return this.homemadeOptions(this.activeTask)
  931. .filter((item) => item.objectType !== 'person')
  932. .map((item) => {
  933. const displayName = String(item.name || '').replace(
  934. /^工位[::]/,
  935. ''
  936. );
  937. const rowKey = this.dispatchObjectRowKey(item);
  938. const task = this.getDispatchRowTask(item);
  939. const draft =
  940. this.dispatchRowDraftMap[this.dispatchRowDraftKey(item)] || {};
  941. const assignment = this.getDispatchAssignment(item);
  942. const defaultStartTime =
  943. this.activeTask.dispatchDefaultStartTime || '';
  944. const defaultEndTime = this.activeTask.dispatchDefaultEndTime || '';
  945. return {
  946. ...item,
  947. id: rowKey,
  948. displayName,
  949. quantity:
  950. draft.quantity !== undefined
  951. ? draft.quantity
  952. : task
  953. ? this.formatDispatchRowQuantity(task.quantity)
  954. : assignment
  955. ? this.formatDispatchRowQuantity(assignment.quantity)
  956. : '',
  957. executionStartTime:
  958. draft.executionStartTime !== undefined
  959. ? draft.executionStartTime
  960. : task?.executionStartTime ||
  961. assignment?.executionStartTime ||
  962. defaultStartTime,
  963. executionEndTime:
  964. draft.executionEndTime !== undefined
  965. ? draft.executionEndTime
  966. : task?.executionEndTime ||
  967. assignment?.executionEndTime ||
  968. defaultEndTime,
  969. status: assignment?.status || '',
  970. changeId: assignment?.changeId || '',
  971. teamTimeIds: task?.teamTimeIds || assignment?.teamTimeIds,
  972. weight: task?.weight || assignment?.weight || item.weight || '',
  973. code: item.code || item.workstationCode || '',
  974. assetCode: this.pickDispatchSingleValue([
  975. {
  976. source: item,
  977. keys: ['assetCode', 'deviceCode']
  978. },
  979. {
  980. source: item.extInfo,
  981. keys: ['assetCode', 'deviceCode']
  982. }
  983. ]),
  984. assetName: this.pickDispatchSingleValue([
  985. {
  986. source: item,
  987. keys: ['assetName', 'deviceName']
  988. },
  989. {
  990. source: item.extInfo,
  991. keys: ['assetName', 'deviceName']
  992. }
  993. ]),
  994. assetModelType: item.assetModelType || item.deviceModel || '',
  995. assetCategoryLevelPath:
  996. item.assetCategoryLevelPath || item.deviceType || ''
  997. };
  998. });
  999. },
  1000. pagedDispatchObjectRows() {
  1001. const start = (this.dispatchPage - 1) * this.dispatchPageSize;
  1002. return this.dispatchObjectRows.slice(
  1003. start,
  1004. start + this.dispatchPageSize
  1005. );
  1006. },
  1007. selectedDispatchObjectRows() {
  1008. return this.dispatchObjectRows.filter(
  1009. (row) =>
  1010. !this.isDeviceSnapshotLocked(row) &&
  1011. this.isSelectedDispatchObject(row)
  1012. );
  1013. },
  1014. currentPageSelectableDispatchRows() {
  1015. return this.pagedDispatchObjectRows.filter(
  1016. (row) => !this.isDeviceSnapshotLocked(row)
  1017. );
  1018. },
  1019. currentPageSelectedDispatchRows() {
  1020. return this.currentPageSelectableDispatchRows.filter((row) =>
  1021. this.isSelectedDispatchObject(row)
  1022. );
  1023. },
  1024. isCurrentPageDispatchChecked() {
  1025. return (
  1026. this.currentPageSelectableDispatchRows.length > 0 &&
  1027. this.currentPageSelectedDispatchRows.length ===
  1028. this.currentPageSelectableDispatchRows.length
  1029. );
  1030. },
  1031. isCurrentPageDispatchIndeterminate() {
  1032. return (
  1033. this.currentPageSelectedDispatchRows.length > 0 &&
  1034. this.currentPageSelectedDispatchRows.length <
  1035. this.currentPageSelectableDispatchRows.length
  1036. );
  1037. },
  1038. normalTableHeight() {
  1039. return this.fillTableHeight ? '100%' : undefined;
  1040. },
  1041. normalTableMaxHeight() {
  1042. return this.fillTableHeight ? undefined : this.tableMaxHeight;
  1043. }
  1044. },
  1045. watch: {
  1046. activeTaskKey(newKey, oldKey) {
  1047. this.clearDispatchSelectionsByTaskKey(oldKey);
  1048. this.dispatchPage = 1;
  1049. this.loadDispatchAssignData();
  1050. this.loadDispatchDeviceSnapshots();
  1051. },
  1052. currentPlan: {
  1053. immediate: true,
  1054. handler() {
  1055. this.dispatchReportType = this.getDefaultDispatchReportType();
  1056. this.dispatchRowDraftMap = {};
  1057. this.dispatchAssignmentMap = {};
  1058. this.dispatchDeviceSnapshotMap = {};
  1059. this.dispatchPage = 1;
  1060. this.loadDispatchAssignData();
  1061. this.loadDispatchDeviceSnapshots();
  1062. }
  1063. },
  1064. dispatchObjectRows() {
  1065. const maxPage = Math.max(
  1066. 1,
  1067. Math.ceil(this.dispatchObjectRows.length / this.dispatchPageSize)
  1068. );
  1069. if (this.dispatchPage > maxPage) {
  1070. this.dispatchPage = maxPage;
  1071. }
  1072. },
  1073. taskList: {
  1074. immediate: true,
  1075. handler(list) {
  1076. if (!Array.isArray(list) || list.length === 0) {
  1077. this.activeTaskKey = '';
  1078. this.dispatchRowDraftMap = {};
  1079. this.dispatchDeviceSnapshotMap = {};
  1080. this.dispatchPage = 1;
  1081. return;
  1082. }
  1083. const hasActive = list.some(
  1084. (item) => this.dispatchTaskGroupKey(item) === this.activeTaskKey
  1085. );
  1086. if (!hasActive) {
  1087. this.activeTaskKey = this.dispatchTaskGroupKey(list[0]);
  1088. }
  1089. if (Date.now() < this.suppressTaskListAssignReloadUntil) {
  1090. return;
  1091. }
  1092. this.$nextTick(() => {
  1093. this.loadDispatchAssignData();
  1094. this.loadDispatchDeviceSnapshots();
  1095. });
  1096. }
  1097. }
  1098. },
  1099. methods: {
  1100. normalizeDispatchReportType(value) {
  1101. return String(value) === '0' ? 0 : 1;
  1102. },
  1103. getDefaultDispatchReportType() {
  1104. const value =
  1105. this.currentPlan?.singleReport ??
  1106. this.currentPlan?.reportType ??
  1107. this.currentPlan?.workOrderSingleReport;
  1108. return this.normalizeDispatchReportType(value);
  1109. },
  1110. isDispatchColumnVisible(key) {
  1111. return this.dispatchColumnVisible[key] !== false;
  1112. },
  1113. handleDispatchColumnVisibleChange(keys) {
  1114. if (!keys.length) {
  1115. this.dispatchVisibleColumns = ['displayName'];
  1116. this.$message.warning('至少保留一列');
  1117. }
  1118. this.$nextTick(() => {
  1119. this.$refs.dispatchTable?.doLayout?.();
  1120. });
  1121. },
  1122. parseDispatchQuantity(value) {
  1123. if (value === null || value === undefined || value === '') {
  1124. return null;
  1125. }
  1126. const text = String(value).trim();
  1127. if (!/^([1-9]\d*(\.\d+)?|0\.\d*[1-9]\d*)$/.test(text)) {
  1128. return null;
  1129. }
  1130. const num = Number(text);
  1131. return Number.isFinite(num) ? num : null;
  1132. },
  1133. formatDispatchDateTime(value) {
  1134. if (!value) {
  1135. return '';
  1136. }
  1137. const text = String(value);
  1138. if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(text)) {
  1139. return text.slice(0, 16);
  1140. }
  1141. if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(text)) {
  1142. return text.replace('T', ' ').slice(0, 16);
  1143. }
  1144. return text;
  1145. },
  1146. getDispatchPlanStartTime() {
  1147. const plan = this.currentPlan || {};
  1148. return (
  1149. plan.startTime || plan.planStartTime || plan.executionStartTime || ''
  1150. );
  1151. },
  1152. getDispatchPlanEndTime() {
  1153. const plan = this.currentPlan || {};
  1154. return (
  1155. plan.endTime ||
  1156. plan.planEndTime ||
  1157. plan.planCompleteTime ||
  1158. plan.executionEndTime ||
  1159. ''
  1160. );
  1161. },
  1162. getDispatchTaskDefaultStartTime(row = this.activeTask) {
  1163. return row?.executionStartTime || row?.startTime || '';
  1164. },
  1165. getDispatchTaskDefaultEndTime(row = this.activeTask) {
  1166. return row?.executionEndTime || row?.endTime || '';
  1167. },
  1168. parseDispatchTime(value) {
  1169. if (!value) {
  1170. return null;
  1171. }
  1172. if (value instanceof Date) {
  1173. const dateTime = value.getTime();
  1174. return Number.isFinite(dateTime) ? dateTime : null;
  1175. }
  1176. const text = String(value).replace('T', ' ').replace(/-/g, '/');
  1177. const dateTime = new Date(text).getTime();
  1178. return Number.isFinite(dateTime) ? dateTime : null;
  1179. },
  1180. getDispatchSourceTaskId(row) {
  1181. return (
  1182. row?.sourceTaskId ?? row?.firstTaskId ?? row?.taskId ?? row?.id ?? ''
  1183. );
  1184. },
  1185. dispatchTaskGroupKey(row) {
  1186. return String(
  1187. row?.sourceTaskId ??
  1188. row?.firstTaskId ??
  1189. row?.taskId ??
  1190. row?.id ??
  1191. row?._taskKey ??
  1192. ''
  1193. );
  1194. },
  1195. isFirstDispatchTask(row) {
  1196. if (!row) {
  1197. return false;
  1198. }
  1199. const firstTaskId =
  1200. this.currentPlan?.firstTaskId ??
  1201. this.currentPlan?.taskId ??
  1202. this.currentPlan?.sourceTaskId ??
  1203. '';
  1204. if (
  1205. firstTaskId !== null &&
  1206. firstTaskId !== undefined &&
  1207. firstTaskId !== ''
  1208. ) {
  1209. return (
  1210. String(
  1211. row.sourceTaskId ?? row.firstTaskId ?? row.taskId ?? row.id
  1212. ) === String(firstTaskId)
  1213. );
  1214. }
  1215. const index = this.dispatchTaskTabs.findIndex(
  1216. (item) =>
  1217. this.dispatchTaskGroupKey(item) === this.dispatchTaskGroupKey(row)
  1218. );
  1219. return index === 0;
  1220. },
  1221. dispatchObjectRowKey(row) {
  1222. const rawId =
  1223. row?.rawId ??
  1224. row?.workstationId ??
  1225. row?.factoryWorkstationId ??
  1226. row?.stationId ??
  1227. row?.id ??
  1228. row?.code ??
  1229. row?.workstationCode ??
  1230. '';
  1231. if (rawId !== null && rawId !== undefined && rawId !== '') {
  1232. return String(row?.objectType || 'workstation') + ':' + String(rawId);
  1233. }
  1234. return String(row?.name || row?.displayName || '');
  1235. },
  1236. getDispatchAssignmentKey(row) {
  1237. return `${this.dispatchTaskGroupKey(
  1238. this.activeTask
  1239. )}::${this.dispatchObjectRowKey(row)}`;
  1240. },
  1241. getDispatchAssignment(row) {
  1242. return this.dispatchAssignmentMap[this.getDispatchAssignmentKey(row)];
  1243. },
  1244. removeDispatchAssignment(row) {
  1245. const key = this.getDispatchAssignmentKey(row);
  1246. if (key) {
  1247. this.$delete(this.dispatchAssignmentMap, key);
  1248. }
  1249. },
  1250. getDispatchWorkOrderId() {
  1251. const plan = this.currentPlan || {};
  1252. return plan.workOrderId || plan.orderId || plan.sourceWorkOrderId || '';
  1253. },
  1254. getDispatchPlanId() {
  1255. const plan = this.currentPlan || {};
  1256. return plan.productionPlanId || plan.planId || plan.id || '';
  1257. },
  1258. getDeviceSnapshotRequestKey(row = this.activeTask) {
  1259. const planId = this.getDispatchPlanId();
  1260. const taskId = this.getDispatchSourceTaskId(row);
  1261. return planId && taskId ? `${planId}::${taskId}` : '';
  1262. },
  1263. normalizeDeviceSnapshotCode(value) {
  1264. if (value === null || value === undefined || value === '') {
  1265. return '';
  1266. }
  1267. return String(value).trim();
  1268. },
  1269. getDispatchDeviceSnapshotCandidateCodes(row) {
  1270. return [
  1271. row?.assetCode,
  1272. row?.deviceCode,
  1273. row?.extInfo?.assetCode,
  1274. row?.extInfo?.deviceCode
  1275. ]
  1276. .map((item) => this.normalizeDeviceSnapshotCode(item))
  1277. .filter(Boolean);
  1278. },
  1279. isDispatchDeviceSnapshotCodeMatched(row, snapshotCodes = {}) {
  1280. return this.getDispatchDeviceSnapshotCandidateCodes(row).some(
  1281. (code) => snapshotCodes[code]
  1282. );
  1283. },
  1284. hasDispatchDeviceSnapshotMatchedRow(snapshotCodes = {}) {
  1285. return this.dispatchObjectRows.some((row) =>
  1286. this.isDispatchDeviceSnapshotCodeMatched(row, snapshotCodes)
  1287. );
  1288. },
  1289. isDeviceSnapshotLocked(row) {
  1290. if (!this.orderDispatchStyle || !row) {
  1291. return false;
  1292. }
  1293. const requestKey = this.getDeviceSnapshotRequestKey();
  1294. if (
  1295. !requestKey ||
  1296. !Object.prototype.hasOwnProperty.call(
  1297. this.dispatchDeviceSnapshotMap,
  1298. requestKey
  1299. )
  1300. ) {
  1301. return false;
  1302. }
  1303. const snapshotCodes = this.dispatchDeviceSnapshotMap[requestKey] || {};
  1304. if (
  1305. !Object.keys(snapshotCodes).length ||
  1306. !this.hasDispatchDeviceSnapshotMatchedRow(snapshotCodes)
  1307. ) {
  1308. return false;
  1309. }
  1310. return !this.isDispatchDeviceSnapshotCodeMatched(row, snapshotCodes);
  1311. },
  1312. clearDeviceSnapshotLockedSelections() {
  1313. this.dispatchObjectRows.forEach((row) => {
  1314. if (
  1315. this.isDeviceSnapshotLocked(row) &&
  1316. this.isSelectedDispatchObject(row)
  1317. ) {
  1318. this.clearDispatchObject(row);
  1319. }
  1320. });
  1321. },
  1322. async loadDispatchDeviceSnapshots() {
  1323. if (
  1324. !this.orderDispatchStyle ||
  1325. this.readonlyMode ||
  1326. !this.activeTask ||
  1327. !this.currentPlan
  1328. ) {
  1329. return;
  1330. }
  1331. const planId = this.getDispatchPlanId();
  1332. const taskId = this.getDispatchSourceTaskId(this.activeTask);
  1333. const requestKey = this.getDeviceSnapshotRequestKey(this.activeTask);
  1334. if (!planId || !taskId || !requestKey) {
  1335. return;
  1336. }
  1337. this.dispatchDeviceSnapshotLoading = true;
  1338. this.dispatchDeviceSnapshotRequestKey = requestKey;
  1339. try {
  1340. const res = await listByPlanIdAndTaskId({ planId, taskId });
  1341. if (this.dispatchDeviceSnapshotRequestKey !== requestKey) {
  1342. return;
  1343. }
  1344. const snapshotCodes = {};
  1345. (Array.isArray(res) ? res : []).forEach((item) => {
  1346. const code = this.normalizeDeviceSnapshotCode(item?.deviceCode);
  1347. if (code) {
  1348. snapshotCodes[code] = true;
  1349. }
  1350. });
  1351. this.$set(this.dispatchDeviceSnapshotMap, requestKey, snapshotCodes);
  1352. this.clearDeviceSnapshotLockedSelections();
  1353. } catch (e) {
  1354. if (this.dispatchDeviceSnapshotRequestKey === requestKey) {
  1355. this.$delete(this.dispatchDeviceSnapshotMap, requestKey);
  1356. }
  1357. this.$message.warning(e.message || '获取工序设备快照失败');
  1358. } finally {
  1359. if (this.dispatchDeviceSnapshotRequestKey === requestKey) {
  1360. this.dispatchDeviceSnapshotLoading = false;
  1361. }
  1362. }
  1363. },
  1364. getDispatchWorkCenterId(row = this.activeTask) {
  1365. const plan = this.currentPlan || {};
  1366. return (
  1367. row?.workCenterId ||
  1368. row?.workcenterId ||
  1369. row?.sourceWorkCenterId ||
  1370. plan.workCenterId ||
  1371. ''
  1372. );
  1373. },
  1374. getDispatchWorkCenterName(row = this.activeTask) {
  1375. const plan = this.currentPlan || {};
  1376. return (
  1377. row?.workCenterName ||
  1378. row?.workcenterName ||
  1379. row?.sourceWorkCenterName ||
  1380. plan.workCenterName ||
  1381. ''
  1382. );
  1383. },
  1384. normalizeDispatchSingleValue(value) {
  1385. if (Array.isArray(value)) {
  1386. return value.length
  1387. ? this.normalizeDispatchSingleValue(value[0])
  1388. : '';
  1389. }
  1390. if (value === null || value === undefined) {
  1391. return '';
  1392. }
  1393. const text = String(value).trim();
  1394. if (!text) {
  1395. return '';
  1396. }
  1397. if (['undefined', 'null'].includes(text.toLowerCase())) {
  1398. return '';
  1399. }
  1400. return text.includes(',') ? text.split(',')[0].trim() : text;
  1401. },
  1402. pickDispatchSingleValue(groups = []) {
  1403. for (const group of groups) {
  1404. const source = group?.source || {};
  1405. const keys = Array.isArray(group?.keys) ? group.keys : [];
  1406. for (const key of keys) {
  1407. const value = this.normalizeDispatchSingleValue(source[key]);
  1408. if (value) {
  1409. return value;
  1410. }
  1411. }
  1412. }
  1413. return '';
  1414. },
  1415. pickDispatchTeamId(groups = []) {
  1416. for (const group of groups) {
  1417. const source = group?.source || {};
  1418. const keys = Array.isArray(group?.keys) ? group.keys : [];
  1419. for (const key of keys) {
  1420. const value = this.normalizeDispatchSingleValue(source[key]);
  1421. if (value && !String(value).includes(':')) {
  1422. return value;
  1423. }
  1424. }
  1425. }
  1426. return '';
  1427. },
  1428. getDispatchTeamId() {
  1429. const plan = this.currentPlan || {};
  1430. const task = this.activeTask || {};
  1431. return this.pickDispatchTeamId([
  1432. { source: task, keys: DISPATCH_TEAM_ID_KEYS },
  1433. { source: plan, keys: DISPATCH_TEAM_ID_KEYS }
  1434. ]);
  1435. },
  1436. getDispatchTeamName() {
  1437. const plan = this.currentPlan || {};
  1438. const task = this.activeTask || {};
  1439. return this.pickDispatchSingleValue([
  1440. { source: task, keys: DISPATCH_TEAM_NAME_KEYS },
  1441. { source: plan, keys: DISPATCH_TEAM_NAME_KEYS }
  1442. ]);
  1443. },
  1444. getDispatchTaskTeamId(row = this.activeTask) {
  1445. const teamIdKeys = [
  1446. 'dispatchTeamId',
  1447. 'teamId',
  1448. 'firstTaskTeamId',
  1449. 'firstTeamId',
  1450. 'teamIds',
  1451. 'executionTeamId'
  1452. ];
  1453. return this.pickDispatchTeamId([
  1454. { source: row || {}, keys: teamIdKeys },
  1455. { source: this.currentPlan || {}, keys: teamIdKeys }
  1456. ]);
  1457. },
  1458. getDispatchTaskLeaderId(row = this.activeTask) {
  1459. const leaderKeys = [
  1460. 'dispatchTeamLeaderId',
  1461. 'executionTeamLeaderId',
  1462. 'teamLeaderUserId',
  1463. 'leaderUserId',
  1464. 'executionLeaderId'
  1465. ];
  1466. return this.pickDispatchSingleValue([
  1467. { source: row || {}, keys: leaderKeys },
  1468. { source: this.currentPlan || {}, keys: leaderKeys }
  1469. ]);
  1470. },
  1471. getUserSingleValueSet(value) {
  1472. const result = new Set();
  1473. const append = (source) => {
  1474. if (Array.isArray(source)) {
  1475. source.forEach(append);
  1476. return;
  1477. }
  1478. if (source === null || source === undefined || source === '') {
  1479. return;
  1480. }
  1481. String(source)
  1482. .split(',')
  1483. .map((item) => item.trim())
  1484. .filter(Boolean)
  1485. .forEach((item) => result.add(String(item)));
  1486. };
  1487. append(value);
  1488. return result;
  1489. },
  1490. getCurrentUserInfo() {
  1491. return this.$store?.state?.user?.info || {};
  1492. },
  1493. getCurrentUserTeamIdSet() {
  1494. const userInfo = this.getCurrentUserInfo();
  1495. const ids = this.getUserSingleValueSet(userInfo.teamId);
  1496. (userInfo.teamList || []).forEach((item) => {
  1497. const id = item?.teamId ?? item?.id;
  1498. if (id !== null && id !== undefined && id !== '') {
  1499. ids.add(String(id));
  1500. }
  1501. });
  1502. return ids;
  1503. },
  1504. getCurrentUserWorkCenterIdSet() {
  1505. const userInfo = this.getCurrentUserInfo();
  1506. const ids = this.getUserSingleValueSet(userInfo.workCenterIds);
  1507. (userInfo.centerList || []).forEach((item) => {
  1508. const id = item?.centerId ?? item?.id;
  1509. if (id !== null && id !== undefined && id !== '') {
  1510. ids.add(String(id));
  1511. }
  1512. });
  1513. return ids;
  1514. },
  1515. getDispatchToolbarPermissionState(action) {
  1516. if (this.readonlyMode) {
  1517. return { allowed: false, message: '当前状态仅支持查看' };
  1518. }
  1519. if (!this.activeTask) {
  1520. return { allowed: false, message: '请选择工序' };
  1521. }
  1522. const teamId = this.getDispatchTaskTeamId(this.activeTask);
  1523. const userTeamIds = this.getCurrentUserTeamIdSet();
  1524. if (!teamId || !userTeamIds.has(String(teamId))) {
  1525. return {
  1526. allowed: false,
  1527. message: '当前登录人不属于该工序所属班组'
  1528. };
  1529. }
  1530. const leaderId = this.getDispatchTaskLeaderId(this.activeTask);
  1531. const userId = this.getCurrentUserInfo().userId;
  1532. if (!leaderId || String(leaderId) !== String(userId)) {
  1533. return { allowed: false, message: '当前班组不是对应组长' };
  1534. }
  1535. if (
  1536. action === 'addStation' &&
  1537. Number(this.activeTask.assignType ?? 1) === 3
  1538. ) {
  1539. return { allowed: false, message: '产线指派不能添加工位' };
  1540. }
  1541. return { allowed: true, message: '' };
  1542. },
  1543. isDispatchToolbarDisabled(action) {
  1544. return !this.getDispatchToolbarPermissionState(action).allowed;
  1545. },
  1546. validateDispatchToolbarPermission(action) {
  1547. const state = this.getDispatchToolbarPermissionState(action);
  1548. if (!state.allowed) {
  1549. this.$message.warning(state.message);
  1550. return false;
  1551. }
  1552. return true;
  1553. },
  1554. getDispatchAssigneeId(row) {
  1555. const rawId =
  1556. row?.rawId ??
  1557. row?.workstationId ??
  1558. row?.factoryWorkstationId ??
  1559. row?.stationId ??
  1560. row?.assigneeId ??
  1561. row?.id ??
  1562. '';
  1563. return String(rawId).replace(/^(workstation|person|team):/, '');
  1564. },
  1565. normalizeDispatchLongId(value) {
  1566. if (value === null || value === undefined || value === '') {
  1567. return '';
  1568. }
  1569. const text = String(value).trim();
  1570. return /^\d+$/.test(text) ? text : '';
  1571. },
  1572. getDispatchDeviceId(row) {
  1573. return (
  1574. this.normalizeDispatchLongId(row?.assetId) ||
  1575. this.normalizeDispatchLongId(row?.extInfo?.assetId) ||
  1576. this.normalizeDispatchLongId(row?.deviceId) ||
  1577. this.normalizeDispatchLongId(row?.extInfo?.deviceId) ||
  1578. ''
  1579. );
  1580. },
  1581. getAssignmentTypeCode(value) {
  1582. if (value && typeof value === 'object') {
  1583. return value.code ?? value.value ?? value.id ?? '';
  1584. }
  1585. return value ?? '';
  1586. },
  1587. getDispatchStatusText(status) {
  1588. if (status === null || status === undefined || status === '') {
  1589. return '';
  1590. }
  1591. if (typeof status === 'object') {
  1592. return status.desc || status.name || status.label || '';
  1593. }
  1594. return String(status);
  1595. },
  1596. canResetDispatchRow(row) {
  1597. if (!this.getDispatchToolbarPermissionState('reset').allowed) {
  1598. return false;
  1599. }
  1600. const data = this.getDispatchActionRowData(row);
  1601. if (
  1602. data.status === null ||
  1603. data.status === undefined ||
  1604. data.status === ''
  1605. ) {
  1606. return false;
  1607. }
  1608. return String(this.getAssignmentTypeCode(data.status)) !== '1';
  1609. },
  1610. canDeleteAddedDispatchStation(row) {
  1611. if (!row || String(row.isNew ?? '') !== '1') {
  1612. return false;
  1613. }
  1614. const data = this.getDispatchActionRowData(row);
  1615. const rawStatusCode = this.getAssignmentTypeCode(data?.status);
  1616. const statusCode =
  1617. rawStatusCode === null ||
  1618. rawStatusCode === undefined ||
  1619. rawStatusCode === ''
  1620. ? NaN
  1621. : Number(rawStatusCode);
  1622. const statusText = this.getDispatchStatusText(data?.status);
  1623. return (
  1624. statusCode !== 0 &&
  1625. statusCode !== 1 &&
  1626. statusText !== '已保存' &&
  1627. statusText !== '保存' &&
  1628. statusText !== '已派单' &&
  1629. statusText !== '派单'
  1630. );
  1631. },
  1632. isDispatchRowAssigned(row) {
  1633. const data =
  1634. typeof this.getDispatchActionRowData === 'function'
  1635. ? this.getDispatchActionRowData(row)
  1636. : row || {};
  1637. const statusCode = this.getAssignmentTypeCode(data?.status);
  1638. if (String(statusCode) === '1') {
  1639. return true;
  1640. }
  1641. const statusText = this.getDispatchStatusText(data?.status);
  1642. return statusText === '已派单' || statusText === '派单';
  1643. },
  1644. isDispatchRowControlDisabled(row) {
  1645. return this.readonlyMode || this.isDeviceSnapshotLocked(row);
  1646. },
  1647. getDispatchTableRowClassName({ row }) {
  1648. if (this.isDeviceSnapshotLocked(row)) {
  1649. return 'dispatch-row-device-locked';
  1650. }
  1651. return this.readonlyMode && this.isDispatchRowAssigned(row)
  1652. ? 'dispatch-row-assigned'
  1653. : '';
  1654. },
  1655. normalizeDispatchAssignment(item) {
  1656. const assigneeId =
  1657. item.assigneeId || item.workStationId || item.workstationId || '';
  1658. return {
  1659. quantity: item.quantity,
  1660. weight: item.weight,
  1661. executionStartTime: item.startTime || item.executionStartTime || '',
  1662. executionEndTime: item.endTime || item.executionEndTime || '',
  1663. changeId: item.id || item.changeId || '',
  1664. status: item.status,
  1665. teamTimeIds: item.teamTimeIds,
  1666. assigneeId
  1667. };
  1668. },
  1669. async loadDispatchAssignData() {
  1670. if (!this.orderDispatchStyle || !this.activeTask || !this.currentPlan) {
  1671. return;
  1672. }
  1673. const taskId = this.getDispatchSourceTaskId(this.activeTask);
  1674. const workOrderId = this.getDispatchWorkOrderId();
  1675. const teamId = this.getDispatchTeamId();
  1676. if (!taskId || !workOrderId || !teamId) {
  1677. return;
  1678. }
  1679. const groupKey = this.dispatchTaskGroupKey(this.activeTask);
  1680. const params = {
  1681. workOrderId,
  1682. workCenterId: this.getDispatchWorkCenterId(),
  1683. taskId,
  1684. teamId
  1685. };
  1686. try {
  1687. const res = await listAssign(params);
  1688. const nextMap = Object.keys(this.dispatchAssignmentMap).reduce(
  1689. (map, key) => {
  1690. if (!key.startsWith(`${groupKey}::`)) {
  1691. map[key] = this.dispatchAssignmentMap[key];
  1692. }
  1693. return map;
  1694. },
  1695. {}
  1696. );
  1697. (Array.isArray(res) ? res : []).forEach((assignRecord) => {
  1698. (assignRecord.assignees || []).forEach((item) => {
  1699. const typeCode = this.getAssignmentTypeCode(item.assigneeType);
  1700. if (String(typeCode) !== '1') {
  1701. return;
  1702. }
  1703. const assignment = this.normalizeDispatchAssignment(item);
  1704. const key = `${groupKey}::workstation:${assignment.assigneeId}`;
  1705. nextMap[key] = assignment;
  1706. });
  1707. });
  1708. this.dispatchAssignmentMap = nextMap;
  1709. } catch (e) {
  1710. this.$message.warning(e.message || '获取派单数据失败');
  1711. }
  1712. },
  1713. async handleDispatchRefresh() {
  1714. if (this.dispatchRefreshLoading) {
  1715. return;
  1716. }
  1717. this.dispatchRefreshLoading = true;
  1718. try {
  1719. await this.loadDispatchAssignData();
  1720. this.$nextTick(() => {
  1721. this.$refs.dispatchTable?.doLayout?.();
  1722. });
  1723. } finally {
  1724. this.dispatchRefreshLoading = false;
  1725. }
  1726. },
  1727. isEmptyDispatchQuantity(value) {
  1728. if (value === null || value === undefined || value === '') {
  1729. return true;
  1730. }
  1731. const text = String(value).trim();
  1732. return text === '0' || /^0\.0*$/.test(text);
  1733. },
  1734. shouldClearDispatchQuantity(value) {
  1735. if (value === null || value === undefined || value === '') {
  1736. return true;
  1737. }
  1738. return false;
  1739. },
  1740. formatDispatchRowQuantity(value) {
  1741. return this.isEmptyDispatchQuantity(value) ? '' : value;
  1742. },
  1743. updateDispatchRowDraft(row, patch) {
  1744. const key = this.dispatchRowDraftKey(row);
  1745. this.$set(this.dispatchRowDraftMap, key, {
  1746. ...(this.dispatchRowDraftMap[key] || {}),
  1747. ...patch
  1748. });
  1749. },
  1750. dispatchRowDraftKey(row, task = this.activeTask) {
  1751. return [
  1752. this.getDispatchWorkOrderId() || this.currentPlan?.id || '',
  1753. this.dispatchTaskGroupKey(task) || '',
  1754. this.dispatchObjectRowKey(row)
  1755. ].join('::');
  1756. },
  1757. getDispatchTaskQuantityTotal(row) {
  1758. const groupKey = this.dispatchTaskGroupKey(row);
  1759. if (
  1760. this.orderDispatchStyle &&
  1761. this.activeTask &&
  1762. groupKey === this.dispatchTaskGroupKey(this.activeTask)
  1763. ) {
  1764. return this.dispatchObjectRows.reduce((total, item) => {
  1765. const data = this.getDispatchActionRowData(item);
  1766. return total + (this.parseDispatchQuantity(data.quantity) || 0);
  1767. }, 0);
  1768. }
  1769. return (this.taskList || []).reduce((total, item) => {
  1770. if (this.dispatchTaskGroupKey(item) !== groupKey) {
  1771. return total;
  1772. }
  1773. return total + (this.parseDispatchQuantity(item.quantity) || 0);
  1774. }, 0);
  1775. },
  1776. clearDispatchQuantity(row) {
  1777. if (row) {
  1778. this.$set(row, 'quantity', '');
  1779. }
  1780. },
  1781. validateDispatchQuantity(row, showMessage = true) {
  1782. if (!row) {
  1783. return false;
  1784. }
  1785. if (
  1786. row.quantity === null ||
  1787. row.quantity === undefined ||
  1788. row.quantity === ''
  1789. ) {
  1790. return true;
  1791. }
  1792. const quantity = this.parseDispatchQuantity(row.quantity);
  1793. if (quantity === null) {
  1794. this.clearDispatchQuantity(row);
  1795. if (showMessage) {
  1796. this.$message.warning('数量只能输入非0开头的整数或小数');
  1797. }
  1798. return false;
  1799. }
  1800. const planQuantity = this.dispatchPlanQuantityLimit;
  1801. if (planQuantity !== null) {
  1802. const total = this.getDispatchTaskQuantityTotal(row);
  1803. if (total > planQuantity) {
  1804. this.clearDispatchQuantity(row);
  1805. if (showMessage) {
  1806. this.$message.warning('工位数量合计不能大于计划数量');
  1807. }
  1808. return false;
  1809. }
  1810. }
  1811. return true;
  1812. },
  1813. handleDispatchQuantityInput(row) {
  1814. return this.validateDispatchQuantity(row);
  1815. },
  1816. getDispatchTaskRows() {
  1817. const groupKey = this.dispatchTaskGroupKey(this.activeTask);
  1818. return (this.taskList || []).filter(
  1819. (item) => this.dispatchTaskGroupKey(item) === groupKey
  1820. );
  1821. },
  1822. getDispatchRowTask(row) {
  1823. return this.getDispatchTaskRows().find((item) =>
  1824. this.optionMatchesDispatchObject(item.executionTeamId, row)
  1825. );
  1826. },
  1827. getDispatchTaskRowsByKey(groupKey) {
  1828. if (!groupKey) {
  1829. return [];
  1830. }
  1831. return (this.taskList || []).filter(
  1832. (item) => this.dispatchTaskGroupKey(item) === groupKey
  1833. );
  1834. },
  1835. emitDispatchTaskListChange(eventName, row) {
  1836. this.suppressTaskListAssignReloadUntil = Date.now() + 300;
  1837. this.$emit(eventName, row);
  1838. },
  1839. clearDispatchSelectionsByTaskKey(groupKey) {
  1840. if (!this.orderDispatchStyle || !groupKey) {
  1841. return;
  1842. }
  1843. this.getDispatchTaskRowsByKey(groupKey).forEach((task) => {
  1844. if (!task?.executionTeamId || this.isDispatchRowAssigned(task)) {
  1845. return;
  1846. }
  1847. if (task._dispatchDraft) {
  1848. this.emitDispatchTaskListChange('remove-task-row', task);
  1849. return;
  1850. }
  1851. this.$set(task, 'executionTeamId', '');
  1852. this.$set(task, 'rawExecutionTeamId', '');
  1853. this.$set(task, 'executionObjectType', '');
  1854. this.$set(task, 'executionObjectName', '');
  1855. this.$set(task, 'executionTeamName', '');
  1856. this.$set(task, 'executionTeamLeader', '');
  1857. this.$set(task, 'executionTeamLeaderId', '');
  1858. });
  1859. },
  1860. createDispatchTaskRow(row) {
  1861. const source = this.activeTask || {};
  1862. const next = {
  1863. ...source,
  1864. id: undefined,
  1865. _dispatchDraft: true,
  1866. quantity: '',
  1867. executionStartTime: row.executionStartTime || '',
  1868. executionEndTime: row.executionEndTime || '',
  1869. _taskKey: `${this.dispatchTaskGroupKey(
  1870. source
  1871. )}-${this.dispatchObjectRowKey(row)}`
  1872. };
  1873. this.emitDispatchTaskListChange('add-task-row', next);
  1874. return next;
  1875. },
  1876. clearDispatchObject(row, task = this.getDispatchRowTask(row)) {
  1877. this.$delete(this.dispatchRowDraftMap, this.dispatchRowDraftKey(row));
  1878. if (!task) {
  1879. row.quantity = '';
  1880. row.executionStartTime = '';
  1881. row.executionEndTime = '';
  1882. return;
  1883. }
  1884. row.quantity = '';
  1885. row.executionStartTime = '';
  1886. row.executionEndTime = '';
  1887. if (task._dispatchDraft) {
  1888. this.emitDispatchTaskListChange('remove-task-row', task);
  1889. return;
  1890. }
  1891. this.$set(task, 'quantity', '');
  1892. this.$set(task, 'executionStartTime', '');
  1893. this.$set(task, 'executionEndTime', '');
  1894. this.$set(task, 'executionTeamId', '');
  1895. this.$set(task, 'rawExecutionTeamId', '');
  1896. this.$set(task, 'executionObjectType', '');
  1897. this.$set(task, 'executionObjectName', '');
  1898. this.$set(task, 'executionTeamName', '');
  1899. this.$set(task, 'executionTeamLeader', '');
  1900. this.$set(task, 'executionTeamLeaderId', '');
  1901. },
  1902. clearDispatchTaskBinding(row, task = this.getDispatchRowTask(row)) {
  1903. if (!task) {
  1904. return;
  1905. }
  1906. if (task._dispatchDraft) {
  1907. this.emitDispatchTaskListChange('remove-task-row', task);
  1908. return;
  1909. }
  1910. this.$set(task, 'quantity', '');
  1911. this.$set(task, 'executionTeamId', '');
  1912. this.$set(task, 'rawExecutionTeamId', '');
  1913. this.$set(task, 'executionObjectType', '');
  1914. this.$set(task, 'executionObjectName', '');
  1915. this.$set(task, 'executionTeamName', '');
  1916. this.$set(task, 'executionTeamLeader', '');
  1917. this.$set(task, 'executionTeamLeaderId', '');
  1918. },
  1919. clearDispatchQuantityInput(row) {
  1920. this.clearDispatchObject(row);
  1921. this.$nextTick(() => {
  1922. row.quantity = '';
  1923. this.$forceUpdate();
  1924. });
  1925. },
  1926. ensureDispatchObjectSelected(row) {
  1927. if (!this.activeTask || !row || this.isDeviceSnapshotLocked(row)) {
  1928. return null;
  1929. }
  1930. const existed = this.getDispatchRowTask(row);
  1931. const canUseActiveTask = !this.activeTask.executionTeamId;
  1932. const task =
  1933. existed ||
  1934. (canUseActiveTask
  1935. ? this.activeTask
  1936. : this.createDispatchTaskRow(row));
  1937. if (!this.optionMatchesDispatchObject(task.executionTeamId, row)) {
  1938. this.selectDispatchObject(row, task);
  1939. }
  1940. return task;
  1941. },
  1942. handleDispatchRowQuantityInput(row, value) {
  1943. if (this.isDispatchRowControlDisabled(row)) {
  1944. return;
  1945. }
  1946. this.$set(row, 'quantity', value);
  1947. this.updateDispatchRowDraft(row, { quantity: value });
  1948. const quantity = this.parseDispatchQuantity(value);
  1949. if (this.shouldClearDispatchQuantity(value)) {
  1950. this.clearDispatchQuantityInput(row);
  1951. return;
  1952. }
  1953. const text = String(value || '').trim();
  1954. if (/^0\d+/.test(text)) {
  1955. this.clearDispatchQuantityInput(row);
  1956. return;
  1957. }
  1958. if (
  1959. quantity === null &&
  1960. (/^[1-9]\d*\.\d*$/.test(text) || /^0(\.\d*)?$/.test(text))
  1961. ) {
  1962. this.clearDispatchTaskBinding(row);
  1963. return;
  1964. }
  1965. const task = this.ensureDispatchObjectSelected(row);
  1966. if (!task) {
  1967. return;
  1968. }
  1969. this.$set(task, 'quantity', value);
  1970. const valid = this.handleDispatchQuantityInput(task);
  1971. if (!valid) {
  1972. this.updateDispatchRowDraft(row, { quantity: '' });
  1973. }
  1974. row.quantity = this.formatDispatchRowQuantity(task.quantity);
  1975. },
  1976. handleDispatchObjectCheckChange(row, checked) {
  1977. if (this.isDispatchRowControlDisabled(row)) {
  1978. return;
  1979. }
  1980. if (checked) {
  1981. const task = this.ensureDispatchObjectSelected(row);
  1982. if (task && row.quantity) {
  1983. this.$set(task, 'quantity', row.quantity);
  1984. }
  1985. if (task) {
  1986. this.$set(task, 'executionStartTime', row.executionStartTime || '');
  1987. this.$set(task, 'executionEndTime', row.executionEndTime || '');
  1988. }
  1989. return;
  1990. }
  1991. const task = this.getDispatchRowTask(row);
  1992. if (!task) {
  1993. return;
  1994. }
  1995. this.updateDispatchRowDraft(row, {
  1996. quantity: row.quantity,
  1997. executionStartTime:
  1998. row.executionStartTime || task.executionStartTime || '',
  1999. executionEndTime: row.executionEndTime || task.executionEndTime || ''
  2000. });
  2001. if (task._dispatchDraft) {
  2002. this.emitDispatchTaskListChange('remove-task-row', task);
  2003. return;
  2004. }
  2005. this.$set(task, 'quantity', '');
  2006. this.$set(task, 'executionTeamId', '');
  2007. this.$set(task, 'rawExecutionTeamId', '');
  2008. this.$set(task, 'executionObjectType', '');
  2009. this.$set(task, 'executionObjectName', '');
  2010. this.$set(task, 'executionTeamName', '');
  2011. this.$set(task, 'executionTeamLeader', '');
  2012. this.$set(task, 'executionTeamLeaderId', '');
  2013. },
  2014. clearDispatchStartTime(row) {
  2015. if (row) {
  2016. this.$set(row, 'executionStartTime', '');
  2017. this.$forceUpdate();
  2018. }
  2019. },
  2020. clearDispatchEndTime(row) {
  2021. if (row) {
  2022. this.$set(row, 'executionEndTime', '');
  2023. this.$forceUpdate();
  2024. }
  2025. },
  2026. validateDispatchStartTime(row, showMessage = true) {
  2027. if (!row?.executionStartTime) {
  2028. return true;
  2029. }
  2030. const startTime = this.parseDispatchTime(row.executionStartTime);
  2031. const planStartTime = this.parseDispatchTime(
  2032. this.getDispatchPlanStartTime()
  2033. );
  2034. if (
  2035. startTime !== null &&
  2036. planStartTime !== null &&
  2037. startTime < planStartTime
  2038. ) {
  2039. this.clearDispatchStartTime(row);
  2040. if (showMessage) {
  2041. this.$message.warning('开始时间不能小于计划开始时间');
  2042. }
  2043. return false;
  2044. }
  2045. const planEndTime = this.parseDispatchTime(
  2046. this.getDispatchPlanEndTime()
  2047. );
  2048. if (
  2049. startTime !== null &&
  2050. planEndTime !== null &&
  2051. startTime > planEndTime
  2052. ) {
  2053. this.clearDispatchStartTime(row);
  2054. if (showMessage) {
  2055. this.$message.warning('开始时间不能大于计划结束时间');
  2056. }
  2057. return false;
  2058. }
  2059. return true;
  2060. },
  2061. validateDispatchEndTime(row, showMessage = true) {
  2062. if (!row?.executionEndTime) {
  2063. return true;
  2064. }
  2065. const endTime = this.parseDispatchTime(row.executionEndTime);
  2066. const startTime = this.parseDispatchTime(row.executionStartTime);
  2067. if (endTime !== null && startTime !== null && endTime < startTime) {
  2068. this.clearDispatchEndTime(row);
  2069. if (showMessage) {
  2070. this.$message.warning('结束时间不能小于开始时间');
  2071. }
  2072. return false;
  2073. }
  2074. const planEndTime = this.parseDispatchTime(
  2075. this.getDispatchPlanEndTime()
  2076. );
  2077. if (endTime !== null && planEndTime !== null && endTime > planEndTime) {
  2078. this.clearDispatchEndTime(row);
  2079. if (showMessage) {
  2080. this.$message.warning('结束时间不能大于计划结束时间');
  2081. }
  2082. return false;
  2083. }
  2084. return true;
  2085. },
  2086. validateDispatchTime(row, showMessage = true) {
  2087. return (
  2088. this.validateDispatchStartTime(row, showMessage) &&
  2089. this.validateDispatchEndTime(row, showMessage)
  2090. );
  2091. },
  2092. handleDispatchStartTimeChange(row) {
  2093. if (!this.validateDispatchStartTime(row)) {
  2094. return;
  2095. }
  2096. const endTimeValid = this.validateDispatchEndTime(row);
  2097. this.$emit('time-change', row, 'executionStartTime');
  2098. if (!endTimeValid) {
  2099. this.$emit('time-change', row, 'executionEndTime');
  2100. }
  2101. },
  2102. handleDispatchEndTimeChange(row) {
  2103. if (!this.validateDispatchEndTime(row)) {
  2104. return;
  2105. }
  2106. this.$emit('time-change', row, 'executionEndTime');
  2107. },
  2108. handleDispatchRowStartTimeChange(row) {
  2109. if (this.isDispatchRowControlDisabled(row)) {
  2110. return;
  2111. }
  2112. const task = this.ensureDispatchObjectSelected(row);
  2113. if (!task) {
  2114. return;
  2115. }
  2116. this.$set(task, 'executionStartTime', row.executionStartTime || '');
  2117. this.handleDispatchStartTimeChange(task);
  2118. row.executionStartTime = task.executionStartTime || '';
  2119. row.executionEndTime =
  2120. task.executionEndTime || row.executionEndTime || '';
  2121. this.updateDispatchRowDraft(row, {
  2122. executionStartTime: row.executionStartTime,
  2123. executionEndTime: row.executionEndTime
  2124. });
  2125. },
  2126. handleDispatchRowEndTimeChange(row) {
  2127. if (this.isDispatchRowControlDisabled(row)) {
  2128. return;
  2129. }
  2130. const task = this.ensureDispatchObjectSelected(row);
  2131. if (!task) {
  2132. return;
  2133. }
  2134. this.$set(task, 'executionEndTime', row.executionEndTime || '');
  2135. this.handleDispatchEndTimeChange(task);
  2136. row.executionEndTime = task.executionEndTime || '';
  2137. this.updateDispatchRowDraft(row, {
  2138. executionStartTime: row.executionStartTime,
  2139. executionEndTime: row.executionEndTime
  2140. });
  2141. },
  2142. handleCurrentPageDispatchCheckChange(checked) {
  2143. if (this.readonlyMode) {
  2144. return;
  2145. }
  2146. this.currentPageSelectableDispatchRows.forEach((row) => {
  2147. this.handleDispatchObjectCheckChange(row, checked);
  2148. });
  2149. },
  2150. getDispatchActionRowData(row) {
  2151. const task = this.getDispatchRowTask(row);
  2152. const assignment = this.getDispatchAssignment(row);
  2153. return {
  2154. ...row,
  2155. quantity: task?.quantity ?? row.quantity,
  2156. executionStartTime:
  2157. task?.executionStartTime ?? row.executionStartTime,
  2158. executionEndTime: task?.executionEndTime ?? row.executionEndTime,
  2159. changeId: assignment?.changeId ?? row.changeId,
  2160. status: assignment?.status ?? row.status,
  2161. teamTimeIds: task?.teamTimeIds ?? row.teamTimeIds,
  2162. weight: task?.weight ?? row.weight
  2163. };
  2164. },
  2165. isDispatchWithdrawable(row) {
  2166. const statusCode = this.getAssignmentTypeCode(row?.status);
  2167. return !!row?.changeId && !!statusCode;
  2168. },
  2169. async handleDispatchRowReset(row) {
  2170. if (!this.validateDispatchToolbarPermission('reset')) {
  2171. return;
  2172. }
  2173. const data = this.getDispatchActionRowData(row);
  2174. if (!data.changeId) {
  2175. this.$message.warning('只能对已撤回跟已保存的数据进行重置');
  2176. return;
  2177. }
  2178. this.dispatchToolbarLoading = true;
  2179. try {
  2180. const res = await resetAssignee(data.changeId);
  2181. if (res) {
  2182. this.removeDispatchAssignment(row);
  2183. this.clearDispatchObject(row);
  2184. this.$message.success('操作成功');
  2185. this.$emit('dispatch-action-success', {
  2186. type: 'reset',
  2187. task: this.activeTask
  2188. });
  2189. }
  2190. } catch (e) {
  2191. this.$message.error(e.message || '操作失败');
  2192. } finally {
  2193. this.dispatchToolbarLoading = false;
  2194. }
  2195. },
  2196. handleDeleteAddedDispatchStation(row) {
  2197. if (!this.canDeleteAddedDispatchStation(row)) {
  2198. this.$message.warning(
  2199. '只有通过添加工位新增且状态不是保存或派单的数据才能删除'
  2200. );
  2201. return;
  2202. }
  2203. const task = this.getDispatchRowTask(row);
  2204. this.clearDispatchObject(row, task);
  2205. this.$emit('remove-dispatch-station', {
  2206. task: this.activeTask,
  2207. row
  2208. });
  2209. this.$message.success('删除成功');
  2210. },
  2211. validateDispatchActionRows(rows, type) {
  2212. if (!rows.length) {
  2213. this.$message.warning('请最少选择一条数据');
  2214. return false;
  2215. }
  2216. if (
  2217. !this.getDispatchWorkOrderId() ||
  2218. !this.getDispatchSourceTaskId(this.activeTask)
  2219. ) {
  2220. this.$message.warning('当前订单或工序信息不完整,无法操作');
  2221. return false;
  2222. }
  2223. const invalidRequired = rows.some((row) => {
  2224. const data = this.getDispatchActionRowData(row);
  2225. return (
  2226. !this.parseDispatchQuantity(data.quantity) ||
  2227. !data.executionStartTime ||
  2228. !data.executionEndTime
  2229. );
  2230. });
  2231. if (invalidRequired) {
  2232. this.$message.warning(
  2233. '请将所选数据的 数量,开始时间,完成时间 填写完毕'
  2234. );
  2235. return false;
  2236. }
  2237. const invalidTime = rows.some((row) => {
  2238. const data = this.getDispatchActionRowData(row);
  2239. return !this.validateDispatchTime(data, false);
  2240. });
  2241. if (invalidTime) {
  2242. this.$message.warning('请检查所选数据的开始时间和完成时间');
  2243. return false;
  2244. }
  2245. if (
  2246. type === 2 &&
  2247. rows.some((row) => !this.isDispatchWithdrawable(row))
  2248. ) {
  2249. this.$message.warning('只有状态为派单的数据才能进行撤回');
  2250. return false;
  2251. }
  2252. return true;
  2253. },
  2254. buildDispatchAssignees(rows) {
  2255. const measuringUnit =
  2256. this.currentPlan?.measuringUnit || this.currentPlan?.unit || '';
  2257. return rows.map((row) => {
  2258. const data = this.getDispatchActionRowData(row);
  2259. const assigneeId = this.getDispatchAssigneeId(row);
  2260. const assigneeName =
  2261. row.displayName || String(row.name || '').replace(/^工位[::]/, '');
  2262. const assignee = {
  2263. assigneeId,
  2264. quantity: data.quantity,
  2265. weight: data.weight || '',
  2266. startTime: data.executionStartTime,
  2267. endTime: data.executionEndTime,
  2268. assigneeType: 1,
  2269. assigneeName,
  2270. measuringUnit,
  2271. isNew: row.isNew ? row.isNew : '',
  2272. deviceId: this.getDispatchDeviceId(row),
  2273. deviceName:
  2274. row.assetName || row.deviceName || row.extInfo?.assetName || '',
  2275. workStationId: assigneeId,
  2276. workStationName: assigneeName
  2277. };
  2278. if (data.teamTimeIds) {
  2279. assignee.teamTimeIds = data.teamTimeIds;
  2280. }
  2281. return assignee;
  2282. });
  2283. },
  2284. buildDispatchActionPayload(rows) {
  2285. const row = this.activeTask || {};
  2286. return {
  2287. taskId: this.getDispatchSourceTaskId(row),
  2288. taskName: row.taskName || row.name,
  2289. taskCode: row.taskCode || row.code,
  2290. teamName: this.getDispatchTeamName(),
  2291. teamId: this.getDispatchTeamId(),
  2292. workCenterId: this.getDispatchWorkCenterId(row),
  2293. workCenterName: this.getDispatchWorkCenterName(row),
  2294. workOrderId: this.getDispatchWorkOrderId(),
  2295. dispatchMethod: 0,
  2296. dispatchingMethod:
  2297. this.currentPlan?.dispatchingMethod ??
  2298. this.currentPlan?.taskAss ??
  2299. 0,
  2300. assignType: 1,
  2301. singleReport: this.reportTypeValue,
  2302. dispatchType: this.reportTypeValue,
  2303. assignees: this.buildDispatchAssignees(rows)
  2304. };
  2305. },
  2306. validateFirstTaskConfirmReportType() {
  2307. if (this.reportTypeValue === 0 || this.reportTypeValue === 1) {
  2308. return true;
  2309. }
  2310. this.$message.warning('请先选择报工类型');
  2311. return false;
  2312. },
  2313. async validateFirstTaskConfirmLeader(teamId) {
  2314. try {
  2315. const permissionRes = await parameterGetByCode({
  2316. code: 'production_order_dispatch_permission'
  2317. });
  2318. if (String(permissionRes?.value || 0) !== '1') {
  2319. return true;
  2320. }
  2321. const isTeamLeader = await getcheckLoginUserIsTeamLeader(teamId);
  2322. if (!isTeamLeader) {
  2323. this.$message.warning('当前班组不是对应组长');
  2324. return false;
  2325. }
  2326. return true;
  2327. } catch (e) {
  2328. this.$message.error(e.message || '校验组长身份失败');
  2329. return false;
  2330. }
  2331. },
  2332. getFirstTaskAssignedRows() {
  2333. return this.dispatchObjectRows.filter((row) =>
  2334. this.isDispatchRowAssigned(row)
  2335. );
  2336. },
  2337. buildFirstTaskConfirmPayload(assignedRows) {
  2338. const row = this.activeTask || {};
  2339. const assignType = Number(row.assignType ?? 1);
  2340. const dispatchIds = assignedRows.map((item) =>
  2341. this.getDispatchAssigneeId(item)
  2342. );
  2343. const payload = {
  2344. assignType,
  2345. singleReport: this.reportTypeValue,
  2346. teamId: this.getDispatchTeamId(),
  2347. dispatchingMethod:
  2348. this.currentPlan?.dispatchingMethod ??
  2349. this.currentPlan?.taskAss ??
  2350. 0,
  2351. crewIds: [],
  2352. workstationIds: [],
  2353. factoryLineIds: [],
  2354. id: this.getDispatchWorkOrderId() || this.currentPlan?.id || '',
  2355. planStartTime: this.getDispatchPlanStartTime(),
  2356. planEndTime: this.getDispatchPlanEndTime()
  2357. };
  2358. if (assignType === 2) {
  2359. payload.crewIds = dispatchIds;
  2360. } else if (assignType === 3) {
  2361. payload.factoryLineIds = dispatchIds;
  2362. } else {
  2363. payload.workstationIds = dispatchIds;
  2364. }
  2365. return payload;
  2366. },
  2367. async handleFirstTaskConfirm() {
  2368. if (!this.validateDispatchToolbarPermission('confirm')) {
  2369. return;
  2370. }
  2371. if (!this.validateFirstTaskConfirmReportType()) {
  2372. return;
  2373. }
  2374. const teamId = this.getDispatchTeamId();
  2375. if (!teamId) {
  2376. this.$message.warning('请先选择班组');
  2377. return;
  2378. }
  2379. const workCenterId = this.getDispatchWorkCenterId(this.activeTask);
  2380. const workOrderId =
  2381. this.getDispatchWorkOrderId() || this.currentPlan?.id;
  2382. if (!workCenterId || !workOrderId) {
  2383. this.$message.warning('当前订单或工序信息不完整,无法操作');
  2384. return;
  2385. }
  2386. if (!(await this.validateFirstTaskConfirmLeader(teamId))) {
  2387. return;
  2388. }
  2389. const assignedRows = this.getFirstTaskAssignedRows();
  2390. if (!assignedRows.length) {
  2391. const taskName =
  2392. this.activeTask?.taskName || this.activeTask?.name || '';
  2393. this.$message.warning(`请您先进行首工序任务(${taskName}工序)派单`);
  2394. return;
  2395. }
  2396. this.dispatchToolbarLoading = true;
  2397. try {
  2398. const checked = await checkAssignConfirm({
  2399. teamId,
  2400. workCenterId,
  2401. workOrderId
  2402. });
  2403. if (!checked) {
  2404. return;
  2405. }
  2406. const response = await releaseWorkOrder(
  2407. this.buildFirstTaskConfirmPayload(assignedRows)
  2408. );
  2409. if (response) {
  2410. this.$message.success('操作成功');
  2411. await this.loadDispatchAssignData();
  2412. this.$emit('dispatch-action-success', {
  2413. type: 'confirm',
  2414. task: this.activeTask
  2415. });
  2416. }
  2417. } catch (e) {
  2418. this.$message.error(e.message || '操作失败');
  2419. } finally {
  2420. this.dispatchToolbarLoading = false;
  2421. }
  2422. },
  2423. async handleDispatchToolbarAction(type) {
  2424. if (!this.validateDispatchToolbarPermission(type)) {
  2425. return;
  2426. }
  2427. const rows = this.selectedDispatchObjectRows;
  2428. if (!this.validateDispatchActionRows(rows, type)) {
  2429. return;
  2430. }
  2431. const data =
  2432. type === 2
  2433. ? rows.map((row) => this.getDispatchActionRowData(row).changeId)
  2434. : this.buildDispatchActionPayload(rows);
  2435. const api =
  2436. type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
  2437. this.dispatchToolbarLoading = true;
  2438. try {
  2439. await api(data);
  2440. await this.loadDispatchAssignData();
  2441. this.$message.success('操作成功');
  2442. this.$emit('dispatch-action-success', {
  2443. type,
  2444. task: this.activeTask
  2445. });
  2446. } catch (e) {
  2447. this.$message.error(e.message || '操作失败');
  2448. } finally {
  2449. this.dispatchToolbarLoading = false;
  2450. }
  2451. },
  2452. handleDispatchAddStation() {
  2453. if (!this.validateDispatchToolbarPermission('addStation')) {
  2454. return;
  2455. }
  2456. if (!this.activeTask) {
  2457. this.$message.warning('请选择工序');
  2458. return;
  2459. }
  2460. const workCenterId = this.getDispatchWorkCenterId(this.activeTask);
  2461. if (!workCenterId) {
  2462. this.$message.warning('当前工序缺少工作中心,无法添加工位');
  2463. return;
  2464. }
  2465. const index = this.dispatchTaskTabs.findIndex(
  2466. (item) =>
  2467. this.dispatchTaskGroupKey(item) ===
  2468. this.dispatchTaskGroupKey(this.activeTask)
  2469. );
  2470. const existedStations = this.dispatchObjectRows.map((row) => ({
  2471. ...row,
  2472. id: this.getDispatchAssigneeId(row)
  2473. }));
  2474. this.$refs.chooseStationRef?.open(
  2475. workCenterId,
  2476. existedStations,
  2477. index,
  2478. 2,
  2479. this.getDispatchTeamId()
  2480. );
  2481. },
  2482. handleChooseStationList(list, index) {
  2483. const task = this.dispatchTaskTabs[index];
  2484. const stations = (Array.isArray(list) ? list : []).map((item) => ({
  2485. ...item,
  2486. isNew: 1,
  2487. assetCode: this.pickDispatchSingleValue([
  2488. {
  2489. source: item,
  2490. keys: ['assetCode', 'deviceCode']
  2491. },
  2492. {
  2493. source: item.extInfo,
  2494. keys: ['assetCode', 'deviceCode']
  2495. }
  2496. ]),
  2497. assetId:
  2498. this.normalizeDispatchLongId(item.assetId) ||
  2499. this.normalizeDispatchLongId(item.extInfo?.assetId) ||
  2500. '',
  2501. assetName: this.pickDispatchSingleValue([
  2502. {
  2503. source: item,
  2504. keys: ['assetName', 'deviceName']
  2505. },
  2506. {
  2507. source: item.extInfo,
  2508. keys: ['assetName', 'deviceName']
  2509. }
  2510. ])
  2511. }));
  2512. this.$emit('add-dispatch-stations', {
  2513. task,
  2514. index,
  2515. list: stations
  2516. });
  2517. },
  2518. handleDispatchSubmit(row) {
  2519. if (
  2520. !this.validateDispatchQuantity(row) ||
  2521. !this.validateDispatchTime(row)
  2522. ) {
  2523. return;
  2524. }
  2525. this.$emit('row-submit', row);
  2526. },
  2527. handleDispatchRowSubmit(row) {
  2528. const task = this.ensureDispatchObjectSelected(row);
  2529. if (!task) {
  2530. return;
  2531. }
  2532. this.handleDispatchSubmit(task);
  2533. },
  2534. taskRowKey(row, index) {
  2535. return String(row?._taskKey ?? row?.id ?? row?.taskId ?? index);
  2536. },
  2537. taskCodeDisplay(row) {
  2538. return (
  2539. row?.taskCode ||
  2540. row?.code ||
  2541. row?.sourceTaskCode ||
  2542. row?.firstTaskCode ||
  2543. '-'
  2544. );
  2545. },
  2546. dispatchTeamDisplay(row = this.activeTask) {
  2547. const plan = this.currentPlan || {};
  2548. return (
  2549. this.pickDispatchSingleValue([
  2550. { source: row || {}, keys: DISPATCH_TEAM_NAME_KEYS },
  2551. { source: plan, keys: DISPATCH_TEAM_NAME_KEYS }
  2552. ]) || '所有班组'
  2553. );
  2554. },
  2555. handleDispatchPageSizeChange(size) {
  2556. this.dispatchPageSize = size;
  2557. this.dispatchPage = 1;
  2558. },
  2559. handleDispatchPageChange(page) {
  2560. this.dispatchPage = page;
  2561. },
  2562. homemadeOptions(row) {
  2563. // 由父组件按模式决定选项来源:
  2564. // - 工厂排程:直接返回班组选项。
  2565. // - 班组排程:返回人员 + 当前工序可派工位。
  2566. return this.getHomemadeOptions
  2567. ? this.getHomemadeOptions(row)
  2568. : this.teamOptions;
  2569. },
  2570. optionMatchesDispatchObject(optionId, row) {
  2571. return (
  2572. String(optionId || '') ===
  2573. String(this.dispatchObjectRowKey(row) || '')
  2574. );
  2575. },
  2576. isSelectedDispatchObject(row) {
  2577. const task = this.getDispatchRowTask(row);
  2578. return !!task;
  2579. },
  2580. selectDispatchObject(row, targetTask) {
  2581. const task = targetTask || this.activeTask;
  2582. if (!task || !row) {
  2583. return;
  2584. }
  2585. this.$set(task, 'executionType', this.execType.HOMEMADE);
  2586. this.$set(task, 'executionTeamId', this.dispatchObjectRowKey(row));
  2587. this.$set(task, 'rawExecutionTeamId', row.rawId);
  2588. this.$set(task, 'executionObjectType', row.objectType);
  2589. this.$set(task, 'executionObjectName', row.name);
  2590. this.$set(task, 'executionTeamName', row.name);
  2591. this.$set(task, 'executionTeamLeader', row.leaderUserName || '');
  2592. this.$set(task, 'executionTeamLeaderId', row.leaderUserId || '');
  2593. this.$emit('execution-object-change', task);
  2594. }
  2595. }
  2596. };
  2597. </script>
  2598. <style lang="scss" scoped>
  2599. .config-panel {
  2600. width: 100%;
  2601. max-width: 100%;
  2602. min-width: 0;
  2603. box-sizing: border-box;
  2604. border: 1px solid #d8e3ef;
  2605. border-radius: 10px;
  2606. padding: 8px 10px 10px;
  2607. background: linear-gradient(180deg, #ffffff 0%, #fafdff 100%);
  2608. margin-top: 10px;
  2609. }
  2610. .config-panel.factory-task-config-panel {
  2611. margin-top: 0;
  2612. padding: 6px 8px 8px;
  2613. }
  2614. .dispatch-config-panel {
  2615. height: 100%;
  2616. margin-top: 0;
  2617. padding: 0;
  2618. border: 0;
  2619. border-radius: 10px;
  2620. overflow: hidden;
  2621. }
  2622. .dispatch-style-panel {
  2623. display: flex;
  2624. flex-direction: column;
  2625. height: 100%;
  2626. width: 100%;
  2627. min-width: 0;
  2628. overflow: hidden;
  2629. background: transparent;
  2630. }
  2631. .dispatch-config-panel ::v-deep .el-empty {
  2632. height: 100%;
  2633. min-height: 240px;
  2634. padding: 24px 0;
  2635. box-sizing: border-box;
  2636. border-radius: 10px;
  2637. background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  2638. }
  2639. .dispatch-config-panel ::v-deep .el-empty__image {
  2640. width: 118px;
  2641. }
  2642. .dispatch-config-panel ::v-deep .el-empty__description {
  2643. margin-top: 10px;
  2644. }
  2645. .dispatch-report-type {
  2646. display: flex;
  2647. flex: 0 0 auto;
  2648. align-items: center;
  2649. gap: 8px;
  2650. min-height: 38px;
  2651. padding: 5px 12px;
  2652. box-sizing: border-box;
  2653. color: #606266;
  2654. font-size: 14px;
  2655. background: linear-gradient(180deg, #ffffff 0%, #f4f9fd 100%);
  2656. border-bottom: 1px solid #e5edf6;
  2657. }
  2658. .dispatch-required {
  2659. color: #f56c6c;
  2660. font-size: 14px;
  2661. }
  2662. .dispatch-report-label {
  2663. color: #606266;
  2664. font-weight: 500;
  2665. }
  2666. .dispatch-plan-info {
  2667. display: inline-flex;
  2668. flex: 1 1 auto;
  2669. align-items: center;
  2670. justify-content: flex-end;
  2671. gap: 10px;
  2672. min-width: 0;
  2673. color: #008000;
  2674. }
  2675. .dispatch-plan-item {
  2676. display: inline-flex;
  2677. align-items: baseline;
  2678. gap: 4px;
  2679. min-width: 0;
  2680. padding: 3px 8px;
  2681. border: 1px solid #c8e8cf;
  2682. border-radius: 7px;
  2683. background: linear-gradient(180deg, #f4fcf6 0%, #edf9f0 100%);
  2684. white-space: nowrap;
  2685. }
  2686. .dispatch-plan-label {
  2687. color: #008000;
  2688. font-weight: 600;
  2689. }
  2690. .dispatch-plan-value {
  2691. max-width: 280px;
  2692. overflow: hidden;
  2693. color: #008000;
  2694. font-weight: 600;
  2695. text-overflow: ellipsis;
  2696. }
  2697. .dispatch-process-tabs ::v-deep {
  2698. flex: 0 0 auto;
  2699. border: 0;
  2700. box-shadow: none;
  2701. .el-tabs__header {
  2702. margin: 0;
  2703. background: #f8fbff;
  2704. border-bottom-color: #e5edf6;
  2705. }
  2706. .el-tabs__nav-scroll {
  2707. padding: 0 10px;
  2708. }
  2709. .el-tabs__item {
  2710. display: inline-flex;
  2711. align-items: center;
  2712. justify-content: center;
  2713. height: 34px;
  2714. line-height: 1;
  2715. min-width: 82px;
  2716. margin-right: 6px;
  2717. padding: 0 14px;
  2718. border-radius: 8px 8px 0 0;
  2719. font-size: 14px;
  2720. font-weight: 500;
  2721. color: #909399;
  2722. text-align: center;
  2723. transition: all 0.18s ease;
  2724. }
  2725. .el-tabs__item:not(.is-active):hover {
  2726. color: #1683d8;
  2727. background: rgba(31, 140, 235, 0.06);
  2728. }
  2729. .el-tabs__item.is-active {
  2730. color: #0f75bd;
  2731. background: #fff;
  2732. font-weight: 600;
  2733. box-shadow: inset 0 -2px 0 #16b8a6;
  2734. }
  2735. .el-tabs__content {
  2736. display: none;
  2737. }
  2738. }
  2739. .dispatch-process-meta {
  2740. flex: 0 0 auto;
  2741. position: relative;
  2742. margin: 6px 12px;
  2743. padding: 6px 10px 6px 14px;
  2744. border: 1px solid #c8e8cf;
  2745. border-radius: 9px;
  2746. color: #008000;
  2747. font-size: 14px;
  2748. font-weight: 600;
  2749. background: linear-gradient(90deg, #f2fbf4 0%, #fbfffb 100%);
  2750. }
  2751. .dispatch-process-meta::before {
  2752. position: absolute;
  2753. top: 8px;
  2754. bottom: 8px;
  2755. left: 0;
  2756. width: 3px;
  2757. border-radius: 0 3px 3px 0;
  2758. background: #30b24a;
  2759. content: '';
  2760. }
  2761. .dispatch-toolbar {
  2762. flex: 0 0 auto;
  2763. display: flex;
  2764. align-items: center;
  2765. gap: 8px;
  2766. min-height: 40px;
  2767. padding: 5px 12px;
  2768. box-sizing: border-box;
  2769. border-top: 1px solid #eef3f8;
  2770. border-bottom: 1px solid #e5edf6;
  2771. background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  2772. }
  2773. .dispatch-toolbar-left,
  2774. .dispatch-toolbar-icons,
  2775. .dispatch-assign-mode {
  2776. display: inline-flex;
  2777. align-items: center;
  2778. gap: 8px;
  2779. }
  2780. .dispatch-toolbar-left {
  2781. flex: 0 0 auto;
  2782. gap: 7px;
  2783. }
  2784. .dispatch-toolbar-left ::v-deep .el-button + .el-button {
  2785. margin-left: 0;
  2786. }
  2787. .dispatch-toolbar ::v-deep .el-button {
  2788. min-height: 28px;
  2789. border-radius: 7px;
  2790. font-weight: 600;
  2791. transition: all 0.18s ease;
  2792. }
  2793. .dispatch-toolbar ::v-deep .el-button:not(.el-button--primary):hover {
  2794. color: #1683d8;
  2795. border-color: #bfdcf5;
  2796. background: #f4f9ff;
  2797. }
  2798. .dispatch-toolbar-left ::v-deep .el-button--primary {
  2799. border-color: #1f8ceb;
  2800. background: linear-gradient(180deg, #2a9af0 0%, #1684df 100%);
  2801. box-shadow: 0 3px 8px rgba(31, 140, 235, 0.2);
  2802. }
  2803. .dispatch-toolbar-left ::v-deep .el-button--success {
  2804. border-color: #58c234;
  2805. background: linear-gradient(180deg, #8edc66 0%, #5fc238 100%);
  2806. box-shadow: 0 3px 8px rgba(95, 194, 56, 0.2);
  2807. }
  2808. .dispatch-toolbar-left ::v-deep .el-button.is-disabled,
  2809. .dispatch-toolbar-left ::v-deep .el-button.is-disabled:hover,
  2810. .dispatch-toolbar-left ::v-deep .el-button.is-disabled:focus,
  2811. .dispatch-toolbar-left ::v-deep .el-button.is-disabled:active {
  2812. color: #9aa6b2;
  2813. border-color: #d8e1eb;
  2814. background: #edf2f7;
  2815. box-shadow: none;
  2816. cursor: not-allowed;
  2817. }
  2818. .dispatch-assign-mode {
  2819. flex: 1 1 auto;
  2820. justify-content: center;
  2821. }
  2822. .dispatch-assign-label {
  2823. color: #606266;
  2824. font-size: 14px;
  2825. font-weight: 600;
  2826. }
  2827. .dispatch-assign-mode ::v-deep .el-button--primary {
  2828. box-shadow: 0 2px 6px rgba(31, 140, 235, 0.2);
  2829. }
  2830. .dispatch-toolbar-icons {
  2831. flex: 0 0 auto;
  2832. }
  2833. .dispatch-table-wrap {
  2834. flex: 1 1 auto;
  2835. min-height: 0;
  2836. padding: 0 8px;
  2837. box-sizing: border-box;
  2838. overflow: hidden;
  2839. background: #fff;
  2840. }
  2841. .dispatch-table {
  2842. height: 100%;
  2843. border-color: #e5edf6;
  2844. border-radius: 9px;
  2845. }
  2846. .dispatch-status-badge {
  2847. display: inline-flex;
  2848. align-items: center;
  2849. justify-content: center;
  2850. min-width: 58px;
  2851. height: 24px;
  2852. padding: 0 10px;
  2853. border: 1px solid #d8e1eb;
  2854. border-radius: 999px;
  2855. color: #606b78;
  2856. background: #f8fafc;
  2857. font-size: 13px;
  2858. font-weight: 600;
  2859. line-height: 22px;
  2860. box-sizing: border-box;
  2861. }
  2862. .dispatch-status-badge.is-assigned {
  2863. border-color: #8fd19e;
  2864. color: #008000;
  2865. background: #eefaf0;
  2866. box-shadow: inset 0 0 0 1px rgba(48, 178, 74, 0.08);
  2867. }
  2868. .dispatch-empty-control {
  2869. display: inline-flex;
  2870. align-items: center;
  2871. justify-content: center;
  2872. min-height: 30px;
  2873. width: 100%;
  2874. color: #c0c4cc;
  2875. }
  2876. .dispatch-state-checkbox {
  2877. cursor: pointer;
  2878. }
  2879. .dispatch-pagination {
  2880. display: flex;
  2881. flex: 0 0 auto;
  2882. align-items: center;
  2883. justify-content: center;
  2884. min-height: 42px;
  2885. padding: 4px 10px;
  2886. border-top: 1px solid #e5edf6;
  2887. background: linear-gradient(180deg, #ffffff 0%, #f1f6fb 100%);
  2888. box-shadow: 0 -3px 10px rgba(31, 45, 61, 0.04);
  2889. }
  2890. .panel-title {
  2891. font-size: 14px;
  2892. font-weight: 600;
  2893. margin-bottom: 10px;
  2894. }
  2895. .panel-header {
  2896. display: flex;
  2897. align-items: center;
  2898. justify-content: space-between;
  2899. gap: 8px;
  2900. margin-bottom: 5px;
  2901. flex-wrap: wrap;
  2902. }
  2903. .factory-task-config-panel .panel-header {
  2904. min-height: 28px;
  2905. margin-bottom: 4px;
  2906. }
  2907. .panel-header .panel-title {
  2908. margin-bottom: 0;
  2909. }
  2910. .panel-actions {
  2911. display: inline-flex;
  2912. align-items: center;
  2913. gap: 8px;
  2914. flex: 0 0 auto;
  2915. }
  2916. .factory-task-config-panel .panel-actions ::v-deep .el-button {
  2917. min-height: 26px;
  2918. padding: 6px 10px;
  2919. }
  2920. .readonly-tip {
  2921. color: #e6a23c;
  2922. font-size: 12px;
  2923. }
  2924. .task-config-table-wrap,
  2925. .last-end-over-plan-wrap,
  2926. .end-over-delivery-wrap {
  2927. width: 100%;
  2928. }
  2929. .task-config-table-wrap {
  2930. min-height: 0;
  2931. overflow: hidden;
  2932. }
  2933. .factory-task-config-panel .task-config-table-wrap {
  2934. flex: 1 1 auto;
  2935. height: 100%;
  2936. }
  2937. .last-end-over-plan-wrap ::v-deep .el-input__inner,
  2938. .end-over-delivery-wrap ::v-deep .el-input__inner {
  2939. color: #f56c6c;
  2940. border-color: #f56c6c;
  2941. }
  2942. .last-end-over-plan-wrap ::v-deep .el-input__inner:focus,
  2943. .end-over-delivery-wrap ::v-deep .el-input__inner:focus {
  2944. border-color: #f56c6c;
  2945. }
  2946. .config-table ::v-deep {
  2947. .dispatch-table.el-table {
  2948. font-size: 14px;
  2949. }
  2950. td.config-table-index-col .cell {
  2951. font-size: 14px !important;
  2952. }
  2953. .el-table td > .cell {
  2954. font-size: 14px;
  2955. text-align: center;
  2956. }
  2957. .el-table th > .cell,
  2958. .el-table__body .cell {
  2959. padding-left: 4px;
  2960. padding-right: 4px;
  2961. }
  2962. td.task-name-cell .task-name-text {
  2963. font-size: 14px;
  2964. font-weight: 500;
  2965. line-height: 1.4;
  2966. }
  2967. .config-table-control .el-input__inner {
  2968. height: 28px;
  2969. padding-left: 10px;
  2970. padding-right: 10px;
  2971. font-size: 13px;
  2972. line-height: 28px;
  2973. }
  2974. .config-table-control .el-input__prefix,
  2975. .config-table-control .el-input__suffix {
  2976. top: 0;
  2977. height: 100%;
  2978. display: inline-flex;
  2979. align-items: center;
  2980. }
  2981. .config-table-control .el-input__prefix {
  2982. left: 8px;
  2983. }
  2984. .config-table-control .el-input__suffix {
  2985. right: 6px;
  2986. }
  2987. .config-table-control .el-input__icon {
  2988. display: inline-flex;
  2989. align-items: center;
  2990. justify-content: center;
  2991. height: 100%;
  2992. line-height: 1;
  2993. }
  2994. .config-table-control .el-select__caret {
  2995. line-height: 1;
  2996. }
  2997. .el-table td,
  2998. .el-table th {
  2999. padding-top: 4px;
  3000. padding-bottom: 4px;
  3001. }
  3002. .el-table__row {
  3003. height: 34px;
  3004. }
  3005. .el-table__body-wrapper {
  3006. padding-bottom: 1px;
  3007. box-sizing: border-box;
  3008. }
  3009. .el-table__body tr:last-child td {
  3010. border-bottom: 1px solid #ebeef5;
  3011. }
  3012. .el-button--small {
  3013. min-width: 36px;
  3014. padding: 7px 0;
  3015. }
  3016. .config-table-control {
  3017. width: 100% !important;
  3018. }
  3019. .config-table-control.el-date-editor {
  3020. max-width: 100%;
  3021. }
  3022. .config-table-control.el-date-editor .el-input__inner {
  3023. padding-left: 28px;
  3024. padding-right: 20px;
  3025. }
  3026. .el-input-number .el-input__inner {
  3027. text-align: left;
  3028. }
  3029. }
  3030. .factory-task-config-panel .config-table ::v-deep {
  3031. .el-table td,
  3032. .el-table th {
  3033. padding-top: 3px;
  3034. padding-bottom: 3px;
  3035. }
  3036. .el-table__row {
  3037. height: 32px;
  3038. }
  3039. .config-table-control .el-input__inner {
  3040. height: 26px;
  3041. line-height: 26px;
  3042. }
  3043. .config-table-control.el-select .el-input__inner {
  3044. padding-right: 30px;
  3045. }
  3046. .config-table-control .el-input--prefix .el-input__inner {
  3047. padding-left: 28px;
  3048. }
  3049. }
  3050. .dispatch-table ::v-deep {
  3051. font-size: 14px;
  3052. .el-table th {
  3053. background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
  3054. color: #253244;
  3055. font-size: 14px;
  3056. font-weight: 600;
  3057. position: sticky;
  3058. top: 0;
  3059. z-index: 2;
  3060. }
  3061. .el-table td,
  3062. .el-table th {
  3063. border-bottom-color: #e9eff6;
  3064. }
  3065. .el-table__row:hover > td.el-table__cell {
  3066. background: #f5faff;
  3067. }
  3068. .el-table__body tr.current-row > td.el-table__cell {
  3069. background: #eaf5ff;
  3070. }
  3071. .el-table__body tr.dispatch-row-assigned > td.el-table__cell {
  3072. position: relative;
  3073. color: #52606d;
  3074. background: #f4fbf5;
  3075. }
  3076. .el-table__body tr.dispatch-row-assigned:hover > td.el-table__cell {
  3077. background: #e9f7ed;
  3078. }
  3079. .el-table__body tr.dispatch-row-assigned > td:first-child::before {
  3080. position: absolute;
  3081. top: 8px;
  3082. bottom: 8px;
  3083. left: 0;
  3084. width: 3px;
  3085. border-radius: 0 3px 3px 0;
  3086. background: #30b24a;
  3087. content: '';
  3088. }
  3089. .el-table__body tr.dispatch-row-device-locked > td.el-table__cell {
  3090. color: #8a96a3;
  3091. background: #f4f6f8;
  3092. cursor: not-allowed;
  3093. }
  3094. .el-table__body tr.dispatch-row-device-locked:hover > td.el-table__cell {
  3095. background: #eef2f6;
  3096. }
  3097. .el-table__body-wrapper::-webkit-scrollbar {
  3098. width: 8px;
  3099. height: 8px;
  3100. }
  3101. .el-table__body-wrapper::-webkit-scrollbar-thumb {
  3102. border: 2px solid #fff;
  3103. border-radius: 999px;
  3104. background: #bdcad8;
  3105. }
  3106. .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
  3107. background: #aeb9c8;
  3108. }
  3109. .el-table td,
  3110. .el-table th {
  3111. padding-top: 4px;
  3112. padding-bottom: 4px;
  3113. }
  3114. .el-table__row {
  3115. height: 36px;
  3116. }
  3117. .el-table__fixed-right {
  3118. box-shadow: -4px 0 8px rgba(0, 0, 0, 0.04);
  3119. }
  3120. .el-table__body-wrapper {
  3121. background: linear-gradient(
  3122. 90deg,
  3123. rgba(31, 140, 235, 0.025) 1px,
  3124. transparent 1px
  3125. ),
  3126. #fff;
  3127. background-size: 48px 48px;
  3128. }
  3129. .config-table-control .el-input__inner {
  3130. border-color: #dce7f2;
  3131. background: #fbfdff;
  3132. }
  3133. .dispatch-row-assigned .config-table-control .el-input__inner,
  3134. .dispatch-row-assigned
  3135. .config-table-control.el-date-editor
  3136. .el-input__inner {
  3137. color: #5f6977;
  3138. border-color: #b9d7bf;
  3139. background: #eef6f0;
  3140. box-shadow: inset 3px 0 0 #30b24a;
  3141. -webkit-text-fill-color: #5f6977;
  3142. }
  3143. .dispatch-row-assigned .config-table-control .el-input__prefix,
  3144. .dispatch-row-assigned .config-table-control .el-input__suffix {
  3145. color: #6aa875;
  3146. }
  3147. .config-table-control .el-input__inner:focus {
  3148. border-color: #1f8ceb;
  3149. box-shadow: 0 0 0 2px rgba(31, 140, 235, 0.08);
  3150. }
  3151. }
  3152. .dispatch-checkbox-wrap,
  3153. .dispatch-workstation-name,
  3154. .dispatch-disabled-field {
  3155. display: inline-block;
  3156. width: 100%;
  3157. }
  3158. .dispatch-workstation-name {
  3159. overflow: hidden;
  3160. text-overflow: ellipsis;
  3161. white-space: nowrap;
  3162. }
  3163. @media (max-width: 576px) {
  3164. .config-panel {
  3165. padding: 8px;
  3166. }
  3167. .dispatch-config-panel {
  3168. padding: 0;
  3169. }
  3170. .panel-header {
  3171. align-items: flex-start;
  3172. }
  3173. .dispatch-toolbar {
  3174. align-items: flex-start;
  3175. flex-direction: column;
  3176. padding: 12px;
  3177. }
  3178. .dispatch-report-type {
  3179. align-items: flex-start;
  3180. flex-wrap: wrap;
  3181. padding: 10px 12px;
  3182. }
  3183. .dispatch-plan-info {
  3184. flex-basis: 100%;
  3185. justify-content: flex-start;
  3186. gap: 10px;
  3187. }
  3188. .dispatch-assign-mode {
  3189. justify-content: flex-start;
  3190. }
  3191. }
  3192. </style>
  3193. <style lang="scss">
  3194. .dispatch-column-popover {
  3195. padding: 12px 14px;
  3196. border: 1px solid #e6edf5;
  3197. border-radius: 8px;
  3198. box-shadow: 0 8px 24px rgba(31, 45, 61, 0.12);
  3199. .dispatch-column-settings__title {
  3200. margin-bottom: 10px;
  3201. color: #263445;
  3202. font-size: 14px;
  3203. font-weight: 600;
  3204. }
  3205. .dispatch-column-settings__list {
  3206. display: grid;
  3207. grid-template-columns: repeat(2, minmax(0, 1fr));
  3208. gap: 8px 10px;
  3209. }
  3210. .el-checkbox {
  3211. margin-right: 0;
  3212. color: #4b5563;
  3213. line-height: 22px;
  3214. }
  3215. .el-checkbox__label {
  3216. padding-left: 6px;
  3217. font-size: 13px;
  3218. }
  3219. }
  3220. .dispatch-workstation-tooltip {
  3221. max-width: 260px;
  3222. z-index: 4000 !important;
  3223. line-height: 1.5;
  3224. word-break: break-all;
  3225. }
  3226. .dispatch-device-lock-tooltip {
  3227. min-width: 190px;
  3228. max-width: 320px;
  3229. z-index: 7000 !important;
  3230. padding: 10px 14px 10px 18px;
  3231. border: 1px solid #ff8a00;
  3232. border-left: 4px solid #ff5f00;
  3233. border-radius: 6px;
  3234. color: #7a2d00 !important;
  3235. background: linear-gradient(180deg, #fff7dc 0%, #ffe8bd 100%) !important;
  3236. box-shadow: 0 10px 24px rgba(180, 83, 9, 0.28),
  3237. inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  3238. font-size: 14px;
  3239. font-weight: 700;
  3240. line-height: 1.45;
  3241. }
  3242. .dispatch-device-lock-tooltip[x-placement^='top'] .popper__arrow {
  3243. border-top-color: #ff9f1a !important;
  3244. }
  3245. .dispatch-device-lock-tooltip[x-placement^='top'] .popper__arrow::after {
  3246. border-top-color: #fff3dc !important;
  3247. }
  3248. .dispatch-device-lock-tooltip[x-placement^='bottom'] .popper__arrow {
  3249. border-bottom-color: #ff9f1a !important;
  3250. }
  3251. .dispatch-device-lock-tooltip[x-placement^='bottom'] .popper__arrow::after {
  3252. border-bottom-color: #fff3dc !important;
  3253. }
  3254. .dispatch-device-lock-tooltip[x-placement^='left'] .popper__arrow {
  3255. border-left-color: #ff9f1a !important;
  3256. }
  3257. .dispatch-device-lock-tooltip[x-placement^='left'] .popper__arrow::after {
  3258. border-left-color: #fff3dc !important;
  3259. }
  3260. .dispatch-device-lock-tooltip[x-placement^='right'] .popper__arrow {
  3261. border-right-color: #ff9f1a !important;
  3262. }
  3263. .dispatch-device-lock-tooltip[x-placement^='right'] .popper__arrow::after {
  3264. border-right-color: #fff3dc !important;
  3265. }
  3266. </style>