index.vue 23 KB

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