index.vue 24 KB

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