index.vue 26 KB

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