bottomOperate.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <template>
  2. <view class="bottom_box">
  3. <!-- 按钮组 -->
  4. <view class="nav_box rx-cc" @click="open">
  5. <image class="open_icon" :class="{ open_icon_reversal: isOperate }" src="~@/static/pda/open.svg"></image>
  6. </view>
  7. <!-- // 弹出框 -->
  8. <view class="operate_list" v-show="isOperate">
  9. <view v-if="clientEnvironmentId == 2">
  10. <view v-for="(item, index) in btnList[btnState]" :key="index" class="list rx-bc"
  11. @click="operate(item.type, item)">
  12. <view class="round">{{ index + 1 }}</view>
  13. <view class="name">{{ item.name }}</view>
  14. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  15. </view>
  16. </view>
  17. <view v-else>
  18. <view v-for="(item, index) in btnListOne[btnState]" :key="index" class="list rx-bc"
  19. @click="operate(item.type, item)">
  20. <view class="round">{{ index + 1 }}</view>
  21. <view class="name">{{ item.name }}</view>
  22. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  23. </view>
  24. </view>
  25. <!--
  26. <view v-if='btnControlReportMethod == 2' class="list rx-bc">
  27. <view class="round">{{btnList[btnState].length + 1}}</view>
  28. <view class="name" @click="operate('skip', {})" >跳过(不报工)</view>
  29. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  30. </view>
  31. -->
  32. <view v-if="newTaskObj.existOutsource == 1" class="list rx-bc" @click="operate('outPicking', {})">
  33. <view class="round">{{ btnList[btnState].length + 1 }}</view>
  34. <view class="name">委外领料</view>
  35. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  36. </view>
  37. <view v-if="newTaskObj.existOutsource == 1" class="list rx-bc"
  38. @click="operate('jobBooking', { isOutsource: 1 })">
  39. <view class="round">{{ btnList[btnState].length + 2 }}</view>
  40. <view class="name">委外报工</view>
  41. <image class="arrow_right" src="~@/static/pda/arrow_right.svg"></image>
  42. </view>
  43. </view>
  44. <view class="btn_box">
  45. <view class="btn" @click="handPause()">{{ GDStatus == 9 ? '取消暂停' : '暂停' }}</view>
  46. <view class="btn" @click="handTerminate()">终止</view>
  47. <view class="btn">转派</view>
  48. <view class="btn" :style="newTaskObj.existOutsource == 1 ? 'background: #FFA929' : ''"
  49. @click="handOutsource()">委外</view>
  50. <view class="btn" @click="handHandover">交接</view>
  51. </view>
  52. <!-- //委外弹窗 -->
  53. <SearchPopup mode="center" v-if="outsourceShow">
  54. <template v-slot:list>
  55. <view class="popup_list">
  56. <view class="title">【{{ taskObj.currentTaskName }}】是否委外</view>
  57. <u-form labelPosition="left" :model="outsourceForm" labelWidth="180" labelAlign="left" class="">
  58. <u-form-item label="委外名称:" borderBottom prop="name">
  59. <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
  60. </u-form-item>
  61. <u-form-item label="委外类型:" borderBottom prop="">
  62. <zxz-uni-data-select :localdata="typeList" v-model="outsourceForm.type" dataValue='id'
  63. dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  64. </u-form-item>
  65. <u-form-item label="委外数量:" borderBottom prop="formedNumLast">
  66. <input class="uni-input content_num" v-model="outsourceForm.formedNumLast"
  67. type='number'></input>
  68. </u-form-item>
  69. <u-form-item label="委外到:" borderBottom prop="taskIds">
  70. <zxz-uni-data-select :localdata="newStepsList" style="font-size: 15px;"
  71. v-model="outsourceForm.taskIds" dataValue='taskId' format='{taskTypeName}'
  72. dataKey="taskId" filterable :clear='true' @change="changeTaskId"></zxz-uni-data-select>
  73. </u-form-item>
  74. <u-form-item label="委外场景:" borderBottom prop="taskIds">
  75. {{ sceneText }}
  76. </u-form-item>
  77. <u-form-item label="直接入库:" borderBottom prop="isInWarehouse"
  78. v-if="outsourceForm.isFirstTask != 1">
  79. <u-checkbox-group v-model="isInWarehouse" size="15px" v-if="clientEnvironmentId != 2">
  80. <u-checkbox labelSize="15px" iconSize="10px" activeColor="#157A2C" name="true"
  81. label="是"></u-checkbox>
  82. </u-checkbox-group>
  83. <view style="font-size: 15px;" v-if="clientEnvironmentId == 2">是</view>
  84. <zxz-uni-data-select style="margin-left: 10px; font-size: 15px;"
  85. v-if="clientEnvironmentId == 2 || isInWarehouse.length" :localdata="warehouseList"
  86. v-model="outsourceForm.warehouseId" dataValue='id' dataKey="name" filterable
  87. format='{name}'></zxz-uni-data-select>
  88. </u-form-item>
  89. <u-form-item label="工艺路线:" borderBottom style="font-size: 15px;" prop="produceRoutingId"
  90. v-if="clientEnvironmentId != 2 && outsourceForm.isFirstTask != 1 && isInWarehouse && isInWarehouse.length == 0">
  91. <zxz-uni-data-select :localdata="produceList" v-model="outsourceForm.produceRoutingId"
  92. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  93. </u-form-item>
  94. <u-form-item label="计划交期:" borderBottom prop="requireDeliveryTime">
  95. <uni-datetime-picker type="datetime" v-model="outsourceForm.requireDeliveryTime" />
  96. </u-form-item>
  97. </u-form>
  98. </view>
  99. </template>
  100. <template v-slot:operate>
  101. <view class="operate_box rx-bc">
  102. <u-button size="small" class="u-reset-button" @click="outCancel">
  103. 取消
  104. </u-button>
  105. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk()">
  106. 确定
  107. </u-button>
  108. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  109. 提交并发布
  110. </u-button> -->
  111. </view>
  112. </template>
  113. </SearchPopup>
  114. <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
  115. <handover ref="handoverRef"></handover>
  116. </view>
  117. </template>
  118. <script>
  119. import {
  120. getTwoTreeByPid,
  121. checkOutsource,
  122. applyoutsourceSave,
  123. producerouting,
  124. getWarehouseList,
  125. updateStatusPause,
  126. updateStatusPauseRecover,
  127. updateStatusTerminate
  128. } from '@/api/pda/workOrder.js'
  129. import SearchPopup from './searchPopup.vue'
  130. import outsourceList from './outsourceList.vue'
  131. import handover from './handover.vue'
  132. import {
  133. EventBus
  134. } from '@/utils/eventBus.js'
  135. export default {
  136. components: {
  137. SearchPopup,
  138. outsourceList,
  139. handover
  140. },
  141. props: {
  142. state: String | Number,
  143. gdStatus: String | Number,
  144. taskObj: Object,
  145. controlReportMethod: String | Number,
  146. stepsList: {
  147. type: Array,
  148. default: () => []
  149. },
  150. },
  151. watch: {
  152. btns: {
  153. immediate: true,
  154. deep: true,
  155. handler(newVal) {
  156. this.btnsList = []
  157. this.btnsList = newVal
  158. }
  159. },
  160. state: {
  161. immediate: true,
  162. deep: true,
  163. handler(newVal) {
  164. this.btnState = newVal
  165. }
  166. },
  167. gdStatus: {
  168. immediate: true,
  169. deep: true,
  170. handler(newVal) {
  171. this.GDStatus = newVal
  172. }
  173. },
  174. controlReportMethod: {
  175. immediate: true,
  176. deep: true,
  177. handler(newVal) {
  178. this.btnControlReportMethod = newVal
  179. }
  180. },
  181. taskObj: {
  182. immediate: true,
  183. deep: true,
  184. handler(newVal) {
  185. console.log(newVal)
  186. this.newTaskObj = newVal
  187. }
  188. },
  189. stepsList: {
  190. immediate: true,
  191. deep: true,
  192. handler(newVal) {
  193. }
  194. }
  195. },
  196. data() {
  197. return {
  198. isOperate: false,
  199. sceneText: '',
  200. outsourceScene: null,
  201. btnsList: [],
  202. btnState: 1,
  203. GDStatus: null,
  204. btnControlReportMethod: null,
  205. btnList: {
  206. 1: [{
  207. name: '领料',
  208. type: 'picking'
  209. },
  210. {
  211. name: '投料',
  212. type: 'feeding'
  213. },
  214. {
  215. name: '更换周转车',
  216. type: 'turnover'
  217. },
  218. {
  219. name: '报工',
  220. type: 'jobBooking',
  221. isOutsource: 0
  222. },
  223. // {
  224. // name: '多工单报工',
  225. // type: ''
  226. // }
  227. ],
  228. 2: [{
  229. name: '取样',
  230. type: 'sample'
  231. },
  232. {
  233. name: '报工',
  234. type: 'sampleJob'
  235. },
  236. ],
  237. 3: [{
  238. name: '更换周转车',
  239. type: 'qualityTurnover'
  240. },
  241. {
  242. name: '质检',
  243. type: 'inspection'
  244. },
  245. {
  246. name: '报工',
  247. type: 'inspectionJob'
  248. }
  249. ],
  250. 4: [{
  251. name: '领料',
  252. type: 'picking'
  253. },
  254. {
  255. name: '投料',
  256. type: 'feeding'
  257. },
  258. {
  259. name: '报工',
  260. type: 'jobBooking'
  261. },
  262. ],
  263. 5: [{
  264. name: '入库',
  265. type: 'warehousing'
  266. },
  267. ],
  268. 6: [{
  269. name: '报工',
  270. type: 'jobBooking'
  271. },
  272. ],
  273. },
  274. btnListOne: {
  275. 1: [{
  276. name: '领料',
  277. type: 'picking'
  278. },
  279. {
  280. name: '投料',
  281. type: 'feeding'
  282. },
  283. {
  284. name: '报工',
  285. type: 'jobBooking',
  286. isOutsource: 0
  287. },
  288. // {
  289. // name: '多工单报工',
  290. // type: ''
  291. // }
  292. ],
  293. 2: [{
  294. name: '取样',
  295. type: 'sample'
  296. },
  297. {
  298. name: '报工',
  299. type: 'sampleJob'
  300. },
  301. ],
  302. 3: [
  303. {
  304. name: '质检',
  305. type: 'inspection'
  306. },
  307. {
  308. name: '报工',
  309. type: 'inspectionJob'
  310. }
  311. ],
  312. 4: [{
  313. name: '领料',
  314. type: 'picking'
  315. },
  316. {
  317. name: '投料',
  318. type: 'feeding'
  319. },
  320. {
  321. name: '报工',
  322. type: 'jobBooking'
  323. },
  324. ],
  325. 5: [{
  326. name: '入库',
  327. type: 'warehousing'
  328. },
  329. ],
  330. 6: [{
  331. name: '报工',
  332. type: 'jobBooking'
  333. },
  334. ],
  335. },
  336. sceneText: '',
  337. outsourceScene: null,
  338. newTaskObj: {},
  339. outsourceShow: false,
  340. outsourceForm: {
  341. },
  342. produceList: [],
  343. warehouseList: [],
  344. typeList: [{
  345. id: 4,
  346. name: '带料生产委外'
  347. },
  348. {
  349. id: 5,
  350. name: '不带料生产委外'
  351. },
  352. ],
  353. newStepsList: [],
  354. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  355. isInWarehouse: []
  356. }
  357. },
  358. created() {
  359. },
  360. methods: {
  361. // 委外时间选择
  362. //委外到 类型选择
  363. changeTaskId(e) {
  364. console.log(this.outsourceForm, e);
  365. if (this.newStepsList.length) {
  366. const id = this.newStepsList[0].sourceTaskId;
  367. //isFirstTask 1是首工序 0不是
  368. if (this.outsourceForm.isFirstTask) {
  369. this.sceneText = "首工序";
  370. this.outsourceForm.outsourceScene = 1;
  371. if (e.sourceTaskId !== id) {
  372. this.sceneText = "首工序及多工序";
  373. this.outsourceForm.outsourceScene = 4;
  374. }
  375. } else {
  376. if (e.sourceTaskId === id) {
  377. // 单工序
  378. this.sceneText = "单工序"
  379. this.outsourceForm.outsourceScene = 2;
  380. } else {
  381. //多工序
  382. this.sceneText = "多工序"
  383. this.outsourceForm.outsourceScene = 3;
  384. }
  385. }
  386. } else {
  387. uni.showToast({
  388. title: '委外到工序为空',
  389. icon: 'none'
  390. })
  391. }
  392. },
  393. open() {
  394. this.isOperate = !this.isOperate
  395. },
  396. operate(type, item) {
  397. this.$emit('operate', type, item)
  398. },
  399. handOutsource() {
  400. let param = {
  401. taskId: this.newTaskObj.currentTaskId,
  402. workOrderId: this.newTaskObj.workOrderId,
  403. }
  404. checkOutsource(param).then(res => {
  405. this.outsourceForm = {
  406. ...res,
  407. }
  408. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  409. if (res.outsource) {
  410. this.getNewSteps()
  411. this.outsourceShow = true
  412. this.produceFn()
  413. this.getWarehouseFn()
  414. } else {
  415. uni.showToast({
  416. title: '此工序不能委外',
  417. icon: 'none'
  418. })
  419. }
  420. })
  421. },
  422. handPause() {
  423. if (this.GDStatus == 9) {
  424. uni.showModal({
  425. title: '提示',
  426. content: '确定该工单取消暂停?',
  427. success: async res => {
  428. if (res.confirm) {
  429. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  430. this.$emit('refresh')
  431. })
  432. }
  433. }
  434. })
  435. } else {
  436. uni.showModal({
  437. title: '提示',
  438. content: '确定该工单暂停?',
  439. success: async res => {
  440. if (res.confirm) {
  441. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  442. this.$emit('refresh')
  443. })
  444. }
  445. }
  446. })
  447. }
  448. },
  449. handHandover() {
  450. this.$refs.handoverRef.open()
  451. },
  452. handTerminate() {
  453. uni.showModal({
  454. title: '提示',
  455. content: '确定该工单终止?',
  456. success: async res => {
  457. if (res.confirm) {
  458. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  459. this.$emit('refresh')
  460. })
  461. }
  462. }
  463. })
  464. },
  465. outCancel() {
  466. this.sceneText = "";//委外场景
  467. this.outsourceForm.outsourceScene = null;
  468. this.outsourceShow = false
  469. EventBus.$off('outEvent');
  470. },
  471. getNewSteps() {
  472. this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
  473. this.newStepsList = []
  474. this.stepsList.forEach((f, i) => {
  475. if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
  476. 4)) {
  477. this.newStepsList.push(f)
  478. }
  479. })
  480. },
  481. getIndexOfElementInArray(array, target) {
  482. for (let i = 0; i < array.length; i++) {
  483. if (array[i].taskId === target) {
  484. return i; // 返回第一次出现target的索引位置
  485. }
  486. }
  487. return -1; // 未找到目标值时返回-1
  488. },
  489. // 工艺路线
  490. produceFn() {
  491. let param = {
  492. pageNum: 1,
  493. size: -1,
  494. routeType: 2
  495. }
  496. producerouting(param).then(res => {
  497. this.produceList = res.list
  498. })
  499. },
  500. // 仓库
  501. getWarehouseFn() {
  502. getWarehouseList().then(res => {
  503. this.warehouseList = res
  504. })
  505. },
  506. outsourceOk() {
  507. if (!this.outsourceForm.name) {
  508. uni.showToast({
  509. title: '请输入委外名称',
  510. icon: 'none'
  511. })
  512. return false
  513. }
  514. if (!this.outsourceForm.type) {
  515. uni.showToast({
  516. title: '请选择委外类型',
  517. icon: 'none'
  518. })
  519. return false
  520. }
  521. if (!this.outsourceForm.requireDeliveryTime) {
  522. uni.showToast({
  523. title: '请选择委外完成时间',
  524. icon: 'none'
  525. })
  526. return false
  527. }
  528. if (this.clientEnvironmentId == 2) {
  529. this.outsourceForm.isInWarehouse = 1
  530. } else {
  531. this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm
  532. .isInWarehouse = 0
  533. }
  534. if (this.outsourceForm.requireDeliveryTime.indexOf('00:00:00') === -1) {
  535. this.outsourceForm.requireDeliveryTime = this.outsourceForm.requireDeliveryTime + '00:00:00';
  536. }
  537. let param = {
  538. ...this.outsourceForm,
  539. taskId: this.newTaskObj.currentTaskId,
  540. workOrderId: this.newTaskObj.workOrderId,
  541. }
  542. console.log(param)
  543. this.sceneText = "";//委外场景
  544. this.outsourceForm.outsourceScene = null;
  545. this.$refs.outsourceListRef.open(param)
  546. // let param = {
  547. // ...this.outsourceForm,
  548. // taskId: this.newTaskObj.currentTaskId,
  549. // workOrderId: this.newTaskObj.workOrderId,
  550. // isRelease: isRelease
  551. // }
  552. // applyoutsourceSave(param).then(res => {
  553. // console.log(res)
  554. // this.outCancel()
  555. // })
  556. },
  557. }
  558. }
  559. </script>
  560. <style lang="scss" scoped>
  561. .bottom_box {
  562. background: #fff;
  563. }
  564. .nav_box {
  565. width: 750rpx;
  566. height: 40rpx;
  567. background: $theme-color;
  568. .open_icon {
  569. width: 48rpx;
  570. height: 48rpx;
  571. }
  572. .open_icon_reversal {
  573. transform: scaleY(-1);
  574. /* 垂直翻转 */
  575. }
  576. }
  577. .operate_list {
  578. margin: 0 32rpx;
  579. .list {
  580. border-radius: 8rpx;
  581. border: 1rpx solid $theme-color;
  582. background: #F0F8F2;
  583. height: 64rpx;
  584. padding: 0rpx 16rpx;
  585. margin-top: 16rpx;
  586. }
  587. .round {
  588. width: 32rpx;
  589. height: 32rpx;
  590. line-height: 32rpx;
  591. text-align: center;
  592. border-radius: 50%;
  593. background: $theme-color;
  594. font-size: 24rpx;
  595. font-style: normal;
  596. font-weight: 400;
  597. color: #fff;
  598. }
  599. .name {
  600. font-family: PingFang HK;
  601. font-size: 24rpx;
  602. font-style: normal;
  603. font-weight: 600;
  604. color: $theme-color;
  605. }
  606. .arrow_right {
  607. width: 32rpx;
  608. height: 32rpx;
  609. }
  610. }
  611. .btn_box {
  612. display: flex;
  613. padding: 16rpx 32rpx;
  614. align-items: flex-start;
  615. gap: 16rpx;
  616. align-self: stretch;
  617. .btn {
  618. width: 160rpx;
  619. height: 64rpx;
  620. line-height: 64rpx;
  621. background: $theme-color;
  622. text-align: center;
  623. border-radius: 8rpx;
  624. color: #fff;
  625. font-family: PingFang HK;
  626. font-size: 24rpx;
  627. font-style: normal;
  628. font-weight: 600;
  629. }
  630. }
  631. .operate_box {
  632. padding: 10rpx 20rpx;
  633. /deep/ .u-button {
  634. width: 180rpx;
  635. }
  636. }
  637. .popup_list {
  638. width: 78vw;
  639. min-height: 360rpx;
  640. padding: 0 32rpx;
  641. .title {
  642. color: #333;
  643. font-size: 32rpx;
  644. text-align: center;
  645. padding: 30rpx;
  646. }
  647. }
  648. .list_item_btn {
  649. width: 160rpx;
  650. height: 54rpx;
  651. line-height: 54rpx;
  652. background: $theme-color;
  653. text-align: center;
  654. border-radius: 8rpx;
  655. color: #fff;
  656. font-family: PingFang HK;
  657. font-size: 22rpx;
  658. font-style: normal;
  659. font-weight: 600;
  660. }
  661. .content_num {
  662. display: flex;
  663. align-items: center;
  664. padding: 0 4rpx;
  665. /deep/ .uni-input-input {
  666. border: 2rpx solid #F0F8F2;
  667. background: #F0F8F2;
  668. color: $theme-color;
  669. }
  670. }
  671. </style>