bottomOperate.vue 7.9 KB

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