form.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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.technologicalProcessDetail.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
  371. .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. if(storageNum.value != null && storageNum.value<0) {
  477. uni.showToast({
  478. icon: 'none',
  479. title: "存入数量应大于0",
  480. duration: 2000
  481. })
  482. return false;
  483. }
  484. for (let i = 0; i < unfitInfos.value.length; i++) {
  485. const e = unfitInfos.value[i]
  486. if (e.rejectNum == null || e.rejectNum == 0) {
  487. uni.showToast({
  488. icon: 'none',
  489. title: `第${i + 1}条不合格信息未输入不合格数量`
  490. })
  491. return false
  492. }
  493. }
  494. if (!dayworkItem.value.qualifiedNum) {
  495. uni.showToast({
  496. icon: 'none',
  497. title: "合格数不能为空",
  498. duration: 2000
  499. })
  500. return false;
  501. }
  502. if (dayworkItem.value.qualifiedNum < 0) {
  503. uni.showToast({
  504. icon: 'none',
  505. title: "合格数不能为负数,请检查不合格信息后提交",
  506. duration: 2000
  507. })
  508. return false;
  509. }
  510. return true
  511. // unfitInfos.value.forEach((e, i) => {
  512. // if (e.name)
  513. // })
  514. }
  515. async function handleCheckStock() {
  516. let currentProcessStepNumber = dayworkInfo.value.currentProcess.processStepNumber;
  517. let lastProcess = dayworkInfo.value.processSequence[dayworkInfo.value.processSequence.length - 1];
  518. // 判断当前工序是否是最后一道序
  519. if (currentProcessStepNumber === lastProcess.processStepNumber) {
  520. // 等待 getTakeStockPeriod() 的 Promise 完成
  521. const res = await getTakeStockPeriod({dayworkId: dayworkInfo.value.id});
  522. console.log(res.data.length);
  523. if (res.data.length > 0) {
  524. uni.showToast({
  525. icon: 'none',
  526. title: "此次盘点未结束,不能结束报工",
  527. duration: 2000
  528. });
  529. return false; // 如果盘点未结束,返回 false
  530. }
  531. }
  532. // 如果不是最后一道工序或盘点已结束,返回 true
  533. return true;
  534. }
  535. async function handleFinishDaywork() {
  536. if (!validHandle()) {
  537. return
  538. }
  539. //判断当前批次是否在盘点,如果盘点未结束,则不能结束报工
  540. let checkStockResult = await handleCheckStock();
  541. console.log(checkStockResult)
  542. if(!checkStockResult ) {
  543. return;
  544. }
  545. //零存数据
  546. if(storageNum.value != null&& storageNum.value != "" ) {
  547. if(Object.keys(storageInfo.value).length === 0){
  548. storageInfo.value = {
  549. productionPlanDetailId:dayworkItem.value.productionPlanDetailId,
  550. productDescription:dayworkItem.value.productDescription,
  551. drawingNumber:dayworkItem.value.drawingNumber,
  552. lotId:dayworkItem.value.lotId,
  553. lotCode:dayworkItem.value.lotCode,
  554. deptId:dayworkItem.value.deptId,
  555. productId:dayworkItem.value.daywork.productId,
  556. technologyVersion:dayworkItem.value.technologicalProcessDetail.technologyVersion,
  557. storageNum:storageNum.value,
  558. storagerId:store.userInfo.userId,
  559. }
  560. }
  561. else{
  562. storageInfo.value.storageNum = storageNum.value
  563. }
  564. }else{
  565. storageInfo.value = null
  566. }
  567. //零取数据
  568. if(retrievalInfo.value.length >0) {
  569. retrievalInfo.value.forEach(item =>{
  570. item.retrievalLotId = dayworkItem.value.lotId,
  571. item.retrievalLotCode = dayworkItem.value.lotCode,
  572. item.retrievalerId = store.userInfo.userId,
  573. item.retrievalTime = timestampToTime(new Date())
  574. })
  575. }
  576. const saveData = {
  577. rejectList: unfitInfos.value,
  578. consult: consultations.value,
  579. id: dayworkItem.value.id,
  580. prodNum: dayworkItem.value.prodNum,
  581. rejectNum: dayworkItem.value.rejectNum,
  582. qualifiedNum: dayworkItem.value.qualifiedNum,
  583. remark: dayworkItem.value.remark,
  584. storageInfo:storageInfo.value,
  585. retrievalInfo:retrievalInfo.value
  586. }
  587. const currentTime = Date.now();
  588. // 检查是否已经过去了 2 秒
  589. if (currentTime - lastRequestTimestamp.value < 2000) {
  590. // 如果在 2 秒 内已经点击,那么不执行
  591. uni.showToast({
  592. icon: 'none',
  593. title: `请勿重复点击`,
  594. duration: 2000
  595. })
  596. return;
  597. }
  598. console.log(saveData)
  599. finish(saveData).then(res => {
  600. if (res.code === 200) {
  601. uni.navigateBack()
  602. } else {
  603. uni.showToast({
  604. icon: 'none',
  605. title: res.message
  606. })
  607. }
  608. })
  609. }
  610. const handleUpdateDaywork = () => {
  611. if (!validHandle()) {
  612. return
  613. }
  614. //零存数据
  615. if(storageNum.value != null&& storageNum.value != "" ) {
  616. if(Object.keys(storageInfo.value).length === 0){
  617. storageInfo.value = {
  618. productionPlanDetailId:dayworkItem.value.productionPlanDetailId,
  619. productDescription:dayworkItem.value.productDescription,
  620. drawingNumber:dayworkItem.value.drawingNumber,
  621. lotId:dayworkItem.value.lotId,
  622. lotCode:dayworkItem.value.lotCode,
  623. deptId:dayworkItem.value.deptId,
  624. productId:dayworkItem.value.daywork.productId,
  625. technologyVersion:dayworkItem.value.technologicalProcessDetail.technologyVersion,
  626. storageNum:storageNum.value,
  627. storagerId:store.userInfo.userId,
  628. }
  629. }
  630. else{
  631. storageInfo.value.storageNum = storageNum.value
  632. }
  633. }else{
  634. storageInfo.value = null
  635. }
  636. //零取数据
  637. if(retrievalInfo.value.length >0) {
  638. retrievalInfo.value.forEach(item =>{
  639. item.retrievalLotId = dayworkItem.value.lotId,
  640. item.retrievalLotCode = dayworkItem.value.lotCode,
  641. item.retrievalerId = store.userInfo.userId,
  642. item.retrievalTime = timestampToTime(new Date())
  643. })
  644. }
  645. const saveData = {
  646. rejectList: unfitInfos.value,
  647. consult: consultations.value,
  648. id: dayworkItem.value.id,
  649. prodNum: dayworkItem.value.prodNum,
  650. rejectNum: dayworkItem.value.rejectNum,
  651. qualifiedNum: dayworkItem.value.qualifiedNum,
  652. remark: dayworkItem.value.remark,
  653. storageInfo:storageInfo.value,
  654. retrievalInfo:retrievalInfo.value
  655. }
  656. console.log(saveData)
  657. update(saveData).then(res => {
  658. if (res.code === 200) {
  659. uni.$emit("formBack")
  660. uni.navigateBack()
  661. } else {
  662. uni.showToast({
  663. icon: 'none',
  664. title: res.message
  665. })
  666. }
  667. })
  668. }
  669. </script>
  670. <style lang="scss">
  671. .buttonOp {
  672. margin-top: 5px;
  673. }
  674. .page-container {
  675. height: 100%;
  676. background-color: #ececec;
  677. font-size: 28rpx;
  678. >.title {
  679. font-weight: 700;
  680. margin: 24rpx 16rpx;
  681. }
  682. }
  683. .add-btn {
  684. padding: 12rpx 32rpx;
  685. background-color: #a4adb3;
  686. color: #ffffff;
  687. border-radius: 12rpx;
  688. font-size: 24rpx;
  689. }
  690. .lot-info {
  691. margin: 32rpx 16rpx 0 16rpx;
  692. padding: 24rpx;
  693. background-color: #ffffff;
  694. border-radius: 8rpx;
  695. .lot-code {
  696. font-size: 32rpx;
  697. font-weight: 700;
  698. margin-bottom: 16rpx;
  699. }
  700. .product-info {
  701. font-size: 28rpx;
  702. color: #9f9f9f;
  703. }
  704. }
  705. .middle {
  706. display: flex;
  707. flex-direction: row;
  708. align-items: center;
  709. justify-content: center
  710. }
  711. .segment {
  712. width: 80%;
  713. background-color: rgba(213, 213, 213, 1);
  714. border: 1rpx solid rgba(213, 213, 213, 1);
  715. margin: 16px 0;
  716. }
  717. .unfit-title {
  718. margin-bottom: 24rpx;
  719. justify-content: space-between;
  720. align-items: center;
  721. text {
  722. font-size: 28rpx;
  723. font-weight: 700;
  724. }
  725. .add-btn {
  726. padding: 12rpx 32rpx;
  727. background-color: #a4adb3;
  728. color: #ffffff;
  729. border-radius: 12rpx;
  730. font-size: 24rpx;
  731. }
  732. }
  733. .save {
  734. align-items: center;
  735. padding-bottom: 32rpx;
  736. justify-content: space-between;
  737. input {
  738. height: 56rpx;
  739. border: 1px solid #9f9f9f;
  740. font-size: 28rpx;
  741. &.number {
  742. width: 60%;
  743. text-align: center;
  744. }
  745. }
  746. }
  747. .unfit-container {
  748. padding: 24rpx;
  749. margin: 0 16rpx;
  750. background-color: #ffffff;
  751. border-radius: 12rpx;
  752. .unfit-item-container {
  753. position: relative;
  754. >* {
  755. margin-bottom: 24rpx;
  756. }
  757. .title {
  758. font-weight: 700;
  759. justify-content: space-between;
  760. align-items: center;
  761. image {
  762. width: 40rpx;
  763. height: 40rpx;
  764. }
  765. }
  766. .standard {}
  767. .result {
  768. align-items: center;
  769. border-bottom: 1px solid #9f9f9f;
  770. padding-bottom: 32rpx;
  771. .label {
  772. flex: 1;
  773. }
  774. input {
  775. width: 280rpx;
  776. height: 56rpx;
  777. border: 1px solid #9f9f9f;
  778. font-size: 28rpx;
  779. &.number {
  780. width: 104rpx;
  781. text-align: center;
  782. }
  783. }
  784. }
  785. }
  786. .unfit-item-container:last-child {
  787. .result {
  788. border-bottom: none;
  789. padding-bottom: 0;
  790. }
  791. }
  792. }
  793. .consultation-container {
  794. margin: 0 16rpx;
  795. padding: 24rpx;
  796. background-color: #ffffff;
  797. border-radius: 8rpx;
  798. .consultation-item-container {
  799. margin-bottom: 24rpx;
  800. border-bottom: 2px solid #888888;
  801. padding-bottom: 24rpx;
  802. }
  803. .consultation-item-container:last-child {
  804. margin-bottom: 0;
  805. border-bottom: 0;
  806. padding-bottom: 0;
  807. }
  808. .question,
  809. .answer {
  810. .label {
  811. justify-content: space-between;
  812. margin-bottom: 16rpx;
  813. font-weight: 700;
  814. }
  815. .content {
  816. line-height: 40rpx;
  817. }
  818. }
  819. .answer {
  820. margin-top: 24rpx;
  821. }
  822. }
  823. .daywork-container {
  824. margin-top: 24rpx;
  825. padding: 24rpx;
  826. background-color: #ffffff;
  827. border: 1px solid #bcbcbc;
  828. .result {
  829. align-items: center;
  830. .label {
  831. width: 112rpx;
  832. }
  833. input {
  834. flex: 1;
  835. height: 56rpx;
  836. border: 1px solid #9f9f9f;
  837. font-size: 28rpx;
  838. text-align: center;
  839. }
  840. }
  841. .remark {
  842. margin-top: 24rpx;
  843. .label {
  844. width: 112rpx;
  845. }
  846. textarea {
  847. flex: 1;
  848. border: 1px solid #9f9f9f;
  849. height: 168rpx;
  850. }
  851. }
  852. .btns-container {
  853. margin-top: 24rpx;
  854. .bottom-btn {
  855. display: flex;
  856. flex: 1;
  857. height: 80rpx;
  858. background-color: #5555ff;
  859. color: #ffffff;
  860. text-align: center;
  861. justify-content: center;
  862. align-items: center;
  863. border-radius: 8rpx;
  864. margin-right: 10rpx;
  865. &.left-btn {
  866. background-color: rgba(85, 85, 255, 1.0);
  867. }
  868. &.right-btn {
  869. margin-left: 24rpx;
  870. }
  871. }
  872. .finished-btn {
  873. display: flex;
  874. flex: 1;
  875. height: 80rpx;
  876. background-color: #fc6565;
  877. color: #ffffff;
  878. text-align: center;
  879. justify-content: center;
  880. align-items: center;
  881. border-radius: 8rpx;
  882. }
  883. .pause-btn {
  884. display: flex;
  885. flex: 1;
  886. height: 80rpx;
  887. background-color: #55d90d;
  888. color: #ffffff;
  889. text-align: center;
  890. justify-content: center;
  891. align-items: center;
  892. border-radius: 8rpx;
  893. }
  894. .question-btn {
  895. width: 80rpx;
  896. align-items: flex-end;
  897. image {
  898. width: 48rpx;
  899. height: 48rpx;
  900. }
  901. text {
  902. font-size: 24rpx;
  903. }
  904. }
  905. }
  906. }
  907. .zb-table .item-tr {
  908. flex-direction: row;
  909. }
  910. </style>