bottomOperate.vue 7.3 KB

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