workReport.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373
  1. <template>
  2. <div class="index_box">
  3. <el-drawer
  4. title=""
  5. :visible.sync="drawer"
  6. v-if="drawer"
  7. :before-close="handleClose"
  8. :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
  9. :with-header="false"
  10. append-to-body
  11. >
  12. <div>
  13. <div>
  14. <div class="seek-list" style="background-color: #157a2c">
  15. <!-- <div>
  16. <el-input
  17. style="width: 180px; margin-right: 5px"
  18. clearable
  19. v-model="keyWord"
  20. placeholder="请输入关键字"
  21. @clear="handleSearch"
  22. />
  23. <el-button
  24. size="mini"
  25. type="primary"
  26. style="margin: 0 5px"
  27. @click="handleSearch"
  28. >查询</el-button
  29. >
  30. <template>
  31. <el-popover
  32. placement="top-start"
  33. width="200"
  34. trigger="hover"
  35. content="支持工单编码,产品编码,产品名称,产品规格,牌号,型号,批次号查询。"
  36. >
  37. <i
  38. class="el-icon-question"
  39. slot="reference"
  40. style="color: #40a9ff; font-size: 14px"
  41. ></i> </el-popover
  42. ></template>
  43. </div> -->
  44. <div
  45. style="
  46. width: 100%;
  47. color: #fff;
  48. display: flex;
  49. justify-content: space-between;
  50. "
  51. >
  52. <div>
  53. <b style="margin-right: 50px; font-size: 14px"
  54. >当前工序:{{ title }}</b
  55. >
  56. <b style="font-size: 14px">下道工序:{{ title1 }}</b>
  57. </div>
  58. <div>
  59. <b style="font-size: 14px; margin-right: 10px; color: orange"
  60. >工艺路线:{{ workOrderInfo.produceRoutingName }}
  61. </b>
  62. <b style="font-weight: blod; font-size: 14px">
  63. 操作员:{{ info.name }}
  64. </b>
  65. </div>
  66. <div class="rx-ec">
  67. <el-button
  68. icon="el-icon-full-screen"
  69. type="text"
  70. style="color: #fff; font-size: 14px"
  71. @click="handleFull"
  72. >{{ isFullscreen ? '全屏' : '缩小' }}</el-button
  73. >
  74. <el-button
  75. icon="el-icon-circle-close"
  76. type="text"
  77. style="color: #fff; font-size: 14px"
  78. @click="handleClose"
  79. >关闭</el-button
  80. >
  81. </div>
  82. </div>
  83. </div>
  84. <div class="drawer_content">
  85. <el-steps :active="activeIndex" space="20px" align-center>
  86. <el-step
  87. v-for="(item, index) in routeList"
  88. :key="index"
  89. :title="item.taskTypeName"
  90. @click.native="handIdx(index, item)"
  91. :description="desIndex == index ? '此处' : ''"
  92. :class="desIndex == index ? 'active' : ''"
  93. :status="errorIndex == index ? 'error' : ''"
  94. ></el-step>
  95. </el-steps>
  96. </div>
  97. <el-tabs type="border-card">
  98. <el-tab-pane label="基本信息">
  99. <ele-split-layout
  100. space="0px"
  101. width="26%"
  102. :resizable="true"
  103. :min-size="200"
  104. :max-size="-200"
  105. :left-style="{
  106. overflow: 'hidden',
  107. width: '100%'
  108. }"
  109. :right-style="{ overflow: 'hidden' }"
  110. :responsive="false"
  111. style="height: calc(100vh - 230px)"
  112. >
  113. <!-- 详细信息 -->
  114. <div class="left_main">
  115. <div class="top">
  116. <Info :workOrderInfo="workOrderInfo"></Info>
  117. </div>
  118. </div>
  119. <!-- //报工信息 -->
  120. <template v-slot:content>
  121. <div class="right_main">
  122. <!-- 领料 -->
  123. <!-- <div v-if="operationType == 'pick'"> -->
  124. <div v-if="operationType == 'pick'">
  125. <pickDetails
  126. ref="pickListRef"
  127. :workTaskId="workTaskId"
  128. :taskId="taskObj.id"
  129. @pickAdd="pickAdd"
  130. ></pickDetails>
  131. </div>
  132. <div v-if="operationType == 'feed'">
  133. <!-- 投料 -->
  134. <feeding
  135. v-if="isFinalCheckProduction"
  136. :workListIds="workListIds"
  137. :feedNeedEquipment="feedNeedEquipment"
  138. @feedSuccess="feedSuccess"
  139. ></feeding>
  140. </div>
  141. <div v-if="operationType == 'job'">
  142. <!-- // 报工列表 入库 -->
  143. <warehousing
  144. v-if="taskObj.id == -1"
  145. :workListIds="workListIds"
  146. ref="wareRef"
  147. @warehouseSuccess="warehouseSuccess"
  148. :workPlanType="workPlanType"
  149. ></warehousing>
  150. <!-- // 设备 入库 -->
  151. <!-- 普通报工 -->
  152. <!-- <jobBooking
  153. v-else
  154. :workListIds="workListIds"
  155. ref="jobRef"
  156. :reportNeedFeed="reportNeedFeed"
  157. ></jobBooking> -->
  158. <jobBooking
  159. v-else-if="isFinalCheckProduction"
  160. :workListIds="workListIds"
  161. ref="jobRef"
  162. :reportNeedFeed="reportNeedFeed"
  163. @jobSuccess="jobSuccess"
  164. :workPlanType="workPlanType"
  165. ></jobBooking>
  166. <!-- <workPlan
  167. style="width: 100%"
  168. v-else
  169. :workListIds="workListIds"
  170. ref="jobRef"
  171. :reportNeedFeed="reportNeedFeed"
  172. >
  173. </workPlan> -->
  174. </div>
  175. <!-- 工步 -->
  176. <div v-if="operationType == 'workStep'"> </div>
  177. <!-- 质检工序 -->
  178. <div v-if="operationType == 'inspection'">
  179. <inspection
  180. :workListIds="workListIds"
  181. ref="inspectionRef"
  182. ></inspection>
  183. </div>
  184. <!-- 委外 -->
  185. <div
  186. v-if="operationType == 'Outsourcing' && isType == '3'"
  187. class="right_main_box"
  188. >
  189. <outsourcingDetails
  190. ref="outsourcingListRef"
  191. @outsourcingAdd="outsourcingAdd"
  192. v-if="!isStep && !isOutsource && !isPleaseEntrust"
  193. :chooseType="chooseType"
  194. ></outsourcingDetails>
  195. <outsourcing
  196. :outsourceFormVal="outsourceForm"
  197. :taskObj="taskObj"
  198. :workListIds="workListIds[0]"
  199. :workData="workInfoList"
  200. @changePlugIn="changePlugIn"
  201. @changeCancel="changeCancel"
  202. :chooseType="chooseType"
  203. v-if="isStep"
  204. ></outsourcing>
  205. <outsourceList
  206. :workData="workInfoList"
  207. :taskObj="taskObj"
  208. :outsourceFormVal="outsourceForm"
  209. :chooseType="chooseType"
  210. @closeForm="closeForm"
  211. @outScucc="outScucc"
  212. v-if="isOutsource"
  213. ></outsourceList>
  214. <!-- -->
  215. <!-- <outsourceList
  216. :outsourceFormVal="outObj"
  217. @closeForm="closeForm"
  218. @outScucc="outScucc"
  219. v-if="isOutsource"
  220. ></outsourceList> -->
  221. <pleaseEntrust
  222. :outsourceFormVal="outObj"
  223. @closeForm="closeForm"
  224. @outScucc="outScucc"
  225. v-if="isPleaseEntrust"
  226. ></pleaseEntrust>
  227. </div>
  228. </div>
  229. </template>
  230. </ele-split-layout>
  231. <footBtn
  232. @footBtn="footBtn"
  233. :type="type"
  234. :singleReportInspection="singleReportInspection"
  235. style="background: rgba(223, 250, 222, 0.6); padding: 10px"
  236. ></footBtn>
  237. </el-tab-pane>
  238. <el-tab-pane label="投料详情">
  239. <feedDetails
  240. :routeObj="routeObj"
  241. :curTaskObj="curTaskObj"
  242. ></feedDetails
  243. ></el-tab-pane>
  244. <el-tab-pane label="报工详情">
  245. <jobDetails
  246. :routeObj="routeObj"
  247. :curTaskObj="curTaskObj"
  248. :newId="newId"
  249. ></jobDetails>
  250. </el-tab-pane>
  251. <el-tab-pane label="生产明细">
  252. <productionDetails
  253. :workOrderInfo="workOrderInfo"
  254. ></productionDetails>
  255. </el-tab-pane>
  256. <!-- <el-tab-pane label="退料详情"> </el-tab-pane> -->
  257. </el-tabs>
  258. </div>
  259. </div>
  260. <!--领料弹框 -->
  261. <picking
  262. v-if="pickingShow"
  263. @close="pickingClose"
  264. :workListIds="workListIds"
  265. ></picking>
  266. <!-- 工艺文件 -->
  267. <wokePopup ref="wokePopupRef"></wokePopup>
  268. <!-- 检验报工 -->
  269. <workPlan ref="jobRefs" @closeWorkPlan="closeWorkPlan"> </workPlan>
  270. <!-- <workes ref="jobRefs"> </workes> -->
  271. <!-- :workListIds="workListIds" :taskId="taskObj.id" -->
  272. <!-- 工步 -->
  273. <workStep ref="workStepRef" />
  274. <!-- 任务 -->
  275. <TaskDialog ref="taskDialogRef" />
  276. <!-- 异常 -->
  277. <createError ref="createErrorRef" />
  278. <addPlease ref="addPleaseRef" @refresh="refreshPlease"></addPlease>
  279. <qualityInspection ref="qualityInspectionRef"></qualityInspection>
  280. </el-drawer>
  281. </div>
  282. </template>
  283. <script>
  284. import Info from './info.vue';
  285. import TaskDialog from '@/views/produce/components/taskDialog/index.vue';
  286. import Search from '@/views/produce/components/search.vue';
  287. import footBtn from '@/views/produce/components/footBtn.vue';
  288. // import produceOrder from './components/produceOrder.vue';
  289. import produceOrder from '@/views/produce/components/new_produceOrder.vue';
  290. import productionResource from '@/views/produce/components/productionResource/index.vue';
  291. import outsourcing from '@/views/produce/components/outsourcing/index.vue';
  292. import picking from '@/views/produce/components/picking/index.vue';
  293. import wokePopup from '@/views/produce/components/picking/wokePopup.vue';
  294. import inspection from '@/views/produce/components/inspection/newIndex.vue';
  295. // import inspection from './components/inspection/index.vue';
  296. import pickDetails from '@/views/produce/components/picking/details.vue';
  297. import AssetTree from '@/components/AssetTree/joobIndex.vue';
  298. import feeding from '@/views/produce/components/feeding/index.vue';
  299. import outsourcingDetails from '@/views/produce/components/outsourcing/details.vue';
  300. import jobBooking from '@/views/produce/components/jobBooking/index.vue';
  301. import workPlan from '@/views/produce/components/workPlan/index.vue';
  302. // import workes from './components/workPlan/components/work.vue';
  303. import warehousing from '@/views/produce/components/warehousing/index.vue';
  304. // import outsourceList from '@/views/produce/components/outsourcing/outsourceList.vue';
  305. import outsourceList from '@/views/produce/components/outsourcing/new_outsourceList.vue';
  306. import pleaseEntrust from '@/views/produce/components/outsourcing/pleaseEntrust.vue';
  307. import workStep from '@/views/produce/components/workStep/index.vue';
  308. import createError from '@/views/produce/components/createError.vue';
  309. import productionDetails from '../workOrderList/components/productionDetails.vue';
  310. import { parameterGetByCode } from '@/api/system/dictionary-data';
  311. import {
  312. getByTaskId,
  313. pcCheckOutsource,
  314. getTaskInstanceById,
  315. checkOutsourceMaterial,
  316. listTask,
  317. factoryworkstationPage,
  318. nextTask,
  319. checkPleaseEntrust
  320. } from '@/api/produce/index';
  321. import { getTaskInstanceList } from '@/api/produce/job';
  322. import { workorderInfo } from '@/api/produceOrder/index.js';
  323. import feedDetails from '@/views/produce/components/feeding/details.vue';
  324. import jobDetails from '@/views/produce/components/jobBooking/details.vue';
  325. import addPlease from '@/views/produce/components/outsourcing/addPlease.vue';
  326. import qualityInspection from '@/views/produce/components/qualityInspection/index.vue';
  327. import { checkProductionResult } from '@/api/producetaskrulerecord/index.js';
  328. export default {
  329. components: {
  330. Search,
  331. footBtn,
  332. wokePopup,
  333. produceOrder,
  334. productionResource,
  335. outsourcing,
  336. picking,
  337. pickDetails,
  338. outsourceList,
  339. feeding,
  340. AssetTree,
  341. jobBooking,
  342. inspection,
  343. warehousing,
  344. workStep,
  345. workPlan,
  346. TaskDialog,
  347. createError,
  348. Info,
  349. feedDetails,
  350. jobDetails,
  351. productionDetails,
  352. outsourcingDetails,
  353. pleaseEntrust,
  354. addPlease,
  355. qualityInspection
  356. },
  357. data() {
  358. return {
  359. name: '',
  360. activeName: '0',
  361. taskName: '',
  362. keyWord: '', //搜索
  363. title: '',
  364. type: '',
  365. loading: false,
  366. isLoading: null,
  367. operationType: null,
  368. popupType: '', // 弹窗
  369. workListIds: [],
  370. factoryworkstationList: [],
  371. title1: '',
  372. arr: [],
  373. arrTow: [],
  374. produceTaskList: [],
  375. isType: '',
  376. isStep: false,
  377. outsourceForm: {},
  378. outObj: {},
  379. pickingShow: false,
  380. wokePopup: false,
  381. workOrderInfo: {},
  382. routeList: [],
  383. activeIndex: 0,
  384. desIndex: 0,
  385. errorIndex: 10000,
  386. drawer: false,
  387. workData: {},
  388. isFullscreen: false,
  389. isOutsource: false,
  390. chooseType: '1',
  391. routeObj: {
  392. id: null
  393. },
  394. BomObj: {},
  395. defaultProps: {
  396. children: 'children',
  397. label: 'newName'
  398. },
  399. defaultPropsTow: {
  400. children: 'children',
  401. label: 'name',
  402. value: 'code'
  403. },
  404. feedNeedEquipment: 0, //投料是否要添加生产设备1是0否
  405. reportNeedFeed: 0, //生产质检是否需要处置再报工1是0否
  406. singleReportInspection: null, //获取选中的工单是单个还是批量
  407. workTaskId: null, //选中的工单工序id
  408. workStepQueryParam: {
  409. taskId: null,
  410. workOrderId: null,
  411. bomCategoryId: null
  412. },
  413. isFinalCheckProduction: true,
  414. newId: '',
  415. curTaskObj: null,
  416. produceList: [],
  417. workPlanType: '',
  418. isPleaseEntrust: false,
  419. workInfoList: {}
  420. };
  421. },
  422. computed: {
  423. taskObj() {
  424. return this.$store.state.user.taskObj;
  425. },
  426. info() {
  427. return this.$store.state.user.info;
  428. },
  429. rightShow() {
  430. return (type) => {};
  431. }
  432. },
  433. created() {
  434. this.init();
  435. this.getTaskList();
  436. this.getFactoryworkstationPageList();
  437. this.operationType = null;
  438. this.workListIds = [];
  439. },
  440. methods: {
  441. tabClickValue() {
  442. this.name = '';
  443. this.seekInput();
  444. },
  445. // 前端筛选
  446. seekInput() {
  447. // console.log(activeName);
  448. if (this.activeName == '0') {
  449. if (!this.name) return (this.produceTaskList = this.arr);
  450. this.produceTaskList = this.produceTaskList.filter((item) => {
  451. return item.name.indexOf(this.name) > -1;
  452. });
  453. } else {
  454. if (!this.name) return (this.factoryworkstationList = this.arrTow);
  455. this.factoryworkstationList = this.factoryworkstationList.filter(
  456. (item) => {
  457. return item.name.indexOf(this.name) > -1;
  458. }
  459. );
  460. }
  461. },
  462. // 折叠悬浮中样式调整
  463. init() {
  464. this.$store.dispatch('theme/setCollapse', true);
  465. },
  466. async getTaskName(value) {
  467. let res = await nextTask({
  468. taskId: this.taskObj.id,
  469. workOrderIds: [value.id]
  470. });
  471. const title1 = res.data.map((item) => item.taskTypeName).toString();
  472. this.title1 = title1 ? title1 : '';
  473. },
  474. handleSearch() {
  475. let obj = {
  476. keyWord: this.keyWord,
  477. taskName: this.taskName
  478. };
  479. this.$refs.produceOrder.handleSearch(obj);
  480. //handleSearch(this.code);
  481. },
  482. handleNodeClickNew(info) {
  483. // this.current = info;
  484. let current = { id: info.id };
  485. this.$store.commit('user/currentObj', current);
  486. },
  487. setRootId(id) {
  488. this.rootId = id;
  489. },
  490. // 点击工序
  491. // handleNodeClick(data) {
  492. // this.feedNeedEquipment = data.feedNeedEquipment;
  493. // this.reportNeedFeed = data.reportNeedFeed;
  494. // let obj = {
  495. // 1: `${data.workCenterName}-${data.name}(普通工序)`,
  496. // 3: `${data.workCenterName}-${data.name}(质检工序)`,
  497. // 4: `${data.workCenterName}-${data.name}(包装工序)`,
  498. // 5: `${data.workCenterName}-${data.name}(入库工序)`,
  499. // 6: `${data.workCenterName}-${data.name}(质检工序)`
  500. // };
  501. // this.title = obj[data.type] || '';
  502. // this.type = data.type;
  503. // let taskObj = {};
  504. // taskObj = this.routeList.find((item) => item.taskId === data.taskId);
  505. // console.log(taskObj, 'taskObj');
  506. // this.$store.commit('user/setTaskObj', taskObj);
  507. // },
  508. handleChoose(val) {
  509. console.log(val);
  510. },
  511. handleFull() {
  512. this.isFullscreen = !this.isFullscreen;
  513. this.$forceUpdate();
  514. },
  515. // 获取工序列表
  516. getTaskList() {
  517. listTask().then((res) => {
  518. res.map((v) => {
  519. v.newName = `${v.workCenterName}-${v.name}`;
  520. });
  521. this.produceTaskList = res;
  522. this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
  523. //默认选择第一个工序
  524. // if (this.produceTaskList?.length) {
  525. // this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
  526. // this.$nextTick(() => {
  527. // this.$refs.taskListRef.setCurrentKey(this.produceTaskList[0].id);
  528. // });
  529. // }
  530. // newName
  531. });
  532. },
  533. // 获取工位
  534. getFactoryworkstationPageList() {
  535. factoryworkstationPage({ pageNum: 1, size: 99999999 }).then((res) => {
  536. this.factoryworkstationList = res.list;
  537. this.arrTow = JSON.parse(JSON.stringify(this.factoryworkstationList));
  538. // newName
  539. });
  540. },
  541. changeCancel(activeType) {
  542. this.isStep = false;
  543. this.chooseType = activeType;
  544. if (this.chooseType == '1') {
  545. this.$nextTick(() => {
  546. this.$refs.outsourcingListRef.getDataList(this.workData.code);
  547. });
  548. } else if (this.chooseType == '2') {
  549. this.$nextTick(() => {
  550. this.$refs.outsourcingListRef.getPleaseData(this.workData.code);
  551. });
  552. }
  553. },
  554. closeForm() {
  555. this.isOutsource = false;
  556. this.isPleaseEntrust = false;
  557. this.$nextTick(() => {
  558. this.$refs.outsourcingListRef.getDataList(this.workData.code);
  559. });
  560. },
  561. outScucc() {
  562. // this.operationType = null;
  563. this.isOutsource = false;
  564. this.isPleaseEntrust = false;
  565. this.$nextTick(() => {
  566. this.$refs.outsourcingListRef.getDataList(this.workData.code);
  567. });
  568. },
  569. // 切换组件
  570. // async changePlugIn(e) {
  571. // this.outObj = e;
  572. // let req = {
  573. // taskId: e.taskId,
  574. // taskIds: e.taskIds,
  575. // workOrderId: e.workOrderId,
  576. // quantity: e.formedNumLast
  577. // };
  578. // const res = await checkOutsourceMaterial(req);
  579. // this.outObj = { ...res.data, ...this.outsourceForm, ...this.outObj };
  580. // this.isStep = false;
  581. // this.isOutsource = true;
  582. // },
  583. async changePlugIn(e, index) {
  584. if (index == '1') {
  585. this.outObj = e;
  586. let req = {
  587. taskId: e.taskId,
  588. taskIds: e.taskIds,
  589. workOrderId: e.workOrderId,
  590. quantity: e.formedNumLast
  591. };
  592. const URL =
  593. index == '1' ? checkOutsourceMaterial : checkPleaseEntrust;
  594. const res = await URL(req);
  595. this.outObj = { ...res.data, ...this.outsourceForm, ...this.outObj };
  596. this.isStep = false;
  597. this.isOutsource = true;
  598. } else if (index == '2') {
  599. this.outObj = e;
  600. let req = {
  601. taskId: e.taskId,
  602. taskIds: e.taskIds,
  603. workOrderId: e.workOrderId,
  604. quantity: e.formedNumLast
  605. };
  606. const res = await checkPleaseEntrust(req);
  607. this.outObj = { ...res.data, ...this.outsourceForm, ...this.outObj };
  608. this.isStep = false;
  609. this.isPleaseEntrust = true;
  610. }
  611. },
  612. pickingWokeClose() {
  613. this.wokePopup = false;
  614. },
  615. open(row) {
  616. this.curTaskObj = null;
  617. this.workOrderInfo = row;
  618. this.routeObj.id = this.workOrderInfo.id;
  619. this.getTaskFn();
  620. this.drawer = true;
  621. this.getOrderData();
  622. },
  623. async getOrderData() {
  624. await workorderInfo(this.workOrderInfo.id).then((res) => {
  625. this.workOrderInfo = res;
  626. this.workStepQueryParam.taskId = this.workOrderInfo.taskId;
  627. this.workStepQueryParam.workOrderId = this.workOrderInfo.id;
  628. this.workStepQueryParam.bomCategoryId =
  629. this.workOrderInfo.bomCategoryId;
  630. this.singleReportInspection = this.workOrderInfo.singleReport;
  631. });
  632. },
  633. handleClose() {
  634. this.drawer = false;
  635. },
  636. feedSuccess() {
  637. this.getOrderData();
  638. this.getTaskFn();
  639. },
  640. jobSuccess() {
  641. this.getOrderData();
  642. this.getTaskFn();
  643. },
  644. warehouseSuccess() {
  645. this.getOrderData();
  646. this.getTaskFn();
  647. },
  648. async getTaskFn() {
  649. await getTaskInstanceList(this.workOrderInfo.id).then((res) => {
  650. this.routeList = res;
  651. console.log(this.routeList, 'routeList');
  652. console.log(this.workOrderInfo, 'this.workOrderInfo');
  653. // 使用findIndex方法查找
  654. const index = this.routeList.findIndex(
  655. (item) => item.taskId == this.workOrderInfo.taskId
  656. );
  657. this.desIndex = index;
  658. console.log(this.routeList, '888888');
  659. this.newId = this.routeList[this.desIndex].taskId || '';
  660. if (this.workOrderInfo.taskId != -2) {
  661. this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
  662. } else {
  663. this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
  664. this.desIndex = 0;
  665. }
  666. this.activeIndex = index;
  667. this.workData = this.workOrderInfo;
  668. this.handIdx(this.activeIndex, this.routeList[index]);
  669. });
  670. },
  671. async getCodeData(req) {
  672. await parameterGetByCode({ code: 'enable_quality_plus' }).then(
  673. (res) => {
  674. if (res.value == '1') {
  675. this.$refs.jobRefs.open(req);
  676. }
  677. }
  678. );
  679. },
  680. async checkQualityResult() {
  681. if (
  682. this.taskObj &&
  683. this.workListIds.length > 0 &&
  684. this.taskObj.id != -1
  685. ) {
  686. // 判断是否要求先完成 产前准备等事项
  687. const result = await checkProductionResult({
  688. produceTaskId: this.taskObj.id,
  689. workOrderIds: this.workListIds
  690. });
  691. return result;
  692. }
  693. },
  694. async footBtn(t) {
  695. this.workPlanType = '';
  696. // this.operationType = t;
  697. // 新增判断 *** 出现弹窗的时候不然右边数据消失
  698. if ((t == 'work' || t == 'workStep', t === 'task')) {
  699. this.popupType = t;
  700. } else {
  701. this.operationType = t;
  702. }
  703. if (
  704. Object.keys(this.$store.state.user.taskObj).length === 0 &&
  705. this.$store.state.user.taskObj.constructor === Object
  706. ) {
  707. this.$message.warning('请选择工序');
  708. return true;
  709. }
  710. if (['pick', 'feed', 'job', 'work', 'workStep', 'task'].includes(t)) {
  711. this.isFinalCheckProduction = false;
  712. if (this.$store.state.user.info.clientEnvironmentId == 9) {
  713. if (t == 'feed') {
  714. if (!this.$store.state.user.info.workCenterIds) {
  715. return this.$message.warning('该用户没有权限投料');
  716. }
  717. const isWorkCenter =
  718. this.$store.state.user.info.workCenterIds.includes(
  719. this.taskObj.workCenterId
  720. );
  721. if (!isWorkCenter) {
  722. return this.$message.warning('该用户没有权限投料');
  723. }
  724. }
  725. }
  726. this.isFinalCheckProduction = true;
  727. if (this.workListIds.length == 0) {
  728. this.$message.warning('请选择工单列表');
  729. return false;
  730. }
  731. }
  732. // console.log('按钮被点击了.....', t);
  733. if (t === 'job') {
  734. let req = {
  735. taskId: this.taskObj.id,
  736. workOrderId: this.workListIds[0],
  737. data: [this.workOrderInfo]
  738. };
  739. this.isFinalCheckProduction = false;
  740. if (this.$store.state.user.info.clientEnvironmentId == 9) {
  741. if (!this.$store.state.user.info.workCenterIds) {
  742. return this.$message.warning('该用户没有权限报工');
  743. }
  744. const isWorkCenter =
  745. this.$store.state.user.info.workCenterIds.includes(
  746. this.taskObj.workCenterId
  747. );
  748. if (!isWorkCenter) {
  749. return this.$message.warning('该用户没有权限报工');
  750. }
  751. }
  752. // let resultValue = '0';
  753. // await parameterGetByCode({
  754. // code: 'first_article_dual_inspection_for_report'
  755. // }).then((res) => {
  756. // resultValue = res.value;
  757. // });
  758. // if (resultValue == '1') {
  759. // this.isFinalCheckProduction = false;
  760. // if (this.taskObj.id != '-1') {
  761. // const result = await this.checkQualityResult();
  762. // if (!result) return;
  763. // const firstArticleResult =
  764. // result.firstArticleDualInspectionResult ?? true;
  765. // this.isFinalCheckProduction = firstArticleResult;
  766. // if (!firstArticleResult) {
  767. // return this.$message.warning('请完成首件两检再报工!');
  768. // }
  769. // }
  770. // this.isFinalCheckProduction = true;
  771. if (this.taskObj.id != '-1') {
  772. const result = await this.checkQualityResult();
  773. if (!result) return;
  774. const firstArticleResult =
  775. result.firstArticleDualInspectionResult ?? true;
  776. if (!firstArticleResult) {
  777. this.$message.warning('请完成首件两检再报工!');
  778. return;
  779. }
  780. }
  781. this.isFinalCheckProduction = true;
  782. // }
  783. if (
  784. this.taskObj.type == 2 ||
  785. this.taskObj.type == 3 ||
  786. this.taskObj.type == 6
  787. ) {
  788. // this.$refs.jobRefs.open(req);
  789. this.getCodeData(req);
  790. }
  791. }
  792. if (t == 'pick') {
  793. this.$nextTick(() => {
  794. this.$refs.pickListRef.getList(this.workListIds);
  795. });
  796. }
  797. // 工步
  798. if (t === 'workStep') {
  799. if (this.workListIds.length > 1) {
  800. return this.$message.warning('工步只能选择一个工单!');
  801. }
  802. this.$refs.workStepRef.open(this.workStepQueryParam);
  803. // let req = {
  804. // taskId: this.taskObj.id,
  805. // workOrderId: this.workListIds[0]
  806. // };
  807. // this.$refs.wokePopupRef.open(req);
  808. }
  809. if (t === 'task') {
  810. if (this.workListIds.length > 1) {
  811. return this.$message.warning('任务只能选择一个工单!');
  812. }
  813. this.$refs.taskDialogRef.open(
  814. this.workStepQueryParam,
  815. this.workOrderInfo
  816. );
  817. }
  818. if (t === 'error') {
  819. if (this.workListIds.length > 1) {
  820. return this.$message.warning('异常只能选择一个工单!');
  821. }
  822. // console.log(this.workListIds, 'this.workListIds');
  823. this.$refs.createErrorRef.open('add', this.workOrderInfo);
  824. }
  825. // 工艺路线 *** 修改 判断只能选择一个
  826. // if (t === 'work') {
  827. // let req = {
  828. // taskId: this.taskObj.id,
  829. // workOrderId: this.workListIds[0]
  830. // };
  831. // this.$refs.wokePopupRef.open(req);
  832. // }
  833. if (t === 'work') {
  834. if (this.workListIds.length > 1) {
  835. return this.$message.warning('工艺文件只能选择一个工单!');
  836. }
  837. let req = {
  838. taskId: this.taskObj.id,
  839. workOrderId: this.workListIds[0]
  840. };
  841. this.$refs.wokePopupRef.open(req);
  842. }
  843. if (t == 'feed') {
  844. }
  845. // 委外
  846. if (t == 'Outsourcing') {
  847. if (this.workListIds.length > 1) {
  848. return this.$message.warning('委外工序只能选择一个工单!');
  849. } else if (this.workListIds.length < 1)
  850. return this.$message.warning('请选择工单!');
  851. else {
  852. // /
  853. this.handOutsource(this.workListIds[0]);
  854. }
  855. }
  856. if (t == 'qualityInspection') {
  857. if (this.workListIds.length < 1) {
  858. return this.$message.warning('请选择工单!');
  859. }
  860. if (this.workListIds.length > 1) {
  861. return this.$message.warning('首件两检只能选择一个工单!');
  862. }
  863. this.$refs.qualityInspectionRef.open(
  864. this.workOrderInfo,
  865. this.taskObj
  866. );
  867. }
  868. },
  869. handIdx(index, item) {
  870. console.log(this.routeList, 'routeList');
  871. console.log(index, item, 'handIdx');
  872. if (item.count > 0 || index == this.desIndex) {
  873. this.taskId = item.taskId;
  874. } else {
  875. if (item.taskId != -2) {
  876. this.$message.info('还未执行到此工序');
  877. return;
  878. }
  879. }
  880. this.curTaskObj = JSON.parse(JSON.stringify(item));
  881. console.log(item, 'item');
  882. this.feedNeedEquipment = item.feedNeedEquipment;
  883. this.reportNeedFeed = item.reportNeedFeed;
  884. let obj = {
  885. 1: `${item.taskTypeName}(普通工序)`,
  886. 3: `${item.taskTypeName}(质检工序)`,
  887. 4: `${item.taskTypeName}(包装工序)`,
  888. 5: `${item.taskTypeName}(入库工序)`,
  889. 6: `${item.taskTypeName}(质检工序)`
  890. };
  891. this.title = obj[item.type] || '';
  892. this.type = item.type;
  893. let taskObj = {};
  894. taskObj = this.routeList.find((e) => e.taskId === item.taskId);
  895. taskObj.id = taskObj.sourceTaskId;
  896. taskObj.isOrderListData = true;
  897. if (taskObj.taskId != 2) {
  898. this.$store.commit('user/setTaskObj', taskObj);
  899. this.workListIds = [this.workOrderInfo.id];
  900. }
  901. // if (item.taskId == -2) {
  902. // this.$message.info('完结状态不能点击');
  903. // return;
  904. // } else {
  905. // this.desIndex = index;
  906. // this.newId = this.routeList[this.desIndex].taskId || '';
  907. // this.getTaskName(this.workOrderInfo);
  908. // }
  909. if (item.taskId != -2) {
  910. this.desIndex = index;
  911. this.newId = this.routeList[this.desIndex].taskId || '';
  912. this.getTaskName(this.workOrderInfo);
  913. }
  914. },
  915. outsourcingAdd(type, activeName) {
  916. this.chooseType = activeName;
  917. this.getTaskInstanceByIdFn(this.workListIds[0]);
  918. // this.isStep = true;
  919. this.workInfoList = { list: [] };
  920. this.workInfoList.list.push(this.workData);
  921. if (this.chooseType == '2') {
  922. this.isStep = true;
  923. } else {
  924. this.isOutsource = true;
  925. }
  926. },
  927. async handOutsource(workOrderId) {
  928. this.isType = '';
  929. // return
  930. let param = {
  931. taskId: this.taskObj.id,
  932. workOrderId: workOrderId
  933. };
  934. await pcCheckOutsource(param).then((res) => {
  935. this.outsourceForm = {
  936. ...res.data
  937. };
  938. this.isStep = false;
  939. this.isOutsource = false;
  940. this.isPleaseEntrust = false;
  941. // this.outsourceForm.name = this.taskObj.taskTypeName + '委外';
  942. if (res.data.outsource) {
  943. this.isType = '3';
  944. // this.getTaskInstanceByIdFn(workOrderId);
  945. if (!this.isStep && !this.isOutsource && !this.isPleaseEntrust) {
  946. this.$nextTick(() => {
  947. this.$refs.outsourcingListRef.getDataList(this.workData.code);
  948. });
  949. }
  950. // console.log(
  951. // this.$refs.outsourcingListRef,
  952. // 'this.$refs.outsourcingListRef'
  953. // );
  954. // this.$refs.outsourcingListRef.getDataList(this.workData.code);
  955. } else {
  956. return this.$message.warning('此工序不能委外');
  957. }
  958. });
  959. },
  960. closeWorkPlan(type) {
  961. this.workPlanType = type;
  962. },
  963. refreshPlease() {
  964. this.$nextTick(() => {
  965. this.$refs.outsourcingListRef.getPleaseData(
  966. this.workData.list[0].code
  967. );
  968. });
  969. },
  970. //获取工单列表
  971. getTaskInstanceByIdFn(workOrderId) {
  972. getTaskInstanceById(workOrderId).then((res) => {
  973. let { data } = res;
  974. if (data.length) {
  975. data = data.filter(
  976. (item) => item.taskId != -2 && item.taskId != -1
  977. );
  978. let arr = data.findIndex(
  979. (item) => item.sourceTaskId == this.taskObj.id
  980. );
  981. if (arr != -1) {
  982. data.splice(0, arr);
  983. }
  984. this.$set(this.outsourceForm, 'newStepsList', data);
  985. }
  986. });
  987. },
  988. pickAdd() {
  989. this.pickingShow = true;
  990. },
  991. // 关闭领料弹窗
  992. pickingClose(val) {
  993. if (val) {
  994. this.$nextTick(() => {
  995. this.$refs.pickListRef.getList(this.workListIds);
  996. });
  997. }
  998. this.pickingShow = false;
  999. },
  1000. rowClick(row, taskId) {
  1001. if (taskId) {
  1002. let params = {
  1003. categoryId: row.categoryId,
  1004. taskId: taskId
  1005. };
  1006. getByTaskId(params).then((res) => {
  1007. this.BomObj = res.data;
  1008. this.$forceUpdate();
  1009. });
  1010. }
  1011. }
  1012. },
  1013. mounted() {
  1014. this.$nextTick(() => {
  1015. const targetElements =
  1016. document.getElementsByClassName('ele-admin-tabs');
  1017. if (targetElements.length > 0) {
  1018. // 遍历所有具有 'ele-admin-tabs' 类的元素
  1019. Array.from(targetElements).forEach((element) => {
  1020. // 对每个元素添加 'new-ele-admin-tabs' 类
  1021. element.classList.add('new-ele-admin-tabs');
  1022. });
  1023. }
  1024. });
  1025. },
  1026. destroyed() {
  1027. this.$nextTick(() => {
  1028. const targetElements =
  1029. document.getElementsByClassName('ele-admin-tabs');
  1030. if (targetElements.length > 0) {
  1031. Array.from(targetElements).forEach((element) => {
  1032. element.classList.remove('new-ele-admin-tabs');
  1033. });
  1034. }
  1035. });
  1036. }
  1037. };
  1038. </script>
  1039. <style lang="scss" scoped>
  1040. // .content_box {
  1041. // display: flex;
  1042. // }
  1043. // .content_box_tab {
  1044. // width: 220px;
  1045. // padding: 5px;
  1046. // height: 100vh;
  1047. // background-color: #fff;
  1048. // overflow-y: auto;
  1049. // border: 1px solid blue;
  1050. // }
  1051. .footBtn {
  1052. position: absolute;
  1053. bottom: 20px;
  1054. left: 0;
  1055. }
  1056. .new-ele-admin-tabs {
  1057. display: none !important;
  1058. }
  1059. .c_title {
  1060. color: #157a2c;
  1061. font-size: 16px;
  1062. font-weight: bold;
  1063. }
  1064. .tableZ_box {
  1065. border: 1px solid #e3e5e5;
  1066. margin: 6px 0;
  1067. &:last-child {
  1068. border-bottom: none;
  1069. }
  1070. .row {
  1071. width: 100%;
  1072. display: flex;
  1073. }
  1074. .col {
  1075. width: calc(100% / 5);
  1076. display: flex;
  1077. align-items: center;
  1078. min-width: 200px;
  1079. min-height: 32px;
  1080. border-bottom: 1px solid #e3e5e5;
  1081. border-right: 1px solid #e3e5e5;
  1082. &:last-child {
  1083. border-right: none;
  1084. }
  1085. .name {
  1086. display: flex;
  1087. align-items: center;
  1088. padding: 4px;
  1089. width: 80px;
  1090. height: 100%;
  1091. background-color: #d0e4d5;
  1092. color: #000;
  1093. }
  1094. .content {
  1095. padding: 4px 6px;
  1096. color: #000;
  1097. }
  1098. }
  1099. .pd6 {
  1100. padding: 0 6px;
  1101. }
  1102. }
  1103. </style>
  1104. <style lang="scss" scoped>
  1105. .seek-list {
  1106. display: flex;
  1107. height: 42px;
  1108. justify-content: space-between;
  1109. align-items: center;
  1110. padding: 10px 10px;
  1111. }
  1112. .right_main_box {
  1113. background-color: #fff;
  1114. height: 100%;
  1115. box-sizing: border-box;
  1116. }
  1117. .index_box {
  1118. padding: 10px;
  1119. padding-bottom: 0;
  1120. width: 100%;
  1121. box-sizing: border-box;
  1122. min-width: 1280px !important;
  1123. // height: calc(100vh - 60px);
  1124. // overflow-x: auto;
  1125. /* 当内容超出宽度时,允许水平滚动 */
  1126. white-space: nowrap;
  1127. /* 防止内部文本换行,确保所有内容都在一行显示 */
  1128. scrollbar-width: thin;
  1129. /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
  1130. scrollbar-color: #40a9ff transparent;
  1131. /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
  1132. }
  1133. .main {
  1134. width: 100%;
  1135. min-width: 1280px;
  1136. height: calc(100vh - 234px);
  1137. display: flex;
  1138. justify-content: space-between;
  1139. }
  1140. .left_main {
  1141. width: 100%;
  1142. height: 100%;
  1143. display: flex;
  1144. flex-direction: column;
  1145. justify-content: space-around;
  1146. // min-width: 640px;
  1147. .top {
  1148. width: 100%;
  1149. height: 100%;
  1150. overflow: auto;
  1151. }
  1152. // .bottom {
  1153. // width: 100%;
  1154. // min-height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
  1155. // overflow: hidden;
  1156. // }
  1157. }
  1158. ::v-deep .el-tabs__item.is-active {
  1159. background-color: #dffade;
  1160. /* 蓝色背景 */
  1161. color: #333;
  1162. }
  1163. ::v-deep .is-active {
  1164. color: #dffade;
  1165. }
  1166. .right_main {
  1167. width: 100%;
  1168. padding-bottom: 12px;
  1169. height: calc((100vh - 234px));
  1170. background: #f0f3f3;
  1171. border: 1px solid rgb(207, 215, 207);
  1172. }
  1173. .drawer_content {
  1174. margin: 5px 10px;
  1175. box-sizing: border-box;
  1176. .taskTitle {
  1177. display: flex;
  1178. width: 100%;
  1179. align-items: center;
  1180. flex-direction: row;
  1181. justify-content: center;
  1182. font-size: 16px;
  1183. color: green;
  1184. margin-bottom: 5px;
  1185. font-weight: bold;
  1186. }
  1187. }
  1188. ::v-deep .is-fullscreen {
  1189. width: 100vw !important;
  1190. height: 100vh !important;
  1191. overflow: hidden !important; /* 隐藏滚动条 */
  1192. }
  1193. ::v-deep .not-fullscreen {
  1194. width: calc(100vw - 230px) !important;
  1195. height: 100vh !important;
  1196. overflow: hidden !important; /* 隐藏滚动条 */
  1197. }
  1198. ::v-deep .active .is-text {
  1199. background: #ffa929; /* 背景色 */
  1200. border-color: #ffa929;
  1201. color: #ffffff; /* 图标文字颜色 */
  1202. }
  1203. ::v-deep .el-step__title {
  1204. line-height: 30px;
  1205. }
  1206. ::v-deep .el-tabs__content {
  1207. padding: 1px !important;
  1208. }
  1209. </style>