index.vue 24 KB

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