index.vue 23 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
  4. color="#000" @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode">
  5. </uni-nav-bar>
  6. <view class="list_box">
  7. <u-list @scrolltolower="scrolltolower">
  8. <view class="card_box">
  9. <workOrderBom :item='objData' v-if='objData' @handleScan='handleScan'></workOrderBom>
  10. <paramBom v-if='paramDetailList.length != 0' :list='paramDetailList'></paramBom>
  11. <deviceBom v-if='objData.equipmentList.length != 0' :list='objData.equipmentList'></deviceBom>
  12. <modelBom v-if='objData.modelList.length != 0' :list='objData.modelList' pattern='job'
  13. ref='modelRef'>
  14. </modelBom>
  15. <jobBom v-if='isLoad' :item='objData' ref='jobRef' :notFormed='objData.notFormedList'
  16. @penalize='penalize' @modeNum='modeNum'></jobBom>
  17. <palletBom v-if="objData.palletList.length != 0" :palletList='objData.palletList'></palletBom>
  18. <revolvingDiskBom v-if="isLoad && objData.revolvingDiskList.length > 0" pattern='job'
  19. :revolvingDiskList="objData.revolvingDiskList"></revolvingDiskBom>
  20. <!-- <oneJobBom
  21. v-if='objData.instanceList && objData.instanceList.length != 0 && taskType != 4 && taskType != 6'
  22. :item='objData' :list='objData.instanceList'>
  23. </oneJobBom> -->
  24. <semiProductJobBom
  25. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6 && objData.singleReport == 1'
  26. :item='objData' :list='objData.semiProductList' :equipmentList="objData.equipmentList">
  27. </semiProductJobBom>
  28. <semiProductJobBomPL
  29. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6 && objData.singleReport == 0'
  30. :item='objData' :list='objData.semiProductList' :equipmentList="objData.equipmentList">
  31. </semiProductJobBomPL>
  32. <oneJobQualityBom
  33. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType == 6 && clientEnvironmentId == 3 && objData.singleReport == 1'
  34. :item='objData' :list='objData.semiProductList'></oneJobQualityBom>
  35. <oneJobQualityBomPL
  36. v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType == 6 && clientEnvironmentId == 3 && objData.singleReport == 0'
  37. :item='objData' :list='objData.semiProductList' :sampleQuality="objData.sampleQuality"></oneJobQualityBomPL>
  38. <byProductBom v-if='objData.productRecycleList.length != 0' :list='objData.productRecycleList'
  39. @penalize='penalize'>
  40. </byProductBom>
  41. <turnoverBom v-if='objData.turnover.length != 0' :list='objData.turnover' :wordItem='objData'
  42. pattern='job' @handleScan='handleScan' @formedNumFn='formedNumFn'>
  43. </turnoverBom>
  44. <aridRegion v-if='objData.aridRegionList.length != 0' :list='objData.aridRegionList'
  45. :remainingTime='remainingTime' @handleScan='handleScan' :isType='true'></aridRegion>
  46. <packingBom :taskId='taskId' :workOrderId='id' :objData='objData' ref="packRef"
  47. v-if='taskType == 4 && clientEnvironmentId != 3 && objData'></packingBom>
  48. <packingTgBom
  49. v-if='objData.pickOutInList && objData.pickOutInList.length != 0 && taskType == 4 && clientEnvironmentId == 3'
  50. :list='objData.pickOutInList' :item='objData' ></packingTgBom>
  51. <view class="operate_box rx-sc">
  52. <u-button size="small" class="u-reset-button" type="success" @click="handAdd">手动添加</u-button>
  53. </view>
  54. <view style="height: 100rpx;"></view>
  55. </view>
  56. </u-list>
  57. </view>
  58. <view :class="[operateBtn ? 'flex_btn': 'flex_btn2']">
  59. <image v-if="operateBtn" class="jiantou" src="../../../../static/rightJt.png" @click="operateBtn = false">
  60. </image>
  61. <view class="close_box" @click="operateBtn = true">
  62. <image v-if="!operateBtn" class="close" src="../../../../static/close.png"></image>
  63. </view>
  64. <view v-if="!operateBtn" @click="removeCacheFn()">清空缓存</view>
  65. <view v-if="!operateBtn" @click="switchOrder = true">切换工单</view>
  66. </view>
  67. <view class="bottom-wrapper">
  68. <view class="btn_box" @click="save(1)">缓存</view>
  69. <view class="btn_box" @click="save(2)">一键报工</view>
  70. </view>
  71. <SearchPopup mode="bottom" v-if='searchShow'>
  72. <template v-slot:list>
  73. <view class="search_list">
  74. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  75. <u-form-item label="仓库:" class="required-form" borderBottom prop="warehouseId">
  76. <zxz-uni-data-select :localdata="warehouseList" v-model="formData.warehouseId"
  77. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  78. </u-form-item>
  79. </u-form>
  80. </view>
  81. </template>
  82. <template v-slot:operate>
  83. <view class="operate_box rx-bc">
  84. <u-button size="small" class="u-reset-button" @click="searchCancel">
  85. 取消
  86. </u-button>
  87. <u-button type="success" size="small" class="u-reset-button" @click="popupOk">
  88. 确定
  89. </u-button>
  90. </view>
  91. </template>
  92. </SearchPopup>
  93. <SearchPopup mode="center" v-if='switchOrder'>
  94. <template v-slot:list>
  95. <view class="search_list2">
  96. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  97. <u-form-item label="工单:" class="required-form" borderBottom prop="warehouseId">
  98. <zxz-uni-data-select :localdata="warehouseList" v-model="formData.warehouseId"
  99. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  100. </u-form-item>
  101. </u-form>
  102. </view>
  103. </template>
  104. <template v-slot:operate>
  105. <view class="operate_box rx-bc">
  106. <u-button size="small" class="u-reset-button" @click="switchOrder = false ">
  107. 取消
  108. </u-button>
  109. <u-button type="success" size="small" class="u-reset-button">
  110. 确定
  111. </u-button>
  112. </view>
  113. </template>
  114. </SearchPopup>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. getByIdReport,
  120. getByCodeReport,
  121. jobSave
  122. } from '@/api/pda/jobBooking.js'
  123. import {
  124. scanLedger,
  125. getWarehouseList,
  126. saveCache,
  127. getCache,
  128. removeCache
  129. } from '@/api/pda/workOrder.js'
  130. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  131. import deviceBom from '../../feeding/components/deviceBom.vue'
  132. import modelBom from '../../feeding/components/modelBom.vue'
  133. import jobBom from '../components/jobBom.vue'
  134. import palletBom from '../components/palletBom.vue'
  135. import oneJobBom from '../components/oneJobBom.vue'
  136. import semiProductJobBom from '../components/semiProductJobBom.vue'
  137. import semiProductJobBomPL from '../components/semiProductJobBomPL.vue'
  138. import byProductBom from '../components/byProductBom'
  139. import turnoverBom from '../components/turnoverBom.vue'
  140. import aridRegion from '../../feeding/components/aridRegion.vue'
  141. import paramBom from '../../feeding/components/paramBom.vue'
  142. import packingBom from '../components/packingBom.vue'
  143. import packingTgBom from '../components/packingTgBom'
  144. import revolvingDiskBom from '../../feeding/components/revolvingDiskBom.vue'
  145. import SearchPopup from '../../components/searchPopup.vue'
  146. import oneJobQualityBom from '../components/oneJobQualityBom.vue'
  147. import oneJobQualityBomPL from '../components/oneJobQualityBomPL.vue'
  148. export default {
  149. components: {
  150. workOrderBom,
  151. deviceBom,
  152. modelBom,
  153. jobBom,
  154. palletBom,
  155. oneJobBom,
  156. semiProductJobBom,
  157. semiProductJobBomPL,
  158. byProductBom,
  159. turnoverBom,
  160. aridRegion,
  161. paramBom,
  162. packingBom,
  163. packingTgBom,
  164. revolvingDiskBom,
  165. SearchPopup,
  166. oneJobQualityBom,
  167. oneJobQualityBomPL
  168. },
  169. data() {
  170. return {
  171. title: '',
  172. taskType: 1,
  173. isLoad: true,
  174. objData: {
  175. equipmentList: [],
  176. modelList: [],
  177. turnover: [],
  178. productRecycleList: [],
  179. aridRegionList: [],
  180. palletList: [],
  181. workReportInfo: {
  182. },
  183. notFormedList: [], // 报工-不合格
  184. },
  185. searchShow: false,
  186. switchOrder: false,
  187. warehouseList: [],
  188. formData: {
  189. warehouseId: ''
  190. },
  191. penalizeIndex: null,
  192. paramDetailList: [],
  193. remainingTime: 0,
  194. id: null,
  195. taskId: null,
  196. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  197. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  198. operateBtn: true
  199. }
  200. },
  201. onLoad(options) {
  202. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  203. this.taskType = options.taskType
  204. this.id = options.id
  205. this.taskId = options.taskId
  206. this.getList()
  207. },
  208. onShow() {
  209. uni.$off("setSelectList");
  210. uni.$on("setSelectList", (selectList, id) => {
  211. let turnover = []
  212. let equipmentList = [] // 生产设备
  213. let isEquipment = this.objData.equipmentList.length > 0 ? true : false // 判断是否有设置
  214. selectList.forEach(f => {
  215. if (f.rootCategoryLevelId == 4) { // 生产设备
  216. if (isEquipment) {
  217. equipmentList = this.objData.equipmentList
  218. } else {
  219. equipmentList = equipmentList.concat(f)
  220. }
  221. }
  222. if (f.rootCategoryLevelId == 7) { // 周转车
  223. turnover = turnover.concat(f)
  224. }
  225. })
  226. this.$set(this.objData, 'equipmentList', equipmentList)
  227. this.$set(this.objData, 'turnover', turnover)
  228. this.$forceUpdate()
  229. });
  230. },
  231. methods: {
  232. // 相机扫码
  233. HandlScanCode() {
  234. uni.scanCode({
  235. success: (res) => {
  236. this.scanItAllData(res.result)
  237. }
  238. })
  239. },
  240. scanItAllData(result) {
  241. scanLedger(result).then(res => {
  242. if (res[0].rootCategoryLevelId == 4) { // 设备
  243. let isFals = this.objData.equipmentList.some(m => m.code == result)
  244. if (isFals) {
  245. uni.showToast({
  246. title: '设备已存在',
  247. icon: 'none'
  248. })
  249. return false
  250. }
  251. this.objData.equipmentList.push(res[0])
  252. this.$forceUpdate()
  253. }
  254. if (res.length >= 1 && res[0].rootCategoryLevelId == 5) { // 磨具
  255. if (this.objData.modelList.length == 0) {
  256. this.objData.modelList = res
  257. this.$forceUpdate()
  258. } else {
  259. if (this.objData.modelList[0].instanceId != res[0].instanceId) {
  260. uni.showToast({
  261. title: '模具不匹配',
  262. icon: 'none'
  263. })
  264. } else {
  265. uni.showToast({
  266. title: '设备匹配成功',
  267. icon: 'none'
  268. })
  269. }
  270. }
  271. } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 周转车
  272. let isFals = this.objData.turnover.some(m => m.code == result)
  273. if (isFals) {
  274. uni.showToast({
  275. title: '周转车已存在',
  276. icon: 'none'
  277. })
  278. return false
  279. }
  280. this.objData.turnover.push(res[0])
  281. this.$forceUpdate()
  282. }
  283. })
  284. },
  285. handleScan(id, type) {
  286. uni.scanCode({
  287. success: (res) => {
  288. this.scanData(res.result, type, id)
  289. }
  290. })
  291. },
  292. scanData(result, type, id) {
  293. if (type == 'wordOrder') {
  294. getByCodeReport(result, this.taskId).then(res => {
  295. this.objData = res
  296. if (!this.objData.hasOwnProperty('turnover')) {
  297. this.objData['turnover'] = []
  298. }
  299. if (!this.objData.hasOwnProperty('aridRegionList')) {
  300. this.objData['aridRegionList'] = []
  301. }
  302. })
  303. } else if (type == 'turnover') {
  304. let isFals = this.objData.turnover.some(m => m.code == result)
  305. if (isFals) {
  306. uni.showToast({
  307. title: '周转车已存在',
  308. icon: 'none'
  309. })
  310. return false
  311. }
  312. getByCodeReport(result, this.taskId).then(res => {
  313. this.objData.turnover[id] = res
  314. })
  315. }
  316. },
  317. formedNumFn(num) {
  318. this.$refs.jobRef.setFormedNum(num)
  319. },
  320. getList() {
  321. this.isLoad = false
  322. getByIdReport(this.id, this.taskId).then(res => {
  323. this.objData = res
  324. console.log(22,res)
  325. if (!this.objData.hasOwnProperty('turnover')) {
  326. this.objData['turnover'] = []
  327. }
  328. if (!this.objData.hasOwnProperty('aridRegionList')) {
  329. this.objData['aridRegionList'] = []
  330. }
  331. if (!this.objData.hasOwnProperty('instanceList')) {
  332. this.objData['instanceList'] = []
  333. }
  334. if (!this.objData.hasOwnProperty('palletList')) {
  335. this.objData['palletList'] = []
  336. }
  337. if (!this.objData.hasOwnProperty('revolvingDiskList')) {
  338. this.objData['revolvingDiskList'] = []
  339. }
  340. // this.taskType = res.currentTaskDiagram.type
  341. if (this.objData.palletList.length > 0) {
  342. this.objData.palletList = this.objData.palletList.map(m => {
  343. return {
  344. hideKc: true, // 不显示库存
  345. quantity: m.feedQuantity,
  346. ...m
  347. }
  348. })
  349. } else {
  350. // this.objData.palletList = [{
  351. // categoryLevelId: '',
  352. // categoryLevelName: '',
  353. // categoryId: '',
  354. // rootCategoryLevelId: '',
  355. // code: '',
  356. // name: '',
  357. // specification: '',
  358. // brandNum: '',
  359. // modelType: '',
  360. // quantity: '',
  361. // unit: '',
  362. // }]
  363. }
  364. if (this.taskType == 6 && this.clientEnvironmentId == 3) {
  365. this.objData.semiProductList = this.objData.pickOutInList
  366. }
  367. if (this.clientEnvironmentId == 3 && this.objData.singleReport == 0 && this.taskType != 6 ) {
  368. this.objData.semiProductList.map(a => {
  369. a.extInfo.batchReportInfo = [ { allFeedQuantity: '', allReportWeight: '', taskId: '', taskName: '' }]
  370. return {
  371. a
  372. }
  373. })
  374. this.objData.semiProductList = this.objData.semiProductList
  375. }
  376. this.objData.workReportInfo = {
  377. formingNum: null,
  378. formingWeight: null,
  379. formedNum: null,
  380. formedWeight: null,
  381. taskId: this.taskId
  382. }
  383. this.objData.notFormedList = [{
  384. notFormedNum: null,
  385. notFormedWeight: null,
  386. weightUnit: res.weightUnit,
  387. unit: res.unit,
  388. warehouseId: null, // 处置 仓库id
  389. }]
  390. if (this.objData.semiProductList.length > 0) { // 预制体报工
  391. this.objData.workReportInfo.formedNum = this.objData.semiProductList.length
  392. }
  393. this.objData.workReportInfo.formingNum = res.formingNum
  394. this.objData.workReportInfo.formingWeight = res.formingWeight
  395. this.objData.workReportInfo.unit = res.unit
  396. this.objData.workReportInfo.weightUnit = res.weightUnit
  397. this.objData.workReportInfo.workOrderId = res.workOrderId
  398. this.paramDetailList = []
  399. this.paramDetailList = res.paramDetailList.map(m => {
  400. if (m.extInfo.textType == 5) {
  401. this.remainingTime = m.extInfo.remainingTime
  402. }
  403. return {
  404. ...m.extInfo
  405. }
  406. })
  407. }).finally(() => {
  408. this.isLoad = true
  409. if (this.taskType == 1) {
  410. this.getCacheFn()
  411. }
  412. })
  413. },
  414. scrolltolower() {},
  415. handAdd() {
  416. const storageKey = Date.now() + "";
  417. uni.setStorageSync(storageKey, this.objData || {});
  418. uni.navigateTo({
  419. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  420. })
  421. },
  422. penalize(index) {
  423. if (index || index == 0) {
  424. this.penalizeIndex = index
  425. this.formData.warehouseId = this.objData.productRecycleList[this.penalizeIndex].warehouseId || ''
  426. } else {
  427. this.penalizeIndex = null
  428. this.formData.warehouseId = this.objData.notFormedList[0].warehouseId || ''
  429. }
  430. this.$forceUpdate()
  431. if (this.warehouseList.length == 0) {
  432. getWarehouseList().then(res => {
  433. this.warehouseList = res
  434. this.searchShow = true
  435. })
  436. } else {
  437. this.searchShow = true
  438. }
  439. },
  440. inputChange(e) {
  441. console.log(e)
  442. },
  443. searchCancel() {
  444. this.searchShow = false
  445. },
  446. popupOk() {
  447. if (this.penalizeIndex == null) {
  448. this.$set(this.objData.notFormedList[0], 'warehouseId', this.formData.warehouseId || null)
  449. } else {
  450. this.objData.productRecycleList[this.penalizeIndex].warehouseId = this.formData.warehouseId
  451. }
  452. this.$forceUpdate()
  453. this.searchShow = false
  454. },
  455. modeNum(num) {
  456. if (this.objData.modelList.length == 0) {
  457. return false
  458. }
  459. this.$refs.modelRef.setNum(num)
  460. },
  461. async save(type) {
  462. uni.showLoading({
  463. title: '加载中'
  464. });
  465. console.log(this.objData)
  466. if (!this.objData.workReportInfo['formedNum'] && this.objData.workReportInfo['formedNum'] != 0) {
  467. uni.showToast({
  468. title: '请输入合格品数量',
  469. icon: 'none'
  470. })
  471. return false
  472. }
  473. // 预制体
  474. if (this.objData.semiProductList.length > 0 && this.taskType != 4 && this.objData.singleReport == 1 && type == 2) {
  475. let bol
  476. let _i
  477. bol = this.objData.semiProductList.every((e, i) => {
  478. _i = i + 1
  479. if (this.taskType == 6) {
  480. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId
  481. } else {
  482. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  483. .reportWeight
  484. }
  485. })
  486. if (!bol) {
  487. uni.showToast({
  488. title: `请完善第${_i}处置方式`,
  489. icon: 'none'
  490. })
  491. return false
  492. }
  493. }
  494. // if(this.objData.singleReport == 0 && type == 2) {
  495. // }
  496. if (this.objData.productRecycleList.length > 0 && this.clientEnvironmentId != 2) {
  497. const isRecycle = await this.checkRecycle()
  498. if (!isRecycle) {
  499. return false
  500. }
  501. }
  502. if (this.taskType == 4 && this.clientEnvironmentId != 3) {
  503. const isPack = await this.checkPack()
  504. if (!isPack) {
  505. return false
  506. }
  507. }
  508. if (this.objData.currentTaskDiagram.isFirstTask == 0 ) { // isFirstTask 1是 判断是否首工序
  509. const isFirstTask = await this.checkFirstTask()
  510. if (!isFirstTask) {
  511. return false
  512. }
  513. }
  514. if (this.taskType == 1) {
  515. const isCache = await this.checkCache(type)
  516. if (!isCache) {
  517. return false
  518. }
  519. }
  520. jobSave(this.objData).then(res => {
  521. uni.hideLoading();
  522. if (this.taskType == 4) {
  523. uni.showModal({
  524. title: '提示',
  525. content: '打包完成是否去入库!',
  526. confirmText: '确认', //这块是确定按钮的文字
  527. success: rr => {
  528. if (rr.confirm) {
  529. uni.redirectTo({
  530. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`
  531. })
  532. } else {
  533. uni.navigateBack()
  534. }
  535. }
  536. })
  537. } else {
  538. uni.navigateBack()
  539. }
  540. }).finally(() => {
  541. setTimeout(function() {
  542. uni.hideLoading();
  543. }, 3000);
  544. })
  545. },
  546. checkRecycle() {
  547. uni.hideLoading();
  548. return new Promise((resolve) => {
  549. uni.showModal({
  550. title: '提示',
  551. content: '是否跳过副产品回收处置!',
  552. confirmText: '确认', //这块是确定按钮的文字
  553. success: function(res) {
  554. if (res.confirm) {
  555. resolve(true)
  556. } else {
  557. resolve(false)
  558. }
  559. }
  560. })
  561. })
  562. },
  563. checkPack() {
  564. uni.hideLoading();
  565. return new Promise((resolve) => {
  566. let packInfo = this.$refs.packRef.getData()
  567. this.objData.packInfo = packInfo
  568. this.objData.taskType = this.taskType
  569. if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
  570. .objData
  571. .notFormedList[0].notFormedNum)) {
  572. uni.hideLoading();
  573. uni.showModal({
  574. title: '提示',
  575. content: '合格品数量加不合格品数量不等于包装总数!',
  576. confirmText: '确认', //这块是确定按钮的文字
  577. success: function(res) {
  578. if (res.confirm) {
  579. resolve(true)
  580. } else {
  581. resolve(false)
  582. }
  583. }
  584. })
  585. } else {
  586. resolve(true)
  587. }
  588. })
  589. },
  590. checkFirstTask() {
  591. uni.hideLoading();
  592. return new Promise((resolve) => {
  593. if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
  594. this.objData.notFormedList[0].notFormedNum)) {
  595. uni.showModal({
  596. title: '提示',
  597. content: '合格品数量加不合格品数量不等于上道工序数量!',
  598. confirmText: '确认', //这块是确定按钮的文字
  599. success: function(res) {
  600. if (res.confirm) {
  601. resolve(true)
  602. } else {
  603. resolve(false)
  604. }
  605. }
  606. })
  607. } else {
  608. resolve(true)
  609. }
  610. })
  611. },
  612. checkCache(type) {
  613. uni.hideLoading();
  614. return new Promise((resolve) => {
  615. if (type == 1) {
  616. saveCache(this.objData).then(rr => {
  617. uni.showToast({
  618. title: `已经缓存`,
  619. icon: 'none'
  620. })
  621. })
  622. resolve(false)
  623. } else if (type == 2) {
  624. resolve(true)
  625. }
  626. })
  627. },
  628. removeCacheFn() {
  629. uni.showModal({
  630. title: '缓存',
  631. content: '是否清空缓存!',
  632. confirmText: '确认', //这块是确定按钮的文字
  633. success: rr => {
  634. if (rr.confirm) {
  635. let parma = {
  636. workOrderIds: [this.id],
  637. taskId: this.taskId,
  638. type: 1
  639. }
  640. removeCache(parma).then(res => {
  641. this.getList()
  642. })
  643. }
  644. }
  645. })
  646. },
  647. getCacheFn() {
  648. let parma = {
  649. workOrderId: this.id,
  650. taskId: this.taskId,
  651. type: 1
  652. }
  653. getCache(parma).then(res => {
  654. if (!res || res.length < 0 || Object.getOwnPropertyNames(res).length === 0) {
  655. return false;
  656. }
  657. this.objData['product'] = res.extInfo.product
  658. this.objData['workReportInfo'] = res.extInfo.workReportInfo
  659. this.objData['notFormedList'] = res.extInfo.notFormedList
  660. this.objData['turnover'] = res.extInfo.turnover
  661. this.objData['productRecycleList'] = res.extInfo.productRecycleList
  662. this.objData['semiProductList'] = res.extInfo.semiProductList
  663. this.objData['modelList'] = res.extInfo.modelList
  664. })
  665. },
  666. },
  667. beforeDestroy() {
  668. uni.hideLoading();
  669. },
  670. }
  671. </script>
  672. <style lang="scss" scoped>
  673. .content-box {
  674. height: 100vh;
  675. overflow: hidden;
  676. display: flex;
  677. flex-direction: column;
  678. }
  679. .list_box {
  680. flex: 1;
  681. overflow: hidden;
  682. padding: 4rpx 0;
  683. .u-list {
  684. height: 100% !important;
  685. }
  686. .card_box {
  687. padding: 16rpx 20rpx;
  688. }
  689. }
  690. .bottom-wrapper {
  691. width: 100%;
  692. display: flex;
  693. align-items: center;
  694. justify-content: space-around;
  695. .btn_box {
  696. width: 50%;
  697. height: 88rpx;
  698. line-height: 88rpx;
  699. background: $theme-color;
  700. text-align: center;
  701. font-size: 36rpx;
  702. font-style: normal;
  703. font-weight: 400;
  704. color: #fff;
  705. &:first-child {
  706. border-right: 2rpx solid #fff;
  707. }
  708. }
  709. }
  710. .operate_box {
  711. padding: 10rpx 160rpx;
  712. /deep/ .u-button {
  713. width: 160rpx;
  714. }
  715. }
  716. .search_list {
  717. min-height: 500rpx;
  718. padding: 0 32rpx;
  719. }
  720. .search_list2 {
  721. min-height: 120rpx;
  722. padding: 0 32rpx;
  723. }
  724. .flex_btn {
  725. position: fixed;
  726. right: 0;
  727. bottom: 160rpx;
  728. width: 40rpx;
  729. height: 50rpx;
  730. line-height: 66rpx;
  731. border-radius: 22rpx 0 0 22rpx;
  732. background: $theme-color;
  733. text-align: center;
  734. font-size: 22rpx;
  735. font-style: normal;
  736. font-weight: 400;
  737. color: #fff;
  738. opacity: 0.6;
  739. .jiantou {
  740. width: 30rpx;
  741. height: 30rpx;
  742. }
  743. }
  744. .flex_btn2 {
  745. position: fixed;
  746. right: 0;
  747. bottom: 160rpx;
  748. width: 126rpx;
  749. min-height: 140rpx;
  750. line-height: 62rpx;
  751. border-radius: 22rpx 0 0 22rpx;
  752. background: $theme-color;
  753. text-align: center;
  754. font-size: 22rpx;
  755. font-style: normal;
  756. font-weight: 400;
  757. color: #fff;
  758. opacity: 0.7;
  759. .close_box {
  760. height: 50rpx;
  761. line-height: 50rpx;
  762. width: 126rpx;
  763. text-align: left;
  764. .close {
  765. width: 40rpx;
  766. height: 40rpx;
  767. padding: 6rpx 10rpx;
  768. }
  769. }
  770. }
  771. </style>