bottomOperate.vue 14 KB

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