index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. <template>
  2. <view class="mask" v-if="isLoading"></view>
  3. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;position: fixed;left: 0;right: 0;">
  4. <view class="box-bg uni-row">
  5. <view class="input-view uni-row">
  6. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  7. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入批次号/箱号" />
  8. </view>
  9. <view class="search" @click="handleSearch">
  10. 搜索
  11. </view>
  12. </view>
  13. <view class="list-title uni-row">
  14. <text class="label">是否正常批次</text>
  15. <text>{{ normalStatus ? '是' : '否' }}</text>
  16. <switch class="switch" :checked="normalStatus" @change="switchChange" color="rgba(103, 195, 55, 1.0)" />
  17. </view>
  18. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  19. <text>暂无批次</text>
  20. </view>
  21. <view v-else class="scroll-container" style="margin-bottom:130px">
  22. <!-- 批次列表 -->
  23. <view v-for="(item, index) in listData" :key="index" class="list-item" @click="checkStatus(item)">
  24. <!-- @click="handleToreportingForWork(item)" -->
  25. <view class="title-container uni-row" style="justify-content: flex-start;">
  26. <view class="title uni-row">
  27. <text class="label">批次号:</text>
  28. <text class="label code">{{ item['lotCode'] }}</text>
  29. </view>
  30. <view class=" uni-row" style="margin-left: 16rpx;">
  31. <view v-if="item['status'] == 1" class="tag"><text class="label">进行中</text></view>
  32. <view v-else-if="item['status'] == 3" class="tag turnover "><text class="label">待领取</text>
  33. </view>
  34. <view v-else-if="item['status'] == 2" class="tag turnover "><text class="label">待周转</text>
  35. </view>
  36. <view v-else-if="item['status'] == 0" class="tag finished "><text class="label">未开始</text>
  37. </view>
  38. <view v-else-if="item['status'] == 4" type="default finished" class="tag finished"><text
  39. class="label">已完成</text></view>
  40. </view>
  41. </view>
  42. <view class="item-info uni-row">
  43. <text class="label">产品描述</text>
  44. <text class="label right">{{ curPlan['productDescription'] }}</text>
  45. </view>
  46. <view class="item-info uni-row">
  47. <text class="label">材质</text>
  48. <text
  49. class="label right">{{ item['furnaceNoInfo'] ? item['furnaceNoInfo'].firstTechnicalRequirement + ";" + item['furnaceNoInfo'].secondTechnicalRequirement : '-' }}</text>
  50. </view>
  51. <view class="item-info uni-row">
  52. <text class="label">原材料厂家</text>
  53. <text
  54. class="label right">{{ item['furnaceNoInfo'] ? (item['furnaceNoInfo'].factory === "" ? "-" : item['furnaceNoInfo'].factory) : "-" }}</text>
  55. </view>
  56. <view class="item-info uni-row">
  57. <text class="label">箱号</text>
  58. <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
  59. </view>
  60. <!-- <view class="item-info uni-row">
  61. <text class="label">总工时</text>
  62. <text class="label right">{{ item['totalWorkingHours']}}</text>
  63. </view> -->
  64. <view class="item-info uni-row">
  65. <text class="label">投入数</text>
  66. <text
  67. class="label right">{{item.prevProcess == null ? item['productionQuantity'] : item['processQualifiedNum']}}</text>
  68. </view>
  69. <view class="item-info uni-row">
  70. <text class="label">已完成工序</text>
  71. <text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
  72. </view>
  73. <view class="item-info uni-row">
  74. <text class="label">待加工工序</text>
  75. <!-- <text
  76. class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
  77. <text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
  78. </view>
  79. <view class="item-info uni-row">
  80. <text class="label">下道工序</text>
  81. <view class="label right uni-row">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
  82. (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
  83. </view>)
  84. </view>
  85. </view>
  86. <!-- <view class="item-info uni-row">
  87. <text class="label">设备</text>
  88. <text class="label right">{{ curPlan['equipmentName'] }}</text>
  89. </view> -->
  90. <view v-if="notPreProcess" class="item-info uni-row">
  91. <text class="label">所在区域</text>
  92. <text class="label right">{{ getPlaceText(item) }}</text>
  93. </view>
  94. <view class="status-btn uni-row">
  95. <view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
  96. <button class="reporting-tag" size="mini"
  97. @click.stop="handleToreportingForWork(item)">开始报工</button>
  98. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  99. </view>
  100. <view v-if="item['status'] == 2" class=" uni-row">
  101. <button class="turnover-tag" size="mini"
  102. @click.stop="handleShowTurnoverApplication(item)">周转申请</button>
  103. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  104. </view>
  105. <view v-else-if="item['status'] == 3" class=" uni-row">
  106. <button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)"
  107. style="background-color: rgba(255, 85, 85, 1);">取消周转</button>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 抽屉 -->
  113. <uni-drawer ref="showRight" mode="right" :mask-click="true" style="height: 100%;">
  114. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;margin-top: 20px;">工艺列表</view>
  115. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  116. 仅显示当前工序后面工艺
  117. </view>
  118. <view><button v-if="!editStatus" class="start-batch-btn" style="margin-bottom: 16rpx;" type="primary"
  119. @click="handleOpenDrawing">查看本工序图纸</button></view>
  120. <scroll-view scroll-y="true" style="height: 70%;" @touchmove.stop>
  121. <view v-for="(item,index) in curProcessAfte" :key="index"
  122. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  123. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  124. </view>
  125. </scroll-view>
  126. <!-- <view><button v-if="!editStatus" class="view-end-btn" style="margin-top: 20rpx;" type="primary"
  127. @click="handleOpenDrawing">查看本工序图纸</button></view> -->
  128. </uni-drawer>
  129. <!-- <view v-if="bottomStatus" class="bottom uni-row">
  130. <button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
  131. </view>
  132. <view v-if="!bottomStatus" class="bottom uni-row">
  133. <button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
  134. </view> -->
  135. <view class="bottom uni-row">
  136. <button v-if="bottomStatus" class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
  137. @click="handleStartNewBatch">开始新批次</button>
  138. <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
  139. @click="handleScanCode">扫码开始批次</button>
  140. <button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
  141. </view>
  142. <dialog-lot ref="lotDialog" @submit="handleDoIt" />
  143. <dialog-turnoverApplication ref="turnoverApplicationDialog" @reflushDaywork="handleDoTurnoverAfter" />
  144. <dialog-selectProduction ref="selectProduction"></dialog-selectProduction>
  145. <dialog-selectEquipment ref='selectEquipment'
  146. @handleAddDayWorkItem='handleAddEquipment'></dialog-selectEquipment>
  147. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  148. </view>
  149. </template>
  150. <script setup>
  151. import {
  152. normalizeProps,
  153. reactive,
  154. onMounted,
  155. getCurrentInstance,
  156. ref
  157. } from 'vue'
  158. import {
  159. onLoad,
  160. onReady,
  161. onUnload,
  162. onShow,
  163. onPullDownRefresh
  164. } from '@dcloudio/uni-app'
  165. import QrScanner from '../vueQrCode/index.vue'
  166. import {
  167. getDayWorkList,
  168. showDaywork,
  169. // showDayworkSave,
  170. turnoverDelete
  171. } from '@/api/business/dayWork.js'
  172. import {
  173. getAbnormalityLot
  174. } from '@/api/business/lot.js'
  175. import {
  176. carrierFinishedCheck
  177. } from '@/api/business/carrier.js'
  178. import {
  179. addEquipmentInfo
  180. } from '@/api/business/dayWorkItem.js'
  181. import {
  182. isTakeStock
  183. } from '@/api/business/taksStackLot.js'
  184. import {
  185. store
  186. } from '@/store/index.js'
  187. import {
  188. toHHmmss
  189. } from '@/utils/common.js'
  190. import {
  191. getSortingDayworkItem,
  192. showDayworkSave
  193. } from '@/api/business/sortDaywork.js'
  194. const turnoverApplicationDialog = ref(null)
  195. const selectProduction = ref(null)
  196. const lotDialog = ref(null)
  197. const listData = ref([])
  198. const curPlan = ref(null)
  199. const bizDayworkObj = ref({})
  200. const bottomStatus = ref(false) // 底部按钮显示
  201. const paging = ref();
  202. const reqParam = ref(null);
  203. const normalStatus = ref(true)
  204. const isLoading = ref(false);
  205. const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态
  206. const keywords = ref(null)
  207. const selectEquipment = ref(null) // 组件
  208. const tempList = ref([])
  209. const wasteRecyclingList = ref([]) //废品回用批次
  210. // 在数据中定义一个变量来控制遮罩层的显示
  211. const isMaskShow = ref(false);
  212. const currentDaywork = ref({})
  213. const notPreProcess = ref(true)
  214. const curProcessAfte = ref([])
  215. const showRight = ref(null) // 抽屉
  216. const editStatus = ref(false)
  217. const showQrCodeReader = ref(false);
  218. onLoad((options) => {
  219. curPlan.value = store.planDetails;
  220. normalStatus.value = true;
  221. console.log(store.planDetails)
  222. if (options != null) {
  223. console.log(options)
  224. console.log("999")
  225. keywords.value = options.param1
  226. if (store.planDetails.isAmend == 1 || store.planDetails.isWasteRecycling == 1) {
  227. normalStatus.value = false;
  228. }
  229. }
  230. console.log(curPlan.value)
  231. //废品回用的领料部门如果是当前工段,也要可以开始新批次
  232. //查找当前计划单下的批次废品回用是当前工段
  233. getAbnormalityLot({
  234. productionPlanDetailId: store.planDetails.id,
  235. requisitionDepartmentId: store.curDeptDetails.deptId
  236. }).then(res => {
  237. wasteRecyclingList.value = res.rows
  238. console.log(wasteRecyclingList.value.length)
  239. if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId) {
  240. bottomStatus.value = true;
  241. store.isPreProcess = true;
  242. } else {
  243. bottomStatus.value = false;
  244. store.isPreProcess = false;
  245. }
  246. })
  247. console.log(wasteRecyclingList.value.length)
  248. })
  249. function getPlaceText(item) {
  250. let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
  251. '-' : '默认周转区' : item.dayworkItemList[0].place
  252. let deptName = item.dayworkItemList[0].deptName
  253. return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
  254. }
  255. /**
  256. * 监听下拉刷新
  257. */
  258. onPullDownRefresh(() => {
  259. uni.stopPullDownRefresh();
  260. reflush();
  261. // normalStatus.value = true;
  262. // let reqData = {
  263. // productionPlanDetailId: store.planDetails.id,
  264. // deptId: store.curDeptDetails.deptId,
  265. // keywords: keywords.value
  266. // };
  267. // getDayWorkList(reqData).then(res => {
  268. // if (res.code == 200) {
  269. // tempList.value = res.data
  270. // if (normalStatus.value) {
  271. // listData.value = res.data.filter(item => {
  272. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  273. // });
  274. // } else {
  275. // listData.value = res.data.filter(item => {
  276. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  277. // })
  278. // }
  279. // for (let i = 0; i < listData.value.length; i++) {
  280. // if (listData.value[i].prevProcess) {
  281. // let sum = 0;
  282. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  283. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
  284. // .prevProcess
  285. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[
  286. // i]
  287. // .dayworkItemList[j].status == 3)) {
  288. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  289. // }
  290. // }
  291. // listData.value[i].processQualifiedNum = sum;
  292. // }
  293. // }
  294. // }
  295. // uni.stopPullDownRefresh();
  296. // })
  297. })
  298. onShow(() => {
  299. reflush();
  300. })
  301. function handleOpenDrawing() {
  302. console.log(currentDaywork.value, "444")
  303. var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork
  304. .value.currentProcess.processStepNumber);
  305. // 检查 filteredProcess 是否有元素,并选择第一个元素
  306. if (filteredProcess.length > 0) {
  307. var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
  308. // 对 technologicalProcessDetailId 进行URL编码
  309. var encodedId = encodeURIComponent(currentDaywork.value.productId);
  310. var enTechnologicalProcessId = encodeURIComponent(currentDaywork.value.technologicalProcessId);
  311. var enprocessCode = encodeURIComponent(firstMatch.processCode);
  312. var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
  313. var enProcessAlias = encodeURIComponent(firstMatch.processAlias);
  314. var enIsWasteRecycling = encodeURIComponent(currentDaywork.value.isWasteRecycling);
  315. var enIsAmend = encodeURIComponent(currentDaywork.value.isAmend);
  316. // 构建查询参数字符串
  317. var queryParam =
  318. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  319. // 使用模板字符串构建完整的URL
  320. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  321. // 导航到指定页面
  322. uni.navigateTo({
  323. url: navigateUrl
  324. });
  325. } else {
  326. console.log('No process matched the current process step number.');
  327. }
  328. }
  329. function reflush() {
  330. // normalStatus.value = true;
  331. init(store.planDetails.id);
  332. }
  333. function handleShowTurnoverApplication(data) {
  334. isTakeStock().then(response => {
  335. if (response.data) {
  336. uni.showToast({
  337. icon: 'none',
  338. title: '正在盘点,不能申请周转',
  339. duration: 2000
  340. })
  341. } else {
  342. let _data = data ?? {}
  343. carrierFinishedCheck(data).then(res => {
  344. if (res.code === 200) {
  345. // 调用子组件中的方法
  346. turnoverApplicationDialog.value.open(_data)
  347. } else {
  348. uni.showToast({
  349. icon: 'none',
  350. title: res.msg
  351. })
  352. }
  353. })
  354. }
  355. })
  356. // .catch(err => {
  357. // uri.showToast({
  358. // icon: "fail",
  359. // title: "网络请求失败。"
  360. // })
  361. // })
  362. }
  363. function handleStartNewBatch() {
  364. store.normalStatus = normalStatus.value;
  365. // console.log(normalStatus.value)
  366. uni.navigateTo({
  367. url: "/pages/addNewBatch/index"
  368. })
  369. }
  370. function init(id) {
  371. uni.showLoading({
  372. title: '加载中'
  373. });
  374. let reqData = {
  375. productionPlanDetailId: id,
  376. deptId: store.curDeptDetails.deptId,
  377. keywords: keywords.value
  378. };
  379. // normalStatus.value = true;
  380. getDayWorkList(reqData).then(res => {
  381. if (res.code == 200) {
  382. console.log(res)
  383. tempList.value = res.data
  384. if (normalStatus.value) {
  385. listData.value = res.data.filter(item => {
  386. return item.isWasteRecycling == 0 && item.isAmend == 0;
  387. });
  388. } else {
  389. listData.value = res.data.filter(item => {
  390. return item.isWasteRecycling == 1 || item.isAmend == 1;
  391. })
  392. }
  393. // listData.value = res.data.filter(item => {
  394. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  395. // });
  396. /* 0531 */
  397. // for (let i = 0; i < listData.value.length; i++) {
  398. // if (listData.value[i].prevProcess) {
  399. // let sum = 0;
  400. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  401. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
  402. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
  403. // .dayworkItemList[j].status == 3)) {
  404. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  405. // }
  406. // }
  407. // listData.value[i].processQualifiedNum = sum;
  408. // }
  409. // }
  410. }
  411. uni.hideLoading();
  412. })
  413. }
  414. function handleSearch() {
  415. init(store.planDetails.id);
  416. }
  417. function checkStatus(item) {
  418. if (item.dayworkItemList[0].status < 3) {
  419. return
  420. } else {
  421. handleToreportingForWork(item)
  422. }
  423. }
  424. function handleToreportingForWork(item) {
  425. store.dayworkInfo = item
  426. console.log(store.dayworkInfo)
  427. // if (item.dayworkItemList[0].status == 0) {
  428. // return
  429. // }
  430. uni.$once("formBack", () => handleSearch())
  431. if (item.dayworkItemList[0].equipmentDetailId == 0) {
  432. selectEquipment.value.open(null);
  433. } else {
  434. uni.navigateTo({
  435. url: "/pages/sorting/form",
  436. success: function(res) {
  437. // 通过eventChannel向被打开页面传送数据
  438. res.eventChannel.emit('acceptDataFromOpenerPage', {
  439. data: item
  440. })
  441. }
  442. })
  443. }
  444. }
  445. //选择设备
  446. function handleAddEquipment(data) {
  447. let dayworkItem = store.dayworkInfo.dayworkItemList[0]
  448. store.dayworkInfo.dayworkItemList[0].equipmentDetailId = data.equipmentDetailId
  449. store.dayworkInfo.dayworkItemList[0].equipmentDetailCode = data.equipmentDetailCode
  450. dayworkItem.equipmentDetailId = data.equipmentDetailId
  451. dayworkItem.equipmentDetailCode = data.equipmentDetailCode
  452. //保存
  453. addEquipmentInfo(dayworkItem).then(res => {
  454. if (res.code == 200) {
  455. uni.navigateTo({
  456. url: "/pages/sorting/form",
  457. success: function(res) {
  458. // 通过eventChannel向被打开页面传送数据
  459. res.eventChannel.emit('acceptDataFromOpenerPage', {
  460. data: store.dayworkInfo
  461. })
  462. }
  463. })
  464. }
  465. })
  466. }
  467. function handleClickProcessList(item) {
  468. let curProcessAfterList = [];
  469. console.log(item)
  470. currentDaywork.value = item
  471. editStatus.value = false
  472. // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
  473. // editStatus.value = true
  474. // } else {
  475. // editStatus.value = false
  476. // }
  477. let nextIndex = 0;
  478. for (let i = 0; i < item.processSequence.length; i++) {
  479. console.log(item.nextProcess, "next")
  480. if (item.nextProcess) {
  481. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  482. nextIndex = i;
  483. }
  484. } else {
  485. nextIndex = item.processSequence.length
  486. }
  487. }
  488. for (let i = 0; i < item.processSequence.length; i++) {
  489. if (i >= nextIndex) {
  490. curProcessAfterList.push(item.processSequence[i]);
  491. }
  492. }
  493. if (item.status == 3) {
  494. curProcessAfterList.splice(0, 1)
  495. }
  496. console.log(curProcessAfterList)
  497. curProcessAfte.value = curProcessAfterList;
  498. showRight.value.open();
  499. }
  500. function handleSearchCode() {
  501. selectProduction.value.open(normalStatus.value);
  502. }
  503. // function switchChange(event) {
  504. // //异常批
  505. // if (event.detail.value) {
  506. // listData.value = tempList.value.filter(item => {
  507. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  508. // });
  509. // normalStatus.value = 1
  510. // } else {
  511. // listData.value = tempList.value.filter(item => {
  512. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  513. // });
  514. // normalStatus.value = 0
  515. // }
  516. // }
  517. /*
  518. function handleScanCode() {
  519. // 引入原生插件
  520. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  521. // const mpaasScanModule = null
  522. if (mpaasScanModule) {
  523. // 调用插件的 mpaasScan 方法
  524. mpaasScanModule.mpaasScan({
  525. // 扫码识别类型,参数可多选,qrCode、barCode,
  526. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  527. scanType: ["qrCode", "barCode"],
  528. // 是否隐藏相册,默认false不隐藏
  529. hideAlbum: false,
  530. },
  531. (ret) => {
  532. console.log(ret);
  533. let vehicleObj = JSON.parse(ret.resp_result);
  534. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  535. uni.showToast({
  536. icon: "none",
  537. title: "请扫载具码",
  538. duration: 1000
  539. })
  540. return;
  541. }
  542. showDaywork({
  543. carrierId: vehicleObj.carrierId,
  544. status: 7
  545. }).then(response => {
  546. if (response.code == 200) {
  547. // console.log(response)
  548. // console.log(response.data[0].productionPlanDetailId)
  549. // console.log(store.planDetails.id)
  550. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  551. uni.showToast({
  552. icon: 'none',
  553. title: '该批次不在当前工段',
  554. duration: 2000
  555. })
  556. return
  557. }
  558. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  559. // console.log(response.data)
  560. lotDialog.value.open(response.data);
  561. } else {
  562. uni.showToast({
  563. icon: 'none',
  564. title: '该批次不在此计划单内',
  565. duration: 2000
  566. })
  567. }
  568. } else {
  569. uni.showToast({
  570. icon: 'none',
  571. title: response.msg,
  572. duration: 2000
  573. })
  574. }
  575. })
  576. }
  577. );
  578. } else {
  579. // 测试时用
  580. showDaywork({
  581. carrierId: '1770342949090017283',
  582. status: 7
  583. }).then(response => {
  584. if (response.code == 200) {
  585. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  586. uni.showToast({
  587. icon: 'none',
  588. title: '该批次不在当前工段',
  589. duration: 2000
  590. })
  591. return
  592. }
  593. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  594. console.log(response.data)
  595. lotDialog.value.open(response.data);
  596. } else {
  597. uni.showToast({
  598. icon: 'none',
  599. title: '该批次不在此计划单内',
  600. duration: 2000
  601. })
  602. }
  603. } else {
  604. console.log(response)
  605. uni.showToast({
  606. icon: 'none',
  607. title: response.msg,
  608. duration: 2000
  609. })
  610. }
  611. })
  612. }
  613. }
  614. */
  615. //H5扫码器回调
  616. function onDecodeHandler(data) {
  617. showQrCodeReader.value = false;
  618. let vehicleObj = {
  619. carrierCode: data
  620. };
  621. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  622. uni.showToast({
  623. icon: "none",
  624. title: "请扫载具码",
  625. duration: 1000
  626. })
  627. return;
  628. }
  629. showDaywork({
  630. carrierCode: vehicleObj.carrierCode,
  631. status: 7
  632. }).then(response => {
  633. if (response.code == 200) {
  634. // console.log(response)
  635. // console.log(response.data[0].productionPlanDetailId)
  636. // console.log(store.planDetails.id)
  637. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  638. uni.showToast({
  639. icon: 'none',
  640. title: '该批次不在当前工段',
  641. duration: 2000
  642. })
  643. return
  644. }
  645. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  646. // console.log(response.data)
  647. lotDialog.value.open(response.data);
  648. } else {
  649. uni.showToast({
  650. icon: 'none',
  651. title: '该批次不在此计划单内',
  652. duration: 2000
  653. })
  654. }
  655. } else {
  656. uni.showToast({
  657. icon: 'none',
  658. title: response.msg,
  659. duration: 2000
  660. })
  661. }
  662. })
  663. }
  664. //H5扫码器关闭
  665. function qrReaderClose() {
  666. showQrCodeReader.value = false;
  667. }
  668. function handleScanCode() {
  669. showQrCodeReader.value = true;
  670. // 引入原生插件
  671. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  672. // // const mpaasScanModule = null
  673. // if (mpaasScanModule) {
  674. // // 调用插件的 mpaasScan 方法
  675. // mpaasScanModule.mpaasScan({
  676. // // 扫码识别类型,参数可多选,qrCode、barCode,
  677. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  678. // scanType: ["qrCode", "barCode"],
  679. // // 是否隐藏相册,默认false不隐藏
  680. // hideAlbum: false,
  681. // },
  682. // (ret) => {
  683. // console.log(ret);
  684. // let vehicleObj = {
  685. // carrierCode: ret.resp_result
  686. // };
  687. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  688. // uni.showToast({
  689. // icon: "none",
  690. // title: "请扫载具码",
  691. // duration: 1000
  692. // })
  693. // return;
  694. // }
  695. // showDaywork({
  696. // carrierCode: vehicleObj.carrierCode,
  697. // status: 7
  698. // }).then(response => {
  699. // if (response.code == 200) {
  700. // // console.log(response)
  701. // // console.log(response.data[0].productionPlanDetailId)
  702. // // console.log(store.planDetails.id)
  703. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  704. // uni.showToast({
  705. // icon: 'none',
  706. // title: '该批次不在当前工段',
  707. // duration: 2000
  708. // })
  709. // return
  710. // }
  711. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  712. // // console.log(response.data)
  713. // lotDialog.value.open(response.data);
  714. // } else {
  715. // uni.showToast({
  716. // icon: 'none',
  717. // title: '该批次不在此计划单内',
  718. // duration: 2000
  719. // })
  720. // }
  721. // } else {
  722. // uni.showToast({
  723. // icon: 'none',
  724. // title: response.msg,
  725. // duration: 2000
  726. // })
  727. // }
  728. // })
  729. // }
  730. // );
  731. // } else {
  732. // // 测试时用
  733. // showDaywork({
  734. // carrierCode: '000075',
  735. // status: 7
  736. // }).then(response => {
  737. // if (response.code == 200) {
  738. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  739. // uni.showToast({
  740. // icon: 'none',
  741. // title: '该批次不在当前工段',
  742. // duration: 2000
  743. // })
  744. // return
  745. // }
  746. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  747. // console.log(response.data)
  748. // lotDialog.value.open(response.data);
  749. // } else {
  750. // uni.showToast({
  751. // icon: 'none',
  752. // title: '该批次不在此计划单内',
  753. // duration: 2000
  754. // })
  755. // }
  756. // } else {
  757. // console.log(response)
  758. // uni.showToast({
  759. // icon: 'none',
  760. // title: response.msg,
  761. // duration: 2000
  762. // })
  763. // }
  764. // })
  765. // }
  766. }
  767. // function handleScanCode() {
  768. // uni.scanCode({
  769. // onlyFromCamera: true,
  770. // success: function (res) {
  771. // if (res.scanType !== 'QR_CODE') {
  772. // uni.showToast({
  773. // icon: 'none',
  774. // title: '二维码未识别成功',
  775. // duration: 2000
  776. // })
  777. // }
  778. // console.log('条码类型:' + res.scanType);
  779. // console.log('条码内容:' + res.result);
  780. // }
  781. // });
  782. // }
  783. function handleAddDaywork(data) {
  784. isLoading.value = true; // 显示遮罩层
  785. uni.showLoading({
  786. title: '加载中'
  787. })
  788. console.log(data)
  789. let reqParam = [];
  790. for (var i = 0; i < data.length; i++) {
  791. reqParam.push(data[i].daywork)
  792. }
  793. console.log(data)
  794. data.forEach(item => {
  795. item.isSort = 1
  796. item.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  797. })
  798. showDayworkSave(data).then(res => {
  799. isLoading.value = false;
  800. uni.hideLoading();
  801. if (res.code == 200) {
  802. console.log(res)
  803. init(store.planDetails.id);
  804. } else {
  805. uni.showToast({
  806. icon: "none",
  807. title: res.msg,
  808. duration: 2000
  809. })
  810. }
  811. })
  812. }
  813. function handleDoIt(data) {
  814. handleAddDaywork(data);
  815. }
  816. function handleDoTurnoverAfter() {
  817. reflush();
  818. }
  819. function switchChange(event) {
  820. console.log(event)
  821. //异常批
  822. if (normalStatus.value) {
  823. listData.value = tempList.value.filter(item => {
  824. return item.isWasteRecycling == 1 || item.isAmend == 1;
  825. });
  826. normalStatus.value = false
  827. } else {
  828. listData.value = tempList.value.filter(item => {
  829. return item.isWasteRecycling == 0 && item.isAmend == 0;
  830. });
  831. normalStatus.value = true
  832. }
  833. console.log(listData.value)
  834. }
  835. function startReport(data) {
  836. getSortingDayworkItem(data).then(res => {
  837. uni.showToast({
  838. icon: "success",
  839. title: "开始成功",
  840. duration: 2000
  841. })
  842. init(store.planDetails.id)
  843. })
  844. }
  845. function handleCancelTurnover(data) {
  846. isTakeStock().then(response => {
  847. if (response.data) {
  848. uni.showToast({
  849. icon: 'none',
  850. title: '正在盘点,不能取消周转',
  851. duration: 2000
  852. })
  853. } else {
  854. turnoverDelete(data).then(res => {
  855. if (res.code == 200) {
  856. uni.showToast({
  857. icon: "success",
  858. title: "取消成功",
  859. duration: 2000
  860. })
  861. setTimeout(() => {
  862. init(store.planDetails.id);
  863. }, 1500);
  864. } else {
  865. uni.showToast({
  866. icon: "none",
  867. title: "取消失败",
  868. duration: 2000
  869. })
  870. setTimeout(() => {
  871. init(store.planDetails.id);
  872. }, 1000);
  873. }
  874. })
  875. }
  876. })
  877. }
  878. </script>
  879. <style lang="scss">
  880. $nav-height: 60rpx;
  881. .box-bg {
  882. width: 94%;
  883. background-color: #F5F5F5;
  884. padding: 5rpx 16rpx;
  885. justify-content: space-around;
  886. align-items: center;
  887. margin: 24rpx auto 0;
  888. .input-view {
  889. width: 100%;
  890. flex: 4;
  891. background-color: #f8f8f8;
  892. height: $nav-height;
  893. border: 1rpx solid #999;
  894. border-radius: 15rpx;
  895. padding: 0 15rpx;
  896. flex-wrap: nowrap;
  897. margin: 0 10rpx 0;
  898. line-height: $nav-height;
  899. .input-uni-icon {
  900. line-height: $nav-height;
  901. }
  902. .nav-bar-input {
  903. width: 80%;
  904. height: $nav-height;
  905. line-height: $nav-height;
  906. padding: 0 5rpx;
  907. background-color: #f8f8f8;
  908. }
  909. }
  910. .search {
  911. width: 20%;
  912. text-align: center;
  913. color: #808080;
  914. }
  915. }
  916. .list-title {
  917. width: 100%;
  918. margin-top: 16rpx;
  919. height: 64rpx;
  920. line-height: 64rpx;
  921. align-items: center;
  922. margin-left: 32rpx;
  923. .label {
  924. font-size: 32rpx;
  925. margin-right: 24rpx;
  926. }
  927. .icon-gear {
  928. font-size: 56rpx;
  929. }
  930. }
  931. .switch {
  932. margin-top: -8rpx;
  933. transform: scale(0.7);
  934. }
  935. .scroll-container {
  936. width: 92%;
  937. margin: 24rpx auto 0 auto;
  938. height: calc(90% - 100rpx);
  939. overflow: auto;
  940. }
  941. .list-item {
  942. background-color: #fff;
  943. position: relative;
  944. padding: 16rpx;
  945. padding-bottom: 24rpx;
  946. margin-bottom: 24rpx;
  947. border-radius: 24rpx;
  948. .title-container {
  949. margin-top: 8rpx;
  950. margin-bottom: 16rpx;
  951. .title {
  952. height: 48rpx;
  953. align-items: center;
  954. .label {
  955. font-size: 32rpx;
  956. font-weight: bold;
  957. &.code {
  958. margin-left: 8rpx;
  959. }
  960. }
  961. }
  962. .tag {
  963. border: 1px solid #1CE5B0;
  964. background-color: #F6FFFD;
  965. padding: 8rpx;
  966. border-radius: 8rpx;
  967. .label {
  968. color: #1CE5B0;
  969. font-size: 24rpx;
  970. }
  971. &.finished {
  972. border: 1px solid #BBBBBB;
  973. background-color: #F5F5F5;
  974. .label {
  975. color: #BBBBBB;
  976. }
  977. }
  978. &.turnover {
  979. border: 1px solid #FF7901;
  980. background-color: #F6FFFD;
  981. .label {
  982. color: #FF7901;
  983. }
  984. }
  985. }
  986. }
  987. .item-info {
  988. margin-bottom: 8rpx;
  989. .label {
  990. font-size: 28rpx;
  991. width: 220rpx;
  992. color: #808080;
  993. &.right {
  994. flex: 1;
  995. color: #000000;
  996. }
  997. }
  998. }
  999. .status-btn {
  1000. justify-content: flex-end;
  1001. align-items: center;
  1002. .turnover-tag {
  1003. padding-right: 12rpx;
  1004. padding-left: 12rpx;
  1005. border-radius: 8rpx;
  1006. border: 1rpx solid #FF7901;
  1007. background-color: #FF7901;
  1008. font-size: 28rpx;
  1009. color: #FFFFFF;
  1010. }
  1011. .reporting-tag {
  1012. padding-right: 12rpx;
  1013. padding-left: 12rpx;
  1014. border-radius: 8rpx;
  1015. margin-left: 16rpx;
  1016. border: 1rpx solid #1684fc;
  1017. background-color: #1684fc;
  1018. font-size: 28rpx;
  1019. color: #FFFFFF;
  1020. }
  1021. }
  1022. }
  1023. .bottom {
  1024. height: 10%;
  1025. position: fixed;
  1026. right: 0;
  1027. bottom: 0;
  1028. left: 0;
  1029. height: 100rpx;
  1030. border-top: 1px solid #999999;
  1031. padding: 16rpx 32rpx;
  1032. align-items: center;
  1033. background-color: #fff;
  1034. justify-content: space-evenly;
  1035. .start-batch-btn {
  1036. flex: 1;
  1037. height: 80rpx;
  1038. line-height: 80rpx;
  1039. border-radius: 8rpx;
  1040. color: #FFFFFF;
  1041. font-size: 28rpx;
  1042. }
  1043. }
  1044. </style>