bottomOperate.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. <template>
  2. <view class="bottom_box">
  3. <!-- 按钮组 -->
  4. <view class="nav_box rx-cc" @click="open">
  5. <image
  6. class="open_icon"
  7. :class="{ open_icon_reversal: isOperate }"
  8. src="~@/static/pda/open.svg"
  9. ></image>
  10. </view>
  11. <!-- // 弹出框 -->
  12. <view class="operate_list" v-show="isOperate">
  13. <view v-if="clientEnvironmentId == 2">
  14. <view
  15. v-for="(item, index) in btnList[btnState]"
  16. :key="index"
  17. class="list rx-bc"
  18. @click="operate(item.type, item)"
  19. >
  20. <view class="round">{{ index + 1 }}</view>
  21. <view class="name">{{ item.name }}</view>
  22. <image
  23. class="arrow_right"
  24. src="~@/static/pda/arrow_right.svg"
  25. ></image>
  26. </view>
  27. </view>
  28. <view v-else>
  29. <view
  30. v-for="(item, index) in btnListOne[btnState]"
  31. :key="index"
  32. class="list rx-bc"
  33. @click="operate(item.type, item)"
  34. >
  35. <view class="round">{{ index + 1 }}</view>
  36. <view class="name">{{ item.name }}</view>
  37. <image
  38. class="arrow_right"
  39. src="~@/static/pda/arrow_right.svg"
  40. ></image>
  41. </view>
  42. </view>
  43. <!--
  44. <view v-if='btnControlReportMethod == 2' class="list rx-bc">
  45. <view class="round">{{btnList[btnState].length + 1}}</view>
  46. <view class="name" @click="operate('skip', {})" >跳过(不报工)</view>
  47. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  48. </view>
  49. -->
  50. <view
  51. v-if="newTaskObj.existOutsource == 1"
  52. class="list rx-bc"
  53. @click="operate('outPicking', {})"
  54. >
  55. <view class="round">{{ btnList[btnState].length + 1 }}</view>
  56. <view class="name">委外领料</view>
  57. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  58. </view>
  59. <!-- <view v-if="newTaskObj.existOutsource == 1" class="list rx-bc"
  60. @click="operate('jobBooking', { isOutsource: 1 })">
  61. <view class="round">{{ btnList[btnState].length + 2 }}</view>
  62. <view class="name">委外报工</view>
  63. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  64. </view> -->
  65. </view>
  66. <view class="btn_box">
  67. <view class="btn" @click="handPause()">{{
  68. GDStatus == 9 ? "取消暂停" : "暂停"
  69. }}</view>
  70. <view class="btn" @click="handTerminate()">终止</view>
  71. <view class="btn">转派</view>
  72. <view
  73. class="btn"
  74. :style="newTaskObj.existOutsource == 1 ? 'background: #FFA929' : ''"
  75. @click="handOutsource()"
  76. >委外</view
  77. >
  78. <view class="btn" @click="handHandover">交接</view>
  79. <view class="btn" @click="handError">异常</view>
  80. </view>
  81. <!-- //委外弹窗 -->
  82. <SearchPopup mode="center" v-if="outsourceShow">
  83. <template v-slot:list>
  84. <view class="popup_list">
  85. <view class="title">【{{ taskObj.currentTaskName }}】是否委外</view>
  86. <u-form
  87. labelPosition="left"
  88. :model="outsourceForm"
  89. labelWidth="180"
  90. labelAlign="left"
  91. class=""
  92. >
  93. <u-form-item label="委外名称:" borderBottom prop="name">
  94. <input
  95. class="uni-input"
  96. v-model="outsourceForm.name"
  97. placeholder="请输入委外名称"
  98. />
  99. </u-form-item>
  100. <u-form-item label="委外类型:" borderBottom prop="">
  101. <zxz-uni-data-select
  102. :localdata="typeList"
  103. v-model="outsourceForm.type"
  104. dataValue="id"
  105. dataKey="name"
  106. filterable
  107. format="{name}"
  108. ></zxz-uni-data-select>
  109. </u-form-item>
  110. <u-form-item label="委外数量:" borderBottom prop="formedNumLast">
  111. <input
  112. class="uni-input content_num"
  113. v-model="outsourceForm.formedNumLast"
  114. type="number"
  115. />
  116. </u-form-item>
  117. <u-form-item label="委外工序:" borderBottom prop="taskIdes">
  118. <zxz-uni-data-select
  119. :localdata="newStepsList"
  120. style="font-size: 15px"
  121. v-model="outsourceForm.taskIdes"
  122. dataValue="taskId"
  123. format="{taskTypeName}"
  124. dataKey="taskTypeName"
  125. multiple
  126. :clear="true"
  127. @change="changeTaskId"
  128. ></zxz-uni-data-select>
  129. </u-form-item>
  130. <u-form-item label="委外场景:" borderBottom prop="taskIdes">
  131. {{ sceneText }}
  132. </u-form-item>
  133. <u-form-item
  134. label="直接入库:"
  135. borderBottom
  136. prop="isInWarehouse"
  137. v-if="outsourceForm.isFirstTask != 1"
  138. >
  139. <!-- <u-checkbox-group v-model="isInWarehouse" size="15px" v-if="clientEnvironmentId != 2" >
  140. <u-checkbox labelSize="15px" iconSize="10px" activeColor="#157A2C" name="true"
  141. label="是" disabled></u-checkbox>
  142. </u-checkbox-group>
  143. <view style="font-size: 15px;" v-if="clientEnvironmentId == 2">是</view> -->
  144. <zxz-uni-data-select
  145. style="margin-left: 10px; font-size: 15px"
  146. v-if="clientEnvironmentId == 2 || isInWarehouse.length"
  147. :localdata="warehouseList"
  148. v-model="outsourceForm.warehouseId"
  149. dataValue="id"
  150. dataKey="name"
  151. filterable
  152. format="{name}"
  153. ></zxz-uni-data-select>
  154. </u-form-item>
  155. <u-form-item
  156. label="工艺路线:"
  157. borderBottom
  158. style="font-size: 15px"
  159. prop="produceRoutingId"
  160. v-if="
  161. clientEnvironmentId != 2 &&
  162. outsourceForm.isFirstTask != 1 &&
  163. isInWarehouse &&
  164. isInWarehouse.length == 0
  165. "
  166. >
  167. <zxz-uni-data-select
  168. :localdata="produceList"
  169. v-model="outsourceForm.produceRoutingId"
  170. dataValue="id"
  171. dataKey="name"
  172. filterable
  173. format="{name}"
  174. ></zxz-uni-data-select>
  175. </u-form-item>
  176. <u-form-item
  177. label="计划交期:"
  178. borderBottom
  179. prop="requireDeliveryTime"
  180. >
  181. <uni-datetime-picker
  182. type="datetime"
  183. v-model="outsourceForm.requireDeliveryTime"
  184. />
  185. </u-form-item>
  186. </u-form>
  187. </view>
  188. </template>
  189. <template v-slot:operate>
  190. <view class="operate_box rx-bc">
  191. <u-button size="small" class="u-reset-button" @click="outCancel">
  192. 取消
  193. </u-button>
  194. <u-button
  195. type="success"
  196. size="small"
  197. class="u-reset-button"
  198. @click="outsourceOk()"
  199. >
  200. 确定
  201. </u-button>
  202. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  203. 提交并发布
  204. </u-button> -->
  205. </view>
  206. </template>
  207. </SearchPopup>
  208. <!-- 异常弹窗 -->
  209. <SearchPopup mode="center" v-if="errorShow">
  210. <template v-slot:list>
  211. <view class="popup_list">
  212. <view class="title">异常信息</view>
  213. <u-form
  214. labelPosition="left"
  215. :model="errorForm"
  216. labelWidth="180"
  217. labelAlign="left"
  218. class=""
  219. >
  220. <u-form-item label="工单号:" borderBottom prop="code">
  221. <input
  222. class="uni-input content_num"
  223. v-model="info.code"
  224. disabled
  225. />
  226. </u-form-item>
  227. <u-form-item label="产品编码:" borderBottom prop="code">
  228. <input
  229. class="uni-input content_num"
  230. v-model="info.productCode"
  231. disabled
  232. />
  233. </u-form-item>
  234. <u-form-item label="产品名称:" borderBottom prop="code">
  235. <input
  236. class="uni-input content_num"
  237. v-model="info.productName"
  238. disabled
  239. />
  240. </u-form-item>
  241. <u-form-item label="异常类型:" borderBottom prop="type">
  242. <zxz-uni-data-select
  243. :localdata="errorTypeList"
  244. v-model="errorForm.type"
  245. dataValue="value"
  246. dataKey="label"
  247. filterable
  248. format="{label}"
  249. ></zxz-uni-data-select>
  250. </u-form-item>
  251. <u-form-item label="编码:" borderBottom prop="code">
  252. <input
  253. class="uni-input content_num"
  254. v-model="errorForm.code"
  255. disabled
  256. />
  257. </u-form-item>
  258. <u-form-item label="名称:" borderBottom prop="name">
  259. <input class="uni-input content_num" v-model="errorForm.name" />
  260. </u-form-item>
  261. <u-form-item label="异常描述:" borderBottom prop="name">
  262. <input
  263. type="textarea"
  264. class="content_num"
  265. v-model="errorForm.describes"
  266. />
  267. </u-form-item>
  268. </u-form>
  269. </view>
  270. <view class="photo_btn" @click="chooseImage">拍照</view>
  271. <view class="photo_list">
  272. <PreviewPhoto
  273. type="add"
  274. @imagedelete="imagedelete"
  275. :imageList="imageList"
  276. />
  277. </view>
  278. </template>
  279. <template v-slot:operate>
  280. <view class="operate_box rx-bc">
  281. <u-button size="small" class="u-reset-button" @click="errorCancel">
  282. 取消
  283. </u-button>
  284. <u-button
  285. type="success"
  286. size="small"
  287. class="u-reset-button"
  288. @click="errorOk()"
  289. >
  290. 确定
  291. </u-button>
  292. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  293. 提交并发布
  294. </u-button> -->
  295. </view>
  296. </template>
  297. </SearchPopup>
  298. <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
  299. <handover ref="handoverRef"></handover>
  300. </view>
  301. </template>
  302. <script>
  303. import {
  304. getTwoTreeByPid,
  305. checkOutsource,
  306. applyoutsourceSave,
  307. producerouting,
  308. getWarehouseList,
  309. updateStatusPause,
  310. updateStatusPauseRecover,
  311. updateStatusTerminate,
  312. } from "@/api/pda/workOrder.js";
  313. import SearchPopup from "./searchPopup.vue";
  314. import outsourceList from "./outsourceList.vue";
  315. import handover from "./handover.vue";
  316. import { EventBus } from "@/utils/eventBus.js";
  317. import { getByCode } from "@/api/pda/common.js";
  318. import PreviewPhoto from "@/pages/maintenance/check/components/PreviewPhoto.vue";
  319. export default {
  320. components: {
  321. SearchPopup,
  322. outsourceList,
  323. handover,
  324. PreviewPhoto,
  325. },
  326. props: {
  327. state: String | Number,
  328. gdStatus: String | Number,
  329. taskObj: Object,
  330. info: {
  331. type: Object,
  332. default: {},
  333. },
  334. controlReportMethod: String | Number,
  335. stepsList: {
  336. type: Array,
  337. default: () => [],
  338. },
  339. },
  340. watch: {
  341. btns: {
  342. immediate: true,
  343. deep: true,
  344. handler(newVal) {
  345. this.btnsList = [];
  346. this.btnsList = newVal;
  347. },
  348. },
  349. state: {
  350. immediate: true,
  351. deep: true,
  352. handler(newVal) {
  353. this.btnState = newVal;
  354. },
  355. },
  356. gdStatus: {
  357. immediate: true,
  358. deep: true,
  359. handler(newVal) {
  360. this.GDStatus = newVal;
  361. },
  362. },
  363. controlReportMethod: {
  364. immediate: true,
  365. deep: true,
  366. handler(newVal) {
  367. this.btnControlReportMethod = newVal;
  368. },
  369. },
  370. taskObj: {
  371. immediate: true,
  372. deep: true,
  373. handler(newVal) {
  374. this.newTaskObj = newVal;
  375. },
  376. },
  377. stepsList: {
  378. immediate: true,
  379. deep: true,
  380. handler(newVal) {},
  381. },
  382. },
  383. data() {
  384. return {
  385. isOperate: false,
  386. sceneText: "",
  387. outsourceScene: null,
  388. btnsList: [],
  389. btnState: 1,
  390. GDStatus: null,
  391. btnControlReportMethod: null,
  392. btnList: {
  393. 1: [
  394. {
  395. name: "领料",
  396. type: "picking",
  397. },
  398. {
  399. name: "投料",
  400. type: "feeding",
  401. },
  402. {
  403. name: "更换周转车",
  404. type: "turnover",
  405. },
  406. {
  407. name: "报工",
  408. type: "jobBooking",
  409. isOutsource: 0,
  410. },
  411. // {
  412. // name: '多工单报工',
  413. // type: ''
  414. // }
  415. ],
  416. 2: [
  417. {
  418. name: "取样",
  419. type: "sample",
  420. },
  421. {
  422. name: "报工",
  423. type: "sampleJob",
  424. },
  425. ],
  426. 3: [
  427. {
  428. name: "更换周转车",
  429. type: "qualityTurnover",
  430. },
  431. {
  432. name: "质检",
  433. type: "inspection",
  434. },
  435. {
  436. name: "报工",
  437. type: "inspectionJob",
  438. },
  439. ],
  440. 4: [
  441. {
  442. name: "领料",
  443. type: "picking",
  444. },
  445. {
  446. name: "投料",
  447. type: "feeding",
  448. },
  449. {
  450. name: "报工",
  451. type: "jobBooking",
  452. },
  453. ],
  454. 5: [
  455. {
  456. name: "入库",
  457. type: "warehousing",
  458. },
  459. ],
  460. 6: [
  461. {
  462. name: "报工",
  463. type: "jobBooking",
  464. },
  465. ],
  466. },
  467. btnListOne: {
  468. 1: [
  469. {
  470. name: "领料",
  471. type: "picking",
  472. },
  473. {
  474. name: "投料",
  475. type: "feeding",
  476. },
  477. {
  478. name: "报工",
  479. type: "jobBooking",
  480. isOutsource: 0,
  481. },
  482. // {
  483. // name: '多工单报工',
  484. // type: ''
  485. // }
  486. ],
  487. 2: [
  488. {
  489. name: "取样",
  490. type: "sample",
  491. },
  492. {
  493. name: "报工",
  494. type: "sampleJob",
  495. },
  496. ],
  497. 3: [
  498. {
  499. name: "质检",
  500. type: "inspection",
  501. },
  502. {
  503. name: "报工",
  504. type: "inspectionJob",
  505. },
  506. ],
  507. 4: [
  508. {
  509. name: "领料",
  510. type: "picking",
  511. },
  512. {
  513. name: "投料",
  514. type: "feeding",
  515. },
  516. {
  517. name: "报工",
  518. type: "jobBooking",
  519. },
  520. ],
  521. 5: [
  522. {
  523. name: "入库",
  524. type: "warehousing",
  525. },
  526. ],
  527. 6: [
  528. {
  529. name: "报工",
  530. type: "jobBooking",
  531. },
  532. ],
  533. 99: [
  534. {
  535. name: "领料",
  536. type: "picking",
  537. },
  538. {
  539. name: "投料",
  540. type: "feeding",
  541. },
  542. {
  543. name: "报工",
  544. type: "jobBooking",
  545. isOutsource: 0,
  546. },
  547. ],
  548. },
  549. errorShow: false,
  550. sceneText: "",
  551. outsourceScene: null,
  552. newTaskObj: {},
  553. outsourceShow: false,
  554. outsourceForm: {},
  555. produceList: [],
  556. warehouseList: [],
  557. typeList: [
  558. {
  559. id: 4,
  560. name: "带料生产委外",
  561. },
  562. {
  563. id: 5,
  564. name: "不带料生产委外",
  565. },
  566. ],
  567. errorTypeList: [],
  568. errorForm: {},
  569. newStepsList: [],
  570. clientEnvironmentId:
  571. uni.getStorageSync("userInfo") &&
  572. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  573. isInWarehouse: [1],
  574. imageList: [],
  575. };
  576. },
  577. created() {
  578. this.getTypeList("Exception_type");
  579. },
  580. methods: {
  581. imagedelete(index) {
  582. this.imageList.splice(index, 1);
  583. },
  584. getImageData() {
  585. return this.imageList || [];
  586. },
  587. // *** 新增拍照
  588. chooseImage() {
  589. const _this = this;
  590. if (_this.imageList.length >= 9) {
  591. _this.$refs.uToast.show({
  592. type: "warning",
  593. message: "最多上传9张照片",
  594. });
  595. return;
  596. }
  597. uni.chooseImage({
  598. count: 9, //默认9
  599. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  600. sourceType: ["camera"], //从相册选择
  601. success: function (res) {
  602. uni.showLoading({
  603. title: "上传中",
  604. });
  605. _this
  606. .uploadFile(res.tempFilePaths)
  607. .then((res) => {
  608. res.forEach((item) => {
  609. let fileNames = item.storePath.split("/");
  610. let url =
  611. _this.apiUrl +
  612. "/main/file/getFile?objectName=" +
  613. item.storePath +
  614. "&fullfilename=" +
  615. fileNames[fileNames.length - 1];
  616. let images = _this.imageList;
  617. // 不能存储超过 9 张
  618. if (images.length < 9) {
  619. _this.imageList.push(url);
  620. }
  621. });
  622. uni.hideLoading();
  623. })
  624. .catch((error) => {
  625. console.log(error, "errorerrorerror");
  626. uni.hideLoading();
  627. });
  628. },
  629. });
  630. },
  631. uploadFile(list) {
  632. let PromiseAll = [];
  633. const apiUrl = this.apiUrl;
  634. const token = uni.getStorageSync("token"); //取存本地的token
  635. list.forEach((item) => {
  636. PromiseAll.push(
  637. new Promise((resolve, reject) => {
  638. uni.uploadFile({
  639. url: apiUrl + "/main/file/upload",
  640. filePath: item,
  641. name: "multiPartFile",
  642. header: {
  643. authorization: token,
  644. },
  645. success: (uploadFileRes) => {
  646. if (uploadFileRes.statusCode == 500) {
  647. uni.hideLoading();
  648. return;
  649. }
  650. let data = JSON.parse(uploadFileRes.data);
  651. resolve(data.data);
  652. },
  653. fail: (err) => {
  654. console.log(err, "123456");
  655. // 上传请求本身失败(如网络问题等),直接 reject
  656. uni.hideLoading();
  657. reject(err);
  658. },
  659. });
  660. })
  661. );
  662. });
  663. return Promise.all(PromiseAll);
  664. },
  665. // 委外时间选择
  666. //委外到 类型选择
  667. changeTaskId(e) {
  668. console.log(this.outsourceForm, e);
  669. // if (this.newStepsList.length) {
  670. if (this.outsourceForm.taskIdes.length != 0) {
  671. if (this.outsourceForm.taskIdes.length == 1) {
  672. this.sceneText = "单工序";
  673. this.outsourceForm.outsourceScene = 2;
  674. } else {
  675. this.sceneText = "多工序";
  676. this.outsourceForm.outsourceScene = 3;
  677. }
  678. // const id = this.newStepsList[0].sourceTaskId;
  679. // //isFirstTask 1是首工序 0不是
  680. // if (this.outsourceForm.isFirstTask) {
  681. // this.sceneText = "首工序";
  682. // this.outsourceForm.outsourceScene = 1;
  683. // if (e.sourceTaskId !== id) {
  684. // this.sceneText = "首工序及多工序";
  685. // this.outsourceForm.outsourceScene = 4;
  686. // }
  687. // } else {
  688. // if (e.sourceTaskId === id) {
  689. // // 单工序
  690. // this.sceneText = "单工序";
  691. // this.outsourceForm.outsourceScene = 2;
  692. // } else {
  693. // //多工序
  694. // this.sceneText = "多工序";
  695. // this.outsourceForm.outsourceScene = 3;
  696. // }
  697. // }
  698. } else {
  699. uni.showToast({
  700. title: "委外到工序为空",
  701. icon: "none",
  702. });
  703. }
  704. },
  705. async getTypeList(code) {
  706. const res = await getByCode(code);
  707. const list = [];
  708. if (res.length) {
  709. res.map((item, index) => {
  710. for (var key in res[index]) {
  711. list.push({
  712. label: res[index][key],
  713. value: key,
  714. });
  715. }
  716. });
  717. }
  718. this.errorTypeList = list;
  719. },
  720. open() {
  721. this.isOperate = !this.isOperate;
  722. },
  723. errorCancel() {
  724. this.errorShow = false;
  725. },
  726. errorOk() {
  727. if (!this.errorForm.type) {
  728. uni.showToast({
  729. title: "请选择异常类型",
  730. icon: "none",
  731. });
  732. return false;
  733. }
  734. if (!this.errorForm.name) {
  735. uni.showToast({
  736. title: "请输入名称",
  737. icon: "none",
  738. });
  739. return false;
  740. }
  741. this.errorShow = false;
  742. },
  743. operate(type, item) {
  744. this.$emit("operate", type, item);
  745. },
  746. handOutsource() {
  747. let param = {
  748. taskId: this.newTaskObj.currentTaskId,
  749. workOrderId: this.newTaskObj.workOrderId,
  750. };
  751. checkOutsource(param).then((res) => {
  752. this.outsourceForm = {
  753. ...res,
  754. };
  755. this.outsourceForm.name = this.taskObj.currentTaskName + "委外";
  756. this.outsourceForm.taskIdes = [];
  757. if (res.outsource) {
  758. this.getNewSteps();
  759. this.outsourceShow = true;
  760. this.produceFn();
  761. this.getWarehouseFn();
  762. } else {
  763. uni.showToast({
  764. title: "此工序不能委外",
  765. icon: "none",
  766. });
  767. }
  768. });
  769. },
  770. handPause() {
  771. if (this.GDStatus == 9) {
  772. uni.showModal({
  773. title: "提示",
  774. content: "确定该工单取消暂停?",
  775. success: async (res) => {
  776. if (res.confirm) {
  777. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(
  778. (res) => {
  779. this.$emit("refresh");
  780. }
  781. );
  782. }
  783. },
  784. });
  785. } else {
  786. uni.showModal({
  787. title: "提示",
  788. content: "确定该工单暂停?",
  789. success: async (res) => {
  790. if (res.confirm) {
  791. updateStatusPause([this.newTaskObj.workOrderId]).then((res) => {
  792. this.$emit("refresh");
  793. });
  794. }
  795. },
  796. });
  797. }
  798. },
  799. handHandover() {
  800. this.$refs.handoverRef.open();
  801. },
  802. handTerminate() {
  803. uni.showModal({
  804. title: "提示",
  805. content: "确定该工单终止?",
  806. success: async (res) => {
  807. if (res.confirm) {
  808. updateStatusTerminate([this.newTaskObj.workOrderId]).then((res) => {
  809. this.$emit("refresh");
  810. });
  811. }
  812. },
  813. });
  814. },
  815. outCancel() {
  816. this.sceneText = ""; //委外场景
  817. this.outsourceForm.outsourceScene = null;
  818. this.outsourceShow = false;
  819. EventBus.$off("outEvent");
  820. },
  821. getNewSteps() {
  822. this.activeIndex = this.getIndexOfElementInArray(
  823. this.stepsList,
  824. this.newTaskObj.currentTaskId
  825. );
  826. this.newStepsList = [];
  827. this.stepsList.forEach((f, i) => {
  828. if (f.taskId != "-2" && i >= this.activeIndex) {
  829. if (this.clientEnvironmentId == 3) {
  830. if (f.type != 6) {
  831. this.newStepsList.push(f);
  832. }
  833. } else {
  834. this.newStepsList.push(f);
  835. }
  836. }
  837. });
  838. },
  839. getIndexOfElementInArray(array, target) {
  840. for (let i = 0; i < array.length; i++) {
  841. if (array[i].taskId === target) {
  842. return i; // 返回第一次出现target的索引位置
  843. }
  844. }
  845. return -1; // 未找到目标值时返回-1
  846. },
  847. // 工艺路线
  848. produceFn() {
  849. let param = {
  850. pageNum: 1,
  851. size: -1,
  852. routeType: 2,
  853. };
  854. producerouting(param).then((res) => {
  855. this.produceList = res.list;
  856. });
  857. },
  858. // 仓库
  859. getWarehouseFn() {
  860. getWarehouseList().then((res) => {
  861. this.warehouseList = res;
  862. });
  863. },
  864. handError() {
  865. console.log(this.info, "taskObj");
  866. this.errorShow = true;
  867. },
  868. outsourceOk() {
  869. if (!this.outsourceForm.name) {
  870. uni.showToast({
  871. title: "请输入委外名称",
  872. icon: "none",
  873. });
  874. return false;
  875. }
  876. if (!this.outsourceForm.type) {
  877. uni.showToast({
  878. title: "请选择委外类型",
  879. icon: "none",
  880. });
  881. return false;
  882. }
  883. if (!this.outsourceForm.formedNumLast) {
  884. uni.showToast({
  885. title: "委外数量不能为空",
  886. icon: "none",
  887. });
  888. return false;
  889. }
  890. if (this.outsourceForm.taskIdes.length == 0) {
  891. uni.showToast({
  892. title: "请选择委外工序",
  893. icon: "none",
  894. });
  895. return false;
  896. }
  897. if (!this.outsourceForm.requireDeliveryTime) {
  898. uni.showToast({
  899. title: "请选择委外完成时间",
  900. icon: "none",
  901. });
  902. return false;
  903. }
  904. if (this.clientEnvironmentId == 2) {
  905. this.outsourceForm.isInWarehouse = 1;
  906. } else {
  907. this.isInWarehouse.length > 0
  908. ? (this.outsourceForm.isInWarehouse = 1)
  909. : (this.outsourceForm.isInWarehouse = 0);
  910. }
  911. if (this.outsourceForm.requireDeliveryTime.indexOf("00:00:00") === -1) {
  912. this.outsourceForm.requireDeliveryTime =
  913. this.outsourceForm.requireDeliveryTime + "00:00:00";
  914. }
  915. const taskIds = this.outsourceForm.taskIdes.join(",");
  916. let param = {
  917. ...this.outsourceForm,
  918. taskId: this.newTaskObj.currentTaskId,
  919. workOrderId: this.newTaskObj.workOrderId,
  920. taskIds,
  921. };
  922. console.log(param);
  923. this.sceneText = ""; //委外场景
  924. this.outsourceForm.outsourceScene = null;
  925. this.$refs.outsourceListRef.open(param);
  926. // let param = {
  927. // ...this.outsourceForm,
  928. // taskId: this.newTaskObj.currentTaskId,
  929. // workOrderId: this.newTaskObj.workOrderId,
  930. // isRelease: isRelease
  931. // }
  932. // applyoutsourceSave(param).then(res => {
  933. // console.log(res)
  934. // this.outCancel()
  935. // })
  936. },
  937. },
  938. };
  939. </script>
  940. <style lang="scss" scoped>
  941. .bottom_box {
  942. background: #fff;
  943. }
  944. .nav_box {
  945. width: 750rpx;
  946. height: 40rpx;
  947. background: $theme-color;
  948. .open_icon {
  949. width: 48rpx;
  950. height: 48rpx;
  951. }
  952. .open_icon_reversal {
  953. transform: scaleY(-1);
  954. /* 垂直翻转 */
  955. }
  956. }
  957. .operate_list {
  958. margin: 0 32rpx;
  959. .list {
  960. border-radius: 8rpx;
  961. border: 1rpx solid $theme-color;
  962. background: #f0f8f2;
  963. height: 64rpx;
  964. padding: 0rpx 16rpx;
  965. margin-top: 16rpx;
  966. }
  967. .round {
  968. width: 32rpx;
  969. height: 32rpx;
  970. line-height: 32rpx;
  971. text-align: center;
  972. border-radius: 50%;
  973. background: $theme-color;
  974. font-size: 24rpx;
  975. font-style: normal;
  976. font-weight: 400;
  977. color: #fff;
  978. }
  979. .name {
  980. font-family: PingFang HK;
  981. font-size: 24rpx;
  982. font-style: normal;
  983. font-weight: 600;
  984. color: $theme-color;
  985. }
  986. .arrow_right {
  987. width: 32rpx;
  988. height: 32rpx;
  989. }
  990. }
  991. .btn_box {
  992. display: flex;
  993. padding: 16rpx 32rpx;
  994. align-items: flex-start;
  995. gap: 16rpx;
  996. align-self: stretch;
  997. .btn {
  998. width: 160rpx;
  999. height: 64rpx;
  1000. line-height: 64rpx;
  1001. background: $theme-color;
  1002. text-align: center;
  1003. border-radius: 8rpx;
  1004. color: #fff;
  1005. font-family: PingFang HK;
  1006. font-size: 24rpx;
  1007. font-style: normal;
  1008. font-weight: 600;
  1009. }
  1010. }
  1011. .operate_box {
  1012. padding: 10rpx 20rpx;
  1013. /deep/ .u-button {
  1014. width: 180rpx;
  1015. }
  1016. }
  1017. .popup_list {
  1018. width: 78vw;
  1019. min-height: 360rpx;
  1020. padding: 0 32rpx;
  1021. .title {
  1022. color: #333;
  1023. font-size: 32rpx;
  1024. text-align: center;
  1025. padding: 30rpx;
  1026. }
  1027. }
  1028. .list_item_btn {
  1029. width: 160rpx;
  1030. height: 54rpx;
  1031. line-height: 54rpx;
  1032. background: $theme-color;
  1033. text-align: center;
  1034. border-radius: 8rpx;
  1035. color: #fff;
  1036. font-family: PingFang HK;
  1037. font-size: 22rpx;
  1038. font-style: normal;
  1039. font-weight: 600;
  1040. }
  1041. .content_num {
  1042. display: flex;
  1043. align-items: center;
  1044. padding: 0 4rpx;
  1045. /deep/ .uni-input-input {
  1046. border: 2rpx solid #f0f8f2;
  1047. background: #f0f8f2;
  1048. color: $theme-color;
  1049. }
  1050. }
  1051. .photo_btn {
  1052. background-color: #157a2c;
  1053. width: 140rpx;
  1054. height: 60rpx;
  1055. line-height: 60rpx;
  1056. font-size: 24rpx;
  1057. color: #fff;
  1058. text-align: center;
  1059. border-radius: 8rpx;
  1060. margin-bottom: 12rpx;
  1061. display: inline-block;
  1062. }
  1063. </style>