index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  1. <template>
  2. <div>
  3. <div v-if="isShow">
  4. <div class="top_fixed">
  5. <div
  6. style="display: flex; align-items: center; margin-right: 10px"
  7. v-if="List.length > 1"
  8. >
  9. <div class="rx-bc">
  10. <div class="name">批量投料时间:</div>
  11. </div>
  12. <el-date-picker
  13. v-model="executorTime"
  14. type="datetime"
  15. value-format="yyyy-MM-dd HH:mm:ss"
  16. placeholder="选择日期"
  17. @change="handleCreate"
  18. >
  19. </el-date-picker>
  20. </div>
  21. <el-button
  22. type="primary"
  23. size="mini"
  24. :loading="loadingBtn"
  25. @click="save(2, 'all')"
  26. >一键投料(报工)</el-button
  27. >
  28. <el-button type="primary" size="mini" @click="removeCacheFn('all')"
  29. >清空缓存</el-button
  30. >
  31. <el-button type="primary" size="mini" @click="save(1, 'all')"
  32. >缓存</el-button
  33. >
  34. </div>
  35. <div class="feed_box" v-if="isLoad">
  36. <div v-for="(item, index) in List" :key="index" class="card_box">
  37. <div class="title_box rx-bc">
  38. <div class="name" v-if="!taskObj.isOrderListData">工单信息 </div>
  39. <div class="name" v-else> </div>
  40. <div class="rx-bc">
  41. <el-button
  42. type="text"
  43. size="mini"
  44. @click="outboundOrder(item.workOrderId, item)"
  45. >出库单</el-button
  46. >
  47. <el-button
  48. type="text"
  49. size="mini"
  50. @click="openPicking(item.workOrderId, item)"
  51. >手动添加</el-button
  52. >
  53. <el-button
  54. type="text"
  55. size="mini"
  56. @click="removeCacheFn(item.workOrderId)"
  57. >清空缓存</el-button
  58. >
  59. <el-button type="text" size="mini" @click="save(1, index)"
  60. >缓存</el-button
  61. >
  62. </div>
  63. </div>
  64. <workOrderBom
  65. :item="item"
  66. :isReportWork="false"
  67. v-if="!taskObj.isOrderListData"
  68. ></workOrderBom>
  69. <div>
  70. <div class="title_box rx-bc">
  71. <div class="name">投料时间 </div>
  72. </div>
  73. 投料时间:
  74. <el-date-picker
  75. v-model="item.executorTime"
  76. type="datetime"
  77. value-format="yyyy-MM-dd HH:mm:ss"
  78. placeholder="选择日期"
  79. style="margin-right: 25px; width: 190px"
  80. >
  81. </el-date-picker>
  82. 执行人:
  83. <el-select
  84. v-model="teamId"
  85. placeholder="请选择班组"
  86. filterable
  87. style="width: 120px"
  88. @change="checkTeamList(teamId)"
  89. >
  90. <el-option
  91. v-for="item in teamList"
  92. :label="item.name"
  93. :value="item.id"
  94. :key="item.id"
  95. >
  96. </el-option>
  97. </el-select>
  98. <el-select
  99. v-model="executorIdList"
  100. placeholder="请选择执行人"
  101. filterable
  102. multiple
  103. @change="changeId"
  104. >
  105. <div class="checkboxWrapper">
  106. <el-checkbox v-model="checked" @change="checkChange">
  107. 全选
  108. </el-checkbox>
  109. </div>
  110. <el-option
  111. v-for="item in teamUserList"
  112. :label="item.name"
  113. :value="item.id"
  114. :key="item.id"
  115. >
  116. </el-option>
  117. </el-select>
  118. <!-- -->
  119. </div>
  120. <paramBom
  121. v-if="item.paramDetailList.length != 0"
  122. :list="item.paramDetailList"
  123. ></paramBom>
  124. <!-- 设备信息 -->
  125. <deviceBom
  126. v-if="item.equipmentList.length != 0"
  127. :list="item.equipmentList"
  128. ></deviceBom>
  129. <!-- <productsBom
  130. v-if="
  131. item.product != null &&
  132. item.product != '{}' &&
  133. item.singleReport != 0
  134. "
  135. :itemObj="item"
  136. :productsObj="item.product"
  137. >
  138. </productsBom> -->
  139. <productsBom
  140. v-if="item.product.length != 0 && item.singleReport == 1"
  141. :itemObj="item"
  142. :productsObj="item.product"
  143. >
  144. </productsBom>
  145. <!-- <batchProductsBom
  146. v-if="
  147. item.product != null &&
  148. item.product != '{}' &&
  149. item.singleReport == 0
  150. "
  151. :itemObj="item"
  152. :productsObj="item.product"
  153. >
  154. </batchProductsBom> -->
  155. <batchProductsBom
  156. v-if="item.product.length != 0 && item.singleReport == 0"
  157. :itemObj="item"
  158. :productsObj="item.product"
  159. :isEdit="isEdit"
  160. >
  161. </batchProductsBom>
  162. <modelBom v-if="item.modelList.length != 0" :list="item.modelList">
  163. </modelBom>
  164. <!-- 物料清单 -->
  165. <instanceBom
  166. v-if="item.instanceList.length != 0"
  167. :list="item.instanceList"
  168. :equipmentList="item.equipmentList"
  169. :currentTaskDiagram="item.currentTaskDiagram"
  170. :workInfo="item"
  171. title="物料清单"
  172. >
  173. </instanceBom>
  174. <!-- 备料清单 -->
  175. <instanceBom
  176. v-if="item.sparePartsList.length != 0"
  177. :list="item.sparePartsList"
  178. :equipmentList="item.equipmentList"
  179. :currentTaskDiagram="item.currentTaskDiagram"
  180. :workInfo="item"
  181. title="备料清单"
  182. >
  183. </instanceBom>
  184. <semiProductJobBom
  185. v-if="item.semiProductList.length != 0"
  186. :list="item.semiProductList"
  187. :equipmentList="item.equipmentList"
  188. :currentTaskDiagram="item.currentTaskDiagram"
  189. :item="item"
  190. :isChoose="isChoose"
  191. :isEngrave="isEngrave"
  192. :isDisposal="isDisposal"
  193. title="物料清单"
  194. >
  195. </semiProductJobBom>
  196. <!-- 周转车 -->
  197. <turnoverBom
  198. v-if="item.turnover.length != 0"
  199. :wordItem="item"
  200. :list="item.turnover"
  201. pattern="feed"
  202. >
  203. </turnoverBom>
  204. <aridRegion
  205. v-if="item.aridRegionList.length != 0"
  206. :list="item.aridRegionList"
  207. ></aridRegion>
  208. <palletBom
  209. v-if="item.palletList.length != 0"
  210. :list="item.palletList"
  211. ></palletBom>
  212. <!-- // 包装物料清单 -->
  213. <packingBom
  214. v-if="item.packingList.length != 0"
  215. :list="item.packingList"
  216. ></packingBom>
  217. <revolvingDiskBom
  218. v-if="item.revolvingDiskList.length != 0"
  219. :list="item.revolvingDiskList"
  220. ></revolvingDiskBom>
  221. </div>
  222. </div>
  223. <pickingList
  224. isType="feed"
  225. ref="pickingListRef"
  226. @allSelection="allSelection"
  227. ></pickingList>
  228. </div>
  229. <div v-else>
  230. <el-empty description="批量报工,不需要投料,直接去报工取样"></el-empty>
  231. </div>
  232. <outboundOrderDialog
  233. ref="outboundOrderDialogRef"
  234. @chooseData="chooseData"
  235. />
  236. </div>
  237. </template>
  238. <script>
  239. import { workorderList } from '@/api/produce/workOrder';
  240. import {
  241. batchSave,
  242. feedSaveCache,
  243. feedGetCache,
  244. removeCache
  245. } from '@/api/produce/feeding';
  246. import { checkRepeatFeed } from '@/api/produce/index';
  247. import pickingList from '../picking/pickingList.vue';
  248. import packingBom from './components/packingBom.vue';
  249. import workOrderBom from './components/workOrderBom.vue';
  250. import paramBom from './components/paramBom.vue';
  251. import deviceBom from './components/deviceBom.vue';
  252. import productsBom from './components/productsBom.vue';
  253. import batchProductsBom from './components/batchProductsBom.vue';
  254. import modelBom from './components/modelBom.vue';
  255. import instanceBom from './components/instanceBom.vue';
  256. // import semiProductBom from './components/semiProductBom.vue';
  257. import semiProductJobBom from '@/views/produce/components/jobBooking/components/semiProductJobBom.vue';
  258. import turnoverBom from './components/turnoverBom.vue';
  259. import aridRegion from './components/aridRegion.vue';
  260. import palletBom from './components/palletBom.vue';
  261. import revolvingDiskBom from './components/revolvingDiskBom.vue';
  262. import outboundOrderDialog from './components/outboundOrderDialog.vue';
  263. import { deepClone } from '@/utils';
  264. import { timestampToDateTime } from '@/utils/index.js';
  265. import { parameterGetByCode } from '@/api/system/dictionary-data';
  266. import { getTeam } from '@/api/produce/job.js';
  267. export default {
  268. name: 'feeding',
  269. components: {
  270. pickingList,
  271. packingBom,
  272. workOrderBom,
  273. paramBom,
  274. deviceBom,
  275. productsBom,
  276. modelBom,
  277. instanceBom,
  278. semiProductJobBom,
  279. turnoverBom,
  280. aridRegion,
  281. palletBom,
  282. revolvingDiskBom,
  283. batchProductsBom,
  284. outboundOrderDialog
  285. },
  286. props: {
  287. workListIds: {
  288. type: Array,
  289. default() {
  290. return [];
  291. }
  292. },
  293. feedNeedEquipment: {}
  294. },
  295. computed: {
  296. taskObj() {
  297. return this.$store.state.user.taskObj;
  298. },
  299. clientEnvironmentId() {
  300. return this.$store.state.user.info.clientEnvironmentId;
  301. }
  302. },
  303. watch: {
  304. workListIds: {
  305. handler(val) {
  306. this.getList(val);
  307. console.log('1111122222', val);
  308. },
  309. deep: true,
  310. immediate: true
  311. }
  312. },
  313. data() {
  314. return {
  315. List: [],
  316. idsList: [],
  317. executorTime: '',
  318. isLoad: false,
  319. isShow: true,
  320. loading: null,
  321. loadingBtn: false,
  322. isEdit: false,
  323. isChoose: false,
  324. isEngrave: false,
  325. isDisposal: false,
  326. teamList: [],
  327. teamAllList: [],
  328. teamUserList: [],
  329. executorIdList: [],
  330. teamId: '',
  331. isDefaultExecutor: false,
  332. checked: false
  333. // feedExistNum: '',
  334. // feedNeedAridRegion: '',
  335. // feedNeedAuxiliaryEquipment: '',
  336. // feedNeedBoat: '',
  337. // feedNeedConsumableMaterial: '',
  338. // feedNeedEquipment: '',
  339. // feedNeedJunkProduct: '',
  340. // feedNeedMateriel: '',
  341. // feedNeedMeasuringEquipment: '',
  342. // feedNeedMould: '',
  343. // feedNeedProduct: '',
  344. // feedNeedQuality: '',
  345. // feedNeedReworkProduct: '',
  346. // feedNeedSemiProduct: '',
  347. // feedNeedTurnover: '',
  348. // feedStatus: ''
  349. };
  350. },
  351. mounted() {
  352. this.getChooseEngrave();
  353. if (localStorage.getItem('singleUserInfo') == '1') {
  354. const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
  355. this.getTeamList(data.teamId);
  356. } else {
  357. this.getTeamList(this.$store.state.user.info.teamId);
  358. }
  359. // this.getTeamList(this.$store.state.user.info.teamId);
  360. },
  361. methods: {
  362. handleCreate(e) {
  363. if (e) {
  364. const list = JSON.parse(JSON.stringify(this.List));
  365. console.log(list);
  366. list.map((item) => {
  367. item.executorTime = e;
  368. });
  369. this.$set(this, 'List', list);
  370. }
  371. },
  372. getList(ids) {
  373. this.idsList = ids || [];
  374. let param = {
  375. ids: ids,
  376. taskId: this.taskObj.id
  377. };
  378. this.isLoad = false;
  379. workorderList(param)
  380. .then((res) => {
  381. let arr = [];
  382. arr = res.map((m) => {
  383. m.workOrderId = m.id;
  384. m.paramDetailList = m.paramDetailList;
  385. m.instanceList = []; // 物料
  386. // m.equipmentList = []; // 设备
  387. m.modelList = []; // 模具
  388. m.aridRegionList = []; // 干燥区
  389. m.packingList = []; // 包装
  390. m.palletList = []; // 舟皿
  391. m.revolvingDiskList = []; // 周转盘
  392. m.semiProductList = []; //半成品
  393. m.sparePartsList = []; //备品清单
  394. if (m.pickOutInList.length > 0) {
  395. m.pickOutInList.forEach((f) => {
  396. if (f.rootCategoryLevelId == 1) {
  397. m.instanceList.push(f);
  398. } else if (f.rootCategoryLevelId == 4) {
  399. m.modelList.push(f);
  400. } else if (f.rootCategoryLevelId == 5) {
  401. m.modelList.push(f);
  402. } else if (f.rootCategoryLevelId == 6) {
  403. m.sparePartsList.push(f);
  404. } else if (f.rootCategoryLevelId == 11) {
  405. m.aridRegionList.push(f);
  406. } else if (f.rootCategoryLevelId == 13) {
  407. m.packingList.push(f);
  408. } else if (f.rootCategoryLevelId == 8) {
  409. m.palletList.push(f);
  410. } else if (f.rootCategoryLevelId == 26) {
  411. m.revolvingDiskList.push(f);
  412. } else if (
  413. [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
  414. ) {
  415. m.semiProductList.push(f);
  416. }
  417. });
  418. }
  419. if (m.semiProductList.length != 0) {
  420. m.semiProductList.forEach((item) => {
  421. if (!item.confirm) {
  422. item.confirm = '';
  423. }
  424. });
  425. }
  426. // 处理字段
  427. if (m.quality == '') {
  428. m.product = '{}';
  429. }
  430. if (!Object.prototype.hasOwnProperty.call(m, 'product')) {
  431. m.product = '{}';
  432. }
  433. if (m.singleReport == 1) {
  434. m.semiProductList.map((item) => {
  435. item.extInfo.taskId = '';
  436. item.extInfo.taskName = '';
  437. });
  438. }
  439. if (m.singleReport == 0) {
  440. m.product.map((item) => {
  441. item.extInfo.taskId = '';
  442. item.extInfo.taskName = '';
  443. });
  444. }
  445. if (
  446. this.clientEnvironmentId == 3 &&
  447. this.taskObj.type == 6 &&
  448. m.singleReport == 0
  449. ) {
  450. this.isShow = false;
  451. } else {
  452. this.isShow = true;
  453. }
  454. delete m.id;
  455. if (this.taskObj.id) {
  456. m.taskId = this.taskObj.id;
  457. m.taskName = this.taskObj.name;
  458. }
  459. return {
  460. ...m
  461. };
  462. });
  463. console.log(arr, 'arr');
  464. arr.forEach((it) => {
  465. if (it.semiProductList.length != 0) {
  466. it.semiProductList.forEach((item) => {
  467. if (item.extInfo && item.extInfo.taskId == -1) {
  468. item.extInfo.taskId = item.extInfo.taskId + '';
  469. }
  470. });
  471. }
  472. // if (it.pickOutInList.length != 0) {
  473. // it.pickOutInList.forEach((item) => {
  474. // if (item.extInfo && item.extInfo.taskId == -1) {
  475. // item.extInfo.taskId = item.extInfo.taskId + '';
  476. // }
  477. // });
  478. // }
  479. });
  480. this.List = deepClone(arr);
  481. })
  482. .finally(() => {
  483. this.isLoad = true;
  484. this.getCacheFn();
  485. });
  486. this.$forceUpdate();
  487. },
  488. async getChooseEngrave() {
  489. await parameterGetByCode({
  490. code: 'choose_engrave'
  491. }).then((res) => {
  492. this.isChoose = res.value == '1' ? true : false;
  493. });
  494. await parameterGetByCode({
  495. code: 'batch_update_engrave'
  496. }).then((res) => {
  497. this.isEngrave = res.value == '1' ? true : false;
  498. });
  499. await parameterGetByCode({
  500. code: 'batch_disposal'
  501. }).then((res) => {
  502. this.isDisposal = res.value == '1' ? true : false;
  503. });
  504. await parameterGetByCode({
  505. code: 'default_executor'
  506. }).then((res) => {
  507. this.isDefaultExecutor = res.value == '1' ? true : false;
  508. if (this.isDefaultExecutor) {
  509. this.setDefaultIdList();
  510. }
  511. });
  512. },
  513. setDefaultIdList() {
  514. if (this.teamList.length != 0) {
  515. this.teamId = this.teamList[0].id;
  516. const index = this.teamList.findIndex(
  517. (item) => item.id == this.teamId
  518. );
  519. console.log(this.teamAllList);
  520. this.teamUserList = this.teamAllList[index];
  521. if (this.teamUserList) {
  522. const res = this.teamUserList.find(
  523. (it) => it.id == this.$store.state.user.info.userId
  524. );
  525. this.executorIdList.push(res.id);
  526. }
  527. }
  528. },
  529. changeId() {
  530. if (this.executorIdList.length == this.teamUserList.length) {
  531. this.checked = true;
  532. } else {
  533. this.checked = false;
  534. }
  535. },
  536. checkTeamList(id) {
  537. this.executorIdList = [];
  538. const index = this.teamList.findIndex((item) => item.id == id);
  539. this.teamUserList = this.teamAllList[index];
  540. },
  541. async getTeamList(id) {
  542. const ids = id.split(',');
  543. this.teamList = [];
  544. this.teamUserList = [];
  545. const list = ids.map((item) => getTeam(item));
  546. const dataList = await Promise.all(list);
  547. dataList.forEach((item) => {
  548. this.teamList.push({
  549. name: item.name,
  550. id: item.id
  551. });
  552. this.teamAllList.push(item.userVOList);
  553. });
  554. },
  555. outboundOrder(id, item) {
  556. this.$refs.outboundOrderDialogRef.open(id, item);
  557. },
  558. openPicking(id, item) {
  559. this.$refs.pickingListRef.open(id, item, '选择设备列表');
  560. },
  561. chooseData(listData) {
  562. this.$set(this.List[0], 'semiProductList', listData);
  563. this.$forceUpdate();
  564. console.log(this.List[0], 'this.List');
  565. },
  566. allSelection(id, selectList) {
  567. this.List.forEach((m) => {
  568. if (m.workOrderId == id) {
  569. let modelList = []; // 模具
  570. let instanceList = []; // 投料
  571. let aridRegionList = []; // 干燥区
  572. let equipmentList = []; // 生产设备
  573. let palletList = []; // 舟皿
  574. let revolvingDiskList = []; // 周转盘
  575. let semiProductList = []; // 半成品
  576. let turnover = []; //周转车
  577. let sparePartsList = []; //备品清单
  578. selectList.forEach((f) => {
  579. if (f.rootCategoryLevelId == 4) {
  580. equipmentList = equipmentList.concat(f);
  581. }
  582. if (f.rootCategoryLevelId == 5) {
  583. modelList = modelList.concat(f);
  584. } else if (f.rootCategoryLevelId == 1) {
  585. instanceList = instanceList.concat(f);
  586. } else if (f.rootCategoryLevelId == 11) {
  587. aridRegionList = aridRegionList.concat(f);
  588. } else if (f.rootCategoryLevelId == 6) {
  589. sparePartsList = sparePartsList.concat(f);
  590. } else if (f.rootCategoryLevelId == 7) {
  591. turnover = turnover.concat(f);
  592. } else if (f.rootCategoryLevelId == 8) {
  593. palletList = palletList.concat(f);
  594. } else if (f.rootCategoryLevelId == 26) {
  595. revolvingDiskList = revolvingDiskList.concat(f);
  596. } else if (
  597. [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
  598. ) {
  599. semiProductList = semiProductList.concat(f);
  600. }
  601. });
  602. this.$set(m, 'modelList', modelList);
  603. this.$set(m, 'sparePartsList', sparePartsList);
  604. this.$set(m, 'instanceList', instanceList);
  605. this.$set(m, 'aridRegionList', aridRegionList);
  606. this.$set(m, 'equipmentList', equipmentList);
  607. this.$set(m, 'turnover', turnover);
  608. this.$set(m, 'palletList', palletList);
  609. this.$set(m, 'revolvingDiskList', revolvingDiskList);
  610. this.$set(m, 'semiProductList', semiProductList);
  611. this.$forceUpdate();
  612. }
  613. });
  614. },
  615. checkChange() {
  616. if (this.checked) {
  617. this.executorIdList = [];
  618. this.executorIdList = this.teamUserList.map((item) => item.id);
  619. } else {
  620. this.executorIdList = [];
  621. }
  622. },
  623. getCacheFn() {
  624. let parma = {
  625. workOrderIds: this.idsList,
  626. taskId: this.taskObj.id,
  627. type: 2
  628. };
  629. feedGetCache(parma).then((res) => {
  630. if (res.length == 0) {
  631. return false;
  632. }
  633. let objList = res[0].extInfo.objList;
  634. this.List.forEach((f, index) => {
  635. objList.forEach((o) => {
  636. if (
  637. f.workOrderId == o.workOrderId &&
  638. f.currentTaskDiagram.taskId == o.taskId
  639. ) {
  640. f['instanceList'] = o.instanceList || [];
  641. f['equipmentList'] = o.equipmentList || [];
  642. f['modelList'] = o.modelList || [];
  643. f['sparePartsList'] = o.sparePartsList || [];
  644. f['aridRegionList'] = o.aridRegionList || [];
  645. f['packingList'] = o.packingList || [];
  646. f['palletList'] = o.palletList || [];
  647. f['revolvingDiskList'] = o.revolvingDiskList || [];
  648. f['semiProductList'] = o.semiProductList || [];
  649. this.$set(this.List[index], 'executorTime', o.executorTime);
  650. this.$forceUpdate();
  651. }
  652. });
  653. });
  654. });
  655. },
  656. async save(type, index) {
  657. let arr = this.List.filter((L) => L.executorTime);
  658. if (!arr.length) {
  659. return this.$message.warning('请选择投料时间');
  660. }
  661. if (this.executorIdList.length == 0) {
  662. return this.$message.warning('执行人不能为空!');
  663. }
  664. const executorList = [];
  665. this.executorIdList.forEach((item) => {
  666. const data = this.teamUserList.find((it) => it.id == item);
  667. if (data) {
  668. executorList.push({
  669. userId: data.id,
  670. jobNumber: data.jobNumber,
  671. name: data.name
  672. });
  673. }
  674. });
  675. this.List = this.List.map((item) => {
  676. item.executorList = executorList;
  677. return item;
  678. });
  679. // this.List = this.List.map((item) => {
  680. // item.executorList = executorList;
  681. // return item;
  682. // });
  683. let deviceIs = false;
  684. this.List.forEach((f) => {
  685. f.instanceList.forEach((e) => {
  686. if (Object.prototype.hasOwnProperty.call(e, 'type')) {
  687. e.extInfo['type'] = e.type;
  688. }
  689. e.extInfo['isConsumable'] = e.isConsumable;
  690. });
  691. if (this.feedNeedEquipment == 1 && f.equipmentList.length == 0) {
  692. deviceIs = true;
  693. setTimeout(() => {
  694. this.$message.warning({
  695. message: '请工单编号:' + f.code + '添加设备',
  696. key: f.code
  697. });
  698. }, 500);
  699. }
  700. });
  701. //判断投料是否要添加设备
  702. if (deviceIs) {
  703. return;
  704. }
  705. for (let item of this.List) {
  706. if (
  707. item.currentTaskDiagram.feedNeedTurnover == 1 &&
  708. item.turnover.length == 0
  709. ) {
  710. setTimeout(() => {
  711. this.$message.warning({
  712. message: '请工单编号:' + item.code + '添加周转车',
  713. key: item.code
  714. });
  715. }, 500);
  716. return;
  717. }
  718. }
  719. for (let item of this.List) {
  720. if (
  721. item.currentTaskDiagram.feedNeedBoat == 1 &&
  722. item.palletList.length == 0
  723. ) {
  724. setTimeout(() => {
  725. this.$message.warning({
  726. message: '请工单编号:' + item.code + '添加舟皿',
  727. key: item.code
  728. });
  729. }, 500);
  730. return;
  731. }
  732. }
  733. const isCache = await this.checkCache(type);
  734. if (!isCache) {
  735. return false;
  736. }
  737. this.loading = this.$loading({
  738. lock: true,
  739. text: '加载中',
  740. background: 'rgba(0, 0, 0, 0.7)'
  741. });
  742. for (let item of this.List) {
  743. await checkRepeatFeed({
  744. currentTaskDiagram: item.currentTaskDiagram,
  745. workOrderId: item.workOrderId
  746. }).then((res) => {
  747. if (res.data == 0) {
  748. this.feedReport();
  749. } else {
  750. this.$confirm('已经有投料是否继续重复投料?', '提示', {
  751. confirmButtonText: '确定',
  752. cancelButtonText: '取消',
  753. type: 'warning'
  754. })
  755. .then(() => {
  756. this.feedReport();
  757. })
  758. .catch(() => {
  759. this.loading.close();
  760. });
  761. }
  762. // const totalNum = Number(item.formingNum);
  763. // const reportNum = this.add(
  764. // item.workReportInfo.notFormedNum,
  765. // item.workReportInfo.formedNum
  766. // );
  767. // const totalReportNum = this.add(reportNum, Number(res));
  768. // if (totalReportNum > totalNum) {
  769. // this.$confirm('报工数量大于生产数量, 是否继续报工?', '提示', {
  770. // confirmButtonText: '确定',
  771. // cancelButtonText: '取消',
  772. // type: 'warning'
  773. // })
  774. // .then(() => {
  775. // this.feedReport();
  776. // })
  777. // .catch(() => {
  778. // this.loading.close();
  779. // });
  780. // } else {
  781. // this.feedReport();
  782. // }
  783. });
  784. }
  785. },
  786. feedReport() {
  787. batchSave(this.List)
  788. .then((res) => {
  789. this.loading.close();
  790. this.$message.success('投料成功');
  791. this.getList(this.idsList);
  792. this.executorIdList = [];
  793. this.checked = false;
  794. this.teamId = '';
  795. this.$emit('feedSuccess', 'success');
  796. })
  797. .catch((e) => {
  798. this.loading.close();
  799. });
  800. },
  801. toInteger(num) {
  802. const len = this.getDecimalLength(num);
  803. return {
  804. int: Math.round(num * Math.pow(10, len)),
  805. factor: Math.pow(10, len)
  806. };
  807. },
  808. add(a, b) {
  809. const { int: aInt, factor: aFactor } = this.toInteger(a);
  810. const { int: bInt, factor: bFactor } = this.toInteger(b);
  811. const maxFactor = Math.max(aFactor, bFactor);
  812. return (
  813. (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
  814. maxFactor
  815. );
  816. },
  817. getDecimalLength(num) {
  818. return (num.toString().split('.')[1] || '').length;
  819. },
  820. checkCache(type, index) {
  821. return new Promise((resolve) => {
  822. if (type == 1) {
  823. feedSaveCache(this.List).then((rr) => {
  824. this.$message.success('已经缓存');
  825. });
  826. resolve(false);
  827. } else if (type == 2) {
  828. resolve(true);
  829. }
  830. });
  831. },
  832. removeCacheFn(type) {
  833. this.$confirm('是否清空缓存', '缓存')
  834. .then(() => {
  835. let parma = {
  836. workOrderIds: type == 'all' ? this.idsList : [type],
  837. taskId: this.taskObj.id,
  838. type: 2
  839. };
  840. removeCache(parma).then((res) => {
  841. this.getList(this.idsList);
  842. });
  843. })
  844. .catch(() => {});
  845. }
  846. }
  847. };
  848. </script>
  849. <style scoped lang="scss">
  850. .top_fixed {
  851. width: 100%;
  852. height: 40px;
  853. background: #fff;
  854. display: flex;
  855. align-items: center;
  856. justify-content: flex-end;
  857. }
  858. .feed_box {
  859. // margin-top: 6px;
  860. width: 100%;
  861. height: calc(100vh - 70px - 50px - 80px - 60px);
  862. overflow-y: scroll;
  863. overflow-x: hidden;
  864. }
  865. .card_box {
  866. background: #fff;
  867. padding: 8px;
  868. border-radius: 2px;
  869. }
  870. .checkboxWrapper {
  871. padding: 8px 20px;
  872. border-bottom: 1px solid #ccc;
  873. }
  874. ::v-deep .el-select__tags {
  875. flex-wrap: nowrap;
  876. overflow: auto;
  877. }
  878. /* 输入框最大宽度*/
  879. ::v-deep .el-select__tags-text {
  880. max-width: 90px;
  881. }
  882. /* 底部滚动条的高度*/
  883. ::v-deep .el-select__tags::-webkit-scrollbar {
  884. height: 2px !important;
  885. }
  886. </style>
  887. <style lang="scss">
  888. .mt6 {
  889. margin-top: 6px;
  890. }
  891. .title_box {
  892. padding: 5px 0;
  893. .name {
  894. font-size: 14px;
  895. font-style: normal;
  896. font-weight: 400;
  897. color: #157a2c;
  898. padding-left: 5px;
  899. position: relative;
  900. &:before {
  901. position: absolute;
  902. content: '';
  903. left: 0px;
  904. top: 0px;
  905. bottom: 0px;
  906. width: 2px;
  907. height: 14px;
  908. background: #157a2c;
  909. margin: auto;
  910. }
  911. }
  912. }
  913. .material {
  914. margin-top: 6px;
  915. .content_table {
  916. width: 100%;
  917. border: 1px solid #e3e5e5;
  918. position: relative;
  919. .item {
  920. display: flex;
  921. border-bottom: 1px solid #e3e5e5;
  922. .lable {
  923. width: 72px;
  924. text-align: center;
  925. background-color: #f7f9fa;
  926. font-size: 12px;
  927. border-right: 1px solid #e3e5e5;
  928. flex-shrink: 0;
  929. }
  930. .lable80 {
  931. width: 80px !important;
  932. font-size: 12px;
  933. }
  934. .lable90 {
  935. width: 90px !important;
  936. }
  937. .lable100 {
  938. width: 100px !important;
  939. }
  940. .ww60 {
  941. width: 60px;
  942. }
  943. .content {
  944. width: 250px;
  945. min-height: 32px;
  946. font-size: 14px;
  947. line-height: 14px;
  948. font-style: normal;
  949. font-weight: 400;
  950. padding: 9px 4px;
  951. box-sizing: border-box;
  952. word-wrap: break-word;
  953. flex-grow: 1 !important;
  954. .unit {
  955. padding: 0 2px;
  956. font-size: 12px;
  957. color: #404446;
  958. }
  959. }
  960. .content_num {
  961. display: flex;
  962. align-items: center;
  963. padding: 2px;
  964. --input-background-color: #f0f8f2;
  965. }
  966. .pd2 {
  967. padding: 2px 4px;
  968. }
  969. &:last-child {
  970. border-bottom: none;
  971. }
  972. }
  973. .ww55 {
  974. width: 55%;
  975. }
  976. .ww50 {
  977. width: 50%;
  978. }
  979. .ww45 {
  980. width: 45%;
  981. }
  982. .ww40 {
  983. width: 40%;
  984. }
  985. .ww30 {
  986. width: 30%;
  987. }
  988. .ww33 {
  989. width: 33.33%;
  990. }
  991. .ww20 {
  992. width: 20%;
  993. }
  994. .del_box {
  995. position: absolute;
  996. right: 2px;
  997. top: 2px;
  998. }
  999. .sort_index {
  1000. position: absolute;
  1001. left: 2px;
  1002. top: 2px;
  1003. width: 14px;
  1004. height: 14px;
  1005. line-height: 14px;
  1006. text-align: center;
  1007. color: #fff;
  1008. font-size: 12px;
  1009. border-radius: 50%;
  1010. background: rgb(21, 122, 44);
  1011. }
  1012. }
  1013. }
  1014. </style>