bottomOperate.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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. ..._arr,
  188. {
  189. name: '报工',
  190. type: 'inspectionJob'
  191. }
  192. ]
  193. })
  194. },
  195. open() {
  196. this.isOperate = !this.isOperate
  197. },
  198. operate(type, item) {
  199. this.$emit('operate', type, item)
  200. },
  201. handOutsource() {
  202. let param = {
  203. taskId: this.newTaskObj.currentTaskId,
  204. workOrderId: this.newTaskObj.workOrderId
  205. }
  206. checkOutsource(param).then(res => {
  207. this.outsourceForm = {
  208. ...res,
  209. requireDeliveryTime: '2024-05-20'
  210. }
  211. console.log(this.outsourceForm)
  212. if (res.outsource) {
  213. this.outsourceShow = true
  214. } else {
  215. uni.showToast({
  216. title: '此工序不能委外',
  217. icon: 'none'
  218. })
  219. }
  220. })
  221. },
  222. outCancel() {
  223. this.outsourceShow = false
  224. },
  225. onDateChange(e) {
  226. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  227. this.$forceUpdate()
  228. },
  229. outsourceOk(isRelease) {
  230. if (!this.outsourceForm.name) {
  231. uni.showToast({
  232. title: '请输入委外名称',
  233. icon: 'none'
  234. })
  235. return false
  236. }
  237. if (!this.outsourceForm.requireDeliveryTime) {
  238. uni.showToast({
  239. title: '请选择委外完成时间',
  240. icon: 'none'
  241. })
  242. return false
  243. }
  244. let param = {
  245. ...this.outsourceForm,
  246. taskId: this.newTaskObj.currentTaskId,
  247. workOrderId: this.newTaskObj.workOrderId,
  248. isRelease: isRelease
  249. }
  250. applyoutsourceSave(param).then(res => {
  251. console.log(res)
  252. this.outCancel()
  253. })
  254. },
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. .bottom_box {
  260. background: #fff;
  261. }
  262. .nav_box {
  263. width: 750rpx;
  264. height: 40rpx;
  265. background: $theme-color;
  266. .open_icon {
  267. width: 48rpx;
  268. height: 48rpx;
  269. }
  270. .open_icon_reversal {
  271. transform: scaleY(-1);
  272. /* 垂直翻转 */
  273. }
  274. }
  275. .operate_list {
  276. margin: 0 32rpx;
  277. .list {
  278. border-radius: 8rpx;
  279. border: 1rpx solid $theme-color;
  280. background: #F0F8F2;
  281. height: 64rpx;
  282. padding: 0rpx 16rpx;
  283. margin-top: 16rpx;
  284. }
  285. .round {
  286. width: 32rpx;
  287. height: 32rpx;
  288. line-height: 32rpx;
  289. text-align: center;
  290. border-radius: 50%;
  291. background: $theme-color;
  292. font-size: 24rpx;
  293. font-style: normal;
  294. font-weight: 400;
  295. color: #fff;
  296. }
  297. .name {
  298. font-family: PingFang HK;
  299. font-size: 24rpx;
  300. font-style: normal;
  301. font-weight: 600;
  302. color: $theme-color;
  303. }
  304. .arrow_right {
  305. width: 32rpx;
  306. height: 32rpx;
  307. }
  308. }
  309. .btn_box {
  310. display: flex;
  311. padding: 16rpx 32rpx;
  312. align-items: flex-start;
  313. gap: 16rpx;
  314. align-self: stretch;
  315. .btn {
  316. width: 160rpx;
  317. height: 64rpx;
  318. line-height: 64rpx;
  319. background: $theme-color;
  320. text-align: center;
  321. border-radius: 8rpx;
  322. color: #fff;
  323. font-family: PingFang HK;
  324. font-size: 24rpx;
  325. font-style: normal;
  326. font-weight: 600;
  327. }
  328. }
  329. .operate_box {
  330. padding: 10rpx 20rpx;
  331. /deep/ .u-button {
  332. width: 160rpx;
  333. }
  334. }
  335. .popup_list {
  336. width: 78vw;
  337. min-height: 360rpx;
  338. padding: 0 32rpx;
  339. .title {
  340. color: #333;
  341. font-size: 28rpx;
  342. text-align: center;
  343. padding: 30rpx;
  344. }
  345. }
  346. </style>