index.vue 25 KB

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