index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  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 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. onLoad(() => {
  197. curPlan.value = store.planDetails;
  198. normalStatus.value = true;
  199. console.log(curPlan.value)
  200. //废品回用的领料部门如果是当前工段,也要可以开始新批次
  201. //查找当前计划单下的批次废品回用是当前工段
  202. getAbnormalityLot({
  203. productionPlanDetailId: store.planDetails.id,
  204. requisitionDepartmentId: store.curDeptDetails.deptId
  205. }).then(res => {
  206. wasteRecyclingList.value = res.rows
  207. console.log(wasteRecyclingList.value.length)
  208. if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId ||
  209. wasteRecyclingList.value.length > 0) {
  210. bottomStatus.value = true;
  211. store.isPreProcess = true;
  212. } else {
  213. bottomStatus.value = false;
  214. store.isPreProcess = false;
  215. }
  216. })
  217. console.log(wasteRecyclingList.value.length)
  218. })
  219. /**
  220. * 监听下拉刷新
  221. */
  222. onPullDownRefresh(() => {
  223. uni.stopPullDownRefresh();
  224. reflush();
  225. // normalStatus.value = true;
  226. // let reqData = {
  227. // productionPlanDetailId: store.planDetails.id,
  228. // deptId: store.curDeptDetails.deptId,
  229. // keywords: keywords.value
  230. // };
  231. // getDayWorkList(reqData).then(res => {
  232. // if (res.code == 200) {
  233. // tempList.value = res.data
  234. // if (normalStatus.value) {
  235. // listData.value = res.data.filter(item => {
  236. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  237. // });
  238. // } else {
  239. // listData.value = res.data.filter(item => {
  240. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  241. // })
  242. // }
  243. // for (let i = 0; i < listData.value.length; i++) {
  244. // if (listData.value[i].prevProcess) {
  245. // let sum = 0;
  246. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  247. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
  248. // .prevProcess
  249. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[
  250. // i]
  251. // .dayworkItemList[j].status == 3)) {
  252. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  253. // }
  254. // }
  255. // listData.value[i].processQualifiedNum = sum;
  256. // }
  257. // }
  258. // }
  259. // uni.stopPullDownRefresh();
  260. // })
  261. })
  262. onShow(() => {
  263. reflush();
  264. })
  265. function handleOpenDrawing(){
  266. console.log(currentDaywork.value,"444")
  267. var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork.value.currentProcess.processStepNumber);
  268. // 检查 filteredProcess 是否有元素,并选择第一个元素
  269. if (filteredProcess.length > 0) {
  270. var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
  271. // 对 technologicalProcessDetailId 进行URL编码
  272. var encodedId = encodeURIComponent(firstMatch.technologicalProcessDetailId);
  273. var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
  274. // 构建查询参数字符串
  275. var queryParam = `param1=${encodedId}&param2=${encodeCode}`;
  276. // 使用模板字符串构建完整的URL
  277. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  278. // 导航到指定页面
  279. uni.navigateTo({
  280. url: navigateUrl
  281. });
  282. } else {
  283. console.log('No process matched the current process step number.');
  284. }
  285. }
  286. function reflush() {
  287. // normalStatus.value = true;
  288. init(store.planDetails.id);
  289. }
  290. function handleShowTurnoverApplication(data) {
  291. let _data = data ?? {}
  292. carrierFinishedCheck(data).then(res => {
  293. if (res.code === 200) {
  294. // 调用子组件中的方法
  295. turnoverApplicationDialog.value.open(_data)
  296. } else {
  297. uni.showToast({
  298. icon: 'none',
  299. title: res.msg
  300. })
  301. }
  302. })
  303. // .catch(err => {
  304. // uri.showToast({
  305. // icon: "fail",
  306. // title: "网络请求失败。"
  307. // })
  308. // })
  309. }
  310. function handleStartNewBatch() {
  311. store.normalStatus = normalStatus.value;
  312. // console.log(normalStatus.value)
  313. uni.navigateTo({
  314. url: "/pages/addNewBatch/index"
  315. })
  316. }
  317. function init(id) {
  318. uni.showLoading({
  319. title: '加载中'
  320. });
  321. let reqData = {
  322. productionPlanDetailId: id,
  323. deptId: store.curDeptDetails.deptId,
  324. keywords: keywords.value
  325. };
  326. // normalStatus.value = true;
  327. getDayWorkList(reqData).then(res => {
  328. if (res.code == 200) {
  329. console.log(res)
  330. tempList.value = res.data
  331. if (normalStatus.value) {
  332. listData.value = res.data.filter(item => {
  333. return item.isWasteRecycling == 0 && item.isAmend == 0;
  334. });
  335. } else {
  336. listData.value = res.data.filter(item => {
  337. return item.isWasteRecycling == 1 || item.isAmend == 1;
  338. })
  339. }
  340. // listData.value = res.data.filter(item => {
  341. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  342. // });
  343. /* 0531 */
  344. // for (let i = 0; i < listData.value.length; i++) {
  345. // if (listData.value[i].prevProcess) {
  346. // let sum = 0;
  347. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  348. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
  349. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
  350. // .dayworkItemList[j].status == 3)) {
  351. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  352. // }
  353. // }
  354. // listData.value[i].processQualifiedNum = sum;
  355. // }
  356. // }
  357. }
  358. uni.hideLoading();
  359. })
  360. }
  361. function handleSearch() {
  362. init(store.planDetails.id);
  363. }
  364. function checkStatus(item) {
  365. if (item.dayworkItemList[0].status < 3) {
  366. return
  367. } else {
  368. handleToreportingForWork(item)
  369. }
  370. }
  371. function handleToreportingForWork(item) {
  372. // if (item.dayworkItemList[0].status == 0) {
  373. // return
  374. // }
  375. uni.$once("formBack", () => handleSearch())
  376. uni.navigateTo({
  377. url: "/pages/sorting/form",
  378. success: function(res) {
  379. // 通过eventChannel向被打开页面传送数据
  380. res.eventChannel.emit('acceptDataFromOpenerPage', {
  381. data: item
  382. })
  383. }
  384. })
  385. }
  386. function handleClickProcessList(item) {
  387. let curProcessAfterList = [];
  388. console.log(item)
  389. currentDaywork.value = item
  390. let nextIndex = 0;
  391. for (let i = 0; i < item.processSequence.length; i++) {
  392. if (item.nextProcess.id == item.processSequence[i].id) {
  393. nextIndex = i;
  394. }
  395. }
  396. for (let i = 0; i < item.processSequence.length; i++) {
  397. if (i >= nextIndex) {
  398. curProcessAfterList.push(item.processSequence[i]);
  399. }
  400. }
  401. if (item.status == 3) {
  402. curProcessAfterList.splice(0, 1)
  403. }
  404. console.log(curProcessAfterList)
  405. curProcessAfte.value = curProcessAfterList;
  406. showRight.value.open();
  407. }
  408. function handleSearchCode() {
  409. selectProduction.value.open(normalStatus.value);
  410. }
  411. // function switchChange(event) {
  412. // //异常批
  413. // if (event.detail.value) {
  414. // listData.value = tempList.value.filter(item => {
  415. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  416. // });
  417. // normalStatus.value = 1
  418. // } else {
  419. // listData.value = tempList.value.filter(item => {
  420. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  421. // });
  422. // normalStatus.value = 0
  423. // }
  424. // }
  425. /*
  426. function handleScanCode() {
  427. // 引入原生插件
  428. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  429. // const mpaasScanModule = null
  430. if (mpaasScanModule) {
  431. // 调用插件的 mpaasScan 方法
  432. mpaasScanModule.mpaasScan({
  433. // 扫码识别类型,参数可多选,qrCode、barCode,
  434. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  435. scanType: ["qrCode", "barCode"],
  436. // 是否隐藏相册,默认false不隐藏
  437. hideAlbum: false,
  438. },
  439. (ret) => {
  440. console.log(ret);
  441. let vehicleObj = JSON.parse(ret.resp_result);
  442. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  443. uni.showToast({
  444. icon: "none",
  445. title: "请扫载具码",
  446. duration: 1000
  447. })
  448. return;
  449. }
  450. showDaywork({
  451. carrierId: vehicleObj.carrierId,
  452. status: 7
  453. }).then(response => {
  454. if (response.code == 200) {
  455. // console.log(response)
  456. // console.log(response.data[0].productionPlanDetailId)
  457. // console.log(store.planDetails.id)
  458. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  459. uni.showToast({
  460. icon: 'none',
  461. title: '该批次不在当前工段',
  462. duration: 2000
  463. })
  464. return
  465. }
  466. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  467. // console.log(response.data)
  468. lotDialog.value.open(response.data);
  469. } else {
  470. uni.showToast({
  471. icon: 'none',
  472. title: '该批次不在此计划单内',
  473. duration: 2000
  474. })
  475. }
  476. } else {
  477. uni.showToast({
  478. icon: 'none',
  479. title: response.msg,
  480. duration: 2000
  481. })
  482. }
  483. })
  484. }
  485. );
  486. } else {
  487. // 测试时用
  488. showDaywork({
  489. carrierId: '1770342949090017283',
  490. status: 7
  491. }).then(response => {
  492. if (response.code == 200) {
  493. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  494. uni.showToast({
  495. icon: 'none',
  496. title: '该批次不在当前工段',
  497. duration: 2000
  498. })
  499. return
  500. }
  501. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  502. console.log(response.data)
  503. lotDialog.value.open(response.data);
  504. } else {
  505. uni.showToast({
  506. icon: 'none',
  507. title: '该批次不在此计划单内',
  508. duration: 2000
  509. })
  510. }
  511. } else {
  512. console.log(response)
  513. uni.showToast({
  514. icon: 'none',
  515. title: response.msg,
  516. duration: 2000
  517. })
  518. }
  519. })
  520. }
  521. }
  522. */
  523. function handleScanCode() {
  524. // 引入原生插件
  525. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  526. // const mpaasScanModule = null
  527. if (mpaasScanModule) {
  528. // 调用插件的 mpaasScan 方法
  529. mpaasScanModule.mpaasScan({
  530. // 扫码识别类型,参数可多选,qrCode、barCode,
  531. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  532. scanType: ["qrCode", "barCode"],
  533. // 是否隐藏相册,默认false不隐藏
  534. hideAlbum: false,
  535. },
  536. (ret) => {
  537. console.log(ret);
  538. let vehicleObj = {
  539. carrierCode: ret.resp_result
  540. };
  541. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  542. uni.showToast({
  543. icon: "none",
  544. title: "请扫载具码",
  545. duration: 1000
  546. })
  547. return;
  548. }
  549. showDaywork({
  550. carrierCode: vehicleObj.carrierCode,
  551. status: 7
  552. }).then(response => {
  553. if (response.code == 200) {
  554. // console.log(response)
  555. // console.log(response.data[0].productionPlanDetailId)
  556. // console.log(store.planDetails.id)
  557. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  558. uni.showToast({
  559. icon: 'none',
  560. title: '该批次不在当前工段',
  561. duration: 2000
  562. })
  563. return
  564. }
  565. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  566. // console.log(response.data)
  567. lotDialog.value.open(response.data);
  568. } else {
  569. uni.showToast({
  570. icon: 'none',
  571. title: '该批次不在此计划单内',
  572. duration: 2000
  573. })
  574. }
  575. } else {
  576. uni.showToast({
  577. icon: 'none',
  578. title: response.msg,
  579. duration: 2000
  580. })
  581. }
  582. })
  583. }
  584. );
  585. } else {
  586. // 测试时用
  587. showDaywork({
  588. carrierId: '1770342949090017283',
  589. status: 7
  590. }).then(response => {
  591. if (response.code == 200) {
  592. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  593. uni.showToast({
  594. icon: 'none',
  595. title: '该批次不在当前工段',
  596. duration: 2000
  597. })
  598. return
  599. }
  600. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  601. console.log(response.data)
  602. lotDialog.value.open(response.data);
  603. } else {
  604. uni.showToast({
  605. icon: 'none',
  606. title: '该批次不在此计划单内',
  607. duration: 2000
  608. })
  609. }
  610. } else {
  611. console.log(response)
  612. uni.showToast({
  613. icon: 'none',
  614. title: response.msg,
  615. duration: 2000
  616. })
  617. }
  618. })
  619. }
  620. }
  621. // function handleScanCode() {
  622. // uni.scanCode({
  623. // onlyFromCamera: true,
  624. // success: function (res) {
  625. // if (res.scanType !== 'QR_CODE') {
  626. // uni.showToast({
  627. // icon: 'none',
  628. // title: '二维码未识别成功',
  629. // duration: 2000
  630. // })
  631. // }
  632. // console.log('条码类型:' + res.scanType);
  633. // console.log('条码内容:' + res.result);
  634. // }
  635. // });
  636. // }
  637. function handleAddDaywork(data) {
  638. console.log(data)
  639. let reqParam = [];
  640. for (var i = 0; i < data.length; i++) {
  641. reqParam.push(data[i].daywork)
  642. }
  643. console.log(data)
  644. showDayworkSave(data).then(res => {
  645. console.log(res)
  646. init(store.planDetails.id);
  647. })
  648. }
  649. function handleDoIt(data) {
  650. handleAddDaywork(data);
  651. }
  652. function handleDoTurnoverAfter() {
  653. reflush();
  654. }
  655. function switchChange(event) {
  656. console.log(event)
  657. //异常批
  658. if (normalStatus.value) {
  659. listData.value = tempList.value.filter(item => {
  660. return item.isWasteRecycling == 1 || item.isAmend == 1;
  661. });
  662. normalStatus.value = false
  663. } else {
  664. listData.value = tempList.value.filter(item => {
  665. return item.isWasteRecycling == 0 && item.isAmend == 0;
  666. });
  667. normalStatus.value = true
  668. }
  669. console.log(listData.value)
  670. }
  671. function startReport(data) {
  672. getSortingDayworkItem(data).then(res => {
  673. uni.showToast({
  674. icon: "success",
  675. title: "开始成功",
  676. duration: 2000
  677. })
  678. init(store.planDetails.id)
  679. })
  680. }
  681. function handleCancelTurnover(data) {
  682. turnoverDelete(data).then(res => {
  683. if (res.code == 200) {
  684. uni.showToast({
  685. icon: "success",
  686. title: "取消成功",
  687. duration: 2000
  688. })
  689. init(store.planDetails.id);
  690. } else {
  691. uni.showToast({
  692. icon: "none",
  693. title: "取消失败",
  694. duration: 2000
  695. })
  696. }
  697. })
  698. }
  699. </script>
  700. <style lang="scss">
  701. $nav-height: 60rpx;
  702. .box-bg {
  703. width: 94%;
  704. background-color: #F5F5F5;
  705. padding: 5rpx 16rpx;
  706. justify-content: space-around;
  707. align-items: center;
  708. margin: 24rpx auto 0;
  709. .input-view {
  710. width: 100%;
  711. flex: 4;
  712. background-color: #f8f8f8;
  713. height: $nav-height;
  714. border: 1rpx solid #999;
  715. border-radius: 15rpx;
  716. padding: 0 15rpx;
  717. flex-wrap: nowrap;
  718. margin: 0 10rpx 0;
  719. line-height: $nav-height;
  720. .input-uni-icon {
  721. line-height: $nav-height;
  722. }
  723. .nav-bar-input {
  724. width: 80%;
  725. height: $nav-height;
  726. line-height: $nav-height;
  727. padding: 0 5rpx;
  728. background-color: #f8f8f8;
  729. }
  730. }
  731. .search {
  732. width: 20%;
  733. text-align: center;
  734. color: #808080;
  735. }
  736. }
  737. .list-title {
  738. width: 100%;
  739. margin-top: 16rpx;
  740. height: 64rpx;
  741. line-height: 64rpx;
  742. align-items: center;
  743. margin-left: 32rpx;
  744. .label {
  745. font-size: 32rpx;
  746. margin-right: 24rpx;
  747. }
  748. .icon-gear {
  749. font-size: 56rpx;
  750. }
  751. }
  752. .switch {
  753. margin-top: -8rpx;
  754. transform: scale(0.7);
  755. }
  756. .scroll-container {
  757. width: 92%;
  758. margin: 24rpx auto 0 auto;
  759. height: calc(90% - 100rpx);
  760. overflow: auto;
  761. }
  762. .list-item {
  763. background-color: #fff;
  764. position: relative;
  765. padding: 16rpx;
  766. padding-bottom: 24rpx;
  767. margin-bottom: 24rpx;
  768. border-radius: 24rpx;
  769. .title-container {
  770. margin-top: 8rpx;
  771. margin-bottom: 16rpx;
  772. .title {
  773. height: 48rpx;
  774. align-items: center;
  775. .label {
  776. font-size: 32rpx;
  777. font-weight: bold;
  778. &.code {
  779. margin-left: 8rpx;
  780. }
  781. }
  782. }
  783. .tag {
  784. border: 1px solid #1CE5B0;
  785. background-color: #F6FFFD;
  786. padding: 8rpx;
  787. border-radius: 8rpx;
  788. .label {
  789. color: #1CE5B0;
  790. font-size: 24rpx;
  791. }
  792. &.finished {
  793. border: 1px solid #BBBBBB;
  794. background-color: #F5F5F5;
  795. .label {
  796. color: #BBBBBB;
  797. }
  798. }
  799. &.turnover {
  800. border: 1px solid #FF7901;
  801. background-color: #F6FFFD;
  802. .label {
  803. color: #FF7901;
  804. }
  805. }
  806. }
  807. }
  808. .item-info {
  809. margin-bottom: 8rpx;
  810. .label {
  811. font-size: 28rpx;
  812. width: 220rpx;
  813. color: #808080;
  814. &.right {
  815. flex: 1;
  816. color: #000000;
  817. }
  818. }
  819. }
  820. .status-btn {
  821. justify-content: flex-end;
  822. align-items: center;
  823. .turnover-tag {
  824. padding-right: 12rpx;
  825. padding-left: 12rpx;
  826. border-radius: 8rpx;
  827. border: 1rpx solid #FF7901;
  828. background-color: #FF7901;
  829. font-size: 28rpx;
  830. color: #FFFFFF;
  831. }
  832. .reporting-tag {
  833. padding-right: 12rpx;
  834. padding-left: 12rpx;
  835. border-radius: 8rpx;
  836. margin-left: 16rpx;
  837. border: 1rpx solid #1684fc;
  838. background-color: #1684fc;
  839. font-size: 28rpx;
  840. color: #FFFFFF;
  841. }
  842. }
  843. }
  844. .bottom {
  845. height: 10%;
  846. position: fixed;
  847. right: 0;
  848. bottom: 0;
  849. left: 0;
  850. height: 100rpx;
  851. border-top: 1px solid #999999;
  852. padding: 16rpx 32rpx;
  853. align-items: center;
  854. background-color: #fff;
  855. justify-content: space-evenly;
  856. .start-batch-btn {
  857. flex: 1;
  858. height: 80rpx;
  859. line-height: 80rpx;
  860. border-radius: 8rpx;
  861. color: #FFFFFF;
  862. font-size: 28rpx;
  863. }
  864. }
  865. </style>