bottomOperate.vue 16 KB

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