index.vue 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575
  1. <template>
  2. <div class="index_box">
  3. <!-- <div class="menu-container">
  4. <div
  5. v-for="(item, index) in menuItems"
  6. :key="item.label"
  7. class="menu-item"
  8. :class="{ active: isOpen }"
  9. :style="getItemStyle(index)"
  10. @click="handleItemClick(item)"
  11. >
  12. {{ item.label }}
  13. </div>
  14. <button class="toggle-btn" @click="toggleMenu">
  15. {{ isOpen ? 'X' : '≡' }}
  16. </button>
  17. </div> -->
  18. <div class="content_box">
  19. <!-- @tab-click="handleClick" -->
  20. <!-- 工序名称 -->
  21. <!-- <Search></Search> -->
  22. <div class="content_box_tab">
  23. <el-input
  24. style="width: 160px"
  25. clearable
  26. v-model="name"
  27. placeholder="请输入筛选项"
  28. @input="seekInput"
  29. />
  30. <el-button type="text" @click="updataTaskList">刷新</el-button>
  31. <el-tabs
  32. v-model="activeName"
  33. type="card"
  34. stretch
  35. @tab-click="tabClickValue"
  36. >
  37. <!-- :render-content="renderContent"-->
  38. <el-tab-pane label="工单" name="0">
  39. <div class="custom-tree-node">
  40. <el-tree
  41. :data="produceTaskList"
  42. :props="defaultProps"
  43. node-key="id"
  44. :highlight-current="true"
  45. @node-click="handleNodeClick"
  46. ref="taskListRef"
  47. :key="treeKey"
  48. >
  49. <span class="custom-tree-node" slot-scope="{ node, data }">
  50. <span>{{ node.label }}</span>
  51. <span
  52. style="color: red; font-weight: 700"
  53. v-if="data.number != '0' && data.number"
  54. >({{ data.number >= 100 ? '99+' : data.number }})</span
  55. >
  56. </span>
  57. </el-tree>
  58. </div>
  59. </el-tab-pane>
  60. <el-tab-pane label="任务" name="1">
  61. <div class="custom-tree-node">
  62. <el-tree
  63. :data="produceTaskList"
  64. :props="defaultProps"
  65. node-key="id"
  66. :highlight-current="true"
  67. @node-click="handleNodeClick"
  68. ref="taskListRef"
  69. :key="treeKey"
  70. >
  71. <span class="custom-tree-node" slot-scope="{ node, data }">
  72. <span>{{ node.label }}</span>
  73. <span
  74. style="color: red; font-weight: 700"
  75. v-if="data.number != '0' && data.number"
  76. >({{ data.number >= 100 ? '99+' : data.number }})</span
  77. >
  78. </span>
  79. </el-tree>
  80. </div>
  81. <!-- <AssetTree @handleNodeClick="handleNodeClickNew" @setRootId="setRootId" id="0" :paramsType="'type'"
  82. ref="treeList" eqDevice="sb" /> -->
  83. <!-- <el-tree
  84. :data="factoryworkstationList"
  85. :props="defaultPropsTow"
  86. node-key="id"
  87. :highlight-current="true"
  88. @node-click="handleNodeClick"
  89. >
  90. </el-tree>-->
  91. </el-tab-pane>
  92. </el-tabs>
  93. </div>
  94. <div style="width: calc(100% - 220px)">
  95. <div class="seek-list" style="background-color: #157a2c">
  96. <div>
  97. <el-input
  98. style="width: 180px; margin-right: 5px"
  99. clearable
  100. v-model="keyWord"
  101. placeholder="请输入关键字"
  102. @clear="handleSearch"
  103. />
  104. <!-- <el-input style="width: 180px" clearable v-model="taskName" placeholder="请输入工序进度" /> -->
  105. <!-- -->
  106. <el-button
  107. size="mini"
  108. type="primary"
  109. style="margin: 0 5px"
  110. @click="handleSearch"
  111. >查询</el-button
  112. >
  113. <template>
  114. <el-popover
  115. placement="top-start"
  116. width="200"
  117. trigger="hover"
  118. content="支持工单编码,产品编码,产品名称,产品规格,牌号,型号,批次号查询。"
  119. >
  120. <i
  121. class="el-icon-question"
  122. slot="reference"
  123. style="color: #40a9ff; font-size: 14px"
  124. ></i>
  125. <!-- <el-button slot="reference">hover 激活</el-button> -->
  126. </el-popover></template
  127. >
  128. <!--
  129. <span>支持工单编码,产品编码,产品名称,产品规格,牌号,型号,批次号查询</span
  130. > -->
  131. </div>
  132. <div
  133. style="
  134. width: 55%;
  135. color: #fff;
  136. display: flex;
  137. justify-content: space-between;
  138. "
  139. >
  140. <div>
  141. <b style="margin-right: 50px">当前工序:{{ title }}</b>
  142. <b>下道工序:{{ title1 }}</b>
  143. </div>
  144. <div> 操作员:{{ info.name }} </div>
  145. </div>
  146. </div>
  147. <!-- :right-style="{ overflow: 'hidden' }" -->
  148. <ele-split-layout
  149. space="0px"
  150. width="45%"
  151. :resizable="true"
  152. :min-size="200"
  153. :max-size="-200"
  154. :left-style="{
  155. overflow: 'hidden',
  156. width: '100%'
  157. }"
  158. :responsive="false"
  159. style="height: calc(100vh - 70px - 50px - 90px)"
  160. >
  161. <!-- 左侧 工单列表 -->
  162. <div class="left_main">
  163. <div class="top">
  164. <!-- /工单列表 -->
  165. <produceOrder
  166. v-if="produceTaskList.length != 0 && activeName == '0'"
  167. @workSelect="workSelect"
  168. @rowClick="rowClick"
  169. ref="produceOrder"
  170. @getTaskName="getTaskName"
  171. :produceTaskInfo="produceTaskInfo"
  172. >
  173. </produceOrder>
  174. <task-work-list
  175. v-if="produceTaskList.length != 0 && activeName == '1'"
  176. @taskSelect="taskSelect"
  177. @rowTaskClick="rowTaskClick"
  178. ref="produceOrder"
  179. @getTaskName="getTaskName"
  180. :produceTaskInfo="produceTaskInfo"
  181. >
  182. </task-work-list>
  183. </div>
  184. <!-- <div class="bottom">
  185. <productionResource :BomObj="BomObj"></productionResource>
  186. </div> -->
  187. </div>
  188. <!-- 右侧 详情 -->
  189. <template v-slot:content>
  190. <div class="right_main">
  191. <!-- 领料 -->
  192. <!-- <div v-if="operationType == 'pick'"> -->
  193. <div v-if="operationType == 'pick' && activeName == '0'">
  194. <pickDetails
  195. ref="pickListRef"
  196. :workTaskId="workTaskId"
  197. :taskId="taskObj.id"
  198. @pickAdd="pickAdd"
  199. ></pickDetails>
  200. </div>
  201. <div v-if="operationType == 'feed' && activeName == '0'">
  202. <!-- 投料 -->
  203. <feeding
  204. :workListIds="workListIds"
  205. :feedNeedEquipment="feedNeedEquipment"
  206. @reload="reloadFeeding"
  207. ></feeding>
  208. </div>
  209. <div v-if="operationType == 'job'">
  210. <!-- // 报工列表 入库 -->
  211. <warehousing
  212. v-if="taskObj.id == -1 && activeName == '0'"
  213. :workListIds="workListIds"
  214. ref="wareRef"
  215. :workPlanType="workPlanType"
  216. ></warehousing>
  217. <!-- // 设备 入库 -->
  218. <!-- 普通报工 -->
  219. <!-- <jobBooking
  220. v-else
  221. :workListIds="workListIds"
  222. ref="jobRef"
  223. :reportNeedFeed="reportNeedFeed"
  224. ></jobBooking> -->
  225. <jobBooking
  226. v-else-if="isFinalCheckProduction && activeName == '0'"
  227. :workListIds="workListIds"
  228. ref="jobRef"
  229. :reportNeedFeed="reportNeedFeed"
  230. :workPlanType="workPlanType"
  231. ></jobBooking>
  232. <task-report
  233. ref="taskReportRef"
  234. v-if="activeName == '1' && isFinalCheckProduction"
  235. style="background: #fff"
  236. @success="successTask"
  237. />
  238. <!-- <workPlan
  239. style="width: 100%"
  240. v-else
  241. :workListIds="workListIds"
  242. ref="jobRef"
  243. :reportNeedFeed="reportNeedFeed"
  244. >
  245. </workPlan> -->
  246. </div>
  247. <!-- 工步 -->
  248. <div v-if="operationType == 'workStep'"> </div>
  249. <!-- 质检工序 -->
  250. <div v-if="operationType == 'inspection'">
  251. <inspection
  252. :workListIds="workListIds"
  253. ref="inspectionRef"
  254. ></inspection>
  255. </div>
  256. <!-- 委外 -->
  257. <div
  258. v-if="operationType == 'Outsourcing' && isType == '3'"
  259. class="right_main_box"
  260. >
  261. <outsourcingDetails
  262. ref="outsourcingListRef"
  263. @outsourcingAdd="outsourcingAdd"
  264. v-if="!isStep && !isOutsource && !isPleaseEntrust"
  265. :chooseType="chooseType"
  266. ></outsourcingDetails>
  267. <outsourcing
  268. :outsourceFormVal="outsourceForm"
  269. :taskObj="taskObj"
  270. :workListIds="workListIds[0]"
  271. :workData="workData"
  272. @changePlugIn="changePlugIn"
  273. @changeCancel="changeCancel"
  274. :chooseType="chooseType"
  275. v-if="isStep"
  276. ></outsourcing>
  277. <!-- -->
  278. <outsourceList
  279. :workData="workData"
  280. :taskObj="taskObj"
  281. :outsourceFormVal="outsourceForm"
  282. :chooseType="chooseType"
  283. @closeForm="closeForm"
  284. @outScucc="outScucc"
  285. v-if="isOutsource"
  286. ></outsourceList>
  287. <!--
  288. <outsourceList
  289. :outsourceFormVal="outObj"
  290. @closeForm="closeForm"
  291. @outScucc="outScucc"
  292. v-if="isOutsource"
  293. ></outsourceList> -->
  294. <pleaseEntrust
  295. :outsourceFormVal="outObj"
  296. @closeForm="closeForm"
  297. @outScucc="outScucc"
  298. v-if="isPleaseEntrust"
  299. ></pleaseEntrust>
  300. </div>
  301. <!-- <div class="menu-container">
  302. <div class="main-btn" @click="toggleMenu">
  303. <span>+</span>
  304. </div>
  305. <transition-group name="fan" tag="div">
  306. <div
  307. v-for="(btn, index) in buttons"
  308. :key="btn.label"
  309. class="sub-btn"
  310. :style="getBtnStyle(index)"
  311. v-show="isOpen"
  312. >
  313. {{ btn.label }}
  314. </div>
  315. </transition-group>
  316. </div> -->
  317. </div>
  318. </template>
  319. </ele-split-layout>
  320. <footBtn
  321. @footBtn="footBtn"
  322. :type="type"
  323. :singleReportInspection="singleReportInspection"
  324. style="background: rgba(223, 250, 222, 0.6); padding: 10px"
  325. :isPreProductionResult="isPreProductionResult"
  326. :activeName="activeName"
  327. ></footBtn>
  328. <!-- <div class="box"> -->
  329. <!-- </div> -->
  330. </div>
  331. <!-- <footBtn @footBtn="footBtn"></footBtn> -->
  332. </div>
  333. <!--领料弹框 -->
  334. <picking
  335. v-if="pickingShow"
  336. @close="pickingClose"
  337. :workListIds="workListIds"
  338. ></picking>
  339. <!-- 工艺文件 -->
  340. <wokePopup ref="wokePopupRef"></wokePopup>
  341. <!-- 检验报工 -->
  342. <workPlan ref="jobRefs" @closeWorkPlan="closeWorkPlan"> </workPlan>
  343. <!-- <workes ref="jobRefs"> </workes> -->
  344. <!-- :workListIds="workListIds" :taskId="taskObj.id" -->
  345. <!-- 工步 -->
  346. <workStep ref="workStepRef" />
  347. <!-- 任务 -->
  348. <TaskDialog ref="taskDialogRef" />
  349. <!-- 异常 -->
  350. <createError ref="createErrorRef" />
  351. <!-- 设备列表 -->
  352. <device ref="deviceRef" />
  353. <!-- 周转车列表 -->
  354. <turnover ref="turnoverRef" />
  355. <!-- BOM详情 -->
  356. <BomDetailsPop ref="bomDrawer"></BomDetailsPop>
  357. <!-- 产前准备 、 过程控制 、产后检测 -->
  358. <prenatalExamination
  359. ref="prenatalExaminationRef"
  360. @close="closePrenatalExamination"
  361. />
  362. <!-- 新增请托 -->
  363. <addPlease ref="addPleaseRef" @refresh="refreshPlease"></addPlease>
  364. <!-- qualityInspection -->
  365. <qualityInspection ref="qualityInspectionRef"></qualityInspection>
  366. </div>
  367. </template>
  368. <script>
  369. import TaskDialog from '@/views/produce/components/taskDialog/index.vue';
  370. import Search from './components/search.vue';
  371. import footBtn from './components/footBtn.vue';
  372. // import produceOrder from './components/produceOrder.vue';
  373. import produceOrder from './components/new_produceOrder.vue';
  374. import productionResource from './components/productionResource/index.vue';
  375. import outsourcing from './components/outsourcing/index.vue';
  376. import picking from './components/picking/index.vue';
  377. import wokePopup from './components/picking/wokePopup.vue';
  378. import inspection from './components/inspection/newIndex.vue';
  379. // import inspection from './components/inspection/index.vue';
  380. import pickDetails from './components/picking/details.vue';
  381. import AssetTree from '@/components/AssetTree/joobIndex.vue';
  382. import feeding from './components/feeding/index.vue';
  383. import jobBooking from './components/jobBooking/index.vue';
  384. import workPlan from './components/workPlan/index.vue';
  385. import workes from './components/workPlan/components/work.vue';
  386. import warehousing from './components/warehousing/index.vue';
  387. // import outsourceList from './components/outsourcing/outsourceList.vue';
  388. import outsourceList from './components/outsourcing/new_outsourceList.vue';
  389. import pleaseEntrust from './components/outsourcing/pleaseEntrust.vue';
  390. import workStep from './components/workStep/index.vue';
  391. import createError from './components/createError.vue';
  392. import device from './components/device/index.vue';
  393. import turnover from './components/turnover/index.vue';
  394. import outsourcingDetails from './components/outsourcing/details.vue';
  395. import BomDetailsPop from './components/bom/detailsPop.vue';
  396. import { parameterGetByCode } from '@/api/system/dictionary-data';
  397. import addPlease from './components/outsourcing/addPlease.vue';
  398. import {
  399. getByTaskId,
  400. pcCheckOutsource,
  401. getTaskInstanceById,
  402. checkOutsourceMaterial,
  403. listTask,
  404. factoryworkstationPage,
  405. nextTask,
  406. singleListTask,
  407. pleaseEntrustManagement,
  408. checkPleaseEntrust,
  409. checkRepeatPick
  410. } from '@/api/produce/index';
  411. import prenatalExamination from './components/prenatalExamination/index.vue';
  412. import { workorderPage2 } from '@/api/produce/workOrder.js';
  413. import { checkProductionResult } from '@/api/producetaskrulerecord/index.js';
  414. import qualityInspection from './components/qualityInspection/index.vue';
  415. import { pageByCurrentUser } from '@/api/workOrderList';
  416. import taskWorkList from './components/taskWorkList.vue';
  417. import taskReport from './components/taskReport.vue';
  418. import { getProduceTaskList } from '@/api/aps';
  419. export default {
  420. components: {
  421. Search,
  422. footBtn,
  423. wokePopup,
  424. produceOrder,
  425. productionResource,
  426. outsourcing,
  427. picking,
  428. pickDetails,
  429. outsourceList,
  430. feeding,
  431. AssetTree,
  432. jobBooking,
  433. inspection,
  434. warehousing,
  435. workStep,
  436. workPlan,
  437. TaskDialog,
  438. createError,
  439. device,
  440. turnover,
  441. outsourcingDetails,
  442. BomDetailsPop,
  443. prenatalExamination,
  444. pleaseEntrust,
  445. addPlease,
  446. qualityInspection,
  447. taskWorkList,
  448. taskReport
  449. },
  450. data() {
  451. return {
  452. name: '',
  453. activeName: '0',
  454. taskName: '',
  455. keyWord: '', //搜索
  456. title: '',
  457. type: '',
  458. loading: false,
  459. operationType: null,
  460. popupType: '', // 弹窗
  461. workListIds: [],
  462. factoryworkstationList: [],
  463. title1: '',
  464. arr: [],
  465. arrTow: [],
  466. produceTaskList: [],
  467. taskDataList: [],
  468. produceTaskInfo: null,
  469. isType: '',
  470. isStep: false,
  471. outsourceForm: {},
  472. outObj: {},
  473. pickingShow: false,
  474. wokePopup: false,
  475. workPlanType: '',
  476. isOutsource: false,
  477. isPleaseEntrust: false,
  478. BomObj: {},
  479. defaultProps: {
  480. children: 'children',
  481. label: 'newName'
  482. },
  483. defaultPropsTow: {
  484. children: 'children',
  485. label: 'name',
  486. value: 'code'
  487. },
  488. feedNeedEquipment: 0, //投料是否要添加生产设备1是0否
  489. reportNeedFeed: 0, //生产质检是否需要处置再报工1是0否
  490. singleReportInspection: null, //获取选中的工单是单个还是批量
  491. workTaskId: null, //选中的工单工序id
  492. workStepQueryParam: {
  493. taskId: null,
  494. workOrderId: null,
  495. bomCategoryId: null
  496. },
  497. isFinalCheckProduction: true,
  498. isOpen: false,
  499. buttons: [
  500. { label: '按钮1' },
  501. { label: '按钮2' },
  502. { label: '按钮3' },
  503. { label: '按钮4' }
  504. ],
  505. radius: 120, // 按钮展开的半径
  506. isOpen: false,
  507. lastClicked: '无',
  508. menuItems: [
  509. { label: 'BOM', action: 'Add' },
  510. { label: '周转车', action: 'Bold' },
  511. { label: '设备', action: 'Copy' },
  512. { label: '产前准备', action: 'Delete' },
  513. { label: '过程检测', action: 'Edit' },
  514. { label: '产后检查', action: 'Favorite' }
  515. ],
  516. isPreProductionResult: null,
  517. chooseType: '1',
  518. isUpdataTask: false,
  519. treeKey: '1',
  520. taskData: null,
  521. taskRequestController: null
  522. };
  523. },
  524. computed: {
  525. taskObj() {
  526. return this.$store.state.user.taskObj;
  527. },
  528. info() {
  529. return this.$store.state.user.info;
  530. },
  531. rightShow() {
  532. return (type) => {};
  533. },
  534. actionMap() {
  535. return {
  536. job: this.handleJob,
  537. pick: this.handlePick,
  538. workStep: this.handleWorkStep,
  539. task: this.handleTask,
  540. work: this.handleWork,
  541. device: this.handleDevice,
  542. bom: this.handleBom,
  543. error: this.handleError,
  544. Outsourcing: this.handleOutsourcing,
  545. qualityInspection: this.handleQualityInspection,
  546. prenatalExamination: () => this.handleInspection(1),
  547. processDetection: () => this.handleInspection(2),
  548. postpartumExamination: () => this.handleInspection(3)
  549. };
  550. }
  551. },
  552. created() {
  553. this.init();
  554. this.getTaskList();
  555. this.getFactoryworkstationPageList();
  556. this.operationType = null;
  557. this.workListIds = [];
  558. },
  559. methods: {
  560. tabClickValue() {
  561. this.abortTaskRequest();
  562. this.isFinalCheckProduction = false;
  563. this.operationType = '';
  564. this.getTaskList();
  565. this.name = '';
  566. this.seekInput();
  567. },
  568. toggleMenu() {
  569. this.isOpen = !this.isOpen;
  570. },
  571. handleItemClick(item) {
  572. this.lastClicked = item.action;
  573. // console.log(`Clicked: ${item.label} - ${item.action}`);
  574. },
  575. getItemStyle(index) {
  576. if (!this.isOpen) {
  577. return {};
  578. }
  579. const radius = 120;
  580. let angle = -180 + (120 / (this.menuItems.length - 1)) * index;
  581. let rad = (angle * Math.PI) / 180;
  582. let tx = Math.cos(rad) * radius;
  583. let ty = Math.sin(rad) * radius;
  584. return {
  585. '--tx': `${tx}px`,
  586. '--ty': `${ty}px`,
  587. 'transition-delay': `${index * 0.05}s`
  588. };
  589. },
  590. abortTaskRequest() {
  591. if (this.taskRequestController) {
  592. this.taskRequestController.abort();
  593. this.taskRequestController = null;
  594. }
  595. },
  596. // 前端筛选
  597. seekInput() {
  598. // console.log(activeName);
  599. if (this.activeName == '0') {
  600. if (!this.name) return (this.produceTaskList = this.arr);
  601. this.produceTaskList = this.produceTaskList.filter((item) => {
  602. return item.name.indexOf(this.name) > -1;
  603. });
  604. } else {
  605. if (!this.name) return (this.factoryworkstationList = this.arrTow);
  606. this.factoryworkstationList = this.factoryworkstationList.filter(
  607. (item) => {
  608. return item.name.indexOf(this.name) > -1;
  609. }
  610. );
  611. }
  612. },
  613. // 折叠悬浮中样式调整
  614. init() {
  615. this.$store.dispatch('theme/setCollapse', true);
  616. },
  617. async getTaskName(value) {
  618. if (value.length > 0) {
  619. let res = await nextTask({
  620. taskId: this.taskObj.id,
  621. workOrderIds: value.map((item) => item.id)
  622. });
  623. this.title1 = res.data.map((item) => item.taskTypeName).toString();
  624. } else {
  625. this.title1 = '';
  626. }
  627. },
  628. handleSearch() {
  629. let obj = {
  630. keyWord: this.keyWord,
  631. taskName: this.taskName
  632. };
  633. this.$refs.produceOrder.handleSearch(obj);
  634. },
  635. handleNodeClickNew(info) {
  636. let current = { id: info.id };
  637. this.$store.commit('user/currentObj', current);
  638. },
  639. setRootId(id) {
  640. this.rootId = id;
  641. },
  642. // 点击工序
  643. handleNodeClick(data) {
  644. this.feedNeedEquipment = data.feedNeedEquipment;
  645. this.reportNeedFeed = data.reportNeedFeed;
  646. this.produceTaskInfo = data;
  647. // 重置按钮 禁用
  648. if (this.produceTaskInfo && this.produceTaskInfo.id != data.id) {
  649. this.isPreProductionResult = null;
  650. }
  651. let obj = {
  652. 1: `${data.workCenterName}-${data.name}(普通工序)`,
  653. 3: `${data.workCenterName}-${data.name}(质检工序)`,
  654. 4: `${data.workCenterName}-${data.name}(包装工序)`,
  655. 5: `${data.workCenterName}-${data.name}(入库工序)`,
  656. 6: `${data.workCenterName}-${data.name}(质检工序)`
  657. };
  658. this.title = obj[data.type] || '';
  659. this.type = data.type;
  660. let taskObj = {};
  661. taskObj = this.produceTaskList.find((item) => item.id === data.id);
  662. taskObj.isOrderListData = false;
  663. this.$store.commit('user/setTaskObj', taskObj);
  664. },
  665. handleChoose(val) {
  666. console.log(val);
  667. },
  668. // 获取工序列表
  669. getTaskList() {
  670. if (localStorage.getItem('singleUserInfo') == '1') {
  671. singleListTask(
  672. JSON.parse(localStorage.getItem('chooseUserInfo'))
  673. ).then((res) => {
  674. this.handleTaskList(res);
  675. });
  676. } else {
  677. listTask().then((res) => {
  678. this.handleTaskList(res);
  679. if (this.activeName === '0') {
  680. this.getTaskWorkNumber();
  681. } else if (this.activeName === '1') {
  682. this.getTaskWorkList();
  683. }
  684. });
  685. }
  686. // if (localStorage.getItem('singleUserInfo') == '1') {
  687. // singleListTask(
  688. // JSON.parse(localStorage.getItem('chooseUserInfo'))
  689. // ).then((res) => {
  690. // res.map((v) => {
  691. // v.newName = `${v.workCenterName}-${v.name}`;
  692. // });
  693. // this.produceTaskList = res;
  694. // this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
  695. // if (this.produceTaskList?.length) {
  696. // this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
  697. // this.$nextTick(() => {
  698. // this.$refs.taskListRef?.setCurrentKey(
  699. // this.produceTaskList[0].id
  700. // );
  701. // });
  702. // this.produceTaskInfo = this.produceTaskList[0];
  703. // }
  704. // });
  705. // } else {
  706. // listTask().then((res) => {
  707. // res.map((v) => {
  708. // v.newName = `${v.workCenterName}-${v.name}`;
  709. // });
  710. // this.produceTaskList = res;
  711. // this.taskDataList = res;
  712. // this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
  713. // if (this.produceTaskList?.length) {
  714. // this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
  715. // this.$nextTick(() => {
  716. // this.$refs.taskListRef?.setCurrentKey(
  717. // this.produceTaskList[0].id
  718. // );
  719. // });
  720. // this.produceTaskInfo = this.produceTaskList[0];
  721. // }
  722. // if (this.activeName == '0') {
  723. // this.getTaskWorkNumber();
  724. // } else if (this.activeName == '1') {
  725. // this.getTaskWorkList();
  726. // }
  727. // });
  728. // }
  729. },
  730. handleTaskList(res) {
  731. res.forEach((v) => {
  732. v.newName = `${v.workCenterName}-${v.name}`;
  733. });
  734. this.produceTaskList = res;
  735. this.taskDataList = res;
  736. this.arr = JSON.parse(JSON.stringify(res));
  737. // 默认选中第一个
  738. if (res?.length) {
  739. this.$store.commit('user/setTaskObj', res[0]);
  740. this.produceTaskInfo = res[0];
  741. this.$nextTick(() => {
  742. this.$refs.taskListRef?.setCurrentKey(res[0].id);
  743. });
  744. }
  745. },
  746. async fetchTaskWorkCount(apiFn) {
  747. this.taskRequestController = new AbortController();
  748. const signal = this.taskRequestController.signal;
  749. try {
  750. const requests = this.taskDataList.map((item) =>
  751. apiFn(
  752. {
  753. pageNum: 1,
  754. size: 5000,
  755. taskId: item.id
  756. },
  757. { signal }
  758. )
  759. );
  760. const results = await Promise.all(requests);
  761. this.taskDataList = this.taskDataList.map((item, index) => ({
  762. ...item,
  763. number: results[index]?.count || 0
  764. }));
  765. this.produceTaskList = this.taskDataList;
  766. this.treeKey = Date.now();
  767. } catch (err) {
  768. if (err?.name == 'CanceledError' || err?.name == 'AbortError') {
  769. return;
  770. }
  771. console.error(err);
  772. }
  773. },
  774. //获取工序下所有的工单集合
  775. async getTaskWorkNumber() {
  776. await this.fetchTaskWorkCount(workorderPage2);
  777. // for (const [index, item] of this.taskDataList.entries()) {
  778. // await workorderPage2({
  779. // pageNum: 1,
  780. // size: 5000,
  781. // taskId: item.id
  782. // }).then((res) => {
  783. // this.taskDataList[index].number = res.count;
  784. // });
  785. // }
  786. // this.produceTaskList = this.taskDataList;
  787. // this.treeKey = Date.now();
  788. },
  789. //获取工序下所有的任务集合
  790. async getTaskWorkList() {
  791. await this.fetchTaskWorkCount(pageByCurrentUser);
  792. // for (const [index, item] of this.taskDataList.entries()) {
  793. // await pageByCurrentUser({
  794. // pageNum: 1,
  795. // size: 5000,
  796. // taskId: item.id
  797. // }).then((res) => {
  798. // this.taskDataList[index].number = res.count;
  799. // });
  800. // }
  801. // this.produceTaskList = this.taskDataList;
  802. // this.treeKey = Date.now();
  803. },
  804. // 获取工位
  805. getFactoryworkstationPageList() {
  806. factoryworkstationPage({ pageNum: 1, size: 99999999 }).then((res) => {
  807. this.factoryworkstationList = res.list;
  808. this.arrTow = JSON.parse(JSON.stringify(this.factoryworkstationList));
  809. // newName
  810. });
  811. },
  812. changeCancel(activeType) {
  813. this.isStep = false;
  814. this.chooseType = activeType;
  815. // this.$nextTick(() => {
  816. // this.$refs.outsourcingListRef.getDataList(this.workData.list[0].code);
  817. // });
  818. if (this.chooseType == '1') {
  819. this.$nextTick(() => {
  820. this.$refs.outsourcingListRef.getDataList(
  821. this.workData.list[0].code
  822. );
  823. });
  824. } else if (this.chooseType == '2') {
  825. this.$nextTick(() => {
  826. this.$refs.outsourcingListRef.getPleaseData(
  827. this.workData.list[0].code
  828. );
  829. });
  830. }
  831. },
  832. closeForm() {
  833. this.isOutsource = false;
  834. this.isPleaseEntrust = false;
  835. this.$nextTick(() => {
  836. this.$refs.outsourcingListRef.getDataList(this.workData.list[0].code);
  837. });
  838. },
  839. outScucc() {
  840. // this.operationType = null;
  841. this.isOutsource = false;
  842. this.isPleaseEntrust = false;
  843. this.$nextTick(() => {
  844. this.$refs.outsourcingListRef.getDataList(this.workData.list[0].code);
  845. });
  846. },
  847. updataTaskList() {
  848. this.isUpdataTask = true;
  849. this.getTaskList();
  850. },
  851. // 切换组件
  852. async changePlugIn(e, index) {
  853. if (index == '1') {
  854. this.outObj = e;
  855. let req = {
  856. taskId: e.taskId,
  857. taskIds: e.taskIds,
  858. workOrderId: e.workOrderId,
  859. quantity: e.formedNumLast
  860. };
  861. const URL =
  862. index == '1' ? checkOutsourceMaterial : checkPleaseEntrust;
  863. const res = await URL(req);
  864. this.outObj = { ...res.data, ...this.outsourceForm, ...this.outObj };
  865. this.isStep = false;
  866. this.isOutsource = true;
  867. } else if (index == '2') {
  868. this.outObj = e;
  869. let req = {
  870. taskId: e.taskId,
  871. taskIds: e.taskIds,
  872. workOrderId: e.workOrderId,
  873. quantity: e.formedNumLast
  874. };
  875. const res = await checkPleaseEntrust(req);
  876. this.outObj = { ...res.data, ...this.outsourceForm, ...this.outObj };
  877. this.isStep = false;
  878. this.isPleaseEntrust = true;
  879. // this.isOutsource = true;
  880. console.log(res, '请托的结果');
  881. }
  882. },
  883. renderContent(h, { node, data, store }) {
  884. // Use createElement syntax instead of JSX
  885. return h('span', { class: 'custom-tree-node' }, [
  886. // h('span', node.label),
  887. h(
  888. 'el-badge',
  889. {
  890. props: {
  891. value: data.number != '0' ? data.number : '',
  892. max: 99
  893. },
  894. class: 'item'
  895. },
  896. [h('span', node.label)]
  897. )
  898. ]);
  899. },
  900. workSelect(data) {
  901. this.workTaskId = data.list.length > 0 ? data.list[0].taskId : null;
  902. this.workStepQueryParam.taskId =
  903. data.list.length > 0 ? data.list[0].taskId : null;
  904. this.workStepQueryParam.workOrderId =
  905. data.list.length > 0 ? data.list[0].id : null;
  906. this.workStepQueryParam.bomCategoryId =
  907. data.list.length > 0 ? data.list[0].bomCategoryId : null;
  908. this.singleReportInspection =
  909. data.list.length > 0 ? data.list[0].singleReport : null; //获取选中的工单是单个还是批量
  910. this.isStep = false;
  911. this.operationType = null;
  912. this.workListIds = data.ids;
  913. this.workData = data;
  914. this.checkProductionResult();
  915. },
  916. taskSelect(data) {
  917. this.taskData = data.list[0];
  918. },
  919. pickingWokeClose() {
  920. this.wokePopup = false;
  921. },
  922. async getCodeData(req) {
  923. await parameterGetByCode({ code: 'enable_quality_plus' }).then(
  924. (res) => {
  925. if (res.value == '1') {
  926. this.$refs.jobRefs.open(req);
  927. }
  928. }
  929. );
  930. },
  931. closeWorkPlan(type) {
  932. this.workPlanType = type;
  933. },
  934. async checkQualityResult() {
  935. if (
  936. this.produceTaskInfo &&
  937. this.workListIds.length > 0 &&
  938. this.produceTaskInfo.id != -1
  939. ) {
  940. // 判断是否要求先完成 产前准备等事项
  941. const result = await checkProductionResult({
  942. produceTaskId: this.produceTaskInfo.id,
  943. workOrderIds: this.workListIds
  944. });
  945. return result;
  946. }
  947. },
  948. // async footBtn(t) {
  949. // this.workPlanType = '';
  950. // if ((t == 'work' || t == 'workStep', t === 'task')) {
  951. // this.popupType = t;
  952. // } else {
  953. // this.operationType = t;
  954. // }
  955. // if (
  956. // Object.keys(this.$store.state.user.taskObj).length === 0 &&
  957. // this.$store.state.user.taskObj.constructor === Object
  958. // ) {
  959. // this.$message.warning('请选择工序');
  960. // return true;
  961. // }
  962. // if (['pick', 'feed', 'job', 'work', 'workStep', 'task'].includes(t)) {
  963. // if (this.activeName == '0') {
  964. // if (this.workListIds.length == 0) {
  965. // this.$message.warning('请选择工单列表');
  966. // return false;
  967. // }
  968. // }
  969. // }
  970. // if (t === 'job') {
  971. // let resultValue = '0';
  972. // await parameterGetByCode({
  973. // code: 'first_article_dual_inspection_for_report'
  974. // }).then((res) => {
  975. // resultValue = res.value;
  976. // });
  977. // if (this.activeName == '1') {
  978. // if (!this.taskData) {
  979. // this.isFinalCheckProduction = false;
  980. // return this.$message.warning('请选择一条任务单进行报工');
  981. // } else {
  982. // this.isFinalCheckProduction = true;
  983. // }
  984. // const row = this.taskData;
  985. // if (resultValue == '1') {
  986. // if (row.totalFirstArticleDualInspectionStatus != 2) {
  987. // this.isFinalCheckProduction = false;
  988. // return this.$message.warning('请先完成首件两检再报工');
  989. // }
  990. // } else {
  991. // this.isFinalCheckProduction = true;
  992. // }
  993. // let currentRow = {
  994. // assignCode: row.assignCode,
  995. // mesWorkOrderCode: row.mesWorkOrderCode,
  996. // workOrderCode: row.workOrderCode,
  997. // productionPlanCode: row.productionPlanCode,
  998. // produceRoutingName: row.produceRoutingName,
  999. // formingNum: row.formingNum,
  1000. // assignTeamName: row.assignTeamName,
  1001. // formingWeight: row.formingWeight,
  1002. // planStartTime: row.planStartTime,
  1003. // planCompleteTime: row.planCompleteTime,
  1004. // startTime: row.startTime,
  1005. // firstTaskId: row.firstTaskId,
  1006. // endTime: row.endTime,
  1007. // taskName: row.taskName,
  1008. // firstTaskName: row.firstTaskName,
  1009. // assigneeType: row.assigneeType ? row.assigneeType.desc : '',
  1010. // assigneeName: row.assigneeName,
  1011. // weight: row.weight,
  1012. // quantity: row.quantity,
  1013. // durationText: row.durationText,
  1014. // apsAssigneeId: row.id,
  1015. // batchNo: row.batchNo,
  1016. // productCode: row.productCode,
  1017. // productName: row.productName,
  1018. // specification: row.specification,
  1019. // newWeightUnit: row.newWeightUnit,
  1020. // measuringUnit: row.measuringUnit
  1021. // };
  1022. // let form = {
  1023. // realEndTime: row.realEndTime,
  1024. // realStartTime: row.realStartTime,
  1025. // unqualifiedWeight: row.unqualifiedWeight,
  1026. // unqualifiedQuantity: row.unqualifiedQuantity,
  1027. // qualifiedWeight: row.qualifiedWeight,
  1028. // remark: row.assigneeRemark,
  1029. // qualifiedQuantity: row.qualifiedQuantity,
  1030. // reportQuantity: row.reportQuantity,
  1031. // lossQuantity: row.lossQuantity
  1032. // };
  1033. // this.$nextTick(() => {
  1034. // this.$refs.taskReportRef.open('repoort', currentRow, form);
  1035. // });
  1036. // } else {
  1037. // this.isFinalCheckProduction = true;
  1038. // let req = {
  1039. // taskId: this.taskObj.id,
  1040. // workOrderId: this.workListIds[0],
  1041. // data: this.workData.list
  1042. // };
  1043. // if (resultValue == '1') {
  1044. // const result = await this.checkQualityResult();
  1045. // if (!result) return;
  1046. // const firstArticleResult =
  1047. // result.firstArticleDualInspectionResult ?? true;
  1048. // this.isFinalCheckProduction = firstArticleResult;
  1049. // if (!firstArticleResult) {
  1050. // return this.$message.warning('请完成首件两检再报工!');
  1051. // }
  1052. // }
  1053. // if (
  1054. // this.taskObj.type == 2 ||
  1055. // this.taskObj.type == 3 ||
  1056. // this.taskObj.type == 6
  1057. // ) {
  1058. // this.getCodeData(req);
  1059. // }
  1060. // }
  1061. // }
  1062. // if (t == 'pick') {
  1063. // if (this.activeName == '0') {
  1064. // this.$nextTick(() => {
  1065. // console.log(this.taskObj);
  1066. // this.$refs.pickListRef.getList(this.workListIds);
  1067. // });
  1068. // }
  1069. // }
  1070. // // 工步
  1071. // if (t === 'workStep') {
  1072. // if (this.activeName == '0') {
  1073. // if (this.workListIds.length > 1) {
  1074. // return this.$message.warning('工步只能选择一个工单!');
  1075. // }
  1076. // this.$refs.workStepRef.open(this.workStepQueryParam);
  1077. // }
  1078. // }
  1079. // if (t === 'task') {
  1080. // if (this.activeName == '0') {
  1081. // if (this.workListIds.length > 1) {
  1082. // return this.$message.warning('任务只能选择一个工单!');
  1083. // }
  1084. // this.$refs.taskDialogRef.open(
  1085. // this.workStepQueryParam,
  1086. // this.workData.list[0]
  1087. // );
  1088. // }
  1089. // }
  1090. // if (t === 'error') {
  1091. // if (this.activeName == '0') {
  1092. // if (this.workListIds.length > 1) {
  1093. // return this.$message.warning('异常只能选择一个工单!');
  1094. // } else if (this.workListIds.length < 1) {
  1095. // return this.$message.warning('请选择工单!');
  1096. // }
  1097. // this.$refs.createErrorRef.open('add', this.workData.list[0]);
  1098. // }
  1099. // }
  1100. // // 工艺路线 *** 修改 判断只能选择一个
  1101. // // if (t === 'work') {
  1102. // // let req = {
  1103. // // taskId: this.taskObj.id,
  1104. // // workOrderId: this.workListIds[0]
  1105. // // };
  1106. // // this.$refs.wokePopupRef.open(req);
  1107. // // }
  1108. // if (t === 'work') {
  1109. // if (this.activeName == '0') {
  1110. // if (this.workListIds.length > 1) {
  1111. // return this.$message.warning('工艺文件只能选择一个工单!');
  1112. // } else if (this.workListIds.length < 1) {
  1113. // return this.$message.warning('请选择工单!');
  1114. // }
  1115. // await parameterGetByCode({
  1116. // code: 'mes_craft_file_by_category_code'
  1117. // }).then((res) => {
  1118. // console.log(this.workData.list, 'this.workData.list');
  1119. // if (res.value == '1') {
  1120. // let req = {
  1121. // taskId: this.taskObj.id,
  1122. // workOrderId: this.workListIds[0],
  1123. // productCode: this.workData.list[0].productCode
  1124. // };
  1125. // this.$refs.wokePopupRef.openTwo(req);
  1126. // } else {
  1127. // let req = {
  1128. // taskId: this.taskObj.id,
  1129. // workOrderId: this.workListIds[0]
  1130. // };
  1131. // this.$refs.wokePopupRef.open(req);
  1132. // }
  1133. // });
  1134. // }
  1135. // }
  1136. // if (t == 'feed') {
  1137. // }
  1138. // if (t == 'device') {
  1139. // if (this.activeName == '0') {
  1140. // if (this.taskObj.id) {
  1141. // this.$refs.deviceRef.open(this.taskObj.id);
  1142. // } else {
  1143. // this.$message.warning('请选择工序');
  1144. // }
  1145. // }
  1146. // }
  1147. // if (t == 'turnover') {
  1148. // if (this.activeName == '0') {
  1149. // if (this.workListIds.length < 1) {
  1150. // return this.$message.warning('请选择工单!');
  1151. // } else {
  1152. // const codeListData = [];
  1153. // this.workData.list.forEach((it) => {
  1154. // codeListData.push(it.code);
  1155. // });
  1156. // this.$refs.turnoverRef.open(codeListData);
  1157. // }
  1158. // }
  1159. // }
  1160. // if (t == 'bom') {
  1161. // if (this.activeName == '0') {
  1162. // if (this.workListIds.length > 1) {
  1163. // return this.$message.warning('查看BOM详情只能选择一个工单!');
  1164. // } else if (this.workListIds.length < 1)
  1165. // return this.$message.warning('请选择工单!');
  1166. // else {
  1167. // console.log(this.workData);
  1168. // const row = this.workData.list[0];
  1169. // let rowData = {
  1170. // categoryId: row.categoryId,
  1171. // categoryName: row.bomCategoryName,
  1172. // code: row.code,
  1173. // versions: row.bomCategoryVersions,
  1174. // rootPathIdParent: row.categoryLevelPathIdParent || '',
  1175. // isProduct: true,
  1176. // bomType: Number(row.bomType),
  1177. // isTemp: 0
  1178. // };
  1179. // this.$refs.bomDrawer.open(rowData);
  1180. // }
  1181. // }
  1182. // }
  1183. // // 委外
  1184. // if (t == 'Outsourcing') {
  1185. // if (this.activeName == '0') {
  1186. // if (this.workListIds.length > 1) {
  1187. // return this.$message.warning('委外请托工序只能选择一个工单!');
  1188. // } else if (this.workListIds.length < 1) {
  1189. // return this.$message.warning('请选择工单!');
  1190. // } else {
  1191. // console.log(this.workData, 'this.workData');
  1192. // // /
  1193. // this.handOutsource(this.workListIds[0]);
  1194. // }
  1195. // }
  1196. // }
  1197. // // 产前准备 过程控制 产后检查
  1198. // if (
  1199. // t == 'prenatalExamination' ||
  1200. // t == 'processDetection' ||
  1201. // t == 'postpartumExamination'
  1202. // ) {
  1203. // if (this.activeName == '0') {
  1204. // if (this.workListIds.length > 1) {
  1205. // if (t == 'prenatalExamination') {
  1206. // return this.$message.warning('产前准备只能选择一个工单!');
  1207. // }
  1208. // if (t == 'processDetection') {
  1209. // return this.$message.warning('过程控制只能选择一个工单!');
  1210. // }
  1211. // return this.$message.warning('产后检查只能选择一个工单!');
  1212. // }
  1213. // if (this.workListIds.length < 1) {
  1214. // return this.$message.warning('请选择工单!');
  1215. // }
  1216. // let reportWorkType = 1;
  1217. // switch (t) {
  1218. // case 'prenatalExamination':
  1219. // reportWorkType = 1;
  1220. // break;
  1221. // case 'processDetection':
  1222. // reportWorkType = 2;
  1223. // break;
  1224. // default:
  1225. // reportWorkType = 3;
  1226. // break;
  1227. // }
  1228. // this.$refs.prenatalExaminationRef.open(
  1229. // this.workData.list[0],
  1230. // this.produceTaskInfo,
  1231. // reportWorkType
  1232. // );
  1233. // }
  1234. // }
  1235. // // 首件两检
  1236. // if (t == 'qualityInspection') {
  1237. // if (this.activeName == '0') {
  1238. // if (this.workListIds.length < 1) {
  1239. // return this.$message.warning('请选择工单!');
  1240. // }
  1241. // if (this.workListIds.length > 1) {
  1242. // return this.$message.warning('首件两检只能选择一个工单!');
  1243. // }
  1244. // this.$refs.qualityInspectionRef.open(
  1245. // this.workData.list[0],
  1246. // this.produceTaskInfo
  1247. // );
  1248. // } else {
  1249. // if (!this.taskData) {
  1250. // return this.$message.warning('请选择一条任务单首件两检');
  1251. // }
  1252. // this.selfRequest(this.taskData);
  1253. // }
  1254. // }
  1255. // },
  1256. // async footBtn(t) {
  1257. // this.initOperationType(t);
  1258. // if (!this.checkTaskSelected()) return;
  1259. // if (!this.checkWorkOrderSelected(t)) return;
  1260. // switch (t) {
  1261. // case 'job':
  1262. // await this.handleJob();
  1263. // break;
  1264. // case 'pick':
  1265. // this.handlePick();
  1266. // break;
  1267. // case 'workStep':
  1268. // this.handleWorkStep();
  1269. // break;
  1270. // case 'task':
  1271. // this.handleTask();
  1272. // break;
  1273. // case 'error':
  1274. // this.handleError();
  1275. // break;
  1276. // case 'work':
  1277. // await this.handleWork();
  1278. // break;
  1279. // case 'device':
  1280. // this.handleDevice();
  1281. // break;
  1282. // case 'turnover':
  1283. // this.handleTurnover();
  1284. // break;
  1285. // case 'bom':
  1286. // this.handleBom();
  1287. // break;
  1288. // case 'Outsourcing':
  1289. // this.handleOutsourcing();
  1290. // break;
  1291. // case 'prenatalExamination':
  1292. // case 'processDetection':
  1293. // case 'postpartumExamination':
  1294. // this.handleInspection(t);
  1295. // break;
  1296. // case 'qualityInspection':
  1297. // this.handleQualityInspection();
  1298. // break;
  1299. // default:
  1300. // break;
  1301. // }
  1302. // },
  1303. // initOperationType(t) {
  1304. // this.workPlanType = '';
  1305. // if (['work', 'workStep', 'task'].includes(t)) {
  1306. // this.popupType = t;
  1307. // } else {
  1308. // this.operationType = t;
  1309. // }
  1310. // },
  1311. // checkTaskSelected() {
  1312. // const taskObj = this.$store.state.user.taskObj;
  1313. // if (!taskObj || Object.keys(taskObj).length === 0) {
  1314. // this.$message.warning('请选择工序');
  1315. // return false;
  1316. // }
  1317. // return true;
  1318. // },
  1319. // checkWorkOrderSelected(t) {
  1320. // const needCheck = ['pick', 'feed', 'job', 'work', 'workStep', 'task'];
  1321. // if (!needCheck.includes(t)) return true;
  1322. // if (this.activeName === '0' && this.workListIds.length === 0) {
  1323. // this.$message.warning('请选择工单列表');
  1324. // return false;
  1325. // }
  1326. // return true;
  1327. // },
  1328. // async needFirstArticleCheck() {
  1329. // const res = await parameterGetByCode({
  1330. // code: 'first_article_dual_inspection_for_report'
  1331. // });
  1332. // return res?.value === '1';
  1333. // },
  1334. // async handleJob() {
  1335. // const needCheck = await this.needFirstArticleCheck();
  1336. // if (this.activeName === '1') {
  1337. // this.handleSingleTaskJob(needCheck);
  1338. // } else {
  1339. // await this.handleBatchJob(needCheck);
  1340. // }
  1341. // },
  1342. // handleSingleTaskJob(needCheck) {
  1343. // if (!this.taskData) {
  1344. // this.isFinalCheckProduction = false;
  1345. // return this.$message.warning('请选择一条任务单进行报工');
  1346. // }
  1347. // const row = this.taskData;
  1348. // if (needCheck && row.totalFirstArticleDualInspectionStatus !== 2) {
  1349. // this.isFinalCheckProduction = false;
  1350. // return this.$message.warning('请先完成首件两检再报工');
  1351. // }
  1352. // this.isFinalCheckProduction = true;
  1353. // const currentRow = this.buildTaskRow(row);
  1354. // const form = this.buildTaskForm(row);
  1355. // this.$nextTick(() => {
  1356. // this.$refs.taskReportRef.open('repoort', currentRow, form);
  1357. // });
  1358. // },
  1359. // async handleBatchJob(needCheck) {
  1360. // this.isFinalCheckProduction = true;
  1361. // const req = {
  1362. // taskId: this.taskObj.id,
  1363. // workOrderId: this.workListIds[0],
  1364. // data: this.workData.list
  1365. // };
  1366. // if (needCheck) {
  1367. // const result = await this.checkQualityResult();
  1368. // const ok = result?.firstArticleDualInspectionResult ?? true;
  1369. // if (!ok) {
  1370. // this.isFinalCheckProduction = false;
  1371. // return this.$message.warning('请完成首件两检再报工!');
  1372. // }
  1373. // }
  1374. // if ([2, 3, 6].includes(this.taskObj.type)) {
  1375. // this.getCodeData(req);
  1376. // }
  1377. // },
  1378. // buildTaskRow(row) {
  1379. // return {
  1380. // assignCode: row.assignCode,
  1381. // mesWorkOrderCode: row.mesWorkOrderCode,
  1382. // workOrderCode: row.workOrderCode,
  1383. // productionPlanCode: row.productionPlanCode,
  1384. // produceRoutingName: row.produceRoutingName,
  1385. // formingNum: row.formingNum,
  1386. // assignTeamName: row.assignTeamName,
  1387. // formingWeight: row.formingWeight,
  1388. // planStartTime: row.planStartTime,
  1389. // planCompleteTime: row.planCompleteTime,
  1390. // startTime: row.startTime,
  1391. // firstTaskId: row.firstTaskId,
  1392. // endTime: row.endTime,
  1393. // taskName: row.taskName,
  1394. // firstTaskName: row.firstTaskName,
  1395. // assigneeType: row.assigneeType?.desc || '',
  1396. // assigneeName: row.assigneeName,
  1397. // weight: row.weight,
  1398. // quantity: row.quantity,
  1399. // durationText: row.durationText,
  1400. // apsAssigneeId: row.id,
  1401. // batchNo: row.batchNo,
  1402. // productCode: row.productCode,
  1403. // productName: row.productName,
  1404. // specification: row.specification,
  1405. // newWeightUnit: row.newWeightUnit,
  1406. // measuringUnit: row.measuringUnit
  1407. // };
  1408. // },
  1409. // buildTaskForm(row) {
  1410. // return {
  1411. // realEndTime: row.realEndTime,
  1412. // realStartTime: row.realStartTime,
  1413. // unqualifiedWeight: row.unqualifiedWeight,
  1414. // unqualifiedQuantity: row.unqualifiedQuantity,
  1415. // qualifiedWeight: row.qualifiedWeight,
  1416. // remark: row.assigneeRemark,
  1417. // qualifiedQuantity: row.qualifiedQuantity,
  1418. // reportQuantity: row.reportQuantity,
  1419. // lossQuantity: row.lossQuantity
  1420. // };
  1421. // },
  1422. // handlePick() {
  1423. // this.$nextTick(() => {
  1424. // this.$refs.pickListRef.getList(this.workListIds);
  1425. // });
  1426. // },
  1427. // handleWorkStep() {
  1428. // if (this.workListIds.length > 1) {
  1429. // return this.$message.warning('工步只能选择一个工单!');
  1430. // }
  1431. // this.$refs.workStepRef.open(this.workStepQueryParam);
  1432. // },
  1433. // handleTask() {
  1434. // if (this.workListIds.length > 1) {
  1435. // return this.$message.warning('任务只能选择一个工单!');
  1436. // }
  1437. // this.$refs.taskDialogRef.open(
  1438. // this.workStepQueryParam,
  1439. // this.workData.list[0]
  1440. // );
  1441. // },
  1442. // handleError() {
  1443. // if (this.workListIds.length !== 1) {
  1444. // return this.$message.warning('异常只能选择一个工单!');
  1445. // }
  1446. // this.$refs.createErrorRef.open('add', this.workData.list[0]);
  1447. // },
  1448. // async handleWork() {
  1449. // if (this.workListIds.length !== 1) {
  1450. // return this.$message.warning('工艺文件只能选择一个工单!');
  1451. // }
  1452. // const res = await parameterGetByCode({
  1453. // code: 'mes_craft_file_by_category_code'
  1454. // });
  1455. // const baseReq = {
  1456. // taskId: this.taskObj.id,
  1457. // workOrderId: this.workListIds[0]
  1458. // };
  1459. // if (res?.value === '1') {
  1460. // this.$refs.wokePopupRef.openTwo({
  1461. // ...baseReq,
  1462. // productCode: this.workData.list[0].productCode
  1463. // });
  1464. // } else {
  1465. // this.$refs.wokePopupRef.open(baseReq);
  1466. // }
  1467. // },
  1468. // handleDevice() {
  1469. // if (!this.taskObj.id) {
  1470. // return this.$message.warning('请选择工序');
  1471. // }
  1472. // this.$refs.deviceRef.open(this.taskObj.id);
  1473. // },
  1474. // handleTurnover() {
  1475. // if (this.workListIds.length < 1) {
  1476. // return this.$message.warning('请选择工单!');
  1477. // }
  1478. // const codes = this.workData.list.map((it) => it.code);
  1479. // this.$refs.turnoverRef.open(codes);
  1480. // },
  1481. // handleBom() {
  1482. // if (this.workListIds.length !== 1) {
  1483. // return this.$message.warning('查看BOM只能选择一个工单!');
  1484. // }
  1485. // const row = this.workData.list[0];
  1486. // this.$refs.bomDrawer.open({
  1487. // categoryId: row.categoryId,
  1488. // categoryName: row.bomCategoryName,
  1489. // code: row.code,
  1490. // versions: row.bomCategoryVersions,
  1491. // rootPathIdParent: row.categoryLevelPathIdParent || '',
  1492. // isProduct: true,
  1493. // bomType: Number(row.bomType),
  1494. // isTemp: 0
  1495. // });
  1496. // },
  1497. // handleOutsourcing() {
  1498. // if (this.workListIds.length !== 1) {
  1499. // return this.$message.warning('委外只能选择一个工单!');
  1500. // }
  1501. // this.handOutsource(this.workListIds[0]);
  1502. // },
  1503. // handleInspection(t) {
  1504. // if (this.workListIds.length !== 1) {
  1505. // const map = {
  1506. // prenatalExamination: '产前准备',
  1507. // processDetection: '过程控制',
  1508. // postpartumExamination: '产后检查'
  1509. // };
  1510. // return this.$message.warning(`${map[t]}只能选择一个工单!`);
  1511. // }
  1512. // const typeMap = {
  1513. // prenatalExamination: 1,
  1514. // processDetection: 2,
  1515. // postpartumExamination: 3
  1516. // };
  1517. // this.$refs.prenatalExaminationRef.open(
  1518. // this.workData.list[0],
  1519. // this.produceTaskInfo,
  1520. // typeMap[t]
  1521. // );
  1522. // },
  1523. // handleQualityInspection() {
  1524. // if (this.activeName === '0') {
  1525. // if (this.workListIds.length !== 1) {
  1526. // return this.$message.warning('首件两检只能选择一个工单!');
  1527. // }
  1528. // this.$refs.qualityInspectionRef.open(
  1529. // this.workData.list[0],
  1530. // this.produceTaskInfo
  1531. // );
  1532. // } else {
  1533. // if (!this.taskData) {
  1534. // return this.$message.warning('请选择一条任务单首件两检');
  1535. // }
  1536. // this.selfRequest(this.taskData);
  1537. // }
  1538. // },
  1539. async footBtn(t) {
  1540. this.workPlanType = '';
  1541. if (['work', 'workStep', 'task'].includes(t)) {
  1542. this.popupType = t;
  1543. } else {
  1544. this.operationType = t;
  1545. }
  1546. if (!this.checkTaskSelected()) return;
  1547. const handler = this.actionMap[t];
  1548. if (handler) {
  1549. await handler.call(this);
  1550. }
  1551. },
  1552. checkTaskSelected() {
  1553. const taskObj = this.$store.state.user.taskObj;
  1554. if (!taskObj || Object.keys(taskObj).length === 0) {
  1555. this.$message.warning('请选择工序');
  1556. return false;
  1557. }
  1558. return true;
  1559. },
  1560. checkWorkOrder({ min = 1, max = Infinity, msg = {} }) {
  1561. const len = this.workListIds.length;
  1562. if (len < min) {
  1563. this.$message.warning(msg.min || '请选择工单!');
  1564. return false;
  1565. }
  1566. if (len > max) {
  1567. this.$message.warning(msg.max || '只能选择一个工单!');
  1568. return false;
  1569. }
  1570. return true;
  1571. },
  1572. async getFirstArticleConfig() {
  1573. const res = await parameterGetByCode({
  1574. code: 'first_article_dual_inspection_for_report'
  1575. });
  1576. return res.value;
  1577. },
  1578. /* ================== job ================== */
  1579. async handleJob() {
  1580. const resultValue = await this.getFirstArticleConfig();
  1581. if (this.activeName == '1') {
  1582. return this.handleTaskJob(resultValue);
  1583. }
  1584. return this.handleWorkOrderJob(resultValue);
  1585. },
  1586. async handleTaskJob(resultValue) {
  1587. if (!this.taskData) {
  1588. this.isFinalCheckProduction = false;
  1589. return this.$message.warning('请选择一条任务单进行报工');
  1590. }
  1591. if (this.taskData.disposalStatus == '0') {
  1592. return this.$message.warning('请先接收任务再做首件两检');
  1593. }
  1594. if (this.taskData.disposalStatus == '2') {
  1595. return this.$message.warning('该任务单已被拒绝');
  1596. }
  1597. const row = this.taskData;
  1598. if (
  1599. resultValue === '1' &&
  1600. row.totalFirstArticleDualInspectionStatus !== 2
  1601. ) {
  1602. this.isFinalCheckProduction = false;
  1603. return this.$message.warning('请先完成首件两检再报工');
  1604. }
  1605. this.isFinalCheckProduction = true;
  1606. const currentRow = {
  1607. assignCode: row.assignCode,
  1608. mesWorkOrderCode: row.mesWorkOrderCode,
  1609. workOrderCode: row.workOrderCode,
  1610. productionPlanCode: row.productionPlanCode,
  1611. produceRoutingName: row.produceRoutingName,
  1612. formingNum: row.formingNum,
  1613. assignTeamName: row.assignTeamName,
  1614. formingWeight: row.formingWeight,
  1615. planStartTime: row.planStartTime,
  1616. planCompleteTime: row.planCompleteTime,
  1617. startTime: row.startTime,
  1618. firstTaskId: row.firstTaskId,
  1619. endTime: row.endTime,
  1620. taskName: row.taskName,
  1621. firstTaskName: row.firstTaskName,
  1622. assigneeType: row.assigneeType?.desc || '',
  1623. assigneeName: row.assigneeName,
  1624. weight: row.weight,
  1625. quantity: row.quantity,
  1626. durationText: row.durationText,
  1627. apsAssigneeId: row.id,
  1628. batchNo: row.batchNo,
  1629. productCode: row.productCode,
  1630. productName: row.productName,
  1631. specification: row.specification,
  1632. newWeightUnit: row.newWeightUnit,
  1633. measuringUnit: row.measuringUnit
  1634. };
  1635. const form = {
  1636. realEndTime: row.realEndTime,
  1637. realStartTime: row.realStartTime,
  1638. unqualifiedWeight: row.unqualifiedWeight,
  1639. unqualifiedQuantity: row.unqualifiedQuantity,
  1640. qualifiedWeight: row.qualifiedWeight,
  1641. remark: row.assigneeRemark,
  1642. qualifiedQuantity: row.qualifiedQuantity,
  1643. reportQuantity: row.reportQuantity,
  1644. lossQuantity: row.lossQuantity
  1645. };
  1646. this.$nextTick(() => {
  1647. this.$refs.taskReportRef.open('repoort', currentRow, form);
  1648. });
  1649. },
  1650. async handleWorkOrderJob(resultValue) {
  1651. if (!this.checkWorkOrder({ min: 1 })) return;
  1652. if (resultValue === '1') {
  1653. const result = await this.checkQualityResult();
  1654. if (!result?.firstArticleDualInspectionResult) {
  1655. return this.$message.warning('请完成首件两检再报工!');
  1656. }
  1657. }
  1658. if ([2, 3, 6].includes(this.taskObj.type)) {
  1659. this.getCodeData({
  1660. taskId: this.taskObj.id,
  1661. workOrderId: this.workListIds[0],
  1662. data: this.workData.list
  1663. });
  1664. }
  1665. },
  1666. /* ================== pick ================== */
  1667. handlePick() {
  1668. if (this.activeName != '0') return;
  1669. if (!this.checkWorkOrder({ min: 1 })) return;
  1670. this.$nextTick(() => {
  1671. this.$refs.pickListRef.getList(this.workListIds);
  1672. });
  1673. },
  1674. /* ================== workStep ================== */
  1675. handleWorkStep() {
  1676. if (this.activeName != '0') return;
  1677. if (
  1678. !this.checkWorkOrder({
  1679. min: 1,
  1680. max: 1,
  1681. msg: { max: '工步只能选择一个工单!' }
  1682. })
  1683. )
  1684. return;
  1685. this.$refs.workStepRef.open(this.workStepQueryParam);
  1686. },
  1687. /* ================== task ================== */
  1688. handleTask() {
  1689. if (this.activeName != '0') return;
  1690. if (
  1691. !this.checkWorkOrder({
  1692. min: 1,
  1693. max: 1,
  1694. msg: { max: '任务只能选择一个工单!' }
  1695. })
  1696. )
  1697. return;
  1698. this.$refs.taskDialogRef.open(
  1699. this.workStepQueryParam,
  1700. this.workData.list[0]
  1701. );
  1702. },
  1703. /* ================== work ================== */
  1704. async handleWork() {
  1705. if (this.activeName != '0') return;
  1706. if (
  1707. !this.checkWorkOrder({
  1708. min: 1,
  1709. max: 1,
  1710. msg: { max: '工艺文件只能选择一个工单!' }
  1711. })
  1712. )
  1713. return;
  1714. const res = await parameterGetByCode({
  1715. code: 'mes_craft_file_by_category_code'
  1716. });
  1717. const req = {
  1718. taskId: this.taskObj.id,
  1719. workOrderId: this.workListIds[0],
  1720. productCode: this.workData.list[0].productCode
  1721. };
  1722. res.value === '1'
  1723. ? this.$refs.wokePopupRef.openTwo(req)
  1724. : this.$refs.wokePopupRef.open(req);
  1725. },
  1726. /* ================== device ================== */
  1727. handleDevice() {
  1728. if (this.activeName != '0') return;
  1729. if (!this.taskObj.id) {
  1730. return this.$message.warning('请选择工序');
  1731. }
  1732. this.$refs.deviceRef.open(this.taskObj.id);
  1733. },
  1734. /* ================== bom ================== */
  1735. handleBom() {
  1736. if (this.activeName == '0') {
  1737. if (
  1738. !this.checkWorkOrder({
  1739. min: 1,
  1740. max: 1,
  1741. msg: { max: '查看BOM详情只能选择一个工单!' }
  1742. })
  1743. )
  1744. return;
  1745. const row = this.workData.list[0];
  1746. this.$refs.bomDrawer.open({
  1747. categoryId: row.categoryId,
  1748. categoryName: row.bomCategoryName,
  1749. code: row.code,
  1750. versions: row.bomCategoryVersions,
  1751. rootPathIdParent: row.categoryLevelPathIdParent || '',
  1752. isProduct: true,
  1753. bomType: Number(row.bomType),
  1754. isTemp: 0
  1755. });
  1756. } else if (this.activeName == '1') {
  1757. if (!this.taskData) {
  1758. return this.$message.warning('请选择一条任务单');
  1759. }
  1760. const row = this.taskData;
  1761. this.$refs.bomDrawer.open({
  1762. categoryId: row.categoryId,
  1763. categoryName: row.bomCategoryName,
  1764. code: row.code ? row.code : '',
  1765. versions: row.bomCategoryVersions,
  1766. rootPathIdParent: row.categoryLevelPathIdParent || '',
  1767. isProduct: true,
  1768. bomType: Number(row.bomType),
  1769. isTemp: 0
  1770. });
  1771. }
  1772. },
  1773. /* ================== Outsourcing ================== */
  1774. handleOutsourcing() {
  1775. if (this.activeName != '0') return;
  1776. if (
  1777. !this.checkWorkOrder({
  1778. min: 1,
  1779. max: 1,
  1780. msg: { max: '委外请托工序只能选择一个工单!' }
  1781. })
  1782. )
  1783. return;
  1784. this.handOutsource(this.workListIds[0]);
  1785. },
  1786. /* ================== 产前 / 过程 / 产后 ================== */
  1787. handleInspection(type) {
  1788. if (this.activeName != '0') return;
  1789. if (
  1790. !this.checkWorkOrder({
  1791. min: 1,
  1792. max: 1
  1793. })
  1794. )
  1795. return;
  1796. this.$refs.prenatalExaminationRef.open(
  1797. this.workData.list[0],
  1798. this.produceTaskInfo,
  1799. type
  1800. );
  1801. },
  1802. /* ================== error ================== */
  1803. handleError() {
  1804. if (this.activeName == '0') {
  1805. if (this.workListIds.length !== 1) {
  1806. return this.$message.warning('异常只能选择一个工单!');
  1807. }
  1808. this.$refs.createErrorRef.open('add', this.workData.list[0]);
  1809. }
  1810. },
  1811. /* ================== 首件两检 ================== */
  1812. handleQualityInspection() {
  1813. if (this.activeName == '0') {
  1814. if (
  1815. !this.checkWorkOrder({
  1816. min: 1,
  1817. max: 1,
  1818. msg: { max: '首件两检只能选择一个工单!' }
  1819. })
  1820. )
  1821. return;
  1822. this.$refs.qualityInspectionRef.open(
  1823. this.workData.list[0],
  1824. this.produceTaskInfo
  1825. );
  1826. } else {
  1827. if (!this.taskData) {
  1828. return this.$message.warning('请选择一条任务单进行首件两检');
  1829. }
  1830. if (this.taskData.disposalStatus == '0') {
  1831. return this.$message.warning('请先接收任务再做首件两检');
  1832. }
  1833. if (this.taskData.disposalStatus == '2') {
  1834. return this.$message.warning('该任务单已被拒绝');
  1835. }
  1836. this.selfRequest(this.taskData);
  1837. }
  1838. },
  1839. successTask() {
  1840. this.isFinalCheckProduction = false;
  1841. },
  1842. async selfRequest(row) {
  1843. let params = {
  1844. routingId: row.produceRoutingId,
  1845. pageNum: 1,
  1846. size: -1,
  1847. isDetail: true
  1848. };
  1849. const result = await getProduceTaskList(params);
  1850. const taskData = result.list.find(
  1851. (item) => item.sourceTaskId === row.taskId
  1852. );
  1853. this.$refs.qualityInspectionRef.open(row, taskData, 1);
  1854. },
  1855. outsourcingAdd(type, activeName) {
  1856. this.chooseType = activeName;
  1857. this.getTaskInstanceByIdFn(this.workListIds[0]);
  1858. if (this.chooseType == '2') {
  1859. this.isStep = true;
  1860. } else {
  1861. this.isOutsource = true;
  1862. }
  1863. },
  1864. refreshPlease() {
  1865. this.$nextTick(() => {
  1866. this.$refs.outsourcingListRef.getPleaseData(
  1867. this.workData.list[0].code
  1868. );
  1869. });
  1870. },
  1871. handOutsource(workOrderId) {
  1872. this.isType = '';
  1873. // return
  1874. let param = {
  1875. taskId: this.taskObj.id,
  1876. workOrderId: workOrderId
  1877. };
  1878. pcCheckOutsource(param).then((res) => {
  1879. this.outsourceForm = {
  1880. ...res.data
  1881. };
  1882. // this.outsourceForm.name = this.taskObj.name + '委外';
  1883. this.isStep = false;
  1884. this.isOutsource = false;
  1885. this.isPleaseEntrust = false;
  1886. if (res.data.outsource) {
  1887. this.isType = '3';
  1888. if (!this.isStep && !this.isOutsource && !this.isPleaseEntrust) {
  1889. this.$nextTick(() => {
  1890. this.$refs.outsourcingListRef.getDataList(
  1891. this.workData.list[0].code
  1892. );
  1893. });
  1894. }
  1895. // this.getTaskInstanceByIdFn(workOrderId);
  1896. // this.$refs.outsourceListRef.getList(workOrderId);
  1897. // console.log(this.workData[0].list, 'this.workData.list');
  1898. } else {
  1899. return this.$message.warning('此工序不能委外/请托');
  1900. }
  1901. });
  1902. },
  1903. //获取工单列表
  1904. getTaskInstanceByIdFn(workOrderId) {
  1905. getTaskInstanceById(workOrderId).then((res) => {
  1906. let { data } = res;
  1907. if (data.length) {
  1908. data = data.filter((item) => item.taskId != -2);
  1909. let arr = data.findIndex(
  1910. (item) => item.sourceTaskId == this.taskObj.id
  1911. );
  1912. if (arr != -1) {
  1913. data.splice(0, arr);
  1914. }
  1915. this.$set(this.outsourceForm, 'newStepsList', data);
  1916. }
  1917. });
  1918. },
  1919. pickAdd() {
  1920. if (this.workListIds.length > 1) {
  1921. return this.$message.warning('领料只能选择一个工单!');
  1922. } else if (this.workListIds.length < 1) {
  1923. return this.$message.warning('请选择工单!');
  1924. }
  1925. this.checkPick();
  1926. // this.pickingShow = true;
  1927. },
  1928. async checkPick() {
  1929. await checkRepeatPick({
  1930. workOrderId: this.workListIds[0]
  1931. }).then((res) => {
  1932. if (res.data == 0) {
  1933. this.pickingShow = true;
  1934. } else {
  1935. this.$confirm('已经有领料是否继续重复领料?', '提示', {
  1936. confirmButtonText: '确定',
  1937. cancelButtonText: '取消',
  1938. type: 'warning'
  1939. })
  1940. .then(() => {
  1941. this.pickingShow = true;
  1942. })
  1943. .catch(() => {});
  1944. }
  1945. });
  1946. },
  1947. // 关闭领料弹窗
  1948. pickingClose(val) {
  1949. if (val) {
  1950. this.$nextTick(() => {
  1951. this.$refs.pickListRef.getList(this.workListIds);
  1952. });
  1953. }
  1954. this.pickingShow = false;
  1955. },
  1956. rowClick(row, taskId) {
  1957. if (taskId) {
  1958. let params = {
  1959. categoryId: row.categoryId,
  1960. taskId: taskId
  1961. };
  1962. getByTaskId(params).then((res) => {
  1963. this.BomObj = res.data;
  1964. this.$forceUpdate();
  1965. });
  1966. }
  1967. },
  1968. rowTaskClick() {
  1969. if (taskId) {
  1970. let params = {
  1971. categoryId: row.categoryId,
  1972. taskId: taskId
  1973. };
  1974. getByTaskId(params).then((res) => {
  1975. this.BomObj = res.data;
  1976. this.$forceUpdate();
  1977. });
  1978. }
  1979. },
  1980. closePrenatalExamination() {
  1981. this.checkProductionResult();
  1982. },
  1983. //是否完成 产前准备 限制按钮
  1984. async checkProductionResult() {
  1985. if (
  1986. this.produceTaskInfo &&
  1987. this.workListIds.length > 0 &&
  1988. this.produceTaskInfo.id != -1
  1989. ) {
  1990. // 判断是否要求先完成 产前准备等事项
  1991. const result = await checkProductionResult({
  1992. produceTaskId: this.produceTaskInfo.id,
  1993. workOrderIds: this.workListIds
  1994. });
  1995. this.isPreProductionResult = result;
  1996. }
  1997. },
  1998. // 投料后 重新检测按钮状态
  1999. reloadFeeding() {
  2000. this.checkProductionResult();
  2001. }
  2002. },
  2003. mounted() {
  2004. this.$nextTick(() => {
  2005. const targetElements =
  2006. document.getElementsByClassName('ele-admin-tabs');
  2007. if (targetElements.length > 0) {
  2008. // 遍历所有具有 'ele-admin-tabs' 类的元素
  2009. Array.from(targetElements).forEach((element) => {
  2010. // 对每个元素添加 'new-ele-admin-tabs' 类
  2011. element.classList.add('new-ele-admin-tabs');
  2012. });
  2013. }
  2014. });
  2015. },
  2016. destroyed() {
  2017. this.$nextTick(() => {
  2018. const targetElements =
  2019. document.getElementsByClassName('ele-admin-tabs');
  2020. if (targetElements.length > 0) {
  2021. Array.from(targetElements).forEach((element) => {
  2022. element.classList.remove('new-ele-admin-tabs');
  2023. });
  2024. }
  2025. });
  2026. }
  2027. };
  2028. </script>
  2029. <style lang="scss">
  2030. .content_box {
  2031. display: flex;
  2032. }
  2033. .content_box_tab {
  2034. width: 220px;
  2035. padding: 5px;
  2036. height: calc(100vh - 73px);
  2037. background-color: #fff;
  2038. overflow-y: auto;
  2039. }
  2040. .footBtn {
  2041. position: absolute;
  2042. bottom: 20px;
  2043. left: 0;
  2044. }
  2045. .new-ele-admin-tabs {
  2046. display: none !important;
  2047. }
  2048. .c_title {
  2049. color: #157a2c;
  2050. font-size: 16px;
  2051. font-weight: bold;
  2052. }
  2053. .tableZ_box {
  2054. border: 1px solid #e3e5e5;
  2055. margin: 6px 0;
  2056. &:last-child {
  2057. border-bottom: none;
  2058. }
  2059. .row {
  2060. width: 100%;
  2061. display: flex;
  2062. }
  2063. .col {
  2064. width: calc(100% / 5);
  2065. display: flex;
  2066. align-items: center;
  2067. // min-width: 200px;
  2068. min-height: 32px;
  2069. border-bottom: 1px solid #e3e5e5;
  2070. border-right: 1px solid #e3e5e5;
  2071. &:last-child {
  2072. border-right: none;
  2073. }
  2074. .name {
  2075. display: flex;
  2076. align-items: center;
  2077. padding: 4px;
  2078. width: 60px;
  2079. height: 100%;
  2080. background-color: #d0e4d5;
  2081. color: #000;
  2082. }
  2083. .content {
  2084. padding: 4px 6px;
  2085. color: #000;
  2086. }
  2087. }
  2088. .pd6 {
  2089. padding: 0 6px;
  2090. }
  2091. }
  2092. </style>
  2093. <style lang="scss" scoped>
  2094. .seek-list {
  2095. display: flex;
  2096. justify-content: space-between;
  2097. align-items: center;
  2098. padding: 10px 10px;
  2099. }
  2100. .right_main_box {
  2101. background-color: #fff;
  2102. height: 100%;
  2103. box-sizing: border-box;
  2104. }
  2105. .index_box {
  2106. position: relative;
  2107. padding: 10px;
  2108. padding-bottom: 0;
  2109. width: 100%;
  2110. box-sizing: border-box;
  2111. min-width: 1280px !important;
  2112. height: calc(100vh - 60px);
  2113. // overflow-x: auto;
  2114. /* 当内容超出宽度时,允许水平滚动 */
  2115. white-space: nowrap;
  2116. /* 防止内部文本换行,确保所有内容都在一行显示 */
  2117. scrollbar-width: thin;
  2118. /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
  2119. scrollbar-color: #40a9ff transparent;
  2120. /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
  2121. }
  2122. .main {
  2123. width: 100%;
  2124. min-width: 1280px;
  2125. height: calc(100vh - 70px - 50px - 80px);
  2126. display: flex;
  2127. justify-content: space-between;
  2128. }
  2129. .left_main {
  2130. width: 100%;
  2131. height: 100%;
  2132. display: flex;
  2133. flex-direction: column;
  2134. justify-content: space-around;
  2135. min-width: 640px;
  2136. .top {
  2137. width: 100%;
  2138. height: 100%;
  2139. overflow: hidden;
  2140. }
  2141. // .bottom {
  2142. // width: 100%;
  2143. // min-height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
  2144. // overflow: hidden;
  2145. // }
  2146. }
  2147. ::v-deep .el-tabs__item.is-active {
  2148. background-color: #dffade;
  2149. /* 蓝色背景 */
  2150. color: #333;
  2151. }
  2152. ::v-deep .is-active {
  2153. color: #dffade;
  2154. }
  2155. .right_main {
  2156. min-width: 640px;
  2157. padding-bottom: 12px;
  2158. height: calc((100vh - 70px - 50px - 80px - 12px));
  2159. background: #f0f3f3;
  2160. }
  2161. ::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
  2162. padding: 0 !important;
  2163. }
  2164. // .menu-container {
  2165. // position: relative;
  2166. // width: 200px;
  2167. // height: 200px;
  2168. // margin: 100px;
  2169. // }
  2170. /* 主按钮 */
  2171. // .main-btn {
  2172. // width: 60px;
  2173. // height: 60px;
  2174. // background: #3498db;
  2175. // border-radius: 50%;
  2176. // color: #fff;
  2177. // font-size: 30px;
  2178. // text-align: center;
  2179. // line-height: 60px;
  2180. // cursor: pointer;
  2181. // position: absolute;
  2182. // left: 0;
  2183. // bottom: 0;
  2184. // box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  2185. // transition: transform 0.3s;
  2186. // }
  2187. // .main-btn:hover {
  2188. // transform: rotate(90deg);
  2189. // }
  2190. /* 子按钮 */
  2191. // .sub-btn {
  2192. // width: 40px;
  2193. // height: 40px;
  2194. // background: #e74c3c;
  2195. // border-radius: 50%;
  2196. // color: #fff;
  2197. // font-size: 14px;
  2198. // text-align: center;
  2199. // line-height: 50px;
  2200. // position: absolute;
  2201. // left: 5px;
  2202. // bottom: 5px;
  2203. // box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  2204. // transform: translate(0, 0);
  2205. // transition: all 0.4s ease;
  2206. // opacity: 1;
  2207. // }
  2208. /* 动画进入/离开 */
  2209. // .fan-enter-active,
  2210. // .fan-leave-active {
  2211. // transition: all 0.4s ease;
  2212. // }
  2213. // .fan-enter,
  2214. // .fan-leave-to {
  2215. // opacity: 0;
  2216. // transform: translate(0, 0);
  2217. // }
  2218. // .box {
  2219. // position: relative;
  2220. // }
  2221. .menu-container {
  2222. position: fixed;
  2223. right: 0;
  2224. margin-top: 42.5%;
  2225. width: 235px;
  2226. height: 100px;
  2227. display: flex;
  2228. justify-content: center;
  2229. align-items: center;
  2230. z-index: 999;
  2231. }
  2232. .toggle-btn {
  2233. position: absolute;
  2234. width: 55px;
  2235. height: 55px;
  2236. background: #2196f3;
  2237. border-radius: 50%;
  2238. display: flex;
  2239. justify-content: center;
  2240. align-items: center;
  2241. color: white;
  2242. font-size: 30px;
  2243. font-weight: bold;
  2244. cursor: pointer;
  2245. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  2246. z-index: 100;
  2247. transition: all 0.3s ease;
  2248. border: none;
  2249. left: 60%;
  2250. top: 60%;
  2251. transform: translate(-50%, -50%);
  2252. }
  2253. .toggle-btn:hover {
  2254. transform: translate(-50%, -50%) scale(1.05);
  2255. box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  2256. }
  2257. .toggle-btn:active {
  2258. transform: translate(-50%, -50%) scale(0.95);
  2259. }
  2260. .menu-item {
  2261. position: absolute;
  2262. width: 50px;
  2263. height: 50px;
  2264. background: #4caf50;
  2265. border-radius: 50%;
  2266. display: flex;
  2267. justify-content: center;
  2268. align-items: center;
  2269. color: white;
  2270. font-size: 12px;
  2271. font-weight: bold;
  2272. box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  2273. transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  2274. transform: translate(-50%, -50%) scale(0);
  2275. opacity: 0;
  2276. pointer-events: none;
  2277. z-index: 90;
  2278. left: 55%;
  2279. top: 60%;
  2280. }
  2281. .menu-item.active {
  2282. opacity: 1;
  2283. pointer-events: auto;
  2284. transform: translate(var(--tx), var(--ty)) scale(1);
  2285. }
  2286. .menu-item:hover {
  2287. transform: translate(var(--tx), var(--ty)) scale(1.15) !important;
  2288. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  2289. background: #66bb6a;
  2290. cursor: pointer;
  2291. }
  2292. .instructions {
  2293. margin-top: 2rem;
  2294. color: white;
  2295. text-align: center;
  2296. background: rgba(255, 255, 255, 0.1);
  2297. padding: 1rem;
  2298. border-radius: 10px;
  2299. max-width: 500px;
  2300. backdrop-filter: blur(5px);
  2301. }
  2302. .custom-tree-node {
  2303. // position: absolute;
  2304. // flex: 1;
  2305. // display: flex;
  2306. // align-items: center;
  2307. // justify-content: space-between;
  2308. font-size: 14px;
  2309. padding-right: 8px;
  2310. }
  2311. .item {
  2312. margin-top: 10px;
  2313. margin-right: 40px;
  2314. }
  2315. </style>