index.vue 24 KB

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