bottomOperate.vue 14 KB

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