bottomOperate.vue 15 KB

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