index.vue 25 KB

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