bottomOperate.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  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")
  282. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  283. isInWarehouse: []
  284. }
  285. },
  286. created() {
  287. },
  288. methods: {
  289. //委外到 类型选择
  290. changeTaskId(e){
  291. console.log(this.newStepsList);
  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. // 委外时间选择
  321. //委外到 类型选择
  322. changeTaskId(e){
  323. console.log(this.newStepsList);
  324. if(this.newStepsList.length){
  325. const id =this.newStepsList[0].sourceTaskId;
  326. //isFirstTask 1是首工序 0不是
  327. if(this.outsourceForm.isFirstTask){
  328. this.sceneText = "首工序";
  329. this.outsourceForm.outsourceScene = 1;
  330. if(e.sourceTaskId!==id){
  331. this.sceneText = "首工序及多工序";
  332. this.outsourceForm.outsourceScene = 4;
  333. }
  334. }else{
  335. if(e.sourceTaskId===id){
  336. // 单工序
  337. this.sceneText = "单工序"
  338. this.outsourceForm.outsourceScene = 2;
  339. }else{
  340. //多工序
  341. this.sceneText = "多工序"
  342. this.outsourceForm.outsourceScene =3;
  343. }
  344. }
  345. }else{
  346. uni.showToast({
  347. title: '委外到工序为空',
  348. icon: 'none'
  349. })
  350. }
  351. },
  352. open() {
  353. this.isOperate = !this.isOperate
  354. },
  355. operate(type, item) {
  356. this.$emit('operate', type, item)
  357. },
  358. handOutsource() {
  359. let param = {
  360. taskId: this.newTaskObj.currentTaskId,
  361. workOrderId: this.newTaskObj.workOrderId,
  362. }
  363. checkOutsource(param).then(res => {
  364. this.outsourceForm = {
  365. ...res,
  366. }
  367. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  368. if (res.outsource) {
  369. this.getNewSteps()
  370. this.outsourceShow = true
  371. this.produceFn()
  372. this.getWarehouseFn()
  373. } else {
  374. uni.showToast({
  375. title: '此工序不能委外',
  376. icon: 'none'
  377. })
  378. }
  379. })
  380. },
  381. handPause() {
  382. if (this.GDStatus == 9) {
  383. uni.showModal({
  384. title: '提示',
  385. content: '确定该工单取消暂停?',
  386. success: async res => {
  387. if (res.confirm) {
  388. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  389. this.$emit('refresh')
  390. })
  391. }
  392. }
  393. })
  394. } else {
  395. uni.showModal({
  396. title: '提示',
  397. content: '确定该工单暂停?',
  398. success: async res => {
  399. if (res.confirm) {
  400. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  401. this.$emit('refresh')
  402. })
  403. }
  404. }
  405. })
  406. }
  407. },
  408. handHandover() {
  409. this.$refs.handoverRef.open()
  410. },
  411. handTerminate() {
  412. uni.showModal({
  413. title: '提示',
  414. content: '确定该工单终止?',
  415. success: async res => {
  416. if (res.confirm) {
  417. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  418. this.$emit('refresh')
  419. })
  420. }
  421. }
  422. })
  423. },
  424. outCancel() {
  425. this.sceneText="";//委外场景
  426. this.outsourceForm.outsourceScene =null;
  427. this.outsourceShow = false
  428. EventBus.$off('outEvent');
  429. },
  430. getNewSteps() {
  431. this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
  432. this.newStepsList = []
  433. this.stepsList.forEach((f, i) => {
  434. if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
  435. 4)) {
  436. this.newStepsList.push(f)
  437. }
  438. })
  439. },
  440. getIndexOfElementInArray(array, target) {
  441. for (let i = 0; i < array.length; i++) {
  442. if (array[i].taskId === target) {
  443. return i; // 返回第一次出现target的索引位置
  444. }
  445. }
  446. return -1; // 未找到目标值时返回-1
  447. },
  448. // 工艺路线
  449. produceFn() {
  450. let param = {
  451. pageNum: 1,
  452. size: -1,
  453. routeType: 2
  454. }
  455. producerouting(param).then(res => {
  456. this.produceList = res.list
  457. })
  458. },
  459. // 仓库
  460. getWarehouseFn() {
  461. getWarehouseList().then(res => {
  462. this.warehouseList = res
  463. })
  464. },
  465. outsourceOk() {
  466. if (!this.outsourceForm.name) {
  467. uni.showToast({
  468. title: '请输入委外名称',
  469. icon: 'none'
  470. })
  471. return false
  472. }
  473. if (!this.outsourceForm.type) {
  474. uni.showToast({
  475. title: '请选择委外类型',
  476. icon: 'none'
  477. })
  478. return false
  479. }
  480. if (!this.outsourceForm.requireDeliveryTime) {
  481. uni.showToast({
  482. title: '请选择委外完成时间',
  483. icon: 'none'
  484. })
  485. return false
  486. }
  487. if (this.clientEnvironmentId == 2) {
  488. this.outsourceForm.isInWarehouse = 1
  489. } else {
  490. this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm
  491. .isInWarehouse = 0
  492. }
  493. this.outsourceForm.requireDeliveryTime = this.outsourceForm.requireDeliveryTime+'00:00:00';
  494. console.log(this.outsourceForm,'this.outsourceForm.');
  495. let param = {
  496. ...this.outsourceForm,
  497. taskId: this.newTaskObj.currentTaskId,
  498. workOrderId: this.newTaskObj.workOrderId,
  499. }
  500. console.log(param)
  501. this.sceneText="";//委外场景
  502. this.outsourceForm.outsourceScene =null;
  503. this.$refs.outsourceListRef.open(param)
  504. // let param = {
  505. // ...this.outsourceForm,
  506. // taskId: this.newTaskObj.currentTaskId,
  507. // workOrderId: this.newTaskObj.workOrderId,
  508. // isRelease: isRelease
  509. // }
  510. // applyoutsourceSave(param).then(res => {
  511. // console.log(res)
  512. // this.outCancel()
  513. // })
  514. },
  515. }
  516. }
  517. </script>
  518. <style lang="scss" scoped>
  519. .bottom_box {
  520. background: #fff;
  521. }
  522. .nav_box {
  523. width: 750rpx;
  524. height: 40rpx;
  525. background: $theme-color;
  526. .open_icon {
  527. width: 48rpx;
  528. height: 48rpx;
  529. }
  530. .open_icon_reversal {
  531. transform: scaleY(-1);
  532. /* 垂直翻转 */
  533. }
  534. }
  535. .operate_list {
  536. margin: 0 32rpx;
  537. .list {
  538. border-radius: 8rpx;
  539. border: 1rpx solid $theme-color;
  540. background: #F0F8F2;
  541. height: 64rpx;
  542. padding: 0rpx 16rpx;
  543. margin-top: 16rpx;
  544. }
  545. .round {
  546. width: 32rpx;
  547. height: 32rpx;
  548. line-height: 32rpx;
  549. text-align: center;
  550. border-radius: 50%;
  551. background: $theme-color;
  552. font-size: 24rpx;
  553. font-style: normal;
  554. font-weight: 400;
  555. color: #fff;
  556. }
  557. .name {
  558. font-family: PingFang HK;
  559. font-size: 24rpx;
  560. font-style: normal;
  561. font-weight: 600;
  562. color: $theme-color;
  563. }
  564. .arrow_right {
  565. width: 32rpx;
  566. height: 32rpx;
  567. }
  568. }
  569. .btn_box {
  570. display: flex;
  571. padding: 16rpx 32rpx;
  572. align-items: flex-start;
  573. gap: 16rpx;
  574. align-self: stretch;
  575. .btn {
  576. width: 160rpx;
  577. height: 64rpx;
  578. line-height: 64rpx;
  579. background: $theme-color;
  580. text-align: center;
  581. border-radius: 8rpx;
  582. color: #fff;
  583. font-family: PingFang HK;
  584. font-size: 24rpx;
  585. font-style: normal;
  586. font-weight: 600;
  587. }
  588. }
  589. .operate_box {
  590. padding: 10rpx 20rpx;
  591. /deep/ .u-button {
  592. width: 180rpx;
  593. }
  594. }
  595. .popup_list {
  596. width: 78vw;
  597. min-height: 360rpx;
  598. padding: 0 32rpx;
  599. .title {
  600. color: #333;
  601. font-size: 32rpx;
  602. text-align: center;
  603. padding: 30rpx;
  604. }
  605. }
  606. .list_item_btn {
  607. width: 160rpx;
  608. height: 54rpx;
  609. line-height: 54rpx;
  610. background: $theme-color;
  611. text-align: center;
  612. border-radius: 8rpx;
  613. color: #fff;
  614. font-family: PingFang HK;
  615. font-size: 22rpx;
  616. font-style: normal;
  617. font-weight: 600;
  618. }
  619. .content_num {
  620. display: flex;
  621. align-items: center;
  622. padding: 0 4rpx;
  623. /deep/ .uni-input-input {
  624. border: 2rpx solid #F0F8F2;
  625. background: #F0F8F2;
  626. color: $theme-color;
  627. }
  628. }
  629. </style>