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. }
  509. })
  510. if (!bol) {
  511. uni.showToast({
  512. title: `请完善第${_i}处置方式`,
  513. icon: 'none'
  514. })
  515. return false
  516. }
  517. }
  518. if (this.objData.productRecycleList.length > 0 && this.clientEnvironmentId != 2) {
  519. const isRecycle = await this.checkRecycle()
  520. if (!isRecycle) {
  521. return false
  522. }
  523. }
  524. if (this.taskType == 4 && this.clientEnvironmentId != 3) {
  525. const isPack = await this.checkPack()
  526. if (!isPack) {
  527. return false
  528. }
  529. }
  530. if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
  531. const isFirstTask = await this.checkFirstTask()
  532. if (!isFirstTask) {
  533. return false
  534. }
  535. }
  536. if (this.taskType == 1) {
  537. const isCache = await this.checkCache(type)
  538. if (!isCache) {
  539. return false
  540. }
  541. }
  542. if (this.clientEnvironmentId == 3 && type == 2 && this.taskType == 6 && this.objData.singleReport ==
  543. 0) {
  544. this.objData.semiProductList = []
  545. }
  546. if (this.clientEnvironmentId == 3 && this.taskType == 1) {
  547. if (this.objData && this.objData.executorTime && this.objData.executorTime != undefined) {
  548. // 正则表达式1:匹配 yyyy-MM-dd 格式
  549. const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
  550. if(dateRegex.test(this.objData.executorTime.trimRight())) {
  551. this.objData.workReportInfo['executorTime'] = this.objData.executorTime+' 00:00:00'
  552. } else {
  553. this.objData.workReportInfo['executorTime'] = this.objData.executorTime
  554. }
  555. } else {
  556. uni.showToast({
  557. title: `请先选择实际报工时间`,
  558. icon: 'none'
  559. })
  560. return false
  561. }
  562. }
  563. console.log('报工', this.objData)
  564. jobSave(this.objData).then(res => {
  565. uni.hideLoading();
  566. if (this.taskType == 4) {
  567. uni.showModal({
  568. title: '提示',
  569. content: '打包完成是否去入库!',
  570. confirmText: '确认', //这块是确定按钮的文字
  571. success: rr => {
  572. if (rr.confirm) {
  573. uni.redirectTo({
  574. url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`
  575. })
  576. } else {
  577. uni.navigateBack()
  578. }
  579. }
  580. })
  581. } else {
  582. uni.navigateBack()
  583. }
  584. }).finally(() => {
  585. setTimeout(function() {
  586. uni.hideLoading();
  587. }, 3000);
  588. })
  589. },
  590. checkRecycle() {
  591. uni.hideLoading();
  592. return new Promise((resolve) => {
  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. })
  606. },
  607. checkPack() {
  608. uni.hideLoading();
  609. return new Promise((resolve) => {
  610. let packInfo = this.$refs.packRef.getData()
  611. this.objData.packInfo = packInfo
  612. this.objData.taskType = this.taskType
  613. if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
  614. .objData
  615. .notFormedList[0].notFormedNum)) {
  616. uni.hideLoading();
  617. uni.showModal({
  618. title: '提示',
  619. content: '合格品数量加不合格品数量不等于包装总数!',
  620. confirmText: '确认', //这块是确定按钮的文字
  621. success: function(res) {
  622. if (res.confirm) {
  623. resolve(true)
  624. } else {
  625. resolve(false)
  626. }
  627. }
  628. })
  629. } else {
  630. resolve(true)
  631. }
  632. })
  633. },
  634. checkFirstTask() {
  635. uni.hideLoading();
  636. return new Promise((resolve) => {
  637. if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
  638. this.objData.notFormedList[0].notFormedNum)) {
  639. uni.showModal({
  640. title: '提示',
  641. content: '合格品数量加不合格品数量不等于上道工序数量!',
  642. confirmText: '确认', //这块是确定按钮的文字
  643. success: function(res) {
  644. if (res.confirm) {
  645. resolve(true)
  646. } else {
  647. resolve(false)
  648. }
  649. }
  650. })
  651. } else {
  652. resolve(true)
  653. }
  654. })
  655. },
  656. checkCache(type) {
  657. uni.hideLoading();
  658. return new Promise((resolve) => {
  659. if (type == 1) {
  660. saveCache(this.objData).then(rr => {
  661. uni.showToast({
  662. title: `已经缓存`,
  663. icon: 'none'
  664. })
  665. })
  666. resolve(false)
  667. } else if (type == 2) {
  668. resolve(true)
  669. }
  670. })
  671. },
  672. removeCacheFn() {
  673. uni.showModal({
  674. title: '缓存',
  675. content: '是否清空缓存!',
  676. confirmText: '确认', //这块是确定按钮的文字
  677. success: rr => {
  678. if (rr.confirm) {
  679. let parma = {
  680. workOrderIds: [this.id],
  681. taskId: this.taskId,
  682. type: 1
  683. }
  684. removeCache(parma).then(res => {
  685. this.getList()
  686. })
  687. }
  688. }
  689. })
  690. },
  691. getCacheFn() {
  692. let parma = {
  693. workOrderId: this.id,
  694. taskId: this.taskId,
  695. type: 1
  696. }
  697. getCache(parma).then(res => {
  698. if (!res || res.length < 0 || Object.getOwnPropertyNames(res).length === 0) {
  699. return false;
  700. }
  701. this.objData['product'] = res.extInfo.product
  702. this.objData['workReportInfo'] = res.extInfo.workReportInfo
  703. this.objData['notFormedList'] = res.extInfo.notFormedList
  704. this.objData['turnover'] = res.extInfo.turnover
  705. this.objData['productRecycleList'] = res.extInfo.productRecycleList
  706. this.objData['semiProductList'] = res.extInfo.semiProductList
  707. this.objData['modelList'] = res.extInfo.modelList
  708. })
  709. },
  710. },
  711. beforeDestroy() {
  712. uni.hideLoading();
  713. },
  714. }
  715. </script>
  716. <style lang="scss" scoped>
  717. .content-box {
  718. height: 100vh;
  719. overflow: hidden;
  720. display: flex;
  721. flex-direction: column;
  722. }
  723. .list_box {
  724. flex: 1;
  725. overflow: hidden;
  726. padding: 4rpx 0;
  727. .u-list {
  728. height: 100% !important;
  729. }
  730. .card_box {
  731. padding: 16rpx 20rpx;
  732. }
  733. }
  734. .bottom-wrapper {
  735. width: 100%;
  736. display: flex;
  737. align-items: center;
  738. justify-content: space-around;
  739. .btn_box {
  740. width: 50%;
  741. height: 88rpx;
  742. line-height: 88rpx;
  743. background: $theme-color;
  744. text-align: center;
  745. font-size: 36rpx;
  746. font-style: normal;
  747. font-weight: 400;
  748. color: #fff;
  749. &:first-child {
  750. border-right: 2rpx solid #fff;
  751. }
  752. }
  753. }
  754. .operate_box {
  755. padding: 10rpx 160rpx;
  756. /deep/ .u-button {
  757. width: 160rpx;
  758. }
  759. }
  760. .search_list {
  761. min-height: 500rpx;
  762. padding: 0 32rpx;
  763. }
  764. .search_list2 {
  765. min-height: 120rpx;
  766. padding: 0 32rpx;
  767. }
  768. .flex_btn {
  769. position: fixed;
  770. right: 0;
  771. bottom: 160rpx;
  772. width: 40rpx;
  773. height: 50rpx;
  774. line-height: 66rpx;
  775. border-radius: 22rpx 0 0 22rpx;
  776. background: $theme-color;
  777. text-align: center;
  778. font-size: 22rpx;
  779. font-style: normal;
  780. font-weight: 400;
  781. color: #fff;
  782. opacity: 0.6;
  783. .jiantou {
  784. width: 30rpx;
  785. height: 30rpx;
  786. }
  787. }
  788. .flex_btn2 {
  789. position: fixed;
  790. right: 0;
  791. bottom: 160rpx;
  792. width: 126rpx;
  793. min-height: 140rpx;
  794. line-height: 62rpx;
  795. border-radius: 22rpx 0 0 22rpx;
  796. background: $theme-color;
  797. text-align: center;
  798. font-size: 22rpx;
  799. font-style: normal;
  800. font-weight: 400;
  801. color: #fff;
  802. opacity: 0.7;
  803. .close_box {
  804. height: 50rpx;
  805. line-height: 50rpx;
  806. width: 126rpx;
  807. text-align: left;
  808. .close {
  809. width: 40rpx;
  810. height: 40rpx;
  811. padding: 6rpx 10rpx;
  812. }
  813. }
  814. }
  815. </style>