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. this.btnControlReportMethod = newVal
  126. }
  127. },
  128. taskObj: {
  129. immediate: true,
  130. deep: true,
  131. handler(newVal) {
  132. this.newTaskObj = newVal
  133. }
  134. }
  135. },
  136. data() {
  137. return {
  138. isOperate: false,
  139. btnsList: [],
  140. btnState: 1,
  141. GDStatus: null,
  142. btnControlReportMethod: null,
  143. btnList: {
  144. 1: [{
  145. name: '领料',
  146. type: 'picking'
  147. },
  148. {
  149. name: '投料',
  150. type: 'feeding'
  151. },
  152. {
  153. name: '报工',
  154. type: 'jobBooking'
  155. },
  156. {
  157. name: '更换周转车',
  158. type: 'turnover'
  159. },
  160. ],
  161. 2: [{
  162. name: '取样',
  163. type: 'sample'
  164. },
  165. {
  166. name: '报工',
  167. type: 'sampleJob'
  168. },
  169. ],
  170. 3: [{
  171. name: '报工',
  172. type: 'inspection'
  173. }, ],
  174. 4: [{
  175. name: '领料',
  176. type: 'picking'
  177. },
  178. {
  179. name: '投料',
  180. type: 'feeding'
  181. },
  182. {
  183. name: '报工',
  184. type: 'jobBooking'
  185. },
  186. ],
  187. 5: [{
  188. name: '入库',
  189. type: 'warehousing'
  190. },
  191. ],
  192. 6: [{
  193. name: '报工',
  194. type: 'jobBooking'
  195. },
  196. ],
  197. },
  198. newTaskObj: {},
  199. outsourceShow: false,
  200. outsourceForm: {
  201. },
  202. produceList: [],
  203. warehouseList: [],
  204. typeList: [{
  205. id: 1,
  206. name: '采购委外'
  207. },
  208. {
  209. id: 2,
  210. name: '直接发货委外'
  211. },
  212. {
  213. id: 3,
  214. name: '无采购委外'
  215. },
  216. ],
  217. materialList: [{
  218. id: 1,
  219. name: '产品'
  220. },
  221. {
  222. id: 2,
  223. name: '半成品'
  224. },
  225. ]
  226. }
  227. },
  228. created() {
  229. this.getTwoTree()
  230. },
  231. methods: {
  232. getTwoTree() {
  233. getTwoTreeByPid(12).then(res => {
  234. let _arr = res.map(m => {
  235. m.type = 'inspection'
  236. return m
  237. })
  238. this.btnList[3] = []
  239. this.btnList[3] = [{
  240. name: '更换周转车',
  241. type: 'qualityTurnover'
  242. },
  243. ..._arr,
  244. {
  245. name: '报工',
  246. type: 'inspectionJob'
  247. }
  248. ]
  249. })
  250. },
  251. open() {
  252. this.isOperate = !this.isOperate
  253. },
  254. operate(type, item) {
  255. this.$emit('operate', type, item)
  256. },
  257. handOutsource() {
  258. let param = {
  259. taskId: this.newTaskObj.currentTaskId,
  260. workOrderId: this.newTaskObj.workOrderId,
  261. }
  262. checkOutsource(param).then(res => {
  263. this.outsourceForm = {
  264. ...res,
  265. requireDeliveryTime: '2024-06-30'
  266. }
  267. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  268. if (res.outsource) {
  269. this.outsourceShow = true
  270. this.produceFn()
  271. this.getWarehouseFn()
  272. } else {
  273. uni.showToast({
  274. title: '此工序不能委外',
  275. icon: 'none'
  276. })
  277. }
  278. })
  279. },
  280. handPause() {
  281. if (this.GDStatus == 9) {
  282. uni.showModal({
  283. title: '提示',
  284. content: '确定该工单取消暂停?',
  285. success: async res => {
  286. if (res.confirm) {
  287. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  288. this.$emit('refresh')
  289. })
  290. }
  291. }
  292. })
  293. } else {
  294. uni.showModal({
  295. title: '提示',
  296. content: '确定该工单暂停?',
  297. success: async res => {
  298. if (res.confirm) {
  299. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  300. this.$emit('refresh')
  301. })
  302. }
  303. }
  304. })
  305. }
  306. },
  307. handTerminate() {
  308. uni.showModal({
  309. title: '提示',
  310. content: '确定该工单终止?',
  311. success: async res => {
  312. if (res.confirm) {
  313. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  314. this.$emit('refresh')
  315. })
  316. }
  317. }
  318. })
  319. },
  320. outCancel() {
  321. this.outsourceShow = false
  322. },
  323. onDateChange(e) {
  324. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  325. this.$forceUpdate()
  326. },
  327. // 工艺路线
  328. produceFn() {
  329. let param = {
  330. pageNum: 1,
  331. size: -1,
  332. routeType: 2
  333. }
  334. producerouting(param).then(res => {
  335. this.produceList = res.list
  336. })
  337. },
  338. // 仓库
  339. getWarehouseFn() {
  340. getWarehouseList().then(res => {
  341. this.warehouseList = res
  342. })
  343. },
  344. outsourceOk(isRelease) {
  345. if (!this.outsourceForm.name) {
  346. uni.showToast({
  347. title: '请输入委外名称',
  348. icon: 'none'
  349. })
  350. return false
  351. }
  352. if (!this.outsourceForm.type) {
  353. uni.showToast({
  354. title: '请选择委外类型',
  355. icon: 'none'
  356. })
  357. return false
  358. }
  359. if (this.outsourceForm.type == 2 && !this.outsourceForm.material) {
  360. uni.showToast({
  361. title: '请选择委外物料',
  362. icon: 'none'
  363. })
  364. return false
  365. }
  366. if (!this.outsourceForm.produceRoutingId) {
  367. uni.showToast({
  368. title: '请选择工艺路线',
  369. icon: 'none'
  370. })
  371. return false
  372. }
  373. if (!this.outsourceForm.requireDeliveryTime) {
  374. uni.showToast({
  375. title: '请选择委外完成时间',
  376. icon: 'none'
  377. })
  378. return false
  379. }
  380. let param = {
  381. ...this.outsourceForm,
  382. taskId: this.newTaskObj.currentTaskId,
  383. workOrderId: this.newTaskObj.workOrderId,
  384. isRelease: isRelease
  385. }
  386. applyoutsourceSave(param).then(res => {
  387. console.log(res)
  388. this.outCancel()
  389. })
  390. },
  391. }
  392. }
  393. </script>
  394. <style lang="scss" scoped>
  395. .bottom_box {
  396. background: #fff;
  397. }
  398. .nav_box {
  399. width: 750rpx;
  400. height: 40rpx;
  401. background: $theme-color;
  402. .open_icon {
  403. width: 48rpx;
  404. height: 48rpx;
  405. }
  406. .open_icon_reversal {
  407. transform: scaleY(-1);
  408. /* 垂直翻转 */
  409. }
  410. }
  411. .operate_list {
  412. margin: 0 32rpx;
  413. .list {
  414. border-radius: 8rpx;
  415. border: 1rpx solid $theme-color;
  416. background: #F0F8F2;
  417. height: 64rpx;
  418. padding: 0rpx 16rpx;
  419. margin-top: 16rpx;
  420. }
  421. .round {
  422. width: 32rpx;
  423. height: 32rpx;
  424. line-height: 32rpx;
  425. text-align: center;
  426. border-radius: 50%;
  427. background: $theme-color;
  428. font-size: 24rpx;
  429. font-style: normal;
  430. font-weight: 400;
  431. color: #fff;
  432. }
  433. .name {
  434. font-family: PingFang HK;
  435. font-size: 24rpx;
  436. font-style: normal;
  437. font-weight: 600;
  438. color: $theme-color;
  439. }
  440. .arrow_right {
  441. width: 32rpx;
  442. height: 32rpx;
  443. }
  444. }
  445. .btn_box {
  446. display: flex;
  447. padding: 16rpx 32rpx;
  448. align-items: flex-start;
  449. gap: 16rpx;
  450. align-self: stretch;
  451. .btn {
  452. width: 160rpx;
  453. height: 64rpx;
  454. line-height: 64rpx;
  455. background: $theme-color;
  456. text-align: center;
  457. border-radius: 8rpx;
  458. color: #fff;
  459. font-family: PingFang HK;
  460. font-size: 24rpx;
  461. font-style: normal;
  462. font-weight: 600;
  463. }
  464. }
  465. .operate_box {
  466. padding: 10rpx 20rpx;
  467. /deep/ .u-button {
  468. width: 180rpx;
  469. }
  470. }
  471. .popup_list {
  472. width: 78vw;
  473. min-height: 360rpx;
  474. padding: 0 32rpx;
  475. .title {
  476. color: #333;
  477. font-size: 28rpx;
  478. text-align: center;
  479. padding: 30rpx;
  480. }
  481. }
  482. </style>