dialog-end-work.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. <template>
  2. <view class="mask" v-if="isLoading"></view>
  3. <dialog-base ref="baseDialog" title="结束报工">
  4. <view class="list-container">
  5. <view class="list-title uni-row">
  6. <text class="label">合格量</text>
  7. <input class="input" @input="handleInputQualifiedNum" style="width: 70%;"
  8. v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
  9. </view>
  10. <view class="list-title uni-row">
  11. <text class="label">废品信息</text>
  12. <view class="uni-row" style="justify-content: flex-end;"><text class="label" style="color: blue;"
  13. @click="handleAddWasteInfo">+添加</text></view>
  14. </view>
  15. <view class="list-title uni-row" v-for="(item, index) in wasteInfo">
  16. <input class="input" @input="handleInputRejectNum(item)" style="width: 20%;" v-model="item.rejectNum"
  17. placeholder="废品量" />
  18. <uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="item.reason" :localdata="reasonList"
  19. @change="handleReasonChange(item)"></uni-data-select>
  20. <uni-icons class="icon-gear" type="close" size="40" color="red"
  21. @click="handleDeleteWasteInfo(index)"></uni-icons>
  22. </view>
  23. <view class="list-title uni-row">
  24. <text class="label">当前序是否完成</text><text>否</text>
  25. <switch class="switch" @change="switchChange" color="rgba(103, 195, 55, 1.0)" />
  26. <text>是</text>
  27. </view>
  28. <view class="list-title uni-row" v-if="workInfo.status == 3">
  29. <text class="label">废品损失率</text>
  30. <view class="uni-row" style="justify-content: flex-end;"><text class="label">{{rejectRatio}}</text>
  31. </view>
  32. </view>
  33. <view v-if="showCarrierList && !store.isPreProcess" class="confirmCarrier">
  34. <text class="label">确认载具</text>
  35. <view class="vehicleList uni-row">
  36. <view v-for="(item,index) in bindList" :key="index"
  37. :class="{ 'vehicleNo': true, 'uni-row': true, 'blueBorder': item.flag }">
  38. <text>{{item.carrierCode}}</text>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="store.isPreProcess" class="add-btn-container uni-row">
  44. <button type="default" class="btn" @click="handlePreFinishReporting">结束报工</button>
  45. </view>
  46. <view v-if="!store.isPreProcess" class="add-btn-container uni-row">
  47. <button v-if="showCarrierList" type="primary" class="btnScan" @click="handleScanCode">扫码确认载具</button>
  48. <button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
  49. </view>
  50. </dialog-base>
  51. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  52. </template>
  53. <script setup>
  54. import {
  55. ref,
  56. getCurrentInstance
  57. } from 'vue'
  58. import QrScanner from '@/pages/vueQrCode/index.vue'
  59. import {
  60. onLoad
  61. } from '@dcloudio/uni-app'
  62. import {
  63. updateDayWorkItem,
  64. saveDayWorkItem
  65. } from "@/api/business/dayWorkItem.js"
  66. import {
  67. getDayworkCarrierList
  68. } from '@/api/business/dayworkCarrier.js'
  69. import {
  70. store
  71. } from '@/store/index.js'
  72. import {
  73. timestampToTime,
  74. toHHmmss
  75. } from '@/utils/common.js'
  76. import {
  77. getDictInfoByType
  78. } from '@/api/dict/dict.js'
  79. import {
  80. getSpecialDeptProcessList
  81. } from '@/api/business/deptProcess.js'
  82. import {
  83. debounce
  84. } from '@/utils/common.js'
  85. import {
  86. getDayWorkItemList,
  87. listItem,
  88. getIsFirstOrder,
  89. } from '@/api/business/dayWorkItem.js'
  90. import {
  91. Decimal
  92. } from 'decimal.js'
  93. const baseDialog = ref(null)
  94. const workInfo = ref({})
  95. const showQrCodeReader = ref(false);
  96. const wasteInfo = ref([])
  97. const qualifiedNumRatio = ref(1)
  98. const reasonList = ref([])
  99. const emit = defineEmits(['resflushItem'])
  100. const showCarrierList = ref(false) // 工序是否完成显示载具列表
  101. const bindList = ref([])
  102. const confirmCarrierList = ref([])
  103. const isFirstOrder = ref(true); //是否为首序
  104. const endFlag = ref(0)
  105. const rejectRatio = ref(0)
  106. const isLoading = ref(false);
  107. const specialDeptProcessList = ref([])
  108. const temp = ref(0) // 保存workInfo.value.qualifiedNum的值(还原用)
  109. const lotPreSumReject = ref(0)
  110. const lotPreSumQualifiedNum = ref(0)
  111. const remainingQualifiedNum = ref(0) // 当前的合格量还能最大添加多少(剩余数量)
  112. onLoad(() => {})
  113. function open(data, itemListData) {
  114. console.log(store.isPreProcess)
  115. console.log("777")
  116. resetPage();
  117. workInfo.value = {
  118. ...data,
  119. };
  120. console.log("数据data", workInfo);
  121. //获取报工数量限制
  122. getReportLimit()
  123. //查看是否为首序
  124. getIsFirst(store.dayworkInfo.id);
  125. workInfo.value.qualifiedNum = 0;
  126. Promise.all([getSpecialDeptProcessList(), listItem({
  127. dayworkId: store.dayworkInfo.id,
  128. status: 2
  129. }), ], )
  130. .then(([res, response]) => {
  131. if (res.code == 200 && response.code == 200) {
  132. for (let i = 0; i < res.data.length; i++) {
  133. specialDeptProcessList.value[i] = res.data[i].processId;
  134. }
  135. for (let i = 0; i < response.rows.length; i++) {
  136. if (response.rows[i].processStepNumber == workInfo.value.processStepNumber) {
  137. lotPreSumReject.value += response.rows[i].rejectSum;
  138. lotPreSumQualifiedNum.value += response.rows[i].qualifiedNum;
  139. }
  140. }
  141. }
  142. if (specialDeptProcessList.value.includes(workInfo.value.processId)) {
  143. workInfo.value.qualifiedNum = store.dayworkInfo.prevProcess != null ?
  144. Math.max(0, store.dayworkInfo.processQualifiedNum - lotPreSumQualifiedNum.value -
  145. lotPreSumReject.value) :
  146. Math.max(0, store.dayworkInfo.productionQuantity - lotPreSumQualifiedNum.value -
  147. lotPreSumReject
  148. .value);
  149. // temp.value = workInfo.value.qualifiedNum;
  150. } else {
  151. workInfo.value.qualifiedNum = 0;
  152. }
  153. }).catch(err => {
  154. console.log('146 err')
  155. });
  156. init();
  157. baseDialog.value.open()
  158. }
  159. function getReportLimit() {
  160. getDictInfoByType("report_up_limit").then(res => {
  161. if (res.data && res.data.length > 0) {
  162. qualifiedNumRatio.value = parseInt(res.data[0].dictValue)
  163. }
  164. }).catch(err => {
  165. console.log(err)
  166. console.log('369 err')
  167. })
  168. }
  169. function close() {
  170. baseDialog.value.close()
  171. }
  172. function getIsFirst(dayworkId) {
  173. getIsFirstOrder(dayworkId).then(res => {
  174. if (res.code == 200) {
  175. isFirstOrder.value = res.data.isFirstOrder;
  176. }
  177. }).catch(err => {
  178. console.log(err)
  179. })
  180. }
  181. function resetPage() {
  182. workInfo.value.qualifiedNum = null;
  183. workInfo.value = {};
  184. wasteInfo.value = [];
  185. reasonList.value = [];
  186. showCarrierList.value = false;
  187. bindList.value = [];
  188. confirmCarrierList.value = [];
  189. endFlag.value = 0;
  190. lotPreSumReject.value = 0;
  191. lotPreSumQualifiedNum.value = 0;
  192. remainingQualifiedNum.value = 0;
  193. }
  194. function init() {
  195. getDictInfoByType("waste_causes").then(res => {
  196. for (let i = 0; i < res.data.length; i++) {
  197. reasonList.value[i] = {
  198. value: res.data[i].dictValue,
  199. text: res.data[i].dictLabel
  200. }
  201. }
  202. }).catch(err => {
  203. console.log('189 err')
  204. })
  205. getDayworkCarrierList({
  206. dayworkId: store.dayworkInfo.id,
  207. isChanged: 0,
  208. processInspectionId: 0
  209. }).then(res => {
  210. console.log(res)
  211. if (res.code == 200) {
  212. bindList.value = res.rows;
  213. for (let i = 0; i < bindList.value.length; i++) {
  214. bindList.value[i].flag = false;
  215. }
  216. }
  217. }).catch(err => {
  218. console.log('203 err')
  219. })
  220. }
  221. function switchChange(event) {
  222. if (event.detail.value) {
  223. workInfo.value.status = "3"
  224. } else {
  225. workInfo.value.status = "2"
  226. }
  227. console.log(event.detail.value, !store.isPreProcess)
  228. showCarrierList.value = event.detail.value;
  229. }
  230. function handleInputQualifiedNum() {
  231. workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^-+|[^\d]/g, '');
  232. let temQualifiedNum = workInfo.value.qualifiedNum
  233. if (workInfo.value.qualifiedNum === null || workInfo.value.qualifiedNum === '') {
  234. temQualifiedNum = 0
  235. }
  236. //计算损失率
  237. let sunm = parseInt(temQualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
  238. rejectRatio.value = (((parseInt(workInfo.value.prodNum) - sunm) / parseInt(workInfo.value.prodNum)) *
  239. 100).toFixed(2) + '%';
  240. console.log(((parseInt(temQualifiedNum) - sunm) / parseInt(temQualifiedNum)) *
  241. 100)
  242. }
  243. function handleInputRejectNum(item) {
  244. item.rejectNum = item.rejectNum.replace(/^0+|^-|[^\d]/g, '');
  245. // 合格数随着投产数
  246. //let sumRejectNum = 0;
  247. // for (let i = 0; i < wasteInfo.value.length; i++) {
  248. // wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^0+|^-|[^\d]/g, '');
  249. // // sumRejectNum += Number(wasteInfo.value[i].rejectNum);
  250. // }
  251. // if (temp.value > 0) {
  252. // debounce(function() {
  253. // workInfo.value.qualifiedNum = temp.value;
  254. // workInfo.value.qualifiedNum -= sumRejectNum;
  255. // }, 500)
  256. // }
  257. }
  258. /*
  259. function handleScanCode() {
  260. // 引入原生插件
  261. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  262. if (mpaasScanModule) {
  263. //调用插件的 mpaasScan 方法
  264. mpaasScanModule.mpaasScan({
  265. // 扫码识别类型,参数可多选,qrCode、barCode,
  266. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  267. scanType: ["qrCode", "barCode"],
  268. // 是否隐藏相册,默认false不隐藏
  269. hideAlbum: false,
  270. },
  271. (ret) => {
  272. let vehicleObj = JSON.parse(ret.resp_result);
  273. let hasInFlag = false
  274. for (let i = 0; i < bindList.value.length; i++) {
  275. if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
  276. hasInFlag = true
  277. if (!bindList.value[i].flag) {
  278. endFlag.value += 1;
  279. }
  280. bindList.value[i].flag = true;
  281. }
  282. }
  283. if(!hasInFlag) {
  284. uni.showToast({
  285. icon: 'none',
  286. title: '该批次没有绑定此箱',
  287. duration: 2000
  288. })
  289. }
  290. if (endFlag.value < bindList.value.length && hasInFlag) {
  291. setTimeout(() => {
  292. handleScanCode();
  293. }, 700);
  294. }
  295. }
  296. );
  297. }
  298. }
  299. */
  300. function handleScanCode() {
  301. // 引入原生插件
  302. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  303. // if (mpaasScanModule) {
  304. // //调用插件的 mpaasScan 方法
  305. // mpaasScanModule.mpaasScan({
  306. // // 扫码识别类型,参数可多选,qrCode、barCode,
  307. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  308. // scanType: ["qrCode", "barCode"],
  309. // // 是否隐藏相册,默认false不隐藏
  310. // hideAlbum: false,
  311. // },
  312. // (ret) => {
  313. // let vehicleObj = {
  314. // carrierCode: ret.resp_result
  315. // };
  316. // let hasInFlag = false
  317. // for (let i = 0; i < bindList.value.length; i++) {
  318. // if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
  319. // hasInFlag = true
  320. // if (!bindList.value[i].flag) {
  321. // endFlag.value += 1;
  322. // }
  323. // bindList.value[i].flag = true;
  324. // }
  325. // }
  326. // if (!hasInFlag) {
  327. // uni.showToast({
  328. // icon: 'none',
  329. // title: '该批次没有绑定此箱',
  330. // duration: 2000
  331. // })
  332. // }
  333. // if (endFlag.value < bindList.value.length && hasInFlag) {
  334. // setTimeout(() => {
  335. // handleScanCode();
  336. // }, 700);
  337. // }
  338. // }
  339. // );
  340. // } else {
  341. // let vehicleObj = {
  342. // carrierCode: bindList.value[0].carrierCode
  343. // };
  344. // let hasInFlag = false
  345. // for (let i = 0; i < bindList.value.length; i++) {
  346. // if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
  347. // hasInFlag = true
  348. // if (!bindList.value[i].flag) {
  349. // endFlag.value += 1;
  350. // }
  351. // bindList.value[i].flag = true;
  352. // }
  353. // }
  354. // if (!hasInFlag) {
  355. // uni.showToast({
  356. // icon: 'none',
  357. // title: '该批次没有绑定此箱',
  358. // duration: 2000
  359. // })
  360. // }
  361. // if (endFlag.value < bindList.value.length && hasInFlag) {
  362. // setTimeout(() => {
  363. // handleScanCode();
  364. // }, 700);
  365. // }
  366. // }
  367. showQrCodeReader.value = true;
  368. }
  369. function qrReaderClose() {
  370. showQrCodeReader.value = false;
  371. }
  372. function onDecodeHandler(ret) {
  373. showQrCodeReader.value = false;
  374. let vehicleObj = {
  375. carrierCode: ret
  376. };
  377. let hasInFlag = false
  378. for (let i = 0; i < bindList.value.length; i++) {
  379. if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
  380. hasInFlag = true
  381. if (!bindList.value[i].flag) {
  382. endFlag.value += 1;
  383. }
  384. bindList.value[i].flag = true;
  385. }
  386. }
  387. if (!hasInFlag) {
  388. uni.showToast({
  389. icon: 'none',
  390. title: '该批次没有绑定此箱',
  391. duration: 2000
  392. })
  393. }
  394. if (endFlag.value < bindList.value.length && hasInFlag) {
  395. setTimeout(() => {
  396. handleScanCode();
  397. }, 700);
  398. }
  399. }
  400. function handlePreFinishReporting() {
  401. //投产数
  402. let number = store.dayworkInfo.prevProcess == null ? store.dayworkInfo.productionQuantity : store.dayworkInfo
  403. .processQualifiedNum;
  404. workInfo.value.prodNum = number
  405. let max = parseInt(number * (qualifiedNumRatio.value / 100));
  406. let sunm = parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
  407. let percent = new Decimal(sunm).div(number).mul(100); // 使用 Decimal.js 计算
  408. // 保留两位小数
  409. percent = percent.toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
  410. console.log("合格量", percent)
  411. // let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
  412. let num = qualifiedNumRatio.value;
  413. // 填入数大于剩余量情况
  414. if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
  415. // 判断当前是否为首序
  416. if (isFirstOrder.value) {
  417. uni.showModal({
  418. title: '提示',
  419. content: `合格数总量超出投入量${percent}%,是否继续保存?`,
  420. success: function(res) {
  421. if (res.confirm) {
  422. handleSave();
  423. } else if (res.cancel) {}
  424. }
  425. })
  426. } else {
  427. if (percent > num) {
  428. console.log("999")
  429. uni.showToast({
  430. icon: 'none',
  431. title: '合格数总量为投产量的' + percent + "%,请重新输入!"
  432. })
  433. return;
  434. } else {
  435. handleSave();
  436. }
  437. }
  438. } else {
  439. //判断当前序合格总数为0 ,不允许保存
  440. console.log(parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0)
  441. if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
  442. uni.showToast({
  443. icon: 'none',
  444. title: '当前序合格总数不能为0',
  445. duration: 2000
  446. })
  447. } else {
  448. handleSave();
  449. }
  450. }
  451. }
  452. function handleFinishReporting() {
  453. console.log(store.isPreProcess)
  454. //投产数
  455. let number = workInfo.value.prodNum;
  456. let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(
  457. 2);
  458. let num = qualifiedNumRatio.value;
  459. //lotPreSumQualifiedNum当前序的所有合格数
  460. if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
  461. if (isFirstOrder.value) {
  462. if (percent == qualifiedNumRatio.value) {
  463. percent = qualifiedNumRatio.value
  464. }
  465. uni.showModal({
  466. title: '提示',
  467. content: `合格数总量超出投入量${percent}%,是否继续保存?`,
  468. success: function(res) {
  469. if (res.confirm) {
  470. if (showCarrierList.value) {
  471. if (endFlag.value >= bindList.value.length) {
  472. handleSave();
  473. } else {
  474. uni.showToast({
  475. icon: "none",
  476. title: "请先扫码确认载具",
  477. duration: 2000
  478. })
  479. return;
  480. }
  481. } else {
  482. handleSave();
  483. }
  484. } else if (res.cancel) {}
  485. }
  486. })
  487. } else {
  488. if (percent == num) {
  489. percent = qualifiedNumRatio.value
  490. }
  491. if (percent > num) {
  492. console.log("888")
  493. uni.showToast({
  494. icon: 'none',
  495. title: '合格数总量为投产量的' + percent + "%,请重新输入!"
  496. })
  497. return;
  498. } else {
  499. handleSave();
  500. }
  501. }
  502. } else {
  503. //判断当前序合格总数为0 ,不允许保存
  504. if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
  505. uni.showToast({
  506. icon: 'none',
  507. title: '当前序合格总数不能为0'
  508. })
  509. return;
  510. }
  511. if (showCarrierList.value) {
  512. if (endFlag.value >= bindList.value.length) {
  513. handleSave();
  514. } else {
  515. uni.showToast({
  516. icon: "none",
  517. title: "请先扫码确认载具",
  518. duration: 2000
  519. })
  520. return;
  521. }
  522. } else {
  523. handleSave();
  524. }
  525. }
  526. }
  527. function handleSave() {
  528. console.log(workInfo.value.qualifiedNum)
  529. if (workInfo.value.qualifiedNum === null || workInfo.value.qualifiedNum === '') {
  530. uni.showToast({
  531. icon: "none",
  532. title: "请输入合格数",
  533. duration: 2000
  534. })
  535. return;
  536. }
  537. let rejectSum = 0
  538. console.log(rejectSum);
  539. for (let i = 0; i < wasteInfo.value.length; i++) {
  540. if ((!wasteInfo.value[i].rejectNum && wasteInfo.value[i].reason) ||
  541. (wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason) ||
  542. (!wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason)) {
  543. uni.showToast({
  544. icon: 'none',
  545. title: "请输入废弃数或废弃原因",
  546. duration: 2000
  547. })
  548. return;
  549. }
  550. rejectSum += Number(wasteInfo.value[i].rejectNum);
  551. }
  552. if (rejectSum > workInfo.value.prodNum) {
  553. uni.showToast({
  554. icon: 'none',
  555. title: '废品数不能大于投产数',
  556. duration: 2000
  557. })
  558. return;
  559. }
  560. if (workInfo.value.status != '3') {
  561. workInfo.value.status = '2';
  562. }
  563. isLoading.value = true; // 显示遮罩层
  564. workInfo.value.endTime = timestampToTime(new Date());
  565. uni.showLoading({
  566. title: '加载中'
  567. });
  568. workInfo.value.rejectList = wasteInfo.value;
  569. workInfo.value.isPreProcess = store.isPreProcess;
  570. workInfo.value.processStepNumber = store.dayworkInfo.currentProcess.processStepNumber
  571. saveDayWorkItem(workInfo.value).then(res => {
  572. isLoading.value = false; // 隐藏遮罩层
  573. uni.hideLoading();
  574. if (res.code === 200) {
  575. uni.showToast({
  576. icon: 'success',
  577. title: '操作成功',
  578. });
  579. emit('resflushItem');
  580. close();
  581. } else {
  582. uni.showToast({
  583. icon: 'none',
  584. title: res.msg
  585. });
  586. }
  587. })
  588. }
  589. function handleAddWasteInfo() {
  590. if (wasteInfo.value.length > 0) {
  591. if (wasteInfo.value.some(item => item.rejectNum == '' || item.reason == '')) {
  592. uni.showToast({
  593. icon: 'none',
  594. title: '请填写废品量或废品原因再点击添加'
  595. })
  596. } else {
  597. wasteInfo.value.push({
  598. rejectNum: '',
  599. reason: ''
  600. })
  601. }
  602. } else {
  603. wasteInfo.value.push({
  604. rejectNum: store.dayworkInfo.processQualifiedNum > 0 ? store.dayworkInfo
  605. .processQualifiedNum - lotPreSumQualifiedNum.value - lotPreSumReject.value - workInfo.value
  606. .qualifiedNum > 0 ? store.dayworkInfo
  607. .processQualifiedNum - lotPreSumQualifiedNum.value - lotPreSumReject.value - workInfo.value
  608. .qualifiedNum : 1 : store.dayworkInfo.isLast == 1 ?
  609. store.dayworkInfo.lastLotQuantity - lotPreSumQualifiedNum.value - lotPreSumReject.value -
  610. workInfo.value.qualifiedNum > 0 ?
  611. store.dayworkInfo.lastLotQuantity - lotPreSumQualifiedNum.value - lotPreSumReject.value -
  612. workInfo.value.qualifiedNum : 1 : store.dayworkInfo.oneLotQuantity - lotPreSumQualifiedNum
  613. .value - lotPreSumReject.value -
  614. workInfo.value.qualifiedNum > 0 ?
  615. store.dayworkInfo.oneLotQuantity - lotPreSumQualifiedNum.value - lotPreSumReject.value -
  616. workInfo.value.qualifiedNum : 1,
  617. reason: ''
  618. })
  619. }
  620. }
  621. function handleDeleteWasteInfo(index) {
  622. wasteInfo.value.splice(index, 1);
  623. }
  624. function handleReasonChange(item) {
  625. if (wasteInfo.value.filter(waste => waste.reason == item.reason).length > 1) {
  626. wasteInfo.value.splice(wasteInfo.value.indexOf(item), 1);
  627. uni.showToast({
  628. icon: 'none',
  629. title: '请勿重复选择废品原因',
  630. duration: 2000
  631. })
  632. }
  633. }
  634. defineExpose({
  635. open
  636. })
  637. </script>
  638. <style lang="scss">
  639. .dialog-body {
  640. .list-container {
  641. width: 100%;
  642. display: flex;
  643. align-items: flex-start;
  644. padding: 0 4rpx;
  645. .list-title {
  646. width: 100%;
  647. margin-top: 16rpx;
  648. height: 64rpx;
  649. line-height: 64rpx;
  650. align-items: center;
  651. .label {
  652. flex: 1;
  653. font-size: 32rpx;
  654. }
  655. .input {
  656. width: 40%;
  657. height: 66rpx;
  658. padding-left: 10rpx;
  659. font-size: 22rpx;
  660. border: 1rpx solid #e1e1e1;
  661. border-radius: 8rpx;
  662. }
  663. .icon-gear {
  664. font-size: 56rpx;
  665. }
  666. }
  667. .switch {
  668. margin-top: -8rpx;
  669. align-items: center;
  670. transform: scale(0.7);
  671. }
  672. .confirmCarrier {
  673. .label {
  674. padding-top: 20rpx;
  675. font-size: 32rpx;
  676. }
  677. .vehicleList {
  678. justify-content: baseline;
  679. align-content: flex-start;
  680. flex-wrap: wrap;
  681. width: 100%;
  682. height: 120rpx;
  683. overflow: auto;
  684. .vehicleNo {
  685. padding: 0 10rpx;
  686. margin: 10rpx 20rpx 0 0;
  687. justify-content: space-between;
  688. align-items: center;
  689. width: auto;
  690. height: 60rpx;
  691. border: 2rpx solid rgba(213, 213, 213, 1);
  692. border-radius: 6rpx;
  693. }
  694. .blueBorder {
  695. background-color: #1684fc;
  696. color: #FFFFFF;
  697. }
  698. }
  699. }
  700. }
  701. .add-btn-container {
  702. margin-top: 32rpx;
  703. .btn {
  704. flex: 1;
  705. background-color: rgba(255, 85, 85, 1);
  706. color: #FFFFFF;
  707. margin-left: 5rpx;
  708. padding: 0;
  709. }
  710. .btnScan {
  711. flex: 1;
  712. color: #FFFFFF;
  713. margin-right: 5rpx;
  714. padding: 0;
  715. }
  716. }
  717. }
  718. .mask {
  719. position: fixed;
  720. top: 0;
  721. left: 0;
  722. right: 0;
  723. bottom: 0;
  724. background-color: rgba(0, 0, 0, 0.5);
  725. z-index: 20;
  726. display: flex;
  727. justify-content: center;
  728. align-items: center;
  729. }
  730. .mask .loading-text {
  731. color: #fff;
  732. font-size: 36rpx;
  733. }
  734. </style>