index.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648
  1. <template>
  2. <div>
  3. <div class="top_fixed">
  4. <div
  5. style="display: flex; align-items: center; margin-right: 10px"
  6. v-if="List.length > 1"
  7. >
  8. <div class="rx-bc">
  9. <div class="name">批量报工时间:</div>
  10. </div>
  11. <el-date-picker
  12. v-model="executorTime"
  13. type="datetime"
  14. value-format="yyyy-MM-dd HH:mm:ss"
  15. placeholder="选择日期"
  16. @change="handleCreate"
  17. >
  18. </el-date-picker>
  19. </div>
  20. <el-button
  21. type="primary"
  22. size="mini"
  23. :loading="loadingBtn"
  24. @click="save(2, 'all')"
  25. >一键报工</el-button
  26. >
  27. <el-button type="primary" size="mini" @click="removeCacheFn('all')"
  28. >清空缓存</el-button
  29. >
  30. <el-button
  31. v-if="taskObj.type == 1"
  32. type="primary"
  33. size="mini"
  34. @click="save(1, 'all')"
  35. >缓存</el-button
  36. >
  37. </div>
  38. <div class="job_box">
  39. <div
  40. v-for="(item, index) in List"
  41. :key="index"
  42. class="card_box"
  43. v-if="isLoad"
  44. >
  45. <div class="title_box rx-bc" v-if="!taskObj.isOrderListData">
  46. <div class="name">工单信息 </div>
  47. <div class="rx-bc">
  48. <el-button
  49. type="text"
  50. size="mini"
  51. @click="openPicking(item.workOrderId, item)"
  52. >添加设备</el-button
  53. >
  54. <el-button
  55. type="text"
  56. size="mini"
  57. @click="removeCacheFn(item.workOrderId)"
  58. >清空缓存</el-button
  59. >
  60. <el-button
  61. v-if="taskObj.type == 1"
  62. type="text"
  63. size="mini"
  64. @click="save(1, index)"
  65. >缓存</el-button
  66. >
  67. </div>
  68. </div>
  69. <!-- // 工单信息 -->
  70. <workOrderBom
  71. :item="item"
  72. v-if="!taskObj.isOrderListData"
  73. ></workOrderBom>
  74. <!-- 报工时间 -->
  75. <div>
  76. <div class="title_box rx-bc">
  77. <div class="name">报工时间</div>
  78. </div>
  79. 报工时间:
  80. <el-date-picker
  81. v-model="item.workReportInfo.executorTime"
  82. type="datetime"
  83. value-format="yyyy-MM-dd HH:mm:ss"
  84. placeholder="选择日期"
  85. style="margin-right: 25px; width: 190px"
  86. >
  87. </el-date-picker>
  88. 执行人:
  89. <el-select
  90. v-model="teamId"
  91. placeholder="请选择班组"
  92. filterable
  93. style="width: 120px"
  94. @change="checkTeamList(teamId)"
  95. >
  96. <el-option
  97. v-for="item in teamList"
  98. :label="item.name"
  99. :value="item.id"
  100. :key="item.id"
  101. >
  102. </el-option>
  103. </el-select>
  104. <el-select
  105. v-model="executorIdList"
  106. placeholder="请选择执行人"
  107. filterable
  108. multiple
  109. @change="changeId"
  110. >
  111. <div class="checkboxWrapper">
  112. <el-checkbox v-model="checked" @change="checkChange">
  113. 全选
  114. </el-checkbox>
  115. </div>
  116. <el-option
  117. v-for="item in teamUserList"
  118. :label="item.name"
  119. :value="item.id"
  120. :key="item.id"
  121. >
  122. </el-option>
  123. </el-select>
  124. </div>
  125. <paramBom
  126. v-if="item.paramDetailList.length != 0"
  127. :list="item.paramDetailList"
  128. ></paramBom>
  129. <!-- //报工信息 -->
  130. <div v-if="item.singleReport == 0">
  131. <jobBom
  132. :item="item"
  133. ref="jobBomRef"
  134. :notFormed="item.notFormedList"
  135. :warehouseList="warehouseList"
  136. ></jobBom>
  137. </div>
  138. <div v-if="item.singleReport == 1">
  139. <jobDdBom
  140. :item="item"
  141. ref="jobRef"
  142. :notFormed="item.notFormedList"
  143. :warehouseList="warehouseList"
  144. ></jobDdBom>
  145. </div>
  146. <!-- :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList" @modeNum='modeNum'-->
  147. <deviceBom
  148. v-if="item.equipmentList.length != 0"
  149. :list="item.equipmentList"
  150. ></deviceBom>
  151. <modelBom
  152. v-if="item.modelList.length != 0"
  153. :list="item.modelList"
  154. pattern="job"
  155. ref="modelRef"
  156. :item="item"
  157. ></modelBom>
  158. <palletBom
  159. v-if="item.palletList.length != 0"
  160. :list="item.palletList"
  161. ></palletBom>
  162. <revolvingDiskBom
  163. v-if="item.revolvingDiskList.length > 0"
  164. pattern="job"
  165. :list="objData.revolvingDiskList"
  166. >
  167. </revolvingDiskBom>
  168. <!-- 单件 报告信息 -->
  169. <semiProductJobBom
  170. :singleReport="item.singleReport"
  171. v-if="
  172. item.semiProductList &&
  173. item.semiProductList.length != 0 &&
  174. item.singleReport == 1 &&
  175. clientEnvironmentId != 3
  176. "
  177. :item="item"
  178. :list="item.semiProductList"
  179. :equipmentList="item.equipmentList"
  180. :isChoose="isChoose"
  181. @chooseData="chooseData"
  182. :isEngrave="isEngrave"
  183. :isDisposal="isDisposal"
  184. ></semiProductJobBom>
  185. <semiProductJobBom
  186. :singleReport="item.singleReport"
  187. v-if="
  188. item.semiProductList &&
  189. item.semiProductList.length != 0 &&
  190. item.singleReport == 1 &&
  191. clientEnvironmentId == 3 &&
  192. taskObj.type != 4
  193. "
  194. :item="item"
  195. :list="item.semiProductList"
  196. :equipmentList="item.equipmentList"
  197. :isChoose="isChoose"
  198. @chooseData="chooseData"
  199. :isEngrave="isEngrave"
  200. :isDisposal="isDisposal"
  201. ></semiProductJobBom>
  202. <!-- 通用批量报工 -->
  203. <batchSemiProductJobBom
  204. :singleReport="item.singleReport"
  205. v-if="
  206. item.product &&
  207. item.product.length != 0 &&
  208. item.singleReport == 0 &&
  209. clientEnvironmentId != 3
  210. "
  211. :item="item"
  212. :list="item.product"
  213. :equipmentList="item.equipmentList"
  214. :isChoose="isChoose"
  215. :isEngrave="isEngrave"
  216. :isDisposal="isDisposal"
  217. @chooseData="chooseData"
  218. ></batchSemiProductJobBom>
  219. <!-- <batchSemiProductJobBom
  220. :singleReport="item.singleReport"
  221. v-if="
  222. item.semiProductList &&
  223. item.semiProductList.length != 0 &&
  224. item.singleReport == 0 &&
  225. clientEnvironmentId == 3 &&
  226. taskObj.type == 4
  227. "
  228. :item="item"
  229. :list="item.semiProductList"
  230. :equipmentList="item.equipmentList"
  231. :isChoose="isChoose"
  232. :isEngrave="isEngrave"
  233. :isDisposal="isDisposal"
  234. @chooseData="chooseData"
  235. ></batchSemiProductJobBom> -->
  236. <!-- <checkbox :tableData="item.semiProductList" ></checkbox> -->
  237. <!-- :itemData="item" @tableDataFn="tableDataFn" -->
  238. <!-- 碳谷批量报工 -->
  239. <semiProductJobBomPL
  240. :singleReport="item.singleReport"
  241. v-if="
  242. item.semiProductList &&
  243. item.semiProductList.length != 0 &&
  244. taskObj.type != 6 &&
  245. item.singleReport == 0 &&
  246. clientEnvironmentId == 3
  247. "
  248. :item="item"
  249. :list="item.semiProductList"
  250. :equipmentList="item.equipmentList"
  251. @countNumPl="countNumPl"
  252. :isChoose="isChoose"
  253. :isEngrave="isEngrave"
  254. :isDisposal="isDisposal"
  255. :index="index"
  256. ></semiProductJobBomPL>
  257. <!-- <semiProductJobBom v-if="
  258. item.pickOutInList &&
  259. item.pickOutInList.length != 0 &&
  260. taskObj.type == 6 &&
  261. item.singleReport == 1
  262. " :item="item" :list="item.pickOutInList">
  263. </semiProductJobBom> -->
  264. <!-- 物料清单 -->
  265. <!-- <semiProductBom
  266. v-if="
  267. item.semiProductList.length != 0 &&
  268. item.singleReport == 0 &&
  269. clientEnvironmentId != 3
  270. "
  271. :list="item.semiProductList"
  272. :equipmentList="item.equipmentList"
  273. :workInfo="item"
  274. ></semiProductBom> -->
  275. <!-- 产品信息 -->
  276. <oneJobQualityBomPL
  277. v-if="
  278. item.semiProductList &&
  279. item.semiProductList.length != 0 &&
  280. taskObj.type == 6 &&
  281. item.singleReport == 0 &&
  282. clientEnvironmentId == 3
  283. "
  284. :item="item"
  285. :list="item.semiProductList"
  286. >
  287. </oneJobQualityBomPL>
  288. <byProductBom
  289. v-if="item.productRecycleList.length != 0"
  290. :list="item.productRecycleList"
  291. >
  292. </byProductBom>
  293. <turnoverBom
  294. v-if="item.turnover.length != 0"
  295. :list="item.turnover"
  296. :wordItem="item"
  297. pattern="job"
  298. >
  299. </turnoverBom>
  300. <aridRegion
  301. v-if="item.aridRegionList.length != 0"
  302. :list="item.aridRegionList"
  303. :isType="true"
  304. ></aridRegion>
  305. <!-- 这里是包装分组 -->
  306. <!-- <div
  307. v-if="
  308. item.currentTaskDiagram.type == 4 &&
  309. item.semiProductList.length != 0
  310. "
  311. >
  312. <semiProductJobBom
  313. :singleReport="item.singleReport"
  314. :item="item"
  315. :list="
  316. item.currentTaskDiagram.type == 4
  317. ? item.pickOutInList
  318. : item.semiProductList
  319. "
  320. :equipmentList="item.equipmentList"
  321. ></semiProductJobBom>
  322. </div>
  323. <div
  324. v-if="
  325. item.currentTaskDiagram.type == 4 && item.pickOutInList.length != 0
  326. "
  327. >
  328. <semiProductJobBom
  329. :singleReport="item.singleReport"
  330. :item="item"
  331. :list="
  332. item.currentTaskDiagram.type == 4
  333. ? item.pickOutInList
  334. : item.semiProductList
  335. "
  336. :equipmentList="item.equipmentList"
  337. ></semiProductJobBom>
  338. </div> -->
  339. <packingTgBom
  340. v-if="
  341. item.semiProductList &&
  342. item.semiProductList.length != 0 &&
  343. taskObj.type == 4 &&
  344. clientEnvironmentId == 3 &&
  345. item.singleReport == 1
  346. "
  347. :list="item.semiProductList"
  348. :item="item"
  349. :isChoose="isChoose"
  350. :isEngrave="isEngrave"
  351. :isDisposal="isDisposal"
  352. ></packingTgBom>
  353. <div
  354. v-if="
  355. item &&
  356. item.currentTaskDiagram.type == 4 &&
  357. clientEnvironmentId == 3 &&
  358. item.singleReport == 0
  359. "
  360. >
  361. <batchPackagingGrouping
  362. ref="packagingGroupingRef"
  363. :objData="item"
  364. :workOrderId="item.workOrderId"
  365. :taskId="item.currentTaskDiagram.taskId"
  366. >
  367. </batchPackagingGrouping>
  368. </div>
  369. <div
  370. v-if="
  371. item &&
  372. item.currentTaskDiagram.type == 4 &&
  373. clientEnvironmentId != 3
  374. "
  375. >
  376. <!-- <packagingGrouping
  377. ref="packagingGroupingRef"
  378. :objData="item"
  379. :workOrderId="item.workOrderId"
  380. :taskId="item.currentTaskDiagram.taskId"
  381. >
  382. </packagingGrouping> -->
  383. <batchPackagingGrouping
  384. ref="packagingGroupingRef"
  385. :objData="item"
  386. :workOrderId="item.workOrderId"
  387. :taskId="item.currentTaskDiagram.taskId"
  388. >
  389. </batchPackagingGrouping>
  390. </div>
  391. <!-- <packingBom :taskId='taskObj.id' :workOrderId="item.workOrderId" :objData="item" ref="packRef"
  392. v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom> -->
  393. <!-- <semiProductJobBom
  394. :singleReport="item.singleReport"
  395. v-if="
  396. item.semiProductList &&
  397. item.semiProductList.length != 0 &&
  398. item.singleReport == 1
  399. "
  400. :item="item"
  401. :list="item.semiProductList"
  402. :equipmentList="item.equipmentList"
  403. :isChoose="isChoose"
  404. @chooseData="chooseData"
  405. :isEngrave="isEngrave"
  406. :isDisposal="isDisposal"
  407. ></semiProductJobBom> -->
  408. <!-- <packingTgBom
  409. v-if="
  410. item.semiProductList &&
  411. item.semiProductList.length != 0 &&
  412. taskObj.type == 4 &&
  413. clientEnvironmentId == 3
  414. "
  415. :list="item.semiProductList"
  416. :item="item"
  417. ></packingTgBom> -->
  418. <semiProductJobBom
  419. v-if="
  420. item.pickOutInList &&
  421. item.pickOutInList.length != 0 &&
  422. taskObj.type == 4 &&
  423. clientEnvironmentId == 3
  424. "
  425. :singleReport="item.singleReport"
  426. :list="item.semiProductList"
  427. :equipmentList="item.equipmentList"
  428. :item="item"
  429. @chooseData="chooseData"
  430. :isEngrave="isEngrave"
  431. :isDisposal="isDisposal"
  432. ></semiProductJobBom>
  433. </div>
  434. </div>
  435. <pickingList
  436. isType="job"
  437. ref="pickingListRef"
  438. @allSelection="allSelection"
  439. ></pickingList>
  440. </div>
  441. </template>
  442. <script>
  443. import { listByIdsReport } from '@/api/produce/job';
  444. import { getWarehouseList } from '@/api/produce/index';
  445. import {
  446. jobSave,
  447. saveCache,
  448. getCache,
  449. removeCache
  450. } from '@/api/produce/workOrder';
  451. import pickingList from '../picking/pickingList.vue';
  452. import packagingGrouping from './components/packagingGrouping.vue';
  453. import workOrderBom from '../feeding/components/workOrderBom.vue';
  454. import paramBom from '../feeding/components/paramBom.vue';
  455. import jobBom from './components/jobBom.vue';
  456. import deviceBom from '../feeding/components/deviceBom.vue';
  457. import modelBom from '../feeding/components/modelBom.vue';
  458. import palletBom from './components/palletBom.vue';
  459. import revolvingDiskBom from '../feeding/components/revolvingDiskBom.vue';
  460. import oneJobQualityBom from './components/oneJobQualityBom.vue';
  461. import oneJobQualityBomPL from './components/oneJobQualityBomPL.vue';
  462. import jobDdBom from './components/jobDdBom.vue';
  463. import semiProductJobBom from './components/semiProductJobBom.vue';
  464. // import semiProductJobBom from './components/newSemiProductJobBom.vue';
  465. import semiProductJobBomPL from './components/semiProductJobBomPL.vue';
  466. import semiProductJobBomQT from './components/semiProductJobBomQT.vue';
  467. import batchSemiProductJobBom from './components/batchSemiProductJobBom.vue';
  468. import batchPackagingGrouping from './components/batchPackagingGrouping.vue';
  469. import semiProductBom from '../feeding/components/semiProductBom';
  470. // import byProductBom from './components/byProductBom.vue';
  471. import byProductBom from './components/newByProductBom.vue';
  472. import turnoverBom from './components/turnoverBom.vue';
  473. import aridRegion from '../feeding/components/aridRegion.vue';
  474. import packingBom from './components/packingBom.vue';
  475. import packingTgBom from './components/packingTgBom.vue';
  476. import { timestampToDateTime } from '@/utils/index.js';
  477. import { parameterGetByCode } from '@/api/system/dictionary-data';
  478. import { getTeam } from '@/api/produce/job.js';
  479. export default {
  480. components: {
  481. pickingList,
  482. packagingGrouping,
  483. workOrderBom,
  484. paramBom,
  485. jobBom,
  486. deviceBom,
  487. modelBom,
  488. palletBom,
  489. revolvingDiskBom,
  490. oneJobQualityBom,
  491. oneJobQualityBomPL,
  492. semiProductJobBomQT,
  493. semiProductJobBom,
  494. semiProductJobBomPL,
  495. byProductBom,
  496. turnoverBom,
  497. aridRegion,
  498. packingBom,
  499. jobDdBom,
  500. packingTgBom,
  501. semiProductBom,
  502. batchSemiProductJobBom,
  503. batchPackagingGrouping
  504. },
  505. props: {
  506. workListIds: {
  507. type: Array,
  508. default() {
  509. return [];
  510. }
  511. },
  512. reportNeedFeed: {},
  513. workPlanType: {
  514. type: String,
  515. default: ''
  516. }
  517. },
  518. data() {
  519. return {
  520. List: [],
  521. idsList: [],
  522. isLoad: false,
  523. executorTime: '',
  524. warehouseList: [],
  525. loading: null,
  526. loadingBtn: false,
  527. chooseListData: [],
  528. isChoose: false,
  529. isEngrave: false,
  530. isDisposal: false,
  531. teamList: [],
  532. teamAllList: [],
  533. teamUserList: [],
  534. executorIdList: [],
  535. teamId: '',
  536. checked: false
  537. };
  538. },
  539. computed: {
  540. taskObj() {
  541. return this.$store.state.user.taskObj;
  542. },
  543. clientEnvironmentId() {
  544. return this.$store.state.user.info.clientEnvironmentId;
  545. }
  546. },
  547. watch: {
  548. workListIds: {
  549. handler(val) {
  550. this.getList(val);
  551. },
  552. deep: true,
  553. immediate: true
  554. },
  555. workPlanType: {
  556. handler(val) {
  557. if (val == 1) {
  558. this.getList(this.idsList);
  559. }
  560. }
  561. }
  562. },
  563. created() {
  564. this.getWarehouseListFn();
  565. this.getChooseEngrave();
  566. },
  567. mounted() {
  568. if (localStorage.getItem('singleUserInfo') == '1') {
  569. const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
  570. this.getTeamList(data.teamId);
  571. } else {
  572. this.getTeamList(this.$store.state.user.info.teamId);
  573. }
  574. },
  575. methods: {
  576. checkPack() {
  577. this.$refs.packagingGroupingRef[0].getData();
  578. },
  579. handleCreate(e) {
  580. if (e) {
  581. const list = JSON.parse(JSON.stringify(this.List));
  582. console.log(list);
  583. list.map((item) => {
  584. item.workReportInfo.executorTime = e;
  585. });
  586. this.$set(this, 'List', list);
  587. }
  588. },
  589. async getTeamList(id) {
  590. const ids = id.split(',');
  591. this.teamList = [];
  592. this.teamUserList = [];
  593. const list = ids.map((item) => getTeam(item));
  594. const dataList = await Promise.all(list);
  595. dataList.forEach((item) => {
  596. this.teamList.push({
  597. name: item.name,
  598. id: item.id
  599. });
  600. this.teamAllList.push(item.userVOList);
  601. });
  602. },
  603. async getChooseEngrave() {
  604. await parameterGetByCode({
  605. code: 'choose_engrave'
  606. }).then((res) => {
  607. this.isChoose = res.value == '1' ? true : false;
  608. });
  609. await parameterGetByCode({
  610. code: 'batch_update_engrave'
  611. }).then((res) => {
  612. this.isEngrave = res.value == '1' ? true : false;
  613. });
  614. await parameterGetByCode({
  615. code: 'batch_disposal'
  616. }).then((res) => {
  617. this.isDisposal = res.value == '1' ? true : false;
  618. });
  619. await parameterGetByCode({
  620. code: 'default_executor'
  621. }).then((res) => {
  622. this.isDefaultExecutor = res.value == '1' ? true : false;
  623. if (this.isDefaultExecutor) {
  624. this.setDefaultIdList();
  625. }
  626. });
  627. },
  628. setDefaultIdList() {
  629. if (this.teamList.length != 0) {
  630. this.teamId = this.teamList[0].id;
  631. const index = this.teamList.findIndex(
  632. (item) => item.id == this.teamId
  633. );
  634. this.teamUserList = this.teamAllList[index];
  635. if (this.teamUserList) {
  636. const res = this.teamUserList.find(
  637. (it) => it.id == this.$store.state.user.info.userId
  638. );
  639. this.executorIdList.push(res.id);
  640. }
  641. // const res = this.teamUserList.find(
  642. // (it) => it.id == this.$store.state.user.info.userId
  643. // );
  644. // this.executorIdList.push(res.id);
  645. }
  646. },
  647. changeId() {
  648. if (this.executorIdList.length == this.teamUserList.length) {
  649. this.checked = true;
  650. } else {
  651. this.checked = false;
  652. }
  653. },
  654. checkChange() {
  655. if (this.checked) {
  656. this.executorIdList = [];
  657. this.executorIdList = this.teamUserList.map((item) => item.id);
  658. } else {
  659. this.executorIdList = [];
  660. }
  661. },
  662. getList(ids) {
  663. this.idsList = ids || [];
  664. if (this.taskObj.id != -2) {
  665. let param = {
  666. ids: ids,
  667. taskId: this.taskObj.id,
  668. type: 0
  669. };
  670. this.isLoad = false;
  671. listByIdsReport(param)
  672. .then((res) => {
  673. this.List = res.map((obj) => {
  674. if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
  675. obj['turnover'] = [];
  676. }
  677. if (
  678. !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
  679. ) {
  680. obj['aridRegionList'] = [];
  681. }
  682. if (
  683. !Object.prototype.hasOwnProperty.call(obj, 'instanceList')
  684. ) {
  685. obj['instanceList'] = [];
  686. }
  687. if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
  688. obj['palletList'] = [];
  689. }
  690. if (
  691. !Object.prototype.hasOwnProperty.call(
  692. obj,
  693. 'revolvingDiskList'
  694. )
  695. ) {
  696. obj['revolvingDiskList'] = [];
  697. }
  698. if (obj.palletList.length > 0) {
  699. obj.palletList = obj.palletList.map((m) => {
  700. return {
  701. hideKc: true, // 不显示库存
  702. quantity: m.feedQuantity,
  703. ...m
  704. };
  705. });
  706. }
  707. // console.log(this.taskObj.type, 'this.taskObj.type');
  708. if (
  709. (this.taskObj.type == 6 && obj.singleReport == 1) ||
  710. (this.clientEnvironmentId == 3 &&
  711. obj.singleReport == 0 &&
  712. this.taskObj.type == 6)
  713. ) {
  714. obj.semiProductList = obj.pickOutInList;
  715. obj.pickOutInList = [];
  716. console.log('赋值了');
  717. } else if (
  718. this.clientEnvironmentId == 3 &&
  719. obj.singleReport == 0
  720. ) {
  721. if (obj.pickOutInList && obj.pickOutInList.length != 0) {
  722. obj.semiProductList = obj.pickOutInList;
  723. obj.pickOutInList = [];
  724. }
  725. } else if (this.taskObj.type == 6 && obj.singleReport == 0) {
  726. obj.product = obj.pickOutInList;
  727. obj.pickOutInList = [];
  728. } else if (
  729. this.taskObj.type == 4 &&
  730. obj.singleReport == 0 &&
  731. this.clientEnvironmentId != 3
  732. ) {
  733. if (obj.pickOutInList && obj.pickOutInList.length != 0) {
  734. obj.product = obj.pickOutInList;
  735. obj.pickOutInList = [];
  736. }
  737. } else if (
  738. this.taskObj.type == 4 &&
  739. obj.singleReport == 1 &&
  740. this.clientEnvironmentId != 2
  741. ) {
  742. if (obj.pickOutInList && obj.pickOutInList.length != 0) {
  743. obj.semiProductList = obj.pickOutInList;
  744. obj.pickOutInList = [];
  745. }
  746. }
  747. if (
  748. obj.singleReport == 1 &&
  749. obj.currentTaskDiagram.type != 2 &&
  750. obj.currentTaskDiagram.type != 3 &&
  751. obj.currentTaskDiagram.type != 6
  752. ) {
  753. obj.semiProductList.map((item) => {
  754. item.extInfo.taskId = '';
  755. item.extInfo.taskName = '';
  756. });
  757. }
  758. if (
  759. obj.singleReport == 0 &&
  760. obj.currentTaskDiagram.type != 2 &&
  761. obj.currentTaskDiagram.type != 3 &&
  762. obj.currentTaskDiagram.type != 6
  763. ) {
  764. obj.product.map((item) => {
  765. item.extInfo.taskId = '';
  766. item.extInfo.taskName = '';
  767. });
  768. }
  769. if (
  770. this.clientEnvironmentId == 3 &&
  771. obj.singleReport == 0 &&
  772. this.taskObj.type != 6
  773. ) {
  774. obj.semiProductList.map((a) => {
  775. let feedQuantity = 0;
  776. let reportWeight = 0;
  777. let unFeedQuantity = 0;
  778. let unReportWeight = 0;
  779. if (
  780. a.extInfo &&
  781. a.extInfo.batchReportInfo &&
  782. a.extInfo.batchReportInfo.length != 0
  783. ) {
  784. a.extInfo.batchReportInfo.forEach((it) => {
  785. console.log(it, '1111111111');
  786. feedQuantity += Number(it.allFeedQuantity);
  787. reportWeight += Number(it.allReportWeight);
  788. });
  789. }
  790. if (
  791. a.extInfo &&
  792. a.extInfo.notBatchReportInfo &&
  793. a.extInfo.notBatchReportInfo.length != 0
  794. ) {
  795. a.extInfo.notBatchReportInfo.forEach((it) => {
  796. unFeedQuantity += Number(it.allFeedQuantity);
  797. unReportWeight += Number(it.allReportWeight);
  798. });
  799. }
  800. a.extInfo.batchReportInfo = [
  801. {
  802. allFeedQuantity: feedQuantity,
  803. allReportWeight: reportWeight,
  804. taskId: '',
  805. taskName: ''
  806. }
  807. ];
  808. a.extInfo.notBatchReportInfo = [
  809. {
  810. allFeedQuantity: unFeedQuantity,
  811. allReportWeight: unReportWeight,
  812. notType: '',
  813. taskId: '',
  814. taskName: '',
  815. notReason: ''
  816. }
  817. ];
  818. return {
  819. a
  820. };
  821. });
  822. obj.semiProductList = JSON.parse(
  823. JSON.stringify(obj.semiProductList)
  824. );
  825. }
  826. obj.semiProductList = obj.semiProductList.map((item) => {
  827. if (this.taskObj.type != 6) {
  828. if (item['extInfo']?.reportWeight) {
  829. item['extInfo'].reportWeight = '';
  830. }
  831. }
  832. item.confirm = 0;
  833. console.log(item, 'item');
  834. return item;
  835. });
  836. obj.product = obj.product.map((item) => {
  837. if (this.taskObj.type != 6) {
  838. if (item['extInfo']?.reportWeight) {
  839. item['extInfo'].reportWeight = '';
  840. }
  841. }
  842. item.confirm = 0;
  843. console.log(item, 'item');
  844. return item;
  845. });
  846. obj.workReportInfo = {
  847. executorTime: null,
  848. formingNum: null,
  849. formingWeight: null,
  850. formedNum: null,
  851. formedWeight: null,
  852. taskId: this.taskObj.id,
  853. notFormedNum: null,
  854. notFormedWeigh: null
  855. };
  856. obj.notFormedList = [
  857. {
  858. notFormedNum: null,
  859. notFormedWeight: null,
  860. weightUnit: obj.weightUnit,
  861. unit: obj.unit,
  862. warehouseId: null // 处置 仓库id
  863. }
  864. ];
  865. if (obj.semiProductList.length != 0) {
  866. // 预制体报工
  867. obj.workReportInfo.formedNum = obj.semiProductList.length;
  868. let numCot = 0;
  869. let notFormedNum = 0;
  870. if (obj.semiProductList.length > 0) {
  871. obj.semiProductList.map((fitem) => {
  872. if (
  873. !fitem.extInfo.isQualified ||
  874. fitem.extInfo.isQualified == 1
  875. ) {
  876. numCot = numCot + fitem.feedQuantity || 1;
  877. } else {
  878. notFormedNum = notFormedNum + fitem.feedQuantity;
  879. }
  880. });
  881. obj.workReportInfo.formedNum = numCot;
  882. obj.workReportInfo.notFormedNum = notFormedNum;
  883. }
  884. } else if (obj.product.length != 0) {
  885. const formedNum = obj.product.reduce((acc, pro) => {
  886. return pro.feedQuantity &&
  887. (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
  888. ? acc + Number(pro.feedQuantity)
  889. : acc;
  890. }, 0);
  891. const notFormedNum = obj.product.reduce((acc, pro) => {
  892. return pro.feedQuantity && pro.extInfo.isQualified == 2
  893. ? acc + Number(pro.feedQuantity)
  894. : acc;
  895. }, 0);
  896. obj.workReportInfo.formedNum = formedNum;
  897. obj.workReportInfo.notFormedNum = notFormedNum;
  898. }
  899. obj.workReportInfo.formingNum = obj.formingNum;
  900. obj.workReportInfo.formingWeight = obj.formingWeight;
  901. obj.workReportInfo.unit = obj.unit;
  902. obj.workReportInfo.weightUnit = obj.weightUnit;
  903. obj.workReportInfo.workOrderId = obj.workOrderId;
  904. obj.workReportInfo.executorTime = obj.executorTime;
  905. obj.paramDetailList.map((m) => {
  906. if (m.extInfo.textType == 5) {
  907. m.remainingTime = m.extInfo.remainingTime;
  908. }
  909. return {
  910. ...m.extInfo
  911. };
  912. });
  913. console.log(obj, 4445555);
  914. if (this.taskObj.type == 4) {
  915. let numVal = 0;
  916. obj.pickOutInList.map((item) => {
  917. numVal = numVal + item.feedQuantity;
  918. });
  919. obj.workReportInfo.formedNum = numVal;
  920. }
  921. return {
  922. ...obj
  923. };
  924. });
  925. if (this.clientEnvironmentId == 3) {
  926. this.List.forEach((item, index) => {
  927. if (
  928. item.semiProductList.length != 0 &&
  929. item.singleReport == 0
  930. ) {
  931. this.countNumPl(item.semiProductList, index);
  932. }
  933. });
  934. }
  935. })
  936. .finally(() => {
  937. this.isLoad = true;
  938. if (this.taskObj.type == 1) {
  939. this.getCacheFn();
  940. }
  941. });
  942. }
  943. },
  944. openPicking(id, item) {
  945. this.$refs.pickingListRef.open(id, item);
  946. },
  947. allSelection(id, selectList) {
  948. console.log(id, selectList, 'allSelection');
  949. this.List.forEach((m) => {
  950. if (m.workOrderId == id) {
  951. let turnover = [];
  952. let equipmentList = []; // 生产设备
  953. selectList.forEach((f) => {
  954. if (f.rootCategoryLevelId == 4) {
  955. equipmentList = equipmentList.concat(f);
  956. }
  957. if (f.rootCategoryLevelId == 7) {
  958. turnover = turnover.concat(f);
  959. }
  960. });
  961. this.$set(m, 'equipmentList', equipmentList);
  962. this.$set(m, 'turnover', turnover);
  963. this.$forceUpdate();
  964. }
  965. });
  966. },
  967. chooseData(dataList) {
  968. this.chooseListData = this.deepCopy(dataList);
  969. // if (this.chooseListData.length > 0) {
  970. // this.chooseListData.forEach((item) => {
  971. // item.confirm = 1;
  972. // });
  973. // } else {
  974. // this.List.forEach((item) => {
  975. // item.semiProductList.forEach((fitem) => {
  976. // fitem.confirm = 0;
  977. // });
  978. // });
  979. // }
  980. },
  981. deepCopy(obj, hash = new WeakMap()) {
  982. if (obj === null) return null;
  983. if (obj instanceof Date) return new Date(obj);
  984. if (obj instanceof RegExp) return new RegExp(obj);
  985. if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
  986. if (hash.has(obj)) return hash.get(obj); // 处理循环引用
  987. const result = Array.isArray(obj) ? [] : {};
  988. hash.set(obj, result); // 存储原始对象和其副本的映射关系
  989. return Object.keys(obj).reduce((acc, key) => {
  990. acc[key] = this.deepCopy(obj[key], hash);
  991. return acc;
  992. }, result);
  993. },
  994. checkTeamList(id) {
  995. this.executorIdList = [];
  996. const index = this.teamList.findIndex((item) => item.id == id);
  997. this.teamUserList = this.teamAllList[index];
  998. },
  999. async save(type) {
  1000. const required = await parameterGetByCode({
  1001. code: 'mes_report_engrave_required'
  1002. }).then((res) => {
  1003. return res;
  1004. });
  1005. console.log(required, 'required');
  1006. if (this.executorIdList.length == 0) {
  1007. return this.$message.error('执行人不能为空!');
  1008. }
  1009. const executorList = [];
  1010. this.executorIdList.forEach((item) => {
  1011. const data = this.teamUserList.find((it) => it.id == item);
  1012. if (data) {
  1013. executorList.push({
  1014. userId: data.id,
  1015. jobNumber: data.jobNumber,
  1016. name: data.name
  1017. });
  1018. }
  1019. });
  1020. this.List = this.List.map((item) => {
  1021. item.workReportInfo.executorList = executorList;
  1022. return item;
  1023. });
  1024. console.log(this.List, '------------');
  1025. let confirmList = [];
  1026. // const confirmList = this.List[0].semiProductList.filter(
  1027. // (item) => item.confirm == 1
  1028. // );
  1029. this.List.forEach((item) => {
  1030. item.semiProductList.forEach((it) => {
  1031. if (it.confirm == 1) {
  1032. confirmList.push(it);
  1033. }
  1034. });
  1035. });
  1036. if (required.value == '1' && this.List[0].singleReport == 1) {
  1037. // if (this.chooseListData.length > 0) {
  1038. // this.checkChooseData(this.chooseListData, type, 'choose');
  1039. // return;
  1040. // } else {
  1041. // this.checkChooseData(this.List, type, 'all');
  1042. // return;
  1043. // }
  1044. console.log(this.List, 'this.List');
  1045. if (confirmList.length > 0) {
  1046. for (let i = 0; i < confirmList.length; i++) {
  1047. // if (
  1048. // !confirmList[i].extInfo.engrave &&
  1049. // confirmList[i].confirm == 1
  1050. // ) {
  1051. // this.$message.warning('请输入刻码!');
  1052. // return;
  1053. // }
  1054. if (confirmList[i].confirm == 1) {
  1055. if (!confirmList[i].extInfo.engrave) {
  1056. this.$message.warning('请输入刻码!');
  1057. return;
  1058. }
  1059. }
  1060. }
  1061. } else {
  1062. if (this.List.length > 0) {
  1063. console.log(this.List);
  1064. for (let i = 0; i < this.List[0].semiProductList.length; i++) {
  1065. // if (!this.List[0].semiProductList[i].extInfo.engrave) {
  1066. // this.$message.warning('请输入刻码!');
  1067. // return;
  1068. // }
  1069. if (this.List[0].semiProductList[i].confirm == 1) {
  1070. if (!this.List[0].semiProductList[i].extInfo.engrave) {
  1071. this.$message.warning('请输入刻码!');
  1072. return;
  1073. }
  1074. }
  1075. }
  1076. // this.List.forEach((item) => {
  1077. // for (let i = 0; i < item.semiProductList.length; i++) {
  1078. // if (!item.semiProductList[i].extInfo.engrave) {
  1079. // this.$message.warning('请输入刻码!');
  1080. // return;
  1081. // }
  1082. // }
  1083. // });
  1084. // for (let i = 0; i < this.List.length; i++) {
  1085. // for(let j = 0; i < this.List[i].semiProductList.length; j++) {
  1086. // }
  1087. // // for (let j = 0; this.List[i].semiProductList.length; j++) {
  1088. // // console.log(
  1089. // // this.List[i].semiProductList[j],
  1090. // // 'this.List[i].semiProductList[j]'
  1091. // // );
  1092. // // if (!this.List[i].semiProductList[j].extInfo.engrave) {
  1093. // // this.$message.warning('请输入刻码!');
  1094. // // return;
  1095. // // }
  1096. // // }
  1097. // }
  1098. }
  1099. }
  1100. }
  1101. console.log('11111', this.List);
  1102. this.loading = this.$loading({
  1103. lock: true,
  1104. text: '加载中',
  1105. background: 'rgba(0, 0, 0, 0.7)'
  1106. });
  1107. let arr = this.List.filter((L) => L.workReportInfo.executorTime);
  1108. if (!arr.length) {
  1109. this.loading.close();
  1110. return this.$message.warning('请选择执行时间');
  1111. }
  1112. // for (let i = 0; i < this.List.length; i++) {
  1113. // if (
  1114. // this.List[i].packInfo &&
  1115. // Object.keys(this.List[i].packInfo).length === 0
  1116. // ) {
  1117. // this.loading.close();
  1118. // return this.$message.warning('请到主数据配置包装规格');
  1119. // }
  1120. // }
  1121. // if(this.taskObj.type !=6){
  1122. // if(this.reportNeedFeed==1&&!(this.List[0].semiProductList.length>0||this.List[0].pickOutInList.length>0)){
  1123. // this.loading.close();
  1124. // return this.$message.warning('请先投料再报工');
  1125. // }
  1126. // }
  1127. let bol2;
  1128. bol2 = this.List.every((e) => {
  1129. return (
  1130. // e.workReportInfo['formedNum'] && e.workReportInfo['formedNum'] != 0
  1131. e.workReportInfo['formedNum'] != ''
  1132. );
  1133. });
  1134. // if (!bol2) {
  1135. // this.$message.warning('请输入合格品数量');
  1136. // this.loading.close();
  1137. // return false;
  1138. // }
  1139. // 预制体
  1140. let wId;
  1141. let bol = true;
  1142. let _i;
  1143. this.List.forEach((L) => {
  1144. if (
  1145. L.semiProductList.length > 0 &&
  1146. this.taskObj.type != 4 &&
  1147. L.singleReport == 1
  1148. ) {
  1149. bol = L.semiProductList.every((e, i) => {
  1150. _i = i + 1;
  1151. wId = L.code;
  1152. if (this.taskObj.type == 6) {
  1153. return (
  1154. Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
  1155. e.extInfo.taskId
  1156. );
  1157. } else {
  1158. if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
  1159. return (
  1160. Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
  1161. e.extInfo.taskId &&
  1162. e.extInfo.reportWeight
  1163. );
  1164. } else {
  1165. return (
  1166. Object.prototype.hasOwnProperty.call(
  1167. e.extInfo,
  1168. 'notType'
  1169. ) && e.extInfo.notType
  1170. );
  1171. }
  1172. }
  1173. });
  1174. }
  1175. if (L.workReportInfo.batchNo) {
  1176. L.workReportInfo.batchNo = L.batchNo + L.workReportInfo.batchNo;
  1177. }
  1178. });
  1179. // if (!bol) {
  1180. // this.$message.warning(`请完善工单${wId}第${_i}处置方式`);
  1181. // this.loading.close();
  1182. // return false;
  1183. // }
  1184. if (this.clientEnvironmentId != 2) {
  1185. for (let i = 0; i < this.List.length; i++) {
  1186. for (let j = 0; j < this.List[i].productRecycleList.length; j++) {
  1187. if (!this.List[i].productRecycleList[j].warehouseId) {
  1188. const isRecycle = await this.checkRecycle();
  1189. if (!isRecycle) {
  1190. return false;
  1191. }
  1192. }
  1193. }
  1194. }
  1195. // let succ = this.List.some((L) => {
  1196. // return L.productRecycleList.length > 0;
  1197. // });
  1198. // if (succ) {
  1199. // const isRecycle = await this.checkRecycle();
  1200. // if (!isRecycle) {
  1201. // return false;
  1202. // }
  1203. // }
  1204. }
  1205. console.log(this.item, '9999999999');
  1206. if (this.taskObj.type == 4) {
  1207. if (this.clientEnvironmentId == 3) {
  1208. this.List.forEach((it) => {
  1209. if (it.singleReport == 0) {
  1210. this.checkPack();
  1211. }
  1212. });
  1213. } else {
  1214. this.checkPack();
  1215. }
  1216. // if (!isPack) {
  1217. // return false
  1218. // }
  1219. }
  1220. console.log('4444444444', this.List);
  1221. if (this.taskObj.type == 1) {
  1222. const isCache = await this.checkCache(type);
  1223. if (!isCache) {
  1224. return false;
  1225. }
  1226. }
  1227. if (
  1228. this.clientEnvironmentId == 3 &&
  1229. type == 2 &&
  1230. this.taskObj.type == 6
  1231. ) {
  1232. this.List.forEach((L) => {
  1233. if (L.singleReport == 0) {
  1234. L.semiProductList = [];
  1235. }
  1236. });
  1237. console.log('ashsaoghaoghoasg');
  1238. }
  1239. let isSemiProduct = false;
  1240. this.List.map((semi) => {
  1241. if (
  1242. semi.semiProductList.length == 0 &&
  1243. semi.singleReport == 1 &&
  1244. semi.currentTaskDiagram.isFirstTask == 1 &&
  1245. this.clientEnvironmentId != 3
  1246. ) {
  1247. isSemiProduct = true;
  1248. this.loading.close();
  1249. setTimeout(() => {
  1250. this.$message.warning({
  1251. message: '请工单编号:' + semi.code + '先创建在制品',
  1252. key: semi.code // 使用当前时间作为key,确保唯一性
  1253. });
  1254. }, 500);
  1255. }
  1256. if (semi.semiProductList.length == 0 && semi.singleReport == 0) {
  1257. semi.semiProductList.map((ditem) => {
  1258. if (ditem.extInfo.batchReportInfo) {
  1259. ditem.extInfo.batchReportInfo.map((baItem) => {
  1260. let idvalue = baItem.deviceId
  1261. ? baItem.deviceId.split('/')
  1262. : '';
  1263. baItem.deviceId = idvalue ? idvalue[0] : '';
  1264. });
  1265. }
  1266. if (ditem.extInfo.notBatchReportInfo) {
  1267. ditem.extInfo.notBatchReportInfo.map((noItem) => {
  1268. let idvalue = noItem.deviceId
  1269. ? noItem.deviceId.split('/')
  1270. : '';
  1271. noItem.deviceId = idvalue ? idvalue[0] : '';
  1272. });
  1273. }
  1274. });
  1275. }
  1276. });
  1277. if (isSemiProduct) {
  1278. this.loading.close();
  1279. return;
  1280. }
  1281. console.log(this.List, 'this.List');
  1282. // return;
  1283. // this.List[0].product = this.List[0].semiProductList;
  1284. this.loadingBtn = true;
  1285. jobSave(this.List)
  1286. .then((res) => {
  1287. this.loadingBtn = false;
  1288. this.loading.close();
  1289. this.$message.success('报工成功');
  1290. this.checked = false;
  1291. this.executorIdList = [];
  1292. this.teamId = '';
  1293. this.getList(this.idsList);
  1294. this.$emit('jobSuccess', 'Success');
  1295. })
  1296. .catch(() => {
  1297. this.loadingBtn = false;
  1298. this.loading.close();
  1299. });
  1300. // .finally(() => {
  1301. // setTimeout(function () {
  1302. // this.loading.close();
  1303. // }, 3000);
  1304. // });
  1305. },
  1306. checkRecycle() {
  1307. // this.loading.close();
  1308. return new Promise((resolve) => {
  1309. this.$confirm('是否跳过副产品回收处置!', '提示', {
  1310. confirmButtonText: '确定',
  1311. cancelButtonText: '取消',
  1312. type: 'warning'
  1313. })
  1314. .then(() => {
  1315. resolve(true);
  1316. })
  1317. .catch(() => {
  1318. resolve(false);
  1319. });
  1320. });
  1321. },
  1322. checkCache(type) {
  1323. return new Promise((resolve) => {
  1324. if (type == 1) {
  1325. saveCache(this.List).then((rr) => {
  1326. this.$message.success('缓存成功');
  1327. this.loading.close();
  1328. });
  1329. resolve(false);
  1330. } else if (type == 2) {
  1331. resolve(true);
  1332. }
  1333. });
  1334. },
  1335. getCacheFn() {
  1336. let parma = {
  1337. workOrderIds: this.idsList,
  1338. taskId: this.taskObj.id,
  1339. type: 1
  1340. };
  1341. getCache(parma).then((res) => {
  1342. this.List.forEach((f, index) => {
  1343. res.forEach((o) => {
  1344. if (f.workOrderId == o.workOrderId) {
  1345. f['product'] = o.extInfo.product;
  1346. f['workReportInfo'] = o.extInfo.workReportInfo;
  1347. f['notFormedList'] = o.extInfo.notFormedList;
  1348. f['turnover'] = o.extInfo.turnover;
  1349. f['productRecycleList'] = o.extInfo.productRecycleList;
  1350. f['semiProductList'] = o.extInfo.semiProductList;
  1351. f['modelList'] = o.extInfo.modelList;
  1352. // this.$set(this.List[index].workReportInfo,'executorTime',timestampToDateTime(o.extInfo.workReportInfo.executorTime))
  1353. this.$forceUpdate();
  1354. }
  1355. });
  1356. });
  1357. });
  1358. },
  1359. removeCacheFn(type) {
  1360. this.$confirm('是否清空缓存', '缓存')
  1361. .then(() => {
  1362. let parma = {
  1363. workOrderIds: type == 'all' ? this.idsList : [type],
  1364. taskId: this.taskObj.id,
  1365. type: 1
  1366. };
  1367. removeCache(parma).then((res) => {
  1368. this.$message.success('已经清空缓存');
  1369. this.getList(this.idsList);
  1370. });
  1371. })
  1372. .catch(() => {});
  1373. },
  1374. getWarehouseListFn() {
  1375. getWarehouseList().then((res) => {
  1376. this.warehouseList = res.data;
  1377. });
  1378. },
  1379. //批量报工合格不合格重量统计
  1380. countNumPl(list, index) {
  1381. console.log('11111122222333', list);
  1382. //合格总数
  1383. let formedNumCount = 0;
  1384. //合格总重量
  1385. let formedWeightCount = 0;
  1386. //不合格总数
  1387. let notFormedNumCount = 0;
  1388. //不合格总重量
  1389. let notFormedWeightCount = 0;
  1390. list.map((item) => {
  1391. //合格总数
  1392. item.extInfo.batchReportInfo.forEach((m) => {
  1393. formedNumCount = formedNumCount + Number(m.allFeedQuantity || 0);
  1394. });
  1395. //合格总重量
  1396. item.extInfo.batchReportInfo.forEach((w) => {
  1397. formedWeightCount =
  1398. formedWeightCount + Number(w.allReportWeight || 0);
  1399. });
  1400. //不合格总数
  1401. item.extInfo.notBatchReportInfo.forEach((nf) => {
  1402. notFormedNumCount =
  1403. notFormedNumCount + Number(nf.allFeedQuantity || 0);
  1404. });
  1405. //不合格总重量
  1406. item.extInfo.notBatchReportInfo.forEach((nw) => {
  1407. notFormedWeightCount =
  1408. notFormedWeightCount + Number(nw.allReportWeight || 0);
  1409. });
  1410. });
  1411. this.$set(this.List[index].workReportInfo, 'formedNum', formedNumCount); //合格总数
  1412. this.$set(
  1413. this.List[index].workReportInfo,
  1414. 'formedWeight',
  1415. formedWeightCount
  1416. ); //合格总重量
  1417. this.$set(
  1418. this.List[index].workReportInfo,
  1419. 'notFormedNum',
  1420. notFormedNumCount
  1421. ); //不合格总数
  1422. this.$set(
  1423. this.List[index].workReportInfo,
  1424. 'notFormedWeight',
  1425. notFormedWeightCount
  1426. ); //不合格总重量
  1427. }
  1428. }
  1429. };
  1430. </script>
  1431. <style scoped lang="scss">
  1432. .top_fixed {
  1433. width: 100%;
  1434. height: 40px;
  1435. background: #fff;
  1436. display: flex;
  1437. align-items: center;
  1438. justify-content: flex-end;
  1439. }
  1440. .title_box {
  1441. padding: 10px 0;
  1442. .name {
  1443. font-size: 14px;
  1444. font-style: normal;
  1445. font-weight: 400;
  1446. color: #157a2c;
  1447. padding-left: 5px;
  1448. position: relative;
  1449. &:before {
  1450. position: absolute;
  1451. content: '';
  1452. left: 0px;
  1453. top: 0px;
  1454. bottom: 0px;
  1455. width: 2px;
  1456. height: 14px;
  1457. background: #157a2c;
  1458. margin: auto;
  1459. }
  1460. }
  1461. }
  1462. .job_box {
  1463. // margin-top: 6px;
  1464. width: 100%;
  1465. height: calc(100vh - 70px - 50px - 80px - 60px);
  1466. overflow-y: scroll;
  1467. overflow-x: hidden;
  1468. }
  1469. .card_box {
  1470. background: #fff;
  1471. padding: 8px;
  1472. border-radius: 2px;
  1473. }
  1474. .checkboxWrapper {
  1475. padding: 8px 20px;
  1476. border-bottom: 1px solid #ccc;
  1477. }
  1478. ::v-deep .el-select__tags {
  1479. flex-wrap: nowrap;
  1480. overflow: auto;
  1481. }
  1482. /* 输入框最大宽度*/
  1483. ::v-deep .el-select__tags-text {
  1484. max-width: 90px;
  1485. }
  1486. /* 底部滚动条的高度*/
  1487. ::v-deep .el-select__tags::-webkit-scrollbar {
  1488. height: 2px !important;
  1489. }
  1490. </style>