bottomOperate.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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>
  14. <view class="btn_box">
  15. <view class="btn">暂停</view>
  16. <view class="btn">终止</view>
  17. <view class="btn">转派</view>
  18. <view class="btn" @click="handOutsource()">委外</view>
  19. </view>
  20. <SearchPopup mode="center" v-if="outsourceShow">
  21. <template v-slot:list>
  22. <view class="popup_list">
  23. <view class="title">【{{taskObj.currentTaskName}}】是否委外</view>
  24. <u-form labelPosition="left" :model="outsourceForm" labelWidth="180" labelAlign="left" class="">
  25. <u-form-item label="委外名称:" borderBottom prop="num">
  26. <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
  27. </u-form-item>
  28. <u-form-item label="委外数量:" borderBottom prop="num">
  29. <input class="uni-input" v-model="outsourceForm.formedNumLast" type='number'></input>
  30. </u-form-item>
  31. <u-form-item label="完成时间:" borderBottom prop="requireDeliveryTime">
  32. <picker mode="date" :value="outsourceForm.requireDeliveryTime" @change="onDateChange">
  33. <view class="uni-input">{{ outsourceForm.requireDeliveryTime || '选择日期' }}</view>
  34. </picker>
  35. </u-form-item>
  36. </u-form>
  37. </view>
  38. </template>
  39. <template v-slot:operate>
  40. <view class="operate_box rx-bc">
  41. <u-button size="small" class="u-reset-button" @click="outCancel">
  42. 取消
  43. </u-button>
  44. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(0)">
  45. 提交
  46. </u-button>
  47. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  48. 提交并发布
  49. </u-button>
  50. </view>
  51. </template>
  52. </SearchPopup>
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. getTwoTreeByPid,
  58. checkOutsource,
  59. applyoutsourceSave,
  60. } from '@/api/pda/workOrder.js'
  61. import SearchPopup from './searchPopup.vue'
  62. export default {
  63. components: {
  64. SearchPopup
  65. },
  66. props: {
  67. state: String | Number,
  68. taskObj: Object
  69. },
  70. watch: {
  71. btns: {
  72. immediate: true,
  73. deep: true,
  74. handler(newVal) {
  75. this.btnsList = []
  76. this.btnsList = newVal
  77. }
  78. },
  79. state: {
  80. immediate: true,
  81. deep: true,
  82. handler(newVal) {
  83. this.btnState = newVal
  84. }
  85. },
  86. taskObj: {
  87. immediate: true,
  88. deep: true,
  89. handler(newVal) {
  90. this.newTaskObj = newVal
  91. }
  92. }
  93. },
  94. data() {
  95. return {
  96. isOperate: false,
  97. btnsList: [],
  98. btnState: 1,
  99. btnList: {
  100. 1: [{
  101. name: '领料',
  102. type: 'picking'
  103. },
  104. {
  105. name: '投料',
  106. type: 'feeding'
  107. },
  108. {
  109. name: '报工',
  110. type: 'jobBooking'
  111. },
  112. {
  113. name: '更换周转车',
  114. type: 'turnover'
  115. },
  116. ],
  117. 2: [{
  118. name: '取样',
  119. type: 'sample'
  120. },
  121. {
  122. name: '报工',
  123. type: 'sampleJob'
  124. },
  125. ],
  126. 3: [{
  127. name: '报工',
  128. type: 'inspection'
  129. }, ],
  130. 4: [{
  131. name: '领料',
  132. type: 'picking'
  133. },
  134. {
  135. name: '投料',
  136. type: 'feeding'
  137. },
  138. {
  139. name: '报工',
  140. type: 'jobBooking'
  141. },
  142. ],
  143. 5: [{
  144. name: '入库',
  145. type: 'warehousing'
  146. },
  147. ],
  148. },
  149. newTaskObj: {},
  150. outsourceShow: false,
  151. outsourceForm: {
  152. },
  153. }
  154. },
  155. created() {
  156. this.getTwoTree()
  157. },
  158. methods: {
  159. getTwoTree() {
  160. getTwoTreeByPid(12).then(res => {
  161. let _arr = res.map(m => {
  162. m.type = 'inspection'
  163. return m
  164. })
  165. this.btnList[3] = []
  166. this.btnList[3] = [
  167. ..._arr,
  168. {
  169. name: '报工',
  170. type: 'inspectionJob'
  171. }
  172. ]
  173. })
  174. },
  175. open() {
  176. this.isOperate = !this.isOperate
  177. },
  178. operate(type, item) {
  179. this.$emit('operate', type, item)
  180. },
  181. handOutsource() {
  182. let param = {
  183. taskId: this.newTaskObj.currentTaskId,
  184. workOrderId: this.newTaskObj.workOrderId
  185. }
  186. checkOutsource(param).then(res => {
  187. this.outsourceForm = {
  188. ...res,
  189. requireDeliveryTime: '2024-05-20'
  190. }
  191. console.log(this.outsourceForm)
  192. if (res.outsource) {
  193. this.outsourceShow = true
  194. } else {
  195. uni.showToast({
  196. title: '此工序不能委外',
  197. icon: 'none'
  198. })
  199. }
  200. })
  201. },
  202. outCancel() {
  203. this.outsourceShow = false
  204. },
  205. onDateChange(e) {
  206. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  207. this.$forceUpdate()
  208. },
  209. outsourceOk(isRelease) {
  210. if (!this.outsourceForm.name) {
  211. uni.showToast({
  212. title: '请输入委外名称',
  213. icon: 'none'
  214. })
  215. return false
  216. }
  217. if (!this.outsourceForm.requireDeliveryTime) {
  218. uni.showToast({
  219. title: '请选择委外完成时间',
  220. icon: 'none'
  221. })
  222. return false
  223. }
  224. let param = {
  225. ...this.outsourceForm,
  226. taskId: this.newTaskObj.currentTaskId,
  227. workOrderId: this.newTaskObj.workOrderId,
  228. isRelease: isRelease
  229. }
  230. applyoutsourceSave(param).then(res => {
  231. console.log(res)
  232. this.outCancel()
  233. })
  234. },
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .bottom_box {
  240. background: #fff;
  241. }
  242. .nav_box {
  243. width: 750rpx;
  244. height: 40rpx;
  245. background: $theme-color;
  246. .open_icon {
  247. width: 48rpx;
  248. height: 48rpx;
  249. }
  250. .open_icon_reversal {
  251. transform: scaleY(-1);
  252. /* 垂直翻转 */
  253. }
  254. }
  255. .operate_list {
  256. margin: 0 32rpx;
  257. .list {
  258. border-radius: 8rpx;
  259. border: 1rpx solid $theme-color;
  260. background: #F0F8F2;
  261. height: 64rpx;
  262. padding: 0rpx 16rpx;
  263. margin-top: 16rpx;
  264. }
  265. .round {
  266. width: 32rpx;
  267. height: 32rpx;
  268. line-height: 32rpx;
  269. text-align: center;
  270. border-radius: 50%;
  271. background: $theme-color;
  272. font-size: 24rpx;
  273. font-style: normal;
  274. font-weight: 400;
  275. color: #fff;
  276. }
  277. .name {
  278. font-family: PingFang HK;
  279. font-size: 24rpx;
  280. font-style: normal;
  281. font-weight: 600;
  282. color: $theme-color;
  283. }
  284. .arrow_right {
  285. width: 32rpx;
  286. height: 32rpx;
  287. }
  288. }
  289. .btn_box {
  290. display: flex;
  291. padding: 16rpx 32rpx;
  292. align-items: flex-start;
  293. gap: 16rpx;
  294. align-self: stretch;
  295. .btn {
  296. width: 160rpx;
  297. height: 64rpx;
  298. line-height: 64rpx;
  299. background: $theme-color;
  300. text-align: center;
  301. border-radius: 8rpx;
  302. color: #fff;
  303. font-family: PingFang HK;
  304. font-size: 24rpx;
  305. font-style: normal;
  306. font-weight: 600;
  307. }
  308. }
  309. .operate_box {
  310. padding: 10rpx 20rpx;
  311. /deep/ .u-button {
  312. width: 160rpx;
  313. }
  314. }
  315. .popup_list {
  316. width: 78vw;
  317. min-height: 360rpx;
  318. padding: 0 32rpx;
  319. .title {
  320. color: #333;
  321. font-size: 28rpx;
  322. text-align: center;
  323. padding: 30rpx;
  324. }
  325. }
  326. </style>