bottomOperate.vue 12 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. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  227. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  228. }
  229. },
  230. created() {
  231. this.getTwoTree()
  232. },
  233. methods: {
  234. getTwoTree() {
  235. getTwoTreeByPid(12).then(res => {
  236. let _arr = res.map(m => {
  237. m.type = 'inspection'
  238. return m
  239. })
  240. this.btnList[3] = []
  241. this.btnList[3] = [{
  242. name: '更换周转车',
  243. type: 'qualityTurnover'
  244. },
  245. ..._arr,
  246. {
  247. name: '报工',
  248. type: 'inspectionJob'
  249. }
  250. ]
  251. })
  252. },
  253. open() {
  254. this.isOperate = !this.isOperate
  255. },
  256. operate(type, item) {
  257. this.$emit('operate', type, item)
  258. },
  259. handOutsource() {
  260. let param = {
  261. taskId: this.newTaskObj.currentTaskId,
  262. workOrderId: this.newTaskObj.workOrderId,
  263. }
  264. checkOutsource(param).then(res => {
  265. this.outsourceForm = {
  266. ...res,
  267. requireDeliveryTime: '2024-06-30'
  268. }
  269. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  270. if (res.outsource) {
  271. this.outsourceShow = true
  272. this.produceFn()
  273. this.getWarehouseFn()
  274. } else {
  275. uni.showToast({
  276. title: '此工序不能委外',
  277. icon: 'none'
  278. })
  279. }
  280. })
  281. },
  282. handPause() {
  283. if (this.GDStatus == 9) {
  284. uni.showModal({
  285. title: '提示',
  286. content: '确定该工单取消暂停?',
  287. success: async res => {
  288. if (res.confirm) {
  289. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  290. this.$emit('refresh')
  291. })
  292. }
  293. }
  294. })
  295. } else {
  296. uni.showModal({
  297. title: '提示',
  298. content: '确定该工单暂停?',
  299. success: async res => {
  300. if (res.confirm) {
  301. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  302. this.$emit('refresh')
  303. })
  304. }
  305. }
  306. })
  307. }
  308. },
  309. handTerminate() {
  310. uni.showModal({
  311. title: '提示',
  312. content: '确定该工单终止?',
  313. success: async res => {
  314. if (res.confirm) {
  315. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  316. this.$emit('refresh')
  317. })
  318. }
  319. }
  320. })
  321. },
  322. outCancel() {
  323. this.outsourceShow = false
  324. },
  325. onDateChange(e) {
  326. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  327. this.$forceUpdate()
  328. },
  329. // 工艺路线
  330. produceFn() {
  331. let param = {
  332. pageNum: 1,
  333. size: -1,
  334. routeType: 2
  335. }
  336. producerouting(param).then(res => {
  337. this.produceList = res.list
  338. })
  339. },
  340. // 仓库
  341. getWarehouseFn() {
  342. getWarehouseList().then(res => {
  343. this.warehouseList = res
  344. })
  345. },
  346. outsourceOk(isRelease) {
  347. if (!this.outsourceForm.name) {
  348. uni.showToast({
  349. title: '请输入委外名称',
  350. icon: 'none'
  351. })
  352. return false
  353. }
  354. if (!this.outsourceForm.type) {
  355. uni.showToast({
  356. title: '请选择委外类型',
  357. icon: 'none'
  358. })
  359. return false
  360. }
  361. if (this.outsourceForm.type == 2 && !this.outsourceForm.material) {
  362. uni.showToast({
  363. title: '请选择委外物料',
  364. icon: 'none'
  365. })
  366. return false
  367. }
  368. if (this.clientEnvironmentId != 2 && !this.outsourceForm.produceRoutingId) {
  369. uni.showToast({
  370. title: '请选择工艺路线',
  371. icon: 'none'
  372. })
  373. return false
  374. }
  375. if (!this.outsourceForm.requireDeliveryTime) {
  376. uni.showToast({
  377. title: '请选择委外完成时间',
  378. icon: 'none'
  379. })
  380. return false
  381. }
  382. let param = {
  383. ...this.outsourceForm,
  384. taskId: this.newTaskObj.currentTaskId,
  385. workOrderId: this.newTaskObj.workOrderId,
  386. isRelease: isRelease
  387. }
  388. applyoutsourceSave(param).then(res => {
  389. console.log(res)
  390. this.outCancel()
  391. })
  392. },
  393. }
  394. }
  395. </script>
  396. <style lang="scss" scoped>
  397. .bottom_box {
  398. background: #fff;
  399. }
  400. .nav_box {
  401. width: 750rpx;
  402. height: 40rpx;
  403. background: $theme-color;
  404. .open_icon {
  405. width: 48rpx;
  406. height: 48rpx;
  407. }
  408. .open_icon_reversal {
  409. transform: scaleY(-1);
  410. /* 垂直翻转 */
  411. }
  412. }
  413. .operate_list {
  414. margin: 0 32rpx;
  415. .list {
  416. border-radius: 8rpx;
  417. border: 1rpx solid $theme-color;
  418. background: #F0F8F2;
  419. height: 64rpx;
  420. padding: 0rpx 16rpx;
  421. margin-top: 16rpx;
  422. }
  423. .round {
  424. width: 32rpx;
  425. height: 32rpx;
  426. line-height: 32rpx;
  427. text-align: center;
  428. border-radius: 50%;
  429. background: $theme-color;
  430. font-size: 24rpx;
  431. font-style: normal;
  432. font-weight: 400;
  433. color: #fff;
  434. }
  435. .name {
  436. font-family: PingFang HK;
  437. font-size: 24rpx;
  438. font-style: normal;
  439. font-weight: 600;
  440. color: $theme-color;
  441. }
  442. .arrow_right {
  443. width: 32rpx;
  444. height: 32rpx;
  445. }
  446. }
  447. .btn_box {
  448. display: flex;
  449. padding: 16rpx 32rpx;
  450. align-items: flex-start;
  451. gap: 16rpx;
  452. align-self: stretch;
  453. .btn {
  454. width: 160rpx;
  455. height: 64rpx;
  456. line-height: 64rpx;
  457. background: $theme-color;
  458. text-align: center;
  459. border-radius: 8rpx;
  460. color: #fff;
  461. font-family: PingFang HK;
  462. font-size: 24rpx;
  463. font-style: normal;
  464. font-weight: 600;
  465. }
  466. }
  467. .operate_box {
  468. padding: 10rpx 20rpx;
  469. /deep/ .u-button {
  470. width: 180rpx;
  471. }
  472. }
  473. .popup_list {
  474. width: 78vw;
  475. min-height: 360rpx;
  476. padding: 0 32rpx;
  477. .title {
  478. color: #333;
  479. font-size: 28rpx;
  480. text-align: center;
  481. padding: 30rpx;
  482. }
  483. }
  484. </style>