workReport.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  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 (t == 'feed') {
  713. if (!this.$store.state.user.info.workCenterIds) {
  714. return this.$message.warning('该用户没有权限投料');
  715. }
  716. const isWorkCenter =
  717. this.$store.state.user.info.workCenterIds.includes(
  718. this.taskObj.workCenterId
  719. );
  720. if (!isWorkCenter) {
  721. return this.$message.warning('该用户没有权限投料');
  722. }
  723. }
  724. this.isFinalCheckProduction = true;
  725. if (this.workListIds.length == 0) {
  726. this.$message.warning('请选择工单列表');
  727. return false;
  728. }
  729. }
  730. // console.log('按钮被点击了.....', t);
  731. if (t === 'job') {
  732. let req = {
  733. taskId: this.taskObj.id,
  734. workOrderId: this.workListIds[0],
  735. data: [this.workOrderInfo]
  736. };
  737. if (!this.$store.state.user.info.workCenterIds) {
  738. return this.$message.warning('该用户没有权限报工');
  739. }3
  740. const isWorkCenter =
  741. this.$store.state.user.info.workCenterIds.includes(
  742. this.taskObj.workCenterId
  743. );
  744. if (!isWorkCenter) {
  745. return this.$message.warning('该用户没有权限报工');
  746. }
  747. // let resultValue = '0';
  748. // await parameterGetByCode({
  749. // code: 'first_article_dual_inspection_for_report'
  750. // }).then((res) => {
  751. // resultValue = res.value;
  752. // });
  753. // if (resultValue == '1') {
  754. // this.isFinalCheckProduction = false;
  755. // if (this.taskObj.id != '-1') {
  756. // const result = await this.checkQualityResult();
  757. // if (!result) return;
  758. // const firstArticleResult =
  759. // result.firstArticleDualInspectionResult ?? true;
  760. // this.isFinalCheckProduction = firstArticleResult;
  761. // if (!firstArticleResult) {
  762. // return this.$message.warning('请完成首件两检再报工!');
  763. // }
  764. // }
  765. // this.isFinalCheckProduction = true;
  766. this.isFinalCheckProduction = false;
  767. if (this.taskObj.id != '-1') {
  768. const result = await this.checkQualityResult();
  769. if (!result) return;
  770. const firstArticleResult =
  771. result.firstArticleDualInspectionResult ?? true;
  772. if (!firstArticleResult) {
  773. this.$message.warning('请完成首件两检再报工!');
  774. return;
  775. }
  776. }
  777. this.isFinalCheckProduction = true;
  778. // }
  779. if (
  780. this.taskObj.type == 2 ||
  781. this.taskObj.type == 3 ||
  782. this.taskObj.type == 6
  783. ) {
  784. // this.$refs.jobRefs.open(req);
  785. this.getCodeData(req);
  786. }
  787. }
  788. if (t == 'pick') {
  789. this.$nextTick(() => {
  790. this.$refs.pickListRef.getList(this.workListIds);
  791. });
  792. }
  793. // 工步
  794. if (t === 'workStep') {
  795. if (this.workListIds.length > 1) {
  796. return this.$message.warning('工步只能选择一个工单!');
  797. }
  798. this.$refs.workStepRef.open(this.workStepQueryParam);
  799. // let req = {
  800. // taskId: this.taskObj.id,
  801. // workOrderId: this.workListIds[0]
  802. // };
  803. // this.$refs.wokePopupRef.open(req);
  804. }
  805. if (t === 'task') {
  806. if (this.workListIds.length > 1) {
  807. return this.$message.warning('任务只能选择一个工单!');
  808. }
  809. this.$refs.taskDialogRef.open(
  810. this.workStepQueryParam,
  811. this.workOrderInfo
  812. );
  813. }
  814. if (t === 'error') {
  815. if (this.workListIds.length > 1) {
  816. return this.$message.warning('异常只能选择一个工单!');
  817. }
  818. // console.log(this.workListIds, 'this.workListIds');
  819. this.$refs.createErrorRef.open('add', this.workOrderInfo);
  820. }
  821. // 工艺路线 *** 修改 判断只能选择一个
  822. // if (t === 'work') {
  823. // let req = {
  824. // taskId: this.taskObj.id,
  825. // workOrderId: this.workListIds[0]
  826. // };
  827. // this.$refs.wokePopupRef.open(req);
  828. // }
  829. if (t === 'work') {
  830. if (this.workListIds.length > 1) {
  831. return this.$message.warning('工艺文件只能选择一个工单!');
  832. }
  833. let req = {
  834. taskId: this.taskObj.id,
  835. workOrderId: this.workListIds[0]
  836. };
  837. this.$refs.wokePopupRef.open(req);
  838. }
  839. if (t == 'feed') {
  840. }
  841. // 委外
  842. if (t == 'Outsourcing') {
  843. if (this.workListIds.length > 1) {
  844. return this.$message.warning('委外工序只能选择一个工单!');
  845. } else if (this.workListIds.length < 1)
  846. return this.$message.warning('请选择工单!');
  847. else {
  848. // /
  849. this.handOutsource(this.workListIds[0]);
  850. }
  851. }
  852. if (t == 'qualityInspection') {
  853. if (this.workListIds.length < 1) {
  854. return this.$message.warning('请选择工单!');
  855. }
  856. if (this.workListIds.length > 1) {
  857. return this.$message.warning('首件两检只能选择一个工单!');
  858. }
  859. this.$refs.qualityInspectionRef.open(
  860. this.workOrderInfo,
  861. this.taskObj
  862. );
  863. }
  864. },
  865. handIdx(index, item) {
  866. console.log(this.routeList, 'routeList');
  867. console.log(index, item, 'handIdx');
  868. if (item.count > 0 || index == this.desIndex) {
  869. this.taskId = item.taskId;
  870. } else {
  871. if (item.taskId != -2) {
  872. this.$message.info('还未执行到此工序');
  873. return;
  874. }
  875. }
  876. this.curTaskObj = JSON.parse(JSON.stringify(item));
  877. console.log(item, 'item');
  878. this.feedNeedEquipment = item.feedNeedEquipment;
  879. this.reportNeedFeed = item.reportNeedFeed;
  880. let obj = {
  881. 1: `${item.taskTypeName}(普通工序)`,
  882. 3: `${item.taskTypeName}(质检工序)`,
  883. 4: `${item.taskTypeName}(包装工序)`,
  884. 5: `${item.taskTypeName}(入库工序)`,
  885. 6: `${item.taskTypeName}(质检工序)`
  886. };
  887. this.title = obj[item.type] || '';
  888. this.type = item.type;
  889. let taskObj = {};
  890. taskObj = this.routeList.find((e) => e.taskId === item.taskId);
  891. taskObj.id = taskObj.sourceTaskId;
  892. taskObj.isOrderListData = true;
  893. if (taskObj.taskId != 2) {
  894. this.$store.commit('user/setTaskObj', taskObj);
  895. this.workListIds = [this.workOrderInfo.id];
  896. }
  897. // if (item.taskId == -2) {
  898. // this.$message.info('完结状态不能点击');
  899. // return;
  900. // } else {
  901. // this.desIndex = index;
  902. // this.newId = this.routeList[this.desIndex].taskId || '';
  903. // this.getTaskName(this.workOrderInfo);
  904. // }
  905. if (item.taskId != -2) {
  906. this.desIndex = index;
  907. this.newId = this.routeList[this.desIndex].taskId || '';
  908. this.getTaskName(this.workOrderInfo);
  909. }
  910. },
  911. outsourcingAdd(type, activeName) {
  912. this.chooseType = activeName;
  913. this.getTaskInstanceByIdFn(this.workListIds[0]);
  914. // this.isStep = true;
  915. this.workInfoList = { list: [] };
  916. this.workInfoList.list.push(this.workData);
  917. if (this.chooseType == '2') {
  918. this.isStep = true;
  919. } else {
  920. this.isOutsource = true;
  921. }
  922. },
  923. async handOutsource(workOrderId) {
  924. this.isType = '';
  925. // return
  926. let param = {
  927. taskId: this.taskObj.id,
  928. workOrderId: workOrderId
  929. };
  930. await pcCheckOutsource(param).then((res) => {
  931. this.outsourceForm = {
  932. ...res.data
  933. };
  934. this.isStep = false;
  935. this.isOutsource = false;
  936. this.isPleaseEntrust = false;
  937. // this.outsourceForm.name = this.taskObj.taskTypeName + '委外';
  938. if (res.data.outsource) {
  939. this.isType = '3';
  940. // this.getTaskInstanceByIdFn(workOrderId);
  941. if (!this.isStep && !this.isOutsource && !this.isPleaseEntrust) {
  942. this.$nextTick(() => {
  943. this.$refs.outsourcingListRef.getDataList(this.workData.code);
  944. });
  945. }
  946. // console.log(
  947. // this.$refs.outsourcingListRef,
  948. // 'this.$refs.outsourcingListRef'
  949. // );
  950. // this.$refs.outsourcingListRef.getDataList(this.workData.code);
  951. } else {
  952. return this.$message.warning('此工序不能委外');
  953. }
  954. });
  955. },
  956. closeWorkPlan(type) {
  957. this.workPlanType = type;
  958. },
  959. refreshPlease() {
  960. this.$nextTick(() => {
  961. this.$refs.outsourcingListRef.getPleaseData(
  962. this.workData.list[0].code
  963. );
  964. });
  965. },
  966. //获取工单列表
  967. getTaskInstanceByIdFn(workOrderId) {
  968. getTaskInstanceById(workOrderId).then((res) => {
  969. let { data } = res;
  970. if (data.length) {
  971. data = data.filter(
  972. (item) => item.taskId != -2 && item.taskId != -1
  973. );
  974. let arr = data.findIndex(
  975. (item) => item.sourceTaskId == this.taskObj.id
  976. );
  977. if (arr != -1) {
  978. data.splice(0, arr);
  979. }
  980. this.$set(this.outsourceForm, 'newStepsList', data);
  981. }
  982. });
  983. },
  984. pickAdd() {
  985. this.pickingShow = true;
  986. },
  987. // 关闭领料弹窗
  988. pickingClose(val) {
  989. if (val) {
  990. this.$nextTick(() => {
  991. this.$refs.pickListRef.getList(this.workListIds);
  992. });
  993. }
  994. this.pickingShow = false;
  995. },
  996. rowClick(row, taskId) {
  997. if (taskId) {
  998. let params = {
  999. categoryId: row.categoryId,
  1000. taskId: taskId
  1001. };
  1002. getByTaskId(params).then((res) => {
  1003. this.BomObj = res.data;
  1004. this.$forceUpdate();
  1005. });
  1006. }
  1007. }
  1008. },
  1009. mounted() {
  1010. this.$nextTick(() => {
  1011. const targetElements =
  1012. document.getElementsByClassName('ele-admin-tabs');
  1013. if (targetElements.length > 0) {
  1014. // 遍历所有具有 'ele-admin-tabs' 类的元素
  1015. Array.from(targetElements).forEach((element) => {
  1016. // 对每个元素添加 'new-ele-admin-tabs' 类
  1017. element.classList.add('new-ele-admin-tabs');
  1018. });
  1019. }
  1020. });
  1021. },
  1022. destroyed() {
  1023. this.$nextTick(() => {
  1024. const targetElements =
  1025. document.getElementsByClassName('ele-admin-tabs');
  1026. if (targetElements.length > 0) {
  1027. Array.from(targetElements).forEach((element) => {
  1028. element.classList.remove('new-ele-admin-tabs');
  1029. });
  1030. }
  1031. });
  1032. }
  1033. };
  1034. </script>
  1035. <style lang="scss" scoped>
  1036. // .content_box {
  1037. // display: flex;
  1038. // }
  1039. // .content_box_tab {
  1040. // width: 220px;
  1041. // padding: 5px;
  1042. // height: 100vh;
  1043. // background-color: #fff;
  1044. // overflow-y: auto;
  1045. // border: 1px solid blue;
  1046. // }
  1047. .footBtn {
  1048. position: absolute;
  1049. bottom: 20px;
  1050. left: 0;
  1051. }
  1052. .new-ele-admin-tabs {
  1053. display: none !important;
  1054. }
  1055. .c_title {
  1056. color: #157a2c;
  1057. font-size: 16px;
  1058. font-weight: bold;
  1059. }
  1060. .tableZ_box {
  1061. border: 1px solid #e3e5e5;
  1062. margin: 6px 0;
  1063. &:last-child {
  1064. border-bottom: none;
  1065. }
  1066. .row {
  1067. width: 100%;
  1068. display: flex;
  1069. }
  1070. .col {
  1071. width: calc(100% / 5);
  1072. display: flex;
  1073. align-items: center;
  1074. min-width: 200px;
  1075. min-height: 32px;
  1076. border-bottom: 1px solid #e3e5e5;
  1077. border-right: 1px solid #e3e5e5;
  1078. &:last-child {
  1079. border-right: none;
  1080. }
  1081. .name {
  1082. display: flex;
  1083. align-items: center;
  1084. padding: 4px;
  1085. width: 80px;
  1086. height: 100%;
  1087. background-color: #d0e4d5;
  1088. color: #000;
  1089. }
  1090. .content {
  1091. padding: 4px 6px;
  1092. color: #000;
  1093. }
  1094. }
  1095. .pd6 {
  1096. padding: 0 6px;
  1097. }
  1098. }
  1099. </style>
  1100. <style lang="scss" scoped>
  1101. .seek-list {
  1102. display: flex;
  1103. height: 42px;
  1104. justify-content: space-between;
  1105. align-items: center;
  1106. padding: 10px 10px;
  1107. }
  1108. .right_main_box {
  1109. background-color: #fff;
  1110. height: 100%;
  1111. box-sizing: border-box;
  1112. }
  1113. .index_box {
  1114. padding: 10px;
  1115. padding-bottom: 0;
  1116. width: 100%;
  1117. box-sizing: border-box;
  1118. min-width: 1280px !important;
  1119. // height: calc(100vh - 60px);
  1120. // overflow-x: auto;
  1121. /* 当内容超出宽度时,允许水平滚动 */
  1122. white-space: nowrap;
  1123. /* 防止内部文本换行,确保所有内容都在一行显示 */
  1124. scrollbar-width: thin;
  1125. /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
  1126. scrollbar-color: #40a9ff transparent;
  1127. /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
  1128. }
  1129. .main {
  1130. width: 100%;
  1131. min-width: 1280px;
  1132. height: calc(100vh - 234px);
  1133. display: flex;
  1134. justify-content: space-between;
  1135. }
  1136. .left_main {
  1137. width: 100%;
  1138. height: 100%;
  1139. display: flex;
  1140. flex-direction: column;
  1141. justify-content: space-around;
  1142. // min-width: 640px;
  1143. .top {
  1144. width: 100%;
  1145. height: 100%;
  1146. overflow: auto;
  1147. }
  1148. // .bottom {
  1149. // width: 100%;
  1150. // min-height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
  1151. // overflow: hidden;
  1152. // }
  1153. }
  1154. ::v-deep .el-tabs__item.is-active {
  1155. background-color: #dffade;
  1156. /* 蓝色背景 */
  1157. color: #333;
  1158. }
  1159. ::v-deep .is-active {
  1160. color: #dffade;
  1161. }
  1162. .right_main {
  1163. width: 100%;
  1164. padding-bottom: 12px;
  1165. height: calc((100vh - 234px));
  1166. background: #f0f3f3;
  1167. border: 1px solid rgb(207, 215, 207);
  1168. }
  1169. .drawer_content {
  1170. margin: 5px 10px;
  1171. box-sizing: border-box;
  1172. .taskTitle {
  1173. display: flex;
  1174. width: 100%;
  1175. align-items: center;
  1176. flex-direction: row;
  1177. justify-content: center;
  1178. font-size: 16px;
  1179. color: green;
  1180. margin-bottom: 5px;
  1181. font-weight: bold;
  1182. }
  1183. }
  1184. ::v-deep .is-fullscreen {
  1185. width: 100vw !important;
  1186. height: 100vh !important;
  1187. overflow: hidden !important; /* 隐藏滚动条 */
  1188. }
  1189. ::v-deep .not-fullscreen {
  1190. width: calc(100vw - 230px) !important;
  1191. height: 100vh !important;
  1192. overflow: hidden !important; /* 隐藏滚动条 */
  1193. }
  1194. ::v-deep .active .is-text {
  1195. background: #ffa929; /* 背景色 */
  1196. border-color: #ffa929;
  1197. color: #ffffff; /* 图标文字颜色 */
  1198. }
  1199. ::v-deep .el-step__title {
  1200. line-height: 30px;
  1201. }
  1202. ::v-deep .el-tabs__content {
  1203. padding: 1px !important;
  1204. }
  1205. </style>