bottomOperate.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  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
  262. label="异常描述:"
  263. borderBottom
  264. prop="describes"
  265. :labelStyle="{ alignSelf: 'flex-start', paddingTop: '12rpx' }"
  266. >
  267. <textarea
  268. class="error_popup__textarea"
  269. v-model="errorForm.describes"
  270. placeholder="请输入异常描述"
  271. :auto-height="true"
  272. />
  273. </u-form-item>
  274. </u-form>
  275. <view class="error_popup__photo">
  276. <view class="error_popup__photo-header">
  277. <view class="error_popup__photo-label">现场照片</view>
  278. <view class="error_popup__photo-btn" @click="chooseImage">
  279. <text class="error_popup__photo-btn-icon">+</text>
  280. <text>拍照</text>
  281. </view>
  282. </view>
  283. <view class="error_popup__photo-list">
  284. <PreviewPhoto
  285. type="add"
  286. @imagedelete="imagedelete"
  287. :imageList="imageList"
  288. />
  289. </view>
  290. </view>
  291. </view>
  292. </template>
  293. <template v-slot:operate>
  294. <view class="error_popup__operate rx-bc">
  295. <u-button size="normal" class="error_popup__btn" @click="errorCancel">
  296. 取消
  297. </u-button>
  298. <u-button
  299. type="success"
  300. size="normal"
  301. class="error_popup__btn"
  302. @click="errorOk()"
  303. >
  304. 确定
  305. </u-button>
  306. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  307. 提交并发布
  308. </u-button> -->
  309. </view>
  310. </template>
  311. </SearchPopup>
  312. <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
  313. <handover ref="handoverRef"></handover>
  314. </view>
  315. </template>
  316. <script>
  317. import {
  318. getTwoTreeByPid,
  319. checkOutsource,
  320. applyoutsourceSave,
  321. producerouting,
  322. getWarehouseList,
  323. updateStatusPause,
  324. updateStatusPauseRecover,
  325. updateStatusTerminate,
  326. } from "@/api/pda/workOrder.js";
  327. import SearchPopup from "./searchPopup.vue";
  328. import outsourceList from "./outsourceList.vue";
  329. import handover from "./handover.vue";
  330. import { EventBus } from "@/utils/eventBus.js";
  331. import { getByCode } from "@/api/pda/common.js";
  332. import PreviewPhoto from "@/pages/maintenance/check/components/PreviewPhoto.vue";
  333. export default {
  334. components: {
  335. SearchPopup,
  336. outsourceList,
  337. handover,
  338. PreviewPhoto,
  339. },
  340. props: {
  341. state: String | Number,
  342. gdStatus: String | Number,
  343. taskObj: Object,
  344. info: {
  345. type: Object,
  346. default: {},
  347. },
  348. controlReportMethod: String | Number,
  349. stepsList: {
  350. type: Array,
  351. default: () => [],
  352. },
  353. },
  354. watch: {
  355. btns: {
  356. immediate: true,
  357. deep: true,
  358. handler(newVal) {
  359. this.btnsList = [];
  360. this.btnsList = newVal;
  361. },
  362. },
  363. state: {
  364. immediate: true,
  365. deep: true,
  366. handler(newVal) {
  367. this.btnState = newVal;
  368. },
  369. },
  370. gdStatus: {
  371. immediate: true,
  372. deep: true,
  373. handler(newVal) {
  374. this.GDStatus = newVal;
  375. },
  376. },
  377. controlReportMethod: {
  378. immediate: true,
  379. deep: true,
  380. handler(newVal) {
  381. this.btnControlReportMethod = newVal;
  382. },
  383. },
  384. taskObj: {
  385. immediate: true,
  386. deep: true,
  387. handler(newVal) {
  388. this.newTaskObj = newVal;
  389. },
  390. },
  391. stepsList: {
  392. immediate: true,
  393. deep: true,
  394. handler(newVal) {},
  395. },
  396. },
  397. data() {
  398. return {
  399. isOperate: false,
  400. sceneText: "",
  401. outsourceScene: null,
  402. btnsList: [],
  403. btnState: 1,
  404. GDStatus: null,
  405. btnControlReportMethod: null,
  406. btnList: {
  407. 1: [
  408. {
  409. name: "领料",
  410. type: "picking",
  411. },
  412. {
  413. name: "投料",
  414. type: "feeding",
  415. },
  416. {
  417. name: "更换周转车",
  418. type: "turnover",
  419. },
  420. {
  421. name: "报工",
  422. type: "jobBooking",
  423. isOutsource: 0,
  424. },
  425. // {
  426. // name: '多工单报工',
  427. // type: ''
  428. // }
  429. ],
  430. 2: [
  431. {
  432. name: "取样",
  433. type: "sample",
  434. },
  435. {
  436. name: "报工",
  437. type: "sampleJob",
  438. },
  439. ],
  440. 3: [
  441. {
  442. name: "更换周转车",
  443. type: "qualityTurnover",
  444. },
  445. {
  446. name: "质检",
  447. type: "inspection",
  448. },
  449. {
  450. name: "报工",
  451. type: "inspectionJob",
  452. },
  453. ],
  454. 4: [
  455. {
  456. name: "领料",
  457. type: "picking",
  458. },
  459. {
  460. name: "投料",
  461. type: "feeding",
  462. },
  463. {
  464. name: "报工",
  465. type: "jobBooking",
  466. },
  467. ],
  468. 5: [
  469. {
  470. name: "入库",
  471. type: "warehousing",
  472. },
  473. ],
  474. 6: [
  475. {
  476. name: "报工",
  477. type: "jobBooking",
  478. },
  479. ],
  480. },
  481. btnListOne: {
  482. 1: [
  483. {
  484. name: "领料",
  485. type: "picking",
  486. },
  487. {
  488. name: "投料",
  489. type: "feeding",
  490. },
  491. {
  492. name: "报工",
  493. type: "jobBooking",
  494. isOutsource: 0,
  495. },
  496. // {
  497. // name: '多工单报工',
  498. // type: ''
  499. // }
  500. ],
  501. 2: [
  502. {
  503. name: "取样",
  504. type: "sample",
  505. },
  506. {
  507. name: "报工",
  508. type: "sampleJob",
  509. },
  510. ],
  511. 3: [
  512. {
  513. name: "质检",
  514. type: "inspection",
  515. },
  516. {
  517. name: "报工",
  518. type: "inspectionJob",
  519. },
  520. ],
  521. 4: [
  522. {
  523. name: "领料",
  524. type: "picking",
  525. },
  526. {
  527. name: "投料",
  528. type: "feeding",
  529. },
  530. {
  531. name: "报工",
  532. type: "jobBooking",
  533. },
  534. ],
  535. 5: [
  536. {
  537. name: "入库",
  538. type: "warehousing",
  539. },
  540. ],
  541. 6: [
  542. {
  543. name: "报工",
  544. type: "jobBooking",
  545. },
  546. ],
  547. 99: [
  548. {
  549. name: "领料",
  550. type: "picking",
  551. },
  552. {
  553. name: "投料",
  554. type: "feeding",
  555. },
  556. {
  557. name: "报工",
  558. type: "jobBooking",
  559. isOutsource: 0,
  560. },
  561. ],
  562. },
  563. errorShow: false,
  564. sceneText: "",
  565. outsourceScene: null,
  566. newTaskObj: {},
  567. outsourceShow: false,
  568. outsourceForm: {},
  569. produceList: [],
  570. warehouseList: [],
  571. typeList: [
  572. {
  573. id: 4,
  574. name: "带料生产委外",
  575. },
  576. {
  577. id: 5,
  578. name: "不带料生产委外",
  579. },
  580. ],
  581. errorTypeList: [],
  582. errorForm: {},
  583. newStepsList: [],
  584. clientEnvironmentId:
  585. uni.getStorageSync("userInfo") &&
  586. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  587. isInWarehouse: [1],
  588. imageList: [],
  589. };
  590. },
  591. created() {
  592. this.getTypeList("Exception_type");
  593. },
  594. methods: {
  595. imagedelete(index) {
  596. this.imageList.splice(index, 1);
  597. },
  598. getImageData() {
  599. return this.imageList || [];
  600. },
  601. // *** 新增拍照
  602. chooseImage() {
  603. const _this = this;
  604. if (_this.imageList.length >= 9) {
  605. _this.$refs.uToast.show({
  606. type: "warning",
  607. message: "最多上传9张照片",
  608. });
  609. return;
  610. }
  611. uni.chooseImage({
  612. count: 9, //默认9
  613. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  614. sourceType: ["camera"], //从相册选择
  615. success: function (res) {
  616. uni.showLoading({
  617. title: "上传中",
  618. });
  619. _this
  620. .uploadFile(res.tempFilePaths)
  621. .then((res) => {
  622. res.forEach((item) => {
  623. let fileNames = item.storePath.split("/");
  624. let url =
  625. _this.apiUrl +
  626. "/main/file/getFile?objectName=" +
  627. item.storePath +
  628. "&fullfilename=" +
  629. fileNames[fileNames.length - 1];
  630. let images = _this.imageList;
  631. // 不能存储超过 9 张
  632. if (images.length < 9) {
  633. _this.imageList.push(url);
  634. }
  635. });
  636. uni.hideLoading();
  637. })
  638. .catch((error) => {
  639. console.log(error, "errorerrorerror");
  640. uni.hideLoading();
  641. });
  642. },
  643. });
  644. },
  645. uploadFile(list) {
  646. let PromiseAll = [];
  647. const apiUrl = this.apiUrl;
  648. const token = uni.getStorageSync("token"); //取存本地的token
  649. list.forEach((item) => {
  650. PromiseAll.push(
  651. new Promise((resolve, reject) => {
  652. uni.uploadFile({
  653. url: apiUrl + "/main/file/upload",
  654. filePath: item,
  655. name: "multiPartFile",
  656. header: {
  657. authorization: token,
  658. },
  659. success: (uploadFileRes) => {
  660. if (uploadFileRes.statusCode == 500) {
  661. uni.hideLoading();
  662. return;
  663. }
  664. let data = JSON.parse(uploadFileRes.data);
  665. resolve(data.data);
  666. },
  667. fail: (err) => {
  668. console.log(err, "123456");
  669. // 上传请求本身失败(如网络问题等),直接 reject
  670. uni.hideLoading();
  671. reject(err);
  672. },
  673. });
  674. })
  675. );
  676. });
  677. return Promise.all(PromiseAll);
  678. },
  679. // 委外时间选择
  680. //委外到 类型选择
  681. changeTaskId(e) {
  682. console.log(this.outsourceForm, e);
  683. // if (this.newStepsList.length) {
  684. if (this.outsourceForm.taskIdes.length != 0) {
  685. if (this.outsourceForm.taskIdes.length == 1) {
  686. this.sceneText = "单工序";
  687. this.outsourceForm.outsourceScene = 2;
  688. } else {
  689. this.sceneText = "多工序";
  690. this.outsourceForm.outsourceScene = 3;
  691. }
  692. // const id = this.newStepsList[0].sourceTaskId;
  693. // //isFirstTask 1是首工序 0不是
  694. // if (this.outsourceForm.isFirstTask) {
  695. // this.sceneText = "首工序";
  696. // this.outsourceForm.outsourceScene = 1;
  697. // if (e.sourceTaskId !== id) {
  698. // this.sceneText = "首工序及多工序";
  699. // this.outsourceForm.outsourceScene = 4;
  700. // }
  701. // } else {
  702. // if (e.sourceTaskId === id) {
  703. // // 单工序
  704. // this.sceneText = "单工序";
  705. // this.outsourceForm.outsourceScene = 2;
  706. // } else {
  707. // //多工序
  708. // this.sceneText = "多工序";
  709. // this.outsourceForm.outsourceScene = 3;
  710. // }
  711. // }
  712. } else {
  713. uni.showToast({
  714. title: "委外到工序为空",
  715. icon: "none",
  716. });
  717. }
  718. },
  719. async getTypeList(code) {
  720. const res = await getByCode(code);
  721. const list = [];
  722. if (res.length) {
  723. res.map((item, index) => {
  724. for (var key in res[index]) {
  725. list.push({
  726. label: res[index][key],
  727. value: key,
  728. });
  729. }
  730. });
  731. }
  732. this.errorTypeList = list;
  733. },
  734. open() {
  735. this.isOperate = !this.isOperate;
  736. },
  737. errorCancel() {
  738. this.errorShow = false;
  739. },
  740. errorOk() {
  741. if (!this.errorForm.type) {
  742. uni.showToast({
  743. title: "请选择异常类型",
  744. icon: "none",
  745. });
  746. return false;
  747. }
  748. if (!this.errorForm.name) {
  749. uni.showToast({
  750. title: "请输入名称",
  751. icon: "none",
  752. });
  753. return false;
  754. }
  755. this.errorShow = false;
  756. },
  757. operate(type, item) {
  758. this.$emit("operate", type, item);
  759. },
  760. handOutsource() {
  761. let param = {
  762. taskId: this.newTaskObj.currentTaskId,
  763. workOrderId: this.newTaskObj.workOrderId,
  764. };
  765. checkOutsource(param).then((res) => {
  766. this.outsourceForm = {
  767. ...res,
  768. };
  769. this.outsourceForm.name = this.taskObj.currentTaskName + "委外";
  770. this.outsourceForm.taskIdes = [];
  771. if (res.outsource) {
  772. this.getNewSteps();
  773. this.outsourceShow = true;
  774. this.produceFn();
  775. this.getWarehouseFn();
  776. } else {
  777. uni.showToast({
  778. title: "此工序不能委外",
  779. icon: "none",
  780. });
  781. }
  782. });
  783. },
  784. handPause() {
  785. if (this.GDStatus == 9) {
  786. uni.showModal({
  787. title: "提示",
  788. content: "确定该工单取消暂停?",
  789. success: async (res) => {
  790. if (res.confirm) {
  791. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(
  792. (res) => {
  793. this.$emit("refresh");
  794. }
  795. );
  796. }
  797. },
  798. });
  799. } else {
  800. uni.showModal({
  801. title: "提示",
  802. content: "确定该工单暂停?",
  803. success: async (res) => {
  804. if (res.confirm) {
  805. updateStatusPause([this.newTaskObj.workOrderId]).then((res) => {
  806. this.$emit("refresh");
  807. });
  808. }
  809. },
  810. });
  811. }
  812. },
  813. handHandover() {
  814. this.$refs.handoverRef.open();
  815. },
  816. handTerminate() {
  817. uni.showModal({
  818. title: "提示",
  819. content: "确定该工单终止?",
  820. success: async (res) => {
  821. if (res.confirm) {
  822. updateStatusTerminate([this.newTaskObj.workOrderId]).then((res) => {
  823. this.$emit("refresh");
  824. });
  825. }
  826. },
  827. });
  828. },
  829. outCancel() {
  830. this.sceneText = ""; //委外场景
  831. this.outsourceForm.outsourceScene = null;
  832. this.outsourceShow = false;
  833. EventBus.$off("outEvent");
  834. },
  835. getNewSteps() {
  836. this.activeIndex = this.getIndexOfElementInArray(
  837. this.stepsList,
  838. this.newTaskObj.currentTaskId
  839. );
  840. this.newStepsList = [];
  841. this.stepsList.forEach((f, i) => {
  842. if (f.taskId != "-2" && i >= this.activeIndex) {
  843. if (this.clientEnvironmentId == 3) {
  844. if (f.type != 6) {
  845. this.newStepsList.push(f);
  846. }
  847. } else {
  848. this.newStepsList.push(f);
  849. }
  850. }
  851. });
  852. },
  853. getIndexOfElementInArray(array, target) {
  854. for (let i = 0; i < array.length; i++) {
  855. if (array[i].taskId === target) {
  856. return i; // 返回第一次出现target的索引位置
  857. }
  858. }
  859. return -1; // 未找到目标值时返回-1
  860. },
  861. // 工艺路线
  862. produceFn() {
  863. let param = {
  864. pageNum: 1,
  865. size: -1,
  866. routeType: 2,
  867. };
  868. producerouting(param).then((res) => {
  869. this.produceList = res.list;
  870. });
  871. },
  872. // 仓库
  873. getWarehouseFn() {
  874. getWarehouseList().then((res) => {
  875. this.warehouseList = res;
  876. });
  877. },
  878. handError() {
  879. console.log(this.info, "taskObj");
  880. this.errorShow = true;
  881. },
  882. outsourceOk() {
  883. if (!this.outsourceForm.name) {
  884. uni.showToast({
  885. title: "请输入委外名称",
  886. icon: "none",
  887. });
  888. return false;
  889. }
  890. if (!this.outsourceForm.type) {
  891. uni.showToast({
  892. title: "请选择委外类型",
  893. icon: "none",
  894. });
  895. return false;
  896. }
  897. if (!this.outsourceForm.formedNumLast) {
  898. uni.showToast({
  899. title: "委外数量不能为空",
  900. icon: "none",
  901. });
  902. return false;
  903. }
  904. if (this.outsourceForm.taskIdes.length == 0) {
  905. uni.showToast({
  906. title: "请选择委外工序",
  907. icon: "none",
  908. });
  909. return false;
  910. }
  911. if (!this.outsourceForm.requireDeliveryTime) {
  912. uni.showToast({
  913. title: "请选择委外完成时间",
  914. icon: "none",
  915. });
  916. return false;
  917. }
  918. if (this.clientEnvironmentId == 2) {
  919. this.outsourceForm.isInWarehouse = 1;
  920. } else {
  921. this.isInWarehouse.length > 0
  922. ? (this.outsourceForm.isInWarehouse = 1)
  923. : (this.outsourceForm.isInWarehouse = 0);
  924. }
  925. if (this.outsourceForm.requireDeliveryTime.indexOf("00:00:00") === -1) {
  926. this.outsourceForm.requireDeliveryTime =
  927. this.outsourceForm.requireDeliveryTime + "00:00:00";
  928. }
  929. const taskIds = this.outsourceForm.taskIdes.join(",");
  930. let param = {
  931. ...this.outsourceForm,
  932. taskId: this.newTaskObj.currentTaskId,
  933. workOrderId: this.newTaskObj.workOrderId,
  934. taskIds,
  935. };
  936. console.log(param);
  937. this.sceneText = ""; //委外场景
  938. this.outsourceForm.outsourceScene = null;
  939. this.$refs.outsourceListRef.open(param);
  940. // let param = {
  941. // ...this.outsourceForm,
  942. // taskId: this.newTaskObj.currentTaskId,
  943. // workOrderId: this.newTaskObj.workOrderId,
  944. // isRelease: isRelease
  945. // }
  946. // applyoutsourceSave(param).then(res => {
  947. // console.log(res)
  948. // this.outCancel()
  949. // })
  950. },
  951. },
  952. };
  953. </script>
  954. <style lang="scss" scoped>
  955. .bottom_box {
  956. background: #fff;
  957. }
  958. .nav_box {
  959. width: 750rpx;
  960. height: 56rpx;
  961. background: $theme-color;
  962. .open_icon {
  963. width: 48rpx;
  964. height: 48rpx;
  965. }
  966. .open_icon_reversal {
  967. transform: scaleY(-1);
  968. /* 垂直翻转 */
  969. }
  970. }
  971. .operate_list {
  972. margin: 0 32rpx;
  973. .list {
  974. border-radius: 8rpx;
  975. border: 1rpx solid $theme-color;
  976. background: #f0f8f2;
  977. height: 64rpx;
  978. padding: 0rpx 16rpx;
  979. margin-top: 16rpx;
  980. }
  981. .round {
  982. width: 32rpx;
  983. height: 32rpx;
  984. line-height: 32rpx;
  985. text-align: center;
  986. border-radius: 50%;
  987. background: $theme-color;
  988. font-size: 24rpx;
  989. font-style: normal;
  990. font-weight: 400;
  991. color: #fff;
  992. }
  993. .name {
  994. font-family: PingFang HK;
  995. font-size: 24rpx;
  996. font-style: normal;
  997. font-weight: 600;
  998. color: $theme-color;
  999. }
  1000. .arrow_right {
  1001. width: 32rpx;
  1002. height: 32rpx;
  1003. }
  1004. }
  1005. .btn_box {
  1006. display: flex;
  1007. padding: 16rpx 32rpx;
  1008. align-items: flex-start;
  1009. gap: 16rpx;
  1010. align-self: stretch;
  1011. .btn {
  1012. width: 160rpx;
  1013. height: 64rpx;
  1014. line-height: 64rpx;
  1015. background: $theme-color;
  1016. text-align: center;
  1017. border-radius: 8rpx;
  1018. color: #fff;
  1019. font-family: PingFang HK;
  1020. font-size: 24rpx;
  1021. font-style: normal;
  1022. font-weight: 600;
  1023. }
  1024. }
  1025. .operate_box {
  1026. padding: 10rpx 20rpx;
  1027. /deep/ .u-button {
  1028. width: 180rpx;
  1029. }
  1030. }
  1031. .popup_list {
  1032. width: 78vw;
  1033. min-height: 360rpx;
  1034. max-height: 70vh;
  1035. overflow-y: auto;
  1036. padding: 0 32rpx;
  1037. box-sizing: border-box;
  1038. .title {
  1039. color: #333;
  1040. font-size: 32rpx;
  1041. text-align: center;
  1042. padding: 30rpx;
  1043. }
  1044. }
  1045. .error_popup__textarea {
  1046. width: 100%;
  1047. min-height: 120rpx;
  1048. max-height: 320rpx;
  1049. padding: 12rpx 16rpx;
  1050. box-sizing: border-box;
  1051. border: 2rpx solid #f0f8f2;
  1052. border-radius: 8rpx;
  1053. background: #f0f8f2;
  1054. color: $theme-color;
  1055. font-size: 26rpx;
  1056. line-height: 1.5;
  1057. }
  1058. .error_popup__photo {
  1059. margin: 24rpx 0 16rpx;
  1060. &-header {
  1061. display: flex;
  1062. align-items: center;
  1063. justify-content: space-between;
  1064. margin-bottom: 16rpx;
  1065. }
  1066. &-label {
  1067. font-size: 26rpx;
  1068. color: #333;
  1069. font-weight: 500;
  1070. }
  1071. &-btn {
  1072. display: inline-flex;
  1073. align-items: center;
  1074. justify-content: center;
  1075. height: 56rpx;
  1076. padding: 0 24rpx;
  1077. background: $theme-color;
  1078. color: #fff;
  1079. border-radius: 28rpx;
  1080. font-size: 24rpx;
  1081. &-icon {
  1082. font-size: 30rpx;
  1083. line-height: 1;
  1084. margin-right: 6rpx;
  1085. }
  1086. }
  1087. &-list {
  1088. display: flex;
  1089. flex-wrap: wrap;
  1090. }
  1091. }
  1092. .error_popup__operate {
  1093. padding: 16rpx 32rpx;
  1094. gap: 24rpx;
  1095. /deep/ .u-button {
  1096. flex: 1;
  1097. height: 72rpx;
  1098. }
  1099. }
  1100. .error_popup__btn {
  1101. flex: 1;
  1102. }
  1103. .list_item_btn {
  1104. width: 160rpx;
  1105. height: 54rpx;
  1106. line-height: 54rpx;
  1107. background: $theme-color;
  1108. text-align: center;
  1109. border-radius: 8rpx;
  1110. color: #fff;
  1111. font-family: PingFang HK;
  1112. font-size: 22rpx;
  1113. font-style: normal;
  1114. font-weight: 600;
  1115. }
  1116. .content_num {
  1117. display: flex;
  1118. align-items: center;
  1119. padding: 0 4rpx;
  1120. /deep/ .uni-input-input {
  1121. border: 2rpx solid #f0f8f2;
  1122. background: #f0f8f2;
  1123. color: $theme-color;
  1124. }
  1125. }
  1126. .photo_btn {
  1127. background-color: #157a2c;
  1128. width: 140rpx;
  1129. height: 60rpx;
  1130. line-height: 60rpx;
  1131. font-size: 24rpx;
  1132. color: #fff;
  1133. text-align: center;
  1134. border-radius: 8rpx;
  1135. margin-bottom: 12rpx;
  1136. display: inline-block;
  1137. }
  1138. </style>