bottomOperate.vue 14 KB

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