bottomOperate.vue 14 KB

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