index.vue 27 KB

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