bottomOperate.vue 7.8 KB

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