bottomOperate.vue 11 KB

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