bottomOperate.vue 14 KB

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