bottomOperate.vue 13 KB

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