bottomOperate.vue 16 KB

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