bottomOperate.vue 15 KB

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