bottomOperate.vue 10 KB

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