index.vue 25 KB

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