bottomOperate.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  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 class="list rx-bc" v-if="btnState == 1">
  19. <view class="list_item_btn" @click="operate('jobBooking', {})">报工</view>
  20. <view class="list_item_btn" @click="operate('',item)">多工单报工</view>
  21. </view>
  22. <view class="list rx-bc" v-if="newTaskObj.existOutsource == 1">
  23. <view class="list_item_btn" @click="operate('outPicking', {})">委外领料</view>
  24. <view class="list_item_btn" @click="operate('jobBooking', {})">委外报工</view>
  25. </view>
  26. </view>
  27. <view class="btn_box">
  28. <view class="btn" @click="handPause()">{{ GDStatus == 9 ? '取消暂停' : '暂停' }}</view>
  29. <view class="btn" @click="handTerminate()">终止</view>
  30. <view class="btn">转派</view>
  31. <view class="btn" @click="handOutsource()">委外</view>
  32. </view>
  33. <SearchPopup mode="center" v-if="outsourceShow">
  34. <template v-slot:list>
  35. <view class="popup_list">
  36. <view class="title">【{{taskObj.currentTaskName}}】是否委外</view>
  37. <u-form labelPosition="left" :model="outsourceForm" labelWidth="180" labelAlign="left" class="">
  38. <u-form-item label="委外名称:" borderBottom prop="name">
  39. <input class="uni-input" v-model="outsourceForm.name" placeholder="请输入委外名称"></input>
  40. </u-form-item>
  41. <u-form-item label="委外类型:" borderBottom prop="">
  42. <zxz-uni-data-select :localdata="typeList" v-model="outsourceForm.type" dataValue='id'
  43. dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  44. </u-form-item>
  45. <u-form-item label="委外数量:" borderBottom prop="formedNumLast" v-if="clientEnvironmentId == 2">
  46. <input class="uni-input content_num"
  47. v-model="outsourceForm.formedNumLast" type='number'></input>
  48. </u-form-item>
  49. <u-form-item label="委外到:" borderBottom prop="taskIds">
  50. <zxz-uni-data-select :localdata="newStepsList" v-model="outsourceForm.taskIds"
  51. dataValue='taskId' format='{taskTypeName}' dataKey="taskId" filterable
  52. :clear='true'></zxz-uni-data-select>
  53. </u-form-item>
  54. <u-form-item label="直接入库:" borderBottom prop="isInWarehouse" >
  55. <u-checkbox-group v-model="isInWarehouse" size="14px" v-if="clientEnvironmentId != 2 " >
  56. <u-checkbox labelSize="14px" iconSize="10px" activeColor="#157A2C" name="true" label="是"></u-checkbox>
  57. </u-checkbox-group>
  58. <view v-if="clientEnvironmentId == 2 " >是</view>
  59. <zxz-uni-data-select style="margin-left: 10px;" v-if="clientEnvironmentId == 2 || isInWarehouse.length" :localdata="warehouseList" v-model="outsourceForm.warehouseId"
  60. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  61. </u-form-item>
  62. <u-form-item label="工艺路线:" borderBottom prop="produceRoutingId" v-if="clientEnvironmentId != 2 &&isInWarehouse && isInWarehouse.length == 0">
  63. <zxz-uni-data-select :localdata="produceList" v-model="outsourceForm.produceRoutingId"
  64. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  65. </u-form-item>
  66. <u-form-item label="计划交期:" borderBottom prop="requireDeliveryTime">
  67. <picker mode="date" :value="outsourceForm.requireDeliveryTime" @change="onDateChange">
  68. <view class="uni-input">{{ outsourceForm.requireDeliveryTime || '选择日期' }}</view>
  69. </picker>
  70. </u-form-item>
  71. </u-form>
  72. </view>
  73. </template>
  74. <template v-slot:operate>
  75. <view class="operate_box rx-bc">
  76. <u-button size="small" class="u-reset-button" @click="outCancel">
  77. 取消
  78. </u-button>
  79. <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(0)">
  80. 确定
  81. </u-button>
  82. <!-- <u-button type="success" size="small" class="u-reset-button" @click="outsourceOk(1)">
  83. 提交并发布
  84. </u-button> -->
  85. </view>
  86. </template>
  87. </SearchPopup>
  88. <outsourceList ref="outsourceListRef" @close="outCancel()"></outsourceList>
  89. </view>
  90. </template>
  91. <script>
  92. import {
  93. getTwoTreeByPid,
  94. checkOutsource,
  95. applyoutsourceSave,
  96. producerouting,
  97. getWarehouseList,
  98. updateStatusPause,
  99. updateStatusPauseRecover,
  100. updateStatusTerminate
  101. } from '@/api/pda/workOrder.js'
  102. import SearchPopup from './searchPopup.vue'
  103. import outsourceList from './outsourceList.vue'
  104. import {
  105. EventBus
  106. } from '@/utils/eventBus.js'
  107. export default {
  108. components: {
  109. SearchPopup,
  110. outsourceList
  111. },
  112. props: {
  113. state: String | Number,
  114. gdStatus: String | Number,
  115. taskObj: Object,
  116. controlReportMethod: String | Number,
  117. stepsList: {
  118. type: Array,
  119. default: () => []
  120. },
  121. },
  122. watch: {
  123. btns: {
  124. immediate: true,
  125. deep: true,
  126. handler(newVal) {
  127. this.btnsList = []
  128. this.btnsList = newVal
  129. }
  130. },
  131. state: {
  132. immediate: true,
  133. deep: true,
  134. handler(newVal) {
  135. this.btnState = newVal
  136. }
  137. },
  138. gdStatus: {
  139. immediate: true,
  140. deep: true,
  141. handler(newVal) {
  142. this.GDStatus = newVal
  143. }
  144. },
  145. controlReportMethod: {
  146. immediate: true,
  147. deep: true,
  148. handler(newVal) {
  149. this.btnControlReportMethod = newVal
  150. }
  151. },
  152. taskObj: {
  153. immediate: true,
  154. deep: true,
  155. handler(newVal) {
  156. console.log(newVal)
  157. this.newTaskObj = newVal
  158. }
  159. },
  160. stepsList: {
  161. immediate: true,
  162. deep: true,
  163. handler(newVal) {
  164. }
  165. }
  166. },
  167. data() {
  168. return {
  169. isOperate: false,
  170. btnsList: [],
  171. btnState: 1,
  172. GDStatus: null,
  173. btnControlReportMethod: null,
  174. btnList: {
  175. 1: [{
  176. name: '领料',
  177. type: 'picking'
  178. },
  179. {
  180. name: '投料',
  181. type: 'feeding'
  182. },
  183. {
  184. name: '更换周转车',
  185. type: 'turnover'
  186. },
  187. ],
  188. 2: [{
  189. name: '取样',
  190. type: 'sample'
  191. },
  192. {
  193. name: '报工',
  194. type: 'sampleJob'
  195. },
  196. ],
  197. 3: [{
  198. name: '更换周转车',
  199. type: 'qualityTurnover'
  200. },
  201. {
  202. name: '质检',
  203. type: 'inspection'
  204. },
  205. {
  206. name: '报工',
  207. type: 'inspectionJob'
  208. }
  209. ],
  210. 4: [{
  211. name: '领料',
  212. type: 'picking'
  213. },
  214. {
  215. name: '投料',
  216. type: 'feeding'
  217. },
  218. {
  219. name: '报工',
  220. type: 'jobBooking'
  221. },
  222. ],
  223. 5: [{
  224. name: '入库',
  225. type: 'warehousing'
  226. },
  227. ],
  228. 6: [{
  229. name: '报工',
  230. type: 'jobBooking'
  231. },
  232. ],
  233. },
  234. newTaskObj: {},
  235. outsourceShow: false,
  236. outsourceForm: {
  237. },
  238. produceList: [],
  239. warehouseList: [],
  240. typeList: [{
  241. id: 4,
  242. name: '带料委外'
  243. },
  244. {
  245. id: 5,
  246. name: '无料委外'
  247. },
  248. ],
  249. newStepsList: [],
  250. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  251. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  252. isInWarehouse: []
  253. }
  254. },
  255. created() {
  256. },
  257. methods: {
  258. open() {
  259. this.isOperate = !this.isOperate
  260. },
  261. operate(type, item) {
  262. this.$emit('operate', type, item)
  263. },
  264. handOutsource() {
  265. let param = {
  266. taskId: this.newTaskObj.currentTaskId,
  267. workOrderId: this.newTaskObj.workOrderId,
  268. }
  269. checkOutsource(param).then(res => {
  270. this.outsourceForm = {
  271. ...res,
  272. }
  273. this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
  274. if (res.outsource) {
  275. this.getNewSteps()
  276. this.outsourceShow = true
  277. this.produceFn()
  278. this.getWarehouseFn()
  279. } else {
  280. uni.showToast({
  281. title: '此工序不能委外',
  282. icon: 'none'
  283. })
  284. }
  285. })
  286. },
  287. handPause() {
  288. if (this.GDStatus == 9) {
  289. uni.showModal({
  290. title: '提示',
  291. content: '确定该工单取消暂停?',
  292. success: async res => {
  293. if (res.confirm) {
  294. updateStatusPauseRecover([this.newTaskObj.workOrderId]).then(res => {
  295. this.$emit('refresh')
  296. })
  297. }
  298. }
  299. })
  300. } else {
  301. uni.showModal({
  302. title: '提示',
  303. content: '确定该工单暂停?',
  304. success: async res => {
  305. if (res.confirm) {
  306. updateStatusPause([this.newTaskObj.workOrderId]).then(res => {
  307. this.$emit('refresh')
  308. })
  309. }
  310. }
  311. })
  312. }
  313. },
  314. handTerminate() {
  315. uni.showModal({
  316. title: '提示',
  317. content: '确定该工单终止?',
  318. success: async res => {
  319. if (res.confirm) {
  320. updateStatusTerminate([this.newTaskObj.workOrderId]).then(res => {
  321. this.$emit('refresh')
  322. })
  323. }
  324. }
  325. })
  326. },
  327. outCancel() {
  328. this.outsourceShow = false
  329. EventBus.$off('outEvent');
  330. },
  331. getNewSteps() {
  332. this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
  333. this.newStepsList = []
  334. this.stepsList.forEach((f, i) => {
  335. if (f.taskId != '-1' && f.taskId != '-2' && i > this.activeIndex && (f.type == 1 || f.type ==
  336. 4)) {
  337. this.newStepsList.push(f)
  338. }
  339. })
  340. },
  341. getIndexOfElementInArray(array, target) {
  342. for (let i = 0; i < array.length; i++) {
  343. if (array[i].taskId === target) {
  344. return i; // 返回第一次出现target的索引位置
  345. }
  346. }
  347. return -1; // 未找到目标值时返回-1
  348. },
  349. onDateChange(e) {
  350. this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
  351. this.$forceUpdate()
  352. },
  353. // 工艺路线
  354. produceFn() {
  355. let param = {
  356. pageNum: 1,
  357. size: -1,
  358. routeType: 2
  359. }
  360. producerouting(param).then(res => {
  361. this.produceList = res.list
  362. })
  363. },
  364. // 仓库
  365. getWarehouseFn() {
  366. getWarehouseList().then(res => {
  367. this.warehouseList = res
  368. })
  369. },
  370. outsourceOk(isRelease) {
  371. if (!this.outsourceForm.name) {
  372. uni.showToast({
  373. title: '请输入委外名称',
  374. icon: 'none'
  375. })
  376. return false
  377. }
  378. if (!this.outsourceForm.type) {
  379. uni.showToast({
  380. title: '请选择委外类型',
  381. icon: 'none'
  382. })
  383. return false
  384. }
  385. // this.outsourceForm.requireDeliveryTime = '2025-03-18'
  386. if (!this.outsourceForm.requireDeliveryTime) {
  387. uni.showToast({
  388. title: '请选择委外完成时间',
  389. icon: 'none'
  390. })
  391. return false
  392. }
  393. if(this.clientEnvironmentId == 2) {
  394. this.outsourceForm.isInWarehouse = 1
  395. } else {
  396. this.isInWarehouse.length > 0 ? this.outsourceForm.isInWarehouse = 1 : this.outsourceForm.isInWarehouse = 0
  397. }
  398. let param = {
  399. ...this.outsourceForm,
  400. taskId: this.newTaskObj.currentTaskId,
  401. workOrderId: this.newTaskObj.workOrderId,
  402. isRelease: isRelease
  403. }
  404. console.log(param)
  405. this.$refs.outsourceListRef.open(param)
  406. // let param = {
  407. // ...this.outsourceForm,
  408. // taskId: this.newTaskObj.currentTaskId,
  409. // workOrderId: this.newTaskObj.workOrderId,
  410. // isRelease: isRelease
  411. // }
  412. // applyoutsourceSave(param).then(res => {
  413. // console.log(res)
  414. // this.outCancel()
  415. // })
  416. },
  417. }
  418. }
  419. </script>
  420. <style lang="scss" scoped>
  421. .bottom_box {
  422. background: #fff;
  423. }
  424. .nav_box {
  425. width: 750rpx;
  426. height: 40rpx;
  427. background: $theme-color;
  428. .open_icon {
  429. width: 48rpx;
  430. height: 48rpx;
  431. }
  432. .open_icon_reversal {
  433. transform: scaleY(-1);
  434. /* 垂直翻转 */
  435. }
  436. }
  437. .operate_list {
  438. margin: 0 32rpx;
  439. .list {
  440. border-radius: 8rpx;
  441. border: 1rpx solid $theme-color;
  442. background: #F0F8F2;
  443. height: 64rpx;
  444. padding: 0rpx 16rpx;
  445. margin-top: 16rpx;
  446. }
  447. .round {
  448. width: 32rpx;
  449. height: 32rpx;
  450. line-height: 32rpx;
  451. text-align: center;
  452. border-radius: 50%;
  453. background: $theme-color;
  454. font-size: 24rpx;
  455. font-style: normal;
  456. font-weight: 400;
  457. color: #fff;
  458. }
  459. .name {
  460. font-family: PingFang HK;
  461. font-size: 24rpx;
  462. font-style: normal;
  463. font-weight: 600;
  464. color: $theme-color;
  465. }
  466. .arrow_right {
  467. width: 32rpx;
  468. height: 32rpx;
  469. }
  470. }
  471. .btn_box {
  472. display: flex;
  473. padding: 16rpx 32rpx;
  474. align-items: flex-start;
  475. gap: 16rpx;
  476. align-self: stretch;
  477. .btn {
  478. width: 160rpx;
  479. height: 64rpx;
  480. line-height: 64rpx;
  481. background: $theme-color;
  482. text-align: center;
  483. border-radius: 8rpx;
  484. color: #fff;
  485. font-family: PingFang HK;
  486. font-size: 24rpx;
  487. font-style: normal;
  488. font-weight: 600;
  489. }
  490. }
  491. .operate_box {
  492. padding: 10rpx 20rpx;
  493. /deep/ .u-button {
  494. width: 180rpx;
  495. }
  496. }
  497. .popup_list {
  498. width: 78vw;
  499. min-height: 360rpx;
  500. padding: 0 32rpx;
  501. .title {
  502. color: #333;
  503. font-size: 28rpx;
  504. text-align: center;
  505. padding: 30rpx;
  506. }
  507. }
  508. .list_item_btn {
  509. width: 160rpx;
  510. height: 54rpx;
  511. line-height: 54rpx;
  512. background: $theme-color;
  513. text-align: center;
  514. border-radius: 8rpx;
  515. color: #fff;
  516. font-family: PingFang HK;
  517. font-size: 22rpx;
  518. font-style: normal;
  519. font-weight: 600;
  520. }
  521. .content_num {
  522. display: flex;
  523. align-items: center;
  524. padding: 0 4rpx;
  525. /deep/ .uni-input-input {
  526. border: 2rpx solid #F0F8F2;
  527. background: #F0F8F2;
  528. color: $theme-color;
  529. }
  530. }
  531. </style>