index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  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. console.log(item.nextProcess,"next")
  399. if(item.nextProcess){
  400. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  401. nextIndex = i;
  402. }
  403. }else{
  404. nextIndex = item.processSequence.length
  405. }
  406. }
  407. for (let i = 0; i < item.processSequence.length; i++) {
  408. if (i >= nextIndex) {
  409. curProcessAfterList.push(item.processSequence[i]);
  410. }
  411. }
  412. if (item.status == 3) {
  413. curProcessAfterList.splice(0, 1)
  414. }
  415. console.log(curProcessAfterList)
  416. curProcessAfte.value = curProcessAfterList;
  417. showRight.value.open();
  418. }
  419. function handleSearchCode() {
  420. selectProduction.value.open(normalStatus.value);
  421. }
  422. // function switchChange(event) {
  423. // //异常批
  424. // if (event.detail.value) {
  425. // listData.value = tempList.value.filter(item => {
  426. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  427. // });
  428. // normalStatus.value = 1
  429. // } else {
  430. // listData.value = tempList.value.filter(item => {
  431. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  432. // });
  433. // normalStatus.value = 0
  434. // }
  435. // }
  436. /*
  437. function handleScanCode() {
  438. // 引入原生插件
  439. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  440. // const mpaasScanModule = null
  441. if (mpaasScanModule) {
  442. // 调用插件的 mpaasScan 方法
  443. mpaasScanModule.mpaasScan({
  444. // 扫码识别类型,参数可多选,qrCode、barCode,
  445. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  446. scanType: ["qrCode", "barCode"],
  447. // 是否隐藏相册,默认false不隐藏
  448. hideAlbum: false,
  449. },
  450. (ret) => {
  451. console.log(ret);
  452. let vehicleObj = JSON.parse(ret.resp_result);
  453. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  454. uni.showToast({
  455. icon: "none",
  456. title: "请扫载具码",
  457. duration: 1000
  458. })
  459. return;
  460. }
  461. showDaywork({
  462. carrierId: vehicleObj.carrierId,
  463. status: 7
  464. }).then(response => {
  465. if (response.code == 200) {
  466. // console.log(response)
  467. // console.log(response.data[0].productionPlanDetailId)
  468. // console.log(store.planDetails.id)
  469. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  470. uni.showToast({
  471. icon: 'none',
  472. title: '该批次不在当前工段',
  473. duration: 2000
  474. })
  475. return
  476. }
  477. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  478. // console.log(response.data)
  479. lotDialog.value.open(response.data);
  480. } else {
  481. uni.showToast({
  482. icon: 'none',
  483. title: '该批次不在此计划单内',
  484. duration: 2000
  485. })
  486. }
  487. } else {
  488. uni.showToast({
  489. icon: 'none',
  490. title: response.msg,
  491. duration: 2000
  492. })
  493. }
  494. })
  495. }
  496. );
  497. } else {
  498. // 测试时用
  499. showDaywork({
  500. carrierId: '1770342949090017283',
  501. status: 7
  502. }).then(response => {
  503. if (response.code == 200) {
  504. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  505. uni.showToast({
  506. icon: 'none',
  507. title: '该批次不在当前工段',
  508. duration: 2000
  509. })
  510. return
  511. }
  512. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  513. console.log(response.data)
  514. lotDialog.value.open(response.data);
  515. } else {
  516. uni.showToast({
  517. icon: 'none',
  518. title: '该批次不在此计划单内',
  519. duration: 2000
  520. })
  521. }
  522. } else {
  523. console.log(response)
  524. uni.showToast({
  525. icon: 'none',
  526. title: response.msg,
  527. duration: 2000
  528. })
  529. }
  530. })
  531. }
  532. }
  533. */
  534. function handleScanCode() {
  535. // 引入原生插件
  536. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  537. // const mpaasScanModule = null
  538. if (mpaasScanModule) {
  539. // 调用插件的 mpaasScan 方法
  540. mpaasScanModule.mpaasScan({
  541. // 扫码识别类型,参数可多选,qrCode、barCode,
  542. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  543. scanType: ["qrCode", "barCode"],
  544. // 是否隐藏相册,默认false不隐藏
  545. hideAlbum: false,
  546. },
  547. (ret) => {
  548. console.log(ret);
  549. let vehicleObj = {
  550. carrierCode: ret.resp_result
  551. };
  552. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  553. uni.showToast({
  554. icon: "none",
  555. title: "请扫载具码",
  556. duration: 1000
  557. })
  558. return;
  559. }
  560. showDaywork({
  561. carrierCode: vehicleObj.carrierCode,
  562. status: 7
  563. }).then(response => {
  564. if (response.code == 200) {
  565. // console.log(response)
  566. // console.log(response.data[0].productionPlanDetailId)
  567. // console.log(store.planDetails.id)
  568. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  569. uni.showToast({
  570. icon: 'none',
  571. title: '该批次不在当前工段',
  572. duration: 2000
  573. })
  574. return
  575. }
  576. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  577. // console.log(response.data)
  578. lotDialog.value.open(response.data);
  579. } else {
  580. uni.showToast({
  581. icon: 'none',
  582. title: '该批次不在此计划单内',
  583. duration: 2000
  584. })
  585. }
  586. } else {
  587. uni.showToast({
  588. icon: 'none',
  589. title: response.msg,
  590. duration: 2000
  591. })
  592. }
  593. })
  594. }
  595. );
  596. } else {
  597. // 测试时用
  598. showDaywork({
  599. carrierId: '1770342949090017283',
  600. status: 7
  601. }).then(response => {
  602. if (response.code == 200) {
  603. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  604. uni.showToast({
  605. icon: 'none',
  606. title: '该批次不在当前工段',
  607. duration: 2000
  608. })
  609. return
  610. }
  611. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  612. console.log(response.data)
  613. lotDialog.value.open(response.data);
  614. } else {
  615. uni.showToast({
  616. icon: 'none',
  617. title: '该批次不在此计划单内',
  618. duration: 2000
  619. })
  620. }
  621. } else {
  622. console.log(response)
  623. uni.showToast({
  624. icon: 'none',
  625. title: response.msg,
  626. duration: 2000
  627. })
  628. }
  629. })
  630. }
  631. }
  632. // function handleScanCode() {
  633. // uni.scanCode({
  634. // onlyFromCamera: true,
  635. // success: function (res) {
  636. // if (res.scanType !== 'QR_CODE') {
  637. // uni.showToast({
  638. // icon: 'none',
  639. // title: '二维码未识别成功',
  640. // duration: 2000
  641. // })
  642. // }
  643. // console.log('条码类型:' + res.scanType);
  644. // console.log('条码内容:' + res.result);
  645. // }
  646. // });
  647. // }
  648. function handleAddDaywork(data) {
  649. console.log(data)
  650. let reqParam = [];
  651. for (var i = 0; i < data.length; i++) {
  652. reqParam.push(data[i].daywork)
  653. }
  654. console.log(data)
  655. showDayworkSave(data).then(res => {
  656. console.log(res)
  657. init(store.planDetails.id);
  658. })
  659. }
  660. function handleDoIt(data) {
  661. handleAddDaywork(data);
  662. }
  663. function handleDoTurnoverAfter() {
  664. reflush();
  665. }
  666. function switchChange(event) {
  667. console.log(event)
  668. //异常批
  669. if (normalStatus.value) {
  670. listData.value = tempList.value.filter(item => {
  671. return item.isWasteRecycling == 1 || item.isAmend == 1;
  672. });
  673. normalStatus.value = false
  674. } else {
  675. listData.value = tempList.value.filter(item => {
  676. return item.isWasteRecycling == 0 && item.isAmend == 0;
  677. });
  678. normalStatus.value = true
  679. }
  680. console.log(listData.value)
  681. }
  682. function startReport(data) {
  683. getSortingDayworkItem(data).then(res => {
  684. uni.showToast({
  685. icon: "success",
  686. title: "开始成功",
  687. duration: 2000
  688. })
  689. init(store.planDetails.id)
  690. })
  691. }
  692. function handleCancelTurnover(data) {
  693. turnoverDelete(data).then(res => {
  694. if (res.code == 200) {
  695. uni.showToast({
  696. icon: "success",
  697. title: "取消成功",
  698. duration: 2000
  699. })
  700. init(store.planDetails.id);
  701. } else {
  702. uni.showToast({
  703. icon: "none",
  704. title: "取消失败",
  705. duration: 2000
  706. })
  707. }
  708. })
  709. }
  710. </script>
  711. <style lang="scss">
  712. $nav-height: 60rpx;
  713. .box-bg {
  714. width: 94%;
  715. background-color: #F5F5F5;
  716. padding: 5rpx 16rpx;
  717. justify-content: space-around;
  718. align-items: center;
  719. margin: 24rpx auto 0;
  720. .input-view {
  721. width: 100%;
  722. flex: 4;
  723. background-color: #f8f8f8;
  724. height: $nav-height;
  725. border: 1rpx solid #999;
  726. border-radius: 15rpx;
  727. padding: 0 15rpx;
  728. flex-wrap: nowrap;
  729. margin: 0 10rpx 0;
  730. line-height: $nav-height;
  731. .input-uni-icon {
  732. line-height: $nav-height;
  733. }
  734. .nav-bar-input {
  735. width: 80%;
  736. height: $nav-height;
  737. line-height: $nav-height;
  738. padding: 0 5rpx;
  739. background-color: #f8f8f8;
  740. }
  741. }
  742. .search {
  743. width: 20%;
  744. text-align: center;
  745. color: #808080;
  746. }
  747. }
  748. .list-title {
  749. width: 100%;
  750. margin-top: 16rpx;
  751. height: 64rpx;
  752. line-height: 64rpx;
  753. align-items: center;
  754. margin-left: 32rpx;
  755. .label {
  756. font-size: 32rpx;
  757. margin-right: 24rpx;
  758. }
  759. .icon-gear {
  760. font-size: 56rpx;
  761. }
  762. }
  763. .switch {
  764. margin-top: -8rpx;
  765. transform: scale(0.7);
  766. }
  767. .scroll-container {
  768. width: 92%;
  769. margin: 24rpx auto 0 auto;
  770. height: calc(90% - 100rpx);
  771. overflow: auto;
  772. }
  773. .list-item {
  774. background-color: #fff;
  775. position: relative;
  776. padding: 16rpx;
  777. padding-bottom: 24rpx;
  778. margin-bottom: 24rpx;
  779. border-radius: 24rpx;
  780. .title-container {
  781. margin-top: 8rpx;
  782. margin-bottom: 16rpx;
  783. .title {
  784. height: 48rpx;
  785. align-items: center;
  786. .label {
  787. font-size: 32rpx;
  788. font-weight: bold;
  789. &.code {
  790. margin-left: 8rpx;
  791. }
  792. }
  793. }
  794. .tag {
  795. border: 1px solid #1CE5B0;
  796. background-color: #F6FFFD;
  797. padding: 8rpx;
  798. border-radius: 8rpx;
  799. .label {
  800. color: #1CE5B0;
  801. font-size: 24rpx;
  802. }
  803. &.finished {
  804. border: 1px solid #BBBBBB;
  805. background-color: #F5F5F5;
  806. .label {
  807. color: #BBBBBB;
  808. }
  809. }
  810. &.turnover {
  811. border: 1px solid #FF7901;
  812. background-color: #F6FFFD;
  813. .label {
  814. color: #FF7901;
  815. }
  816. }
  817. }
  818. }
  819. .item-info {
  820. margin-bottom: 8rpx;
  821. .label {
  822. font-size: 28rpx;
  823. width: 220rpx;
  824. color: #808080;
  825. &.right {
  826. flex: 1;
  827. color: #000000;
  828. }
  829. }
  830. }
  831. .status-btn {
  832. justify-content: flex-end;
  833. align-items: center;
  834. .turnover-tag {
  835. padding-right: 12rpx;
  836. padding-left: 12rpx;
  837. border-radius: 8rpx;
  838. border: 1rpx solid #FF7901;
  839. background-color: #FF7901;
  840. font-size: 28rpx;
  841. color: #FFFFFF;
  842. }
  843. .reporting-tag {
  844. padding-right: 12rpx;
  845. padding-left: 12rpx;
  846. border-radius: 8rpx;
  847. margin-left: 16rpx;
  848. border: 1rpx solid #1684fc;
  849. background-color: #1684fc;
  850. font-size: 28rpx;
  851. color: #FFFFFF;
  852. }
  853. }
  854. }
  855. .bottom {
  856. height: 10%;
  857. position: fixed;
  858. right: 0;
  859. bottom: 0;
  860. left: 0;
  861. height: 100rpx;
  862. border-top: 1px solid #999999;
  863. padding: 16rpx 32rpx;
  864. align-items: center;
  865. background-color: #fff;
  866. justify-content: space-evenly;
  867. .start-batch-btn {
  868. flex: 1;
  869. height: 80rpx;
  870. line-height: 80rpx;
  871. border-radius: 8rpx;
  872. color: #FFFFFF;
  873. font-size: 28rpx;
  874. }
  875. }
  876. </style>