bottomOperate.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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 ? 'color: #FFA929' : ''" @click="handOutsource()">委外</view>
  34. </view>
  35. <SearchPopup mode="center" v-if="outsourceShow">
  36. <template v-slot:list>
  37. <view class="popup_list">
  38. <view class="title">【{{taskObj.currentTaskName}}】是否委外</view>
  39. <u-form labelPosition="left" :model="outsourceForm" labelWidth="180" labelAlign="left" class="">
  40. <u-form-item label="委外名称:" borderBottom prop="name">
  41. <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
  42. </u-form-item>
  43. <u-form-item label="委外类型:" borderBottom prop="">
  44. <zxz-uni-data-select :localdata="typeList" v-model="outsourceForm.type" dataValue='id'
  45. dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  46. </u-form-item>
  47. <u-form-item label="委外数量:" borderBottom prop="formedNumLast" v-if="clientEnvironmentId == 2">
  48. <input class="uni-input content_num"
  49. v-model="outsourceForm.formedNumLast" type='number'></input>
  50. </u-form-item>
  51. <u-form-item label="委外到:" borderBottom prop="taskIds">
  52. <zxz-uni-data-select :localdata="newStepsList" v-model="outsourceForm.taskIds"
  53. dataValue='taskId' format='{taskTypeName}' dataKey="taskId" filterable
  54. :clear='true'></zxz-uni-data-select>
  55. </u-form-item>
  56. <u-form-item label="直接入库:" borderBottom prop="isInWarehouse" >
  57. <u-checkbox-group v-model="isInWarehouse" size="14px" v-if="clientEnvironmentId != 2 " >
  58. <u-checkbox labelSize="14px" iconSize="10px" activeColor="#157A2C" name="true" label="是"></u-checkbox>
  59. </u-checkbox-group>
  60. <view v-if="clientEnvironmentId == 2 " >是</view>
  61. <zxz-uni-data-select style="margin-left: 10px;" v-if="clientEnvironmentId == 2 || isInWarehouse.length" :localdata="warehouseList" v-model="outsourceForm.warehouseId"
  62. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  63. </u-form-item>
  64. <u-form-item label="工艺路线:" borderBottom prop="produceRoutingId" v-if="clientEnvironmentId != 2 &&isInWarehouse && isInWarehouse.length == 0">
  65. <zxz-uni-data-select :localdata="produceList" v-model="outsourceForm.produceRoutingId"
  66. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  67. </u-form-item>
  68. <u-form-item label="计划交期:" borderBottom prop="requireDeliveryTime">
  69. <picker mode="date" :value="outsourceForm.requireDeliveryTime" @change="onDateChange">
  70. <view class="uni-input">{{ outsourceForm.requireDeliveryTime || '选择日期' }}</view>
  71. </picker>
  72. </u-form-item>
  73. </u-form>
  74. </view>
  75. </template>
  76. <template v-slot:operate>
  77. <view class="operate_box rx-bc">
  78. <u-button size="small" class="u-reset-button" @click="outCancel">
  79. 取消
  80. </u-button>
  81. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(0)">
  82. 确定
  83. </u-button>
  84. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  85. 提交并发布
  86. </u-button> -->
  87. </view>
  88. </template>
  89. </SearchPopup>
  90. <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
  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 {
  107. EventBus
  108. } from '@/utils/eventBus.js'
  109. export default {
  110. components: {
  111. SearchPopup,
  112. outsourceList
  113. },
  114. props: {
  115. state: String | Number,
  116. gdStatus: String | Number,
  117. taskObj: Object,
  118. controlReportMethod: String | Number,
  119. stepsList: {
  120. type: Array,
  121. default: () => []
  122. },
  123. },
  124. watch: {
  125. btns: {
  126. immediate: true,
  127. deep: true,
  128. handler(newVal) {
  129. this.btnsList = []
  130. this.btnsList = newVal
  131. }
  132. },
  133. state: {
  134. immediate: true,
  135. deep: true,
  136. handler(newVal) {
  137. this.btnState = newVal
  138. }
  139. },
  140. gdStatus: {
  141. immediate: true,
  142. deep: true,
  143. handler(newVal) {
  144. this.GDStatus = newVal
  145. }
  146. },
  147. controlReportMethod: {
  148. immediate: true,
  149. deep: true,
  150. handler(newVal) {
  151. this.btnControlReportMethod = newVal
  152. }
  153. },
  154. taskObj: {
  155. immediate: true,
  156. deep: true,
  157. handler(newVal) {
  158. console.log(newVal)
  159. this.newTaskObj = newVal
  160. }
  161. },
  162. stepsList: {
  163. immediate: true,
  164. deep: true,
  165. handler(newVal) {
  166. }
  167. }
  168. },
  169. data() {
  170. return {
  171. isOperate: false,
  172. btnsList: [],
  173. btnState: 1,
  174. GDStatus: null,
  175. btnControlReportMethod: null,
  176. btnList: {
  177. 1: [{
  178. name: '领料',
  179. type: 'picking'
  180. },
  181. {
  182. name: '投料',
  183. type: 'feeding'
  184. },
  185. {
  186. name: '更换周转车',
  187. type: 'turnover'
  188. },
  189. {
  190. name: '报工',
  191. type: 'jobBooking'
  192. },
  193. {
  194. name: '多工单报工',
  195. type: ''
  196. }
  197. ],
  198. 2: [{
  199. name: '取样',
  200. type: 'sample'
  201. },
  202. {
  203. name: '报工',
  204. type: 'sampleJob'
  205. },
  206. ],
  207. 3: [{
  208. name: '更换周转车',
  209. type: 'qualityTurnover'
  210. },
  211. {
  212. name: '质检',
  213. type: 'inspection'
  214. },
  215. {
  216. name: '报工',
  217. type: 'inspectionJob'
  218. }
  219. ],
  220. 4: [{
  221. name: '领料',
  222. type: 'picking'
  223. },
  224. {
  225. name: '投料',
  226. type: 'feeding'
  227. },
  228. {
  229. name: '报工',
  230. type: 'jobBooking'
  231. },
  232. ],
  233. 5: [{
  234. name: '入库',
  235. type: 'warehousing'
  236. },
  237. ],
  238. 6: [{
  239. name: '报工',
  240. type: 'jobBooking'
  241. },
  242. ],
  243. },
  244. newTaskObj: {},
  245. outsourceShow: false,
  246. outsourceForm: {
  247. },
  248. produceList: [],
  249. warehouseList: [],
  250. typeList: [{
  251. id: 4,
  252. name: '带料委外'
  253. },
  254. {
  255. id: 5,
  256. name: '无料委外'
  257. },
  258. ],
  259. newStepsList: [],
  260. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  261. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  262. isInWarehouse: []
  263. }
  264. },
  265. created() {
  266. },
  267. methods: {
  268. open() {
  269. this.isOperate = !this.isOperate
  270. },
  271. operate(type, item) {
  272. this.$emit('operate', type, item)
  273. },
  274. handOutsource() {
  275. let param = {
  276. taskId: this.newTaskObj.currentTaskId,
  277. workOrderId: this.newTaskObj.workOrderId,
  278. }
  279. checkOutsource(param).then(res => {
  280. this.outsourceForm = {
  281. ...res,
  282. }
  283. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  284. if (res.outsource) {
  285. this.getNewSteps()
  286. this.outsourceShow = true
  287. this.produceFn()
  288. this.getWarehouseFn()
  289. } else {
  290. uni.showToast({
  291. title: '此工序不能委外',
  292. icon: 'none'
  293. })
  294. }
  295. })
  296. },
  297. handPause() {
  298. if (this.GDStatus == 9) {
  299. uni.showModal({
  300. title: '提示',
  301. content: '确定该工单取消暂停?',
  302. success: async res => {
  303. if (res.confirm) {
  304. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  305. this.$emit('refresh')
  306. })
  307. }
  308. }
  309. })
  310. } else {
  311. uni.showModal({
  312. title: '提示',
  313. content: '确定该工单暂停?',
  314. success: async res => {
  315. if (res.confirm) {
  316. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  317. this.$emit('refresh')
  318. })
  319. }
  320. }
  321. })
  322. }
  323. },
  324. handTerminate() {
  325. uni.showModal({
  326. title: '提示',
  327. content: '确定该工单终止?',
  328. success: async res => {
  329. if (res.confirm) {
  330. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  331. this.$emit('refresh')
  332. })
  333. }
  334. }
  335. })
  336. },
  337. outCancel() {
  338. this.outsourceShow = false
  339. EventBus.$off('outEvent');
  340. },
  341. getNewSteps() {
  342. this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
  343. this.newStepsList = []
  344. this.stepsList.forEach((f, i) => {
  345. if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
  346. 4)) {
  347. this.newStepsList.push(f)
  348. }
  349. })
  350. },
  351. getIndexOfElementInArray(array, target) {
  352. for (let i = 0; i < array.length; i++) {
  353. if (array[i].taskId === target) {
  354. return i; // 返回第一次出现target的索引位置
  355. }
  356. }
  357. return -1; // 未找到目标值时返回-1
  358. },
  359. onDateChange(e) {
  360. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  361. this.$forceUpdate()
  362. },
  363. // 工艺路线
  364. produceFn() {
  365. let param = {
  366. pageNum: 1,
  367. size: -1,
  368. routeType: 2
  369. }
  370. producerouting(param).then(res => {
  371. this.produceList = res.list
  372. })
  373. },
  374. // 仓库
  375. getWarehouseFn() {
  376. getWarehouseList().then(res => {
  377. this.warehouseList = res
  378. })
  379. },
  380. outsourceOk(isRelease) {
  381. if (!this.outsourceForm.name) {
  382. uni.showToast({
  383. title: '请输入委外名称',
  384. icon: 'none'
  385. })
  386. return false
  387. }
  388. if (!this.outsourceForm.type) {
  389. uni.showToast({
  390. title: '请选择委外类型',
  391. icon: 'none'
  392. })
  393. return false
  394. }
  395. this.outsourceForm.requireDeliveryTime = '2025-03-18'
  396. if (!this.outsourceForm.requireDeliveryTime) {
  397. uni.showToast({
  398. title: '请选择委外完成时间',
  399. icon: 'none'
  400. })
  401. return false
  402. }
  403. if(this.clientEnvironmentId == 2) {
  404. this.outsourceForm.isInWarehouse = 1
  405. } else {
  406. this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm.isInWarehouse = 0
  407. }
  408. let param = {
  409. ...this.outsourceForm,
  410. taskId: this.newTaskObj.currentTaskId,
  411. workOrderId: this.newTaskObj.workOrderId,
  412. isRelease: isRelease
  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: 28rpx;
  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>