bottomOperate.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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="expectReceiveDate">
  32. <picker mode="date" :value="outsourceForm.expectReceiveDate" @change="onDateChange">
  33. <view class="uni-input">{{ outsourceForm.expectReceiveDate || '选择日期' }}</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">
  45. 提交
  46. </u-button>
  47. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk">
  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. },
  157. methods: {
  158. getTwoTree() {
  159. getTwoTreeByPid(12).then(res => {
  160. let _arr = res.map(m => {
  161. m.type = 'inspection'
  162. return m
  163. })
  164. this.btnList[3] = []
  165. this.btnList[3] = [
  166. ..._arr,
  167. {
  168. name: '报工',
  169. type: 'inspectionJob'
  170. }
  171. ]
  172. })
  173. },
  174. open() {
  175. this.isOperate = !this.isOperate
  176. },
  177. operate(type, item) {
  178. this.$emit('operate', type, item)
  179. },
  180. handOutsource() {
  181. let param = {
  182. taskId: this.newTaskObj.currentTaskId,
  183. workOrderId: this.newTaskObj.workOrderId
  184. }
  185. checkOutsource(param).then(res => {
  186. this.outsourceForm = {
  187. ...res,
  188. expectReceiveDate: '2024-05-20'
  189. }
  190. console.log(this.outsourceForm)
  191. if (res.outsource) {
  192. this.outsourceShow = true
  193. } else {
  194. uni.showToast({
  195. title: '此工序不能委外',
  196. icon: 'none'
  197. })
  198. }
  199. })
  200. },
  201. outCancel() {
  202. this.outsourceShow = false
  203. },
  204. onDateChange(e) {
  205. this.$set(this.outsourceForm, 'expectReceiveDate', e.detail.value)
  206. this.$forceUpdate()
  207. },
  208. outsourceOk() {
  209. if (!this.outsourceForm.name) {
  210. uni.showToast({
  211. title: '请输入委外名称',
  212. icon: 'none'
  213. })
  214. return false
  215. }
  216. if (!this.outsourceForm.expectReceiveDate) {
  217. uni.showToast({
  218. title: '请选择委外完成时间',
  219. icon: 'none'
  220. })
  221. return false
  222. }
  223. let param = {
  224. ...this.outsourceForm,
  225. taskId: this.newTaskObj.currentTaskId,
  226. workOrderId: this.newTaskObj.workOrderId
  227. }
  228. applyoutsourceSave(param).then(res => {
  229. console.log(res)
  230. })
  231. },
  232. }
  233. }
  234. </script>
  235. <style lang="scss" scoped>
  236. .bottom_box {
  237. background: #fff;
  238. }
  239. .nav_box {
  240. width: 750rpx;
  241. height: 40rpx;
  242. background: $theme-color;
  243. .open_icon {
  244. width: 48rpx;
  245. height: 48rpx;
  246. }
  247. .open_icon_reversal {
  248. transform: scaleY(-1);
  249. /* 垂直翻转 */
  250. }
  251. }
  252. .operate_list {
  253. margin: 0 32rpx;
  254. .list {
  255. border-radius: 8rpx;
  256. border: 1rpx solid $theme-color;
  257. background: #F0F8F2;
  258. height: 64rpx;
  259. padding: 0rpx 16rpx;
  260. margin-top: 16rpx;
  261. }
  262. .round {
  263. width: 32rpx;
  264. height: 32rpx;
  265. line-height: 32rpx;
  266. text-align: center;
  267. border-radius: 50%;
  268. background: $theme-color;
  269. font-size: 24rpx;
  270. font-style: normal;
  271. font-weight: 400;
  272. color: #fff;
  273. }
  274. .name {
  275. font-family: PingFang HK;
  276. font-size: 24rpx;
  277. font-style: normal;
  278. font-weight: 600;
  279. color: $theme-color;
  280. }
  281. .arrow_right {
  282. width: 32rpx;
  283. height: 32rpx;
  284. }
  285. }
  286. .btn_box {
  287. display: flex;
  288. padding: 16rpx 32rpx;
  289. align-items: flex-start;
  290. gap: 16rpx;
  291. align-self: stretch;
  292. .btn {
  293. width: 160rpx;
  294. height: 64rpx;
  295. line-height: 64rpx;
  296. background: $theme-color;
  297. text-align: center;
  298. border-radius: 8rpx;
  299. color: #fff;
  300. font-family: PingFang HK;
  301. font-size: 24rpx;
  302. font-style: normal;
  303. font-weight: 600;
  304. }
  305. }
  306. .operate_box {
  307. padding: 10rpx 20rpx;
  308. /deep/ .u-button {
  309. width: 160rpx;
  310. }
  311. }
  312. .popup_list {
  313. width: 78vw;
  314. min-height: 360rpx;
  315. padding: 0 32rpx;
  316. .title {
  317. color: #333;
  318. font-size: 28rpx;
  319. text-align: center;
  320. padding: 30rpx;
  321. }
  322. }
  323. </style>