bottomOperate.vue 9.6 KB

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