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="是" disabled></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. this.newTaskObj = newVal
  186. }
  187. },
  188. stepsList: {
  189. immediate: true,
  190. deep: true,
  191. handler(newVal) {
  192. }
  193. }
  194. },
  195. data() {
  196. return {
  197. isOperate: false,
  198. sceneText: '',
  199. outsourceScene: null,
  200. btnsList: [],
  201. btnState: 1,
  202. GDStatus: null,
  203. btnControlReportMethod: null,
  204. btnList: {
  205. 1: [{
  206. name: '领料',
  207. type: 'picking'
  208. },
  209. {
  210. name: '投料',
  211. type: 'feeding'
  212. },
  213. {
  214. name: '更换周转车',
  215. type: 'turnover'
  216. },
  217. {
  218. name: '报工',
  219. type: 'jobBooking',
  220. isOutsource: 0
  221. },
  222. // {
  223. // name: '多工单报工',
  224. // type: ''
  225. // }
  226. ],
  227. 2: [{
  228. name: '取样',
  229. type: 'sample'
  230. },
  231. {
  232. name: '报工',
  233. type: 'sampleJob'
  234. },
  235. ],
  236. 3: [{
  237. name: '更换周转车',
  238. type: 'qualityTurnover'
  239. },
  240. {
  241. name: '质检',
  242. type: 'inspection'
  243. },
  244. {
  245. name: '报工',
  246. type: 'inspectionJob'
  247. }
  248. ],
  249. 4: [{
  250. name: '领料',
  251. type: 'picking'
  252. },
  253. {
  254. name: '投料',
  255. type: 'feeding'
  256. },
  257. {
  258. name: '报工',
  259. type: 'jobBooking'
  260. },
  261. ],
  262. 5: [{
  263. name: '入库',
  264. type: 'warehousing'
  265. },
  266. ],
  267. 6: [{
  268. name: '报工',
  269. type: 'jobBooking'
  270. },
  271. ],
  272. },
  273. btnListOne: {
  274. 1: [{
  275. name: '领料',
  276. type: 'picking'
  277. },
  278. {
  279. name: '投料',
  280. type: 'feeding'
  281. },
  282. {
  283. name: '报工',
  284. type: 'jobBooking',
  285. isOutsource: 0
  286. },
  287. // {
  288. // name: '多工单报工',
  289. // type: ''
  290. // }
  291. ],
  292. 2: [{
  293. name: '取样',
  294. type: 'sample'
  295. },
  296. {
  297. name: '报工',
  298. type: 'sampleJob'
  299. },
  300. ],
  301. 3: [
  302. {
  303. name: '质检',
  304. type: 'inspection'
  305. },
  306. {
  307. name: '报工',
  308. type: 'inspectionJob'
  309. }
  310. ],
  311. 4: [{
  312. name: '领料',
  313. type: 'picking'
  314. },
  315. {
  316. name: '投料',
  317. type: 'feeding'
  318. },
  319. {
  320. name: '报工',
  321. type: 'jobBooking'
  322. },
  323. ],
  324. 5: [{
  325. name: '入库',
  326. type: 'warehousing'
  327. },
  328. ],
  329. 6: [{
  330. name: '报工',
  331. type: 'jobBooking'
  332. },
  333. ],
  334. },
  335. sceneText: '',
  336. outsourceScene: null,
  337. newTaskObj: {},
  338. outsourceShow: false,
  339. outsourceForm: {
  340. },
  341. produceList: [],
  342. warehouseList: [],
  343. typeList: [{
  344. id: 4,
  345. name: '带料生产委外'
  346. },
  347. {
  348. id: 5,
  349. name: '不带料生产委外'
  350. },
  351. ],
  352. newStepsList: [],
  353. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  354. isInWarehouse: [1]
  355. }
  356. },
  357. created() {
  358. },
  359. methods: {
  360. // 委外时间选择
  361. //委外到 类型选择
  362. changeTaskId(e) {
  363. console.log(this.outsourceForm, e);
  364. if (this.newStepsList.length) {
  365. const id = this.newStepsList[0].sourceTaskId;
  366. //isFirstTask 1是首工序 0不是
  367. if (this.outsourceForm.isFirstTask) {
  368. this.sceneText = "首工序";
  369. this.outsourceForm.outsourceScene = 1;
  370. if (e.sourceTaskId !== id) {
  371. this.sceneText = "首工序及多工序";
  372. this.outsourceForm.outsourceScene = 4;
  373. }
  374. } else {
  375. if (e.sourceTaskId === id) {
  376. // 单工序
  377. this.sceneText = "单工序"
  378. this.outsourceForm.outsourceScene = 2;
  379. } else {
  380. //多工序
  381. this.sceneText = "多工序"
  382. this.outsourceForm.outsourceScene = 3;
  383. }
  384. }
  385. } else {
  386. uni.showToast({
  387. title: '委外到工序为空',
  388. icon: 'none'
  389. })
  390. }
  391. },
  392. open() {
  393. this.isOperate = !this.isOperate
  394. },
  395. operate(type, item) {
  396. this.$emit('operate', type, item)
  397. },
  398. handOutsource() {
  399. let param = {
  400. taskId: this.newTaskObj.currentTaskId,
  401. workOrderId: this.newTaskObj.workOrderId,
  402. }
  403. checkOutsource(param).then(res => {
  404. this.outsourceForm = {
  405. ...res,
  406. }
  407. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  408. if (res.outsource) {
  409. this.getNewSteps()
  410. this.outsourceShow = true
  411. this.produceFn()
  412. this.getWarehouseFn()
  413. } else {
  414. uni.showToast({
  415. title: '此工序不能委外',
  416. icon: 'none'
  417. })
  418. }
  419. })
  420. },
  421. handPause() {
  422. if (this.GDStatus == 9) {
  423. uni.showModal({
  424. title: '提示',
  425. content: '确定该工单取消暂停?',
  426. success: async res => {
  427. if (res.confirm) {
  428. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  429. this.$emit('refresh')
  430. })
  431. }
  432. }
  433. })
  434. } else {
  435. uni.showModal({
  436. title: '提示',
  437. content: '确定该工单暂停?',
  438. success: async res => {
  439. if (res.confirm) {
  440. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  441. this.$emit('refresh')
  442. })
  443. }
  444. }
  445. })
  446. }
  447. },
  448. handHandover() {
  449. this.$refs.handoverRef.open()
  450. },
  451. handTerminate() {
  452. uni.showModal({
  453. title: '提示',
  454. content: '确定该工单终止?',
  455. success: async res => {
  456. if (res.confirm) {
  457. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  458. this.$emit('refresh')
  459. })
  460. }
  461. }
  462. })
  463. },
  464. outCancel() {
  465. this.sceneText = "";//委外场景
  466. this.outsourceForm.outsourceScene = null;
  467. this.outsourceShow = false
  468. EventBus.$off('outEvent');
  469. },
  470. getNewSteps() {
  471. this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
  472. this.newStepsList = []
  473. this.stepsList.forEach((f, i) => {
  474. if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
  475. 4)) {
  476. this.newStepsList.push(f)
  477. }
  478. })
  479. },
  480. getIndexOfElementInArray(array, target) {
  481. for (let i = 0; i < array.length; i++) {
  482. if (array[i].taskId === target) {
  483. return i; // 返回第一次出现target的索引位置
  484. }
  485. }
  486. return -1; // 未找到目标值时返回-1
  487. },
  488. // 工艺路线
  489. produceFn() {
  490. let param = {
  491. pageNum: 1,
  492. size: -1,
  493. routeType: 2
  494. }
  495. producerouting(param).then(res => {
  496. this.produceList = res.list
  497. })
  498. },
  499. // 仓库
  500. getWarehouseFn() {
  501. getWarehouseList().then(res => {
  502. this.warehouseList = res
  503. })
  504. },
  505. outsourceOk() {
  506. if (!this.outsourceForm.name) {
  507. uni.showToast({
  508. title: '请输入委外名称',
  509. icon: 'none'
  510. })
  511. return false
  512. }
  513. if (!this.outsourceForm.type) {
  514. uni.showToast({
  515. title: '请选择委外类型',
  516. icon: 'none'
  517. })
  518. return false
  519. }
  520. if (!this.outsourceForm.requireDeliveryTime) {
  521. uni.showToast({
  522. title: '请选择委外完成时间',
  523. icon: 'none'
  524. })
  525. return false
  526. }
  527. if (this.clientEnvironmentId == 2) {
  528. this.outsourceForm.isInWarehouse = 1
  529. } else {
  530. this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm
  531. .isInWarehouse = 0
  532. }
  533. if (this.outsourceForm.requireDeliveryTime.indexOf('00:00:00') === -1) {
  534. this.outsourceForm.requireDeliveryTime = this.outsourceForm.requireDeliveryTime + '00:00:00';
  535. }
  536. let param = {
  537. ...this.outsourceForm,
  538. taskId: this.newTaskObj.currentTaskId,
  539. workOrderId: this.newTaskObj.workOrderId,
  540. }
  541. console.log(param)
  542. this.sceneText = "";//委外场景
  543. this.outsourceForm.outsourceScene = null;
  544. this.$refs.outsourceListRef.open(param)
  545. // let param = {
  546. // ...this.outsourceForm,
  547. // taskId: this.newTaskObj.currentTaskId,
  548. // workOrderId: this.newTaskObj.workOrderId,
  549. // isRelease: isRelease
  550. // }
  551. // applyoutsourceSave(param).then(res => {
  552. // console.log(res)
  553. // this.outCancel()
  554. // })
  555. },
  556. }
  557. }
  558. </script>
  559. <style lang="scss" scoped>
  560. .bottom_box {
  561. background: #fff;
  562. }
  563. .nav_box {
  564. width: 750rpx;
  565. height: 40rpx;
  566. background: $theme-color;
  567. .open_icon {
  568. width: 48rpx;
  569. height: 48rpx;
  570. }
  571. .open_icon_reversal {
  572. transform: scaleY(-1);
  573. /* 垂直翻转 */
  574. }
  575. }
  576. .operate_list {
  577. margin: 0 32rpx;
  578. .list {
  579. border-radius: 8rpx;
  580. border: 1rpx solid $theme-color;
  581. background: #F0F8F2;
  582. height: 64rpx;
  583. padding: 0rpx 16rpx;
  584. margin-top: 16rpx;
  585. }
  586. .round {
  587. width: 32rpx;
  588. height: 32rpx;
  589. line-height: 32rpx;
  590. text-align: center;
  591. border-radius: 50%;
  592. background: $theme-color;
  593. font-size: 24rpx;
  594. font-style: normal;
  595. font-weight: 400;
  596. color: #fff;
  597. }
  598. .name {
  599. font-family: PingFang HK;
  600. font-size: 24rpx;
  601. font-style: normal;
  602. font-weight: 600;
  603. color: $theme-color;
  604. }
  605. .arrow_right {
  606. width: 32rpx;
  607. height: 32rpx;
  608. }
  609. }
  610. .btn_box {
  611. display: flex;
  612. padding: 16rpx 32rpx;
  613. align-items: flex-start;
  614. gap: 16rpx;
  615. align-self: stretch;
  616. .btn {
  617. width: 160rpx;
  618. height: 64rpx;
  619. line-height: 64rpx;
  620. background: $theme-color;
  621. text-align: center;
  622. border-radius: 8rpx;
  623. color: #fff;
  624. font-family: PingFang HK;
  625. font-size: 24rpx;
  626. font-style: normal;
  627. font-weight: 600;
  628. }
  629. }
  630. .operate_box {
  631. padding: 10rpx 20rpx;
  632. /deep/ .u-button {
  633. width: 180rpx;
  634. }
  635. }
  636. .popup_list {
  637. width: 78vw;
  638. min-height: 360rpx;
  639. padding: 0 32rpx;
  640. .title {
  641. color: #333;
  642. font-size: 32rpx;
  643. text-align: center;
  644. padding: 30rpx;
  645. }
  646. }
  647. .list_item_btn {
  648. width: 160rpx;
  649. height: 54rpx;
  650. line-height: 54rpx;
  651. background: $theme-color;
  652. text-align: center;
  653. border-radius: 8rpx;
  654. color: #fff;
  655. font-family: PingFang HK;
  656. font-size: 22rpx;
  657. font-style: normal;
  658. font-weight: 600;
  659. }
  660. .content_num {
  661. display: flex;
  662. align-items: center;
  663. padding: 0 4rpx;
  664. /deep/ .uni-input-input {
  665. border: 2rpx solid #F0F8F2;
  666. background: #F0F8F2;
  667. color: $theme-color;
  668. }
  669. }
  670. </style>