form.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="lot-info uni-column">
  4. <view class="lot-code uni-row">
  5. <text>批次号</text>
  6. <text style="margin-left: 24rpx;">{{ dayworkItem.lotCode }}</text>
  7. </view>
  8. <view class="product-info">
  9. 产品描述: {{ dayworkItem.productDescription }}
  10. </view>
  11. <view class="product-info">
  12. 原材料厂家: {{ dayworkInfo.furnaceNoInfo.factory }}
  13. </view>
  14. <view class="product-info">
  15. 投产数量: {{ dayworkItem.prodNum }}
  16. </view>
  17. </view>
  18. <!-- 不合格信息 -->
  19. <view class="title unfit-title uni-row">
  20. <text>不合格信息</text>
  21. <view v-if="Number(dayworkItem.status) < 3" class="add-btn" @click="handleAddUnfit">添加</view>
  22. </view>
  23. <view class="unfit-container">
  24. <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
  25. <view class="title uni-row">
  26. <text>检查标准-{{ item.checkStandard }}</text>
  27. <uni-icons v-if="Number(dayworkItem.status) < 3" type="trash" size="24" color="#fc6565"
  28. @click="handleDelUnfit(index)" />
  29. </view>
  30. <!-- <view class="standard">检查标准:{{ item.checkStandard }}</view> -->
  31. <view class="result uni-row" style="display: flex;flex-direction: row;justify-content: space-between;">
  32. <!-- align-items: flex-start; -->
  33. <view class="label" style="padding-right: 16rpx;flex: 0 1 auto; min-width: 118rpx;">
  34. 检查结果</view>
  35. <input v-if="Number(dayworkItem.status) < 3" v-model="item.reason" placeholder="请输入检查结果" />
  36. <span v-else style="flex-grow: 1;">{{ item.reason }}</span>
  37. <view class="label"
  38. style="text-align: right; padding-right: 16rpx;flex: 0 1 auto; min-width: 68rpx;">数量</view>
  39. <input v-if="Number(dayworkItem.status) < 3" class="number" type="number" v-model="item.rejectNum"
  40. @blur="rejectNumberChange" />
  41. <span v-else>{{ item.rejectNum }}</span>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 咨询部分 -->
  46. <view class="title">咨询</view>
  47. <view class="consultation-container uni-column">
  48. <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
  49. <view class="question uni-column">
  50. <view class="label uni-row">
  51. <text>问题描述</text>
  52. <text :style="{ color: showStatusColor(item.status) }">{{item.consultDepartment == 0?'技术':'品管'}} {{ showStatus(item.status) }}</text>
  53. </view>
  54. <view class="content">{{ item.content }}</view>
  55. </view>
  56. <!-- <view v-if="item.answer !== ''" class="answer"
  57. style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
  58. <view class="label">回复</view>
  59. <view class="content">{{ item.answer }}</view>
  60. </view> -->
  61. </view>
  62. </view>
  63. <!-- 零存库部分 -->
  64. <view class="title">零存库</view>
  65. <view class="consultation-container ">
  66. <view class="title unfit-title uni-row">
  67. <view class="title">零取</view>
  68. <view class="add-btn" v-if="Number(dayworkItem.status) < 3" style="background-color: #409eff;" @click="handleAddLot">添加</view>
  69. </view>
  70. <view >
  71. <zb-table v-if="Number(dayworkItem.status) < 3"
  72. :columns="column1"
  73. :stripe="true"
  74. :fit="true"
  75. @dele="dele"
  76. :data="retrievalInfo"></zb-table>
  77. <zb-table v-else
  78. :columns="column2"
  79. :stripe="true"
  80. :fit="true"
  81. @dele="dele"
  82. :data="retrievalInfo"></zb-table>
  83. <!-- <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据" >
  84. <uni-tr >
  85. <uni-th style="font-size: 25rpx;" width="atuo" align="center">批次号</uni-th>
  86. <uni-th style="font-size: 25rpx;" width="120" align="center">数量</uni-th>
  87. <uni-th v-if="Number(dayworkItem.status) < 3" style="font-size: 25rpx;" width="80" align="center">操作</uni-th>
  88. </uni-tr>
  89. <uni-tr v-for="(item, index) in retrievalInfo" :key="index">
  90. <uni-th style="font-size: 24rpx;" width="auto" align="center">{{ item.lotCode }}</uni-th>
  91. <uni-th style="font-size: 25rpx;" width="120" align="center">
  92. {{ item.storageNum }}
  93. </uni-th>
  94. <uni-th v-if="Number(dayworkItem.status) < 3 && item.status == 0" align="center" width="80">
  95. <uni-icons type="closeempty" size="22" @click="handleDelete(item)"></uni-icons>
  96. </uni-th>
  97. </uni-tr>
  98. </uni-table> -->
  99. </view>
  100. <view v-if="saveFlag" class='middle'>
  101. <view class='segment'></view>
  102. <view class='segment'></view>
  103. </view>
  104. <view v-if="saveFlag" class="title unfit-title uni-row">
  105. <view class="title">零存</view>
  106. </view>
  107. <view v-if="saveFlag" class="save uni-row">
  108. <text class="label">存入数量</text>
  109. <input class="number" type="number" v-if="!(storageInfo.status == 1 || Number(dayworkItem.status) >= 3 || storageInfo.id)" placeholder="请输入" v-model="storageNum" />
  110. <span style="margin-left: 56rpx;flex: 1;" v-else>{{ storageNum }}</span>
  111. </view>
  112. </view>
  113. <!-- 报工部分 -->
  114. <view class="daywork-container">
  115. <view class="result uni-row">
  116. <view class="label">合格量</view>
  117. <input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入合格量"
  118. v-model="dayworkItem.qualifiedNum" />
  119. <span v-else>{{ dayworkItem.qualifiedNum }}</span>
  120. <view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
  121. <input v-if="Number(dayworkItem.status) < 3" :disabled="true" type="number" placeholder="请输入废品量"
  122. v-model="dayworkItem.rejectNum" />
  123. <span v-else>{{ dayworkItem.rejectNum }}</span>
  124. </view>
  125. <view class="remark uni-row">
  126. <view class="label">备注</view>
  127. <textarea v-if="Number(dayworkItem.status) < 3" v-model="dayworkItem.remark" />
  128. <span v-else>{{ dayworkItem.remark }}</span>
  129. </view>
  130. <view class="btns-container uni-row">
  131. <!-- 最后一步完成不能更换载具 -->
  132. <view v-if="dayworkItem.daywork != null && dayworkItem.daywork.status != 2" class="bottom-btn left-btn "
  133. @click="handleChangeCarrier">
  134. 更换载具</view>
  135. <view v-if="checkFinishable()&&Number(dayworkItem.status) < 3" class="finished-btn"
  136. @click.stop="handleFinishDaywork">结束报工</view>
  137. <view v-if="!checkFinishable()&&Number(dayworkItem.status) < 3" class="pause-btn"
  138. @click.stop="handleUpdateDaywork">暂停</view>
  139. <view v-if="Number(dayworkItem.status) < 3" class="question-btn uni-column"
  140. @click.stop="handleAddConsultation">
  141. <uni-icons type="headphones" size="24" />
  142. <text>咨询</text>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. </template>
  148. <script setup>
  149. import {
  150. ref
  151. } from 'vue'
  152. import {
  153. onMounted,
  154. getCurrentInstance
  155. } from 'vue';
  156. import {
  157. getSortingDayworkItem,
  158. saveConsult,
  159. finish,
  160. update
  161. } from '@/api/business/sortDaywork.js'
  162. import {
  163. getTakeStockPeriod
  164. } from '@/api/business/taksStackLot.js'
  165. import {
  166. onLoad,
  167. onReady,
  168. onUnload,
  169. onShow
  170. } from '@dcloudio/uni-app'
  171. import {
  172. store
  173. } from '@/store/index.js'
  174. import {
  175. timestampToTime,
  176. toHHmmss
  177. } from '@/utils/common.js'
  178. const isEventTriggered = ref(false); // 创建一个标志位
  179. const unfitInfos = ref([])
  180. const consultations = ref([])
  181. const dayworkInfo = ref({})
  182. const retrievalInfo = ref([])
  183. // 创建一个引用来存储最后一次请求的时间戳
  184. const lastRequestTimestamp = ref(0);
  185. const dayworkItem = ref({})
  186. const saveFlag = ref(false)
  187. const storageNum = ref(null)
  188. const storageInfo = ref(null)
  189. const column1 = [
  190. { name: 'lotCode', label: '批次号',align:'center'},
  191. { name: 'storageNum', label: '数量',align:'center' },
  192. { name: 'operation', type:'operation',label: '操作',align:'center',renders:[
  193. {
  194. name:'删除',
  195. type:'warn',
  196. func:"dele",
  197. class:"buttonOp"
  198. },
  199. ]},
  200. ]
  201. const column2 = [
  202. { name: 'lotCode', label: '批次号',align:'center'},
  203. { name: 'storageNum', label: '数量',align:'center' },
  204. ]
  205. /***************************** 页面生命周期函数 *****************************/
  206. onLoad(()=>{
  207. })
  208. onShow(() => {
  209. uni.$off('addInfoEvent');
  210. })
  211. onMounted(() => {
  212. const instance = getCurrentInstance().proxy
  213. const eventChannel = instance.getOpenerEventChannel();
  214. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  215. if (data && data.data) {
  216. dayworkInfo.value = data.data
  217. init({
  218. id: data.data.id
  219. })
  220. } else {
  221. let reqParam = {
  222. id: dayworkInfo.value.id
  223. }
  224. init(reqParam);
  225. }
  226. })
  227. })
  228. /***************************** 定义了一些方法 *****************************/
  229. const init = (data) => {
  230. console.log("dayworkInfo", dayworkInfo.value);
  231. // 获取当前报工信息
  232. getSortingDayworkItem(data).then(res => {
  233. console.log(res)
  234. if (res.code === 200) {
  235. dayworkItem.value = res.data
  236. //判断是否显示零存
  237. if(dayworkItem.value.processStepNumber == dayworkInfo.value.processSequence[dayworkInfo.value.processSequence.length - 1].processStepNumber) {
  238. saveFlag.value = true
  239. }else{
  240. saveFlag.value = false
  241. }
  242. console.log(dayworkItem.value)
  243. if (dayworkItem.value.qualifiedNum === 0 && dayworkItem.value.rejectNum === 0) {
  244. dayworkItem.value.qualifiedNum = res.data.prodNum
  245. }
  246. retrievalInfo.value = res.data.retrievalInfo
  247. storageInfo.value = res.data.storageInfo
  248. console.log(Object.keys(storageInfo.value).length === 0)
  249. if(Object.keys(storageInfo.value).length !== 0) {
  250. storageNum.value = storageInfo.value.storageNum
  251. }
  252. consultations.value = res.data.consults
  253. unfitInfos.value = res.data.rejectList
  254. } else {
  255. uni.showToast({
  256. icon: 'none',
  257. title: res.message
  258. })
  259. }
  260. })
  261. }
  262. const addInfo = (data) => {
  263. data.forEach(item=>{
  264. console.log(retrievalInfo.value)
  265. retrievalInfo.value.push(item)
  266. })
  267. console.log(data)
  268. uni.$off('addInfoEvent');
  269. }
  270. //添加零取批次
  271. function handleAddLot() {
  272. console.log('調用 handleAddLot')
  273. uni.$on('addInfoEvent', (data) => {
  274. addInfo(data.data)
  275. })
  276. console.log(dayworkItem.value)
  277. const info = {
  278. deptId:dayworkItem.value.deptId,
  279. productId:dayworkItem.value.daywork.productId,
  280. drawingNumber:dayworkItem.value.drawingNumber,
  281. technologyVersion:dayworkItem.value.technologyVersion,
  282. retrievalLotId:dayworkItem.value.lotId,
  283. hasAddedList : retrievalInfo.value
  284. }
  285. // 将 info 对象转换为 JSON 字符串
  286. const serializedData = JSON.stringify(info);
  287. // 对 JSON 字符串进行 URL 编码
  288. const encodedData = encodeURIComponent(serializedData);
  289. // 构建 URL,确保使用正确编码的数据
  290. uni.navigateTo({
  291. url: `/pages/sorting/storageRetrieval?data=${encodedData}`
  292. });
  293. }
  294. const addUnfitInfo = (data) => {
  295. console.log(data)
  296. if (data.index > unfitInfos.value.length) {
  297. const info = {
  298. inspectionInstructionId: data.id,
  299. title: data.title,
  300. standard: data.standard,
  301. checkStandard: data.standard,
  302. type: data.type,
  303. reason: ''
  304. }
  305. unfitInfos.value.push(info)
  306. }
  307. }
  308. function dele(ite,index) {
  309. if(ite.status == 1){
  310. uni.showToast({
  311. icon: 'none',
  312. title: '已被领取,不能删除'
  313. })
  314. }else{
  315. retrievalInfo.value.splice(index, 1);
  316. }
  317. }
  318. const addConsultation = (data) => {
  319. const info = {
  320. dayworkItemId: dayworkItem.value.id,
  321. content: data.content,
  322. userId: store.userInfo.userId,
  323. nickName: store.userInfo.nickName,
  324. dayworkId: dayworkItem.value.dayworkId,
  325. productionPlandetailId: dayworkItem.value.productionPlandetailId,
  326. productionPlanDetailSubDetailId: dayworkItem.value.productionPlanDetailSubDetailId,
  327. lotId: dayworkItem.value.lotId,
  328. lotCode: dayworkItem.value.lotCode,
  329. productId: dayworkItem.value.productId,
  330. productDescription: dayworkItem.value.productDescription,
  331. technologicalProcessId: dayworkItem.value.technologicalProcessId,
  332. technologicalProcessDetailId: dayworkItem.value.technologicalProcessDetailId,
  333. processId: dayworkItem.value.processId,
  334. processAlias: dayworkItem.value.process.processAlias,
  335. technicianId: dayworkItem.value.technicianId,
  336. departments : data.departments,
  337. pictures : data.pictures
  338. }
  339. saveConsult(info).then(res => {
  340. if (res.code === 200) {
  341. consultations.value = res.data
  342. console.log(consultations.value)
  343. } else {
  344. uni.showToast({
  345. icon: 'none',
  346. title: res.message
  347. })
  348. }
  349. })
  350. isEventTriggered.value = true; // 更新标志位状态
  351. consultations.value.push(info)
  352. }
  353. /***************************** 定义了一些事件 *****************************/
  354. // 添加不合格信息
  355. const handleAddUnfit = () => {
  356. // 监听事件
  357. uni.$once('addUnfitInfoEvent', (data) => {
  358. addUnfitInfo(data)
  359. })
  360. // console.log(dayworkItem.value)
  361. uni.navigateTo({
  362. url: "/pages/sorting/options",
  363. success: (res) => {
  364. // 通过eventChannel向被打开页面传送数据
  365. res.eventChannel.emit('acceptDataFromOpenerPage', {
  366. data: dayworkItem.value,
  367. query: {
  368. productId: dayworkItem.value.daywork.productId,
  369. processId: dayworkItem.value.process.id,
  370. // technologyVersion: dayworkItem.value.technologicalProcessDetail.technologyVersion
  371. technologyVersion: dayworkItem.value.technologyVersion
  372. },
  373. index: unfitInfos.value.length
  374. })
  375. }
  376. })
  377. }
  378. // 删除不合格信息
  379. const handleDelUnfit = (index) => {
  380. let tempInfo = unfitInfos.value[index]
  381. console.log(tempInfo)
  382. uni.showModal({
  383. title: '提示',
  384. content: '确定删除该项?',
  385. success: function(res) {
  386. if (res.confirm) {
  387. dayworkItem.value.rejectNum = dayworkItem.value.rejectNum - tempInfo.rejectNum
  388. dayworkItem.value.qualifiedNum = parseInt(dayworkItem.value.qualifiedNum) + parseInt(
  389. tempInfo.rejectNum)
  390. unfitInfos.value.splice(index, 1)
  391. } else if (res.cancel) {
  392. return
  393. }
  394. }
  395. })
  396. }
  397. /* 更换载具*/
  398. function handleChangeCarrier(item) {
  399. // uni.$once('refreshQuickReport', () => {
  400. // init()
  401. // })
  402. store.dayworkInfo = null
  403. uni.navigateTo({
  404. url: "/pages/changeBox/index",
  405. success: function(res) {
  406. // 通过eventChannel向被打开页面传送数据
  407. res.eventChannel.emit('sortingFromOpenerPage', {
  408. data: dayworkItem.value
  409. })
  410. }
  411. })
  412. }
  413. // 添加不合格信息
  414. const handleAddConsultation = () => {
  415. isEventTriggered.value = false; // 更新标志位状态
  416. // 监听事件
  417. uni.$once('addConsulttationEvent', (data) => {
  418. if (!isEventTriggered.value) {
  419. // 如果事件尚未触发,则执行事件触发逻辑
  420. addConsultation(data)
  421. }
  422. })
  423. uni.navigateTo({
  424. url: "/pages/sorting/consultation",
  425. success: (res) => {
  426. // 通过eventChannel向被打开页面传送数据
  427. res.eventChannel.emit('acceptDataFromOpenerPage', {
  428. data: dayworkItem.value
  429. })
  430. }
  431. })
  432. }
  433. const checkFinishable = () => {
  434. if (consultations.value.findIndex(v => v.status === 0) >= 0) {
  435. return false
  436. } else {
  437. return true
  438. }
  439. }
  440. const showStatus = (status) => {
  441. // console.log(status)
  442. switch (status) {
  443. case 0:
  444. return '未确认'
  445. case 1:
  446. return '不合格'
  447. case 2:
  448. return '合格'
  449. default:
  450. return ''
  451. }
  452. }
  453. const showStatusColor = (status) => {
  454. // console.log(status)
  455. switch (status) {
  456. case 0:
  457. return '#fcab53'
  458. case 1:
  459. return '#fc044f'
  460. case 2:
  461. return '#1deb19'
  462. default:
  463. return ''
  464. }
  465. }
  466. const rejectNumberChange = () => {
  467. let sumReject = 0
  468. unfitInfos.value.forEach(v => {
  469. sumReject += v.rejectNum == null ? 0 : Number(v.rejectNum)
  470. })
  471. dayworkItem.value.rejectNum = sumReject
  472. dayworkItem.value.qualifiedNum = dayworkItem.value.prodNum - sumReject
  473. console.log(dayworkItem.value)
  474. }
  475. const validHandle = () => {
  476. console.log(storageNum.value == "")
  477. if(storageNum.value != null &&storageNum.value != "" && storageNum.value<=0) {
  478. uni.showToast({
  479. icon: 'none',
  480. title: "存入数量应大于0",
  481. duration: 2000
  482. })
  483. return false;
  484. }
  485. for (let i = 0; i < unfitInfos.value.length; i++) {
  486. const e = unfitInfos.value[i]
  487. if (e.rejectNum == null || e.rejectNum == 0) {
  488. uni.showToast({
  489. icon: 'none',
  490. title: `第${i + 1}条不合格信息未输入不合格数量`
  491. })
  492. return false
  493. }
  494. }
  495. if (!dayworkItem.value.qualifiedNum) {
  496. uni.showToast({
  497. icon: 'none',
  498. title: "合格数不能为空",
  499. duration: 2000
  500. })
  501. return false;
  502. }
  503. if (dayworkItem.value.qualifiedNum < 0) {
  504. uni.showToast({
  505. icon: 'none',
  506. title: "合格数不能为负数,请检查不合格信息后提交",
  507. duration: 2000
  508. })
  509. return false;
  510. }
  511. return true
  512. // unfitInfos.value.forEach((e, i) => {
  513. // if (e.name)
  514. // })
  515. }
  516. async function handleCheckStock() {
  517. let currentProcessStepNumber = dayworkInfo.value.currentProcess.processStepNumber;
  518. let lastProcess = dayworkInfo.value.processSequence[dayworkInfo.value.processSequence.length - 1];
  519. // 判断当前工序是否是最后一道序
  520. if (currentProcessStepNumber === lastProcess.processStepNumber) {
  521. // 等待 getTakeStockPeriod() 的 Promise 完成
  522. const res = await getTakeStockPeriod({dayworkId: dayworkInfo.value.id});
  523. console.log(res.data.length);
  524. if (res.data.length > 0) {
  525. uni.showToast({
  526. icon: 'none',
  527. title: "此次盘点未结束,不能结束报工",
  528. duration: 2000
  529. });
  530. return false; // 如果盘点未结束,返回 false
  531. }
  532. }
  533. // 如果不是最后一道工序或盘点已结束,返回 true
  534. return true;
  535. }
  536. async function handleFinishDaywork() {
  537. if (!validHandle()) {
  538. return
  539. }
  540. //判断当前批次是否在盘点,如果盘点未结束,则不能结束报工
  541. let checkStockResult = await handleCheckStock();
  542. console.log(checkStockResult)
  543. if(!checkStockResult ) {
  544. return;
  545. }
  546. //零存数据
  547. if(storageNum.value != null&& storageNum.value != "" ) {
  548. if(Object.keys(storageInfo.value).length === 0){
  549. storageInfo.value = {
  550. productionPlanDetailId:dayworkItem.value.productionPlanDetailId,
  551. productDescription:dayworkItem.value.productDescription,
  552. drawingNumber:dayworkItem.value.drawingNumber,
  553. lotId:dayworkItem.value.lotId,
  554. lotCode:dayworkItem.value.lotCode,
  555. deptId:dayworkItem.value.deptId,
  556. productId:dayworkItem.value.daywork.productId,
  557. technologyVersion:dayworkItem.value.technologyVersion,
  558. storageNum:storageNum.value,
  559. storagerId:store.userInfo.userId,
  560. }
  561. }
  562. else{
  563. storageInfo.value.storageNum = storageNum.value
  564. }
  565. }else{
  566. storageInfo.value = null
  567. }
  568. //零取数据
  569. if(retrievalInfo.value.length >0) {
  570. retrievalInfo.value.forEach(item =>{
  571. item.retrievalLotId = dayworkItem.value.lotId,
  572. item.retrievalLotCode = dayworkItem.value.lotCode,
  573. item.retrievalerId = store.userInfo.userId,
  574. item.retrievalTime = timestampToTime(new Date())
  575. })
  576. }
  577. const saveData = {
  578. rejectList: unfitInfos.value,
  579. consult: consultations.value,
  580. id: dayworkItem.value.id,
  581. prodNum: dayworkItem.value.prodNum,
  582. rejectNum: dayworkItem.value.rejectNum,
  583. qualifiedNum: dayworkItem.value.qualifiedNum,
  584. remark: dayworkItem.value.remark,
  585. storageInfo:storageInfo.value,
  586. retrievalInfo:retrievalInfo.value
  587. }
  588. const currentTime = Date.now();
  589. // 检查是否已经过去了 2 秒
  590. if (currentTime - lastRequestTimestamp.value < 2000) {
  591. // 如果在 2 秒 内已经点击,那么不执行
  592. uni.showToast({
  593. icon: 'none',
  594. title: `请勿重复点击`,
  595. duration: 2000
  596. })
  597. return;
  598. }
  599. console.log(saveData)
  600. finish(saveData).then(res => {
  601. if (res.code === 200) {
  602. uni.navigateBack()
  603. } else {
  604. uni.showToast({
  605. icon: 'none',
  606. title: res.message
  607. })
  608. }
  609. })
  610. }
  611. const handleUpdateDaywork = () => {
  612. if (!validHandle()) {
  613. return
  614. }
  615. //零存数据
  616. if(storageNum.value != null&& storageNum.value != "" ) {
  617. if(Object.keys(storageInfo.value).length === 0){
  618. storageInfo.value = {
  619. productionPlanDetailId:dayworkItem.value.productionPlanDetailId,
  620. productDescription:dayworkItem.value.productDescription,
  621. drawingNumber:dayworkItem.value.drawingNumber,
  622. lotId:dayworkItem.value.lotId,
  623. lotCode:dayworkItem.value.lotCode,
  624. deptId:dayworkItem.value.deptId,
  625. productId:dayworkItem.value.daywork.productId,
  626. technologyVersion:dayworkItem.value.technologyVersion,
  627. storageNum:storageNum.value,
  628. storagerId:store.userInfo.userId,
  629. }
  630. }
  631. else{
  632. storageInfo.value.storageNum = storageNum.value
  633. }
  634. }else{
  635. storageInfo.value = null
  636. }
  637. //零取数据
  638. if(retrievalInfo.value.length >0) {
  639. retrievalInfo.value.forEach(item =>{
  640. item.retrievalLotId = dayworkItem.value.lotId,
  641. item.retrievalLotCode = dayworkItem.value.lotCode,
  642. item.retrievalerId = store.userInfo.userId,
  643. item.retrievalTime = timestampToTime(new Date())
  644. })
  645. }
  646. const saveData = {
  647. rejectList: unfitInfos.value,
  648. consult: consultations.value,
  649. id: dayworkItem.value.id,
  650. prodNum: dayworkItem.value.prodNum,
  651. rejectNum: dayworkItem.value.rejectNum,
  652. qualifiedNum: dayworkItem.value.qualifiedNum,
  653. remark: dayworkItem.value.remark,
  654. storageInfo:storageInfo.value,
  655. retrievalInfo:retrievalInfo.value
  656. }
  657. console.log(saveData)
  658. update(saveData).then(res => {
  659. if (res.code === 200) {
  660. uni.$emit("formBack")
  661. uni.navigateBack()
  662. } else {
  663. uni.showToast({
  664. icon: 'none',
  665. title: res.message
  666. })
  667. }
  668. })
  669. }
  670. </script>
  671. <style lang="scss">
  672. .buttonOp {
  673. margin-top: 5px;
  674. }
  675. .page-container {
  676. height: 100%;
  677. background-color: #ececec;
  678. font-size: 28rpx;
  679. >.title {
  680. font-weight: 700;
  681. margin: 24rpx 16rpx;
  682. }
  683. }
  684. .add-btn {
  685. padding: 12rpx 32rpx;
  686. background-color: #a4adb3;
  687. color: #ffffff;
  688. border-radius: 12rpx;
  689. font-size: 24rpx;
  690. }
  691. .lot-info {
  692. margin: 32rpx 16rpx 0 16rpx;
  693. padding: 24rpx;
  694. background-color: #ffffff;
  695. border-radius: 8rpx;
  696. .lot-code {
  697. font-size: 32rpx;
  698. font-weight: 700;
  699. margin-bottom: 16rpx;
  700. }
  701. .product-info {
  702. font-size: 28rpx;
  703. color: #9f9f9f;
  704. }
  705. }
  706. .middle {
  707. display: flex;
  708. flex-direction: row;
  709. align-items: center;
  710. justify-content: center
  711. }
  712. .segment {
  713. width: 80%;
  714. background-color: rgba(213, 213, 213, 1);
  715. border: 1rpx solid rgba(213, 213, 213, 1);
  716. margin: 16px 0;
  717. }
  718. .unfit-title {
  719. margin-bottom: 24rpx;
  720. justify-content: space-between;
  721. align-items: center;
  722. text {
  723. font-size: 28rpx;
  724. font-weight: 700;
  725. }
  726. .add-btn {
  727. padding: 12rpx 32rpx;
  728. background-color: #a4adb3;
  729. color: #ffffff;
  730. border-radius: 12rpx;
  731. font-size: 24rpx;
  732. }
  733. }
  734. .save {
  735. align-items: center;
  736. padding-bottom: 32rpx;
  737. justify-content: space-between;
  738. input {
  739. height: 56rpx;
  740. border: 1px solid #9f9f9f;
  741. font-size: 28rpx;
  742. &.number {
  743. width: 60%;
  744. text-align: center;
  745. }
  746. }
  747. }
  748. .unfit-container {
  749. padding: 24rpx;
  750. margin: 0 16rpx;
  751. background-color: #ffffff;
  752. border-radius: 12rpx;
  753. .unfit-item-container {
  754. position: relative;
  755. >* {
  756. margin-bottom: 24rpx;
  757. }
  758. .title {
  759. font-weight: 700;
  760. justify-content: space-between;
  761. align-items: center;
  762. image {
  763. width: 40rpx;
  764. height: 40rpx;
  765. }
  766. }
  767. .standard {}
  768. .result {
  769. align-items: center;
  770. border-bottom: 1px solid #9f9f9f;
  771. padding-bottom: 32rpx;
  772. .label {
  773. flex: 1;
  774. }
  775. input {
  776. width: 280rpx;
  777. height: 56rpx;
  778. border: 1px solid #9f9f9f;
  779. font-size: 28rpx;
  780. &.number {
  781. width: 104rpx;
  782. text-align: center;
  783. }
  784. }
  785. }
  786. }
  787. .unfit-item-container:last-child {
  788. .result {
  789. border-bottom: none;
  790. padding-bottom: 0;
  791. }
  792. }
  793. }
  794. .consultation-container {
  795. margin: 0 16rpx;
  796. padding: 24rpx;
  797. background-color: #ffffff;
  798. border-radius: 8rpx;
  799. .consultation-item-container {
  800. margin-bottom: 24rpx;
  801. border-bottom: 2px solid #888888;
  802. padding-bottom: 24rpx;
  803. }
  804. .consultation-item-container:last-child {
  805. margin-bottom: 0;
  806. border-bottom: 0;
  807. padding-bottom: 0;
  808. }
  809. .question,
  810. .answer {
  811. .label {
  812. justify-content: space-between;
  813. margin-bottom: 16rpx;
  814. font-weight: 700;
  815. }
  816. .content {
  817. line-height: 40rpx;
  818. }
  819. }
  820. .answer {
  821. margin-top: 24rpx;
  822. }
  823. }
  824. .daywork-container {
  825. margin-top: 24rpx;
  826. padding: 24rpx;
  827. background-color: #ffffff;
  828. border: 1px solid #bcbcbc;
  829. .result {
  830. align-items: center;
  831. .label {
  832. width: 112rpx;
  833. }
  834. input {
  835. flex: 1;
  836. height: 56rpx;
  837. border: 1px solid #9f9f9f;
  838. font-size: 28rpx;
  839. text-align: center;
  840. }
  841. }
  842. .remark {
  843. margin-top: 24rpx;
  844. .label {
  845. width: 112rpx;
  846. }
  847. textarea {
  848. flex: 1;
  849. border: 1px solid #9f9f9f;
  850. height: 168rpx;
  851. }
  852. }
  853. .btns-container {
  854. margin-top: 24rpx;
  855. .bottom-btn {
  856. display: flex;
  857. flex: 1;
  858. height: 80rpx;
  859. background-color: #5555ff;
  860. color: #ffffff;
  861. text-align: center;
  862. justify-content: center;
  863. align-items: center;
  864. border-radius: 8rpx;
  865. margin-right: 10rpx;
  866. &.left-btn {
  867. background-color: rgba(85, 85, 255, 1.0);
  868. }
  869. &.right-btn {
  870. margin-left: 24rpx;
  871. }
  872. }
  873. .finished-btn {
  874. display: flex;
  875. flex: 1;
  876. height: 80rpx;
  877. background-color: #fc6565;
  878. color: #ffffff;
  879. text-align: center;
  880. justify-content: center;
  881. align-items: center;
  882. border-radius: 8rpx;
  883. }
  884. .pause-btn {
  885. display: flex;
  886. flex: 1;
  887. height: 80rpx;
  888. background-color: #55d90d;
  889. color: #ffffff;
  890. text-align: center;
  891. justify-content: center;
  892. align-items: center;
  893. border-radius: 8rpx;
  894. }
  895. .question-btn {
  896. width: 80rpx;
  897. align-items: flex-end;
  898. image {
  899. width: 48rpx;
  900. height: 48rpx;
  901. }
  902. text {
  903. font-size: 24rpx;
  904. }
  905. }
  906. }
  907. }
  908. .zb-table .item-tr {
  909. flex-direction: row;
  910. }
  911. </style>