bottomOperate.vue 8.5 KB

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