index.vue 25 KB

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