index.vue 23 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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'></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 = [{
  370. allFeedQuantity: '',
  371. allReportWeight: '',
  372. taskId: '',
  373. taskName: ''
  374. }]
  375. return {
  376. a
  377. }
  378. })
  379. this.objData.semiProductList = this.objData.semiProductList
  380. }
  381. this.objData.workReportInfo = {
  382. formingNum: null,
  383. formingWeight: null,
  384. formedNum: null,
  385. formedWeight: null,
  386. taskId: this.taskId
  387. }
  388. this.objData.notFormedList = [{
  389. notFormedNum: null,
  390. notFormedWeight: null,
  391. weightUnit: res.weightUnit,
  392. unit: res.unit,
  393. warehouseId: null, // 处置 仓库id
  394. }]
  395. if (this.objData.semiProductList.length > 0) { // 预制体报工
  396. this.objData.workReportInfo.formedNum = this.objData.semiProductList.length
  397. }
  398. this.objData.workReportInfo.formingNum = res.formingNum
  399. this.objData.workReportInfo.formingWeight = res.formingWeight
  400. this.objData.workReportInfo.unit = res.unit
  401. this.objData.workReportInfo.weightUnit = res.weightUnit
  402. this.objData.workReportInfo.workOrderId = res.workOrderId
  403. this.paramDetailList = []
  404. this.paramDetailList = res.paramDetailList.map(m => {
  405. if (m.extInfo.textType == 5) {
  406. this.remainingTime = m.extInfo.remainingTime
  407. }
  408. return {
  409. ...m.extInfo
  410. }
  411. })
  412. }).finally(() => {
  413. this.isLoad = true
  414. if (this.taskType == 1) {
  415. this.getCacheFn()
  416. }
  417. })
  418. },
  419. scrolltolower() {},
  420. handAdd() {
  421. const storageKey = Date.now() + "";
  422. uni.setStorageSync(storageKey, this.objData || {});
  423. uni.navigateTo({
  424. url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  425. })
  426. },
  427. penalize(index) {
  428. if (index || index == 0) {
  429. this.penalizeIndex = index
  430. this.formData.warehouseId = this.objData.productRecycleList[this.penalizeIndex].warehouseId || ''
  431. } else {
  432. this.penalizeIndex = null
  433. this.formData.warehouseId = this.objData.notFormedList[0].warehouseId || ''
  434. }
  435. this.$forceUpdate()
  436. if (this.warehouseList.length == 0) {
  437. getWarehouseList().then(res => {
  438. this.warehouseList = res
  439. this.searchShow = true
  440. })
  441. } else {
  442. this.searchShow = true
  443. }
  444. },
  445. inputChange(e) {
  446. console.log(e)
  447. },
  448. searchCancel() {
  449. this.searchShow = false
  450. },
  451. popupOk() {
  452. if (this.penalizeIndex == null) {
  453. this.$set(this.objData.notFormedList[0], 'warehouseId', this.formData.warehouseId || null)
  454. } else {
  455. this.objData.productRecycleList[this.penalizeIndex].warehouseId = this.formData.warehouseId
  456. }
  457. this.$forceUpdate()
  458. this.searchShow = false
  459. },
  460. modeNum(num) {
  461. if (this.objData.modelList.length == 0) {
  462. return false
  463. }
  464. this.$refs.modelRef.setNum(num)
  465. },
  466. async save(type) {
  467. uni.showLoading({
  468. title: '加载中'
  469. });
  470. console.log(this.objData)
  471. if (!this.objData.workReportInfo['formedNum'] && this.objData.workReportInfo['formedNum'] != 0) {
  472. uni.showToast({
  473. title: '请输入合格品数量',
  474. icon: 'none'
  475. })
  476. return false
  477. }
  478. // 预制体
  479. if (this.objData.semiProductList.length > 0 && this.taskType != 4 && this.objData.singleReport == 1 &&
  480. type == 2) {
  481. let bol
  482. let _i
  483. bol = this.objData.semiProductList.every((e, i) => {
  484. _i = i + 1
  485. if (this.taskType == 6) {
  486. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId
  487. } else {
  488. return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
  489. .reportWeight
  490. }
  491. })
  492. if (!bol) {
  493. uni.showToast({
  494. title: `请完善第${_i}处置方式`,
  495. icon: 'none'
  496. })
  497. return false
  498. }
  499. }
  500. if (this.objData.productRecycleList.length > 0 && this.clientEnvironmentId != 2) {
  501. const isRecycle = await this.checkRecycle()
  502. if (!isRecycle) {
  503. return false
  504. }
  505. }
  506. if (this.taskType == 4 && this.clientEnvironmentId != 3) {
  507. const isPack = await this.checkPack()
  508. if (!isPack) {
  509. return false
  510. }
  511. }
  512. if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  513. const isFirstTask = await this.checkFirstTask()
  514. if (!isFirstTask) {
  515. return false
  516. }
  517. }
  518. if (this.taskType == 1) {
  519. const isCache = await this.checkCache(type)
  520. if (!isCache) {
  521. return false
  522. }
  523. }
  524. if (this.clientEnvironmentId == 3 && type == 2 && this.taskType == 6 && this.objData.singleReport ==0) {
  525. this.objData.semiProductList = []
  526. }
  527. jobSave(this.objData).then(res => {
  528. uni.hideLoading();
  529. if (this.taskType == 4) {
  530. uni.showModal({
  531. title: '提示',
  532. content: '打包完成是否去入库!',
  533. confirmText: '确认', //这块是确定按钮的文字
  534. success: rr => {
  535. if (rr.confirm) {
  536. uni.redirectTo({
  537. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`
  538. })
  539. } else {
  540. uni.navigateBack()
  541. }
  542. }
  543. })
  544. } else {
  545. uni.navigateBack()
  546. }
  547. }).finally(() => {
  548. setTimeout(function() {
  549. uni.hideLoading();
  550. }, 3000);
  551. })
  552. },
  553. checkRecycle() {
  554. uni.hideLoading();
  555. return new Promise((resolve) => {
  556. uni.showModal({
  557. title: '提示',
  558. content: '是否跳过副产品回收处置!',
  559. confirmText: '确认', //这块是确定按钮的文字
  560. success: function(res) {
  561. if (res.confirm) {
  562. resolve(true)
  563. } else {
  564. resolve(false)
  565. }
  566. }
  567. })
  568. })
  569. },
  570. checkPack() {
  571. uni.hideLoading();
  572. return new Promise((resolve) => {
  573. let packInfo = this.$refs.packRef.getData()
  574. this.objData.packInfo = packInfo
  575. this.objData.taskType = this.taskType
  576. if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
  577. .objData
  578. .notFormedList[0].notFormedNum)) {
  579. uni.hideLoading();
  580. uni.showModal({
  581. title: '提示',
  582. content: '合格品数量加不合格品数量不等于包装总数!',
  583. confirmText: '确认', //这块是确定按钮的文字
  584. success: function(res) {
  585. if (res.confirm) {
  586. resolve(true)
  587. } else {
  588. resolve(false)
  589. }
  590. }
  591. })
  592. } else {
  593. resolve(true)
  594. }
  595. })
  596. },
  597. checkFirstTask() {
  598. uni.hideLoading();
  599. return new Promise((resolve) => {
  600. if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
  601. this.objData.notFormedList[0].notFormedNum)) {
  602. uni.showModal({
  603. title: '提示',
  604. content: '合格品数量加不合格品数量不等于上道工序数量!',
  605. confirmText: '确认', //这块是确定按钮的文字
  606. success: function(res) {
  607. if (res.confirm) {
  608. resolve(true)
  609. } else {
  610. resolve(false)
  611. }
  612. }
  613. })
  614. } else {
  615. resolve(true)
  616. }
  617. })
  618. },
  619. checkCache(type) {
  620. uni.hideLoading();
  621. return new Promise((resolve) => {
  622. if (type == 1) {
  623. saveCache(this.objData).then(rr => {
  624. uni.showToast({
  625. title: `已经缓存`,
  626. icon: 'none'
  627. })
  628. })
  629. resolve(false)
  630. } else if (type == 2) {
  631. resolve(true)
  632. }
  633. })
  634. },
  635. removeCacheFn() {
  636. uni.showModal({
  637. title: '缓存',
  638. content: '是否清空缓存!',
  639. confirmText: '确认', //这块是确定按钮的文字
  640. success: rr => {
  641. if (rr.confirm) {
  642. let parma = {
  643. workOrderIds: [this.id],
  644. taskId: this.taskId,
  645. type: 1
  646. }
  647. removeCache(parma).then(res => {
  648. this.getList()
  649. })
  650. }
  651. }
  652. })
  653. },
  654. getCacheFn() {
  655. let parma = {
  656. workOrderId: this.id,
  657. taskId: this.taskId,
  658. type: 1
  659. }
  660. getCache(parma).then(res => {
  661. if (!res || res.length < 0 || Object.getOwnPropertyNames(res).length === 0) {
  662. return false;
  663. }
  664. this.objData['product'] = res.extInfo.product
  665. this.objData['workReportInfo'] = res.extInfo.workReportInfo
  666. this.objData['notFormedList'] = res.extInfo.notFormedList
  667. this.objData['turnover'] = res.extInfo.turnover
  668. this.objData['productRecycleList'] = res.extInfo.productRecycleList
  669. this.objData['semiProductList'] = res.extInfo.semiProductList
  670. this.objData['modelList'] = res.extInfo.modelList
  671. })
  672. },
  673. },
  674. beforeDestroy() {
  675. uni.hideLoading();
  676. },
  677. }
  678. </script>
  679. <style lang="scss" scoped>
  680. .content-box {
  681. height: 100vh;
  682. overflow: hidden;
  683. display: flex;
  684. flex-direction: column;
  685. }
  686. .list_box {
  687. flex: 1;
  688. overflow: hidden;
  689. padding: 4rpx 0;
  690. .u-list {
  691. height: 100% !important;
  692. }
  693. .card_box {
  694. padding: 16rpx 20rpx;
  695. }
  696. }
  697. .bottom-wrapper {
  698. width: 100%;
  699. display: flex;
  700. align-items: center;
  701. justify-content: space-around;
  702. .btn_box {
  703. width: 50%;
  704. height: 88rpx;
  705. line-height: 88rpx;
  706. background: $theme-color;
  707. text-align: center;
  708. font-size: 36rpx;
  709. font-style: normal;
  710. font-weight: 400;
  711. color: #fff;
  712. &:first-child {
  713. border-right: 2rpx solid #fff;
  714. }
  715. }
  716. }
  717. .operate_box {
  718. padding: 10rpx 160rpx;
  719. /deep/ .u-button {
  720. width: 160rpx;
  721. }
  722. }
  723. .search_list {
  724. min-height: 500rpx;
  725. padding: 0 32rpx;
  726. }
  727. .search_list2 {
  728. min-height: 120rpx;
  729. padding: 0 32rpx;
  730. }
  731. .flex_btn {
  732. position: fixed;
  733. right: 0;
  734. bottom: 160rpx;
  735. width: 40rpx;
  736. height: 50rpx;
  737. line-height: 66rpx;
  738. border-radius: 22rpx 0 0 22rpx;
  739. background: $theme-color;
  740. text-align: center;
  741. font-size: 22rpx;
  742. font-style: normal;
  743. font-weight: 400;
  744. color: #fff;
  745. opacity: 0.6;
  746. .jiantou {
  747. width: 30rpx;
  748. height: 30rpx;
  749. }
  750. }
  751. .flex_btn2 {
  752. position: fixed;
  753. right: 0;
  754. bottom: 160rpx;
  755. width: 126rpx;
  756. min-height: 140rpx;
  757. line-height: 62rpx;
  758. border-radius: 22rpx 0 0 22rpx;
  759. background: $theme-color;
  760. text-align: center;
  761. font-size: 22rpx;
  762. font-style: normal;
  763. font-weight: 400;
  764. color: #fff;
  765. opacity: 0.7;
  766. .close_box {
  767. height: 50rpx;
  768. line-height: 50rpx;
  769. width: 126rpx;
  770. text-align: left;
  771. .close {
  772. width: 40rpx;
  773. height: 40rpx;
  774. padding: 6rpx 10rpx;
  775. }
  776. }
  777. }
  778. </style>